Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Feat/UI rework (#12479)
Eyera46197ff16079
diff --git a/studio/frontend/public/reload-snapshot.js b/studio/frontend/public/reload-snapshot.jsindex ff0944c276b..eff83fc3a8f 100644--- a/studio/frontend/public/reload-snapshot.js+++ b/studio/frontend/public/reload-snapshot.js@@ -53,6 +53,7 @@"--contrast-line-mix","--contrast-panel-ink-target","--contrast-panel-target",+ "--contrast-seam-gain","--contrast-state-mix","--contrast-surface-mix","--contrast-target",diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex 06f8cdc3f97..b3ec14f001f 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -85,6 +85,8 @@ import { copyToClipboardFrom } from "@/lib/copy-to-clipboard";import { isTauri } from "@/lib/api-base";import { useWebUpdateCheck } from "@/hooks/use-web-update-check";import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";+import { useHoverFlyout } from "@/hooks/use-hover-flyout";+import { NAV_FLYOUT_INTENT, NAV_TOOLTIP_INTENT } from "@/lib/hover-intent";import {Archive03Icon,Cancel01Icon,@@ -137,6 +139,7 @@ import {import {Tooltip,TooltipContent,+ TooltipProvider,} from "@/components/ui/tooltip";import { Tooltip as TooltipPrimitive } from "radix-ui";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";@@ -256,7 +259,6 @@ import {useRef,useState,type ComponentType,- type PointerEvent,type ReactNode,} from "react";import { toast } from "@/lib/toast";@@ -1007,46 +1009,22 @@ export function AppSidebar() {const [chatOpen, setChatOpen] = useState(true);// Mouse hover previews the flyout; a press pins or unpins it. Touch and keyboard pin it.- const [moreHoverOpen, setMoreHoverOpen] = useState(false);const [morePinnedOpen, setMorePinnedOpen] = useState(false);- const moreOpen = moreHoverOpen || morePinnedOpen;const moreTriggerRef = useRef<HTMLButtonElement | null>(null);const moreContentRef = useRef<HTMLDivElement | null>(null);+ const moreHover = useHoverFlyout(NAV_FLYOUT_INTENT, moreContentRef);+ const { dismiss: dismissMoreHover } = moreHover;+ const moreOpen = moreHover.open || morePinnedOpen;// A hover preview must not move focus in or out of the composer.const moreChosen = useRef(false);- const moreCloseTimer = useRef<ReturnType<typeof setTimeout> | null>(null);- const clearMoreCloseTimer = useCallback(() => {- if (!moreCloseTimer.current) return;- clearTimeout(moreCloseTimer.current);- moreCloseTimer.current = null;- }, []);- const openMorePreview = useCallback(- (event: PointerEvent<HTMLElement>) => {- if (event.pointerType !== "mouse") return;- clearMoreCloseTimer();- setMoreHoverOpen(true);- },- [clearMoreCloseTimer],- );- // Grace period for crossing the gap to the flyout.- const closeMorePreviewSoon = useCallback(- (event: PointerEvent<HTMLElement>) => {- if (event.pointerType !== "mouse") return;- clearMoreCloseTimer();- moreCloseTimer.current = setTimeout(() => setMoreHoverOpen(false), 180);- },- [clearMoreCloseTimer],- );const setMoreOpen = useCallback((next: boolean) => {- clearMoreCloseTimer();+ dismissMoreHover();if (next) moreChosen.current = true;setMorePinnedOpen(next);- if (!next) setMoreHoverOpen(false);},- [clearMoreCloseTimer],+ [dismissMoreHover],);- useEffect(() => clearMoreCloseTimer, [clearMoreCloseTimer]);// Radix forwards onOpenAutoFocus at runtime but omits it from DropdownMenuContent's types.const moreContentFocusProps = {onOpenAutoFocus: (event: Event) => {@@ -4951,6 +4929,7 @@ export function AppSidebar() {return (<>{slotShortcuts}+ <TooltipProvider {...NAV_TOOLTIP_INTENT}><Sidebarcollapsible="icon"collapseToZero={isTauri}@@ -4958,18 +4937,18 @@ export function AppSidebar() {className={cn(// Rail background comes from --sidebar-surface (index.css) so the footer fade can match it."font-heading group-data-[collapsible=icon]:[&_[data-sidebar=sidebar]]:bg-[var(--sidebar-surface)]",- usesNativeMacTitlebar &&- "group-data-[collapsible=icon]:[&_[data-sidebar=sidebar]]:border-r-0",- usesDesktopTitlebar && !usesNativeMacTitlebar && pinned &&- "[&_[data-sidebar=sidebar]]:border-r-0",+ !(usesCustomTitlebar && pinned) &&+ "[&_[data-sidebar=sidebar]]:border-r [&_[data-sidebar=sidebar]]:border-sidebar-edge dark:[&_[data-sidebar=sidebar]]:border-r-0",)}><SidebarHeaderclassName={cn("relative",- usesDesktopTitlebar- ? "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",+ usesCustomTitlebar+ ? "shrink-0 p-0 pt-[calc(var(--studio-content-top-inset,0px)+var(--studio-chat-header-padding-top,11px))]"+ : usesNativeMacTitlebar+ ? "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 && (@@ -4992,6 +4971,7 @@ export function AppSidebar() {usesDesktopTitlebar? "justify-between pl-4 pr-3": "justify-between",+ usesCustomTitlebar && "h-[var(--studio-chat-control-height,34px)]",)}><Link@@ -5256,10 +5236,7 @@ export function AppSidebar() {})}{/* Unpinned destinations, behind one row. */}{overflowNavIds.length > 0 && (- <SidebarMenuItem- onPointerEnter={openMorePreview}- onPointerLeave={closeMorePreviewSoon}- >+ <SidebarMenuItem><DropdownMenuopen={moreOpen}onOpenChange={setMoreOpen}@@ -5274,6 +5251,7 @@ export function AppSidebar() {<DropdownMenuTrigger asChild><SidebarMenuButtonref={moreTriggerRef}+ {...moreHover.trigger}// More is a container, not a destination: no active style just because the current page// lives inside it. Keeps the row highlighted while the panel is open, after the pointer// has left. Not data-state: the tooltip and menu triggers both write that one.@@ -5283,7 +5261,7 @@ export function AppSidebar() {if (event.pointerType !== "mouse" || event.button !== 0 || event.ctrlKey) return;event.preventDefault();// An open preview never mounts again, so focus it as a click-open would.- if (!morePinnedOpen && moreHoverOpen) {+ if (!morePinnedOpen && moreHover.open) {moreContentRef.current?.focus({ preventScroll: true });}setMoreOpen(!morePinnedOpen);@@ -5317,8 +5295,7 @@ export function AppSidebar() {align="start"sideOffset={6}className="w-48 p-1"- onPointerEnter={openMorePreview}- onPointerLeave={closeMorePreviewSoon}+ {...moreHover.content}// The trigger handles its own presses.onPointerDownOutside={(event) => {if (moreTriggerRef.current?.contains(event.target as Node)) event.preventDefault();@@ -5862,6 +5839,7 @@ export function AppSidebar() {</SidebarMenu></SidebarFooter></Sidebar>+ </TooltipProvider><ChatSearchDialog />{!isTauri && (<ShutdownDialogdiff --git a/studio/frontend/src/components/tauri/window-titlebar.tsx b/studio/frontend/src/components/tauri/window-titlebar.tsxindex 8e51acd70d3..111109f5c72 100644--- a/studio/frontend/src/components/tauri/window-titlebar.tsx+++ b/studio/frontend/src/components/tauri/window-titlebar.tsx@@ -444,9 +444,9 @@ export function WindowTitlebar({hides it: any visible border there is lighter than both surfaces and reads as a white seam. */}<divclassName={cn(- "absolute top-0 right-0 h-[12px] border-t border-sidebar-border dark:border-transparent",+ "absolute top-0 right-0 h-[12px] border-t border-sidebar-edge dark:border-transparent",pinned &&- "h-[calc(100dvh-var(--studio-custom-titlebar-height))] rounded-tl-[12px] border-l border-sidebar-border/80 border-t-sidebar-border/90",+ "h-[calc(100dvh-var(--studio-custom-titlebar-height))] rounded-tl-[12px] border-l",)}style={{ left: pinned ? cornerLeft : 0 }}/>diff --git a/studio/frontend/src/components/ui/sidebar.tsx b/studio/frontend/src/components/ui/sidebar.tsxindex 99f9e615c05..48e8d303f55 100644--- a/studio/frontend/src/components/ui/sidebar.tsx+++ b/studio/frontend/src/components/ui/sidebar.tsx@@ -451,7 +451,7 @@ function Sidebar({data-sidebar="sidebar"data-slot="sidebar-inner"className={cn(- "bg-sidebar flex size-full flex-col overflow-hidden border-r border-sidebar-border dark:border-r-0",+ "bg-sidebar flex size-full flex-col overflow-hidden","group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1",)}>diff --git a/studio/frontend/src/components/ui/tooltip.tsx b/studio/frontend/src/components/ui/tooltip.tsxindex d2482f3dab5..3baaaee9010 100644--- a/studio/frontend/src/components/ui/tooltip.tsx+++ b/studio/frontend/src/components/ui/tooltip.tsx@@ -86,7 +86,7 @@ function getServerModalBlock(): boolean {return false;}-// Default to instant open (no hover delay): icon labels, nav labels and the token calculators+// Default to instant open (no hover delay): icon labels and the token calculators// should feel snappy. Consumers that want a delay pass an explicit `delayDuration`.function TooltipProvider({delayDuration = 0,@@ -300,7 +300,7 @@ function TooltipContent({sideOffset={sideOffset}collisionPadding={collisionPadding}className={cn(- "z-[999999] w-fit max-w-xs",+ "z-[999999] w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[state=delayed-open]:ease-out",variant === "default" && "tooltip-compact",variant === "rich" && "tooltip-rich",className,diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsxindex 156558ce6db..face8123c68 100644--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx@@ -1869,9 +1869,7 @@ export function ChatSettingsPanel({data-slot="chat-settings-panel"className={cn("relative z-50 shrink-0 bg-panel-surface text-panel-surface-fg font-heading",- open- ? "w-(--chat-settings-width) border-l border-sidebar-border"- : "w-0 overflow-hidden",+ open ? "w-(--chat-settings-width)" : "w-0 overflow-hidden",)}style={{@@ -1905,7 +1903,14 @@ export function ChatSettingsPanel({dataSlot="chat-settings-resize-handle"/>) : null}- <div className="h-full w-full overflow-hidden">{settingsContent}</div>+ <div+ className={cn(+ "h-full w-full overflow-hidden",+ open && "border-l border-panel-edge",+ )}+ >+ {settingsContent}+ </div></aside>);}diff --git a/studio/frontend/src/features/settings/stores/appearance-custom-store.ts b/studio/frontend/src/features/settings/stores/appearance-custom-store.tsindex b86178e10c3..75b06f98ed3 100644--- a/studio/frontend/src/features/settings/stores/appearance-custom-store.ts+++ b/studio/frontend/src/features/settings/stores/appearance-custom-store.ts@@ -319,6 +319,7 @@ export const CONTRAST_PANEL_TARGET_VAR = "--contrast-panel-target";/** Multipliers for the hand-written washes that stand in for those tokens. */export const CONTRAST_WASH_GAIN_VAR = "--contrast-wash-gain";export const CONTRAST_EDGE_GAIN_VAR = "--contrast-edge-gain";+export const CONTRAST_SEAM_GAIN_VAR = "--contrast-seam-gain";const HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;@@ -1058,6 +1059,10 @@ export function applyCustomizationToDocument(// chrome you aim at. Raising doubles it, level with the state tokens.setVar(CONTRAST_WASH_GAIN_VAR, gain(raising ? 1 : 0.4));setVar(CONTRAST_EDGE_GAIN_VAR, gain(raising ? 0.9 : 0.8));+ setVar(+ CONTRAST_SEAM_GAIN_VAR,+ (1 - distance * (raising ? 0.9 : 0.15)).toFixed(3),+ );} else {el.removeAttribute("data-contrast-adjust");setVar("--contrast-target", null);@@ -1073,6 +1078,7 @@ export function applyCustomizationToDocument(setVar(CONTRAST_INK_MIX_VAR, null);setVar(CONTRAST_WASH_GAIN_VAR, null);setVar(CONTRAST_EDGE_GAIN_VAR, null);+ setVar(CONTRAST_SEAM_GAIN_VAR, null);}el.classList.toggle("pointer-cursors", c.pointerCursors);diff --git a/studio/frontend/src/hooks/use-hover-flyout.ts b/studio/frontend/src/hooks/use-hover-flyout.tsnew file mode 100644index 00000000000..f67827b1f6e--- /dev/null+++ b/studio/frontend/src/hooks/use-hover-flyout.ts@@ -0,0 +1,104 @@+// 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 {+ type PointerEvent as ReactPointerEvent,+ type RefObject,+ useCallback,+ useEffect,+ useMemo,+ useRef,+ useState,+} from "react";++import { type HoverFlyoutIntent, isPointerHeadingInto } from "@/lib/hover-intent";++type PointerHandler = (event: ReactPointerEvent<HTMLElement>) => void;++export function useHoverFlyout(+ intent: HoverFlyoutIntent,+ contentRef: RefObject<HTMLElement | null>,+) {+ const [open, setOpen] = useState(false);+ const timerRef = useRef<number | undefined>(undefined);+ const stopAimRef = useRef<(() => void) | null>(null);++ const cancel = useCallback(() => {+ window.clearTimeout(timerRef.current);+ timerRef.current = undefined;+ stopAimRef.current?.();+ stopAimRef.current = null;+ }, []);++ const dismiss = useCallback(() => {+ cancel();+ setOpen(false);+ }, [cancel]);++ const closeAfterGrace = useCallback(() => {+ window.clearTimeout(timerRef.current);+ timerRef.current = window.setTimeout(dismiss, intent.closeDelay);+ }, [dismiss, intent.closeDelay]);++ const onTriggerEnter = useCallback<PointerHandler>(+ (event) => {+ if (event.pointerType !== "mouse") return;+ cancel();+ if (open) return;+ timerRef.current = window.setTimeout(() => setOpen(true), intent.openDelay);+ },+ [cancel, intent.openDelay, open],+ );++ const onTriggerLeave = useCallback<PointerHandler>(+ (event) => {+ if (event.pointerType !== "mouse") return;+ cancel();+ if (!open) return;+ const exit = { x: event.clientX, y: event.clientY };+ const followAim = (move: PointerEvent) => {+ const target = contentRef.current?.getBoundingClientRect();+ const pointer = { x: move.clientX, y: move.clientY };+ if (target && isPointerHeadingInto(exit, pointer, target)) {+ closeAfterGrace();+ } else {+ dismiss();+ }+ };+ window.addEventListener("pointermove", followAim);+ stopAimRef.current = () =>+ window.removeEventListener("pointermove", followAim);+ closeAfterGrace();+ },+ [cancel, closeAfterGrace, contentRef, dismiss, open],+ );++ const onContentEnter = useCallback<PointerHandler>(+ (event) => {+ if (event.pointerType === "mouse") cancel();+ },+ [cancel],+ );++ const onContentLeave = useCallback<PointerHandler>(+ (event) => {+ if (event.pointerType !== "mouse") return;+ cancel();+ if (open) closeAfterGrace();+ },+ [cancel, closeAfterGrace, open],+ );++ useEffect(() => cancel, [cancel]);++ const trigger = useMemo(+ () => ({ onPointerEnter: onTriggerEnter, onPointerLeave: onTriggerLeave }),+ [onTriggerEnter, onTriggerLeave],+ );+ const content = useMemo(+ () => ({ onPointerEnter: onContentEnter, onPointerLeave: onContentLeave }),+ [onContentEnter, onContentLeave],+ );++ return { open, dismiss, trigger, content };+}diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 5b873f25016..7217406e9a0 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -1655,6 +1655,8 @@--border: var(--border-base);--input: var(--input-base);--sidebar-border: var(--sidebar-border-base);+ --sidebar-edge: color-mix(in srgb, var(--foreground-base) calc(12% * var(--contrast-seam-gain, 1)), var(--sidebar));+ --panel-edge: color-mix(in srgb, var(--foreground-base) calc(12% * clamp(0.85, var(--contrast-edge-gain, 1), 1.1)), var(--background));/* Slider fill and thumb, the one panel control that takes neither. */--panel-slider-fg: var(--panel-slider-fg-base);/* Ink: body copy, headings, menu and sidebar labels. */@@ -1981,6 +1983,8 @@ html[data-chat-font] .aui-root {--color-verified: var(--verified);--color-sidebar-ring: var(--ring-soft);--color-sidebar-border: var(--sidebar-border);+ --color-sidebar-edge: var(--sidebar-edge);+ --color-panel-edge: var(--panel-edge);--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);--color-sidebar-accent: var(--sidebar-accent);--color-tabs-line-indicator: var(--tabs-line-indicator);diff --git a/studio/frontend/src/lib/hover-intent.ts b/studio/frontend/src/lib/hover-intent.tsnew file mode 100644index 00000000000..05f80e21ace--- /dev/null+++ b/studio/frontend/src/lib/hover-intent.ts@@ -0,0 +1,69 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++export type HoverFlyoutIntent = {+ readonly openDelay: number;+ readonly closeDelay: number;+};++type Point = { readonly x: number; readonly y: number };++type Box = {+ readonly left: number;+ readonly top: number;+ readonly right: number;+ readonly bottom: number;+};++export const NAV_TOOLTIP_INTENT = {+ delayDuration: 400,+ skipDelayDuration: 300,+ disableHoverableContent: true,+} as const;++export const NAV_FLYOUT_INTENT: HoverFlyoutIntent = {+ openDelay: 150,+ closeDelay: 300,+};++const EXIT_BLEED_PX = 5;++function isInside(point: Point, box: Box): boolean {+ return (+ point.x >= box.left &&+ point.x <= box.right &&+ point.y >= box.top &&+ point.y <= box.bottom+ );+}++function sideOf(a: Point, b: Point, point: Point): number {+ return (b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x);+}++function isInsideTriangle(point: Point, a: Point, b: Point, c: Point): boolean {+ const ab = sideOf(a, b, point);+ const bc = sideOf(b, c, point);+ const ca = sideOf(c, a, point);+ return (ab >= 0 && bc >= 0 && ca >= 0) || (ab <= 0 && bc <= 0 && ca <= 0);+}++export function isPointerHeadingInto(+ exit: Point,+ pointer: Point,+ target: Box,+): boolean {+ if (isInside(pointer, target)) return true;+ const headingRight = exit.x <= (target.left + target.right) / 2;+ const nearEdge = headingRight ? target.left : target.right;+ const apex = {+ x: exit.x + (headingRight ? -EXIT_BLEED_PX : EXIT_BLEED_PX),+ y: exit.y,+ };+ return isInsideTriangle(+ pointer,+ apex,+ { x: nearEdge, y: target.top },+ { x: nearEdge, y: target.bottom },+ );+}diff --git a/studio/frontend/src/lib/snap-padding.ts b/studio/frontend/src/lib/snap-padding.tsindex 4fd1536e0f3..338f3011e4b 100644--- a/studio/frontend/src/lib/snap-padding.ts+++ b/studio/frontend/src/lib/snap-padding.ts@@ -81,12 +81,15 @@ function balanceRowInsets(surface: HTMLElement): boolean {return true;}+const snappedSurfaces = new WeakSet<HTMLElement>();+/*** Rounds a surface's own padding and margin, then balances its rows' insets, now or once its* rows render.*/export function snapRowInsets(surface: HTMLElement | null): void {- if (!surface || typeof window === "undefined") return;+ if (!surface || typeof window === "undefined" || snappedSurfaces.has(surface)) return;+ snappedSurfaces.add(surface);snapInlinePadding(surface);if (balanceRowInsets(surface) || typeof MutationObserver === "undefined") return;const observer = new MutationObserver(() => {diff --git a/studio/frontend/tests/hover-intent.test.ts b/studio/frontend/tests/hover-intent.test.tsnew file mode 100644index 00000000000..e9c7f6d296a--- /dev/null+++ b/studio/frontend/tests/hover-intent.test.ts@@ -0,0 +1,69 @@+// 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 {+ NAV_FLYOUT_INTENT,+ NAV_TOOLTIP_INTENT,+ isPointerHeadingInto,+} from "../src/lib/hover-intent.ts";+import { readSrc } from "./helpers/kit.ts";++const FLYOUT_RIGHT = { left: 300, top: 100, right: 492, bottom: 340 };+const FLYOUT_LEFT = { left: 400, top: 100, right: 690, bottom: 340 };++test("a pointer inside the flyout is always heading into it", () => {+ assert.equal(isPointerHeadingInto({ x: 290, y: 110 }, { x: 400, y: 300 }, FLYOUT_RIGHT), true);+});++test("leaving the row toward the flyout keeps it, straight or diagonal", () => {+ assert.equal(isPointerHeadingInto({ x: 290, y: 110 }, { x: 296, y: 110 }, FLYOUT_RIGHT), true);+ assert.equal(isPointerHeadingInto({ x: 290, y: 110 }, { x: 295, y: 125 }, FLYOUT_RIGHT), true);+ assert.equal(isPointerHeadingInto({ x: 150, y: 133 }, { x: 220, y: 170 }, FLYOUT_RIGHT), true);+});++test("moving on to the next row or back away is not heading into it", () => {+ assert.equal(isPointerHeadingInto({ x: 150, y: 133 }, { x: 150, y: 160 }, FLYOUT_RIGHT), false);+ assert.equal(isPointerHeadingInto({ x: 150, y: 133 }, { x: 140, y: 120 }, FLYOUT_RIGHT), false);+ assert.equal(isPointerHeadingInto({ x: 290, y: 110 }, { x: 300, y: 60 }, FLYOUT_RIGHT), false);+});++test("a flyout flipped to the other side is aimed at from that side", () => {+ assert.equal(isPointerHeadingInto({ x: 700, y: 110 }, { x: 695, y: 115 }, FLYOUT_LEFT), true);+ assert.equal(isPointerHeadingInto({ x: 700, y: 110 }, { x: 720, y: 115 }, FLYOUT_LEFT), false);+});++test("nav labels wait for intent, then chain without delay or hover grace", () => {+ assert.ok(NAV_TOOLTIP_INTENT.delayDuration > 0);+ assert.ok(NAV_TOOLTIP_INTENT.skipDelayDuration > 0);+ assert.equal(NAV_TOOLTIP_INTENT.disableHoverableContent, true);+});++test("the More flyout opens sooner than a label and outlasts the gap to it", () => {+ assert.ok(NAV_FLYOUT_INTENT.openDelay > 0);+ assert.ok(NAV_FLYOUT_INTENT.openDelay < NAV_TOOLTIP_INTENT.delayDuration);+ assert.ok(NAV_FLYOUT_INTENT.closeDelay > NAV_FLYOUT_INTENT.openDelay);+});++test("the hover flyout answers the mouse only", () => {+ const hook = readSrc("hooks/use-hover-flyout.ts");+ assert.equal(hook.match(/event\.pointerType !== "mouse"/g)?.length, 3);+ assert.equal(hook.match(/event\.pointerType === "mouse"/g)?.length, 1);+ assert.match(hook, /isPointerHeadingInto\(exit, pointer, target\)/);+});++test("the sidebar scopes nav tooltip intent to itself", () => {+ const sidebar = readSrc("components/app-sidebar.tsx");+ assert.match(sidebar, /<TooltipProvider \{\.\.\.NAV_TOOLTIP_INTENT\}>\s*<Sidebar\b/);+ assert.match(sidebar, /<\/Sidebar>\s*<\/TooltipProvider>/);+});++test("only a tooltip that waited animates in, so chained ones glide", () => {+ const tooltip = readSrc("components/ui/tooltip.tsx");+ assert.match(tooltip, /data-\[state=delayed-open\]:animate-in/);+ assert.match(tooltip, /origin-\(--radix-tooltip-content-transform-origin\)/);+ assert.doesNotMatch(tooltip, /data-\[state=instant-open\]:animate-in/);+ assert.doesNotMatch(tooltip, /data-\[state=closed\]:animate-out/);+});diff --git a/studio/frontend/tests/menu-row-spacing.test.ts b/studio/frontend/tests/menu-row-spacing.test.tsindex edb3c683ff1..bfcd3f633f8 100644--- a/studio/frontend/tests/menu-row-spacing.test.ts+++ b/studio/frontend/tests/menu-row-spacing.test.ts@@ -115,3 +115,25 @@ test("menu surfaces keep whole-pixel padding, margin and width, so the hover pil);assert.match(readSrc("components/app-sidebar.tsx"), /app-user-menu sidebar-menu[^"]*w-\[round\(calc\(16rem\*var\(--ui-space-scale,1\)\),1px\)\]/);});++test("a surface is snapped once, however often its ref callback runs again", async () => {+ const { snapRowInsets } = await import("../src/lib/snap-padding.ts");+ const computed: Record<string, string> = {+ paddingLeft: "7.466px",+ paddingRight: "7.466px",+ marginLeft: "0px",+ marginRight: "0px",+ };+ const element = { style: {} as Record<string, string>, offsetWidth: 0 };+ const saved = { window: globalThis.window, getComputedStyle: globalThis.getComputedStyle };+ Object.assign(globalThis, { window: {}, getComputedStyle: () => computed });+ try {+ snapRowInsets(element as unknown as HTMLElement);+ computed.paddingLeft = "10.333px";+ computed.paddingRight = "9.5px";+ snapRowInsets(element as unknown as HTMLElement);+ } finally {+ Object.assign(globalThis, saved);+ }+ assert.deepEqual(element.style, { paddingLeft: "7px", paddingRight: "7px" });+});diff --git a/studio/frontend/tests/sidebar-action-rows-inert.test.ts b/studio/frontend/tests/sidebar-action-rows-inert.test.tsindex d52fc623c0f..07d1d486111 100644--- a/studio/frontend/tests/sidebar-action-rows-inert.test.ts+++ b/studio/frontend/tests/sidebar-action-rows-inert.test.ts@@ -51,6 +51,18 @@ test("desktop branding clears the titlebar actions", async () => {);});+test("custom titlebar branding centers on the chat header's model picker", async () => {+ const header = APP_SIDEBAR.split("<SidebarHeader")[1].split("</SidebarHeader>")[0];+ assert.match(+ header,+ /usesCustomTitlebar\s*\?\s*"shrink-0 p-0 pt-\[calc\(var\(--studio-content-top-inset,0px\)\+var\(--studio-chat-header-padding-top,11px\)\)\]"/,+ );+ assert.match(+ header,+ /usesCustomTitlebar && "h-\[var\(--studio-chat-control-height,34px\)\]"/,+ );+});+test("desktop branding keeps an 11px gap above New chat", async () => {const source = APP_SIDEBAR;assert.match(source, /usesDesktopTitlebar \? "pt-\[11px\]" : "pt-\[7px\]"/);diff --git a/studio/frontend/tests/sidebar-more-menu-interaction.test.ts b/studio/frontend/tests/sidebar-more-menu-interaction.test.tsindex c9e36d12934..6ebecb5ccd2 100644--- a/studio/frontend/tests/sidebar-more-menu-interaction.test.ts+++ b/studio/frontend/tests/sidebar-more-menu-interaction.test.ts@@ -19,19 +19,14 @@ async function moreFlyout() {test("the sidebar More flyout previews on mouse hover and pins on a press", async () => {const { source, flyout } = await moreFlyout();- assert.match(source, /const moreOpen = moreHoverOpen \|\| morePinnedOpen/);- // Mouse only, so a touch tap does not flash a preview.assert.match(source,- /openMorePreview = useCallback\(\s*\(event: PointerEvent<HTMLElement>\) => \{\s*if \(event\.pointerType !== "mouse"\) return;/,- );- assert.match(source, /setTimeout\(\(\) => setMoreHoverOpen\(false\), 180\)/);- // Row and flyout both keep it open.- assert.equal(flyout.match(/onPointerEnter=\{openMorePreview\}/g)?.length, 2);- assert.equal(- flyout.match(/onPointerLeave=\{closeMorePreviewSoon\}/g)?.length,- 2,+ /const moreHover = useHoverFlyout\(NAV_FLYOUT_INTENT, moreContentRef\);/,);+ assert.match(source, /const moreOpen = moreHover\.open \|\| morePinnedOpen/);+ assert.match(flyout, /ref=\{moreTriggerRef\}\s*\{\.\.\.moreHover\.trigger\}/);+ assert.match(flyout, /\{\.\.\.moreHover\.content\}/);+ assert.doesNotMatch(flyout, /<SidebarMenuItem\s+onPointer/);// A press pins or unpins, and is not treated as an outside press.assert.match(flyout,@@ -76,7 +71,7 @@ test("a hover preview leaves focus where it was", async () => {assert.match(flyout, /ref=\{moreContentRef\}/);assert.match(flyout,- /if \(!morePinnedOpen && moreHoverOpen\) \{\s*moreContentRef\.current\?\.focus\(\{ preventScroll: true \}\);/,+ /if \(!morePinnedOpen && moreHover\.open\) \{\s*moreContentRef\.current\?\.focus\(\{ preventScroll: true \}\);/,);assert.match(flyout,diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.pyindex ca5e5de31e0..4722acbdfb3 100644--- a/tests/studio/test_desktop_reliability_frontend_contract.py+++ b/tests/studio/test_desktop_reliability_frontend_contract.py@@ -657,7 +657,7 @@ def test_expanded_titlebar_button_and_corner_match_sidebar_edge():)# One border draws the edge and, when pinned, its rounded corner; the top edge always shows.assert (- '"absolute top-0 right-0 h-[12px] border-t border-sidebar-border dark:border-transparent",'+ '"absolute top-0 right-0 h-[12px] border-t border-sidebar-edge dark:border-transparent",'in decoration)# Dark draws no seam: a border lighter than both surfaces reads as a white line on Windows.@@ -666,15 +666,11 @@ def test_expanded_titlebar_button_and_corner_match_sidebar_edge():# Pinned, it is the sidebar's full-height edge: dark has no sidebar border-r to continue it.assert re.search(r'pinned &&\s*"h-\[calc\(100dvh-var\(--studio-custom-titlebar-height\)\)\] '- r"rounded-tl-\[12px\] border-l ",+ r'rounded-tl-\[12px\] border-l"',decoration,)- assert re.search(- r"usesDesktopTitlebar && !usesNativeMacTitlebar && pinned &&\s*"- r'"\[&_\[data-sidebar=sidebar\]\]:border-r-0"',- APP_SIDEBAR.read_text(encoding = "utf-8"),- )assert "style={{ left: pinned ? cornerLeft : 0 }}" in decoration+ assert "style={{ left: cornerLeft }}" in decoration# The sidebar-coloured mask outside the corner only appears when pinned.assert decoration.count("{pinned && (") == 1assert "transparent_11px,var(--color-sidebar)_12px" in decoration@@ -908,10 +904,17 @@ def test_mac_chat_header_controls_share_the_titlebar_row():assert "absolute top-[var(--studio-content-top-inset,0px)]" in source-def test_collapsed_mac_sidebar_hides_divider():+def test_sidebar_draws_its_edge_unless_the_titlebar_outline_does():source = _ui_source(APP_SIDEBAR)+ inner = _ui_source(SIDEBAR_PRIMITIVE).split('data-slot="sidebar-inner"', 1)[1].split(">", 1)[0]- assert "group-data-[collapsible=icon]:[&_[data-sidebar=sidebar]]:border-r-0" in source+ assert "border-r" not in inner+ assert re.search(+ r'!\(usesCustomTitlebar && pinned\) &&\s*"\[&_\[data-sidebar=sidebar\]\]:border-r '+ r"\[&_\[data-sidebar=sidebar\]\]:border-sidebar-edge "+ r'dark:\[&_\[data-sidebar=sidebar\]\]:border-r-0"',+ source,+ )assert "top-[var(--studio-mac-titlebar-height,34px)]" not in source