Skip to content

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.

Studio: scale spacing with the UI font size (#11458)

Michael Han10c380e92176
diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx
index 5fc14ca795a..546b8586059 100644
--- a/studio/frontend/src/app/provider.tsx
+++ b/studio/frontend/src/app/provider.tsx
@@ -45,6 +45,7 @@ import { useTauriUpdate } from "@/hooks/use-tauri-update";
import { isTauri } from "@/lib/api-base";
import { followDesktopUpdateScreen } from "@/lib/desktop-update-activity";
import { resyncInferenceStatusAfterServerModelChange } from "@/features/chat";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { getToastOffsets } from "@/lib/toast-offset";
import { Z_LAYER } from "@/lib/z-layers";
import { useRouterState } from "@tanstack/react-router";
@@ -530,10 +531,12 @@ const MAC_NATIVE_CHROME_STYLE = {
"--studio-content-top-inset": "0px",
"--studio-non-chat-content-top-inset": NATIVE_MAC_TITLEBAR_HEIGHT_VAR,
"--studio-hidden-route-top-inset": NATIVE_MAC_TITLEBAR_HEIGHT_VAR,
- "--studio-chat-header-height": "44px",
- "--studio-chat-header-padding-top": "9px",
- "--studio-media-header-left-inset": "0.5rem",
- "--studio-chat-control-height": "33px",
+ // Chat chrome holds text, so it follows the UI font size. The window
+ // geometry above does not: it is the OS window's, not ours.
+ "--studio-chat-header-height": "calc(44px * var(--ui-space-scale, 1))",
+ "--studio-chat-header-padding-top": "calc(9px * var(--ui-space-scale, 1))",
+ "--studio-media-header-left-inset": "calc(0.5rem * var(--ui-space-scale, 1))",
+ "--studio-chat-control-height": "calc(33px * var(--ui-space-scale, 1))",
"--studio-chat-header-right-inset": "0px",
} as CSSProperties;
@@ -547,10 +550,11 @@ const CUSTOM_CHROME_STYLE = {
"--studio-startup-top-inset": "42px",
"--studio-content-top-inset": "34px",
"--studio-hidden-route-top-inset": "34px",
- "--studio-chat-header-height": "48px",
- "--studio-chat-header-padding-top": "9px",
- "--studio-media-header-left-inset": "0.5rem",
- "--studio-chat-control-height": "33px",
+ // Same split as the native-mac block: chat chrome scales, window chrome does not.
+ "--studio-chat-header-height": "calc(48px * var(--ui-space-scale, 1))",
+ "--studio-chat-header-padding-top": "calc(9px * var(--ui-space-scale, 1))",
+ "--studio-media-header-left-inset": "calc(0.5rem * var(--ui-space-scale, 1))",
+ "--studio-chat-control-height": "calc(33px * var(--ui-space-scale, 1))",
"--studio-chat-header-right-inset": "0px",
"--studio-window-control-inset": "112px",
} as CSSProperties;
@@ -1000,10 +1004,12 @@ const REDUCED_MOTION_MAP = {
export function AppProvider({ children }: AppProviderProps) {
const pathname = useRouterState({ select: (s) => s.location.pathname });
+ const uiSpaceScale = useUiSpaceScale();
const toastOffsets = getToastOffsets(
pathname,
isTauri,
shouldUseCustomWindowTitlebar(),
+ uiSpaceScale,
);
const reduceMotion = useAppearanceCustomStore(
(s) => s.customization.reduceMotion,
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index f4ecf193714..4be3698f9ec 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -436,7 +436,7 @@ function NavBadge({ label, className }: { label: string; className?: string }) {
return (
<span
className={cn(
- "nav-badge inline-flex shrink-0 items-center justify-center rounded-full border border-nav-beta-border px-[5px] pt-[3px] pb-[2px] text-[calc(0.5rem*var(--ui-font-scale,1))] font-medium uppercase leading-none tracking-[0.04em] text-nav-fg-muted antialiased subpixel-antialiased shadow-[0_1px_2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]",
+ "nav-badge inline-flex shrink-0 items-center justify-center rounded-full border border-nav-beta-border px-[calc(5px*var(--ui-space-scale,1))] pt-[calc(3px*var(--ui-space-scale,1))] pb-[calc(2px*var(--ui-space-scale,1))] text-[calc(0.5rem*var(--ui-font-scale,1))] font-medium uppercase leading-none tracking-[0.04em] text-nav-fg-muted antialiased subpixel-antialiased shadow-[0_1px_2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]",
className,
)}
>
@@ -498,7 +498,7 @@ function NavItem({
data-tour={dataTour}
data-testid={testId}
data-spinner={spinner ? "true" : undefined}
- className="sidebar-nav-btn h-[33px] rounded-full gap-[8.5px] pl-3 pr-2.5 font-medium group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:!w-[32px] group-data-[collapsible=icon]:mx-auto"
+ className="sidebar-nav-btn h-[calc(33px*var(--ui-space-scale,1))] rounded-full gap-[calc(8.5px*var(--ui-space-scale,1))] pl-3 pr-2.5 font-medium group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:!w-[calc(32px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:mx-auto"
>
<HugeiconsIcon icon={icon} strokeWidth={1.75} className="size-icon! shrink-0 translate-x-0.5 group-hover/menu-button:animate-icon-pop" />
<span className="text-ui-14p5 leading-ui-19 tracking-nav">{label}</span>
@@ -578,7 +578,7 @@ function WorkflowChoice({
onClick={onSelect}
// Weight and colour come from the nav rows above; only the size sets a submenu apart.
className={cn(
- "flex h-[29px] w-full items-center gap-2 rounded-full pl-3 pr-2.5 text-left font-medium text-nav-fg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ "flex h-[calc(29px*var(--ui-space-scale,1))] w-full items-center gap-2 rounded-full pl-3 pr-2.5 text-left font-medium text-nav-fg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
active ? "bg-sidebar-accent" : "hover:bg-sidebar-accent/60",
!enabled && "opacity-40 hover:bg-transparent",
)}
@@ -2129,7 +2129,7 @@ export function AppSidebar() {
// Inside the scroller the rail already occupies that space. The profile footer also uses this
// padding deliberately: its width is independent of whether the recent-chat list has a scrollbar.
- const unrailedRowPadding = usesDesktopTitlebar ? "px-[5px]" : "px-1.5";
+ const unrailedRowPadding = usesDesktopTitlebar ? "px-[calc(5px*var(--ui-space-scale,1))]" : "px-1.5";
// Header actions end where a hovered row's "…" does: unrailedRowPadding + the
// action's own pr-1.5. 12px normally (the pr-3 class default), 11px here.
@@ -3217,17 +3217,17 @@ export function AppSidebar() {
? "sidebar-row-action sidebar-touch-reveal group-hover/project-chat-item:opacity-100 group-hover/project-chat-item:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto"
: "sidebar-row-action sidebar-touch-reveal group-hover/recent-item:opacity-100 group-hover/recent-item:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto";
const buttonClass = cn(
- "sidebar-nav-btn h-[30px] cursor-pointer rounded-full py-0 pr-4 text-ui-14p5 leading-ui-19 tracking-nav font-medium",
+ "sidebar-nav-btn h-[calc(30px*var(--ui-space-scale,1))] cursor-pointer rounded-full py-0 pr-4 text-ui-14p5 leading-ui-19 tracking-nav font-medium",
// pl-3 (12px) over the content's pl-1.5 (6px) = 18px, aligning with the nav items above.
- variant === "project" ? "pl-[39px]" : "pl-3",
+ variant === "project" ? "pl-[calc(39px*var(--ui-space-scale,1))]" : "pl-3",
// Pinned chats carry a chat icon, so add the nav-item icon gap.
- isPinned && variant !== "project" && "gap-[8.5px]",
+ isPinned && variant !== "project" && "gap-[calc(8.5px*var(--ui-space-scale,1))]",
// A spinner glyph cannot truncate, and the pin and the kebab overlay that same edge, so a
// working row holds their room open whether or not it is hovered.
showWorkSpinner ? "pr-16" : hasUnreadActivity ? "pr-7" : undefined,
// Coarse pointers reveal the actions permanently, so the spinner drops back beside
// them (right-16, ending 78px in) and the title has to clear that, not just pr-16.
- showWorkSpinner && "[@media(pointer:coarse)]:pr-[78px]",
+ showWorkSpinner && "[@media(pointer:coarse)]:pr-[calc(78px*var(--ui-space-scale,1))]",
variant === "project"
? showWorkSpinner
? undefined
@@ -3267,8 +3267,8 @@ export function AppSidebar() {
aria-label={translate("shell.dialog.renameChat.placeholder")}
className={cn(
// No pill or box; edit in place as plain highlighted text.
- "text-foreground h-[30px] w-full border-0 bg-transparent py-0 pr-4 text-ui-14p5 leading-ui-19 font-medium tracking-nav outline-none",
- variant === "project" ? "pl-[39px]" : "pl-3",
+ "text-foreground h-[calc(30px*var(--ui-space-scale,1))] w-full border-0 bg-transparent py-0 pr-4 text-ui-14p5 leading-ui-19 font-medium tracking-nav outline-none",
+ variant === "project" ? "pl-[calc(39px*var(--ui-space-scale,1))]" : "pl-3",
)}
/>
</SidebarMenuItem>
@@ -3736,7 +3736,7 @@ export function AppSidebar() {
else openProject(project.id);
}}
// Same gutter whether hover or this row's menu revealed the actions.
- className="sidebar-nav-btn h-[33px] rounded-full gap-[8.5px] pl-3 pr-2.5 font-medium group-hover/recent-item:pr-16 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16 [@media(pointer:coarse)]:pr-16"
+ className="sidebar-nav-btn h-[calc(33px*var(--ui-space-scale,1))] rounded-full gap-[calc(8.5px*var(--ui-space-scale,1))] pl-3 pr-2.5 font-medium group-hover/recent-item:pr-16 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16 [@media(pointer:coarse)]:pr-16"
>
{/* The folder says whether its chats are showing. */}
<HugeiconsIcon
@@ -3841,7 +3841,7 @@ export function AppSidebar() {
<SidebarMenuItem
{...dnd.dropZoneProps({ section: order.section, folderId: project.id, blockEnd })}
>
- <p className="flex h-[30px] items-center pl-9 pr-4 text-ui-13 leading-ui-18 tracking-nav text-nav-fg-muted">
+ <p className="flex h-[calc(30px*var(--ui-space-scale,1))] items-center pl-9 pr-4 text-ui-13 leading-ui-18 tracking-nav text-nav-fg-muted">
{t("shell.navigation.noChats")}
</p>
</SidebarMenuItem>
@@ -3856,7 +3856,7 @@ export function AppSidebar() {
onClick={() => toggleProjectShowAll(project.id)}
// Force the muted token: .sidebar-nav-btn's own color rule outweighs a plain text utility,
// so Show more would otherwise match the chat rows.
- className="sidebar-nav-btn h-[30px] rounded-full pl-9 pr-4 font-medium text-nav-fg-muted!"
+ className="sidebar-nav-btn h-[calc(30px*var(--ui-space-scale,1))] rounded-full pl-9 pr-4 font-medium text-nav-fg-muted!"
>
<span className="text-ui-13 leading-ui-18 tracking-nav">
{t(
@@ -3891,8 +3891,8 @@ export function AppSidebar() {
className={cn(
"relative",
usesDesktopTitlebar
- ? "shrink-0 p-0 pt-[calc(var(--studio-desktop-titlebar-height,34px)+17px)]"
- : "pl-3 pr-3 pt-[14px] pb-[8px] group-data-[collapsible=icon]:px-0",
+ ? "shrink-0 p-0 pt-[calc(var(--studio-desktop-titlebar-height,34px)+calc(17px*var(--ui-space-scale,1)))]"
+ : "pl-3 pr-3 pt-[calc(14px*var(--ui-space-scale,1))] pb-[calc(8px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:px-0",
)}
>
{showSidebarBrand && (
@@ -3900,7 +3900,7 @@ export function AppSidebar() {
{usesNativeMacTitlebar && !isMobile && (
<div
data-tauri-drag-region
- className="absolute inset-x-0 top-0 z-10 flex h-[var(--studio-desktop-titlebar-height,34px)] items-start pt-px pl-[calc(var(--studio-mac-traffic-light-inset,78px)+6px)] select-none group-data-[collapsible=icon]:hidden"
+ className="absolute inset-x-0 top-0 z-10 flex h-[var(--studio-desktop-titlebar-height,34px)] items-start pt-px pl-[calc(var(--studio-mac-traffic-light-inset,78px)+calc(6px*var(--ui-space-scale,1)))] select-none group-data-[collapsible=icon]:hidden"
>
<DesktopTitlebarNavigation
expanded={pinned}
@@ -3911,7 +3911,7 @@ export function AppSidebar() {
<div
data-tauri-drag-region={usesNativeMacTitlebar || undefined}
className={cn(
- "relative z-10 flex items-center gap-[8.5px] group-data-[collapsible=icon]:hidden",
+ "relative z-10 flex items-center gap-[calc(8.5px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:hidden",
usesDesktopTitlebar
? "justify-between pl-4 pr-3"
: "justify-between",
@@ -3926,7 +3926,7 @@ export function AppSidebar() {
}}
className={cn(
// min-w-0 so a narrow sidebar truncates the wordmark instead of pushing the search icon over.
- "flex min-w-0 items-center gap-[6px] select-none transition-opacity",
+ "flex min-w-0 items-center gap-[calc(6px*var(--ui-space-scale,1))] select-none transition-opacity",
chatDisabled && "pointer-events-none",
)}
aria-label={t("shell.aria.home")}
@@ -3943,7 +3943,7 @@ export function AppSidebar() {
<span className="relative -top-px truncate font-heading text-[calc(13px+0.5rem*var(--ui-font-scale,1))] font-semibold tracking-[0em] leading-tight text-black dark:text-white dark:tracking-[0.02em]">
unsloth
</span>
- <span className="nav-badge ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full border border-nav-beta-border px-[5px] pt-[3px] pb-[2px] text-[calc(0.5rem*var(--ui-font-scale,1))] font-medium leading-none tracking-[0.04em] text-nav-fg-muted antialiased subpixel-antialiased shadow-[0_1px_2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]">
+ <span className="nav-badge ml-0.5 inline-flex shrink-0 items-center justify-center rounded-full border border-nav-beta-border px-[calc(5px*var(--ui-space-scale,1))] pt-[calc(3px*var(--ui-space-scale,1))] pb-[calc(2px*var(--ui-space-scale,1))] text-[calc(0.5rem*var(--ui-font-scale,1))] font-medium leading-none tracking-[0.04em] text-nav-fg-muted antialiased subpixel-antialiased shadow-[0_1px_2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]">
{t("shell.beta")}
</span>
</Link>
@@ -3956,7 +3956,7 @@ export function AppSidebar() {
useChatSearchStore.getState().open();
closeMobileIfOpen();
}}
- className="inline-flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="inline-flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
aria-label={t("shell.navigation.search")}
>
<HugeiconsIcon icon={Search01Icon} strokeWidth={1.75} className="size-icon" />
@@ -3982,7 +3982,7 @@ export function AppSidebar() {
<button
type="button"
onClick={togglePinned}
- className="inline-flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="inline-flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
aria-label={t("shell.aria.closeSidebar")}
>
<HugeiconsIcon icon={LayoutAlignLeftIcon} strokeWidth={1.75} className="size-icon" />
@@ -4000,13 +4000,13 @@ export function AppSidebar() {
</div>
</div>
{!isMobile && (!usesDesktopTitlebar || usesNativeMacTitlebar) && (
- <div className="relative z-10 hidden group-data-[collapsible=icon]:flex h-[33px] items-center justify-center w-full">
+ <div className="relative z-10 hidden group-data-[collapsible=icon]:flex h-[calc(33px*var(--ui-space-scale,1))] items-center justify-center w-full">
<Tooltip>
<TooltipPrimitive.Trigger asChild>
<button
type="button"
onClick={togglePinned}
- className="inline-flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="inline-flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
aria-label={t("shell.aria.openSidebar")}
>
<HugeiconsIcon icon={LayoutAlignLeftIcon} strokeWidth={1.75} className="size-icon" />
@@ -4030,9 +4030,9 @@ export function AppSidebar() {
className={cn(
"group-data-[collapsible=icon]:px-0 shrink-0 transition-[padding]",
rowPadding,
- usesDesktopTitlebar ? "pt-[11px]" : "pt-[9px]",
+ usesDesktopTitlebar ? "pt-[calc(11px*var(--ui-space-scale,1))]" : "pt-[calc(9px*var(--ui-space-scale,1))]",
// Scrolled: New Chat is pinned, give a little gap below it.
- scrolled ? "pb-[5px]" : "pb-px",
+ scrolled ? "pb-[calc(5px*var(--ui-space-scale,1))]" : "pb-px",
)}
>
<SidebarGroupContent>
@@ -4210,7 +4210,7 @@ export function AppSidebar() {
setMorePinnedOpen(true);
}
}}
- className="sidebar-nav-btn h-[33px] rounded-full gap-[8.5px] pl-3 pr-2.5 font-medium group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:!w-[32px] group-data-[collapsible=icon]:mx-auto"
+ className="sidebar-nav-btn h-[calc(33px*var(--ui-space-scale,1))] rounded-full gap-[calc(8.5px*var(--ui-space-scale,1))] pl-3 pr-2.5 font-medium group-data-[collapsible=icon]:px-2.5 group-data-[collapsible=icon]:!w-[calc(32px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:mx-auto"
>
<HugeiconsIcon
icon={MoreHorizontalIcon}
@@ -4435,7 +4435,7 @@ export function AppSidebar() {
<SidebarMenuItem>
<SidebarMenuButton
onClick={() => setShowAllProjects((prev) => !prev)}
- className="sidebar-nav-btn h-[30px] rounded-full pl-3 pr-4 font-medium text-nav-fg-muted!"
+ className="sidebar-nav-btn h-[calc(30px*var(--ui-space-scale,1))] rounded-full pl-3 pr-4 font-medium text-nav-fg-muted!"
>
<span className="text-ui-13 leading-ui-18 tracking-nav">
{t(
@@ -4566,7 +4566,7 @@ export function AppSidebar() {
>
<SidebarMenuButton
isActive={isActiveRun}
- className="sidebar-nav-btn h-auto flex-col items-start gap-0.5 py-[5px] rounded-[14px] pl-3 pr-7 text-ui-14p5 tracking-nav font-medium"
+ className="sidebar-nav-btn h-auto flex-col items-start gap-0.5 py-[calc(5px*var(--ui-space-scale,1))] rounded-[14px] pl-3 pr-7 text-ui-14p5 tracking-nav font-medium"
onClick={() => {
setSelectedHistoryRunId(run.id);
// From Recipes/Export, jump to Train so the run's history opens.
@@ -4574,7 +4574,7 @@ export function AppSidebar() {
closeMobileIfOpen();
}}
>
- <div className="flex w-full items-center gap-[8.5px]">
+ <div className="flex w-full items-center gap-[calc(8.5px*var(--ui-space-scale,1))]">
<span
className={cn(
"size-1.5 shrink-0 rounded-full",
@@ -4640,13 +4640,13 @@ export function AppSidebar() {
<SidebarFooter
className={cn(
- "relative pb-[11px] group-data-[collapsible=icon]:px-0",
+ "relative pb-[calc(11px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:px-0",
// The profile is outside the recent-chat scroller and keeps its full
// width when that scroller gains or loses a scrollbar.
unrailedRowPadding,
- // pt-[3px] cancels the profile button's -3px margin, so the 8px above it is whatever sits over the
+ // pt-[calc(3px*var(--ui-space-scale,1))] cancels the profile button's -3px margin, so the 8px above it is whatever sits over the
// footer edge (the fade plateau, or the list's pb-2 once the fade is hidden) and 8px sits below.
- showUpdateCard ? "pt-1" : "pt-[3px]",
+ showUpdateCard ? "pt-1" : "pt-[calc(3px*var(--ui-space-scale,1))]",
)}
>
{/* Fade above the profile box, shown only when there's more list below
@@ -4679,11 +4679,11 @@ export function AppSidebar() {
.openDialog("about", { scrollTarget: "about-updates" });
closeMobileIfOpen();
}}
- className="flex h-[44px] w-full items-center gap-[9px] rounded-[14px] border border-border/60 bg-transparent px-2 py-[3px] text-left transition-colors hover:bg-nav-surface-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring group-data-[collapsible=icon]:mx-auto group-data-[collapsible=icon]:h-[34px] group-data-[collapsible=icon]:w-[34px] group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:rounded-full group-data-[collapsible=icon]:p-0"
+ className="flex h-[calc(44px*var(--ui-space-scale,1))] w-full items-center gap-[calc(9px*var(--ui-space-scale,1))] rounded-[14px] border border-border/60 bg-transparent px-2 py-[calc(3px*var(--ui-space-scale,1))] text-left transition-colors hover:bg-nav-surface-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring group-data-[collapsible=icon]:mx-auto group-data-[collapsible=icon]:h-[calc(34px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:w-[calc(34px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:rounded-full group-data-[collapsible=icon]:p-0"
>
<span
aria-hidden="true"
- className="flex size-[32px] shrink-0 items-center justify-center group-data-[collapsible=icon]:size-full"
+ className="flex size-[calc(32px*var(--ui-space-scale,1))] shrink-0 items-center justify-center group-data-[collapsible=icon]:size-full"
>
<HugeiconsIcon
icon={BadgeInfoIcon}
@@ -4703,7 +4703,7 @@ export function AppSidebar() {
</div>
<span
aria-hidden="true"
- className="ml-auto flex size-[32px] shrink-0 items-center justify-center text-muted-foreground group-data-[collapsible=icon]:hidden"
+ className="ml-auto flex size-[calc(32px*var(--ui-space-scale,1))] shrink-0 items-center justify-center text-muted-foreground group-data-[collapsible=icon]:hidden"
>
<ArrowRightIcon
className="size-[17px]"
@@ -4736,14 +4736,14 @@ export function AppSidebar() {
ref={triggerRef}
size="lg"
aria-label={t("shell.accountMenu", { name: displayTitle })}
- className="sidebar-nav-btn !h-[44px] -my-[3px] gap-[9px] pl-2 pr-[45px] py-[3px] rounded-[14px] group-data-[collapsible=icon]:!size-[34px] 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 !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">
<UserAvatar
name={displayTitle}
imageUrl={avatarDataUrl}
size="sm"
- className="!size-[32px] group-data-[collapsible=icon]:!rounded-full"
+ className="!size-[calc(32px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:!rounded-full"
/>
</div>
{/* min-w-0 so long names truncate instead of overflowing;
@@ -4868,7 +4868,7 @@ export function AppSidebar() {
type="button"
aria-label={t("shell.navigation.settings")}
onClick={() => useSettingsDialogStore.getState().openDialog()}
- className="absolute right-2 top-1/2 flex size-[32px] -translate-y-1/2 items-center justify-center rounded-[10px] text-muted-foreground transition-colors hover:bg-[rgb(0_0_0_/_calc(0.1*var(--contrast-wash-gain,1)))] hover:text-foreground dark:hover:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring group-data-[collapsible=icon]:hidden"
+ className="absolute right-2 top-1/2 flex size-[calc(32px*var(--ui-space-scale,1))] -translate-y-1/2 items-center justify-center rounded-[10px] text-muted-foreground transition-colors hover:bg-[rgb(0_0_0_/_calc(0.1*var(--contrast-wash-gain,1)))] hover:text-foreground dark:hover:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring group-data-[collapsible=icon]:hidden"
>
<HugeiconsIcon
icon={Settings02Icon}
diff --git a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx
index d82774fe09f..6fdc14cbce1 100644
--- a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx
+++ b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx
@@ -155,7 +155,7 @@ export function PromptQueueList({
// rounding and the clip live on this frame instead.
<div
data-queue-frame=""
- className="relative z-0 mx-3 mb-[-8px] overflow-hidden rounded-t-[20px] border border-border/60 bg-background sm:mx-5 dark:bg-[color-mix(in_srgb,var(--card)_50%,var(--background))]"
+ className="relative z-0 mx-3 mb-[calc(-8px*var(--ui-space-scale,1))] overflow-hidden rounded-t-[20px] border border-border/60 bg-background sm:mx-5 dark:bg-[color-mix(in_srgb,var(--card)_50%,var(--background))]"
>
<div
ref={listRef}
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index a6996476cbc..fcfc5af9083 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -370,6 +370,7 @@ import {
import { extractTaggedText, updateThreadMessage } from "@/features/chat/utils/update-thread-message";
import { useComposerPillFit } from "@/hooks/use-composer-pill-fit";
import { useIsMobile } from "@/hooks/use-mobile";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
// True while a file is dragged anywhere over the chat page, so the composer
// can show its "Drop files here" affordance.
@@ -2029,7 +2030,7 @@ export const Thread: FC<{
: // + the chat-model notice, which is an opaque absolute bar
// directly under the header. 0px whenever it is not showing,
// so every other surface keeps the padding it had.
- "pt-[calc(var(--studio-content-top-inset,0px)+48px+var(--studio-chat-notice-height,0px))]",
+ "pt-[calc(var(--studio-content-top-inset,0px)+var(--studio-chat-header-height,48px)+var(--studio-chat-notice-height,0px))]",
)}
>
{!hideWelcome && (
@@ -2400,14 +2401,14 @@ const ThreadWelcome: FC<{
<div className="aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col">
<div className="aui-thread-welcome-center flex w-full grow flex-col items-center justify-start pt-[27.5dvh]">
{/* Matches the docked composer's gutter; index.css trims both. */}
- <div className="aui-thread-welcome-message flex w-full flex-col justify-center gap-9 px-[var(--custom-chat-welcome-padding,1rem)]">
+ <div className="aui-thread-welcome-message flex w-full flex-col justify-center gap-9 px-[var(--custom-chat-welcome-padding,calc(1rem*var(--ui-space-scale,1)))]">
{/* Center the greeting (sloth + title) over the composer. */}
- <div className="unsloth-welcome-greeting flex flex-row items-center justify-center gap-[15px]">
+ <div className="unsloth-welcome-greeting flex flex-row items-center justify-center gap-[calc(15px*var(--ui-space-scale,1))]">
{/* Temporary chat keeps the title on its own, no mascot. */}
{showGreetingSloth && !incognito && (
<MascotImg
src={currentEmojiSrc}
- className="unsloth-welcome-sloth size-[44px] -translate-y-[2px]"
+ className="unsloth-welcome-sloth size-[calc(44px*var(--ui-space-scale,1))] -translate-y-[2px]"
/>
)}
<h1 className="aui-thread-welcome-message-inner unsloth-welcome-title fade-in slide-in-from-bottom-1 animate-in text-3xl tracking-[-0.02em] duration-200">
@@ -2774,6 +2775,9 @@ const Composer: FC<{
const inputRef = useRef<HTMLTextAreaElement>(null);
const editorRef = useRef<HTMLDivElement>(null);
const inputId = useId();
+ // One empty row, at whatever the UI font size makes a row.
+ const uiSpaceScale = useUiSpaceScale();
+ const oneRowHeight = Math.round(40 * uiSpaceScale);
const [editorHeight, setEditorHeight] = useState(40);
const [isWritingExpanded, setIsWritingExpanded] = useState(false);
const toggleWritingExpanded = () => {
@@ -5157,7 +5161,7 @@ const Composer: FC<{
className="unsloth-composer-editor"
style={
{
- "--composer-editor-height": `${composerText.length === 0 ? 40 : Math.max(40, editorHeight)}px`,
+ "--composer-editor-height": `${composerText.length === 0 ? oneRowHeight : Math.max(oneRowHeight, editorHeight)}px`,
} as CSSProperties
}
>
@@ -8307,7 +8311,7 @@ const AssistantActionBar: FC = () => {
side="bottom"
align="start"
onCloseAutoFocus={(e) => e.preventDefault()}
- className="aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-[21px] bg-popover px-[9px] py-2 text-popover-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:shadow-none"
+ className="aui-action-bar-more-content z-50 min-w-32 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-none"
>
{/* Prevent an outside dismissal from triggering Delete. */}
<MenuDismissGuard triggerRef={moreMenuTriggerRef} />
@@ -8559,7 +8563,7 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
aria-label="Previous"
className="aui-branch-chevron-btn"
>
- <ChevronLeftIcon strokeWidth={1.25} className="size-[36px]" />
+ <ChevronLeftIcon strokeWidth={1.25} className="size-[calc(36px*var(--ui-space-scale,1))]" />
</button>
</BranchPickerPrimitive.Previous>
<span className="aui-branch-picker-state font-mono text-ui-13 tabular-nums">
@@ -8571,7 +8575,7 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
aria-label="Next"
className="aui-branch-chevron-btn"
>
- <ChevronRightIcon strokeWidth={1.25} className="size-[36px]" />
+ <ChevronRightIcon strokeWidth={1.25} className="size-[calc(36px*var(--ui-space-scale,1))]" />
</button>
</BranchPickerPrimitive.Next>
</BranchPickerPrimitive.Root>
diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx
index aef4a3077f7..0b1c407fd59 100644
--- a/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx
+++ b/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx
@@ -109,7 +109,7 @@ const RenderHtmlToolUIImpl: ToolCallMessagePartComponent = ({
}
return (
- <div className="relative my-2 flex min-h-[52px] w-full max-w-md items-center overflow-hidden rounded-lg border border-border/70 bg-muted/15 px-3 py-2 text-left dark:bg-muted/10">
+ <div className="relative my-2 flex min-h-[calc(52px*var(--ui-space-scale,1))] w-full max-w-md items-center overflow-hidden rounded-lg border border-border/70 bg-muted/15 px-3 py-2 text-left dark:bg-muted/10">
<div className="relative z-10 flex min-w-0 flex-1 items-center gap-2.5">
<HugeiconsIcon
icon={BrowserIcon}
diff --git a/studio/frontend/src/components/media-page-link.tsx b/studio/frontend/src/components/media-page-link.tsx
index a58fc6681ef..6fe23368236 100644
--- a/studio/frontend/src/components/media-page-link.tsx
+++ b/studio/frontend/src/components/media-page-link.tsx
@@ -56,7 +56,7 @@ export function MediaPageLink({
onNavigate?.();
navigate({ to });
}}
- className="flex h-[34px] min-w-0 items-center gap-1.5 rounded-full pl-2.5 pr-2 text-ui-13 font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ className="flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 items-center gap-1.5 rounded-full pl-2.5 pr-2 text-ui-13 font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<HugeiconsIcon icon={icon} className="size-4 shrink-0" />
<span className={cn("min-w-0 truncate", labelClassName)}>{label}</span>
diff --git a/studio/frontend/src/components/navbar.tsx b/studio/frontend/src/components/navbar.tsx
index 253244ae4fa..cc1f0706858 100644
--- a/studio/frontend/src/components/navbar.tsx
+++ b/studio/frontend/src/components/navbar.tsx
@@ -18,7 +18,7 @@ export function Navbar() {
if (!isMobile) {
return (
<>
- <header className="pointer-events-none absolute inset-x-0 top-0 z-40 h-[48px]">
+ <header className="pointer-events-none absolute inset-x-0 top-0 z-40 h-[calc(48px*var(--ui-space-scale,1))]">
{usesNativeMacTitlebar && (
<div
data-tauri-drag-region
@@ -34,7 +34,7 @@ export function Navbar() {
<DesktopTitlebarNavigation
expanded={false}
onToggleSidebar={togglePinned}
- className="pointer-events-auto absolute left-[calc(var(--studio-mac-traffic-light-inset,78px)+6px)] top-px z-[60]"
+ className="pointer-events-auto absolute left-[calc(var(--studio-mac-traffic-light-inset,78px)+calc(6px*var(--ui-space-scale,1)))] top-px z-[60]"
/>
)}
</>
@@ -48,7 +48,7 @@ export function Navbar() {
"absolute top-0 inset-x-0 pointer-events-none",
usesCustomTitlebar
? "z-[80] h-[var(--studio-custom-titlebar-height,34px)]"
- : "z-[45] h-[48px]",
+ : "z-[45] h-[calc(48px*var(--ui-space-scale,1))]",
)}
>
<div
@@ -57,11 +57,19 @@ export function Navbar() {
usesCustomTitlebar
? "items-center pl-3"
: usesNativeMacTitlebar
- ? "items-start pt-[11px] pl-[calc(var(--studio-mac-traffic-light-inset,78px)+6px)]"
- : "items-start pt-[11px] pl-2",
+ ? "items-start pt-[calc(11px*var(--ui-space-scale,1))] pl-[calc(var(--studio-mac-traffic-light-inset,78px)+calc(6px*var(--ui-space-scale,1)))]"
+ : "items-start pt-[calc(11px*var(--ui-space-scale,1))] pl-2",
)}
>
- <SidebarTrigger className="pointer-events-auto !size-[34px]" />
+ {/* Scales with the header, except in the fixed titlebar band. */}
+ <SidebarTrigger
+ className={cn(
+ "pointer-events-auto",
+ usesCustomTitlebar
+ ? "!size-[34px]"
+ : "!size-[calc(34px*var(--ui-space-scale,1))]",
+ )}
+ />
</div>
</header>
);
diff --git a/studio/frontend/src/components/tauri/startup-screen.tsx b/studio/frontend/src/components/tauri/startup-screen.tsx
index ec708c43340..0f1a9732c70 100644
--- a/studio/frontend/src/components/tauri/startup-screen.tsx
+++ b/studio/frontend/src/components/tauri/startup-screen.tsx
@@ -46,7 +46,7 @@ function Logo() {
src="/sticker.png"
alt=""
aria-hidden="true"
- className="h-[60px] w-[60px] object-contain"
+ className="h-[calc(60px*var(--ui-space-scale,1))] w-[calc(60px*var(--ui-space-scale,1))] object-contain"
/>
<span
className="text-ui-50 font-semibold leading-none tracking-[-0.02em] text-foreground"
diff --git a/studio/frontend/src/components/tauri/update-screen.tsx b/studio/frontend/src/components/tauri/update-screen.tsx
index 5c5f71cdc8b..dadf2f8b0a8 100644
--- a/studio/frontend/src/components/tauri/update-screen.tsx
+++ b/studio/frontend/src/components/tauri/update-screen.tsx
@@ -29,7 +29,7 @@ function Logo() {
src="/sticker.png"
alt=""
aria-hidden="true"
- className="h-[60px] w-[60px] object-contain"
+ className="h-[calc(60px*var(--ui-space-scale,1))] w-[calc(60px*var(--ui-space-scale,1))] object-contain"
/>
<span
className="text-ui-50 font-semibold leading-none tracking-[-0.02em] text-foreground"
diff --git a/studio/frontend/src/components/tauri/window-titlebar.tsx b/studio/frontend/src/components/tauri/window-titlebar.tsx
index d846d7730cc..023c6786f44 100644
--- a/studio/frontend/src/components/tauri/window-titlebar.tsx
+++ b/studio/frontend/src/components/tauri/window-titlebar.tsx
@@ -117,6 +117,8 @@ export function DesktopTitlebarNavigation({
const stopTitlebarDrag = (event: MouseEvent<HTMLButtonElement>) => {
event.stopPropagation();
};
+ // Window chrome: the band around these is a fixed 34px, so they keep their
+ // size while the slot holding them scales.
const buttonClass =
"inline-flex size-[30px] shrink-0 items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";
@@ -149,6 +151,8 @@ export function DesktopTitlebarNavigation({
/>
</button>
) : (
+ // Holds the slot the navbar's own trigger sits in, so it is the
+ // button's fixed size, not a scaled one.
<div aria-hidden="true" className="size-[30px] shrink-0" />
)}
<button
@@ -214,8 +218,13 @@ export function WindowTitlebar({
: "var(--studio-sidebar-collapsed-width,3rem)"
: "0px";
+ // The buttons in this slot are fixed but their padding and gaps scale, so
+ // the slot grows with them and never shrinks under the three 30px buttons.
+ // The drag region starts where it ends.
const titlebarNavigationWidth =
- showSidebarSurface && !pinned ? "7rem" : sidebarWidth;
+ showSidebarSurface && !pinned
+ ? "max(7rem, calc(7rem * var(--ui-space-scale, 1)))"
+ : sidebarWidth;
const contentBorderLeft = pinned ? `calc(${sidebarWidth} + 12px)` : "0px";
const refreshMaximized = useCallback(async () => {
diff --git a/studio/frontend/src/components/ui/dropdown-menu.tsx b/studio/frontend/src/components/ui/dropdown-menu.tsx
index 65cf123965a..90b16572fa4 100644
--- a/studio/frontend/src/components/ui/dropdown-menu.tsx
+++ b/studio/frontend/src/components/ui/dropdown-menu.tsx
@@ -52,7 +52,7 @@ function DropdownMenuContent({
// The 3px alignment nudge must be margin, not translate: a transform
// here makes this scroll container the containing block for nested
// position:fixed submenu wrappers, clipping every submenu.
- "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-48 rounded-lg p-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-[calc(var(--radix-dropdown-menu-trigger-width)_+_6px)] data-[align=start]:-ml-[3px] data-[align=end]:ml-[3px] origin-(--radix-dropdown-menu-content-transform-origin) flex flex-col overflow-hidden",
+ "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-48 max-w-[calc(100vw-32px)] rounded-lg p-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-[calc(var(--radix-dropdown-menu-trigger-width)_+_6px*var(--ui-space-scale,1))] data-[align=start]:-ml-[calc(3px*var(--ui-space-scale,1))] data-[align=end]:ml-[calc(3px*var(--ui-space-scale,1))] origin-(--radix-dropdown-menu-content-transform-origin) flex flex-col overflow-hidden",
className,
)}
{...props}
diff --git a/studio/frontend/src/components/ui/input-group.tsx b/studio/frontend/src/components/ui/input-group.tsx
index 4f7e031cacf..cfe3a7b2614 100644
--- a/studio/frontend/src/components/ui/input-group.tsx
+++ b/studio/frontend/src/components/ui/input-group.tsx
@@ -29,9 +29,9 @@ const inputGroupAddonVariants = cva(
variants: {
align: {
"inline-start":
- "pl-3 has-[>button]:ml-[-0.25rem] has-[>kbd]:ml-[-0.15rem] order-first",
+ "pl-3 has-[>button]:ml-[calc(-0.25rem*var(--ui-space-scale,1))] has-[>kbd]:ml-[calc(-0.15rem*var(--ui-space-scale,1))] order-first",
"inline-end":
- "pr-3 has-[>button]:mr-[-0.25rem] has-[>kbd]:mr-[-0.15rem] order-last",
+ "pr-3 has-[>button]:mr-[calc(-0.25rem*var(--ui-space-scale,1))] has-[>kbd]:mr-[calc(-0.15rem*var(--ui-space-scale,1))] order-last",
"block-start":
"px-3 pt-3 group-has-[>input]/input-group:pt-3 [.border-b]:pb-3 order-first w-full justify-start",
"block-end":
diff --git a/studio/frontend/src/components/ui/input.tsx b/studio/frontend/src/components/ui/input.tsx
index 53b59614b69..d81602fa5f6 100644
--- a/studio/frontend/src/components/ui/input.tsx
+++ b/studio/frontend/src/components/ui/input.tsx
@@ -62,7 +62,7 @@ function StepperArrow({ direction }: { direction: 1 | -1 }) {
<svg
viewBox="0 0 10 6"
aria-hidden="true"
- className={cn("h-[5px] w-2", direction === -1 && "rotate-180")}
+ className={cn("h-[calc(5px*var(--ui-space-scale,1))] w-2", direction === -1 && "rotate-180")}
>
<path d="M5 0.5 9 5.5H1Z" fill="currentColor" />
</svg>
@@ -132,7 +132,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
{field}
<span
aria-hidden="true"
- className="absolute top-1/2 right-2.5 flex h-[21px] w-4 -translate-y-1/2 flex-col overflow-hidden rounded-[5px] bg-[rgb(0_0_0_/_calc(0.07*var(--contrast-wash-gain,1)))] opacity-0 transition-opacity group-hover/number:opacity-100 group-focus-within/number:opacity-100 group-has-[input:disabled]/number:pointer-events-none group-has-[input:disabled]/number:opacity-0 dark:bg-[rgb(255_255_255_/_calc(0.12*var(--contrast-wash-gain,1)))]"
+ className="absolute top-1/2 right-2.5 flex h-[calc(21px*var(--ui-space-scale,1))] w-4 -translate-y-1/2 flex-col overflow-hidden rounded-[5px] bg-[rgb(0_0_0_/_calc(0.07*var(--contrast-wash-gain,1)))] opacity-0 transition-opacity group-hover/number:opacity-100 group-focus-within/number:opacity-100 group-has-[input:disabled]/number:pointer-events-none group-has-[input:disabled]/number:opacity-0 dark:bg-[rgb(255_255_255_/_calc(0.12*var(--contrast-wash-gain,1)))]"
>
<StepperButton direction={1} />
<StepperButton direction={-1} />
diff --git a/studio/frontend/src/components/ui/popover.tsx b/studio/frontend/src/components/ui/popover.tsx
index 1a7d1d58cd2..1f4c2f60016 100644
--- a/studio/frontend/src/components/ui/popover.tsx
+++ b/studio/frontend/src/components/ui/popover.tsx
@@ -42,7 +42,7 @@ function PopoverContent({
align={align}
sideOffset={sideOffset}
className={cn(
- "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 flex flex-col gap-4 rounded-lg p-4 text-sm duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",
+ "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 flex flex-col gap-4 rounded-lg p-4 text-sm duration-100 z-50 w-72 max-w-[calc(100vw-32px)] origin-(--radix-popover-content-transform-origin) outline-hidden",
className,
)}
{...props}
diff --git a/studio/frontend/src/components/ui/select.tsx b/studio/frontend/src/components/ui/select.tsx
index 0d2aab9ce9d..148305bfd82 100644
--- a/studio/frontend/src/components/ui/select.tsx
+++ b/studio/frontend/src/components/ui/select.tsx
@@ -126,7 +126,7 @@ function SelectContent({
data-slot="select-content"
data-align-trigger={position === "item-aligned"}
className={cn(
- "bg-popover text-popover-foreground font-heading data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 min-w-36 rounded-xl p-1 corner-squircle duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) flex flex-col overflow-hidden",
+ "bg-popover text-popover-foreground font-heading data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 min-w-36 max-w-[calc(100vw-32px)] rounded-xl p-1 corner-squircle duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) flex flex-col overflow-hidden",
// No popper translate offset: the menu sits flush against the trigger.
className,
)}
diff --git a/studio/frontend/src/components/ui/slider.tsx b/studio/frontend/src/components/ui/slider.tsx
index 4e2baee4f33..528562dd89d 100644
--- a/studio/frontend/src/components/ui/slider.tsx
+++ b/studio/frontend/src/components/ui/slider.tsx
@@ -59,6 +59,26 @@ function Slider({
);
const isSingleThumbHorizontal =
values.length === 1 && orientation === "horizontal";
+ // The thumb follows the UI font size, and .panel-slider resizes it outright,
+ // so the fill measures it rather than assuming 16px. offsetWidth ignores the
+ // hover/press transforms.
+ const thumbRef = React.useRef<HTMLSpanElement | null>(null);
+ const [thumbWidth, setThumbWidth] = React.useState(THUMB_SIZE_PX);
+ React.useLayoutEffect(() => {
+ const thumb = thumbRef.current;
+ if (!thumb) return;
+ const measure = () => {
+ const width = thumb.offsetWidth;
+ if (width > 0) {
+ setThumbWidth((current) => (current === width ? current : width));
+ }
+ };
+ measure();
+ if (typeof ResizeObserver === "undefined") return;
+ const observer = new ResizeObserver(measure);
+ observer.observe(thumb);
+ return () => observer.disconnect();
+ }, []);
const fillPercent = isSingleThumbHorizontal
? Math.min(
100,
@@ -73,7 +93,7 @@ function Slider({
? undefined
: fillPercent <= 0
? "0%"
- : `calc(${fillPercent}% + ${getThumbInBoundsOffset(THUMB_SIZE_PX, fillPercent)}px)`;
+ : `calc(${fillPercent}% + ${getThumbInBoundsOffset(thumbWidth, fillPercent)}px)`;
return (
<SliderPrimitive.Root
@@ -116,6 +136,7 @@ function Slider({
<SliderPrimitive.Thumb
data-slot="slider-thumb"
key={index}
+ ref={index === 0 ? thumbRef : undefined}
// The thumb is the element carrying role="slider", so the name and the spoken value
// belong here. Everything else spreads onto Root, which is a plain div: an aria-label
// passed to this component reached that div and left the actual control unnamed, and
diff --git a/studio/frontend/src/components/ui/switch.tsx b/studio/frontend/src/components/ui/switch.tsx
index db63936f379..2caf7963cbd 100644
--- a/studio/frontend/src/components/ui/switch.tsx
+++ b/studio/frontend/src/components/ui/switch.tsx
@@ -18,7 +18,7 @@ function Switch({
data-slot="switch"
data-size={size}
className={cn(
- "data-checked:bg-control-accent data-unchecked:bg-input focus-visible:border-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent aria-invalid:ring-[3px] data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",
+ "data-checked:bg-control-accent data-unchecked:bg-input focus-visible:border-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent aria-invalid:ring-[3px] data-[size=default]:h-[calc(18.4px*var(--ui-space-scale,1))] data-[size=default]:w-[calc(32px*var(--ui-space-scale,1))] data-[size=sm]:h-[calc(14px*var(--ui-space-scale,1))] data-[size=sm]:w-[calc(24px*var(--ui-space-scale,1))] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",
className,
)}
{...props}
diff --git a/studio/frontend/src/components/ui/tabs.tsx b/studio/frontend/src/components/ui/tabs.tsx
index 90d184fe76d..22f2cef66c3 100644
--- a/studio/frontend/src/components/ui/tabs.tsx
+++ b/studio/frontend/src/components/ui/tabs.tsx
@@ -49,7 +49,7 @@ export function Tabs({
}
export const tabsListVariants = cva(
- "rounded-4xl p-[3px] group-data-horizontal/tabs:h-9 group-data-vertical/tabs:rounded-2xl data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",
+ "rounded-4xl p-[calc(3px*var(--ui-space-scale,1))] group-data-horizontal/tabs:h-9 group-data-vertical/tabs:rounded-2xl data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",
{
variants: {
variant: {
diff --git a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
index f8bc06c2ee2..9973c7bd3db 100644
--- a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
+++ b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
@@ -456,7 +456,7 @@ export function ApiMonitorOverlay(): ReactElement | null {
close();
void navigate({ to: "/api-monitor" });
}}
- className="mt-1 flex h-[33px] w-full items-center justify-center gap-[8.5px] rounded-full bg-muted/60 text-ui-13p5 font-medium tracking-nav text-nav-fg transition-colors hover:bg-nav-surface-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:bg-background/50"
+ className="mt-1 flex h-[calc(33px*var(--ui-space-scale,1))] w-full items-center justify-center gap-[calc(8.5px*var(--ui-space-scale,1))] rounded-full bg-muted/60 text-ui-13p5 font-medium tracking-nav text-nav-fg transition-colors hover:bg-nav-surface-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:bg-background/50"
>
<HugeiconsIcon
icon={ExpandIcon}
diff --git a/studio/frontend/src/features/audio/audio-page.tsx b/studio/frontend/src/features/audio/audio-page.tsx
index 5154970f739..03965cb7b4a 100644
--- a/studio/frontend/src/features/audio/audio-page.tsx
+++ b/studio/frontend/src/features/audio/audio-page.tsx
@@ -2567,7 +2567,7 @@ export function AudioPage({
{active && <GuidedTour {...tour.tourProps} />}
{/* Keep the tabs centered over the preview at every width. The model rail holds at 408px when
space permits and shrinks only to preserve the controls. */}
- <div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">
+ <div className="pointer-events-none relative z-40 grid h-[calc(48px*var(--ui-space-scale,1))] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">
<div className="pointer-events-none flex h-full min-w-0 items-start overflow-hidden pl-[var(--studio-media-header-left-inset,1.5rem)] @[50rem]:border-r @[50rem]:border-border/60">
{/* A long resident model name must yield to the mode pill instead of painting over it. */}
<div className="pointer-events-auto flex min-w-0 max-w-full items-center gap-2 overflow-hidden pt-[var(--studio-chat-header-padding-top,11px)]">
@@ -2587,7 +2587,7 @@ export function AudioPage({
onValueChange={handleModelSelect}
onEject={busy === null && selectorValue ? handleEject : undefined}
variant="ghost"
- className="!h-[34px] max-w-full gap-1 overflow-hidden pl-3 pr-1 @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"
+ className="!h-[calc(34px*var(--ui-space-scale,1))] max-w-full gap-1 overflow-hidden pl-3 pr-1 @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"
triggerLabelClassName="text-ui-14 @[68rem]:text-ui-16"
task={HUB_TASKS_BY_MODE[mode]}
catalog={AUDIO_CATALOG}
@@ -2615,7 +2615,7 @@ export function AudioPage({
void navigateSelf({ to: "/studio" });
}}
fit={true}
- className="h-[34px] [&>button]:h-[34px] [&>button]:px-3 @[68rem]:[&>button]:px-11"
+ className="h-[calc(34px*var(--ui-space-scale,1))] [&>button]:h-[calc(34px*var(--ui-space-scale,1))] [&>button]:px-3 @[68rem]:[&>button]:px-11"
tabs={[
{
value: "create",
@@ -2678,7 +2678,7 @@ export function AudioPage({
value={mode}
onValueChange={(v) => transitionMode(v as CreateMode)}
fit={true}
- className="h-[30px] self-start [&>button]:h-[30px] [&>button]:px-6"
+ className="h-[calc(30px*var(--ui-space-scale,1))] self-start [&>button]:h-[calc(30px*var(--ui-space-scale,1))] [&>button]:px-6"
tabs={[
{ value: "speak", label: "Generate" },
{ value: "transcribe", label: "Transcribe" },
@@ -2783,7 +2783,7 @@ export function AudioPage({
if (ttsLoaded) handleEject();
}}
fit={true}
- className="h-[30px] self-start [&>button]:h-[30px] [&>button]:px-6"
+ className="h-[calc(30px*var(--ui-space-scale,1))] self-start [&>button]:h-[calc(30px*var(--ui-space-scale,1))] [&>button]:px-6"
tabs={[
{ value: "auto", label: "GPU when available" },
{ value: "cpu", label: "CPU RAM" },
@@ -2977,7 +2977,7 @@ export function AudioPage({
data-reload-snapshot-sensitive={
transcript || transcribedName ? "" : undefined
}
- className="flex min-h-0 flex-1 flex-col gap-3 p-6 px-10 @[50rem]:pt-[60px]"
+ className="flex min-h-0 flex-1 flex-col gap-3 p-6 px-10 @[50rem]:pt-[calc(60px*var(--ui-space-scale,1))]"
>
<div className="hover-scrollbar flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto">
{transcriptionStartedAt !== null && (
@@ -3067,7 +3067,7 @@ export function AudioPage({
</div>
</div>
) : (
- <div className="flex min-h-0 flex-1 flex-col gap-4 p-6 px-10 @[50rem]:pt-[60px]">
+ <div className="flex min-h-0 flex-1 flex-col gap-4 p-6 px-10 @[50rem]:pt-[calc(60px*var(--ui-space-scale,1))]">
<div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-4">
{selectedClip ? (
<div className="flex w-full max-w-xl flex-col gap-3">
diff --git a/studio/frontend/src/features/audio/transcription-progress.tsx b/studio/frontend/src/features/audio/transcription-progress.tsx
index 43146961fd2..672734a4c67 100644
--- a/studio/frontend/src/features/audio/transcription-progress.tsx
+++ b/studio/frontend/src/features/audio/transcription-progress.tsx
@@ -36,7 +36,7 @@ export function TranscriptionProgress({
<div className="flex items-center gap-3 text-ui-13 text-muted-foreground">
{running && (
<span
- className="transcription-wave flex h-5 items-center gap-[3px]"
+ className="transcription-wave flex h-5 items-center gap-[calc(3px*var(--ui-space-scale,1))]"
aria-hidden="true"
data-stopping={stopping}
>
diff --git a/studio/frontend/src/features/chat/artifacts/artifact-card.tsx b/studio/frontend/src/features/chat/artifacts/artifact-card.tsx
index d5902e7e8f0..432905de3f5 100644
--- a/studio/frontend/src/features/chat/artifacts/artifact-card.tsx
+++ b/studio/frontend/src/features/chat/artifacts/artifact-card.tsx
@@ -23,7 +23,7 @@ import {
} from "./types";
const CARD_BASE =
- "group/artifact-card relative flex min-h-[52px] cursor-pointer items-center overflow-hidden rounded-lg border border-border/70 bg-muted/15 px-3 py-2 text-left transition-colors hover:bg-muted/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:bg-muted/10 dark:hover:bg-muted/20";
+ "group/artifact-card relative flex min-h-[calc(52px*var(--ui-space-scale,1))] cursor-pointer items-center overflow-hidden rounded-lg border border-border/70 bg-muted/15 px-3 py-2 text-left transition-colors hover:bg-muted/25 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:bg-muted/10 dark:hover:bg-muted/20";
export function ArtifactCard({
code,
diff --git a/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx b/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx
index 568c49965dc..de9bc9a4d4e 100644
--- a/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx
+++ b/studio/frontend/src/features/chat/artifacts/artifact-surface.tsx
@@ -209,8 +209,14 @@ export function ArtifactSurface({
style={
variant === "panel"
? {
- marginTop: "calc(90px + var(--studio-chat-notice-height, 0px))",
- height: "calc(100% - 122px - var(--studio-chat-notice-height, 0px))",
+ // 90 above and 32 below, the same 32 the shell's mb-8 draws, so
+ // the three move together with the UI font size. The content
+ // inset inside the 90 is the window's titlebar band, which does
+ // not scale, so only the header and gap above the panel do.
+ marginTop:
+ "calc(var(--studio-content-top-inset, 0px) + (90px - var(--studio-content-top-inset, 0px)) * var(--ui-space-scale, 1) + var(--studio-chat-notice-height, 0px))",
+ height:
+ "calc(100% - var(--studio-content-top-inset, 0px) - (122px - var(--studio-content-top-inset, 0px)) * var(--ui-space-scale, 1) - var(--studio-chat-notice-height, 0px))",
}
: undefined
}
diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx
index 6d62aaeff2d..1b7b52b340b 100644
--- a/studio/frontend/src/features/chat/chat-page.tsx
+++ b/studio/frontend/src/features/chat/chat-page.tsx
@@ -806,7 +806,7 @@ function CompareShell({
</div>
{/* Symmetric: the extra right inset mirrored the viewport's one-sided
scrollbar gutter, which is now reserved on both edges. */}
- <div className="shrink-0 bg-background pl-5 pr-5 md:px-[30px] pb-2 pt-1">
+ <div className="shrink-0 bg-background pl-5 pr-5 md:px-[calc(30px*var(--ui-space-scale,1))] pb-2 pt-1">
<div className="mx-auto w-full max-w-[var(--custom-chat-max-width,48rem)]">{composer}</div>
{showModelDisclaimer && (
<p className="composer-footer-note">
@@ -949,7 +949,7 @@ const LoraCompareContent = memo(function LoraCompareContent({
}
borderClassName="border-t border-border/60 md:border-t-0 md:border-l"
header={
- <div className="shrink-0 px-3 py-1.5 text-start md:text-end md:pr-[calc(4rem+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]">
+ <div className="shrink-0 px-3 py-1.5 text-start md:text-end md:pr-[calc(4rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]">
<span className="text-ui-10 font-semibold uppercase tracking-wider text-primary">
Fine-tuned
</span>
@@ -1001,12 +1001,12 @@ function GeneralCompareHeader({
return (
<div
className={cn(
- "pointer-events-none relative z-40 flex h-[48px] shrink-0 items-start gap-2 bg-background pt-[var(--studio-chat-header-padding-top,11px)]",
+ "pointer-events-none relative z-40 flex h-[calc(48px*var(--ui-space-scale,1))] shrink-0 items-start gap-2 bg-background pt-[var(--studio-chat-header-padding-top,11px)]",
side === "left"
? pinned
? "pl-12 pr-3 md:pl-2"
- : "pl-12 pr-3 md:pl-[calc(0.5rem+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]"
- : "pl-3 pr-[calc(3rem+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
+ : "pl-12 pr-3 md:pl-[calc(0.5rem*var(--ui-space-scale,1)+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]"
+ : "pl-3 pr-[calc(3rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
)}
>
<ModelSelector
@@ -1719,7 +1719,7 @@ function ProjectLanding({
}
>
{/* Slightly narrower than the composer max; every block shares this. */}
- <div className="mx-auto flex w-full max-w-[44rem] flex-col pt-[120px] pb-14">
+ <div className="mx-auto flex w-full max-w-[44rem] flex-col pt-[calc(120px*var(--ui-space-scale,1))] pb-14">
<div className="mb-12 flex items-center gap-4">
<span className="flex size-13 shrink-0 items-center justify-center rounded-[18px] bg-muted text-foreground/80">
<HugeiconsIcon
@@ -1828,7 +1828,7 @@ function ProjectLanding({
return (
<div
key={`${item.type}:${item.id}`}
- className="flex min-h-[58px] w-full items-center rounded-full px-4 py-2"
+ className="flex min-h-[calc(58px*var(--ui-space-scale,1))] w-full items-center rounded-full px-4 py-2"
>
<div className="min-w-0 flex-1">
<input
@@ -1875,7 +1875,7 @@ function ProjectLanding({
return (
<div
key={`${item.type}:${item.id}`}
- className="group relative flex min-h-[58px] w-full items-center rounded-full transition-colors hover:bg-nav-surface-hover has-[[data-state=open]]:bg-nav-surface-hover"
+ className="group relative flex min-h-[calc(58px*var(--ui-space-scale,1))] w-full items-center rounded-full transition-colors hover:bg-nav-surface-hover has-[[data-state=open]]:bg-nav-surface-hover"
>
<button
type="button"
@@ -1888,7 +1888,7 @@ function ProjectLanding({
: { compare: item.id, project: projectId },
});
}}
- className="flex min-h-[58px] min-w-0 flex-1 items-center gap-4 rounded-full px-4 py-2 text-left"
+ className="flex min-h-[calc(58px*var(--ui-space-scale,1))] min-w-0 flex-1 items-center gap-4 rounded-full px-4 py-2 text-left"
>
<div className="min-w-0 flex-1">
<div className="truncate text-ui-15 font-semibold leading-5 text-foreground">
@@ -3989,16 +3989,16 @@ export function ChatPage({
)}
<div
className={cn(
- "pointer-events-none absolute top-[var(--studio-content-top-inset,0px)] left-0 right-[10px] z-40 flex h-[var(--studio-chat-header-height,48px)] shrink-0 items-start bg-background pt-[var(--studio-chat-header-padding-top,11px)] pr-[calc(0.5rem+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
+ "pointer-events-none absolute top-[var(--studio-content-top-inset,0px)] left-0 right-[10px] z-40 flex h-[var(--studio-chat-header-height,48px)] shrink-0 items-start bg-background pt-[var(--studio-chat-header-padding-top,11px)] pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
isMobile
? "pl-12"
: pinned
? "pl-2"
: isTauri
? "pl-[var(--studio-collapsed-chat-controls-inset,0.75rem)]"
- : "pl-[calc(0.5rem+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]",
+ : "pl-[calc(0.5rem*var(--ui-space-scale,1)+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]",
view.mode === "compare" &&
- "right-[10px] left-auto w-auto bg-transparent pl-0 pr-[calc(0.5rem+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
+ "right-[10px] left-auto w-auto bg-transparent pl-0 pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
)}
>
<div className="pointer-events-auto flex items-center gap-1">
@@ -4010,7 +4010,7 @@ export function ChatPage({
title="New chat"
aria-label="New chat"
onClick={handleDesktopNewChat}
- className="!size-[30px] rounded-[10px] text-muted-foreground"
+ className="!size-[calc(30px*var(--ui-space-scale,1))] rounded-[10px] text-muted-foreground"
>
<HugeiconsIcon
icon={PencilEdit02Icon}
@@ -4153,7 +4153,7 @@ export function ChatPage({
type="button"
onClick={toggleIncognito}
className={cn(
- "flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
+ "flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
incognito
? "bg-primary/10 text-primary hover:bg-primary/15"
: "text-nav-fg hover:bg-nav-surface-hover hover:text-black dark:hover:text-white",
@@ -4193,7 +4193,7 @@ export function ChatPage({
closeArtifactSurface();
openResearchPanel(latestResearchRunId);
}}
- className="relative flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:hover:text-white"
+ className="relative flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:hover:text-white"
aria-label="Open research activity"
aria-pressed={openResearchRunId === latestResearchRunId}
>
@@ -4221,7 +4221,7 @@ export function ChatPage({
useResearchRunStore.getState().closePanel();
setSettingsOpen(true);
}}
- className="flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] text-nav-fg transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
aria-label="Open run settings"
>
<HugeiconsIcon
diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
index 3027db16547..22a3c7dfcc8 100644
--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx
+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
@@ -1081,7 +1081,7 @@ export function ChatSettingsPanel({
<div className="hint-on-hover flex h-full min-h-0 flex-col">
{/* Header is outside the scroll area so the scrollbar never shifts the close button.
Reuse the chat header metrics so the toggle stays put when the panel opens. */}
- <div className="flex h-[var(--studio-chat-header-height,48px)] shrink-0 items-start gap-2 bg-panel-surface pl-[18px] pr-[18px] pt-[var(--studio-chat-header-padding-top,11px)]">
+ <div className="flex h-[var(--studio-chat-header-height,48px)] shrink-0 items-start gap-2 bg-panel-surface pl-[calc(18px*var(--ui-space-scale,1))] pr-[calc(18px*var(--ui-space-scale,1))] pt-[var(--studio-chat-header-padding-top,11px)]">
{isMobile ? (
<span className="flex h-[var(--studio-chat-control-height,34px)] flex-1 items-center text-ui-16 font-semibold tracking-[0em] dark:tracking-[0.015em] text-nav-fg">
Run settings
@@ -1096,7 +1096,7 @@ export function ChatSettingsPanel({
<button
type="button"
onClick={() => onOpenChange?.(false)}
- className="flex size-[30px] cursor-pointer items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="flex size-[calc(30px*var(--ui-space-scale,1))] cursor-pointer items-center justify-center rounded-[10px] text-nav-icon-idle dark:text-nav-fg-muted transition-colors hover:bg-nav-surface-hover hover:text-black dark:hover:text-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
aria-label="Close run settings"
>
<HugeiconsIcon
@@ -1122,7 +1122,7 @@ export function ChatSettingsPanel({
ref={settingsScrollRef}
className="run-settings-scroll relative min-h-0 flex-1 overflow-y-auto"
>
- <div className="px-[18px] pt-3">
+ <div className="px-[calc(18px*var(--ui-space-scale,1))] pt-3">
{(hasModelContent || modelConfig) && (
<CollapsibleSection label="Model" defaultOpen={true} first={true}>
<div className="flex flex-col gap-5">
diff --git a/studio/frontend/src/features/chat/components/project-switcher.tsx b/studio/frontend/src/features/chat/components/project-switcher.tsx
index 4c9bec19f13..44e52ad8c9d 100644
--- a/studio/frontend/src/features/chat/components/project-switcher.tsx
+++ b/studio/frontend/src/features/chat/components/project-switcher.tsx
@@ -69,7 +69,7 @@ export function ProjectSwitcher({
? "Loading project"
: "Pick a project"
}
- className="-mx-1 flex h-[34px] shrink-0 items-center gap-2 rounded-full pl-3 pr-2.5 transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="-mx-1 flex h-[calc(34px*var(--ui-space-scale,1))] shrink-0 items-center gap-2 rounded-full pl-3 pr-2.5 transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
>
<HugeiconsIcon
icon={Folder01Icon}
diff --git a/studio/frontend/src/features/chat/components/youtube-transcript-prompt.tsx b/studio/frontend/src/features/chat/components/youtube-transcript-prompt.tsx
index c35bacaabbd..ba2df33350f 100644
--- a/studio/frontend/src/features/chat/components/youtube-transcript-prompt.tsx
+++ b/studio/frontend/src/features/chat/components/youtube-transcript-prompt.tsx
@@ -122,7 +122,7 @@ export function YoutubeTranscriptPrompt({
return (
<div
- className="relative z-0 mx-7 mb-[-8px] rounded-t-[18px] rounded-b-none border border-border/45 bg-background/90 px-5 py-2 text-muted-foreground shadow-none backdrop-blur-md dark:bg-card/85"
+ className="relative z-0 mx-7 mb-[calc(-8px*var(--ui-space-scale,1))] rounded-t-[18px] rounded-b-none border border-border/45 bg-background/90 px-5 py-2 text-muted-foreground shadow-none backdrop-blur-md dark:bg-card/85"
aria-label="Attach YouTube transcript"
>
<div className="grid h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-2.5">
diff --git a/studio/frontend/src/features/chat/projects-page.tsx b/studio/frontend/src/features/chat/projects-page.tsx
index 378945c97c8..46f1b7565ce 100644
--- a/studio/frontend/src/features/chat/projects-page.tsx
+++ b/studio/frontend/src/features/chat/projects-page.tsx
@@ -989,7 +989,7 @@ export function ProjectsPage() {
</div>
</div>
{chatsOpen && (
- <div className="mb-2 flex flex-col gap-0.5 pl-[76px]">
+ <div className="mb-2 flex flex-col gap-0.5 pl-[calc(76px*var(--ui-space-scale,1))]">
{chats === undefined || chats === "loading" ? (
<Skeleton className="h-6 w-48 rounded-[8px]" />
) : chats === "error" ? (
diff --git a/studio/frontend/src/features/hub/catalog/card-carousel.tsx b/studio/frontend/src/features/hub/catalog/card-carousel.tsx
index 99514c1154c..4c41a15238c 100644
--- a/studio/frontend/src/features/hub/catalog/card-carousel.tsx
+++ b/studio/frontend/src/features/hub/catalog/card-carousel.tsx
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { cn } from "@/lib/utils";
import {
type MouseEvent as ReactMouseEvent,
@@ -73,8 +74,13 @@ export function CardCarousel<T>({
const scrollerRef = useRef<HTMLDivElement>(null);
const [canLeft, setCanLeft] = useState(false);
const [canRight, setCanRight] = useState(false);
- const stepPx = itemWidth + CARD_GAP_PX;
- const arrowCenterPx = CAROUSEL_TOP_PADDING_PX + itemHeight / 2;
+ // gap-4 and pt-2 scale with the UI font size, like the cards themselves, so
+ // the stride and the arrow's centre line take the same scale.
+ const scale = useUiSpaceScale();
+ const gapPx = CARD_GAP_PX * scale;
+ const topPaddingPx = CAROUSEL_TOP_PADDING_PX * scale;
+ const stepPx = itemWidth + gapPx;
+ const arrowCenterPx = topPaddingPx + itemHeight / 2;
const updateArrows = useCallback(() => {
const el = scrollerRef.current;
@@ -93,8 +99,12 @@ export function CardCarousel<T>({
}, [updateArrows]);
useEffect(() => {
+ // The stride and the cards scale with the UI font size, which moves
+ // scrollWidth. The observer above only sees the scroller's own box, so the
+ // dimensions belong here rather than being left to a height that happens
+ // to change alongside them.
updateArrows();
- }, [updateArrows, items]);
+ }, [updateArrows, items, itemWidth, itemHeight, gapPx]);
const scrollByCards = useCallback(
(direction: 1 | -1) => {
@@ -194,13 +204,13 @@ export function CardCarousel<T>({
aria-hidden="true"
data-visible={canLeft || undefined}
className="hub-carousel-fade hub-carousel-fade-left"
- style={{ top: CAROUSEL_TOP_PADDING_PX, height: itemHeight }}
+ style={{ top: topPaddingPx, height: itemHeight }}
/>
<div
aria-hidden="true"
data-visible={canRight || undefined}
className="hub-carousel-fade hub-carousel-fade-right"
- style={{ top: CAROUSEL_TOP_PADDING_PX, height: itemHeight }}
+ style={{ top: topPaddingPx, height: itemHeight }}
/>
<CarouselArrow
side="left"
diff --git a/studio/frontend/src/features/hub/catalog/catalog-states.tsx b/studio/frontend/src/features/hub/catalog/catalog-states.tsx
index 7c8b5b851f3..2fe02ba2a2b 100644
--- a/studio/frontend/src/features/hub/catalog/catalog-states.tsx
+++ b/studio/frontend/src/features/hub/catalog/catalog-states.tsx
@@ -11,6 +11,7 @@ import {
import type { IconSvgElement } from "@hugeicons/react";
import { HugeiconsIcon } from "@hugeicons/react";
import type { ReactNode } from "react";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { useLayoutEffect, useRef, useState } from "react";
import type { HubFailure } from "@/features/hub/lib/network";
@@ -295,8 +296,8 @@ function SkeletonRow() {
<div className="flex items-center gap-3 px-3 py-2.5">
<div className="size-8 shrink-0 animate-pulse rounded-[9px] bg-muted" />
<div className="min-w-0 flex-1 space-y-1.5">
- <div className="h-[13px] w-1/2 animate-pulse rounded-full bg-muted" />
- <div className="h-[11px] w-3/4 animate-pulse rounded-full bg-muted/70" />
+ <div className="h-[calc(13px*var(--ui-space-scale,1))] w-1/2 animate-pulse rounded-full bg-muted" />
+ <div className="h-[calc(11px*var(--ui-space-scale,1))] w-3/4 animate-pulse rounded-full bg-muted/70" />
</div>
</div>
);
@@ -307,11 +308,14 @@ const MIN_SKELETON_ROWS = 4;
const MAX_SKELETON_ROWS = 24;
const DEFAULT_SKELETON_ROWS = 6;
-function clampSkeletonCount(height: number): number {
+// The row's padding, avatar and bars follow the UI font size, so the estimate
+// does too, or the list under-fills at small sizes and overflows at large.
+function clampSkeletonCount(height: number, scale: number): number {
if (!Number.isFinite(height) || height <= 0) return DEFAULT_SKELETON_ROWS;
+ const rowHeight = SKELETON_ROW_ESTIMATE_PX * scale;
return Math.max(
MIN_SKELETON_ROWS,
- Math.min(MAX_SKELETON_ROWS, Math.ceil(height / SKELETON_ROW_ESTIMATE_PX)),
+ Math.min(MAX_SKELETON_ROWS, Math.ceil(height / rowHeight)),
);
}
@@ -319,6 +323,7 @@ export function SkeletonList({ count }: { count?: number }) {
const ref = useRef<HTMLUListElement>(null);
const [autoCount, setAutoCount] = useState(count ?? DEFAULT_SKELETON_ROWS);
const rowCount = count ?? autoCount;
+ const scale = useUiSpaceScale();
useLayoutEffect(() => {
if (count != null) return;
@@ -328,7 +333,7 @@ export function SkeletonList({ count }: { count?: number }) {
let frame: number | null = null;
const update = () => {
frame = null;
- setAutoCount(clampSkeletonCount(container.clientHeight));
+ setAutoCount(clampSkeletonCount(container.clientHeight, scale));
};
const schedule = () => {
if (frame !== null) return;
@@ -350,7 +355,7 @@ export function SkeletonList({ count }: { count?: number }) {
if (frame !== null) window.cancelAnimationFrame(frame);
observer.disconnect();
};
- }, [count]);
+ }, [count, scale]);
return (
<ul ref={ref} className="divide-y divide-border" aria-hidden="true">
diff --git a/studio/frontend/src/features/hub/catalog/hub-section-row.tsx b/studio/frontend/src/features/hub/catalog/hub-section-row.tsx
index 5b15a6c8a2c..b8c4eed9554 100644
--- a/studio/frontend/src/features/hub/catalog/hub-section-row.tsx
+++ b/studio/frontend/src/features/hub/catalog/hub-section-row.tsx
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { Skeleton } from "@/components/ui/skeleton";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { memo } from "react";
import type { DiscoverRow } from "../types";
import { CardCarousel } from "./card-carousel";
@@ -16,14 +17,20 @@ import {
const SKELETON_KEYS = ["s0", "s1", "s2", "s3", "s4"] as const;
-function HubSectionRowSkeleton() {
+function HubSectionRowSkeleton({
+ width,
+ height,
+}: {
+ width: number;
+ height: number;
+}) {
return (
<div className="flex gap-4 overflow-hidden pb-4 pt-2">
{SKELETON_KEYS.map((key) => (
<Skeleton
key={key}
className="shrink-0 rounded-[20px]"
- style={{ width: MODEL_CARD_WIDTH_PX, height: MODEL_CARD_HEIGHT_PX }}
+ style={{ width, height }}
/>
))}
</div>
@@ -47,6 +54,11 @@ export const HubSectionRow = memo(function HubSectionRow({
isDataset: boolean;
isLoading: boolean;
}) {
+ // The card's padding, avatar and text scale with the UI font size, and the
+ // card clips its overflow, so the carousel slot scales with them.
+ const scale = useUiSpaceScale();
+ const cardWidth = Math.round(MODEL_CARD_WIDTH_PX * scale);
+ const cardHeight = Math.round(MODEL_CARD_HEIGHT_PX * scale);
const showSkeleton = isLoading && rows.length === 0;
if (!showSkeleton && rows.length === 0) {
return null;
@@ -69,13 +81,13 @@ export const HubSectionRow = memo(function HubSectionRow({
</button>
</h2>
{showSkeleton ? (
- <HubSectionRowSkeleton />
+ <HubSectionRowSkeleton width={cardWidth} height={cardHeight} />
) : (
<CardCarousel
items={rows}
getKey={(row) => row.id}
- itemWidth={MODEL_CARD_WIDTH_PX}
- itemHeight={MODEL_CARD_HEIGHT_PX}
+ itemWidth={cardWidth}
+ itemHeight={cardHeight}
ariaLabel={title}
renderItem={(row) => (
<ModelCard
diff --git a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx
index 45b4204c591..6bc7b013088 100644
--- a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx
+++ b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx
@@ -520,7 +520,7 @@ export function LocalOnDeviceCard({
setVariantOpen(false);
}}
className={cn(
- "mx-2 flex w-[calc(100%-1rem)] min-w-0 cursor-pointer items-center gap-2 rounded-[10px] px-2.5 py-2 text-left transition-colors",
+ "mx-2 flex w-[calc(100%-1rem*var(--ui-space-scale,1))] min-w-0 cursor-pointer items-center gap-2 rounded-[10px] px-2.5 py-2 text-left transition-colors",
isSelected
? "bg-[color-mix(in_oklab,var(--foreground)_calc(7%*var(--contrast-wash-gain,1)),transparent)] dark:bg-[color-mix(in_oklab,var(--foreground)_calc(12%*var(--contrast-wash-gain,1)),transparent)]"
: "hover:bg-[color-mix(in_oklab,var(--foreground)_calc(5%*var(--contrast-wash-gain,1)),transparent)] dark:hover:bg-[color-mix(in_oklab,var(--foreground)_calc(6%*var(--contrast-wash-gain,1)),transparent)]",
diff --git a/studio/frontend/src/features/hub/catalog/model-card.tsx b/studio/frontend/src/features/hub/catalog/model-card.tsx
index 27e6efda918..a02959d52bc 100644
--- a/studio/frontend/src/features/hub/catalog/model-card.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-card.tsx
@@ -300,7 +300,7 @@ export const ModelCard = memo(function ModelCard({
)}
</span>
</div>
- <div className="mt-[3px] flex shrink-0 items-center gap-1">
+ <div className="mt-[calc(3px*var(--ui-space-scale,1))] flex shrink-0 items-center gap-1">
<AccessGlyphs
gated={row.result.gated}
isPrivate={row.result.private}
@@ -329,7 +329,7 @@ export const ModelCard = memo(function ModelCard({
</div>
</div>
<div className="mt-auto flex items-end justify-between gap-2 pt-2.5">
- <div className="hub-trending-stats flex min-w-0 items-center gap-2.5 pb-[3px]">
+ <div className="hub-trending-stats flex min-w-0 items-center gap-2.5 pb-[calc(3px*var(--ui-space-scale,1))]">
<StatChip
icon={Download01Icon}
value={formatCompact(row.result.downloads)}
diff --git a/studio/frontend/src/features/hub/catalog/model-inspector.tsx b/studio/frontend/src/features/hub/catalog/model-inspector.tsx
index 79431827560..45c3c0f82f1 100644
--- a/studio/frontend/src/features/hub/catalog/model-inspector.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-inspector.tsx
@@ -580,7 +580,7 @@ export const ModelInspector = memo(function ModelInspector({
<OwnerAvatar
owner={model.owner}
repoName={model.title}
- className="size-[60px] rounded-[18px] text-ui-19"
+ className="size-[calc(60px*var(--ui-space-scale,1))] rounded-[18px] text-ui-19"
/>
<div className="min-w-0 flex-1">
<div className="flex min-w-0 items-center gap-1.5">
diff --git a/studio/frontend/src/features/hub/catalog/model-readme.tsx b/studio/frontend/src/features/hub/catalog/model-readme.tsx
index e249bf542ed..b59cd9280f1 100644
--- a/studio/frontend/src/features/hub/catalog/model-readme.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-readme.tsx
@@ -504,7 +504,7 @@ export function ModelReadme({
? current.error
: readmeUnavailableMessage(subject);
return (
- <p className="min-h-[44px] text-ui-12p5 text-muted-foreground">
+ <p className="min-h-[calc(44px*var(--ui-space-scale,1))] text-ui-12p5 text-muted-foreground">
{errorMessage}
</p>
);
@@ -512,7 +512,7 @@ export function ModelReadme({
if (!current.body) {
return (
- <p className="min-h-[44px] text-ui-12p5 text-muted-foreground">
+ <p className="min-h-[calc(44px*var(--ui-space-scale,1))] text-ui-12p5 text-muted-foreground">
{readmeMissingMessage(subject)}
</p>
);
diff --git a/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx b/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx
index 1acda818dd1..bde665baf8f 100644
--- a/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx
@@ -40,7 +40,12 @@ import {
NetworkErrorState,
SkeletonList,
} from "./catalog-states";
-import { InventoryRow, VirtualRows } from "./models-catalog-rows";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
+import {
+ CATALOG_COLUMN_GAP_PX,
+ InventoryRow,
+ VirtualRows,
+} from "./models-catalog-rows";
import {
type AllModelsView,
type InventorySort,
@@ -390,6 +395,12 @@ export function DownloadedList({
? RESULT_SPLIT_ROW_HEIGHT_PX
: RESULT_GRID_ROW_HEIGHT_PX;
const cellHeightPx = compact ? RESULT_SPLIT_HEIGHT_PX : RESULT_GRID_HEIGHT_PX;
+ // VirtualRows scales its own slots with the UI font size. The pinned grid
+ // below lays the same rows out by hand, so it scales here to match.
+ const pinnedScale = useUiSpaceScale();
+ const pinnedRowHeightPx = Math.round(rowHeightPx * pinnedScale);
+ const pinnedCellHeightPx = Math.round(cellHeightPx * pinnedScale);
+ const pinnedColumnGapPx = Math.round(CATALOG_COLUMN_GAP_PX * pinnedScale);
const renderInventoryRow = (item: InventoryItem) => (
<InventoryRow
row={item.row}
@@ -475,9 +486,9 @@ export function DownloadedList({
style={{
display: "grid",
gridTemplateColumns: `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`,
- columnGap: 12,
- rowGap: rowHeightPx - cellHeightPx,
- paddingBottom: rowHeightPx - cellHeightPx,
+ columnGap: pinnedColumnGapPx,
+ rowGap: pinnedRowHeightPx - pinnedCellHeightPx,
+ paddingBottom: pinnedRowHeightPx - pinnedCellHeightPx,
}}
>
{pinnedItems.map((item) => {
@@ -502,7 +513,7 @@ export function DownloadedList({
key={rowKey}
className="min-w-0"
style={{
- height: cellHeightPx,
+ height: pinnedCellHeightPx,
opacity: dragRowKey === rowKey ? 0.4 : undefined,
}}
draggable={itemPinKey != null}
diff --git a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx
index 715cc62344b..b53dec39173 100644
--- a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx
@@ -26,6 +26,7 @@ import {
pinKey,
usePinnedModelsStore,
} from "@/features/model-picker";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { cn, formatCompact } from "@/lib/utils";
import {
Download01Icon,
@@ -41,6 +42,7 @@ import {
memo,
useCallback,
useContext,
+ useEffect,
useMemo,
useRef,
useState,
@@ -471,8 +473,8 @@ export const DiscoverModelRow = memo(function DiscoverModelRow({
className="size-8 rounded-[11px]"
remote={false}
/>
- <div className="flex min-w-0 flex-1 flex-col gap-[3px]">
- <div className="flex h-[18px] min-w-0 items-center justify-between gap-2">
+ <div className="flex min-w-0 flex-1 flex-col gap-[calc(3px*var(--ui-space-scale,1))]">
+ <div className="flex h-[calc(18px*var(--ui-space-scale,1))] min-w-0 items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-2 pr-2">
<p className="truncate text-ui-12 font-medium leading-ui-18 tracking-[-0.005em] text-foreground">
{row.repo}
@@ -510,7 +512,7 @@ export const DiscoverModelRow = memo(function DiscoverModelRow({
/>
</div>
</div>
- <div className="flex h-[16px] min-w-0 items-center justify-between gap-2 text-ui-11p5 leading-ui-16 text-muted-foreground/85">
+ <div className="flex h-[calc(16px*var(--ui-space-scale,1))] min-w-0 items-center justify-between gap-2 text-ui-11p5 leading-ui-16 text-muted-foreground/85">
<span className="flex min-w-0 items-center gap-1">
<span className="truncate">{row.owner}</span>
{row.owner.toLowerCase() === "unsloth" && (
@@ -892,6 +894,8 @@ export const InventoryRow = memo(function InventoryRow({
});
export const CATALOG_ROW_HEIGHT_PX = 57;
+/** Gutter between lanes, shared with the hand-laid grids beside these rows. */
+export const CATALOG_COLUMN_GAP_PX = 12;
export function VirtualRows<T>({
items,
@@ -902,7 +906,7 @@ export function VirtualRows<T>({
columns = 1,
rowHeight = CATALOG_ROW_HEIGHT_PX,
cellHeight = rowHeight,
- columnGap = 12,
+ columnGap = CATALOG_COLUMN_GAP_PX,
}: {
items: readonly T[];
scrollElement: HTMLDivElement | null;
@@ -916,11 +920,17 @@ export function VirtualRows<T>({
}) {
const lanes = Math.max(1, columns);
const rowCount = Math.ceil(items.length / lanes);
+ // The rows inside these slots scale with the UI font size, so the slots do
+ // too, or tall rows run into the next absolutely positioned one.
+ const scale = useUiSpaceScale();
+ const slotHeight = Math.round(rowHeight * scale);
+ const slotCellHeight = Math.round(cellHeight * scale);
+ const laneGap = Math.round(columnGap * scale);
// eslint-disable-next-line react-hooks/incompatible-library
const virtualizer = useVirtualizer({
count: rowCount,
getScrollElement: () => scrollElement,
- estimateSize: () => rowHeight,
+ estimateSize: () => slotHeight,
overscan: 10,
scrollMargin,
getItemKey: (rowIndex) => {
@@ -929,6 +939,11 @@ export function VirtualRows<T>({
},
});
+ // Sizes are cached from estimateSize, so a new scale has to invalidate them.
+ useEffect(() => {
+ virtualizer.measure();
+ }, [virtualizer, slotHeight]);
+
return (
<ul
style={{
@@ -952,7 +967,7 @@ export function VirtualRows<T>({
transform: `translateY(${virtualRow.start - scrollMargin}px)`,
// Fixed height matching estimateSize (no measureElement ref): dynamic per-row
// measurement churns virtualizer state and causes visible jumps as new rows arrive.
- height: `${rowHeight}px`,
+ height: `${slotHeight}px`,
contain: "layout",
}}
>
@@ -960,8 +975,8 @@ export function VirtualRows<T>({
style={{
display: "grid",
gridTemplateColumns: `repeat(${lanes}, minmax(0, 1fr))`,
- columnGap: `${columnGap}px`,
- height: `${cellHeight}px`,
+ columnGap: `${laneGap}px`,
+ height: `${slotCellHeight}px`,
}}
>
{Array.from({ length: lanes }, (_, lane) => {
diff --git a/studio/frontend/src/features/hub/catalog/models-table.tsx b/studio/frontend/src/features/hub/catalog/models-table.tsx
index 1868a011006..403a97afc02 100644
--- a/studio/frontend/src/features/hub/catalog/models-table.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-table.tsx
@@ -73,11 +73,11 @@ const LIST_COLS = {
model: "flex min-w-0 flex-[2.4] items-center gap-3",
caps: "hidden min-w-0 flex-[1.7] items-center gap-1.5 md:flex",
capsModel: "hidden w-[132px] shrink-0 items-center gap-1.5 md:flex",
- size: "hidden w-[60px] shrink-0 lg:block",
+ size: "hidden w-[calc(60px*var(--ui-space-scale,1))] shrink-0 lg:block",
updated: "hidden w-[82px] shrink-0 xl:block",
downloads: "hidden w-[104px] shrink-0 items-center gap-1.5 sm:flex",
likes: "hidden w-[76px] shrink-0 items-center gap-1.5 sm:flex",
- actions: "flex w-[64px] shrink-0 items-center justify-end gap-0.5",
+ actions: "flex w-[calc(64px*var(--ui-space-scale,1))] shrink-0 items-center justify-end gap-0.5",
} as const;
function ViewToggleButton({
@@ -645,7 +645,7 @@ export const ResultCard = memo(function ResultCard({
<OwnerAvatar
owner={row.owner}
repoName={row.repo}
- className="size-[52px] shrink-0 rounded-[16px] text-ui-16 ring-1 ring-[rgb(0_0_0_/_calc(0.05*var(--contrast-edge-gain,1)))] dark:ring-[rgb(255_255_255_/_calc(0.1*var(--contrast-edge-gain,1)))]"
+ className="size-[calc(52px*var(--ui-space-scale,1))] shrink-0 rounded-[16px] text-ui-16 ring-1 ring-[rgb(0_0_0_/_calc(0.05*var(--contrast-edge-gain,1)))] dark:ring-[rgb(255_255_255_/_calc(0.1*var(--contrast-edge-gain,1)))]"
remote={false}
/>
<div className="flex min-w-0 flex-1 flex-col">
diff --git a/studio/frontend/src/features/hub/catalog/transport-toggle.tsx b/studio/frontend/src/features/hub/catalog/transport-toggle.tsx
index 08c8ff3e995..6c0aa5422eb 100644
--- a/studio/frontend/src/features/hub/catalog/transport-toggle.tsx
+++ b/studio/frontend/src/features/hub/catalog/transport-toggle.tsx
@@ -53,7 +53,7 @@ export function TransportToggle() {
return (
<fieldset
aria-label="Download transport"
- className="hub-tag-soft m-0 inline-flex h-[26px] min-w-0 items-center gap-0.5 rounded-full border-0 p-0.5 text-ui-11"
+ className="hub-tag-soft m-0 inline-flex h-[calc(26px*var(--ui-space-scale,1))] min-w-0 items-center gap-0.5 rounded-full border-0 p-0.5 text-ui-11"
>
{OPTIONS.map((opt) => {
const active = mode === opt.value;
@@ -79,7 +79,7 @@ export function TransportToggle() {
if (!disabled) setMode(opt.value);
}}
className={cn(
- "inline-flex h-[22px] items-center justify-center rounded-full px-2 font-medium tracking-tight transition-colors",
+ "inline-flex h-[calc(22px*var(--ui-space-scale,1))] items-center justify-center rounded-full px-2 font-medium tracking-tight transition-colors",
disabled
? "cursor-not-allowed text-muted-foreground/45"
: active
diff --git a/studio/frontend/src/features/hub/components/hf-token-indicator.tsx b/studio/frontend/src/features/hub/components/hf-token-indicator.tsx
index e4d09034b95..fca37abfce6 100644
--- a/studio/frontend/src/features/hub/components/hf-token-indicator.tsx
+++ b/studio/frontend/src/features/hub/components/hf-token-indicator.tsx
@@ -111,7 +111,7 @@ export function HfTokenIndicator({
aria-label={ariaLabel}
className={cn(
// Solid circle reads optically larger than the flat HTTP/Xet box, so keep it 22px.
- "inline-flex h-[22px] w-[22px] items-center justify-center rounded-full text-ui-11p5 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
+ "inline-flex h-[calc(22px*var(--ui-space-scale,1))] w-[calc(22px*var(--ui-space-scale,1))] items-center justify-center rounded-full text-ui-11p5 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
hasToken
? "hub-tag-soft text-muted-foreground hover:text-foreground/80"
: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.css
index 46a24e7a6a7..a378bb587e3 100644
--- a/studio/frontend/src/features/hub/hub.css
+++ b/studio/frontend/src/features/hub/hub.css
@@ -748,7 +748,7 @@
@layer utilities {
.hub-tag-soft,
.hub-tag-meta {
- @apply min-h-[26px] rounded-full bg-muted/70 ring-1 ring-inset;
+ @apply min-h-[calc(26px*var(--ui-space-scale,1))] rounded-full bg-muted/70 ring-1 ring-inset;
--tw-ring-color: color-mix(in srgb, var(--foreground) calc(3.5% * var(--contrast-edge-gain, 1)), transparent);
}
@@ -1072,7 +1072,7 @@
display: flex;
flex-wrap: wrap;
align-items: center;
- gap: 0.5rem;
+ gap: calc(0.5rem * var(--ui-space-scale, 1));
}
.hub-readme-prose :is(p, div):has(> a:nth-of-type(2) > img) > br {
@@ -1101,12 +1101,12 @@
cursor: pointer;
align-items: center;
justify-content: center;
- gap: 0.5rem;
+ gap: calc(0.5rem * var(--ui-space-scale, 1));
white-space: nowrap;
border-radius: 9999px;
background-color: transparent;
- padding-left: 0.75rem;
- padding-right: 0.75rem;
+ padding-left: calc(0.75rem * var(--ui-space-scale, 1));
+ padding-right: calc(0.75rem * var(--ui-space-scale, 1));
font-size: calc(0.8125rem * var(--ui-font-scale, 1));
font-weight: 500;
line-height: calc(1.125rem * var(--ui-font-scale, 1));
@@ -1142,12 +1142,12 @@
cursor: pointer;
align-items: center;
justify-content: center;
- gap: 0.4rem;
+ gap: calc(0.4rem * var(--ui-space-scale, 1));
white-space: nowrap;
border-radius: 9999px;
background-color: var(--status-success);
- padding-left: 1rem;
- padding-right: 1rem;
+ padding-left: calc(1rem * var(--ui-space-scale, 1));
+ padding-right: calc(1rem * var(--ui-space-scale, 1));
font-size: calc(0.8125rem * var(--ui-font-scale, 1));
font-weight: 600;
line-height: calc(1.125rem * var(--ui-font-scale, 1));
@@ -1243,8 +1243,8 @@
.hub-page .field-trigger.field-filter {
color: var(--muted-foreground);
font-weight: 400;
- padding-top: 0.25rem;
- padding-bottom: 0.25rem;
+ padding-top: calc(0.25rem * var(--ui-space-scale, 1));
+ padding-bottom: calc(0.25rem * var(--ui-space-scale, 1));
line-height: calc(1.25rem * var(--ui-font-scale, 1));
}
@@ -1256,9 +1256,9 @@
display: inline-flex;
flex-shrink: 0;
align-items: center;
- gap: 0.4rem;
+ gap: calc(0.4rem * var(--ui-space-scale, 1));
height: 2rem;
- padding-inline: 0.7rem;
+ padding-inline: calc(0.7rem * var(--ui-space-scale, 1));
border-radius: 9999px;
border: 1px solid color-mix(in srgb, var(--foreground) calc(8% * var(--contrast-edge-gain, 1)), transparent);
background-color: color-mix(in srgb, var(--foreground) calc(2.5% * var(--contrast-wash-gain, 1)), transparent);
@@ -1450,7 +1450,7 @@
@layer utilities {
.hub-chip {
- @apply inline-flex items-center gap-1 rounded-full px-2 py-[3px] text-ui-11 font-medium leading-none;
+ @apply inline-flex items-center gap-1 rounded-full px-2 py-[calc(3px*var(--ui-space-scale,1))] text-ui-11 font-medium leading-none;
background-color: color-mix(in srgb, var(--foreground) calc(5% * var(--contrast-wash-gain, 1)), transparent);
color: var(--muted-foreground);
}
@@ -1460,7 +1460,7 @@
}
.hub-meta-tag {
- @apply inline-flex h-[18px] shrink-0 items-center gap-1 rounded-full px-2 text-ui-11 font-medium leading-none;
+ @apply inline-flex h-[calc(18px*var(--ui-space-scale,1))] shrink-0 items-center gap-1 rounded-full px-2 text-ui-11 font-medium leading-none;
background-color: color-mix(in srgb, var(--foreground) calc(5% * var(--contrast-wash-gain, 1)), transparent);
color: var(--muted-foreground);
}
diff --git a/studio/frontend/src/features/igpu-carveout/igpu-carveout-toast.ts b/studio/frontend/src/features/igpu-carveout/igpu-carveout-toast.ts
index aebb9da4d83..f80652a78f9 100644
--- a/studio/frontend/src/features/igpu-carveout/igpu-carveout-toast.ts
+++ b/studio/frontend/src/features/igpu-carveout/igpu-carveout-toast.ts
@@ -32,7 +32,7 @@ export const IGPU_CARVEOUT_NOTICE_TITLE = "This model could run faster";
* of description floats it mid-toast, aligned to neither edge. Overridden here rather
* than in that shared rule because every other toast's action IS the thing to do. */
export const IGPU_CARVEOUT_ACTION_CLASS =
- "!justify-self-end !h-[26px] !border !border-border !bg-transparent !px-3 " +
+ "!justify-self-end !h-[calc(26px*var(--ui-space-scale,1))] !border !border-border !bg-transparent !px-3 " +
"!font-medium !text-foreground hover:!bg-accent";
/** The model the notice on screen is about, so an unload can take it down.
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index cdfb8db4f78..b6bd552f166 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -3882,7 +3882,7 @@ export function ImagesPage({
{active && <GuidedTour {...tour.tourProps} />}
{/* Keep the tabs centered over the preview at every width: the model rail holds at 408px when
space permits and shrinks only to preserve the controls. */}
- <div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">
+ <div className="pointer-events-none relative z-40 grid h-[calc(48px*var(--ui-space-scale,1))] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">
<div
className={cn(
"pointer-events-none flex h-full min-w-0 items-start overflow-hidden @[50rem]:border-r @[50rem]:border-border/60",
@@ -3914,7 +3914,7 @@ export function ImagesPage({
resolveDownloadFootprint={resolveDownloadFootprint}
onEject={status?.loaded ? handleUnload : undefined}
variant="ghost"
- className="!h-[34px] max-w-full gap-1 overflow-hidden pl-3 pr-1 @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"
+ className="!h-[calc(34px*var(--ui-space-scale,1))] max-w-full gap-1 overflow-hidden pl-3 pr-1 @[68rem]:gap-2 @[68rem]:pl-4 @[68rem]:pr-2"
triggerLabelClassName="text-ui-14 @[68rem]:text-ui-16"
task={IMAGE_GEN_TASKS}
catalog={IMAGE_CATALOG}
@@ -3931,7 +3931,7 @@ export function ImagesPage({
variant="outline"
size="sm"
aria-label="Cancel load"
- className="!h-[34px] rounded-full text-xs"
+ className="!h-[calc(34px*var(--ui-space-scale,1))] rounded-full text-xs"
onClick={() => void handleCancelLoad()}
>
Cancel load
@@ -3950,7 +3950,7 @@ export function ImagesPage({
value={pageMode}
onValueChange={(v) => setPageMode(v as "create" | "train")}
fit={true}
- className="h-[34px] [&>button]:h-[34px] [&>button]:px-3 @[68rem]:[&>button]:px-11"
+ className="h-[calc(34px*var(--ui-space-scale,1))] [&>button]:h-[calc(34px*var(--ui-space-scale,1))] [&>button]:px-3 @[68rem]:[&>button]:px-11"
tabs={[
{ value: "create", label: "Create", icon: <HugeiconsIcon icon={SparklesIcon} className="size-3.5" /> },
{ value: "train", label: "Train", icon: <HugeiconsIcon icon={TestTubeOutlineIcon} className="size-3.5" /> },
@@ -4593,7 +4593,7 @@ export function ImagesPage({
data-tour="images-preview"
className="relative flex min-h-[60dvh] min-w-0 flex-1 flex-col overflow-hidden @[50rem]:min-h-0"
>
- <div className="hover-scrollbar relative flex flex-1 items-center justify-center overflow-auto p-6 px-10 @[50rem]:pt-[60px]">
+ <div className="hover-scrollbar relative flex flex-1 items-center justify-center overflow-auto p-6 px-10 @[50rem]:pt-[calc(60px*var(--ui-space-scale,1))]">
{selected && selectedSrc ? (
<>
<img
diff --git a/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx b/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx
index 013c8d4e04a..3cb4b894b17 100644
--- a/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx
+++ b/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx
@@ -153,7 +153,7 @@ function LabelTile({
rows={2}
spellCheck={false}
placeholder="Describe this image..."
- className="min-h-[2.75rem] rounded-sm px-2 py-1.5 text-ui-11! leading-snug md:text-ui-11!"
+ className="min-h-[calc(2.75rem*var(--ui-space-scale,1))] rounded-sm px-2 py-1.5 text-ui-11! leading-snug md:text-ui-11!"
aria-label={`Caption for ${record.filename}`}
/>
{/* No leading-none: truncate's overflow would crop the descenders. */}
diff --git a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
index 48653bc158e..39bf10d3250 100644
--- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
+++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
@@ -1527,7 +1527,7 @@ export function DiffusionTrainPanel({
ref={attachSettingsScroll}
onScroll={onSettingsScroll}
className={cn(
- "hover-scrollbar panel-scroll-fade-action flex min-h-0 flex-1 flex-col gap-5 overflow-x-hidden pb-6 pl-0.5 pr-8 pt-[42px] @[50rem]:overflow-y-auto",
+ "hover-scrollbar panel-scroll-fade-action flex min-h-0 flex-1 flex-col gap-5 overflow-x-hidden pb-6 pl-0.5 pr-8 pt-[calc(42px*var(--ui-space-scale,1))] @[50rem]:overflow-y-auto",
settingsFadeClass,
)}
>
@@ -1891,7 +1891,7 @@ export function DiffusionTrainPanel({
cards' outer ring from being clipped. */}
{/* 40px off the rule, the gutter the settings column has off the page edge. */}
{/* This pane remains a query container for its own stat and chart breakpoints. */}
- <div className="@container hover-scrollbar relative flex min-w-0 flex-1 flex-col gap-5 pb-7 pl-10 pr-1.5 pt-4 @[50rem]:overflow-y-auto @[50rem]:pt-[42px]">
+ <div className="@container hover-scrollbar relative flex min-w-0 flex-1 flex-col gap-5 pb-7 pl-10 pr-1.5 pt-4 @[50rem]:overflow-y-auto @[50rem]:pt-[calc(42px*var(--ui-space-scale,1))]">
{viewRun && !hasRun ? (
<>
<div className="flex flex-col gap-3">
diff --git a/studio/frontend/src/features/images/train/train-base-selector.tsx b/studio/frontend/src/features/images/train/train-base-selector.tsx
index cdbfe56ed54..12e33a024d5 100644
--- a/studio/frontend/src/features/images/train/train-base-selector.tsx
+++ b/studio/frontend/src/features/images/train/train-base-selector.tsx
@@ -46,7 +46,7 @@ export function TrainBaseSelector({
<button
type="button"
aria-label="Training base model"
- className="unsloth-model-selector-trigger flex h-[34px] min-w-0 max-w-[320px] items-center gap-2 rounded-full pl-4 pr-2 text-sm transition-colors hover:bg-accent"
+ className="unsloth-model-selector-trigger flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 max-w-[320px] items-center gap-2 rounded-full pl-4 pr-2 text-sm transition-colors hover:bg-accent"
>
<span className="min-w-0 truncate font-medium">{label}</span>
{family && (
diff --git a/studio/frontend/src/features/model-picker/components/model-selector.tsx b/studio/frontend/src/features/model-picker/components/model-selector.tsx
index e915eace37f..8197be6c45b 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector.tsx
@@ -232,7 +232,7 @@ function ModelSelectorTrigger({
<HugeiconsIcon
icon={CloudIcon}
strokeWidth={1.75}
- className="relative top-[0.15625rem] ml-1.5 mr-[0.36rem] size-3.5 shrink-0 text-muted-foreground"
+ className="relative top-[0.15625rem] ml-1.5 mr-[calc(0.36rem*var(--ui-space-scale,1))] size-3.5 shrink-0 text-muted-foreground"
/>
) : null}
</span>
@@ -629,7 +629,7 @@ function ModelSelectorContent({
<PillTabs
// Wider tabs than the shared default. The panel reserves
// --picker-tab-pad a pill, so keep the two in step.
- className="[&_[role=tab]]:px-[calc(0.75rem_+_var(--picker-tab-pad)/2)]"
+ className="[&_[role=tab]]:px-[calc(0.75rem*var(--ui-space-scale,1)_+_var(--picker-tab-pad)/2)]"
ariaLabel={t("picker.hubSectionAriaLabel")}
tabs={hubSectionTabs}
value={effectiveHubSection}
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.tsx
index 9adb5559d9f..41cac4c6424 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
@@ -561,7 +561,7 @@ function VisionBadge() {
<TooltipTrigger asChild={true}>
<span
aria-label="Vision"
- className="flex h-[18px] shrink-0 items-center justify-center rounded-md border border-border/60 px-1.5 text-indigo-700 dark:text-indigo-300"
+ className="flex h-[calc(18px*var(--ui-space-scale,1))] shrink-0 items-center justify-center rounded-md border border-border/60 px-1.5 text-indigo-700 dark:text-indigo-300"
>
<HugeiconsIcon icon={ViewIcon} className="size-3" strokeWidth={1.8} />
</span>
@@ -575,10 +575,10 @@ function VisionBadge() {
function ParamChip({ label }: { label: string }) {
return (
- // h-[18px], the height every other chip in the row band pins (quant, vision, the disk mark, the
+ // h-[calc(18px*var(--ui-space-scale,1))], the height every other chip in the row band pins (quant, vision, the disk mark, the
// Loaded tag). py-px sized this one by its line box instead, the one height here that scales with
// --ui-font-scale, so the row only looked level at the scale where the two happened to cross.
- <span className="inline-flex h-[18px] shrink-0 items-center whitespace-nowrap rounded-md border border-border/60 px-1.5 text-ui-10 font-medium text-muted-foreground tabular-nums">
+ <span className="inline-flex h-[calc(18px*var(--ui-space-scale,1))] shrink-0 items-center whitespace-nowrap rounded-md border border-border/60 px-1.5 text-ui-10 font-medium text-muted-foreground tabular-nums">
{label}
</span>
);
@@ -624,7 +624,7 @@ function DownloadedBadge() {
<TooltipTrigger asChild={true}>
<span
aria-label="On device"
- className="flex h-[18px] w-[14px] shrink-0 items-center justify-center"
+ className="flex h-[calc(18px*var(--ui-space-scale,1))] w-[calc(14px*var(--ui-space-scale,1))] shrink-0 items-center justify-center"
>
<span
aria-hidden="true"
@@ -649,7 +649,7 @@ function PartialBadge({ resumable }: { resumable?: boolean }) {
<TooltipTrigger asChild={true}>
<span
aria-label="Partial download"
- className="flex h-[18px] w-[14px] shrink-0 items-center justify-center"
+ className="flex h-[calc(18px*var(--ui-space-scale,1))] w-[calc(14px*var(--ui-space-scale,1))] shrink-0 items-center justify-center"
>
<span
aria-hidden="true"
@@ -877,7 +877,7 @@ export function GgufDownloadFootprintExplanation({
function QuantChip({ label }: { label: string }) {
return (
- <span className="inline-flex h-[18px] max-w-full items-center overflow-hidden rounded-md bg-[rgb(0_0_0_/_calc(0.06*var(--contrast-wash-gain,1)))] px-1 font-mono text-ui-9 text-muted-foreground dark:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))]">
+ <span className="inline-flex h-[calc(18px*var(--ui-space-scale,1))] max-w-full items-center overflow-hidden rounded-md bg-[rgb(0_0_0_/_calc(0.06*var(--contrast-wash-gain,1)))] px-1 font-mono text-ui-9 text-muted-foreground dark:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))]">
{label}
</span>
);
@@ -922,17 +922,17 @@ const META_COLUMN = {
// Each width below is the widest set its scope can draw: anything wider makes min-w-min expand the
// slot and shift every column after it. This slot holds capability glyphs (18px), the vision badge
// (24px) and the "on disk" mark (14px), gap-1 between them; scope draws no glyph.
- badge: "min-w-min min-[560px]:w-[24px]",
+ badge: "min-w-min min-[560px]:w-[calc(24px*var(--ui-space-scale,1))]",
// One glyph plus the disk mark (18 + 4 + 14).
- badgeMid: "min-w-min min-[560px]:w-[36px]",
+ badgeMid: "min-w-min min-[560px]:w-[calc(36px*var(--ui-space-scale,1))]",
// On Device draws the vision badge (26px) and, since partials are listed, the partial mark
// (14px) beside it. 44px is that pair with its gap: reserving only the badge let a row drawing
// both grow past the slot and carry its quant chip 18px left of every other row.
- badgeDevice: "min-w-min min-[560px]:w-[44px]",
+ badgeDevice: "min-w-min min-[560px]:w-[calc(44px*var(--ui-space-scale,1))]",
// Hub draws the disk mark and no vision badge (18+4+14). A second glyph grows it via min-w-min.
- badgeWide: "min-w-min min-[560px]:w-[36px]",
+ badgeWide: "min-w-min min-[560px]:w-[calc(36px*var(--ui-space-scale,1))]",
// The fit mark (Hub rows), one 18px glyph.
- vram: "min-w-min min-[560px]:w-[18px]",
+ vram: "min-w-min min-[560px]:w-[calc(18px*var(--ui-space-scale,1))]",
// Device rows reserve the slot rather than hug the chip. This is the last variable column, so
// hugging it let each row's meta cluster set its own width and left the quant column ragged. 4.4em
// is the widest these lists draw at text-ui-10 ("235B" 38.4px, "0.35B" 40.9px), so nothing routine
@@ -942,13 +942,13 @@ const META_COLUMN = {
// formatBytes writes no space ("536MB"), so the widest this holds is 29.5px, not the ~40px a spaced "536 MB" needs.
size: "min-w-min min-[560px]:w-[3.2em]",
// The format dot that leads the row; the name lives in its tooltip.
- format: "min-[560px]:w-[14px]",
+ format: "min-[560px]:w-[calc(14px*var(--ui-space-scale,1))]",
} as const;
// One gutter for every row, gear or no gear, so the columns never shift by a button; the
// buttons show on hover or while their menu is open.
const ROW_ACTIONS_CLASS =
- "mr-0.5 flex w-[38px] shrink-0 items-center justify-end -space-x-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 has-[[data-state=open]]:opacity-100 [@media(hover:none)]:opacity-100";
+ "mr-0.5 flex w-[calc(38px*var(--ui-space-scale,1))] shrink-0 items-center justify-end -space-x-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 has-[[data-state=open]]:opacity-100 [@media(hover:none)]:opacity-100";
// Partial rows keep their buttons on screen. Everywhere else the gutter hides until hover because
// the row itself is the action, but a partial cannot be loaded at all: the menu IS its only
@@ -1167,9 +1167,9 @@ function ModelRow({
}}
onClick={onClick}
className={cn(
- // pl-[5.5px]: the dot is centred in a 14px hover target, so 5.5 + (14 - 5) / 2 lands it on
+ // pl-[calc(5.5px*var(--ui-space-scale,1))]: the dot is centred in a 14px hover target, so 5.5 + (14 - 5) / 2 lands it on
// 10px, level with the section labels at px-2.5.
- "group/row flex w-full flex-col items-stretch py-1.5 pl-[5.5px] pr-2 text-left text-sm transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
+ "group/row flex w-full flex-col items-stretch py-1.5 pl-[calc(5.5px*var(--ui-space-scale,1))] pr-2 text-left text-sm transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
showMemoryBar ? "rounded-2xl" : "rounded-full",
selected && "bg-sidebar-accent",
className,
@@ -1212,7 +1212,7 @@ function ModelRow({
<DotTag
tone="success"
label="Loaded"
- className="ml-2 h-[18px] shrink-0 gap-1 rounded-md px-1.5"
+ className="ml-2 h-[calc(18px*var(--ui-space-scale,1))] shrink-0 gap-1 rounded-md px-1.5"
dotClassName="size-[5px]"
/>
)}
@@ -1276,7 +1276,7 @@ function ModelRow({
<DotTag
tone="success"
label="Loaded"
- className="h-[18px] gap-1 rounded-md px-1.5"
+ className="h-[calc(18px*var(--ui-space-scale,1))] gap-1 rounded-md px-1.5"
dotClassName="size-[5px]"
/>
)}
@@ -6118,7 +6118,7 @@ export function HubModelPicker({
type="button"
onClick={onBrowseHub}
aria-label="Search more models on the Hub"
- className="hub-tab-toggle-pill flex h-(--picker-control-h) w-(--picker-control-w) shrink-0 items-center justify-center gap-[5px] rounded-full border-0 text-xs text-foreground transition-colors"
+ className="hub-tab-toggle-pill flex h-(--picker-control-h) w-(--picker-control-w) shrink-0 items-center justify-center gap-[calc(5px*var(--ui-space-scale,1))] rounded-full border-0 text-xs text-foreground transition-colors"
>
<HugeiconsIcon
icon={DashboardCircleIcon}
@@ -6201,8 +6201,8 @@ export function HubModelPicker({
"overlay-scrollbar-gutter",
// On Device pulls the heading block tight to the controls; Recommended keeps more top room
// above its first row.
- showDownloaded ? "pt-0" : "pt-[4px]",
- onEject ? "pb-[60px]" : "pb-4",
+ showDownloaded ? "pt-0" : "pt-[calc(4px*var(--ui-space-scale,1))]",
+ onEject ? "pb-[calc(60px*var(--ui-space-scale,1))]" : "pb-4",
)}
>
{showConnected ? (
@@ -7493,7 +7493,7 @@ export function HubModelPicker({
</div>
</div>
{onEject ? (
- <div className="pointer-events-none absolute inset-x-0 bottom-0 flex justify-end pr-3.5 pb-[19px]">
+ <div className="pointer-events-none absolute inset-x-0 bottom-0 flex justify-end pr-3.5 pb-[calc(19px*var(--ui-space-scale,1))]">
<button
type="button"
onClick={onEject}
diff --git a/studio/frontend/src/features/recipe-studio/components/chip-input.tsx b/studio/frontend/src/features/recipe-studio/components/chip-input.tsx
index 01d469627b5..1d3604ea494 100644
--- a/studio/frontend/src/features/recipe-studio/components/chip-input.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/chip-input.tsx
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { Button } from "@/components/ui/button";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { Cancel01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import {
@@ -31,6 +32,7 @@ export function ChipInput({
}: ChipInputProps): ReactElement {
const [draft, setDraft] = useState("");
const [isWrapped, setIsWrapped] = useState(false);
+ const uiSpaceScale = useUiSpaceScale();
const containerRef = useRef<HTMLDivElement | null>(null);
const listId = useId();
const suggestionSet = useMemo(
@@ -43,14 +45,17 @@ export function ChipInput({
if (!element) {
return;
}
+ // min-h-9 follows the UI font size, so a one-line field is 27px at the
+ // 12px setting and 46px at 20px. A fixed cutoff calls the tall one wrapped
+ // before a single chip has moved.
const syncWrapped = () => {
- setIsWrapped(element.clientHeight > 44);
+ setIsWrapped(element.clientHeight > 44 * uiSpaceScale);
};
syncWrapped();
const observer = new ResizeObserver(syncWrapped);
observer.observe(element);
return () => observer.disconnect();
- }, [values.length, draft]);
+ }, [values.length, draft, uiSpaceScale]);
function addValue(rawValue: string, allowAny: boolean): void {
const trimmed = rawValue.trim();
diff --git a/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx b/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx
index 003eb6837fe..045f91db56a 100644
--- a/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx
@@ -220,7 +220,7 @@ function AuxNodeBase({
onChange={(event) => updateScore({ name: event.target.value })}
/>
<Textarea
- className="corner-squircle nodrag nowheel max-h-32 min-h-[56px] w-full resize-none overflow-y-auto text-xs"
+ className="corner-squircle nodrag nowheel max-h-32 min-h-[calc(56px*var(--ui-space-scale,1))] w-full resize-none overflow-y-auto text-xs"
placeholder="Score description"
value={score.description}
disabled={executionLocked}
diff --git a/studio/frontend/src/features/recipe-studio/components/rf-ui/base-handle.tsx b/studio/frontend/src/features/recipe-studio/components/rf-ui/base-handle.tsx
index c10098cd432..73e1d4650b1 100644
--- a/studio/frontend/src/features/recipe-studio/components/rf-ui/base-handle.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/rf-ui/base-handle.tsx
@@ -17,7 +17,7 @@ export function BaseHandle({
<Handle
{...props}
className={cn(
- "h-[12px] w-[12px] rounded-full border border-border/80 bg-muted shadow-[0_0_0_1px_hsl(var(--background))] transition-all hover:scale-110 hover:border-primary/70 hover:bg-primary/20",
+ "h-[calc(12px*var(--ui-space-scale,1))] w-[calc(12px*var(--ui-space-scale,1))] rounded-full border border-border/80 bg-muted shadow-[0_0_0_1px_hsl(var(--background))] transition-all hover:scale-110 hover:border-primary/70 hover:bg-primary/20",
className,
)}
>
diff --git a/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx b/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx
index f67019498e4..1ebdda367f9 100644
--- a/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx
@@ -133,7 +133,7 @@ export function ExecutionProgressIsland({
<div
className={cn(
"w-[clamp(15rem,26vw,20rem)] max-w-[calc(100vw-1rem)] rounded-b-xl border-x border-b bg-card/96 shadow-sm backdrop-blur-sm transition-all",
- minimized ? "min-h-[3rem]" : "min-h-[8.5rem]",
+ minimized ? "min-h-[calc(3rem*var(--ui-space-scale,1))]" : "min-h-[8.5rem]",
)}
aria-live="polite"
>
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/llm/scores-tab.tsx b/studio/frontend/src/features/recipe-studio/dialogs/llm/scores-tab.tsx
index 514b3c2426a..012ec9729b2 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/llm/scores-tab.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/llm/scores-tab.tsx
@@ -149,7 +149,7 @@ export function LlmScoresTab({
}
/>
<Textarea
- className="corner-squircle nodrag min-h-[56px] text-xs"
+ className="corner-squircle nodrag min-h-[calc(56px*var(--ui-space-scale,1))] text-xs"
placeholder="Score description"
value={score.description}
onChange={(event) =>
diff --git a/studio/frontend/src/features/settings/components/settings-row.tsx b/studio/frontend/src/features/settings/components/settings-row.tsx
index a058785a5c2..ec5d2561e65 100644
--- a/studio/frontend/src/features/settings/components/settings-row.tsx
+++ b/studio/frontend/src/features/settings/components/settings-row.tsx
@@ -107,7 +107,7 @@ export function SettingsRow({
className={cn(
"flex max-w-full shrink-0",
// Line the control up with the first description line, not the label.
- alignTop ? "items-start pt-[21px]" : "items-center",
+ alignTop ? "items-start pt-[calc(21px*var(--ui-space-scale,1))]" : "items-center",
)}
>
{children}
diff --git a/studio/frontend/src/features/settings/settings-dialog.tsx b/studio/frontend/src/features/settings/settings-dialog.tsx
index 3249a8d68ff..7f29d20bd4d 100644
--- a/studio/frontend/src/features/settings/settings-dialog.tsx
+++ b/studio/frontend/src/features/settings/settings-dialog.tsx
@@ -511,7 +511,7 @@ export function SettingsDialog() {
<button
type="button"
onClick={() => openResult(tab.id)}
- className="flex h-[30px] items-center gap-2.5 rounded-full pl-3 pr-2.5 text-ui-13p5 font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
+ className="flex h-[calc(30px*var(--ui-space-scale,1))] items-center gap-2.5 rounded-full pl-3 pr-2.5 text-ui-13p5 font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
>
{tab.iconComponent ? (
<tab.iconComponent className="size-icon shrink-0" />
@@ -529,7 +529,7 @@ export function SettingsDialog() {
key={entry}
type="button"
onClick={() => openResult(tab.id, entry)}
- className="flex h-[30px] items-center rounded-full pl-10 pr-2.5 text-left text-ui-14 text-sidebar-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
+ className="flex h-[calc(30px*var(--ui-space-scale,1))] items-center rounded-full pl-10 pr-2.5 text-left text-ui-14 text-sidebar-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
>
<span className="min-w-0 truncate">{entry}</span>
</button>
@@ -570,9 +570,9 @@ export function SettingsDialog() {
type="button"
onClick={() => setActiveTab(tab.id)}
className={cn(
- "relative flex h-[32px] items-center gap-2.5 rounded-full pl-3 pr-2.5 text-ui-14p5 leading-ui-19 tracking-nav font-medium transition-colors",
+ "relative flex h-[calc(32px*var(--ui-space-scale,1))] items-center gap-2.5 rounded-full pl-3 pr-2.5 text-ui-14p5 leading-ui-19 tracking-nav font-medium transition-colors",
// Keep the row height when the list scrolls: a flex item
- // shrinks past h-[32px] down to its text otherwise.
+ // shrinks past h-[calc(32px*var(--ui-space-scale,1))] down to its text otherwise.
"shrink-0",
"focus-visible:outline-none",
// The active pill already marks the current tab, so
@@ -625,7 +625,7 @@ export function SettingsDialog() {
<button
type="button"
onClick={closeDialog}
- className="absolute top-3 end-3 z-10 flex size-[30px] items-center justify-center rounded-[10px] text-[#383835] dark:text-[#c7c7c4] transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ className="absolute top-3 end-3 z-10 flex size-[calc(30px*var(--ui-space-scale,1))] items-center justify-center rounded-[10px] text-[#383835] dark:text-[#c7c7c4] transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
aria-label={t("settings.dialog.closeAriaLabel")}
>
<HugeiconsIcon icon={Cancel01Icon} className="size-4" />
diff --git a/studio/frontend/src/features/video/video-page.tsx b/studio/frontend/src/features/video/video-page.tsx
index e300b68afa1..88bacb8059b 100644
--- a/studio/frontend/src/features/video/video-page.tsx
+++ b/studio/frontend/src/features/video/video-page.tsx
@@ -3452,7 +3452,7 @@ function VideoGenerator({
</Dialog>
{/* Top: the model selector, clear of the sidebar and level with the controls column. Load
progress shows in a toast. */}
- <div className="@container pointer-events-none relative z-40 flex h-[48px] shrink-0 items-start justify-between pl-[var(--studio-media-header-left-inset,1.5rem)] pr-2 pt-[var(--studio-chat-header-padding-top,11px)]">
+ <div className="@container pointer-events-none relative z-40 flex h-[calc(48px*var(--ui-space-scale,1))] shrink-0 items-start justify-between pl-[var(--studio-media-header-left-inset,1.5rem)] pr-2 pt-[var(--studio-chat-header-padding-top,11px)]">
{/* min-w-0: without it a long resident model name pushes the Images link off a phone screen. */}
<div className="pointer-events-auto flex min-w-0 items-center gap-3">
<ModelSelector
@@ -3464,7 +3464,7 @@ function VideoGenerator({
resolveDownloadFootprint={resolveDownloadFootprint}
onEject={status?.loaded ? handleUnload : undefined}
variant="ghost"
- className="!h-[34px]"
+ className="!h-[calc(34px*var(--ui-space-scale,1))]"
task={VIDEO_GEN_TASKS}
catalog={VIDEO_CATALOG}
placeholder="Select video model"
@@ -3482,7 +3482,7 @@ function VideoGenerator({
variant="outline"
size="sm"
aria-label="Cancel load"
- className="!h-[34px] rounded-full text-xs"
+ className="!h-[calc(34px*var(--ui-space-scale,1))] rounded-full text-xs"
onClick={() => void handleCancelLoad()}
>
Cancel load
diff --git a/studio/frontend/src/hooks/use-ui-space-scale.ts b/studio/frontend/src/hooks/use-ui-space-scale.ts
new file mode 100644
index 00000000000..520fab90436
--- /dev/null
+++ b/studio/frontend/src/hooks/use-ui-space-scale.ts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import {
+ UI_FONT_SIZE_RANGE,
+ useAppearanceCustomStore,
+} from "@/features/settings/stores/appearance-custom-store";
+
+/**
+ * The JS twin of --ui-space-scale, for geometry that only exists in JS:
+ * virtualizer slot heights and anything measured against them. Everything
+ * else scales through the CSS variable.
+ */
+export function useUiSpaceScale(): number {
+ const uiFontSize = useAppearanceCustomStore((s) => s.customization.uiFontSize);
+ return (
+ (uiFontSize ?? UI_FONT_SIZE_RANGE.default) / UI_FONT_SIZE_RANGE.default
+ );
+}
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index f3539b6ecc4..2b171ac8d10 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -237,7 +237,11 @@
--shadow-offset-x: 0px;
--shadow-offset-y: 0px;
--letter-spacing: 0em;
- --spacing: 0.25rem;
+ /* Tailwind's spacing step, scaled so every padding, margin, gap, size,
+ width and height utility follows the UI font size. Overlays that could
+ then outgrow a phone screen carry their own viewport cap. See
+ --ui-space-scale below. */
+ --spacing: calc(0.25rem * var(--ui-space-scale, 1));
/*--shadow-2xs: 0px 0px 0px 0px hsl(0 0% 0% / 0);*/
/*--shadow-xs: 0px 0px 0px 0px hsl(0 0% 0% / 0);*/
/*--shadow-sm:*/
@@ -311,6 +315,21 @@
is 15px. An explicit user preference overrides this inline. */
--ui-font-scale: 0.9375;
+ /* Every padding, gap and margin multiplies by this, so spacing stays the
+ same fraction of the text at any UI font size (12px -> 0.8, 20px ->
+ 1.333). Normalised at the 15px default, so the shipped look is
+ unchanged. Values pinned outside the UI (traffic lights, title bar,
+ hairlines) skip it. */
+ --ui-space-scale: calc(var(--ui-font-scale, 1) / 0.9375);
+
+ /* Chat chrome that holds text. Declared here because the web shell sets no
+ chrome vars; the desktop shells override these in app/provider.tsx.
+ Window geometry stays pinned there: it is the OS window's, not ours. */
+ --studio-chat-header-height: calc(48px * var(--ui-space-scale, 1));
+ --studio-chat-control-height: calc(33px * var(--ui-space-scale, 1));
+ --studio-chat-header-padding-top: calc(11px * var(--ui-space-scale, 1));
+ --studio-media-header-left-inset: calc(1.5rem * var(--ui-space-scale, 1));
+
/* Standard interactive-icon size for nav, menus, action bars, and
in-message code-block actions. Sized one step above body text so
icons read as minimally larger than adjacent labels (~14px text).
@@ -324,31 +343,30 @@
/* Mirrors the size-3.5 rule applied inside popovers (see the icon block
below), so widths that reserve room for those icons track them. */
--ui-icon-size-sm: min(calc(0.875rem * var(--ui-font-scale, 1)), calc(0.4375rem + 0.4375rem * var(--ui-font-scale, 1)));
- /* Model picker header controls. Padding and gaps come from the pinned
- --spacing, the icons and label both scale, so reserve each separately.
- The trigger is 2.25rem of padding and gaps, two icons, then the label,
- plus --picker-control-pad. Height matches the h-9 it replaces at the
- 16px default. */
- --picker-control-h: calc(1.125rem + 1.125rem * var(--ui-font-scale, 1));
- /* Padding added to Search Hub and the two dropdowns, 0.375rem a side. Pinned
- like the rest: it pads, and it stops the "Trending" label clipping. */
- --picker-control-pad: 0.75rem;
+ /* Model picker header controls. Padding and gaps follow --ui-space-scale,
+ icons and label follow --ui-font-scale, so reserve each separately. The
+ trigger is 2.25rem of padding and gaps, two icons, then the label, plus
+ --picker-control-pad. Height matches the h-9 it replaces at 16px. */
+ --picker-control-h: calc(1.125rem * var(--ui-space-scale, 1) + 1.125rem * var(--ui-font-scale, 1));
+ /* Padding added to Search Hub and the two dropdowns, 0.375rem a side. It
+ also stops the "Trending" label clipping, so it tracks the scale. */
+ --picker-control-pad: calc(0.75rem * var(--ui-space-scale, 1));
/* Same per section pill (Recommended / On Device / Connected), 0.25rem a
side, i.e. px-3 to px-4 on the tabs. */
- --picker-tab-pad: 0.5rem;
- --picker-control-w: calc(2.25rem + var(--picker-control-pad) + 2 * var(--ui-icon-size-sm) + 2.875rem * var(--ui-font-scale, 1));
+ --picker-tab-pad: calc(0.5rem * var(--ui-space-scale, 1));
+ --picker-control-w: calc(2.25rem * var(--ui-space-scale, 1) + var(--picker-control-pad) + 2 * var(--ui-icon-size-sm) + 2.875rem * var(--ui-font-scale, 1));
/* Panel: pl-4, two gaps and pr-2, the pills' padding, their two icons and
label, then the two dropdowns. The control row fills this exactly, which
keeps the last dropdown flush with Search Hub above it. Widening a
control takes the difference from the search field, not the panel. */
- --picker-panel-w: calc(6.25rem + 2 * var(--picker-tab-pad) + 2 * var(--ui-icon-size-sm) + 9.875rem * var(--ui-font-scale, 1) + 2 * var(--picker-control-w));
+ --picker-panel-w: calc(6.25rem * var(--ui-space-scale, 1) + 2 * var(--picker-tab-pad) + 2 * var(--ui-icon-size-sm) + 9.875rem * var(--ui-font-scale, 1) + 2 * var(--picker-control-w));
/* Provider row adds one more control and the Connected pill; split like the rest. */
- --picker-panel-w-external: calc(var(--picker-panel-w) + var(--picker-tab-pad) + 4rem + 2.75rem * var(--ui-font-scale, 1));
- /* Inset of a centered .size-icon glyph within a 2rem (size-8) action
- button — i.e. (32px − icon-size) / 2. Use as a negative margin on a
- chat-message action bar so the leftmost icon's visual edge aligns
- with the message text edge. Auto-tracks --icon-size. */
- --icon-btn-inset: calc((2rem - var(--icon-size)) / 2);
+ --picker-panel-w-external: calc(var(--picker-panel-w) + var(--picker-tab-pad) + 4rem * var(--ui-space-scale, 1) + 2.75rem * var(--ui-font-scale, 1));
+ /* Inset of a centered .size-icon glyph in a size-8 action button, i.e.
+ (button - icon-size) / 2. Use as a negative margin on a chat-message
+ action bar so the leftmost icon lines up with the message text edge.
+ The button is 8 spacing steps, the glyph tracks --icon-size. */
+ --icon-btn-inset: calc((2rem * var(--ui-space-scale, 1) - var(--icon-size)) / 2);
}
.dark {
@@ -408,7 +426,8 @@
--shadow-offset-x: 0px;
--shadow-offset-y: 0px;
--letter-spacing: 0em;
- --spacing: 0.25rem;
+ /* Same scaled step as light; see the :root definition. */
+ --spacing: calc(0.25rem * var(--ui-space-scale, 1));
--shadow-2xs: 0px 0px 0px 0px hsl(0 0% 0% / 0);
--shadow-xs: 0px 0px 0px 0px hsl(0 0% 0% / 0);
--shadow-sm: 0px 0px 0px 0px hsl(0 0% 0% / 0), 0px 1px 2px 0px hsl(0 0% 0% / 0);
@@ -1249,8 +1268,8 @@ html[data-chat-font] .aui-root {
own padding-right is the whole gap: the glyph boxes meet at 30px, so 2px
here is 2px between them and 10px between the drawn icons. */
.sidebar-row-action.is-unpin-action {
- right: 1.875rem;
- padding-right: 0.125rem;
+ right: calc(1.875rem * var(--ui-space-scale, 1));
+ padding-right: calc(0.125rem * var(--ui-space-scale, 1));
/* The base pl-2 faces the options button, which is what opens the gap between the two
icons. On the pin there is nothing to its left but the title, so that padding is
dead space: invisible, but inside the button, and sidebar-touch-reveal makes the
@@ -1285,7 +1304,7 @@ html[data-chat-font] .aui-root {
+ pr-1.5 inside a pill the list inset by px-1.5 = 12px). The desktop
titlebar insets by 5px, so those headers override this in app-sidebar.tsx. */
.sidebar-sticky-label {
- @apply rounded-none bg-sidebar pt-0 pb-[8px] pl-[16px] pr-3 text-ui-14! leading-ui-17 font-medium normal-case focus-visible:ring-0! focus-visible:outline-none transition-shadow duration-150;
+ @apply rounded-none bg-sidebar pt-0 pb-[calc(8px*var(--ui-space-scale,1))] pl-[calc(16px*var(--ui-space-scale,1))] pr-3 text-ui-14! leading-ui-17 font-medium normal-case focus-visible:ring-0! focus-visible:outline-none transition-shadow duration-150;
/* Muted section-header gray, matching Gemini's "Notebooks"/"Recents".
Lightened from #5f6368 so the label reads as a header, clearly
lighter than the near-black nav items. */
@@ -1294,15 +1313,15 @@ html[data-chat-font] .aui-root {
}
/* These compound selectors must beat the base label's pr-3 declaration.
Tailwind emits utility classes before this components block, so putting
- pr-[11px]/pr-[13px] on the element would lose the cascade. */
+ pr-[calc(11px*var(--ui-space-scale,1))]/pr-[calc(13px*var(--ui-space-scale,1))] on the element would lose the cascade. */
.sidebar-sticky-label.sidebar-sticky-label-desktop {
- padding-right: 11px;
+ padding-right: calc(11px * var(--ui-space-scale, 1));
}
.sidebar-sticky-label.sidebar-sticky-label-desktop-recents {
- padding-right: 13px;
+ padding-right: calc(13px * var(--ui-space-scale, 1));
}
.sidebar-sticky-label-following {
- @apply pt-[21px];
+ @apply pt-[calc(21px*var(--ui-space-scale,1))];
}
.dark .sidebar-sticky-label {
/* Muted gray, clearly dimmer than the near-white nav items (#ececee) so
@@ -1578,9 +1597,9 @@ html[data-chat-font] .aui-root {
/* Important like .panel-input-group: these all override a base
SelectTrigger class of the same weight. 14px each side optically:
the chevron's stroke fills 14 of its 24 viewBox units, so its box
- carries ~3px of slack and pr-[11px] pays that back. */
+ carries ~3px of slack and pr-[calc(11px*var(--ui-space-scale,1))] pays that back. */
.panel-select-trigger {
- @apply rounded-full! border-transparent! bg-[var(--panel-input-surface)]! py-0! pl-3.5! pr-[11px]! text-ui-13! font-medium! text-nav-fg shadow-none! hover:bg-[var(--panel-input-surface-hover)]! focus-visible:ring-0!;
+ @apply rounded-full! border-transparent! bg-[var(--panel-input-surface)]! py-0! pl-3.5! pr-[calc(11px*var(--ui-space-scale,1))]! text-ui-13! font-medium! text-nav-fg shadow-none! hover:bg-[var(--panel-input-surface-hover)]! focus-visible:ring-0!;
}
/* These controls suppress the ring, so keyboard focus would otherwise
@@ -1647,8 +1666,8 @@ html[data-chat-font] .aui-root {
.app-user-menu [data-slot="dropdown-menu-item"],
.app-user-menu [data-slot="dropdown-menu-sub-trigger"] {
height: 36px;
- padding: 0 0.75rem !important;
- gap: 9.5px !important;
+ padding: 0 calc(0.75rem * var(--ui-space-scale, 1)) !important;
+ gap: calc(9.5px * var(--ui-space-scale, 1)) !important;
border-radius: 12px;
font-weight: 500;
font-size: calc(0.9375rem * var(--ui-font-scale, 1));
@@ -2003,7 +2022,7 @@ html[data-chat-font] .aui-root {
/* On hover the icon swaps for an X inside a soft circle (ChatGPT-style),
filling the icon slot so every pill's X is identical and centered. */
.composer-pill-x {
- @apply pointer-events-none absolute inset-0 m-auto size-[var(--ui-icon-size)] rounded-full bg-primary/15 p-[3px] opacity-0 transition-opacity dark:bg-[rgb(255_255_255_/_calc(0.14*var(--contrast-wash-gain,1)))];
+ @apply pointer-events-none absolute inset-0 m-auto size-[var(--ui-icon-size)] rounded-full bg-primary/15 p-[calc(3px*var(--ui-space-scale,1))] opacity-0 transition-opacity dark:bg-[rgb(255_255_255_/_calc(0.14*var(--contrast-wash-gain,1)))];
}
/* Hovering an active pill swaps the icon for an X (click to turn off). */
@@ -2093,7 +2112,7 @@ html[data-chat-font] .aui-root {
order: 1;
/* Pull the plus button closer to the composer edge. Logical, so RTL
pulls it outward instead of into the action group. */
- margin-inline-start: -0.25rem;
+ margin-inline-start: calc(-0.25rem * var(--ui-space-scale, 1));
}
.unsloth-composer-line .unsloth-composer-input {
@@ -2104,7 +2123,7 @@ html[data-chat-font] .aui-root {
order: 3;
margin-inline-start: auto;
/* Cancel the line padding to preserve the surface's 10px edge gap. */
- margin-inline-end: -0.25rem;
+ margin-inline-end: calc(-0.25rem * var(--ui-space-scale, 1));
}
.unsloth-composer-line[data-expanded="true"] .unsloth-composer-input {
@@ -2112,13 +2131,13 @@ html[data-chat-font] .aui-root {
flex-basis: 100%;
width: 100%;
/* Sits close to the left edge, near the plus. */
- padding-left: calc(0.375rem + 1px);
- padding-top: 0.5rem;
- padding-bottom: 0.5rem;
+ padding-left: calc(0.375rem * var(--ui-space-scale, 1) + 1px);
+ padding-top: calc(0.5rem * var(--ui-space-scale, 1));
+ padding-bottom: calc(0.5rem * var(--ui-space-scale, 1));
}
.unsloth-composer-line[data-expanded="true"] {
- row-gap: 0.375rem;
+ row-gap: calc(0.375rem * var(--ui-space-scale, 1));
}
.unsloth-composer-line[data-expanded="true"] .unsloth-composer-left {
@@ -2129,12 +2148,12 @@ html[data-chat-font] .aui-root {
autosize textarea's inline !important height, so a cleared message leaves
no stale tall box or stray scrollbar. */
.unsloth-composer-input:placeholder-shown {
- max-height: 40px !important;
+ max-height: calc(40px * var(--ui-space-scale, 1)) !important;
overflow-y: hidden !important;
}
.unsloth-composer-input {
- @apply min-h-[40px] min-w-0 flex-1 resize-none overflow-y-auto bg-transparent pl-0.5 pr-2 py-2 text-ui-15 font-[450] leading-6 outline-none placeholder:text-muted-foreground focus-visible:ring-0;
+ @apply min-h-[calc(40px*var(--ui-space-scale,1))] min-w-0 flex-1 resize-none overflow-y-auto bg-transparent pl-0.5 pr-2 py-2 text-ui-15 font-[450] leading-6 outline-none placeholder:text-muted-foreground focus-visible:ring-0;
}
/* Animate the frame so the textarea stays mounted and keeps selection/undo. */
@@ -2143,7 +2162,10 @@ html[data-chat-font] .aui-root {
order: 1;
flex-basis: 100%;
width: 100%;
- height: var(--composer-editor-height, 40px);
+ height: var(
+ --composer-editor-height,
+ calc(40px * var(--ui-space-scale, 1))
+ );
transition: height 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
@@ -2152,14 +2174,14 @@ html[data-chat-font] .aui-root {
min-height: 100%;
max-height: 100% !important;
/* Reserved before typing, or the toggle appearing would reflow the text. */
- padding-right: 2.25rem;
+ padding-right: calc(2.25rem * var(--ui-space-scale, 1));
}
/* max(): at 480px tall the clamp is 192px, under the twelve-row compact
height, so expanding would clip. svh, since dvh tracks Safari's bar. */
.aui-composer-root[data-writing-expanded="true"] .unsloth-composer-editor {
height: max(
- var(--composer-editor-height, 40px),
+ var(--composer-editor-height, calc(40px * var(--ui-space-scale, 1))),
clamp(8rem, calc(80svh - 12rem), 42rem)
);
}
@@ -2170,7 +2192,7 @@ html[data-chat-font] .aui-root {
}
.aui-thread-welcome-center:has([data-writing-expanded="true"]) {
- padding-top: 1rem;
+ padding-top: calc(1rem * var(--ui-space-scale, 1));
}
.unsloth-composer-plus {
@@ -2210,7 +2232,7 @@ html[data-chat-font] .aui-root {
padding-left: 0;
padding-right: 0;
/* One gap for every control, so the row spaces evenly. */
- --composer-tight-gap: 0.125rem;
+ --composer-tight-gap: calc(0.125rem * var(--ui-space-scale, 1));
}
.unsloth-composer-left,
@@ -2220,11 +2242,11 @@ html[data-chat-font] .aui-root {
/* Plus and send hug their edges by the same amount. */
.unsloth-composer-left {
- margin-inline-start: -0.125rem;
+ margin-inline-start: calc(-0.125rem * var(--ui-space-scale, 1));
}
.unsloth-composer-line .aui-composer-action-wrapper {
- margin-inline-end: -0.125rem;
+ margin-inline-end: calc(-0.125rem * var(--ui-space-scale, 1));
}
/* Send's own inset stacks on the gap above; drop it. The running state
@@ -2237,7 +2259,7 @@ html[data-chat-font] .aui-root {
/* Keeps the text starting just right of the plus glyph below it. */
.unsloth-composer-line[data-expanded="true"] .unsloth-composer-input {
- padding-left: calc(0.5rem + 1px);
+ padding-left: calc(0.5rem * var(--ui-space-scale, 1) + 1px);
}
/* Recording swaps the input for the dictation bar, whose timer and
@@ -2245,12 +2267,12 @@ html[data-chat-font] .aui-root {
min-width 0, so past that floor it overflows the surface instead of
shrinking. Trim the same paddings the rest of the row gives up. */
.unsloth-dictation-wave {
- padding-left: 0.5rem;
- padding-right: 0.25rem;
+ padding-left: calc(0.5rem * var(--ui-space-scale, 1));
+ padding-right: calc(0.25rem * var(--ui-space-scale, 1));
}
.unsloth-dictation-timer {
- margin-inline-end: 0.5rem;
+ margin-inline-end: calc(0.5rem * var(--ui-space-scale, 1));
}
/* Past its floor the bar has to stop taking width it cannot use. Left
@@ -2314,14 +2336,14 @@ html[data-chat-font] .aui-root {
.unsloth-composer-line
.aui-composer-action-wrapper
> .aui-composer-run-controls {
- margin-left: 0.25rem;
+ margin-left: calc(0.25rem * var(--ui-space-scale, 1));
}
/* Same 28px as the row above, and both of the bar's buttons together:
stop carries none of our classes, so they have to be sized as a
pair or the recording controls come out mismatched. */
.unsloth-dictation-actions {
- gap: 0.375rem;
+ gap: calc(0.375rem * var(--ui-space-scale, 1));
}
.unsloth-dictation-actions > button {
@@ -2339,7 +2361,7 @@ html[data-chat-font] .aui-root {
}
.unsloth-dictation-timer {
- margin-inline-end: 0.25rem;
+ margin-inline-end: calc(0.25rem * var(--ui-space-scale, 1));
}
}
@@ -2402,8 +2424,8 @@ html[data-chat-font] .aui-root {
breakpoint would keep the full 20px there. */
@container (max-width: 31.5rem) {
.unsloth-composer-dock-inner {
- padding-left: 0.75rem;
- padding-right: 0.75rem;
+ padding-left: calc(0.75rem * var(--ui-space-scale, 1));
+ padding-right: calc(0.75rem * var(--ui-space-scale, 1));
}
/* The welcome screen is inside the viewport's own 20px gutter, so pull
@@ -2412,12 +2434,12 @@ html[data-chat-font] .aui-root {
.aui-thread-welcome-message {
padding-left: 0;
padding-right: 0;
- margin-left: -0.5rem;
- margin-right: -0.5rem;
+ margin-left: calc(-0.5rem * var(--ui-space-scale, 1));
+ margin-right: calc(-0.5rem * var(--ui-space-scale, 1));
/* w-full would pin the width and the margins would only shift the
box left. An explicit width widens it into the gutter instead;
auto would shrink-wrap, since the parent centres its children. */
- width: calc(100% + 1rem);
+ width: calc(100% + 1rem * var(--ui-space-scale, 1));
}
.unsloth-welcome-title {
@@ -2430,7 +2452,7 @@ html[data-chat-font] .aui-root {
}
.unsloth-welcome-greeting {
- gap: 0.625rem;
+ gap: calc(0.625rem * var(--ui-space-scale, 1));
}
}
@@ -2447,7 +2469,7 @@ html[data-chat-font] .aui-root {
}
.unsloth-welcome-greeting {
- gap: 0.5rem;
+ gap: calc(0.5rem * var(--ui-space-scale, 1));
}
}
@@ -2505,12 +2527,12 @@ html[data-chat-font] .aui-root {
item radius (12px) + side gutter (9px), so the curves run parallel.
!important beats the global 14px dropdown radius. */
border-radius: 21px !important;
- padding-top: 0.5rem;
- padding-bottom: 0.5rem;
+ padding-top: calc(0.5rem * var(--ui-space-scale, 1));
+ padding-bottom: calc(0.5rem * var(--ui-space-scale, 1));
/* Side gutter ~matches the 0.5rem top/bottom padding so the hover box
sits evenly inset on all four sides. */
- padding-left: 9px;
- padding-right: 9px;
+ padding-left: calc(9px * var(--ui-space-scale, 1));
+ padding-right: calc(9px * var(--ui-space-scale, 1));
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.16);
}
@@ -2776,15 +2798,15 @@ html[data-chat-font] .aui-root {
[data-streamdown="unordered-list"] {
list-style-type: disc;
list-style-position: outside;
- padding-left: 1.25rem;
- margin-block: 0.5rem;
+ padding-left: calc(1.25rem * var(--ui-space-scale, 1));
+ margin-block: calc(0.5rem * var(--ui-space-scale, 1));
}
[data-streamdown="ordered-list"] {
list-style-type: decimal;
list-style-position: outside;
- padding-left: 1.25rem;
- margin-block: 0.5rem;
+ padding-left: calc(1.25rem * var(--ui-space-scale, 1));
+ margin-block: calc(0.5rem * var(--ui-space-scale, 1));
}
[data-streamdown="list-item"] {
@@ -2801,12 +2823,12 @@ html[data-chat-font] .aui-root {
.aui-thread-root [data-streamdown="code-block-body"] {
/* Keep overlay scrollbars below one-line code. */
- padding-bottom: 0.625rem !important;
+ padding-bottom: calc(0.625rem * var(--ui-space-scale, 1)) !important;
}
[data-streamdown="code-block"] {
- gap: 0.25rem;
- padding: 0.75rem 1rem;
+ gap: calc(0.25rem * var(--ui-space-scale, 1));
+ padding: calc(0.75rem * var(--ui-space-scale, 1)) calc(1rem * var(--ui-space-scale, 1));
border-radius: 1.5rem;
/* Wide lines must scroll inside the thread column, not widen past the composer (flex min-width:auto). */
max-width: 100%;
@@ -2879,7 +2901,7 @@ html[data-chat-font] .aui-root {
paragraph. `:where()` keeps this at zero specificity so a part that does set its own
`mt-*` still wins. The first real child follows a zero-height badge anchor and gets none. */
:where(.aui-assistant-message-content > * + *) {
- margin-top: 1rem;
+ margin-top: calc(1rem * var(--ui-space-scale, 1));
}
:where(.aui-assistant-message-content > .h-0 + *) {
margin-top: 0;
@@ -2917,9 +2939,9 @@ html[data-chat-font] .aui-root {
/* Align fenced code blocks with the main chat column even when nested in lists. */
.aui-thread-root [data-streamdown="list-item"] > [data-streamdown="code-block"],
.aui-thread-root [data-streamdown="list-item"] [data-streamdown="code-block"] {
- margin-left: -1.25rem;
- width: calc(100% + 1.25rem);
- max-width: calc(100% + 1.25rem);
+ margin-left: calc(-1.25rem * var(--ui-space-scale, 1));
+ width: calc(100% + 1.25rem * var(--ui-space-scale, 1));
+ max-width: calc(100% + 1.25rem * var(--ui-space-scale, 1));
}
.dark .aui-thread-root [data-streamdown="code-block"] {
@@ -3115,14 +3137,14 @@ html[data-chat-font] .aui-root {
/* No border line; same drop shadow as the composer (.unsloth-composer-surface).
!important because Sonner injects its base rules at runtime. */
[data-sonner-toast][data-styled='true'] {
- padding: 12px 18px !important;
+ padding: calc(12px * var(--ui-space-scale, 1)) calc(18px * var(--ui-space-scale, 1)) !important;
align-items: start !important;
- gap: 10px !important;
+ gap: calc(10px * var(--ui-space-scale, 1)) !important;
box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.16) !important;
}
[data-sonner-toast][data-styled='true'] [data-icon] {
- margin: 2px 0 0 !important;
+ margin: calc(2px * var(--ui-space-scale, 1)) 0 0 !important;
}
[data-sonner-toast][data-styled='true'] [data-content] {
@@ -3133,8 +3155,8 @@ html[data-chat-font] .aui-root {
display: grid !important;
grid-template-columns: minmax(0, 1fr);
align-items: start !important;
- column-gap: 10px !important;
- row-gap: 10px !important;
+ column-gap: calc(10px * var(--ui-space-scale, 1)) !important;
+ row-gap: calc(10px * var(--ui-space-scale, 1)) !important;
}
[data-sonner-toast][data-styled='true']:has([data-button]):has([data-icon]) {
@@ -3165,7 +3187,7 @@ html[data-chat-font] .aui-root {
}
[data-sonner-toast][data-styled='true']:has([data-close-button]) {
- padding-right: 48px !important;
+ padding-right: calc(48px * var(--ui-space-scale, 1)) !important;
}
/* Toast buttons are pills, matching the dialog actions they stand in for. */
@@ -3177,9 +3199,9 @@ html[data-chat-font] .aui-root {
[data-sonner-toast][data-styled='true'].chat-model-load-toast {
display: flex !important;
align-items: center !important;
- gap: 12px !important;
- padding-top: 14px !important;
- padding-bottom: 14px !important;
+ gap: calc(12px * var(--ui-space-scale, 1)) !important;
+ padding-top: calc(14px * var(--ui-space-scale, 1)) !important;
+ padding-bottom: calc(14px * var(--ui-space-scale, 1)) !important;
}
[data-sonner-toast][data-styled='true'].chat-model-load-toast [data-content] {
@@ -3194,7 +3216,7 @@ html[data-chat-font] .aui-root {
/* Progress bar is the last row; give it room below. */
[data-sonner-toast][data-styled='true'].chat-model-load-toast:has([role='progressbar']) {
- padding-bottom: 18px !important;
+ padding-bottom: calc(18px * var(--ui-space-scale, 1)) !important;
}
/* Dark toasts share the chatbox surface color (.chat-composer-surface
@@ -3500,7 +3522,7 @@ html[data-chat-font] .aui-root {
/* Keep Sonner close button inside the toast and pin to theme tokens (--gray2 hover ignores data-sonner-theme). */
[data-sonner-toast][data-styled="true"] [data-close-button] {
- top: 8px !important;
+ top: calc(8px * var(--ui-space-scale, 1)) !important;
transform: none !important;
background: var(--popover) !important;
color: var(--popover-foreground) !important;
@@ -3531,9 +3553,9 @@ html[data-chat-font] .aui-root {
position: relative;
display: grid;
grid-template-columns: repeat(8, minmax(0, 1fr));
- gap: 14px;
+ gap: calc(14px * var(--ui-space-scale, 1));
width: min(66%, 18rem);
- padding: 1.5rem;
+ padding: calc(1.5rem * var(--ui-space-scale, 1));
border-radius: 1.5rem;
}
@@ -3921,6 +3943,6 @@ html[data-chat-font] .aui-root {
@layer components {
/* Align the arrow with page content while retaining its hit area. */
.settings-back-button {
- margin-inline-start: -0.75rem;
+ margin-inline-start: calc(-0.75rem * var(--ui-space-scale, 1));
}
}
diff --git a/studio/frontend/src/lib/toast-offset.ts b/studio/frontend/src/lib/toast-offset.ts
index f9be6555264..04cc5d8f97e 100644
--- a/studio/frontend/src/lib/toast-offset.ts
+++ b/studio/frontend/src/lib/toast-offset.ts
@@ -22,6 +22,8 @@ export function getToastOffsets(
pathname: string,
isDesktopApp: boolean,
usesCustomTitlebar: boolean,
+ /** The page header grows with the UI font size; the titlebar band does not. */
+ uiSpaceScale = 1,
): ToastOffsets {
const hasPageHeader =
HEADER_ROUTES.has(pathname) || pathname.startsWith("/chat/");
@@ -29,10 +31,9 @@ export function getToastOffsets(
isDesktopApp && (!hasPageHeader || usesCustomTitlebar)
? DESKTOP_TITLEBAR_HEIGHT
: 0;
- const defaultTopOffset = hasPageHeader ? HEADER_TOP_OFFSET : EDGE_OFFSET;
- const mobileTopOffset = hasPageHeader
- ? HEADER_TOP_OFFSET
- : MOBILE_EDGE_OFFSET;
+ const headerTopOffset = Math.round(HEADER_TOP_OFFSET * uiSpaceScale);
+ const defaultTopOffset = hasPageHeader ? headerTopOffset : EDGE_OFFSET;
+ const mobileTopOffset = hasPageHeader ? headerTopOffset : MOBILE_EDGE_OFFSET;
return {
default: {
diff --git a/studio/frontend/tests/chat-column-centering.test.ts b/studio/frontend/tests/chat-column-centering.test.ts
index 91ad367e9f1..b3ecd8a9344 100644
--- a/studio/frontend/tests/chat-column-centering.test.ts
+++ b/studio/frontend/tests/chat-column-centering.test.ts
@@ -4,13 +4,13 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { readSrcAsync } from "./helpers/kit.ts";
+import { atDefaultUiScale, readSrcAsync } from "./helpers/kit.ts";
// The chat column is centred by margin, so every inset around it has to be
// symmetric. A one-sided scrollbar gutter counts as an inset.
test("the thread viewport reserves its scrollbar gutter on both edges", async () => {
- const css = await readSrcAsync("index.css");
+ const css = atDefaultUiScale(await readSrcAsync("index.css"));
const at = css.indexOf(".aui-thread-viewport {");
assert.notEqual(at, -1);
@@ -23,8 +23,8 @@ test("the thread viewport reserves its scrollbar gutter on both edges", async ()
});
test("nothing around the composer re-adds a one-sided inset", async () => {
- const chatPage = await readSrcAsync("features/chat/chat-page.tsx");
- const thread = await readSrcAsync("components/assistant-ui/thread.tsx");
+ const chatPage = atDefaultUiScale(await readSrcAsync("features/chat/chat-page.tsx"));
+ const thread = atDefaultUiScale(await readSrcAsync("components/assistant-ui/thread.tsx"));
// The compare-mode wrapper mirrored the old one-sided gutter.
assert.doesNotMatch(chatPage, /pl-5 pr-5 md:pr-\[30px\]/);
diff --git a/studio/frontend/tests/chat-remembers-its-model.test.ts b/studio/frontend/tests/chat-remembers-its-model.test.ts
index e48f0f689aa..c5b3a65e4c3 100644
--- a/studio/frontend/tests/chat-remembers-its-model.test.ts
+++ b/studio/frontend/tests/chat-remembers-its-model.test.ts
@@ -11,6 +11,7 @@ import assert from "node:assert/strict";
import test from "node:test";
import {
+ atDefaultUiScale,
installLocalStorageFake,
readText,
registerBundlerResolver,
@@ -39,17 +40,17 @@ const { wantsDownloadManagerStaging } = await import(
"../src/features/chat/utils/model-download-staging.ts"
);
-const notice = readText("../src/features/chat/components/chat-model-notice.tsx");
-const page = readText("../src/features/chat/chat-page.tsx");
-const runtimeProvider = readText("../src/features/chat/runtime-provider.tsx");
-const adapter = readText("../src/features/chat/api/chat-adapter.ts");
-const chatApi = readText("../src/features/chat/api/chat-api.ts");
-const types = readText("../src/features/chat/types.ts");
-const thread = readText("../src/components/assistant-ui/thread.tsx");
+const notice = atDefaultUiScale(readText("../src/features/chat/components/chat-model-notice.tsx"));
+const page = atDefaultUiScale(readText("../src/features/chat/chat-page.tsx"));
+const runtimeProvider = atDefaultUiScale(readText("../src/features/chat/runtime-provider.tsx"));
+const adapter = atDefaultUiScale(readText("../src/features/chat/api/chat-adapter.ts"));
+const chatApi = atDefaultUiScale(readText("../src/features/chat/api/chat-api.ts"));
+const types = atDefaultUiScale(readText("../src/features/chat/types.ts"));
+const thread = atDefaultUiScale(readText("../src/components/assistant-ui/thread.tsx"));
const researchPanel = readText(
"../src/features/chat/components/research-activity-panel.tsx",
);
-const artifact = readText("../src/features/chat/artifacts/artifact-surface.tsx");
+const artifact = atDefaultUiScale(readText("../src/features/chat/artifacts/artifact-surface.tsx"));
const switchSource = readText(
"../src/features/chat/components/chat-model-notice-switch.ts",
);
@@ -253,7 +254,7 @@ test("the conversation reserves the space the notice overlay takes", () => {
// 0px so every surface without a notice keeps exactly the padding it had.
assert.match(
thread,
- /pt-\[calc\(var\(--studio-content-top-inset,0px\)\+48px\+var\(--studio-chat-notice-height,0px\)\)\]/,
+ /pt-\[calc\(var\(--studio-content-top-inset,0px\)\+var\(--studio-chat-header-height,48px\)\+var\(--studio-chat-notice-height,0px\)\)\]/,
);
// And the fade moves down with it, or it would dissolve behind the opaque bar.
const fade = slice(page, "chat-header-fade", '"');
@@ -304,15 +305,18 @@ test("the canvas panel reserves the notice's height too", () => {
// preview/source tabs and the close control sit in exactly that band, and the
// notice is opaque and takes pointer events at z-30. Same fix as the research
// panel, and 0px whenever no notice is on screen.
+ // The 90 and the 122 now carry the UI scale, minus the content inset, which
+ // is window chrome and stays fixed. At the default both come to what they
+ // were, so the geometry this test describes is unchanged.
const panel = slice(artifact, 'variant === "panel"', "aria-label=");
assert.match(
panel,
- /marginTop:\s*\n?\s*"calc\(90px \+ var\(--studio-chat-notice-height, 0px\)\)"/,
+ /marginTop:\s*\n?\s*"calc\(var\(--studio-content-top-inset, 0px\) \+ \(90px - var\(--studio-content-top-inset, 0px\)\) \* var\(--ui-space-scale, 1\) \+ var\(--studio-chat-notice-height, 0px\)\)"/,
);
// Both edges move, or the panel keeps its height and overflows the bottom.
assert.match(
panel,
- /height:\s*\n?\s*"calc\(100% - 122px - var\(--studio-chat-notice-height, 0px\)\)"/,
+ /height:\s*\n?\s*"calc\(100% - var\(--studio-content-top-inset, 0px\) - \(122px - var\(--studio-content-top-inset, 0px\)\) \* var\(--ui-space-scale, 1\) - var\(--studio-chat-notice-height, 0px\)\)"/,
);
// The class list must not still carry the fixed geometry the style replaces.
assert.doesNotMatch(panel, /mt-\[90px\]/);
diff --git a/studio/frontend/tests/chrome-icon-button-consistency.test.ts b/studio/frontend/tests/chrome-icon-button-consistency.test.ts
index 962991ff77f..9955a3b3554 100644
--- a/studio/frontend/tests/chrome-icon-button-consistency.test.ts
+++ b/studio/frontend/tests/chrome-icon-button-consistency.test.ts
@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { readSrc } from "./helpers/kit.ts";
+import { atDefaultUiScale, readSrc } from "./helpers/kit.ts";
const BUTTON_CLASS = /className="([^"]+)"/;
const WHITESPACE = /\s+/;
@@ -41,8 +41,8 @@ function buttonClasses(button: string): Set<string> {
test("run settings uses one aligned toggle in both states", async () => {
const [page, panel] = await Promise.all([
- readSrc("features/chat/chat-page.tsx"),
- readSrc("features/chat/chat-settings-sheet.tsx"),
+ atDefaultUiScale(readSrc("features/chat/chat-page.tsx")),
+ atDefaultUiScale(readSrc("features/chat/chat-settings-sheet.tsx")),
]);
const toggles = [
@@ -66,8 +66,8 @@ test("run settings uses one aligned toggle in both states", async () => {
test("settings chrome uses the titlebar rounded-square hover shape", async () => {
const [dialog, sidebar] = await Promise.all([
- readSrc("features/settings/settings-dialog.tsx"),
- readSrc("components/app-sidebar.tsx"),
+ atDefaultUiScale(readSrc("features/settings/settings-dialog.tsx")),
+ atDefaultUiScale(readSrc("components/app-sidebar.tsx")),
]);
const dialogMain = dialog.slice(dialog.indexOf("<main"));
diff --git a/studio/frontend/tests/helpers/kit.ts b/studio/frontend/tests/helpers/kit.ts
index ce64025d8be..9bd74a74c9d 100644
--- a/studio/frontend/tests/helpers/kit.ts
+++ b/studio/frontend/tests/helpers/kit.ts
@@ -16,6 +16,19 @@ export function readSrc(relative: string): string {
return readFileSync(new URL(`../../src/${relative}`, import.meta.url), "utf8");
}
+const UI_SPACE_SCALE =
+ /calc\(\s*(-?[\d.]+(?:px|rem|em))\s*\*\s*var\(--ui-space-scale\s*,\s*1\)\s*\)/g;
+
+/**
+ * Source with --ui-space-scale collapsed to the length it resolves to at the
+ * default UI font size. Shape assertions reason in px, and every length in such
+ * a comparison moves by the same factor, so reading the authored base keeps
+ * them true at any font size.
+ */
+export function atDefaultUiScale(source: string): string {
+ return source.replace(UI_SPACE_SCALE, "$1");
+}
+
/** A repository file read as text, relative to `studio/frontend/tests` like the `new URL` it replaces. Prefer `readSrc` under `src`. */
export function readText(relative: string): string {
return readFileSync(new URL(`../${relative}`, import.meta.url), "utf8");
diff --git a/studio/frontend/tests/mac-titlebar-optical-alignment.test.ts b/studio/frontend/tests/mac-titlebar-optical-alignment.test.ts
index 5dea7511204..2f3ad08209c 100644
--- a/studio/frontend/tests/mac-titlebar-optical-alignment.test.ts
+++ b/studio/frontend/tests/mac-titlebar-optical-alignment.test.ts
@@ -1,15 +1,15 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { readSrc } from "./helpers/kit.ts";
+import { atDefaultUiScale, readSrc } from "./helpers/kit.ts";
const PORTALLED_NATIVE_TITLEBAR_PATTERN =
/"--studio-window-chrome-top",[\s\S]*?NATIVE_MAC_TITLEBAR_HEIGHT_VAR/;
test("mac titlebar navigation shifts buttons with centered glyphs", async () => {
const [titlebar, provider] = await Promise.all([
- readSrc("components/tauri/window-titlebar.tsx"),
- readSrc("app/provider.tsx"),
+ atDefaultUiScale(readSrc("components/tauri/window-titlebar.tsx")),
+ atDefaultUiScale(readSrc("app/provider.tsx")),
]);
const macStyle = provider.match(
/const MAC_NATIVE_CHROME_STYLE = \{[\s\S]*?\} as CSSProperties;/,
@@ -29,10 +29,10 @@ test("mac titlebar navigation shifts buttons with centered glyphs", async () =>
test("mac chat and media headers share the lowered control row", async () => {
const [provider, chat, images, video] = await Promise.all([
- readSrc("app/provider.tsx"),
- readSrc("features/chat/chat-page.tsx"),
- readSrc("features/images/images-page.tsx"),
- readSrc("features/video/video-page.tsx"),
+ atDefaultUiScale(readSrc("app/provider.tsx")),
+ atDefaultUiScale(readSrc("features/chat/chat-page.tsx")),
+ atDefaultUiScale(readSrc("features/images/images-page.tsx")),
+ atDefaultUiScale(readSrc("features/video/video-page.tsx")),
]);
const macStyle = provider.match(
@@ -50,8 +50,8 @@ test("mac chat and media headers share the lowered control row", async () => {
// fallback string is built from the same constant rather than retyped.
test("mac native chrome clearance stays fixed across interface scales", async () => {
const [provider, runtime] = await Promise.all([
- readSrc("app/provider.tsx"),
- readSrc("features/settings/lib/interface-scale-runtime.ts"),
+ atDefaultUiScale(readSrc("app/provider.tsx")),
+ atDefaultUiScale(readSrc("features/settings/lib/interface-scale-runtime.ts")),
]);
assert.match(
runtime,
diff --git a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
index 5a4f45983de..f4a007a6623 100644
--- a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
+++ b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
@@ -6,8 +6,14 @@ import { readFileSync } from "node:fs";
import test from "node:test";
import { fileURLToPath } from "node:url";
+import { atDefaultUiScale } from "./helpers/kit.ts";
+
function read(path: string): string {
- return readFileSync(fileURLToPath(new URL(path, import.meta.url)), "utf-8");
+ // Lengths here are compared to each other in px, so read them at the default
+ // UI font size; --ui-space-scale moves every one of them by the same factor.
+ return atDefaultUiScale(
+ readFileSync(fileURLToPath(new URL(path, import.meta.url)), "utf-8"),
+ );
}
const PICKERS = read(
diff --git a/studio/frontend/tests/sidebar-action-rows-inert.test.ts b/studio/frontend/tests/sidebar-action-rows-inert.test.ts
index ff273dbe4ba..ff1abaddf1b 100644
--- a/studio/frontend/tests/sidebar-action-rows-inert.test.ts
+++ b/studio/frontend/tests/sidebar-action-rows-inert.test.ts
@@ -4,11 +4,11 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { readSrc } from "./helpers/kit.ts";
+import { atDefaultUiScale, readSrc } from "./helpers/kit.ts";
-const APP_SIDEBAR = readSrc("components/app-sidebar.tsx");
+const APP_SIDEBAR = atDefaultUiScale(readSrc("components/app-sidebar.tsx"));
-const INDEX = readSrc("index.css");
+const INDEX = atDefaultUiScale(readSrc("index.css"));
// The pinned top rows run an action rather than open a page, so neither may
// mark itself active: nav rows paint one pill for both states, and an active
diff --git a/studio/frontend/tests/sidebar-spinner-column.test.ts b/studio/frontend/tests/sidebar-spinner-column.test.ts
index ea767e9bc0b..04e8d582997 100644
--- a/studio/frontend/tests/sidebar-spinner-column.test.ts
+++ b/studio/frontend/tests/sidebar-spinner-column.test.ts
@@ -4,9 +4,9 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { readSrc } from "./helpers/kit.ts";
+import { atDefaultUiScale, readSrc } from "./helpers/kit.ts";
-const APP_SIDEBAR = readSrc("components/app-sidebar.tsx");
+const APP_SIDEBAR = atDefaultUiScale(readSrc("components/app-sidebar.tsx"));
// The nav spinner is ml-auto, so it sits at its row's padding-right plus its margin-right.
// The chat spinner is anchored at right-N off the row's edge instead: in the flow a working
@@ -64,8 +64,8 @@ test("nav and Recents spinners land on one trailing column", async () => {
// The kebab overlays the row's right edge, so a spinner row must pad past it.
test("a working Recents row clears the kebab on hover", async () => {
const [source, css] = await Promise.all([
- readSrc("components/app-sidebar.tsx"),
- readSrc("index.css"),
+ atDefaultUiScale(readSrc("components/app-sidebar.tsx")),
+ atDefaultUiScale(readSrc("index.css")),
]);
const kebabInset =
@@ -100,7 +100,7 @@ test("a working Recents row clears the kebab on hover", async () => {
// one glyph can reach across the other. The options button is later in the DOM and would win
// those clicks, taking the pin's own glyph with them.
test("the pin and options buttons do not overlap", () => {
- const css = readSrc("index.css");
+ const css = atDefaultUiScale(readSrc("index.css"));
const px = (value: string) =>
value.trim().endsWith("rem")
@@ -195,8 +195,8 @@ test("a pending row is marked so both renderers can show its tooltip", async ()
test("the expanded row and the flyout both show a pending tooltip", async () => {
const [sidebar, appSidebar] = await Promise.all([
- readSrc("components/ui/sidebar.tsx"),
- readSrc("components/app-sidebar.tsx"),
+ atDefaultUiScale(readSrc("components/ui/sidebar.tsx")),
+ atDefaultUiScale(readSrc("components/app-sidebar.tsx")),
]);
// The rail-only rule has to make an exception, or an enabled row is silent while expanded.
diff --git a/studio/frontend/tests/sidebar-touch-reorder.test.ts b/studio/frontend/tests/sidebar-touch-reorder.test.ts
index 7cf09af9dd1..7db8ee71a18 100644
--- a/studio/frontend/tests/sidebar-touch-reorder.test.ts
+++ b/studio/frontend/tests/sidebar-touch-reorder.test.ts
@@ -4,9 +4,9 @@
import assert from "node:assert/strict";
import test from "node:test";
-import { readSrc, readSrcAsync } from "./helpers/kit.ts";
+import { atDefaultUiScale, readSrc, readSrcAsync } from "./helpers/kit.ts";
-const APP_SIDEBAR = readSrc("components/app-sidebar.tsx");
+const APP_SIDEBAR = atDefaultUiScale(readSrc("components/app-sidebar.tsx"));
// Touch never fires dragstart, so the row menu is the only way to reorder a
// list there. A menu behind a trigger without sidebar-touch-reveal is inert on
@@ -23,7 +23,7 @@ function actionClassFor(source: string, label: string): string {
test("only sidebar-touch-reveal actions work on a coarse pointer", async () => {
// The rule the rest of this file depends on.
- const css = await readSrcAsync("index.css");
+ const css = atDefaultUiScale(await readSrcAsync("index.css"));
const coarse = /@media \(pointer: coarse\) \{([\s\S]*?)\n\t\}/.exec(css);
assert.ok(coarse, "no coarse-pointer block in index.css");
assert.match(coarse[1], /\.sidebar-row-action\.sidebar-touch-reveal/);
diff --git a/studio/frontend/tests/toast-offset.test.ts b/studio/frontend/tests/toast-offset.test.ts
index 69db00effb6..9ac9b1c52b3 100644
--- a/studio/frontend/tests/toast-offset.test.ts
+++ b/studio/frontend/tests/toast-offset.test.ts
@@ -103,3 +103,21 @@ test("offsets are pure, so a caller cannot poison the next lookup", () => {
mobile: { top: 52, right: 16 },
});
});
+
+test("the header offset follows the UI font size, the titlebar does not", () => {
+ // The page header is 48px * the scale, so a fixed 52px top lands inside it
+ // at the 20px setting. The titlebar band is fixed and keeps its 34px.
+ assert.deepEqual(getToastOffsets("/chat", false, false, 20 / 15), {
+ default: { top: 69, right: 12 },
+ mobile: { top: 69, right: 16 },
+ });
+ assert.deepEqual(getToastOffsets("/chat", true, true, 20 / 15), {
+ default: { top: 103, right: 12 },
+ mobile: { top: 103, right: 16 },
+ });
+ // A route with no header keeps its corner inset at any size.
+ assert.deepEqual(getToastOffsets("/settings", false, false, 20 / 15), {
+ default: { top: 12, right: 12 },
+ mobile: { top: 16, right: 16 },
+ });
+});
diff --git a/studio/frontend/tests/ui-font-size-scales-spacing.test.ts b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
new file mode 100644
index 00000000000..4fb761e5957
--- /dev/null
+++ b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
@@ -0,0 +1,241 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { readdirSync } from "node:fs";
+import { join } from "node:path";
+
+import { readSrc } from "./helpers/kit.ts";
+
+/** Every source that can carry a length. */
+const SOURCES = (function walk(dir: string): string[] {
+ return readdirSync(join(import.meta.dirname, "../src", dir), {
+ withFileTypes: true,
+ }).flatMap((entry) => {
+ const path = dir ? `${dir}/${entry.name}` : entry.name;
+ if (entry.isDirectory()) return walk(path);
+ return /\.(tsx?|css)$/.test(entry.name) ? [path] : [];
+ });
+})("");
+
+// UI font size has to move what separates the text too: a 20px label in a row
+// padded for 12px reads as cramped. --ui-space-scale is the one multiplier
+// every such length goes through.
+
+const CSS = readSrc("index.css");
+const SIDEBAR = readSrc("components/app-sidebar.tsx");
+const PROVIDER = readSrc("app/provider.tsx");
+
+const SCALED = /calc\([\d.]+(?:px|rem)\s*\*\s*var\(--ui-space-scale,\s*1\)\)/;
+
+test("the spacing scale is the font-size preference, normalised at the default", () => {
+ // --ui-font-scale is against a 16px base and the default is 15px, so
+ // dividing by the default leaves the shipped spacing untouched.
+ assert.match(
+ CSS,
+ /--ui-space-scale:\s*calc\(var\(--ui-font-scale, 1\) \/ 0\.9375\);/,
+ );
+ assert.match(CSS, /--ui-font-scale:\s*0\.9375;/);
+});
+
+test("every tailwind spacing utility goes through it", () => {
+ // p-*, m-*, gap-* and size-* are all calc(var(--spacing) * n), so the step
+ // scales the whole layout at once. The @theme passthrough is commented out,
+ // so it is not a declaration.
+ const declarations = (CSS.match(/--spacing:[^;]+;/g) ?? []).filter(
+ (declaration) => !declaration.includes("var(--spacing)"),
+ );
+ assert.equal(declarations.length, 2, "light and dark each declare --spacing");
+ for (const declaration of declarations) {
+ assert.match(
+ declaration,
+ /--spacing:\s*calc\(0\.25rem \* var\(--ui-space-scale, 1\)\);/,
+ );
+ }
+});
+
+test("a measured cutoff moves with the box it measures", () => {
+ // min-h-9 scales, so a one-line chip field is 27px at the 12px setting and
+ // 46px at 20px. A fixed 44 calls the tall one wrapped while it is empty.
+ const chips = readSrc("features/recipe-studio/components/chip-input.tsx");
+ assert.match(chips, /element\.clientHeight > 44 \* uiSpaceScale/);
+ assert.match(chips, /\}, \[values\.length, draft, uiSpaceScale\]\);/);
+});
+
+test("em lengths are left alone, they already follow the text", () => {
+ // rem is against the 16px root, which the preference never touches, so it
+ // needs the multiplier. em is against the element's own font size, which
+ // does move, so scaling it applies the preference twice.
+ const withEm = SOURCES.filter((file) =>
+ /[^a-z0-9.]-?[\d.]+em\s*\*\s*var\(--ui-space-scale/.test(readSrc(file)),
+ );
+ assert.deepEqual(withEm, [], "these em lengths take the scale twice");
+ const pickers = readSrc(
+ "features/model-picker/components/model-selector/pickers.tsx",
+ );
+ assert.match(pickers, /mx-\[-0\.1em\]/);
+ assert.match(pickers, /ml-\[0\.14em\]/);
+});
+
+test("chat chrome that holds text scales, window chrome does not", () => {
+ // The header band and the controls in it grow with their labels.
+ for (const name of [
+ "--studio-chat-header-height",
+ "--studio-chat-control-height",
+ "--studio-chat-header-padding-top",
+ ]) {
+ for (const source of [CSS, PROVIDER]) {
+ const declaration = new RegExp(
+ `${name}"?:\\s*"?(calc\\([^;\\n"]*\\)|[^;,\\n]+)`,
+ ).exec(source);
+ assert.ok(declaration, `${name} is gone`);
+ assert.match(declaration[1], SCALED, `${name} must follow the UI scale`);
+ }
+ }
+
+ // The title bar and the traffic lights belong to the OS window; a font size
+ // preference must not move the UI off them.
+ for (const name of [
+ "--studio-desktop-titlebar-height",
+ "--studio-content-top-inset",
+ ]) {
+ const declaration = new RegExp(`${name}":\\s*"([^"]+)"`).exec(PROVIDER);
+ if (declaration) {
+ assert.doesNotMatch(declaration[1], /--ui-space-scale/, name);
+ }
+ }
+});
+
+test("the sidebar's hand-set spacing follows the scale", () => {
+ // The rows use one-off px values (gap-[8.5px], pl-[39px]), which is exactly
+ // the spacing that used to stay put while the labels grew.
+ const bare = [
+ ...SIDEBAR.matchAll(
+ /(?<![\w-])-?(?:p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap|gap-x|gap-y)-\[(\d*\.?\d+)px\]/g,
+ ),
+ ].filter((match) => Number(match[1]) > 1);
+ assert.deepEqual(
+ bare.map((match) => match[0]),
+ [],
+ "these sidebar paddings ignore the UI font size",
+ );
+});
+
+test("fixed slots that hold scaled content scale with it", () => {
+ // These heights live in JS, so the CSS variable cannot reach them. A slot
+ // left at its 15px value clips or overlaps the row it holds.
+ const HOOK = "useUiSpaceScale";
+ const rows = readSrc("features/hub/catalog/models-catalog-rows.tsx");
+ assert.ok(rows.includes(HOOK), "the virtualizer ignores the UI font size");
+ assert.match(rows, /estimateSize: \(\) => slotHeight/);
+ assert.match(rows, /height: `\$\{slotHeight\}px`/);
+ // estimateSize is cached, so a new scale has to invalidate the sizes.
+ assert.match(rows, /virtualizer\.measure\(\)/);
+
+ const carousel = readSrc("features/hub/catalog/hub-section-row.tsx");
+ assert.ok(carousel.includes(HOOK), "the carousel slot ignores it");
+ assert.match(carousel, /itemHeight=\{cardHeight\}/);
+ // The stride and the arrow's centre line are measured in JS against gap-4
+ // and pt-2, which scale, so an unscaled stride stops short of the next card.
+ const strip = readSrc("features/hub/catalog/card-carousel.tsx");
+ assert.ok(strip.includes(HOOK), "the carousel stride ignores it");
+ assert.match(strip, /const gapPx = CARD_GAP_PX \* scale;/);
+ assert.match(strip, /const topPaddingPx = CAROUSEL_TOP_PADDING_PX \* scale;/);
+ // A new scale changes scrollWidth, which decides the arrows. The resize
+ // observer only watches the scroller's own box, so the sizes are deps.
+ assert.match(
+ strip,
+ /\}, \[updateArrows, items, itemWidth, itemHeight, gapPx\]\);/,
+ );
+
+ const lists = readSrc("features/hub/catalog/models-catalog-lists.tsx");
+ assert.ok(lists.includes(HOOK), "the pinned grid ignores it");
+ // The pinned block sits directly above the virtualized rows in the same
+ // lanes, so a gutter of its own would step the card widths.
+ assert.match(
+ lists,
+ /Math\.round\(CATALOG_COLUMN_GAP_PX \* pinnedScale\)/,
+ );
+ assert.doesNotMatch(lists, /columnGap: 12,/);
+});
+
+test("the titlebar reserves room for its controls, which stay in the band", () => {
+ const titlebar = readSrc("components/tauri/window-titlebar.tsx");
+ // The band is a fixed 34px and clips nothing, so a grown button would hang
+ // over the page and take its clicks.
+ assert.match(titlebar, /inline-flex size-\[30px\] shrink-0/);
+ // The spacer stands in for one of those buttons while the navbar renders
+ // its own trigger, so it holds the same fixed width.
+ assert.match(titlebar, /aria-hidden="true" className="size-\[30px\] shrink-0"/);
+ assert.match(titlebar, /inline-flex h-\[26px\] w-\[26px\] shrink-0/);
+ // The padding and gaps around them still scale, so the drag region has to
+ // start further out or it covers the last button.
+ // max(), because the buttons are fixed: the slot may grow with the padding
+ // around them but must never fall under their own width.
+ assert.match(
+ titlebar,
+ /max\(7rem, calc\(7rem \* var\(--ui-space-scale, 1\)\)\)/,
+ );
+});
+
+test("the composer's one-row clamp is one row at any size", () => {
+ // The editor box wins over the input's own min-height, so all three clamps
+ // and the JS floor have to move together or an empty composer clips.
+ const clamps = CSS.match(/calc\(40px \* var\(--ui-space-scale, 1\)\)/g) ?? [];
+ assert.equal(clamps.length, 3, "a 40px composer clamp is still fixed");
+ const thread = readSrc("components/assistant-ui/thread.tsx");
+ assert.match(thread, /const oneRowHeight = Math\.round\(40 \* uiSpaceScale\);/);
+ assert.doesNotMatch(thread, /Math\.max\(40, editorHeight\)/);
+});
+
+test("overlays that scale cannot outgrow the screen", () => {
+ // w-* follows --spacing too, so a w-72 popover is 384px at the 20px
+ // setting, past a 375px phone. Each floating surface caps itself.
+ for (const file of [
+ "components/ui/popover.tsx",
+ "components/ui/dropdown-menu.tsx",
+ "components/ui/select.tsx",
+ ]) {
+ assert.match(
+ readSrc(file),
+ /max-w-\[calc\(100vw-32px\)\]/,
+ `${file} can overflow a narrow viewport`,
+ );
+ }
+});
+
+test("the artifact panel's vertical budget adds up at any size", () => {
+ // The shell's mb-8 scales. If the offsets above and below it do not, the
+ // panel outgrows its pane and the bottom is clipped.
+ const surface = readSrc("features/chat/artifacts/artifact-surface.tsx");
+ assert.match(surface, /\bmb-8\b/, "the panel no longer carries mb-8");
+ // The titlebar band inside the 90 is window chrome and stays fixed, so it
+ // comes out of the offset before the rest is scaled and goes back in after.
+ assert.match(
+ surface,
+ /marginTop:\s*\n?\s*"calc\(var\(--studio-content-top-inset, 0px\) \+ \(90px - var\(--studio-content-top-inset, 0px\)\) \* var\(--ui-space-scale, 1\) \+ var\(--studio-chat-notice-height, 0px\)\)"/,
+ );
+ assert.match(
+ surface,
+ /height:\s*\n?\s*"calc\(100% - var\(--studio-content-top-inset, 0px\) - \(122px - var\(--studio-content-top-inset, 0px\)\) \* var\(--ui-space-scale, 1\) - var\(--studio-chat-notice-height, 0px\)\)"/,
+ );
+ // 90 above plus the 32 of mb-8 is the 122 taken off the pane.
+ assert.equal(90 + 8 * 4, 122);
+});
+
+test("the stylesheet's comments stay comments", () => {
+ // A "*/" inside the prose ends the comment early and postcss then reads the
+ // rest of the sentence as a declaration, taking the next one with it.
+ const stripped = CSS.replace(/\/\*[\s\S]*?\*\//g, "");
+ assert.doesNotMatch(
+ stripped,
+ /\butility follows\b|\bTailwind's\b/,
+ "prose leaked out of a comment",
+ );
+ assert.ok(
+ stripped.includes("--spacing: calc(0.25rem * var(--ui-space-scale, 1));"),
+ "the spacing step is no longer a declaration of its own",
+ );
+});