The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Menus: one spacing system for panels, sheets and search
Adarsh134ca92db909
diff --git a/src/app/nav-subs.css b/src/app/nav-subs.cssindex a1bc01f4..85f63e95 100644--- a/src/app/nav-subs.css+++ b/src/app/nav-subs.css@@ -1,34 +1,62 @@/*- * A studio's features under it in the Studios menu (mega-panel SubLinks). With a mouse: 24 px names in a column, two to- * a row's 48 px (an odd number gets a 24 px pad), so the columns' rows stay in line. On a touch screen: pills that wrap,- * 32 px to see and 44 px to tap. Below the height its column has room for, a studio with data-subs-line (Genjutsu)- * lists them as one wrapped line of names instead. In a layer (unlike nav-states.css), so a utility that hides the- * list still wins.+ * A studio's features under it in the Studios menu (mega-panel SubLinks), on the menus' 4 px grid:+ * text a feature's name starts on its studio's text column: the lead card's title (12 px in), or the row's name+ * from 1440 px (48 px in, after its thumbnail). Below 1440 px a row has no thumbnail and its name sits on the+ * column's edge, so its features take the card's 12 px column.+ * line a 1 px hairline on the studio's lead-in: the card's left edge (and a row's, below 1440 px), the thumbnail's+ * centre from 1440 px. It ends at the last shown feature's bottom, never past it.+ * rhythm with a mouse, 24 px names in a column; the row after the list follows 4 px below it, as rows follow rows.+ * On a touch screen, pills that wrap, 32 px to see and 44 px to tap. Below the height its column has room+ * for, a studio with data-subs-line (Genjutsu) lists them as wrapped lines of 24 px names instead.+ * In a layer (unlike nav-states.css), so a utility that hides the list still wins.*/@layer components {.nav-subs {+ /* --subs-text: where the names start; --subs-pad: a link's inline padding (its hover fill reaches that far out). */+ --subs-text: 12px;+ --subs-pad: 8px;+ position: relative;display: flex;flex-direction: column;+ padding-left: calc(var(--subs-text) - var(--subs-pad));+ }+ .nav-subs::before {+ content: "";+ position: absolute;+ top: 0;+ bottom: 0;+ left: 0;+ width: 1px;+ background-color: var(--border);+ pointer-events: none;}.nav-subs > li > a {min-height: 24px;- padding-inline: 8px;+ padding-inline: var(--subs-pad);border-radius: 8px;font-size: 12.5px;line-height: 16px;}- .nav-subs[data-odd] {- padding-bottom: 24px;+ @media (min-width: 1440px) {+ .nav-subs[data-under] {+ --subs-text: 48px;+ }+ .nav-subs[data-under]::before {+ left: 17px;+ }}@media (pointer: coarse) {.nav-subs {flex-direction: row;flex-wrap: wrap;- gap: 12px 6px;- padding-block: 8px 12px;+ gap: 12px 8px;+ padding-block: 8px;+ /* A pill's border keeps 4 px off the line; from 1440 px under a row its words start on the row's name. */+ padding-left: max(4px, calc(var(--subs-text) - 12px));}- .nav-subs[data-odd] {- padding-bottom: 12px;+ .nav-subs::before {+ top: 8px;+ bottom: 8px;}.nav-subs > li > a {min-height: 32px;@@ -45,27 +73,12 @@}@media (not (pointer: coarse)) and (max-height: 799.98px) {.nav-subs[data-subs-line] {+ --subs-pad: 4px;flex-direction: row;flex-wrap: wrap;- /* Two lines of names make a 50 px list: with the row it hangs from (its own line left out), two whole rows. */- padding-block: 4px 6px;- }- .nav-subs[data-subs-line] > li {- display: flex;- align-items: center;- }- /* A dot after each name but the last: a line that wraps starts on a name. */- .nav-subs[data-subs-line] > li:not(:last-child)::after {- content: "\00B7";- color: var(--muted-foreground);- }- /* The last one shown: the links after it (data-from) need a taller window. */- .nav-subs[data-subs-line] > li:not([data-from]):not(:has(~ li:not([data-from])))::after {- content: none;+ column-gap: 4px;}.nav-subs[data-subs-line] > li > a {- min-height: 20px;- padding-inline: 2px;font-size: 12px;}/* The open feature reads by its weight here: no pip beside a name in a line. */diff --git a/src/components/nav/mega-panel.tsx b/src/components/nav/mega-panel.tsxindex 1d168ccf..b7784ade 100644--- a/src/components/nav/mega-panel.tsx+++ b/src/components/nav/mega-panel.tsx@@ -31,11 +31,19 @@ const ROW_HIDE = (i: number, families = false) =>);function NewBadge() {- return <span className="shrink-0 rounded-full bg-highlight px-1.5 py-px text-[10px] leading-4 font-semibold text-highlight-foreground">New</span>;+ return (+ <span data-new className="shrink-0 rounded-full bg-highlight px-1.5 py-px text-[10px] leading-4 font-semibold text-highlight-foreground">+ New+ </span>+ );}-/** A column's first card: its cover, name and one line. `row` 1 under the owner's New board (Canvas), its cover shorter by that button. */-export function LeadCard({ e, col, row = 0, current, inside, now }: { e: MegaItem; col: number; row?: number; current: boolean; inside?: boolean; now: number }) {+/**+ * A column's first card: its cover, name and one line. `row` 1 under the owner's New board (Canvas), its cover shorter by+ * that button. The cover's height is rounded down to the 4 px grid (a 4:3 box of a fractional column width would put+ * every row under the card on a half pixel), and its words start 12 px in, the column its features hang from.+ */+export function LeadCard({ e, col, row = 0, current, inside, now, className }: { e: MegaItem; col: number; row?: number; current: boolean; inside?: boolean; now: number; className?: string }) {return (<IntentLinkhref={e.href}@@ -43,7 +51,7 @@ export function LeadCard({ e, col, row = 0, current, inside, now }: { e: MegaItedata-row={row}aria-current={current ? "page" : undefined}data-active={inside ? "" : undefined}- className="nav-row group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground"+ className={cn("nav-row group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground [container-type:inline-size]", className)}><CoverThumbid={e.navCover}@@ -52,11 +60,11 @@ export function LeadCard({ e, col, row = 0, current, inside, now }: { e: MegaIteicon={e.icon}eagerclassName={cn(- "rounded-none md:max-lg:max-h-[max(56px,calc(100dvh-460px))]",- row ? "max-h-[max(64px,calc(100dvh-640px))]" : "max-h-[max(64px,calc(100dvh-592px))]",+ "h-[round(down,75cqw,4px)] rounded-none md:max-lg:max-h-[round(down,max(56px,calc(100dvh_-_460px)),4px)]",+ row ? "max-h-[round(down,max(64px,calc(100dvh_-_640px)),4px)]" : "max-h-[round(down,max(64px,calc(100dvh_-_592px)),4px)]",)}/>- <span className="nav-mark-start flex min-w-0 flex-col gap-0.5 px-3 pt-2.5 pb-3 md:max-lg:px-2.5 md:max-lg:py-2">+ <span className="nav-mark-start flex min-w-0 flex-col gap-0.5 px-[11px] pt-2.5 pb-3 md:max-lg:py-2"><span className="flex min-w-0 items-center gap-1.5"><span className="truncate text-[14px] leading-[18px] font-semibold md:max-lg:text-[13px]">{e.label}</span>{isNew(e, now) && <NewBadge />}@@ -69,7 +77,14 @@ export function LeadCard({ e, col, row = 0, current, inside, now }: { e: MegaIte);}+/**+ * A studio's row: 44 px (40 below lg), 4 px from the next, so rows fall every 48 px. From 1280 px its name and its line+ * share a 36 px box that wraps: a name too long to share its line with its New badge keeps its words and the badge starts+ * the second line, before the line; a name too long for the column takes the second line instead and the line gives way+ * (it stays in the title). Below 1280 px the name alone, on up to two lines, with its badge beside it.+ */function Row({ e, col, row, current, inside, now, className }: { e: MegaItem; col: number; row: number; current: boolean; inside?: boolean; now: number; className?: string }) {+ const fresh = isNew(e, now);return (<IntentLinkhref={e.href}@@ -78,18 +93,28 @@ function Row({ e, col, row, current, inside, now, className }: { e: MegaItem; coaria-current={current ? "page" : undefined}data-active={inside ? "" : undefined}title={e.line ? `${e.label}: ${e.line}` : e.label}- className={cn("nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1.5 md:max-lg:min-h-10", className)}+ className={cn("nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1 md:max-lg:min-h-10 md:max-lg:py-0.5", className)}>{/* Six columns leave a row its name and line below 1440 px, and its name alone below 1280 px. Its picture loadswhen the row shows (lazy): a row hidden by the window's height never fetches it. */}<CoverThumb id={e.navCover} cover={e.cover} size="row" icon={e.icon} className="max-[1439.98px]:hidden" />- <span className="flex min-w-0 flex-col">- <span className="flex min-w-0 items-center gap-1.5">- <span className={cn("truncate text-[13px] leading-[18px] font-medium max-xl:line-clamp-2 max-xl:whitespace-normal", (current || inside) && "font-semibold")}>{e.label}</span>- {isNew(e, now) && <NewBadge />}+ {/* Centred while it fits; a name on two lines starts at the top and pushes the line out of the 36 px box. */}+ <span data-row-text className="flex max-h-9 min-w-0 flex-1 flex-wrap items-center gap-x-1.5 overflow-hidden [align-content:safe_center] max-xl:flex-nowrap">+ <span data-row-name className={cn("line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium", (current || inside) && "font-semibold")}>+ {e.label}+ </span>+ {fresh && <NewBadge />}+ {/* After a badge that wrapped, the line fills the rest of the second line; after one beside the name it can't fit+ there and starts its own. A studio whose links become one line on a short window gives that line its room. */}+ <span+ className={cn(+ "min-w-0 flex-1 truncate text-[12px] leading-4 text-muted-foreground max-xl:hidden",+ fresh ? "basis-[calc(100%-48px)]" : "basis-full",+ e.subsLine && "[@media(max-height:799.98px)]:hidden",+ )}+ >+ {e.line}</span>- {/* A studio whose links become one line on a short window gives that line its own line's room. */}- <span className={cn("truncate text-[12px] leading-4 text-muted-foreground max-xl:hidden", e.subsLine && "[@media(max-height:799.98px)]:hidden")}>{e.line}</span></span></IntentLink>);@@ -114,23 +139,20 @@ const hideBelow = (h: 800 | 880 | 960, line = false) => cn(!line && HIDE_SHORT[h/*** What a studio holds inside (its tabs and modes), as links under its card or row: names only, smaller and quieter- * than the rows, hung from a hairline under the studio (nav-subs.css: with a mouse, two 24 px names to a- * row's 48 px, so the columns' rows stay in line; pills on a touch screen; one wrapped line of names below the height a- * studio with `subsLine` needs). `row`: the first link's place for the arrow keys (they go down from the studio through- * its links to the next row). `current`: the open page's feature. `under`: links under a row, whose names start where- * the row's name does.+ * than the rows, hung from a hairline under the studio (nav-subs.css: with a mouse, 24 px names on the studio's text+ * column; pills on a touch screen; wrapped lines of names below the height a studio with `subsLine` needs). `row`: the+ * first link's place for the arrow keys (they go down from the studio through its links to the next row). `current`:+ * the open page's feature. `under`: links under a row, whose names start where the row's name does.*/function SubLinks({ e, col, row, current, under }: { e: MegaItem; col: number; row: number; current?: string; under?: boolean }) {if (!e.subs?.length) return null;- // An odd number of links ends half a row short: a 24 px pad fills it (the owner's taller-window links come in twos).- const odd = e.subs.filter((s) => !s.from).length % 2 === 1;return (<ularia-label={`In ${e.label}`}data-subs={e.id}- data-odd={odd ? "" : undefined}+ data-under={under ? "" : undefined}data-subs-line={e.subsLine ? "" : undefined}- className={cn("nav-subs ml-[17px] border-l border-border pl-1 max-[1439.98px]:ml-1.5", under && "min-[1440px]:pl-[21px]", e.subsFrom && hideBelow(e.subsFrom, e.subsLine))}+ className={cn("nav-subs min-w-0", e.subsFrom && hideBelow(e.subsFrom, e.subsLine))}>{e.subs.map((s, i) => (<li key={s.id} data-from={s.from ? "" : undefined} className={cn(s.from && hideBelow(s.from))}>@@ -168,10 +190,10 @@ function Tile({ e, col, row, current, eager }: { e: MegaItem; col: number; row:data-row={row}aria-current={current ? "page" : undefined}title={e.line ? `${e.label}: ${e.line}` : e.label}- className="nav-row nav-mark-under flex min-w-0 flex-col gap-1.5 rounded-[12px] p-1.5"+ className="nav-row nav-mark-under -m-1.5 flex min-w-0 flex-col gap-1.5 rounded-[12px] p-1.5"><CoverThumb cover={e.cover} size="tile16" icon={e.icon} eager={eager} />- <span className="flex min-w-0 flex-col px-0.5">+ <span className="flex min-w-0 flex-col"><span className={cn("truncate text-[13px] leading-[18px] font-medium", current && "font-semibold")}>{e.label}</span><span className="truncate text-[12px] leading-4 text-muted-foreground">{e.line}</span></span>@@ -266,7 +288,7 @@ export function MegaColumns({ model, current, now, kind }: { model: MegaModel; c</IntentLink>)}</div>- <ul aria-labelledby={labelId} className="grid gap-x-3 gap-y-2" style={{ gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` }}>+ <ul aria-labelledby={labelId} className="grid gap-3" style={{ gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` }}>{c.rows.map((e, i) => {const row = Math.floor(i / n);// Two sections: one row of tiles each below 900 px of height, two from 900 px.@@ -292,10 +314,10 @@ export function MegaColumns({ model, current, now, kind }: { model: MegaModel; creturn (<div key={c.id} data-group={c.id} className={cn("flex min-w-0 flex-col gap-2", place)}>{label}- <ul aria-labelledby={labelId} className="flex flex-col gap-0.5">+ <ul aria-labelledby={labelId} className="flex flex-col gap-1">{c.lead && (- <li className="pb-1.5">- <LeadCard e={c.lead} col={col} current={current === c.lead.id} inside={holder === c.lead.id} now={now} />+ <li>+ <LeadCard e={c.lead} col={col} current={current === c.lead.id} inside={holder === c.lead.id} now={now} className="mb-1" /><SubLinks e={c.lead} col={col} row={1} current={current} /></li>)}@@ -311,11 +333,11 @@ export function MegaColumns({ model, current, now, kind }: { model: MegaModel; c};return (- <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">+ <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6">{families? model.families!.map((f) => (<Fragment key={f.id}>- <div className={cn("flex items-center gap-2 border-b pb-1.5 lg:row-start-1", f.span >= 3 ? "col-span-3" : SPAN[f.span])} data-family={f.id}>+ <div className={cn("flex h-10 items-center gap-2 border-b lg:row-start-1", f.span >= 3 ? "col-span-3" : SPAN[f.span])} data-family={f.id}><p className="text-[12px] leading-4 font-semibold text-foreground">{f.label} <span className="font-normal text-muted-foreground tabular-nums">· {f.count}</span></p>@@ -356,7 +378,7 @@ export function MegaPanel({ id, onClose, onSearch }: { id: MegaId; onClose: () =const search = useSearchParams()?.toString() ?? "";return (<div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">- <div className="flex min-h-10 items-center gap-3.5 pb-4">+ <div className="flex min-h-10 items-center gap-3 pb-4"><p className="text-[13px] text-muted-foreground" data-count-line>{model ? model.countLine : failed ? "Couldn't load this menu" : " "}</p>@@ -366,7 +388,7 @@ export function MegaPanel({ id, onClose, onSearch }: { id: MegaId; onClose: () =aria-current={pathname === area.href ? "page" : undefined}aria-label={model?.seeAll.name ?? `See all ${area.label.toLowerCase()}`}data-see-all- className="nav-row group/all -ml-1 inline-flex h-9 items-center gap-1 rounded-[10px] px-2 text-[13px] font-medium text-brand-text"+ className="nav-row group/all -ml-1 inline-flex h-8 items-center gap-1 rounded-[8px] px-2 text-[13px] font-medium text-brand-text">See all<ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />diff --git a/src/components/nav/phone-sheets.tsx b/src/components/nav/phone-sheets.tsxindex 24f3bd31..4563efaa 100644--- a/src/components/nav/phone-sheets.tsx+++ b/src/components/nav/phone-sheets.tsx@@ -62,7 +62,7 @@ export function sheetReturnTarget(opener: HTMLElement | null, shown: NavSheet, tfunction YouSheet() {return (- <div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto overscroll-contain px-4 pb-1">+ <div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto overscroll-contain px-4 pb-1 [--nav-icon:18px]"><ComputerNoteBlock /><AccountSections variant="sheet" /></div>@@ -183,7 +183,8 @@ export function PhoneSheets() {onPointerCancel={() => (drag.current = null)}><span aria-hidden className="mx-auto h-1 w-10 rounded-full bg-border-strong" />- <div className={cn("flex items-center pr-2", shown === "studios" ? "gap-1 pl-3" : "gap-3 pl-4")}>+ {/* On the sheet's 16 px gutter, as the chips and tiles under it are. */}+ <div className={cn("flex items-center pr-2 pl-4", shown === "studios" ? "gap-1" : "gap-3")}><SheetPrimitive.Title className={cn("font-heading text-[28px] leading-none font-normal text-foreground", shown === "studios" && "sr-only")}>{shown === "studios" ? MEGA_AREAS[family].label : TITLES[shown]}</SheetPrimitive.Title>diff --git a/src/components/nav/search-palette.tsx b/src/components/nav/search-palette.tsxindex ffec445b..b56d1d20 100644--- a/src/components/nav/search-palette.tsx+++ b/src/components/nav/search-palette.tsx@@ -347,7 +347,7 @@ export function PaletteBody({)}{result.best.length > 0 && (<CommandPrimitive.Group heading="Best matches" className={cn("mb-4", sectionHeading)}>- <div className="flex flex-col gap-0.5">+ <div className="flex flex-col gap-1">{result.best.map((h) => (<BestRow key={h.key} hit={h} onPick={pickHit} />))}@@ -356,7 +356,7 @@ export function PaletteBody({)}{result.also.length > 0 && (<CommandPrimitive.Group heading="Also try" className={cn("mb-4", sectionHeading)}>- <div className="grid grid-cols-1 gap-2 sm:grid-cols-2">+ <div className="grid grid-cols-1 gap-x-2 gap-y-1 sm:grid-cols-2">{result.also.map((h) => (<AlsoTile key={h.key} hit={h} onPick={pickHit} />))}@@ -365,14 +365,16 @@ export function PaletteBody({)}{result.groups.map((g) => (<CommandPrimitive.Group key={g.kind} heading={g.label} className={cn("mb-4", sectionHeading)}>- {g.hits.map((h) => (- <HitRow key={h.key} hit={h} onPick={pickHit} />- ))}+ <div className="flex flex-col gap-1">+ {g.hits.map((h) => (+ <HitRow key={h.key} hit={h} onPick={pickHit} />+ ))}+ </div></CommandPrimitive.Group>))}{recentItems.length > 0 && (<CommandPrimitive.Group heading={KIND_LABELS.recent} className={cn("mb-4", sectionHeading)}>- <div className="grid grid-cols-1 gap-1 sm:grid-cols-2">+ <div className="grid grid-cols-1 gap-x-2 gap-y-1 sm:grid-cols-2">{recentItems.map((g) => (<RecentRow key={g.id} g={g} onOpen={onOpenRecent} />))}@@ -393,7 +395,7 @@ export function PaletteBody({</CommandPrimitive.Group>{!searching && recentItems.length > 0 && (<CommandPrimitive.Group heading="Jump back in" className={cn("mt-3 border-t pt-3", sectionHeading)}>- <div className="grid grid-cols-1 gap-1 sm:grid-cols-2">+ <div className="grid grid-cols-1 gap-x-2 gap-y-1 sm:grid-cols-2">{recentItems.slice(0, 4).map((g) => (<RecentRow key={g.id} g={g} onOpen={onOpenRecent} />))}diff --git a/src/components/nav/search-results.tsx b/src/components/nav/search-results.tsxindex 53ac5bc2..60c74132 100644--- a/src/components/nav/search-results.tsx+++ b/src/components/nav/search-results.tsx@@ -110,21 +110,35 @@ function EnterCap() {);}-/** A tool's studio before its name ("Audio › Clean up voice"), or a preset's gallery ("Camera motions › Dolly In"). */-function Name({ hit, crumb, className }: { hit: NavHit; crumb?: string; className?: string }) {+/**+ * A tool's studio before its name ("Audio › Clean up voice"), or a preset's gallery ("Camera motions › Dolly In").+ * `stack`: a two-line row's name, whose crumb moves to its second line on a phone (Line), so the name is never cut for it.+ */+function Name({ hit, crumb, stack, className }: { hit: NavHit; crumb?: string; stack?: boolean; className?: string }) {return (- <span className={cn("block truncate", className)}>+ <span data-hit-name={stack ? "stack" : ""} className={cn("block truncate", className)}>{crumb && (- <>+ <span className={cn(stack && "max-sm:hidden")}><span className="font-medium text-muted-foreground">{crumb}</span><ChevronRight aria-hidden className="mx-1 inline size-3 align-[-1px] text-muted-foreground" />- </>+ </span>)}{hit.label}</span>);}+/** A two-line row's second line: what the hit is, after its crumb on a phone (Name's `stack`). */+function Line({ hit, crumb }: { hit: NavHit; crumb?: string }) {+ const what = hit.what ?? hit.hint;+ return (+ <span className="truncate text-[12.5px] text-muted-foreground">+ {crumb && crumb !== what && <span className="sm:hidden">{what ? `${crumb} · ` : crumb}</span>}+ {what}+ </span>+ );+}+const crumbOf = (hit: NavHit) => hit.from ?? (hit.kind === "tool" ? hit.hint : undefined);/** A best match: a 64x48 cover, its name and line, what it is, and the Enter keycap when selected. */@@ -134,12 +148,12 @@ export function BestRow({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) => vvalue={hit.key}onSelect={() => onPick(hit)}aria-current={useCurrent(hit.href)}- className={cn("group/hit flex h-[58px] cursor-pointer items-center gap-3.5 rounded-xl py-[5px] pr-3 pl-2", selected)}+ className={cn("group/hit flex h-14 cursor-pointer items-center gap-3 rounded-xl py-1 pr-3 pl-2", selected)}><HitCover hit={hit} size="thumb" /><span className="flex min-w-0 flex-1 flex-col gap-0.5">- <Name hit={hit} crumb={crumbOf(hit)} className="text-[14.5px] font-semibold" />- <span className="truncate text-[12.5px] text-muted-foreground">{hit.what ?? hit.hint}</span>+ <Name hit={hit} crumb={crumbOf(hit)} stack className="text-[14.5px] font-semibold" />+ <Line hit={hit} crumb={crumbOf(hit)} /></span><Tag hit={hit} /><EnterCap />@@ -154,12 +168,12 @@ export function AlsoTile({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) =>value={hit.key}onSelect={() => onPick(hit)}aria-current={useCurrent(hit.href)}- className={cn("group/hit flex h-14 min-w-0 cursor-pointer items-center gap-3 rounded-xl py-[5px] pr-3 pl-2", selected)}+ className={cn("group/hit flex h-14 min-w-0 cursor-pointer items-center gap-3 rounded-xl py-1 pr-3 pl-2", selected)}><HitCover hit={hit} size="chip" /><span className="flex min-w-0 flex-1 flex-col gap-0.5">- <Name hit={hit} crumb={crumbOf(hit)} className="text-[14px] font-semibold" />- <span className="truncate text-[12.5px] text-muted-foreground">{hit.what ?? hit.hint}</span>+ <Name hit={hit} crumb={crumbOf(hit)} stack className="text-[14px] font-semibold" />+ <Line hit={hit} crumb={crumbOf(hit)} /></span><Tag hit={hit} /></CommandPrimitive.Item>@@ -192,7 +206,7 @@ export function StudioTile({ e, onPick }: { e: NavEntry; onPick: (e: NavEntry) =keywords={[e.label]}onSelect={() => onPick(e)}aria-current={useCurrent(e.href)}- className={cn("group/hit flex h-11 min-w-0 cursor-pointer items-center gap-2.5 rounded-[10px] pr-2 pl-2 md:h-10", selected)}+ className={cn("group/hit flex h-11 min-w-0 cursor-pointer items-center gap-3 rounded-[10px] pr-2 pl-2 md:h-10", selected)}><CoverThumb id={e.cover} size="row" icon={e.icon} /><span className="line-clamp-2 min-w-0 text-[13px] leading-[1.2] font-medium text-foreground group-aria-[current=page]/hit:font-semibold">diff --git a/src/components/nav/status-chips.tsx b/src/components/nav/status-chips.tsxindex ccdd67de..5a6b9be6 100644--- a/src/components/nav/status-chips.tsx+++ b/src/components/nav/status-chips.tsx@@ -52,10 +52,10 @@ export function StatusDot({ ok }: { ok: boolean | undefined }) {return <span aria-hidden className={cn("size-1.5 shrink-0 rounded-full", ok ? "bg-success" : "bg-subtle-foreground")} />;}-/** A status dot centred in a 16 px slot: the icon column of the menu's rows. */+/** A status dot centred in a slot as wide as the rows' icons (16 px in the menu, 18 px in the You sheet: --nav-icon). */function DotSlot({ ok }: { ok: boolean | undefined }) {return (- <span aria-hidden className="grid w-4 shrink-0 place-items-center">+ <span aria-hidden className="grid w-[var(--nav-icon,16px)] shrink-0 place-items-center"><StatusDot ok={ok} /></span>);diff --git a/src/components/nav/studios-sheet.tsx b/src/components/nav/studios-sheet.tsxindex 7a7589c2..82c0ba9b 100644--- a/src/components/nav/studios-sheet.tsx+++ b/src/components/nav/studios-sheet.tsx@@ -27,17 +27,17 @@ function Tile({ entry, current }: { entry: MegaItem; current: boolean }) {<IntentLinkhref={entry.href}aria-current={current ? "page" : undefined}- className="nav-row nav-mark-under group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-1.5 text-center"+ className="nav-row nav-mark-under group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-1 text-center"><span className="relative">- <CoverThumb id={entry.navCover} cover={entry.cover} icon={entry.icon} size="tile" eager className="size-13" />+ <CoverThumb id={entry.navCover} cover={entry.cover} icon={entry.icon} size="tile" eager className="size-12" />{fresh && (<span aria-hidden className="absolute -top-1 -right-1.5 rounded-full bg-highlight px-1 py-px text-[9px] leading-none font-semibold text-highlight-foreground">New</span>)}</span>- <span aria-hidden className="line-clamp-2 text-[11px] leading-[1.2] text-foreground/85 group-aria-[current=page]/tile:font-semibold group-aria-[current=page]/tile:text-foreground">+ <span aria-hidden className="line-clamp-3 min-h-[26px] text-[11px] leading-[13px] text-foreground/85 group-aria-[current=page]/tile:font-semibold group-aria-[current=page]/tile:text-foreground">{entry.short ?? entry.label}</span><span className="sr-only">@@ -85,11 +85,11 @@ function SheetSubs({ items, kind, current }: { items: MegaItem[]; kind: ViewerKifunction SeeAllTile({ href, label, name }: { href: string; label: string; name: string }) {return (<li className="min-w-0">- <IntentLink href={href} aria-label={name} className="nav-row group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-1.5 text-center text-brand-text">- <span aria-hidden className="grid size-13 place-items-center rounded-[14px] border border-dashed border-border-strong bg-brand-faint/40">+ <IntentLink href={href} aria-label={name} className="nav-row group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-1 text-center text-brand-text">+ <span aria-hidden className="grid size-12 place-items-center rounded-[14px] border border-dashed border-border-strong bg-brand-faint/40"><ArrowRight className="size-5" /></span>- <span aria-hidden className="line-clamp-2 text-[11px] leading-[1.2] font-medium">+ <span aria-hidden className="line-clamp-3 min-h-[26px] text-[11px] leading-[13px] font-medium">{label}</span></IntentLink>@@ -227,9 +227,9 @@ export function StudiosSheet({ family = "studios", group: initial, onSearch }: {) : !model ? (<ul aria-hidden className="grid grid-cols-5 gap-x-1 pb-1">{Array.from({ length: 30 }, (_, i) => (- <li key={i} className="flex flex-col items-center gap-1 px-0.5 pt-0.5 pb-1.5">- <span className="size-13 rounded-[14px] bg-muted" />- <span className="h-3 w-10 rounded bg-muted/60" />+ <li key={i} className="flex flex-col items-center gap-1 px-0.5 pt-0.5 pb-1">+ <span className="size-12 rounded-[14px] bg-muted" />+ <span className="h-[26px] w-10 rounded bg-muted/60" /></li>))}</ul>@@ -240,7 +240,7 @@ export function StudiosSheet({ family = "studios", group: initial, onSearch }: {<NewBoardButton /></Suspense>)}- <ul aria-label={area.panel} className="grid grid-cols-2 gap-x-2 gap-y-1 pb-1">+ <ul aria-label={area.panel} className="grid grid-cols-2 gap-2 pb-1">{items.map((e) => (<BoardCard key={e.id} entry={e} current={e.id === current} />))}diff --git a/tests/e2e/mega-menus.mjs b/tests/e2e/mega-menus.mjsindex babf1873..f44b040f 100644--- a/tests/e2e/mega-menus.mjs+++ b/tests/e2e/mega-menus.mjs@@ -191,6 +191,125 @@ try {}}+ // 1c. One spacing system (nav-subs.css, mega-panel.tsx): in every list column, a feature's name starts on its+ // studio's text column and the hairline ends at the last feature shown; rows 44 px (40 below lg), 4 px apart, on+ // whole pixels; a card 8 px above the next row (4 above its features), a feature list 4 px above it; See all 32 px;+ // Canvas' tiles on their column's edge and top; and no name cut beside a New badge.+ {+ const widths = {};+ for (const who of ["guest", "owner"]) {+ for (const size of [{ width: 1024, height: 768 }, ...SIZES]) {+ const ctx = await as(who, { viewport: size });+ const p = await page(ctx);+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ const label = `${who} ${size.width}x${size.height}`;+ for (const [id, m] of Object.entries(MENUS)) {+ if (size.width < m.from) continue;+ const panel = await openMenu(p, id);+ const r = await panel.evaluate((el) => {+ const vis = (n) => !!n && n.checkVisibility();+ const box = (n) => n.getBoundingClientRect();+ // Where an element's first words start (a Range on its first text node).+ const textX = (n) => {+ const w = document.createTreeWalker(n, NodeFilter.SHOW_TEXT, { acceptNode: (t) => (t.textContent.trim() && vis(t.parentElement) ? 1 : 3) });+ const t = w.nextNode();+ if (!t) return NaN;+ const rg = document.createRange();+ rg.selectNodeContents(t);+ return rg.getClientRects()[0]?.left ?? NaN;+ };+ const near = (a, b, tol = 0.75) => Math.abs(a - b) <= tol;+ const out = { text: [], line: [], gaps: [], heights: [], halves: [], cut: [], badge: [], clipped: [], seeAll: [], canvas: [], widths: [] };+ for (const group of el.querySelectorAll("[data-group]")) {+ const list = group.querySelector(":scope > ul");+ const colX = box(group).left;+ out.widths.push(box(group).width);+ // Tiles (Canvas) are checked below; the owner's Canvas column (New board, recent boards) has its own rows.+ if (!list || list.classList.contains("grid") || list.querySelector(":scope > li > button")) continue;+ let prev = null; // { kind: "card" | "row" | "subs", bottom }+ for (const li of [...list.children].filter(vis)) {+ const a = li.querySelector(":scope > a");+ if (!a) continue;+ const subs = li.querySelector(":scope > ul.nav-subs");+ const lead = a.matches('[class*="group/lead"]');+ const ab = box(a);+ if (prev) out.gaps.push({ at: a.textContent.trim().slice(0, 24), from: prev.kind, gap: +(ab.top - prev.bottom).toFixed(2), want: prev.kind === "card" ? 8 : 4 });+ if (!lead) {+ out.heights.push({ at: a.textContent.trim().slice(0, 24), h: +ab.height.toFixed(2) });+ if (Math.abs(ab.top - Math.round(ab.top)) > 0.05) out.halves.push(`${a.textContent.trim().slice(0, 24)} ${ab.top.toFixed(2)}`);+ }+ prev = { kind: lead ? "card" : "row", bottom: ab.bottom };+ const name = lead ? a.querySelector(".nav-mark-start > span > span") : a.querySelector("[data-row-name]");+ const nameX = textX(name);+ // Every row's name shows whole inside its words' box (a two-line name pushes its line out, never itself).+ const holderBox = !lead && a.querySelector("[data-row-text]");+ if (holderBox && (box(name).top < box(holderBox).top - 0.5 || box(name).bottom > box(holderBox).bottom + 0.5 || name.scrollHeight > name.clientHeight + 0.5))+ out.clipped.push(a.textContent.trim().slice(0, 30));+ if (lead) out.text.push({ at: "lead", x: +(nameX - colX).toFixed(2), want: 12 });+ // A name beside (or above) its New badge keeps all its words, and the badge shows whole.+ const badge = a.querySelector("[data-new]");+ if (badge) {+ if (name.scrollWidth > name.clientWidth + 0.5 || name.scrollHeight > name.clientHeight + 0.5) out.cut.push(a.textContent.trim().slice(0, 30));+ const holder = badge.parentElement;+ if (box(badge).bottom > box(holder).bottom + 0.5 || box(badge).right > box(holder).right + 0.5) out.badge.push(a.textContent.trim().slice(0, 30));+ }+ if (vis(subs)) {+ const first = [...subs.querySelectorAll(":scope > li > a")].find(vis);+ const links = [...subs.querySelectorAll(":scope > li")].filter(vis);+ const sb = box(subs);+ out.gaps.push({ at: `${a.textContent.trim().slice(0, 16)}'s features`, from: lead ? "card" : "row", gap: +(sb.top - ab.bottom).toFixed(2), want: lead ? 4 : 0 });+ // Under a card, or under a row without its thumbnail: the card's 12 px column; else the row's name.+ const words = a.querySelector(":scope > [data-row-text]");+ const thumb = !lead && [...a.children].some((c) => c !== words && vis(c));+ const want = lead || !thumb ? 12 : nameX - colX;+ out.text.push({ at: `${a.textContent.trim().slice(0, 16)}'s features`, x: +(textX(first) - colX).toFixed(2), want: +want.toFixed(2) });+ const before = getComputedStyle(subs, "::before");+ const lineBottom = sb.bottom - (parseFloat(before.bottom) || 0);+ const last = links.at(-1);+ if (!matchMedia("(pointer: coarse)").matches && !near(lineBottom, box(last).bottom)) out.line.push(`${a.textContent.trim().slice(0, 16)}: ${(lineBottom - box(last).bottom).toFixed(1)} past`);+ prev = { kind: "subs", bottom: box(last).bottom };+ }+ }+ }+ for (const s of el.querySelectorAll("a:not([data-sub])")) if (vis(s) && /^See all/.test(s.textContent.trim())) out.seeAll.push(+box(s).height.toFixed(2));+ // Canvas: a tile's picture on its column's edge, the first row's tops on the lead column's first item.+ const tiles = [...el.querySelectorAll("[data-group] > ul.grid")].filter(vis);+ if (tiles.length) {+ const firstItem = [...el.querySelectorAll("[data-group]")].filter((g) => !g.querySelector(":scope > ul.grid")).map((g) => [...g.querySelectorAll("a, button")].find(vis))[0];+ for (const ul of tiles) {+ const g = ul.closest("[data-group]");+ const ib = box(ul.querySelector(":scope > li > a > *"));+ out.canvas.push({ dx: +(ib.left - box(g).left).toFixed(2), top: +ib.top.toFixed(2), lead: firstItem ? +box(firstItem).top.toFixed(2) : null });+ }+ }+ return out;+ });+ const rowH = size.width >= 1024 ? 44 : 40;+ const offText = r.text.filter((t) => Math.abs(t.x - t.want) > 0.75);+ check(offText.length === 0, `${label} ${id}: features start on their studio's text column, card words 12 px in`, offText.map((t) => `${t.at} ${t.x}/${t.want}`).join(", "));+ check(r.line.length === 0, `${label} ${id}: each hairline ends at its last feature`, r.line.join(", "));+ const offGap = r.gaps.filter((g) => Math.abs(g.gap - g.want) > 0.75);+ check(offGap.length === 0, `${label} ${id}: rows 4 px apart, a card 8 (4 to its features), a feature list 4`, offGap.slice(0, 5).map((g) => `${g.at} after ${g.from} ${g.gap}/${g.want}`).join(", "));+ const offH = r.heights.filter((h) => Math.abs(h.h - rowH) > 0.5);+ check(offH.length === 0, `${label} ${id}: rows ${rowH} px tall`, offH.slice(0, 5).map((h) => `${h.at} ${h.h}`).join(", "));+ check(r.halves.length === 0, `${label} ${id}: every row on a whole pixel`, r.halves.slice(0, 4).join(", "));+ if (size.width >= 1280) check(r.cut.length === 0 && r.badge.length === 0, `${label} ${id}: no name cut beside a New badge, the badge whole`, [...r.cut, ...r.badge].join(", "));+ check(r.clipped.length === 0, `${label} ${id}: every row's name whole, none pushed out of its row`, r.clipped.join(", "));+ check(r.seeAll.every((h) => Math.abs(h - 32) <= 0.5), `${label} ${id}: every See all 32 px`, r.seeAll.join(", "));+ if (id === "canvas")+ check(r.canvas.every((c) => Math.abs(c.dx) <= 0.75 && c.lead !== null && Math.abs(c.top - c.lead) <= 0.75) || r.canvas.length === 0, `${label} canvas: tiles on their column's edge, level with the first column`, JSON.stringify(r.canvas));+ if (id === "studios") (widths[size.width] ??= []).push(...r.widths);+ await p.keyboard.press("Escape");+ await panel.waitFor({ state: "hidden" });+ }+ await ctx.close();+ }+ }+ // Wider windows never get narrower columns (the panel stops at 1440 px with one gutter).+ const w = (x) => Math.min(...(widths[x] ?? [0]));+ check(w(1920) >= w(1440) - 0.5, "Studios: columns at 1920 at least as wide as at 1440", `${w(1440).toFixed(1)} → ${w(1920).toFixed(1)}`);+ }+// 2. Keys, one panel at a time, links and See all (guest, 1440x900).{const ctx = await as("guest");@@ -488,6 +607,20 @@ try {const said = OWNER_WORDS.filter((w) => r.text.includes(w));check(said.length === 0, `${label} ${fam}: no owner-only words`, said.join(", "));}+ if (fam === "studios") {+ // The family tabs on the chips' 16 px gutter; tile rows of one height (two lines kept for every name).+ const g = await sheet.evaluate((el) => {+ const left = (sel) => el.querySelector(sel)?.getBoundingClientRect().left ?? NaN;+ const tiles = [...el.querySelectorAll('[data-sheet-family="studios"] > ul > li')].filter((li) => li.checkVisibility());+ return {+ fam: left('[role="group"][aria-label="What to show"] button'),+ chip: left('[role="group"][aria-label^="Show the studios"] button'),+ heights: [...new Set(tiles.map((li) => Math.round(li.getBoundingClientRect().height * 10) / 10))],+ };+ });+ check(Math.abs(g.fam - g.chip) <= 0.5, `${label} studios: family tabs and chips on one gutter`, `${g.fam} / ${g.chip}`);+ check(g.heights.length === 1 && g.heights[0] % 4 === 0, `${label} studios: tile rows of one height on the 4 px grid`, g.heights.join(", "));+ }if (fam !== "studios" && fam !== "canvas") {const chips = sheet.locator('[role="group"][aria-label^="Show one group"] button[aria-pressed]');await chips.nth(1).tap();@@ -506,6 +639,45 @@ try {}}+ // 5b. Phone: the You sheet's rows (status rows too) start their words on one column; a best match keeps its whole+ // name, its crumb moving to the second line.+ {+ const ctx = await as("owner", PHONE);+ const p = await page(ctx);+ await openRoute(p, `${app}/image`, { settleMs: 300 });+ await p.locator('[data-phone-tabs] [data-tab="you"]').first().tap();+ const sheet = p.locator("#phone-sheet");+ await sheet.waitFor({ state: "visible" });+ await p.waitForTimeout(800);+ const xs = await sheet.evaluate((el) =>+ [...el.querySelectorAll('a[class*="-mx-2"], button[class*="-mx-2"]')]+ .filter((n) => n.checkVisibility())+ .map((n) => {+ const w = document.createTreeWalker(n, NodeFilter.SHOW_TEXT, { acceptNode: (t) => (t.textContent.trim() && t.parentElement.checkVisibility() ? 1 : 3) });+ const t = w.nextNode();+ const rg = document.createRange();+ if (t) rg.selectNodeContents(t);+ return { at: t?.textContent.trim().slice(0, 20), x: t ? Math.round(rg.getClientRects()[0].left * 10) / 10 : NaN };+ }),+ );+ const xsOk = xs.length > 2 && Math.max(...xs.map((r) => r.x)) - Math.min(...xs.map((r) => r.x)) <= 0.75;+ check(xsOk, "phone You sheet: every row's words on one column", xs.map((r) => `${r.at} ${r.x}`).join(", "));+ await p.keyboard.press("Escape");+ await p.waitForTimeout(400);+ await p.keyboard.press("/");+ const dlg = p.getByRole("dialog");+ await dlg.waitFor({ state: "visible" });+ await p.keyboard.type("ad", { delay: 40 });+ await p.waitForTimeout(1200);+ const cut = await dlg.evaluate((el) =>+ [...el.querySelectorAll('[data-hit-name="stack"]')].filter((n) => n.checkVisibility() && n.scrollWidth > n.clientWidth + 0.5).map((n) => n.textContent.trim()),+ );+ const stacked = await dlg.locator('[data-hit-name="stack"]').count();+ check(stacked > 0 && cut.length === 0, "phone search: best matches keep their whole names", cut.join(" | ") || `${stacked} names`);+ check(ctx.errors.length === 0, "phone You sheet and search: no console errors", ctx.errors.join(" | "));+ await ctx.close();+ }+// 6. /canvas: the finished look only, nothing over the subject, no cover-less card for visitors.const gen = fs.readFileSync(path.join(root, "src/lib/template-covers.generated.ts"), "utf8");const peakAt = new Map([...gen.matchAll(/"video":"([^"?]+)[^"]*","at":([0-9.]+)/g)].map((m) => [m[1], Number(m[2])]));diff --git a/tests/e2e/nav-subfeatures.mjs b/tests/e2e/nav-subfeatures.mjsindex 240a3320..55198fe6 100644--- a/tests/e2e/nav-subfeatures.mjs+++ b/tests/e2e/nav-subfeatures.mjs@@ -169,18 +169,19 @@ try {}check((await panel(p).locator('[data-group="sell"] > ul > li > a[href="/ads"]').count()) === 0, `${label}: Ads Studio is under Marketing Studio, not a row of its own`);const allSubs = Object.values(r.subs).flat();- // 24 px with a mouse (two to a row); a name in a line 20 px, its neighbours a dot away.- const short = allSubs.filter((s) => s.h < (s.line ? 19.5 : 23.5));- check(short.length === 0, `${label}: every link 24 px tall (20 in a line)`, short.map((s) => `${s.label} ${s.h}`).join(", "));- // The columns' rows stay in line (from 800 px: below it Genjutsu's line takes what it needs): every row's top is a- // whole number of 48 px rows from the first one's.+ // 24 px with a mouse, in a column or in wrapped lines (two to a row's 48 px).+ const short = allSubs.filter((s) => s.h < 23.5);+ check(short.length === 0, `${label}: every link 24 px tall`, short.map((s) => `${s.label} ${s.h}`).join(", "));+ // The columns' rows keep one grid (from 800 px: below it Genjutsu's lines take what they need): a list ends where+ // its last feature does and the next row follows 4 px below, as rows follow rows, so every row's top is a whole+ // number of 24 px (half a row) from the first one's.if (size.width >= 1280 && size.height >= 800 && r.rows.length) {const base = Math.min(...r.rows);const off = r.rows.filter((t) => {- const m = (((t - base) % 48) + 48) % 48;- return m > 2.5 && m < 45.5;+ const m = (((t - base) % 24) + 24) % 24;+ return m > 1 && m < 23;});- check(off.length === 0, `${label}: the columns' rows stay in line`, off.map(Math.round).join(", "));+ check(off.length === 0, `${label}: the columns' rows keep one 24 px grid`, off.map(Math.round).join(", "));}if (who !== "owner") {const said = OWNER_SUBS.filter((w) => allSubs.some((s) => s.label === w));diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.tsindex c46a58e5..58d354b2 100644--- a/tests/nav-bar.test.ts+++ b/tests/nav-bar.test.ts@@ -227,7 +227,7 @@ describe("the launcher's columns", () => {expect(render(createElement(LauncherColumns, { kind: undefined, current: "genjutsu", now: 0 }))).not.toContain("data-active");});- it("gives Genjutsu's modes one wrapped line on a short window, and pads an odd list to whole rows", () => {+ it("gives Genjutsu's modes wrapped lines on a short window, and hangs a row's features on its name's column", () => {const ul = (id: string) => html.match(new RegExp(`<ul[^>]*data-subs="${id}"[^>]*>`))?.[0] ?? "";expect(ul("genjutsu")).toContain("data-subs-line");// With a mouse it never hides (the line takes over); on a touch screen it needs 1024 px.@@ -235,8 +235,11 @@ describe("the launcher's columns", () => {expect(ul("genjutsu")).toContain("[@media(pointer:coarse)_and_(max-height:1023.98px)]:hidden");expect(ul("video-tools")).toContain("[@media(max-height:879.98px)]:hidden");expect(ul("video-tools")).not.toContain("data-subs-line");- expect(ul("marketing")).toContain("data-odd");- expect(ul("audio")).not.toContain("data-odd");+ // No pad after an odd list (the next row follows 4 px below, as rows do); features under a row are marked to+ // start on its name (nav-subs.css), under a lead card on the card's words.+ expect(html).not.toContain("data-odd");+ expect(ul("genjutsu")).toContain("data-under");+ expect(ul("marketing")).not.toContain("data-under");});it("shows New badges only until their date", () => {