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 menus, sidebar and browser pane from restyling the whole chat (#16938)
Daniel Han42489f20e255
diff --git a/studio/frontend/src/app/routes/__root.tsx b/studio/frontend/src/app/routes/__root.tsxindex 56ad0d78b58..3c917ba8055 100644--- a/studio/frontend/src/app/routes/__root.tsx+++ b/studio/frontend/src/app/routes/__root.tsx@@ -489,7 +489,8 @@ function RootLayout() {}const shouldMountAudio = isAudioRoute || audioMounted;const isChatLike = isChatRoute || isImagesRoute || isVideoRoute || isAudioRoute;- const nonChatTopInset = useIsMobileShell()+ const mobileShell = useIsMobileShell();+ const nonChatTopInset = mobileShell? "pt-14": "pt-[calc(var(--studio-non-chat-content-top-inset,var(--studio-content-top-inset,0px))-var(--studio-non-chat-scroller-top,0px))] [--studio-titlebar-height:var(--studio-non-chat-content-top-inset,var(--studio-content-top-inset,0px))]";@@ -726,7 +727,14 @@ function RootLayout() {<ChatBackground route={isChatRoute ? "chat" : "page"} backdrop /><AppSidebar /><SidebarEdgeTrigger />- {windowsWallpaperPage && <div data-slot="page-wallpaper-blur" aria-hidden="true" />}+ {windowsWallpaperPage && (+ <div+ data-slot="page-wallpaper-blur"+ // AppSidebar's data-windows-glass-frame, which sits under this page only off the mobile sheet.+ data-sidebar-frame={(pinned && !mobileShell) || undefined}+ aria-hidden="true"+ />+ )}<SidebarInsetclassName={isChatLikediff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex 66a9bec2b54..c55ebbb23a4 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -565,11 +565,13 @@ const CONTEXT_ROW_MENU: RowMenuParts = {};// The kebab shows itself while its menu is open; the quick-action beside it was hover-only, so-// it slid in over the title. The row reserves room for both, so reveal both.+// it slid in over the title. The row reserves room for both, so reveal both. Row parts look at+// the actions after them (`:has(~ ...)`), not the row at its descendants: a group-has-* puts the+// style after the :has(), which WebKit re-checks across the whole document on every keystroke.const REVEAL_WITH_OPEN_MENU_PROJECT_CHAT =- "group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:opacity-100 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:pointer-events-auto";+ "[&:has(~.sidebar-row-action[data-state=open])]:opacity-100 [&:has(~.sidebar-row-action[data-state=open])]:pointer-events-auto";const REVEAL_WITH_OPEN_MENU_RECENT =- "group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-100 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pointer-events-auto";+ "[&:has(~.sidebar-row-action[data-state=open])]:opacity-100 [&:has(~.sidebar-row-action[data-state=open])]:pointer-events-auto";const CHAT_SORT_OPTIONS: Array<{value: SidebarChatSort;@@ -5435,15 +5437,15 @@ export function AppSidebar() {? undefined: // Room for the pin quick-action plus the kebab, and the same room with the menu open:// a narrower gutter there let the title run under them.- "group-hover/project-chat-item:pr-14 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:pr-14 [@media(pointer:coarse)]:pr-14"+ "group-hover/project-chat-item:pr-14 [&:has(~.sidebar-row-action[data-state=open])]:pr-14 [@media(pointer:coarse)]:pr-14": showWorkSpinner? undefined: // A chat row carries a pin and a kebab, so reserve the room for both on hover and// while the menu is open.- "group-hover/recent-item:pr-16 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16 [@media(pointer:coarse)]:pr-16",+ "group-hover/recent-item:pr-16 [&:has(~.sidebar-row-action[data-state=open])]:pr-16 [@media(pointer:coarse)]:pr-16",variant === "project"- ? "group-has-[.sidebar-row-action:focus-visible]/project-chat-item:pr-14"- : "group-has-[.sidebar-row-action:focus-visible]/recent-item:pr-16",+ ? "[&:has(~.sidebar-row-action:focus-visible)]:pr-14"+ : "[&:has(~.sidebar-row-action:focus-visible)]:pr-16",);return (@@ -5520,8 +5522,8 @@ export function AppSidebar() {// behind: sit left of them instead, where this used to be."[@media(pointer:coarse)]:right-16",variant === "project"- ? "group-hover/project-chat-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/project-chat-item:opacity-0"- : "group-hover/recent-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/recent-item:opacity-0",+ ? "group-hover/project-chat-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0"+ : "group-hover/recent-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0",)}>{awaitingApproval ? (@@ -5546,8 +5548,8 @@ export function AppSidebar() {className={cn("pointer-events-none absolute right-4 top-1/2 z-10 flex size-3.5 -translate-y-1/2 items-center justify-center text-muted-foreground transition-opacity",variant === "project"- ? "group-hover/project-chat-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/project-chat-item:opacity-0"- : "group-hover/recent-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/recent-item:opacity-0",+ ? "group-hover/project-chat-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0"+ : "group-hover/recent-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0",)}aria-hidden>@@ -5562,8 +5564,8 @@ export function AppSidebar() {className={cn("pointer-events-none absolute right-2 top-1/2 z-10 flex size-4 -translate-y-1/2 items-center justify-center text-muted-foreground transition-opacity",variant === "project"- ? "group-hover/project-chat-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/project-chat-item:opacity-0"- : "group-hover/recent-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/recent-item:opacity-0",+ ? "group-hover/project-chat-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0"+ : "group-hover/recent-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0",)}><HugeiconsIcon icon={Clock01Icon} strokeWidth={1.75} className="size-3.5" />@@ -5577,8 +5579,8 @@ export function AppSidebar() {className={cn("pointer-events-none absolute right-4 top-1/2 z-10 flex -translate-y-1/2 text-muted-foreground transition-opacity [@media(pointer:coarse)]:hidden",variant === "project"- ? "group-hover/project-chat-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/project-chat-item:opacity-0"- : "group-hover/recent-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/recent-item:opacity-0",+ ? "group-hover/project-chat-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0"+ : "group-hover/recent-item:opacity-0 [&:has(~.sidebar-row-action[data-state=open])]:opacity-0 [&:has(~.sidebar-row-action:focus-visible)]:opacity-0",)}><GitBranchIcon aria-hidden={true} strokeWidth={1.75} className="size-3.5" />@@ -5791,7 +5793,7 @@ export function AppSidebar() {if (listsChats) toggleProjectCollapsed(project.id);else openProject(project.id);}}- className="sidebar-nav-btn h-[calc(33px*var(--ui-space-scale,1))] rounded-full gap-[calc(8.5px*var(--ui-space-scale,1))] pl-3 pr-2.5 font-medium group-hover/recent-item:pr-16 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16 [@media(pointer:coarse)]:pr-16"+ className="sidebar-nav-btn h-[calc(33px*var(--ui-space-scale,1))] rounded-full gap-[calc(8.5px*var(--ui-space-scale,1))] pl-3 pr-2.5 font-medium group-hover/recent-item:pr-16 [&:has(~.sidebar-row-action[data-state=open])]:pr-16 [@media(pointer:coarse)]:pr-16"><HugeiconsIconicon={expanded ? Folder02Icon : ProjectIcon}diff --git a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsxindex bce30ea850c..d646a9253c8 100644--- a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx+++ b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx@@ -213,7 +213,7 @@ export function PromptQueueList({)}>{isEditing ? (- <div className="group/queue-editor flex flex-wrap items-center justify-end gap-2 px-1 py-2">+ <div className="group/queue-editor has-[textarea:focus-visible]:[--queue-hint-visibility:visible] flex flex-wrap items-center justify-end gap-2 px-1 py-2"><div className="w-full overflow-hidden rounded-lg border-0 bg-muted/40 p-3 has-[:focus-visible]:bg-muted dark:bg-card dark:has-[:focus-visible]:bg-accent"><textarearef={inputRef}@@ -278,7 +278,7 @@ export function PromptQueueList({</div><spanaria-hidden="true"- className="invisible mr-auto text-xs font-medium text-foreground group-has-[textarea:focus-visible]/queue-editor:visible"+ className="mr-auto text-xs font-medium text-foreground [visibility:var(--queue-hint-visibility,hidden)]">{t("promptQueue.editingHint")}</span>diff --git a/studio/frontend/src/components/ui/info-hint.tsx b/studio/frontend/src/components/ui/info-hint.tsxindex 5dc32d045d5..caf2a0491f6 100644--- a/studio/frontend/src/components/ui/info-hint.tsx+++ b/studio/frontend/src/components/ui/info-hint.tsx@@ -1,7 +1,7 @@// 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 ReactNode, useState } from "react";+import { type ReactNode, type RefObject, useEffect, useRef, useState } from "react";import {Tooltip,@@ -11,6 +11,36 @@ import {import { InformationCircleIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";+// index.css reveals the "i" when the row one or two levels up holds keyboard focus. That used to be+// `ROW:has(:focus-visible) > [data-slot=info-hint]`, a style after a :has(), which WebKit re-checks+// over the whole document on every keystroke, so the hint marks itself instead.+const FIELD_ROW = ":is(.diffusion-surface, .hint-on-hover) *";++function useNearFocus(hint: RefObject<HTMLElement | null>): void {+ useEffect(() => {+ const el = hint.current;+ const rows = [el?.parentElement, el?.parentElement?.parentElement].filter(+ (row): row is HTMLElement => row?.matches(FIELD_ROW) ?? false,+ );+ if (!el || rows.length === 0) return;+ const sync = () => {+ const near = rows.some((row) => row.querySelector(":focus-visible") !== null);+ if (near !== el.hasAttribute("data-near-focus")) el.toggleAttribute("data-near-focus", near);+ };+ // After the event: :focus-visible has settled on the element gaining or losing focus. Keyboard+ // input can turn it on without moving focus (a mouse-focused slider nudged with an arrow key),+ // and a pointer press can turn it off, so those re-check too.+ const later = () => queueMicrotask(sync);+ const top = rows[rows.length - 1];+ const events = ["focusin", "focusout", "keydown", "pointerdown"] as const;+ for (const type of events) top.addEventListener(type, later);+ sync();+ return () => {+ for (const type of events) top.removeEventListener(type, later);+ };+ }, [hint]);+}+/** Small "i" affordance that reveals a styled tooltip on hover/focus. The* standard inline help control across the settings UI. */export function InfoHint({@@ -24,12 +54,15 @@ export function InfoHint({hoverOnly?: boolean;}) {const [hovered, setHovered] = useState(false);+ const button = useRef<HTMLButtonElement>(null);+ useNearFocus(button);return (<Tooltip{...(hoverOnly ? { open: hovered, onOpenChange: () => {} } : {})}><TooltipTrigger asChild><button+ ref={button}onPointerEnter={hoverOnly ? () => setHovered(true) : undefined}onPointerLeave={hoverOnly ? () => setHovered(false) : undefined}type="button"diff --git a/studio/frontend/src/features/browser/pinned-page-row.tsx b/studio/frontend/src/features/browser/pinned-page-row.tsxindex 7e016b73fc3..babfb5aaaf0 100644--- a/studio/frontend/src/features/browser/pinned-page-row.tsx+++ b/studio/frontend/src/features/browser/pinned-page-row.tsx@@ -36,7 +36,7 @@ const SURFACE = "unsloth-plus-menu sidebar-row-menu sidebar-menu";const MENU = `${SURFACE} w-60`;// As a chat row's: the pin and the kebab show on hover, and while the menu is open.const ACTION =- "sidebar-row-action sidebar-touch-reveal group-hover/recent-item:opacity-100 group-hover/recent-item:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-100 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pointer-events-auto";+ "sidebar-row-action sidebar-touch-reveal group-hover/recent-item:opacity-100 group-hover/recent-item:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto [&:has(~.sidebar-row-action[data-state=open])]:opacity-100 [&:has(~.sidebar-row-action[data-state=open])]:pointer-events-auto";/** Every pinned page, in pin order. */export function usePinnedPages(): PinnedPage[] {@@ -116,7 +116,7 @@ export function PinnedPageRow({event.preventDefault();setRenaming(true);}}- className="sidebar-nav-btn h-[calc(30px*var(--ui-space-scale,1))] cursor-pointer gap-[calc(8.5px*var(--ui-space-scale,1))] rounded-full py-0 pl-3 pr-4 text-ui-14p5 font-medium leading-ui-19 tracking-nav group-hover/recent-item:pr-16 group-has-[.sidebar-row-action:focus-visible]/recent-item:pr-16 group-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16 [@media(pointer:coarse)]:pr-16"+ className="sidebar-nav-btn h-[calc(30px*var(--ui-space-scale,1))] cursor-pointer gap-[calc(8.5px*var(--ui-space-scale,1))] rounded-full py-0 pl-3 pr-4 text-ui-14p5 font-medium leading-ui-19 tracking-nav group-hover/recent-item:pr-16 [&:has(~.sidebar-row-action:focus-visible)]:pr-16 [&:has(~.sidebar-row-action[data-state=open])]:pr-16 [@media(pointer:coarse)]:pr-16"><SiteFaviconurl={page.url}diff --git a/studio/frontend/src/features/chat-background/backdrop.tsx b/studio/frontend/src/features/chat-background/backdrop.tsxindex 5d33b83a5a3..4999b974a36 100644--- a/studio/frontend/src/features/chat-background/backdrop.tsx+++ b/studio/frontend/src/features/chat-background/backdrop.tsx@@ -3,6 +3,7 @@import { type CSSProperties, useEffect, useRef, useState } from "react";import { ROOT_READY, ROOT_WORKSPACE_READY, markRoot } from "./background";+import { useWallpaperHostFlags } from "./host-flags";import { ComposerGlassLenses } from "./lens";const BACKDROP_SAFE = "0.55";@@ -24,6 +25,7 @@ export function GlassBackdrop() {setAppWallpaper(null);};}, []);+ useWallpaperHostFlags(host);return (<divref={host}diff --git a/studio/frontend/src/features/chat-background/background.tsx b/studio/frontend/src/features/chat-background/background.tsxindex ba9e2f5ef0e..9670ee9516b 100644--- a/studio/frontend/src/features/chat-background/background.tsx+++ b/studio/frontend/src/features/chat-background/background.tsx@@ -18,6 +18,7 @@ import {} from "./model";import { useAppliedMaterial } from "./material";import { ComposerGlassLenses } from "./lens";+import { useWallpaperHostFlags } from "./host-flags";import { type ImageTone, glassReadability, measureTone } from "./tone";type Frame = { url: string; value: ChatBackgroundValue };@@ -282,6 +283,7 @@ export function ChatBackground({ active = true }: { active?: boolean }) {setAppWallpaper(null);};}, [shownReady]);+ useWallpaperHostFlags(host);if (!value || !active) return null;return (<divdiff --git a/studio/frontend/src/features/chat-background/host-flags.ts b/studio/frontend/src/features/chat-background/host-flags.tsnew file mode 100644index 00000000000..a6e3c6fded7--- /dev/null+++ b/studio/frontend/src/features/chat-background/host-flags.ts@@ -0,0 +1,61 @@+// 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 RefObject, useLayoutEffect } from "react";++/*+ * What the wallpaper layer shows, mirrored onto the element that holds it, so the wallpaper and+ * glass CSS keys on the host itself. `HOST:has(> .chat-wallpaper[data-ready]) X` puts the style+ * after the :has(): Chromium then re-checks every X-like element under HOST (the whole thread,+ * since the workspace holds it) whenever anything below HOST changes, and WebKit pays the same on+ * focus and input. Each flag is exactly its :has() argument, so the selectors match the same set.+ */+export const WALLPAPER_HOST_FLAGS = [+ ["data-wallpaper-ready", ":scope > .chat-wallpaper[data-ready]"],+ [+ "data-wallpaper-outline-off",+ ':scope > .chat-wallpaper[data-ready][data-outline="false"]',+ ],+ [+ "data-wallpaper-flat",+ ':scope > .chat-wallpaper[data-ready] > .chat-wallpaper-image[data-fade="false"]',+ ],+ [+ "data-wallpaper-frame-flat",+ ':scope > .chat-wallpaper[data-ready] > .chat-wallpaper-frame > .chat-wallpaper-image[data-fade="false"]',+ ],+ [+ "data-wallpaper-image",+ ":scope > .chat-wallpaper[data-ready]:not([data-glass-backdrop])",+ ],+ [+ "data-wallpaper-preview-outline-off",+ ':scope > .chat-wallpaper[data-outline="false"]',+ ],+] as const;++/** Recompute the host flags from the layers it holds now. Idempotent. */+export function syncWallpaperHost(host: Element | null | undefined): void {+ if (!host) return;+ for (const [name, selector] of WALLPAPER_HOST_FLAGS) {+ const on = host.querySelector(selector) !== null;+ // Only write on a change: an attribute write restyles the host even when the value is the same.+ if (on !== host.hasAttribute(name)) host.toggleAttribute(name, on);+ }+}++/**+ * Keep the parent's flags in step with this layer: before paint after every render, and once it is+ * gone. The cleanup re-reads in a microtask, after React has removed or updated the layer and still+ * before the frame paints. Unchanged flags are not rewritten, so a re-render costs a few lookups.+ */+export function useWallpaperHostFlags(+ layer: RefObject<HTMLElement | null>,+): void {+ useLayoutEffect(() => {+ const host = layer.current?.parentElement;+ if (!host) return;+ syncWallpaperHost(host);+ return () => queueMicrotask(() => syncWallpaperHost(host));+ });+}diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsxindex 2c0b76839ee..5cb84a34a10 100644--- a/studio/frontend/src/features/chat/chat-page.tsx+++ b/studio/frontend/src/features/chat/chat-page.tsx@@ -2442,7 +2442,7 @@ function ProjectLanding({return (<divkey={`${item.type}:${item.id}`}- className="group relative flex min-h-[calc(58px*var(--ui-space-scale,1))] w-full items-center rounded-md transition-colors hover:bg-nav-surface-hover has-[[data-state=open]]:bg-nav-surface-hover"+ className="group relative flex min-h-[calc(58px*var(--ui-space-scale,1))] w-full items-center rounded-md transition-colors hover:bg-nav-surface-hover has-[[data-state=open]]:bg-nav-surface-hover has-[[data-state=open]]:[--row-date-opacity:0]"><buttontype="button"@@ -2462,7 +2462,7 @@ function ProjectLanding({{displayTitle}</div></div>- <span className="shrink-0 text-ui-14 text-muted-foreground transition-opacity max-md:opacity-0 pointer-coarse:opacity-0 group-hover:opacity-0 group-has-[[data-state=open]]:opacity-0">+ <span className="shrink-0 text-ui-14 text-muted-foreground opacity-[var(--row-date-opacity,1)] transition-opacity max-md:opacity-0 pointer-coarse:opacity-0 group-hover:opacity-0">{preview?.date ??formatProjectChatDate(item.createdAt)}</span>diff --git a/studio/frontend/src/features/hub/catalog/model-readme.tsx b/studio/frontend/src/features/hub/catalog/model-readme.tsxindex 293c6682e48..bdc66cd92d4 100644--- a/studio/frontend/src/features/hub/catalog/model-readme.tsx+++ b/studio/frontend/src/features/hub/catalog/model-readme.tsx@@ -43,6 +43,7 @@ import {stripFrontmatter,} from "../lib/hf-readme";import { rehypeReadmeUrls } from "../lib/rehype-readme-urls";+import { badgeRowsRef } from "../lib/badge-rows";type ReadmePlugins = NonNullable<ComponentProps<typeof Streamdown>["plugins"]>;@@ -544,7 +545,7 @@ export function ModelReadme({}return (- <div className={cn("hub-readme-prose", PROSE)}>+ <div ref={badgeRowsRef} className={cn("hub-readme-prose", PROSE)}><ReadmeOnlineContext.Provider value={online}><Streamdownmode="static"diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.cssindex 09229d9f9d0..7775aa812eb 100644--- a/studio/frontend/src/features/hub/hub.css+++ b/studio/frontend/src/features/hub/hub.css@@ -1131,23 +1131,24 @@display: none;}- .hub-readme-prose :is(p, div):has(> a:nth-of-type(2) > img) {+ /* data-badge-row: a p/div holding two or more linked images, set by lib/badge-rows.ts. */+ .hub-readme-prose :is(p, div)[data-badge-row] {display: flex;flex-wrap: wrap;align-items: center;gap: calc(0.5rem * var(--ui-space-scale, 1));}- .hub-readme-prose :is(p, div):has(> a:nth-of-type(2) > img) > br {+ .hub-readme-prose :is(p, div)[data-badge-row] > br {display: none;}- .hub-readme-prose :is(p, div):has(> a:nth-of-type(2) > img) > a {+ .hub-readme-prose :is(p, div)[data-badge-row] > a {display: inline-flex;align-items: center;}- .hub-readme-prose :is(p, div):has(> a:nth-of-type(2) > img) img {+ .hub-readme-prose :is(p, div)[data-badge-row] img {margin-block: 0;}diff --git a/studio/frontend/src/features/hub/lib/badge-rows.ts b/studio/frontend/src/features/hub/lib/badge-rows.tsnew file mode 100644index 00000000000..764e06b8736--- /dev/null+++ b/studio/frontend/src/features/hub/lib/badge-rows.ts@@ -0,0 +1,31 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/*+ * README badge rows (a paragraph of two or more linked images) lay out as one wrapped flex row.+ * They are marked here rather than styled through `:is(p, div):has(> a:nth-of-type(2) > img) img`:+ * a style after a :has() made Chromium test that :has() on every p/div above every image and link+ * in the app, so the chat thread's favicons and source chips paid for a rule meant for the Hub.+ */+export const BADGE_ROW_ATTRIBUTE = "data-badge-row";+const BADGE_ROW = ":scope > a:nth-of-type(2) > img";++/** Flag exactly the p/div elements under `root` the old :has() matched. Idempotent. */+export function markBadgeRows(root: ParentNode): void {+ for (const el of root.querySelectorAll("p, div")) {+ const on = el.querySelector(BADGE_ROW) !== null;+ if (on !== el.hasAttribute(BADGE_ROW_ATTRIBUTE))+ el.toggleAttribute(BADGE_ROW_ATTRIBUTE, on);+ }+}++/** Ref callback: mark now and again whenever the rendered README changes shape. */+export function badgeRowsRef(+ root: HTMLElement | null,+): (() => void) | undefined {+ if (!root) return undefined;+ markBadgeRows(root);+ const observer = new MutationObserver(() => markBadgeRows(root));+ observer.observe(root, { childList: true, subtree: true });+ return () => observer.disconnect();+}diff --git a/studio/frontend/src/features/library/components/library-cards.tsx b/studio/frontend/src/features/library/components/library-cards.tsxindex fbe5bbaf0bb..233f690a361 100644--- a/studio/frontend/src/features/library/components/library-cards.tsx+++ b/studio/frontend/src/features/library/components/library-cards.tsx@@ -140,7 +140,7 @@ function CardFrame({const selected = select?.selection.has(selectKey) ?? false;const selecting = (select?.selection.size ?? 0) > 0;return (- <div className="group/library-card relative">+ <div className="group/library-card has-[:focus-visible]:[--card-time-opacity:1] relative"><buttontype="button"aria-label={label}@@ -242,7 +242,7 @@ export function ItemCard({ item }: { item: LibraryItem }) {<spanclassName={cn(GLASS_SURFACE,- "pointer-events-none absolute bottom-2 left-2 inline-flex h-6 items-center rounded-full px-2 text-ui-12 leading-none opacity-0 transition-opacity group-hover/library-card:opacity-100 group-has-[:focus-visible]/library-card:opacity-100 pointer-coarse:opacity-100",+ "pointer-events-none absolute bottom-2 left-2 inline-flex h-6 items-center rounded-full px-2 text-ui-12 leading-none opacity-[var(--card-time-opacity,0)] transition-opacity group-hover/library-card:opacity-100 pointer-coarse:opacity-100",)}>{formatCardTime(item.updatedAt, locale)}diff --git a/studio/frontend/src/features/rag/components/embedding-model-menu-picker.tsx b/studio/frontend/src/features/rag/components/embedding-model-menu-picker.tsxindex 2e836c26ad7..b68a613ebea 100644--- a/studio/frontend/src/features/rag/components/embedding-model-menu-picker.tsx+++ b/studio/frontend/src/features/rag/components/embedding-model-menu-picker.tsx@@ -238,7 +238,7 @@ export function EmbeddingModelMenuList({ onBack }: { onBack: () => void }) {const pinLabel = t(isPinned ? "settings.general.rag.unpin" : "settings.general.rag.pin");return (// The pin is its own menu item, so arrow keys reach it; it is laid over the row's spacer.- <div key={model} className="menu-row-with-action group/row relative">+ <div key={model} className="menu-row-with-action group/row has-[[data-highlighted]]:[--row-pin-opacity:1] relative"><DropdownMenuItemdisabled={switching !== null && switching !== model}onSelect={(event) => {@@ -288,7 +288,7 @@ export function EmbeddingModelMenuList({ onBack }: { onBack: () => void }) {if (neighbour) requestAnimationFrame(() => neighbour.focus());}}// As on Recents: grey, unpin glyph once pinned. Shown on row hover or focus, always on touch.- className="pointer-events-auto flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground opacity-0 outline-hidden transition-colors group-hover/row:opacity-100 group-has-[[data-highlighted]]/row:opacity-100 [@media(hover:none)]:opacity-100 hover:bg-[rgb(0_0_0_/_calc(0.06*var(--contrast-wash-gain,1)))] data-[highlighted]:bg-[rgb(0_0_0_/_calc(0.06*var(--contrast-wash-gain,1)))] dark:hover:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))] dark:data-[highlighted]:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))]"+ className="pointer-events-auto flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground opacity-[var(--row-pin-opacity,0)] outline-hidden transition-colors group-hover/row:opacity-100 [@media(hover:none)]:opacity-100 hover:bg-[rgb(0_0_0_/_calc(0.06*var(--contrast-wash-gain,1)))] data-[highlighted]:bg-[rgb(0_0_0_/_calc(0.06*var(--contrast-wash-gain,1)))] dark:hover:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))] dark:data-[highlighted]:bg-[rgb(255_255_255_/_calc(0.1*var(--contrast-wash-gain,1)))]"><HugeiconsIconicon={isPinned ? PinOffIcon : PinIcon}diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 3ddb7c446d9..ee6465f633c 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -2500,16 +2500,12 @@ html[data-chat-font] .aui-root {pointer-events: none;transition: opacity 150ms;}- /* Not :focus-within: a select returns focus to its trigger on close and left the "i" up. */+ /* Not :focus-within: a select returns focus to its trigger on close and left the "i" up.+ data-near-focus: the row one or two levels up holds :focus-visible (info-hint.tsx). */+ :is(.diffusion-surface, .hint-on-hover) *:hover > [data-slot="info-hint"],+ :is(.diffusion-surface, .hint-on-hover) *:hover > * > [data-slot="info-hint"],:is(.diffusion-surface, .hint-on-hover)- :is(*:hover, *:has(:focus-visible))- > [data-slot="info-hint"],- :is(.diffusion-surface, .hint-on-hover)- :is(*:hover, *:has(:focus-visible))- > *- > [data-slot="info-hint"],- :is(.diffusion-surface, .hint-on-hover)- [data-slot="info-hint"]:focus-visible {+ [data-slot="info-hint"]:is(:focus-visible, [data-near-focus]) {opacity: 1;pointer-events: auto;}@@ -3798,11 +3794,13 @@ html[data-chat-font] .aui-root {background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));}- /* A row whose action is its own menu item (RAG pins): keep the row lit while the action is. */- .unsloth-plus-menu .menu-row-with-action:has([data-row-action]:is(:hover, [data-highlighted])) > :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]) {+ /* A row whose action is its own menu item (RAG pins): keep the row lit while the action is.+ The :has() looks at the item's later siblings, so the item is its own subject: a style after a+ :has() puts its right side (any [data-slot]) on Chromium's shared :has() invalidation set. */+ .unsloth-plus-menu .menu-row-with-action > :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]):has(~ [data-row-action]:is(:hover, [data-highlighted]), ~ * [data-row-action]:is(:hover, [data-highlighted])) {background-color: rgb(0 0 0 / calc(0.06 * var(--contrast-wash-gain, 1)));}- .dark .unsloth-plus-menu .menu-row-with-action:has([data-row-action]:is(:hover, [data-highlighted])) > :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]) {+ .dark .unsloth-plus-menu .menu-row-with-action > :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]):has(~ [data-row-action]:is(:hover, [data-highlighted]), ~ * [data-row-action]:is(:hover, [data-highlighted])) {background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));}@@ -6146,23 +6144,28 @@ html:not(.dark)[data-glass][data-chat-welcome] :is([data-wallpaper-workspace], [opacity: sqrt(var(--wallpaper-visibility));}}+/* Wallpaper hosts carry flags mirrored from their .chat-wallpaper layer (host-flags.ts) instead of+ HOST:has(> .chat-wallpaper[data-ready]) X: a style after a :has() made Chromium re-check the whole+ thread on any change below the workspace. A flag repeats once per simple selector of the :has()+ argument it replaced (`[data-wallpaper-ready][data-wallpaper-ready]` for `.chat-wallpaper[data-ready]`),+ so every rule keeps its specificity. *//* Conversations dim the crop; compare dims even an empty pane so both match.Welcome/compare come from root flags (welcome.ts): a descendant :has() here re-walks the thread per keystroke. */-html:not([data-chat-welcome]) :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]):not([data-wallpaper-route="page"]) > .chat-wallpaper,-html[data-chat-compare] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]):not([data-wallpaper-route="page"]) > .chat-wallpaper,+html:not([data-chat-welcome]) :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready]:not([data-wallpaper-route="page"]) > .chat-wallpaper,+html[data-chat-compare] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready]:not([data-wallpaper-route="page"]) > .chat-wallpaper,.wallpaper-preview[data-wallpaper-conversation] > .chat-wallpaper { opacity: calc(.4 + .6 * var(--wallpaper-conversation, 0)); }-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) :is(.aui-thread-viewport, [data-wallpaper-reading-surface]) {+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] :is(.aui-thread-viewport, [data-wallpaper-reading-surface]) {background: color-mix(in srgb, var(--background) calc((1 - var(--wallpaper-safe, 0)) * (1 - .65 * var(--wallpaper-conversation, 0)) * 100%), transparent);}/* No second wash on the welcome view: it crushes mid-tones into a dark horizon. */-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .aui-thread-viewport:has(> .aui-thread-welcome-root > .aui-thread-welcome-center) {+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .aui-thread-viewport:has(> .aui-thread-welcome-root > .aui-thread-welcome-center) {background: transparent;}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-welcome-greeting {+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-welcome-greeting {position: relative;isolation: isolate;}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-welcome-greeting::before {+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-welcome-greeting::before {content: "";position: absolute;inset: -48px -40px;@@ -6170,7 +6173,7 @@ html[data-chat-compare] :is([data-wallpaper-workspace], [data-chat-content-root]pointer-events: none;background: radial-gradient(ellipse, color-mix(in srgb, var(--background) calc((1 - var(--wallpaper-safe, 0)) * 70%), transparent) 0%, transparent 72%);}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface,+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface,.wallpaper-preview-composer {background: color-mix(in srgb, var(--background) max(92%, calc((1 - var(--wallpaper-safe, 0)) * 100%)), transparent);backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);@@ -6184,7 +6187,7 @@ html[data-composer-outline="on"] :is(.unsloth-composer-surface, .wallpaper-previ}/* 0 drops every glass edge; solid surfaces keep their drop shadow, which is no outline. */html[data-glass="macos"][data-composer-outline="off"] .unsloth-composer-surface,-html[data-composer-outline="off"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface,+html[data-composer-outline="off"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface,html[data-composer-outline="off"] .wallpaper-preview-composer {--composer-shadow: none !important;}@@ -6197,16 +6200,16 @@ html[data-composer-outline="off"] .wallpaper-preview-composer {height: 150px;background: linear-gradient(color-mix(in srgb, var(--background) 48%, transparent), transparent);}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) [data-side-panel-inset]:not(.chat-header-fade),+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] [data-side-panel-inset]:not(.chat-header-fade),html[data-chat-wallpaper-ready] [data-slot="window-titlebar"] {background: transparent;backdrop-filter: none;}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .chat-header-fade,+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .chat-header-fade,html[data-chat-wallpaper-ready] [data-slot="window-titlebar-decoration"] {visibility: hidden;}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) [data-wallpaper-chrome-controls],+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] [data-wallpaper-chrome-controls],html[data-chat-wallpaper-ready] [data-slot="window-titlebar"] [data-wallpaper-chrome-controls] {background: transparent;backdrop-filter: none;@@ -6230,29 +6233,29 @@ html[data-chat-wallpaper-ready] [data-slot="window-titlebar"][data-viewport-backopacity: .3;}/* One viewport-sized crop, so opening the sidebar does not reframe the image. */-[data-wallpaper-workspace]:has(> .chat-wallpaper[data-ready]) > [data-slot="sidebar-inset"],-[data-wallpaper-workspace]:has(> .chat-wallpaper[data-ready]) [data-chat-page-root] {+[data-wallpaper-workspace][data-wallpaper-ready][data-wallpaper-ready] > [data-slot="sidebar-inset"],+[data-wallpaper-workspace][data-wallpaper-ready][data-wallpaper-ready] [data-chat-page-root] {background: transparent;}-[data-wallpaper-workspace][data-wallpaper-route="page"]:has(> .chat-wallpaper[data-ready]) > [data-slot="sidebar-inset"] {+[data-wallpaper-workspace][data-wallpaper-route="page"][data-wallpaper-ready][data-wallpaper-ready] > [data-slot="sidebar-inset"] {background: color-mix(in srgb, var(--background) max(86%, calc((1 - var(--wallpaper-safe, 0)) * 100%)), transparent);}@supports not (backdrop-filter: blur(1px)) {- :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface,+ :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface,.wallpaper-preview-composer { background: var(--background); }}-/* Keep both wallpaper paths child-only so typing in the chat does not invalidate the whole workspace. */-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready] > .chat-wallpaper-image[data-fade="false"]) .thread-bottom-fade,-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready] > .chat-wallpaper-frame > .chat-wallpaper-image[data-fade="false"]) .thread-bottom-fade {+/* Host flags (host-flags.ts), not repeated: nothing else that hides the fade outranks one flag. */+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-flat] .thread-bottom-fade,+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-frame-flat] .thread-bottom-fade {display: none;}/* Clear only route canvases; cards, menus and reading surfaces retain their fills. */-[data-wallpaper-workspace]:has(> .chat-wallpaper[data-ready]) :is(.hub-page, .hub-page .hub-canvas, [data-wallpaper-page-canvas]) { background: transparent; }+[data-wallpaper-workspace][data-wallpaper-ready][data-wallpaper-ready] :is(.hub-page, .hub-page .hub-canvas, [data-wallpaper-page-canvas]) { background: transparent; }-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) .unsloth-composer-surface,-.wallpaper-preview:has(> .chat-wallpaper[data-outline="false"]) .wallpaper-preview-composer { --composer-shadow: none; }+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-outline-off][data-wallpaper-outline-off][data-wallpaper-outline-off] .unsloth-composer-surface,+.wallpaper-preview[data-wallpaper-preview-outline-off][data-wallpaper-preview-outline-off] .wallpaper-preview-composer { --composer-shadow: none; }/* WebKit only (data-glass-layers, set by WindowMaterialMount): give the children of the large glasssurfaces their own layers, so scrolling or typing inside one repaints that layer instead of@@ -6376,7 +6379,7 @@ html[data-glass-clear] [data-slot="sidebar-inner"]:has([data-slot="sidebar-foote[dir="rtl"] .sidebar-scroll-fade {--sidebar-rail-side: to right;}-html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) :is(.unsloth-composer-surface, .unsloth-files-panel),+html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] :is(.unsloth-composer-surface, .unsloth-files-panel),html[data-glass] .wallpaper-preview-composer,html[data-glass="macos"] :is(.unsloth-composer-surface, .unsloth-files-panel) {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);@@ -6384,7 +6387,7 @@ html[data-glass="macos"] :is(.unsloth-composer-surface, .unsloth-files-panel) {backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));--composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 14%, transparent), inset 0 1px 0 rgb(255 255 255 / .08);}-html[data-glass]:not([data-chat-welcome]) :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]):not([data-wallpaper-route="page"]) > .chat-wallpaper,+html[data-glass]:not([data-chat-welcome]) :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready]:not([data-wallpaper-route="page"]) > .chat-wallpaper,html[data-glass] [data-wallpaper-workspace][data-wallpaper-route="page"] > .chat-wallpaper[data-ready],html[data-glass] .wallpaper-preview[data-wallpaper-conversation] > .chat-wallpaper {opacity: calc(.7 * (.4 + .6 * var(--wallpaper-conversation, 0)));@@ -6402,14 +6405,14 @@ html:not(.dark)[data-glass] [data-wallpaper-workspace][data-wallpaper-route="paghtml:not(.dark)[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] {--glass-page-wash: color-mix(in srgb, var(--glass-page-bg) min(96%, calc((max(var(--glass-tint), var(--glass-pane-floor)) - 12%) * var(--glass-opacity, 1))), transparent);}-html[data-glass]:not([data-chat-welcome]) :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]):not([data-wallpaper-route="page"]) :is(.unsloth-composer-surface, .unsloth-files-panel),+html[data-glass]:not([data-chat-welcome]) :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready]:not([data-wallpaper-route="page"]) :is(.unsloth-composer-surface, .unsloth-files-panel),html[data-glass] .wallpaper-preview[data-wallpaper-conversation] .wallpaper-preview-composer {--glass-composer-boost: 9%;--glass-blur: calc(var(--glass-blur-base) * var(--glass-strength, 1) + 5px + var(--glass-repaint, 0) * .01px);}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]):has(> .chat-wallpaper[data-ready]) :is(.unsloth-composer-surface, .unsloth-files-panel),+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 {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");}@@ -6491,14 +6494,14 @@ html[data-glass][data-chat-wallpaper-workspace-ready]:not([data-glass-plain]) [dbackdrop-filter: none;box-shadow: none;}-html[data-glass^="liquid"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) :is(.unsloth-composer-surface, .unsloth-files-panel),+html[data-glass^="liquid"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] :is(.unsloth-composer-surface, .unsloth-files-panel),html[data-glass^="liquid"] .wallpaper-preview-composer {position: relative;background-image: var(--glass-glow, none), var(--glass-sheen);--composer-shadow: var(--glass-rim);}/* The bevel: a gradient ring, since a gradient border-box layer would show through the clear fill. */-html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) :is(.unsloth-composer-surface, .unsloth-files-panel)::before,+html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] :is(.unsloth-composer-surface, .unsloth-files-panel)::before,html[data-glass="liquid-3d"] .wallpaper-preview-composer::before {content: "";position: absolute;@@ -6509,33 +6512,33 @@ html[data-glass="liquid-3d"] .wallpaper-preview-composer::before {mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);pointer-events: none;}-html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface .unsloth-composer-plus:not(:hover, [data-state="open"], :focus-visible) {+html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface .unsloth-composer-plus:not(:hover, [data-state="open"], :focus-visible) {background-image: var(--glass-bead);box-shadow: var(--glass-bead-rim);}-html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill)[data-active="true"]:not([data-state="open"], :focus-visible) {+html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill)[data-active="true"]:not([data-state="open"], :focus-visible) {background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary) 20%, rgb(255 255 255 / .3)), color-mix(in srgb, var(--primary) 12%, rgb(255 255 255 / .072)));box-shadow: inset 0 1px 0 rgb(255 255 255 / .42), inset 0 0 0 1px color-mix(in srgb, var(--primary) 14%, rgb(255 255 255 / .108));}-html.dark[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill)[data-active="true"]:not([data-state="open"], :focus-visible) {+html.dark[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill)[data-active="true"]:not([data-state="open"], :focus-visible) {background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary) 22%, rgb(255 255 255 / .08)), color-mix(in srgb, var(--primary) 12%, transparent));box-shadow: inset 0 1px 0 rgb(255 255 255 / .16), inset 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent);}-html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface button.aui-composer-send:not(:disabled) {+html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface button.aui-composer-send:not(:disabled) {background-image: linear-gradient(180deg, rgb(255 255 255 / .228), rgb(255 255 255 / .03) 55%);box-shadow: inset 0 1px 0 rgb(255 255 255 / .3);}-html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) :is(.unsloth-composer-surface, .unsloth-files-panel),-html[data-glass] .wallpaper-preview:has(> .chat-wallpaper[data-outline="false"]) .wallpaper-preview-composer {+html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-outline-off][data-wallpaper-outline-off][data-wallpaper-outline-off] :is(.unsloth-composer-surface, .unsloth-files-panel),+html[data-glass] .wallpaper-preview[data-wallpaper-preview-outline-off][data-wallpaper-preview-outline-off] .wallpaper-preview-composer {--composer-shadow: none;}-html[data-glass^="liquid"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) :is(.unsloth-composer-surface, .unsloth-files-panel),-html[data-glass^="liquid"] .wallpaper-preview:has(> .chat-wallpaper[data-outline="false"]) .wallpaper-preview-composer {+html[data-glass^="liquid"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-outline-off][data-wallpaper-outline-off][data-wallpaper-outline-off] :is(.unsloth-composer-surface, .unsloth-files-panel),+html[data-glass^="liquid"] .wallpaper-preview[data-wallpaper-preview-outline-off][data-wallpaper-preview-outline-off] .wallpaper-preview-composer {--composer-shadow: none;}-html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) :is(.unsloth-composer-surface, .unsloth-files-panel)::before,-html[data-glass="liquid-3d"] .wallpaper-preview:has(> .chat-wallpaper[data-outline="false"]) .wallpaper-preview-composer::before {+html[data-glass="liquid-3d"] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-outline-off][data-wallpaper-outline-off][data-wallpaper-outline-off] :is(.unsloth-composer-surface, .unsloth-files-panel)::before,+html[data-glass="liquid-3d"] .wallpaper-preview[data-wallpaper-preview-outline-off][data-wallpaper-preview-outline-off] .wallpaper-preview-composer::before {content: none;}@@ -6614,7 +6617,7 @@ html.dark[data-glass="liquid-3d"] {}html[data-glass][data-chat-wallpaper-workspace-ready] :is([data-slot="sidebar-inner"], [data-slot="chat-settings-panel"]),html[data-glass][data-chat-wallpaper-ready] [data-wallpaper-chrome-controls],-html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) :is(.unsloth-composer-surface, .unsloth-files-panel),+html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] :is(.unsloth-composer-surface, .unsloth-files-panel),html[data-glass="macos"] :is([data-slot="sidebar-inner"], [data-slot="chat-settings-panel"], [data-wallpaper-chrome-controls], .unsloth-composer-surface, .unsloth-files-panel) {--accent: var(--glass-hover);--sidebar-accent: var(--glass-hover);@@ -6757,7 +6760,7 @@ html:not(.dark)[data-glass][data-chat-wallpaper-workspace-ready] [data-slot="sidborder-color: transparent;box-shadow: none;}-html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill, .unsloth-composer-plus):is(:hover:not(:disabled), [data-state="open"]):not(:focus-visible, [data-active="true"]),+html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill, .unsloth-composer-plus):is(:hover:not(:disabled), [data-state="open"]):not(:focus-visible, [data-active="true"]),html[data-glass="macos"] .unsloth-composer-surface :is(.composer-pill-btn, .unsloth-thinking-pill, .unsloth-composer-plus):is(:hover:not(:disabled), [data-state="open"]):not(:focus-visible, [data-active="true"]),html[data-glass][data-chat-wallpaper-workspace-ready] [data-slot="sidebar-inner"] [data-slot="sidebar-menu-button"]:is(:hover, [data-active="true"]),html[data-glass="macos"] [data-slot="sidebar-inner"] [data-slot="sidebar-menu-button"]:is(:hover, [data-active="true"]),@@ -6980,13 +6983,13 @@ html[data-glass] [class*="hover:bg-sidebar-accent"] [class*="hover:bg-sidebar-acbackground-color: transparent;}-html[data-glass] [data-auth-wallpaper]:has(> .chat-wallpaper[data-ready]) > [data-slot="card"] {+html[data-glass] [data-auth-wallpaper][data-wallpaper-ready][data-wallpaper-ready] > [data-slot="card"] {background-color: color-mix(in srgb, var(--card) min(96%, calc(max(min(100%, calc(var(--glass-tint) + 40%)), var(--glass-read-floor, 0%), var(--glass-menu-floor)) * var(--glass-opacity, 1))), transparent);-webkit-backdrop-filter: blur(max(var(--glass-blur), 24px)) saturate(var(--glass-saturate));backdrop-filter: blur(max(var(--glass-blur), 24px)) saturate(var(--glass-saturate));box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 10%, transparent);}-html[data-glass^="liquid"] [data-auth-wallpaper]:has(> .chat-wallpaper[data-ready]) > [data-slot="card"] {+html[data-glass^="liquid"] [data-auth-wallpaper][data-wallpaper-ready][data-wallpaper-ready] > [data-slot="card"] {background-image: var(--glass-sheen);box-shadow: var(--glass-rim), var(--glass-lift);}@@ -7040,24 +7043,24 @@ html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-slot="page-wallpaper-blur"] {display: none;}-html[data-glass] [data-windows-wallpaper-page]:has(> .chat-wallpaper[data-ready]:not([data-glass-backdrop])) > [data-slot="page-wallpaper-blur"] {+html[data-glass] [data-windows-wallpaper-page][data-wallpaper-image][data-wallpaper-image][data-wallpaper-image] > [data-slot="page-wallpaper-blur"] {display: block;position: absolute;inset: var(--studio-custom-titlebar-height) 0 0 anchor(--windows-page-sidebar right, 0px);pointer-events: none;backdrop-filter: blur(max(22px, var(--glass-blur)));}-/* Child path to the pinned sidebar's container (Sidebar spreads props there): this page also- holds the hidden chat, and a descendant :has() would walk it on every mutation. */-[data-windows-wallpaper-page]:has(> [data-windows-glass-frame], > [data-slot="sidebar"] > [data-windows-glass-frame]) > [data-slot="page-wallpaper-blur"] {+/* The pinned sidebar's glass frame, flagged by the root: this page also holds the hidden chat, and+ any :has() on it re-checked the chat on every mutation. */+[data-windows-wallpaper-page] > [data-slot="page-wallpaper-blur"][data-sidebar-frame] {border-top-left-radius: 4px;}/* A full-height page may extend under the Windows caption. Start its readingtint below the controls, even when the content scrolls. */-html[data-glass][data-chat-wallpaper-workspace-ready] [data-windows-wallpaper-page]:has(> .chat-wallpaper[data-ready]:not([data-glass-backdrop])) > [data-slot="sidebar-inset"] {+html[data-glass][data-chat-wallpaper-workspace-ready] [data-windows-wallpaper-page][data-wallpaper-image][data-wallpaper-image][data-wallpaper-image] > [data-slot="sidebar-inset"] {background: linear-gradient(to bottom, transparent var(--studio-custom-titlebar-height), var(--glass-page-wash) 0) fixed;}-html[data-glass] [data-windows-wallpaper-page]:has(> .chat-wallpaper[data-ready]:not([data-glass-backdrop])) [data-slot="api-toolbar-fade"] {+html[data-glass] [data-windows-wallpaper-page][data-wallpaper-image][data-wallpaper-image][data-wallpaper-image] [data-slot="api-toolbar-fade"] {display: none;}@@ -7174,11 +7177,11 @@ html:not(.dark) .glass-lens-rim .glass-lens-copy {.dark .glass-lens::after {box-shadow: inset 0 1px 1px -.5px rgb(255 255 255 / .112), inset 0 4px 4px -4px rgb(255 255 255 / .064), inset 0 -3px 4px -3px rgb(0 0 0 / .35);}-html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface:has(> .glass-lens) {+html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-ready][data-wallpaper-ready] .unsloth-composer-surface:has(> .glass-lens) {--composer-shadow: none;}-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) .glass-lens .glass-lens-rim,-:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) .glass-lens::after {+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-outline-off][data-wallpaper-outline-off][data-wallpaper-outline-off] .glass-lens .glass-lens-rim,+:is([data-wallpaper-workspace], [data-chat-content-root])[data-wallpaper-outline-off][data-wallpaper-outline-off][data-wallpaper-outline-off] .glass-lens::after {display: none;}diff --git a/studio/frontend/tests/appearance-composer-outline.test.ts b/studio/frontend/tests/appearance-composer-outline.test.tsindex a61fd9a54d7..a1ed496499c 100644--- a/studio/frontend/tests/appearance-composer-outline.test.ts+++ b/studio/frontend/tests/appearance-composer-outline.test.ts@@ -47,7 +47,7 @@ test("a set outline reaches every composer, and 0 drops the glass edge too", ()// !important: the glass composer rules are more specific and would otherwise keep their 14% ring.assert.match(css, /html\[data-composer-outline="on"\] :is\(\.unsloth-composer-surface, \.wallpaper-preview-composer\) \{\s*--composer-shadow: inset 0 0 0 1px [^;]*var\(--composer-outline\)[^;]*!important;/);// macOS glass has no background image, so its 14% ring needs its own selector.- assert.match(css, /html\[data-glass="macos"\]\[data-composer-outline="off"\] \.unsloth-composer-surface,[^{]*\.chat-wallpaper\[data-ready\]\) \.unsloth-composer-surface,[^{]*\{\s*--composer-shadow: none !important;/);+ assert.match(css, /html\[data-glass="macos"\]\[data-composer-outline="off"\] \.unsloth-composer-surface,[^{]*\[data-wallpaper-ready\]\[data-wallpaper-ready\] \.unsloth-composer-surface,[^{]*\{\s*--composer-shadow: none !important;/);assert.match(css, /var\(--composer-outline, var\(--wallpaper-outline, 30%\)\)/);});diff --git a/studio/frontend/tests/has-anchor-order.test.ts b/studio/frontend/tests/has-anchor-order.test.tsindex 959429cf227..ee17d556c0d 100644--- a/studio/frontend/tests/has-anchor-order.test.ts+++ b/studio/frontend/tests/has-anchor-order.test.ts@@ -13,13 +13,16 @@ const HAS_INSIDE_IS = /:is\([^{]*:has\([^{]*\s[~>+]?\s?\*\)/;test("Tailwind's group-has and peer-has variants lose their :has() inside :is()", async () => {const compiler = await compile("@theme { --spacing: 0.25rem; } @tailwind utilities;");- const generated = compiler.build([- "group-has-[[data-state=open]]:opacity-0",- "group-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16",- "group-has-[>svg]/alert:col-start-2",- "group-has-[[data-state=open]]:hover:opacity-0",- "peer-has-[:checked]:opacity-50",- ]);+ // Spelled so Tailwind's scan of this file does not ship these as real app CSS (has-subject-after.test.ts).+ const generated = compiler.build(+ [+ "GROUP-has-[[data-state=open]]:opacity-0",+ "GROUP-has-[.sidebar-row-action[data-state=open]]/recent-item:pr-16",+ "GROUP-has-[>svg]/alert:col-start-2",+ "GROUP-has-[[data-state=open]]:hover:opacity-0",+ "PEER-has-[:checked]:opacity-50",+ ].map((token) => token.replace("GROUP", "group").replace("PEER", "peer")),+ );assert.match(generated, HAS_INSIDE_IS, "Tailwind still emits the shape this plugin rewrites");const rewritten = hoistHasAnchors(generated);assert.doesNotMatch(diff --git a/studio/frontend/tests/has-host-flags.test.ts b/studio/frontend/tests/has-host-flags.test.tsnew file mode 100644index 00000000000..d293137d581--- /dev/null+++ b/studio/frontend/tests/has-host-flags.test.ts@@ -0,0 +1,88 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/*+ * The flags that replaced `HOST:has(> .chat-wallpaper...) X`, `:is(p, div):has(> a:nth-of-type(2) > img)`+ * and the Windows frame :has(): every flag the CSS reads is set by code, and the code is wired.+ */++import assert from "node:assert/strict";+import test from "node:test";++import { WALLPAPER_HOST_FLAGS } from "../src/features/chat-background/host-flags.ts";+import { readSrc } from "./helpers/kit.ts";++const css = readSrc("index.css");++test("every wallpaper host flag the CSS reads is mirrored from the wallpaper layer", () => {+ for (const [name] of WALLPAPER_HOST_FLAGS)+ assert.ok(+ css.includes(`[${name}]`),+ `${name} is set but index.css never reads it`,+ );+ for (const [, selector] of WALLPAPER_HOST_FLAGS)+ assert.match(selector, /^:scope > \.chat-wallpaper/);+ const rules = css.replace(/\/\*[\s\S]*?\*\//g, "");+ assert.doesNotMatch(+ rules,+ /:has\(\s*>\s*\.chat-wallpaper/,+ "wallpaper CSS reads the host flags, not a :has()",+ );+});++test("both wallpaper layers keep their host's flags in step", () => {+ for (const file of [+ "features/chat-background/background.tsx",+ "features/chat-background/backdrop.tsx",+ ]) {+ const source = readSrc(file);+ assert.match(source, /useWallpaperHostFlags\(host\);/, file);+ assert.match(+ source,+ /ref=\{host\}[\s\S]{0,80}className="chat-wallpaper"/,+ file,+ );+ }+});++test("hub README badge rows are marked, not matched with :has()", () => {+ const hub = readSrc("features/hub/hub.css");+ assert.doesNotMatch(hub, /:has\(> a:nth-of-type/);+ assert.equal(+ hub.match(/\.hub-readme-prose :is\(p, div\)\[data-badge-row\]/g)?.length,+ 4,+ );+ assert.match(+ readSrc("features/hub/lib/badge-rows.ts"),+ /":scope > a:nth-of-type\(2\) > img"/,+ );+ assert.match(+ readSrc("features/hub/catalog/model-readme.tsx"),+ /<div ref=\{badgeRowsRef\} className=\{cn\("hub-readme-prose", PROSE\)\}>/,+ );+});++test("the Windows page blur learns about the sidebar frame from the root, not a :has()", () => {+ assert.match(+ css,+ /\[data-windows-wallpaper-page\] > \[data-slot="page-wallpaper-blur"\]\[data-sidebar-frame\] \{\n {2}border-top-left-radius: 4px;/,+ );+ const root = readSrc("app/routes/__root.tsx");+ assert.match(+ root,+ /data-slot="page-wallpaper-blur"\s+\/\/[^\n]*\n\s+data-sidebar-frame=\{\(pinned && !mobileShell\) \|\| undefined\}/,+ );+ // The flag mirrors AppSidebar's own condition (windowsWallpaperPage already implies the Windows titlebar).+ assert.match(+ readSrc("components/app-sidebar.tsx"),+ /data-windows-glass-frame=\{\(pinned && usesWindowsTitlebar\(\)\) \|\| undefined\}/,+ );+});++test("the info hint re-checks keyboard focus on key and pointer input, not only on focus moves", () => {+ const hint = readSrc("components/ui/info-hint.tsx");+ // A mouse-focused slider nudged with an arrow key gains :focus-visible without a focus event.+ assert.match(hint, /\["focusin", "focusout", "keydown", "pointerdown"\]/);+ assert.match(hint, /for \(const type of events\) top\.addEventListener\(type, later\);/);+ assert.match(hint, /for \(const type of events\) top\.removeEventListener\(type, later\);/);+});diff --git a/studio/frontend/tests/has-subject-after.test.ts b/studio/frontend/tests/has-subject-after.test.tsnew file mode 100644index 00000000000..77a7b4f801a--- /dev/null+++ b/studio/frontend/tests/has-subject-after.test.ts@@ -0,0 +1,326 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/*+ * No new CSS rule whose style lands AFTER a :has(): `X:has(A) Y`, `X:has(A) > Y`, Tailwind's+ * group-has-* / peer-has-*, `has-[A]:[&>Y]`, `[:has(A)>&]`. Chromium keeps one shared invalidation set+ * for every such rule: when anything changes under an X it has tested, it re-checks every element+ * below that X matching ANY rule's Y (a tag, a [data-slot], ...). With X on the workspace or a p/div+ * above the thread, a sidebar toggle or a run-settings open restyled ~9-10k thread elements at 150+ * turns (348 ms of style). WebKit re-checks the whole document whenever anything named inside such+ * a :has() changes: with :focus-visible or [data-state] in there, every keystroke paid it (typing+ * p50 59 -> 25 ms at 150 turns once they were gone).+ *+ * Fix a new one by making the :has() element the subject (`X:has(A) { --v: ... }`, or `Y:has(~ A)`+ * for a sibling), or by setting a data attribute on X from the code that already knows A+ * (chat-background/host-flags.ts, hub/lib/badge-rows.ts, ui/info-hint.tsx), or by moving the state+ * onto X as a custom property (X sets it in its own has-[...] class, Y reads it with var()). Only allowlist a+ * rule whose X can never hold the thread, whose Y is a class used only inside X and whose :has()+ * names nothing that changes while typing, after measuring a sidebar toggle (Chromium) and typing+ * (WebKit) at 150 turns.+ *+ * Static and fast: compiles src/index.css (and its imports) with the build's Tailwind, plus every+ * class token in src that mentions has, then lists the selectors.+ */++import assert from "node:assert/strict";+import { readFileSync, readdirSync } from "node:fs";+import path from "node:path";+import test from "node:test";++import { compile, optimize } from "@tailwindcss/node";+import postcss from "postcss";+import selectorParser, { type Selector } from "postcss-selector-parser";++import { hoistHasAnchors } from "../vite-plugin-has-anchor.ts";++const SRC = path.resolve(import.meta.dirname, "../src");++/*+ * Rules allowed to keep a style after their :has(), measured harmless with all of them present: a+ * sidebar toggle and a run-settings open at 150 turns restyle ~140 / ~250 elements (Chromium), and+ * WebKit typing at 150 turns is as fast as with none of them. Their anchor never holds the thread.+ * Tailwind utilities are listed by class token, hand-written rules by selector.+ */+const ALLOWED_TAILWIND = new Set<string>([+ // Chat model controls (a notice beside the picker) and the composer's files panel.+ "max-sm:group-has-[>[data-chat-model-notice]]/chat-model-controls:!ml-0",+ "max-sm:group-has-[>[data-chat-model-notice]]/chat-model-controls:!gap-0",+ "max-sm:group-has-[>[data-chat-model-notice]]/chat-model-controls:!px-2",+ "[:has(.unsloth-files-panel)>&]:hidden",+ // shadcn/ui primitives (sidebar menu, field, input group, avatar, alert, command, combobox, number input).+ "group-has-data-[sidebar=menu-action]/menu-item:pr-8",+ "group-has-disabled/field:opacity-50",+ "group-has-data-[size=lg]/avatar-group:size-10",+ "group-has-data-[size=lg]/avatar-group:[--avatar-count-icon:calc(var(--spacing)*5)]",+ "group-has-data-[size=sm]/avatar-group:size-6",+ "group-has-data-[size=sm]/avatar-group:[--avatar-count-icon:calc(var(--spacing)*3)]",+ "group-has-data-[slot=combobox-clear]/input-group:hidden",+ "group-has-[[data-orientation=horizontal]]/field:text-balance",+ "group-has-[[data-slot=command-shortcut]]/command-item:hidden",+ "group-has-[input:disabled]/number:pointer-events-none",+ "group-has-[input:disabled]/number:opacity-0",+ "group-has-[>input]/input-group:pt-3",+ "group-has-[>input]/input-group:pb-3",+ "group-has-[>svg]/alert:col-start-2",+ "sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",+ "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",+ "@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",+ "has-[>[data-align=block-end]]:[&>input]:pt-3",+ "has-[>[data-align=block-start]]:[&>input]:pb-3",+ "has-[>[data-align=inline-end]]:[&>input]:pr-1.5",+ "has-[>[data-align=inline-start]]:[&>input]:pl-1.5",+]);++const ALLOWED_SELECTORS = new Set<string>([+ // Sidebar row hover (index.css).+ ".group\\/project-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".group\\/project-chat-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".group\\/projects-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".group\\/recent-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".group\\/run-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".dark .group\\/project-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".dark .group\\/project-chat-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".dark .group\\/projects-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".dark .group\\/recent-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ ".dark .group\\/run-item:hover:not(:has(.sidebar-row-action:hover)) .sidebar-nav-btn",+ // Composer pills, files panel and drop overlay (index.css).+ ":is([data-pill-compact=true] .composer-pill-btn:not([data-keep-label]),[data-pill-compact=first] .composer-pill-btn.composer-pill-permissions:not([data-keep-label])):has(.composer-pill-caret):hover .composer-pill-glyph",+ ":is([data-pill-compact=true] .composer-pill-btn:not([data-keep-label]),[data-pill-compact=first] .composer-pill-btn.composer-pill-permissions:not([data-keep-label])):has(.composer-pill-caret) .composer-pill-x",+ ".composer-pill-btn[data-active=true]:has(.composer-pill-x):hover .composer-pill-glyph",+ ".composer-pill-btn[data-active=true]:has(.composer-pill-x):hover .composer-pill-x",+ ".composer-pill-btn:has(>.composer-pill-glyph[role=button]):hover .composer-pill-glyph",+ ".composer-pill-btn:has(>.composer-pill-glyph[role=button]):hover .composer-pill-x",+ ".aui-composer-root:has(.unsloth-files-panel[data-dragging=true]) .aui-composer-drop-overlay",+ ".unsloth-files-panel-row:has(>.unsloth-files-panel-strip:hover)>.unsloth-files-panel-show-all",+ // Sonner toasts (index.css): only inside a toast.+ "[data-sonner-toast][data-styled=true]:not(:has([data-title])) [data-icon]",+ "[data-sonner-toast][data-styled=true][data-multiline]:not(:has([data-title])) [data-icon]",+ "[data-sonner-toast][data-styled=true]:has([data-button]) [data-icon]",+ "[data-sonner-toast][data-styled=true]:has([data-button]) [data-content]",+ "[data-sonner-toast][data-styled=true]:has([data-button]):has([data-icon]) [data-content]",+ "[data-sonner-toast][data-styled=true]:has([data-button]) [data-button]",+ "[data-sonner-toast][data-styled=true]:has([data-button]):has([data-icon]) [data-button]",+ // Sidebar footer fade (index.css): the sidebar never holds the thread.+ "html[data-glass][data-chat-wallpaper-workspace-ready] [data-slot=sidebar-inner]:has([data-slot=sidebar-footer-fade][data-visible=true]) .sidebar-scroll-fade",+ "html[data-glass=macos] [data-slot=sidebar-inner]:has([data-slot=sidebar-footer-fade][data-visible=true]) .sidebar-scroll-fade",+ "html[data-glass-clear] [data-slot=sidebar-inner]:has([data-slot=sidebar-footer-fade][data-visible=true]) .sidebar-scroll-fade",+]);++const FUNCTIONAL = new Set([+ ":is",+ ":where",+ ":not",+ ":matches",+ ":-webkit-any",+]);++const containsHas = (node: selectorParser.Container): boolean => {+ let found = false;+ node.walkPseudos((pseudo) => {+ if (pseudo.value === ":has") found = true;+ });+ return found;+};++/** True when some compound before the last one carries a :has(), directly or inside :is()/:not(). */+function styleAfterHas(selector: Selector): boolean {+ const nodes = selector.nodes;+ let lastCombinator = -1;+ nodes.forEach((node, i) => {+ if (node.type === "combinator") lastCombinator = i;+ });+ return nodes.some((node, i) => {+ if (node.type !== "pseudo") return false;+ if (node.value === ":has") return i < lastCombinator;+ if (!node.nodes.length) return false;+ if (i < lastCombinator && node.nodes.some(containsHas)) return true;+ return FUNCTIONAL.has(node.value) && node.nodes.some(styleAfterHas);+ });+}++const normalize = (selector: Selector): string => {+ const copy = selector.clone();+ copy.walk((node) => {+ node.spaces.before = "";+ node.spaces.after = "";+ if (node.type === "combinator") node.value = node.value.trim() || " ";+ });+ return String(copy)+ .trim()+ .replace(/="([\w-]+)"/g, "=$1");+};++function* files(dir: string, ext: RegExp): Generator<string> {+ for (const entry of readdirSync(dir, { withFileTypes: true })) {+ const full = path.join(dir, entry.name);+ if (entry.isDirectory()) yield* files(full, ext);+ else if (ext.test(entry.name)) yield full;+ }+}++/** Every whitespace/quote-delimited token Tailwind scans that could be a class using :has(). */+const FRONTEND = path.resolve(SRC, "..");+const SCANNED = /\.(tsx?|jsx?|mjs|html)$/;++/** What Tailwind's automatic source detection reads: src, tests and scripts, plus the root files. */+function* scannedFiles(): Generator<string> {+ for (const dir of ["src", "tests", "scripts"])+ yield* files(path.join(FRONTEND, dir), SCANNED);+ for (const entry of readdirSync(FRONTEND, { withFileTypes: true })) {+ if (entry.isFile() && SCANNED.test(entry.name))+ yield path.join(FRONTEND, entry.name);+ }+}++function hasCandidates(): Set<string> {+ const out = new Set<string>();+ for (const file of scannedFiles()) {+ const text = readFileSync(file, "utf8");+ if (!text.includes("has")) continue;+ for (const token of text.split(/[\s"'`]+/)) {+ if (+ token.length < 300 &&+ (token.includes("has-") || token.includes(":has("))+ ) {+ out.add(token.replace(/^[,;({]+|[,;)}]+$/g, ""));+ }+ }+ }+ return out;+}++type Offender = { key: string; selector: string };++async function builtCss(candidates: Set<string>): Promise<string> {+ const entry = path.join(SRC, "index.css");+ const compiler = await compile(readFileSync(entry, "utf8"), {+ base: SRC,+ onDependency: () => {},+ });+ // vite.config.ts runs the same hoist on every .css; optimize() flattens nesting like the build.+ const warn = console.warn;+ console.warn = () => {};+ try {+ return optimize(hoistHasAnchors(compiler.build([...candidates])), {+ minify: false,+ }).code;+ } finally {+ console.warn = warn;+ }+}++function offenders(css: string, candidates: Set<string>): Offender[] {+ const out: Offender[] = [];+ postcss.parse(css).walkRules((rule) => {+ // Join nesting first (a raw .css file may nest `.x:has(.a) { .y {} }`), skipping @media and the like.+ let full = rule.selector;+ for (+ let parent = rule.parent;+ parent && parent.type !== "root";+ parent = parent.parent+ ) {+ if (parent.type !== "rule") continue;+ const outer = (parent as postcss.Rule).selector;+ full = full.includes("&")+ ? full.replaceAll("&", `:is(${outer})`)+ : `:is(${outer}) ${full}`;+ }+ if (!full.includes(":has(")) return;+ selectorParser((root) => {+ root.each((selector) => {+ if (!styleAfterHas(selector)) return;+ let key = normalize(selector);+ selector.walkClasses((cls) => {+ if (candidates.has(cls.value)) key = cls.value;+ });+ out.push({ key, selector: String(selector).trim() });+ });+ }).processSync(full);+ });+ return out;+}++async function appOffenders(): Promise<Offender[]> {+ const candidates = hasCandidates();+ const found = offenders(await builtCss(candidates), candidates);+ // CSS files the entry does not import are bundled on their own.+ const imported = readFileSync(path.join(SRC, "index.css"), "utf8");+ for (const file of files(SRC, /\.css$/)) {+ const rel = `./${path.relative(SRC, file).split(path.sep).join("/")}`;+ if (rel === "./index.css" || imported.includes(`"${rel}"`)) continue;+ found.push(...offenders(readFileSync(file, "utf8"), candidates));+ }+ return found;+}++test("no new CSS rule puts its style after a :has() (Chromium restyles the whole thread)", async () => {+ const found = await appOffenders();+ assert.ok(+ found.length > 0,+ "the scan found nothing at all; it is no longer reading the app's CSS",+ );+ const fresh = found.filter(+ ({ key }) => !ALLOWED_TAILWIND.has(key) && !ALLOWED_SELECTORS.has(key),+ );+ assert.deepEqual(+ [...new Set(fresh.map(({ key }) => key))],+ [],+ "These rules style an element AFTER a :has() (X:has(A) Y, group-has-*, peer-has-*, has-[A]:[&>Y]).\n" ++ "Chromium then re-checks every Y-like element under each X on any change below X; with X above the\n" ++ "chat thread a sidebar toggle restyled ~9k thread elements at 150 turns. Make the :has() element the\n" ++ "subject, or set a data attribute on X from the component that knows A (see the comment at the top\n" ++ "of tests/has-subject-after.test.ts). Allowlist only after measuring.\n" ++ fresh.map(({ selector }) => ` ${selector}`).join("\n"),+ );+ // A stale entry would quietly allow a future rule with the same name.+ const keys = new Set(found.map(({ key }) => key));+ const stale = [...ALLOWED_TAILWIND, ...ALLOWED_SELECTORS].filter(+ (key) => !keys.has(key),+ );+ assert.deepEqual(+ stale,+ [],+ "allowlisted rules that no longer exist: remove them from the allowlist",+ );+});++test("no custom variant hides a :has() from the scan", () => {+ // Utilities built from these are not in the candidate list, so the scan above cannot see them.+ const variants: string[] = [];+ for (const file of files(SRC, /\.css$/)) {+ postcss+ .parse(readFileSync(file, "utf8"))+ .walkAtRules(/^(custom-variant|variant)$/, (rule) => {+ if (rule.toString().includes(":has("))+ variants.push(`${path.basename(file)}: ${rule.params}`);+ });+ }+ assert.deepEqual(+ variants,+ [],+ "a @custom-variant with :has(): scan its utilities or make the :has() the subject",+ );+});++test("the scan flags the shapes that restyled the thread and passes subject :has()", () => {+ const flagged = (css: string): number =>+ offenders(css, new Set(["group-has-x"])).length;+ const bad = [+ ":is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) [data-chat-page-root] {}",+ ".hub-readme-prose :is(p, div):has(> a:nth-of-type(2) > img) img {}",+ ".menu-row-with-action:has([data-row-action]:hover) > [data-slot=dropdown-menu-item] {}",+ ":is(:where(.group):has([data-state=open]) *) {}",+ ".a:not(:has(.b)) .c {}",+ ".a { :where(.group):has(.b) & { opacity: 0 } }",+ ".x:has(.a) { @media (hover: hover) { .y { opacity: 0 } } }",+ ];+ for (const css of bad) assert.equal(flagged(css), 1, css);+ const good = [+ ".menu-row-with-action > [data-slot=dropdown-menu-item]:has(~ * [data-row-action]:hover) {}",+ "[data-wallpaper-workspace][data-wallpaper-ready] [data-chat-page-root] {}",+ ".composer-pill-btn:has(.composer-pill-caret) {}",+ ".a :is(.b:has(> .c)) {}",+ ];+ for (const css of good) assert.equal(flagged(css), 0, css);+});diff --git a/studio/frontend/tests/library-helpers.test.ts b/studio/frontend/tests/library-helpers.test.tsindex 4532a270f16..416276c2d6f 100644--- a/studio/frontend/tests/library-helpers.test.ts+++ b/studio/frontend/tests/library-helpers.test.ts@@ -327,11 +327,13 @@ test("a card's date shows on hover, on keyboard focus and always on touch", () =const date = /"([^"]*)",\s*\)}\s*>\s*\{formatCardTime/.exec(readSrc("features/library/components/library-cards.tsx"))?.[1].split(" ");for (const reveal of ["group-hover/library-card:opacity-100",- "group-has-[:focus-visible]/library-card:opacity-100",+ // keyboard focus: the card sets --card-time-opacity with its own has-[:focus-visible]+ "opacity-[var(--card-time-opacity,0)]","pointer-coarse:opacity-100",]) {assert.ok(date?.includes(reveal), reveal);}+ assert.match(readSrc("features/library/components/library-cards.tsx"), /className="group\/library-card has-\[:focus-visible\]:\[--card-time-opacity:1\] relative"/);});test("a moved folder's files are read again by the galleries and the Library", () => {diff --git a/studio/frontend/tests/rag-embedding-picker.test.ts b/studio/frontend/tests/rag-embedding-picker.test.tsindex 8d64d8cafe8..7f80690bce7 100644--- a/studio/frontend/tests/rag-embedding-picker.test.ts+++ b/studio/frontend/tests/rag-embedding-picker.test.ts@@ -174,7 +174,7 @@ test("pins are grey with the Recents unpin glyph, and tooltips are the app's own});test("in the composer list the pin shows on row hover only, pinned or not", () => {- assert.match(MENU_PICKER, /text-muted-foreground opacity-0 outline-hidden transition-colors group-hover\/row:opacity-100/);+ assert.match(MENU_PICKER, /text-muted-foreground opacity-\[var\(--row-pin-opacity,0\)\] outline-hidden transition-colors group-hover\/row:opacity-100/);assert.doesNotMatch(MENU_PICKER, /!isPinned &&/);});@@ -244,12 +244,18 @@ test("composer pins are their own menu items, so the keyboard reaches them", ()/<DropdownMenuPrimitive\.CheckboxItem\s+checked=\{isPinned\}[\s\S]*?data-row-action=\{true\}[\s\S]*?togglePin\(model\);/,);assert.doesNotMatch(MENU_PICKER, /tabIndex=\{-1\}/);- assert.match(read("../src/index.css"), /\.menu-row-with-action:has\(\[data-row-action\]:is\(:hover, \[data-highlighted\]\)\)/);+ // The item's own :has() over its later siblings lights it while the pin is hovered or highlighted.+ assert.match(+ read("../src/index.css"),+ /\.menu-row-with-action > :is\(\[data-slot="dropdown-menu-item"\], \[data-slot="context-menu-item"\]\):has\(~ \[data-row-action\]:is\(:hover, \[data-highlighted\]\), ~ \* \[data-row-action\]:is\(:hover, \[data-highlighted\]\)\)/,+ );});test("pins show without hover on touch screens", () => {assert.match(PICKER, /"opacity-0 group-hover\/row:opacity-100 \[@media\(hover:none\)\]:opacity-100"/);- assert.match(MENU_PICKER, /group-has-\[\[data-highlighted\]\]\/row:opacity-100 \[@media\(hover:none\)\]:opacity-100/);+ // The row lifts the pin while anything in it is highlighted (has-[[data-highlighted]] sets --row-pin-opacity).+ assert.match(MENU_PICKER, /className="menu-row-with-action group\/row has-\[\[data-highlighted\]\]:\[--row-pin-opacity:1\] relative"/);+ assert.match(MENU_PICKER, /group-hover\/row:opacity-100 \[@media\(hover:none\)\]:opacity-100/);});test("the embedding controls wrap and fit narrow settings panels", () => {diff --git a/studio/frontend/tests/sidebar-row-menu-and-pinned-folders.test.ts b/studio/frontend/tests/sidebar-row-menu-and-pinned-folders.test.tsindex 6c0b42e8998..84c8460abd1 100644--- a/studio/frontend/tests/sidebar-row-menu-and-pinned-folders.test.ts+++ b/studio/frontend/tests/sidebar-row-menu-and-pinned-folders.test.ts@@ -13,36 +13,30 @@ import { readSrcAsync } from "./helpers/kit.ts";const APP_SIDEBAR = await readSrcAsync("components/app-sidebar.tsx");-// The open-state gutter rule is more specific than hover, so both must reserve the same.+// The open-state gutter rule is more specific than hover, so both must reserve the same. The row's+// parts look at the actions after them (`:has(~ ...)`), not the row at its descendants (group-has-*).test("an open row menu reserves the same gutter hover does", () => {const pattern =- /group-hover\/([a-z-]+):pr-(\d+)[^"]*group-has-\[\.sidebar-row-action\[data-state=open\]\]\/([a-z-]+):pr-(\d+)/g;+ /group-hover\/([a-z-]+):pr-(\d+)[^"]*\[&:has\(~\.sidebar-row-action\[data-state=open\]\)\]:pr-(\d+)/g;const seen: string[] = [];- for (const [, hoverGroup, hoverPad, openGroup, openPad] of APP_SIDEBAR.matchAll(- pattern,- )) {- assert.equal(- hoverGroup,- openGroup,- "the hover and open-state gutters are written for different rows",- );+ for (const [, hoverGroup, hoverPad, openPad] of APP_SIDEBAR.matchAll(pattern)) {assert.equal(openPad,hoverPad,- `${openGroup} reserves pr-${hoverPad} on hover but pr-${openPad} with its menu open, so the title runs under the actions`,+ `${hoverGroup} reserves pr-${hoverPad} on hover but pr-${openPad} with its menu open, so the title runs under the actions`,);- seen.push(`${openGroup}:${openPad}`);+ seen.push(`${hoverGroup}:${openPad}`);}// Counts kinds of row, not branches.assert.ok(seen.length >= 3, `only ${seen.length} rows carry both gutters`);});test("the quick-action beside an open menu is revealed with it", () => {- for (const group of ["project-chat-item", "recent-item"]) {+ for (const name of ["PROJECT_CHAT", "RECENT"]) {const reveal = new RegExp(- `group-has-\\[\\.sidebar-row-action\\[data-state=open\\]\\]/${group}:opacity-100 group-has-\\[\\.sidebar-row-action\\[data-state=open\\]\\]/${group}:pointer-events-auto`,+ `REVEAL_WITH_OPEN_MENU_${name} =\\s*"\\[&:has\\(~\\.sidebar-row-action\\[data-state=open\\]\\)\\]:opacity-100 \\[&:has\\(~\\.sidebar-row-action\\[data-state=open\\]\\)\\]:pointer-events-auto"`,);- assert.match(APP_SIDEBAR, reveal, `${group} has no open-menu reveal`);+ assert.match(APP_SIDEBAR, reveal, `${name} has no open-menu reveal`);}const secondaries = APP_SIDEBAR.match(/is-unpin-action/g) ?? [];assert.equal(secondaries.length, 3, "a secondary row action came or went");diff --git a/studio/frontend/tests/sidebar-spinner-column.test.ts b/studio/frontend/tests/sidebar-spinner-column.test.tsindex 278e9860260..38ca585c135 100644--- a/studio/frontend/tests/sidebar-spinner-column.test.ts+++ b/studio/frontend/tests/sidebar-spinner-column.test.ts@@ -100,8 +100,9 @@ test("every trailing mark yields to the row actions on hover, an open menu and kfor (const group of ["recent-item", "project-chat-item"]) {for (const fade of [`group-hover/${group}:opacity-0`,- `group-has-[.sidebar-row-action[data-state=open]]/${group}:opacity-0`,- `group-has-[.sidebar-row-action:focus-visible]/${group}:opacity-0`,+ // The actions follow the mark in the row, so the mark looks at its later siblings.+ "[&:has(~.sidebar-row-action[data-state=open])]:opacity-0",+ "[&:has(~.sidebar-row-action:focus-visible)]:opacity-0",]) {assert.ok(block.includes(fade), `the ${name} lacks ${fade}`);}@@ -131,7 +132,7 @@ test("a working Recents row clears the kebab on hover", async () => {);// focus-visible reveals the actions without hover, so rows reserve room there too.- const focusPads = [...source.matchAll(/:focus-visible\]\/[a-z-]+:pr-([0-9.]+)/g)].map(+ const focusPads = [...source.matchAll(/:has\(~\.sidebar-row-action:focus-visible\)\]:pr-([0-9.]+)/g)].map((m) => Number(m[1]) * TAILWIND_UNIT,);assert.equal(focusPads.length, 2, `expected 2 focus paddings, got ${focusPads.length}`);diff --git a/studio/frontend/tests/window-material.test.ts b/studio/frontend/tests/window-material.test.tsindex 800496f75f6..9f2e4b82e71 100644--- a/studio/frontend/tests/window-material.test.ts+++ b/studio/frontend/tests/window-material.test.ts@@ -73,7 +73,7 @@ test("turning the wallpaper fade off drops the band behind the composer", () =>const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");assert.match(css,- /\.chat-wallpaper-image\[data-fade="false"\]\) \.thread-bottom-fade \{\n display: none;/,+ /\[data-wallpaper-frame-flat\] \.thread-bottom-fade \{\n display: none;/,);});@@ -89,8 +89,8 @@ test("glass strength repairs malformed persisted data", () => {test("composer outline off also drops the glass ring and bevel", () => {const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");- assert.match(css, /html\[data-glass\] [^{]*\[data-outline="false"\]\) :is\(\.unsloth-composer-surface, \.unsloth-files-panel\),[^{]*\{\n --composer-shadow: none;/);- assert.match(css, /\[data-outline="false"\]\) :is\(\.unsloth-composer-surface, \.unsloth-files-panel\)::before,[^{]*\{\n content: none;/);+ assert.match(css, /html\[data-glass\] [^{]*\[data-wallpaper-outline-off\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel\),[^{]*\{\n --composer-shadow: none;/);+ assert.match(css, /\[data-wallpaper-outline-off\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel\)::before,[^{]*\{\n content: none;/);});test("glass adds no outer shadows, only inset light", () => {@@ -137,7 +137,7 @@ test("glass lens modes repair malformed data and scale the right way", () => {assert.ok(LENS_SCALE.magnify > 1 && LENS_SCALE.shrink < 1);const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");assert.match(css, /\.glass-lens \{\n position: absolute;\n inset: 0;\n z-index: -1;/);- assert.match(css, /\[data-outline="false"\]\) \.glass-lens \.glass-lens-rim,/);+ assert.match(css, /\[data-wallpaper-outline-off\] \.glass-lens \.glass-lens-rim,/);});test("a glass lens set to off draws no wallpaper copies", () => {@@ -201,8 +201,8 @@ test("the glass preference survives an account switch, and sign-in waits for thetest("glass over an open conversation dims the image and thickens the composer and files panel", () => {const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");- // Welcome comes from a root flag (welcome.ts), not a :has() walk over the whole thread.- const conversation = String.raw`html\[data-glass\]:not\(\[data-chat-welcome\]\) :is\(\[data-wallpaper-workspace\], \[data-chat-content-root\]\):has\(> \.chat-wallpaper\[data-ready\]\):not\(\[data-wallpaper-route="page"\]\)`;+ // Welcome comes from a root flag (welcome.ts) and the image from a host flag (host-flags.ts), not a :has().+ const conversation = String.raw`html\[data-glass\]:not\(\[data-chat-welcome\]\) :is\(\[data-wallpaper-workspace\], \[data-chat-content-root\]\)\[data-wallpaper-ready\]\[data-wallpaper-ready\]:not\(\[data-wallpaper-route="page"\]\)`;assert.match(css, new RegExp(`${conversation} > \\.chat-wallpaper,[^{]*\\{\\n opacity: calc\\(\\.7 \\* `));assert.match(css, new RegExp(`${conversation} :is\\(\\.unsloth-composer-surface, \\.unsloth-files-panel\\),[^{]*\\{\\n --glass-composer-boost: 9%;`));assert.match(css, /calc\(\(max\(calc\(var\(--glass-tint\) \+ 14%\), var\(--glass-read-floor, 0%\), var\(--glass-composer-floor\)\) \+ var\(--glass-composer-boost, 0%\)\)/);diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.pyindex 4c507589ec3..4dd6d148d14 100644--- a/tests/studio/test_desktop_reliability_frontend_contract.py+++ b/tests/studio/test_desktop_reliability_frontend_contract.py@@ -1714,8 +1714,25 @@ def test_chat_sidebar_row_actions_visible_on_coarse_pointers():"pin's fixed rem offset and padding into the pr-N units the row's gutters are in, and ""the two sides of every comparison below would be in different scales")+ # The open-menu / focused-action gutters key on the row's own later sibling,+ # `[&:has(~.sidebar-row-action...)]:pr-N`, instead of a `group-has-*/<variant>` class (a style+ # after a :has() restyles the whole thread). They carry no variant name, so read the variant+ # from the branch that renders them, `variant === "project"`, and name it the way the+ # group-scoped classes did, so every check below still knows which row it is reading.+ sibling_gutter = re.compile(r"\[&:has\(~\.sidebar-row-action[^\s]*\)\]:(pr-\d+(?:\.\d+)?)")++ def _named_variant(constraints: dict[str, bool], cls: str) -> str:+ match = sibling_gutter.fullmatch(cls)+ project = constraints.get('variant === "project"')+ if not match or project is None:+ return cls+ return f"has-sibling/{'project-chat-item' if project else 'recent-item'}:{match.group(1)}"+rendered = [- (constraints, [_as_spacing_units(cls, spacing) for cls in rendering])+ (+ constraints,+ [_as_spacing_units(_named_variant(constraints, cls), spacing) for cls in rendering],+ )for constraints, rendering in _rendered_with_conditions(_cn_arguments(row_classes))]renderings = [classes for _, classes in rendered]