The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Bar menus: every tool as a playing tile, grouped in tabs, in every menu
Adarsh8e3d9493c0cf
diff --git a/src/components/home/home-bento.css b/src/components/home/home-bento.cssindex 2beae2ac..ccc93f15 100644--- a/src/components/home/home-bento.css+++ b/src/components/home/home-bento.css@@ -1499,6 +1499,13 @@transform 0.3s var(--ease-enter, cubic-bezier(0.08, 0.82, 0.17, 1)),visibility 0s;}+/* Out of the way while a bar menu, the search or any dialog is open over the page. */+html:has([data-bar-scrim][data-open]) .hb-cue-float[data-shown],+html:has([role="dialog"]) .hb-cue-float[data-shown] {+ opacity: 0;+ visibility: hidden;+ pointer-events: none;+}/* The arrow dips three times as the floating copy arrives, then rests. */.hb-cue-float[data-shown] .hb-cue-arrow {animation: hb-cue-dip 1.4s ease-in-out 0.3s 3;diff --git a/src/components/home/home-bento.tsx b/src/components/home/home-bento.tsxindex ea097e4c..7e601e96 100644--- a/src/components/home/home-bento.tsx+++ b/src/components/home/home-bento.tsx@@ -276,8 +276,8 @@ export function HomeBento({ bento }: { bento: Bento }) {<div id="home-bento-foot" className={s.foot}><p className="min-w-0">- <span className="lg:hidden">Rendered locally on ComfyUI, on one RTX 5090.</span>- <span className="max-lg:hidden">Every preview on this page was rendered locally on ComfyUI, on one RTX 5090.</span>+ <span className="xl:hidden">Rendered locally on ComfyUI, on one RTX 5090.</span>+ <span className="max-xl:hidden">Every preview on this page was rendered locally on ComfyUI, on one RTX 5090.</span></p><ScrollCue footId="home-bento-foot" /><PausePreviews className="justify-self-end [@media(pointer:coarse)]:min-h-11 [@media(pointer:coarse)]:min-w-11" />diff --git a/src/components/home/home-islands.tsx b/src/components/home/home-islands.tsxindex 1deb9e9d..361de471 100644--- a/src/components/home/home-islands.tsx+++ b/src/components/home/home-islands.tsx@@ -1,11 +1,11 @@"use client";-import { ArrowDown, ArrowRight, Check, Copy, Pause, Play } from "lucide-react";+import { ArrowDown, ArrowRight, Check, Copy } from "lucide-react";import { useEffect, useRef, useState } from "react";import { CardPending, IntentLink } from "@/components/intent-link";import { useFadeEdges } from "@/components/use-fade-edges";import { useRailStills } from "@/components/use-rail-stills";-import { PresetPreview, setPreviewsPaused, usePreviewPlayback, usePreviewsPaused } from "@/components/preset-preview";+import { PresetPreview, usePreviewPlayback } from "@/components/preset-preview";import { CONNECT_GPU_EVENT, signInHref, useHydrated, useIsOwner, useStatus } from "@/lib/api";import { placeOf } from "@/lib/place-name";import { copyWithToast } from "@/lib/clipboard";@@ -39,28 +39,8 @@ export function HomeRail({ className, children }: { className?: string; children);}-/** Stops every preview playing by itself, on every page, for this visit; a hover still plays one. */-export function PausePreviews({ className }: { className?: string }) {- const paused = usePreviewsPaused();- const Icon = paused ? Play : Pause;- const label = paused ? "Play previews" : "Pause previews";- return (- <button- type="button"- onClick={() => setPreviewsPaused(!paused)}- aria-label={label}- title={label}- // 44 px to tap: its hit area reaches past its 28 px circle.- className={cn(- "relative inline-flex size-7 shrink-0 items-center justify-center gap-1.5 rounded-full border text-[12px] text-muted-foreground transition-colors after:absolute after:-inset-2 after:content-[''] hover:bg-accent hover:text-foreground sm:w-[8.5rem]",- className,- )}- >- <Icon className="size-3" />- <span className="max-sm:hidden">{label}</span>- </button>- );-}+/** Home's first screen shows it too (home-bento.tsx); it lives on its own so the bar's menus share it. */+export { PausePreviews } from "@/components/pause-previews";/** The self-host card's Copy button: the commands go to the clipboard, and the icon turns to a check for a moment. */export function CopyCommand({ text }: { text: string }) {diff --git a/src/components/nav/cover-thumb.tsx b/src/components/nav/cover-thumb.tsxindex 3ff45cc8..11a989cc 100644--- a/src/components/nav/cover-thumb.tsx+++ b/src/components/nav/cover-thumb.tsx@@ -17,11 +17,11 @@ const CLIP_FADE = 200;/** How long a mouse stays on a card before it comes alive (ms). */const ALIVE_AFTER = 120;-/** The one cover clip playing (a menu plays only the card under the pointer: one decoder at a time). */+/** The one cover clip playing on hover (a card under the pointer: one decoder at a time). A menu's player runs its own (shared). */let playingClip: HTMLVideoElement | null = null;-/** Clips play on hover unless the viewer asks for less motion or to save data. */-function clipsAllowed(): boolean {+/** Clips play unless the viewer asks for less motion or to save data. */+export function clipsAllowed(): boolean {if (reducedMotion()) return false;const conn = (navigator as Navigator & { connection?: { saveData?: boolean } }).connection;return !conn?.saveData;@@ -58,16 +58,19 @@ export function useAliveCard() {/*** A cover's clip over its still: it shows once its first frame is drawn (so the still stays until then: never a blank* frame) and fades in; `leaving`, it fades back out to the still. `at`: a still from inside the clip (a template's- * peak frame), where it starts and loops back to, short of the clip's last stretch.+ * peak frame), where it starts and loops back to, short of the clip's last stretch. `shared`: one of several playing+ * at once (a menu's player, which keeps their number down), so it leaves the others playing.*/-function CoverClip({ src, at, leaving, focus }: { src: string; at?: number; leaving: boolean; focus?: string }) {+function CoverClip({ src, at, leaving, focus, shared }: { src: string; at?: number; leaving: boolean; focus?: string; shared?: boolean }) {const ref = useRef<HTMLVideoElement>(null);const [drawn, setDrawn] = useState(false);useLayoutEffect(() => {const v = ref.current;if (!v) return;- if (playingClip && playingClip !== v) playingClip.pause();- playingClip = v;+ if (!shared) {+ if (playingClip && playingClip !== v) playingClip.pause();+ playingClip = v;+ }let live = true;let from = 0;const seek = () => {@@ -98,7 +101,7 @@ function CoverClip({ src, at, leaving, focus }: { src: string; at?: number; leavif (playingClip === v) playingClip = null;releaseVideo(v);};- }, [src, at]);+ }, [src, at, shared]);return (<videoref={ref}@@ -181,6 +184,7 @@ export function CoverThumb({eager,low,alive,+ shared,sizes: boxSizes,className,}: {@@ -200,6 +204,8 @@ export function CoverThumb({* leans in a little. Neither under reduced motion; no clip when saving data.*/alive?: boolean;+ /** Its clip is one of several a menu's player runs at once (CoverClip's `shared`). */+ shared?: boolean;/** A fluid box's width for the srcset, when it isn't its size's usual one (a lead card two tracks wide, a phone's tile). */sizes?: string;className?: string;@@ -218,7 +224,7 @@ export function CoverThumb({// A fetched menu's cover names its clip; a Studios lead's nav cover gives its version (nav-covers.ts).const clip = !allowed ? undefined : (cover?.clip ?? (id && nav?.clipV ? `/previews/presets/${id}.mp4?v=${nav.clipV}` : undefined));const { mounted, leaving } = useClipPresence(!!alive && !!clip);- const clipEl = clip && mounted && <CoverClip src={clip} at={cover?.clipAt} leaving={leaving} focus={cover?.framing?.focus} />;+ const clipEl = clip && mounted && <CoverClip src={clip} at={cover?.clipAt} leaving={leaving} focus={cover?.framing?.focus} shared={shared} />;const still = cover && (// eslint-disable-next-line @next/next/no-img-element -- versioned static covers, sized by the box (no optimizer round trip)<img@@ -274,6 +280,12 @@ export function CoverThumb({);}+/** Whether a cover (inline, or a nav cover by preset id) has a clip to play. */+export function useHasClip(id: string | undefined, cover: MegaCover | undefined): boolean {+ const nav = useNavCover(cover ? undefined : id);+ return !!(cover?.clip ?? (id && nav?.clipV));+}+/** A model icon by name (NavEntry.icon), decorative. */export function NavIcon({ name, className }: { name: NavIconName; className?: string }) {return createElement(navIcon(name), { "aria-hidden": true, className });diff --git a/src/components/nav/create-menu.tsx b/src/components/nav/create-menu.tsxindex 79c8a51d..8dd9d312 100644--- a/src/components/nav/create-menu.tsx+++ b/src/components/nav/create-menu.tsx@@ -8,17 +8,14 @@ import { navActive, NEW_CREATION_HREF } from "@/lib/nav";import { area } from "@/lib/nav-areas";import { CREATE_COLUMNS, entry, visibleTo, type NavEntry, type ViewerKind } from "@/lib/nav-model";import { cn } from "@/lib/utils";-import { BarCardMenu } from "./bar-split";-import { warmNav } from "./nav-prefetch";import { NavIcon } from "./cover-thumb";import { useViewerKind } from "./nav-ui";import { CARD_ROW, MENU_HEADING, MENU_ROW_1, MENU_ROW_2, 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 card (links in a- * grid: arrow keys move up and down a column and across to the other, Esc gives focus back to the item) and the- * phone's Create sheet (a plain list) show the same items.- * "New creation" (a fresh composer on Home) closes both.+ * Create: the tools that start from words or a picture, in two labelled columns. The phone's Create sheet lists them+ * here; the bar's Create menu shows the same groups as picture tiles (createMenu in lib/mega-menus.ts, drawn by+ * mega-panel.tsx). "New creation" (a fresh composer on Home) is in both.*//** The two columns, in order: kept in the navigation model, so the /create page (a server component) reads them too. */@@ -153,18 +150,3 @@ export function columnMove(lengths: readonly number[], at: { col: number; row: nif (col < 0 || col >= lengths.length || !len) return null;return { col, row: Math.min(at.row, len - 1) };}--/** Opened: the routes its rows lead to start loading. */-const warmCreate = () => warmNav("create");--/**- * The bar's Create item: one button that opens the Create card (resting on it with a mouse, a click, a tap, Enter,- * Space or ArrowDown). Its page (/create) is the card's first link, "See all". `active`: a Create page is open.- */-export function CreateMenu({ active }: { active?: boolean }) {- return (- <BarCardMenu id="create" href={CREATE_AREA_HREF} label="Create" active={active} onOpen={warmCreate} cardClassName="relative w-[520px] max-w-[calc(100vw-24px)]">- <CreateList variant="menu" />- </BarCardMenu>- );-}diff --git a/src/components/nav/mega-data.ts b/src/components/nav/mega-data.tsindex 5d84b370..344e2c39 100644--- a/src/components/nav/mega-data.ts+++ b/src/components/nav/mega-data.ts@@ -2,11 +2,11 @@import { useCallback, useSyncExternalStore } from "react";import { queueIdlePrefetch } from "@/lib/idle-prefetch";-import { FETCHED_MENUS, menuUrl, studiosMenu, unpackMenu, type FetchedMegaId, type MegaId, type MegaModel } from "@/lib/mega-menus";+import { bundledMenu, FETCHED_MENUS, menuUrl, unpackMenu, type FetchedMegaId, type MegaId, type MegaModel } from "@/lib/mega-menus";import type { ViewerKind } from "@/lib/nav-model";/*- * The fetched menus' data (Apps, Motions & effects, Canvas): one small static file each (/nav-menus/<id>), asked for+ * The fetched menus' data (Fuobe FX, Apps, Motions & effects, Canvas; Create and Studios are in the bundle): one small static file each (/nav-menus/<id>), asked for* once per page load, never with the page itself. The bar asks when the browser is idle (prefetchMenus) or when the* pointer or focus first comes to the item (loadMenu); a phone only when its sheet shows that family. A failed* request is forgotten, so the next warm tries again.@@ -40,9 +40,12 @@ export function loadMenu(id: FetchedMegaId): void {);}-/** A grouped menu: Studios at once (it's in the bundle), the others once loaded. */+/** Create and Studios are in the bundle (built from the navigation model); the others are fetched. */+const bundled = (id: MegaId): id is "create" | "studios" => id === "create" || id === "studios";++/** A grouped menu: Create and Studios at once (they're in the bundle), the others once loaded. */export function warmMenu(id: MegaId): void {- if (id !== "studios") loadMenu(id);+ if (!bundled(id)) loadMenu(id);}/** A browser asking to save data, or on a slow connection: menus load when asked for only. */@@ -70,17 +73,17 @@ export interface MenuState {retry(): void;}-/** A menu's data for who is looking: Studios from the navigation model, the others as loaded (undefined until then). */+/** A menu's data for who is looking: Create and Studios from the navigation model, the others as loaded (undefined until then). */export function useMegaMenu(id: MegaId, kind: ViewerKind | undefined): MenuState {const entry = useSyncExternalStore(subscribe,- () => (id === "studios" ? undefined : entries.get(id)),+ () => (bundled(id) ? undefined : entries.get(id)),() => undefined,);const retry = useCallback(() => {- if (id !== "studios") loadMenu(id);+ if (!bundled(id)) loadMenu(id);}, [id]);- if (id === "studios") return { model: studiosMenu(kind), failed: false, retry };+ if (bundled(id)) return { model: bundledMenu(id, kind), failed: false, retry };return { model: entry?.state === "ready" ? entry.model : undefined, failed: entry?.state === "failed", retry };}@@ -96,9 +99,9 @@ export function resetMenus() {changed();}-/** A menu's data is here (Studios always is): a hover open waits a moment for it (bar-menus.tsx), never a click. */+/** A menu's data is here (Create and Studios always are): a hover open waits a moment for it (bar-menus.tsx), never a click. */export function menuReady(id: MegaId): boolean {- return id === "studios" || entries.get(id)?.state === "ready";+ return bundled(id) || entries.get(id)?.state === "ready";}/** At once (not when idle): the data of these menus, unless the browser asks to save data. */diff --git a/src/components/nav/mega-launcher.tsx b/src/components/nav/mega-launcher.tsxindex 41f6ec46..ca97e158 100644--- a/src/components/nav/mega-launcher.tsx+++ b/src/components/nav/mega-launcher.tsx@@ -1,8 +1,8 @@"use client";import { lazy, memo, startTransition, Suspense, useCallback, useEffect, useRef, useState } from "react";-import { MEGA_AREAS, megaMove, megaPanelId, TILE_COLS, type MegaId } from "@/lib/mega-menus";-import { activeEntry, launcherActive, subActive } from "@/lib/nav-model";+import { MEGA_AREAS, megaMove, megaPanelId, type MegaId } from "@/lib/mega-menus";+import { activeEntry, CREATE_COLUMNS, launcherActive, subActive } from "@/lib/nav-model";import { cn } from "@/lib/utils";import { shows, useBarController, useBarMenu } from "./bar-menus";import { BarTrigger } from "./bar-split";@@ -11,10 +11,10 @@ import { useSearchPalette } from "./search-context";import { warmNav, type NavPanel } from "./nav-prefetch";/*- * The bar's grouped menus: Studios, Apps, Motions & effects and Canvas, one panel under the bar each, grouped by what- * you want to make, one click and no scrolling (down to 1280x720). A disclosure for navigation (a button that shows a- * panel of links), not a menu: Tab walks the links in order ("See all" first), and arrow keys move in the grid (up and- * down a column, left and right to the same place in the next one).+ * The bar's menus: Create, Studios, Fuobe FX, Apps, Motions & effects and Canvas, one panel under the bar each, every+ * tool in it as a picture tile, grouped (All, then a tab per group); the panel scrolls inside when they don't fit. A+ * disclosure for navigation (a button that shows a panel of links), not a menu: Tab walks the links in order ("See all"+ * first), and arrow keys move in the tiles (up and down a column, left and right to the same place in the next one).** How the item opens and closes its panel (rest, click, tap, keys, switching from one to the next) is the bar's* controller's (bar-menus.tsx), the same for all six menus. The panel's body (its links, cards and tiles:@@ -43,10 +43,14 @@ 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 text-popover-foreground";/** The routes a menu's links lead to that load ahead when it opens (each row also loads on hover: IntentLink). */-const WARM: Record<MegaId, NavPanel> = { studios: "studios", apps: "more", motions: "more", canvas: "more", fx: "fx" };+const WARM: Record<MegaId, NavPanel> = { create: "create", studios: "studios", apps: "more", motions: "more", canvas: "more", fx: "fx" };/** The item of a menu the open page is (aria-current): a studio or one of its features, an app, a preset, a ready board. */export function megaCurrent(id: MegaId, pathname: string, search = ""): string | undefined {+ if (id === "create") {+ const e = activeEntry(pathname, new URLSearchParams(search));+ return e && CREATE_COLUMNS.some((c) => (c.ids as readonly string[]).includes(e.id)) ? e.id : undefined;+ }if (id === "studios") return subActive(pathname, search) ?? launcherActive(pathname);if (id === "apps") return /^\/apps\/([^/]+)$/.exec(pathname)?.[1];if (id === "motions") return pathname === "/video" ? (new URLSearchParams(search).get("preset") ?? undefined) : undefined;@@ -70,7 +74,7 @@ export function preloadMegaPanel(): void {}/** The big panels in the bar's order (the order they get ready in when the pointer's place is not known). */-const BAR_ORDER: readonly MegaId[] = ["studios", "fx", "apps", "motions", "canvas"];+const BAR_ORDER: readonly MegaId[] = ["create", "studios", "fx", "apps", "motions", "canvas"];/** Each mounted panel: what gets it ready, whether its item shows at this width, and whether its pictures are ready. */const primers = new Map<MegaId, { heat: () => void; shows: () => boolean; at: () => number | undefined; done: boolean }>();let primeQueue: MegaId[] | null = null;@@ -123,48 +127,30 @@ export function primeMegaPanels(x?: number): void {.then(primeNext);}-/** While a menu's data (or the panel's body) is on its way: its columns at their final sizes, so nothing moves when it comes. */+/** While a menu's data (or the panel's body) is on its way: the tabs' row and columns of tiles at their final sizes. */export function MegaSkeleton({ id }: { id?: MegaId }) {- if (id === "canvas") {- return (- <div aria-hidden data-mega-skeleton className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 lg:gap-x-3">- <div className="col-span-3 flex flex-col gap-2 lg:col-span-2">- <span className="h-4 w-24 rounded bg-muted" />- <span className="aspect-[4/3] max-h-[max(64px,calc(100dvh-592px))] w-full rounded-t-[14px] bg-muted" />- <span className="-mt-2 h-[60px] rounded-b-[14px] bg-muted/60" />- </div>- <div className="col-span-3 flex flex-col gap-2 lg:col-span-4">- <span className="h-4 w-28 rounded bg-muted" />- <span className="grid gap-x-3 gap-y-2" style={{ gridTemplateColumns: `repeat(${TILE_COLS}, minmax(0, 1fr))` }}>- {Array.from({ length: TILE_COLS * 2 }, (_, i) => (- <span key={i} className="flex flex-col gap-1.5 p-1.5">- <span className="aspect-video rounded-[10px] bg-muted" />- <span className="h-[34px] rounded bg-muted/50" />- </span>- ))}+ void id;+ return (+ <div aria-hidden data-mega-skeleton>+ <div className="-mx-6 mb-4 flex h-10 items-center gap-6 border-b px-6">+ {Array.from({ length: 6 }, (_, i) => (+ <span key={i} className="h-3.5 w-20 rounded bg-muted" />+ ))}+ </div>+ <div className="grid grid-cols-3 gap-3 lg:grid-cols-4 xl:grid-cols-5">+ {Array.from({ length: 10 }, (_, i) => (+ <span key={i} className={cn("flex flex-col overflow-hidden rounded-[12px] border", i >= 6 && "max-lg:hidden", i >= 8 && "max-xl:hidden")}>+ <span className="aspect-[4/3] bg-muted" />+ <span className="h-[54px] bg-muted/40" /></span>- </div>+ ))}</div>- );- }- return (- <div aria-hidden data-mega-skeleton className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 lg:gap-x-3">- {Array.from({ length: 6 }, (_, i) => (- <div key={i} className="flex flex-col gap-2">- <span className="h-4 w-24 rounded bg-muted" />- <span className="aspect-[4/3] max-h-[max(64px,calc(100dvh-592px))] w-full rounded-t-[14px] bg-muted" />- <span className="-mt-2 h-[60px] rounded-b-[14px] bg-muted/60" />- {Array.from({ length: 7 }, (_, r) => (- <span key={r} className={cn("h-11 rounded-[10px] bg-muted/50", r >= 6 && "[@media(max-height:799.98px)]:hidden")} />- ))}- </div>- ))}</div>);}/**- * A bar item with a full-width panel (Studios, Apps, Motions & effects, Canvas): one button that shows and hides the+ * A bar item with a full-width panel (Create, Studios, Fuobe FX, Apps, Motions & effects, Canvas): one button that shows and hides the* panel. The panel hangs from the bar (the header is its positioned parent), spans it, and sits on the bar's shared* sheet (BarStage). It is in the DOM straight after its item (Tab goes item, panel, next item), hidden and inert while* closed; its body loads the first time the pointer or focus comes near (or soon after the page is ready).@@ -264,7 +250,7 @@ export function MegaLauncher({ id, active, className }: { id: MegaId; active?: b<Suspensefallback={<div className="max-w-[1680px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">- <div className="min-h-10 pb-4" />+ <div className="min-h-10 pb-3" /><MegaSkeleton id={id} /></div>}diff --git a/src/components/nav/mega-panel.tsx b/src/components/nav/mega-panel.tsxindex db5d1fee..7a888308 100644--- a/src/components/nav/mega-panel.tsx+++ b/src/components/nav/mega-panel.tsx@@ -1,35 +1,42 @@"use client";-import { ArrowRight, RotateCw, Search } from "lucide-react";+import { ArrowRight, ChevronRight, Plus, RotateCw, Search } from "lucide-react";import { usePathname, useSearchParams } from "next/navigation";-import { Fragment, lazy, Suspense, useEffect, useId, useRef, useState } from "react";+import { Fragment, lazy, memo, Suspense, useEffect, useId, useLayoutEffect, useRef, useState } from "react";import { IntentLink } from "@/components/intent-link";+import { PausePreviews } from "@/components/pause-previews";+import { usePreviewsPaused } from "@/components/preset-preview";import { Kbd } from "@/components/ui/kbd";-import { MEGA_AREAS, ROW_CAPS, studiosMenu, TILE_COLS, type MegaColumn, type MegaId, type MegaItem, type MegaModel } from "@/lib/mega-menus";+import { NEW_CREATION_HREF } from "@/lib/nav";+import { bundledMenu, MEGA_AREAS, type MegaColumn, type MegaId, type MegaItem, type MegaModel } from "@/lib/mega-menus";import { isNew, subParent, type ViewerKind } from "@/lib/nav-model";import { cn } from "@/lib/utils";-import { FxCompare } from "@/components/fx/fx-compare";-import { COVER_SIZES, CoverThumb, useAliveCard } from "./cover-thumb";+import { clipsAllowed, CoverThumb, useAliveCard, useHasClip } from "./cover-thumb";import { useMegaMenu } from "./mega-data";import { megaCurrent, MegaSkeleton } from "./mega-launcher";import { useViewerKind } from "./nav-ui";/*- * A grouped menu's panel body (the bar's MegaLauncher): its count line, See all and search, then its columns of links.- * Loaded on its own, when the pointer or focus first comes to a bar item with a menu or once the page is idle, so the- * links, cards and tiles cost the pages nothing until then.+ * A bar menu's panel body (the bar's MegaLauncher): its count line, See all, Pause previews and search; a row of tabs+ * (All, then each group); then every tool as a picture tile. "All" flows the tiles down balanced columns, each group+ * starting with its name wherever it falls, so every column ends at about the same height; a group's tab shows that+ * group alone as a grid. The tiles on screen play their clips, a few at a time (useMenuPlayer). Loaded on its own, when+ * the pointer or focus first comes to a bar item or once the page is idle, so it costs the pages nothing until then.*/+/** Columns of tiles by the window's width: three on a tablet, four from lg, five from xl (the Tailwind classes below). */+const COLUMNS = "columns-3 lg:columns-4 xl:columns-5";+const GRID = "grid-cols-3 lg:grid-cols-4 xl:grid-cols-5";+const columnsAt = (w: number) => (w >= 1280 ? 5 : w >= 1024 ? 4 : 3);+/**- * A list row from this index on hides on a short window, so the panel never scrolls (the fetched menus; Studios fits).- * A menu with family headings (Motions & effects) gives a short window's last row to that heading line.+ * A tile's picture width for its srcset: a fifth of the panel (at most 1680 px less its 24 px sides and 12 px gaps) from+ * xl, a quarter from lg, a third below.*/-const ROW_HIDE = (i: number, families = false) =>- cn(- i >= ROW_CAPS.short - (families ? 1 : 0) && "[@media(max-height:799.98px)]:hidden",- i >= ROW_CAPS.mid && "[@media(max-height:959.98px)]:hidden",- i >= ROW_CAPS.tall && "hidden",- );+export const TILE_SIZES = "(min-width: 1680px) 316px, (min-width: 1280px) calc((100vw - 96px) / 5), (min-width: 1024px) calc((100vw - 84px) / 4), calc((100vw - 72px) / 3)";++/** How many tiles play their clips at once: enough to bring the menu to life, few enough for any laptop. */+export const PLAY_AT_ONCE = 8;function NewBadge() {return (@@ -40,375 +47,265 @@ function NewBadge() {}/**- * The `sizes` of a picture `span` of the grid's six tracks wide (from lg), less `inset` px (a card's border), so its- * srcset gives a 2x or 3x screen a copy at least as wide as the box: the panel's content is at most 1680 px wide less- * its 24 px sides (px-6), its tracks 12 px apart (gap-x-3), so a track is (width - 108) / 6. For the Canvas menu,- * which shows from 1440 px only (always six tracks); a tile is one track wide (its tiles are as far apart as the tracks).- */-export function trackSizes(span: number, inset = 0): string {- const extra = (span - 1) * 12 - inset;- return `(min-width: 1680px) ${Math.floor(((1680 - 108) * span) / 6) + extra}px, calc((100vw - 108px) * ${span} / 6 + ${extra}px)`;-}--/** A lead card's picture box: 4:3 of the column, its height on the 4 px grid, shorter on a short window. */-const LEAD_BOX = "h-[round(down,75cqw,4px)] rounded-none md:max-lg:max-h-[round(down,max(56px,calc(100dvh_-_460px)),4px)]";-const LEAD_MAX = "max-h-[round(down,max(64px,calc(100dvh_-_592px)),4px)]";-/** Under the owner's New board button (Canvas). */-const LEAD_MAX_BELOW = "max-h-[round(down,max(64px,calc(100dvh_-_640px)),4px)]";--/**- * A column's first card: its cover, name and one line. `row` 1 under the owner's New board (Canvas), its cover shorter by- * that button. The cover's height is rounded down to the 4 px grid (a 4:3 box of a fractional column width would put- * every row under the card on a half pixel), and its words start 12 px in, the column its features hang from. `span`:- * the tracks its column takes, when more than one (Canvas' Start here), for its picture's srcset.+ * One tool: its picture (4:3), name and line, as one link; a studio's features as small links under it. `playing`:+ * the menu's player has it on (its clip plays over the still, where it has one); a mouse resting on it or the keys+ * focusing it plays it too. `eager`: on the menu's first screen, so its picture loads with the panel.*/-export function LeadCard({ e, col, row = 0, span = 1, current, inside, now, className }: { e: MegaItem; col: number; row?: number; span?: number; current: boolean; inside?: boolean; now: number; className?: string }) {- // Pointed at or focused, its cover comes alive (its clip, or a lean in); a Fuobe FX card shows its before and after.+const MegaTile = memo(function MegaTile({ e, current, inside, now, playing, eager, subCurrent }: { e: MegaItem; current: boolean; inside: boolean; now: number; playing: boolean; eager: boolean; subCurrent?: string }) {const { alive, handlers } = useAliveCard();+ const clip = useHasClip(e.navCover, e.cover);return (- <IntentLink- {...(e.fx ? {} : handlers)}- href={e.href}- data-col={col}- data-row={row}- aria-current={current ? "page" : undefined}- data-active={inside ? "" : undefined}- className={cn("nav-row group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground [container-type:inline-size]", className)}- >- {/* A Fuobe FX item shows its before and after (the menu's arrow keys stay the menu's: keys off). */}- {e.fx ? (- <FxCompare view={e.fx} sizes={span > 1 ? trackSizes(span, 2) : COVER_SIZES.lead.sizes} eager className={cn("w-full shrink-0", LEAD_BOX, row ? LEAD_MAX_BELOW : LEAD_MAX)} />- ) : (- <CoverThumb- id={e.navCover}- cover={e.cover}- size="lead"- icon={e.icon}- eager- alive={alive}- sizes={span > 1 ? trackSizes(span, 2) : undefined}- className={cn(LEAD_BOX, row ? LEAD_MAX_BELOW : LEAD_MAX)}- />- )}- <span className="nav-mark-start flex min-w-0 flex-col gap-0.5 px-[11px] pt-2.5 pb-3 md:max-lg:py-2">- <span className="flex min-w-0 items-center gap-1.5">- <span className="truncate text-[14px] leading-[18px] font-semibold md:max-lg:text-[13px]">{e.label}</span>- {isNew(e, now) && <NewBadge />}- </span>- <span title={e.line} className="truncate text-[12px] leading-4 text-muted-foreground md:max-lg:hidden">- {e.line}- </span>- </span>- </IntentLink>- );-}--/**- * A studio's row: 44 px (40 below lg), 4 px from the next, so rows fall every 48 px. From 1280 px its name and its line- * share a 36 px box that wraps: a name too long to share its line with its New badge keeps its words and the badge starts- * the second line, before the line; a name too long for the column takes the second line instead and the line gives way- * (it stays in the title). Below 1280 px the name alone, on up to two lines, with its badge beside it.- */-function Row({ e, col, row, current, inside, now, eager, className }: { e: MegaItem; col: number; row: number; current: boolean; inside?: boolean; now: number; eager?: boolean; className?: string }) {- const fresh = isNew(e, now);- return (- <IntentLink- href={e.href}- data-col={col}- data-row={row}- aria-current={current ? "page" : undefined}- data-active={inside ? "" : undefined}- title={e.line ? `${e.label}: ${e.line}` : e.label}- className={cn("nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1 md:max-lg:min-h-10 md:max-lg:py-0.5 [@media(pointer:coarse)]:min-h-11", className)}- >- {/* Six columns leave a row its name and line below 1440 px, and its name alone below 1280 px. `eager`: a row this- window shows loads its picture with the panel, so it is there on the first frame; any other row's loads when it- shows (lazy): a row hidden by the window's height never fetches it. */}- <CoverThumb id={e.navCover} cover={e.cover} size="row" icon={e.icon} eager={eager} low className="max-[1439.98px]:hidden" />- {/* Centred while it fits; a name on two lines starts at the top and pushes the line out of the 36 px box. */}- <span data-row-text className="flex max-h-9 min-w-0 flex-1 flex-wrap items-center gap-x-1 overflow-hidden [align-content:safe_center] max-xl:flex-nowrap">- <span data-row-name className={cn("line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium", (current || inside) && "font-semibold")}>- {e.label}- </span>- {fresh && <NewBadge />}- {/* After a badge that wrapped, the line fills the rest of the second line; after one beside the name it can't fit- there and starts its own. Its basis leaves 48 px: the badge (about 34 px) and the 4 px gap, with room to spare.- A wider badge needs a smaller basis, or the line falls to a third line and is hidden. */}- <span className={cn("min-w-0 flex-1 truncate text-[12px] leading-4 text-muted-foreground max-xl:hidden", fresh ? "basis-[calc(100%-48px)]" : "basis-full")}>- {e.line}+ <div data-tile={e.id} data-clip={clip ? "" : undefined} className="mb-3 break-inside-avoid">+ <IntentLink+ {...handlers}+ href={e.href}+ data-key=""+ aria-current={current ? "page" : undefined}+ data-active={inside ? "" : undefined}+ title={e.line ? `${e.label}: ${e.line}` : e.label}+ className="nav-row group/tile flex flex-col overflow-hidden rounded-[12px] border bg-card text-card-foreground"+ >+ <CoverThumb id={e.navCover} cover={e.cover} size="card" icon={e.icon} eager={eager} alive={alive || playing} shared={playing && !alive} sizes={TILE_SIZES} className="rounded-none" />+ <span className="flex min-w-0 flex-col gap-0.5 px-[11px] pt-2 pb-2.5">+ <span className="flex min-w-0 items-center gap-1.5">+ <span className={cn("truncate text-[13.5px] leading-[18px] font-medium", (current || inside) && "font-semibold")}>{e.label}</span>+ {isNew(e, now) && <NewBadge />}+ </span>+ {e.line && <span className="truncate text-[12px] leading-4 text-muted-foreground">{e.line}</span>}</span>- </span>- </IntentLink>+ </IntentLink>+ {/* A studio's features (its tabs and modes): every one a click away from the menu. */}+ {e.subs && e.subs.length > 0 && (+ <ul aria-label={`In ${e.label}`} data-subs={e.id} className="flex flex-wrap gap-1 px-0.5 pt-1.5">+ {e.subs.map((s) => (+ <li key={s.id} className="min-w-0">+ <IntentLink+ href={s.href}+ data-key=""+ data-sub=""+ aria-current={subCurrent === s.id ? "page" : undefined}+ aria-label={s.name}+ title={s.line}+ className={cn(+ "nav-row inline-flex h-7 max-w-full items-center gap-1 rounded-full px-2.5 text-[12px] [@media(pointer:coarse)]:h-9",+ s.more ? "font-medium text-brand-text" : "bg-muted/70 text-muted-foreground hover:text-foreground aria-[current=page]:font-semibold aria-[current=page]:text-foreground",+ )}+ >+ <span className="truncate">{s.label}</span>+ {s.more && <ArrowRight aria-hidden className="size-3 shrink-0" />}+ </IntentLink>+ </li>+ ))}+ </ul>+ )}+ </div>);-}--/**- * Below the window height a studio's links need, they hide, so the panel never scrolls inside. With a mouse they are- * 24 px names; on a touch screen pills 44 px to tap (nav-subs.css), so they need a taller window there.- */-const HIDE_SHORT: Record<800 | 880 | 960, string> = {- 800: "[@media(max-height:799.98px)]:hidden",- 880: "[@media(max-height:879.98px)]:hidden",- 960: "[@media(max-height:959.98px)]:hidden",-};-const HIDE_TOUCH: Record<800 | 880 | 960, string> = {- 800: "[@media(pointer:coarse)_and_(max-height:1023.98px)]:hidden",- 880: "[@media(pointer:coarse)_and_(max-height:1099.98px)]:hidden",- 960: "[@media(pointer:coarse)_and_(max-height:1199.98px)]:hidden",-};-/** `line`: with a mouse they become one line of names there instead (nav-subs.css), so only a touch screen hides them. */-const hideBelow = (h: 800 | 880 | 960, line = false) => cn(!line && HIDE_SHORT[h], HIDE_TOUCH[h]);+});-/**- * What a studio holds inside (its tabs and modes), as links under its card or row: names only, smaller and quieter- * than the rows, hung from a hairline under the studio (nav-subs.css: with a mouse, 24 px names on the studio's text- * column; pills on a touch screen; wrapped lines of names below the height a studio with `subsLine` needs). `row`: the- * first link's place for the arrow keys (they go down from the studio through its links to the next row). `current`:- * the open page's feature. `under`: links under a row, whose names start where the row's name does.- */-function SubLinks({ e, col, row, current, under }: { e: MegaItem; col: number; row: number; current?: string; under?: boolean }) {- if (!e.subs?.length) return null;- return (- <ul- aria-label={`In ${e.label}`}- data-subs={e.id}- data-under={under ? "" : undefined}- data-subs-line={e.subsLine ? "" : undefined}- className={cn("nav-subs min-w-0", e.subsFrom && hideBelow(e.subsFrom, e.subsLine))}- >- {e.subs.map((s, i) => (- <li key={s.id} data-from={s.from ? "" : undefined} className={cn(s.from && hideBelow(s.from))}>- <IntentLink- href={s.href}- data-col={col}- data-row={row + i}- data-sub=""- aria-current={current === s.id ? "page" : undefined}- aria-label={s.name}- title={s.line}- className={cn(- "nav-row nav-mark-start group/sub flex items-center gap-1",- s.more ? "font-medium text-brand-text" : "text-muted-foreground hover:text-foreground aria-[current=page]:font-semibold aria-[current=page]:text-foreground",- )}- >- <span className="truncate">{s.label}</span>- {s.more && <ArrowRight aria-hidden className="size-3 shrink-0 motion-safe:transition-transform group-hover/sub:translate-x-0.5" />}- </IntentLink>- </li>- ))}- </ul>- );-}+/** A group's tools in the order the menu shows them: its lead, then the rest (a studio listed under another left out). */+const groupItems = (c: MegaColumn): MegaItem[] => [...(c.lead ? [c.lead] : []), ...c.rows].filter((e) => !e.under);/**- * A ready board as a 16:9 tile: its peak frame (the finished scene), its name and one line. The first row's pictures- * load with the panel; a later row's when it shows (lazy: a row hidden by the window's height never fetches its own).+ * The arrow keys' places (bar-menus.tsx: gridKey reads data-col and data-row): set from where the links land, since the+ * flowing columns decide that. Each link takes the column of its tile's left edge and the next row down in it; set+ * again whenever the layout changes (a tab, the window's size, the owner's Canvas column arriving).*/-function Tile({ e, col, row, current, eager }: { e: MegaItem; col: number; row: number; current: boolean; eager: boolean }) {- const { alive, handlers } = useAliveCard();- return (- <IntentLink- {...handlers}- href={e.href}- data-col={col}- data-row={row}- aria-current={current ? "page" : undefined}- title={e.line ? `${e.label}: ${e.line}` : e.label}- className="nav-row nav-mark-under -m-1.5 flex min-w-0 flex-col gap-1.5 rounded-[12px] p-1.5 [container-type:inline-size]"- >- {/* 16:9, its height rounded down to the 4 px grid, so a second row of tiles sits on a whole pixel. */}- <CoverThumb cover={e.cover} size="tile16" icon={e.icon} eager={eager} alive={alive} sizes={trackSizes(1)} className="aspect-auto h-[round(down,56.25cqw,4px)]" />- <span className="flex min-w-0 flex-col">- <span className={cn("truncate text-[13px] leading-[18px] font-medium", current && "font-semibold")}>{e.label}</span>- <span className="truncate text-[12px] leading-4 text-muted-foreground">{e.line}</span>- </span>- </IntentLink>- );+function usePlaceKeys(root: React.RefObject<HTMLElement | null>, key: unknown) {+ useLayoutEffect(() => {+ const el = root.current;+ if (!el) return;+ const place = () => {+ const links = [...el.querySelectorAll<HTMLElement>("[data-key], [data-col]")].filter((l) => l.offsetParent !== null);+ const lefts: number[] = [];+ const colOf = (l: HTMLElement) => {+ const x = Math.round(((l.closest<HTMLElement>("[data-tile], [data-block]") ?? l).getBoundingClientRect().left));+ let i = lefts.findIndex((v) => Math.abs(v - x) < 6);+ if (i < 0) i = lefts.push(x) - 1;+ return i;+ };+ const placed = links.map((l) => ({ l, col: colOf(l), top: l.getBoundingClientRect().top }));+ const order = [...lefts].sort((a, b) => a - b);+ const cols = new Map<number, typeof placed>();+ for (const p of placed) {+ const c = order.indexOf(lefts[p.col]);+ (cols.get(c) ?? cols.set(c, []).get(c)!).push(p);+ }+ for (const [c, list] of cols) {+ list.sort((a, b) => a.top - b.top);+ list.forEach((p, r) => {+ p.l.dataset.col = String(c);+ p.l.dataset.row = String(r);+ });+ }+ };+ place();+ const ro = new ResizeObserver(place);+ ro.observe(el);+ return () => ro.disconnect();+ }, [root, key]);}/**- * How many of a list column's rows show their picture in this window (ROW_HIDE's caps; none below 1440 px, where rows- * show no picture): these load with the panel, before it opens. Read once, when the panel's body first renders (only- * ever in the browser).+ * The menu's player: the tiles on screen with a clip play it, at most PLAY_AT_ONCE, the first ones first. Nothing plays+ * while the panel is closed or scrolled past, in a hidden tab, with previews paused (Pause previews), under reduced+ * motion or when saving data. Returns the ids playing.*/-function rowsWithPictures(capped: boolean, families: boolean): number {- if (typeof window === "undefined" || window.innerWidth < 1440) return 0;- if (!capped) return Infinity;- const h = window.innerHeight;- return h < 800 ? ROW_CAPS.short - (families ? 1 : 0) : h < 960 ? ROW_CAPS.mid : ROW_CAPS.tall;-}--/** Tiles across a tiles column. */-const across = (c: MegaColumn) => Math.min(c.span ?? 1, TILE_COLS);+const NONE: ReadonlySet<string> = new Set();-/**- * Where each column's links sit for the arrow keys: its first key column and first row. A list column is one key- * column, a tiles column one per tile across. Tiles columns one under the other (Canvas' sections) share their key- * columns, the lower one's rows after the upper one's, so ArrowDown goes on from one section into the next.- */-export function keyPlaces(columns: readonly MegaColumn[]): { col: number; row: number }[] {- const out: { col: number; row: number }[] = [];- let next = 0;- columns.forEach((c, i) => {- const prev = columns[i - 1];- if (c.variant === "tiles" && prev?.variant === "tiles") {- out.push({ col: out[i - 1].col, row: out[i - 1].row + Math.ceil(prev.rows.length / across(prev)) });- return;- }- out.push({ col: next, row: 0 });- next += c.variant === "tiles" ? across(c) : 1;- });- return out;+function useMenuPlayer(root: React.RefObject<HTMLElement | null>, key: unknown): ReadonlySet<string> {+ const paused = usePreviewsPaused();+ const [allowed] = useState(() => typeof window !== "undefined" && clipsAllowed());+ const [ids, setIds] = useState<ReadonlySet<string>>(NONE);+ const off = paused || !allowed;+ useEffect(() => {+ const el = root.current;+ if (!el || off) return;+ const tiles = [...el.querySelectorAll<HTMLElement>("[data-tile][data-clip]")];+ const order = new Map(tiles.map((t, i) => [t, i]));+ const seen = new Set<HTMLElement>();+ const update = () => {+ const next = document.hidden ? [] : [...seen].sort((a, b) => order.get(a)! - order.get(b)!).slice(0, PLAY_AT_ONCE).map((t) => t.dataset.tile!);+ setIds((prev) => (prev.size === next.length && next.every((id) => prev.has(id)) ? prev : new Set(next)));+ };+ // The panel scrolls inside itself: its section is the box the tiles must be in to count as on screen.+ const io = new IntersectionObserver(+ (es) => {+ for (const e of es) {+ if (e.isIntersecting) seen.add(e.target as HTMLElement);+ else seen.delete(e.target as HTMLElement);+ }+ update();+ },+ { root: el.closest("section"), threshold: 0.6 },+ );+ tiles.forEach((t) => io.observe(t));+ document.addEventListener("visibilitychange", update);+ return () => {+ io.disconnect();+ document.removeEventListener("visibilitychange", update);+ };+ }, [root, key, off]);+ return off ? NONE : ids;}-/** Grid tracks a column takes: its span from lg (six tracks), the whole row below it (three). */-const SPAN: Record<number, string> = { 1: "", 2: "col-span-3 lg:col-span-2", 3: "col-span-3", 4: "col-span-3 lg:col-span-4", 6: "col-span-3 lg:col-span-6" };-/** The Canvas menu's first column for the owner (New board, recent boards): loaded only once the owner opens it. */const CanvasOwnerStart = lazy(() => import("./mega-canvas-owner"));-/** The owner's first Canvas column while it loads: the New board button, then a lead card, at their final sizes. */+/** The owner's Canvas start while it loads: the New board button and a tile, at their final sizes. */function OwnerStartSkeleton() {return (- <div aria-hidden className="flex flex-col gap-2">+ <div aria-hidden className="mb-3 flex flex-col gap-2 break-inside-avoid"><span className="h-10 rounded-[10px] bg-muted" />- <span className="aspect-[4/3] max-h-[max(64px,calc(100dvh-640px))] w-full rounded-t-[14px] bg-muted" />- <span className="-mt-2 h-[59px] rounded-b-[14px] bg-muted/60" />+ <span className="aspect-[4/3] w-full rounded-[12px] bg-muted" /></div>);}/**- * A menu's columns as links (no behaviour): one per group, its label, then the lead card and rows (or the cover- * tiles). Family headings (Motions & effects) sit over their own columns: in the order they are read, and from lg in- * one row above all of them. `current`: the open page's item id. `now`: the clock for the "New" badges.+ * A menu's tools: the tabs, then "All" (every group, flowing down balanced columns) or one group as a grid. `current`:+ * the open page's item id. `now`: the clock for the "New" badges.*/-export function MegaColumns({ model, current, now, kind }: { model: MegaModel; current?: string; now: number; kind?: ViewerKind }) {+export function MegaGrid({ model, current, now, kind }: { model: MegaModel; current?: string; now: number; kind?: ViewerKind }) {const ids = useId();- const capped = model.id !== "studios";- const families = !!model.families?.length;- const tileColumns = model.columns.filter((c) => c.variant === "tiles").length;- const places = keyPlaces(model.columns);- const [pictured] = useState(() => rowsWithPictures(capped, families));+ const [tab, setTab] = useState(-1);+ const group = tab >= 0 ? model.columns[tab] : undefined;+ const root = useRef<HTMLDivElement>(null);+ const layout = `${model.id}:${tab}`;+ usePlaceKeys(root, layout);+ const playing = useMenuPlayer(root, layout);// On a studio's feature (Genjutsu's Restyle, Upscale's Video), its studio is marked as holding the page too.const holder = current ? subParent(current) : undefined;-- const column = (c: MegaColumn, ci: number) => {- const { col, row: firstRow } = places[ci];- const labelId = `${ids}-${c.id}`;- const label = (- <p id={labelId} title={c.label} className="truncate text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase">- {c.label}- </p>- );- // Two tiles sections stack on the right (Canvas): the first column takes both rows.- const place = cn(SPAN[c.span ?? 1], families && "lg:row-start-2", tileColumns > 1 && c.variant !== "tiles" && "lg:row-span-2");- if (c.owner === "canvas-start" && kind === "owner") {- return (- <div key={c.id} data-group={c.id} className={cn("flex min-w-0 flex-col gap-2", place)}>- {label}- <Suspense fallback={<OwnerStartSkeleton />}>- <CanvasOwnerStart col={col} labelledBy={labelId} fallback={c.lead && <LeadCard e={c.lead} col={col} row={1} span={c.span} current={false} now={now} />} />- </Suspense>- </div>- );- }- if (c.variant === "tiles") {- const n = across(c);- return (- <div key={c.id} data-group={c.id} className={cn("flex min-w-0 flex-col gap-2", place)}>- <div className="flex min-w-0 items-center gap-2">- {label}- {c.more && (- <IntentLink href={c.more.href} className="nav-row group/all -my-2 ml-auto inline-flex h-8 shrink-0 items-center gap-1 rounded-[8px] px-2 text-[12px] font-medium text-brand-text">- {c.more.label}- <ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />- </IntentLink>- )}- </div>- <ul aria-labelledby={labelId} className="grid gap-3" style={{ gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` }}>- {c.rows.map((e, i) => {- const row = Math.floor(i / n);- // Two sections: one row of tiles each below 900 px of height, two from 900 px.- return (- <li key={e.id} className={cn(tileColumns > 1 && row >= 1 && "[@media(max-height:899.98px)]:hidden")}>- <Tile e={e} col={col + (i % n)} row={firstRow + row} current={current === e.id} eager={row === 0} />- </li>- );- })}- </ul>- </div>- );- }- // A studio listed under another (Ads Studio under Marketing Studio) is one of its links, not a row of its own.- const rows = c.rows.filter((e) => !e.under);- // Places for the arrow keys, top to bottom: the lead (0), its links, then each row and its links.- let next = 1 + (c.lead?.subs?.length ?? 0);- const at = rows.map((e) => {- const r = next;- next += 1 + (e.subs?.length ?? 0);- return r;- });- return (- <div key={c.id} data-group={c.id} className={cn("flex min-w-0 flex-col gap-2", place)}>- {label}- <ul aria-labelledby={labelId} className="flex flex-col gap-1">- {c.lead && (- <li>- <LeadCard e={c.lead} col={col} span={c.span} current={current === c.lead.id} inside={holder === c.lead.id} now={now} className="mb-1" />- <SubLinks e={c.lead} col={col} row={1} current={current} />- </li>- )}- {rows.map((e, ri) => (- <li key={e.id} className={capped ? ROW_HIDE(ri, families) : undefined}>- <Row e={e} col={col} row={at[ri]} current={current === e.id} inside={holder === e.id} now={now} eager={ri < pictured} />- <SubLinks e={e} col={col} row={at[ri] + 1} current={current} under />- </li>- ))}- </ul>- </div>- );+ // The tiles at the top of each column load with the panel (so it never opens on empty boxes); the rest when they show.+ const [cols] = useState(() => (typeof window === "undefined" ? 5 : columnsAt(window.innerWidth)));+ const all = model.columns.flatMap(groupItems);+ const firstScreen = new Set<string>();+ if (group) groupItems(group).slice(0, cols * 2).forEach((e) => firstScreen.add(e.id));+ else for (let c = 0; c < cols; c++) all.slice(Math.floor((c * all.length) / cols), Math.floor((c * all.length) / cols) + 3).forEach((e) => firstScreen.add(e.id));+ const pick = (i: number) => {+ setTab(i);+ root.current?.closest("section")?.scrollTo({ top: 0 });};-- // A menu with fewer than six columns (Fuobe FX has five) shares the whole width among them, so no empty strip is- // left on the right under the full-width header row.- const spans = families ? 6 : model.columns.reduce((n, c) => n + (c.span ?? 1), 0);- const fewer = spans > 0 && spans < 6;+ const tile = (e: MegaItem) => (+ <MegaTile key={e.id} e={e} current={current === e.id} inside={holder === e.id} now={now} playing={playing.has(e.id)} eager={firstScreen.has(e.id)} subCurrent={current} />+ );+ // Each family's name (Camera motions, Effects) heads its first group.+ const familyHeads = new Map<string, NonNullable<MegaModel["families"]>[number]>();+ for (const f of model.families ?? []) {+ const first = model.columns.find((c) => c.family === f.id);+ if (first) familyHeads.set(first.id, f);+ }return (- <div- className={cn("grid grid-cols-3 gap-x-4 gap-y-6 lg:gap-x-3", fewer ? "lg:grid-cols-(--mega-cols)" : "lg:grid-cols-6")}- style={fewer ? ({ "--mega-cols": `repeat(${spans}, minmax(0, 1fr))` } as React.CSSProperties) : undefined}- >- {families- ? model.families!.map((f) => (- <Fragment key={f.id}>- <div className={cn("flex h-10 items-center gap-2 border-b pb-px lg:row-start-1", f.span >= 3 ? "col-span-3" : SPAN[f.span])} data-family={f.id}>- <p className="text-[12px] leading-4 font-semibold text-foreground">- {f.label} <span className="font-normal text-muted-foreground tabular-nums">· {f.count}</span>+ <div ref={root}>+ {/* One row of names: All, then each group (its count beside it). Pinned under the panel's header as it scrolls. */}+ <div role="group" aria-label={`Show in ${MEGA_AREAS[model.id].label}`} className="sticky top-[var(--mega-head,0px)] z-10 -mx-6 mb-4 flex gap-1 overflow-x-auto border-b bg-popover px-6 [scrollbar-width:none]">+ {[{ label: "All", n: all.length }, ...model.columns.map((c) => ({ label: c.label, n: groupItems(c).length }))].map((t, i) => {+ const on = tab === i - 1;+ return (+ <button+ key={t.label}+ type="button"+ aria-pressed={on}+ onClick={() => pick(i - 1)}+ className={cn(+ "nav-row -mb-px inline-flex h-10 shrink-0 items-center gap-1.5 rounded-none border-b-2 px-3 text-[13.5px] font-medium whitespace-nowrap [@media(pointer:coarse)]:h-11",+ on ? "border-brand-text text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",+ )}+ >+ {t.label}+ <span className="text-[12px] font-normal text-muted-foreground tabular-nums">{t.n}</span>+ </button>+ );+ })}+ </div>+ {group ? (+ <div className={cn("grid gap-x-3", GRID)}>{groupItems(group).map(tile)}</div>+ ) : (+ <div className={cn("gap-x-3", COLUMNS)}>+ {model.columns.map((c, ci) => {+ const famHead = familyHeads.get(c.id);+ const owner = c.owner === "canvas-start" && kind === "owner";+ const items = groupItems(c);+ return (+ <Fragment key={c.id}>+ {famHead && (+ <p data-family={famHead.id} className="break-after-avoid pt-1 pb-2 font-heading text-[22px] leading-7 text-brand-text">+ {famHead.label} <span className="font-sans text-[12px] text-muted-foreground tabular-nums">{famHead.count}</span>+ </p>+ )}+ <p id={`${ids}-${c.id}`} data-group={c.id} className="break-inside-avoid break-after-avoid pb-2">+ <button type="button" onClick={() => pick(ci)} aria-label={`Show only ${c.label}`} className="nav-row -mx-1.5 flex w-[calc(100%+12px)] min-w-0 items-baseline gap-1.5 rounded-[8px] px-1.5 py-1 text-left">+ <span className="truncate text-[13.5px] font-semibold">{c.label}</span>+ <span className="text-[12px] text-muted-foreground tabular-nums">{items.length}</span>+ <ChevronRight aria-hidden className="ml-auto size-3.5 shrink-0 self-center text-muted-foreground" />+ </button></p>- <IntentLink href={f.href} aria-label={`See all ${f.label.toLowerCase()}`} className="nav-row group/all ml-auto inline-flex h-8 items-center gap-1 rounded-[8px] px-2 text-[12px] 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" />- </IntentLink>- </div>- {model.columns.map((c, ci) => (c.family === f.id ? column(c, ci) : null))}- </Fragment>- ))- : model.columns.map(column)}+ {owner ? (+ <div data-block="" className="mb-3 break-inside-avoid">+ <Suspense fallback={<OwnerStartSkeleton />}>+ <CanvasOwnerStart col={0} labelledBy={`${ids}-${c.id}`} fallback={c.lead && tile(c.lead)} />+ </Suspense>+ </div>+ ) : (+ items.map(tile)+ )}+ </Fragment>+ );+ })}+ </div>+ )}</div>);}--/** Studios' columns as the bar shows them (the checks render it alone). */+/** Studios' tools as the bar shows them (the checks render it alone). */export function LauncherColumns({ kind, current, now }: { kind: ViewerKind | undefined; current?: string; now: number }) {- return <MegaColumns model={studiosMenu(kind)} current={current} now={now} kind={kind} />;+ return <MegaGrid model={bundledMenu("studios", kind)} current={current} now={now} kind={kind} />;}/**- * The pictures a closed panel holds ready for its first frame: those it loads with the panel first (lead covers, before- * and after stills, the first tiles), decoded, so it never opens on empty boxes that fill in after. Resolves once each- * one is decoded or failed, or after `cap` ms. The rows' small pictures load too, after these (low priority).+ * The pictures a closed panel holds ready for its first frame: those it loads with the panel (the tiles at the top of+ * each column), decoded, so it never opens on empty boxes that fill in after. Resolves once each one is decoded or+ * failed, or after `cap` ms.*/function decodePictures(root: HTMLElement, cap = 4000): Promise<void> {const imgs = [...root.querySelectorAll<HTMLImageElement>('img:not([loading="lazy"]):not([fetchpriority="low"])')];@@ -435,6 +332,7 @@ export function MegaPanel({ id, onClose, onSearch, onPrimed }: { id: MegaId; onC// The query too: moving from one preset to another (/video?preset=…) keeps the path.const search = useSearchParams()?.toString() ?? "";const root = useRef<HTMLDivElement>(null);+ const head = useRef<HTMLDivElement>(null);const primed = useRef(onPrimed);useEffect(() => {primed.current = onPrimed;@@ -448,13 +346,24 @@ export function MegaPanel({ id, onClose, onSearch, onPrimed }: { id: MegaId; onClive = false;};}, [model]);+ // The tabs pin under the header row as the panel scrolls: its height is where they stop.+ useLayoutEffect(() => {+ const h = head.current;+ const el = root.current;+ if (!h || !el) return;+ const set = () => el.style.setProperty("--mega-head", `${h.offsetHeight}px`);+ set();+ const ro = new ResizeObserver(set);+ ro.observe(h);+ return () => ro.disconnect();+ }, []);return (- <div ref={root} className="max-w-[1680px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">- <div className="flex min-h-10 items-center gap-3 pb-4">+ <div ref={root} className="max-w-[1680px] px-6 pb-6 lg:pb-7">+ <div ref={head} className="sticky top-0 z-20 -mx-6 flex min-h-10 items-center gap-3 bg-popover px-6 pt-5 pb-3 lg:pt-6"><p className="text-[13px] text-muted-foreground" data-count-line>- {model ? model.countLine : failed ? "Couldn't load this menu" : " "}+ {model ? model.countLine : failed ? "Couldn't load this menu" : " "}</p>- {/* A plain link in Tab order before the grid; the grid's arrow keys skip it (it has no data-col). */}+ {/* A plain link in Tab order before the tiles; the arrow keys skip it (it has no data-key). */}<IntentLinkhref={area.href}aria-current={pathname === area.href ? "page" : undefined}@@ -465,6 +374,12 @@ export function MegaPanel({ id, onClose, onSearch, onPrimed }: { id: MegaId; onCSee all<ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" /></IntentLink>+ {id === "create" && (+ <IntentLink href={NEW_CREATION_HREF} eager className="nav-row inline-flex h-8 items-center gap-1.5 rounded-[8px] px-2 text-[13px] font-medium [@media(pointer:coarse)]:h-11">+ <Plus aria-hidden className="size-3.5 text-brand-text" />+ New creation+ </IntentLink>+ )}{failed && (<button type="button" onClick={retry} className="nav-row inline-flex h-9 items-center gap-1.5 rounded-[10px] px-2 text-[13px] font-medium"><RotateCw aria-hidden className="size-3.5" />@@ -472,6 +387,7 @@ export function MegaPanel({ id, onClose, onSearch, onPrimed }: { id: MegaId; onC</button>)}<span className="flex-1" />+ <PausePreviews className="h-8 [@media(pointer:coarse)]:h-11" /><buttontype="button"onClick={onSearch}@@ -479,13 +395,14 @@ export function MegaPanel({ id, onClose, onSearch, onPrimed }: { id: MegaId; onCclassName="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+ <span className="max-lg:hidden">Search all apps, effects and tools</span>+ <span className="lg:hidden">Search</span><Kbd aria-hidden className="[@media(hover:none)]:hidden">/</Kbd></button></div>- {model ? <MegaColumns model={model} kind={kind} current={megaCurrent(id, pathname, search)} now={now} /> : failed ? null : <MegaSkeleton id={id} />}+ {model ? <MegaGrid model={model} kind={kind} current={megaCurrent(id, pathname, search)} now={now} /> : failed ? null : <MegaSkeleton id={id} />}</div>);}diff --git a/src/components/nav/top-bar.tsx b/src/components/nav/top-bar.tsxindex 3ddfedd9..2f85ba05 100644--- a/src/components/nav/top-bar.tsx+++ b/src/components/nav/top-bar.tsx@@ -11,7 +11,6 @@ import { activeEntry, entry, type NavEntry } from "@/lib/nav-model";import { isPlainClick, useTappedTab } from "@/lib/use-tapped-tab";import { cn } from "@/lib/utils";import { CoverThumb, NavIcon } from "./cover-thumb";-import { CreateMenu } from "./create-menu";import { CARD_ROW, MENU_ROW_2, ROW_LINE, rowName, SeeAllRow } from "./nav-row";import { useNavUi, useViewerKind } from "./nav-ui";import { useSearchPalette } from "./search-context";@@ -189,7 +188,7 @@ function BarLinks({ active, onTap }: { active: Active; onTap?: (href: string) =>return (<>{/* An item is marked anywhere in its area, its own page (/create, /studios …) included. */}- <CreateMenu active={active.create || active.page === "create"} />+ <MegaLauncher id="create" active={active.create || active.page === "create"} /><MegaLauncher id="studios" active={active.studios || active.page === "studios"} /><MegaLauncher id="fx" active={active.fx || active.page === "fx"} className="hidden xl:inline-flex" /><MegaLauncher id="apps" active={active.apps || active.page === "apps"} className="hidden xl:inline-flex" />diff --git a/src/components/pause-previews.tsx b/src/components/pause-previews.tsxnew file mode 100644index 00000000..61c78a15--- /dev/null+++ b/src/components/pause-previews.tsx@@ -0,0 +1,33 @@+"use client";++import { Pause, Play } from "lucide-react";+import { setPreviewsPaused, usePreviewsPaused } from "@/components/preset-preview";+import { cn } from "@/lib/utils";++/**+ * Stops every preview playing by itself, on every page (Home's first screen, the bar's menus, the galleries), remembered+ * on this device (preset-preview.tsx); a hover still plays one where a card allows it. One setting: pausing here pauses+ * everywhere.+ */+export function PausePreviews({ className }: { className?: string }) {+ const paused = usePreviewsPaused();+ const Icon = paused ? Play : Pause;+ const label = paused ? "Play previews" : "Pause previews";+ return (+ <button+ type="button"+ onClick={() => setPreviewsPaused(!paused)}+ aria-label={label}+ aria-pressed={paused}+ title={label}+ // 44 px to tap: its hit area reaches past its 28 px circle.+ className={cn(+ "relative inline-flex size-7 shrink-0 items-center justify-center gap-1.5 rounded-full border text-[12px] text-muted-foreground transition-colors after:absolute after:-inset-2 after:content-[''] hover:bg-accent hover:text-foreground sm:w-[8.5rem]",+ className,+ )}+ >+ <Icon className="size-3" />+ <span className="max-sm:hidden">{label}</span>+ </button>+ );+}diff --git a/src/components/preset-preview.tsx b/src/components/preset-preview.tsxindex d87a9e01..fa67bf79 100644--- a/src/components/preset-preview.tsx+++ b/src/components/preset-preview.tsx@@ -28,12 +28,13 @@ import { cn } from "@/lib/utils";const store = createPlaybackStore(browserPlaybackEnv);/**- * Home's "Pause previews", kept for this visit (the tab's session): it holds on every page, and a new visit plays- * again, so a pause tapped by mistake doesn't keep every gallery still in that browser.+ * "Pause previews" (Home's first screen, the bar's menus): one setting for every page, remembered on this device, so a+ * viewer who paused because their computer struggles finds previews still paused on the next visit. Blocked storage+ * keeps it for the visit only.*/const PAUSE_KEY = "fuobe:previews";try {- if (typeof window !== "undefined" && sessionStorage.getItem(PAUSE_KEY) === "paused") store.setPaused(true);+ if (typeof window !== "undefined" && localStorage.getItem(PAUSE_KEY) === "paused") store.setPaused(true);} catch {}/** Whether the viewer paused previews (false until hydrated, as on the server). */@@ -42,8 +43,8 @@ export const usePreviewsPaused = () => useSyncExternalStore(store.subscribe, stoexport function setPreviewsPaused(paused: boolean) {store.setPaused(paused);try {- if (paused) sessionStorage.setItem(PAUSE_KEY, "paused");- else sessionStorage.removeItem(PAUSE_KEY);+ if (paused) localStorage.setItem(PAUSE_KEY, "paused");+ else localStorage.removeItem(PAUSE_KEY);} catch {}}diff --git a/src/lib/fx-tools.ts b/src/lib/fx-tools.tsindex ed2ee28a..f7e4cfe1 100644--- a/src/lib/fx-tools.ts+++ b/src/lib/fx-tools.ts@@ -37,8 +37,13 @@ export const FX_COVERS: Readonly<Record<string, string>> = {"video-tools-depth": "effect-lidar-transition","video-tools-relight": "app-relight","video-tools-evolution": "effect-world-morphing",+ "video-tools-trim": "app-clipcut",+ "video-tools-join": "app-urban-cuts",+ "video-tools-captions": "app-text-edit",+ "video-tools-remove-dialogue": "app-clean-up-voice",[gj("restyle")]: "effect-layer-mixed-media",[gj("finish")]: "effect-film-colors",+ [gj("reshoot")]: "app-expression-edit","upscale-fps": "motion-slow-motion",// Body Double (an app with a navigation entry): its own cover, a card here."body-double": "app-body-double",diff --git a/src/lib/mega-menus.server.ts b/src/lib/mega-menus.server.tsindex 214bbad3..872b38a9 100644--- a/src/lib/mega-menus.server.ts+++ b/src/lib/mega-menus.server.ts@@ -14,7 +14,7 @@ import { canvasIntro, templateCards } from "@/lib/canvas-template-cards";import { templateSections, type Viewing } from "@/lib/canvas-sections";import { coverFraming } from "@/lib/cover-framing";import { HOME_EFFECTS, HOME_MOTIONS, presetHref } from "@/lib/home-showcase";-import { ROW_CAPS, TILE_COLS, TILE_ROWS, type MegaColumn, type MegaCover, type MegaItem, type MegaModel } from "@/lib/mega-menus";+import type { MegaColumn, MegaCover, MegaItem, MegaModel } from "@/lib/mega-menus";import { hasMini, miniOf } from "@/lib/preset-cards";import { presetCover } from "@/lib/preset-covers";import { presetStillSources } from "@/lib/preset-hd";@@ -124,17 +124,18 @@ export function presetMegaCover(id: string): MegaCover | undefined {/** Whether a preset has a cover of its own (presetCover gives another shot's to a few: SAME_SHOT). */export const hasOwnCover = (id: string) => !!presetCover(id)?.poster.startsWith(`/previews/presets/${id}.jpg`);-const presetItem = (p: Preset): MegaItem => ({ id: p.id, href: presetHref(p.id), label: p.name, line: presetLine(p), cover: presetMegaCover(p.id) });--/** A lead card's item with its cover's clip, which plays over the still while the card is pointed at (rows show none). */+/** An item with its cover's clip, which plays over the still while its tile is on screen or pointed at. */function withClip(e: MegaItem): MegaItem {const clip = e.cover && presetCover(e.id)?.video;return clip ? { ...e, cover: { ...e.cover!, clip } } : e;}+const presetItem = (p: Preset): MegaItem => withClip({ id: p.id, href: presetHref(p.id), label: p.name, line: presetLine(p), cover: presetMegaCover(p.id) });+/**- * One column per group: its presets premium first (featuredAll), one of each idea (sameIdea), the first with its own- * cover as the lead, then up to ROW_CAPS.tall rows (each with its cover). Columns in the order of their strongest preset.+ * One column per group: every one of its presets, premium first (featuredAll), the first with a cover of its own as the+ * lead. Columns in the order of their strongest preset. The menu shows all of them (it scrolls inside), so a visitor+ * finds every app, motion and effect from the bar.*/export function presetColumns(items: readonly Preset[], groups: readonly PresetGroup[], family?: string): MegaColumn[] {const ranked = featuredAll(items);@@ -143,22 +144,16 @@ export function presetColumns(items: readonly Preset[], groups: readonly PresetGreturn [...groups].sort((a, b) => firstAt(a) - firstAt(b)).map((g) => {- const seen = new Set<string>();- const mine = ranked.filter((p) => {- if (!inGroup(g)(p) || !hasOwnCover(p.id)) return false;- const k = sameIdea(p.name);- if (seen.has(k)) return false;- seen.add(k);- return true;- });- const [lead, ...rest] = mine;+ const mine = ranked.filter(inGroup(g));+ const lead = mine.find((p) => hasOwnCover(p.id)) ?? mine[0];+ const rest = mine.filter((p) => p !== lead);return {id: g.id,label: g.label,chip: g.chip,...(family && { family }),- ...(lead && { lead: withClip(presetItem(lead)) }),- rows: rest.slice(0, ROW_CAPS.tall).map(presetItem),+ ...(lead && { lead: presetItem(lead) }),+ rows: rest.map(presetItem),};});}@@ -204,8 +199,7 @@ function templateMegaCover(id: string): MegaCover | undefined {}/**- * The ready boards a visitor can open, by section: only those with a real cover, at most TILE_ROWS rows of TILE_COLS- * each (the panel never scrolls; the rest are a click away on /canvas). "What's a canvas?" leads, with the board the+ * The ready boards a visitor can open, by section: every one with a real cover (the menu scrolls inside). "What's a canvas?" leads, with the board the* /canvas explainer shows, which the tiles then leave out. The owner's first column (New board, their recent boards)* replaces it in the browser (`owner`).*/@@ -244,9 +238,7 @@ export function canvasMenu(): MegaModel {chip: s.title,variant: "tiles",span: 4,- rows: s.items- .slice(0, TILE_ROWS * TILE_COLS)- .map((t) => ({ id: t.id, href: `/canvas/start/${t.id}`, label: t.name, line: MENU_LINES[t.id] ?? shortLine(t.description), icon: "Network", cover: templateMegaCover(t.id) })),+ rows: s.items.map((t) => ({ id: t.id, href: `/canvas/start/${t.id}`, label: t.name, line: MENU_LINES[t.id] ?? shortLine(t.description), icon: "Network", cover: templateMegaCover(t.id) })),// The last section's label row ends on "See all": every ready board on /canvas....(i === shown.length - 1 && { more: { href: "/canvas?tab=templates", label: "See all ready boards" } }),}),@@ -275,7 +267,7 @@ function fxMenuItem(id: string): MegaItem | undefined {// Its line as the Studios menu gives it (34 characters at most; CSS fits it to the row).line: e.what,icon: e.icon,- ...(own && { cover: own }),+ ...(own && { cover: presetCover(mine!)?.video ? { ...own, clip: presetCover(mine!)!.video! } : own }),...(nav && { navCover: nav }),...(fx && { fx }),...(e.short && { short: e.short }),@@ -285,7 +277,7 @@ function fxMenuItem(id: string): MegaItem | undefined {/*** Fuobe FX as a menu: a column per section (src/lib/fx-tools.ts), its first card as the lead and then its other cards- * and its pills, up to ROW_CAPS.tall rows (the page has every one). What a visitor sees: the owner's own modes are left+ * and its pills, every one (the menu scrolls inside). What a visitor sees: the owner's own modes are left* to the page.*/export function fxMenu(): MegaModel {@@ -311,7 +303,7 @@ export function fxMenu(): MegaModel {const lead = items.find((x) => x.cover || x.navCover) ?? items[0];// Rows show their small cover: only the lead card shows a before and after, so only it carries one.const rest = items.filter((x) => x !== lead).map((x) => (x.fx ? { ...x, fx: undefined } : x));- return { id: s.id, label: s.title, chip: FX_SECTIONS.find((x) => x.id === s.id)!.chip, ...(lead && { lead }), rows: rest.slice(0, ROW_CAPS.tall) };+ return { id: s.id, label: s.title, chip: FX_SECTIONS.find((x) => x.id === s.id)!.chip, ...(lead && { lead }), rows: rest };}),};}diff --git a/src/lib/mega-menus.ts b/src/lib/mega-menus.tsindex 6371713c..c3fc32e0 100644--- a/src/lib/mega-menus.ts+++ b/src/lib/mega-menus.ts@@ -1,19 +1,24 @@/**- * The bar's grouped menus (Studios, Apps, Motions & effects, Canvas) as one model the launcher draws: a header line- * with the true count, columns of a lead card and rows (or cover tiles), and "See all". Client-safe (no catalog):- * Studios is built here from the navigation model; the other three are built on the server from the catalog and the- * covers (mega-menus.server.ts) and fetched as small static files (/nav-menus/<id>) the first time a menu warms.+ * The bar's menus (Create, Studios, Fuobe FX, Apps, Motions & effects, Canvas) as one model the panel draws: a header+ * line with the true count, its groups (each a lead and the rest, every one of them: the panel scrolls inside), and+ * "See all". Client-safe (no catalog): Create and Studios are built here from the navigation model; the others are+ * built on the server from the catalog and the covers (mega-menus.server.ts) and fetched as small static files+ * (/nav-menus/<id>) the first time a menu warms.*/import type { CoverFraming } from "./cover-framing";import type { FxView } from "./fx-compare";+import { LIVE_DEMO_POSTER } from "./live/demo";import { area } from "./nav-areas";import type { StillSources } from "./preset-hd";-import { entriesFor, launcherColumns, studioCount, studioSubs, STUDIO_SUBS, subLabel, subParent, type NavEntry, type NavIconName, type ViewerKind } from "./nav-model";+import { CREATE_COLUMNS, entriesFor, entry, launcherColumns, studioCount, studioSubs, STUDIO_SUBS, subLabel, subParent, visibleTo, type NavEntry, type NavIconName, type ViewerKind } from "./nav-model";-export type MegaId = "studios" | "apps" | "motions" | "canvas" | "fx";+export type MegaId = "create" | "studios" | "apps" | "motions" | "canvas" | "fx";-/** The menus fetched from the server (Studios is in the bundle). */-export type FetchedMegaId = Exclude<MegaId, "studios">;+/** The menus built in the browser from the navigation model (in the bundle, never fetched). */+export const BUNDLED_MENUS: readonly MegaId[] = ["create", "studios"];++/** The menus fetched from the server (Create and Studios are in the bundle). */+export type FetchedMegaId = Exclude<MegaId, "studios" | "create">;export const FETCHED_MENUS: readonly FetchedMegaId[] = ["apps", "motions", "canvas", "fx"];/** Where a fetched menu's data is: a static file, made at build time. */@@ -129,6 +134,7 @@ export interface MegaModel {/** Each menu's bar item: its name, the page its name opens, and the names of its chevron and panel. */export const MEGA_AREAS: Record<MegaId, { label: string; href: string; menu: string; panel: string }> = {+ create: { label: "Create", href: area("create").href, menu: "Create menu", panel: "Create" },studios: { label: "Studios", href: area("studios").href, menu: "Studios menu", panel: "All studios" },apps: { label: "Apps", href: area("apps").href, menu: "Apps menu", panel: "All apps" },motions: { label: "Motions & effects", href: area("motions").href, menu: "Motions & effects menu", panel: "All motions and effects" },@@ -240,6 +246,46 @@ export function studiosMenu(kind: ViewerKind | undefined): MegaModel {return model;}+/**+ * Create's tools that have no preset cover: a picture of their own work (Chat's Creative brief workshop, Live edit's+ * recorded session). A test keeps each file in step.+ */+export const CREATE_COVERS: Readonly<Record<string, MegaCover>> = {+ chat: { poster: "/previews/chat/workshop/creative-brief.jpg?v=0a107c75", thumb: "/previews/chat/workshop/creative-brief.jpg?v=0a107c75" },+ "live-edit": { poster: LIVE_DEMO_POSTER.webp[1].src, thumb: LIVE_DEMO_POSTER.webp[0].src },+};++/** The Create menu for each kind of viewer, built once (it only reads the navigation model). */+const createMenus = new Map<ViewerKind | undefined, MegaModel>();++/**+ * Create as a menu: its two groups (CREATE_COLUMNS: Make, Edit a picture), each tool a tile with its cover (or its icon+ * where it has none), for who is looking.+ */+export function createMenu(kind: ViewerKind | undefined): MegaModel {+ const built = createMenus.get(kind);+ if (built) return built;+ const columns: MegaColumn[] = CREATE_COLUMNS.map((c) => {+ const items = c.ids.map((id) => entry(id)).filter((e): e is NavEntry => !!e && visibleTo(e, kind))+ .map((e) => (CREATE_COVERS[e.id] ? { ...studioItem(e), cover: CREATE_COVERS[e.id] } : studioItem(e)));+ const [lead, ...rows] = items;+ return { id: c.label.toLowerCase().replace(/[^a-z]+/g, "-"), label: c.label, chip: c.label, ...(lead && { lead }), rows };+ });+ const n = columns.reduce((sum, c) => sum + (c.lead ? 1 : 0) + c.rows.length, 0);+ const model: MegaModel = {+ id: "create",+ count: n,+ countLine: "Start from words or a picture",+ seeAll: { href: MEGA_AREAS.create.href, name: "See all of Create" },+ columns,+ };+ createMenus.set(kind, model);+ return model;+}++/** A bundled menu's model (Create, Studios) for who is looking. */+export const bundledMenu = (id: "create" | "studios", kind: ViewerKind | undefined): MegaModel => (id === "create" ? createMenu(kind) : studiosMenu(kind));+/** Every item of a menu, leads first in each column, in column order (a phone's "All", a test). */export const megaItems = (m: MegaModel): MegaItem[] => m.columns.flatMap((c) => [...(c.lead ? [c.lead] : []), ...c.rows]);@@ -252,25 +298,38 @@ function presetUrls(id: string, v: string): MegaCover {return { poster, thumb: `/previews/presets/thumbs/${id}.jpg?v=${v}`, mini: `/previews/presets/mini/${id}.jpg?v=${v}` };}-/** An item as the menu files carry it: a preset's cover by its version (`cv`) and its page left out when it is the usual one. */-type WireItem = Omit<MegaItem, "href" | "cover"> & { href?: string; cover?: MegaCover; cv?: string };+/**+ * An item as the menu files carry it: a preset's cover by its version (`cv`), its clip by its version (`clv`) when it is+ * the preset's own (/previews/presets/<id>.mp4), and its page left out when it is the usual one.+ */+type WireItem = Omit<MegaItem, "href" | "cover"> & { href?: string; cover?: MegaCover; cv?: string; clv?: string };++/** A preset's own clip: /previews/presets/<id>.mp4?v=<v>. */+const presetClip = (id: string, v: string) => `/previews/presets/${id}.mp4?v=${v}`;function packItem(e: MegaItem): WireItem {const { href, cover, ...rest } = e;const v = cover && /^\/previews\/presets\/([^/]+)\.jpg\?v=([0-9a-f]{8})$/.exec(cover.poster);const usual = v && v[1] === e.id && JSON.stringify({ ...presetUrls(e.id, v[2]) }) === JSON.stringify({ poster: cover!.poster, thumb: cover!.thumb, mini: cover!.mini });- // The usual cover goes by its version, with what its URLs don't say (its framing, its clip) beside it.- const extra = usual && { ...(cover!.framing && { framing: cover!.framing }), ...(cover!.clip && { clip: cover!.clip }), ...(cover!.clipAt !== undefined && { clipAt: cover!.clipAt }) };+ const clv = usual && cover!.clip ? /^\/previews\/presets\/([^/]+)\.mp4\?v=([0-9a-f]{8})$/.exec(cover!.clip) : null;+ const ownClip = clv && clv[1] === e.id ? clv[2] : undefined;+ // The usual cover goes by its version, with what its URLs don't say (its framing, another preset's clip) beside it.+ const extra = usual && {+ ...(cover!.framing && { framing: cover!.framing }),+ ...(cover!.clip && !ownClip && { clip: cover!.clip }),+ ...(cover!.clipAt !== undefined && { clipAt: cover!.clipAt }),+ };return {...rest,...(href !== presetPage(e.id) && { href }),- ...(usual ? { cv: v![2], ...(extra && Object.keys(extra).length && { cover: extra as MegaCover }) } : cover && { cover }),+ ...(usual ? { cv: v![2], ...(ownClip && { clv: ownClip }), ...(extra && Object.keys(extra).length && { cover: extra as MegaCover }) } : cover && { cover }),};}function unpackItem(w: WireItem): MegaItem {- const { cv, href, cover, ...rest } = w;- return { ...rest, href: href ?? presetPage(w.id), ...(cv ? { cover: { ...presetUrls(w.id, cv), ...cover } } : cover && { cover }) };+ const { cv, clv, href, cover, ...rest } = w;+ const own = cv ? { ...presetUrls(w.id, cv), ...(clv && { clip: presetClip(w.id, clv) }), ...cover } : undefined;+ return { ...rest, href: href ?? presetPage(w.id), ...(own ? { cover: own } : cover && { cover }) };}/** A menu as its file carries it (smaller: presets' covers by version): packMenu on the server, unpackMenu in the browser. */diff --git a/src/lib/menu-lines.ts b/src/lib/menu-lines.tsindex b0234deb..5748b449 100644--- a/src/lib/menu-lines.ts+++ b/src/lib/menu-lines.ts@@ -112,6 +112,7 @@ export const MENU_LINES: Record<string, string> = {"effect-chain-monet-muse": "Into a Monet lily pond","effect-chain-superstar": "On stage under spotlights","effect-chain-fairytale-castle": "A fairytale castle rises",+ "effect-chain-fallen-angel": "Dark wings in a storm","effect-chain-blue-depth": "You drift in deep blue","effect-chain-dolphin-ride": "You ride a dolphin","effect-chain-skatedog": "A dog on a skateboard",diff --git a/src/lib/nav-covers.ts b/src/lib/nav-covers.tsindex c143ee89..db5c4c7f 100644--- a/src/lib/nav-covers.ts+++ b/src/lib/nav-covers.ts@@ -4,7 +4,7 @@*/import "server-only";import { coverFraming, type CoverFraming } from "./cover-framing";-import { coverIds, launcherColumns } from "./nav-model";+import { coverIds } from "./nav-model";import { hasMini, miniOf } from "./preset-cards";import { presetCover } from "./preset-covers";@@ -18,8 +18,8 @@ export interface NavCover {/** How it sits in a square tile or pill (cover-framing.ts), when it isn't centred there. */framing?: CoverFraming;/**- * Its short muted clip's version, for the Studios menu's lead cards only (a row's picture is too small for a clip):- * the clip is /previews/presets/<id>.mp4?v=<clipV>, played over the still while the card is pointed at.+ * Its short muted clip's version: the clip is /previews/presets/<id>.mp4?v=<clipV>, played over the still while its+ * menu tile is on screen (the bar's menus) or its card is pointed at.*/clipV?: string;}@@ -33,8 +33,6 @@ let cached: NavCovers | undefined;export function navCovers(): NavCovers {if (cached) return cached;const out: NavCovers = {};- // The Studios menu's lead cards, for any viewer: only they play a clip.- const leads = new Set((["guest", "account", "owner", undefined] as const).flatMap((k) => launcherColumns(k).map((c) => c.lead.cover)));for (const id of coverIds()) {const c = presetCover(id);if (!c) throw new Error(`The navigation names ${id}, which has no cover`);@@ -42,7 +40,7 @@ export function navCovers(): NavCovers {const mini = hasMini(c.poster) ? miniOf(c.poster) : undefined;// Only a clip of its own, at the usual place (a stand-in's clip is another preset's).const own = `/previews/presets/${id}.mp4?v=`;- const clipV = leads.has(id) && c.video?.startsWith(own) ? c.video.slice(own.length) : undefined;+ const clipV = c.video?.startsWith(own) ? c.video.slice(own.length) : undefined;out[id] = { thumb: c.thumb, poster: c.poster, ...(mini && { mini }), ...(framing && { framing }), ...(clipV && { clipV }) };}cached = out;diff --git a/src/lib/nav-model.ts b/src/lib/nav-model.tsindex efdc393d..c29ea466 100644--- a/src/lib/nav-model.ts+++ b/src/lib/nav-model.ts@@ -140,7 +140,7 @@ const PAGES: NavEntry[] = [{ id: "inpaint", href: "/inpaint", label: "Inpaint", what: "Paint over a part", kind: "create", goals: ["edit", "people"], keywords: "mask fill remove brush fix", cover: "app-change-background", icon: "Brush" },{ id: "layers", href: "/layers", label: "Layers", what: "Split a picture into layers", kind: "create", goals: ["edit"], keywords: "layered psd split cutout", cover: "app-packshot", icon: "Layers2" },{ id: "color-grade", href: "/color-grade", label: "Color grading", what: "Grade and match colors", kind: "create", goals: ["edit", "film"], keywords: "grade lut colour color", cover: "app-color-grading", icon: "SlidersHorizontal" },- { id: "canvas", href: "/canvas", label: "Canvas", what: "Wire models together", kind: "create", goals: [], keywords: "nodes flow workflow graph", icon: "Network" },+ { id: "canvas", href: "/canvas", label: "Canvas", what: "Wire models together", kind: "create", goals: [], keywords: "nodes flow workflow graph", cover: "effect-pearl-earring", icon: "Network" },{ id: "motions", href: "/motions", label: "Camera motions", what: "Crane and drone moves for any shot", kind: "presets", goals: ["film"], keywords: "camera moves presets dolly crane drone orbit", cover: "motion-crane-up", icon: "Film" },{ id: "effects", href: "/effects", label: "Effects", what: "Cinematic effects from one photo", kind: "presets", goals: ["film", "social"], keywords: "vfx presets visual effects", cover: "effect-nature-bloom", icon: "Sparkles" },{ id: "library", href: "/library", label: "All creations", what: "Everything you have made", kind: "library", goals: [], keywords: "library history results creations", icon: "Library", eager: true },diff --git a/tests/mega-menus.test.ts b/tests/mega-menus.test.tsindex ac12c9fd..df541fc3 100644--- a/tests/mega-menus.test.ts+++ b/tests/mega-menus.test.ts@@ -5,9 +5,8 @@ import sharp from "sharp";import { describe, expect, it } from "vitest";import { APPS, EFFECTS, MODELS, MOTIONS } from "@/lib/catalog";import { CANVAS_TEMPLATES } from "@/lib/catalog/canvas";-import { APP_GROUPS, appsMenu, canvasMenu, EFFECT_GROUPS, LINE_MAX, menuCategory, MOTION_GROUPS, motionsMenu, presetLine, sameIdea, SERVER_MENUS, shortLine, type PresetGroup } from "@/lib/mega-menus.server";-import { megaItems, megaMove, packMenu, ROW_CAPS, studiosMenu, TILE_COLS, TILE_ROWS, unpackMenu, type MegaModel } from "@/lib/mega-menus";-import { keyPlaces, trackSizes } from "@/components/nav/mega-panel";+import { APP_GROUPS, appsMenu, canvasMenu, EFFECT_GROUPS, LINE_MAX, menuCategory, MOTION_GROUPS, motionsMenu, presetLine, SERVER_MENUS, shortLine, type PresetGroup } from "@/lib/mega-menus.server";+import { megaItems, megaMove, packMenu, studiosMenu, unpackMenu, type MegaModel } from "@/lib/mega-menus";import { CANVAS_INTRO } from "@/lib/canvas-template-cards";import { MENU_LINES } from "@/lib/menu-lines";import type { Preset } from "@/lib/catalog/types";@@ -61,21 +60,20 @@ describe.each([// Each kind in its own premium order (a column holds one kind).const rank = new Map([APPS, MOTIONS, EFFECTS].flatMap((kind) => featuredAll(kind).map((p, i) => [p.id, i] as const)));- it("leads each column with its strongest preset that has a cover of its own, then the rest premium first", () => {+ it("leads each column with its strongest preset that has a cover of its own, then every other one premium first", () => {for (const c of menu.columns) {- const ids = [c.lead!, ...c.rows].map((e) => e.id);- const order = ids.map((id) => rank.get(id)!);+ const order = c.rows.map((e) => rank.get(e.id)!);expect(order, c.id).toEqual([...order].sort((a, b) => a - b));expect(Object.hasOwn(PRESET_COVERS, c.lead!.id), c.id).toBe(true);- expect(c.rows.length, c.id).toBeLessThanOrEqual(ROW_CAPS.tall);- // One of each idea ("Angles", "Fuobe Angles", "Any Angle": the strongest only).- expect(new Set(ids.map((id) => sameIdea(items.find((p) => p.id === id)!.name))).size, c.id).toBe(ids.length);+ // No stronger preset in the column has a cover of its own.+ for (const e of c.rows) if (rank.get(e.id)! < rank.get(c.lead!.id)!) expect(Object.hasOwn(PRESET_COVERS, e.id), `${c.id}: ${e.id}`).toBe(false);}});- it("shows at most seven rows under a lead, as Studios", () => {- expect(ROW_CAPS.tall).toBeLessThanOrEqual(7);- for (const c of menu.columns) expect(c.rows.length, c.id).toBeLessThanOrEqual(7);+ it("lists every preset of its kind, each once (the menu scrolls inside, so a visitor finds all of them)", () => {+ const ids = megaItems(menu).map((e) => e.id);+ expect(new Set(ids).size).toBe(ids.length);+ expect([...ids].sort()).toEqual(items.map((p) => p.id).sort());});it("orders its columns by their strongest preset (within a family)", () => {@@ -91,7 +89,9 @@ describe.each([expect(new Set(all.map((e) => e.id)).size).toBe(all.length);for (const e of all) {expect(e.cover?.poster, e.id).toMatch(/\?v=[0-9a-f]{8}$/);- for (const u of [e.cover!.poster, e.cover!.thumb, e.cover!.mini!]) expect(fs.existsSync(file(u)), u).toBe(true);+ for (const u of [e.cover!.poster, e.cover!.thumb, e.cover!.mini].filter((u): u is string => !!u)) expect(fs.existsSync(file(u)), u).toBe(true);+ // Its clip, where it has one, is a file of the site's.+ if (e.cover!.clip) expect(fs.existsSync(file(e.cover!.clip)), e.cover!.clip).toBe(true);expect(e.href, e.id).toMatch(e.id.startsWith("app-") ? /^\/apps\/app-/ : /^\/video\?preset=/);expect(e.line, e.id).toBeTruthy();// One row's line, whole: no "…", within LINE_MAX (about 26 characters, as Studios' lines).@@ -109,10 +109,9 @@ describe("the Canvas menu", () => {it("lists the ready boards a visitor sees, each with its finished scene (a still or a peak frame), and counts them", () => {const visible = CANVAS_TEMPLATES.filter((t) => t.starter !== false && templateCover("canvas", t.id));const bare = CANVAS_TEMPLATES.filter((t) => t.starter !== false && !templateCover("canvas", t.id));- // The tiles: every board with a cover but the one "What's a canvas?" shows, up to TILE_ROWS rows of TILE_COLS a section.+ // The tiles: every board with a cover but the one "What's a canvas?" shows.const shown = visible.filter((t) => t.id !== CANVAS_INTRO);- const sections = menu.columns.filter((c) => c.variant === "tiles");- expect(boards.length).toBe(Math.min(shown.length, TILE_ROWS * TILE_COLS * sections.length));+ expect(boards.length).toBe(shown.length);for (const b of boards) expect(shown.map((t) => t.id), b.id).toContain(b.id);for (const t of bare) expect(boards.map((b) => b.id)).not.toContain(t.id);expect(menu.count).toBe(visible.length);@@ -121,7 +120,6 @@ describe("the Canvas menu", () => {expect(b.cover?.poster, b.id).toBe(templateCover("canvas", b.id)!.poster);expect(b.cover?.poster, b.id).toMatch(/^\/previews\/(presets\/peak|templates\/canvas)\/[^/]+\.jpg\?v=/);}- for (const c of sections) expect(c.rows.length, c.id).toBeLessThanOrEqual(TILE_ROWS * TILE_COLS);});it("gives each board a whole line that fits its tile: its own menu line, or its description when that is short", () => {@@ -151,10 +149,10 @@ describe("the Canvas menu", () => {const [ma, mb] = [mean(a), mean(b)];return a.reduce((sum, v, i) => sum + Math.abs(v - ma - (b[i] - mb)), 0) / a.length;};- // The boxes as the panel and the phone sheet draw them (tests/e2e/mega-menus.mjs measures them): a tile at 1440- // and 1920 px on a 2x screen, the lead (two tracks) at 1440 px on a 2x screen, a phone card at 390 px on a 3x screen.- const tile = [222 * 2, 262 * 2, 167 * 3];- const lead = [454 * 2, 167 * 3];+ // The boxes as the panel and the phone sheet draw them: a tile (a fifth of the panel) at 1440 and 1920 px on a 2x+ // screen, a phone card at 390 px on a 3x screen; the lead is a tile like the others.+ const tile = [269 * 2, 316 * 2, 167 * 3];+ const lead = tile;const items = [...boards.map((b) => [b, tile] as const), [menu.columns[0].lead!, lead] as const];for (const [e, needs] of items) {const hd = e.cover?.hd;@@ -171,18 +169,6 @@ describe("the Canvas menu", () => {}});- it("tells the browser each picture's box width: a tile one track, the lead two less its border", () => {- const at = (sizes: string, vw: number) => {- const [wide, calc] = sizes.split(", ");- if (vw >= 1680) return Number(/ (\d+)px$/.exec(wide)![1]);- const [, side, span, extra] = /^calc\(\(100vw - (\d+)px\) \* (\d+) \/ 6 \+ (-?\d+)px\)$/.exec(calc)!;- return ((vw - Number(side)) * Number(span)) / 6 + Number(extra);- };- // As the panel draws them (tests/e2e/mega-menus.mjs): tiles 222 and 262 px wide, the lead 454 and 534 px.- expect([1440, 1920].map((vw) => at(trackSizes(1), vw))).toEqual([222, 262]);- expect([1440, 1920].map((vw) => at(trackSizes(2, 2), vw))).toEqual([454, 534]);- });-it("holds no model name", () => {const text = JSON.stringify(menu);for (const name of ["Fuobe DoP", "Qwen", "free on your GPU", ...MODELS.map((m) => m.name).filter((n) => n.length > 5)]) expect(text, name).not.toContain(name);@@ -190,10 +176,10 @@ describe("the Canvas menu", () => {});describe("the menus' size", () => {- it.each(Object.keys(SERVER_MENUS) as (keyof typeof SERVER_MENUS)[])("%s is at most 4 KB gzipped", (id) => {+ it.each(Object.keys(SERVER_MENUS) as (keyof typeof SERVER_MENUS)[])("%s is at most 16 KB gzipped, with every item and its clip", (id) => {const menu = SERVER_MENUS[id]();const wire = JSON.stringify(packMenu(menu));- expect(gzipSync(wire).length).toBeLessThanOrEqual(4096);+ expect(gzipSync(wire).length).toBeLessThanOrEqual(16 * 1024);// The browser gets back exactly the menu the server built.expect(unpackMenu(JSON.parse(wire))).toEqual(menu);});@@ -242,18 +228,6 @@ describe("the menus' groups by what an app takes", () => {});});-describe("the keys' places", () => {- it("stack two tiles sections on the same key columns, the lower one's rows after the upper one's", () => {- const tiles = (n: number) => ({ id: `t${n}`, label: "", chip: "", variant: "tiles" as const, span: 4, rows: Array.from({ length: n }, (_, i) => ({ id: `b${n}-${i}`, href: "/", label: "" })) });- const start = { id: "start", label: "", chip: "", span: 2, rows: [] };- expect(keyPlaces([start, tiles(8), tiles(5)])).toEqual([- { col: 0, row: 0 },- { col: 1, row: 0 },- { col: 1, row: 2 },- ]);- });-});-describe("the arrow keys across columns", () => {it("skip hidden rows (the lengths count only the rows that show) and move between families", () => {// Six columns of 7 shown rows (lead + 6 at 720 px).@@ -275,10 +249,11 @@ describe("Fuobe FX as a menu", () => {expect(m.id).toBe("fx");expect(m.seeAll.href).toBe("/fx");expect(m.columns.map((c) => c.id)).toEqual(FX_SECTIONS.map((s) => s.id));- for (const c of m.columns) {- expect(c.lead?.cover ?? c.lead?.navCover, c.id).toBeTruthy();- expect(c.rows.length, c.id).toBeLessThanOrEqual(ROW_CAPS.tall);- }+ for (const c of m.columns) expect(c.lead?.cover ?? c.lead?.navCover, c.id).toBeTruthy();+ // Every tool of every section, each once (the count is the menu's own).+ expect(megaItems(m)).toHaveLength(m.count);+ // Every one shows a picture: its own cover, a nav cover, or a preset that shows the same job.+ for (const e of megaItems(m)) expect(e.cover ?? e.navCover, e.id).toBeTruthy();expect(m.columns[0].lead!.id).toBe("genjutsu");const items = megaItems(m);for (const id of FX_HOME) expect(items.map((e) => e.id), id).toContain(id);diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.tsindex 18f855ab..fe3200b9 100644--- a/tests/nav-bar.test.ts+++ b/tests/nav-bar.test.ts@@ -144,7 +144,7 @@ describe("which bar item holds the page", () => {});});-describe("the launcher's columns", () => {+describe("the Studios menu's tiles", () => {const html = render(createElement(LauncherColumns, { kind: undefined, now: Date.parse("2026-11-02") }));it("shows every studio, Apps and the Sound column, 4/6/5/4/5/3 (Ads Studio under Marketing Studio; the FX studios are Fuobe FX's), each column's lead first", () => {@@ -157,16 +157,14 @@ describe("the launcher's columns", () => {expect(studiosMenu(undefined).columns.map((c) => 1 + c.rows.filter((e) => !e.under).length)).toEqual([4, 6, 5, 4, 5, 3]);expect(studiosMenu(undefined).columns.flatMap((c) => c.rows.filter((e) => e.under).map((e) => [e.id, e.under]))).toEqual([["ads", "marketing"]]);expect(launcherColumns(undefined).map((c) => c.lead.id)).toEqual(["cinema", "shorts", "marketing", "fashion-factory", "audio", "upscale"]);- expect(html).toContain("grid-cols-6");- // The arrow keys' places: the lead, its features, then each row and its features, top to bottom.- for (const [i, c] of studiosMenu(undefined).columns.entries()) {- const at = (href: string, sub: boolean) => anchors(html).find((a) => a.href === href && a.tag.includes(`data-col="${i}"`) && a.tag.includes("data-sub") === sub)?.tag ?? "";- let r = 0;- for (const e of [c.lead!, ...c.rows.filter((x) => !x.under)]) {- expect(at(e.href, false), e.id).toContain(`data-col="${i}" data-row="${r++}"`);- for (const s of e.subs ?? []) expect(at(s.href, true), s.id).toContain(`data-col="${i}" data-row="${r++}"`);- }- }+ // "All": every tile flows down balanced columns (three, four from lg, five from xl), each group starting with its name.+ expect(html).toContain("columns-3 lg:columns-4 xl:columns-5");+ // One row of names above them: All, then each group with its count (each a button that shows that group alone).+ expect(html).toMatch(/aria-pressed="true"[^>]*>All<span[^>]*>27</);+ for (const [label, n] of [["Film & video", 4], ["Social & shorts", 6], ["Sell & advertise", 5], ["People & fashion", 4], ["Sound", 5], ["Finish & convert", 3]] as const)+ expect(html, label).toMatch(new RegExp(`aria-pressed="false"[^>]*>${label}<span[^>]*>${n}<`));+ // Every link is in the arrow keys' set (their places are set from where the tiles land, in the browser).+ for (const a of anchors(html)) expect(a.tag, a.href).toContain("data-key");expect(studioCount()).toBe(23);});@@ -183,29 +181,28 @@ describe("the launcher's columns", () => {expect(subs("upscale")).toEqual(["Image", "Video", "FPS Boost", "SDR to HDR", "Export"]);expect(subs("audio")).toEqual(["Speech", "Dialogue", "Voice change", "See all 15"]);for (const w of ["Click to Ad", "Ads Studio", "Ad Multiplier", "FPS Boost"]) expect(words(html)).toContain(w);- // Under a hairline, quieter than a row, with no picture and no line of their own (nav-subs.css: 24 px- // names with a mouse, 44 px pills to tap on a touch screen).+ // Small quiet pills under the studio's tile, with no picture and no line of their own.const sub = anchors(html).find((a) => a.tag.includes("data-sub"))!.tag;expect(sub).toContain("text-muted-foreground");- expect(html).toMatch(/<ul[^>]*class="nav-subs /);+ expect(sub).toContain("rounded-full");// A "See all N" says whose.expect(html).toContain('aria-label="See all 15 in Audio"');});- it("labels the groups, and every link has its studio's real cover in a box of fixed size", () => {+ it("names the groups, and every tile has its studio's real cover in a 4:3 box", () => {for (const label of ["Film & video", "Social & shorts", "Sell & advertise", "People & fashion", ">Sound<", "Finish & convert"]) expect(html).toContain(label);for (const c of launcherColumns(undefined)) {for (const e of [c.lead, ...c.rest].filter((x) => x.id !== "ads")) {const cover = covers[e.cover!];expect(cover, e.id).toBeDefined();- // The lead card shows the 320 px copy (and the poster by its srcset); a row the 96 px one.- expect(html).toContain(`src="${(e === c.lead ? cover.thumb : (cover.mini ?? cover.thumb)).replaceAll("&", "&")}"`);+ // Every tile shows the 320 px copy, and the poster by its srcset on a sharp screen.+ expect(html).toContain(`src="${cover.thumb.replaceAll("&", "&")}"`);+ expect(html).toContain(`${cover.poster} 512w`);}- // The lead's 4:3 card picks the poster on sharp screens.- expect(html).toContain(`${covers[c.lead.cover!].poster} 512w`);}- // The six lead cards load as the panel warms; a row's picture when the row shows (lazy). A studio's features have none.- expect(count(html, 'loading="eager"')).toBe(6);+ // The tiles at the top of each of the five columns load as the panel warms; the rest when they show (lazy). A+ // studio's features have no picture.+ expect(count(html, 'loading="eager"')).toBe(15);expect(count(html, 'alt=""')).toBe(27);});@@ -233,17 +230,14 @@ describe("the launcher's columns", () => {expect(render(createElement(LauncherColumns, { kind: undefined, current: "image-to-3d", now: 0 }))).not.toContain("data-active");});- it("hides a row's features on a short window, and hangs them on its name's column", () => {+ it("shows every studio's features under its tile, whatever the window's height (the panel scrolls inside)", () => {const ul = (id: string) => html.match(new RegExp(`<ul[^>]*data-subs="${id}"[^>]*>`))?.[0] ?? "";- // Genjutsu (whose modes wrapped into a line) is Fuobe FX's now.+ // Genjutsu's modes are Fuobe FX's menu's.expect(ul("genjutsu")).toBe("");- expect(ul("image-to-3d")).toContain("[@media(max-height:799.98px)]:hidden");- expect(ul("image-to-3d")).not.toContain("data-subs-line");- // No pad after an odd list (the next row follows 4 px below, as rows do); features under a row are marked to- // start on its name (nav-subs.css), under a lead card on the card's words.- expect(html).not.toContain("data-odd");- expect(ul("image-to-3d")).toContain("data-under");- expect(ul("marketing")).not.toContain("data-under");+ for (const id of ["image-to-3d", "marketing", "upscale", "audio"]) {+ expect(ul(id), id).not.toBe("");+ expect(ul(id), id).not.toContain("max-height");+ }});it("shows New badges only until their date", () => {diff --git a/tests/nav-model.test.ts b/tests/nav-model.test.tsindex 7e130a12..b093de38 100644--- a/tests/nav-model.test.ts+++ b/tests/nav-model.test.ts@@ -354,7 +354,7 @@ describe("nav model: covers", () => {expect(c.poster, id).toMatch(/^\/previews\/[^?]+\.jpg\?v=[0-9a-f]{8}$/);expect(c.thumb, id).toMatch(/^\/previews\/[^?]+\/thumbs\/[^?/]+\.jpg\?v=[0-9a-f]{8}$/);}- // Small enough to pass down from the layout on every page.- expect(JSON.stringify(covers).length).toBeLessThan(12_000);+ // Small enough to pass down from the layout on every page (each with its clip's version: the menus play them).+ expect(JSON.stringify(covers).length).toBeLessThan(14_000);});});