Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Navigation: one hover and focus style across every menu

Adarsh244a64d637d1
diff --git a/src/app/globals.css b/src/app/globals.css
index f7b6eecc..9cbdc703 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -1,8 +1,18 @@
@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";
+@import "./nav-states.css";
@custom-variant dark (&:is(.dark *));
+/* Hover for the app frame's controls: like hover:, but only while the mouse leads (nav-states.css), so a control under a
+ resting mouse never shows a second highlight beside the keyboard's. */
+@custom-variant nav-hover {
+ @media (hover: hover) {
+ &:is(html:not([data-input="keyboard"]) *):hover {
+ @slot;
+ }
+ }
+}
:root {
--radius: 0.625rem; /* 10px = Liner radius-medium. With the multipliers below: sm 6, md 8, lg 10, xl 14 */
diff --git a/src/app/nav-states.css b/src/app/nav-states.css
new file mode 100644
index 00000000..e0346897
--- /dev/null
+++ b/src/app/nav-states.css
@@ -0,0 +1,152 @@
+/* ---------------------------------------------------------------------------------------------
+ * Navigation states: one system for every row, item, tab and tile of the app frame (the top bar,
+ * its menus and launcher, search, the Home goal row, the phone's tabs and sheets).
+ *
+ * highlight the one row the pointer is on, or the one keyboard focus is on: --nav-hi fill.
+ * Never both: moving the mouse hands the highlight to the pointer, a key hands it
+ * back (html[data-input], set by nav/input-modality.ts; before any input both may show). In menus and search
+ * the mouse moves the keyboard's own highlight (Radix data-highlighted, cmdk data-selected), so CSS :hover
+ * never paints their items: the list's one highlight stays where the mouse or the keys left it.
+ * Controls outside .nav-row hover with the nav-hover: variant (globals.css), which follows the same lead.
+ * focus ring keyboard only: 2 px --ring outline drawn inside the item (never bleeds into a gutter).
+ * Filled buttons (.nav-focus-out) draw it 2 px outside instead.
+ * pressed --nav-press fill while the mouse button or finger is down (no grey tap flash).
+ * current the open page: never a fill. A 3 px --nav-mark pip (.nav-mark-start on rows,
+ * .nav-mark-under on bar items and tiles), the icon in --nav-mark, the label semibold.
+ * open a bar trigger whose menu is open: foreground words and the turned chevron, never a fill (the menu's
+ * highlighted row is the one fill on screen).
+ * disabled aria-disabled=true / data-disabled (Radix "", cmdk "true") / :disabled: 45 % opacity, no
+ * highlight, no press.
+ *
+ * Unlayered on purpose: it wins over the utilities a primitive brings (focus:bg-accent), so every
+ * surface shows the same states whatever its markup.
+ * ------------------------------------------------------------------------------------------- */
+:root {
+ --nav-hi: oklch(0.235 0.002 286 / 6%);
+ --nav-press: oklch(0.235 0.002 286 / 11%);
+ --nav-mark: var(--brand-text);
+}
+.dark {
+ --nav-hi: oklch(1 0 0 / 8%);
+ --nav-press: oklch(1 0 0 / 13%);
+}
+
+.nav-row,
+.nav-focus,
+.nav-focus-out {
+ outline: none;
+ -webkit-tap-highlight-color: transparent;
+}
+.nav-row {
+ position: relative;
+}
+@media (prefers-reduced-motion: no-preference) {
+ .nav-row {
+ transition: background-color 120ms ease, color 120ms ease;
+ }
+}
+
+/* Highlight: the pointer's row (devices that hover, while the mouse leads) ... */
+@media (hover: hover) {
+ html:not([data-input="keyboard"]) .nav-row:not([cmdk-item], [role^="menuitem"], :disabled, [aria-disabled="true"], [data-disabled=""], [data-disabled="true"]):hover {
+ background-color: var(--nav-hi);
+ }
+}
+/* ... or the keyboard's (and a menu's own highlighted row, which the mouse moves too). */
+html:not([data-input="pointer"]) .nav-row:focus-visible,
+.nav-row[data-highlighted],
+.nav-row[data-selected="true"] {
+ background-color: var(--nav-hi);
+}
+
+/* Pressed (as specific as the hover rule, and after it: it wins while the button or finger is down). */
+html .nav-row:not(:disabled, [aria-disabled="true"], [data-disabled=""], [data-disabled="true"]):active:active {
+ background-color: var(--nav-press);
+}
+
+/* Focus ring: keyboard only, inside the item. */
+html:not([data-input="pointer"]) :is(.nav-row, .nav-focus):focus-visible,
+html:not([data-input="pointer"]) .nav-row:is([data-highlighted], [data-selected="true"]) {
+ outline: 2px solid var(--ring);
+ outline-offset: -2px;
+}
+html:not([data-input="pointer"]) .nav-focus-out:focus-visible {
+ outline: 2px solid var(--ring);
+ outline-offset: 2px;
+}
+
+/* Disabled. */
+.nav-row:is(:disabled, [aria-disabled="true"], [data-disabled=""], [data-disabled="true"]) {
+ opacity: 0.45;
+ cursor: not-allowed;
+}
+
+/* Current page (aria-current, data-current; data-active on a bar menu that holds the page): a pip, never a fill. The pip holder is the row itself or a part of it (a card's text). */
+.nav-mark-start,
+.nav-mark-under {
+ position: relative;
+}
+:is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active]) :is(.nav-mark-start, .nav-mark-under)::before,
+:is(.nav-mark-start, .nav-mark-under):is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active])::before {
+ content: "";
+ position: absolute;
+ border-radius: 9999px;
+ background-color: var(--nav-mark);
+ pointer-events: none;
+}
+:is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active]) .nav-mark-start::before,
+.nav-mark-start:is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active])::before {
+ inset-inline-start: 0;
+ top: 50%;
+ width: 3px;
+ height: 16px;
+ margin-top: -8px;
+}
+:is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active]) .nav-mark-under::before,
+.nav-mark-under:is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active])::before {
+ bottom: 3px;
+ left: 50%;
+ width: 16px;
+ height: 3px;
+ margin-left: -8px;
+}
+:is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active]) .nav-icon,
+.nav-mark-start:is(.nav-row[aria-current="page"], .nav-row[data-current]) > svg:first-child {
+ color: var(--nav-mark);
+}
+/* A split bar item (a name and a chevron: Create, Studios, Motions & effects): the pip sits under the whole pill, as under
+ a plain item with a chevron, inside the area or on its own page. */
+[data-bar-split].nav-mark-under:is([data-active], :has(> [aria-current="page"]))::before {
+ content: "";
+ position: absolute;
+ bottom: 3px;
+ left: 50%;
+ width: 16px;
+ height: 3px;
+ margin-left: -8px;
+ border-radius: 9999px;
+ background-color: var(--nav-mark);
+ pointer-events: none;
+}
+/* More, below 1280 px, holds Apps and Motions & effects: their page marks it there. */
+@media (max-width: 1279.98px) {
+ .nav-row.nav-mark-under[data-narrow]::before {
+ content: "";
+ position: absolute;
+ bottom: 3px;
+ left: 50%;
+ width: 16px;
+ height: 3px;
+ margin-left: -8px;
+ border-radius: 9999px;
+ background-color: var(--nav-mark);
+ pointer-events: none;
+ }
+}
+@media (forced-colors: active) {
+ [data-bar-split].nav-mark-under:is([data-active], :has(> [aria-current="page"]))::before,
+ :is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active]) :is(.nav-mark-start, .nav-mark-under)::before,
+ :is(.nav-mark-start, .nav-mark-under):is(.nav-row[aria-current="page"], .nav-row[data-current], .nav-row[data-active])::before {
+ background-color: Highlight;
+ }
+}
diff --git a/src/components/ads/ads-home.tsx b/src/components/ads/ads-home.tsx
index 5aaccec2..48817938 100644
--- a/src/components/ads/ads-home.tsx
+++ b/src/components/ads/ads-home.tsx
@@ -120,7 +120,7 @@ export function AdsHome({ examples, starters = [] }: { examples?: ExampleRowData
return (
<div className="flex min-h-content min-w-0 flex-col">
<MarketingHeader title="Ads Studio" active="ads" engine={engine} onEngine={setEngine} />
- <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 px-3 pb-20 sm:px-6">
+ <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 px-4 pb-20 sm:px-6">
<section className="mx-auto max-w-[720px] pt-8 text-center sm:pt-14">
<h2 className="font-heading text-display text-balance">Static ads that perform</h2>
<p className="mx-auto mt-2 max-w-lg text-[15px] text-muted-foreground">Enter your website. Your logo, colours, brand voice and selling points load on their own — then on-brand ads for every product, in 1:1, 4:5 and 9:16, with headlines and CTAs.</p>
diff --git a/src/components/ads/brand-workspace.tsx b/src/components/ads/brand-workspace.tsx
index b7d7796f..099711a2 100644
--- a/src/components/ads/brand-workspace.tsx
+++ b/src/components/ads/brand-workspace.tsx
@@ -98,7 +98,7 @@ export function BrandWorkspace({ brandId }: { brandId: string }) {
<Suspense fallback={null}>
<StepFromUrl onStep={setStep} />
</Suspense>
- <div className="mx-auto flex w-full min-w-0 max-w-[1440px] flex-1 gap-6 px-3 pt-5 pb-16 sm:px-6">
+ <div className="mx-auto flex w-full min-w-0 max-w-[1440px] flex-1 gap-6 px-4 pt-5 pb-16 sm:px-6">
<div className="min-w-0 flex-1">
<Link href="/ads" className="mb-4 inline-flex items-center gap-1 text-[13px] text-muted-foreground hover:text-foreground">
<ArrowLeft className="size-3.5" /> All brands
@@ -176,7 +176,7 @@ export function BrandWorkspace({ brandId }: { brandId: string }) {
</>
)}
</div>
- {chatReady && <div className="sticky top-[calc(var(--chrome-top)+7rem)] hidden h-[calc(var(--content-h)-8rem)] w-[340px] shrink-0 xl:block">{chatPanel(false)}</div>}
+ {chatReady && <div className="sticky top-[calc(var(--chrome-top)+1rem)] hidden h-[calc(var(--content-h)-2rem)] w-[340px] shrink-0 xl:block">{chatPanel(false)}</div>}
</div>
<Sheet open={chat} onOpenChange={setChat}>
<SheetContent side="right" showCloseButton={false} className="w-full gap-0 p-0 sm:max-w-md">
diff --git a/src/components/ads/multiplier.tsx b/src/components/ads/multiplier.tsx
index aee30e36..649cd450 100644
--- a/src/components/ads/multiplier.tsx
+++ b/src/components/ads/multiplier.tsx
@@ -315,7 +315,7 @@ export function AdMultiplier({ models, examples }: { models: Record<string, Mode
return (
<div className="flex min-h-content min-w-0 flex-col">
<MarketingHeader title="Ad Multiplier" active="multiplier" engine={engine} onEngine={setEngine} />
- <div className="mx-auto w-full min-w-0 max-w-[1180px] flex-1 px-3 pt-6 pb-20 sm:px-6 sm:pt-10">
+ <div className="mx-auto w-full min-w-0 max-w-[1180px] flex-1 px-4 pt-6 pb-20 sm:px-6 sm:pt-10">
<div className="pb-6 text-center">
<h2 className="font-heading text-display text-balance">Turn one winning ad into many</h2>
<p className="mx-auto mt-2 max-w-xl text-[15px] text-muted-foreground">Upload an ad that works. Recreate it with new people, products or places — or keep it and try a new hook or call to action.</p>
diff --git a/src/components/any-angle/any-angle-tool.tsx b/src/components/any-angle/any-angle-tool.tsx
index 1a399de3..aaa5528b 100644
--- a/src/components/any-angle/any-angle-tool.tsx
+++ b/src/components/any-angle/any-angle-tool.tsx
@@ -744,7 +744,7 @@ export function AnyAngleTool({ app }: { app?: { name: string } }) {
<h3 id="any-angle-results" className="mb-2 inline-flex items-center gap-1.5 text-[13px] font-semibold">
<Images className="size-3.5" /> Your angles
</h3>
- <div className="-mx-3 flex snap-x gap-3 overflow-x-auto px-3 pb-2 sm:-mx-6 sm:px-6">
+ <div className="-mx-4 flex snap-x gap-3 overflow-x-auto px-4 pb-2 sm:-mx-6 sm:px-6">
{shots.map((g) => (
<ShotCard key={g.id} g={g} original={ref} onAgain={again} />
))}
diff --git a/src/components/areas/area-islands.tsx b/src/components/areas/area-islands.tsx
index 4591881d..847665d9 100644
--- a/src/components/areas/area-islands.tsx
+++ b/src/components/areas/area-islands.tsx
@@ -97,7 +97,7 @@ export function AreaTabs({ tabs, label }: { tabs: AreaTab[]; label: string }) {
aria-label={label}
// Under the phone's bar (48 px and the notch), or the desktop's (top-chrome). Its background and lower rule reach
// the screen's edges (shadows clipped to its own height), so cards scrolling under it never show at its sides.
- className="sticky top-[calc(3rem+env(safe-area-inset-top))] z-10 mt-5 flex h-[52px] items-stretch border-y bg-background shadow-[0_0_0_100vmax_var(--background),0_1px_0_100vmax_var(--border)] [clip-path:inset(0_-100vmax_-1px)] max-sm:-mx-4 md:top-chrome"
+ className="sticky top-[calc(3.5rem+env(safe-area-inset-top))] z-10 mt-5 flex h-[52px] items-stretch border-y bg-background shadow-[0_0_0_100vmax_var(--background),0_1px_0_100vmax_var(--border)] [clip-path:inset(0_-100vmax_-1px)] max-sm:-mx-4 md:top-chrome"
>
<div ref={strip} className="fade-x scrollbar-none relative flex min-w-0 flex-1 snap-x items-stretch gap-0.5 overflow-x-auto max-sm:px-1">
{tabs.map((t) => {
diff --git a/src/components/areas/area-page.tsx b/src/components/areas/area-page.tsx
index 7f7b0d06..6c79600c 100644
--- a/src/components/areas/area-page.tsx
+++ b/src/components/areas/area-page.tsx
@@ -19,10 +19,10 @@ import { AreaSearch, AreaTabs, JumpBackIn, OwnerPills, type AreaTab } from "./ar
/**
* Each section's space under the one before, as Home's (without Home's content-visibility, which needs a known height).
- * A jump to it stops under the bar and the tabs: the phone's bar and the tabs (100 px) and the notch; from md the page
+ * A jump to it stops under the bar and the tabs: the phone's bar and the tabs (108 px) and the notch; from md the page
* already keeps the bar's 56 px clear (scroll-padding), so the tabs' 52 px and a little air.
*/
-export const AREA_SECTION = "-mx-4 mt-8 -mb-2 scroll-mt-[calc(6.75rem+env(safe-area-inset-top))] px-4 py-2 sm:mt-12 md:scroll-mt-16";
+export const AREA_SECTION = "-mx-4 mt-8 -mb-2 scroll-mt-[calc(7.25rem+env(safe-area-inset-top))] px-4 py-2 sm:mt-12 md:scroll-mt-16";
/** The area page's heading: its name and count, its line, and its search (Create, Studios) beside it, or under it on a phone. */
export function AreaHero({ id, count, search, action }: { id: AreaId; count: number; search?: string[]; action?: React.ReactNode }) {
diff --git a/src/components/assist-view.tsx b/src/components/assist-view.tsx
index e30c2259..b72b66ca 100644
--- a/src/components/assist-view.tsx
+++ b/src/components/assist-view.tsx
@@ -151,7 +151,7 @@ export function AssistView() {
return (
<div className="flex h-content min-w-0 flex-col">
- <header className="flex h-14 shrink-0 items-center gap-1.5 px-3 sm:px-6">
+ <header className="flex h-14 shrink-0 items-center gap-1.5 px-4 sm:px-6">
<RailButton />
<div className="flex min-w-0 flex-1 items-center gap-2">
{project && (
@@ -196,7 +196,7 @@ export function AssistView() {
</header>
{!id ? (
- <div className="flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-3 pt-[10vh] pb-16 sm:px-6 sm:pt-[14vh]">
+ <div className="flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-4 pt-[10vh] pb-16 sm:px-6 sm:pt-[14vh]">
<div className="w-full max-w-[760px]">
<div className="mb-6 text-center">
<h2 className="font-heading text-display text-balance">What are we creating today?</h2>
@@ -228,7 +228,7 @@ export function AssistView() {
</div>
) : (
<>
- <div className="min-h-0 flex-1 overflow-y-auto px-3 sm:px-6">
+ <div className="min-h-0 flex-1 overflow-y-auto px-4 sm:px-6">
<div className="mx-auto w-full max-w-[760px] py-4">
{view.isError ? (
<div className="py-20 text-center">
@@ -245,7 +245,7 @@ export function AssistView() {
<div ref={end} className="h-4" />
</div>
</div>
- <div className="shrink-0 px-3 pb-[max(1rem,env(safe-area-inset-bottom))] sm:px-6">
+ <div className="shrink-0 px-4 pb-[max(1rem,env(safe-area-inset-bottom))] sm:px-6">
<div className="mx-auto w-full max-w-[760px]">
<AssistComposer
skills={available}
diff --git a/src/components/assist/memory-view.tsx b/src/components/assist/memory-view.tsx
index 872ee1ba..98bb1921 100644
--- a/src/components/assist/memory-view.tsx
+++ b/src/components/assist/memory-view.tsx
@@ -66,7 +66,7 @@ export function MemoryView({ projectId }: { projectId?: string } = {}) {
return (
<div className={cn("flex min-w-0 flex-col", !projectId && "min-h-content")}>
{!projectId && (
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-4 backdrop-blur sm:px-6">
<RailButton />
<h1 className="font-heading text-[22px] leading-none">Memory</h1>
{owner && (
@@ -83,7 +83,7 @@ export function MemoryView({ projectId }: { projectId?: string } = {}) {
<PhoneNavButton />
</header>
)}
- <div className={cn("w-full max-w-[900px] min-w-0 flex-1 px-3 pb-16 sm:px-6", projectId ? "pt-2" : "pt-4 md:pt-8")}>
+ <div className={cn("w-full max-w-[900px] min-w-0 flex-1 px-4 pb-16 sm:px-6", projectId ? "pt-2" : "pt-4 md:pt-8")}>
{!projectId && <p className="max-w-2xl text-[15px] text-pretty text-muted-foreground">Learning from every chat. Assist follows these in every reply, and saves new ones when you tell it something worth keeping{" "}— it asks first while Ask first is on.</p>}
{!projectId && <AssistVisitorNote className="mt-4 max-w-2xl" />}
{projectId && (
diff --git a/src/components/assist/project-view.tsx b/src/components/assist/project-view.tsx
index 65c7a960..5634a465 100644
--- a/src/components/assist/project-view.tsx
+++ b/src/components/assist/project-view.tsx
@@ -98,7 +98,7 @@ function Project({ p }: { p: AssistProject }) {
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-4 backdrop-blur sm:px-6">
<RailButton />
<ProjectDot project={p} className="ml-1" />
<h1 className="min-w-0 truncate font-heading text-[22px] leading-none">{p.name}</h1>
@@ -121,7 +121,7 @@ function Project({ p }: { p: AssistProject }) {
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[860px] min-w-0 flex-1 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full max-w-[860px] min-w-0 flex-1 px-4 pb-16 sm:px-6">
<div className="mx-auto max-w-[760px] pt-[6vh] sm:pt-[9vh]">
<h2 className="text-center font-heading text-display text-balance">What are we creating in {p.name}?</h2>
<button onClick={() => setSettings(true)} className="mx-auto mt-2 block max-w-xl text-center text-[14px] text-pretty text-muted-foreground hover:text-foreground">
@@ -187,10 +187,10 @@ function Project({ p }: { p: AssistProject }) {
<TabsContent value="sources">
<Sources p={p} />
</TabsContent>
- <TabsContent value="memory" className="-mx-3 sm:-mx-6">
+ <TabsContent value="memory" className="-mx-4 sm:-mx-6">
<MemoryView projectId={p.id} />
</TabsContent>
- <TabsContent value="scheduled" className="-mx-3 sm:-mx-6">
+ <TabsContent value="scheduled" className="-mx-4 sm:-mx-6">
<ScheduledView projectId={p.id} />
</TabsContent>
</Tabs>
diff --git a/src/components/assist/scheduled-view.tsx b/src/components/assist/scheduled-view.tsx
index 85e98cab..9ba3b6e4 100644
--- a/src/components/assist/scheduled-view.tsx
+++ b/src/components/assist/scheduled-view.tsx
@@ -56,7 +56,7 @@ export function ScheduledView({ projectId }: { projectId?: string } = {}) {
return (
<div className={cn("flex min-w-0 flex-col", !projectId && "min-h-content")}>
{!projectId && (
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-4 backdrop-blur sm:px-6">
<RailButton />
<h1 className="font-heading text-[22px] leading-none">Scheduled</h1>
{owner && (
@@ -70,7 +70,7 @@ export function ScheduledView({ projectId }: { projectId?: string } = {}) {
<PhoneNavButton />
</header>
)}
- <div className={cn("w-full max-w-[900px] min-w-0 flex-1 px-3 pb-16 sm:px-6", projectId ? "pt-2" : "pt-4 md:pt-8")}>
+ <div className={cn("w-full max-w-[900px] min-w-0 flex-1 px-4 pb-16 sm:px-6", projectId ? "pt-2" : "pt-4 md:pt-8")}>
{!projectId ? (
<>
<p className="max-w-2xl text-[15px] text-pretty text-muted-foreground">
diff --git a/src/components/assist/skills-view.tsx b/src/components/assist/skills-view.tsx
index 142e355b..d12308ee 100644
--- a/src/components/assist/skills-view.tsx
+++ b/src/components/assist/skills-view.tsx
@@ -106,7 +106,7 @@ function Skills() {
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-4 backdrop-blur sm:px-6">
<RailButton />
<h1 className="font-heading text-[22px] leading-none">Skills</h1>
{owner && (
@@ -133,7 +133,7 @@ function Skills() {
)}
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1100px] min-w-0 flex-1 px-3 pt-4 pb-16 sm:px-6 md:pt-8">
+ <div className="mx-auto w-full max-w-[1100px] min-w-0 flex-1 px-4 pt-4 pb-16 sm:px-6 md:pt-8">
<p className="max-w-2xl text-[15px] text-pretty text-muted-foreground">
Playbooks Assist loads for whole kinds of jobs. Type <span className="rounded bg-muted px-1 font-mono text-[13px]">/name</span> at the start of a message to use one, or let Assist pick it. Skills also reach other agents through Fuobe&apos;s MCP server.
</p>
diff --git a/src/components/av/tool-shell.tsx b/src/components/av/tool-shell.tsx
index f44a917a..8adaaac3 100644
--- a/src/components/av/tool-shell.tsx
+++ b/src/components/av/tool-shell.tsx
@@ -33,7 +33,7 @@ export function ToolShell({
}) {
const [engine, setEngine] = useEngine();
const inHub = useInHub();
- const body = <div className={cn("mx-auto w-full min-w-0 flex-1 px-3 pb-16 sm:px-6", wide ? "max-w-[1240px]" : "max-w-[1040px]")}>{children}</div>;
+ const body = <div className={cn("mx-auto w-full min-w-0 flex-1 px-4 pb-16 sm:px-6", wide ? "max-w-[1240px]" : "max-w-[1040px]")}>{children}</div>;
if (inHub)
return (
<>
@@ -43,8 +43,8 @@ export function ToolShell({
);
return (
<div className="flex min-h-content min-w-0 flex-col">
- <div className="sticky top-chrome z-20 bg-background/85 backdrop-blur">
- <header className="flex h-14 items-center gap-2 px-3 sm:px-6">
+ <div className="max-md:sticky top-chrome z-20 bg-background/85 backdrop-blur">
+ <header className="flex h-14 items-center gap-2 px-4 sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-[1.15]">{title}</h1>
<div className="ml-auto flex shrink-0 items-center gap-2">
{header}
diff --git a/src/components/captions/captions-studio.tsx b/src/components/captions/captions-studio.tsx
index c275d282..0a17db2a 100644
--- a/src/components/captions/captions-studio.tsx
+++ b/src/components/captions/captions-studio.tsx
@@ -207,7 +207,7 @@ function Editor({ video, restored, onReplace }: { video: SlotValue; restored: Sa
return (
<div className="grid gap-4 pt-4 lg:grid-cols-[minmax(0,6fr)_minmax(0,5fr)]">
- <div className="min-w-0 space-y-3 lg:sticky lg:top-[calc(var(--chrome-top)+5rem)] lg:self-start">
+ <div className="min-w-0 space-y-3 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)] lg:self-start">
<Preview video={video} cues={cues} look={lookFor(route, look)} route={route} player={player} onTime={setTime} onDuration={setDuration} />
<div className="flex flex-wrap items-center gap-1.5">
<p className="min-w-0 flex-1 truncate text-[13px] text-muted-foreground">{video.name}</p>
diff --git a/src/components/cinema/workspace.tsx b/src/components/cinema/workspace.tsx
index ea3e6183..f1c9c712 100644
--- a/src/components/cinema/workspace.tsx
+++ b/src/components/cinema/workspace.tsx
@@ -550,7 +550,7 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG
addRefs(e.dataTransfer.files);
}}
>
- <div className="min-h-0 flex-1 overflow-y-auto px-3 pt-4 pb-6 sm:px-6">
+ <div className="min-h-0 flex-1 overflow-y-auto px-4 pt-4 pb-6 sm:px-6">
{currentView.kind === "elements" ? (
<ElementsPanel onMention={mention} onCast={() => setCastOpen(true)} onLocation={() => setLocationOpen(true)} />
) : loading ? (
diff --git a/src/components/color-grade-view.tsx b/src/components/color-grade-view.tsx
index 472e0af6..2191dee8 100644
--- a/src/components/color-grade-view.tsx
+++ b/src/components/color-grade-view.tsx
@@ -433,7 +433,7 @@ function Grader() {
return (
<div className="flex flex-col lg:h-content">
- <header className="flex h-14 shrink-0 items-center gap-2 px-3 sm:px-6">
+ <header className="flex h-14 shrink-0 items-center gap-2 px-4 sm:px-6">
<h1 className="font-heading text-[22px] leading-none">Color grading</h1>
<span className="ml-2 hidden rounded-full bg-success/15 px-2 py-0.5 text-[11px] font-medium text-success sm:inline">Free · runs in your browser</span>
<div className="ml-auto flex items-center gap-2">
@@ -441,7 +441,7 @@ function Grader() {
</div>
<PhoneNavButton />
</header>
- <div className="flex min-h-0 flex-1 flex-col gap-3 px-3 pb-3 sm:px-6 lg:flex-row">
+ <div className="flex min-h-0 flex-1 flex-col gap-3 px-4 pb-3 sm:px-6 lg:flex-row">
<div
ref={box}
className={cn(
diff --git a/src/components/content-factory/home.tsx b/src/components/content-factory/home.tsx
index 59930cde..85deeeb6 100644
--- a/src/components/content-factory/home.tsx
+++ b/src/components/content-factory/home.tsx
@@ -240,14 +240,14 @@ export function ContentFactoryHome({ voices, starters = [], fills = {} }: { voic
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="truncate font-heading text-[22px] leading-none">Content Factory</h1>
<div className="ml-auto">
<EngineSwitch value={engine} onChange={setEngine} selfHostedOnly />
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-12 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-12 px-4 pb-16 sm:px-6">
<div className="mx-auto max-w-[780px] pt-[5vh] text-center sm:pt-[8vh]">
<h2 className="font-heading text-display text-balance">Faceless shorts in the style of a video you love</h2>
<p className="mx-auto mt-2 max-w-[600px] text-body text-muted-foreground">Show it a reference, say what to make, and get a whole series: script, narrator, pictures, motion, music and captions that follow the same pacing and look.</p>
diff --git a/src/components/content-factory/series-view.tsx b/src/components/content-factory/series-view.tsx
index e195be98..b6fbd271 100644
--- a/src/components/content-factory/series-view.tsx
+++ b/src/components/content-factory/series-view.tsx
@@ -53,7 +53,7 @@ export function SeriesView({ id, voices }: { id: string; voices: PickerData["voi
);
const header = (
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<Link href="/content-factory" className="inline-flex min-w-0 items-center gap-1.5 text-[13px] text-muted-foreground hover:text-foreground">
<ArrowLeft className="size-4 shrink-0" /> <span className="truncate">Content Factory</span>
</Link>
@@ -76,7 +76,7 @@ export function SeriesView({ id, voices }: { id: string; voices: PickerData["voi
return (
<div className="flex min-h-content min-w-0 flex-col">
{header}
- <div className="mx-auto w-full max-w-[640px] px-3 pt-16 text-center sm:px-6">
+ <div className="mx-auto w-full max-w-[640px] px-4 pt-16 text-center sm:px-6">
<h1 className="font-heading text-[28px]">{error ? "Series not found" : orphan ? "This series' channel was deleted" : "This series hasn't been made yet"}</h1>
<p className="mt-2 text-[14px] text-muted-foreground">
{error
@@ -106,7 +106,7 @@ export function SeriesView({ id, voices }: { id: string; voices: PickerData["voi
return (
<div className="flex min-h-content min-w-0 flex-col">
{header}
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-8 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-8 px-4 pb-16 sm:px-6">
{isLoading || !s || !channel || !settings ? (
<div className="space-y-4 pt-6">
<Skeleton className="h-9 w-72 max-w-full" />
diff --git a/src/components/dub/dub-studio.tsx b/src/components/dub/dub-studio.tsx
index 69e0bdd4..00642d50 100644
--- a/src/components/dub/dub-studio.tsx
+++ b/src/components/dub/dub-studio.tsx
@@ -480,7 +480,7 @@ function SessionView({ s, onBack }: { s: DubSessionView; onBack: () => void }) {
</div>
<div className="grid gap-4 lg:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]">
- <div className="space-y-3 lg:sticky lg:top-[calc(var(--chrome-top)+5rem)] lg:self-start">
+ <div className="space-y-3 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)] lg:self-start">
<div className="overflow-hidden rounded-2xl border bg-media">
<video ref={video} src={s.video} controls playsInline preload="metadata" onTimeUpdate={(e) => setTime(e.currentTarget.currentTime)} className="max-h-[42vh] w-full object-contain" />
</div>
diff --git a/src/components/evolution/evolution-tool.tsx b/src/components/evolution/evolution-tool.tsx
index a188c202..f74c8e69 100644
--- a/src/components/evolution/evolution-tool.tsx
+++ b/src/components/evolution/evolution-tool.tsx
@@ -244,7 +244,7 @@ export function EvolutionTool() {
</Panel>
</div>
- <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+112px)]">
+ <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)]">
<Field label="How much should change?">
<Segmented label="How much should change?" value={intensity} onChange={setIntensity} options={INTENSITIES.map((i) => ({ value: i.id, label: i.label }))} />
<p className="text-[12px] text-muted-foreground" aria-live="polite">
diff --git a/src/components/explainer/explainer-studio.tsx b/src/components/explainer/explainer-studio.tsx
index 8e999ff7..ec92ebd3 100644
--- a/src/components/explainer/explainer-studio.tsx
+++ b/src/components/explainer/explainer-studio.tsx
@@ -306,15 +306,15 @@ export function ExplainerStudio({ picker, starters = [], fills = {} }: { picker:
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="truncate font-heading text-[22px] leading-none">Explainer</h1>
<div className="ml-auto">
<EngineSwitch value={engine} onChange={setEngine} selfHostedOnly />
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto grid w-full max-w-[1240px] min-w-0 flex-1 gap-8 px-3 pt-6 pb-16 sm:px-6 lg:grid-cols-[minmax(0,520px)_minmax(0,1fr)]">
- <section aria-label="New explainer" className="min-w-0 lg:sticky lg:top-[calc(var(--chrome-top)+5rem)] lg:self-start">
+ <div className="mx-auto grid w-full max-w-[1240px] min-w-0 flex-1 gap-8 px-4 pt-6 pb-16 sm:px-6 lg:grid-cols-[minmax(0,520px)_minmax(0,1fr)]">
+ <section aria-label="New explainer" className="min-w-0 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)] lg:self-start">
<div className="rounded-[20px] border bg-background p-3 shadow-soft transition-[border-color,box-shadow] focus-within:border-primary focus-within:ring-4 focus-within:ring-brand-faint sm:rounded-composer sm:p-4">
<p className="px-1 text-[11px] font-semibold tracking-[0.14em] text-muted-foreground uppercase">Fuobe Explainer</p>
<div className="mt-2 flex items-center gap-3 rounded-2xl bg-muted/60 p-2">
diff --git a/src/components/faceless/channel-view.tsx b/src/components/faceless/channel-view.tsx
index 3338b47c..d2272f55 100644
--- a/src/components/faceless/channel-view.tsx
+++ b/src/components/faceless/channel-view.tsx
@@ -138,13 +138,13 @@ export function ChannelView({ id, picker }: { id: string; picker: PickerData })
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<Link href="/faceless" className="inline-flex min-w-0 items-center gap-1.5 text-[13px] text-muted-foreground hover:text-foreground">
<ArrowLeft className="size-4 shrink-0" /> <span className="truncate">Faceless Studio</span>
</Link>
<PhoneNavButton className="ml-auto" />
</header>
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-8 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-8 px-4 pb-16 sm:px-6">
{isLoading || !channel ? (
<div className="space-y-4 pt-6">
<div className="flex items-center gap-4">
diff --git a/src/components/faceless/episode-view.tsx b/src/components/faceless/episode-view.tsx
index 66ec3bea..3e738105 100644
--- a/src/components/faceless/episode-view.tsx
+++ b/src/components/faceless/episode-view.tsx
@@ -422,7 +422,7 @@ function Timeline({ view, onOpen }: { view: View; onOpen: (g: Generation) => voi
</Button>
</div>
</div>
- <div className="scrollbar-none -mx-3 flex gap-2 overflow-x-auto px-3 pb-1 sm:-mx-0 sm:px-0" role="group" aria-label="Scenes">
+ <div className="scrollbar-none -mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:-mx-0 sm:px-0" role="group" aria-label="Scenes">
{scenes.map((s) => (
<SceneTile key={s.id} scene={s} selected={selected.includes(s.id)} onSelect={(e) => pick(s.index, e)} aspect={ep.settings.aspect} />
))}
@@ -484,7 +484,7 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<Link href={backHref} className="inline-flex min-w-0 shrink items-center gap-1.5 text-[13px] text-muted-foreground hover:text-foreground">
<ArrowLeft className="size-4 shrink-0" />
<span className="truncate">{view?.channel?.name ?? backLabel}</span>
@@ -543,7 +543,7 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
)}
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1100px] min-w-0 flex-1 space-y-6 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full max-w-[1100px] min-w-0 flex-1 space-y-6 px-4 pb-16 sm:px-6">
{isLoading || !view || !ep ? (
<div className="space-y-4 pt-6">
<Skeleton className="h-8 w-96 max-w-full" />
diff --git a/src/components/faceless/episode-wizard.tsx b/src/components/faceless/episode-wizard.tsx
index cfad96a6..1e0a60b8 100644
--- a/src/components/faceless/episode-wizard.tsx
+++ b/src/components/faceless/episode-wizard.tsx
@@ -174,7 +174,7 @@ export function EpisodeWizard({ channelId, picker, initialTopic }: { channelId:
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<Link href={`/faceless/${channelId}`} className="inline-flex min-w-0 items-center gap-1.5 text-[13px] text-muted-foreground hover:text-foreground">
<ArrowLeft className="size-4 shrink-0" />
<span className="truncate">{channel?.name ?? "Channel"}</span>
@@ -184,7 +184,7 @@ export function EpisodeWizard({ channelId, picker, initialTopic }: { channelId:
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[920px] min-w-0 flex-1 px-3 pb-32 sm:px-6">
+ <div className="mx-auto w-full max-w-[920px] min-w-0 flex-1 px-4 pb-32 sm:px-6">
<div className="flex flex-wrap items-center justify-between gap-3 pt-6">
<Steps step={step} />
</div>
@@ -353,7 +353,7 @@ export function EpisodeWizard({ channelId, picker, initialTopic }: { channelId:
{channel && settings && (
<div className="sticky bottom-chrome z-20 border-t bg-background/90 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur">
- <div className="mx-auto flex w-full max-w-[920px] min-w-0 flex-wrap items-center gap-3 px-3 pt-3 sm:px-6">
+ <div className="mx-auto flex w-full max-w-[920px] min-w-0 flex-wrap items-center gap-3 px-4 pt-3 sm:px-6">
{step === 2 ? (
<>
<Button variant="ghost" onClick={() => setStep(1)}>
diff --git a/src/components/faceless/faceless-home.tsx b/src/components/faceless/faceless-home.tsx
index ab675c86..f608ce9b 100644
--- a/src/components/faceless/faceless-home.tsx
+++ b/src/components/faceless/faceless-home.tsx
@@ -81,14 +81,14 @@ export function FacelessHome({ starters = [] }: { starters?: StarterCardData[] }
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="truncate font-heading text-[22px] leading-none">Faceless Studio</h1>
<div className="ml-auto">
<EngineSwitch value={engine} onChange={setEngine} selfHostedOnly />
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-12 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 space-y-12 px-4 pb-16 sm:px-6">
<div className="mx-auto max-w-[760px] pt-[6vh] text-center sm:pt-[9vh]">
<h2 className="font-heading text-display text-balance">Create your Faceless channel</h2>
<p className="mx-auto mt-2 max-w-[560px] text-body text-muted-foreground">A narrated, illustrated show — scripts, voice-over, animation, music and subtitles — with the same look in every episode.</p>
diff --git a/src/components/faceless/script-review.tsx b/src/components/faceless/script-review.tsx
index fe0f027f..ea83c773 100644
--- a/src/components/faceless/script-review.tsx
+++ b/src/components/faceless/script-review.tsx
@@ -254,7 +254,7 @@ export function ScriptReview({ view }: { view: EpisodeView }) {
/>
))}
</ol>
- <div className="sticky bottom-chrome z-10 -mx-3 border-t bg-background/90 px-3 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur sm:-mx-6 sm:px-6">
+ <div className="sticky bottom-chrome z-10 -mx-4 border-t bg-background/90 px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur sm:-mx-6 sm:px-6">
<div className="flex flex-wrap items-center gap-3">
<span className="inline-flex items-center gap-1.5 text-[12px] text-muted-foreground" aria-live="polite">
{update.isPending ? <Loader2 className="size-3 animate-spin" /> : dirty ? null : <Check className="size-3" />}
diff --git a/src/components/genjutsu/genjutsu-studio.tsx b/src/components/genjutsu/genjutsu-studio.tsx
index a55bfbd2..73be80f5 100644
--- a/src/components/genjutsu/genjutsu-studio.tsx
+++ b/src/components/genjutsu/genjutsu-studio.tsx
@@ -800,7 +800,7 @@ export function GenjutsuStudio({ examples, live }: { examples?: ExampleRowData |
)}
</div>
- <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+112px)]">
+ <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)]">
{mode === "picture" && <PictureSteps stage={pictureStage} />}
<p className="text-[13px] text-pretty text-muted-foreground">{modeInfo.hint}</p>
@@ -1183,7 +1183,7 @@ function ModeTabsRow({ modes, mode, onMode, onlyYou }: { modes: typeof GENJUTSU_
}, [mode, row]);
return (
<div className="border-b">
- <div ref={row} style={fade} role="tablist" aria-label="Genjutsu modes" onKeyDown={tabKeys} className="scrollbar-none flex gap-1 overflow-x-auto px-3 sm:px-6">
+ <div ref={row} style={fade} role="tablist" aria-label="Genjutsu modes" onKeyDown={tabKeys} className="scrollbar-none flex gap-1 overflow-x-auto px-4 sm:px-6">
{modes.map((m) => {
const on = m.id === mode;
return (
diff --git a/src/components/home-view.tsx b/src/components/home-view.tsx
index 3abc59ef..ee37074f 100644
--- a/src/components/home-view.tsx
+++ b/src/components/home-view.tsx
@@ -304,7 +304,7 @@ export function HomeView({
)}
/>
<div className="flex items-center gap-1.5">
- <div role="radiogroup" aria-label="What to make" className="flex min-w-0 items-center gap-1">
+ <div role="radiogroup" aria-label="What to make" className="scrollbar-none flex min-w-0 items-center gap-0.5 overflow-x-auto sm:gap-1">
{MODES.map((m) => (
<button
key={m.id}
@@ -313,7 +313,7 @@ export function HomeView({
aria-checked={mode.id === m.id}
onClick={() => setMode(m)}
className={cn(
- "inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] font-medium whitespace-nowrap transition-colors",
+ "inline-flex h-8 shrink-0 items-center gap-1 rounded-full px-2.5 text-[13px] font-medium whitespace-nowrap transition-colors sm:gap-1.5 sm:px-3",
mode.id === m.id ? "bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent",
)}
>
diff --git a/src/components/layers/mobile-view.tsx b/src/components/layers/mobile-view.tsx
index b1bf4be0..6f47b60c 100644
--- a/src/components/layers/mobile-view.tsx
+++ b/src/components/layers/mobile-view.tsx
@@ -61,7 +61,7 @@ export function MobileView({
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-3 backdrop-blur">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-1.5 bg-background/85 px-4 backdrop-blur">
<Button asChild variant="ghost" size="icon-sm" aria-label="All projects">
<Link href="/layers">
<ArrowLeft />
diff --git a/src/components/live/live-edit-app.tsx b/src/components/live/live-edit-app.tsx
index 28f0c542..1b8c3fa7 100644
--- a/src/components/live/live-edit-app.tsx
+++ b/src/components/live/live-edit-app.tsx
@@ -129,7 +129,7 @@ function LiveShowcase({ kind }: { kind: "guest" | "connect" | "unsupported" }) {
const [nudge, setNudge] = useState(false);
return (
<div className="flex min-h-content flex-col">
- <header className="flex h-14 shrink-0 items-center gap-2 px-3 sm:px-6">
+ <header className="flex h-14 shrink-0 items-center gap-2 px-4 sm:px-6">
<h1 className="flex items-center gap-2 font-heading text-[22px] leading-none">
<Zap className="size-4 text-primary" />
Live edit
@@ -137,7 +137,7 @@ function LiveShowcase({ kind }: { kind: "guest" | "connect" | "unsupported" }) {
<span className="ml-1 rounded-full bg-highlight px-2 py-0.5 text-[11px] font-semibold text-highlight-foreground">New</span>
<PhoneNavButton className="ml-auto" />
</header>
- <div className="mx-auto grid w-full max-w-6xl flex-1 items-center gap-6 px-3 pb-6 sm:px-6 lg:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] lg:gap-10">
+ <div className="mx-auto grid w-full max-w-6xl flex-1 items-center gap-6 px-4 pb-6 sm:px-6 lg:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] lg:gap-10">
<LiveDemo className="aspect-[4/3] w-full shadow-strong" onTypeAttempt={() => setNudge(true)} />
<div className="max-w-md">
<p className="font-heading text-[34px] leading-[1.08] text-balance sm:text-[40px]">Change a picture as you type</p>
diff --git a/src/components/marketing/click-to-ad.tsx b/src/components/marketing/click-to-ad.tsx
index 28b4d778..81bee42b 100644
--- a/src/components/marketing/click-to-ad.tsx
+++ b/src/components/marketing/click-to-ad.tsx
@@ -317,7 +317,7 @@ export function ClickToAd({ models, starters = [] }: { models: Record<string, Mo
return (
<div className="flex min-h-content min-w-0 flex-col">
<MarketingHeader title="Click to Ad" active="click" engine={engine} onEngine={setEngine} selfHostedOnly />
- <div className="mx-auto w-full min-w-0 max-w-[980px] flex-1 space-y-5 px-3 pt-6 pb-20 sm:px-6 sm:pt-10">
+ <div className="mx-auto w-full min-w-0 max-w-[980px] flex-1 space-y-5 px-4 pt-6 pb-20 sm:px-6 sm:pt-10">
<div className="pb-2 text-center">
<h2 className="font-heading text-display text-balance">Make a video ad in one click</h2>
<p className="mx-auto mt-2 max-w-xl text-[15px] text-muted-foreground">Drop a product link, get a 9:16 ad with voiceover and captions — ready for TikTok, Reels and Shorts. No filming, no editing, no brief.</p>
diff --git a/src/components/marketing/marketing-studio.tsx b/src/components/marketing/marketing-studio.tsx
index aa39bca6..ec54680c 100644
--- a/src/components/marketing/marketing-studio.tsx
+++ b/src/components/marketing/marketing-studio.tsx
@@ -429,7 +429,7 @@ export function MarketingStudio({ models, starters = [] }: { models: Record<stri
<UrlParams onTemplate={pickTemplate} onTab={setTab} />
<ProductParam products={products.data} onProduct={(p) => set({ product: productChoice(p) })} />
</Suspense>
- <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 px-3 pb-10 sm:px-6">
+ <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 px-4 pb-10 sm:px-6">
<div className="pt-6 pb-2 text-center sm:pt-10">
<h2 className="font-heading text-display text-balance">Turn a product into ready-to-post content</h2>
<p className="mx-auto mt-2 max-w-xl text-[15px] text-muted-foreground">
@@ -478,7 +478,7 @@ export function MarketingStudio({ models, starters = [] }: { models: Record<stri
</div>
{/* Docked composer */}
- <div className="sticky bottom-chrome z-20 bg-gradient-to-t from-background via-background/95 to-transparent px-3 pt-8 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6">
+ <div className="sticky bottom-chrome z-20 bg-gradient-to-t from-background via-background/95 to-transparent px-4 pt-8 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6">
<div
ref={composer}
data-slim={slim || undefined}
diff --git a/src/components/marketing/shell.tsx b/src/components/marketing/shell.tsx
index 863cb8f5..c55ff5ca 100644
--- a/src/components/marketing/shell.tsx
+++ b/src/components/marketing/shell.tsx
@@ -58,8 +58,8 @@ export function MarketingHeader({
if (el.offsetLeft + el.offsetWidth > box.scrollLeft + box.clientWidth || el.offsetLeft < box.scrollLeft) box.scrollLeft = el.offsetLeft - 12;
}, [active]);
return (
- <header className="sticky top-chrome z-30 border-b border-transparent bg-background/85 backdrop-blur supports-[backdrop-filter]:bg-background/70">
- <div className="flex h-14 min-w-0 items-center gap-2 px-3 sm:px-6">
+ <header className="max-md:sticky top-chrome z-30 border-b border-transparent bg-background/85 backdrop-blur supports-[backdrop-filter]:bg-background/70">
+ <div className="flex h-14 min-w-0 items-center gap-2 px-4 sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-none">{title}</h1>
<div className="ml-auto flex shrink-0 items-center gap-2">
{right}
@@ -67,7 +67,7 @@ export function MarketingHeader({
</div>
<PhoneNavButton />
</div>
- <nav ref={nav} aria-label="Marketing tools" className="scrollbar-none -mb-px flex gap-1 overflow-x-auto px-3 sm:px-6">
+ <nav ref={nav} aria-label="Marketing tools" className="scrollbar-none -mb-px flex gap-1 overflow-x-auto px-4 sm:px-6">
{TABS.map((t) => (
<Link
key={t.id}
diff --git a/src/components/marketing/skeletons.tsx b/src/components/marketing/skeletons.tsx
index c33c2b30..28fa38a1 100644
--- a/src/components/marketing/skeletons.tsx
+++ b/src/components/marketing/skeletons.tsx
@@ -24,7 +24,7 @@ function MarketingFrame({ title, active, children }: { title: string; active: Su
export function MarketingToolSkeleton({ title, active }: { title: string; active: SuiteTab }) {
return (
<MarketingFrame title={title} active={active}>
- <div className="mx-auto flex w-full max-w-[760px] flex-col items-center px-3 pt-8 sm:px-6 sm:pt-[10vh]">
+ <div className="mx-auto flex w-full max-w-[760px] flex-col items-center px-4 pt-8 sm:px-6 sm:pt-[10vh]">
<Skeleton className="h-9 w-2/3 max-w-[420px] rounded-xl" />
<Skeleton className="mt-3 h-4 w-1/2 max-w-[300px]" />
<Skeleton className="mt-10 h-40 w-full rounded-[20px]" />
@@ -37,7 +37,7 @@ export function MarketingToolSkeleton({ title, active }: { title: string; active
export function MarketingSkeleton() {
return (
<MarketingFrame title="Marketing Studio" active="studio">
- <div className="mx-auto w-full max-w-[1240px] flex-1 px-3 sm:px-6">
+ <div className="mx-auto w-full max-w-[1240px] flex-1 px-4 sm:px-6">
<div className="flex flex-col items-center pt-6 pb-2 sm:pt-10">
<Skeleton className="h-10 w-3/4 max-w-[560px] rounded-xl" />
<Skeleton className="mt-3 h-4 w-2/3 max-w-[420px]" />
@@ -57,7 +57,7 @@ export function MarketingSkeleton() {
))}
</div>
</div>
- <div className="sticky bottom-chrome px-3 pb-3 sm:px-6">
+ <div className="sticky bottom-chrome px-4 pb-3 sm:px-6">
<Skeleton className="mx-auto h-14 w-full max-w-[860px] rounded-[20px] sm:rounded-composer" />
</div>
</MarketingFrame>
diff --git a/src/components/mixed-media/mixed-studio.tsx b/src/components/mixed-media/mixed-studio.tsx
index cd96e944..15ddeea4 100644
--- a/src/components/mixed-media/mixed-studio.tsx
+++ b/src/components/mixed-media/mixed-studio.tsx
@@ -104,7 +104,7 @@ export function MixedStudio({
};
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="sr-only font-heading text-[22px] leading-none sm:not-sr-only sm:truncate">Mixed Media</h1>
<div role="tablist" aria-label="Mixed Media" onKeyDown={tabKeys} className="fade-x scrollbar-none flex h-8 min-w-0 items-center overflow-x-auto rounded-full bg-muted p-0.5 sm:ml-4">
{TABS.map((t) => (
@@ -127,7 +127,7 @@ export function MixedStudio({
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 px-3 pb-28 sm:px-6 lg:pb-16">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 px-4 pb-28 sm:px-6 lg:pb-16">
{tab === "history" ? (
<MixedHistory onStart={() => pick("presets")} />
) : tab === "how" ? (
@@ -273,7 +273,7 @@ function Workspace({ visitor, engine, models, frameModels }: { visitor: boolean;
</div>
)}
</section>
- <aside ref={panel} id="mm-editor" className="scrollbar-none min-w-0 scroll-mt-16 lg:sticky lg:top-[calc(var(--chrome-top)+4rem)] lg:max-h-[calc(var(--content-h)-4.5rem)] lg:overflow-y-auto lg:overscroll-contain lg:rounded-2xl">
+ <aside ref={panel} id="mm-editor" className="scrollbar-none min-w-0 scroll-mt-16 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)] lg:max-h-[calc(var(--content-h)-4.5rem)] lg:overflow-y-auto lg:overscroll-contain lg:rounded-2xl">
<Editor visitor={visitor} engine={engine} models={models} frameModels={frameModels} preset={preset} values={values} setValues={setValues} onClip={setHasClip} />
</aside>
{preset && !panelVisible && (
diff --git a/src/components/nav/account-menu.tsx b/src/components/nav/account-menu.tsx
index 5de3ea9e..a93a4b7f 100644
--- a/src/components/nav/account-menu.tsx
+++ b/src/components/nav/account-menu.tsx
@@ -10,9 +10,9 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem,
import { signInHref, signOut, useEngineMode, useViewer } from "@/lib/api";
import type { ViewerKind } from "@/lib/nav-model";
import { cn } from "@/lib/utils";
-import { NAV_MENU_ITEM } from "./create-menu";
import { ExploreProgress } from "./explore-progress";
import { useViewerKind } from "./nav-ui";
+import { keepHighlight, MENU_HEADING, MENU_ROW_1, NavMenuItem, SHEET_HEADING, SHEET_ROW as SHEET_ROW_BASE } from "./nav-row";
import { avatarDot, OwnerStatus, usePlaceholdersOn, useShownStatus, VisitorGpu } from "./status-chips";
/*
@@ -35,37 +35,38 @@ function useHere(): string {
return search ? `${pathname}?${search}` : pathname;
}
-const SHEET_ROW =
- "flex min-h-12 w-full items-center gap-3 rounded-xl px-3 text-left text-[15px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground";
-const MENU_ROW = `h-9 gap-2.5 rounded-md px-2 text-[13.5px] [&_svg]:text-muted-foreground ${NAV_MENU_ITEM}`;
+/** The You sheet's rows: the sheet's 48 px row, an 18 px icon on the gutter. */
+const SHEET_ROW = cn(SHEET_ROW_BASE, "text-[15px] [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground");
+/** The account menu's rows: the menus' 40 px one-line row, a 16 px icon on the icon column. */
+const MENU_ROW = cn(MENU_ROW_1, "[&_svg]:size-4 [&_svg]:text-muted-foreground");
function GuestIdentity({ variant, here }: { variant: Variant; here: string }) {
if (variant === "menu")
return (
<DropdownMenuGroup className="flex flex-col gap-1 p-1">
- <DropdownMenuItem asChild className="h-9 justify-center gap-2 rounded-lg bg-primary text-[13.5px] font-semibold text-primary-foreground focus:bg-primary/90 focus:text-primary-foreground [&_svg]:text-primary-foreground">
+ <DropdownMenuItem asChild onPointerLeave={keepHighlight} className="nav-focus-out h-10 justify-center gap-2 rounded-[10px] bg-primary text-[13.5px] font-semibold text-primary-foreground focus:bg-primary/90 focus:text-primary-foreground active:bg-primary/85 [&_svg]:text-primary-foreground">
<a href={signInHref("signup", here)}>
<UserPlus aria-hidden /> Sign up free
</a>
</DropdownMenuItem>
- <DropdownMenuItem asChild className="h-9 justify-center gap-2 rounded-lg border text-[13.5px]">
+ <NavMenuItem asChild className="h-10 justify-center gap-2 border font-medium">
<a href={signInHref("login", here)}>
- <LogIn aria-hidden /> Log in
+ <LogIn aria-hidden className="size-4" /> Log in
</a>
- </DropdownMenuItem>
+ </NavMenuItem>
</DropdownMenuGroup>
);
return (
<div className="grid grid-cols-2 gap-2">
<a
href={signInHref("signup", here)}
- className="flex h-12 items-center justify-center gap-2 rounded-xl bg-primary text-[15px] font-semibold text-primary-foreground outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
+ className="nav-focus-out flex h-12 items-center justify-center gap-2 rounded-xl bg-primary text-[15px] font-semibold text-primary-foreground nav-hover:bg-primary/90 active:bg-primary/85"
>
<UserPlus aria-hidden className="size-[18px]" /> Sign up free
</a>
<a
href={signInHref("login", here)}
- className="flex h-12 items-center justify-center gap-2 rounded-xl border text-[15px] font-medium outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring"
+ className="nav-row flex h-12 items-center justify-center gap-2 rounded-xl border text-[15px] font-medium"
>
<LogIn aria-hidden className="size-[18px]" /> Log in
</a>
@@ -87,21 +88,21 @@ function Identity({ kind, variant }: { kind: ViewerKind | undefined; variant: Va
);
if (kind === "account" && email)
return variant === "menu" ? (
- <DropdownMenuLabel className="flex flex-col font-normal">
+ <DropdownMenuLabel className="flex flex-col px-2.5 font-normal">
<span className="text-[11px] text-muted-foreground">Signed in as</span>
<span className="text-[13px] [overflow-wrap:anywhere] text-foreground">{email}</span>
</DropdownMenuLabel>
) : (
- <div className="flex flex-col px-1">
+ <div className="flex flex-col">
<span className="text-[12px] text-muted-foreground">Signed in as</span>
<span className="text-[15px] font-medium [overflow-wrap:anywhere]">{email}</span>
</div>
);
if (kind === "owner")
return variant === "menu" ? (
- <DropdownMenuLabel className="pt-2 pb-1 text-[11px] font-semibold tracking-[.08em] text-brand-text uppercase">Your setup</DropdownMenuLabel>
+ <DropdownMenuLabel className={MENU_HEADING}>Your setup</DropdownMenuLabel>
) : (
- <p className="px-1 text-[11px] font-semibold tracking-[.08em] text-brand-text uppercase">Your setup</p>
+ <p className={SHEET_HEADING}>Your setup</p>
);
return null;
}
@@ -117,11 +118,11 @@ function GpuSection({ kind, variant }: { kind: ViewerKind | undefined; variant:
{placeholders &&
(item ? (
// From xl the bar shows this pill itself, so the menu leaves it out.
- <DropdownMenuLabel className="py-1 font-normal xl:hidden">
+ <DropdownMenuLabel className="px-2.5 py-1 font-normal xl:hidden">
<PlaceholdersOnChip />
</DropdownMenuLabel>
) : (
- <div className="px-2 py-1">
+ <div className="py-1">
<PlaceholdersOnChip />
</div>
))}
@@ -144,7 +145,7 @@ function ThemeToggle({ variant }: { variant: Variant }) {
</>
);
return variant === "menu" ? (
- <DropdownMenuItem
+ <NavMenuItem
className={MENU_ROW}
onSelect={(e) => {
// The menu stays open: the change shows on it at once.
@@ -153,7 +154,7 @@ function ThemeToggle({ variant }: { variant: Variant }) {
}}
>
{inner}
- </DropdownMenuItem>
+ </NavMenuItem>
) : (
<button type="button" className={SHEET_ROW} onClick={flip}>
{inner}
@@ -161,17 +162,19 @@ function ThemeToggle({ variant }: { variant: Variant }) {
);
}
-/** One link of the Links section, as a menu item or a sheet row. */
+/** One link of the Links section, as a menu item or a sheet row; the open page's row carries the current mark. */
function LinkRow({ variant, href, children }: { variant: Variant; href: string; children: React.ReactNode }) {
+ const pathname = usePathname();
+ const current = pathname === href;
const link = (
- <IntentLink href={href} className={variant === "sheet" ? SHEET_ROW : undefined}>
+ <IntentLink href={href} aria-current={current ? "page" : undefined} className={cn(variant === "sheet" && SHEET_ROW, current && "font-semibold")}>
{children}
</IntentLink>
);
return variant === "menu" ? (
- <DropdownMenuItem asChild className={MENU_ROW}>
+ <NavMenuItem asChild className={MENU_ROW}>
{link}
- </DropdownMenuItem>
+ </NavMenuItem>
) : (
link
);
@@ -198,9 +201,9 @@ function Links({ kind, variant }: { kind: ViewerKind | undefined; variant: Varia
function SignOut({ variant }: { variant: Variant }) {
return variant === "menu" ? (
- <DropdownMenuItem className={MENU_ROW} onSelect={() => void signOut()}>
+ <NavMenuItem className={MENU_ROW} onSelect={() => void signOut()}>
<LogOut aria-hidden /> Sign out
- </DropdownMenuItem>
+ </NavMenuItem>
) : (
<button type="button" className={SHEET_ROW} onClick={() => void signOut()}>
<LogOut aria-hidden /> Sign out
@@ -209,7 +212,7 @@ function SignOut({ variant }: { variant: Variant }) {
}
function Sep({ variant }: { variant: Variant }) {
- return variant === "menu" ? <DropdownMenuSeparator className="my-1.5" /> : <hr className="my-1 border-border" />;
+ return variant === "menu" ? <DropdownMenuSeparator className="mx-2.5 my-1.5" /> : <hr className="my-2 border-border" />;
}
/**
@@ -222,7 +225,8 @@ export function AccountSections({ variant, onNavigate }: { variant: Variant; onN
const body = (
<>
<Identity kind={kind} variant={variant} />
- {kind && <Sep variant={variant} />}
+ {/* The owner's heading introduces the status under it: no rule between them. */}
+ {kind && kind !== "owner" && <Sep variant={variant} />}
<GpuSection kind={kind} variant={variant} />
<ExploreProgress variant={variant} />
<Sep variant={variant} />
@@ -238,7 +242,7 @@ export function AccountSections({ variant, onNavigate }: { variant: Variant; onN
if (variant === "menu") return body;
return (
<div
- className="flex flex-col gap-2"
+ className="flex flex-col"
onClick={(e) => {
if ((e.target as Element).closest("a[href]")) onNavigate?.();
}}
@@ -262,8 +266,10 @@ export function AccountMenu({ kind }: { kind: ViewerKind }) {
<DropdownMenuTrigger
aria-label={label}
className={cn(
- "relative grid size-9 shrink-0 place-items-center rounded-full [@media(pointer:coarse)]:size-11 text-[13px] font-semibold outline-none focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors",
- kind === "guest" ? "border border-sidebar-border text-muted-foreground hover:bg-accent data-[state=open]:bg-accent" : "bg-brand-faint text-brand-text hover:bg-brand-faint-hover data-[state=open]:bg-brand-faint-hover",
+ "nav-focus relative grid size-10 shrink-0 place-items-center rounded-full [@media(pointer:coarse)]:size-11 text-[13px] font-semibold motion-safe:transition-colors",
+ kind === "guest"
+ ? "border border-sidebar-border text-muted-foreground nav-hover:bg-[var(--nav-hi)] nav-hover:text-foreground active:bg-[var(--nav-press)] data-[state=open]:border-border-strong data-[state=open]:text-foreground"
+ : "bg-brand-faint text-brand-text nav-hover:[background-image:linear-gradient(var(--nav-hi),var(--nav-hi))] active:[background-image:linear-gradient(var(--nav-press),var(--nav-press))]",
)}
>
{kind === "account" && email ? <span aria-hidden>{email.charAt(0).toUpperCase()}</span> : <UserRound aria-hidden className="size-[18px]" />}
diff --git a/src/components/nav/bar-split.tsx b/src/components/nav/bar-split.tsx
index 7bd6a5a5..8ac366d2 100644
--- a/src/components/nav/bar-split.tsx
+++ b/src/components/nav/bar-split.tsx
@@ -15,23 +15,23 @@ import { useNavUi } from "./nav-ui";
* ArrowDown on the name, and, with a mouse, resting on the item (not on the item of the page you are on). A touch
* screen never opens it by hovering: a tap on the name goes to the page, a tap on the chevron opens the menu.
*
- * States use the bar's own attributes, so its styling applies: aria-current="page" on the name on the area's page,
- * data-active on the pill inside the area, data-state="open" on the chevron and data-open on the pill while the menu
- * is open. The pill is exactly as wide as a plain item with a chevron (the name keeps its padding on the left, the
+ * States are the nav's (nav-states.css): each half has the highlight on hover or keyboard focus and the pressed fill;
+ * the pill shows the open page's pip under it (data-active inside the area, aria-current="page" on the name on the
+ * area's own page), and while the menu is open (data-open, data-state="open" on the chevron) foreground words and a
+ * turned chevron, never a fill. The pill is exactly as wide as a plain item with a chevron (the name keeps its padding on the left, the
* chevron takes the right padding and the gap), so the bar never grows.
*/
/** The pill around the two controls. */
export const BAR_SPLIT =
- "group/bar-item inline-flex h-10 shrink-0 items-stretch rounded-[10px] text-[14px] whitespace-nowrap text-foreground/80 [@media(pointer:coarse)]:h-11 data-[active]:bg-accent data-[active]:font-semibold data-[active]:text-foreground has-[[aria-current=page]]:bg-accent has-[[aria-current=page]]:text-foreground data-[open]:bg-accent data-[open]:text-foreground motion-safe:transition-colors";
+ "nav-mark-under group/bar-item inline-flex h-10 shrink-0 items-stretch rounded-[10px] text-[14px] whitespace-nowrap text-foreground/80 [@media(pointer:coarse)]:h-11 data-[active]:font-semibold data-[active]:text-foreground has-[[aria-current=page]]:font-semibold has-[[aria-current=page]]:text-foreground data-[open]:text-foreground";
/** The name: the area's page. */
-export const BAR_LABEL =
- "inline-flex items-center gap-1.5 rounded-l-[10px] pr-1 pl-2.5 outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset aria-[current=page]:font-semibold motion-safe:transition-colors min-[1440px]:pl-3.5";
+export const BAR_LABEL = "nav-row inline-flex items-center gap-1.5 rounded-l-[10px] pr-1 pl-2.5 nav-hover:text-foreground focus-visible:text-foreground min-[1440px]:pl-3.5";
/** The chevron: the menu. 26 px wide (30 from 1440) with a mouse; 44 px to tap. */
export const BAR_CHEVRON =
- "inline-flex w-[26px] items-center justify-center rounded-r-[10px] text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[state=open]:text-foreground motion-safe:transition-colors min-[1440px]:w-[30px] [@media(pointer:coarse)]:w-11";
+ "nav-row inline-flex w-[26px] items-center justify-center rounded-r-[10px] text-muted-foreground nav-hover:text-foreground focus-visible:text-foreground data-[state=open]:text-foreground min-[1440px]:w-[30px] [@media(pointer:coarse)]:w-11";
export const BarChevron = () => <ChevronDown aria-hidden className="size-3.5 group-data-[open]/bar-item:rotate-180 motion-safe:transition-transform" />;
@@ -123,6 +123,7 @@ export function BarSplitMenu({
onTap,
className,
contentClassName,
+ onContentKeyDown,
children,
}: {
href: string;
@@ -134,6 +135,8 @@ export function BarSplitMenu({
onTap?: (href: string) => void;
className?: string;
contentClassName?: string;
+ /** Keys the menu's content handles beyond Radix's own (the Create menu's Left and Right across its columns). */
+ onContentKeyDown?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
children: React.ReactNode;
}) {
const [open, setOpen] = useState(false);
@@ -252,6 +255,7 @@ export function BarSplitMenu({
sideOffset={8}
collisionPadding={12}
className={contentClassName}
+ onKeyDown={onContentKeyDown}
onPointerEnter={(e) => {
hover.enter(e);
warmNav(panel);
diff --git a/src/components/nav/create-menu.tsx b/src/components/nav/create-menu.tsx
index 8e9f4e06..4057398f 100644
--- a/src/components/nav/create-menu.tsx
+++ b/src/components/nav/create-menu.tsx
@@ -1,10 +1,10 @@
"use client";
-import { ArrowRight, Plus } from "lucide-react";
+import { Plus } from "lucide-react";
import { usePathname } from "next/navigation";
import { useId } from "react";
import { IntentLink } from "@/components/intent-link";
-import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from "@/components/ui/dropdown-menu";
+import { DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator } from "@/components/ui/dropdown-menu";
import { Kbd } from "@/components/ui/kbd";
import { navActive, NEW_CREATION_HREF } from "@/lib/nav";
import { area } from "@/lib/nav-areas";
@@ -13,6 +13,7 @@ import { cn } from "@/lib/utils";
import { BarSplitMenu } from "./bar-split";
import { NavIcon } from "./cover-thumb";
import { useViewerKind } from "./nav-ui";
+import { MENU_HEADING, MENU_ROW_1, MENU_ROW_2, NavMenuItem, ROW_LINE, rowName, SeeAllRow, SHEET_HEADING, SHEET_ROW } from "./nav-row";
/*
* Create: the tools that start from words or a picture, in two labelled columns. The bar's Create menu (a menu: arrow
@@ -20,13 +21,6 @@ import { useViewerKind } from "./nav-ui";
* "New creation" (a fresh composer on Home) closes both.
*/
-/**
- * A nav menu row: a clear ring on the row the keyboard is on, and a brand bar at the start of the open page's row (the
- * tint alone is too close to the hover one to tell them apart).
- */
-export const NAV_MENU_ITEM =
- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[current]:shadow-[inset_3px_0_0_var(--brand-text)]";
-
/** The two columns, in order: kept in the navigation model, so the /create page (a server component) reads them too. */
export { CREATE_COLUMNS };
@@ -58,46 +52,46 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";
if (variant === "menu")
return (
<>
- <div className="grid grid-cols-2 gap-x-1">
+ <div className="grid grid-cols-2 gap-x-1.5" data-menu-columns>
{columns.map((c, i) => (
- <DropdownMenuGroup key={c.label} aria-labelledby={`${ids}-${i}`} className="flex min-w-0 flex-col">
- <DropdownMenuLabel id={`${ids}-${i}`} className="px-2.5 pt-2 pb-1 text-[11px] font-semibold tracking-[.08em] text-brand-text uppercase">
+ <DropdownMenuGroup key={c.label} aria-labelledby={`${ids}-${i}`} data-menu-column={i} className="flex min-w-0 flex-col">
+ <DropdownMenuLabel id={`${ids}-${i}`} className={MENU_HEADING}>
{c.label}
</DropdownMenuLabel>
{c.entries.map((e) => {
const on = current(pathname, e.href, CREATE_HREFS);
return (
- <DropdownMenuItem key={e.id} asChild className={cn("min-h-11 items-start gap-2.5 rounded-lg px-2.5 py-2 data-[current]:bg-brand-faint", NAV_MENU_ITEM)}>
- <IntentLink href={e.href} eager={e.eager} aria-current={on ? "page" : undefined} data-current={on || undefined}>
- <NavIcon name={e.icon} className="mt-0.5 size-4 text-muted-foreground" />
+ <NavMenuItem key={e.id} asChild className={cn(MENU_ROW_2, "items-start")}>
+ <IntentLink href={e.href} eager={e.eager} aria-current={on ? "page" : undefined}>
+ <NavIcon name={e.icon} className="nav-icon mt-px size-4 text-muted-foreground" />
<span className="flex min-w-0 flex-col">
- <span className={cn("text-[13.5px] leading-tight font-medium", on && "font-semibold")}>{e.label}</span>
- <span className="truncate text-[12px] leading-snug text-muted-foreground">{e.what}</span>
+ <span className={rowName(on)}>{e.label}</span>
+ <span className={ROW_LINE}>{e.what}</span>
</span>
</IntentLink>
- </DropdownMenuItem>
+ </NavMenuItem>
);
})}
</DropdownMenuGroup>
))}
</div>
- <DropdownMenuSeparator className="my-1.5" />
- <div className="grid grid-cols-2 gap-x-1">
- <DropdownMenuItem asChild className={cn("h-10 gap-2.5 rounded-lg px-2.5 text-[13.5px] font-medium", NAV_MENU_ITEM)}>
- <IntentLink href={NEW_CREATION_HREF} eager>
- <Plus aria-hidden className="size-4 text-brand-text" />
- New creation
- <Kbd aria-hidden className="ml-auto [@media(hover:none)]:hidden">
- ↵
- </Kbd>
- </IntentLink>
- </DropdownMenuItem>
- <DropdownMenuItem asChild className={cn("group/all h-10 gap-2 rounded-lg px-2.5 text-[13.5px] font-medium text-brand-text", NAV_MENU_ITEM)}>
- <IntentLink href={CREATE_AREA_HREF} aria-current={pathname === CREATE_AREA_HREF ? "page" : undefined} aria-label="See all of Create">
- See all
- <ArrowRight aria-hidden className="size-4 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
- </IntentLink>
- </DropdownMenuItem>
+ <DropdownMenuSeparator className="mx-2.5 my-1.5" />
+ {/* The foot: two rows on the columns' grid (Left and Right move between them too). */}
+ <div className="grid grid-cols-2 gap-x-1.5" data-menu-columns>
+ <DropdownMenuGroup data-menu-column={0} className="flex min-w-0 flex-col">
+ <NavMenuItem asChild className={cn(MENU_ROW_1, "font-medium")}>
+ <IntentLink href={NEW_CREATION_HREF} eager>
+ <Plus aria-hidden className="size-4 text-brand-text" />
+ New creation
+ <Kbd aria-hidden className="ml-auto [@media(hover:none)]:hidden">
+ ↵
+ </Kbd>
+ </IntentLink>
+ </NavMenuItem>
+ </DropdownMenuGroup>
+ <DropdownMenuGroup data-menu-column={1} className="flex min-w-0 flex-col">
+ <SeeAllRow href={CREATE_AREA_HREF} name="See all of Create" />
+ </DropdownMenuGroup>
</div>
</>
);
@@ -109,14 +103,14 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";
<IntentLink
href={NEW_CREATION_HREF}
eager
- className="flex h-12 items-center justify-center gap-2 rounded-xl bg-primary text-[15px] font-semibold text-primary-foreground outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
+ className="nav-focus-out flex h-12 items-center justify-center gap-2 rounded-xl bg-primary text-[15px] font-semibold text-primary-foreground nav-hover:bg-primary/90 active:bg-primary/85"
>
<Plus aria-hidden className="size-5" />
New creation
</IntentLink>
{columns.map((c, i) => (
<section key={c.label} aria-labelledby={`${ids}-s${i}`} className="flex flex-col">
- <h3 id={`${ids}-s${i}`} className="px-1 pb-1 text-[11px] font-semibold tracking-[.08em] text-brand-text uppercase">
+ <h3 id={`${ids}-s${i}`} className={SHEET_HEADING}>
{c.label}
</h3>
<ul className="flex flex-col">
@@ -128,17 +122,14 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";
href={e.href}
eager={e.eager}
aria-current={on ? "page" : undefined}
- className={cn(
- "flex min-h-12 items-center gap-3 rounded-xl px-2 py-1.5 outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors",
- on && "bg-brand-faint",
- )}
+ className={cn(SHEET_ROW, "py-1.5")}
>
<span className="grid size-9 shrink-0 place-items-center rounded-[10px] bg-muted">
- <NavIcon name={e.icon} className="size-[18px] text-foreground" />
+ <NavIcon name={e.icon} className="nav-icon size-[18px] text-foreground" />
</span>
<span className="flex min-w-0 flex-col">
- <span className={cn("text-[15px] leading-tight font-medium", on && "font-semibold")}>{e.label}</span>
- <span className="truncate text-[12.5px] text-muted-foreground">{e.what}</span>
+ <span className={rowName(on, "text-[15px] leading-5 font-medium")}>{e.label}</span>
+ <span className="truncate text-[12.5px] leading-4 text-muted-foreground">{e.what}</span>
</span>
</IntentLink>
</li>
@@ -154,6 +145,36 @@ export function CreateList({ variant, onNavigate }: { variant: "menu" | "sheet";
/** Create's own page: everything it holds, with covers ("See all" in the menu and on the phone's sheet). */
export const CREATE_AREA_HREF = area("create").href;
+/**
+ * Left and Right in the menu's two columns: the same row of the other column, or its last when that one is shorter.
+ * `lengths`: the rows in each column. Null when the key goes nowhere (an edge, another key).
+ */
+export function columnMove(lengths: readonly number[], at: { col: number; row: number }, key: string): { col: number; row: number } | null {
+ if (key !== "ArrowLeft" && key !== "ArrowRight") return null;
+ const col = at.col + (key === "ArrowLeft" ? -1 : 1);
+ const len = lengths[col] ?? 0;
+ if (col < 0 || col >= lengths.length || !len) return null;
+ return { col, row: Math.min(at.row, len - 1) };
+}
+
+/** Moves the menu's highlight across its columns (Radix's own keys are Up, Down, Home, End and typeahead). */
+function onColumnsKey(e: React.KeyboardEvent<HTMLElement>) {
+ const item = (e.target as HTMLElement).closest<HTMLElement>('[role="menuitem"]');
+ const column = item?.closest<HTMLElement>("[data-menu-column]");
+ const grid = column?.closest<HTMLElement>("[data-menu-columns]");
+ if (!item || !column || !grid) return;
+ const columns = [...grid.querySelectorAll<HTMLElement>(":scope > [data-menu-column]")].map((c) => [...c.querySelectorAll<HTMLElement>('[role="menuitem"]')]);
+ const col = Number(column.dataset.menuColumn);
+ const next = columnMove(
+ columns.map((c) => c.length),
+ { col, row: columns[col]?.indexOf(item) ?? 0 },
+ e.key,
+ );
+ if (!next) return;
+ e.preventDefault();
+ columns[next.col]?.[next.row]?.focus();
+}
+
/**
* The bar's Create item: its name goes to /create, its chevron (or ArrowDown, or resting on it with a mouse) opens the
* menu. `active`: a Create page is open; `current`: /create itself; `onTap`: the name was clicked.
@@ -169,6 +190,7 @@ export function CreateMenu({ active, current, onTap }: { active?: boolean; curre
panel="create"
onTap={onTap}
contentClassName="w-[520px] max-w-[calc(100vw-24px)] p-1.5"
+ onContentKeyDown={onColumnsKey}
>
<CreateList variant="menu" />
</BarSplitMenu>
diff --git a/src/components/nav/explore-progress.tsx b/src/components/nav/explore-progress.tsx
index 4f905ac0..863a1c9d 100644
--- a/src/components/nav/explore-progress.tsx
+++ b/src/components/nav/explore-progress.tsx
@@ -2,12 +2,12 @@
import { Sparkles } from "lucide-react";
import { IntentLink } from "@/components/intent-link";
-import { DropdownMenuItem, DropdownMenuLabel } from "@/components/ui/dropdown-menu";
+import { DropdownMenuLabel } from "@/components/ui/dropdown-menu";
import { exploreProgress, nextToTry } from "@/lib/nav-explore";
import type { NavEntry } from "@/lib/nav-model";
import { cn } from "@/lib/utils";
import { CoverThumb } from "./cover-thumb";
-import { NAV_MENU_ITEM } from "./create-menu";
+import { NavMenuItem, SHEET_ROW } from "./nav-row";
import { useExplored } from "./explore-tracker";
import { useViewerKind } from "./nav-ui";
@@ -33,7 +33,7 @@ export function ExploreProgress({
return <ExploreView variant={variant} done={done} total={total} next={next} onNavigate={onNavigate} />;
}
-const ROW = "flex min-h-12 items-center gap-3 rounded-[12px] px-1.5 py-1 text-left";
+const ROW = "flex min-h-12 items-center gap-3 py-1 text-left";
/** The row itself, from numbers (ExploreProgress reads them from this browser). */
export function ExploreView({
@@ -60,7 +60,7 @@ export function ExploreView({
<span className="text-[13px] font-medium text-foreground">{done >= total ? "You have tried every studio" : count}</span>
</>
);
- return menu ? <DropdownMenuLabel className={cn(ROW, "font-normal")}>{body}</DropdownMenuLabel> : <div className={ROW}>{body}</div>;
+ return menu ? <DropdownMenuLabel className={cn(ROW, "px-2.5 font-normal")}>{body}</DropdownMenuLabel> : <div className={ROW}>{body}</div>;
}
const body = (
<>
@@ -77,17 +77,17 @@ export function ExploreView({
// One name for the whole row.
const label = `Next to try: ${next.label}, ${next.what}. ${count}`;
return menu ? (
- <DropdownMenuItem asChild className={cn(ROW, "cursor-pointer focus:bg-accent", NAV_MENU_ITEM)}>
+ <NavMenuItem asChild className={ROW}>
<IntentLink href={next.href} aria-label={label} onClick={onNavigate}>
{body}
</IntentLink>
- </DropdownMenuItem>
+ </NavMenuItem>
) : (
<IntentLink
href={next.href}
aria-label={label}
onClick={onNavigate}
- className={cn(ROW, "outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors motion-reduce:transition-none")}
+ className={cn(SHEET_ROW, "py-1")}
>
{body}
</IntentLink>
diff --git a/src/components/nav/goal-row.tsx b/src/components/nav/goal-row.tsx
index d53e006e..02a2ba64 100644
--- a/src/components/nav/goal-row.tsx
+++ b/src/components/nav/goal-row.tsx
@@ -73,7 +73,8 @@ function useFadeEdges<T extends HTMLElement>() {
}
const LABEL = "text-[11px] font-semibold tracking-[0.08em] text-brand-text uppercase";
-const FOCUS = "outline-none focus-visible:ring-2 focus-visible:ring-ring";
+/** The band's links and buttons take the nav's states (nav-states.css): highlight, keyboard ring, pressed. */
+const FOCUS = "nav-row";
function NewBadge() {
return <span className="ml-1.5 inline-block rounded-full bg-highlight px-1.5 align-[2px] text-[10px] leading-4 font-semibold text-highlight-foreground">New</span>;
@@ -85,7 +86,7 @@ function GoalCard({ e }: { e: NavEntry }) {
<IntentLink
href={e.href}
className={cn(
- "group/card relative flex h-full flex-col overflow-hidden rounded-[14px] border bg-card hover:border-border-strong motion-safe:transition-colors",
+ "group/card flex h-full flex-col overflow-hidden rounded-[14px] border bg-card nav-hover:border-border-strong",
FOCUS,
)}
>
@@ -125,7 +126,8 @@ export function GoalBand({ id, kind, names, onClose }: { id: GoalId; kind: Viewe
aria-labelledby="goal-band-title"
className={cn(
"flex flex-col gap-5 border-b bg-popover px-4 pt-5 pb-6 text-popover-foreground max-sm:-mx-4",
- "sm:rounded-b-[18px] sm:border-x sm:px-6 sm:pt-6 sm:pb-7 sm:shadow-soft",
+ // 16 px in, its 1 px border included: the band's words sit on the goal tabs' icon column above.
+ "sm:rounded-b-[18px] sm:border-x sm:px-[15px] sm:pt-6 sm:pb-7 sm:shadow-soft",
"motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150",
)}
>
@@ -140,7 +142,7 @@ export function GoalBand({ id, kind, names, onClose }: { id: GoalId; kind: Viewe
<IntentLink
href={assist}
className={cn(
- "col-span-2 row-start-2 inline-flex h-11 items-center gap-2 justify-self-start rounded-full border bg-card pr-4 pl-3.5 text-[13.5px] font-medium hover:bg-accent motion-safe:transition-colors sm:h-10 pointer-coarse:h-11",
+ "col-span-2 row-start-2 inline-flex h-11 items-center gap-2 justify-self-start rounded-full border bg-card pr-4 pl-3.5 text-[13.5px] font-medium sm:h-10 pointer-coarse:h-11",
"sm:col-span-1 sm:col-start-2 sm:row-start-1",
FOCUS,
)}
@@ -154,7 +156,7 @@ export function GoalBand({ id, kind, names, onClose }: { id: GoalId; kind: Viewe
aria-label={`Close ${goal.title}`}
onClick={onClose}
className={cn(
- "col-start-2 row-start-1 grid size-11 place-items-center rounded-xl border bg-card hover:bg-accent motion-safe:transition-colors sm:col-start-3 sm:size-10 pointer-coarse:size-11",
+ "col-start-2 row-start-1 grid size-11 place-items-center rounded-xl border bg-card sm:col-start-3 sm:size-10 pointer-coarse:size-11",
FOCUS,
)}
>
@@ -194,7 +196,7 @@ export function GoalBand({ id, kind, names, onClose }: { id: GoalId; kind: Viewe
<IntentLink
href={tapHref(t.preset)}
className={cn(
- "relative flex h-[60px] min-w-0 items-center gap-2.5 rounded-xl border bg-card py-2 pr-3 pl-2 hover:bg-accent motion-safe:transition-colors",
+ "flex h-[60px] min-w-0 items-center gap-2.5 rounded-xl border bg-card py-2 pr-3 pl-2",
FOCUS,
)}
>
@@ -218,7 +220,7 @@ export function GoalBand({ id, kind, names, onClose }: { id: GoalId; kind: Viewe
<IntentLink
href={e.href}
className={cn(
- "group/finish flex h-11 min-w-0 items-center gap-3 rounded-xl border bg-card px-3.5 hover:bg-accent motion-safe:transition-colors",
+ "group/finish flex h-11 min-w-0 items-center gap-3 rounded-xl border bg-card px-3.5",
FOCUS,
)}
>
@@ -334,7 +336,7 @@ export function GoalRow({ names }: { names: Readonly<Record<string, string>> })
<IntentLink
href={area("studios").href}
className={cn(
- "flex shrink-0 items-center justify-center gap-2 self-center rounded-[10px] text-[13.5px] font-medium text-brand-text hover:bg-brand-faint motion-safe:transition-colors",
+ "flex shrink-0 items-center justify-center gap-2 self-center rounded-[10px] text-[13.5px] font-medium text-brand-text",
// Its words from xl; narrower, its icon (with the words for screen readers) leaves the goals the room.
"ml-1 size-11 max-sm:mr-1 xl:ml-2 xl:h-10 xl:w-auto xl:px-3",
FOCUS,
diff --git a/src/components/nav/goal-tab.ts b/src/components/nav/goal-tab.ts
index 79d8656a..46dadae8 100644
--- a/src/components/nav/goal-tab.ts
+++ b/src/components/nav/goal-tab.ts
@@ -7,12 +7,15 @@
/** The strip: 52 px between two rules, reaching a phone's edges. */
export const GOAL_STRIP = "flex h-[52px] items-stretch border-y max-sm:-mx-4";
-/** A tab in the strip (an icon, then its label); `GOAL_TAB_ON` marks the open one. */
+/**
+ * A tab in the strip (an icon, then its label), with the nav's states (nav-states.css): the highlight on hover or keyboard
+ * focus, pressed. `GOAL_TAB_ON` marks the open one with the tab's underline, never a fill, so it never reads as a second
+ * highlight.
+ */
export const GOAL_TAB = [
- "flex shrink-0 snap-start items-center gap-2 rounded-t-[10px] border-b-2 border-transparent px-4 text-[14px] whitespace-nowrap text-foreground/80 outline-none hover:bg-accent hover:text-foreground motion-safe:transition-colors",
+ "nav-row flex shrink-0 snap-start items-center gap-2 rounded-t-[10px] border-b-2 border-transparent px-4 text-[14px] whitespace-nowrap text-foreground/80 nav-hover:text-foreground",
// A tablet's row holds all six as words alone (a phone's scrolls, with the icons).
"md:max-lg:px-2.5 md:max-lg:text-[13.5px]",
- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
].join(" ");
-export const GOAL_TAB_ON = "border-primary bg-accent text-foreground";
+export const GOAL_TAB_ON = "border-[var(--nav-mark)] text-foreground";
diff --git a/src/components/nav/input-modality.ts b/src/components/nav/input-modality.ts
new file mode 100644
index 00000000..5e9e1ae1
--- /dev/null
+++ b/src/components/nav/input-modality.ts
@@ -0,0 +1,75 @@
+/*
+ * Which input leads: html[data-input="keyboard" | "pointer"]. The nav's states (nav-states.css) read it so only one
+ * row is ever highlighted: while the keyboard leads, the focused row has the highlight and the focus ring and hover
+ * paints nothing; once the mouse moves (or a finger or pen touches), the row under it has the highlight and the
+ * keyboard's ring steps aside. Typing words never takes the lead from the mouse: only the keys that move focus do, and a
+ * letter typed where it moves the list's highlight (a menu's typeahead, search's field), so the ring marks the row the
+ * keys picked.
+ */
+
+export type InputModality = "keyboard" | "pointer";
+
+/** Keys that move focus, press the focused control or close a layer: pressing one hands the lead to the keyboard. */
+const NAV_KEYS = new Set(["Tab", "Enter", " ", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End", "PageUp", "PageDown", "Escape", "F6"]);
+
+/** Where a typed letter moves a list's highlight: an open menu (typeahead) or the search field. */
+const PICKS_BY_TYPING = '[role="menu"], [cmdk-input]';
+
+/**
+ * The modality a key press leads to, or null when it leaves the lead where it is (a modifier, or a letter typed into the
+ * page or a field). A letter in a menu or the search field moves the highlight, so it hands the lead to the keyboard.
+ */
+export function modalityForKey(
+ key: string,
+ mods: { altKey?: boolean; ctrlKey?: boolean; metaKey?: boolean } = {},
+ target?: EventTarget | null,
+): InputModality | null {
+ if (mods.altKey || mods.ctrlKey || mods.metaKey) return null;
+ if (NAV_KEYS.has(key)) return "keyboard";
+ const el = target as Element | null | undefined;
+ if (key.length === 1 && typeof el?.closest === "function" && el.closest(PICKS_BY_TYPING)) return "keyboard";
+ return null;
+}
+
+/** The modality a pointer event leads to: a press of any kind, or a mouse that really moved (not a layout shift). */
+export function modalityForPointer(type: string, moved: boolean): InputModality | null {
+ if (type === "pointerdown") return "pointer";
+ return moved ? "pointer" : null;
+}
+
+let installed = false;
+
+/** Installs the listeners once per page (idempotent). Returns a function that removes them (tests). */
+export function installInputModality(doc: Document = document): () => void {
+ if (installed) return () => {};
+ installed = true;
+ const html = doc.documentElement;
+ let last = { x: Number.NaN, y: Number.NaN };
+ const set = (m: InputModality | null) => {
+ if (m && html.dataset.input !== m) html.dataset.input = m;
+ };
+ const onKey = (e: KeyboardEvent) => set(modalityForKey(e.key, e, e.target));
+ const onDown = (e: PointerEvent) => {
+ last = { x: e.clientX, y: e.clientY };
+ set(modalityForPointer("pointerdown", true));
+ };
+ const onMove = (e: PointerEvent) => {
+ if (e.pointerType !== "mouse") return;
+ const moved = e.clientX !== last.x || e.clientY !== last.y;
+ last = { x: e.clientX, y: e.clientY };
+ set(modalityForPointer("pointermove", moved));
+ };
+ // iOS paints :active (the pressed state) only on pages that listen to touches.
+ const onTouch = () => {};
+ doc.addEventListener("keydown", onKey, true);
+ doc.addEventListener("pointerdown", onDown, true);
+ doc.addEventListener("pointermove", onMove, { capture: true, passive: true });
+ doc.addEventListener("touchstart", onTouch, { passive: true });
+ return () => {
+ installed = false;
+ doc.removeEventListener("keydown", onKey, true);
+ doc.removeEventListener("pointerdown", onDown, true);
+ doc.removeEventListener("pointermove", onMove, true);
+ doc.removeEventListener("touchstart", onTouch);
+ };
+}
diff --git a/src/components/nav/nav-row.tsx b/src/components/nav/nav-row.tsx
new file mode 100644
index 00000000..339dae28
--- /dev/null
+++ b/src/components/nav/nav-row.tsx
@@ -0,0 +1,75 @@
+"use client";
+
+import { ArrowRight } from "lucide-react";
+import { usePathname } from "next/navigation";
+import { DropdownMenu as MenuPrimitive } from "radix-ui";
+import { IntentLink } from "@/components/intent-link";
+import { cn } from "@/lib/utils";
+
+/*
+ * The nav's rows, one anatomy and one set of states for every menu, sheet and panel (the states are in
+ * app/nav-states.css: highlight, focus ring, pressed, current, open, disabled). On a 4 px scale:
+ * menu panel 6 px padding, rows 10 px radius, 10 px inline padding, 12 px between icon and words
+ * menu rows 48 px with a line under the name, 40 px with the name alone
+ * headings 11 px capitals, on the rows' icon column
+ * sheet rows 48 px, content on the sheet's 16 px gutter (the fill reaches 8 px past it)
+ */
+
+/**
+ * A menu item's pointer leave: the highlight stays on the row the mouse left (Radix clears it unless the leave is
+ * default-prevented), so the arrow keys go on from there, as they do in search.
+ */
+export function keepHighlight(e: React.PointerEvent) {
+ e.preventDefault();
+}
+
+/** A row of a desktop menu: a Radix item (the mouse moves the keyboard's highlight) with the nav's states. */
+export function NavMenuItem({ className, onPointerLeave, ...props }: React.ComponentProps<typeof MenuPrimitive.Item>) {
+ return (
+ <MenuPrimitive.Item
+ data-slot="dropdown-menu-item"
+ onPointerLeave={(e) => {
+ onPointerLeave?.(e);
+ keepHighlight(e);
+ }}
+ className={cn(
+ "nav-row nav-mark-start flex cursor-pointer items-center gap-3 rounded-[10px] px-2.5 text-[13.5px] select-none [&_svg]:pointer-events-none [&_svg]:shrink-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+/** "See all" at the foot of a menu: the area's own page, a one-line row in the brand's colour (`name`: for a screen reader). */
+export function SeeAllRow({ href, name, className }: { href: string; name: string; className?: string }) {
+ const pathname = usePathname();
+ return (
+ <NavMenuItem asChild className={cn("group/all h-10 gap-2 font-medium text-brand-text", className)}>
+ <IntentLink href={href} aria-current={pathname === href ? "page" : undefined} aria-label={name}>
+ See all
+ <ArrowRight aria-hidden className="size-4 motion-safe:transition-transform group-data-[highlighted]/all:translate-x-0.5" />
+ </IntentLink>
+ </NavMenuItem>
+ );
+}
+
+/** A two-line menu row (name and line): 48 px. */
+export const MENU_ROW_2 = "min-h-12 py-[7px]";
+/** A one-line menu row (name alone): 40 px. */
+export const MENU_ROW_1 = "h-10";
+/** A menu's group heading, on the rows' icon column. */
+export const MENU_HEADING = "px-2.5 pt-2 pb-1 text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase";
+/** A row's name and its line. */
+export const ROW_NAME = "text-[13.5px] leading-[18px] font-medium";
+export const ROW_LINE = "truncate text-[12px] leading-4 text-muted-foreground";
+
+/** A row of a phone sheet: 48 px; the words sit on the sheet's gutter and the fill reaches 8 px past it. */
+export const SHEET_ROW = "nav-row nav-mark-start -mx-2 flex min-h-12 items-center gap-3 rounded-xl px-2 text-left";
+/** A sheet's group heading, on the gutter. */
+export const SHEET_HEADING = "pb-1 text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase";
+
+/** Names a row's weight: semibold for the open page, medium otherwise. */
+export function rowName(current: boolean | undefined, base = ROW_NAME) {
+ return cn(base, current && "font-semibold");
+}
diff --git a/src/components/nav/nav-ui.tsx b/src/components/nav/nav-ui.tsx
index 28e094ab..0736b257 100644
--- a/src/components/nav/nav-ui.tsx
+++ b/src/components/nav/nav-ui.tsx
@@ -1,9 +1,10 @@
"use client";
-import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
+import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { useHydrated, useViewer } from "@/lib/api";
import type { NavCover, NavCovers } from "@/lib/nav-covers";
import { viewerKindOf, type LauncherGroupId, type ViewerKind } from "@/lib/nav-model";
+import { installInputModality } from "./input-modality";
/*
* The app frame's shared state: the covers the server resolved for the nav (preset id → thumb and poster URLs), who is
@@ -38,6 +39,8 @@ export function NavUiProvider({ covers, children }: { covers: NavCovers; childre
const [launcher, setLauncher] = useState<{ open: boolean; group?: LauncherGroupId }>({ open: false });
const [sheet, setSheetState] = useState<{ sheet: NavSheet | null; group?: LauncherGroupId }>({ sheet: null });
const launcherReturn = useRef<HTMLElement | null>(null);
+ // Which input leads (keyboard or pointer), for the nav states: one highlighted row at a time.
+ useEffect(() => installInputModality(), []);
// Opened or closed by the launcher's own button: focus goes back to it. openStudios() says otherwise.
const setLauncherOpen = useCallback((open: boolean) => {
diff --git a/src/components/nav/next-steps.tsx b/src/components/nav/next-steps.tsx
index 98ff84d9..b10b07cd 100644
--- a/src/components/nav/next-steps.tsx
+++ b/src/components/nav/next-steps.tsx
@@ -94,10 +94,8 @@ function StepLink({ step, variant, onNavigate }: { step: NextStep; variant: "row
prefetch={false}
onClick={onNavigate}
className={cn(
- "flex items-center outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset motion-safe:transition-colors motion-reduce:transition-none",
- row
- ? "h-[52px] gap-2.5 rounded-[14px] border bg-card pr-4 pl-1.5 text-card-foreground hover:border-border-strong hover:bg-accent"
- : "min-h-12 gap-2.5 rounded-lg px-1.5 py-1.5 hover:bg-accent",
+ "nav-row flex items-center",
+ row ? "h-[52px] gap-2.5 rounded-[14px] border bg-card pr-4 pl-1.5 text-card-foreground nav-hover:border-border-strong" : "min-h-12 gap-2.5 rounded-[10px] px-1.5 py-1.5",
)}
>
<CoverThumb id={step.cover} size="pill" icon="Sparkles" className={row ? undefined : "size-9 rounded-lg"} />
diff --git a/src/components/nav/phone-nav-button.tsx b/src/components/nav/phone-nav-button.tsx
index 5a8929ec..393f7051 100644
--- a/src/components/nav/phone-nav-button.tsx
+++ b/src/components/nav/phone-nav-button.tsx
@@ -23,7 +23,7 @@ export function PhoneNavButton({ className }: { className?: string }) {
size="icon"
aria-haspopup="dialog"
data-phone-nav-button
- className={cn("size-11 shrink-0 rounded-full text-muted-foreground motion-reduce:transition-none md:hidden", className)}
+ className={cn("nav-row size-11 shrink-0 rounded-full text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 motion-reduce:transition-none md:hidden", className)}
onTouchStart={search.warm}
onPointerEnter={search.warm}
onFocus={search.warm}
diff --git a/src/components/nav/phone-sheets.tsx b/src/components/nav/phone-sheets.tsx
index 35bc2536..40c6eee4 100644
--- a/src/components/nav/phone-sheets.tsx
+++ b/src/components/nav/phone-sheets.tsx
@@ -182,7 +182,7 @@ export function PhoneSheets() {
<IntentLink
href={SEE_ALL[shown]}
aria-label={`See all ${TITLES[shown].toLowerCase()}`}
- className="group/all ml-auto inline-flex h-11 items-center gap-1 rounded-full px-3 text-[13px] font-medium text-brand-text outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring"
+ className="nav-row group/all ml-auto inline-flex h-11 items-center gap-1 rounded-full px-3 text-[13px] font-medium text-brand-text"
>
See all
<ArrowRight aria-hidden className="size-4" />
@@ -194,14 +194,14 @@ export function PhoneSheets() {
type="button"
onClick={openSearch}
aria-label="Search everything"
- className="grid size-11 shrink-0 place-items-center rounded-full text-brand-text outline-none [-webkit-tap-highlight-color:transparent] hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring [html[data-fullscreen-studio]_&]:hidden"
+ className="nav-row grid size-11 shrink-0 place-items-center rounded-full text-brand-text [html[data-fullscreen-studio]_&]:hidden"
>
<Search className="size-[18px]" aria-hidden />
</button>
)}
<SheetPrimitive.Close
className={cn(
- "grid size-11 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
+ "nav-row grid size-11 shrink-0 place-items-center rounded-full text-muted-foreground nav-hover:text-foreground",
!SEE_ALL[shown] && "ml-auto",
)}
>
diff --git a/src/components/nav/phone-tabs.tsx b/src/components/nav/phone-tabs.tsx
index a98e79f0..ea6f7512 100644
--- a/src/components/nav/phone-tabs.tsx
+++ b/src/components/nav/phone-tabs.tsx
@@ -19,7 +19,7 @@ type TabDot = ReturnType<typeof avatarDot>;
/** One cell: at least 64 x 56, the icon in a 44 x 28 pill that tints when its tab is selected. */
const CELL =
- "group/tab relative flex h-full min-w-0 flex-col items-center justify-center gap-1 rounded-xl text-[11px] leading-none font-medium text-muted-foreground outline-none select-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring data-[active]:text-foreground";
+ "nav-row group/tab flex h-full min-w-0 flex-col items-center justify-center gap-1 rounded-xl text-[11px] leading-none font-medium text-muted-foreground select-none data-[active]:text-foreground";
function TabFace({ icon: Icon, label, dot }: { icon: LucideIcon; label: string; dot?: TabDot }) {
return (
diff --git a/src/components/nav/search-palette.tsx b/src/components/nav/search-palette.tsx
index 2ac9ca4c..14d7d82a 100644
--- a/src/components/nav/search-palette.tsx
+++ b/src/components/nav/search-palette.tsx
@@ -43,7 +43,7 @@ const keepKeys = (e: React.KeyboardEvent) => {
if (e.key === "Enter" || e.key === " ") e.stopPropagation();
};
-const focusRing = "outline-none focus-visible:ring-2 focus-visible:ring-ring";
+const focusRing = "nav-focus";
/** On the page and shown (a launcher link is gone once the launcher closes). */
function shownEl(el: Element | null | undefined): el is HTMLElement {
@@ -277,7 +277,7 @@ export function PaletteBody({
setQ("");
input.current?.focus();
}}
- className={cn("grid size-10 shrink-0 place-items-center rounded-[10px] text-muted-foreground hover:bg-accent hover:text-foreground max-md:size-11 [@media(pointer:coarse)]:size-11", focusRing)}
+ className="nav-row grid size-10 shrink-0 place-items-center rounded-[10px] text-muted-foreground nav-hover:text-foreground max-md:size-11 [@media(pointer:coarse)]:size-11"
>
<X className="size-4" />
</button>
@@ -289,7 +289,7 @@ export function PaletteBody({
onClick={onClose}
// Its name starts with the words it shows (Esc on a desktop, Cancel on a phone), for voice control.
className={cn(
- "h-10 shrink-0 rounded-[10px] border bg-secondary px-3 max-md:h-11 [@media(pointer:coarse)]:h-11 text-[12px] font-medium text-secondary-foreground hover:bg-accent max-md:border-0 max-md:bg-transparent max-md:px-2 max-md:text-[15px] max-md:text-brand-text [@media(hover:none)]:border-0 [@media(hover:none)]:bg-transparent [@media(hover:none)]:text-[15px] [@media(hover:none)]:text-brand-text",
+ "h-10 shrink-0 rounded-[10px] border bg-secondary px-3 max-md:h-11 [@media(pointer:coarse)]:h-11 text-[12px] font-medium text-secondary-foreground nav-hover:bg-[var(--nav-hi)] active:bg-[var(--nav-press)] max-md:border-0 max-md:bg-transparent max-md:px-2 max-md:text-[15px] max-md:text-brand-text [@media(hover:none)]:border-0 [@media(hover:none)]:bg-transparent [@media(hover:none)]:text-[15px] [@media(hover:none)]:text-brand-text",
focusRing,
)}
>
@@ -307,7 +307,7 @@ export function PaletteBody({
{!searching && !scoped && (
<div className="shrink-0 px-5 pt-2.5 max-md:px-3">
<div className="flex flex-wrap items-center gap-x-2.5 py-1 md:h-10 md:flex-nowrap md:py-0">
- <span aria-hidden className="ml-1.5 text-[11px] leading-[14px] font-semibold tracking-[.08em] text-brand-text uppercase">
+ <span aria-hidden className="ml-2 text-[11px] leading-[14px] font-semibold tracking-[.08em] text-brand-text uppercase">
Every studio
</span>
<span className="text-[12px] text-muted-foreground">{groupLabel ? `${tiles.length} in ${groupLabel}` : studioCount()}</span>
@@ -422,7 +422,7 @@ function Hints() {
const mod = useModKey();
const cap = "h-[22px] min-w-[22px] rounded-md border border-b-2 bg-secondary px-1.5 text-[11px] text-foreground";
return (
- <div className="flex h-[46px] shrink-0 items-center gap-3 border-t bg-muted/40 px-[22px] text-[12px] text-muted-foreground max-md:hidden [@media(hover:none)]:hidden">
+ <div className="flex h-[46px] shrink-0 items-center gap-3 border-t bg-muted/40 px-6 text-[12px] text-muted-foreground max-md:hidden [@media(hover:none)]:hidden">
<span className="flex items-center gap-1">
<Kbd className={cap}>↑</Kbd>
<Kbd className={cap}>↓</Kbd>
diff --git a/src/components/nav/search-results.tsx b/src/components/nav/search-results.tsx
index 469b039b..53ac5bc2 100644
--- a/src/components/nav/search-results.tsx
+++ b/src/components/nav/search-results.tsx
@@ -1,6 +1,7 @@
"use client";
import { Command as CommandPrimitive } from "cmdk";
+import { usePathname } from "next/navigation";
import { ChevronRight, Clapperboard, CornerDownLeft, Film, LayoutGrid, Play, Wand2 } from "lucide-react";
import { MediaThumb } from "@/components/studio/result-media";
import type { Generation } from "@/lib/catalog/types";
@@ -16,12 +17,22 @@ import { CoverThumb } from "./cover-thumb";
* picture arrives.
*/
-/** A section's heading, as the launcher's columns have them. */
+/** A section's heading, as the launcher's columns have them: on the rows' cover column (8 px in, clear of the open page's pip). */
export const sectionHeading =
- "**:[[cmdk-group-heading]]:mb-1.5 **:[[cmdk-group-heading]]:ml-1.5 **:[[cmdk-group-heading]]:text-[11px] **:[[cmdk-group-heading]]:leading-[14px] **:[[cmdk-group-heading]]:font-semibold **:[[cmdk-group-heading]]:uppercase **:[[cmdk-group-heading]]:tracking-[.08em] **:[[cmdk-group-heading]]:text-brand-text";
+ "**:[[cmdk-group-heading]]:mb-1.5 **:[[cmdk-group-heading]]:ml-2 **:[[cmdk-group-heading]]:text-[11px] **:[[cmdk-group-heading]]:leading-[14px] **:[[cmdk-group-heading]]:font-semibold **:[[cmdk-group-heading]]:uppercase **:[[cmdk-group-heading]]:tracking-[.08em] **:[[cmdk-group-heading]]:text-brand-text";
-/** A selected row: a tint and a brand ring strong enough to find (focus stays in the field; cmdk marks it data-selected). */
-const selected = "data-[selected=true]:bg-accent data-[selected=true]:shadow-[inset_0_0_0_1.5px_var(--brand-text)]";
+/**
+ * A row's states are the nav's (nav-states.css): cmdk's one selected row (the mouse and the arrow keys move the same
+ * one; focus stays in the field) has the highlight, and the keyboard's ring while the keyboard leads. The open page's
+ * row carries the current mark.
+ */
+const selected = "nav-row nav-mark-start";
+
+/** aria-current for a hit that is the open page. */
+function useCurrent(href: string | undefined): "page" | undefined {
+ const pathname = usePathname();
+ return href && pathname === href.split(/[?#]/)[0] ? "page" : undefined;
+}
/** What kind of thing a hit is, as the tag at the end of its row says it. */
export function kindTag(hit: Pick<NavHit, "kind" | "navKind">): string {
@@ -122,7 +133,8 @@ export function BestRow({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) => v
<CommandPrimitive.Item
value={hit.key}
onSelect={() => onPick(hit)}
- className={cn("group/hit flex h-[58px] cursor-pointer items-center gap-3.5 rounded-xl py-[5px] pr-3 pl-[5px] outline-none", selected)}
+ 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)}
>
<HitCover hit={hit} size="thumb" />
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
@@ -141,7 +153,8 @@ export function AlsoTile({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) =>
<CommandPrimitive.Item
value={hit.key}
onSelect={() => onPick(hit)}
- className={cn("group/hit flex h-14 min-w-0 cursor-pointer items-center gap-3 rounded-xl py-[5px] pr-3 pl-[5px] outline-none", selected)}
+ 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)}
>
<HitCover hit={hit} size="chip" />
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
@@ -159,7 +172,8 @@ export function HitRow({ hit, onPick }: { hit: NavHit; onPick: (h: NavHit) => vo
<CommandPrimitive.Item
value={hit.key}
onSelect={() => onPick(hit)}
- className={cn("group/hit flex h-11 cursor-pointer items-center gap-3 rounded-[10px] pr-3 pl-1 text-[14px] outline-none", selected)}
+ aria-current={useCurrent(hit.href)}
+ className={cn("group/hit flex h-11 cursor-pointer items-center gap-3 rounded-[10px] pr-3 pl-2 text-[14px]", selected)}
>
<HitCover hit={hit} size="row" />
<Name hit={hit} crumb={hit.kind === "tool" ? hit.hint : undefined} className="min-w-0 flex-1 font-medium" />
@@ -177,10 +191,11 @@ export function StudioTile({ e, onPick }: { e: NavEntry; onPick: (e: NavEntry) =
value={`tile:${e.id}`}
keywords={[e.label]}
onSelect={() => onPick(e)}
- className={cn("group/hit flex h-11 min-w-0 cursor-pointer items-center gap-2.5 rounded-[10px] pr-2 pl-1 outline-none md:h-10", selected)}
+ 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)}
>
<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">
+ <span className="line-clamp-2 min-w-0 text-[13px] leading-[1.2] font-medium text-foreground group-aria-[current=page]/hit:font-semibold">
<span className="md:hidden">{e.short ?? e.label}</span>
<span className="max-md:hidden">{e.label}</span>
</span>
@@ -194,7 +209,7 @@ export function RecentRow({ g, onOpen }: { g: Generation; onOpen: (g: Generation
<CommandPrimitive.Item
value={`recent:${g.id}`}
onSelect={() => onOpen(g)}
- className={cn("group/hit flex h-14 min-w-0 cursor-pointer items-center gap-3 rounded-xl py-1 pr-3 pl-1 outline-none", 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)}
>
<span aria-hidden className="relative h-12 w-16 shrink-0 overflow-hidden rounded-[8px] bg-muted">
{g.outputs[0] && <MediaThumb output={g.outputs[0]} g={g} />}
diff --git a/src/components/nav/status-chips.tsx b/src/components/nav/status-chips.tsx
index 91ba31fe..ccdd67de 100644
--- a/src/components/nav/status-chips.tsx
+++ b/src/components/nav/status-chips.tsx
@@ -8,7 +8,7 @@ import { IntentLink } from "@/components/intent-link";
import { awayFix, openConnect, useComputerSupport } from "@/components/gpu/open-connect";
import { usePagePlace } from "@/components/gpu/use-page-place";
import { useHadItems } from "@/components/use-had-items";
-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
+import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { Skeleton } from "@/components/ui/skeleton";
import { ownGpuOf, signInHref, useEngineMode, useHydrated, useStatus, useViewer, type EngineMode, type StatusInfo } from "@/lib/api";
@@ -17,6 +17,7 @@ import { deviceLabel } from "@/lib/gpu/readiness";
import { safeLink, useInterest } from "@/lib/hosted";
import type { ViewerKind } from "@/lib/nav-model";
import { cn } from "@/lib/utils";
+import { MENU_ROW_1, NavMenuItem } from "./nav-row";
/*
* What the sidebar's footer said about GPUs, keys and balance, moved here unchanged in what it says and to whom: the
@@ -44,22 +45,33 @@ const ComputerNoteLive = dynamic(() => import("@/components/gpu/computer-runner"
type Viewer = NonNullable<StatusInfo["viewer"]>;
-const CHIP = "flex min-h-11 w-full flex-col justify-center gap-1 rounded-md px-2 py-1.5 text-left text-[12px] text-muted-foreground transition-colors hover:bg-accent motion-reduce:transition-none";
+/** A status row of the account menu or the You sheet: its dot on the rows' icon column, its words on their label column. */
+const CHIP = "nav-row flex min-h-11 w-full flex-col justify-center gap-1 py-1.5 text-left text-[12px] text-muted-foreground";
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. */
+function DotSlot({ ok }: { ok: boolean | undefined }) {
+ return (
+ <span aria-hidden className="grid w-4 shrink-0 place-items-center">
+ <StatusDot ok={ok} />
+ </span>
+ );
+}
+
/**
* A link or button as a row of a menu (`item`: arrow keys reach it, choosing it closes the menu) or as it is
* elsewhere. The classes go through the menu item, so they win over its defaults.
*/
function Actionable({ item, className, children }: { item?: boolean; className: string; children: React.ReactElement<{ className?: string }> }) {
- if (!item) return cloneElement(children, { className: cn(className, children.props.className) });
+ // A sheet row's words sit on the sheet's gutter (its fill reaches 8 px past it); a menu row's on the menu's.
+ if (!item) return cloneElement(children, { className: cn("-mx-2 rounded-xl px-2", className, children.props.className) });
return (
- <DropdownMenuItem asChild className={cn("items-stretch focus:bg-accent", className)}>
+ <NavMenuItem asChild className={cn("items-stretch", className)}>
{children}
- </DropdownMenuItem>
+ </NavMenuItem>
);
}
@@ -75,12 +87,12 @@ export function YourGpuChip({ gpu, guest, hosted, item }: { gpu: Viewer["gpu"];
const vram = g.vramBytes ? `${Math.round(g.vramBytes / 2 ** 30)} GB` : "";
const inner = (
<>
- <span className="flex w-full items-center gap-2">
- <StatusDot ok={g.online} /> Your GPU
+ <span className="flex w-full items-center gap-3">
+ <DotSlot ok={g.online} /> Your GPU
<span className="ml-auto">{g.online ? "online" : g.comfy === "down" ? "ComfyUI not running" : g.comfy === "no-setting" ? "needs a setting" : "offline"}</span>
</span>
{(g.device || vram || g.mode === "computer") && (
- <span className="truncate text-[11px]">{[g.mode === "computer" && "Your computer", deviceLabel(g.device), vram && `${vram} VRAM`].filter(Boolean).join(" · ")}</span>
+ <span className="truncate pl-7 text-[11px]">{[g.mode === "computer" && "Your computer", deviceLabel(g.device), vram && `${vram} VRAM`].filter(Boolean).join(" · ")}</span>
)}
</>
);
@@ -97,8 +109,8 @@ export function YourGpuChip({ gpu, guest, hosted, item }: { gpu: Viewer["gpu"];
);
}
const body = (
- <span className="flex w-full items-center gap-2">
- <StatusDot ok={false} /> Your GPU
+ <span className="flex w-full items-center gap-3">
+ <DotSlot ok={false} /> Your GPU
{/* Runs go to this studio's GPUs too (hosted runs): one's own is an option. */}
<span className={cn("ml-auto font-medium", hosted ? "text-muted-foreground" : "text-brand-text")}>{hosted ? "Optional" : "Connect"}</span>
</span>
@@ -134,37 +146,37 @@ function BalanceItems({ viewer }: { viewer: Viewer }) {
const action = safeLink(b.action?.url);
return (
<>
- <DropdownMenuLabel className="text-[12px] font-normal text-muted-foreground">{b.text}</DropdownMenuLabel>
+ <DropdownMenuLabel className="px-2.5 text-[12px] font-normal text-muted-foreground">{b.text}</DropdownMenuLabel>
{b.detail.map((d, i) => (
- <div key={i} className="flex justify-between gap-3 px-2 py-1 text-[12px]">
+ <div key={i} className="flex justify-between gap-3 px-2.5 py-1 text-[12px]">
<span className="text-muted-foreground">{d.label}</span>
<span className="text-right">{d.text}</span>
</div>
))}
- <DropdownMenuSeparator />
+ <DropdownMenuSeparator className="mx-2.5 my-1.5" />
{action && b.action && (
- <DropdownMenuItem asChild>
+ <NavMenuItem asChild className={MENU_ROW_1}>
<a href={action} target={action.startsWith("/") ? undefined : "_blank"} rel="noopener noreferrer">
{b.action.label}
</a>
- </DropdownMenuItem>
+ </NavMenuItem>
)}
- {b.offer && <DropdownMenuItem onSelect={() => interest.mutate(b.offer!.key)}>{b.offer.label}</DropdownMenuItem>}
+ {b.offer && <NavMenuItem className={MENU_ROW_1} onSelect={() => interest.mutate(b.offer!.key)}>{b.offer.label}</NavMenuItem>}
{(viewer.links ?? []).map((l, i) => {
const href = safeLink(l.url);
return href ? (
- <DropdownMenuItem key={i} asChild>
+ <NavMenuItem key={i} asChild className={MENU_ROW_1}>
<a href={href} target={href.startsWith("/") ? undefined : "_blank"} rel="noopener noreferrer">
{l.label}
</a>
- </DropdownMenuItem>
+ </NavMenuItem>
) : null;
})}
- <DropdownMenuItem asChild>
+ <NavMenuItem asChild className={MENU_ROW_1}>
<IntentLink href="/connect">
<Cpu /> Use your own GPU or keys (free)
</IntentLink>
- </DropdownMenuItem>
+ </NavMenuItem>
</>
);
}
@@ -189,16 +201,16 @@ export function BalanceChip({ viewer, pill, className }: { viewer: Viewer; pill?
aria-label={`${chip}${refill ? `, ${refill}` : ""}`}
className={cn(
pill
- ? "inline-flex h-9 max-w-56 items-center gap-2 rounded-full [@media(pointer:coarse)]:h-11 border border-sidebar-border px-3 text-[12.5px] text-muted-foreground transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none data-[state=open]:bg-accent"
- : CHIP,
+ ? "inline-flex h-9 max-w-56 items-center gap-2 rounded-full [@media(pointer:coarse)]:h-11 border border-sidebar-border px-3 text-[12.5px] text-muted-foreground nav-row"
+ : cn(CHIP, "-mx-2 rounded-xl px-2"),
className,
)}
>
- <span className="flex min-w-0 items-center gap-2">
- <StatusDot ok={b.amount > 0} /> <span className="truncate font-medium text-foreground">{chip}</span>
+ <span className={cn("flex min-w-0 items-center", pill ? "gap-2" : "gap-3")}>
+ {pill ? <StatusDot ok={b.amount > 0} /> : <DotSlot ok={b.amount > 0} />} <span className="truncate font-medium text-foreground">{chip}</span>
{refill && <span className={cn("ml-auto shrink-0", pill && "hidden xl:inline")}>{refill}</span>}
</span>
- {!pill && b.sub && <span className="truncate text-[11px]">{b.sub}</span>}
+ {!pill && b.sub && <span className="truncate pl-7 text-[11px]">{b.sub}</span>}
</button>
</DropdownMenuTrigger>
<DropdownMenuContent side={pill ? "bottom" : "top"} align={pill ? "end" : "start"} className="w-64">
@@ -214,12 +226,12 @@ export function BalanceSection({ viewer }: { viewer: Viewer }) {
const { chip, refill } = balanceLabel(viewer);
return (
<>
- <DropdownMenuLabel className="flex flex-col gap-0.5 font-normal">
- <span className="flex items-center gap-2 text-[12.5px]">
- <StatusDot ok={b.amount > 0} /> <span className="font-medium text-foreground">{chip}</span>
+ <DropdownMenuLabel className="flex flex-col gap-0.5 px-2.5 font-normal">
+ <span className="flex items-center gap-3 text-[12.5px]">
+ <DotSlot ok={b.amount > 0} /> <span className="font-medium text-foreground">{chip}</span>
{refill && <span className="ml-auto text-[12px] text-muted-foreground">{refill}</span>}
</span>
- {b.sub && <span className="text-[11px] text-muted-foreground">{b.sub}</span>}
+ {b.sub && <span className="pl-7 text-[11px] text-muted-foreground">{b.sub}</span>}
</DropdownMenuLabel>
<BalanceItems viewer={viewer} />
</>
@@ -253,7 +265,7 @@ export function OwnerStatus({ item }: { item?: boolean }) {
if (status?.viewer) return null;
const cloud = !!status && !!(status.providers.fal?.configured || status.providers.replicate?.configured);
const comfy = status?.providers.comfyui?.configured;
- const modeLine = mode !== "both" && <span className="px-2 pb-1 text-[11px] text-muted-foreground">{mode === "open" ? "Open source only" : "Paid APIs only"}</span>;
+ const modeLine = mode !== "both" && <span className={cn("pb-1 text-[11px] text-muted-foreground", item ? "pl-[38px]" : "pl-7")}>{mode === "open" ? "Open source only" : "Paid APIs only"}</span>;
if (!status)
return (
<div aria-hidden className="flex h-[30px] items-center px-2">
@@ -264,9 +276,9 @@ export function OwnerStatus({ item }: { item?: boolean }) {
return (
<>
{mode !== "open" && (
- <Actionable item={item} className={cn(CHIP, "flex-row items-center gap-2")}>
+ <Actionable item={item} className={cn(CHIP, "flex-row items-center gap-3")}>
<IntentLink href="/settings">
- <StatusDot ok={cloud} /> Cloud models
+ <DotSlot ok={cloud} /> Cloud models
<span className="ml-auto">{cloud ? "connected" : "add key"}</span>
</IntentLink>
</Actionable>
@@ -279,18 +291,18 @@ export function OwnerStatus({ item }: { item?: boolean }) {
<Actionable item={item} className={cn(CHIP, "gap-1.5")}>
<IntentLink href="/settings">
{mode !== "open" && (
- <span className="flex w-full items-center gap-2">
- <StatusDot ok={cloud} /> Cloud models
+ <span className="flex w-full items-center gap-3">
+ <DotSlot ok={cloud} /> Cloud models
<span className="ml-auto">{cloud ? "connected" : "add key"}</span>
</span>
)}
{mode !== "cloud" && (
- <span className="flex w-full items-center gap-2">
- <StatusDot ok={comfy} /> ComfyUI
+ <span className="flex w-full items-center gap-3">
+ <DotSlot ok={comfy} /> ComfyUI
<span className="ml-auto">{comfy ? "online" : "offline"}</span>
</span>
)}
- {mode !== "both" && <span className="text-[11px] text-muted-foreground">{mode === "open" ? "Open source only" : "Paid APIs only"}</span>}
+ {mode !== "both" && <span className="pl-7 text-[11px] text-muted-foreground">{mode === "open" ? "Open source only" : "Paid APIs only"}</span>}
</IntentLink>
</Actionable>
);
@@ -357,14 +369,14 @@ export function ComputerPill() {
<>
<Popover>
<PopoverTrigger
- className="inline-flex h-9 w-full min-w-9 items-center justify-center gap-2 rounded-full [@media(pointer:coarse)]:h-11 border border-sidebar-border px-2 text-[12.5px] text-muted-foreground transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none data-[state=open]:bg-accent xl:px-3"
+ className="inline-flex h-9 w-full min-w-9 items-center justify-center gap-2 rounded-full [@media(pointer:coarse)]:h-11 border border-sidebar-border px-2 text-[12.5px] text-muted-foreground nav-row xl:px-3"
>
<ComputerPillFace />
</PopoverTrigger>
<PopoverContent align="end" className="group/note w-72">
<ComputerNote />
<p className="text-[12px] text-muted-foreground group-has-[[role=status]]/note:hidden">Your runs go to the GPU on this computer. Keep a Fuobe tab open while they run.</p>
- <IntentLink href="/connect" className="text-[12px] font-medium text-brand-text underline-offset-4 hover:underline">
+ <IntentLink href="/connect" className="text-[12px] font-medium text-brand-text underline-offset-4 nav-hover:underline">
Your GPU
</IntentLink>
</PopoverContent>
diff --git a/src/components/nav/studios-launcher.tsx b/src/components/nav/studios-launcher.tsx
index 56a91c10..d0a6aad6 100644
--- a/src/components/nav/studios-launcher.tsx
+++ b/src/components/nav/studios-launcher.tsx
@@ -60,7 +60,6 @@ export function launcherCurrent(pathname: string): string | undefined {
export const LAUNCHER_PANEL =
"absolute inset-x-0 top-full max-h-[calc(100dvh-3.5rem)] overflow-y-auto overscroll-contain border-b border-sidebar-border bg-popover text-popover-foreground shadow-heavy motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150";
-const LINK_FOCUS = "outline-none focus-visible:ring-2 focus-visible:ring-ring";
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>;
@@ -73,11 +72,7 @@ function LeadCard({ e, col, current, now }: { e: NavEntry; col: number; current:
data-col={col}
data-row={0}
aria-current={current ? "page" : undefined}
- className={cn(
- "group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground hover:border-border-strong motion-safe:transition-colors motion-reduce:transition-none",
- current && "border-brand-text/40 bg-brand-faint",
- LINK_FOCUS,
- )}
+ className="nav-row group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground"
>
<CoverThumb
id={e.cover}
@@ -86,12 +81,12 @@ function LeadCard({ e, col, current, now }: { e: NavEntry; col: number; current:
eager
className="max-h-[max(64px,calc(100dvh-592px))] rounded-none md:max-lg:max-h-[max(56px,calc(100dvh-460px))]"
/>
- <span className="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-3 pt-2.5 pb-3 md:max-lg:px-2.5 md:max-lg:py-2">
<span className="flex min-w-0 items-center gap-1.5">
- <span className={cn("truncate text-[14px] leading-snug font-semibold md:max-lg:text-[13px]")}>{e.label}</span>
+ <span className="truncate text-[14px] leading-[18px] font-semibold md:max-lg:text-[13px]">{e.label}</span>
{isNew(e, now) && <NewBadge />}
</span>
- <span className="line-clamp-2 text-[12px] leading-[1.35] text-muted-foreground md:max-lg:hidden">{e.what}</span>
+ <span className="line-clamp-2 text-[12px] leading-4 text-muted-foreground md:max-lg:hidden">{e.what}</span>
</span>
</IntentLink>
);
@@ -105,20 +100,16 @@ function Row({ e, col, row, current, now }: { e: NavEntry; col: number; row: num
data-row={row}
aria-current={current ? "page" : undefined}
title={e.label}
- className={cn(
- "flex min-h-11 items-center gap-2.5 rounded-[10px] px-2 py-1.5 hover:bg-accent motion-safe:transition-colors motion-reduce:transition-none md:max-lg:min-h-9 md:max-lg:px-1.5",
- current && "bg-brand-faint",
- LINK_FOCUS,
- )}
+ className="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"
>
{/* Six columns leave a row its name and line below 1440 px, and its name alone below 1280 px. */}
<CoverThumb id={e.cover} size="row" icon={e.icon} eager 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-snug font-medium max-xl:line-clamp-2 max-xl:whitespace-normal", current && "font-semibold")}>{e.label}</span>
+ <span className={cn("truncate text-[13px] leading-[18px] font-medium max-xl:line-clamp-2 max-xl:whitespace-normal", current && "font-semibold")}>{e.label}</span>
{isNew(e, now) && <NewBadge />}
</span>
- <span className="line-clamp-2 text-[11.5px] leading-snug text-muted-foreground max-xl:hidden">{e.what}</span>
+ <span className="line-clamp-2 text-[12px] leading-4 text-muted-foreground max-xl:hidden">{e.what}</span>
</span>
</IntentLink>
);
@@ -131,10 +122,10 @@ function Row({ e, col, row, current, now }: { e: NavEntry; col: number; row: num
export function LauncherColumns({ kind, current, now }: { kind: ViewerKind | undefined; current?: string; now: number }) {
const ids = useId();
return (
- <div className="grid grid-cols-6 gap-4 2xl:gap-6">
+ <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
{launcherColumns(kind).map((c, ci) => (
<div key={c.group.id} data-group={c.group.id} className="flex min-w-0 flex-col gap-2">
- <p id={`${ids}-${c.group.id}`} className="px-0.5 text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase">
+ <p id={`${ids}-${c.group.id}`} title={c.group.label} className="truncate text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase">
{c.group.label}
</p>
<ul aria-labelledby={`${ids}-${c.group.id}`} className="flex flex-col gap-0.5">
@@ -166,7 +157,7 @@ export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSe
onClose();
}, [pathname, onClose]);
return (
- <div className="mx-auto max-w-[1440px] px-6 pt-5 pb-6 lg:px-10 lg:pt-6 lg:pb-7">
+ <div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
<div className="flex items-center gap-3.5 pb-4">
<p className="text-[13px] text-muted-foreground">{studioCount()} studios, grouped by what you want to make</p>
{/* A plain link in Tab order before the grid; the grid's arrow keys skip it (it has no data-col). */}
@@ -174,7 +165,7 @@ export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSe
href={STUDIOS_AREA_HREF}
aria-current={pathname === STUDIOS_AREA_HREF ? "page" : undefined}
aria-label="See all studios"
- className={cn("group/all -ml-1 inline-flex h-9 items-center gap-1 rounded-[10px] px-2 text-[13px] font-medium text-brand-text hover:bg-brand-faint", LINK_FOCUS)}
+ 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"
>
See all
<ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
@@ -184,7 +175,7 @@ export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSe
type="button"
onClick={onSearch}
aria-keyshortcuts="/"
- className={cn("inline-flex h-9 items-center gap-2 rounded-[10px] px-2.5 text-[13px] font-medium text-brand-text hover:bg-brand-faint", LINK_FOCUS)}
+ className="nav-row inline-flex h-10 items-center gap-2 rounded-[10px] px-2.5 text-[13px] font-medium text-brand-text"
>
<Search aria-hidden className="size-4" />
Search all apps, effects and tools
@@ -270,6 +261,14 @@ export function StudiosLauncher({ active, current, onTap }: { active?: boolean;
if (next) panel.current.querySelector<HTMLElement>(`[data-col="${next.col}"][data-row="${next.row}"]`)?.focus();
};
+ // The mouse moves the keyboard's place: the link under it takes focus (quietly: the ring is the keyboard's), so the
+ // arrow keys go on from where the mouse left off and only one link is ever highlighted.
+ const onPanelPointer = (e: React.PointerEvent) => {
+ if (e.pointerType !== "mouse") return;
+ const at = (e.target as HTMLElement).closest<HTMLElement>("[data-col]");
+ if (at && at !== document.activeElement) at.focus({ preventScroll: true });
+ };
+
return (
<div
ref={root}
@@ -338,6 +337,7 @@ export function StudiosLauncher({ active, current, onTap }: { active?: boolean;
aria-label="All studios"
hidden={!open}
onKeyDown={onPanelKey}
+ onPointerMove={onPanelPointer}
onClick={(e) => {
if ((e.target as Element).closest("a[href]")) close(false);
}}
diff --git a/src/components/nav/studios-sheet.tsx b/src/components/nav/studios-sheet.tsx
index d786c68c..0600fb79 100644
--- a/src/components/nav/studios-sheet.tsx
+++ b/src/components/nav/studios-sheet.tsx
@@ -7,11 +7,10 @@ import { CoverThumb } from "@/components/nav/cover-thumb";
import { useNavUi, useViewerKind } from "@/components/nav/nav-ui";
import { IntentLink } from "@/components/intent-link";
import { isNew, LAUNCHER_GROUPS, launcherActive, launcherEntries, type LauncherGroupId, type NavEntry } from "@/lib/nav-model";
-import { cn } from "@/lib/utils";
/** A goal chip: 32 px to look at, 44 px to tap (the row's padding holds the larger hit area). */
const CHIP =
- "relative h-8 min-w-11 shrink-0 rounded-full border border-border bg-secondary px-[7px] text-[12px] font-medium text-secondary-foreground outline-none after:absolute after:inset-x-0 after:-inset-y-1.5 after:content-[''] focus-visible:ring-2 focus-visible:ring-ring aria-pressed:border-transparent aria-pressed:bg-foreground aria-pressed:text-background motion-safe:transition-colors";
+ "nav-focus relative h-8 min-w-11 shrink-0 rounded-full border border-border bg-secondary px-[7px] text-[12px] font-medium text-secondary-foreground after:absolute after:inset-x-0 after:-inset-y-1.5 after:content-[''] active:bg-[var(--nav-press)] aria-pressed:border-transparent aria-pressed:bg-foreground aria-pressed:text-background aria-pressed:active:bg-foreground/85 motion-safe:transition-colors";
function Tile({ entry, current }: { entry: NavEntry; current: boolean }) {
const fresh = isNew(entry);
@@ -20,7 +19,7 @@ function Tile({ entry, current }: { entry: NavEntry; current: boolean }) {
<IntentLink
href={entry.href}
aria-current={current ? "page" : undefined}
- className="group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-0.5 text-center outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring"
+ className="nav-row nav-mark-under group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-1 pb-2.5 text-center"
>
<span className="relative">
<CoverThumb
@@ -28,7 +27,7 @@ function Tile({ entry, current }: { entry: NavEntry; current: boolean }) {
icon={entry.icon}
size="tile"
eager
- className="size-13 group-aria-[current=page]/tile:ring-2 group-aria-[current=page]/tile:ring-primary group-aria-[current=page]/tile:ring-offset-2 group-aria-[current=page]/tile:ring-offset-popover"
+ className="size-13"
/>
{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">
@@ -49,7 +48,7 @@ function Tile({ entry, current }: { entry: NavEntry; current: boolean }) {
}
const SHORTCUT =
- "flex h-11 min-w-0 items-center justify-center gap-1.5 rounded-xl bg-secondary px-2 text-[12.5px] font-medium text-secondary-foreground outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring";
+ "nav-focus flex h-11 min-w-0 items-center justify-center gap-1.5 rounded-xl bg-secondary px-2 text-[12.5px] font-medium text-secondary-foreground active:bg-[var(--nav-press)]";
/**
* Where to go from a full-screen studio, which has no tab bar: Home, Library, You and Search, above the studios. Only
@@ -98,7 +97,7 @@ export function StudiosSheet({ group: initial, onSearch }: { group?: LauncherGro
))}
</div>
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4">
- <ul aria-label={group ? LAUNCHER_GROUPS.find((g) => g.id === group)?.label : "All studios"} className="grid grid-cols-5 gap-x-1 gap-y-1.5 pb-1">
+ <ul aria-label={group ? LAUNCHER_GROUPS.find((g) => g.id === group)?.label : "All studios"} className="grid grid-cols-5 gap-x-1 gap-y-0.5 pb-1">
{tiles.map((e) => (
<Tile key={e.id} entry={e} current={e.id === current} />
))}
diff --git a/src/components/nav/top-bar.tsx b/src/components/nav/top-bar.tsx
index 3d2c25fb..91ad6f31 100644
--- a/src/components/nav/top-bar.tsx
+++ b/src/components/nav/top-bar.tsx
@@ -1,10 +1,10 @@
"use client";
-import { ArrowRight, ChevronDown, MoreHorizontal, Plus, Search } from "lucide-react";
+import { ChevronDown, MoreHorizontal, Plus, Search } from "lucide-react";
import { usePathname } from "next/navigation";
import { Suspense } from "react";
import { IntentLink } from "@/components/intent-link";
-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
+import { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Kbd } from "@/components/ui/kbd";
import { NEW_CREATION_HREF } from "@/lib/nav";
import { area, areaOfPath, areaPageOf, type AreaId } from "@/lib/nav-areas";
@@ -13,7 +13,8 @@ import { isPlainClick, useTappedTab } from "@/lib/use-tapped-tab";
import { cn } from "@/lib/utils";
import { BarSplitMenu } from "./bar-split";
import { CoverThumb, NavIcon } from "./cover-thumb";
-import { CreateMenu, NAV_MENU_ITEM } from "./create-menu";
+import { CreateMenu } from "./create-menu";
+import { MENU_ROW_2, NavMenuItem, ROW_LINE, rowName, SeeAllRow } from "./nav-row";
import { useViewerKind } from "./nav-ui";
import { useSearchPalette } from "./search-context";
import { BarPills } from "./status-chips";
@@ -35,9 +36,13 @@ export { prefetchHrefs } from "./nav-prefetch";
* width. Below md the phone tabs take over (phone-tabs.tsx).
*/
-/** A bar item (link, menu button, the launcher's button). data-active: the page is one of its destinations. */
+/**
+ * A bar item (link, menu button, the launcher's button). Its states are the nav's (nav-states.css): the highlight on
+ * hover or keyboard focus, foreground words and a turned chevron while its menu is open, and for the open page (aria-current, or data-active: the page is
+ * one of its destinations) a pip under the words, never a fill.
+ */
export const BAR_ITEM =
- "group/bar-item inline-flex h-10 shrink-0 [@media(pointer:coarse)]:h-11 items-center gap-1.5 rounded-[10px] px-2.5 text-[14px] whitespace-nowrap text-foreground/80 outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors data-[active]:bg-accent data-[active]:font-semibold data-[active]:text-foreground aria-[current=page]:bg-accent aria-[current=page]:font-semibold aria-[current=page]:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground min-[1440px]:px-3.5";
+ "nav-row nav-mark-under group/bar-item inline-flex h-10 shrink-0 [@media(pointer:coarse)]:h-11 items-center gap-1.5 rounded-[10px] px-2.5 text-[14px] whitespace-nowrap text-foreground/80 nav-hover:text-foreground focus-visible:text-foreground data-[state=open]:text-foreground data-[active]:font-semibold data-[active]:text-foreground aria-[current=page]:font-semibold aria-[current=page]:text-foreground min-[1440px]:px-3.5";
/**
* Which bar item holds the open page, one item per page (areaOfPath): Create for the create tools, Studios for a studio
@@ -73,15 +78,15 @@ const NONE: Active = barActive("");
function RichItem({ e, current }: { e: NavEntry; current: boolean }) {
return (
- <DropdownMenuItem asChild className={cn("min-h-12 gap-3 rounded-lg px-2 py-1.5 data-[current]:bg-brand-faint", NAV_MENU_ITEM)}>
- <IntentLink href={e.href} aria-current={current ? "page" : undefined} data-current={current || undefined}>
+ <NavMenuItem asChild className={MENU_ROW_2}>
+ <IntentLink href={e.href} aria-current={current ? "page" : undefined}>
<CoverThumb id={e.cover} size="row" icon={e.icon} eager />
<span className="flex min-w-0 flex-col">
- <span className={cn("text-[13.5px] leading-tight font-medium", current && "font-semibold")}>{e.label}</span>
- <span className="truncate text-[12px] leading-snug text-muted-foreground">{e.what}</span>
+ <span className={rowName(current)}>{e.label}</span>
+ <span className={ROW_LINE}>{e.what}</span>
</span>
</IntentLink>
- </DropdownMenuItem>
+ </NavMenuItem>
);
}
@@ -93,19 +98,6 @@ function useOn(): (e: NavEntry) => boolean {
return (e) => pathname === e.href || pathname.startsWith(`${e.href}/`);
}
-/** "See all" at the foot of a menu: the area's own page (`name`: what it says to a screen reader). */
-function SeeAllItem({ href, name }: { href: string; name: string }) {
- const pathname = usePathname();
- return (
- <DropdownMenuItem asChild className={cn("group/all mt-1 h-10 gap-2 rounded-lg px-2.5 text-[13.5px] font-medium text-brand-text", NAV_MENU_ITEM)}>
- <IntentLink href={href} aria-current={pathname === href ? "page" : undefined} aria-label={name}>
- See all
- <ArrowRight aria-hidden className="size-4 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
- </IntentLink>
- </DropdownMenuItem>
- );
-}
-
const MOTIONS_AREA_HREF = area("motions").href;
function MotionsItems() {
@@ -115,7 +107,7 @@ function MotionsItems() {
{pick(["motions", "effects"]).map((e) => (
<RichItem key={e.id} e={e} current={on(e)} />
))}
- <SeeAllItem href={MOTIONS_AREA_HREF} name="See all motions & effects" />
+ <SeeAllRow href={MOTIONS_AREA_HREF} name="See all motions & effects" className="mt-1" />
</>
);
}
@@ -149,22 +141,22 @@ function MoreItems() {
</div>
))}
<div className="xl:hidden">
- <SeeAllItem href={MOTIONS_AREA_HREF} name="See all motions & effects" />
- <DropdownMenuSeparator className="my-1.5" />
+ <SeeAllRow href={MOTIONS_AREA_HREF} name="See all motions & effects" className="mt-1" />
+ <DropdownMenuSeparator className="mx-2.5 my-1.5" />
</div>
{pick(["canvas", "assist"]).map((e) => {
return (
- <DropdownMenuItem key={e.id} asChild className={cn("min-h-12 gap-3 rounded-lg px-2 py-1.5 data-[current]:bg-brand-faint", NAV_MENU_ITEM)}>
- <IntentLink href={e.href} eager={e.eager} aria-current={on(e) ? "page" : undefined} data-current={on(e) || undefined}>
+ <NavMenuItem key={e.id} asChild className={MENU_ROW_2}>
+ <IntentLink href={e.href} eager={e.eager} aria-current={on(e) ? "page" : undefined}>
<span className="grid h-[27px] w-9 shrink-0 place-items-center rounded-[6px] bg-muted">
- <NavIcon name={e.icon} className="size-4 text-muted-foreground" />
+ <NavIcon name={e.icon} className="nav-icon size-4 text-muted-foreground" />
</span>
<span className="flex min-w-0 flex-col">
- <span className="text-[13.5px] leading-tight font-medium">{e.label}</span>
- <span className="truncate text-[12px] leading-snug text-muted-foreground">{e.what}</span>
+ <span className={rowName(on(e))}>{e.label}</span>
+ <span className={ROW_LINE}>{e.what}</span>
</span>
</IntentLink>
- </DropdownMenuItem>
+ </NavMenuItem>
);
})}
</>
@@ -177,7 +169,7 @@ function MoreMenu({ active }: { active: Active }) {
<DropdownMenu modal={false} onOpenChange={(o) => o && warmNav("more")}>
<DropdownMenuTrigger
// Marked when it holds the open page at this width: Canvas and Assist always; Apps, Motions and Effects below xl.
- className={cn(BAR_ITEM, "min-[1440px]:hidden max-xl:data-[narrow]:bg-accent max-xl:data-[narrow]:font-semibold max-xl:data-[narrow]:text-foreground")}
+ className={cn(BAR_ITEM, "min-[1440px]:hidden max-xl:data-[narrow]:font-semibold max-xl:data-[narrow]:text-foreground")}
data-active={active.canvas || active.assist || undefined}
data-narrow={active.apps || active.motions || undefined}
>
@@ -240,9 +232,9 @@ function SearchField() {
onPointerEnter={() => search.warm()}
onFocus={() => search.warm()}
className={cn(
- "inline-flex h-10 shrink-0 items-center gap-2 rounded-[10px] text-[13.5px] [@media(pointer:coarse)]:h-11 text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors",
- "w-10 justify-center hover:bg-accent hover:text-foreground [@media(pointer:coarse)]:w-11",
- "lg:max-[1439.98px]:w-[200px] lg:justify-start lg:border lg:border-input lg:bg-background/60 lg:px-3 lg:hover:border-border-strong lg:hover:bg-background min-[1440px]:w-[280px]",
+ "nav-focus inline-flex h-10 shrink-0 items-center gap-2 rounded-[10px] text-[13.5px] [@media(pointer:coarse)]:h-11 text-muted-foreground motion-safe:transition-colors",
+ "w-10 justify-center nav-hover:bg-[var(--nav-hi)] nav-hover:text-foreground active:bg-[var(--nav-press)] [@media(pointer:coarse)]:w-11",
+ "lg:max-[1439.98px]:w-[200px] lg:justify-start lg:border lg:border-input lg:bg-background/60 lg:px-3 lg:nav-hover:border-border-strong lg:nav-hover:bg-background lg:active:bg-background min-[1440px]:w-[280px]",
)}
>
<Search aria-hidden className="size-[18px] shrink-0 lg:size-4" />
@@ -268,7 +260,7 @@ function NewCreation() {
<IntentLink
href={NEW_CREATION_HREF}
eager
- className="inline-flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-full border border-border-strong px-2.5 text-[14px] font-semibold whitespace-nowrap text-foreground outline-none hover:bg-accent focus-visible:ring-2 [@media(pointer:coarse)]:h-11 [html[data-viewer]:not([data-viewer=guest])_&]:border-transparent [html[data-viewer]:not([data-viewer=guest])_&]:bg-primary [html[data-viewer]:not([data-viewer=guest])_&]:text-primary-foreground [html[data-viewer]:not([data-viewer=guest])_&]:hover:bg-primary/90 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar motion-safe:transition-colors lg:pr-4 lg:pl-3"
+ className="nav-focus-out inline-flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-full border border-border-strong px-2.5 text-[14px] font-semibold whitespace-nowrap text-foreground nav-hover:bg-[var(--nav-hi)] active:bg-[var(--nav-press)] [@media(pointer:coarse)]:h-11 [html[data-viewer]:not([data-viewer=guest])_&]:border-transparent [html[data-viewer]:not([data-viewer=guest])_&]:bg-primary [html[data-viewer]:not([data-viewer=guest])_&]:text-primary-foreground [html[data-viewer]:not([data-viewer=guest])_&]:nav-hover:bg-primary/90 [html[data-viewer]:not([data-viewer=guest])_&]:active:bg-primary/85 motion-safe:transition-colors lg:pr-4 lg:pl-3"
>
<Plus aria-hidden className="size-[18px]" />
<span className="sr-only lg:not-sr-only">New creation</span>
@@ -295,14 +287,14 @@ export function TopBar() {
<>
<header
data-top-bar
- className="sticky top-0 z-40 hidden h-14 items-center gap-1 border-b border-sidebar-border bg-sidebar/90 px-4 backdrop-blur-md md:flex lg:max-[1439.98px]:px-5 min-[1440px]:px-6 print:hidden"
+ className="sticky top-0 z-40 hidden h-14 items-center gap-1 border-b border-sidebar-border bg-sidebar/90 pr-4 pl-5 backdrop-blur-md md:flex lg:max-[1439.98px]:pr-5 min-[1440px]:pr-6 print:hidden"
>
<nav aria-label="Main" className="flex min-w-0 items-center gap-0.5">
<IntentLink
href="/"
eager
aria-label="Fuobe home"
- className="mr-1.5 inline-flex shrink-0 items-center self-stretch rounded-md px-1 font-heading text-[24px] leading-none outline-none focus-visible:ring-2 focus-visible:ring-ring lg:mr-3"
+ className="nav-focus mr-1.5 inline-flex shrink-0 items-center self-stretch rounded-md px-1 font-heading text-[24px] leading-none lg:mr-3"
>
Fuobe
</IntentLink>
diff --git a/src/components/nav/viewer-slot.tsx b/src/components/nav/viewer-slot.tsx
index ce4585c9..44f2ee71 100644
--- a/src/components/nav/viewer-slot.tsx
+++ b/src/components/nav/viewer-slot.tsx
@@ -17,23 +17,23 @@ import { useViewerKind } from "./nav-ui";
/**
* Fixed widths, so the placeholder and what replaces it take the same room: Log in 68 (from 1440 px), Sign up 84, the menu
- * button 36 (44 on a touch screen), 6 between.
+ * button 40 like the bar's other items (44 on a touch screen), 6 between.
*/
export const VIEWER_W = {
- guest: "w-[126px] min-[1440px]:w-[200px] [@media(pointer:coarse)]:w-[134px] [@media(pointer:coarse)]:min-[1440px]:w-[208px]",
- member: "w-9 [@media(pointer:coarse)]:w-11",
+ guest: "w-[130px] min-[1440px]:w-[204px] [@media(pointer:coarse)]:w-[134px] [@media(pointer:coarse)]:min-[1440px]:w-[208px]",
+ member: "w-10 [@media(pointer:coarse)]:w-11",
} as const;
const GUEST_BUTTON =
- "inline-flex h-9 shrink-0 items-center justify-center rounded-full text-[13.5px] [@media(pointer:coarse)]:h-11 font-medium whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors";
+ "nav-focus-out inline-flex h-10 shrink-0 items-center justify-center rounded-full text-[13.5px] [@media(pointer:coarse)]:h-11 font-medium whitespace-nowrap motion-safe:transition-colors";
function GuestButtons({ here }: { here: string }) {
return (
<>
- <a href={signInHref("login", here)} className={cn(GUEST_BUTTON, "hidden w-[68px] text-foreground/80 hover:bg-accent hover:text-foreground min-[1440px]:inline-flex")}>
+ <a href={signInHref("login", here)} className={cn(GUEST_BUTTON, "hidden w-[68px] text-foreground/80 nav-hover:bg-[var(--nav-hi)] nav-hover:text-foreground active:bg-[var(--nav-press)] min-[1440px]:inline-flex")}>
Log in
</a>
- <a href={signInHref("signup", here)} className={cn(GUEST_BUTTON, "w-[84px] bg-primary font-semibold text-primary-foreground hover:bg-primary/90")}>
+ <a href={signInHref("signup", here)} className={cn(GUEST_BUTTON, "w-[84px] bg-primary font-semibold text-primary-foreground nav-hover:bg-primary/90 active:bg-primary/85")}>
Sign up
</a>
</>
@@ -66,7 +66,7 @@ export function ViewerSlot() {
<span
aria-hidden
data-slot="viewer"
- className={cn("block h-9 shrink-0", VIEWER_W.guest, "[html[data-viewer='account']_&]:w-9 [html[data-viewer='owner']_&]:w-9 [@media(pointer:coarse)]:[html[data-viewer='account']_&]:w-11 [@media(pointer:coarse)]:[html[data-viewer='owner']_&]:w-11")}
+ className={cn("block h-10 shrink-0", VIEWER_W.guest, "[html[data-viewer='account']_&]:w-10 [html[data-viewer='owner']_&]:w-10 [@media(pointer:coarse)]:[html[data-viewer='account']_&]:w-11 [@media(pointer:coarse)]:[html[data-viewer='owner']_&]:w-11")}
/>
);
if (kind !== "guest")
diff --git a/src/components/page-shell.tsx b/src/components/page-shell.tsx
index e516581c..aa090822 100644
--- a/src/components/page-shell.tsx
+++ b/src/components/page-shell.tsx
@@ -6,7 +6,7 @@ export function PageShell({ children, wide }: { children: React.ReactNode; wide?
return (
<div className="flex min-h-content min-w-0 flex-col">
<PhoneBar />
- <div className={cn("mx-auto w-full min-w-0 flex-1 px-4 pt-4 pb-16 sm:px-8 md:pt-12", wide ? "max-w-[1400px]" : "max-w-[1200px]")}>{children}</div>
+ <div className={cn("mx-auto w-full min-w-0 flex-1 px-4 pt-4 pb-16 sm:px-6 md:pt-12", wide ? "max-w-[1400px]" : "max-w-[1200px]")}>{children}</div>
</div>
);
}
diff --git a/src/components/phone-bar.tsx b/src/components/phone-bar.tsx
index 28d4defb..14fa11ed 100644
--- a/src/components/phone-bar.tsx
+++ b/src/components/phone-bar.tsx
@@ -15,7 +15,7 @@ export function SearchButton({ className }: { className?: string }) {
type="button"
variant="ghost"
size="icon"
- className={cn("size-11 rounded-full text-muted-foreground motion-reduce:transition-none", className)}
+ className={cn("nav-row size-11 rounded-full text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 motion-reduce:transition-none", className)}
aria-label="Search"
aria-haspopup="dialog"
onTouchStart={search.warm}
@@ -36,7 +36,7 @@ export function PhoneBar({ className }: { className?: string }) {
return (
<div
className={cn(
- "sticky top-chrome z-20 flex h-[calc(3rem+env(safe-area-inset-top))] items-center gap-1.5 bg-background/85 pt-[env(safe-area-inset-top)] pr-[max(0.25rem,env(safe-area-inset-right))] pl-[max(0.75rem,env(safe-area-inset-left))] backdrop-blur md:hidden",
+ "sticky top-chrome z-20 flex h-[calc(3.5rem+env(safe-area-inset-top))] items-center gap-1.5 bg-background/85 pt-[env(safe-area-inset-top)] pr-[max(1rem,env(safe-area-inset-right))] pl-[max(0.75rem,env(safe-area-inset-left))] backdrop-blur md:hidden",
className,
)}
>
@@ -44,7 +44,7 @@ export function PhoneBar({ className }: { className?: string }) {
href="/"
eager
aria-label="Fuobe home"
- className="rounded-md px-1 font-heading text-[22px] leading-none outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ className="nav-focus rounded-md px-1 font-heading text-[22px] leading-none"
>
Fuobe
</IntentLink>
diff --git a/src/components/relight/relight-tool.tsx b/src/components/relight/relight-tool.tsx
index 6d3388e9..2ef14e7c 100644
--- a/src/components/relight/relight-tool.tsx
+++ b/src/components/relight/relight-tool.tsx
@@ -641,7 +641,7 @@ export function RelightTool({ app }: { app?: { name: string; description: string
<p className="mt-1 hidden max-w-2xl text-[13px] text-pretty text-muted-foreground sm:block">{SUB}</p>
</div>
<div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_380px] lg:items-start">
- <div className="space-y-2 max-lg:sticky max-lg:top-[calc(var(--chrome-top)+3.5rem)] max-lg:z-10 max-lg:-mx-3 max-lg:bg-background/95 max-lg:px-3 max-lg:pb-2 max-lg:backdrop-blur lg:sticky lg:top-[calc(var(--chrome-top)+5rem)]">
+ <div className="space-y-2 max-lg:sticky max-md:top-[calc(var(--chrome-top)+3.5rem)] md:max-lg:top-[var(--chrome-top)] max-lg:z-10 max-lg:-mx-4 max-lg:bg-background/95 max-lg:px-4 max-lg:pb-2 max-lg:backdrop-blur sm:max-lg:-mx-6 sm:max-lg:px-6 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)]">
<div className="mx-auto w-full max-lg:max-w-[calc(40svh*var(--ar))]" style={{ "--ar": String(pw / Math.max(1, ph)) } as React.CSSProperties}>
<RelightStage
photo={img}
diff --git a/src/components/remove-object/remove-object-tool.tsx b/src/components/remove-object/remove-object-tool.tsx
index 1a1ca063..76ba7c80 100644
--- a/src/components/remove-object/remove-object-tool.tsx
+++ b/src/components/remove-object/remove-object-tool.tsx
@@ -367,7 +367,7 @@ export function RemoveObjectTool({ person = false }: { person?: boolean } = {})
</div>
</div>
- <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+112px)]">
+ <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)]">
<Field label="How do you point at it?">
<Segmented
label="How do you point at it?"
diff --git a/src/components/restore/restore-tool.tsx b/src/components/restore/restore-tool.tsx
index c37146a0..d186a2de 100644
--- a/src/components/restore/restore-tool.tsx
+++ b/src/components/restore/restore-tool.tsx
@@ -221,7 +221,7 @@ export function RestoreTool() {
)}
</div>
- <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+112px)]">
+ <Panel className="space-y-4 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)]">
<p className="flex gap-2 rounded-lg bg-muted/60 px-3 py-2 text-[12px] leading-snug text-muted-foreground">
<Cpu className="mt-0.5 size-3.5 shrink-0" aria-hidden />
<span>{open ? GPU_NOTE : CLOUD_NOTE}</span>
diff --git a/src/components/settings-form.tsx b/src/components/settings-form.tsx
index ec018ca9..3e5c8a16 100644
--- a/src/components/settings-form.tsx
+++ b/src/components/settings-form.tsx
@@ -165,7 +165,7 @@ function ChoiceField({
function StatusStrip({ status, onGuide, guideOpen }: { status?: StatusInfo; onGuide: () => void; guideOpen: boolean }) {
const place = usePagePlace();
return (
- <div className="sticky top-12 z-10 -mx-4 border-b bg-background/90 px-4 py-2.5 backdrop-blur sm:-mx-8 sm:px-8 md:top-chrome">
+ <div className="sticky top-[calc(3.5rem+env(safe-area-inset-top))] z-10 -mx-4 border-b bg-background/90 px-4 py-2.5 backdrop-blur sm:-mx-6 sm:px-6 md:top-chrome">
<nav aria-label="Connections" className="scrollbar-none -my-1 flex items-center gap-1.5 overflow-x-auto py-1">
{status ? (
<>
diff --git a/src/components/shorts/session-view.tsx b/src/components/shorts/session-view.tsx
index 99207f1b..cc961ce6 100644
--- a/src/components/shorts/session-view.tsx
+++ b/src/components/shorts/session-view.tsx
@@ -79,7 +79,7 @@ export function ShortsSessionView({ id }: { id: string }) {
function Frame({ title, children, actions }: { title: string; children: React.ReactNode; actions?: React.ReactNode }) {
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<Link href="/shorts?tab=history" aria-label="Back to your shorts" className="grid size-8 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground">
<ArrowLeft className="size-4" />
</Link>
@@ -87,7 +87,7 @@ function Frame({ title, children, actions }: { title: string; children: React.Re
<div className="ml-auto flex items-center gap-1">{actions}</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1180px] min-w-0 flex-1 px-3 pb-16 sm:px-6">{children}</div>
+ <div className="mx-auto w-full max-w-[1180px] min-w-0 flex-1 px-4 pb-16 sm:px-6">{children}</div>
</div>
);
}
@@ -146,7 +146,7 @@ function Session({ s }: { s: View }) {
>
<Steps steps={STEPS} current={finalVideo && !outdated ? 3 : 2} className="pt-6" />
<div className="mt-6 grid min-w-0 gap-8 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)] lg:items-start">
- <section aria-label="Full video" className="min-w-0 space-y-3 lg:sticky lg:top-[calc(var(--chrome-top)+4rem)]">
+ <section aria-label="Full video" className="min-w-0 space-y-3 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)]">
<div className="relative mx-auto max-h-[72svh] w-full overflow-hidden rounded-2xl bg-muted" style={{ aspectRatio: ratio, maxWidth: ratio < 1 ? 360 : undefined }}>
{finalVideo ? (
<video src={finalVideo.url} controls playsInline preload="metadata" className="size-full bg-black object-contain" aria-label="Your short" />
diff --git a/src/components/shorts/shorts-studio.tsx b/src/components/shorts/shorts-studio.tsx
index c3d5486a..fb834e29 100644
--- a/src/components/shorts/shorts-studio.tsx
+++ b/src/components/shorts/shorts-studio.tsx
@@ -83,7 +83,7 @@ export function ShortsStudio({ models }: { models: Record<Engine, ModelChoice[]>
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-none">Shorts Studio</h1>
<div role="tablist" aria-label="Shorts Studio" onKeyDown={tabKeys} className="ml-2 flex h-8 shrink-0 items-center rounded-full bg-muted p-0.5 sm:ml-4">
{(["presets", "history"] as const).map((t) => (
@@ -106,7 +106,7 @@ export function ShortsStudio({ models }: { models: Record<Engine, ModelChoice[]>
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 px-3 pb-28 sm:px-6 lg:pb-16">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 px-4 pb-28 sm:px-6 lg:pb-16">
{tab === "history" ? (
<ShortsHistory onStart={() => pickTab("presets")} />
) : (
@@ -187,7 +187,7 @@ function Workspace({
onEdit={(id) => setDialog({ open: true, preset: custom.data?.find((p) => p.id === id) })}
/>
</section>
- <aside ref={setup} id="shorts-setup" aria-labelledby="shorts-step-2" className="scrollbar-none min-w-0 scroll-mt-16 lg:sticky lg:top-[calc(var(--chrome-top)+4rem)] lg:max-h-[calc(var(--content-h)-4.5rem)] lg:overflow-y-auto lg:overscroll-contain lg:rounded-2xl">
+ <aside ref={setup} id="shorts-setup" aria-labelledby="shorts-step-2" className="scrollbar-none min-w-0 scroll-mt-16 lg:sticky lg:top-[calc(var(--chrome-top)+1rem)] lg:max-h-[calc(var(--content-h)-4.5rem)] lg:overflow-y-auto lg:overscroll-contain lg:rounded-2xl">
<SetupPanel
visitor={visitor}
engine={engine}
diff --git a/src/components/skeletons.tsx b/src/components/skeletons.tsx
index d9afe2a2..a40746d8 100644
--- a/src/components/skeletons.tsx
+++ b/src/components/skeletons.tsx
@@ -10,11 +10,11 @@ import { PageHeader, PageShell } from "@/components/page-shell";
export function StudioSkeleton() {
return (
<div className="flex min-h-content min-w-0 flex-col" aria-busy="true" aria-label="Loading">
- <div className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 sm:px-6">
+ <div className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 sm:px-6">
<Skeleton className="h-6 w-32 rounded-lg" />
<Skeleton className="ml-auto h-9 w-44 rounded-full" />
</div>
- <div className="mx-auto flex w-full max-w-[760px] flex-col items-center px-3 pt-[16vh] sm:px-6">
+ <div className="mx-auto flex w-full max-w-[760px] flex-col items-center px-4 pt-[16vh] sm:px-6">
<Skeleton className="h-9 w-2/3 max-w-[420px] rounded-xl" />
<Skeleton className="mt-3 h-4 w-1/2 max-w-[300px]" />
<div className="mt-10 w-full rounded-[20px] border bg-background p-2.5 shadow-soft sm:rounded-composer">
@@ -37,7 +37,7 @@ export function StudioSkeleton() {
*/
export function HubBodySkeleton() {
return (
- <div className="mx-auto flex w-full max-w-[760px] flex-col items-center px-3 pt-6 sm:px-6 sm:pt-[12vh]" aria-busy="true" aria-label="Loading" data-hub-skeleton>
+ <div className="mx-auto flex w-full max-w-[760px] flex-col items-center px-4 pt-6 sm:px-6 sm:pt-[12vh]" aria-busy="true" aria-label="Loading" data-hub-skeleton>
<Skeleton className="h-9 w-2/3 max-w-[420px] rounded-xl" />
<Skeleton className="mt-3 h-4 w-1/2 max-w-[300px]" />
<div className="mt-10 w-full rounded-[20px] border bg-background p-2.5 shadow-soft sm:rounded-composer">
diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsx
index 87728575..42958205 100644
--- a/src/components/storyboard-view.tsx
+++ b/src/components/storyboard-view.tsx
@@ -434,14 +434,14 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s
return (
<div className="flex min-h-content min-w-0 flex-col">
- <header className="sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6">
+ <header className="max-md:sticky top-chrome z-20 flex h-14 items-center gap-2 bg-background/85 px-4 backdrop-blur sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-none">Storyboard</h1>
<div className="ml-auto">
<EngineSwitch value={engine} onChange={setEngine} />
</div>
<PhoneNavButton />
</header>
- <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 space-y-10 px-3 pb-16 sm:px-6">
+ <div className="mx-auto w-full min-w-0 max-w-[1240px] flex-1 space-y-10 px-4 pb-16 sm:px-6">
<div className="mx-auto max-w-[820px] pt-6 text-center">
<h2 className="font-heading text-display text-balance">Tell it frame by frame</h2>
<p className="mt-2 text-[13px] text-muted-foreground">
diff --git a/src/components/studio/hub-chrome.tsx b/src/components/studio/hub-chrome.tsx
index 6a2c3b5d..6c5d86d1 100644
--- a/src/components/studio/hub-chrome.tsx
+++ b/src/components/studio/hub-chrome.tsx
@@ -138,7 +138,7 @@ function HubTabs({
return (
<nav aria-label="Modes" className="border-b">
- <div ref={ref} style={fade} className="scrollbar-none flex gap-1 overflow-x-auto px-3 sm:px-6">
+ <div ref={ref} style={fade} className="scrollbar-none flex gap-1 overflow-x-auto px-4 sm:px-6">
{modes.map((m) => {
const on = m.id === active;
const href = modeHref(kind, m.id);
@@ -209,8 +209,8 @@ export function HubFrame({ kind, skeleton, children }: { kind: HubKind; skeleton
const skeletonShown = waiting && late;
return (
<div className="flex min-h-content min-w-0 flex-col" data-hub={kind}>
- <div className="sticky top-chrome z-20 bg-background/85 backdrop-blur" data-hub-chrome>
- <header className="flex h-14 items-center gap-2 px-3 sm:px-6">
+ <div className="max-md:sticky top-chrome z-20 bg-background/85 backdrop-blur" data-hub-chrome>
+ <header className="flex h-14 items-center gap-2 px-4 sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-[1.15]">{HUB_TITLE[kind]}</h1>
<div className="ml-auto flex shrink-0 items-center gap-2">
<div ref={slotRef} className="contents" />
diff --git a/src/components/studio/studio-page.tsx b/src/components/studio/studio-page.tsx
index 959e4b84..5bece4b0 100644
--- a/src/components/studio/studio-page.tsx
+++ b/src/components/studio/studio-page.tsx
@@ -38,7 +38,7 @@ import { PresetUrlCtx, StartRequestCtx, StudioProvider, usePresetUrl, useStudio,
*/
function ExampleCardsPlaceholder() {
return (
- <div aria-hidden className="mx-auto grid w-full max-w-[1000px] grid-cols-2 gap-3 px-3 pb-10 sm:grid-cols-4 sm:gap-4 sm:px-6">
+ <div aria-hidden className="mx-auto grid w-full max-w-[1000px] grid-cols-2 gap-3 px-4 pb-10 sm:grid-cols-4 sm:gap-4 sm:px-6">
{[0, 1, 2, 3].map((i) => (
<div key={i} className={cn("aspect-[4/5] rounded-xl bg-muted", i >= 2 && "max-sm:hidden")} />
))}
@@ -396,7 +396,7 @@ function StudioExamples({ row }: { row: ExampleRowData }) {
if (draft.presetId && draft.presetId !== config.preset?.id) return null;
// An app's page shows its examples in its card above the composer.
if (config.preset && row.cards.some((c) => c.load.via !== "look")) return null;
- return <ExampleRow row={row} activeId={loader?.activeId} onPick={(c) => loader?.use(c)} className="px-3 pb-10 sm:px-6" />;
+ return <ExampleRow row={row} activeId={loader?.activeId} onPick={(c) => loader?.use(c)} className="px-4 pb-10 sm:px-6" />;
}
/** Once there are results, "Examples" beside the composer opens the cards: a picked motion's or effect's, else the page's. */
@@ -448,8 +448,8 @@ function StudioHeader({ title, header, tabs }: { title: string; header?: React.R
</HubHeaderExtras>
);
return (
- <div className="sticky top-chrome z-20 bg-background/85 backdrop-blur">
- <header className="flex h-14 items-center gap-2 px-3 sm:px-6">
+ <div className="max-md:sticky top-chrome z-20 bg-background/85 backdrop-blur">
+ <header className="flex h-14 items-center gap-2 px-4 sm:px-6">
<h1 className="min-w-0 truncate font-heading text-[22px] leading-[1.15]">{title}</h1>
<div className="ml-auto flex shrink-0 items-center gap-2">
{header}
@@ -545,13 +545,13 @@ function StudioBody({ header, tabs, examples }: { header?: React.ReactNode; tabs
/>
{live && (
- <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 px-3 pb-4 sm:px-6">
+ <div className="mx-auto w-full max-w-[1240px] min-w-0 flex-1 px-4 pb-4 sm:px-6">
<div className="h-[calc(var(--content-h)-4.5rem)] min-h-[520px]">
<LiveArea onClose={() => setLive(false)} />
</div>
</div>
)}
- <div className={cn("mx-auto w-full max-w-[1240px] min-w-0 px-3 sm:px-6", hasItems && "flex-1 pb-8", live && "hidden")}>
+ <div className={cn("mx-auto w-full max-w-[1240px] min-w-0 px-4 sm:px-6", hasItems && "flex-1 pb-8", live && "hidden")}>
{hasItems ? (
<div className="pt-4">
<Feed items={items} onReuse={reuse} />
@@ -594,8 +594,8 @@ function StudioBody({ header, tabs, examples }: { header?: React.ReactNode; tabs
className={cn(
live && "hidden",
hasItems
- ? "sticky bottom-chrome z-20 bg-gradient-to-t from-background via-background/95 to-transparent px-3 pt-8 pb-[max(1rem,env(safe-area-inset-bottom))] sm:px-6"
- : "px-3 pt-6 sm:px-6 sm:pt-10",
+ ? "sticky bottom-chrome z-20 bg-gradient-to-t from-background via-background/95 to-transparent px-4 pt-8 pb-[max(1rem,env(safe-area-inset-bottom))] sm:px-6"
+ : "px-4 pt-6 sm:px-6 sm:pt-10",
)}
>
{hasItems && offscreen.count > 0 && (
diff --git a/src/components/thanks/thanks-list.tsx b/src/components/thanks/thanks-list.tsx
index 3c38e953..62bc7027 100644
--- a/src/components/thanks/thanks-list.tsx
+++ b/src/components/thanks/thanks-list.tsx
@@ -39,8 +39,8 @@ export function ThanksList({ groups, makers = [] }: { groups: ThanksGroup[]; mak
return (
<>
- <div id="thanks-list" className="scroll-mt-12 md:scroll-mt-[var(--chrome-top)]" />
- <div className="sticky top-12 z-10 -mx-4 border-b bg-background/90 px-4 py-2 backdrop-blur sm:-mx-8 sm:px-8 md:top-chrome">
+ <div id="thanks-list" className="scroll-mt-[calc(3.5rem+env(safe-area-inset-top))] md:scroll-mt-[var(--chrome-top)]" />
+ <div className="sticky top-[calc(3.5rem+env(safe-area-inset-top))] z-10 -mx-4 border-b bg-background/90 px-4 py-2 backdrop-blur sm:-mx-6 sm:px-6 md:top-chrome">
<div className="flex flex-col gap-2 lg:flex-row lg:items-center">
<label className="relative block min-w-0 lg:w-80 lg:shrink-0">
<span className="sr-only">Search models, LoRAs, node packs and libraries</span>
@@ -63,7 +63,7 @@ export function ThanksList({ groups, makers = [] }: { groups: ThanksGroup[]; mak
</button>
)}
</label>
- <nav aria-label="Jump to a group" className="-mx-4 min-w-0 overflow-x-auto px-4 [scrollbar-width:none] sm:-mx-8 sm:px-8 lg:mx-0 lg:overflow-visible lg:px-0 [&::-webkit-scrollbar]:hidden">
+ <nav aria-label="Jump to a group" className="-mx-4 min-w-0 overflow-x-auto px-4 [scrollbar-width:none] sm:-mx-6 sm:px-6 lg:mx-0 lg:overflow-visible lg:px-0 [&::-webkit-scrollbar]:hidden">
<ul className="flex w-max gap-1.5 lg:w-auto lg:flex-wrap">
{shown
.filter((g) => g.rows.length)
diff --git a/tests/e2e/nav-hubs.mjs b/tests/e2e/nav-hubs.mjs
index 7ffab4b4..285491ab 100644
--- a/tests/e2e/nav-hubs.mjs
+++ b/tests/e2e/nav-hubs.mjs
@@ -418,7 +418,7 @@ try {
// 9. Section tabs stay under the bar and mark the section being read; a phone shows two cards a row.
for (const [device, tag, barH] of [
[DESKTOP, "1440", 56],
- [PHONE, "390", 48],
+ [PHONE, "390", 56],
]) {
const ctx = await as("visitor", device);
const p = await page(ctx);
diff --git a/tests/e2e/nav.mjs b/tests/e2e/nav.mjs
index b1d22c7e..55860fbc 100644
--- a/tests/e2e/nav.mjs
+++ b/tests/e2e/nav.mjs
@@ -560,6 +560,234 @@ try {
await phone.close();
}
+ // 11b. One state system: one highlighted row per open menu whatever the mouse and the keys did, the current page's mark
+ // is not the highlight, the keyboard's ring shows (2 px, the ring colour) and the mouse's never does, pressed differs.
+ {
+ // What each item shows: its fill compared with the highlight and pressed fills (read from the page's own tokens),
+ // its outline, and the current page's pip (a ::before). Read after the 120 ms colour transition has run.
+ const states = async (p, root, items) =>
+ (await p.waitForTimeout(250)) ||
+ p.evaluate(
+ ([root, items]) => {
+ const probe = (v) => {
+ const d = document.createElement("div");
+ d.style.background = `var(${v})`;
+ document.body.append(d);
+ const c = getComputedStyle(d).backgroundColor;
+ d.remove();
+ return c;
+ };
+ const hi = probe("--nav-hi");
+ const press = probe("--nav-press");
+ const ring = probe("--ring");
+ const box = document.querySelector(root);
+ return [...(box?.querySelectorAll(items) ?? [])].map((e) => {
+ const s = getComputedStyle(e);
+ const pip = [e, ...e.querySelectorAll(".nav-mark-start, .nav-mark-under")].some((x) => getComputedStyle(x, "::before").content !== "none");
+ return {
+ name: (e.getAttribute("aria-label") || e.textContent || "").replace(/\s+/g, " ").trim().slice(0, 40),
+ lit: s.backgroundColor === hi,
+ pressed: s.backgroundColor === press,
+ ring: s.outlineStyle !== "none" && parseFloat(s.outlineWidth) >= 2 && s.outlineColor === ring,
+ current: e.getAttribute("aria-current") === "page" || e.hasAttribute("data-active"),
+ pip,
+ };
+ });
+ },
+ [root, items],
+ );
+ const lit = (rows) => rows.filter((r) => r.lit || r.pressed).map((r) => r.name);
+ const steps = [];
+ const one = (rows, what, expect) => {
+ const on = lit(rows);
+ const ok = on.length === 1 && (!expect || on[0].startsWith(expect));
+ steps.push(ok);
+ check(ok, `one highlight: ${what}`, `lit: ${on.join(" | ") || "none"}`);
+ };
+ const ctx = await as("owner");
+ const p = await page(ctx);
+ await openRoute(p, `${app}/edit`);
+ const bar = p.locator("[data-top-bar]");
+ const menu = p.getByRole("menu");
+ const ITEMS = "[role=menuitem]";
+
+ // On /edit the Create pill (a name and a chevron) carries the pip under it, and no fill.
+ const pill = await bar.locator("[data-bar-split]").first().evaluate((e) => ({
+ pip: getComputedStyle(e, "::before").content !== "none",
+ fill: getComputedStyle(e).backgroundColor,
+ active: e.hasAttribute("data-active"),
+ }));
+ check(pill.active && pill.pip && /rgba\(0, 0, 0, 0\)|transparent/.test(pill.fill), "bar: Create (a Create page is open) has the pip under the pill, no fill", JSON.stringify(pill));
+
+ // The owner's case: on /edit, Create opened by the mouse, the mouse on Live edit.
+ await bar.getByRole("button", { name: "Create menu", exact: true }).click();
+ await menu.waitFor();
+ const live = menu.getByRole("menuitem", { name: /^Live edit/ });
+ const box = await live.boundingBox();
+ await p.mouse.move(box.x + 30, box.y + box.height / 2, { steps: 4 });
+ let rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "Create on /edit, mouse on Live edit", "Live edit");
+ const edit = rows.find((r) => r.name.startsWith("Edit"));
+ check(!!edit && edit.current && edit.pip && !edit.lit, "current page: Edit carries the pip, not the highlight fill", JSON.stringify(edit));
+ check(!rows.some((r) => r.ring), "mouse: no keyboard ring on the hovered row");
+ if (shots) await shot(p, "states-create-hover-live-edit");
+
+ // Keys go on from where the mouse is: Down to Inpaint, Right across to the Make column, each with the ring.
+ await p.keyboard.press("ArrowDown");
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "ArrowDown after the mouse", "Inpaint");
+ check(rows.find((r) => r.lit)?.ring === true, "keyboard: the highlighted row shows the 2 px ring");
+ await p.keyboard.press("ArrowLeft");
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "ArrowLeft moves across the two columns");
+ await p.keyboard.press("ArrowRight");
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "ArrowRight comes back", "Inpaint");
+
+ // The mouse takes the highlight back, without the ring; then a press shows the pressed fill.
+ const image = menu.getByRole("menuitem", { name: /^Image/ });
+ const ib = await image.boundingBox();
+ await p.mouse.move(ib.x + 40, ib.y + ib.height / 2, { steps: 4 });
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "the mouse back on Image after the keys", "Image");
+ check(!rows.some((r) => r.ring), "mouse again: the ring steps aside");
+ await p.mouse.down();
+ rows = await states(p, "[role=menu]", ITEMS);
+ check(rows.find((r) => r.name.startsWith("Image"))?.pressed === true, "pressed: mouse-down shows the pressed fill", JSON.stringify(rows.find((r) => r.name.startsWith("Image"))));
+ await p.mouse.move(ib.x + ib.width + 200, ib.y + 300);
+ await p.mouse.up();
+
+ // The open menu's trigger is not a second fill beside the hovered row.
+ await p.mouse.move(ib.x + 40, ib.y + ib.height / 2, { steps: 4 });
+ const trig = await states(p, "[data-top-bar] nav", ":scope > div > a, :scope > div > button");
+ check(!trig.some((r) => r.name.startsWith("Create") && r.lit), "open trigger: Create keeps no fill while its menu is open", JSON.stringify(trig.find((r) => r.name.startsWith("Create"))));
+
+ // The mouse leaves the menu: the highlight stays on Image, and ArrowDown goes on from there.
+ const before = (await states(p, "[role=menu]", ITEMS)).findIndex((r) => r.name.startsWith("Image"));
+ const mb = await menu.boundingBox();
+ const outX = mb.x + mb.width + 40 < p.viewportSize().width ? mb.x + mb.width + 40 : mb.x - 40;
+ await p.mouse.move(outX, ib.y + ib.height / 2, { steps: 1 });
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "the mouse left the menu: the last row keeps the highlight", "Image");
+ await p.keyboard.press("ArrowDown");
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "ArrowDown after the mouse left the menu");
+ check(rows.findIndex((r) => r.lit) === before + 1, "ArrowDown goes on from the row the mouse left", lit(rows).join(" | "));
+
+ // Typeahead after the mouse: the letter hands the lead to the keyboard, so the row it picks shows the ring.
+ await p.mouse.move(ib.x + 40, ib.y + ib.height / 2, { steps: 4 });
+ await p.keyboard.press("i");
+ rows = await states(p, "[role=menu]", ITEMS);
+ one(rows, "typeahead after the mouse");
+ check(rows.find((r) => r.lit)?.ring === true, "typeahead: the picked row shows the ring", JSON.stringify(rows.find((r) => r.lit)));
+ await p.keyboard.press("Escape");
+ await menu.waitFor({ state: "detached" }).catch(() => {});
+
+ // A bar control outside the menus (search field) under a resting mouse drops its hover once the keyboard leads.
+ {
+ const field = bar.getByRole("button", { name: /^Search/ });
+ const fb = await field.boundingBox();
+ await p.mouse.move(fb.x - 400, fb.y + 300, { steps: 2 });
+ await p.waitForTimeout(250);
+ const rest = await field.evaluate((e) => getComputedStyle(e).backgroundColor + getComputedStyle(e).borderColor);
+ await p.mouse.move(fb.x + fb.width / 2, fb.y + fb.height / 2, { steps: 3 });
+ await p.waitForTimeout(250);
+ const hovered = await field.evaluate((e) => getComputedStyle(e).backgroundColor + getComputedStyle(e).borderColor);
+ await p.keyboard.press("Tab");
+ await p.waitForTimeout(250);
+ const keyed = await field.evaluate((e) => getComputedStyle(e).backgroundColor + getComputedStyle(e).borderColor);
+ check(hovered !== rest && keyed === rest, "bar: the search field under the mouse drops its hover while the keyboard leads", `${rest} / ${hovered} / ${keyed}`);
+ await p.mouse.move(fb.x - 400, fb.y + 300, { steps: 2 });
+ }
+
+ // The bar on /library: the hovered item is the one highlight, Library keeps only its pip.
+ await openRoute(p, `${app}/library`);
+ const create = bar.getByRole("link", { name: "Create", exact: true });
+ const cb = await create.boundingBox();
+ await p.mouse.move(cb.x + cb.width / 2, cb.y + cb.height / 2, { steps: 3 });
+ rows = await states(p, "[data-top-bar] nav", ":scope > a, :scope > button, :scope > div > a, :scope > div > button");
+ one(rows, "bar on /library, mouse on Create", "Create");
+ const library = rows.find((r) => r.name === "Library");
+ check(!!library && library.current && library.pip && !library.lit, "bar: Library (current) has the pip, no fill", JSON.stringify(library));
+
+ // The launcher: the mouse moves the keyboard's place, so Down goes on from the hovered row.
+ await openRoute(p, `${app}/storyboard`);
+ await bar.getByRole("button", { name: /^Studios/ }).click();
+ const panel = p.locator("#studios-launcher");
+ await panel.waitFor({ state: "visible" });
+ rows = await states(p, "#studios-launcher", "[data-col]");
+ check(lit(rows).length === 0, "launcher opened by the mouse: nothing highlighted yet", lit(rows).join(" | "));
+ const hovered = panel.locator('[data-col="1"][data-row="1"]');
+ const hb = await hovered.boundingBox();
+ await p.mouse.move(hb.x + 20, hb.y + hb.height / 2, { steps: 4 });
+ rows = await states(p, "#studios-launcher", "[data-col]");
+ one(rows, "launcher, mouse on a row");
+ await p.keyboard.press("ArrowDown");
+ const at = await p.evaluate(() => [document.activeElement?.getAttribute("data-col"), document.activeElement?.getAttribute("data-row")].join(","));
+ rows = await states(p, "#studios-launcher", "[data-col]");
+ one(rows, "launcher, ArrowDown after the mouse");
+ check(at === "1,2", "launcher: ArrowDown goes on from the hovered row", at);
+ const sb = rows.find((r) => r.current);
+ check(!!sb && sb.pip && !sb.lit, "launcher: Storyboard (current) has the pip, no fill", JSON.stringify(sb));
+ await p.keyboard.press("Escape");
+
+ // Home's goal row: the open goal is an underline; hover is the one highlight.
+ await openRoute(p, `${app}/`);
+ await p.locator('[data-goal="sell"]').click();
+ const people = p.locator('[data-goal="people"]');
+ const pb = await people.boundingBox();
+ await p.mouse.move(pb.x + pb.width / 2, pb.y + pb.height / 2, { steps: 3 });
+ rows = await states(p, "[data-goal-row] [role=toolbar]", "[data-goal]");
+ one(rows, "goal row: Sell open, mouse on People", "People");
+
+ // Search: one selected row, whatever the mouse and the keys did.
+ await p.keyboard.press("ControlOrMeta+k");
+ const dialog = p.getByRole("dialog");
+ await dialog.waitFor();
+ await p.keyboard.type("video");
+ await p.waitForTimeout(700);
+ const options = dialog.getByRole("option");
+ const ob = await options.nth(2).boundingBox();
+ await p.mouse.move(ob.x + 40, ob.y + ob.height / 2, { steps: 3 });
+ await p.keyboard.press("ArrowDown");
+ rows = await states(p, "[role=dialog]", "[role=option]");
+ one(rows, "search: mouse on a row, then ArrowDown");
+ await p.keyboard.press("Escape");
+ await dialog.waitFor({ state: "detached" }).catch(() => {});
+
+ // Search opened with "/" under a resting mouse (it last moved, then rests where the list appears): one row.
+ const vp = p.viewportSize();
+ await p.mouse.move(vp.width / 2, vp.height / 2 + 40, { steps: 3 });
+ await p.keyboard.press("/");
+ await dialog.waitFor();
+ await p.waitForTimeout(700);
+ rows = await states(p, "[role=dialog]", "[role=option]");
+ one(rows, "search opened by / under a resting mouse");
+ await p.keyboard.type("vid");
+ await p.waitForTimeout(700);
+ rows = await states(p, "[role=dialog]", "[role=option]");
+ one(rows, "search: typing after / under a resting mouse");
+ check(rows.find((r) => r.lit)?.ring === true, "search: typing hands the lead to the keyboard (the Enter row shows the ring)", JSON.stringify(rows.find((r) => r.lit)));
+ await p.keyboard.press("Escape");
+ check(ctx.errors.length === 0, "state checks: no console errors", ctx.errors.join(" | "));
+ await ctx.close();
+
+ // A phone: no fill is left on a row after a tap (no sticky hover), and no grey tap flash.
+ const phone = await as("owner", PHONE);
+ const q = await page(phone);
+ await openRoute(q, `${app}/edit`);
+ await q.locator("[data-phone-tabs]").getByRole("button", { name: "Create" }).tap();
+ await q.locator("#phone-sheet").waitFor({ state: "visible" });
+ await q.waitForTimeout(300);
+ const sheetRows = await states(q, "#phone-sheet", "a[href]");
+ check(lit(sheetRows).length === 0, "phone: the Create sheet opens with nothing highlighted", lit(sheetRows).join(" | "));
+ const sheetEdit = sheetRows.find((r) => r.current);
+ check(!!sheetEdit && sheetEdit.pip && !sheetEdit.lit, "phone: Edit (current) carries the pip", JSON.stringify(sheetEdit));
+ const flash = await q.locator("#phone-sheet a.nav-row").first().evaluate((e) => getComputedStyle(e).webkitTapHighlightColor);
+ check(/rgba\(0, 0, 0, 0\)|transparent/.test(flash), "phone: sheet rows have no grey tap flash", flash);
+ await phone.close();
+ }
+
// 12. Screenshots in both themes for review.
if (shots) {
for (const scheme of ["dark", "light"]) {
diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.ts
index 42d80c23..b5981354 100644
--- a/tests/nav-bar.test.ts
+++ b/tests/nav-bar.test.ts
@@ -220,7 +220,7 @@ describe("the bar's shell", () => {
expect(html).not.toContain('aria-label="Search Fuobe"');
expect(html).toContain('aria-keyshortcuts="/ Meta+K Control+K"');
// The viewer's room is kept: Sign up's by default, the avatar's where an account or the owner was last.
- expect(html).toMatch(/data-slot="viewer" class="[^"]*w-\[126px\]/);
+ expect(html).toMatch(/data-slot="viewer" class="[^"]*w-\[130px\]/);
for (const w of OWNER_WORDS) expect(words(html), w).not.toContain(w.replace("&amp;", "&"));
expect(html).not.toContain("Sign up");
});
diff --git a/tests/nav-states.test.ts b/tests/nav-states.test.ts
new file mode 100644
index 00000000..6145dcd5
--- /dev/null
+++ b/tests/nav-states.test.ts
@@ -0,0 +1,235 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { readdirSync, readFileSync } from "node:fs";
+import path from "node:path";
+import { createElement, type ReactNode } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import type { StatusInfo, ViewerInfo } from "@/lib/api";
+
+/*
+ * The nav's one state system (src/app/nav-states.css, src/components/nav/nav-row.tsx, input-modality.ts): one highlight
+ * that the mouse and the keyboard share, a keyboard-only focus ring, a pressed state, and a current-page mark that is
+ * never a fill (so it never reads as a second highlight).
+ */
+
+const state = vi.hoisted(() => ({
+ path: "/",
+ hydrated: false,
+ viewer: undefined as ViewerInfo | undefined,
+ status: undefined as StatusInfo | undefined,
+}));
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({ prefetch: () => {}, push: () => {}, replace: () => {}, back: () => {}, refresh: () => {} }),
+ usePathname: () => state.path,
+ useSearchParams: () => new URLSearchParams(),
+}));
+vi.mock("@/lib/api", async (load) => ({
+ ...(await load<typeof import("@/lib/api")>()),
+ useHydrated: () => state.hydrated,
+ useViewer: () => ({ data: state.viewer }),
+ useStatus: () => ({ data: state.status }),
+ useEngineMode: () => "both",
+}));
+
+const { modalityForKey, modalityForPointer } = await import("@/components/nav/input-modality");
+const { columnMove, CreateList } = await import("@/components/nav/create-menu");
+const { LauncherColumns } = await import("@/components/nav/studios-launcher");
+const { AccountSections } = await import("@/components/nav/account-menu");
+const { NavUiProvider } = await import("@/components/nav/nav-ui");
+const { navCovers } = await import("@/lib/nav-covers");
+
+const covers = navCovers();
+const Nav = NavUiProvider as (p: { covers: typeof covers; children?: ReactNode }) => ReactNode;
+const render = (node: ReactNode) => renderToStaticMarkup(createElement(QueryClientProvider, { client: new QueryClient() }, createElement(Nav, { covers }, node)));
+/** Every element tag with aria-current="page". */
+const currentTags = (html: string) => [...html.matchAll(/<[a-z]+\s[^>]*aria-current="page"[^>]*>/g)].map((m) => m[0]);
+const classOf = (tag: string) => /class="([^"]*)"/.exec(tag)?.[1] ?? "";
+
+const ROOT = path.resolve(__dirname, "..");
+const css = readFileSync(path.join(ROOT, "src/app/nav-states.css"), "utf8");
+/** The stylesheet's rules as [selector, body], comments out and media blocks flattened. */
+function rules(text: string): [string, string][] {
+ const flat = text.replace(/\/\*[\s\S]*?\*\//g, "").replace(/@media[^{]*\{([\s\S]*?\})\s*\}/g, "$1");
+ return [...flat.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map((m) => [m[1].trim(), m[2].trim()]);
+}
+
+/** A selector list's selectors (commas inside :is() and :not() stay). */
+function selectors(list: string): string[] {
+ const out: string[] = [];
+ let depth = 0;
+ let at = 0;
+ for (let i = 0; i < list.length; i++) {
+ if (list[i] === "(") depth++;
+ else if (list[i] === ")") depth--;
+ else if (list[i] === "," && depth === 0) {
+ out.push(list.slice(at, i).trim());
+ at = i + 1;
+ }
+ }
+ return [...out, list.slice(at).trim()];
+}
+
+beforeEach(() => {
+ state.path = "/";
+ state.hydrated = false;
+ state.viewer = undefined;
+ state.status = undefined;
+});
+
+describe("which input leads", () => {
+ it("hands the lead to the keyboard only for keys that move or press", () => {
+ for (const k of ["Tab", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", "Home", "End", "Escape", "Enter", " "]) expect(modalityForKey(k), k).toBe("keyboard");
+ for (const k of ["a", "Shift", "Meta", "Control", "Backspace"]) expect(modalityForKey(k), k).toBeNull();
+ // A shortcut (Ctrl+Tab, Cmd+ArrowLeft) is not the keyboard walking the page.
+ expect(modalityForKey("Tab", { ctrlKey: true })).toBeNull();
+ expect(modalityForKey("ArrowLeft", { metaKey: true })).toBeNull();
+ });
+
+ it("hands it to the keyboard for a letter that moves a list's highlight, not for one typed into the page", () => {
+ const inside = (sel: string) => ({ closest: (s: string) => (s.split(",").some((x) => x.trim() === sel) ? {} : null) });
+ // A menu's typeahead and the search field move the highlight: the ring marks the row the keys picked.
+ expect(modalityForKey("i", {}, inside('[role="menu"]') as unknown as EventTarget)).toBe("keyboard");
+ expect(modalityForKey("c", {}, inside("[cmdk-input]") as unknown as EventTarget)).toBe("keyboard");
+ // Typing in any other field, or with no target, leaves the lead where it is; so do keys that are not letters.
+ expect(modalityForKey("a", {}, inside("textarea") as unknown as EventTarget)).toBeNull();
+ expect(modalityForKey("a", {}, null)).toBeNull();
+ expect(modalityForKey("Backspace", {}, inside("[cmdk-input]") as unknown as EventTarget)).toBeNull();
+ expect(modalityForKey("k", { metaKey: true }, inside("[cmdk-input]") as unknown as EventTarget)).toBeNull();
+ });
+
+ it("hands it to the pointer on a press, or a mouse that really moved", () => {
+ expect(modalityForPointer("pointerdown", false)).toBe("pointer");
+ expect(modalityForPointer("pointermove", true)).toBe("pointer");
+ // A layout change under a still mouse (a menu opening under it) is not the mouse moving.
+ expect(modalityForPointer("pointermove", false)).toBeNull();
+ });
+});
+
+describe("the Create menu's columns", () => {
+ it("moves Left and Right to the same row of the other column, or its last", () => {
+ expect(columnMove([5, 5], { col: 0, row: 2 }, "ArrowRight")).toEqual({ col: 1, row: 2 });
+ expect(columnMove([5, 5], { col: 1, row: 4 }, "ArrowLeft")).toEqual({ col: 0, row: 4 });
+ expect(columnMove([5, 3], { col: 0, row: 4 }, "ArrowRight")).toEqual({ col: 1, row: 2 });
+ });
+
+ it("stops at the edges and leaves other keys to the menu", () => {
+ expect(columnMove([5, 5], { col: 0, row: 1 }, "ArrowLeft")).toBeNull();
+ expect(columnMove([5, 5], { col: 1, row: 1 }, "ArrowRight")).toBeNull();
+ expect(columnMove([5, 0], { col: 0, row: 1 }, "ArrowRight")).toBeNull();
+ expect(columnMove([5, 5], { col: 0, row: 1 }, "ArrowDown")).toBeNull();
+ });
+});
+
+describe("the states stylesheet", () => {
+ const all = rules(css);
+ const isCurrent = (sel: string) => /aria-current|data-current|data-active|data-narrow/.test(sel);
+
+ it("is imported by the app's stylesheet, unlayered (it must win over a primitive's focus:bg-accent)", () => {
+ const globals = readFileSync(path.join(ROOT, "src/app/globals.css"), "utf8");
+ expect(globals).toContain('@import "./nav-states.css";');
+ expect(css).not.toMatch(/@layer/);
+ });
+
+ it("gives the highlight one fill, the same for hover, keyboard focus and a menu's highlighted row", () => {
+ const fill = all.filter(([, b]) => b.includes("var(--nav-hi)")).map(([s]) => s);
+ const joined = fill.join("\n");
+ expect(joined).toContain(":hover");
+ expect(joined).toContain(":focus-visible");
+ expect(joined).toContain("[data-highlighted]");
+ expect(joined).toContain('[data-selected="true"]');
+ // Hover never paints while the keyboard leads; the keyboard's focus never paints while the pointer leads.
+ for (const s of fill.flatMap(selectors)) {
+ if (s.includes(":hover")) expect(s).toContain('html:not([data-input="keyboard"])');
+ if (s.includes(":focus-visible")) expect(s).toContain('html:not([data-input="pointer"])');
+ }
+ // Hover only where a pointer hovers: a finger never leaves a sticky highlight.
+ expect(css).toMatch(/@media \(hover: hover\)\s*\{\s*html:not\(\[data-input="keyboard"\]\) \.nav-row[^{]*:hover/);
+ });
+
+ it("never marks the open page with a fill or the highlight", () => {
+ const current = all.filter(([s]) => isCurrent(s));
+ expect(current.length).toBeGreaterThan(0);
+ for (const [s, b] of current) {
+ expect(b, s).not.toContain("--nav-hi");
+ expect(b, s).not.toContain("--nav-press");
+ // Its only fill is the pip's own (a ::before 3 px wide or tall).
+ if (/background-color/.test(b)) expect(s, s).toContain("::before");
+ }
+ const pip = current.filter(([s, b]) => s.includes("::before") && /width/.test(b)).map(([, b]) => b);
+ expect(pip.some((b) => b.includes("width: 3px"))).toBe(true);
+ expect(pip.some((b) => b.includes("height: 3px"))).toBe(true);
+ });
+
+ it("draws a 2 px keyboard ring inside the item, in the ring colour, only while the keyboard leads", () => {
+ const ring = all.filter(([, b]) => b.includes("outline: 2px solid var(--ring)"));
+ expect(ring.length).toBe(2);
+ for (const [s] of ring) for (const one of selectors(s)) expect(one).toContain('html:not([data-input="pointer"])');
+ expect(ring.some(([, b]) => b.includes("outline-offset: -2px"))).toBe(true);
+ });
+
+ it("has a pressed state that wins over hover, and no grey tap flash", () => {
+ const pressed = all.find(([s]) => s.includes(":active"));
+ expect(pressed?.[1]).toContain("var(--nav-press)");
+ expect(css.indexOf(":active")).toBeGreaterThan(css.indexOf(":hover"));
+ expect(css).toContain("-webkit-tap-highlight-color: transparent");
+ });
+
+ it("dims a disabled row and takes it out of hover and press", () => {
+ const disabled = all.find(([s, b]) => s.includes('[aria-disabled="true"]') && b.includes("opacity"));
+ expect(disabled?.[1]).toContain("opacity: 0.45");
+ // cmdk writes data-disabled="false" on every item: only "" (Radix) and "true" count.
+ expect(css).not.toMatch(/\[data-disabled\][^=]/);
+ });
+
+ it("defines its tokens for light and dark", () => {
+ expect(css).toMatch(/:root\s*\{[^}]*--nav-hi:[^}]*--nav-press:[^}]*--nav-mark:/);
+ expect(css).toMatch(/\.dark\s*\{[^}]*--nav-hi:[^}]*--nav-press:/);
+ });
+});
+
+describe("the nav's surfaces use it", () => {
+ const NAV = path.join(ROOT, "src/components/nav");
+ const sources = readdirSync(NAV)
+ .filter((f) => f.endsWith(".tsx"))
+ .map((f) => [f, readFileSync(path.join(NAV, f), "utf8")] as const);
+
+ it("has no other hover, focus or current-page look left in the nav", () => {
+ for (const [f, src] of sources) {
+ expect(src, f).not.toMatch(/hover:bg-accent|focus:bg-accent|focus-visible:ring-2|focus-visible:ring-ring|data-\[current\]:bg-|aria-\[current=page\]:bg-|data-\[active\]:bg-|ring-offset-2 group-aria-\[current/);
+ }
+ });
+
+ it("marks the open page in the Create sheet with the pip, and only that row", () => {
+ state.path = "/edit";
+ const html = render(createElement(CreateList, { variant: "sheet" }));
+ const tags = currentTags(html);
+ expect(tags).toHaveLength(1);
+ expect(tags[0]).toContain('href="/edit"');
+ const cls = classOf(tags[0]);
+ expect(cls).toContain("nav-row");
+ expect(cls).toContain("nav-mark-start");
+ expect(cls).not.toMatch(/bg-brand-faint|bg-accent/);
+ });
+
+ it("marks the open page in the launcher with the pip, not a tinted card or row", () => {
+ for (const current of ["cinema", "katana"]) {
+ const html = render(createElement(LauncherColumns, { kind: undefined, current, now: 0 }));
+ const tags = currentTags(html);
+ expect(tags, current).toHaveLength(1);
+ expect(classOf(tags[0])).toContain("nav-row");
+ expect(classOf(tags[0])).not.toMatch(/bg-brand-faint|border-brand-text/);
+ }
+ });
+
+ it("marks Settings in the You sheet when it is open", () => {
+ state.hydrated = true;
+ state.viewer = { signedIn: true, owner: false, publicSignup: true, account: { email: "[email protected]" } };
+ state.path = "/settings";
+ const html = render(createElement(AccountSections, { variant: "sheet" }));
+ const tags = currentTags(html);
+ expect(tags).toHaveLength(1);
+ expect(tags[0]).toContain('href="/settings"');
+ expect(classOf(tags[0])).toContain("nav-mark-start");
+ });
+});