From e83298457c60cc73f023b97daaa60e29ee1403ad Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Fri, 27 Nov 2026 02:19:26 -0800 Subject: [PATCH 1/3] Studio: give toasts and floating cards the composer's glass in Glass mode Toasts, the update cards, downloads, loaded models, the API and live monitors, the library selection bars, the guided tour card and a few error cards now share the composer's fill, blur, rims and bevel, with no drop shadow. The corner rail only becomes a scroll container when its cards overflow, so WebKit's blur reaches the wallpaper instead of a grey layer. --- studio/frontend/src/app/provider.tsx | 6 +- .../src/components/floating-monitor.tsx | 2 +- studio/frontend/src/components/ui/sonner.tsx | 2 +- .../api-monitor/api-monitor-overlay.tsx | 2 +- .../src/features/chat-background/model.ts | 1 + .../features/chat/artifacts/html-frame.tsx | 2 +- .../src/features/export/export-page.tsx | 2 +- .../find-in-page/components/find-in-page.tsx | 2 +- .../download-manager-panel.tsx | 4 +- .../features/library/chats/chats-library.tsx | 2 +- .../src/features/library/library-page.tsx | 2 +- .../loaded-models/loaded-models-indicator.tsx | 4 +- .../model-picker/sharing/link-handler.tsx | 2 +- .../features/tour/components/guided-tour.tsx | 2 +- studio/frontend/src/index.css | 69 ++++++++++++++----- studio/frontend/src/lib/toast-offset.ts | 32 +++++++++ .../tests/glass-floating-cards.test.ts | 52 ++++++++++++++ .../frontend/tests/glass-webkit-blur.test.ts | 8 +-- studio/frontend/tests/toast-offset.test.ts | 3 +- .../tests/webkit-modal-page-restyle.test.ts | 4 +- studio/frontend/tests/window-material.test.ts | 10 +-- 21 files changed, 165 insertions(+), 48 deletions(-) create mode 100644 studio/frontend/tests/glass-floating-cards.test.ts diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx index 8b7792004bb4..99727761c04f 100644 --- a/studio/frontend/src/app/provider.tsx +++ b/studio/frontend/src/app/provider.tsx @@ -68,9 +68,9 @@ import { refreshWindowChromeTop } from "@/lib/window-chrome"; import { CHAT_SETTINGS_INSET_VAR, COMPOSER_CLEARANCE_VAR, - cornerInsetScope, getToastOffsets, insetPastChatSettings, + overlayRailScope, } from "@/lib/toast-offset"; import { Z_LAYER } from "@/lib/z-layers"; import { useRouterState } from "@tanstack/react-router"; @@ -555,7 +555,7 @@ function TauriUpdateLayer({ /> ) : (
{ toastOptions={{ classNames: { // an open modal dialog sets pointer-events:none on body, which toasts would otherwise inherit. - toast: "cn-toast modal-pe-live pointer-events-auto", + toast: "cn-toast modal-pe-live pointer-events-auto glass-card", description: "!text-muted-foreground", }, }} 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 966c64864371..bd2b65a7e53d 100644 --- a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx +++ b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx @@ -407,7 +407,7 @@ function ApiMonitorPanel({ /* 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). - "menu-soft-surface pointer-events-auto absolute flex max-h-full transition-none w-[calc(400px*var(--ui-space-scale,1))] max-w-full cursor-default select-none flex-col overflow-hidden rounded-xl border-0 p-2.5 font-heading ring-0", + "menu-soft-surface glass-card pointer-events-auto absolute flex max-h-full transition-none w-[calc(400px*var(--ui-space-scale,1))] max-w-full cursor-default select-none flex-col overflow-hidden rounded-xl border-0 p-2.5 font-heading ring-0", // The CSS corner until it has been measured, so the first paint // is the corner it has always opened in rather than the top left. layout ? "top-0 left-0 resize" : "bottom-0 right-0", diff --git a/studio/frontend/src/features/chat-background/model.ts b/studio/frontend/src/features/chat-background/model.ts index 327991df96d7..39c78c608c28 100644 --- a/studio/frontend/src/features/chat-background/model.ts +++ b/studio/frontend/src/features/chat-background/model.ts @@ -79,6 +79,7 @@ export const LENS_HOSTS = [ ".glass-float-surface", '[data-sonner-toast][data-styled="true"]', ".toast-surface", + ".glass-card", '[data-auth-wallpaper] > [data-slot="card"]', ".tooltip-compact", ".tooltip-rich", diff --git a/studio/frontend/src/features/chat/artifacts/html-frame.tsx b/studio/frontend/src/features/chat/artifacts/html-frame.tsx index 567c83cfa304..c3129e1c5244 100644 --- a/studio/frontend/src/features/chat/artifacts/html-frame.tsx +++ b/studio/frontend/src/features/chat/artifacts/html-frame.tsx @@ -57,7 +57,7 @@ const BLOCKED_HOSTS_SHOWN = 3; // The wrapper spans the canvas, so only the notice itself takes clicks. const NOTICE_WRAP = "pointer-events-none absolute inset-x-0 top-0 flex justify-center p-2"; const NOTICE = - "pointer-events-auto max-w-[calc(460px*var(--ui-space-scale,1))] gap-y-0.5 rounded-lg border-transparent bg-popover py-3 ps-4.5 text-ui-13 leading-normal text-popover-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] has-data-[slot=alert-action]:pe-12 dark:bg-card dark:shadow-[0_2px_8px_-2px_var(--background)]"; + "glass-card pointer-events-auto max-w-[calc(460px*var(--ui-space-scale,1))] gap-y-0.5 rounded-lg border-transparent bg-popover py-3 ps-4.5 text-ui-13 leading-normal text-popover-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] has-data-[slot=alert-action]:pe-12 dark:bg-card dark:shadow-[0_2px_8px_-2px_var(--background)]"; const NOTICE_BODY = "text-ui-13 leading-[1.4] text-muted-foreground [&_p:not(:last-child)]:mb-2.5"; const NOTICE_BUTTON = "h-6 rounded-full px-2 text-ui-12 font-medium"; diff --git a/studio/frontend/src/features/export/export-page.tsx b/studio/frontend/src/features/export/export-page.tsx index fa3a3f06bc03..7859ffcd3809 100644 --- a/studio/frontend/src/features/export/export-page.tsx +++ b/studio/frontend/src/features/export/export-page.tsx @@ -2290,7 +2290,7 @@ export function ExportPage() { }) } aria-label="Scroll to export output" - className="fixed bottom-6 right-6 z-30 flex size-10 items-center justify-center rounded-full bg-background/90 text-foreground shadow-md backdrop-blur transition-colors hover:bg-muted" + className="glass-card fixed bottom-6 right-6 z-30 flex size-10 items-center justify-center rounded-full bg-background/90 text-foreground shadow-md backdrop-blur transition-colors hover:bg-muted" > } > diff --git a/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx b/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx index b5770c86d08d..7b890c5fb7fd 100644 --- a/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx +++ b/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx @@ -372,7 +372,7 @@ export function DownloadManagerPanel({ type="button" aria-label={headerLabel} onClick={() => setCollapsed(false)} - className="hub-download-fab pointer-events-auto modal-pe-live" + className="hub-download-fab pointer-events-auto modal-pe-live glass-card" > ) : ( -
+
{headerLabel} diff --git a/studio/frontend/src/features/library/chats/chats-library.tsx b/studio/frontend/src/features/library/chats/chats-library.tsx index 702736884770..bb51e06751f4 100644 --- a/studio/frontend/src/features/library/chats/chats-library.tsx +++ b/studio/frontend/src/features/library/chats/chats-library.tsx @@ -1498,7 +1498,7 @@ export function ChatsLibrary({
{t("shell.selection.countSelected", { count: selectedChats.length })} diff --git a/studio/frontend/src/features/library/library-page.tsx b/studio/frontend/src/features/library/library-page.tsx index 5130f67a9a94..593da73c98f4 100644 --- a/studio/frontend/src/features/library/library-page.tsx +++ b/studio/frontend/src/features/library/library-page.tsx @@ -1104,7 +1104,7 @@ function LibraryView({ role="toolbar" aria-label={t("library.selection.countOfTotal", { count: selectedCount, total: orderedKeys.length })} tabIndex={-1} - className="fixed bottom-8 left-1/2 z-30 flex w-max max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&>*]:shrink-0 items-center gap-2 rounded-full bg-sidebar py-2 pl-6 pr-2 text-sidebar-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] outline-none focus-visible:ring-2 focus-visible:ring-ring dark:shadow-[0_8px_28px_-6px_var(--background)]" + className="glass-card fixed bottom-8 left-1/2 z-30 flex w-max max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&>*]:shrink-0 items-center gap-2 rounded-full bg-sidebar py-2 pl-6 pr-2 text-sidebar-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] outline-none focus-visible:ring-2 focus-visible:ring-ring dark:shadow-[0_8px_28px_-6px_var(--background)]" > diff --git a/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx b/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx index 5e96091bcc6a..9fe4d5b6339e 100644 --- a/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx +++ b/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx @@ -370,7 +370,7 @@ export function LoadedModelsIndicator({ onClick={() => { if (!justDragged()) setCollapsed(false); }} - className="menu-soft-surface menu-soft-edgeless pointer-events-auto flex h-9 cursor-grab touch-none items-center gap-1.5 rounded-full pl-2.5 pr-3 font-heading text-muted-foreground transition-colors hover:text-foreground active:cursor-grabbing" + className="menu-soft-surface menu-soft-edgeless glass-card pointer-events-auto relative flex h-9 cursor-grab touch-none items-center gap-1.5 rounded-full pl-2.5 pr-3 font-heading text-muted-foreground transition-colors hover:text-foreground active:cursor-grabbing" > ) : ( -
+
runConfigInbox.clear(pending.id)} testId="shared-run-settings-unavailable" - className="fixed bottom-4 right-4 z-50 max-w-sm rounded-lg border bg-background p-4" + className="glass-card fixed bottom-4 right-4 z-50 max-w-sm rounded-lg border bg-background p-4" /> } > diff --git a/studio/frontend/src/features/tour/components/guided-tour.tsx b/studio/frontend/src/features/tour/components/guided-tour.tsx index 75572aea0357..e643e8dbbbe6 100644 --- a/studio/frontend/src/features/tour/components/guided-tour.tsx +++ b/studio/frontend/src/features/tour/components/guided-tour.tsx @@ -294,7 +294,7 @@ export function GuidedTour({ // Plain rounded, no corner-squircle: at this radius superellipse(2) // hugs the corner about twice as tightly as the arc, which reads as a // boxed-in card rather than a rounded one. - "relative overflow-hidden rounded-3xl", + "glass-card relative overflow-hidden rounded-3xl", "bg-white/95 text-foreground ring-1 ring-[rgb(0_0_0_/_calc(0.1*var(--contrast-edge-gain,1)))] dark:bg-zinc-900/96 dark:text-zinc-100 dark:ring-[rgb(255_255_255_/_calc(0.12*var(--contrast-edge-gain,1)))]", "shadow-[0_30px_120px_rgba(0,0,0,0.35)]", )} diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css index ddd14afbd003..e3441fcf5244 100644 --- a/studio/frontend/src/index.css +++ b/studio/frontend/src/index.css @@ -7315,7 +7315,8 @@ html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root])[data- html[data-glass="frosted"][data-chat-wallpaper-workspace-ready] [data-windows-glass-frame]::before, html[data-glass="frosted"][data-chat-wallpaper-workspace-ready] [data-slot="sidebar-inner"], html[data-glass="frosted"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] :is(.unsloth-composer-surface, .unsloth-files-panel), -html[data-glass="frosted"] .wallpaper-preview-composer { +html[data-glass="frosted"] .wallpaper-preview-composer, +html[data-glass="frosted"][data-glass-menus] :is(.toast-surface, .glass-card) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); } /* Unblurred rims and linear sheens: WebKit's CPU painter re-blurs inset shadows over the whole surface on every repaint, and paints radial gradients slowly. */ @@ -7344,22 +7345,22 @@ html.dark[data-glass="liquid-3d"] { --glass-bead-rim: inset 0 1px 0 rgb(255 255 255 / .139), inset 0 -1px 0 rgb(255 255 255 / .03), inset 0 0 0 1px rgb(255 255 255 / .035); } /* The composer and files panel keep the full sheen. */ -html[data-glass^="liquid"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html[data-glass^="liquid"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-sheen: linear-gradient(170deg, rgb(255 255 255 / .053), transparent 55%); --glass-rim: inset 0 1px 0 rgb(255 255 255 / .48), inset 0 0 0 1px color-mix(in srgb, var(--foreground) 10%, transparent); } -html.dark[data-glass^="liquid"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html.dark[data-glass^="liquid"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-sheen: linear-gradient(170deg, rgb(255 255 255 / .018), transparent 55%); --glass-rim: inset 0 1px 0 rgb(255 255 255 / .128), inset 0 0 0 1px rgb(255 255 255 / .04); } -html[data-glass="liquid-3d"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html[data-glass="liquid-3d"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-edge: linear-gradient(135deg, rgb(255 255 255 / .165), rgb(255 255 255 / .022) 30%, transparent 55%, rgb(255 255 255 / .022) 80%, rgb(255 255 255 / .099)); --glass-rim: inset 0 1px 0 rgb(255 255 255 / .385), inset 0 0 0 1px color-mix(in srgb, var(--foreground) 9%, transparent); --glass-sheen: linear-gradient(160deg, rgb(255 255 255 / .066), transparent 55%, transparent 75%, rgb(255 255 255 / .049)); --glass-bead: radial-gradient(120% 120% at 30% 12%, rgb(255 255 255 / .33), rgb(255 255 255 / .077) 62%, rgb(255 255 255 / .154)); --glass-bead-rim: inset 0 1px 0 rgb(255 255 255 / .44), inset 0 -1px 0 rgb(255 255 255 / .165), inset 0 0 0 1px rgb(255 255 255 / .11); } -html.dark[data-glass="liquid-3d"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html.dark[data-glass="liquid-3d"] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-edge: linear-gradient(135deg, rgb(255 255 255 / .066), rgb(255 255 255 / .011) 30%, transparent 55%, rgb(255 255 255 / .011) 80%, rgb(255 255 255 / .039)); --glass-rim: inset 0 1px 0 rgb(255 255 255 / .121); --glass-sheen: linear-gradient(160deg, rgb(255 255 255 / .019), transparent 55%, transparent 75%, rgb(255 255 255 / .01)); @@ -7371,13 +7372,13 @@ html.dark[data-glass="liquid-3d"] :is(.unsloth-composer-surface, .unsloth-files- Settings dialog). No sheen on either; the rims and glows carry the look. WebKit is data-glass-layers (the macOS and Linux apps, Safari). After every sheen above: equal specificity, so order decides. */ html[data-glass^="liquid"][data-glass-layers], -html[data-glass^="liquid"][data-glass-layers] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html[data-glass^="liquid"][data-glass-layers] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-sheen: none; } /* Firefox sets no flag: the repeated attribute matches the specificity of the dark sheens above. */ @supports (-moz-appearance: none) { html[data-glass^="liquid"][data-glass], - html[data-glass^="liquid"][data-glass] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { + html[data-glass^="liquid"][data-glass] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-sheen: none; } } @@ -7951,19 +7952,49 @@ html[data-glass][data-glass-menus][data-glass-plain]:not(.dark) :is([data-slot$= box-shadow: inset 0 1px 0 rgb(255 255 255 / .665), inset 0 -1px 0 color-mix(in srgb, var(--foreground) 8%, transparent), var(--glass-lift, 0 0 #0000) !important; } } -/* !important: Sonner injects its base rules at runtime. .toast-surface: the update cards that float like toasts. */ -html[data-glass][data-glass-menus] :is([data-sonner-toast][data-styled="true"], .toast-surface) { +/* Toasts and the floating cards (.toast-surface: update cards; .glass-card: downloads, loaded models, monitors) take the + composer's glass and no drop shadow. !important: Sonner injects its base rules at runtime. */ +html[data-glass][data-glass-menus] :is([data-sonner-toast][data-styled="true"], .toast-surface, .glass-card) { --accent: var(--glass-hover); --muted: var(--glass-hover); --secondary: var(--glass-field); - background-color: color-mix(in srgb, var(--popover) min(96%, calc(max(min(100%, calc(var(--glass-tint) + 30%)), var(--glass-read-floor, 0%), var(--glass-menu-floor)) * var(--glass-opacity, 1))), transparent) !important; - -webkit-backdrop-filter: blur(max(var(--glass-blur), calc(18px * var(--glass-strength, 1)))) saturate(var(--glass-saturate)) !important; - backdrop-filter: blur(max(var(--glass-blur), calc(18px * var(--glass-strength, 1)))) saturate(var(--glass-saturate)) !important; - box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 10%, transparent) !important; + /* The composer draws its edge with --composer-shadow, never a border. */ + border-color: transparent !important; + --composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 14%, transparent), inset 0 1px 0 rgb(255 255 255 / .08); + background-color: color-mix(in srgb, var(--glass-composer-fill) min(96%, calc((max(calc(var(--glass-tint) + 14%), var(--glass-read-floor, 0%), var(--glass-composer-floor)) + var(--glass-composer-boost, 0%)) * var(--glass-opacity, 1))), transparent) !important; + -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) !important; + backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) !important; +} +html[data-glass^="liquid"][data-glass-menus] :is([data-sonner-toast][data-styled="true"], .toast-surface, .glass-card) { + background-image: var(--glass-glow, none), var(--glass-sheen); + --composer-shadow: var(--glass-rim); +} +/* Sonner draws its swipe and exit hit areas on ::before: the bevel steps aside while it does. */ +html[data-glass="liquid-3d"][data-glass-menus] :is(.toast-surface, .glass-card:not([data-sonner-toast]), [data-sonner-toast].glass-card:not([data-swiping="true"], [data-removed="true"]))::before { + content: ""; + position: absolute; + inset: 0; + padding: 1px; + border-radius: inherit; + background: var(--glass-edge); + mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); + pointer-events: none; +} +html[data-glass][data-glass-menus][data-composer-outline="on"] :is([data-sonner-toast][data-styled="true"], .toast-surface, .glass-card) { + --composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--composer-outline), transparent); +} +html[data-glass][data-glass-menus][data-composer-outline="off"] :is([data-sonner-toast][data-styled="true"], .toast-surface, .glass-card) { + --composer-shadow: none; +} +/* The corner rail scrolls only while its cards outgrow it (overlayRailScope): a scroller cuts WebKit's blur off from the page. */ +[data-overlay-rail]:not([data-rail-scrolls]) { + overflow: visible; +} +/* Layered: the liquid menu lift on .menu-soft-surface is a layered !important, which an unlayered one cannot beat. */ +@layer utilities { +html[data-glass][data-glass-menus] :is([data-sonner-toast][data-styled="true"], .toast-surface, .glass-card) { + box-shadow: var(--composer-shadow) !important; } -html[data-glass^="liquid"][data-glass-menus] :is([data-sonner-toast][data-styled="true"], .toast-surface) { - background-image: var(--glass-sheen); - box-shadow: var(--glass-rim), var(--glass-lift) !important; } html[data-glass][data-glass-menus] [data-sonner-toast][data-styled="true"] [data-close-button] { background: transparent !important; @@ -8528,7 +8559,7 @@ html[data-glass="liquid-3d"][data-glass-menus][data-glass-motion].dark :is([data /* Frosted's grain is an SVG feTurbulence tile that WebKitGTK renders again on every paint of the surface (the composer repaints with each scrolled frame): about as much as the rest of a frame. Plain there, on every surface that takes the grain, the pinned sidebar's shared title bar frame included. */ -html[data-glass="frosted"][data-glass-cpu] :is([data-slot="sidebar-inner"], .unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer), +html[data-glass="frosted"][data-glass-cpu] :is([data-slot="sidebar-inner"], .unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card), html[data-glass="frosted"][data-glass-cpu] [data-windows-glass-frame]::before { background-image: none !important; } @@ -8546,11 +8577,11 @@ html.dark[data-glass="liquid-3d"][data-glass-cpu] { --glass-lift: 0 0 8px 0 color-mix(in srgb, var(--background) 75%, transparent); --popup-shadow: 0 8px 18px -8px rgb(0 0 0 / .52); } -html[data-glass="liquid-3d"][data-glass-cpu] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html[data-glass="liquid-3d"][data-glass-cpu] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-rim: inset 0 1px 1px rgb(255 255 255 / .385), inset 0 0 0 1px color-mix(in srgb, var(--foreground) 9%, transparent); --glass-glow: linear-gradient(rgb(255 255 255 / .22), rgb(255 255 255 / .06) 12px, transparent 26px), linear-gradient(to top, rgb(255 255 255 / .14), transparent 24px); } -html.dark[data-glass="liquid-3d"][data-glass-cpu] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) { +html.dark[data-glass="liquid-3d"][data-glass-cpu] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) { --glass-rim: inset 0 1px 1px rgb(255 255 255 / .121); --glass-glow: linear-gradient(rgb(255 255 255 / .06), rgb(255 255 255 / .016) 12px, transparent 26px), linear-gradient(to top, rgb(255 255 255 / .032), transparent 24px); } diff --git a/studio/frontend/src/lib/toast-offset.ts b/studio/frontend/src/lib/toast-offset.ts index a2194db5cff8..d2858667d8d6 100644 --- a/studio/frontend/src/lib/toast-offset.ts +++ b/studio/frontend/src/lib/toast-offset.ts @@ -133,6 +133,38 @@ export function cornerInsetScope( }; } +/** cornerInsetScope for the corner rail, which also scrolls only while its cards outgrow it (data-rail-scrolls): + * WebKit blurs a card inside a scroll container against that container's empty layer, so glass cards there turn grey. */ +export function overlayRailScope( + element: HTMLElement | null, +): (() => void) | undefined { + const release = cornerInsetScope(element); + if (!element || typeof ResizeObserver === "undefined") return release; + const sync = () => + element.toggleAttribute( + "data-rail-scrolls", + element.scrollHeight > element.clientHeight + 1, + ); + const resize = new ResizeObserver(sync); + const observeCards = () => { + resize.disconnect(); + resize.observe(element); + for (const card of element.children) resize.observe(card); + }; + const cards = new MutationObserver(() => { + observeCards(); + sync(); + }); + cards.observe(element, { childList: true }); + observeCards(); + sync(); + return () => { + cards.disconnect(); + resize.disconnect(); + release?.(); + }; +} + export const COMPOSER_CLEARANCE_VAR = "--studio-composer-clearance"; // The collapsed download button's column: 16px inset, 44px button, 16px of air. const CORNER_RAIL_COLUMN = 76; diff --git a/studio/frontend/tests/glass-floating-cards.test.ts b/studio/frontend/tests/glass-floating-cards.test.ts new file mode 100644 index 000000000000..c1373246c333 --- /dev/null +++ b/studio/frontend/tests/glass-floating-cards.test.ts @@ -0,0 +1,52 @@ +// 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 { readSrc } from "./helpers/kit.ts"; + +const CSS = readSrc("index.css").replace(/\/\*[\s\S]*?\*\//g, ""); + +function bodiesFor(selectorPart: string): string[] { + const out: string[] = []; + for (const match of CSS.matchAll(/([^{}]+)\{([^{}]*)\}/g)) { + if (match[1].includes(selectorPart)) out.push(match[2]); + } + return out; +} + +test("glass toasts and floating cards take the composer fill and no drop shadow", () => { + const bodies = bodiesFor(".glass-card)").join("\n"); + assert.match(bodies, /background-color: color-mix\(in srgb, var\(--glass-composer-fill\)/); + assert.match(bodies, /backdrop-filter: blur\(var\(--glass-blur\)\)/); + assert.match(bodies, /box-shadow: var\(--composer-shadow\) !important/); + assert.doesNotMatch(bodies, /--glass-lift/); +}); + +test("the composer's liquid rims cover the floating cards", () => { + for (const glass of ['html[data-glass^="liquid"]', 'html[data-glass="liquid-3d"]']) { + const selector = `${glass} :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card)`; + assert.ok(CSS.includes(selector), selector); + } +}); + +test("every floating card is tagged", () => { + const tagged: [string, string][] = [ + ["components/ui/sonner.tsx", "pointer-events-auto glass-card"], + ["features/hub/download-manager/download-manager-panel.tsx", "hub-download-panel pointer-events-auto modal-pe-live glass-card"], + ["features/hub/download-manager/download-manager-panel.tsx", "hub-download-fab pointer-events-auto modal-pe-live glass-card"], + ["features/loaded-models/loaded-models-indicator.tsx", "menu-soft-edgeless glass-card"], + ["features/api-monitor/api-monitor-overlay.tsx", "menu-soft-surface glass-card"], + ["components/floating-monitor.tsx", "settings-surface glass-card"], + ]; + for (const [file, needle] of tagged) { + assert.ok(readSrc(file).includes(needle), `${file}: ${needle}`); + } +}); + +test("the corner rail is a scroller only while its cards overflow", () => { + const provider = readSrc("app/provider.tsx"); + assert.equal(provider.match(/ref=\{overlayRailScope\}/g)?.length, 2); + assert.match(CSS, /\[data-overlay-rail\]:not\(\[data-rail-scrolls\]\) \{\s*overflow: visible;/); +}); diff --git a/studio/frontend/tests/glass-webkit-blur.test.ts b/studio/frontend/tests/glass-webkit-blur.test.ts index 618b821a0a42..ad90b7e30391 100644 --- a/studio/frontend/tests/glass-webkit-blur.test.ts +++ b/studio/frontend/tests/glass-webkit-blur.test.ts @@ -75,7 +75,7 @@ test("WebKitGTK Frosted drops only its grain tile", () => { for (const selector of grain.selectors) { const target = selector.includes("[data-windows-glass-frame]::before") ? "[data-windows-glass-frame]::before" - : /(\[data-slot="sidebar-inner"\]|\.wallpaper-preview-composer|\.unsloth-composer-surface)/.exec(selector)?.[1]; + : /(\[data-slot="sidebar-inner"\]|\.wallpaper-preview-composer|\.unsloth-composer-surface|\.toast-surface)/.exec(selector)?.[1]; assert.ok(target, `known grain surface: ${selector}`); assert.ok(rule.includes(target), `the WebKitGTK rule clears the grain on ${target}`); } @@ -99,7 +99,7 @@ test("WebKitGTK liquid 3D draws its wide inner glows as gradients, not blurred s assert.match(rule, /--glass-glow: linear-gradient\(/); } const glowUses = CSS.match(/background-image: var\(--glass-glow, none\), var\(--glass-sheen\);/g) ?? []; - assert.equal(glowUses.length, 3, "composer, menus and dialogs; elsewhere --glass-glow is unset, so the layer is none"); + assert.equal(glowUses.length, 4, "composer, menus, dialogs and toasts; elsewhere --glass-glow is unset, so the layer is none"); }); test("WebKit liquid glass drops the sheen, which bands into stripes without dithering", () => { @@ -107,7 +107,7 @@ test("WebKit liquid glass drops the sheen, which bands into stripes without dith assert.match(MATERIAL, /"data-glass-layers",\s*WEBKIT_LAYERS && material !== "solid" && material !== "transparent" && here,/); const rule = ruleAt('html[data-glass^="liquid"][data-glass-layers],'); assert.ok( - rule.includes('html[data-glass^="liquid"][data-glass-layers] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer) {'), + rule.includes('html[data-glass^="liquid"][data-glass-layers] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card) {'), "the composer sets its own sheen, so it is cleared there too", ); assert.match(rule, /--glass-sheen: none;/); @@ -129,7 +129,7 @@ test("Firefox drops the sheen too, with a selector as specific as the dark sheen rule.selectors, [ 'html[data-glass^="liquid"][data-glass]', - 'html[data-glass^="liquid"][data-glass] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer)', + 'html[data-glass^="liquid"][data-glass] :is(.unsloth-composer-surface, .unsloth-files-panel, .wallpaper-preview-composer, .toast-surface, .glass-card)', ], "two attributes on html, like html.dark[data-glass=\"liquid-3d\"]", ); diff --git a/studio/frontend/tests/toast-offset.test.ts b/studio/frontend/tests/toast-offset.test.ts index 65d7a0c03266..228ee7b8dda0 100644 --- a/studio/frontend/tests/toast-offset.test.ts +++ b/studio/frontend/tests/toast-offset.test.ts @@ -299,7 +299,8 @@ test("panel insets are written to their consumers, never to ", () => { const toaster = readSrc("components/ui/sonner.tsx"); assert.match(toaster, / = [ ["components/tauri/window-titlebar.tsx", /"modal-pe-live pointer-events-none absolute inset-x-0 top-0 z-\[70\]/], ["components/tauri/startup-screen.tsx", /"pointer-events-auto modal-pe-live fixed inset-0 z-\[9999\]"/], - ["components/ui/sonner.tsx", /toast: "cn-toast modal-pe-live pointer-events-auto"/], + ["components/ui/sonner.tsx", /toast: "cn-toast modal-pe-live pointer-events-auto glass-card"/], ["components/ui/combobox.tsx", /"isolate z-\[120\] modal-pe-live pointer-events-auto"/], ["features/interface-zoom/components/interface-zoom.tsx", /"modal-pe-live interface-zoom-position pointer-events-auto/], ["app/provider.tsx", /data-tauri-drag-region=\{true\}[\s\S]{0,80}"pointer-events-auto modal-pe-live /], - ["features/hub/download-manager/download-manager-panel.tsx", /"hub-download-fab pointer-events-auto modal-pe-live"/], + ["features/hub/download-manager/download-manager-panel.tsx", /"hub-download-fab pointer-events-auto modal-pe-live glass-card"/], ["features/hub/download-manager/download-manager-panel.tsx", /"hub-download-panel pointer-events-auto modal-pe-live /], ]; for (const [file, re] of live) assert.match(readSrc(file), re, file); diff --git a/studio/frontend/tests/window-material.test.ts b/studio/frontend/tests/window-material.test.ts index a55f054858c5..d5d233f76020 100644 --- a/studio/frontend/tests/window-material.test.ts +++ b/studio/frontend/tests/window-material.test.ts @@ -436,8 +436,8 @@ test("menus, popovers and dialogs point every hover token at the glass hover", ( test("glass sheen runs at 90% except on the composer and files panel", () => { const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8"); assert.match(css, /html\[data-glass\^="liquid"\] \{\n --glass-sheen: linear-gradient\(170deg, rgb\(255 255 255 \/ \.047\)/); - assert.match(css, /html\[data-glass\^="liquid"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer\) \{\n --glass-sheen: linear-gradient\(170deg, rgb\(255 255 255 \/ \.053\)/); - assert.match(css, /html\.dark\[data-glass="liquid-3d"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer\) \{\n --glass-edge:/); + assert.match(css, /html\[data-glass\^="liquid"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer, \.toast-surface, \.glass-card\) \{\n --glass-sheen: linear-gradient\(170deg, rgb\(255 255 255 \/ \.053\)/); + assert.match(css, /html\.dark\[data-glass="liquid-3d"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer, \.toast-surface, \.glass-card\) \{\n --glass-edge:/); }); test("grouped glass cards get more blur and a lighter fill than single controls", () => { @@ -508,7 +508,7 @@ test("light glass draws no grey outlines outside the composer", () => { } assert.match(css, /html\[data-glass\] \{\n --glass-hover: [^;]*;\n --glass-hover-rim: inset 0 0 0 0 transparent;/); assert.match(css, /html\.dark\[data-glass\] \{\n[^}]*--glass-hover-rim: inset 0 0 0 1px rgb\(255 255 255 \/ \.06\);/); - assert.match(css, /html\[data-glass="liquid-3d"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer\) \{\n[^}]*--glass-rim: [^;]*inset 0 0 0 1px/); + assert.match(css, /html\[data-glass="liquid-3d"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer, \.toast-surface, \.glass-card\) \{\n[^}]*--glass-rim: [^;]*inset 0 0 0 1px/); }); test("glass decoration has no blurred inset shadows or radial sheens", () => { @@ -589,8 +589,8 @@ test("macOS glass and a plain background image leave the resting page headers cl test("the update cards that float like toasts take the glass toast surface", () => { const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8"); - assert.match(css, /html\[data-glass\]\[data-glass-menus\] :is\(\[data-sonner-toast\]\[data-styled="true"\], \.toast-surface\) \{[^}]*backdrop-filter: blur\(max\(var\(--glass-blur\), calc\(18px \* var\(--glass-strength, 1\)\)\)\)/); - assert.match(css, /html\[data-glass\^="liquid"\]\[data-glass-menus\] :is\(\[data-sonner-toast\]\[data-styled="true"\], \.toast-surface\) \{/); + assert.match(css, /html\[data-glass\]\[data-glass-menus\] :is\(\[data-sonner-toast\]\[data-styled="true"\], \.toast-surface, \.glass-card\) \{[^}]*backdrop-filter: blur\(var\(--glass-blur\)\) saturate\(var\(--glass-saturate\)\) !important;/); + assert.match(css, /html\[data-glass\^="liquid"\]\[data-glass-menus\] :is\(\[data-sonner-toast\]\[data-styled="true"\], \.toast-surface, \.glass-card\) \{/); // Transparent keeps toasts opaque; the cards re-resolve the palette at full alpha like the toaster. assert.match(css, /html\[data-glass-clear\] #root :is\(\[data-sonner-toaster\], \.toast-surface\) \{\n\s*--clear-alpha: 100%;/); for (const file of ["components/llama-update-banner.tsx", "components/tauri/update-banner.tsx", "components/web/update-banner.tsx"]) { From ec5f14a649f1e315c458a8e213c8051995578e24 Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Fri, 27 Nov 2026 04:52:18 -0800 Subject: [PATCH 2/3] Studio: label the glass All pages scope as everything --- studio/frontend/src/i18n/locales/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts index c6723873563a..13bf6995da6c 100644 --- a/studio/frontend/src/i18n/locales/en.ts +++ b/studio/frontend/src/i18n/locales/en.ts @@ -50,7 +50,7 @@ export const en = { scope: "Show on", scopeNewChat: "New chat page", scopeChats: "Chats", - scopeAll: "All pages", + scopeAll: "All pages (everything)", positionValue: "Horizontal {x}%, vertical {y}%", newChat: "New chat preview", conversation: "Conversation preview", From 9e3d04b369252a262c0963cf42c5caa33dc1e513 Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Fri, 27 Nov 2026 05:02:03 -0800 Subject: [PATCH 3/3] Trim comments --- studio/frontend/src/index.css | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css index e3441fcf5244..c6630bccc1aa 100644 --- a/studio/frontend/src/index.css +++ b/studio/frontend/src/index.css @@ -7952,13 +7952,11 @@ html[data-glass][data-glass-menus][data-glass-plain]:not(.dark) :is([data-slot$= box-shadow: inset 0 1px 0 rgb(255 255 255 / .665), inset 0 -1px 0 color-mix(in srgb, var(--foreground) 8%, transparent), var(--glass-lift, 0 0 #0000) !important; } } -/* Toasts and the floating cards (.toast-surface: update cards; .glass-card: downloads, loaded models, monitors) take the - composer's glass and no drop shadow. !important: Sonner injects its base rules at runtime. */ +/* Toasts and floating cards take the composer's glass, no drop shadow. !important: Sonner injects its base rules at runtime. */ html[data-glass][data-glass-menus] :is([data-sonner-toast][data-styled="true"], .toast-surface, .glass-card) { --accent: var(--glass-hover); --muted: var(--glass-hover); --secondary: var(--glass-field); - /* The composer draws its edge with --composer-shadow, never a border. */ border-color: transparent !important; --composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 14%, transparent), inset 0 1px 0 rgb(255 255 255 / .08); background-color: color-mix(in srgb, var(--glass-composer-fill) min(96%, calc((max(calc(var(--glass-tint) + 14%), var(--glass-read-floor, 0%), var(--glass-composer-floor)) + var(--glass-composer-boost, 0%)) * var(--glass-opacity, 1))), transparent) !important;