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: Library cards stay apart at every zoom, one size, 5 per row (#15643)
Michael Hane4c96e58b6b8
diff --git a/studio/frontend/src/features/library/chats/chats-items.tsx b/studio/frontend/src/features/library/chats/chats-items.tsxindex a482a6ea9b6..dab3baf36bd 100644--- a/studio/frontend/src/features/library/chats/chats-items.tsx+++ b/studio/frontend/src/features/library/chats/chats-items.tsx@@ -76,7 +76,7 @@ import {import { FILE_LIST_COLUMNS } from "../components/library-list";import { useLibrarySettingsStore } from "../settings-store";import { SortRadio } from "../components/library-toolbar";-import { CARD_SHADOW, OVERLAY_CONTROL, RAISED_SURFACE } from "../surface";+import { CARD_MIN_HEIGHT, CARD_SHADOW, OVERLAY_CONTROL, RAISED_SURFACE } from "../surface";const CARD = cn(RAISED_SURFACE,@@ -85,9 +85,7 @@ const CARD = cn("group/chat relative flex min-h-0 min-w-0 cursor-pointer flex-col gap-2.5 self-stretch rounded-2xl px-5 py-5 transition hover:bg-neutral-100 hover:shadow-none dark:hover:bg-accent/60",);-/** Fits the fullest card: tile, two-line title, two-line footer (+1 unit for its icon). */-export const CHAT_CARD_ROW_MIN =- "calc(var(--spacing) * 26 + 2.75 * var(--text-ui-14) + 3 * var(--text-ui-12))";+export const CHAT_CARD_ROW_MIN = CARD_MIN_HEIGHT;import {type ChatContents,type ChatSort,@@ -948,7 +946,7 @@ function SelectBox({}const ROW_INSET = "pl-4 pr-6";-const CELL = "truncate text-ui-13 text-muted-foreground";+const CELL = "truncate text-ui-12p5 text-muted-foreground";const DATE_COLUMN = "hidden w-32 shrink-0 @xl:block";const CONTENTS_COLUMN = "hidden w-36 shrink-0 @3xl:block";const LOCATION_COLUMN = "hidden w-40 shrink-0 @4xl:block";@@ -1012,7 +1010,7 @@ export function ChatListHeader({<div className="pb-2"><divclassName={cn(- "group/chat relative flex items-center gap-4 text-ui-13 text-muted-foreground",+ "group/chat relative flex items-center gap-4 text-ui-12p5 text-muted-foreground",ROW_INSET,)}>@@ -1106,14 +1104,14 @@ export function ChatRow({if (actions.selection.size > 0) actions.toggleSelected(chat.id, event.shiftKey);else actions.open(chat);}}- className="truncate rounded-full text-left text-ui-14 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className="truncate rounded-full text-left text-ui-13 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring">{chatTitle(chat, t)}</button><ChatBadges chat={chat} /></span>{model && (- <span className="truncate text-ui-12 text-muted-foreground">+ <span className="truncate text-ui-11p5 text-muted-foreground">{model}</span>)}@@ -1215,7 +1213,7 @@ function CardFooter({ meta, date, className }: { meta?: ReactNode; date: string;return (<divclassName={cn(- "mt-auto flex min-w-0 flex-col items-start gap-1 text-ui-12 text-muted-foreground",+ "mt-auto flex min-w-0 flex-col items-start gap-1 text-ui-11p5 text-muted-foreground",className,)}>@@ -1231,7 +1229,7 @@ const TILELESS_TITLE = "pe-6";const TILELESS_ROW_NAME = "min-h-13";const CARD_TITLE =- "block w-full rounded-md text-left font-medium text-ui-14 leading-snug text-foreground outline-none [overflow-wrap:anywhere] focus-visible:ring-2 focus-visible:ring-ring";+ "block w-full rounded-md text-left font-medium text-ui-13 leading-snug text-foreground outline-none [overflow-wrap:anywhere] focus-visible:ring-2 focus-visible:ring-ring";export function GroupHeading({children,@@ -1483,7 +1481,7 @@ export function ProjectRow({event.stopPropagation();actions.viewProject(project.id);}}- className="truncate rounded-full text-left text-ui-14 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className="truncate rounded-full text-left text-ui-13 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring">{project.name}</button>@@ -1504,7 +1502,7 @@ export function ProjectRow({)}</span>{project.instructions?.trim() && (- <span className="truncate text-ui-12 text-muted-foreground">+ <span className="truncate text-ui-11p5 text-muted-foreground">{project.instructions.trim()}</span>)}@@ -1550,7 +1548,7 @@ export function ProjectListHeader({ date }: { date: DateColumn }) {return (<divclassName={cn(- "flex items-center gap-4 pb-2 text-ui-13 text-muted-foreground",+ "flex items-center gap-4 pb-2 text-ui-12p5 text-muted-foreground",ROW_INSET,)}>@@ -1725,7 +1723,7 @@ export function SectionRow({event.stopPropagation();actions.viewSection(section.id);}}- className="truncate rounded-full text-left text-ui-14 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className="truncate rounded-full text-left text-ui-13 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring">{section.name}</button>@@ -1767,7 +1765,7 @@ export function SectionListHeader({ date }: { date: DateColumn }) {return (<divclassName={cn(- "flex items-center gap-4 pb-2 text-ui-13 text-muted-foreground",+ "flex items-center gap-4 pb-2 text-ui-12p5 text-muted-foreground",ROW_INSET,)}>@@ -1808,13 +1806,13 @@ function FavoriteTile({)}><div className="grid aspect-square grid-cols-[minmax(0,1fr)] grid-rows-[auto_1fr_auto] px-5 pt-5 pb-3.5">- <p className="line-clamp-2 min-h-[2.75em] break-words font-medium text-ui-13p5 leading-snug text-foreground">+ <p className="line-clamp-2 min-h-[2.75em] break-words font-medium text-ui-12p5 leading-snug text-foreground">{title}</p><div className="flex flex-col items-center text-foreground before:flex-5 after:flex-7">{icon}</div>- <p className="truncate pr-6 text-ui-12 text-muted-foreground">+ <p className="truncate pr-6 text-ui-11p5 text-muted-foreground">{showTime && time ? formatCardTime(time, locale) : ""}</p></div>diff --git a/studio/frontend/src/features/library/chats/chats-library.tsx b/studio/frontend/src/features/library/chats/chats-library.tsxindex eacec7d7532..19055fb8ceb 100644--- a/studio/frontend/src/features/library/chats/chats-library.tsx+++ b/studio/frontend/src/features/library/chats/chats-library.tsx@@ -1161,7 +1161,7 @@ export function ChatsLibrary({description={t("library.chats.empty.sectionsDescription")}action={<Button- variant="dark"+ variant="muted"className="rounded-full"onClick={() => setMovingIntoNew({ kind: "section", chats: [] })}>@@ -1259,7 +1259,7 @@ export function ChatsLibrary({title={t("library.chats.empty.projectsTitle")}description={t("library.chats.empty.projectsDescription")}action={- <Button variant="dark" className="rounded-full" onClick={() => setCreatingProject(true)}>+ <Button variant="muted" className="rounded-full" onClick={() => setCreatingProject(true)}>{t("library.chats.toolbar.newProject")}</Button>}diff --git a/studio/frontend/src/features/library/components/library-cards.tsx b/studio/frontend/src/features/library/components/library-cards.tsxindex eb00050abfe..324971636f0 100644--- a/studio/frontend/src/features/library/components/library-cards.tsx+++ b/studio/frontend/src/features/library/components/library-cards.tsx@@ -22,14 +22,7 @@ import { formatCardTime, formatItemCount } from "../format";import { useColumnCount, useLibraryThumbnail, useSeen } from "../hooks";import { useLibraryActions } from "../actions-context";import { CARD_COLUMNS, useLibrarySettingsStore } from "../settings-store";-import {- CARD_SHADOW,- GLASS_CONTROL,- GLASS_SURFACE,- OVERLAY_CONTROL,- RAISED_SURFACE,- SELECTED_TINT,-} from "../surface";+import { CARD_MIN_HEIGHT, CARD_SHADOW, GLASS_CONTROL, GLASS_SURFACE, OVERLAY_CONTROL, RAISED_SURFACE, SELECTED_TINT } from "../surface";import { CardSelectionContext } from "./card-selection";import { LibraryActionsMenu } from "./library-actions";import { PlayIcon } from "lucide-react";@@ -90,7 +83,9 @@ function ImageThumb({style={loaded && !square? { aspectRatio: 1 / Math.min(Math.max(ratio, MIN_THUMB_RATIO), MAX_THUMB_RATIO) }- : undefined+ : square+ ? { minHeight: CARD_MIN_HEIGHT }+ : undefined}>{!loaded && <div className="aspect-square w-full animate-pulse bg-muted" />}@@ -240,7 +235,7 @@ export function ItemCard({ item }: { item: LibraryItem }) {>{thumb ? (<>- <ImageThumb item={item} square={square && fileKind(item) === "image"} />+ <ImageThumb item={item} square={square || fileKind(item) !== "image"} />{showTime && (<spanclassName={cn(@@ -253,7 +248,10 @@ export function ItemCard({ item }: { item: LibraryItem }) {)}</>) : (- <div className="grid aspect-square grid-cols-[minmax(0,1fr)] grid-rows-[auto_1fr_auto] px-5 pt-5 pb-3.5">+ <div+ className="grid aspect-square grid-cols-[minmax(0,1fr)] grid-rows-[auto_1fr_auto] px-5 pt-5 pb-3.5"+ style={{ minHeight: CARD_MIN_HEIGHT }}+ ><p className="line-clamp-2 min-h-[2.75em] break-all font-medium text-ui-13p5 leading-snug text-foreground">{item.name}</p>@@ -302,7 +300,10 @@ function FolderCard({menu={<LibraryActionsMenu target={{ kind: "folder", folder }} variant="overlay" />}className={CARD_SURFACE}>- <div className="flex aspect-square items-center justify-center">+ <div+ className="flex aspect-square items-center justify-center"+ style={{ minHeight: CARD_MIN_HEIGHT }}+ ><HugeiconsIcon icon={Folder01Icon} strokeWidth={1.5} className={CARD_ICON_CLASS} /></div></CardFrame>@@ -321,10 +322,12 @@ function FolderCard({}const CARD_ROW_GAP = "gap-y-6";+// gap-5 (Masonry) and gap-x-5 (CardGrid) at 100%.+const CARD_COLUMN_GAP_PX = 20;function useCardColumns(container: RefObject<HTMLDivElement | null>): number {- const { minWidth, max } = CARD_COLUMNS[useLibrarySettingsStore((s) => s.cardSize)];- return useColumnCount(container, minWidth, max);+ const { minWidth, max, wideMinWidth } = CARD_COLUMNS[useLibrarySettingsStore((s) => s.cardSize)];+ return useColumnCount(container, minWidth, max, CARD_COLUMN_GAP_PX, wideMinWidth);}export function Masonry<T>({@@ -358,7 +361,6 @@ export function CardGrid({minRowHeight,}: {children: ReactNode;- /** Rows are max(this, the column's 8:7 height). */minRowHeight?: string;}) {const container = useRef<HTMLDivElement>(null);@@ -370,7 +372,7 @@ export function CardGrid({style={{gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,gridAutoRows: minRowHeight- ? `max(${minRowHeight}, calc((100cqw - ${columns - 1} * var(--spacing) * 5) / ${columns} * 7 / 8))`+ ? `max(${minRowHeight}, calc((100cqw - ${columns - 1} * var(--spacing) * 5) / ${columns}))`: undefined,}}>diff --git a/studio/frontend/src/features/library/components/library-header.tsx b/studio/frontend/src/features/library/components/library-header.tsxindex 9d327490175..c100ec7bb3d 100644--- a/studio/frontend/src/features/library/components/library-header.tsx+++ b/studio/frontend/src/features/library/components/library-header.tsx@@ -164,25 +164,43 @@ export function LibraryHeader({controls: ReactNode;tabs: { items: HeaderTab[]; active: string; onChange: (key: string) => void } | null;}) {+ const barRef = useRef<HTMLDivElement>(null);const controlsRef = useRef<HTMLDivElement>(null);const titleRef = useRef<HTMLDivElement>(null);const rowRef = useRef<HTMLDivElement>(null);const [controlsWidth, setControlsWidth] = useState(0);const [covered, setCovered] = useState(false);const [stuck, setStuck] = useState(false);+ const [stacked, setStacked] = useState(false);useEffect(() => {+ const bar = barRef.current;const controlsNode = controlsRef.current;const row = rowRef.current;const titleNode = titleRef.current;- if (!controlsNode || !row || !titleNode) return;+ if (!bar || !controlsNode || !row || !titleNode) return;let frame = 0;const update = () => {frame = 0;setControlsWidth(controlsNode.getBoundingClientRect().width);+ // Unwrapped width from the tools themselves, so wrapping once stacked cannot flip it back.+ const tools = [...(controlsNode.firstElementChild?.children ?? [])] as HTMLElement[];+ const toolGap = controlsNode.firstElementChild+ ? Number.parseFloat(getComputedStyle(controlsNode.firstElementChild).columnGap) || 0+ : 0;+ const needed =+ tools.reduce((sum, tool) => sum + tool.offsetWidth, 0) ++ toolGap * Math.max(0, tools.length - 1);+ // ~6em of title; a longer name truncates instead of stacking.+ const heading = titleNode.firstElementChild as HTMLElement | null;+ const titleRoom = heading+ ? Math.min(heading.scrollWidth, 6 * Number.parseFloat(getComputedStyle(heading).fontSize))+ : 0;+ setStacked(needed + GAP_PX + titleRoom > bar.clientWidth);const top = row.getBoundingClientRect().top;setCovered(top < controlsNode.getBoundingClientRect().bottom);- const gap = top - titleNode.getBoundingClientRect().bottom;+ const above = (row.previousElementSibling as HTMLElement | null) ?? titleNode;+ const gap = top - above.getBoundingClientRect().bottom;setStuck(gap > Number.parseFloat(getComputedStyle(row).marginTop) + 1);};const schedule = () => {@@ -190,6 +208,7 @@ export function LibraryHeader({};const observer = new ResizeObserver(schedule);observer.observe(controlsNode);+ observer.observe(bar);document.addEventListener("scroll", schedule, { capture: true, passive: true });window.addEventListener("resize", schedule);schedule();@@ -201,20 +220,40 @@ export function LibraryHeader({};}, []);- return (- <>- <div className="@container pointer-events-none sticky top-4 z-30 flex h-0 justify-end">- <div ref={controlsRef} className="pointer-events-auto">- {controls}- </div>- </div>+ // Keyed: stacking moves the toolbar instead of remounting its search box.+ const bar = (+ <div+ key="bar"+ ref={barRef}+ className={cn(+ "@container flex",+ stacked+ ? "mt-3"+ : "pointer-events-none sticky top-4 z-30 h-0 justify-end",+ )}+ ><div- ref={titleRef}- className="flex h-9 min-w-0 items-center"- style={{ paddingRight: controlsWidth + GAP_PX }}+ ref={controlsRef}+ className={cn("pointer-events-auto", stacked && "max-w-full [&>*]:flex-wrap [&>*]:gap-y-2")}>- {title}+ {controls}</div>+ </div>+ );+ const heading = (+ <div+ key="title"+ ref={titleRef}+ className="flex h-9 min-w-0 items-center"+ style={{ paddingRight: stacked ? undefined : controlsWidth + GAP_PX }}+ >+ {title}+ </div>+ );++ return (+ <>+ {stacked ? [heading, bar] : [bar, heading]}<divref={rowRef}data-stuck={stuck || undefined}@@ -226,7 +265,7 @@ export function LibraryHeader({tabs={tabs.items}active={tabs.active}onChange={tabs.onChange}- reserve={covered ? controlsWidth + GAP_PX : 0}+ reserve={covered && !stacked ? controlsWidth + GAP_PX : 0}/></div>) : (diff --git a/studio/frontend/src/features/library/hooks.ts b/studio/frontend/src/features/library/hooks.tsindex 9e4fc7f6cae..57c62b8eb93 100644--- a/studio/frontend/src/features/library/hooks.ts+++ b/studio/frontend/src/features/library/hooks.ts@@ -4,6 +4,7 @@import { MAX_DOCUMENT_PREVIEW_BYTES } from "@/components/file-viewer";import { decodePeaks } from "@/features/audio/components/waveform-decode";import { translate } from "@/i18n";+import { subscribeLayoutScale } from "@/lib/layout-scale";import { type RefObject, useEffect, useState } from "react";import {LibraryFileTooLarge,@@ -180,10 +181,13 @@ export function useSeen(ref: RefObject<Element | null>): boolean {return seen;}+/** `baseGap` is the gap at 100%, so `minColumnWidth` scales with interface zoom and text size. */export function useColumnCount(ref: RefObject<HTMLElement | null>,minColumnWidth = 200,maxColumns = 5,+ baseGap?: number,+ wideColumnWidth?: number,): number {const [columns, setColumns] = useState(4);useEffect(() => {@@ -191,13 +195,21 @@ export function useColumnCount(if (!element) return;const measure = () => {const gap = parseFloat(getComputedStyle(element).columnGap) || 0;- const fit = Math.floor((element.clientWidth + gap) / (minColumnWidth + gap));- setColumns(Math.max(2, Math.min(maxColumns, fit)));+ const scale = baseGap && gap > 0 ? gap / baseGap : 1;+ const fits = (width: number) =>+ Math.floor((element.clientWidth + gap) / (width * scale + gap));+ const wide = wideColumnWidth ? fits(wideColumnWidth) : 0;+ setColumns(Math.max(2, Math.min(maxColumns, fits(minColumnWidth)), wide));};measure();const observer = new ResizeObserver(measure);observer.observe(element);- return () => observer.disconnect();- }, [ref, minColumnWidth, maxColumns]);+ // A zoom step can change the gap without resizing the container.+ const unsubscribe = subscribeLayoutScale(measure);+ return () => {+ observer.disconnect();+ unsubscribe();+ };+ }, [ref, minColumnWidth, maxColumns, baseGap, wideColumnWidth]);return columns;}diff --git a/studio/frontend/src/features/library/library-page.tsx b/studio/frontend/src/features/library/library-page.tsxindex 57a3d0a3d09..8392a8809bd 100644--- a/studio/frontend/src/features/library/library-page.tsx+++ b/studio/frontend/src/features/library/library-page.tsx@@ -816,7 +816,7 @@ function LibraryView({ search }: { search: LibrarySearch }) {if (tab === "folders") {return (<Button- variant="dark"+ variant="muted"className="rounded-full"onClick={() => setNameDialog({ mode: "create", parentId: null })}>diff --git a/studio/frontend/src/features/library/settings-store.ts b/studio/frontend/src/features/library/settings-store.tsindex c5b58515cfa..eee41fb3fc3 100644--- a/studio/frontend/src/features/library/settings-store.ts+++ b/studio/frontend/src/features/library/settings-store.ts@@ -58,10 +58,14 @@ export const DEFAULT_LIBRARY_SETTINGS: LibrarySettings = {export const SUGGESTED_LIMITS = [20, 40, 80] as const;-export const CARD_COLUMNS: Record<LibrarySettings["cardSize"], { minWidth: number; max: number }> = {- small: { minWidth: 140, max: 6 },- medium: { minWidth: 170, max: 5 },- large: { minWidth: 210, max: 4 },+/** `max` per row down to `minWidth`; more only once every card can be `wideMinWidth`. */+export const CARD_COLUMNS: Record<+ LibrarySettings["cardSize"],+ { minWidth: number; max: number; wideMinWidth: number }+> = {+ small: { minWidth: 140, max: 6, wideMinWidth: 190 },+ medium: { minWidth: 170, max: 5, wideMinWidth: 225 },+ large: { minWidth: 210, max: 4, wideMinWidth: 275 },};export type LibraryView = "grid" | "list";diff --git a/studio/frontend/src/features/library/surface.ts b/studio/frontend/src/features/library/surface.tsindex 3aaf6bac539..131439049ba 100644--- a/studio/frontend/src/features/library/surface.ts+++ b/studio/frontend/src/features/library/surface.ts@@ -21,3 +21,7 @@ const CONTROL_EDGE =export const GLASS_SURFACE = `bg-white text-neutral-900 ${CONTROL_EDGE} dark:bg-neutral-700 dark:text-white dark:ring-0`;export const GLASS_CONTROL = `${GLASS_SURFACE} hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white`;++/** Fits the fullest card: tile, two-line title, two-line footer. */+export const CARD_MIN_HEIGHT =+ "calc(var(--spacing) * 26 + 2.75 * var(--text-ui-13) + 3 * var(--text-ui-11p5))";diff --git a/studio/frontend/tests/library-chats.test.ts b/studio/frontend/tests/library-chats.test.tsindex da036f1039e..bad2a85b589 100644--- a/studio/frontend/tests/library-chats.test.ts+++ b/studio/frontend/tests/library-chats.test.ts@@ -411,14 +411,22 @@ test("sections have created and last modified dates, and Last modified is the deassert.doesNotMatch(readSrc("features/library/chats/chats-items.tsx"), /field="updated"/);});-test("chat, project and section cards are a little shorter than square, dated bottom left", () => {+test("chat, project and section cards are square like folder and file cards, dated bottom left", () => {const items = readSrc("features/library/chats/chats-items.tsx");const card = items.slice(items.indexOf("const CARD = cn("), items.indexOf("const ICON ="));assert.doesNotMatch(card, /aspect-\[/);assert.match(card, /min-h-0 min-w-0/);- assert.match(card, /CHAT_CARD_ROW_MIN =\s*"calc\(var\(--spacing\) \* 26 \+ 2\.75 \* var\(--text-ui-14\) \+ 3 \* var\(--text-ui-12\)\)"/);+ assert.match(items, /export const CHAT_CARD_ROW_MIN = CARD_MIN_HEIGHT;/);+ assert.match(+ readSrc("features/library/surface.ts"),+ /CARD_MIN_HEIGHT =\s*"calc\(var\(--spacing\) \* 26 \+ 2\.75 \* var\(--text-ui-13\) \+ 3 \* var\(--text-ui-11p5\)\)"/,+ );+ assert.equal(+ readSrc("features/library/components/library-cards.tsx").split("minHeight: CARD_MIN_HEIGHT").length - 1,+ 3,+ );const grid = readSrc("features/library/components/library-cards.tsx");- assert.match(grid, /max\(\$\{minRowHeight\}, calc\(\(100cqw - \$\{columns - 1\} \* var\(--spacing\) \* 5\) \/ \$\{columns\} \* 7 \/ 8\)\)/);+ assert.match(grid, /max\(\$\{minRowHeight\}, calc\(\(100cqw - \$\{columns - 1\} \* var\(--spacing\) \* 5\) \/ \$\{columns\}\)\)/);assert.match(grid, /<div className="@container">\{grid\}<\/div>/);const library = readSrc("features/library/chats/chats-library.tsx");assert.doesNotMatch(library, /<CardGrid(?! minRowHeight=\{CHAT_CARD_ROW_MIN\})/);@@ -441,7 +449,7 @@ test("chat, project and section tiles share one box and hover tint", () => {test("grid cards share a two-line title and a footer of contents over date", () => {const items = readSrc("features/library/chats/chats-items.tsx");assert.match(items, /const CARD_TITLE =\s*"[^"]*\[overflow-wrap:anywhere\]/);- assert.match(items, /const CARD_TITLE =\s*"[^"]*font-medium text-ui-14 /);+ assert.match(items, /const CARD_TITLE =\s*"[^"]*font-medium text-ui-13 /);const footer = items.slice(items.indexOf("function CardFooter("), items.indexOf("const CARD_TITLE"));assert.match(footer, /flex-col items-start/);assert.match(footer, /\{meta && <span className="w-full min-w-0 truncate">\{meta\}<\/span>\}\s*<span className="truncate">\{date\}<\/span>/);@@ -507,7 +515,30 @@ test("every library toolbar's search narrows with the header row, so it never refor (const file of ["features/library/components/library-toolbar.tsx", "features/library/chats/chats-toolbar.tsx"]) {assert.match(readSrc(file), /w-\[clamp\(10rem,calc\(100cqw-30rem\),min\(15rem,24vw\)\)\]/, file);}- assert.match(readSrc("features/library/components/library-header.tsx"), /className="@container /);+ assert.match(readSrc("features/library/components/library-header.tsx"), /"@container flex"/);+});++test("a library toolbar too wide for the row stacks under the title instead of covering it", () => {+ const header = readSrc("features/library/components/library-header.tsx");+ assert.match(header, /setStacked\(needed \+ GAP_PX \+ titleRoom > bar\.clientWidth\)/);+ assert.match(header, /\{stacked \? \[heading, bar\] : \[bar, heading\]\}/);+ assert.match(header, /reserve=\{covered && !stacked \? controlsWidth \+ GAP_PX : 0\}/);+});++test("only image previews keep their own shape; video and other previews are square", () => {+ const cards = readSrc("features/library/components/library-cards.tsx");+ assert.match(cards, /<ImageThumb item=\{item\} square=\{square \|\| fileKind\(item\) !== "image"\} \/>/);+});++test("library card columns widen with the interface zoom and text size", () => {+ const cards = readSrc("features/library/components/library-cards.tsx");+ assert.match(cards, /useColumnCount\(container, minWidth, max, CARD_COLUMN_GAP_PX, wideMinWidth\)/);+ const hooks = readSrc("features/library/hooks.ts");+ assert.match(hooks, /const scale = baseGap && gap > 0 \? gap \/ baseGap : 1;/);+ assert.match(hooks, /\(width \* scale \+ gap\)/);+ assert.match(hooks, /Math\.max\(2, Math\.min\(maxColumns, fits\(minColumnWidth\)\), wide\)/);+ assert.match(readSrc("features/library/settings-store.ts"), /medium: \{ minWidth: 170, max: 5, wideMinWidth: 225 \}/);+ assert.match(hooks, /subscribeLayoutScale\(measure\)/);});test("the library header row casts a light shadow once stuck", () => {@@ -708,3 +739,11 @@ test("a date sort on Sections also picks the date the rows show", () => {const library = readSrc("features/library/chats/chats-library.tsx");assert.match(library, /sectionSort: \{ key, desc \}, \.\.\.\(isDateField\(key\) \? \{ dateField: key \} : \{\}\)/);});++test("every Library empty-state button uses Upload files' muted pill", () => {+ for (const file of ["features/library/library-page.tsx", "features/library/chats/chats-library.tsx"]) {+ const src = readSrc(file);+ assert.doesNotMatch(src, /variant="dark"/, file);+ assert.match(src, /variant="muted"\s+className="rounded-full"/, file);+ }+});