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: paint the room a widening browser drag opens in the page's background (#13723)
Michael Hanba8922b2b8d8
diff --git a/studio/frontend/src/features/browser/resize-pin.ts b/studio/frontend/src/features/browser/resize-pin.tsindex 1be47572ea0..115032f6a8e 100644--- a/studio/frontend/src/features/browser/resize-pin.ts+++ b/studio/frontend/src/features/browser/resize-pin.ts@@ -5,16 +5,20 @@ let release: (() => void) | null = null;/** Hold the page at its size while the split is dragged, so it lays out once on release, not every frame. */export function pinBrowserPage(handle: Element): () => void {- const page = document.querySelector<HTMLElement>("[data-browser-page]");- if (release || !page?.parentElement) return () => undefined;+ // Only the inner box is pinned: the outer one keeps following the panel, so the room a widening+ // drag opens is painted in the page's background rather than the panel's.+ const area = document.querySelector<HTMLElement>("[data-browser-page]");+ const page = area?.querySelector<HTMLElement>(":scope > [data-browser-page]");+ if (release || !area || !page) return () => undefined;const saved = page.style.cssText;const rect = page.getBoundingClientRect();- const box = page.parentElement.getBoundingClientRect();+ const box = area.getBoundingClientRect();// Anchored to the panel's outer edge, which stays put.const right = handle.getBoundingClientRect().left < rect.left;Object.assign(page.style, {position: "absolute",- top: `${rect.top - box.top}px`,+ // Offsets are from the padding box, inside the area's top border.+ top: `${rect.top - box.top - area.clientTop}px`,bottom: "0",margin: "0",width: `${rect.width}px`,diff --git a/studio/frontend/tests/browser-resize-pin.test.ts b/studio/frontend/tests/browser-resize-pin.test.tsindex d806983a4b8..62a49524334 100644--- a/studio/frontend/tests/browser-resize-pin.test.ts+++ b/studio/frontend/tests/browser-resize-pin.test.ts@@ -13,25 +13,39 @@ const box = (left: number, top: number, width: number, height: number) => ({bottom: top + height,});+// The panel's page area (below the toolbar, with a 1px top border) and the page box inside it.const style: Record<string, string> = { cssText: "" };const page = {style,+ getBoundingClientRect: () => box(836, 135, 602, 1067),+};+const areaStyle: Record<string, string> = { cssText: "" };+const area = {+ style: areaStyle,+ clientTop: 1,getBoundingClientRect: () => box(836, 134, 602, 1068),- parentElement: { getBoundingClientRect: () => box(836, 83, 602, 1119) },+ querySelector: (selector: string) =>+ selector === ":scope > [data-browser-page]" ? page : null,};Object.assign(globalThis, {- document: { querySelector: () => page },+ document: { querySelector: () => area },});const { pinBrowserPage } = await import("../src/features/browser/resize-pin.ts");-test("a page pinned for a split drag stays below the browser's toolbar", () => {+test("a page pinned for a split drag stays inside the page area, below the toolbar", () => {const unpin = pinBrowserPage({ getBoundingClientRect: () => box(826, 0, 20, 1200) } as Element);assert.equal(style.position, "absolute");- assert.equal(style.top, "51px", "pinned at top: 0, the page covered the address bar and bookmarks for the whole drag");+ assert.equal(style.top, "0px", "measured from inside the area's top border");assert.equal(style.bottom, "0");assert.equal(style.width, "602px");assert.equal(style.right, "0px", "anchored to the panel's outer edge, which stays put");unpin();assert.equal(style.cssText, "");});++test("the page area itself keeps following the panel, so a widening drag shows the page background", () => {+ const unpin = pinBrowserPage({ getBoundingClientRect: () => box(826, 0, 20, 1200) } as Element);+ assert.deepEqual(areaStyle, { cssText: "" });+ unpin();+});