Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: stop the overlay rail clipping card shadows in dark mode (#11260)
Michael Han2485a8fd9201
diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsxindex 36a86a2c1c5..e3f1548619c 100644--- a/studio/frontend/src/app/provider.tsx+++ b/studio/frontend/src/app/provider.tsx@@ -89,8 +89,15 @@ type TauriMonitor = NonNullable<const MIN_DESKTOP_LAYOUT_WIDTH = 768;// Room the corner rail keeps around its cards so its overflow clip does not cut their shadows off (#9246).+// Sized off the deepest card shadow, the dark-mode one: 0 8px 28px -6px reaches 22px to a card's left+// and 14px above it, and a shorter gutter ends the halo on a hard line. Only those two edges show it:+// the rail is flush with the bottom-right corner, so the clip there lands on the screen edge. Both+// gutters come out of the cap, never out of the cards: 100dvh less 16 and 16 is the band they had.const STACK_SHADOW_GUTTER_BOTTOM = 16;-const STACK_SHADOW_GUTTER_TOP = 8;+const STACK_SHADOW_GUTTER_TOP = 16;+const STACK_SHADOW_GUTTER_LEFT = 28;+// The cards' own inset from the right edge, not a gutter: the rail is flush there.+const STACK_CARD_INSET_RIGHT = 16;// macos page zoom does not change dpr; windows already includes zoom in its dpr.function logicalPerCssPx(monitorScale: number): number {@@ -447,13 +454,15 @@ function TauriUpdateLayer({) : (<div// Scrolls at the cap rather than spilling cards off screen; the gutter keeps the card shadows out of that clip.- className="pointer-events-none fixed bottom-0 right-4 -mx-3 flex max-h-[calc(100dvh_-_8px)] flex-col items-end gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-3"+ className="pointer-events-none fixed bottom-0 right-0 flex max-h-[100dvh] flex-col items-end gap-2 overflow-y-auto overflow-x-hidden overscroll-contain"// Measured from the outside, per card, by tests/studio/playwright_update_banner_layout.py.data-testid="overlay-rail"- // Block gutter in px, never a spacing utility: those are rem, and the cards would drift off the corner.+ // Gutters in px, never a spacing utility: those are rem, and the cards would drift off the corner.style={{paddingTop: STACK_SHADOW_GUTTER_TOP,paddingBottom: STACK_SHADOW_GUTTER_BOTTOM,+ paddingLeft: STACK_SHADOW_GUTTER_LEFT,+ paddingRight: STACK_CARD_INSET_RIGHT,zIndex: Z_LAYER.OVERLAY_STACK,}}>@@ -798,13 +807,15 @@ function TauriWrapper({ children }: { children: ReactNode }) {push the top of the stack off screen. */}<div// Scrolls at the cap rather than spilling cards off screen; the gutter keeps the card shadows out of that clip.- className="pointer-events-none fixed bottom-0 right-4 -mx-3 flex max-h-[calc(100dvh_-_8px)] flex-col items-end gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-3"+ className="pointer-events-none fixed bottom-0 right-0 flex max-h-[100dvh] flex-col items-end gap-2 overflow-y-auto overflow-x-hidden overscroll-contain"// Measured from the outside, per card, by tests/studio/playwright_update_banner_layout.py.data-testid="overlay-rail"- // Block gutter in px, never a spacing utility: those are rem, and the cards would drift off the corner.+ // Gutters in px, never a spacing utility: those are rem, and the cards would drift off the corner.style={{paddingTop: STACK_SHADOW_GUTTER_TOP,paddingBottom: STACK_SHADOW_GUTTER_BOTTOM,+ paddingLeft: STACK_SHADOW_GUTTER_LEFT,+ paddingRight: STACK_CARD_INSET_RIGHT,zIndex: Z_LAYER.OVERLAY_STACK,}}>diff --git a/studio/frontend/tests/overlay-shadow-gutter.test.ts b/studio/frontend/tests/overlay-shadow-gutter.test.tsindex 67625b2248e..ec67fb87584 100644--- a/studio/frontend/tests/overlay-shadow-gutter.test.ts+++ b/studio/frontend/tests/overlay-shadow-gutter.test.ts@@ -26,39 +26,52 @@ function constant(name: string): number {const GUTTER_BOTTOM = constant("STACK_SHADOW_GUTTER_BOTTOM");const GUTTER_TOP = constant("STACK_SHADOW_GUTTER_TOP");+const GUTTER_LEFT = constant("STACK_SHADOW_GUTTER_LEFT");+const INSET_RIGHT = constant("STACK_CARD_INSET_RIGHT");/** Where the cards sit, and the band they may fill, before the gutter. */const CARDS_INSET = 16;const CARDS_BAND_TRIM = 32;test("the gutters clear the shadows the rail carries", () => {- // Off the rendered blur: light is one level of white 8px below and gone 6px- // above; dark is one level of #181818 16px below and 8px above.+ // The dark-mode shadow is the deepest: 0 8px 28px -6px reaches 22px to a+ // card's side and 14px above it. Both were short, so the halo ended flat.assert.ok(GUTTER_BOTTOM >= 16, "the shadow below is clipped");- assert.ok(GUTTER_TOP >= 8, "the shadow above is clipped");+ assert.ok(GUTTER_TOP >= 14, "the shadow above is clipped");+ assert.ok(GUTTER_LEFT >= 22, "the shadow to the left is clipped");});test("the rail's edge drops by the gutter, so the cards keep their inset", () => {- // The rail is on the floor, so its bottom padding alone is the cards' inset.- const rails = PROVIDER.match(/pointer-events-none fixed bottom-(\d+) right-4/g);+ // The rail is in the corner, so its bottom and right padding are the cards'+ // insets. No gutter there: the clip is the screen edge.+ const rails = PROVIDER.match(+ /pointer-events-none fixed bottom-(\d+) right-(\d+)/g,+ );assert.equal(rails?.length, 2, "a rail left its bottom-right corner");for (const rail of rails ?? []) {- const edge = Number(rail.match(/bottom-(\d+)/)?.[1]);+ const floor = Number(rail.match(/bottom-(\d+)/)?.[1]);+ const edge = Number(rail.match(/right-(\d+)/)?.[1]);assert.equal(- edge + GUTTER_BOTTOM,+ floor + GUTTER_BOTTOM,CARDS_INSET,"the bottom card moved off its inset",);+ assert.equal(+ edge + INSET_RIGHT,+ CARDS_INSET,+ "the cards moved off their right inset",+ );}});test("the cap grows by both gutters, so the cards' band is unchanged", () => {- // calc(100dvh - Npx), where N is the band's own trim less the gutter added- // back. Anything larger spends the cards' room on the padding.- const caps = PROVIDER.match(/max-h-\[calc\(100dvh_-_(\d+)px\)\]/g);+ // 100dvh less N, N being the band's trim less the gutters added back, so a+ // bare 100dvh once they cover it. Anything smaller spends the cards' own room,+ // and a cap past 100dvh puts the scrollport's top off screen.+ const caps = PROVIDER.match(/max-h-\[(?:calc\()?100dvh(?:_-_(\d+)px\))?\]/g);assert.equal(caps?.length, 2, "a rail lost its cap");for (const cap of caps ?? []) {- const trim = Number(cap.match(/_(\d+)px/)?.[1]);+ const trim = Number(cap.match(/_-_(\d+)px/)?.[1] ?? 0);assert.equal(trim,CARDS_BAND_TRIM - GUTTER_BOTTOM - GUTTER_TOP,@@ -72,4 +85,6 @@ test("the gutter is applied in px, not a rem utility", () => {// padding and the inset above would disagree and the cards would drift.assert.match(PROVIDER, /paddingTop: STACK_SHADOW_GUTTER_TOP/);assert.match(PROVIDER, /paddingBottom: STACK_SHADOW_GUTTER_BOTTOM/);+ assert.match(PROVIDER, /paddingLeft: STACK_SHADOW_GUTTER_LEFT/);+ assert.match(PROVIDER, /paddingRight: STACK_CARD_INSET_RIGHT/);});diff --git a/studio/frontend/tests/update-banner-flex-priority.test.ts b/studio/frontend/tests/update-banner-flex-priority.test.tsindex f10d59fce57..7f2b8db4d92 100644--- a/studio/frontend/tests/update-banner-flex-priority.test.ts+++ b/studio/frontend/tests/update-banner-flex-priority.test.ts@@ -265,7 +265,7 @@ test("the collapsed notes summary scrolls, like the expanded notes", () => {});/** The two rails' class strings, anchored on the corner they are pinned to. */-const RAIL_ANCHOR = '"pointer-events-none fixed bottom-0 right-4 ';+const RAIL_ANCHOR = '"pointer-events-none fixed bottom-0 right-0 ';function rails(): string[] {const parts = PROVIDER.split(RAIL_ANCHOR);@@ -284,11 +284,54 @@ test("the rail scrolls rather than spilling its cards", () => {/\boverflow-y-auto\b/,"a capped rail spills its cards",);- // The scroller clips at the padding box, so without room reserved there the- // cards lose their shadows; the negative margin puts the rail back where it- // was.- assert.match(rules, /\bpx-3\b/);- assert.match(rules, /-mx-3/);+ // The scroller clips at its padding box, so the shadows' room is reserved+ // there: in px from the constants below, never a rem utility.+ assert.doesNotMatch(+ rules,+ /(^|\s)-?[mp][xlr]-/,+ "a rem gutter is back on the rail's inline axis",+ );+ }+});++/** A card's dark-mode shadow, in px: `0 <y> <blur> <spread>`. */+function darkShadow(source: string): {+ y: number;+ blur: number;+ spread: number;+} {+ const seen = source.match(+ /dark:shadow-\[0_(\d+)px_(\d+)px_(-?\d+)px_/,+ );+ assert.ok(seen, "the card has no dark-mode shadow to size the gutter from");+ return { y: Number(seen[1]), blur: Number(seen[2]), spread: Number(seen[3]) };+}++/** A `const NAME = <n>;` in the provider. */+function gutter(name: string): number {+ const seen = PROVIDER.match(new RegExp(`const ${name} = (\\d+);`));+ assert.ok(seen, `${name} is gone from the provider`);+ return Number(seen[1]);+}++// The bug: in dark mode a card's halo ended on a hard line to its left. That+// shadow reaches 22px, past the 12px the rail reserved, so the clip cut the+// fade mid-gradient. Only the top and left show it; the rest is the screen edge.+test("the rail reserves enough room for the darkest card shadow", () => {+ for (const [name, source] of [...CARDS, ["llama", LLAMA]] as const) {+ const { y, blur, spread } = darkShadow(source);+ // Chromium paints the blur out to about its radius past the spread rect, so+ // this is the halo's reach. The spread is negative, pulling it back in.+ const reach = blur + spread;+ assert.ok(+ gutter("STACK_SHADOW_GUTTER_LEFT") >= reach,+ `the ${name} card's halo is cut off on the left`,+ );+ // The offset carries the halo down, so less of it is left above the card.+ assert.ok(+ gutter("STACK_SHADOW_GUTTER_TOP") >= reach - y,+ `the ${name} card's halo is cut off above it`,+ );}});@@ -303,8 +346,8 @@ test("the rail's block gutter costs the cards no room", () => {// around them, so the cards keep exactly the band they had.assert.match(rules,- /max-h-\[calc\(100dvh_-_8px\)\]/,- "the gutter is being taken out of the cards' band",+ /max-h-\[(?:calc\()?100dvh(?:_-_\d+px\))?\]/,+ "the rail lost the cap that pays for its gutters",);// From the constants, not pb-4/pt-2: those are rem, so at any root size but// 16px the cards would drift off the corner.@@ -318,12 +361,24 @@ test("the rail's block gutter costs the cards no room", () => {/paddingBottom: STACK_SHADOW_GUTTER_BOTTOM/,"the bottom gutter can drift from the cap that pays for it",);+ // Asymmetric: a gutter on the left, where a cut halo shows, and the cards'+ // own inset on the right, where the clip is the screen edge.+ assert.match(+ style,+ /paddingLeft: STACK_SHADOW_GUTTER_LEFT/,+ "the left gutter is back on a rem utility, or gone",+ );+ assert.match(+ style,+ /paddingRight: STACK_CARD_INSET_RIGHT/,+ "the cards' right inset is back on a rem utility, or gone",+ );// Every surface offsets its shadow downwards, so flush against the clip// edge the bottom card loses all of it. A zero gutter is that bug again.assert.doesNotMatch(rules, /\bp[byt]-/, "a rem gutter is back on the rail");}- // The gutter drops the rail's box to the floor and `-mx-3` put it 4px from the right- // edge, so it spans the window's resize grips, which are under it on Tailwind's scale.+ // The gutter drops the rail's box to the floor and it reaches the right edge,+ // so it spans the window's resize grips, which are under it on Tailwind's scale.// All eight: a narrow window spans the rail across the north and west targets too.const TITLEBAR = readSrc("components/tauri/window-titlebar.tsx");// A z-index on the toolbar would read as protection and give none: it sits inside a