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: Glass Settings pane scrolls on the compositor; API monitor fade pauses its blur (software compositing) (#17308)

Daniel Hanfefb9428c2f7
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 89a5c483577..d2933742cd1 100644
--- a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
+++ b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
@@ -7,6 +7,11 @@ import type {
ApiMonitorEntry,
ApiMonitorResponse,
} from "@/features/chat/types/api";
+import {
+ ANIMATION_HOLD_MS,
+ holdGlassMotion,
+ SETTLE_MS,
+} from "@/features/chat-background/glass-motion";
import { FIND_PORTAL_ATTRIBUTE } from "@/features/find-in-page/lib/find-attributes";
import { useMonitorFrameStore } from "@/features/settings/stores/monitor-frame-store";
import { useShortcut } from "@/features/settings/hooks/use-shortcut";
@@ -389,6 +394,9 @@ function ApiMonitorPanel({
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
+ // A script-driven fade: without this its glass blur is computed again on every frame of it.
+ onAnimationStart={() => holdGlassMotion(monitorRef.current, ANIMATION_HOLD_MS)}
+ onAnimationComplete={() => holdGlassMotion(monitorRef.current, SETTLE_MS)}
/* Panel language from the sidebar menu: soft surface, menu corner, heading font. */
className={cn(
// transition-none: see floating-monitor.tsx (a drop must not flash at the start spot).
diff --git a/studio/frontend/src/features/chat-background/glass-motion.ts b/studio/frontend/src/features/chat-background/glass-motion.ts
index 800dd4bae93..96b40eb5d19 100644
--- a/studio/frontend/src/features/chat-background/glass-motion.ts
+++ b/studio/frontend/src/features/chat-background/glass-motion.ts
@@ -63,6 +63,13 @@ export interface GlassMotion {
stop(): void;
}
+let active: GlassMotion | null = null;
+
+/** Pause `el` for `ms`: a surface animated from script fires no animation events. No-op while glass motion is off. */
+export function holdGlassMotion(el: Element | null, ms: number): void {
+ if (el && active) active.hold(el, ms);
+}
+
function isElement(node: unknown): node is Element {
return typeof Element !== "undefined" && node instanceof Element;
}
@@ -213,6 +220,7 @@ export function startGlassMotion(doc: Document = document): GlassMotion {
doc.addEventListener("animationcancel", onAnimationEnd, opts);
const stop = () => {
+ if (active === controller) active = null;
observer?.disconnect();
doc.removeEventListener("scroll", onScroll, opts);
for (const type of INTERACTION_EVENTS) doc.removeEventListener(type, onInteraction, opts);
@@ -233,5 +241,7 @@ export function startGlassMotion(doc: Document = document): GlassMotion {
lastTargets = null;
page = [];
};
- return { hold, scrollTargets, stop };
+ const controller: GlassMotion = { hold, scrollTargets, stop };
+ active = controller;
+ return controller;
}
diff --git a/studio/frontend/src/features/settings/settings-dialog.tsx b/studio/frontend/src/features/settings/settings-dialog.tsx
index c9f909e60f5..f09979a1732 100644
--- a/studio/frontend/src/features/settings/settings-dialog.tsx
+++ b/studio/frontend/src/features/settings/settings-dialog.tsx
@@ -869,6 +869,7 @@ export function SettingsDialog() {
</button>
<div
ref={mainScrollRef}
+ data-settings-main-scroll=""
className="hover-scrollbar flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto px-7 py-6 [scrollbar-gutter:stable]"
>
<SettingsPanelPane
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 9b4d4fa7d9c..842872abf2f 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -7527,6 +7527,13 @@ html[data-glass-clear] #root [data-slot="sidebar-inner"] :is(.bg-sidebar, .sideb
}
}
+/* Software compositing: the translucent Glass Settings pane is not composited-scrolled, so every scroll frame
+ re-rasters it (about 2x the whole Settings scroll cost). Its own layer scrolls it on the compositor instead;
+ text in it loses subpixel antialiasing. The thread viewport is not given one: there it measured no cheaper. */
+html[data-glass][data-glass-motion] [data-settings-main-scroll] {
+ will-change: scroll-position;
+}
+
/* Glass in motion, only with software compositing (data-glass-motion on <html>, set once by WindowMaterialMount
when the page has no GPU WebGL renderer; with a GPU nothing here applies and glass looks and moves as before).
data-glass-moving is set by glass-motion.ts on each surface while something opens, closes or
diff --git a/studio/frontend/tests/glass-motion.test.ts b/studio/frontend/tests/glass-motion.test.ts
index 915276d8e76..0f79874d466 100644
--- a/studio/frontend/tests/glass-motion.test.ts
+++ b/studio/frontend/tests/glass-motion.test.ts
@@ -294,6 +294,23 @@ test("stop() removes every listener, the observer and every flag, and is safe to
assert.equal(a.writes, 2, "the cancelled timer never fires a late write");
});
+test("a script-driven animation holds its surface through the running controller, and nothing without one", () => {
+ const panel = new FakeElement(["surface"]);
+ motion.holdGlassMotion(panel as unknown as Element, 1000);
+ assert.ok(!panel.hasAttribute(ATTR), "no controller: glass motion is off, nothing changes");
+ const { ctl } = page();
+ motion.holdGlassMotion(panel as unknown as Element, motion.ANIMATION_HOLD_MS);
+ assert.ok(panel.hasAttribute(ATTR));
+ motion.holdGlassMotion(panel as unknown as Element, motion.SETTLE_MS);
+ tick(motion.SETTLE_MS);
+ assert.ok(!panel.hasAttribute(ATTR), "the end of the animation releases it SETTLE_MS later");
+ ctl.stop();
+ const other = new FakeElement(["surface"]);
+ motion.holdGlassMotion(other as unknown as Element, 1000);
+ assert.ok(!other.hasAttribute(ATTR), "a stopped controller is no longer reachable");
+ motion.holdGlassMotion(null, 1000);
+});
+
// --- wiring and CSS contract -----------------------------------------------------------------------
test("glass motion runs only with software compositing, where glass blurs: never solid, Transparent, out of scope or WebKitGTK", () => {
@@ -387,3 +404,19 @@ test("in motion, Liquid 3D drops its wide blurred inner glows on dialogs and men
const dialog = rims.find((r) => r.selector.includes("dialog-content") && !r.selector.includes(".dark"));
assert.ok(dialog?.nodes.some((n) => n.type === "decl" && n.prop === "box-shadow" && n.important), "set on the dialog itself, not inherited by its subtree");
});
+
+test("the API monitor's script fade and the Settings pane's scrolling skip per-frame blur and raster work", () => {
+ const overlay = readSrc("features/api-monitor/api-monitor-overlay.tsx");
+ assert.match(overlay, /onAnimationStart=\{\(\) => holdGlassMotion\(monitorRef\.current, ANIMATION_HOLD_MS\)\}/);
+ assert.match(overlay, /onAnimationComplete=\{\(\) => holdGlassMotion\(monitorRef\.current, SETTLE_MS\)\}/);
+ assert.match(overlay, /"menu-soft-surface /, "the panel is a glass surface the pause rules cover");
+ assert.match(readSrc("features/settings/settings-dialog.tsx"), /ref=\{mainScrollRef\}\s+data-settings-main-scroll=""/);
+ const rule = postcss.parse(CSS).nodes.find(
+ (n): n is postcss.Rule => n.type === "rule" && n.selector === "html[data-glass][data-glass-motion] [data-settings-main-scroll]",
+ );
+ assert.ok(rule, "only with Glass under software compositing: GPU and the default look are unchanged");
+ assert.deepEqual(
+ rule.nodes.filter((n) => n.type === "decl").map((n) => `${(n as postcss.Declaration).prop}: ${(n as postcss.Declaration).value}`),
+ ["will-change: scroll-position"],
+ );
+});