Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Apps, Motions & effects and Canvas menus show everything inside, grouped

Adarsh5b793a9a4be0
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index c70cd96d..a93bb948 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -550,7 +550,7 @@ Liner-inspired look (serif headlines, pill composer) in a top-bar frame. `Studio
- **Composer** pieces: pure logic in `src/lib/composer.ts` (summary, blockers, `onImageChange`, `fitAttachments`, `firstMissingSlot`; since round 4 `blockerLine` for the phone's blocked-Generate line, `framesRequest` and the Frames strip helpers, the start token), `attachments.ts` (`useAttach`, `useUploadReaper`), `settings-panel.tsx`, `model-picker.tsx` (cmdk), `attach-menu.tsx`, `preset-chips.tsx` (lazy), `radio-keys.ts`, `frames-strip.tsx`, and since round 4 part 3 `look-chip.tsx` (lazy: Fuobe Soul's looks, a popover on desktop and a sheet on phones). Since round 4 part 3 the composer sends `engine` for a Fuobe Original, drops a look when the model changes to one without looks, moves to a motion's or effect's Original when one is picked, and follows a move across an engine switch (the pure helpers are in `src/lib/composer.ts`: see Fuobe Originals). Video finishing reads the attached clip's facts from `POST /api/media/probe` for its "24 → 60 fps · 5 s → 10 s" line and its prices. Since round 5 part 1 Edit video does too (`clipFacts`, fixes-5): a clip edit that keeps the clip's length is priced on its seconds, and `clipBlocker` blocks Generate with the reason when the clip is outside the model's window (`clip-windows.ts`; the server refuses the same for an API call that sends no length, after the clip is uploaded to the provider's storage, nothing billed). Lipsync reads the voice's length (`StudioConfig.voiceFacts`) to price talking avatars, and the Image studio prices a look's step after the picture (`postStepCost`, with the face mosaic's models in `extraModels`). The Look chip has a "No look" state (`none`, Storyboard). Since round 5 part 2 a price is read on the browser's day (`useToday` in `src/hooks/use-today.ts`: null on the server and while the page hydrates, so a launch-priced model shows no price until then, and it changes at UTC midnight): the composer's estimate, the model picker (`pickerPrice`) and the Models page (`rowPrice` with `ModelRow.launch`; `GET /api/models` answers the day's `price` and keeps `launch`). The slim studio catalog carries `Pricing.promo` as it is. A run with LoRAs on an endpoint with no published price shows "Price unknown", never free, in the composer and on Canvas nodes. The Image studio's controls chip reads "Options" (`StudioConfig.controlsTitle`), where MOSS-Image's Quality sits.
- **Feed and results**: running tiles show elapsed time and, once progress has moved, time left (`use-now.ts`; `notePace` / `timeLeft` in `src/lib/format.ts`); the newest single result offers next steps (`nextSteps` in `output-actions.ts`); video tiles get a poster (`videoPoster`); ProRes, FFV1 and clips the browser can't decode show as a file card (`VideoFileCard` in `result-media.tsx`). Since round 4 part 2, `useCreateGeneration` (`src/lib/api.ts`) shows a run's `notes` (LoRAs left out, a length the API rounds) as a warning toast. Since round 4 part 3 every studio feed finishes Fuobe Soul pictures (`useSoulFinish`), the viewer's Details show a Look row and a Finish row, and a clip with `meta.grade` offers "Apply the … grade" first.
- **Galleries** get slim cards (`src/lib/preset-cards.ts`) with procedural previews (`preset-preview.tsx`, `move-glyphs.ts`); `previewFor` (`src/lib/preset-card-data.ts`) shows a real cover instead when `src/lib/preset-previews.generated.ts` lists one: a still cover is the card's picture as rendered (no tint, bleed, mirroring or move glyph), a clip cover is its first-frame poster with a muted `<video>` over it only while it plays (invisible until its first frame is ready, released when it stops). Every entry records the run, engine, model and variant that made it. `preset-card-data.ts` is the only module that reads the manifest, and only the server gallery pages and Home's server-only showcase import it, so the manifest never ships in client code: the preset header builds the same preview from the slim covers map (`coverPreview` in `src/lib/preset-covers.ts`) (`tests/preset-covers.test.ts` checks the importers, and checks the real manifest against `public/previews`). Every cover URL the site gives ends in its file's content version (`?v=` and 8 hex digits of its sha256; a poster's also covers its 320 px copy in `thumbs/`, whose URL keeps it), written into the manifests by `eval:covers` and `gen-preset-peaks.mjs` (`--versions` on either hashes the files as they are; the covers' one first makes a poster's 320 px copy that's missing or older than its poster, and encodes nothing else), so a cover made again under its old name gets a new URL. Versioned covers are served as `immutable`, for a year in the browser and a day in the CDN (`s-maxage`, so a revert or rollback that gives an old version back never finds the wrong file pinned there); one asked for without its version keeps a day's cache and a week of background revalidation (`next.config.ts`). Both stay outside the sign-in proxy like `samples/`. The file is written by the evaluation harness's `eval:covers`, from a measured run's promoted renders or, with `--from-masters <dir>`, from rendered masters kept outside the repo (`coversFromMasters()` in `scripts/eval/lib/covers.mjs`; it replaces only the ids it writes, and skips an id whose cover another run made elsewhere unless `--replace`). Stills are 4:2:0 JPEGs of at most 768 px; a clip cover is at most 4 s and 512 px, and its last 6 frames are crossfaded into its first ones so the card's loop has no jump (a clip that already ends where it starts is only cut). The first covers came that way: 480 of the 487 app, motion and effect cards (474 stills from Ideogram 4 and 6 clips from MiniMax H3, all rendered in ComfyUI; run `comfyui-previews-2026-10`, in `public/previews/presets/`), while the other 7 keep their procedural preview. Main's later cover work gave 43 apps a before/after reveal clip (Ideogram 4, then Qwen-Image 2.1 Edit), so 48 of the 480 now have a clip (the other 5 from MiniMax H3) and 432 are stills. `preview-playback.ts` decides which play: a clip card plays by itself while it's mostly in view, once scrolling stops, at most 6 at once (3 on a phone), the cards in full view and nearest the middle of the screen first; a procedural preview does so only where nothing can hover (phones), and the preset header plays whatever moves. Nothing plays by itself with reduced motion (turned on while the page is open, it stops at once), Save-Data, on 2G or in a hidden tab; a hover (after a short rest), keyboard focus, or a tap on the preset header still plays one (with reduced motion, only a clip).
-- **Navigation.** The bar: Create (a menu of the create tools), Studios (the launcher, `nav/studios-launcher.tsx`: every studio grouped by goal on one screen in six columns, Film & video, Social & shorts, Sell & advertise, People & fashion, Sound (Audio with Music, Sound effects, Clean up voice and Translate & dub) and Finish & convert, arrow keys across and down the columns), Apps, Motions & effects, Canvas, Assist, Library, a More menu for what doesn't fit, Search, New creation and the account menu (`nav/account-menu.tsx`; the owner's install status, a visitor's GPU, balance, Settings, the theme and Sign out, moved from the old sidebar's footer in `nav/status-chips.tsx`; Thanks & licences, the owner's Models & licences and the source on GitHub are in Settings → About, `AboutLinks` in `owner-settings.tsx`). Phones: Home, Create, Studios, Library and You tabs; Studios opens a sheet with every studio at once (`nav/studios-sheet.tsx`). Home has a goal row under the hero (`nav/goal-row.tsx`): each goal opens a band of its studios, one-tap presets and finishing tools. Under a finished result a "Keep going with this" row offers 3 to 5 next steps that open the next studio with the result attached (`nav/next-steps.tsx`, `keepGoing` in `src/lib/next-steps.ts`; in the studio feed, the Viewer and the 3D model card), and the account menu and You sheet show how much of Fuobe this browser has explored with a next one to try (`nav/explore-progress.tsx`, `src/lib/nav-explore.ts`, kept in `localStorage` only).
+- **Navigation.** The bar: Create (a menu of the create tools), Studios (the launcher, `nav/mega-launcher.tsx` with its body in `nav/mega-panel.tsx`, the same grouped menu Apps, Motions & effects and Canvas open from their chevrons, each fed by a small file made at build time, `src/lib/mega-menus.server.ts`: every studio grouped by goal on one screen in six columns, Film & video, Social & shorts, Sell & advertise, People & fashion, Sound (Audio with Music, Sound effects, Clean up voice and Translate & dub) and Finish & convert, arrow keys across and down the columns), Apps, Motions & effects, Canvas, Assist, Library, a More menu for what doesn't fit, Search, New creation and the account menu (`nav/account-menu.tsx`; the owner's install status, a visitor's GPU, balance, Settings, the theme and Sign out, moved from the old sidebar's footer in `nav/status-chips.tsx`; Thanks & licences, the owner's Models & licences and the source on GitHub are in Settings → About, `AboutLinks` in `owner-settings.tsx`). Phones: Home, Create, Studios, Library and You tabs; Studios opens a sheet with every studio at once (`nav/studios-sheet.tsx`). Home has a goal row under the hero (`nav/goal-row.tsx`): each goal opens a band of its studios, one-tap presets and finishing tools. Under a finished result a "Keep going with this" row offers 3 to 5 next steps that open the next studio with the result attached (`nav/next-steps.tsx`, `keepGoing` in `src/lib/next-steps.ts`; in the studio feed, the Viewer and the 3D model card), and the account menu and You sheet show how much of Fuobe this browser has explored with a next one to try (`nav/explore-progress.tsx`, `src/lib/nav-explore.ts`, kept in `localStorage` only).
- **Models page** (round 4 part 3; the page itself is gone, the rows still feed the model picker): `ModelRow.engines` (`src/lib/model-rows.ts`) puts an Original under both the Cloud and Open source filters, with both engine icons, "Open source + cloud" (`enginesLabel`) and a "Free · $… / megapixel" price. Since round 4 part 4 models switched off leave the list (`models-table.tsx`), which says how many and links to Settings → Models & licences.
- **Sharing** (round 4 part 4): the studio layout (`src/app/(studio)/layout.tsx`) wraps every page in `ShareProvider`, so any result menu can open the Share dialog; the Library gains the Shared tab and Publish in its selection bar, whose phone version folds Like, Pin and Review into a ⋯ menu (see Share links). The public share page lives outside the `(studio)` group, without the studio's frame.
- Stand-alone views: color grading (`color-grade-view.tsx`, `src/lib/grade.ts`; since round 4 part 3 Invert and Solarize sliders, the Soul and DoP grade presets, and `?preset=` to open with a grade picked), storyboard, elements + train dialog (since round 4 part 4 `train-dialog.tsx`: the photo rules and tips, the consent tick for characters, the options by family with where each runs, price, time estimate and licence, Train / Retrain / Upgrade, the demo note, "Train anywhere" with the training kit and attaching a LoRA; element cards show a Soul ID, Training, Retrain or Demo badge; `moodboards/train-board.tsx` for "Train as a look…"), library (`library-view.tsx` + `components/library/*`), Assist, and the studios above.
diff --git a/docs/public-signup.md b/docs/public-signup.md
index 0eebe413..487e5717 100644
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@ -24,7 +24,9 @@ Turning it off signs out every account at once, and guests are sent to sign in a
A guest can open every page: galleries, presets, the studios, Layers, Cinema, Image to 3D and
Settings, read-only. The pages get the catalog and status reads they need (`/api/status`,
`/api/models`, `/api/search-index`, `/api/comfyui`, `/api/settings/models`, curated moodboards,
-built-in skills). The owner's library stays private: the lists come back empty, and other reads of
+built-in skills), and the bar's menus read `/nav-menus/apps`, `/nav-menus/motions` and
+`/nav-menus/canvas`: static files made at build time that hold what a visitor may see only (no model
+names, no template without a real cover). The owner's library stays private: the lists come back empty, and other reads of
it (files, uploads, projects, settings values, tokens) answer 401 "Sign up to see your library".
Every change a guest sends (generate, upload, save a setting, create a project…) answers 401. The
diff --git a/package.json b/package.json
index 95f08d4f..39b56adf 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"test:e2e:first-paint": "node tests/e2e/home-first-paint.mjs",
"test:e2e:mobile": "node tests/e2e/no-horizontal-scroll.mjs",
"test:e2e:shell": "node tests/e2e/shell.mjs",
+ "test:e2e:mega-menus": "node tests/e2e/mega-menus.mjs",
"test:e2e:tabs": "node tests/e2e/instant-tabs.mjs",
"test:e2e:tab-rows": "node tests/e2e/tab-rows.mjs",
"gen:catalog": "python3 scripts/gen-cloud-models.py && python3 scripts/gen-studio-packs.py && python3 scripts/gen-oss-loras.py && python3 scripts/gen-lora-library.py && python3 scripts/gen-influencer-options.py && python3 scripts/gen-soul-originals.py && python3 scripts/gen-trainers.py && node scripts/gen-icon-map.mjs",
diff --git a/public/previews/presets/mini/app-3d-figure.jpg b/public/previews/presets/mini/app-3d-figure.jpg
new file mode 100644
index 00000000..3d6242d3
Binary files /dev/null and b/public/previews/presets/mini/app-3d-figure.jpg differ
diff --git a/public/previews/presets/mini/app-3d-render.jpg b/public/previews/presets/mini/app-3d-render.jpg
new file mode 100644
index 00000000..38fd60ab
Binary files /dev/null and b/public/previews/presets/mini/app-3d-render.jpg differ
diff --git a/public/previews/presets/mini/app-3d-rotation.jpg b/public/previews/presets/mini/app-3d-rotation.jpg
new file mode 100644
index 00000000..8200b686
Binary files /dev/null and b/public/previews/presets/mini/app-3d-rotation.jpg differ
diff --git a/public/previews/presets/mini/app-60s-cafe.jpg b/public/previews/presets/mini/app-60s-cafe.jpg
new file mode 100644
index 00000000..a1224206
Binary files /dev/null and b/public/previews/presets/mini/app-60s-cafe.jpg differ
diff --git a/public/previews/presets/mini/app-ad-creative.jpg b/public/previews/presets/mini/app-ad-creative.jpg
new file mode 100644
index 00000000..4601857f
Binary files /dev/null and b/public/previews/presets/mini/app-ad-creative.jpg differ
diff --git a/public/previews/presets/mini/app-age-shift.jpg b/public/previews/presets/mini/app-age-shift.jpg
new file mode 100644
index 00000000..39df40d7
Binary files /dev/null and b/public/previews/presets/mini/app-age-shift.jpg differ
diff --git a/public/previews/presets/mini/app-ai-influencer.jpg b/public/previews/presets/mini/app-ai-influencer.jpg
new file mode 100644
index 00000000..304dc50d
Binary files /dev/null and b/public/previews/presets/mini/app-ai-influencer.jpg differ
diff --git a/public/previews/presets/mini/app-ai-stylist.jpg b/public/previews/presets/mini/app-ai-stylist.jpg
new file mode 100644
index 00000000..0bacf650
Binary files /dev/null and b/public/previews/presets/mini/app-ai-stylist.jpg differ
diff --git a/public/previews/presets/mini/app-angles.jpg b/public/previews/presets/mini/app-angles.jpg
new file mode 100644
index 00000000..be6e0652
Binary files /dev/null and b/public/previews/presets/mini/app-angles.jpg differ
diff --git a/public/previews/presets/mini/app-any-angle.jpg b/public/previews/presets/mini/app-any-angle.jpg
new file mode 100644
index 00000000..c30af982
Binary files /dev/null and b/public/previews/presets/mini/app-any-angle.jpg differ
diff --git a/public/previews/presets/mini/app-asmr-add-on.jpg b/public/previews/presets/mini/app-asmr-add-on.jpg
new file mode 100644
index 00000000..a3fd185a
Binary files /dev/null and b/public/previews/presets/mini/app-asmr-add-on.jpg differ
diff --git a/public/previews/presets/mini/app-asmr-classic.jpg b/public/previews/presets/mini/app-asmr-classic.jpg
new file mode 100644
index 00000000..3b4f74f4
Binary files /dev/null and b/public/previews/presets/mini/app-asmr-classic.jpg differ
diff --git a/public/previews/presets/mini/app-asmr-host.jpg b/public/previews/presets/mini/app-asmr-host.jpg
new file mode 100644
index 00000000..203945d8
Binary files /dev/null and b/public/previews/presets/mini/app-asmr-host.jpg differ
diff --git a/public/previews/presets/mini/app-asmr-promo.jpg b/public/previews/presets/mini/app-asmr-promo.jpg
new file mode 100644
index 00000000..3da8f461
Binary files /dev/null and b/public/previews/presets/mini/app-asmr-promo.jpg differ
diff --git a/public/previews/presets/mini/app-banana-eating.jpg b/public/previews/presets/mini/app-banana-eating.jpg
new file mode 100644
index 00000000..71a7c86a
Binary files /dev/null and b/public/previews/presets/mini/app-banana-eating.jpg differ
diff --git a/public/previews/presets/mini/app-behind-the-scenes.jpg b/public/previews/presets/mini/app-behind-the-scenes.jpg
new file mode 100644
index 00000000..5fe1669c
Binary files /dev/null and b/public/previews/presets/mini/app-behind-the-scenes.jpg differ
diff --git a/public/previews/presets/mini/app-billboard-ad.jpg b/public/previews/presets/mini/app-billboard-ad.jpg
new file mode 100644
index 00000000..a2437a73
Binary files /dev/null and b/public/previews/presets/mini/app-billboard-ad.jpg differ
diff --git a/public/previews/presets/mini/app-breakdown.jpg b/public/previews/presets/mini/app-breakdown.jpg
new file mode 100644
index 00000000..4edd59fb
Binary files /dev/null and b/public/previews/presets/mini/app-breakdown.jpg differ
diff --git a/public/previews/presets/mini/app-brick-cube.jpg b/public/previews/presets/mini/app-brick-cube.jpg
new file mode 100644
index 00000000..44ca6ada
Binary files /dev/null and b/public/previews/presets/mini/app-brick-cube.jpg differ
diff --git a/public/previews/presets/mini/app-bring-to-life.jpg b/public/previews/presets/mini/app-bring-to-life.jpg
new file mode 100644
index 00000000..1d693168
Binary files /dev/null and b/public/previews/presets/mini/app-bring-to-life.jpg differ
diff --git a/public/previews/presets/mini/app-bullet-time-scene.jpg b/public/previews/presets/mini/app-bullet-time-scene.jpg
new file mode 100644
index 00000000..f729658e
Binary files /dev/null and b/public/previews/presets/mini/app-bullet-time-scene.jpg differ
diff --git a/public/previews/presets/mini/app-bullet-time-splash.jpg b/public/previews/presets/mini/app-bullet-time-splash.jpg
new file mode 100644
index 00000000..cd11ae87
Binary files /dev/null and b/public/previews/presets/mini/app-bullet-time-splash.jpg differ
diff --git a/public/previews/presets/mini/app-bullet-time-white.jpg b/public/previews/presets/mini/app-bullet-time-white.jpg
new file mode 100644
index 00000000..c88b55de
Binary files /dev/null and b/public/previews/presets/mini/app-bullet-time-white.jpg differ
diff --git a/public/previews/presets/mini/app-burning-sunset.jpg b/public/previews/presets/mini/app-burning-sunset.jpg
new file mode 100644
index 00000000..656d3c47
Binary files /dev/null and b/public/previews/presets/mini/app-burning-sunset.jpg differ
diff --git a/public/previews/presets/mini/app-chameleon.jpg b/public/previews/presets/mini/app-chameleon.jpg
new file mode 100644
index 00000000..3516ff1b
Binary files /dev/null and b/public/previews/presets/mini/app-chameleon.jpg differ
diff --git a/public/previews/presets/mini/app-change-background.jpg b/public/previews/presets/mini/app-change-background.jpg
new file mode 100644
index 00000000..8d6763e1
Binary files /dev/null and b/public/previews/presets/mini/app-change-background.jpg differ
diff --git a/public/previews/presets/mini/app-character-swap.jpg b/public/previews/presets/mini/app-character-swap.jpg
new file mode 100644
index 00000000..22c1b00e
Binary files /dev/null and b/public/previews/presets/mini/app-character-swap.jpg differ
diff --git a/public/previews/presets/mini/app-clean-up-voice.jpg b/public/previews/presets/mini/app-clean-up-voice.jpg
new file mode 100644
index 00000000..0d03b82f
Binary files /dev/null and b/public/previews/presets/mini/app-clean-up-voice.jpg differ
diff --git a/public/previews/presets/mini/app-click-to-ad.jpg b/public/previews/presets/mini/app-click-to-ad.jpg
new file mode 100644
index 00000000..88e8cb35
Binary files /dev/null and b/public/previews/presets/mini/app-click-to-ad.jpg differ
diff --git a/public/previews/presets/mini/app-clipcut.jpg b/public/previews/presets/mini/app-clipcut.jpg
new file mode 100644
index 00000000..20fe0209
Binary files /dev/null and b/public/previews/presets/mini/app-clipcut.jpg differ
diff --git a/public/previews/presets/mini/app-cloud-surf.jpg b/public/previews/presets/mini/app-cloud-surf.jpg
new file mode 100644
index 00000000..5ca56395
Binary files /dev/null and b/public/previews/presets/mini/app-cloud-surf.jpg differ
diff --git a/public/previews/presets/mini/app-color-grading.jpg b/public/previews/presets/mini/app-color-grading.jpg
new file mode 100644
index 00000000..d58761db
Binary files /dev/null and b/public/previews/presets/mini/app-color-grading.jpg differ
diff --git a/public/previews/presets/mini/app-colorize.jpg b/public/previews/presets/mini/app-colorize.jpg
new file mode 100644
index 00000000..4e32e1d3
Binary files /dev/null and b/public/previews/presets/mini/app-colorize.jpg differ
diff --git a/public/previews/presets/mini/app-comic-book.jpg b/public/previews/presets/mini/app-comic-book.jpg
new file mode 100644
index 00000000..2a0c2987
Binary files /dev/null and b/public/previews/presets/mini/app-comic-book.jpg differ
diff --git a/public/previews/presets/mini/app-commercial-faces.jpg b/public/previews/presets/mini/app-commercial-faces.jpg
new file mode 100644
index 00000000..bc930a8b
Binary files /dev/null and b/public/previews/presets/mini/app-commercial-faces.jpg differ
diff --git a/public/previews/presets/mini/app-dance.jpg b/public/previews/presets/mini/app-dance.jpg
new file mode 100644
index 00000000..a90db746
Binary files /dev/null and b/public/previews/presets/mini/app-dance.jpg differ
diff --git a/public/previews/presets/mini/app-expand-image.jpg b/public/previews/presets/mini/app-expand-image.jpg
new file mode 100644
index 00000000..12b4956f
Binary files /dev/null and b/public/previews/presets/mini/app-expand-image.jpg differ
diff --git a/public/previews/presets/mini/app-expression-edit.jpg b/public/previews/presets/mini/app-expression-edit.jpg
new file mode 100644
index 00000000..bcdd6564
Binary files /dev/null and b/public/previews/presets/mini/app-expression-edit.jpg differ
diff --git a/public/previews/presets/mini/app-face-swap.jpg b/public/previews/presets/mini/app-face-swap.jpg
new file mode 100644
index 00000000..1cb1e6f9
Binary files /dev/null and b/public/previews/presets/mini/app-face-swap.jpg differ
diff --git a/public/previews/presets/mini/app-figurine.jpg b/public/previews/presets/mini/app-figurine.jpg
new file mode 100644
index 00000000..8bd625ff
Binary files /dev/null and b/public/previews/presets/mini/app-figurine.jpg differ
diff --git a/public/previews/presets/mini/app-fridge-ad.jpg b/public/previews/presets/mini/app-fridge-ad.jpg
new file mode 100644
index 00000000..3ecaa8b7
Binary files /dev/null and b/public/previews/presets/mini/app-fridge-ad.jpg differ
diff --git a/public/previews/presets/mini/app-fuobe-angles.jpg b/public/previews/presets/mini/app-fuobe-angles.jpg
new file mode 100644
index 00000000..2b571983
Binary files /dev/null and b/public/previews/presets/mini/app-fuobe-angles.jpg differ
diff --git a/public/previews/presets/mini/app-game-dump.jpg b/public/previews/presets/mini/app-game-dump.jpg
new file mode 100644
index 00000000..9c6d1fd0
Binary files /dev/null and b/public/previews/presets/mini/app-game-dump.jpg differ
diff --git a/public/previews/presets/mini/app-ghoulgao.jpg b/public/previews/presets/mini/app-ghoulgao.jpg
new file mode 100644
index 00000000..460f07d1
Binary files /dev/null and b/public/previews/presets/mini/app-ghoulgao.jpg differ
diff --git a/public/previews/presets/mini/app-giallo-horror.jpg b/public/previews/presets/mini/app-giallo-horror.jpg
new file mode 100644
index 00000000..60af908e
Binary files /dev/null and b/public/previews/presets/mini/app-giallo-horror.jpg differ
diff --git a/public/previews/presets/mini/app-giant-product.jpg b/public/previews/presets/mini/app-giant-product.jpg
new file mode 100644
index 00000000..a07e1a40
Binary files /dev/null and b/public/previews/presets/mini/app-giant-product.jpg differ
diff --git a/public/previews/presets/mini/app-glitter-sticker.jpg b/public/previews/presets/mini/app-glitter-sticker.jpg
new file mode 100644
index 00000000..d4fa0638
Binary files /dev/null and b/public/previews/presets/mini/app-glitter-sticker.jpg differ
diff --git a/public/previews/presets/mini/app-graffiti-ad.jpg b/public/previews/presets/mini/app-graffiti-ad.jpg
new file mode 100644
index 00000000..319d6786
Binary files /dev/null and b/public/previews/presets/mini/app-graffiti-ad.jpg differ
diff --git a/public/previews/presets/mini/app-gtai.jpg b/public/previews/presets/mini/app-gtai.jpg
new file mode 100644
index 00000000..9ab3bec7
Binary files /dev/null and b/public/previews/presets/mini/app-gtai.jpg differ
diff --git a/public/previews/presets/mini/app-hairstyle-try-on.jpg b/public/previews/presets/mini/app-hairstyle-try-on.jpg
new file mode 100644
index 00000000..9f1c04f0
Binary files /dev/null and b/public/previews/presets/mini/app-hairstyle-try-on.jpg differ
diff --git a/public/previews/presets/mini/app-head-swap.jpg b/public/previews/presets/mini/app-head-swap.jpg
new file mode 100644
index 00000000..944d6bdc
Binary files /dev/null and b/public/previews/presets/mini/app-head-swap.jpg differ
diff --git a/public/previews/presets/mini/app-headshot-generator.jpg b/public/previews/presets/mini/app-headshot-generator.jpg
new file mode 100644
index 00000000..feb45c58
Binary files /dev/null and b/public/previews/presets/mini/app-headshot-generator.jpg differ
diff --git a/public/previews/presets/mini/app-hook-frame.jpg b/public/previews/presets/mini/app-hook-frame.jpg
new file mode 100644
index 00000000..b9358a4c
Binary files /dev/null and b/public/previews/presets/mini/app-hook-frame.jpg differ
diff --git a/public/previews/presets/mini/app-hug.jpg b/public/previews/presets/mini/app-hug.jpg
new file mode 100644
index 00000000..392554a4
Binary files /dev/null and b/public/previews/presets/mini/app-hug.jpg differ
diff --git a/public/previews/presets/mini/app-idol.jpg b/public/previews/presets/mini/app-idol.jpg
new file mode 100644
index 00000000..3891b4f7
Binary files /dev/null and b/public/previews/presets/mini/app-idol.jpg differ
diff --git a/public/previews/presets/mini/app-image-to-3d.jpg b/public/previews/presets/mini/app-image-to-3d.jpg
new file mode 100644
index 00000000..d60839dc
Binary files /dev/null and b/public/previews/presets/mini/app-image-to-3d.jpg differ
diff --git a/public/previews/presets/mini/app-j-magazine.jpg b/public/previews/presets/mini/app-j-magazine.jpg
new file mode 100644
index 00000000..df33537b
Binary files /dev/null and b/public/previews/presets/mini/app-j-magazine.jpg differ
diff --git a/public/previews/presets/mini/app-j-poster.jpg b/public/previews/presets/mini/app-j-poster.jpg
new file mode 100644
index 00000000..ac8e9be6
Binary files /dev/null and b/public/previews/presets/mini/app-j-poster.jpg differ
diff --git a/public/previews/presets/mini/app-japanese-show.jpg b/public/previews/presets/mini/app-japanese-show.jpg
new file mode 100644
index 00000000..bf92b122
Binary files /dev/null and b/public/previews/presets/mini/app-japanese-show.jpg differ
diff --git a/public/previews/presets/mini/app-kick-ad.jpg b/public/previews/presets/mini/app-kick-ad.jpg
new file mode 100644
index 00000000..ec5ecd46
Binary files /dev/null and b/public/previews/presets/mini/app-kick-ad.jpg differ
diff --git a/public/previews/presets/mini/app-latex.jpg b/public/previews/presets/mini/app-latex.jpg
new file mode 100644
index 00000000..84601a70
Binary files /dev/null and b/public/previews/presets/mini/app-latex.jpg differ
diff --git a/public/previews/presets/mini/app-link-to-video-ad.jpg b/public/previews/presets/mini/app-link-to-video-ad.jpg
new file mode 100644
index 00000000..371c62be
Binary files /dev/null and b/public/previews/presets/mini/app-link-to-video-ad.jpg differ
diff --git a/public/previews/presets/mini/app-macro-scene.jpg b/public/previews/presets/mini/app-macro-scene.jpg
new file mode 100644
index 00000000..f93b1067
Binary files /dev/null and b/public/previews/presets/mini/app-macro-scene.jpg differ
diff --git a/public/previews/presets/mini/app-macroshot-product.jpg b/public/previews/presets/mini/app-macroshot-product.jpg
new file mode 100644
index 00000000..7b16e92d
Binary files /dev/null and b/public/previews/presets/mini/app-macroshot-product.jpg differ
diff --git a/public/previews/presets/mini/app-magic-button.jpg b/public/previews/presets/mini/app-magic-button.jpg
new file mode 100644
index 00000000..b373c5df
Binary files /dev/null and b/public/previews/presets/mini/app-magic-button.jpg differ
diff --git a/public/previews/presets/mini/app-makeup-studio.jpg b/public/previews/presets/mini/app-makeup-studio.jpg
new file mode 100644
index 00000000..2afd0666
Binary files /dev/null and b/public/previews/presets/mini/app-makeup-studio.jpg differ
diff --git a/public/previews/presets/mini/app-mascot.jpg b/public/previews/presets/mini/app-mascot.jpg
new file mode 100644
index 00000000..eb74701d
Binary files /dev/null and b/public/previews/presets/mini/app-mascot.jpg differ
diff --git a/public/previews/presets/mini/app-match-colors.jpg b/public/previews/presets/mini/app-match-colors.jpg
new file mode 100644
index 00000000..01603556
Binary files /dev/null and b/public/previews/presets/mini/app-match-colors.jpg differ
diff --git a/public/previews/presets/mini/app-match-lighting.jpg b/public/previews/presets/mini/app-match-lighting.jpg
new file mode 100644
index 00000000..47545ae7
Binary files /dev/null and b/public/previews/presets/mini/app-match-lighting.jpg differ
diff --git a/public/previews/presets/mini/app-melting-doodle.jpg b/public/previews/presets/mini/app-melting-doodle.jpg
new file mode 100644
index 00000000..0531a1a1
Binary files /dev/null and b/public/previews/presets/mini/app-melting-doodle.jpg differ
diff --git a/public/previews/presets/mini/app-meme-generator.jpg b/public/previews/presets/mini/app-meme-generator.jpg
new file mode 100644
index 00000000..6d24f967
Binary files /dev/null and b/public/previews/presets/mini/app-meme-generator.jpg differ
diff --git a/public/previews/presets/mini/app-micro-beasts.jpg b/public/previews/presets/mini/app-micro-beasts.jpg
new file mode 100644
index 00000000..bf0c7be9
Binary files /dev/null and b/public/previews/presets/mini/app-micro-beasts.jpg differ
diff --git a/public/previews/presets/mini/app-mugshot.jpg b/public/previews/presets/mini/app-mugshot.jpg
new file mode 100644
index 00000000..47d01bf8
Binary files /dev/null and b/public/previews/presets/mini/app-mugshot.jpg differ
diff --git a/public/previews/presets/mini/app-mukbang.jpg b/public/previews/presets/mini/app-mukbang.jpg
new file mode 100644
index 00000000..f4bfb39f
Binary files /dev/null and b/public/previews/presets/mini/app-mukbang.jpg differ
diff --git a/public/previews/presets/mini/app-nano-strike.jpg b/public/previews/presets/mini/app-nano-strike.jpg
new file mode 100644
index 00000000..29b73820
Binary files /dev/null and b/public/previews/presets/mini/app-nano-strike.jpg differ
diff --git a/public/previews/presets/mini/app-nano-theft.jpg b/public/previews/presets/mini/app-nano-theft.jpg
new file mode 100644
index 00000000..94471992
Binary files /dev/null and b/public/previews/presets/mini/app-nano-theft.jpg differ
diff --git a/public/previews/presets/mini/app-object-remover.jpg b/public/previews/presets/mini/app-object-remover.jpg
new file mode 100644
index 00000000..f4b4a3f3
Binary files /dev/null and b/public/previews/presets/mini/app-object-remover.jpg differ
diff --git a/public/previews/presets/mini/app-outfit-shot.jpg b/public/previews/presets/mini/app-outfit-shot.jpg
new file mode 100644
index 00000000..edf50141
Binary files /dev/null and b/public/previews/presets/mini/app-outfit-shot.jpg differ
diff --git a/public/previews/presets/mini/app-outfit-swap.jpg b/public/previews/presets/mini/app-outfit-swap.jpg
new file mode 100644
index 00000000..e65c7cc6
Binary files /dev/null and b/public/previews/presets/mini/app-outfit-swap.jpg differ
diff --git a/public/previews/presets/mini/app-outfit-vending.jpg b/public/previews/presets/mini/app-outfit-vending.jpg
new file mode 100644
index 00000000..6e465ed4
Binary files /dev/null and b/public/previews/presets/mini/app-outfit-vending.jpg differ
diff --git a/public/previews/presets/mini/app-packshot.jpg b/public/previews/presets/mini/app-packshot.jpg
new file mode 100644
index 00000000..4d24e626
Binary files /dev/null and b/public/previews/presets/mini/app-packshot.jpg differ
diff --git a/public/previews/presets/mini/app-paint-app.jpg b/public/previews/presets/mini/app-paint-app.jpg
new file mode 100644
index 00000000..b3061fc1
Binary files /dev/null and b/public/previews/presets/mini/app-paint-app.jpg differ
diff --git a/public/previews/presets/mini/app-photo-to-3d.jpg b/public/previews/presets/mini/app-photo-to-3d.jpg
new file mode 100644
index 00000000..2db4121a
Binary files /dev/null and b/public/previews/presets/mini/app-photo-to-3d.jpg differ
diff --git a/public/previews/presets/mini/app-pixel-game.jpg b/public/previews/presets/mini/app-pixel-game.jpg
new file mode 100644
index 00000000..63724adc
Binary files /dev/null and b/public/previews/presets/mini/app-pixel-game.jpg differ
diff --git a/public/previews/presets/mini/app-plushies.jpg b/public/previews/presets/mini/app-plushies.jpg
new file mode 100644
index 00000000..14c3bdc1
Binary files /dev/null and b/public/previews/presets/mini/app-plushies.jpg differ
diff --git a/public/previews/presets/mini/app-poster.jpg b/public/previews/presets/mini/app-poster.jpg
new file mode 100644
index 00000000..62bb623e
Binary files /dev/null and b/public/previews/presets/mini/app-poster.jpg differ
diff --git a/public/previews/presets/mini/app-product-360.jpg b/public/previews/presets/mini/app-product-360.jpg
new file mode 100644
index 00000000..d90aa283
Binary files /dev/null and b/public/previews/presets/mini/app-product-360.jpg differ
diff --git a/public/previews/presets/mini/app-product-placement.jpg b/public/previews/presets/mini/app-product-placement.jpg
new file mode 100644
index 00000000..05289349
Binary files /dev/null and b/public/previews/presets/mini/app-product-placement.jpg differ
diff --git a/public/previews/presets/mini/app-product-shot.jpg b/public/previews/presets/mini/app-product-shot.jpg
new file mode 100644
index 00000000..f3281638
Binary files /dev/null and b/public/previews/presets/mini/app-product-shot.jpg differ
diff --git a/public/previews/presets/mini/app-rap-god.jpg b/public/previews/presets/mini/app-rap-god.jpg
new file mode 100644
index 00000000..95462b7a
Binary files /dev/null and b/public/previews/presets/mini/app-rap-god.jpg differ
diff --git a/public/previews/presets/mini/app-recast.jpg b/public/previews/presets/mini/app-recast.jpg
new file mode 100644
index 00000000..ceeb8542
Binary files /dev/null and b/public/previews/presets/mini/app-recast.jpg differ
diff --git a/public/previews/presets/mini/app-relight.jpg b/public/previews/presets/mini/app-relight.jpg
new file mode 100644
index 00000000..cf45d379
Binary files /dev/null and b/public/previews/presets/mini/app-relight.jpg differ
diff --git a/public/previews/presets/mini/app-remove-background.jpg b/public/previews/presets/mini/app-remove-background.jpg
new file mode 100644
index 00000000..bd592089
Binary files /dev/null and b/public/previews/presets/mini/app-remove-background.jpg differ
diff --git a/public/previews/presets/mini/app-renaissance.jpg b/public/previews/presets/mini/app-renaissance.jpg
new file mode 100644
index 00000000..09483638
Binary files /dev/null and b/public/previews/presets/mini/app-renaissance.jpg differ
diff --git a/public/previews/presets/mini/app-restore-photo.jpg b/public/previews/presets/mini/app-restore-photo.jpg
new file mode 100644
index 00000000..6eb97a11
Binary files /dev/null and b/public/previews/presets/mini/app-restore-photo.jpg differ
diff --git a/public/previews/presets/mini/app-roller-coaster.jpg b/public/previews/presets/mini/app-roller-coaster.jpg
new file mode 100644
index 00000000..87f564e2
Binary files /dev/null and b/public/previews/presets/mini/app-roller-coaster.jpg differ
diff --git a/public/previews/presets/mini/app-sand-worm.jpg b/public/previews/presets/mini/app-sand-worm.jpg
new file mode 100644
index 00000000..fcb487c9
Binary files /dev/null and b/public/previews/presets/mini/app-sand-worm.jpg differ
diff --git a/public/previews/presets/mini/app-shots.jpg b/public/previews/presets/mini/app-shots.jpg
new file mode 100644
index 00000000..acb9f5c9
Binary files /dev/null and b/public/previews/presets/mini/app-shots.jpg differ
diff --git a/public/previews/presets/mini/app-signboard.jpg b/public/previews/presets/mini/app-signboard.jpg
new file mode 100644
index 00000000..306241c8
Binary files /dev/null and b/public/previews/presets/mini/app-signboard.jpg differ
diff --git a/public/previews/presets/mini/app-similarity-score.jpg b/public/previews/presets/mini/app-similarity-score.jpg
new file mode 100644
index 00000000..ac5899e7
Binary files /dev/null and b/public/previews/presets/mini/app-similarity-score.jpg differ
diff --git a/public/previews/presets/mini/app-simlife.jpg b/public/previews/presets/mini/app-simlife.jpg
new file mode 100644
index 00000000..f506e73d
Binary files /dev/null and b/public/previews/presets/mini/app-simlife.jpg differ
diff --git a/public/previews/presets/mini/app-sketch-to-real.jpg b/public/previews/presets/mini/app-sketch-to-real.jpg
new file mode 100644
index 00000000..8bc4fccd
Binary files /dev/null and b/public/previews/presets/mini/app-sketch-to-real.jpg differ
diff --git a/public/previews/presets/mini/app-skibidi.jpg b/public/previews/presets/mini/app-skibidi.jpg
new file mode 100644
index 00000000..ab1a1903
Binary files /dev/null and b/public/previews/presets/mini/app-skibidi.jpg differ
diff --git a/public/previews/presets/mini/app-skin-enhancer.jpg b/public/previews/presets/mini/app-skin-enhancer.jpg
new file mode 100644
index 00000000..d9d2eaf0
Binary files /dev/null and b/public/previews/presets/mini/app-skin-enhancer.jpg differ
diff --git a/public/previews/presets/mini/app-social-media-icon.jpg b/public/previews/presets/mini/app-social-media-icon.jpg
new file mode 100644
index 00000000..4d138912
Binary files /dev/null and b/public/previews/presets/mini/app-social-media-icon.jpg differ
diff --git a/public/previews/presets/mini/app-steal-the-look.jpg b/public/previews/presets/mini/app-steal-the-look.jpg
new file mode 100644
index 00000000..14d5ce6f
Binary files /dev/null and b/public/previews/presets/mini/app-steal-the-look.jpg differ
diff --git a/public/previews/presets/mini/app-steam-it.jpg b/public/previews/presets/mini/app-steam-it.jpg
new file mode 100644
index 00000000..1f8f3034
Binary files /dev/null and b/public/previews/presets/mini/app-steam-it.jpg differ
diff --git a/public/previews/presets/mini/app-sticker-match-cut.jpg b/public/previews/presets/mini/app-sticker-match-cut.jpg
new file mode 100644
index 00000000..a7a4cb45
Binary files /dev/null and b/public/previews/presets/mini/app-sticker-match-cut.jpg differ
diff --git a/public/previews/presets/mini/app-sticker-pack.jpg b/public/previews/presets/mini/app-sticker-pack.jpg
new file mode 100644
index 00000000..0613568e
Binary files /dev/null and b/public/previews/presets/mini/app-sticker-pack.jpg differ
diff --git a/public/previews/presets/mini/app-storm-creature.jpg b/public/previews/presets/mini/app-storm-creature.jpg
new file mode 100644
index 00000000..80241863
Binary files /dev/null and b/public/previews/presets/mini/app-storm-creature.jpg differ
diff --git a/public/previews/presets/mini/app-style-snap.jpg b/public/previews/presets/mini/app-style-snap.jpg
new file mode 100644
index 00000000..2256daf5
Binary files /dev/null and b/public/previews/presets/mini/app-style-snap.jpg differ
diff --git a/public/previews/presets/mini/app-style-transfer.jpg b/public/previews/presets/mini/app-style-transfer.jpg
new file mode 100644
index 00000000..ee6ac9fa
Binary files /dev/null and b/public/previews/presets/mini/app-style-transfer.jpg differ
diff --git a/public/previews/presets/mini/app-talking-photo.jpg b/public/previews/presets/mini/app-talking-photo.jpg
new file mode 100644
index 00000000..5e0fb439
Binary files /dev/null and b/public/previews/presets/mini/app-talking-photo.jpg differ
diff --git a/public/previews/presets/mini/app-tap-to-recolor.jpg b/public/previews/presets/mini/app-tap-to-recolor.jpg
new file mode 100644
index 00000000..702e5c36
Binary files /dev/null and b/public/previews/presets/mini/app-tap-to-recolor.jpg differ
diff --git a/public/previews/presets/mini/app-text-edit.jpg b/public/previews/presets/mini/app-text-edit.jpg
new file mode 100644
index 00000000..9799e5ca
Binary files /dev/null and b/public/previews/presets/mini/app-text-edit.jpg differ
diff --git a/public/previews/presets/mini/app-this-is-fine.jpg b/public/previews/presets/mini/app-this-is-fine.jpg
new file mode 100644
index 00000000..e17fa904
Binary files /dev/null and b/public/previews/presets/mini/app-this-is-fine.jpg differ
diff --git a/public/previews/presets/mini/app-transitions.jpg b/public/previews/presets/mini/app-transitions.jpg
new file mode 100644
index 00000000..329c4b5d
Binary files /dev/null and b/public/previews/presets/mini/app-transitions.jpg differ
diff --git a/public/previews/presets/mini/app-truck-ad.jpg b/public/previews/presets/mini/app-truck-ad.jpg
new file mode 100644
index 00000000..d43ed9c6
Binary files /dev/null and b/public/previews/presets/mini/app-truck-ad.jpg differ
diff --git a/public/previews/presets/mini/app-unboxing-video.jpg b/public/previews/presets/mini/app-unboxing-video.jpg
new file mode 100644
index 00000000..261c28dc
Binary files /dev/null and b/public/previews/presets/mini/app-unboxing-video.jpg differ
diff --git a/public/previews/presets/mini/app-upscale.jpg b/public/previews/presets/mini/app-upscale.jpg
new file mode 100644
index 00000000..bf1b4388
Binary files /dev/null and b/public/previews/presets/mini/app-upscale.jpg differ
diff --git a/public/previews/presets/mini/app-urban-cuts.jpg b/public/previews/presets/mini/app-urban-cuts.jpg
new file mode 100644
index 00000000..94baff33
Binary files /dev/null and b/public/previews/presets/mini/app-urban-cuts.jpg differ
diff --git a/public/previews/presets/mini/app-vectorize.jpg b/public/previews/presets/mini/app-vectorize.jpg
new file mode 100644
index 00000000..0658abf7
Binary files /dev/null and b/public/previews/presets/mini/app-vectorize.jpg differ
diff --git a/public/previews/presets/mini/app-victory-card.jpg b/public/previews/presets/mini/app-victory-card.jpg
new file mode 100644
index 00000000..2097ffff
Binary files /dev/null and b/public/previews/presets/mini/app-victory-card.jpg differ
diff --git a/public/previews/presets/mini/app-video-background-remover.jpg b/public/previews/presets/mini/app-video-background-remover.jpg
new file mode 100644
index 00000000..223c390b
Binary files /dev/null and b/public/previews/presets/mini/app-video-background-remover.jpg differ
diff --git a/public/previews/presets/mini/app-video-face-swap.jpg b/public/previews/presets/mini/app-video-face-swap.jpg
new file mode 100644
index 00000000..88affd9c
Binary files /dev/null and b/public/previews/presets/mini/app-video-face-swap.jpg differ
diff --git a/public/previews/presets/mini/app-virtual-try-on.jpg b/public/previews/presets/mini/app-virtual-try-on.jpg
new file mode 100644
index 00000000..db15d435
Binary files /dev/null and b/public/previews/presets/mini/app-virtual-try-on.jpg differ
diff --git a/public/previews/presets/mini/app-volcano-ad.jpg b/public/previews/presets/mini/app-volcano-ad.jpg
new file mode 100644
index 00000000..cace12c3
Binary files /dev/null and b/public/previews/presets/mini/app-volcano-ad.jpg differ
diff --git a/public/previews/presets/mini/app-what-s-next.jpg b/public/previews/presets/mini/app-what-s-next.jpg
new file mode 100644
index 00000000..3316e8fd
Binary files /dev/null and b/public/previews/presets/mini/app-what-s-next.jpg differ
diff --git a/public/previews/presets/mini/app-yes-kiss.jpg b/public/previews/presets/mini/app-yes-kiss.jpg
new file mode 100644
index 00000000..9d8fca7a
Binary files /dev/null and b/public/previews/presets/mini/app-yes-kiss.jpg differ
diff --git a/public/previews/presets/mini/app-zoom-out.jpg b/public/previews/presets/mini/app-zoom-out.jpg
new file mode 100644
index 00000000..8451a2ed
Binary files /dev/null and b/public/previews/presets/mini/app-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/app-zooms.jpg b/public/previews/presets/mini/app-zooms.jpg
new file mode 100644
index 00000000..7a8d91fb
Binary files /dev/null and b/public/previews/presets/mini/app-zooms.jpg differ
diff --git a/public/previews/presets/mini/effect-acid.jpg b/public/previews/presets/mini/effect-acid.jpg
new file mode 100644
index 00000000..0f17ddcd
Binary files /dev/null and b/public/previews/presets/mini/effect-acid.jpg differ
diff --git a/public/previews/presets/mini/effect-act-natural.jpg b/public/previews/presets/mini/effect-act-natural.jpg
new file mode 100644
index 00000000..81e7e74d
Binary files /dev/null and b/public/previews/presets/mini/effect-act-natural.jpg differ
diff --git a/public/previews/presets/mini/effect-agamemnon.jpg b/public/previews/presets/mini/effect-agamemnon.jpg
new file mode 100644
index 00000000..fbba3020
Binary files /dev/null and b/public/previews/presets/mini/effect-agamemnon.jpg differ
diff --git a/public/previews/presets/mini/effect-agent-reveal.jpg b/public/previews/presets/mini/effect-agent-reveal.jpg
new file mode 100644
index 00000000..a9dcf885
Binary files /dev/null and b/public/previews/presets/mini/effect-agent-reveal.jpg differ
diff --git a/public/previews/presets/mini/effect-air-bending.jpg b/public/previews/presets/mini/effect-air-bending.jpg
new file mode 100644
index 00000000..cac440de
Binary files /dev/null and b/public/previews/presets/mini/effect-air-bending.jpg differ
diff --git a/public/previews/presets/mini/effect-akrill.jpg b/public/previews/presets/mini/effect-akrill.jpg
new file mode 100644
index 00000000..75396670
Binary files /dev/null and b/public/previews/presets/mini/effect-akrill.jpg differ
diff --git a/public/previews/presets/mini/effect-angel-wings.jpg b/public/previews/presets/mini/effect-angel-wings.jpg
new file mode 100644
index 00000000..af8a9d57
Binary files /dev/null and b/public/previews/presets/mini/effect-angel-wings.jpg differ
diff --git a/public/previews/presets/mini/effect-angry-mode.jpg b/public/previews/presets/mini/effect-angry-mode.jpg
new file mode 100644
index 00000000..e7e37280
Binary files /dev/null and b/public/previews/presets/mini/effect-angry-mode.jpg differ
diff --git a/public/previews/presets/mini/effect-animalization.jpg b/public/previews/presets/mini/effect-animalization.jpg
new file mode 100644
index 00000000..adacead1
Binary files /dev/null and b/public/previews/presets/mini/effect-animalization.jpg differ
diff --git a/public/previews/presets/mini/effect-aquarium.jpg b/public/previews/presets/mini/effect-aquarium.jpg
new file mode 100644
index 00000000..cab9d950
Binary files /dev/null and b/public/previews/presets/mini/effect-aquarium.jpg differ
diff --git a/public/previews/presets/mini/effect-architecture-wave.jpg b/public/previews/presets/mini/effect-architecture-wave.jpg
new file mode 100644
index 00000000..f2ed24c3
Binary files /dev/null and b/public/previews/presets/mini/effect-architecture-wave.jpg differ
diff --git a/public/previews/presets/mini/effect-atomic.jpg b/public/previews/presets/mini/effect-atomic.jpg
new file mode 100644
index 00000000..43cce960
Binary files /dev/null and b/public/previews/presets/mini/effect-atomic.jpg differ
diff --git a/public/previews/presets/mini/effect-attack-of-clones.jpg b/public/previews/presets/mini/effect-attack-of-clones.jpg
new file mode 100644
index 00000000..a972e821
Binary files /dev/null and b/public/previews/presets/mini/effect-attack-of-clones.jpg differ
diff --git a/public/previews/presets/mini/effect-ballet.jpg b/public/previews/presets/mini/effect-ballet.jpg
new file mode 100644
index 00000000..26919315
Binary files /dev/null and b/public/previews/presets/mini/effect-ballet.jpg differ
diff --git a/public/previews/presets/mini/effect-balloon.jpg b/public/previews/presets/mini/effect-balloon.jpg
new file mode 100644
index 00000000..bfa5677a
Binary files /dev/null and b/public/previews/presets/mini/effect-balloon.jpg differ
diff --git a/public/previews/presets/mini/effect-beach-ride.jpg b/public/previews/presets/mini/effect-beach-ride.jpg
new file mode 100644
index 00000000..145d932e
Binary files /dev/null and b/public/previews/presets/mini/effect-beach-ride.jpg differ
diff --git a/public/previews/presets/mini/effect-beast-appearance.jpg b/public/previews/presets/mini/effect-beast-appearance.jpg
new file mode 100644
index 00000000..24bbf498
Binary files /dev/null and b/public/previews/presets/mini/effect-beast-appearance.jpg differ
diff --git a/public/previews/presets/mini/effect-black-gloss.jpg b/public/previews/presets/mini/effect-black-gloss.jpg
new file mode 100644
index 00000000..8b19b0b6
Binary files /dev/null and b/public/previews/presets/mini/effect-black-gloss.jpg differ
diff --git a/public/previews/presets/mini/effect-black-tears.jpg b/public/previews/presets/mini/effect-black-tears.jpg
new file mode 100644
index 00000000..48f70bb0
Binary files /dev/null and b/public/previews/presets/mini/effect-black-tears.jpg differ
diff --git a/public/previews/presets/mini/effect-bleach-bypass.jpg b/public/previews/presets/mini/effect-bleach-bypass.jpg
new file mode 100644
index 00000000..c33969db
Binary files /dev/null and b/public/previews/presets/mini/effect-bleach-bypass.jpg differ
diff --git a/public/previews/presets/mini/effect-bleached-warm.jpg b/public/previews/presets/mini/effect-bleached-warm.jpg
new file mode 100644
index 00000000..faee316d
Binary files /dev/null and b/public/previews/presets/mini/effect-bleached-warm.jpg differ
diff --git a/public/previews/presets/mini/effect-bloom-mouth.jpg b/public/previews/presets/mini/effect-bloom-mouth.jpg
new file mode 100644
index 00000000..cf39d0ee
Binary files /dev/null and b/public/previews/presets/mini/effect-bloom-mouth.jpg differ
diff --git a/public/previews/presets/mini/effect-blue-depth.jpg b/public/previews/presets/mini/effect-blue-depth.jpg
new file mode 100644
index 00000000..1b6da8d0
Binary files /dev/null and b/public/previews/presets/mini/effect-blue-depth.jpg differ
diff --git a/public/previews/presets/mini/effect-boarding-pass.jpg b/public/previews/presets/mini/effect-boarding-pass.jpg
new file mode 100644
index 00000000..d627d3bd
Binary files /dev/null and b/public/previews/presets/mini/effect-boarding-pass.jpg differ
diff --git a/public/previews/presets/mini/effect-boiling-point.jpg b/public/previews/presets/mini/effect-boiling-point.jpg
new file mode 100644
index 00000000..22c644bb
Binary files /dev/null and b/public/previews/presets/mini/effect-boiling-point.jpg differ
diff --git a/public/previews/presets/mini/effect-broken-mirror.jpg b/public/previews/presets/mini/effect-broken-mirror.jpg
new file mode 100644
index 00000000..5c5f5d88
Binary files /dev/null and b/public/previews/presets/mini/effect-broken-mirror.jpg differ
diff --git a/public/previews/presets/mini/effect-bubbles.jpg b/public/previews/presets/mini/effect-bubbles.jpg
new file mode 100644
index 00000000..b61f510e
Binary files /dev/null and b/public/previews/presets/mini/effect-bubbles.jpg differ
diff --git a/public/previews/presets/mini/effect-buddy.jpg b/public/previews/presets/mini/effect-buddy.jpg
new file mode 100644
index 00000000..5c83d201
Binary files /dev/null and b/public/previews/presets/mini/effect-buddy.jpg differ
diff --git a/public/previews/presets/mini/effect-building-explosion.jpg b/public/previews/presets/mini/effect-building-explosion.jpg
new file mode 100644
index 00000000..aa9a215a
Binary files /dev/null and b/public/previews/presets/mini/effect-building-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-burning-man.jpg b/public/previews/presets/mini/effect-burning-man.jpg
new file mode 100644
index 00000000..029c6952
Binary files /dev/null and b/public/previews/presets/mini/effect-burning-man.jpg differ
diff --git a/public/previews/presets/mini/effect-cakeify.jpg b/public/previews/presets/mini/effect-cakeify.jpg
new file mode 100644
index 00000000..92bd8c79
Binary files /dev/null and b/public/previews/presets/mini/effect-cakeify.jpg differ
diff --git a/public/previews/presets/mini/effect-candy-pink.jpg b/public/previews/presets/mini/effect-candy-pink.jpg
new file mode 100644
index 00000000..14cdd033
Binary files /dev/null and b/public/previews/presets/mini/effect-candy-pink.jpg differ
diff --git a/public/previews/presets/mini/effect-cannabis.jpg b/public/previews/presets/mini/effect-cannabis.jpg
new file mode 100644
index 00000000..b881751b
Binary files /dev/null and b/public/previews/presets/mini/effect-cannabis.jpg differ
diff --git a/public/previews/presets/mini/effect-canvas.jpg b/public/previews/presets/mini/effect-canvas.jpg
new file mode 100644
index 00000000..6807fe5c
Binary files /dev/null and b/public/previews/presets/mini/effect-canvas.jpg differ
diff --git a/public/previews/presets/mini/effect-car-drive.jpg b/public/previews/presets/mini/effect-car-drive.jpg
new file mode 100644
index 00000000..26308279
Binary files /dev/null and b/public/previews/presets/mini/effect-car-drive.jpg differ
diff --git a/public/previews/presets/mini/effect-car-explosion.jpg b/public/previews/presets/mini/effect-car-explosion.jpg
new file mode 100644
index 00000000..f1724bf8
Binary files /dev/null and b/public/previews/presets/mini/effect-car-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-censorship.jpg b/public/previews/presets/mini/effect-censorship.jpg
new file mode 100644
index 00000000..40e3c880
Binary files /dev/null and b/public/previews/presets/mini/effect-censorship.jpg differ
diff --git a/public/previews/presets/mini/effect-classic-bw.jpg b/public/previews/presets/mini/effect-classic-bw.jpg
new file mode 100644
index 00000000..8bbe95fe
Binary files /dev/null and b/public/previews/presets/mini/effect-classic-bw.jpg differ
diff --git a/public/previews/presets/mini/effect-clone-explosion.jpg b/public/previews/presets/mini/effect-clone-explosion.jpg
new file mode 100644
index 00000000..b3664b96
Binary files /dev/null and b/public/previews/presets/mini/effect-clone-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-clones.jpg b/public/previews/presets/mini/effect-clones.jpg
new file mode 100644
index 00000000..6711568c
Binary files /dev/null and b/public/previews/presets/mini/effect-clones.jpg differ
diff --git a/public/previews/presets/mini/effect-clothes-rain.jpg b/public/previews/presets/mini/effect-clothes-rain.jpg
new file mode 100644
index 00000000..60f5026d
Binary files /dev/null and b/public/previews/presets/mini/effect-clothes-rain.jpg differ
diff --git a/public/previews/presets/mini/effect-cold-steel.jpg b/public/previews/presets/mini/effect-cold-steel.jpg
new file mode 100644
index 00000000..6ebfeb6f
Binary files /dev/null and b/public/previews/presets/mini/effect-cold-steel.jpg differ
diff --git a/public/previews/presets/mini/effect-cold-vision.jpg b/public/previews/presets/mini/effect-cold-vision.jpg
new file mode 100644
index 00000000..2a13cfc4
Binary files /dev/null and b/public/previews/presets/mini/effect-cold-vision.jpg differ
diff --git a/public/previews/presets/mini/effect-color-rain.jpg b/public/previews/presets/mini/effect-color-rain.jpg
new file mode 100644
index 00000000..92d29b9a
Binary files /dev/null and b/public/previews/presets/mini/effect-color-rain.jpg differ
diff --git a/public/previews/presets/mini/effect-column-wipe.jpg b/public/previews/presets/mini/effect-column-wipe.jpg
new file mode 100644
index 00000000..ea6cc62d
Binary files /dev/null and b/public/previews/presets/mini/effect-column-wipe.jpg differ
diff --git a/public/previews/presets/mini/effect-comic.jpg b/public/previews/presets/mini/effect-comic.jpg
new file mode 100644
index 00000000..64490b47
Binary files /dev/null and b/public/previews/presets/mini/effect-comic.jpg differ
diff --git a/public/previews/presets/mini/effect-contre-jour.jpg b/public/previews/presets/mini/effect-contre-jour.jpg
new file mode 100644
index 00000000..299bee74
Binary files /dev/null and b/public/previews/presets/mini/effect-contre-jour.jpg differ
diff --git a/public/previews/presets/mini/effect-cotton-cloud.jpg b/public/previews/presets/mini/effect-cotton-cloud.jpg
new file mode 100644
index 00000000..19102089
Binary files /dev/null and b/public/previews/presets/mini/effect-cotton-cloud.jpg differ
diff --git a/public/previews/presets/mini/effect-crimson-vigil.jpg b/public/previews/presets/mini/effect-crimson-vigil.jpg
new file mode 100644
index 00000000..fc7663a3
Binary files /dev/null and b/public/previews/presets/mini/effect-crimson-vigil.jpg differ
diff --git a/public/previews/presets/mini/effect-crush.jpg b/public/previews/presets/mini/effect-crush.jpg
new file mode 100644
index 00000000..21e0f0bf
Binary files /dev/null and b/public/previews/presets/mini/effect-crush.jpg differ
diff --git a/public/previews/presets/mini/effect-crying.jpg b/public/previews/presets/mini/effect-crying.jpg
new file mode 100644
index 00000000..230ad617
Binary files /dev/null and b/public/previews/presets/mini/effect-crying.jpg differ
diff --git a/public/previews/presets/mini/effect-cutout.jpg b/public/previews/presets/mini/effect-cutout.jpg
new file mode 100644
index 00000000..65bcdad3
Binary files /dev/null and b/public/previews/presets/mini/effect-cutout.jpg differ
diff --git a/public/previews/presets/mini/effect-cyborg.jpg b/public/previews/presets/mini/effect-cyborg.jpg
new file mode 100644
index 00000000..8a2fb3df
Binary files /dev/null and b/public/previews/presets/mini/effect-cyborg.jpg differ
diff --git a/public/previews/presets/mini/effect-cyclope.jpg b/public/previews/presets/mini/effect-cyclope.jpg
new file mode 100644
index 00000000..ea7019de
Binary files /dev/null and b/public/previews/presets/mini/effect-cyclope.jpg differ
diff --git a/public/previews/presets/mini/effect-datamosh.jpg b/public/previews/presets/mini/effect-datamosh.jpg
new file mode 100644
index 00000000..873fe1eb
Binary files /dev/null and b/public/previews/presets/mini/effect-datamosh.jpg differ
diff --git a/public/previews/presets/mini/effect-deflate.jpg b/public/previews/presets/mini/effect-deflate.jpg
new file mode 100644
index 00000000..43978a80
Binary files /dev/null and b/public/previews/presets/mini/effect-deflate.jpg differ
diff --git a/public/previews/presets/mini/effect-diamond.jpg b/public/previews/presets/mini/effect-diamond.jpg
new file mode 100644
index 00000000..634d2221
Binary files /dev/null and b/public/previews/presets/mini/effect-diamond.jpg differ
diff --git a/public/previews/presets/mini/effect-dirty-lens.jpg b/public/previews/presets/mini/effect-dirty-lens.jpg
new file mode 100644
index 00000000..60d9676c
Binary files /dev/null and b/public/previews/presets/mini/effect-dirty-lens.jpg differ
diff --git a/public/previews/presets/mini/effect-disintegration.jpg b/public/previews/presets/mini/effect-disintegration.jpg
new file mode 100644
index 00000000..7f0c70ee
Binary files /dev/null and b/public/previews/presets/mini/effect-disintegration.jpg differ
diff --git a/public/previews/presets/mini/effect-display-transition.jpg b/public/previews/presets/mini/effect-display-transition.jpg
new file mode 100644
index 00000000..5b67de30
Binary files /dev/null and b/public/previews/presets/mini/effect-display-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-dolphin-ride.jpg b/public/previews/presets/mini/effect-dolphin-ride.jpg
new file mode 100644
index 00000000..258b7aea
Binary files /dev/null and b/public/previews/presets/mini/effect-dolphin-ride.jpg differ
diff --git a/public/previews/presets/mini/effect-dream-date.jpg b/public/previews/presets/mini/effect-dream-date.jpg
new file mode 100644
index 00000000..b3cf7851
Binary files /dev/null and b/public/previews/presets/mini/effect-dream-date.jpg differ
diff --git a/public/previews/presets/mini/effect-drunk-master.jpg b/public/previews/presets/mini/effect-drunk-master.jpg
new file mode 100644
index 00000000..a34f94f7
Binary files /dev/null and b/public/previews/presets/mini/effect-drunk-master.jpg differ
diff --git a/public/previews/presets/mini/effect-duplicate.jpg b/public/previews/presets/mini/effect-duplicate.jpg
new file mode 100644
index 00000000..5cc0d9cc
Binary files /dev/null and b/public/previews/presets/mini/effect-duplicate.jpg differ
diff --git a/public/previews/presets/mini/effect-earth-element.jpg b/public/previews/presets/mini/effect-earth-element.jpg
new file mode 100644
index 00000000..45f98ad5
Binary files /dev/null and b/public/previews/presets/mini/effect-earth-element.jpg differ
diff --git a/public/previews/presets/mini/effect-earth-wave.jpg b/public/previews/presets/mini/effect-earth-wave.jpg
new file mode 100644
index 00000000..47c7ee6b
Binary files /dev/null and b/public/previews/presets/mini/effect-earth-wave.jpg differ
diff --git a/public/previews/presets/mini/effect-earth-zoom-out.jpg b/public/previews/presets/mini/effect-earth-zoom-out.jpg
new file mode 100644
index 00000000..3825cd22
Binary files /dev/null and b/public/previews/presets/mini/effect-earth-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/effect-eating.jpg b/public/previews/presets/mini/effect-eating.jpg
new file mode 100644
index 00000000..277051bc
Binary files /dev/null and b/public/previews/presets/mini/effect-eating.jpg differ
diff --git a/public/previews/presets/mini/effect-exploded-view.jpg b/public/previews/presets/mini/effect-exploded-view.jpg
new file mode 100644
index 00000000..58cfdd48
Binary files /dev/null and b/public/previews/presets/mini/effect-exploded-view.jpg differ
diff --git a/public/previews/presets/mini/effect-explosion.jpg b/public/previews/presets/mini/effect-explosion.jpg
new file mode 100644
index 00000000..338fb803
Binary files /dev/null and b/public/previews/presets/mini/effect-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-fairies-around.jpg b/public/previews/presets/mini/effect-fairies-around.jpg
new file mode 100644
index 00000000..cdd5dd11
Binary files /dev/null and b/public/previews/presets/mini/effect-fairies-around.jpg differ
diff --git a/public/previews/presets/mini/effect-fairytale-castle.jpg b/public/previews/presets/mini/effect-fairytale-castle.jpg
new file mode 100644
index 00000000..8759ffa5
Binary files /dev/null and b/public/previews/presets/mini/effect-fairytale-castle.jpg differ
diff --git a/public/previews/presets/mini/effect-fallen-angel.jpg b/public/previews/presets/mini/effect-fallen-angel.jpg
new file mode 100644
index 00000000..014ea5de
Binary files /dev/null and b/public/previews/presets/mini/effect-fallen-angel.jpg differ
diff --git a/public/previews/presets/mini/effect-film-colors.jpg b/public/previews/presets/mini/effect-film-colors.jpg
new file mode 100644
index 00000000..1f800d35
Binary files /dev/null and b/public/previews/presets/mini/effect-film-colors.jpg differ
diff --git a/public/previews/presets/mini/effect-fire-breath.jpg b/public/previews/presets/mini/effect-fire-breath.jpg
new file mode 100644
index 00000000..5ecdb461
Binary files /dev/null and b/public/previews/presets/mini/effect-fire-breath.jpg differ
diff --git a/public/previews/presets/mini/effect-fire-element.jpg b/public/previews/presets/mini/effect-fire-element.jpg
new file mode 100644
index 00000000..66103088
Binary files /dev/null and b/public/previews/presets/mini/effect-fire-element.jpg differ
diff --git a/public/previews/presets/mini/effect-firelava.jpg b/public/previews/presets/mini/effect-firelava.jpg
new file mode 100644
index 00000000..20b5fd69
Binary files /dev/null and b/public/previews/presets/mini/effect-firelava.jpg differ
diff --git a/public/previews/presets/mini/effect-firework.jpg b/public/previews/presets/mini/effect-firework.jpg
new file mode 100644
index 00000000..91171779
Binary files /dev/null and b/public/previews/presets/mini/effect-firework.jpg differ
diff --git a/public/previews/presets/mini/effect-fix-and-pose.jpg b/public/previews/presets/mini/effect-fix-and-pose.jpg
new file mode 100644
index 00000000..a2caa78d
Binary files /dev/null and b/public/previews/presets/mini/effect-fix-and-pose.jpg differ
diff --git a/public/previews/presets/mini/effect-flame-on.jpg b/public/previews/presets/mini/effect-flame-on.jpg
new file mode 100644
index 00000000..7afb69df
Binary files /dev/null and b/public/previews/presets/mini/effect-flame-on.jpg differ
diff --git a/public/previews/presets/mini/effect-flame-transition.jpg b/public/previews/presets/mini/effect-flame-transition.jpg
new file mode 100644
index 00000000..be5d8b7e
Binary files /dev/null and b/public/previews/presets/mini/effect-flame-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-flash-comic.jpg b/public/previews/presets/mini/effect-flash-comic.jpg
new file mode 100644
index 00000000..644d652d
Binary files /dev/null and b/public/previews/presets/mini/effect-flash-comic.jpg differ
diff --git a/public/previews/presets/mini/effect-flashback.jpg b/public/previews/presets/mini/effect-flashback.jpg
new file mode 100644
index 00000000..125663f1
Binary files /dev/null and b/public/previews/presets/mini/effect-flashback.jpg differ
diff --git a/public/previews/presets/mini/effect-floating-fall.jpg b/public/previews/presets/mini/effect-floating-fall.jpg
new file mode 100644
index 00000000..2db93d27
Binary files /dev/null and b/public/previews/presets/mini/effect-floating-fall.jpg differ
diff --git a/public/previews/presets/mini/effect-floating-fish.jpg b/public/previews/presets/mini/effect-floating-fish.jpg
new file mode 100644
index 00000000..a07805fc
Binary files /dev/null and b/public/previews/presets/mini/effect-floating-fish.jpg differ
diff --git a/public/previews/presets/mini/effect-flood.jpg b/public/previews/presets/mini/effect-flood.jpg
new file mode 100644
index 00000000..4e1048ff
Binary files /dev/null and b/public/previews/presets/mini/effect-flood.jpg differ
diff --git a/public/previews/presets/mini/effect-floral-eyes.jpg b/public/previews/presets/mini/effect-floral-eyes.jpg
new file mode 100644
index 00000000..afe9798b
Binary files /dev/null and b/public/previews/presets/mini/effect-floral-eyes.jpg differ
diff --git a/public/previews/presets/mini/effect-fragments.jpg b/public/previews/presets/mini/effect-fragments.jpg
new file mode 100644
index 00000000..769abb2f
Binary files /dev/null and b/public/previews/presets/mini/effect-fragments.jpg differ
diff --git a/public/previews/presets/mini/effect-freezing.jpg b/public/previews/presets/mini/effect-freezing.jpg
new file mode 100644
index 00000000..03818910
Binary files /dev/null and b/public/previews/presets/mini/effect-freezing.jpg differ
diff --git a/public/previews/presets/mini/effect-frozen-in-motion.jpg b/public/previews/presets/mini/effect-frozen-in-motion.jpg
new file mode 100644
index 00000000..2a415424
Binary files /dev/null and b/public/previews/presets/mini/effect-frozen-in-motion.jpg differ
diff --git a/public/previews/presets/mini/effect-garden-bloom.jpg b/public/previews/presets/mini/effect-garden-bloom.jpg
new file mode 100644
index 00000000..f5026aa2
Binary files /dev/null and b/public/previews/presets/mini/effect-garden-bloom.jpg differ
diff --git a/public/previews/presets/mini/effect-gas-transformation.jpg b/public/previews/presets/mini/effect-gas-transformation.jpg
new file mode 100644
index 00000000..36c0fc8f
Binary files /dev/null and b/public/previews/presets/mini/effect-gas-transformation.jpg differ
diff --git a/public/previews/presets/mini/effect-giant-grab.jpg b/public/previews/presets/mini/effect-giant-grab.jpg
new file mode 100644
index 00000000..ffa44890
Binary files /dev/null and b/public/previews/presets/mini/effect-giant-grab.jpg differ
diff --git a/public/previews/presets/mini/effect-giant-people.jpg b/public/previews/presets/mini/effect-giant-people.jpg
new file mode 100644
index 00000000..7426f147
Binary files /dev/null and b/public/previews/presets/mini/effect-giant-people.jpg differ
diff --git a/public/previews/presets/mini/effect-giant.jpg b/public/previews/presets/mini/effect-giant.jpg
new file mode 100644
index 00000000..9a7d2a0f
Binary files /dev/null and b/public/previews/presets/mini/effect-giant.jpg differ
diff --git a/public/previews/presets/mini/effect-glitch.jpg b/public/previews/presets/mini/effect-glitch.jpg
new file mode 100644
index 00000000..b6485ff4
Binary files /dev/null and b/public/previews/presets/mini/effect-glitch.jpg differ
diff --git a/public/previews/presets/mini/effect-glow-trace.jpg b/public/previews/presets/mini/effect-glow-trace.jpg
new file mode 100644
index 00000000..3cd3a59c
Binary files /dev/null and b/public/previews/presets/mini/effect-glow-trace.jpg differ
diff --git a/public/previews/presets/mini/effect-glowing-fish.jpg b/public/previews/presets/mini/effect-glowing-fish.jpg
new file mode 100644
index 00000000..25e2939e
Binary files /dev/null and b/public/previews/presets/mini/effect-glowing-fish.jpg differ
diff --git a/public/previews/presets/mini/effect-glowshift.jpg b/public/previews/presets/mini/effect-glowshift.jpg
new file mode 100644
index 00000000..8c616488
Binary files /dev/null and b/public/previews/presets/mini/effect-glowshift.jpg differ
diff --git a/public/previews/presets/mini/effect-gorilla-transfer.jpg b/public/previews/presets/mini/effect-gorilla-transfer.jpg
new file mode 100644
index 00000000..6e742e47
Binary files /dev/null and b/public/previews/presets/mini/effect-gorilla-transfer.jpg differ
diff --git a/public/previews/presets/mini/effect-group-photo.jpg b/public/previews/presets/mini/effect-group-photo.jpg
new file mode 100644
index 00000000..e8a6f6b2
Binary files /dev/null and b/public/previews/presets/mini/effect-group-photo.jpg differ
diff --git a/public/previews/presets/mini/effect-hair-style.jpg b/public/previews/presets/mini/effect-hair-style.jpg
new file mode 100644
index 00000000..154302e0
Binary files /dev/null and b/public/previews/presets/mini/effect-hair-style.jpg differ
diff --git a/public/previews/presets/mini/effect-hand-paint.jpg b/public/previews/presets/mini/effect-hand-paint.jpg
new file mode 100644
index 00000000..b7f3b9d5
Binary files /dev/null and b/public/previews/presets/mini/effect-hand-paint.jpg differ
diff --git a/public/previews/presets/mini/effect-hand-transition.jpg b/public/previews/presets/mini/effect-hand-transition.jpg
new file mode 100644
index 00000000..f1134bb8
Binary files /dev/null and b/public/previews/presets/mini/effect-hand-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-handheld-run.jpg b/public/previews/presets/mini/effect-handheld-run.jpg
new file mode 100644
index 00000000..2a3b1581
Binary files /dev/null and b/public/previews/presets/mini/effect-handheld-run.jpg differ
diff --git a/public/previews/presets/mini/effect-happy-mode.jpg b/public/previews/presets/mini/effect-happy-mode.jpg
new file mode 100644
index 00000000..b3fad945
Binary files /dev/null and b/public/previews/presets/mini/effect-happy-mode.jpg differ
diff --git a/public/previews/presets/mini/effect-happy.jpg b/public/previews/presets/mini/effect-happy.jpg
new file mode 100644
index 00000000..ef19adcc
Binary files /dev/null and b/public/previews/presets/mini/effect-happy.jpg differ
diff --git a/public/previews/presets/mini/effect-head-explosion.jpg b/public/previews/presets/mini/effect-head-explosion.jpg
new file mode 100644
index 00000000..671090b8
Binary files /dev/null and b/public/previews/presets/mini/effect-head-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-head-off.jpg b/public/previews/presets/mini/effect-head-off.jpg
new file mode 100644
index 00000000..2eb32e9c
Binary files /dev/null and b/public/previews/presets/mini/effect-head-off.jpg differ
diff --git a/public/previews/presets/mini/effect-helicopter-escape.jpg b/public/previews/presets/mini/effect-helicopter-escape.jpg
new file mode 100644
index 00000000..726c459e
Binary files /dev/null and b/public/previews/presets/mini/effect-helicopter-escape.jpg differ
diff --git a/public/previews/presets/mini/effect-hero-flight.jpg b/public/previews/presets/mini/effect-hero-flight.jpg
new file mode 100644
index 00000000..1eed7021
Binary files /dev/null and b/public/previews/presets/mini/effect-hero-flight.jpg differ
diff --git a/public/previews/presets/mini/effect-high-flip.jpg b/public/previews/presets/mini/effect-high-flip.jpg
new file mode 100644
index 00000000..b6aa1f7f
Binary files /dev/null and b/public/previews/presets/mini/effect-high-flip.jpg differ
diff --git a/public/previews/presets/mini/effect-hole-transition.jpg b/public/previews/presets/mini/effect-hole-transition.jpg
new file mode 100644
index 00000000..e415fc26
Binary files /dev/null and b/public/previews/presets/mini/effect-hole-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-horror-face.jpg b/public/previews/presets/mini/effect-horror-face.jpg
new file mode 100644
index 00000000..8a469e12
Binary files /dev/null and b/public/previews/presets/mini/effect-horror-face.jpg differ
diff --git a/public/previews/presets/mini/effect-hyper-neon.jpg b/public/previews/presets/mini/effect-hyper-neon.jpg
new file mode 100644
index 00000000..6726664a
Binary files /dev/null and b/public/previews/presets/mini/effect-hyper-neon.jpg differ
diff --git a/public/previews/presets/mini/effect-i-can-fly.jpg b/public/previews/presets/mini/effect-i-can-fly.jpg
new file mode 100644
index 00000000..5ec8e1d5
Binary files /dev/null and b/public/previews/presets/mini/effect-i-can-fly.jpg differ
diff --git a/public/previews/presets/mini/effect-ice-rose.jpg b/public/previews/presets/mini/effect-ice-rose.jpg
new file mode 100644
index 00000000..6a44fefa
Binary files /dev/null and b/public/previews/presets/mini/effect-ice-rose.jpg differ
diff --git a/public/previews/presets/mini/effect-infinite-clones.jpg b/public/previews/presets/mini/effect-infinite-clones.jpg
new file mode 100644
index 00000000..117d24f2
Binary files /dev/null and b/public/previews/presets/mini/effect-infinite-clones.jpg differ
diff --git a/public/previews/presets/mini/effect-inflate.jpg b/public/previews/presets/mini/effect-inflate.jpg
new file mode 100644
index 00000000..c05092b4
Binary files /dev/null and b/public/previews/presets/mini/effect-inflate.jpg differ
diff --git a/public/previews/presets/mini/effect-innerlight.jpg b/public/previews/presets/mini/effect-innerlight.jpg
new file mode 100644
index 00000000..6a27ed67
Binary files /dev/null and b/public/previews/presets/mini/effect-innerlight.jpg differ
diff --git a/public/previews/presets/mini/effect-invisible.jpg b/public/previews/presets/mini/effect-invisible.jpg
new file mode 100644
index 00000000..ce40789e
Binary files /dev/null and b/public/previews/presets/mini/effect-invisible.jpg differ
diff --git a/public/previews/presets/mini/effect-jelly-drift.jpg b/public/previews/presets/mini/effect-jelly-drift.jpg
new file mode 100644
index 00000000..cd6b06d6
Binary files /dev/null and b/public/previews/presets/mini/effect-jelly-drift.jpg differ
diff --git a/public/previews/presets/mini/effect-jump-transition.jpg b/public/previews/presets/mini/effect-jump-transition.jpg
new file mode 100644
index 00000000..e7f08ec1
Binary files /dev/null and b/public/previews/presets/mini/effect-jump-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-lacewalker.jpg b/public/previews/presets/mini/effect-lacewalker.jpg
new file mode 100644
index 00000000..2ae65f8f
Binary files /dev/null and b/public/previews/presets/mini/effect-lacewalker.jpg differ
diff --git a/public/previews/presets/mini/effect-lava.jpg b/public/previews/presets/mini/effect-lava.jpg
new file mode 100644
index 00000000..d8617d22
Binary files /dev/null and b/public/previews/presets/mini/effect-lava.jpg differ
diff --git a/public/previews/presets/mini/effect-layer-mixed-media.jpg b/public/previews/presets/mini/effect-layer-mixed-media.jpg
new file mode 100644
index 00000000..c1d7537a
Binary files /dev/null and b/public/previews/presets/mini/effect-layer-mixed-media.jpg differ
diff --git a/public/previews/presets/mini/effect-lens-crack.jpg b/public/previews/presets/mini/effect-lens-crack.jpg
new file mode 100644
index 00000000..7435b7a8
Binary files /dev/null and b/public/previews/presets/mini/effect-lens-crack.jpg differ
diff --git a/public/previews/presets/mini/effect-lens-flare.jpg b/public/previews/presets/mini/effect-lens-flare.jpg
new file mode 100644
index 00000000..9613ea23
Binary files /dev/null and b/public/previews/presets/mini/effect-lens-flare.jpg differ
diff --git a/public/previews/presets/mini/effect-levitation.jpg b/public/previews/presets/mini/effect-levitation.jpg
new file mode 100644
index 00000000..09461954
Binary files /dev/null and b/public/previews/presets/mini/effect-levitation.jpg differ
diff --git a/public/previews/presets/mini/effect-lidar-transition.jpg b/public/previews/presets/mini/effect-lidar-transition.jpg
new file mode 100644
index 00000000..17bd67dc
Binary files /dev/null and b/public/previews/presets/mini/effect-lidar-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-lime-jam.jpg b/public/previews/presets/mini/effect-lime-jam.jpg
new file mode 100644
index 00000000..65734581
Binary files /dev/null and b/public/previews/presets/mini/effect-lime-jam.jpg differ
diff --git a/public/previews/presets/mini/effect-live-concert.jpg b/public/previews/presets/mini/effect-live-concert.jpg
new file mode 100644
index 00000000..467b27cb
Binary files /dev/null and b/public/previews/presets/mini/effect-live-concert.jpg differ
diff --git a/public/previews/presets/mini/effect-look-boom.jpg b/public/previews/presets/mini/effect-look-boom.jpg
new file mode 100644
index 00000000..53a5487a
Binary files /dev/null and b/public/previews/presets/mini/effect-look-boom.jpg differ
diff --git a/public/previews/presets/mini/effect-lsd.jpg b/public/previews/presets/mini/effect-lsd.jpg
new file mode 100644
index 00000000..ce110dd0
Binary files /dev/null and b/public/previews/presets/mini/effect-lsd.jpg differ
diff --git a/public/previews/presets/mini/effect-luminous-gaze.jpg b/public/previews/presets/mini/effect-luminous-gaze.jpg
new file mode 100644
index 00000000..716f76b0
Binary files /dev/null and b/public/previews/presets/mini/effect-luminous-gaze.jpg differ
diff --git a/public/previews/presets/mini/effect-magazine.jpg b/public/previews/presets/mini/effect-magazine.jpg
new file mode 100644
index 00000000..c8141f3c
Binary files /dev/null and b/public/previews/presets/mini/effect-magazine.jpg differ
diff --git a/public/previews/presets/mini/effect-marble.jpg b/public/previews/presets/mini/effect-marble.jpg
new file mode 100644
index 00000000..15ba01b8
Binary files /dev/null and b/public/previews/presets/mini/effect-marble.jpg differ
diff --git a/public/previews/presets/mini/effect-medusa-gorgona.jpg b/public/previews/presets/mini/effect-medusa-gorgona.jpg
new file mode 100644
index 00000000..94d77f38
Binary files /dev/null and b/public/previews/presets/mini/effect-medusa-gorgona.jpg differ
diff --git a/public/previews/presets/mini/effect-melt-transition.jpg b/public/previews/presets/mini/effect-melt-transition.jpg
new file mode 100644
index 00000000..95139ea5
Binary files /dev/null and b/public/previews/presets/mini/effect-melt-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-melting.jpg b/public/previews/presets/mini/effect-melting.jpg
new file mode 100644
index 00000000..0966c30b
Binary files /dev/null and b/public/previews/presets/mini/effect-melting.jpg differ
diff --git a/public/previews/presets/mini/effect-mighty-fighter.jpg b/public/previews/presets/mini/effect-mighty-fighter.jpg
new file mode 100644
index 00000000..4446b11e
Binary files /dev/null and b/public/previews/presets/mini/effect-mighty-fighter.jpg differ
diff --git a/public/previews/presets/mini/effect-modern.jpg b/public/previews/presets/mini/effect-modern.jpg
new file mode 100644
index 00000000..600a0609
Binary files /dev/null and b/public/previews/presets/mini/effect-modern.jpg differ
diff --git a/public/previews/presets/mini/effect-monet-muse.jpg b/public/previews/presets/mini/effect-monet-muse.jpg
new file mode 100644
index 00000000..c053e6e2
Binary files /dev/null and b/public/previews/presets/mini/effect-monet-muse.jpg differ
diff --git a/public/previews/presets/mini/effect-money-rain.jpg b/public/previews/presets/mini/effect-money-rain.jpg
new file mode 100644
index 00000000..59097b25
Binary files /dev/null and b/public/previews/presets/mini/effect-money-rain.jpg differ
diff --git a/public/previews/presets/mini/effect-monster-dab.jpg b/public/previews/presets/mini/effect-monster-dab.jpg
new file mode 100644
index 00000000..b518d7fb
Binary files /dev/null and b/public/previews/presets/mini/effect-monster-dab.jpg differ
diff --git a/public/previews/presets/mini/effect-monstrosity.jpg b/public/previews/presets/mini/effect-monstrosity.jpg
new file mode 100644
index 00000000..107d3260
Binary files /dev/null and b/public/previews/presets/mini/effect-monstrosity.jpg differ
diff --git a/public/previews/presets/mini/effect-moonwalk.jpg b/public/previews/presets/mini/effect-moonwalk.jpg
new file mode 100644
index 00000000..ab2b6b5e
Binary files /dev/null and b/public/previews/presets/mini/effect-moonwalk.jpg differ
diff --git a/public/previews/presets/mini/effect-morning-routine.jpg b/public/previews/presets/mini/effect-morning-routine.jpg
new file mode 100644
index 00000000..ae664ea8
Binary files /dev/null and b/public/previews/presets/mini/effect-morning-routine.jpg differ
diff --git a/public/previews/presets/mini/effect-morphskin.jpg b/public/previews/presets/mini/effect-morphskin.jpg
new file mode 100644
index 00000000..f82d82cb
Binary files /dev/null and b/public/previews/presets/mini/effect-morphskin.jpg differ
diff --git a/public/previews/presets/mini/effect-motor-ride.jpg b/public/previews/presets/mini/effect-motor-ride.jpg
new file mode 100644
index 00000000..c511bac6
Binary files /dev/null and b/public/previews/presets/mini/effect-motor-ride.jpg differ
diff --git a/public/previews/presets/mini/effect-multiverse.jpg b/public/previews/presets/mini/effect-multiverse.jpg
new file mode 100644
index 00000000..37cab328
Binary files /dev/null and b/public/previews/presets/mini/effect-multiverse.jpg differ
diff --git a/public/previews/presets/mini/effect-muscle-up.jpg b/public/previews/presets/mini/effect-muscle-up.jpg
new file mode 100644
index 00000000..d9319eeb
Binary files /dev/null and b/public/previews/presets/mini/effect-muscle-up.jpg differ
diff --git a/public/previews/presets/mini/effect-mystification.jpg b/public/previews/presets/mini/effect-mystification.jpg
new file mode 100644
index 00000000..0a0ab03d
Binary files /dev/null and b/public/previews/presets/mini/effect-mystification.jpg differ
diff --git a/public/previews/presets/mini/effect-naturalistic-clean.jpg b/public/previews/presets/mini/effect-naturalistic-clean.jpg
new file mode 100644
index 00000000..620bf2f7
Binary files /dev/null and b/public/previews/presets/mini/effect-naturalistic-clean.jpg differ
diff --git a/public/previews/presets/mini/effect-nature-bloom.jpg b/public/previews/presets/mini/effect-nature-bloom.jpg
new file mode 100644
index 00000000..eb158a31
Binary files /dev/null and b/public/previews/presets/mini/effect-nature-bloom.jpg differ
diff --git a/public/previews/presets/mini/effect-noir.jpg b/public/previews/presets/mini/effect-noir.jpg
new file mode 100644
index 00000000..c3715822
Binary files /dev/null and b/public/previews/presets/mini/effect-noir.jpg differ
diff --git a/public/previews/presets/mini/effect-northern-lights.jpg b/public/previews/presets/mini/effect-northern-lights.jpg
new file mode 100644
index 00000000..f74adbf2
Binary files /dev/null and b/public/previews/presets/mini/effect-northern-lights.jpg differ
diff --git a/public/previews/presets/mini/effect-nostalgic-blue.jpg b/public/previews/presets/mini/effect-nostalgic-blue.jpg
new file mode 100644
index 00000000..c05d1d9e
Binary files /dev/null and b/public/previews/presets/mini/effect-nostalgic-blue.jpg differ
diff --git a/public/previews/presets/mini/effect-objects-around.jpg b/public/previews/presets/mini/effect-objects-around.jpg
new file mode 100644
index 00000000..acb3fd2e
Binary files /dev/null and b/public/previews/presets/mini/effect-objects-around.jpg differ
diff --git a/public/previews/presets/mini/effect-ocean.jpg b/public/previews/presets/mini/effect-ocean.jpg
new file mode 100644
index 00000000..22d090c6
Binary files /dev/null and b/public/previews/presets/mini/effect-ocean.jpg differ
diff --git a/public/previews/presets/mini/effect-oni-mask.jpg b/public/previews/presets/mini/effect-oni-mask.jpg
new file mode 100644
index 00000000..38927465
Binary files /dev/null and b/public/previews/presets/mini/effect-oni-mask.jpg differ
diff --git a/public/previews/presets/mini/effect-origami.jpg b/public/previews/presets/mini/effect-origami.jpg
new file mode 100644
index 00000000..0e80fab7
Binary files /dev/null and b/public/previews/presets/mini/effect-origami.jpg differ
diff --git a/public/previews/presets/mini/effect-outfit-check.jpg b/public/previews/presets/mini/effect-outfit-check.jpg
new file mode 100644
index 00000000..5005d634
Binary files /dev/null and b/public/previews/presets/mini/effect-outfit-check.jpg differ
diff --git a/public/previews/presets/mini/effect-outfit-switch.jpg b/public/previews/presets/mini/effect-outfit-switch.jpg
new file mode 100644
index 00000000..858e8bbb
Binary files /dev/null and b/public/previews/presets/mini/effect-outfit-switch.jpg differ
diff --git a/public/previews/presets/mini/effect-overexposed.jpg b/public/previews/presets/mini/effect-overexposed.jpg
new file mode 100644
index 00000000..3dbef53b
Binary files /dev/null and b/public/previews/presets/mini/effect-overexposed.jpg differ
diff --git a/public/previews/presets/mini/effect-overhead-fall.jpg b/public/previews/presets/mini/effect-overhead-fall.jpg
new file mode 100644
index 00000000..f8d8a2a0
Binary files /dev/null and b/public/previews/presets/mini/effect-overhead-fall.jpg differ
diff --git a/public/previews/presets/mini/effect-overtime.jpg b/public/previews/presets/mini/effect-overtime.jpg
new file mode 100644
index 00000000..8339a7ff
Binary files /dev/null and b/public/previews/presets/mini/effect-overtime.jpg differ
diff --git a/public/previews/presets/mini/effect-paint-splash.jpg b/public/previews/presets/mini/effect-paint-splash.jpg
new file mode 100644
index 00000000..3c184652
Binary files /dev/null and b/public/previews/presets/mini/effect-paint-splash.jpg differ
diff --git a/public/previews/presets/mini/effect-palette.jpg b/public/previews/presets/mini/effect-palette.jpg
new file mode 100644
index 00000000..a5fbc364
Binary files /dev/null and b/public/previews/presets/mini/effect-palette.jpg differ
diff --git a/public/previews/presets/mini/effect-paparazzi.jpg b/public/previews/presets/mini/effect-paparazzi.jpg
new file mode 100644
index 00000000..c869fb70
Binary files /dev/null and b/public/previews/presets/mini/effect-paparazzi.jpg differ
diff --git a/public/previews/presets/mini/effect-paper.jpg b/public/previews/presets/mini/effect-paper.jpg
new file mode 100644
index 00000000..06906fc0
Binary files /dev/null and b/public/previews/presets/mini/effect-paper.jpg differ
diff --git a/public/previews/presets/mini/effect-particles.jpg b/public/previews/presets/mini/effect-particles.jpg
new file mode 100644
index 00000000..217b558b
Binary files /dev/null and b/public/previews/presets/mini/effect-particles.jpg differ
diff --git a/public/previews/presets/mini/effect-peak-moment.jpg b/public/previews/presets/mini/effect-peak-moment.jpg
new file mode 100644
index 00000000..87184e11
Binary files /dev/null and b/public/previews/presets/mini/effect-peak-moment.jpg differ
diff --git a/public/previews/presets/mini/effect-pearl-earring.jpg b/public/previews/presets/mini/effect-pearl-earring.jpg
new file mode 100644
index 00000000..d68a2038
Binary files /dev/null and b/public/previews/presets/mini/effect-pearl-earring.jpg differ
diff --git a/public/previews/presets/mini/effect-pigeons.jpg b/public/previews/presets/mini/effect-pigeons.jpg
new file mode 100644
index 00000000..035189f8
Binary files /dev/null and b/public/previews/presets/mini/effect-pigeons.jpg differ
diff --git a/public/previews/presets/mini/effect-pixelated-face.jpg b/public/previews/presets/mini/effect-pixelated-face.jpg
new file mode 100644
index 00000000..36f43be1
Binary files /dev/null and b/public/previews/presets/mini/effect-pixelated-face.jpg differ
diff --git a/public/previews/presets/mini/effect-pizza-fall.jpg b/public/previews/presets/mini/effect-pizza-fall.jpg
new file mode 100644
index 00000000..4b9f9836
Binary files /dev/null and b/public/previews/presets/mini/effect-pizza-fall.jpg differ
diff --git a/public/previews/presets/mini/effect-plasma-explosion.jpg b/public/previews/presets/mini/effect-plasma-explosion.jpg
new file mode 100644
index 00000000..7951baf9
Binary files /dev/null and b/public/previews/presets/mini/effect-plasma-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-plate-check.jpg b/public/previews/presets/mini/effect-plate-check.jpg
new file mode 100644
index 00000000..cf238635
Binary files /dev/null and b/public/previews/presets/mini/effect-plate-check.jpg differ
diff --git a/public/previews/presets/mini/effect-point-cloud.jpg b/public/previews/presets/mini/effect-point-cloud.jpg
new file mode 100644
index 00000000..331b30e8
Binary files /dev/null and b/public/previews/presets/mini/effect-point-cloud.jpg differ
diff --git a/public/previews/presets/mini/effect-polygon.jpg b/public/previews/presets/mini/effect-polygon.jpg
new file mode 100644
index 00000000..b8d68b6a
Binary files /dev/null and b/public/previews/presets/mini/effect-polygon.jpg differ
diff --git a/public/previews/presets/mini/effect-pool-jump.jpg b/public/previews/presets/mini/effect-pool-jump.jpg
new file mode 100644
index 00000000..aa39437d
Binary files /dev/null and b/public/previews/presets/mini/effect-pool-jump.jpg differ
diff --git a/public/previews/presets/mini/effect-portal.jpg b/public/previews/presets/mini/effect-portal.jpg
new file mode 100644
index 00000000..442b8ed6
Binary files /dev/null and b/public/previews/presets/mini/effect-portal.jpg differ
diff --git a/public/previews/presets/mini/effect-powder-explosion.jpg b/public/previews/presets/mini/effect-powder-explosion.jpg
new file mode 100644
index 00000000..05e329f2
Binary files /dev/null and b/public/previews/presets/mini/effect-powder-explosion.jpg differ
diff --git a/public/previews/presets/mini/effect-practicals.jpg b/public/previews/presets/mini/effect-practicals.jpg
new file mode 100644
index 00000000..cd862894
Binary files /dev/null and b/public/previews/presets/mini/effect-practicals.jpg differ
diff --git a/public/previews/presets/mini/effect-push-to-glass.jpg b/public/previews/presets/mini/effect-push-to-glass.jpg
new file mode 100644
index 00000000..80e01919
Binary files /dev/null and b/public/previews/presets/mini/effect-push-to-glass.jpg differ
diff --git a/public/previews/presets/mini/effect-random-glow.jpg b/public/previews/presets/mini/effect-random-glow.jpg
new file mode 100644
index 00000000..335644d3
Binary files /dev/null and b/public/previews/presets/mini/effect-random-glow.jpg differ
diff --git a/public/previews/presets/mini/effect-raven-transition.jpg b/public/previews/presets/mini/effect-raven-transition.jpg
new file mode 100644
index 00000000..cec02caa
Binary files /dev/null and b/public/previews/presets/mini/effect-raven-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-red-carpet.jpg b/public/previews/presets/mini/effect-red-carpet.jpg
new file mode 100644
index 00000000..340e76e1
Binary files /dev/null and b/public/previews/presets/mini/effect-red-carpet.jpg differ
diff --git a/public/previews/presets/mini/effect-saint-glow.jpg b/public/previews/presets/mini/effect-saint-glow.jpg
new file mode 100644
index 00000000..4646210b
Binary files /dev/null and b/public/previews/presets/mini/effect-saint-glow.jpg differ
diff --git a/public/previews/presets/mini/effect-sakura-petals.jpg b/public/previews/presets/mini/effect-sakura-petals.jpg
new file mode 100644
index 00000000..9254f39a
Binary files /dev/null and b/public/previews/presets/mini/effect-sakura-petals.jpg differ
diff --git a/public/previews/presets/mini/effect-sand-cut.jpg b/public/previews/presets/mini/effect-sand-cut.jpg
new file mode 100644
index 00000000..80126336
Binary files /dev/null and b/public/previews/presets/mini/effect-sand-cut.jpg differ
diff --git a/public/previews/presets/mini/effect-sand-storm.jpg b/public/previews/presets/mini/effect-sand-storm.jpg
new file mode 100644
index 00000000..8b8d1bf7
Binary files /dev/null and b/public/previews/presets/mini/effect-sand-storm.jpg differ
diff --git a/public/previews/presets/mini/effect-scrapbook-collage.jpg b/public/previews/presets/mini/effect-scrapbook-collage.jpg
new file mode 100644
index 00000000..c1c822ba
Binary files /dev/null and b/public/previews/presets/mini/effect-scrapbook-collage.jpg differ
diff --git a/public/previews/presets/mini/effect-seamless-transition.jpg b/public/previews/presets/mini/effect-seamless-transition.jpg
new file mode 100644
index 00000000..dce4af15
Binary files /dev/null and b/public/previews/presets/mini/effect-seamless-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-selfception.jpg b/public/previews/presets/mini/effect-selfception.jpg
new file mode 100644
index 00000000..82b14c5d
Binary files /dev/null and b/public/previews/presets/mini/effect-selfception.jpg differ
diff --git a/public/previews/presets/mini/effect-selfie-outfit.jpg b/public/previews/presets/mini/effect-selfie-outfit.jpg
new file mode 100644
index 00000000..619e4bf3
Binary files /dev/null and b/public/previews/presets/mini/effect-selfie-outfit.jpg differ
diff --git a/public/previews/presets/mini/effect-selfie-posing.jpg b/public/previews/presets/mini/effect-selfie-posing.jpg
new file mode 100644
index 00000000..7694972d
Binary files /dev/null and b/public/previews/presets/mini/effect-selfie-posing.jpg differ
diff --git a/public/previews/presets/mini/effect-selfie.jpg b/public/previews/presets/mini/effect-selfie.jpg
new file mode 100644
index 00000000..4b1d9d2a
Binary files /dev/null and b/public/previews/presets/mini/effect-selfie.jpg differ
diff --git a/public/previews/presets/mini/effect-set-on-fire.jpg b/public/previews/presets/mini/effect-set-on-fire.jpg
new file mode 100644
index 00000000..1ce8b7f6
Binary files /dev/null and b/public/previews/presets/mini/effect-set-on-fire.jpg differ
diff --git a/public/previews/presets/mini/effect-shadow-smoke.jpg b/public/previews/presets/mini/effect-shadow-smoke.jpg
new file mode 100644
index 00000000..8fb72568
Binary files /dev/null and b/public/previews/presets/mini/effect-shadow-smoke.jpg differ
diff --git a/public/previews/presets/mini/effect-shocked.jpg b/public/previews/presets/mini/effect-shocked.jpg
new file mode 100644
index 00000000..971f0129
Binary files /dev/null and b/public/previews/presets/mini/effect-shocked.jpg differ
diff --git a/public/previews/presets/mini/effect-silhouette.jpg b/public/previews/presets/mini/effect-silhouette.jpg
new file mode 100644
index 00000000..3a533486
Binary files /dev/null and b/public/previews/presets/mini/effect-silhouette.jpg differ
diff --git a/public/previews/presets/mini/effect-skatedog.jpg b/public/previews/presets/mini/effect-skatedog.jpg
new file mode 100644
index 00000000..f21fe9eb
Binary files /dev/null and b/public/previews/presets/mini/effect-skatedog.jpg differ
diff --git a/public/previews/presets/mini/effect-sketch.jpg b/public/previews/presets/mini/effect-sketch.jpg
new file mode 100644
index 00000000..db53c2e5
Binary files /dev/null and b/public/previews/presets/mini/effect-sketch.jpg differ
diff --git a/public/previews/presets/mini/effect-skin-surge.jpg b/public/previews/presets/mini/effect-skin-surge.jpg
new file mode 100644
index 00000000..c3d6ed55
Binary files /dev/null and b/public/previews/presets/mini/effect-skin-surge.jpg differ
diff --git a/public/previews/presets/mini/effect-smash-and-grab.jpg b/public/previews/presets/mini/effect-smash-and-grab.jpg
new file mode 100644
index 00000000..257e8e15
Binary files /dev/null and b/public/previews/presets/mini/effect-smash-and-grab.jpg differ
diff --git a/public/previews/presets/mini/effect-smoke-transition.jpg b/public/previews/presets/mini/effect-smoke-transition.jpg
new file mode 100644
index 00000000..6e563731
Binary files /dev/null and b/public/previews/presets/mini/effect-smoke-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-sodium-decay.jpg b/public/previews/presets/mini/effect-sodium-decay.jpg
new file mode 100644
index 00000000..b9eb5443
Binary files /dev/null and b/public/previews/presets/mini/effect-sodium-decay.jpg differ
diff --git a/public/previews/presets/mini/effect-soft-cross.jpg b/public/previews/presets/mini/effect-soft-cross.jpg
new file mode 100644
index 00000000..6465877c
Binary files /dev/null and b/public/previews/presets/mini/effect-soft-cross.jpg differ
diff --git a/public/previews/presets/mini/effect-soft-palette.jpg b/public/previews/presets/mini/effect-soft-palette.jpg
new file mode 100644
index 00000000..fb8d69b4
Binary files /dev/null and b/public/previews/presets/mini/effect-soft-palette.jpg differ
diff --git a/public/previews/presets/mini/effect-soul-jump.jpg b/public/previews/presets/mini/effect-soul-jump.jpg
new file mode 100644
index 00000000..ae450532
Binary files /dev/null and b/public/previews/presets/mini/effect-soul-jump.jpg differ
diff --git a/public/previews/presets/mini/effect-spiders-from-mouth.jpg b/public/previews/presets/mini/effect-spiders-from-mouth.jpg
new file mode 100644
index 00000000..dfa39618
Binary files /dev/null and b/public/previews/presets/mini/effect-spiders-from-mouth.jpg differ
diff --git a/public/previews/presets/mini/effect-spirit-animal.jpg b/public/previews/presets/mini/effect-spirit-animal.jpg
new file mode 100644
index 00000000..39f23fc4
Binary files /dev/null and b/public/previews/presets/mini/effect-spirit-animal.jpg differ
diff --git a/public/previews/presets/mini/effect-splash-transition.jpg b/public/previews/presets/mini/effect-splash-transition.jpg
new file mode 100644
index 00000000..f585f3fd
Binary files /dev/null and b/public/previews/presets/mini/effect-splash-transition.jpg differ
diff --git a/public/previews/presets/mini/effect-squish.jpg b/public/previews/presets/mini/effect-squish.jpg
new file mode 100644
index 00000000..f5644c16
Binary files /dev/null and b/public/previews/presets/mini/effect-squish.jpg differ
diff --git a/public/previews/presets/mini/effect-starship-troopers.jpg b/public/previews/presets/mini/effect-starship-troopers.jpg
new file mode 100644
index 00000000..cb180e8e
Binary files /dev/null and b/public/previews/presets/mini/effect-starship-troopers.jpg differ
diff --git a/public/previews/presets/mini/effect-static-posing.jpg b/public/previews/presets/mini/effect-static-posing.jpg
new file mode 100644
index 00000000..73f95949
Binary files /dev/null and b/public/previews/presets/mini/effect-static-posing.jpg differ
diff --git a/public/previews/presets/mini/effect-stop-world.jpg b/public/previews/presets/mini/effect-stop-world.jpg
new file mode 100644
index 00000000..7510130c
Binary files /dev/null and b/public/previews/presets/mini/effect-stop-world.jpg differ
diff --git a/public/previews/presets/mini/effect-street-colossus.jpg b/public/previews/presets/mini/effect-street-colossus.jpg
new file mode 100644
index 00000000..5b6b750b
Binary files /dev/null and b/public/previews/presets/mini/effect-street-colossus.jpg differ
diff --git a/public/previews/presets/mini/effect-studio-slide.jpg b/public/previews/presets/mini/effect-studio-slide.jpg
new file mode 100644
index 00000000..7c2140c5
Binary files /dev/null and b/public/previews/presets/mini/effect-studio-slide.jpg differ
diff --git a/public/previews/presets/mini/effect-sunglasses.jpg b/public/previews/presets/mini/effect-sunglasses.jpg
new file mode 100644
index 00000000..ba16e894
Binary files /dev/null and b/public/previews/presets/mini/effect-sunglasses.jpg differ
diff --git a/public/previews/presets/mini/effect-super-fast-run.jpg b/public/previews/presets/mini/effect-super-fast-run.jpg
new file mode 100644
index 00000000..d2e9b62b
Binary files /dev/null and b/public/previews/presets/mini/effect-super-fast-run.jpg differ
diff --git a/public/previews/presets/mini/effect-super-saiyan.jpg b/public/previews/presets/mini/effect-super-saiyan.jpg
new file mode 100644
index 00000000..d8fbf95e
Binary files /dev/null and b/public/previews/presets/mini/effect-super-saiyan.jpg differ
diff --git a/public/previews/presets/mini/effect-superstar.jpg b/public/previews/presets/mini/effect-superstar.jpg
new file mode 100644
index 00000000..3fc37c68
Binary files /dev/null and b/public/previews/presets/mini/effect-superstar.jpg differ
diff --git a/public/previews/presets/mini/effect-tattoo-animation.jpg b/public/previews/presets/mini/effect-tattoo-animation.jpg
new file mode 100644
index 00000000..a1105101
Binary files /dev/null and b/public/previews/presets/mini/effect-tattoo-animation.jpg differ
diff --git a/public/previews/presets/mini/effect-teal-orange-epic.jpg b/public/previews/presets/mini/effect-teal-orange-epic.jpg
new file mode 100644
index 00000000..2fa51e0a
Binary files /dev/null and b/public/previews/presets/mini/effect-teal-orange-epic.jpg differ
diff --git a/public/previews/presets/mini/effect-tentacles.jpg b/public/previews/presets/mini/effect-tentacles.jpg
new file mode 100644
index 00000000..0113b891
Binary files /dev/null and b/public/previews/presets/mini/effect-tentacles.jpg differ
diff --git a/public/previews/presets/mini/effect-thunder-god.jpg b/public/previews/presets/mini/effect-thunder-god.jpg
new file mode 100644
index 00000000..820ce4a8
Binary files /dev/null and b/public/previews/presets/mini/effect-thunder-god.jpg differ
diff --git a/public/previews/presets/mini/effect-tiny-planet.jpg b/public/previews/presets/mini/effect-tiny-planet.jpg
new file mode 100644
index 00000000..05a0e9d1
Binary files /dev/null and b/public/previews/presets/mini/effect-tiny-planet.jpg differ
diff --git a/public/previews/presets/mini/effect-toxic.jpg b/public/previews/presets/mini/effect-toxic.jpg
new file mode 100644
index 00000000..089c58b7
Binary files /dev/null and b/public/previews/presets/mini/effect-toxic.jpg differ
diff --git a/public/previews/presets/mini/effect-tracking.jpg b/public/previews/presets/mini/effect-tracking.jpg
new file mode 100644
index 00000000..13c9d186
Binary files /dev/null and b/public/previews/presets/mini/effect-tracking.jpg differ
diff --git a/public/previews/presets/mini/effect-train-rush.jpg b/public/previews/presets/mini/effect-train-rush.jpg
new file mode 100644
index 00000000..d71b8531
Binary files /dev/null and b/public/previews/presets/mini/effect-train-rush.jpg differ
diff --git a/public/previews/presets/mini/effect-trucksition.jpg b/public/previews/presets/mini/effect-trucksition.jpg
new file mode 100644
index 00000000..4bc27387
Binary files /dev/null and b/public/previews/presets/mini/effect-trucksition.jpg differ
diff --git a/public/previews/presets/mini/effect-turn-into-statue.jpg b/public/previews/presets/mini/effect-turn-into-statue.jpg
new file mode 100644
index 00000000..22e6c10d
Binary files /dev/null and b/public/previews/presets/mini/effect-turn-into-statue.jpg differ
diff --git a/public/previews/presets/mini/effect-turning-metal.jpg b/public/previews/presets/mini/effect-turning-metal.jpg
new file mode 100644
index 00000000..2266036e
Binary files /dev/null and b/public/previews/presets/mini/effect-turning-metal.jpg differ
diff --git a/public/previews/presets/mini/effect-turning-monkey.jpg b/public/previews/presets/mini/effect-turning-monkey.jpg
new file mode 100644
index 00000000..2a361a30
Binary files /dev/null and b/public/previews/presets/mini/effect-turning-monkey.jpg differ
diff --git a/public/previews/presets/mini/effect-two-color.jpg b/public/previews/presets/mini/effect-two-color.jpg
new file mode 100644
index 00000000..ab213ce9
Binary files /dev/null and b/public/previews/presets/mini/effect-two-color.jpg differ
diff --git a/public/previews/presets/mini/effect-ultraviolet.jpg b/public/previews/presets/mini/effect-ultraviolet.jpg
new file mode 100644
index 00000000..009e6838
Binary files /dev/null and b/public/previews/presets/mini/effect-ultraviolet.jpg differ
diff --git a/public/previews/presets/mini/effect-vanish.jpg b/public/previews/presets/mini/effect-vanish.jpg
new file mode 100644
index 00000000..2fc1eb51
Binary files /dev/null and b/public/previews/presets/mini/effect-vanish.jpg differ
diff --git a/public/previews/presets/mini/effect-vintage.jpg b/public/previews/presets/mini/effect-vintage.jpg
new file mode 100644
index 00000000..98344475
Binary files /dev/null and b/public/previews/presets/mini/effect-vintage.jpg differ
diff --git a/public/previews/presets/mini/effect-visor-x.jpg b/public/previews/presets/mini/effect-visor-x.jpg
new file mode 100644
index 00000000..df156935
Binary files /dev/null and b/public/previews/presets/mini/effect-visor-x.jpg differ
diff --git a/public/previews/presets/mini/effect-water-bending.jpg b/public/previews/presets/mini/effect-water-bending.jpg
new file mode 100644
index 00000000..7b2d8063
Binary files /dev/null and b/public/previews/presets/mini/effect-water-bending.jpg differ
diff --git a/public/previews/presets/mini/effect-water-element.jpg b/public/previews/presets/mini/effect-water-element.jpg
new file mode 100644
index 00000000..a3185ec6
Binary files /dev/null and b/public/previews/presets/mini/effect-water-element.jpg differ
diff --git a/public/previews/presets/mini/effect-water-splash.jpg b/public/previews/presets/mini/effect-water-splash.jpg
new file mode 100644
index 00000000..2187cba7
Binary files /dev/null and b/public/previews/presets/mini/effect-water-splash.jpg differ
diff --git a/public/previews/presets/mini/effect-werewolf.jpg b/public/previews/presets/mini/effect-werewolf.jpg
new file mode 100644
index 00000000..800e98ac
Binary files /dev/null and b/public/previews/presets/mini/effect-werewolf.jpg differ
diff --git a/public/previews/presets/mini/effect-wild-ride.jpg b/public/previews/presets/mini/effect-wild-ride.jpg
new file mode 100644
index 00000000..c5a7bccb
Binary files /dev/null and b/public/previews/presets/mini/effect-wild-ride.jpg differ
diff --git a/public/previews/presets/mini/effect-wind-to-face.jpg b/public/previews/presets/mini/effect-wind-to-face.jpg
new file mode 100644
index 00000000..f64e0a3a
Binary files /dev/null and b/public/previews/presets/mini/effect-wind-to-face.jpg differ
diff --git a/public/previews/presets/mini/effect-window.jpg b/public/previews/presets/mini/effect-window.jpg
new file mode 100644
index 00000000..c5861a87
Binary files /dev/null and b/public/previews/presets/mini/effect-window.jpg differ
diff --git a/public/previews/presets/mini/effect-windows.jpg b/public/previews/presets/mini/effect-windows.jpg
new file mode 100644
index 00000000..9a22302c
Binary files /dev/null and b/public/previews/presets/mini/effect-windows.jpg differ
diff --git a/public/previews/presets/mini/effect-wireframe.jpg b/public/previews/presets/mini/effect-wireframe.jpg
new file mode 100644
index 00000000..3f36292f
Binary files /dev/null and b/public/previews/presets/mini/effect-wireframe.jpg differ
diff --git a/public/previews/presets/mini/effect-wonderland.jpg b/public/previews/presets/mini/effect-wonderland.jpg
new file mode 100644
index 00000000..27f3e77c
Binary files /dev/null and b/public/previews/presets/mini/effect-wonderland.jpg differ
diff --git a/public/previews/presets/mini/effect-world-morphing.jpg b/public/previews/presets/mini/effect-world-morphing.jpg
new file mode 100644
index 00000000..160be35f
Binary files /dev/null and b/public/previews/presets/mini/effect-world-morphing.jpg differ
diff --git a/public/previews/presets/mini/effect-x-ray.jpg b/public/previews/presets/mini/effect-x-ray.jpg
new file mode 100644
index 00000000..a2c064b6
Binary files /dev/null and b/public/previews/presets/mini/effect-x-ray.jpg differ
diff --git a/public/previews/presets/mini/effect-yacht.jpg b/public/previews/presets/mini/effect-yacht.jpg
new file mode 100644
index 00000000..b322db5f
Binary files /dev/null and b/public/previews/presets/mini/effect-yacht.jpg differ
diff --git a/public/previews/presets/mini/motion-360-orbit.jpg b/public/previews/presets/mini/motion-360-orbit.jpg
new file mode 100644
index 00000000..b899dc99
Binary files /dev/null and b/public/previews/presets/mini/motion-360-orbit.jpg differ
diff --git a/public/previews/presets/mini/motion-3d-rotation.jpg b/public/previews/presets/mini/motion-3d-rotation.jpg
new file mode 100644
index 00000000..873c825f
Binary files /dev/null and b/public/previews/presets/mini/motion-3d-rotation.jpg differ
diff --git a/public/previews/presets/mini/motion-action-run.jpg b/public/previews/presets/mini/motion-action-run.jpg
new file mode 100644
index 00000000..bef0e41d
Binary files /dev/null and b/public/previews/presets/mini/motion-action-run.jpg differ
diff --git a/public/previews/presets/mini/motion-aerial-pullback.jpg b/public/previews/presets/mini/motion-aerial-pullback.jpg
new file mode 100644
index 00000000..82915349
Binary files /dev/null and b/public/previews/presets/mini/motion-aerial-pullback.jpg differ
diff --git a/public/previews/presets/mini/motion-arc-left.jpg b/public/previews/presets/mini/motion-arc-left.jpg
new file mode 100644
index 00000000..8fce452b
Binary files /dev/null and b/public/previews/presets/mini/motion-arc-left.jpg differ
diff --git a/public/previews/presets/mini/motion-arc-right.jpg b/public/previews/presets/mini/motion-arc-right.jpg
new file mode 100644
index 00000000..1fd3ed4a
Binary files /dev/null and b/public/previews/presets/mini/motion-arc-right.jpg differ
diff --git a/public/previews/presets/mini/motion-baseball-kick.jpg b/public/previews/presets/mini/motion-baseball-kick.jpg
new file mode 100644
index 00000000..c87c3f02
Binary files /dev/null and b/public/previews/presets/mini/motion-baseball-kick.jpg differ
diff --git a/public/previews/presets/mini/motion-basketball-dunks.jpg b/public/previews/presets/mini/motion-basketball-dunks.jpg
new file mode 100644
index 00000000..0b59dad4
Binary files /dev/null and b/public/previews/presets/mini/motion-basketball-dunks.jpg differ
diff --git a/public/previews/presets/mini/motion-boxing.jpg b/public/previews/presets/mini/motion-boxing.jpg
new file mode 100644
index 00000000..11275ffb
Binary files /dev/null and b/public/previews/presets/mini/motion-boxing.jpg differ
diff --git a/public/previews/presets/mini/motion-bts.jpg b/public/previews/presets/mini/motion-bts.jpg
new file mode 100644
index 00000000..9cc6cff9
Binary files /dev/null and b/public/previews/presets/mini/motion-bts.jpg differ
diff --git a/public/previews/presets/mini/motion-buckle-up.jpg b/public/previews/presets/mini/motion-buckle-up.jpg
new file mode 100644
index 00000000..cdb8d7b2
Binary files /dev/null and b/public/previews/presets/mini/motion-buckle-up.jpg differ
diff --git a/public/previews/presets/mini/motion-bullet-time.jpg b/public/previews/presets/mini/motion-bullet-time.jpg
new file mode 100644
index 00000000..1394a86e
Binary files /dev/null and b/public/previews/presets/mini/motion-bullet-time.jpg differ
diff --git a/public/previews/presets/mini/motion-car-chasing.jpg b/public/previews/presets/mini/motion-car-chasing.jpg
new file mode 100644
index 00000000..c59e8675
Binary files /dev/null and b/public/previews/presets/mini/motion-car-chasing.jpg differ
diff --git a/public/previews/presets/mini/motion-car-grip.jpg b/public/previews/presets/mini/motion-car-grip.jpg
new file mode 100644
index 00000000..e4c655eb
Binary files /dev/null and b/public/previews/presets/mini/motion-car-grip.jpg differ
diff --git a/public/previews/presets/mini/motion-catwalk.jpg b/public/previews/presets/mini/motion-catwalk.jpg
new file mode 100644
index 00000000..148ff079
Binary files /dev/null and b/public/previews/presets/mini/motion-catwalk.jpg differ
diff --git a/public/previews/presets/mini/motion-classic-static.jpg b/public/previews/presets/mini/motion-classic-static.jpg
new file mode 100644
index 00000000..57d6e7af
Binary files /dev/null and b/public/previews/presets/mini/motion-classic-static.jpg differ
diff --git a/public/previews/presets/mini/motion-crane-down.jpg b/public/previews/presets/mini/motion-crane-down.jpg
new file mode 100644
index 00000000..72a422da
Binary files /dev/null and b/public/previews/presets/mini/motion-crane-down.jpg differ
diff --git a/public/previews/presets/mini/motion-crane-over-the-head.jpg b/public/previews/presets/mini/motion-crane-over-the-head.jpg
new file mode 100644
index 00000000..aac22297
Binary files /dev/null and b/public/previews/presets/mini/motion-crane-over-the-head.jpg differ
diff --git a/public/previews/presets/mini/motion-crane-up.jpg b/public/previews/presets/mini/motion-crane-up.jpg
new file mode 100644
index 00000000..67006b41
Binary files /dev/null and b/public/previews/presets/mini/motion-crane-up.jpg differ
diff --git a/public/previews/presets/mini/motion-crash-zoom-in.jpg b/public/previews/presets/mini/motion-crash-zoom-in.jpg
new file mode 100644
index 00000000..2605bb70
Binary files /dev/null and b/public/previews/presets/mini/motion-crash-zoom-in.jpg differ
diff --git a/public/previews/presets/mini/motion-crash-zoom-out.jpg b/public/previews/presets/mini/motion-crash-zoom-out.jpg
new file mode 100644
index 00000000..e572c285
Binary files /dev/null and b/public/previews/presets/mini/motion-crash-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/motion-documentary-snap.jpg b/public/previews/presets/mini/motion-documentary-snap.jpg
new file mode 100644
index 00000000..308ef958
Binary files /dev/null and b/public/previews/presets/mini/motion-documentary-snap.jpg differ
diff --git a/public/previews/presets/mini/motion-dolly-in.jpg b/public/previews/presets/mini/motion-dolly-in.jpg
new file mode 100644
index 00000000..f127c871
Binary files /dev/null and b/public/previews/presets/mini/motion-dolly-in.jpg differ
diff --git a/public/previews/presets/mini/motion-dolly-left.jpg b/public/previews/presets/mini/motion-dolly-left.jpg
new file mode 100644
index 00000000..2af9de40
Binary files /dev/null and b/public/previews/presets/mini/motion-dolly-left.jpg differ
diff --git a/public/previews/presets/mini/motion-dolly-out.jpg b/public/previews/presets/mini/motion-dolly-out.jpg
new file mode 100644
index 00000000..9d5170de
Binary files /dev/null and b/public/previews/presets/mini/motion-dolly-out.jpg differ
diff --git a/public/previews/presets/mini/motion-dolly-right.jpg b/public/previews/presets/mini/motion-dolly-right.jpg
new file mode 100644
index 00000000..454efcf4
Binary files /dev/null and b/public/previews/presets/mini/motion-dolly-right.jpg differ
diff --git a/public/previews/presets/mini/motion-dolly-zoom-in.jpg b/public/previews/presets/mini/motion-dolly-zoom-in.jpg
new file mode 100644
index 00000000..24acc68b
Binary files /dev/null and b/public/previews/presets/mini/motion-dolly-zoom-in.jpg differ
diff --git a/public/previews/presets/mini/motion-dolly-zoom-out.jpg b/public/previews/presets/mini/motion-dolly-zoom-out.jpg
new file mode 100644
index 00000000..7f43f57f
Binary files /dev/null and b/public/previews/presets/mini/motion-dolly-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/motion-double-dolly.jpg b/public/previews/presets/mini/motion-double-dolly.jpg
new file mode 100644
index 00000000..eb778f00
Binary files /dev/null and b/public/previews/presets/mini/motion-double-dolly.jpg differ
diff --git a/public/previews/presets/mini/motion-downhill-pov.jpg b/public/previews/presets/mini/motion-downhill-pov.jpg
new file mode 100644
index 00000000..9ae416b1
Binary files /dev/null and b/public/previews/presets/mini/motion-downhill-pov.jpg differ
diff --git a/public/previews/presets/mini/motion-dreamy-flow.jpg b/public/previews/presets/mini/motion-dreamy-flow.jpg
new file mode 100644
index 00000000..48ea5681
Binary files /dev/null and b/public/previews/presets/mini/motion-dreamy-flow.jpg differ
diff --git a/public/previews/presets/mini/motion-drone-reveal.jpg b/public/previews/presets/mini/motion-drone-reveal.jpg
new file mode 100644
index 00000000..fbf6d086
Binary files /dev/null and b/public/previews/presets/mini/motion-drone-reveal.jpg differ
diff --git a/public/previews/presets/mini/motion-dutch-angle.jpg b/public/previews/presets/mini/motion-dutch-angle.jpg
new file mode 100644
index 00000000..8032660c
Binary files /dev/null and b/public/previews/presets/mini/motion-dutch-angle.jpg differ
diff --git a/public/previews/presets/mini/motion-earth-zoom-out.jpg b/public/previews/presets/mini/motion-earth-zoom-out.jpg
new file mode 100644
index 00000000..391fd62f
Binary files /dev/null and b/public/previews/presets/mini/motion-earth-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/motion-eating-zoom.jpg b/public/previews/presets/mini/motion-eating-zoom.jpg
new file mode 100644
index 00000000..4859fcad
Binary files /dev/null and b/public/previews/presets/mini/motion-eating-zoom.jpg differ
diff --git a/public/previews/presets/mini/motion-epic-scale.jpg b/public/previews/presets/mini/motion-epic-scale.jpg
new file mode 100644
index 00000000..44bafa65
Binary files /dev/null and b/public/previews/presets/mini/motion-epic-scale.jpg differ
diff --git a/public/previews/presets/mini/motion-eyes-in.jpg b/public/previews/presets/mini/motion-eyes-in.jpg
new file mode 100644
index 00000000..48544f7c
Binary files /dev/null and b/public/previews/presets/mini/motion-eyes-in.jpg differ
diff --git a/public/previews/presets/mini/motion-face-punch.jpg b/public/previews/presets/mini/motion-face-punch.jpg
new file mode 100644
index 00000000..cf40a6da
Binary files /dev/null and b/public/previews/presets/mini/motion-face-punch.jpg differ
diff --git a/public/previews/presets/mini/motion-fisheye.jpg b/public/previews/presets/mini/motion-fisheye.jpg
new file mode 100644
index 00000000..f84b9e8b
Binary files /dev/null and b/public/previews/presets/mini/motion-fisheye.jpg differ
diff --git a/public/previews/presets/mini/motion-flying-cam-transition.jpg b/public/previews/presets/mini/motion-flying-cam-transition.jpg
new file mode 100644
index 00000000..a27aa92e
Binary files /dev/null and b/public/previews/presets/mini/motion-flying-cam-transition.jpg differ
diff --git a/public/previews/presets/mini/motion-flying.jpg b/public/previews/presets/mini/motion-flying.jpg
new file mode 100644
index 00000000..a2d487ec
Binary files /dev/null and b/public/previews/presets/mini/motion-flying.jpg differ
diff --git a/public/previews/presets/mini/motion-focus-change.jpg b/public/previews/presets/mini/motion-focus-change.jpg
new file mode 100644
index 00000000..3c4e6bdb
Binary files /dev/null and b/public/previews/presets/mini/motion-focus-change.jpg differ
diff --git a/public/previews/presets/mini/motion-fpv-drone.jpg b/public/previews/presets/mini/motion-fpv-drone.jpg
new file mode 100644
index 00000000..d4d84172
Binary files /dev/null and b/public/previews/presets/mini/motion-fpv-drone.jpg differ
diff --git a/public/previews/presets/mini/motion-general.jpg b/public/previews/presets/mini/motion-general.jpg
new file mode 100644
index 00000000..71d7eb82
Binary files /dev/null and b/public/previews/presets/mini/motion-general.jpg differ
diff --git a/public/previews/presets/mini/motion-glam.jpg b/public/previews/presets/mini/motion-glam.jpg
new file mode 100644
index 00000000..d2fbbc86
Binary files /dev/null and b/public/previews/presets/mini/motion-glam.jpg differ
diff --git a/public/previews/presets/mini/motion-handheld.jpg b/public/previews/presets/mini/motion-handheld.jpg
new file mode 100644
index 00000000..434c2902
Binary files /dev/null and b/public/previews/presets/mini/motion-handheld.jpg differ
diff --git a/public/previews/presets/mini/motion-head-tracking.jpg b/public/previews/presets/mini/motion-head-tracking.jpg
new file mode 100644
index 00000000..b9775e79
Binary files /dev/null and b/public/previews/presets/mini/motion-head-tracking.jpg differ
diff --git a/public/previews/presets/mini/motion-helicopter-shot.jpg b/public/previews/presets/mini/motion-helicopter-shot.jpg
new file mode 100644
index 00000000..b859497b
Binary files /dev/null and b/public/previews/presets/mini/motion-helicopter-shot.jpg differ
diff --git a/public/previews/presets/mini/motion-hero-cam.jpg b/public/previews/presets/mini/motion-hero-cam.jpg
new file mode 100644
index 00000000..d4cd087f
Binary files /dev/null and b/public/previews/presets/mini/motion-hero-cam.jpg differ
diff --git a/public/previews/presets/mini/motion-hyperlapse.jpg b/public/previews/presets/mini/motion-hyperlapse.jpg
new file mode 100644
index 00000000..ae3fe1f8
Binary files /dev/null and b/public/previews/presets/mini/motion-hyperlapse.jpg differ
diff --git a/public/previews/presets/mini/motion-impossible-camera.jpg b/public/previews/presets/mini/motion-impossible-camera.jpg
new file mode 100644
index 00000000..671a55a4
Binary files /dev/null and b/public/previews/presets/mini/motion-impossible-camera.jpg differ
diff --git a/public/previews/presets/mini/motion-incline.jpg b/public/previews/presets/mini/motion-incline.jpg
new file mode 100644
index 00000000..106efc7c
Binary files /dev/null and b/public/previews/presets/mini/motion-incline.jpg differ
diff --git a/public/previews/presets/mini/motion-intimate-observer.jpg b/public/previews/presets/mini/motion-intimate-observer.jpg
new file mode 100644
index 00000000..a442b838
Binary files /dev/null and b/public/previews/presets/mini/motion-intimate-observer.jpg differ
diff --git a/public/previews/presets/mini/motion-jib-down.jpg b/public/previews/presets/mini/motion-jib-down.jpg
new file mode 100644
index 00000000..1c035b2f
Binary files /dev/null and b/public/previews/presets/mini/motion-jib-down.jpg differ
diff --git a/public/previews/presets/mini/motion-jib-up.jpg b/public/previews/presets/mini/motion-jib-up.jpg
new file mode 100644
index 00000000..15aed97a
Binary files /dev/null and b/public/previews/presets/mini/motion-jib-up.jpg differ
diff --git a/public/previews/presets/mini/motion-kiss.jpg b/public/previews/presets/mini/motion-kiss.jpg
new file mode 100644
index 00000000..411ea6e1
Binary files /dev/null and b/public/previews/presets/mini/motion-kiss.jpg differ
diff --git a/public/previews/presets/mini/motion-lazy-orbit.jpg b/public/previews/presets/mini/motion-lazy-orbit.jpg
new file mode 100644
index 00000000..c148ed09
Binary files /dev/null and b/public/previews/presets/mini/motion-lazy-orbit.jpg differ
diff --git a/public/previews/presets/mini/motion-lazy-susan.jpg b/public/previews/presets/mini/motion-lazy-susan.jpg
new file mode 100644
index 00000000..997b3840
Binary files /dev/null and b/public/previews/presets/mini/motion-lazy-susan.jpg differ
diff --git a/public/previews/presets/mini/motion-low-shutter.jpg b/public/previews/presets/mini/motion-low-shutter.jpg
new file mode 100644
index 00000000..483b5844
Binary files /dev/null and b/public/previews/presets/mini/motion-low-shutter.jpg differ
diff --git a/public/previews/presets/mini/motion-moonwalk-left.jpg b/public/previews/presets/mini/motion-moonwalk-left.jpg
new file mode 100644
index 00000000..42faae9f
Binary files /dev/null and b/public/previews/presets/mini/motion-moonwalk-left.jpg differ
diff --git a/public/previews/presets/mini/motion-moonwalk-right.jpg b/public/previews/presets/mini/motion-moonwalk-right.jpg
new file mode 100644
index 00000000..3daa7084
Binary files /dev/null and b/public/previews/presets/mini/motion-moonwalk-right.jpg differ
diff --git a/public/previews/presets/mini/motion-mouth-in.jpg b/public/previews/presets/mini/motion-mouth-in.jpg
new file mode 100644
index 00000000..68923ca8
Binary files /dev/null and b/public/previews/presets/mini/motion-mouth-in.jpg differ
diff --git a/public/previews/presets/mini/motion-object-pov.jpg b/public/previews/presets/mini/motion-object-pov.jpg
new file mode 100644
index 00000000..10dd1826
Binary files /dev/null and b/public/previews/presets/mini/motion-object-pov.jpg differ
diff --git a/public/previews/presets/mini/motion-one-take.jpg b/public/previews/presets/mini/motion-one-take.jpg
new file mode 100644
index 00000000..d1296f23
Binary files /dev/null and b/public/previews/presets/mini/motion-one-take.jpg differ
diff --git a/public/previews/presets/mini/motion-overhead.jpg b/public/previews/presets/mini/motion-overhead.jpg
new file mode 100644
index 00000000..6ce098ed
Binary files /dev/null and b/public/previews/presets/mini/motion-overhead.jpg differ
diff --git a/public/previews/presets/mini/motion-pan-left.jpg b/public/previews/presets/mini/motion-pan-left.jpg
new file mode 100644
index 00000000..59b4e23b
Binary files /dev/null and b/public/previews/presets/mini/motion-pan-left.jpg differ
diff --git a/public/previews/presets/mini/motion-pan-right.jpg b/public/previews/presets/mini/motion-pan-right.jpg
new file mode 100644
index 00000000..3148d758
Binary files /dev/null and b/public/previews/presets/mini/motion-pan-right.jpg differ
diff --git a/public/previews/presets/mini/motion-pan.jpg b/public/previews/presets/mini/motion-pan.jpg
new file mode 100644
index 00000000..3059651d
Binary files /dev/null and b/public/previews/presets/mini/motion-pan.jpg differ
diff --git a/public/previews/presets/mini/motion-pedestal-down.jpg b/public/previews/presets/mini/motion-pedestal-down.jpg
new file mode 100644
index 00000000..3bfb8578
Binary files /dev/null and b/public/previews/presets/mini/motion-pedestal-down.jpg differ
diff --git a/public/previews/presets/mini/motion-pov.jpg b/public/previews/presets/mini/motion-pov.jpg
new file mode 100644
index 00000000..b6ae859d
Binary files /dev/null and b/public/previews/presets/mini/motion-pov.jpg differ
diff --git a/public/previews/presets/mini/motion-rap-flex.jpg b/public/previews/presets/mini/motion-rap-flex.jpg
new file mode 100644
index 00000000..ed5fa422
Binary files /dev/null and b/public/previews/presets/mini/motion-rap-flex.jpg differ
diff --git a/public/previews/presets/mini/motion-rapid-zoom-in.jpg b/public/previews/presets/mini/motion-rapid-zoom-in.jpg
new file mode 100644
index 00000000..34a983cc
Binary files /dev/null and b/public/previews/presets/mini/motion-rapid-zoom-in.jpg differ
diff --git a/public/previews/presets/mini/motion-rapid-zoom-out.jpg b/public/previews/presets/mini/motion-rapid-zoom-out.jpg
new file mode 100644
index 00000000..2c93c3fe
Binary files /dev/null and b/public/previews/presets/mini/motion-rapid-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/motion-raw-chaos.jpg b/public/previews/presets/mini/motion-raw-chaos.jpg
new file mode 100644
index 00000000..f2964a2d
Binary files /dev/null and b/public/previews/presets/mini/motion-raw-chaos.jpg differ
diff --git a/public/previews/presets/mini/motion-road-rush.jpg b/public/previews/presets/mini/motion-road-rush.jpg
new file mode 100644
index 00000000..0000eedf
Binary files /dev/null and b/public/previews/presets/mini/motion-road-rush.jpg differ
diff --git a/public/previews/presets/mini/motion-robo-arm.jpg b/public/previews/presets/mini/motion-robo-arm.jpg
new file mode 100644
index 00000000..5620a760
Binary files /dev/null and b/public/previews/presets/mini/motion-robo-arm.jpg differ
diff --git a/public/previews/presets/mini/motion-robot-arm.jpg b/public/previews/presets/mini/motion-robot-arm.jpg
new file mode 100644
index 00000000..80ce2e4d
Binary files /dev/null and b/public/previews/presets/mini/motion-robot-arm.jpg differ
diff --git a/public/previews/presets/mini/motion-roll-transition.jpg b/public/previews/presets/mini/motion-roll-transition.jpg
new file mode 100644
index 00000000..fc56201c
Binary files /dev/null and b/public/previews/presets/mini/motion-roll-transition.jpg differ
diff --git a/public/previews/presets/mini/motion-silent-machine.jpg b/public/previews/presets/mini/motion-silent-machine.jpg
new file mode 100644
index 00000000..52659eb6
Binary files /dev/null and b/public/previews/presets/mini/motion-silent-machine.jpg differ
diff --git a/public/previews/presets/mini/motion-skate-cruise.jpg b/public/previews/presets/mini/motion-skate-cruise.jpg
new file mode 100644
index 00000000..a69b817c
Binary files /dev/null and b/public/previews/presets/mini/motion-skate-cruise.jpg differ
diff --git a/public/previews/presets/mini/motion-skateboard-glide.jpg b/public/previews/presets/mini/motion-skateboard-glide.jpg
new file mode 100644
index 00000000..dfb82a88
Binary files /dev/null and b/public/previews/presets/mini/motion-skateboard-glide.jpg differ
diff --git a/public/previews/presets/mini/motion-skateboard-ollie.jpg b/public/previews/presets/mini/motion-skateboard-ollie.jpg
new file mode 100644
index 00000000..a11aa67c
Binary files /dev/null and b/public/previews/presets/mini/motion-skateboard-ollie.jpg differ
diff --git a/public/previews/presets/mini/motion-ski-carving.jpg b/public/previews/presets/mini/motion-ski-carving.jpg
new file mode 100644
index 00000000..96465a83
Binary files /dev/null and b/public/previews/presets/mini/motion-ski-carving.jpg differ
diff --git a/public/previews/presets/mini/motion-ski-powder.jpg b/public/previews/presets/mini/motion-ski-powder.jpg
new file mode 100644
index 00000000..c1bbecff
Binary files /dev/null and b/public/previews/presets/mini/motion-ski-powder.jpg differ
diff --git a/public/previews/presets/mini/motion-slow-motion.jpg b/public/previews/presets/mini/motion-slow-motion.jpg
new file mode 100644
index 00000000..bf31a40a
Binary files /dev/null and b/public/previews/presets/mini/motion-slow-motion.jpg differ
diff --git a/public/previews/presets/mini/motion-snorricam.jpg b/public/previews/presets/mini/motion-snorricam.jpg
new file mode 100644
index 00000000..3d32ffd7
Binary files /dev/null and b/public/previews/presets/mini/motion-snorricam.jpg differ
diff --git a/public/previews/presets/mini/motion-snowboard-carving.jpg b/public/previews/presets/mini/motion-snowboard-carving.jpg
new file mode 100644
index 00000000..89664e37
Binary files /dev/null and b/public/previews/presets/mini/motion-snowboard-carving.jpg differ
diff --git a/public/previews/presets/mini/motion-snowboard-powder.jpg b/public/previews/presets/mini/motion-snowboard-powder.jpg
new file mode 100644
index 00000000..6b77e52a
Binary files /dev/null and b/public/previews/presets/mini/motion-snowboard-powder.jpg differ
diff --git a/public/previews/presets/mini/motion-static.jpg b/public/previews/presets/mini/motion-static.jpg
new file mode 100644
index 00000000..9068a73e
Binary files /dev/null and b/public/previews/presets/mini/motion-static.jpg differ
diff --git a/public/previews/presets/mini/motion-super-dolly-in.jpg b/public/previews/presets/mini/motion-super-dolly-in.jpg
new file mode 100644
index 00000000..8bbd83b4
Binary files /dev/null and b/public/previews/presets/mini/motion-super-dolly-in.jpg differ
diff --git a/public/previews/presets/mini/motion-super-dolly-out.jpg b/public/previews/presets/mini/motion-super-dolly-out.jpg
new file mode 100644
index 00000000..d5e91f32
Binary files /dev/null and b/public/previews/presets/mini/motion-super-dolly-out.jpg differ
diff --git a/public/previews/presets/mini/motion-through-object-in.jpg b/public/previews/presets/mini/motion-through-object-in.jpg
new file mode 100644
index 00000000..c6478905
Binary files /dev/null and b/public/previews/presets/mini/motion-through-object-in.jpg differ
diff --git a/public/previews/presets/mini/motion-through-object-out.jpg b/public/previews/presets/mini/motion-through-object-out.jpg
new file mode 100644
index 00000000..e8be6f17
Binary files /dev/null and b/public/previews/presets/mini/motion-through-object-out.jpg differ
diff --git a/public/previews/presets/mini/motion-tilt-down.jpg b/public/previews/presets/mini/motion-tilt-down.jpg
new file mode 100644
index 00000000..f13a41a4
Binary files /dev/null and b/public/previews/presets/mini/motion-tilt-down.jpg differ
diff --git a/public/previews/presets/mini/motion-tilt-up.jpg b/public/previews/presets/mini/motion-tilt-up.jpg
new file mode 100644
index 00000000..823e670f
Binary files /dev/null and b/public/previews/presets/mini/motion-tilt-up.jpg differ
diff --git a/public/previews/presets/mini/motion-timelapse-glam.jpg b/public/previews/presets/mini/motion-timelapse-glam.jpg
new file mode 100644
index 00000000..f6c958f5
Binary files /dev/null and b/public/previews/presets/mini/motion-timelapse-glam.jpg differ
diff --git a/public/previews/presets/mini/motion-timelapse-human.jpg b/public/previews/presets/mini/motion-timelapse-human.jpg
new file mode 100644
index 00000000..3fb901f9
Binary files /dev/null and b/public/previews/presets/mini/motion-timelapse-human.jpg differ
diff --git a/public/previews/presets/mini/motion-timelapse-landscape.jpg b/public/previews/presets/mini/motion-timelapse-landscape.jpg
new file mode 100644
index 00000000..55126566
Binary files /dev/null and b/public/previews/presets/mini/motion-timelapse-landscape.jpg differ
diff --git a/public/previews/presets/mini/motion-timelapse.jpg b/public/previews/presets/mini/motion-timelapse.jpg
new file mode 100644
index 00000000..3ccec649
Binary files /dev/null and b/public/previews/presets/mini/motion-timelapse.jpg differ
diff --git a/public/previews/presets/mini/motion-tracking.jpg b/public/previews/presets/mini/motion-tracking.jpg
new file mode 100644
index 00000000..19744df4
Binary files /dev/null and b/public/previews/presets/mini/motion-tracking.jpg differ
diff --git a/public/previews/presets/mini/motion-truck-left.jpg b/public/previews/presets/mini/motion-truck-left.jpg
new file mode 100644
index 00000000..a88b7547
Binary files /dev/null and b/public/previews/presets/mini/motion-truck-left.jpg differ
diff --git a/public/previews/presets/mini/motion-truck-right.jpg b/public/previews/presets/mini/motion-truck-right.jpg
new file mode 100644
index 00000000..d7ccdd07
Binary files /dev/null and b/public/previews/presets/mini/motion-truck-right.jpg differ
diff --git a/public/previews/presets/mini/motion-whip-pan.jpg b/public/previews/presets/mini/motion-whip-pan.jpg
new file mode 100644
index 00000000..e1621f6b
Binary files /dev/null and b/public/previews/presets/mini/motion-whip-pan.jpg differ
diff --git a/public/previews/presets/mini/motion-wiggle.jpg b/public/previews/presets/mini/motion-wiggle.jpg
new file mode 100644
index 00000000..880de777
Binary files /dev/null and b/public/previews/presets/mini/motion-wiggle.jpg differ
diff --git a/public/previews/presets/mini/motion-yoyo-zoom.jpg b/public/previews/presets/mini/motion-yoyo-zoom.jpg
new file mode 100644
index 00000000..f585007c
Binary files /dev/null and b/public/previews/presets/mini/motion-yoyo-zoom.jpg differ
diff --git a/public/previews/presets/mini/motion-zoom-in.jpg b/public/previews/presets/mini/motion-zoom-in.jpg
new file mode 100644
index 00000000..73544e4d
Binary files /dev/null and b/public/previews/presets/mini/motion-zoom-in.jpg differ
diff --git a/public/previews/presets/mini/motion-zoom-out.jpg b/public/previews/presets/mini/motion-zoom-out.jpg
new file mode 100644
index 00000000..1382d6b6
Binary files /dev/null and b/public/previews/presets/mini/motion-zoom-out.jpg differ
diff --git a/public/previews/presets/mini/motion-zoom.jpg b/public/previews/presets/mini/motion-zoom.jpg
new file mode 100644
index 00000000..b4ea224d
Binary files /dev/null and b/public/previews/presets/mini/motion-zoom.jpg differ
diff --git a/scripts/eval/lib/covers.mjs b/scripts/eval/lib/covers.mjs
index d94ef628..6e5472a1 100644
--- a/scripts/eval/lib/covers.mjs
+++ b/scripts/eval/lib/covers.mjs
@@ -37,6 +37,52 @@ const THUMB_PX = 320;
/** Where a poster's small copy goes: thumbs/ next to it (the pickers read it there: thumbOf, src/lib/preset-covers.ts). */
export const thumbOf = (poster) => poster.replace(/\/([^/]+)$/, "/thumbs/$1");
+/** Width of a poster's smallest copy (px): the menus' 36 px rows and the phone's 52 px tiles, on a 2x screen. */
+const MINI_PX = 96;
+/** Where that copy goes: mini/ next to the poster, with the poster's version (miniOf, src/lib/preset-cards.ts). */
+export const miniOf = (poster) => poster.replace(/\/([^/]+)$/, "/mini/$1");
+/** The posters that get a mini copy: a preset's own, at /previews/presets/<id>.jpg (not its peak frame, not a template's). */
+const MINI_POSTER = /^\/previews\/presets\/[^/]+\.jpg(\?|$)/;
+
+/**
+ * Which presets have a mini copy, each with the content version of the poster it was made from (contentVersion of the
+ * poster alone): the menus show a mini only for a preset listed here, and a test checks each version against its
+ * poster, so a mini never shows an old picture under its poster's new version. Kept by writeThumbs.
+ */
+export const MINIS_FILE = path.join(REPO_DIR, "src", "lib", "preset-minis.generated.ts");
+const MINIS_HEADER = `/**
+ * The presets whose poster has its 96 px copy for the bar's menus (public/previews/presets/mini/<id>.jpg), each with
+ * the content version of the poster it was made from. The menus show a mini only for a preset listed here; a test
+ * checks every version against its poster. Generated by pnpm eval:covers (writeThumbs): run it again rather than
+ * editing.
+ */
+export const PRESET_MINIS: Record<string, string> = `;
+
+/** The minis list next to a public dir: the repo's for the repo's public/, else a file in that dir (a test's). */
+const minisFileFor = (publicDir) =>
+ path.resolve(publicDir) === path.resolve(path.dirname(COVERS_DIR)) ? MINIS_FILE : path.join(publicDir, "preset-minis.generated.ts");
+
+/** The minis list (id: the version of the poster each mini was made from); empty when there is none yet. */
+export function readMinis(file = MINIS_FILE) {
+ try {
+ const text = fs.readFileSync(file, "utf8");
+ return JSON.parse(
+ text
+ .slice(text.indexOf("=", text.indexOf("PRESET_MINIS")) + 1)
+ .trim()
+ .replace(/;\s*$/, ""),
+ );
+ } catch {
+ return {};
+ }
+}
+
+function writeMinis(minis, file) {
+ const sorted = Object.fromEntries(Object.entries(minis).sort(([a], [b]) => a.localeCompare(b)));
+ fs.mkdirSync(path.dirname(file), { recursive: true });
+ fs.writeFileSync(file, `${MINIS_HEADER}${JSON.stringify(sorted, null, 2)};\n`);
+}
+
/** A cover URL: the file's path, then `?v=` and its content version, 8 hex digits (none before it's versioned). */
const VERSIONED = /^([^?]*)(?:\?v=([0-9a-f]{8}))?$/;
/** A cover URL's path, without its version. */
@@ -185,28 +231,42 @@ export function versionCovers(opts = {}) {
return result;
}
-/** The listed posters whose small copy is missing or older than the poster: the ones writeThumbs makes. */
+/**
+ * The listed posters' small copies that are due: the pickers' (THUMB_PX in thumbs/) when missing or older than the
+ * poster, the menus' (MINI_PX in mini/) when missing or made from another version of the poster (the minis list: a
+ * file's time says nothing after a checkout). The ones writeThumbs makes.
+ */
function dueThumbs(entries, publicDir) {
+ const minis = readMinis(minisFileFor(publicDir));
const due = [];
- for (const e of Object.values(entries)) {
+ for (const [id, e] of Object.entries(entries)) {
const poster = previewFile(e.poster, publicDir);
- const thumb = previewFile(typeof e.poster === "string" && thumbOf(e.poster), publicDir);
- if (poster && thumb && fs.existsSync(poster) && !newer(thumb, poster)) due.push({ poster, thumb });
+ if (!poster || typeof e.poster !== "string" || !fs.existsSync(poster)) continue;
+ const thumb = previewFile(thumbOf(e.poster), publicDir);
+ if (thumb && !newer(thumb, poster)) due.push({ poster, thumb, px: THUMB_PX });
+ // The mini copy is a preset poster's only (/previews/presets/<id>.jpg): the menus show no other cover that small.
+ const mini = MINI_POSTER.test(e.poster) && previewFile(miniOf(e.poster), publicDir);
+ if (mini && (!fs.existsSync(mini) || minis[id] !== contentVersion([poster]))) due.push({ poster, thumb: mini, px: MINI_PX, mini: id });
}
return due;
}
/**
- * Make the small copy of every listed poster that the pickers' tiles show (thumbOf: THUMB_PX wide, about 5 to 12 KB
- * where the poster is 40 to 70), where it's missing or older than its poster. Returns the files it made.
+ * Make the small copies of every listed poster: the one the pickers' tiles show (thumbOf: THUMB_PX wide, about 5 to 12
+ * KB where the poster is 40 to 70) and the menus' rows (miniOf: MINI_PX wide, 2 to 4 KB), where either is missing or
+ * older than its poster. Returns the files it made.
*/
export function writeThumbs(entries, publicDir = path.dirname(COVERS_DIR)) {
const made = [];
- for (const { poster, thumb } of dueThumbs(entries, publicDir)) {
+ const file = minisFileFor(publicDir);
+ const minis = readMinis(file);
+ for (const { poster, thumb, px, mini } of dueThumbs(entries, publicDir)) {
fs.mkdirSync(path.dirname(thumb), { recursive: true });
- run(["-i", poster, "-vf", `scale='min(${THUMB_PX},iw)':-2,format=yuvj420p`, "-frames:v", "1", "-q:v", "5", thumb]);
+ run(["-i", poster, "-vf", `scale='min(${px},iw)':-2,format=yuvj420p`, "-frames:v", "1", "-q:v", "5", thumb]);
made.push(thumb);
+ if (mini) minis[mini] = contentVersion([poster]);
}
+ if (made.some((f) => path.basename(path.dirname(f)) === "mini")) writeMinis(minis, file);
return made;
}
diff --git a/src/app/api/canvases/template-models/route.ts b/src/app/api/canvases/template-models/route.ts
new file mode 100644
index 00000000..006b2804
--- /dev/null
+++ b/src/app/api/canvases/template-models/route.ts
@@ -0,0 +1,12 @@
+import { connection } from "next/server";
+import { templateModels } from "@/lib/canvas-template-cards";
+
+/**
+ * The model names each Canvas template runs on, per engine: the owner's (their cards' and template pages' model line).
+ * Not a guest read (src/lib/guest-access.ts), so a visitor or an account gets 401 from the proxy: the names never come
+ * with a page.
+ */
+export async function GET() {
+ await connection();
+ return Response.json(templateModels());
+}
diff --git a/src/app/nav-menus/apps/route.ts b/src/app/nav-menus/apps/route.ts
new file mode 100644
index 00000000..f6a1c8bd
--- /dev/null
+++ b/src/app/nav-menus/apps/route.ts
@@ -0,0 +1,10 @@
+import { packMenu } from "@/lib/mega-menus";
+import { SERVER_MENUS } from "@/lib/mega-menus.server";
+
+/**
+ * The bar's apps menu as data (src/lib/mega-menus.server.ts): read from the catalog and the covers at build time and
+ * served as a static file, fetched the first time the menu warms (src/components/nav/mega-data.ts).
+ */
+export function GET() {
+ return Response.json(packMenu(SERVER_MENUS.apps()));
+}
diff --git a/src/app/nav-menus/canvas/route.ts b/src/app/nav-menus/canvas/route.ts
new file mode 100644
index 00000000..6b6a57dd
--- /dev/null
+++ b/src/app/nav-menus/canvas/route.ts
@@ -0,0 +1,10 @@
+import { packMenu } from "@/lib/mega-menus";
+import { SERVER_MENUS } from "@/lib/mega-menus.server";
+
+/**
+ * The bar's canvas menu as data (src/lib/mega-menus.server.ts): read from the catalog and the covers at build time and
+ * served as a static file, fetched the first time the menu warms (src/components/nav/mega-data.ts).
+ */
+export function GET() {
+ return Response.json(packMenu(SERVER_MENUS.canvas()));
+}
diff --git a/src/app/nav-menus/motions/route.ts b/src/app/nav-menus/motions/route.ts
new file mode 100644
index 00000000..1b62ca3c
--- /dev/null
+++ b/src/app/nav-menus/motions/route.ts
@@ -0,0 +1,10 @@
+import { packMenu } from "@/lib/mega-menus";
+import { SERVER_MENUS } from "@/lib/mega-menus.server";
+
+/**
+ * The bar's motions menu as data (src/lib/mega-menus.server.ts): read from the catalog and the covers at build time and
+ * served as a static file, fetched the first time the menu warms (src/components/nav/mega-data.ts).
+ */
+export function GET() {
+ return Response.json(packMenu(SERVER_MENUS.motions()));
+}
diff --git a/src/components/canvas/template-card.tsx b/src/components/canvas/template-card.tsx
index bd9036c2..2a7c1413 100644
--- a/src/components/canvas/template-card.tsx
+++ b/src/components/canvas/template-card.tsx
@@ -7,11 +7,12 @@ import { StarterCard } from "@/components/starters/starter-card";
// Types only: the catalog (models, templates) stays on the server; the pages pass slim template cards.
import type { CanvasNodeType, Outline } from "@/lib/catalog/canvas";
import type { Engine } from "@/lib/catalog/types";
-import type { TemplateCardData } from "@/lib/canvas-sections";
+import type { TemplateCardData, TemplateModels } from "@/lib/canvas-sections";
import { offered, type AccessSummary } from "@/lib/model-access";
import { templateCover } from "@/lib/template-covers";
import { cn } from "@/lib/utils";
import { NodeIcon } from "./node-icon";
+import { useTemplateModels } from "./use-canvas";
const BOX = { w: 280, h: 150 };
@@ -73,10 +74,10 @@ export function Schematic({ outline: o, className, labeled = false }: { outline:
);
}
-/** A starter's steps as a few words on dark glass ("Photo › Scene › Film"), over its cover's corner. */
+/** A starter's steps as a few words ("Photo › Scene › Film"): a small muted line under its title, never over its cover. */
export function StepFlow({ steps, className }: { steps: string[]; className?: string }) {
return (
- <span className={cn("pointer-events-none inline-flex items-center gap-0.5 rounded-full bg-black/60 px-2 py-0.5 text-[11px] leading-5 font-medium text-white backdrop-blur-sm", className)} aria-hidden>
+ <span data-step-flow className={cn("pointer-events-none inline-flex flex-wrap items-center gap-0.5 text-[12px] leading-4 font-medium text-muted-foreground", className)} aria-hidden>
{steps.map((s, i) => (
<Fragment key={s}>
{i > 0 && <ChevronRight className="size-3 opacity-70" />}
@@ -87,15 +88,34 @@ export function StepFlow({ steps, className }: { steps: string[]; className?: st
);
}
+/**
+ * A card that has no cover yet, as the owner sees it (a visitor never gets one): its tint and its icon large in the middle
+ * (and its steps under it, on its page), instead of the board in miniature.
+ */
+export function CoverPlaceholder({ icon, steps }: { icon: string; steps?: string[] }) {
+ return (
+ <div className="flex size-full flex-col items-center justify-center gap-2 text-foreground/70">
+ <span className="grid size-12 place-items-center rounded-2xl bg-background/80 shadow-soft">
+ <NodeIcon name={icon} className="size-6" />
+ </span>
+ {steps && <StepFlow steps={steps} className="justify-center" />}
+ </div>
+ );
+}
+
/** The model names a card shows as this install offers them: a model that is off shows the one its node falls back to. */
-export function offeredNames({ models, ifOff }: TemplateCardData["byEngine"][Engine], access: AccessSummary | undefined, engine: Engine): string[] {
+export function offeredNames({ models, ifOff }: TemplateModels[Engine], access: AccessSummary | undefined, engine: Engine): string[] {
if (!ifOff || !access) return models;
return [...new Set(models.map((m) => ifOff.find((x) => x.name === m && !offered(access, x.id, engine))?.instead ?? m))];
}
-/** The owner's line under a card or a template's steps: the models it runs on, and free on the owner's GPU. */
+/**
+ * The owner's line under a card or a template's steps: the models it runs on, and free on the owner's GPU. The names
+ * come from the owner's own request (useTemplateModels), never with the page: a line's height is kept while they load.
+ */
export function ModelLine({ t, engine, access, className }: { t: TemplateCardData; engine: Engine; access?: AccessSummary; className?: string }) {
- const models = offeredNames(t.byEngine[engine], access, engine);
+ const on = useTemplateModels().data?.[t.id]?.[engine];
+ const models = on ? offeredNames(on, access, engine) : [];
return (
<p className={cn("flex items-start gap-1.5 text-[12px] text-muted-foreground", className)}>
{engine === "open" ? <Cpu className="mt-px size-3.5 shrink-0" /> : <Cloud className="mt-px size-3.5 shrink-0" />}
@@ -113,14 +133,13 @@ export function ModelLine({ t, engine, access, className }: { t: TemplateCardDat
*/
export function TemplateCard({ t, engine, onUse, busy, access, owner = false }: { t: TemplateCardData; engine: Engine; onUse?: () => void; busy: boolean; access?: AccessSummary; owner?: boolean }) {
const cover = templateCover("canvas", t.id);
- const { outline } = t.byEngine[engine];
return (
<StarterCard
coverKey={`canvas/${t.id}`}
cover={cover}
hue={t.hue}
flow={<StepFlow steps={t.flow} />}
- overlay={<Schematic outline={outline} className="p-4" />}
+ overlay={<CoverPlaceholder icon={t.icon} />}
icon={<NodeIcon name={t.icon} className="size-4" />}
title={t.name}
description={t.description}
diff --git a/src/components/canvas/template-page.tsx b/src/components/canvas/template-page.tsx
index e19fa4ba..1dcdc1ca 100644
--- a/src/components/canvas/template-page.tsx
+++ b/src/components/canvas/template-page.tsx
@@ -14,7 +14,7 @@ import { shownTo, type TemplateDetail, type TemplateInput } from "@/lib/canvas-s
import { templateCover } from "@/lib/template-covers";
import { toastError } from "@/lib/refusals";
import { NodeIcon } from "./node-icon";
-import { ModelLine, Schematic } from "./template-card";
+import { CoverPlaceholder, ModelLine, Schematic } from "./template-card";
import { useCanvasActions } from "./use-canvas";
function Input({ input }: { input: TemplateInput }) {
@@ -127,8 +127,8 @@ export function TemplatePage({ t }: { t: TemplateDetail }) {
<CoverArt cover={cover} sizes="(max-width: 1024px) 100vw, 820px" playing={playing} asked={asked} />
)
) : (
- <div className="absolute inset-0" style={{ background: `linear-gradient(135deg, oklch(0.62 0.12 ${t.hue} / 0.14), transparent 70%)` }}>
- <Schematic outline={t.byEngine[engine].outline} className="p-6" />
+ <div className="absolute inset-0" style={{ background: `linear-gradient(135deg, oklch(0.62 0.12 ${t.hue} / 0.22), oklch(0.62 0.12 ${t.hue} / 0.06) 75%)` }}>
+ <CoverPlaceholder icon={t.icon} steps={t.flow} />
</div>
)}
{owner && !cover && <span className="absolute top-3 right-3 rounded-full bg-background/90 px-2 py-0.5 text-[11px] font-medium text-muted-foreground shadow-soft">No cover yet</span>}
diff --git a/src/components/canvas/use-canvas.ts b/src/components/canvas/use-canvas.ts
index bbd4983d..60bbede2 100644
--- a/src/components/canvas/use-canvas.ts
+++ b/src/components/canvas/use-canvas.ts
@@ -5,6 +5,7 @@ import { useGenerationStream } from "@/lib/api";
import type { Canvas, CanvasGraph, CanvasPlan, CanvasSummary } from "@/lib/catalog/canvas";
import type { CanvasPage } from "@/lib/catalog/canvas-board";
import type { Engine, Generation } from "@/lib/catalog/types";
+import type { TemplateModels } from "@/lib/canvas-sections";
import { responseError } from "@/lib/refusals";
/** Client hooks for /api/canvases (kept next to the canvas UI; the shapes live in src/lib/catalog/canvas.ts). */
@@ -25,6 +26,18 @@ export interface CanvasView {
const active = (g: Generation) => g.status === "queued" || g.status === "running";
+/**
+ * The model names of every Canvas template, per engine: the owner's only (the route answers no one else), asked for
+ * once by the owner's model lines (ModelLine) and kept for the visit.
+ */
+export function useTemplateModels() {
+ return useQuery({
+ queryKey: ["canvas-template-models"],
+ staleTime: Infinity,
+ queryFn: async () => json<Record<string, TemplateModels>>(await fetch("/api/canvases/template-models")),
+ });
+}
+
/** The owner's canvases; `enabled: false` (a visitor, who has none) asks for nothing. */
export function useCanvases({ enabled = true }: { enabled?: boolean } = {}) {
return useQuery({
diff --git a/src/components/nav/bar-split.tsx b/src/components/nav/bar-split.tsx
index 8ac366d2..9fb52bec 100644
--- a/src/components/nav/bar-split.tsx
+++ b/src/components/nav/bar-split.tsx
@@ -65,15 +65,18 @@ export function useHoverIntent(open: boolean, onOpen: () => void, onClose: () =>
if (!open) byHover.current = false;
}, [open]);
+ // `now`: open without the rest (another of the bar's grouped menus is open: moving along the bar switches at once).
const enter = useCallback(
- (e: React.PointerEvent) => {
+ (e: React.PointerEvent, now = false) => {
if (!canHover(e)) return;
cancel();
if (openRef.current || off) return;
- timer.current = setTimeout(() => {
+ const go = () => {
byHover.current = true;
onOpen();
- }, HOVER_OPEN_MS);
+ };
+ if (now) go();
+ else timer.current = setTimeout(go, HOVER_OPEN_MS);
},
[cancel, onOpen, off],
);
@@ -141,7 +144,11 @@ export function BarSplitMenu({
}) {
const [open, setOpen] = useState(false);
const [offset, setOffset] = useState(0);
- const { launcherOpen, setLauncherOpen } = useNavUi();
+ const openRef = useRef(open);
+ useEffect(() => {
+ openRef.current = open;
+ }, [open]);
+ const { openMenu, setOpenMenu } = useNavUi();
const pill = useRef<HTMLDivElement>(null);
const nameLink = useRef<HTMLAnchorElement>(null);
const chevron = useRef<HTMLButtonElement>(null);
@@ -166,6 +173,13 @@ export function BarSplitMenu({
},
[panel],
);
+ // A grouped menu opened (Studios, Apps …): this one closes, quietly (focus is the other menu's now).
+ useEffect(() => {
+ if (openMenu && openRef.current) {
+ quietClose.current = true;
+ setOpen(false);
+ }
+ }, [openMenu]);
// Opened from the name with ArrowDown: once the menu has taken focus, its first row gets it.
useEffect(() => {
if (!open || !focusFirst.current) return;
@@ -177,10 +191,10 @@ export function BarSplitMenu({
open,
useCallback(() => {
fromName.current = false;
- // One panel at a time: the Studios launcher, open from a click, gives way (focus stays where it is).
- if (launcherOpen) setLauncherOpen(false);
+ // One panel at a time: an open grouped menu gives way (focus stays where it is).
+ if (openMenu) setOpenMenu(null);
show(true, false);
- }, [show, launcherOpen, setLauncherOpen]),
+ }, [show, openMenu, setOpenMenu]),
useCallback(() => {
quietClose.current = true;
show(false);
@@ -196,6 +210,7 @@ export function BarSplitMenu({
if (o) {
hover.pin();
fromName.current = false;
+ if (openMenu) setOpenMenu(null);
}
show(o);
}}
@@ -228,6 +243,7 @@ export function BarSplitMenu({
focusFirst.current = true;
fromName.current = true;
hover.pin();
+ if (openMenu) setOpenMenu(null);
show(true);
}}
>
diff --git a/src/components/nav/cover-thumb.tsx b/src/components/nav/cover-thumb.tsx
index 73adf2b1..b90554b5 100644
--- a/src/components/nav/cover-thumb.tsx
+++ b/src/components/nav/cover-thumb.tsx
@@ -2,6 +2,7 @@
import { createElement } from "react";
import { navIcon } from "@/lib/nav-icons";
+import type { MegaCover } from "@/lib/mega-menus";
import type { NavIconName } from "@/lib/nav-model";
import { cn } from "@/lib/utils";
import { useNavCover } from "./nav-ui";
@@ -12,7 +13,7 @@ import { useNavCover } from "./nav-ui";
* written name, so the image is alt="" and the box is hidden from assistive tech.
*/
-export type CoverSize = "row" | "tile" | "lead" | "card" | "thumb" | "chip" | "pill" | "wide";
+export type CoverSize = "row" | "tile" | "lead" | "card" | "thumb" | "chip" | "pill" | "wide" | "tile16";
interface SizeSpec {
/** The box (size, shape); a caller's className can override any of it. */
@@ -20,16 +21,19 @@ interface SizeSpec {
/** The image's intrinsic size for its width/height attributes (posters are 512x384, thumbs 320x240). */
w: number;
h: number;
- /** Which copy to load: the 320 px thumb for small boxes; fluid boxes pick between both by `sizes`. */
- src: "thumb" | "both";
+ /**
+ * Which copy to load: the 96 px mini for the smallest boxes (the 320 px thumb where a cover has no mini), the 320 px
+ * thumb for small boxes; fluid boxes pick between thumb and poster by `sizes`.
+ */
+ src: "mini" | "thumb" | "both";
sizes: string;
}
export const COVER_SIZES: Record<CoverSize, SizeSpec> = {
/** 36x27: a launcher row, a search grid tile. */
- row: { box: "h-[27px] w-9 rounded-[6px]", w: 36, h: 27, src: "thumb", sizes: "36px" },
+ row: { box: "h-[27px] w-9 rounded-[6px]", w: 36, h: 27, src: "mini", sizes: "36px" },
/** 56x56: the phone Studios sheet. */
- tile: { box: "size-14 rounded-[14px]", w: 56, h: 56, src: "thumb", sizes: "56px" },
+ tile: { box: "size-14 rounded-[14px]", w: 56, h: 56, src: "mini", sizes: "56px" },
/** 4:3, full width: a launcher column's lead card. */
lead: { box: "aspect-[4/3] w-full rounded-[12px]", w: 512, h: 384, src: "both", sizes: "(min-width: 1024px) 272px, 72px" },
/** 4:3, full width: a goal band's studio card. */
@@ -42,17 +46,22 @@ export const COVER_SIZES: Record<CoverSize, SizeSpec> = {
pill: { box: "size-10 rounded-[10px]", w: 40, h: 40, src: "thumb", sizes: "40px" },
/** 16:9, full width: the "next to try" card. */
wide: { box: "aspect-video w-full rounded-[10px]", w: 512, h: 288, src: "both", sizes: "300px" },
+ /** 16:9, full width: a menu's ready-board tile (Canvas), about 200 px wide. */
+ tile16: { box: "aspect-video w-full rounded-[10px]", w: 320, h: 180, src: "thumb", sizes: "200px" },
};
export function CoverThumb({
id,
+ cover: given,
size,
icon,
eager,
className,
}: {
/** A preset id with a real cover (NavEntry.cover, a goal tap's preset); undefined shows the fallback. */
- id: string | undefined;
+ id?: string;
+ /** The cover itself, at its URLs (a fetched menu's), instead of a preset id. */
+ cover?: MegaCover;
size: CoverSize;
/** Shown on the muted fill when there is no cover. */
icon?: NavIconName;
@@ -60,14 +69,16 @@ export function CoverThumb({
eager?: boolean;
className?: string;
}) {
- const cover = useNavCover(id);
+ const nav = useNavCover(given ? undefined : id);
+ const cover = given ?? nav;
const s = COVER_SIZES[size];
+ const small = s.src === "mini" ? (cover?.mini ?? cover?.thumb) : cover?.thumb;
// How the cover sits in a box of another shape (cover-framing.ts): a square keeps its top part by default, where faces are.
const whole = cover?.framing?.fit === "whole";
const img = cover && (
// eslint-disable-next-line @next/next/no-img-element -- versioned static covers, sized by the box (no optimizer round trip)
<img
- src={cover.thumb}
+ src={small}
srcSet={s.src === "both" ? `${cover.thumb} 320w, ${cover.poster} 512w` : undefined}
sizes={s.src === "both" ? s.sizes : undefined}
width={s.w}
@@ -81,11 +92,11 @@ export function CoverThumb({
/>
);
return (
- <span aria-hidden data-cover={cover ? id : undefined} className={cn("relative block shrink-0 overflow-hidden bg-muted", s.box, className)}>
+ <span aria-hidden data-cover={cover ? (id ?? "") : undefined} className={cn("relative block shrink-0 overflow-hidden bg-muted", s.box, className)}>
{cover && whole ? (
<>
{/* eslint-disable-next-line @next/next/no-img-element -- the same small copy, blurred behind the whole picture */}
- <img src={cover.thumb} alt="" loading={eager ? "eager" : "lazy"} decoding="async" draggable={false} className="absolute inset-0 size-full scale-125 object-cover blur-md brightness-[0.7] saturate-[1.3]" />
+ <img src={small} alt="" loading={eager ? "eager" : "lazy"} decoding="async" draggable={false} className="absolute inset-0 size-full scale-125 object-cover blur-md brightness-[0.7] saturate-[1.3]" />
<span className="absolute inset-0 grid place-items-center [container-type:size]">
<span className="relative aspect-[4/3] w-[min(100cqw,133.334cqh)] overflow-hidden">{img}</span>
</span>
diff --git a/src/components/nav/mega-canvas-owner.tsx b/src/components/nav/mega-canvas-owner.tsx
new file mode 100644
index 00000000..76ac897b
--- /dev/null
+++ b/src/components/nav/mega-canvas-owner.tsx
@@ -0,0 +1,114 @@
+"use client";
+
+import { ArrowRight, Loader2, Network, Plus } from "lucide-react";
+import { useRouter } from "next/navigation";
+import { useState, type ReactNode } from "react";
+import { IntentLink } from "@/components/intent-link";
+import { useCanvasActions, useCanvases } from "@/components/canvas/use-canvas";
+import { timeAgo } from "@/lib/format";
+import { toastError } from "@/lib/refusals";
+
+/** How many of the owner's boards the Canvas menu lists, the newest edited first. */
+export const RECENT_BOARDS = 4;
+
+/** Makes an empty board and opens it; `busy` while it is being made. */
+function useNewBoard() {
+ const router = useRouter();
+ const { create } = useCanvasActions();
+ const [busy, setBusy] = useState(false);
+ const start = async () => {
+ setBusy(true);
+ try {
+ const c = await create({});
+ router.push(`/canvas/${c.id}`);
+ } catch (e) {
+ toastError(e, "Couldn't make a new board. Please try again.");
+ setBusy(false);
+ }
+ };
+ return { busy, start };
+}
+
+/** The phone sheet's New board button (the Canvas family, the owner's). */
+export function NewBoardButton() {
+ const { busy, start } = useNewBoard();
+ return (
+ <button
+ type="button"
+ onClick={() => void start()}
+ disabled={busy}
+ className="nav-focus mb-2 flex h-11 w-full items-center justify-center gap-2 rounded-full bg-primary text-[14px] font-semibold text-primary-foreground active:bg-primary/85"
+ >
+ {busy ? <Loader2 className="size-4 animate-spin" aria-hidden /> : <Plus className="size-4" aria-hidden />}
+ New board
+ </button>
+ );
+}
+
+/**
+ * The Canvas menu's first column for the owner (loaded only when the owner opens that menu): a New board button, then
+ * their most recent boards, or, with none yet, `fallback` (the visitor's lead card: a finished board's scene). Board
+ * previews are full-size files, so the rows show an icon, not a picture. `labelledBy`: the column's label.
+ */
+export default function CanvasOwnerStart({ col, labelledBy, fallback }: { col: number; labelledBy: string; fallback?: ReactNode }) {
+ const boards = useCanvases();
+ const { busy, start } = useNewBoard();
+ const recent = [...(boards.data ?? [])].sort((a, b) => (b.editedAt ?? b.updatedAt) - (a.editedAt ?? a.updatedAt)).slice(0, RECENT_BOARDS);
+ return (
+ <ul aria-labelledby={labelledBy} className="flex flex-col gap-2">
+ <li>
+ <button
+ type="button"
+ data-col={col}
+ data-row={0}
+ onClick={() => void start()}
+ disabled={busy}
+ className="nav-focus flex h-10 w-full items-center justify-center gap-2 rounded-[10px] bg-primary text-[14px] font-semibold text-primary-foreground hover:bg-primary/90 active:bg-primary/85 motion-safe:transition-colors"
+ >
+ {busy ? <Loader2 className="size-4 animate-spin" aria-hidden /> : <Plus className="size-4" aria-hidden />}
+ New board
+ </button>
+ </li>
+ {boards.isPending ? (
+ // Their boards are on the way: a lead card's place, so nothing moves when they come.
+ <li aria-hidden className="flex flex-col">
+ <span className="aspect-[4/3] max-h-[max(64px,calc(100dvh-640px))] w-full rounded-t-[14px] bg-muted" />
+ <span className="h-[59px] rounded-b-[14px] bg-muted/60" />
+ </li>
+ ) : recent.length > 0 ? (
+ <li className="flex flex-col gap-0.5">
+ <p className="pt-1 pb-1 text-[12px] leading-4 font-medium text-muted-foreground">Your recent boards</p>
+ {recent.map((b, i) => (
+ <IntentLink
+ key={b.id}
+ href={`/canvas/${b.id}`}
+ data-col={col}
+ data-row={i + 1}
+ title={b.name}
+ className="nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1.5"
+ >
+ <span aria-hidden className="grid h-[27px] w-9 shrink-0 place-items-center rounded-[6px] bg-muted">
+ <Network className="size-4 text-muted-foreground" />
+ </span>
+ <span className="flex min-w-0 flex-col">
+ <span className="truncate text-[13px] leading-[18px] font-medium">{b.name}</span>
+ <span className="truncate text-[12px] leading-4 text-muted-foreground">{b.editedAt ? `Edited ${timeAgo(b.editedAt)}` : "Never edited"}</span>
+ </span>
+ </IntentLink>
+ ))}
+ <IntentLink
+ href="/canvas"
+ data-col={col}
+ data-row={recent.length + 1}
+ className="nav-row group/all -mx-2 inline-flex h-10 items-center gap-1 self-start rounded-[10px] px-2 text-[13px] font-medium text-brand-text"
+ >
+ All your boards
+ <ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
+ </IntentLink>
+ </li>
+ ) : (
+ fallback && <li>{fallback}</li>
+ )}
+ </ul>
+ );
+}
diff --git a/src/components/nav/mega-data.ts b/src/components/nav/mega-data.ts
new file mode 100644
index 00000000..d405fef5
--- /dev/null
+++ b/src/components/nav/mega-data.ts
@@ -0,0 +1,91 @@
+"use client";
+
+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 type { ViewerKind } from "@/lib/nav-model";
+
+/*
+ * The fetched menus' data (Apps, Motions & effects, Canvas): 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.
+ */
+
+type Entry = { state: "loading"; promise: Promise<MegaModel> } | { state: "ready"; model: MegaModel } | { state: "failed" };
+
+const entries = new Map<FetchedMegaId, Entry>();
+const listeners = new Set<() => void>();
+const changed = () => listeners.forEach((l) => l());
+
+/** Starts loading a menu's data (once; again after a failure). */
+export function loadMenu(id: FetchedMegaId): void {
+ const e = entries.get(id);
+ if (e && e.state !== "failed") return;
+ const promise = fetch(menuUrl(id)).then(async (r) => {
+ if (!r.ok) throw new Error(`${menuUrl(id)} answered ${r.status}`);
+ return unpackMenu(await r.json());
+ });
+ entries.set(id, { state: "loading", promise });
+ changed();
+ promise.then(
+ (model) => {
+ entries.set(id, { state: "ready", model });
+ changed();
+ },
+ () => {
+ entries.set(id, { state: "failed" });
+ changed();
+ },
+ );
+}
+
+/** A grouped menu: Studios at once (it's in the bundle), the others once loaded. */
+export function warmMenu(id: MegaId): void {
+ if (id !== "studios") loadMenu(id);
+}
+
+/** A browser asking to save data, or on a slow connection: menus load when asked for only. */
+function saveData(): boolean {
+ if (typeof navigator === "undefined") return true;
+ const conn = (navigator as Navigator & { connection?: { saveData?: boolean; effectiveType?: string } }).connection;
+ return !!conn && (!!conn.saveData || /(^|-)2g$|^3g$/.test(conn.effectiveType ?? ""));
+}
+
+/** After the page has loaded, when the browser is idle: the data (no pictures) of the menus whose bar item shows. */
+export function prefetchMenus(ids: readonly FetchedMegaId[] = FETCHED_MENUS): () => void {
+ if (saveData()) return () => {};
+ const cancels = ids.map((id) => queueIdlePrefetch("nav", menuUrl(id), () => loadMenu(id)));
+ return () => cancels.forEach((c) => c());
+}
+
+const subscribe = (l: () => void) => {
+ listeners.add(l);
+ return () => listeners.delete(l);
+};
+
+export interface MenuState {
+ model?: MegaModel;
+ failed: boolean;
+ retry(): void;
+}
+
+/** A menu's data for who is looking: 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)),
+ () => undefined,
+ );
+ const retry = useCallback(() => {
+ if (id !== "studios") loadMenu(id);
+ }, [id]);
+ if (id === "studios") return { model: studiosMenu(kind), failed: false, retry };
+ return { model: entry?.state === "ready" ? entry.model : undefined, failed: entry?.state === "failed", retry };
+}
+
+/** For tests: forget every loaded menu. */
+export function resetMenus() {
+ entries.clear();
+ changed();
+}
diff --git a/src/components/nav/mega-launcher.tsx b/src/components/nav/mega-launcher.tsx
new file mode 100644
index 00000000..13506fbc
--- /dev/null
+++ b/src/components/nav/mega-launcher.tsx
@@ -0,0 +1,401 @@
+"use client";
+
+import { lazy, Suspense, useCallback, useEffect, useRef, useState } from "react";
+import { IntentLink } from "@/components/intent-link";
+import { MEGA_AREAS, megaMove, megaPanelId, TILE_COLS, type MegaId } from "@/lib/mega-menus";
+import { launcherActive, studioCount } from "@/lib/nav-model";
+import { isPlainClick } from "@/lib/use-tapped-tab";
+import { cn } from "@/lib/utils";
+import { BAR_CHEVRON, BAR_LABEL, BAR_SPLIT, BarChevron, useHoverIntent } from "./bar-split";
+import { warmMenu } from "./mega-data";
+import { useNavUi } from "./nav-ui";
+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, and arrow keys move in the grid (up and down a column,
+ * left and right to the same place in the next one). Esc, a click outside or focus leaving it closes it; Esc gives
+ * focus back to what opened it. One open at a time: opening one closes the others and the bar's Radix menus.
+ *
+ * The item's name goes to the area's page; its chevron (a click, Enter or Space) or ArrowDown on the name opens the
+ * panel. Resting the mouse on an item opens it too (not on the item of the page you are on; it closes again when the
+ * pointer leaves the item and the panel, unless a click or a key pinned it), and while one is open, moving onto another
+ * item switches to that one at once, as a menubar does. The panel is mounted, hidden, the first time the
+ * pointer or focus comes to the item, so its data and lead covers load before it opens. The panel's body (its links,
+ * cards and tiles: mega-panel.tsx) is a chunk of its own, loaded then or once the page is idle (preloadMegaPanel).
+ */
+
+/** The Studios panel's id (kept: the browser checks and the "All studios" buttons name it). */
+export const LAUNCHER_ID = megaPanelId("studios");
+
+/** Every studio on one page, with covers and lines ("See all", the bar item's name). */
+export const STUDIOS_AREA_HREF = MEGA_AREAS.studios.href;
+
+/** Kept for the Studios checks: the arrow keys' moves (megaMove). */
+export const launcherMove = megaMove;
+
+/** The launcher entry a page is on (a hub mode not in the launcher counts as its studio), for aria-current. */
+export function launcherCurrent(pathname: string): string | undefined {
+ return launcherActive(pathname);
+}
+
+/** The panel: under the bar, as wide as it, scrolling inside only when the window is too short for it. */
+export const LAUNCHER_PANEL =
+ "absolute inset-x-0 top-full max-h-[calc(100dvh-3.5rem)] overflow-y-auto overscroll-contain border-b border-sidebar-border bg-popover text-popover-foreground shadow-heavy motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150";
+
+/** 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" };
+
+/** The item of a menu the open page is (aria-current): a studio, an app, a preset, a ready board. */
+export function megaCurrent(id: MegaId, pathname: string, search = ""): string | undefined {
+ if (id === "studios") return launcherActive(pathname);
+ if (id === "apps") return /^\/apps\/([^/]+)$/.exec(pathname)?.[1];
+ if (id === "motions") return pathname === "/video" ? (new URLSearchParams(search).get("preset") ?? undefined) : undefined;
+ return /^\/canvas\/start\/([^/]+)$/.exec(pathname)?.[1];
+}
+
+/** The panel's body, loaded the first time it is asked for (once: the import is cached). */
+const loadPanel = () => import("./mega-panel");
+const LazyPanel = lazy(() => loadPanel().then((m) => ({ default: m.MegaPanel })));
+
+/** Loads the panel's body ahead (the bar does when the page is idle; hover and focus on an item do too). */
+export function preloadMegaPanel(): void {
+ void loadPanel().catch(() => {});
+}
+
+/** 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. */
+export function MegaSkeleton({ id }: { id?: MegaId }) {
+ if (id === "canvas") {
+ return (
+ <div aria-hidden className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
+ <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>
+ ))}
+ </span>
+ </div>
+ </div>
+ );
+ }
+ return (
+ <div aria-hidden className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
+ {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>
+ );
+}
+
+/** Visible on the page (not inside a hidden row or a closed panel). */
+const shows = (el: Element) => (typeof (el as HTMLElement).checkVisibility === "function" ? (el as HTMLElement).checkVisibility() : el.getClientRects().length > 0);
+
+/**
+ * A bar item with a grouped menu: its name goes to the area's page, its chevron (or ArrowDown on the name) opens the
+ * panel. The panel hangs from the bar (the header is its positioned parent) and spans it.
+ * `active`: one of the area's pages is open; `current`: the area's own page; `onTap`: the name was clicked.
+ */
+export function MegaLauncher({
+ id,
+ active,
+ current,
+ onTap,
+ className,
+}: {
+ id: MegaId;
+ active?: boolean;
+ current?: boolean;
+ onTap?: (href: string) => void;
+ className?: string;
+}) {
+ const { openMenu, setOpenMenu, menuGroup, menuReturnTo } = useNavUi();
+ const open = openMenu === id;
+ const area = MEGA_AREAS[id];
+ const search = useSearchPalette();
+ const [warm, setWarm] = useState(false);
+ const shown = warm || open;
+ const root = useRef<HTMLDivElement>(null);
+ const trigger = useRef<HTMLButtonElement>(null);
+ const label = useRef<HTMLAnchorElement>(null);
+ const panel = useRef<HTMLElement>(null);
+ // How it was opened: with its button or a key (focus to the first lead card), from the name (Esc comes back to the
+ // name), or from elsewhere (openArea: the group asked for).
+ const how = useRef<"button" | "name" | "hover" | null>(null);
+ // Opened while another of the bar's grouped menus was open: it takes that one's place without a second entrance.
+ const [switched, setSwitched] = useState(false);
+ // Counts each opening (a click on a menu the mouse opened counts too: focus moves in then).
+ const [opening, setOpening] = useState(0);
+
+ const heat = useCallback(() => {
+ warmMenu(id);
+ preloadMegaPanel();
+ setWarm(true);
+ }, [id]);
+
+ const close = useCallback(
+ (returnFocus: boolean) => {
+ const back = menuReturnTo();
+ const from = how.current;
+ how.current = null;
+ setOpenMenu(null);
+ if (returnFocus) (back?.isConnected ? back : from === "name" ? label.current : trigger.current)?.focus();
+ },
+ [menuReturnTo, setOpenMenu],
+ );
+ const closeQuietly = useCallback(() => {
+ if (openMenu === id) close(false);
+ }, [close, openMenu, id]);
+
+ const show = useCallback(
+ (by: "button" | "name" | "hover") => {
+ how.current = by;
+ setSwitched(!!openMenu && openMenu !== id);
+ setOpening((n) => n + 1);
+ heat();
+ setOpenMenu(id);
+ },
+ [heat, openMenu, id, setOpenMenu],
+ );
+
+ // Resting the mouse opens it (never on its own page, which it would only cover).
+ const hover = useHoverIntent(
+ open,
+ useCallback(() => show("hover"), [show]),
+ useCallback(() => close(false), [close]),
+ !!current,
+ );
+
+ useEffect(() => {
+ if (!open) return;
+ // Opened: the routes one click here leads to start loading.
+ warmNav(WARM[id]);
+ // Opened by resting the mouse: focus stays where it was (a prompt being typed keeps its keys).
+ if (how.current === "hover") return;
+ const byKey = how.current === "button" || how.current === "name";
+ // The panel's links may come a moment later (a fetched menu): focus the asked-for column's lead once there.
+ const focus = () => {
+ const p = panel.current;
+ if (!p) return false;
+ const group = !byKey && menuGroup ? p.querySelector<HTMLElement>(`[data-group="${menuGroup}"] [data-row="0"]`) : null;
+ const at = group ?? p.querySelector<HTMLElement>('[data-col="0"][data-row="0"]');
+ at?.focus();
+ return !!at;
+ };
+ if (focus()) return;
+ const obs = new MutationObserver(() => focus() && obs.disconnect());
+ if (panel.current) obs.observe(panel.current, { childList: true, subtree: true });
+ return () => obs.disconnect();
+ }, [open, opening, menuGroup, id]);
+
+ // While open: a press outside closes it (the press goes on to what it was on), and Esc closes it from anywhere.
+ useEffect(() => {
+ if (!open) return;
+ const down = (e: PointerEvent) => {
+ // A press on another grouped menu's item opens that one in this one's place (no second entrance), closing this.
+ if ((e.target as Element | null)?.closest?.("[data-mega]")) return;
+ if (!root.current?.contains(e.target as Node)) close(false);
+ };
+ const key = (e: KeyboardEvent) => {
+ if (e.key !== "Escape" || e.defaultPrevented) return;
+ e.preventDefault();
+ close(true);
+ };
+ document.addEventListener("pointerdown", down, true);
+ document.addEventListener("keydown", key);
+ return () => {
+ document.removeEventListener("pointerdown", down, true);
+ document.removeEventListener("keydown", key);
+ };
+ }, [open, close]);
+
+ const toggle = (by: "button" | "name") => {
+ // Opened by resting the mouse: a click keeps it open (pinned) and moves focus in, as on a closed one.
+ if (open && hover.openedByHover()) {
+ hover.pin();
+ how.current = by;
+ setOpening((n) => n + 1);
+ return;
+ }
+ hover.pin();
+ if (open) return close(false);
+ show(by);
+ };
+
+ const onPanelKey = (e: React.KeyboardEvent) => {
+ const at = (e.target as HTMLElement).closest<HTMLElement>("[data-col]");
+ if (!at || !panel.current) return;
+ // Columns as the keys see them: the links that show, top to bottom (a row hidden by the window's height is skipped,
+ // and a section under another goes on from it).
+ const cols: HTMLElement[][] = [];
+ for (const el of panel.current.querySelectorAll<HTMLElement>("[data-col]")) {
+ if (!shows(el)) continue;
+ (cols[Number(el.dataset.col)] ??= []).push(el);
+ }
+ for (let i = 0; i < cols.length; i++) (cols[i] ??= []).sort((x, y) => Number(x.dataset.row) - Number(y.dataset.row));
+ const col = Number(at.dataset.col);
+ const row = cols[col]?.indexOf(at) ?? -1;
+ if (row < 0) return;
+ const next = megaMove(
+ cols.map((c) => c.length),
+ { col, row },
+ e.key,
+ );
+ if (/^(Arrow|Home$|End$)/.test(e.key)) e.preventDefault();
+ if (next) cols[next.col][next.row]?.focus();
+ };
+
+ // The mouse moves the keyboard's place: the link under it takes focus (quietly: the ring is the keyboard's), so the
+ // arrow keys go on from where the mouse left off and only one link is ever highlighted.
+ const onPanelPointer = (e: React.PointerEvent) => {
+ if (e.pointerType !== "mouse") return;
+ const at = (e.target as HTMLElement).closest<HTMLElement>("[data-col]");
+ if (at && at !== document.activeElement) at.focus({ preventScroll: true });
+ };
+
+ const n = id === "studios" ? studioCount() : undefined;
+ return (
+ <div
+ ref={root}
+ className="contents"
+ onBlur={(e) => {
+ // Focus went somewhere else on the page (Tab past the last link, a click on a field): close. Focus lost to
+ // nothing (a press on the panel's padding) keeps it open; a press outside closes it above.
+ const to = e.relatedTarget as Node | null;
+ if (open && to && !root.current?.contains(to)) close(false);
+ }}
+ >
+ <div
+ data-bar-split
+ data-mega={id}
+ data-active={active || undefined}
+ data-open={open || undefined}
+ className={cn(BAR_SPLIT, className)}
+ // The panel mounts, hidden, so its data and covers load before it opens.
+ onPointerEnter={(e) => {
+ heat();
+ hover.enter(e, !!openMenu && openMenu !== id);
+ }}
+ onPointerLeave={hover.leave}
+ >
+ <IntentLink
+ ref={label}
+ href={area.href}
+ aria-current={current ? "page" : undefined}
+ aria-label={n !== undefined ? `${area.label}, ${n} studios` : undefined}
+ className={BAR_LABEL}
+ onFocus={heat}
+ onClick={(e) => {
+ if (open) close(false);
+ if (isPlainClick(e)) onTap?.(area.href);
+ }}
+ onKeyDown={(e) => {
+ if (e.key !== "ArrowDown" || e.altKey || e.metaKey || e.ctrlKey || open) return;
+ e.preventDefault();
+ toggle("name");
+ }}
+ >
+ {area.label}
+ {n !== undefined && <span className="rounded-full bg-brand-faint px-1.5 py-px text-[11px] leading-4 font-semibold text-brand-text tabular-nums">{n}</span>}
+ </IntentLink>
+ <button
+ ref={trigger}
+ type="button"
+ aria-label={area.menu}
+ aria-expanded={open}
+ // The panel is on the page once warmed (hover, focus) or open.
+ aria-controls={shown ? megaPanelId(id) : undefined}
+ data-studios-trigger={id === "studios" || undefined}
+ data-mega-trigger={id}
+ data-state={open ? "open" : "closed"}
+ className={BAR_CHEVRON}
+ onFocus={heat}
+ // Click, Enter and Space open it with focus on the first lead card (arrow keys and Tab go on from there).
+ onClick={() => toggle("button")}
+ onKeyDown={(e) => {
+ if (e.key !== "ArrowDown" || open) return;
+ e.preventDefault();
+ toggle("button");
+ }}
+ >
+ <BarChevron />
+ </button>
+ </div>
+ {shown && (
+ <section
+ ref={panel}
+ id={megaPanelId(id)}
+ data-mega-panel={id}
+ aria-label={area.panel}
+ hidden={!open}
+ onKeyDown={onPanelKey}
+ onPointerMove={onPanelPointer}
+ onClick={(e) => {
+ if ((e.target as Element).closest("a[href]")) close(false);
+ }}
+ onPointerEnter={hover.enter}
+ onPointerLeave={hover.leave}
+ data-switched={switched || undefined}
+ className={cn(LAUNCHER_PANEL, switched && "motion-safe:animate-none")}
+ >
+ {/* The body's place while its chunk loads: the count line's height, then the columns' skeleton. */}
+ <Suspense
+ fallback={
+ <div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
+ <div className="min-h-10 pb-4" />
+ <MegaSkeleton id={id} />
+ </div>
+ }
+ >
+ <LazyPanel
+ id={id}
+ onClose={closeQuietly}
+ onSearch={() => {
+ // The item gets focus first, so it is where Esc in the search comes back to (the panel is gone by then).
+ close(true);
+ search.open();
+ }}
+ />
+ </Suspense>
+ </section>
+ )}
+ </div>
+ );
+}
+
+/** The bar's Studios item (MegaLauncher for Studios). */
+export function StudiosLauncher(props: { active?: boolean; current?: boolean; onTap?: (href: string) => void }) {
+ return <MegaLauncher id="studios" {...props} />;
+}
+
+/** Dims the page under an open grouped menu (decoration: presses go through to the page, which closes the menu). */
+export function MegaScrim() {
+ const { openMenu } = useNavUi();
+ if (!openMenu) return null;
+ return (
+ <div
+ aria-hidden
+ className="pointer-events-none fixed inset-x-0 top-14 bottom-0 z-[39] hidden bg-overlay md:block motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150 print:hidden"
+ />
+ );
+}
+
+/** Kept name: the scrim under the launcher. */
+export const LauncherScrim = MegaScrim;
diff --git a/src/components/nav/mega-panel.tsx b/src/components/nav/mega-panel.tsx
new file mode 100644
index 00000000..a358efef
--- /dev/null
+++ b/src/components/nav/mega-panel.tsx
@@ -0,0 +1,324 @@
+"use client";
+
+import { ArrowRight, RotateCw, Search } from "lucide-react";
+import { usePathname, useSearchParams } from "next/navigation";
+import { Fragment, lazy, Suspense, useEffect, useId, useRef, useState } from "react";
+import { IntentLink } from "@/components/intent-link";
+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 { isNew, type ViewerKind } from "@/lib/nav-model";
+import { cn } from "@/lib/utils";
+import { CoverThumb } 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 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.
+ */
+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",
+ );
+
+function NewBadge() {
+ return <span className="shrink-0 rounded-full bg-highlight px-1.5 py-px text-[10px] leading-4 font-semibold text-highlight-foreground">New</span>;
+}
+
+/** A column's first card: its cover, name and one line. `row` 1 under the owner's New board (Canvas), its cover shorter by that button. */
+export function LeadCard({ e, col, row = 0, current, now }: { e: MegaItem; col: number; row?: number; current: boolean; now: number }) {
+ return (
+ <IntentLink
+ href={e.href}
+ data-col={col}
+ data-row={row}
+ aria-current={current ? "page" : undefined}
+ className="nav-row group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground"
+ >
+ <CoverThumb
+ id={e.navCover}
+ cover={e.cover}
+ size="lead"
+ icon={e.icon}
+ eager
+ className={cn(
+ "rounded-none md:max-lg:max-h-[max(56px,calc(100dvh-460px))]",
+ row ? "max-h-[max(64px,calc(100dvh-640px))]" : "max-h-[max(64px,calc(100dvh-592px))]",
+ )}
+ />
+ <span className="nav-mark-start flex min-w-0 flex-col gap-0.5 px-3 pt-2.5 pb-3 md:max-lg:px-2.5 md:max-lg:py-2">
+ <span className="flex min-w-0 items-center gap-1.5">
+ <span className="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>
+ );
+}
+
+function Row({ e, col, row, current, now, className }: { e: MegaItem; col: number; row: number; current: boolean; now: number; className?: string }) {
+ return (
+ <IntentLink
+ href={e.href}
+ data-col={col}
+ data-row={row}
+ aria-current={current ? "page" : undefined}
+ title={e.line ? `${e.label}: ${e.line}` : e.label}
+ className={cn("nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1.5 md:max-lg:min-h-10", className)}
+ >
+ {/* Six columns leave a row its name and line below 1440 px, and its name alone below 1280 px. Its picture loads
+ when the row shows (lazy): a row hidden by the window's height never fetches it. */}
+ <CoverThumb id={e.navCover} cover={e.cover} size="row" icon={e.icon} className="max-[1439.98px]:hidden" />
+ <span className="flex min-w-0 flex-col">
+ <span className="flex min-w-0 items-center gap-1.5">
+ <span className={cn("truncate text-[13px] leading-[18px] font-medium max-xl:line-clamp-2 max-xl:whitespace-normal", current && "font-semibold")}>{e.label}</span>
+ {isNew(e, now) && <NewBadge />}
+ </span>
+ <span className="truncate text-[12px] leading-4 text-muted-foreground max-xl:hidden">{e.line}</span>
+ </span>
+ </IntentLink>
+ );
+}
+
+/**
+ * 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).
+ */
+function Tile({ e, col, row, current, eager }: { e: MegaItem; col: number; row: number; current: boolean; eager: boolean }) {
+ return (
+ <IntentLink
+ 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 flex min-w-0 flex-col gap-1.5 rounded-[12px] p-1.5"
+ >
+ <CoverThumb cover={e.cover} size="tile16" icon={e.icon} eager={eager} />
+ <span className="flex min-w-0 flex-col px-0.5">
+ <span className={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>
+ );
+}
+
+/** Tiles across a tiles column. */
+const across = (c: MegaColumn) => Math.min(c.span ?? 1, TILE_COLS);
+
+/**
+ * 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;
+}
+
+/** 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. */
+function OwnerStartSkeleton() {
+ return (
+ <div aria-hidden className="flex flex-col gap-2">
+ <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" />
+ </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.
+ */
+export function MegaColumns({ 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 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} 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-x-3 gap-y-2" 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>
+ );
+ }
+ 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-0.5">
+ {c.lead && (
+ <li className="pb-1.5">
+ <LeadCard e={c.lead} col={col} current={current === c.lead.id} now={now} />
+ </li>
+ )}
+ {c.rows.map((e, ri) => (
+ <li key={e.id} className={capped ? ROW_HIDE(ri, families) : undefined}>
+ <Row e={e} col={col} row={ri + 1} current={current === e.id} now={now} />
+ </li>
+ ))}
+ </ul>
+ </div>
+ );
+ };
+
+ return (
+ <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
+ {families
+ ? model.families!.map((f) => (
+ <Fragment key={f.id}>
+ <div className={cn("flex items-center gap-2 border-b pb-1.5 lg:row-start-1", f.span >= 3 ? "col-span-3" : SPAN[f.span])} data-family={f.id}>
+ <p className="text-[12px] leading-4 font-semibold text-foreground">
+ {f.label} <span className="font-normal text-muted-foreground tabular-nums">· {f.count}</span>
+ </p>
+ <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)}
+ </div>
+ );
+}
+
+
+/** Studios' columns 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} />;
+}
+
+/** The panel's body once it is shown or warmed: it reads the path (client only: the panel never renders on the server). */
+export function MegaPanel({ id, onClose, onSearch }: { id: MegaId; onClose: () => void; onSearch: () => void }) {
+ const kind = useViewerKind();
+ const pathname = usePathname();
+ const { model, failed, retry } = useMegaMenu(id, kind);
+ const [now] = useState(() => Date.now());
+ // A new page (a link here, back, a notification) closes it.
+ const shownAt = useRef(pathname);
+ useEffect(() => {
+ if (shownAt.current === pathname) return;
+ shownAt.current = pathname;
+ onClose();
+ }, [pathname, onClose]);
+ const area = MEGA_AREAS[id];
+ // The query too: moving from one preset to another (/video?preset=…) keeps the path.
+ const search = useSearchParams()?.toString() ?? "";
+ return (
+ <div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
+ <div className="flex min-h-10 items-center gap-3.5 pb-4">
+ <p className="text-[13px] text-muted-foreground" data-count-line>
+ {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). */}
+ <IntentLink
+ href={area.href}
+ aria-current={pathname === area.href ? "page" : undefined}
+ aria-label={model?.seeAll.name ?? `See all ${area.label.toLowerCase()}`}
+ className="nav-row group/all -ml-1 inline-flex h-9 items-center gap-1 rounded-[10px] px-2 text-[13px] font-medium text-brand-text"
+ >
+ See all
+ <ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
+ </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" />
+ Try again
+ </button>
+ )}
+ <span className="flex-1" />
+ <button
+ type="button"
+ onClick={onSearch}
+ aria-keyshortcuts="/"
+ className="nav-row inline-flex h-10 items-center gap-2 rounded-[10px] px-2.5 text-[13px] font-medium text-brand-text"
+ >
+ <Search aria-hidden className="size-4" />
+ Search all apps, effects and tools
+ <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} />}
+ </div>
+ );
+}
+
+/** Kept for the Studios checks: the Studios panel's body. */
+export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSearch: () => void }) {
+ return <MegaPanel id="studios" onClose={onClose} onSearch={onSearch} />;
+}
diff --git a/src/components/nav/nav-ui.tsx b/src/components/nav/nav-ui.tsx
index 0736b257..45beeb53 100644
--- a/src/components/nav/nav-ui.tsx
+++ b/src/components/nav/nav-ui.tsx
@@ -3,13 +3,14 @@
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { useHydrated, useViewer } from "@/lib/api";
import type { NavCover, NavCovers } from "@/lib/nav-covers";
+import type { MegaId } from "@/lib/mega-menus";
import { viewerKindOf, type LauncherGroupId, type ViewerKind } from "@/lib/nav-model";
import { installInputModality } from "./input-modality";
/*
* The app frame's shared state: the covers the server resolved for the nav (preset id → thumb and poster URLs), who is
* looking, and which of the bar's panels or the phone's sheets is open. One provider for the top bar, the phone tabs and
- * their sheets, so "All studios" anywhere opens the launcher on a desktop and the Studios sheet on a phone.
+ * their sheets, so "All studios" anywhere opens the launcher on a desktop and the Studios sheet on a phone (openArea).
*/
export type NavSheet = "studios" | "create" | "you";
@@ -18,17 +19,22 @@ export type NavSheet = "studios" | "create" | "you";
export const PHONE_QUERY = "(max-width: 767px)";
export interface NavUi {
- launcherOpen: boolean;
- setLauncherOpen(v: boolean): void;
- /** The column the launcher was opened for (openStudios(group)): it takes focus first. */
- launcherGroup: LauncherGroupId | undefined;
- /** Where focus goes back to when the launcher closes with Esc: what opened it, when that was not its own button. */
- launcherReturnTo(): HTMLElement | null;
+ /** The bar's open grouped menu (Studios, Apps, Motions & effects, Canvas): one at a time. */
+ openMenu: MegaId | null;
+ setOpenMenu(v: MegaId | null): void;
+ /** The column the open menu was opened for (openArea(id, group)): it takes focus first. */
+ menuGroup: string | undefined;
+ /** Where focus goes back to when the menu closes with Esc: what opened it, when that was not its own button. */
+ menuReturnTo(): HTMLElement | null;
sheet: NavSheet | null;
setSheet(v: NavSheet | null): void;
- /** The chip the Studios sheet starts on (openStudios(group)); undefined = All. */
- sheetGroup: LauncherGroupId | undefined;
- /** Every studio: the launcher from the md breakpoint up, the Studios sheet on a phone. */
+ /** The family the Studios sheet shows (Studios, Apps, Motions & effects, Canvas). */
+ sheetFamily: MegaId;
+ /** The chip the Studios sheet starts on (openArea(id, group)); undefined = All. */
+ sheetGroup: string | undefined;
+ /** A menu's whole set: its grouped menu from the md breakpoint up, the Studios sheet on that family on a phone. */
+ openArea(id: MegaId, group?: string): void;
+ /** Every studio (openArea("studios", group)). */
openStudios(group?: LauncherGroupId): void;
}
@@ -36,42 +42,45 @@ const NavUiContext = createContext<NavUi | null>(null);
const CoversContext = createContext<NavCovers>({});
export function NavUiProvider({ covers, children }: { covers: NavCovers; children: React.ReactNode }) {
- const [launcher, setLauncher] = useState<{ open: boolean; group?: LauncherGroupId }>({ open: false });
- const [sheet, setSheetState] = useState<{ sheet: NavSheet | null; group?: LauncherGroupId }>({ sheet: null });
- const launcherReturn = useRef<HTMLElement | null>(null);
+ const [menu, setMenu] = useState<{ id: MegaId | null; group?: string }>({ id: null });
+ const [sheet, setSheetState] = useState<{ sheet: NavSheet | null; family: MegaId; group?: string }>({ sheet: null, family: "studios" });
+ const menuReturn = useRef<HTMLElement | null>(null);
// Which input leads (keyboard or pointer), for the nav states: one highlighted row at a time.
useEffect(() => installInputModality(), []);
- // Opened or closed by the launcher's own button: focus goes back to it. openStudios() says otherwise.
- const setLauncherOpen = useCallback((open: boolean) => {
- launcherReturn.current = null;
- setLauncher((l) => (l.open === open && !l.group ? l : { open }));
+ // Opened or closed by a menu's own button: focus goes back to it. openArea() says otherwise.
+ const setOpenMenu = useCallback((id: MegaId | null) => {
+ menuReturn.current = null;
+ setMenu((m) => (m.id === id && !m.group ? m : { id }));
}, []);
- const launcherReturnTo = useCallback(() => launcherReturn.current, []);
- const setSheet = useCallback((v: NavSheet | null) => setSheetState({ sheet: v }), []);
- const openStudios = useCallback((group?: LauncherGroupId) => {
+ const menuReturnTo = useCallback(() => menuReturn.current, []);
+ const setSheet = useCallback((v: NavSheet | null) => setSheetState((s) => ({ sheet: v, family: v === "studios" && s.sheet === "studios" ? s.family : "studios" })), []);
+ const openArea = useCallback((id: MegaId, group?: string) => {
const phone = typeof window !== "undefined" && window.matchMedia(PHONE_QUERY).matches;
if (phone) {
- setSheetState({ sheet: "studios", group });
+ setSheetState({ sheet: "studios", family: id, group });
return;
}
const at = typeof document !== "undefined" ? document.activeElement : null;
- launcherReturn.current = at instanceof HTMLElement && at !== document.body ? at : null;
- setLauncher({ open: true, group });
+ menuReturn.current = at instanceof HTMLElement && at !== document.body ? at : null;
+ setMenu({ id, group });
}, []);
+ const openStudios = useCallback((group?: LauncherGroupId) => openArea("studios", group), [openArea]);
const ui = useMemo<NavUi>(
() => ({
- launcherOpen: launcher.open,
- setLauncherOpen,
- launcherGroup: launcher.open ? launcher.group : undefined,
- launcherReturnTo,
+ openMenu: menu.id,
+ setOpenMenu,
+ menuGroup: menu.id ? menu.group : undefined,
+ menuReturnTo,
sheet: sheet.sheet,
setSheet,
+ sheetFamily: sheet.family,
sheetGroup: sheet.sheet === "studios" ? sheet.group : undefined,
+ openArea,
openStudios,
}),
- [launcher, sheet, setLauncherOpen, launcherReturnTo, setSheet, openStudios],
+ [menu, sheet, setOpenMenu, menuReturnTo, setSheet, openArea, openStudios],
);
return (
@@ -82,13 +91,15 @@ export function NavUiProvider({ covers, children }: { covers: NavCovers; childre
}
const CLOSED: NavUi = {
- launcherOpen: false,
- setLauncherOpen: () => {},
- launcherGroup: undefined,
- launcherReturnTo: () => null,
+ openMenu: null,
+ setOpenMenu: () => {},
+ menuGroup: undefined,
+ menuReturnTo: () => null,
sheet: null,
setSheet: () => {},
+ sheetFamily: "studios",
sheetGroup: undefined,
+ openArea: () => {},
openStudios: () => {},
};
diff --git a/src/components/nav/phone-sheets.tsx b/src/components/nav/phone-sheets.tsx
index 40c6eee4..24f3bd31 100644
--- a/src/components/nav/phone-sheets.tsx
+++ b/src/components/nav/phone-sheets.tsx
@@ -3,14 +3,15 @@
import { usePathname } from "next/navigation";
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
import { Dialog as SheetPrimitive } from "radix-ui";
-import { ArrowRight, Search, XIcon } from "lucide-react";
+import { ArrowRight, XIcon } from "lucide-react";
import { IntentLink } from "@/components/intent-link";
import { AccountSections } from "@/components/nav/account-menu";
import { CreateList } from "@/components/nav/create-menu";
import { PHONE_QUERY, useNavUi, type NavSheet } from "@/components/nav/nav-ui";
import { useSearchPalette } from "@/components/nav/search-context";
import { ComputerNoteBlock } from "@/components/nav/status-chips";
-import { StudiosSheet } from "@/components/nav/studios-sheet";
+import { FamilySwitch, StudiosSheet } from "@/components/nav/studios-sheet";
+import { MEGA_AREAS, type MegaId } from "@/lib/mega-menus";
import { warmNav } from "@/components/nav/nav-prefetch";
import { area } from "@/lib/nav-areas";
import { cn } from "@/lib/utils";
@@ -18,7 +19,7 @@ import { cn } from "@/lib/utils";
const TITLES: Record<NavSheet, string> = { studios: "Studios", create: "Create", you: "You" };
/** "See all" in a sheet's header: the area's own page, with covers and lines. */
-const SEE_ALL: Partial<Record<NavSheet, string>> = { studios: area("studios").href, create: area("create").href };
+const SEE_ALL: Partial<Record<NavSheet, string>> = { create: area("create").href };
/** A drag down this far on the sheet's top (handle and title) closes it, in px. */
const SWIPE_CLOSE = 56;
@@ -77,7 +78,14 @@ function YouSheet() {
* it, and focus goes back to what opened it.
*/
export function PhoneSheets() {
- const { sheet, setSheet, sheetGroup } = useNavUi();
+ const { sheet, setSheet, sheetGroup, sheetFamily } = useNavUi();
+ // The Studios sheet's family (Studios, Apps, Motions & effects, Canvas): where openArea() asked, then as switched.
+ const [family, setFamily] = useState<MegaId>(sheetFamily);
+ const [askedFamily, setAskedFamily] = useState({ sheet, sheetFamily });
+ if (askedFamily.sheet !== sheet || askedFamily.sheetFamily !== sheetFamily) {
+ setAskedFamily({ sheet, sheetFamily });
+ if (sheet === "studios") setFamily(sheetFamily);
+ }
const search = useSearchPalette();
// The body on screen: the open sheet's, and the last one's while the sheet slides away.
const [shown, setShown] = useState<NavSheet>(sheet ?? "studios");
@@ -157,7 +165,7 @@ export function PhoneSheets() {
if (a && !e.metaKey && !e.ctrlKey && !e.shiftKey && a.getAttribute("target") !== "_blank") close();
}}
className={cn(
- "fixed inset-x-0 bottom-[var(--chrome-bottom,0px)] z-50 flex max-h-[calc(100dvh-var(--chrome-bottom,0px)-2.5rem)] flex-col gap-2.5 rounded-t-[22px] border-t border-border bg-popover pt-2 pr-[env(safe-area-inset-right)] pb-3 pl-[env(safe-area-inset-left)] text-popover-foreground shadow-heavy outline-none md:hidden",
+ "fixed inset-x-0 bottom-[var(--chrome-bottom,0px)] z-50 flex max-h-[calc(100dvh-var(--chrome-bottom,0px)-2.5rem)] data-[sheet=studios]:h-[calc(100dvh-var(--chrome-bottom,0px)-2.5rem)] flex-col gap-2.5 rounded-t-[22px] border-t border-border bg-popover pt-2 pr-[env(safe-area-inset-right)] pb-3 pl-[env(safe-area-inset-left)] text-popover-foreground shadow-heavy outline-none md:hidden",
// No tab bar under it in a full-screen studio: it keeps clear of the home indicator itself.
"[html[data-fullscreen-studio]_&]:pb-[max(0.75rem,env(safe-area-inset-bottom))]",
"motion-safe:duration-200 motion-safe:data-open:animate-in motion-safe:data-open:fade-in-0 motion-safe:data-open:slide-in-from-bottom-10 motion-safe:data-closed:animate-out motion-safe:data-closed:fade-out-0 motion-safe:data-closed:slide-out-to-bottom-10",
@@ -175,8 +183,11 @@ export function PhoneSheets() {
onPointerCancel={() => (drag.current = null)}
>
<span aria-hidden className="mx-auto h-1 w-10 rounded-full bg-border-strong" />
- <div className="flex items-center gap-3 pr-2 pl-4">
- <SheetPrimitive.Title className="font-heading text-[28px] leading-none font-normal text-foreground">{TITLES[shown]}</SheetPrimitive.Title>
+ <div className={cn("flex items-center pr-2", shown === "studios" ? "gap-1 pl-3" : "gap-3 pl-4")}>
+ <SheetPrimitive.Title className={cn("font-heading text-[28px] leading-none font-normal text-foreground", shown === "studios" && "sr-only")}>
+ {shown === "studios" ? MEGA_AREAS[family].label : TITLES[shown]}
+ </SheetPrimitive.Title>
+ {shown === "studios" && <FamilySwitch family={family} onFamily={setFamily} />}
{SEE_ALL[shown] && (
// A link in the sheet: following it closes the sheet (onClickCapture above).
<IntentLink
@@ -188,21 +199,10 @@ export function PhoneSheets() {
<ArrowRight aria-hidden className="size-4" />
</IntentLink>
)}
- {shown === "studios" && (
- // In a full-screen studio Search is in the sheet's shortcuts instead.
- <button
- type="button"
- onClick={openSearch}
- aria-label="Search everything"
- className="nav-row grid size-11 shrink-0 place-items-center rounded-full text-brand-text [html[data-fullscreen-studio]_&]:hidden"
- >
- <Search className="size-[18px]" aria-hidden />
- </button>
- )}
<SheetPrimitive.Close
className={cn(
"nav-row grid size-11 shrink-0 place-items-center rounded-full text-muted-foreground nav-hover:text-foreground",
- !SEE_ALL[shown] && "ml-auto",
+ !SEE_ALL[shown] && shown !== "studios" && "ml-auto",
)}
>
<XIcon className="size-5" aria-hidden />
@@ -212,7 +212,7 @@ export function PhoneSheets() {
</div>
{shown === "studios" ? (
// Opened again for another group while open: it starts over on that chip.
- <StudiosSheet key={sheetGroup ?? "all"} group={sheetGroup} onSearch={openSearch} />
+ <StudiosSheet key={`${family}:${family === sheetFamily ? (sheetGroup ?? "all") : "all"}`} family={family} group={family === sheetFamily ? sheetGroup : undefined} onSearch={openSearch} />
) : shown === "create" ? (
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-1">
<CreateList variant="sheet" onNavigate={close} />
diff --git a/src/components/nav/studios-launcher.tsx b/src/components/nav/studios-launcher.tsx
deleted file mode 100644
index d0a6aad6..00000000
--- a/src/components/nav/studios-launcher.tsx
+++ /dev/null
@@ -1,370 +0,0 @@
-"use client";
-
-import { ArrowRight, Search } from "lucide-react";
-import { usePathname } from "next/navigation";
-import { useCallback, useEffect, useId, useRef, useState } from "react";
-import { IntentLink } from "@/components/intent-link";
-import { Kbd } from "@/components/ui/kbd";
-import { area } from "@/lib/nav-areas";
-import { isNew, launcherActive, launcherColumns, studioCount, type NavEntry, type ViewerKind } from "@/lib/nav-model";
-import { isPlainClick } from "@/lib/use-tapped-tab";
-import { cn } from "@/lib/utils";
-import { BAR_CHEVRON, BAR_LABEL, BAR_SPLIT, BarChevron } from "./bar-split";
-import { CoverThumb } from "./cover-thumb";
-import { useNavUi, useViewerKind } from "./nav-ui";
-import { useSearchPalette } from "./search-context";
-import { warmNav } from "./nav-prefetch";
-
-/*
- * Studios: every studio on one panel under the bar, grouped by what you want to make, one click and no scrolling (down to
- * 1280x720, and 1024x768). A disclosure for navigation (a button that shows a panel of links), not a menu: Tab walks the
- * links in order, and arrow keys move in the grid (up and down a column, left and right to the same place in the next
- * one). Esc, a click outside or focus leaving it closes it; Esc gives focus back to what opened it.
- */
-
-export const LAUNCHER_ID = "studios-launcher";
-
-/** Every studio on one page, with covers and lines ("See all", the bar item's name). */
-export const STUDIOS_AREA_HREF = area("studios").href;
-
-export type LauncherKey = "ArrowUp" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "Home" | "End";
-
-/**
- * Where an arrow key goes from `at` in columns of `lengths` links (row 0 is the lead card): up and down within the
- * column, stopping at its ends; left and right to the same row of the neighbouring column, or its last when shorter;
- * Home and End to the column's first and last. Null when the key goes nowhere (an edge, another key).
- */
-export function launcherMove(lengths: readonly number[], at: { col: number; row: number }, key: string): { col: number; row: number } | null {
- const { col, row } = at;
- const len = lengths[col] ?? 0;
- if (!len) return null;
- let next: { col: number; row: number } | null = null;
- if (key === "ArrowDown") next = row < len - 1 ? { col, row: row + 1 } : null;
- else if (key === "ArrowUp") next = row > 0 ? { col, row: row - 1 } : null;
- else if (key === "Home") next = { col, row: 0 };
- else if (key === "End") next = { col, row: len - 1 };
- else if (key === "ArrowLeft" || key === "ArrowRight") {
- let c = col + (key === "ArrowLeft" ? -1 : 1);
- while (c >= 0 && c < lengths.length && !lengths[c]) c += key === "ArrowLeft" ? -1 : 1;
- next = c >= 0 && c < lengths.length ? { col: c, row: Math.min(row, lengths[c] - 1) } : null;
- }
- return next && (next.col !== col || next.row !== row) ? next : null;
-}
-
-/** The launcher entry a page is on (a hub mode not in the launcher counts as its studio), for aria-current. */
-export function launcherCurrent(pathname: string): string | undefined {
- return launcherActive(pathname);
-}
-
-/** The panel: under the bar, as wide as it, scrolling inside only when the window is too short for it. */
-export const LAUNCHER_PANEL =
- "absolute inset-x-0 top-full max-h-[calc(100dvh-3.5rem)] overflow-y-auto overscroll-contain border-b border-sidebar-border bg-popover text-popover-foreground shadow-heavy motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150";
-
-
-function NewBadge() {
- return <span className="shrink-0 rounded-full bg-highlight px-1.5 py-px text-[10px] leading-4 font-semibold text-highlight-foreground">New</span>;
-}
-
-function LeadCard({ e, col, current, now }: { e: NavEntry; col: number; current: boolean; now: number }) {
- return (
- <IntentLink
- href={e.href}
- data-col={col}
- data-row={0}
- aria-current={current ? "page" : undefined}
- className="nav-row group/lead flex flex-col overflow-hidden rounded-[14px] border bg-card text-card-foreground"
- >
- <CoverThumb
- id={e.cover}
- size="lead"
- icon={e.icon}
- eager
- className="max-h-[max(64px,calc(100dvh-592px))] rounded-none md:max-lg:max-h-[max(56px,calc(100dvh-460px))]"
- />
- <span className="nav-mark-start flex min-w-0 flex-col gap-0.5 px-3 pt-2.5 pb-3 md:max-lg:px-2.5 md:max-lg:py-2">
- <span className="flex min-w-0 items-center gap-1.5">
- <span className="truncate text-[14px] leading-[18px] font-semibold md:max-lg:text-[13px]">{e.label}</span>
- {isNew(e, now) && <NewBadge />}
- </span>
- <span className="line-clamp-2 text-[12px] leading-4 text-muted-foreground md:max-lg:hidden">{e.what}</span>
- </span>
- </IntentLink>
- );
-}
-
-function Row({ e, col, row, current, now }: { e: NavEntry; col: number; row: number; current: boolean; now: number }) {
- return (
- <IntentLink
- href={e.href}
- data-col={col}
- data-row={row}
- aria-current={current ? "page" : undefined}
- title={e.label}
- className="nav-row nav-mark-start -mx-2 flex min-h-11 items-center gap-3 rounded-[10px] px-2 py-1.5 md:max-lg:min-h-10"
- >
- {/* Six columns leave a row its name and line below 1440 px, and its name alone below 1280 px. */}
- <CoverThumb id={e.cover} size="row" icon={e.icon} eager className="max-[1439.98px]:hidden" />
- <span className="flex min-w-0 flex-col">
- <span className="flex min-w-0 items-center gap-1.5">
- <span className={cn("truncate text-[13px] leading-[18px] font-medium max-xl:line-clamp-2 max-xl:whitespace-normal", current && "font-semibold")}>{e.label}</span>
- {isNew(e, now) && <NewBadge />}
- </span>
- <span className="line-clamp-2 text-[12px] leading-4 text-muted-foreground max-xl:hidden">{e.what}</span>
- </span>
- </IntentLink>
- );
-}
-
-/**
- * The launcher's columns as links (no behaviour): one per group, its label, the lead card and the rest. `current`: the
- * open page's entry id. `now`: the clock for the "New" badges.
- */
-export function LauncherColumns({ kind, current, now }: { kind: ViewerKind | undefined; current?: string; now: number }) {
- const ids = useId();
- return (
- <div className="grid grid-cols-3 gap-x-4 gap-y-6 lg:grid-cols-6 2xl:gap-x-6">
- {launcherColumns(kind).map((c, ci) => (
- <div key={c.group.id} data-group={c.group.id} className="flex min-w-0 flex-col gap-2">
- <p id={`${ids}-${c.group.id}`} title={c.group.label} className="truncate text-[11px] leading-4 font-semibold tracking-[.08em] text-brand-text uppercase">
- {c.group.label}
- </p>
- <ul aria-labelledby={`${ids}-${c.group.id}`} className="flex flex-col gap-0.5">
- <li className="pb-1.5">
- <LeadCard e={c.lead} col={ci} current={current === c.lead.id} now={now} />
- </li>
- {c.rest.map((e, ri) => (
- <li key={e.id}>
- <Row e={e} col={ci} row={ri + 1} current={current === e.id} now={now} />
- </li>
- ))}
- </ul>
- </div>
- ))}
- </div>
- );
-}
-
-/** The panel's body once it is shown or warmed: it reads the path (client only: the panel never renders on the server). */
-export function LauncherPanel({ onClose, onSearch }: { onClose: () => void; onSearch: () => void }) {
- const kind = useViewerKind();
- const pathname = usePathname();
- const [now] = useState(() => Date.now());
- // A new page (a link here, back, a notification) closes it.
- const shownAt = useRef(pathname);
- useEffect(() => {
- if (shownAt.current === pathname) return;
- shownAt.current = pathname;
- onClose();
- }, [pathname, onClose]);
- return (
- <div className="max-w-[1440px] px-6 pt-5 pb-6 lg:pt-6 lg:pb-7">
- <div className="flex items-center gap-3.5 pb-4">
- <p className="text-[13px] text-muted-foreground">{studioCount()} studios, grouped by what you want to make</p>
- {/* A plain link in Tab order before the grid; the grid's arrow keys skip it (it has no data-col). */}
- <IntentLink
- href={STUDIOS_AREA_HREF}
- aria-current={pathname === STUDIOS_AREA_HREF ? "page" : undefined}
- aria-label="See all studios"
- className="nav-row group/all -ml-1 inline-flex h-9 items-center gap-1 rounded-[10px] px-2 text-[13px] font-medium text-brand-text"
- >
- See all
- <ArrowRight aria-hidden className="size-3.5 motion-safe:transition-transform group-hover/all:translate-x-0.5" />
- </IntentLink>
- <span className="flex-1" />
- <button
- type="button"
- onClick={onSearch}
- aria-keyshortcuts="/"
- className="nav-row inline-flex h-10 items-center gap-2 rounded-[10px] px-2.5 text-[13px] font-medium text-brand-text"
- >
- <Search aria-hidden className="size-4" />
- Search all apps, effects and tools
- <Kbd aria-hidden className="[@media(hover:none)]:hidden">
- /
- </Kbd>
- </button>
- </div>
- <LauncherColumns kind={kind} current={launcherCurrent(pathname)} now={now} />
- </div>
- );
-}
-
-/**
- * The bar's Studios item and its panel: its name goes to /studios, its chevron (or ArrowDown on the name) opens the
- * panel. The panel hangs from the bar (the header is its positioned parent) and spans it. It
- * is mounted, hidden, the first time the pointer or focus comes to the item, so its covers are loading before the click.
- * `active`: a studio's page is open; `current`: /studios itself; `onTap`: the name was clicked.
- */
-export function StudiosLauncher({ active, current, onTap }: { active?: boolean; current?: boolean; onTap?: (href: string) => void }) {
- const { launcherOpen: open, setLauncherOpen, launcherGroup, launcherReturnTo } = useNavUi();
- const search = useSearchPalette();
- const [warm, setWarm] = useState(false);
- const shown = warm || open;
- const root = useRef<HTMLDivElement>(null);
- const trigger = useRef<HTMLButtonElement>(null);
- const panel = useRef<HTMLElement>(null);
- // Opened with this button: it takes focus to the first lead card. Opened from elsewhere (an "All studios" button,
- // openStudios): focus goes to the lead card of the group asked for.
- const byButton = useRef(false);
-
- const close = useCallback(
- (returnFocus: boolean) => {
- const back = launcherReturnTo();
- setLauncherOpen(false);
- if (returnFocus) (back?.isConnected ? back : trigger.current)?.focus();
- },
- [launcherReturnTo, setLauncherOpen],
- );
- const closeQuietly = useCallback(() => close(false), [close]);
-
- useEffect(() => {
- if (!open) return;
- // Opened: the routes one click here leads to start loading.
- warmNav("studios");
- const col = byButton.current ? 0 : Math.max(0, launcherColumns(undefined).findIndex((c) => c.group.id === (launcherGroup ?? "film")));
- byButton.current = false;
- panel.current?.querySelector<HTMLElement>(`[data-col="${col}"][data-row="0"]`)?.focus();
- }, [open, launcherGroup]);
-
- // While open: a press outside closes it (the press goes on to what it was on), and Esc closes it from anywhere.
- useEffect(() => {
- if (!open) return;
- const down = (e: PointerEvent) => {
- if (!root.current?.contains(e.target as Node)) close(false);
- };
- const key = (e: KeyboardEvent) => {
- if (e.key !== "Escape" || e.defaultPrevented) return;
- e.preventDefault();
- close(true);
- };
- document.addEventListener("pointerdown", down, true);
- document.addEventListener("keydown", key);
- return () => {
- document.removeEventListener("pointerdown", down, true);
- document.removeEventListener("keydown", key);
- };
- }, [open, close]);
-
- const toggle = () => {
- if (open) return close(false);
- byButton.current = true;
- setWarm(true);
- setLauncherOpen(true);
- };
-
- const onPanelKey = (e: React.KeyboardEvent) => {
- const at = (e.target as HTMLElement).closest<HTMLElement>("[data-col]");
- if (!at || !panel.current) return;
- const lengths = [...panel.current.querySelectorAll("[data-group]")].map((g) => g.querySelectorAll("[data-col]").length);
- const next = launcherMove(lengths, { col: Number(at.dataset.col), row: Number(at.dataset.row) }, e.key);
- if (/^(Arrow|Home$|End$)/.test(e.key)) e.preventDefault();
- if (next) panel.current.querySelector<HTMLElement>(`[data-col="${next.col}"][data-row="${next.row}"]`)?.focus();
- };
-
- // The mouse moves the keyboard's place: the link under it takes focus (quietly: the ring is the keyboard's), so the
- // arrow keys go on from where the mouse left off and only one link is ever highlighted.
- const onPanelPointer = (e: React.PointerEvent) => {
- if (e.pointerType !== "mouse") return;
- const at = (e.target as HTMLElement).closest<HTMLElement>("[data-col]");
- if (at && at !== document.activeElement) at.focus({ preventScroll: true });
- };
-
- return (
- <div
- ref={root}
- className="contents"
- onBlur={(e) => {
- // Focus went somewhere else on the page (Tab past the last link, a click on a field): close. Focus lost to
- // nothing (a press on the panel's padding) keeps it open; a press outside closes it above.
- const to = e.relatedTarget as Node | null;
- if (open && to && !root.current?.contains(to)) close(false);
- }}
- >
- <div
- data-bar-split
- data-active={active || undefined}
- data-open={open || undefined}
- className={BAR_SPLIT}
- // The panel mounts, hidden, so its covers load before a click (it opens by a click or a key only: it spans the
- // page, so resting the pointer on the bar never covers it).
- onPointerEnter={() => setWarm(true)}
- >
- <IntentLink
- href={STUDIOS_AREA_HREF}
- aria-current={current ? "page" : undefined}
- aria-label={`Studios, ${studioCount()} studios`}
- className={BAR_LABEL}
- onFocus={() => setWarm(true)}
- onClick={(e) => {
- if (open) close(false);
- if (isPlainClick(e)) onTap?.(STUDIOS_AREA_HREF);
- }}
- onKeyDown={(e) => {
- if (e.key !== "ArrowDown" || e.altKey || e.metaKey || e.ctrlKey || open) return;
- e.preventDefault();
- toggle();
- }}
- >
- Studios
- <span className="rounded-full bg-brand-faint px-1.5 py-px text-[11px] leading-4 font-semibold text-brand-text tabular-nums">{studioCount()}</span>
- </IntentLink>
- <button
- ref={trigger}
- type="button"
- aria-label="Studios menu"
- aria-expanded={open}
- // The panel is on the page once warmed (hover, focus) or open.
- aria-controls={shown ? LAUNCHER_ID : undefined}
- data-studios-trigger
- data-state={open ? "open" : "closed"}
- className={BAR_CHEVRON}
- onFocus={() => setWarm(true)}
- // Click, Enter and Space open it with focus on the first lead card (arrow keys and Tab go on from there).
- onClick={toggle}
- onKeyDown={(e) => {
- if (e.key !== "ArrowDown" || open) return;
- e.preventDefault();
- toggle();
- }}
- >
- <BarChevron />
- </button>
- </div>
- {shown && (
- <section
- ref={panel}
- id={LAUNCHER_ID}
- aria-label="All studios"
- hidden={!open}
- onKeyDown={onPanelKey}
- onPointerMove={onPanelPointer}
- onClick={(e) => {
- if ((e.target as Element).closest("a[href]")) close(false);
- }}
- className={LAUNCHER_PANEL}
- >
- <LauncherPanel
- onClose={closeQuietly}
- onSearch={() => {
- // Studios gets focus first, so it is where Esc in the search comes back to (the panel is gone by then).
- close(true);
- search.open();
- }}
- />
- </section>
- )}
- </div>
- );
-}
-
-/** Dims the page under the open launcher (decoration: presses go through to the page, which closes the launcher). */
-export function LauncherScrim() {
- const { launcherOpen } = useNavUi();
- if (!launcherOpen) return null;
- return (
- <div
- aria-hidden
- className="pointer-events-none fixed inset-x-0 top-14 bottom-0 z-[39] hidden bg-overlay md:block motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150 print:hidden"
- />
- );
-}
diff --git a/src/components/nav/studios-sheet.tsx b/src/components/nav/studios-sheet.tsx
index 7ac96c75..7022c747 100644
--- a/src/components/nav/studios-sheet.tsx
+++ b/src/components/nav/studios-sheet.tsx
@@ -1,31 +1,35 @@
"use client";
-import { usePathname } from "next/navigation";
-import { useState } from "react";
-import { CircleUserRound, House, Library, Search } from "lucide-react";
+import { usePathname, useSearchParams } from "next/navigation";
+import { lazy, Suspense, useEffect, useState } from "react";
+import { ArrowRight, CircleUserRound, House, Library, RotateCw, Search } from "lucide-react";
import { CoverThumb } from "@/components/nav/cover-thumb";
import { useNavUi, useViewerKind } from "@/components/nav/nav-ui";
import { IntentLink } from "@/components/intent-link";
-import { isNew, LAUNCHER_GROUPS, launcherActive, launcherEntries, type LauncherGroupId, type NavEntry } from "@/lib/nav-model";
import { onAttr, TAB_PILL, TabRow, useSwapFade } from "@/components/ui/tab-row";
+import { MEGA_AREAS, type MegaId, type MegaItem, type MegaModel } from "@/lib/mega-menus";
+import { isNew } from "@/lib/nav-model";
+import { cn } from "@/lib/utils";
+import { megaCurrent } from "./mega-launcher";
+import { useMegaMenu, warmMenu } from "./mega-data";
-function Tile({ entry, current }: { entry: NavEntry; current: boolean }) {
+/** The families the sheet shows, in the bar's order. */
+export const SHEET_FAMILIES: readonly MegaId[] = ["studios", "apps", "motions", "canvas"];
+
+/** How many of each column a fetched menu's "All" shows (so the whole set fits a 390 x 844 phone). */
+const ALL_PER_COLUMN = 4;
+
+function Tile({ entry, current }: { entry: MegaItem; current: boolean }) {
const fresh = isNew(entry);
return (
<li className="min-w-0">
<IntentLink
href={entry.href}
aria-current={current ? "page" : undefined}
- className="nav-row nav-mark-under group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-1 pb-2.5 text-center"
+ className="nav-row nav-mark-under group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-1.5 text-center"
>
<span className="relative">
- <CoverThumb
- id={entry.cover}
- icon={entry.icon}
- size="tile"
- eager
- className="size-13"
- />
+ <CoverThumb id={entry.navCover} cover={entry.cover} icon={entry.icon} size="tile" eager className="size-13" />
{fresh && (
<span aria-hidden className="absolute -top-1 -right-1.5 rounded-full bg-highlight px-1 py-px text-[9px] leading-none font-semibold text-highlight-foreground">
New
@@ -44,6 +48,34 @@ function Tile({ entry, current }: { entry: NavEntry; current: boolean }) {
);
}
+/** A grid's closing tile: the family's (or a part of it's) whole set. */
+function SeeAllTile({ href, label, name }: { href: string; label: string; name: string }) {
+ return (
+ <li className="min-w-0">
+ <IntentLink href={href} aria-label={name} className="nav-row group/tile flex flex-col items-center gap-1 rounded-[16px] px-0.5 pt-0.5 pb-1.5 text-center text-brand-text">
+ <span aria-hidden className="grid size-13 place-items-center rounded-[14px] border border-dashed border-border-strong bg-brand-faint/40">
+ <ArrowRight className="size-5" />
+ </span>
+ <span aria-hidden className="line-clamp-2 text-[11px] leading-[1.2] font-medium">
+ {label}
+ </span>
+ </IntentLink>
+ </li>
+ );
+}
+
+/** A ready board as a phone card: its finished scene (16:9) with its name under it. */
+function BoardCard({ entry, current }: { entry: MegaItem; current: boolean }) {
+ return (
+ <li className="min-w-0">
+ <IntentLink href={entry.href} aria-current={current ? "page" : undefined} className="nav-row nav-mark-under flex min-w-0 flex-col gap-1 rounded-[14px] p-1">
+ <CoverThumb cover={entry.cover} icon={entry.icon} size="tile16" eager />
+ <span className="truncate px-0.5 text-[12px] leading-4 font-medium">{entry.label}</span>
+ </IntentLink>
+ </li>
+ );
+}
+
const SHORTCUT =
"nav-focus flex h-11 min-w-0 items-center justify-center gap-1.5 rounded-xl bg-secondary px-2 text-[12.5px] font-medium text-secondary-foreground active:bg-[var(--nav-press)]";
@@ -71,36 +103,130 @@ function Shortcuts({ onSearch }: { onSearch: () => void }) {
);
}
+/** The sheet's family switch, in its title row: Studios · Apps · Motions & effects · Canvas. */
+export function FamilySwitch({ family, onFamily }: { family: MegaId; onFamily: (f: MegaId) => void }) {
+ return (
+ <TabRow role="group" aria-label="What to show" follow className="min-w-0 flex-1 gap-0.5">
+ {SHEET_FAMILIES.map((f) => (
+ <button key={f} type="button" aria-pressed={family === f} {...onAttr(family === f)} onClick={() => onFamily(f)} className={cn(TAB_PILL, "px-[7px] text-[14px]")}>
+ {MEGA_AREAS[f].label}
+ </button>
+ ))}
+ </TabRow>
+ );
+}
+
+/** The owner's New board button (the Canvas family), loaded only when the owner shows it. */
+const NewBoardButton = lazy(() => import("./mega-canvas-owner").then((m) => ({ default: m.NewBoardButton })));
+
+/** A chip's items: one column's lead and rows, or a few of each for All. */
+function chipItems(model: MegaModel, chip: string | null): MegaItem[] {
+ const cols = model.columns.filter((c) => !chip || c.id === chip);
+ return cols.flatMap((c) => {
+ const items = [...(c.lead ? [c.lead] : []), ...c.rows];
+ return chip || model.id === "canvas" || model.id === "studios" ? items : items.slice(0, ALL_PER_COLUMN);
+ });
+}
+
/**
- * The Studios sheet's body (the phone's launcher): every studio on one screen as cover tiles, grouped by what you want to
- * make, with chips that narrow it to one group. All of them fit a 390 x 844 phone without scrolling; a shorter screen
- * scrolls the grid inside the sheet, never the page. The frame, its title and its close button are PhoneSheets'.
+ * The Studios sheet's body (the phone's launcher): every studio, app, motion or effect, or ready board on one screen as
+ * cover tiles, grouped as the bar's menus are, with chips that narrow it to one group. Studios, Apps and Motions &
+ * effects fit a 390 x 844 phone without scrolling; anything taller scrolls inside the sheet, never the page. The frame,
+ * its family switch and its close button are PhoneSheets'.
*/
-export function StudiosSheet({ group: initial, onSearch }: { group?: LauncherGroupId; onSearch: () => void }) {
+export function StudiosSheet({ family = "studios", group: initial, onSearch }: { family?: MegaId; group?: string; onSearch: () => void }) {
const kind = useViewerKind();
const pathname = usePathname() ?? "";
- const [group, setGroup] = useState<LauncherGroupId | null>(initial ?? null);
- const tiles = launcherEntries(kind, group ?? undefined);
- const current = launcherActive(pathname);
- const chips: { id: LauncherGroupId | null; label: string }[] = [{ id: null, label: "All" }, ...LAUNCHER_GROUPS.map((g) => ({ id: g.id, label: g.chip }))];
- // A goal tapped: its studios fade in (they are there at once).
- const tilesRef = useSwapFade<HTMLDivElement>(group);
+ const [group, setGroup] = useState<string | null>(initial ?? null);
+ const { model, failed, retry } = useMegaMenu(family, kind);
+ useEffect(() => warmMenu(family), [family]);
+ // The query too: moving from one preset to another (/video?preset=…) keeps the path.
+ const current = megaCurrent(family, pathname, useSearchParams()?.toString() ?? "");
+ const area = MEGA_AREAS[family];
+ // Canvas: its "Start here" column is the desktop's; on a phone the boards are the grid.
+ const columns = model?.columns.filter((c) => !(family === "canvas" && c.id === "start")) ?? [];
+ const chips: { id: string | null; label: string }[] = [{ id: null, label: "All" }, ...columns.map((c) => ({ id: c.id, label: c.chip }))];
+ // Canvas' "What's a canvas?" (a finished board's scene, which the sections leave out) opens its All grid.
+ const intro = family === "canvas" && !group ? model?.columns.find((c) => c.id === "start")?.lead : undefined;
+ const items = model ? [...(intro ? [intro] : []), ...chipItems({ ...model, columns }, group)] : [];
+ const families = model?.families;
+ const seeAll =
+ group && families
+ ? (() => {
+ const f = families.find((x) => x.id === columns.find((c) => c.id === group)?.family);
+ return f && { href: f.href, label: `All ${f.count}`, name: `See all ${f.label.toLowerCase()}` };
+ })()
+ : { href: area.href, label: model ? `See all ${model.count}` : "See all", name: model?.seeAll.name ?? `See all ${area.label.toLowerCase()}` };
+ // A group tapped: its tiles fade in (they are there at once).
+ const tilesRef = useSwapFade<HTMLDivElement>(model ? `${family}/${group ?? ""}` : null);
return (
<>
<Shortcuts onSearch={onSearch} />
- <TabRow role="group" aria-label="Show the studios for one goal" follow className="m-0 shrink-0 px-4 py-1.5">
- {chips.map((c) => (
- <button key={c.id ?? "all"} type="button" aria-pressed={group === c.id} className={TAB_PILL} {...onAttr(group === c.id)} onClick={() => setGroup(c.id)}>
- {c.label}
- </button>
- ))}
- </TabRow>
- <div ref={tilesRef} className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4">
- <ul aria-label={group ? LAUNCHER_GROUPS.find((g) => g.id === group)?.label : "All studios"} className="grid grid-cols-5 gap-x-1 gap-y-0.5 pb-1">
- {tiles.map((e) => (
- <Tile key={e.id} entry={e} current={e.id === current} />
+ <TabRow
+ role="group"
+ aria-label={family === "studios" ? "Show the studios for one goal" : `Show one group of ${area.label.toLowerCase()}`}
+ follow
+ className="m-0 shrink-0 px-4 py-1.5"
+ >
+ <button type="button" onClick={onSearch} aria-label="Search everything" className={cn(TAB_PILL, "px-2.5 text-brand-text [html[data-fullscreen-studio]_&]:hidden")}>
+ <Search className="size-4" aria-hidden />
+ </button>
+ {model &&
+ // A chip per group (Canvas: per section, even one, so its row is never a lone search button).
+ chips.length > (family === "canvas" ? 1 : 2) &&
+ chips.map((c) => (
+ <button key={c.id ?? "all"} type="button" aria-pressed={group === c.id} className={TAB_PILL} {...onAttr(group === c.id)} onClick={() => setGroup(c.id)}>
+ {c.label}
+ </button>
))}
- </ul>
+ </TabRow>
+ <div ref={tilesRef} className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4" data-sheet-family={family}>
+ {failed ? (
+ <p className="flex items-center gap-2 py-6 text-[14px] text-muted-foreground">
+ Couldn&apos;t load this.
+ <button type="button" onClick={retry} className="nav-row inline-flex h-11 items-center gap-1.5 rounded-full px-3 font-medium text-foreground">
+ <RotateCw className="size-4" aria-hidden /> Try again
+ </button>
+ </p>
+ ) : !model ? (
+ <ul aria-hidden className="grid grid-cols-5 gap-x-1 pb-1">
+ {Array.from({ length: 30 }, (_, i) => (
+ <li key={i} className="flex flex-col items-center gap-1 px-0.5 pt-0.5 pb-1.5">
+ <span className="size-13 rounded-[14px] bg-muted" />
+ <span className="h-3 w-10 rounded bg-muted/60" />
+ </li>
+ ))}
+ </ul>
+ ) : family === "canvas" ? (
+ <>
+ {kind === "owner" && (
+ <Suspense fallback={<div className="mb-2 h-11 rounded-full bg-muted" />}>
+ <NewBoardButton />
+ </Suspense>
+ )}
+ <ul aria-label={area.panel} className="grid grid-cols-2 gap-x-2 gap-y-1 pb-1">
+ {items.map((e) => (
+ <BoardCard key={e.id} entry={e} current={e.id === current} />
+ ))}
+ <li className="min-w-0">
+ <IntentLink href="/canvas?tab=templates" className="nav-row flex min-w-0 flex-col gap-1 rounded-[14px] p-1 text-brand-text">
+ <span aria-hidden className="grid aspect-video w-full place-items-center rounded-[10px] border border-dashed border-border-strong bg-brand-faint/40">
+ <ArrowRight className="size-5" />
+ </span>
+ <span className="truncate px-0.5 text-[12px] leading-4 font-medium">See all ready boards</span>
+ </IntentLink>
+ </li>
+ </ul>
+ </>
+ ) : (
+ <ul aria-label={group ? columns.find((c) => c.id === group)?.label : area.panel} className="grid grid-cols-5 gap-x-1 pb-1">
+ {items.map((e) => (
+ <Tile key={e.id} entry={e} current={e.id === current} />
+ ))}
+ {seeAll && family !== "studios" && <SeeAllTile {...seeAll} />}
+ {family === "studios" && <SeeAllTile href={area.href} label="See all" name="See all studios" />}
+ </ul>
+ )}
</div>
</>
);
diff --git a/src/components/nav/top-bar.tsx b/src/components/nav/top-bar.tsx
index 91ad6f31..cc8ef47d 100644
--- a/src/components/nav/top-bar.tsx
+++ b/src/components/nav/top-bar.tsx
@@ -2,7 +2,7 @@
import { ChevronDown, MoreHorizontal, Plus, Search } from "lucide-react";
import { usePathname } from "next/navigation";
-import { Suspense } from "react";
+import { Suspense, useEffect } from "react";
import { IntentLink } from "@/components/intent-link";
import { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Kbd } from "@/components/ui/kbd";
@@ -11,7 +11,6 @@ import { area, areaOfPath, areaPageOf, type AreaId } from "@/lib/nav-areas";
import { activeEntry, entry, type NavEntry } from "@/lib/nav-model";
import { isPlainClick, useTappedTab } from "@/lib/use-tapped-tab";
import { cn } from "@/lib/utils";
-import { BarSplitMenu } from "./bar-split";
import { CoverThumb, NavIcon } from "./cover-thumb";
import { CreateMenu } from "./create-menu";
import { MENU_ROW_2, NavMenuItem, ROW_LINE, rowName, SeeAllRow } from "./nav-row";
@@ -19,7 +18,10 @@ import { useViewerKind } from "./nav-ui";
import { useSearchPalette } from "./search-context";
import { BarPills } from "./status-chips";
import { NavPrefetcher, warmNav } from "./nav-prefetch";
-import { LauncherScrim, StudiosLauncher } from "./studios-launcher";
+import type { FetchedMegaId } from "@/lib/mega-menus";
+import { queueIdlePrefetch } from "@/lib/idle-prefetch";
+import { prefetchMenus } from "./mega-data";
+import { MegaLauncher, MegaScrim, preloadMegaPanel } from "./mega-launcher";
import { ViewerSlot } from "./viewer-slot";
export { prefetchHrefs } from "./nav-prefetch";
@@ -28,7 +30,8 @@ export { prefetchHrefs } from "./nav-prefetch";
* The top bar (md and up): the wordmark, Create, Studios (the launcher), Apps, Motions & effects, Canvas, Assist and
* Library; search; New creation; who is looking. 56 px on every page. What doesn't fit moves into More, by CSS alone
* (nothing is measured, so nothing moves after the first paint):
- * 1440 and up everything, search 280 px, a guest's Log in
+ * 1600 and up everything, search 280 px, a guest's Log in
+ * 1440-1599 the same, search 220 px (Apps, Motions & effects and Canvas each carry a chevron)
* 1280-1439 Canvas and Assist in More, search 200 px
* 1024-1279 Apps and Motions & effects in More too
* 768-1023 the same, search and New creation as icon buttons
@@ -55,6 +58,8 @@ export function barActive(pathname: string): {
apps: boolean;
motions: boolean;
canvas: boolean;
+ /** /canvas itself (the Canvas item's own page). */
+ canvasHome: boolean;
assist: boolean;
library: boolean;
page: AreaId | undefined;
@@ -67,6 +72,7 @@ export function barActive(pathname: string): {
apps: area === "apps",
motions: area === "motions",
canvas: e?.id === "canvas",
+ canvasHome: pathname === "/canvas",
assist: e?.id === "assist",
library: e?.kind === "library",
page: pathname ? areaPageOf(pathname) : undefined,
@@ -100,37 +106,6 @@ function useOn(): (e: NavEntry) => boolean {
const MOTIONS_AREA_HREF = area("motions").href;
-function MotionsItems() {
- const on = useOn();
- return (
- <>
- {pick(["motions", "effects"]).map((e) => (
- <RichItem key={e.id} e={e} current={on(e)} />
- ))}
- <SeeAllRow href={MOTIONS_AREA_HREF} name="See all motions & effects" className="mt-1" />
- </>
- );
-}
-
-/** Motions & effects: its name goes to the page with both; the menu holds the two preset galleries, with their covers. */
-function MotionsMenu({ active, onTap }: { active: Active; onTap?: (href: string) => void }) {
- return (
- <BarSplitMenu
- href={MOTIONS_AREA_HREF}
- label="Motions & effects"
- name="Motions & effects menu"
- active={active.motions}
- current={active.page === "motions"}
- panel="more"
- onTap={onTap}
- className="hidden xl:inline-flex"
- contentClassName="w-80 p-1.5"
- >
- <MotionsItems />
- </BarSplitMenu>
- );
-}
-
function MoreItems() {
const on = useOn();
return (
@@ -194,14 +169,11 @@ function BarLinks({ active, onTap }: { active: Active; onTap?: (href: string) =>
return (
<>
<CreateMenu active={active.create} current={active.page === "create"} onTap={onTap} />
- <StudiosLauncher active={active.studios} current={active.page === "studios"} onTap={onTap} />
- <IntentLink href="/apps" onClick={tap("/apps")} aria-current={cur(active.apps)} className={cn(BAR_ITEM, "hidden xl:inline-flex")}>
- Apps
- </IntentLink>
- <MotionsMenu active={active} onTap={onTap} />
- <IntentLink href="/canvas" onClick={tap("/canvas")} aria-current={cur(active.canvas)} className={cn(BAR_ITEM, "hidden min-[1440px]:inline-flex")}>
- Canvas
- </IntentLink>
+ <MegaLauncher id="studios" active={active.studios} current={active.page === "studios"} onTap={onTap} />
+ {/* /apps is the area's own page (its name is marked); an app's page marks the item. */}
+ <MegaLauncher id="apps" active={active.apps && active.page !== "apps"} current={active.page === "apps"} onTap={onTap} className="hidden xl:inline-flex" />
+ <MegaLauncher id="motions" active={active.motions} current={active.page === "motions"} onTap={onTap} className="hidden xl:inline-flex" />
+ <MegaLauncher id="canvas" active={active.canvas && !active.canvasHome} current={active.canvasHome} onTap={onTap} className="hidden min-[1440px]:inline-flex" />
<IntentLink href="/assist" eager onClick={tap("/assist")} aria-current={cur(active.assist)} className={cn(BAR_ITEM, "hidden min-[1440px]:inline-flex")}>
Assist
</IntentLink>
@@ -234,14 +206,15 @@ function SearchField() {
className={cn(
"nav-focus inline-flex h-10 shrink-0 items-center gap-2 rounded-[10px] text-[13.5px] [@media(pointer:coarse)]:h-11 text-muted-foreground motion-safe:transition-colors",
"w-10 justify-center nav-hover:bg-[var(--nav-hi)] nav-hover:text-foreground active:bg-[var(--nav-press)] [@media(pointer:coarse)]:w-11",
- "lg:max-[1439.98px]:w-[200px] lg:justify-start lg:border lg:border-input lg:bg-background/60 lg:px-3 lg:nav-hover:border-border-strong lg:nav-hover:bg-background lg:active:bg-background min-[1440px]:w-[280px]",
+ "lg:max-[1439.98px]:w-[200px] lg:justify-start lg:border lg:border-input lg:bg-background/60 lg:px-3 lg:nav-hover:border-border-strong lg:nav-hover:bg-background lg:active:bg-background min-[1440px]:max-[1599.98px]:w-[220px] min-[1600px]:w-[280px]",
)}
>
<Search aria-hidden className="size-[18px] shrink-0 lg:size-4" />
- {/* Its name is the words it shows: "Search Fuobe" to 1439 px, the longer line from 1440 (sr-only below lg). */}
- <span className="sr-only min-w-0 flex-1 truncate text-left lg:not-sr-only">
- <span className="min-[1440px]:hidden">Search Fuobe</span>
- <span className="hidden min-[1440px]:inline">Search studios, apps, effects…</span>
+ {/* Its name is the words it shows: "Search Fuobe" to 1599 px, the longer line from 1600 where the field is 280 px
+ wide (sr-only below lg). One line always: not-sr-only would let it wrap. */}
+ <span className="sr-only min-w-0 flex-1 truncate text-left lg:not-sr-only lg:whitespace-nowrap">
+ <span className="min-[1600px]:hidden">Search Fuobe</span>
+ <span className="hidden min-[1600px]:inline">Search studios, apps, effects…</span>
</span>
<Kbd aria-hidden className="hidden lg:inline-flex [@media(hover:none)]:hidden">
/
@@ -281,6 +254,36 @@ function RightCluster() {
);
}
+/**
+ * Once the page has loaded and the browser is idle: the panels' body (its own chunk) and the data (no pictures) of the
+ * grouped menus whose item the bar shows at this width, so the first open never waits for them. A phone loads none
+ * (its sheet asks when it shows one).
+ */
+function MenuPrefetch() {
+ useEffect(() => {
+ if (!window.matchMedia("(min-width: 768px)").matches) return;
+ const ids: FetchedMegaId[] = [];
+ if (window.matchMedia("(min-width: 1280px)").matches) ids.push("apps", "motions");
+ if (window.matchMedia("(min-width: 1440px)").matches) ids.push("canvas");
+ let cancel = () => {};
+ const go = () => {
+ const body = queueIdlePrefetch("nav", "mega-panel", preloadMegaPanel);
+ const data = prefetchMenus(ids);
+ cancel = () => {
+ body();
+ data();
+ };
+ };
+ if (document.readyState === "complete") go();
+ else window.addEventListener("load", go, { once: true });
+ return () => {
+ window.removeEventListener("load", go);
+ cancel();
+ };
+ }, []);
+ return null;
+}
+
/** The bar. Hidden below md and in print; same height on every page, full-screen studios included. */
export function TopBar() {
return (
@@ -307,8 +310,9 @@ export function TopBar() {
<RightCluster />
</div>
</header>
- <LauncherScrim />
+ <MegaScrim />
<NavPrefetcher />
+ <MenuPrefetch />
</>
);
}
diff --git a/src/components/preset-preview.tsx b/src/components/preset-preview.tsx
index fd575ece..d87a9e01 100644
--- a/src/components/preset-preview.tsx
+++ b/src/components/preset-preview.tsx
@@ -288,6 +288,9 @@ const CLIP_ASPECT = 4 / 3;
/** When the clips' shared cycle began (performance.now()), set by the first clip ready to play by itself (Clip). */
let cycleStart: number | undefined;
+/** The end of an effect clip that a loop ending early (rest.until) never reaches (s): where it fades back to its photo. */
+export const CLIP_TAIL = 0.4;
+
/**
* A real cover's clip, mounted only while it plays (a browser allows a page only so many live
* players, a phone fewer), over the poster until its first frame is ready. The poster is that
@@ -337,6 +340,30 @@ function Clip({ src, rest, asked, place, focus }: { src: string; rest?: Preview[
const t = setTimeout(() => setDue(true), untilPlace(place!, now - cycleStart));
return () => clearTimeout(t);
}, [ready, due, place]);
+ // A loop that ends before the clip does (rest.until): back to rest.from from there, checked on every frame shown where
+ // the browser says when one is (requestVideoFrameCallback), else on each time update. The clip's last stretch
+ // (CLIP_TAIL), where an effect fades back to its photo, is never shown.
+ const until = rest?.until;
+ const from = rest?.from ?? 0;
+ useEffect(() => {
+ const v = ref.current;
+ if (!v || until === undefined) return;
+ const end = () => Math.min(until, Number.isFinite(v.duration) && v.duration > 0 ? v.duration - CLIP_TAIL : until);
+ const check = () => {
+ if (v.currentTime >= end()) v.currentTime = from;
+ };
+ if (typeof v.requestVideoFrameCallback === "function") {
+ let id = 0;
+ const tick = () => {
+ check();
+ id = v.requestVideoFrameCallback(tick);
+ };
+ id = v.requestVideoFrameCallback(tick);
+ return () => v.cancelVideoFrameCallback(id);
+ }
+ v.addEventListener("timeupdate", check);
+ return () => v.removeEventListener("timeupdate", check);
+ }, [until, from]);
const seeks = start > 0;
return (
<video
diff --git a/src/components/starters/starter-card.tsx b/src/components/starters/starter-card.tsx
index d17071b9..69755325 100644
--- a/src/components/starters/starter-card.tsx
+++ b/src/components/starters/starter-card.tsx
@@ -13,9 +13,9 @@ export interface StarterCardProps {
cover?: TemplateCover;
/** The tint behind a card without a cover. */
hue: number;
- /** The steps in a few words, over the cover's bottom-right corner. */
+ /** The steps in a few words: a small line under the title, never over the cover. */
flow?: ReactNode;
- /** The steps in miniature, filling a card that has no cover yet. */
+ /** What fills a card that has no cover yet (the owner's only: a visitor never gets such a card). */
overlay: ReactNode;
icon: ReactNode;
title: string;
@@ -38,8 +38,8 @@ export interface StarterCardProps {
}
/**
- * A ready-made starter as a card: its cover with its steps in a few words over a corner, an icon badge, a title, one
- * line of description and one action. The cards of a row line up: the description takes two lines at most and the
+ * A ready-made starter as a card: its cover with an icon badge, a title, its steps in a few words, one line of
+ * description and one action. Only the icon badge sits on the cover, so the picture shows whole. The cards of a row line up: the description takes two lines at most and the
* action sits at the foot.
*/
export function StarterCard({ coverKey, cover, hue, flow, overlay, icon, title, description, href, meta, badge, action, wide, compact, coverTop, className }: StarterCardProps) {
@@ -73,13 +73,15 @@ export function StarterCard({ coverKey, cover, hue, flow, overlay, icon, title,
) : (
<CoverArt cover={cover} sizes={`(max-width: 640px) ${compact ? "112px" : "100vw"}, (max-width: 1024px) 50vw, 440px`} playing={playing} asked={asked} />
)}
- {flow && <span className={cn("pointer-events-none absolute right-2.5 bottom-2.5", compact && "max-sm:hidden")}>{flow}</span>}
{iconBadge}
</div>
) : (
- <div className={cn("relative bg-muted/50", shape)} style={{ background: `linear-gradient(135deg, oklch(0.62 0.12 ${hue} / 0.14), transparent 70%)` }}>
+ <div
+ data-no-cover
+ className={cn("relative bg-muted/50", shape)}
+ style={{ background: `linear-gradient(135deg, oklch(0.62 0.12 ${hue} / 0.22), oklch(0.62 0.12 ${hue} / 0.06) 75%)` }}
+ >
<div className="absolute inset-0">{overlay}</div>
- {iconBadge}
</div>
)}
{badge && <span className={cn("pointer-events-none absolute top-3 right-3 rounded-full bg-background/90 px-2 py-0.5 text-[11px] font-medium text-muted-foreground shadow-soft", compact && "max-sm:top-auto max-sm:right-auto max-sm:bottom-2 max-sm:left-2")}>{badge}</span>}
@@ -91,6 +93,7 @@ export function StarterCard({ coverKey, cover, hue, flow, overlay, icon, title,
{title}
</Link>
</h3>
+ {flow && <div className={cn("mt-0.5 mb-1", compact && "max-sm:hidden")}>{flow}</div>}
<p className="line-clamp-2 text-[13px] text-muted-foreground">{description}</p>
</div>
{meta}
diff --git a/src/lib/canvas-sections.ts b/src/lib/canvas-sections.ts
index 17e8d6df..da106503 100644
--- a/src/lib/canvas-sections.ts
+++ b/src/lib/canvas-sections.ts
@@ -14,7 +14,7 @@ export const TEMPLATE_SECTIONS = [
export type TemplateSectionKey = Exclude<(typeof TEMPLATE_SECTIONS)[number]["key"], "">;
-/** A template as the list shows it: its board outline and model names per engine (the model names are the owner's). */
+/** A template as the list shows it: its board outline per engine (no model names: those are the owner's, TemplateModels). */
export interface TemplateCardData {
id: string;
name: string;
@@ -27,10 +27,15 @@ export interface TemplateCardData {
flow: string[];
/** false: no ready board of its own: the owner's "More templates" only. */
starter?: false;
- /** ifOff: a model's name and the one its node falls back to when the model is off on this install. */
- byEngine: Record<Engine, { outline: Outline; models: string[]; ifOff?: { id: string; name: string; instead: string }[] }>;
+ byEngine: Record<Engine, { outline: Outline }>;
}
+/**
+ * A template's model names per engine, for the owner only (GET /api/canvases/template-models): never in a page's data.
+ * ifOff: a model's name and the one its node falls back to when the model is off on this install.
+ */
+export type TemplateModels = Record<Engine, { models: string[]; ifOff?: { id: string; name: string; instead: string }[] }>;
+
/** An input of a template's board, as its page shows it. */
export interface TemplateInput {
id: string;
diff --git a/src/lib/canvas-template-cards.ts b/src/lib/canvas-template-cards.ts
index 9c5d34d1..cda3b59f 100644
--- a/src/lib/canvas-template-cards.ts
+++ b/src/lib/canvas-template-cards.ts
@@ -6,25 +6,30 @@ import { EXAMPLE_MEDIA } from "@/lib/examples/media.generated";
import plan from "@/lib/examples/plan.json";
import { presetCover } from "@/lib/preset-covers";
import { templateCover } from "@/lib/template-covers";
-import type { CanvasIntro, TemplateCardData, TemplateDetail, TemplateInput } from "@/lib/canvas-sections";
+import type { CanvasIntro, TemplateCardData, TemplateDetail, TemplateInput, TemplateModels } from "@/lib/canvas-sections";
/**
- * One template's board outline and model names on an engine, with the name a node falls back to when its model is
- * switched off in Models & licences (the card swaps it in the browser, as the board the server makes does).
+ * One template's model names on an engine, with the name a node falls back to when its model is switched off in Models
+ * & licences (the card swaps it in the browser, as the board the server makes does).
*/
-function forEngine(t: CanvasTemplate, engine: Engine): TemplateCardData["byEngine"][Engine] {
+function modelsOn(t: CanvasTemplate, engine: Engine): TemplateModels[Engine] {
const graph = t.build(engine);
const nameOf = (id?: string) => getModel(id ?? "")?.name;
const names = graph.nodes.filter(isGenerator).map((n) => nameOf(n.data.modelId));
const without = t.build(engine, () => false).nodes;
- const ifOff: NonNullable<TemplateCardData["byEngine"][Engine]["ifOff"]> = [];
+ const ifOff: NonNullable<TemplateModels[Engine]["ifOff"]> = [];
for (const n of graph.nodes) {
const id = n.data.modelId;
const name = nameOf(id);
const instead = nameOf(without.find((x) => x.id === n.id)?.data.modelId);
if (id && name && instead && instead !== name && !ifOff.some((x) => x.id === id)) ifOff.push({ id, name, instead });
}
- return { outline: outline(graph), models: [...new Set(names.filter((m): m is string => !!m))], ...(ifOff.length && { ifOff }) };
+ return { models: [...new Set(names.filter((m): m is string => !!m))], ...(ifOff.length && { ifOff }) };
+}
+
+/** Every template's model names, by id: the owner's (GET /api/canvases/template-models), never in a page's data. */
+export function templateModels(): Record<string, TemplateModels> {
+ return Object.fromEntries(CANVAS_TEMPLATES.map((t) => [t.id, { cloud: modelsOn(t, "cloud"), open: modelsOn(t, "open") }]));
}
function card(t: CanvasTemplate): TemplateCardData {
@@ -38,7 +43,7 @@ function card(t: CanvasTemplate): TemplateCardData {
rank: t.rank,
flow: t.flow,
...(t.starter === false && { starter: false as const }),
- byEngine: { cloud: forEngine(t, "cloud"), open: forEngine(t, "open") },
+ byEngine: { cloud: { outline: outline(t.build("cloud")) }, open: { outline: outline(t.build("open")) } },
};
}
@@ -97,11 +102,17 @@ export function templateDetail(id: string): TemplateDetail | undefined {
/** Every template's page, prerendered. */
export const templateIds = () => CANVAS_TEMPLATES.map((t) => t.id);
+/**
+ * The board "What's a canvas?" shows: one whose photo and finished scene look nothing alike (a man in a white shirt on
+ * a hillside becomes a bronze-armoured king before his army), so the three tiles show what a board does.
+ */
+export const CANVAS_INTRO = "effect-chain-agamemnon";
+
/**
* "What's a canvas?": one real effect film in three tiles, the photo that went in, the scene it became and the moving
* shot. The photo is the clip's first frame (the effect's own cover), the scene its peak (the template's cover).
*/
-export function canvasIntro(templateId = "effect-chain-pearl-earring"): CanvasIntro | undefined {
+export function canvasIntro(templateId = CANVAS_INTRO): CanvasIntro | undefined {
const film = templateCover("canvas", templateId);
const photo = presetCover(templateId.replace(/^effect-chain-/, "effect-"));
if (!film?.video || !photo) return undefined;
diff --git a/src/lib/cover-framing.ts b/src/lib/cover-framing.ts
index 97fd1a67..91866c2f 100644
--- a/src/lib/cover-framing.ts
+++ b/src/lib/cover-framing.ts
@@ -30,8 +30,8 @@ export const COVER_FRAMING: Record<string, CoverFraming> = {
"effect-agamemnon": { focus: "50% 0%" },
"effect-dolphin-ride": { focus: "50% 30%" },
"effect-pearl-earring": { focus: "50% 0%" },
- // Canvas templates (16:9): content over the whole height.
- "effect-skatedog": { fit: "whole" },
+ // Canvas templates (16:9): the lower part (the person, the dog and both boards; the sky is let go).
+ "effect-skatedog": { focus: "50% 80%" },
// The navigation's square tiles and pills: a reference inset at the right, a lineup across the frame.
"app-steal-the-look": { focus: "80% 25%" },
"app-outfit-swap": { focus: "85% 25%" },
@@ -40,7 +40,7 @@ export const COVER_FRAMING: Record<string, CoverFraming> = {
};
/** The preset id of a preset cover's URL: its poster, peak frame or small copy (with or without its version). */
-const PRESET_COVER = /^\/previews\/presets\/(?:peak\/)?(?:thumbs\/)?([a-z0-9-]+)\.(?:jpg|mp4)(?:\?|$)/;
+const PRESET_COVER = /^\/previews\/presets\/(?:peak\/)?(?:thumbs\/|mini\/)?([a-z0-9-]+)\.(?:jpg|mp4)(?:\?|$)/;
/** A cover's framing by its URL (a still or a clip), or undefined: a cover of the tile's shape, or one centred. */
export function coverFraming(url: string | undefined): CoverFraming | undefined {
diff --git a/src/lib/mega-menus.server.ts b/src/lib/mega-menus.server.ts
new file mode 100644
index 00000000..ef862bcf
--- /dev/null
+++ b/src/lib/mega-menus.server.ts
@@ -0,0 +1,241 @@
+/**
+ * The fetched menus (Apps, Motions & effects, Canvas) built from the catalog, the premium order and the covers, once
+ * per build: /nav-menus/<id> serves them as static files. What a visitor may see only: no model names, no template
+ * without a real cover, nothing owner-only (the owner's own boards come from /api/canvases, in the browser).
+ *
+ * The one hand-kept part is which catalog categories make each column; a test fails when a category is left out or
+ * named twice. Everything else follows the data: columns in the order of their strongest preset (featuredAll), items
+ * premium first, the lead the first item with its own cover.
+ */
+import "server-only";
+import { APPS, EFFECTS, MOTIONS } from "@/lib/catalog";
+import type { Preset } from "@/lib/catalog/types";
+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 { hasMini, miniOf } from "@/lib/preset-cards";
+import { presetCover } from "@/lib/preset-covers";
+import { PRESET_MINIS } from "@/lib/preset-minis.generated";
+import { featuredAll } from "@/lib/preset-featured";
+import { templateCover } from "@/lib/template-covers";
+import { MENU_LINES } from "@/lib/menu-lines";
+
+/** A column of a preset menu: its name, its phone chip, and the catalog categories it holds. */
+export interface PresetGroup {
+ id: string;
+ label: string;
+ chip: string;
+ categories: readonly string[];
+}
+
+export const APP_GROUPS: readonly PresetGroup[] = [
+ { id: "camera", label: "Camera & light", chip: "Camera", categories: ["Camera"] },
+ { id: "product", label: "Product & ads", chip: "Product", categories: ["Product"] },
+ { id: "restyle", label: "Restyle & fix", chip: "Restyle", categories: ["Style", "Utility"] },
+ { id: "people", label: "People & fashion", chip: "People", categories: ["Identity", "Fashion"] },
+ // Apps that take no photo (a video, a voice) join the video apps: menuCategory.
+ { id: "video", label: "Video & sound", chip: "Video", categories: ["Video"] },
+ { id: "fun", label: "Just for fun", chip: "Fun", categories: ["Fun"] },
+];
+
+export const MOTION_GROUPS: readonly PresetGroup[] = [
+ { id: "push", label: "Push, pull & pan", chip: "Push & pan", categories: ["Push & Pull", "Lateral"] },
+ { id: "orbit", label: "Orbit, crane & drone", chip: "Orbit & drone", categories: ["Orbit", "Vertical", "Drone & Vehicle"] },
+ { id: "handheld", label: "Handheld, speed & styles", chip: "Handheld", categories: ["Handheld & POV", "Time & Focus", "Camera Styles", "Action & Sports", "Transitions"] },
+];
+
+export const EFFECT_GROUPS: readonly PresetGroup[] = [
+ { id: "blockbuster", label: "Blockbuster & magic", chip: "Blockbuster", categories: ["Blockbuster", "Elements", "Magic", "Transform", "Destruction", "Scale", "Horror", "Nature"] },
+ { id: "viral", label: "Viral & social", chip: "Viral", categories: ["Viral", "UGC", "Playful", "Commercial", "Transitions"] },
+ { id: "looks", label: "Looks, grades & light", chip: "Looks", categories: ["Mixed Media", "Color Grade", "Stylize", "Relight"] },
+];
+
+/**
+ * The category a preset is grouped by in the menus: its catalog category, except that an app taking no photo (only a
+ * video or a voice) counts as a video app, so "Restyle & fix" holds photo apps only.
+ */
+export function menuCategory(p: Pick<Preset, "type" | "category" | "inputs">): string {
+ const inputs = p.inputs ?? [];
+ if (p.type === "app" && inputs.length > 0 && inputs.every((i) => i.accept !== "image")) return "Video";
+ return p.category;
+}
+
+/**
+ * Presets that are the same idea under another name ("Angles", "Fuobe Angles", "Any Angle"): one key, so a column
+ * shows only the strongest of them.
+ */
+export const sameIdea = (name: string) =>
+ name
+ .toLowerCase()
+ .replace(/^(?:fuobe|any|the)\s+/, "")
+ .replace(/s$/, "");
+
+/** Home's own captions, the line a preset gets where it has one. */
+const CAPTIONS = new Map<string, string>([...HOME_MOTIONS, ...HOME_EFFECTS].map((r) => [r.id, r.caption]));
+
+/** The longest line a menu row or lead card shows: one line of a row (about 26 characters at 12 px), as Studios' lines are. */
+export const LINE_MAX = 26;
+
+/** Words a cut line never ends on (it would read as cut off). */
+const LOOSE_END = /\s+(?:a|an|the|and|or|but|of|to|into|onto|in|on|at|with|for|from|by|as|your|their|its|his|her|while|that|which|so|then|is|are|up|out|over|through|around|across|like|until|than|each|every|any|it)$/i;
+
+/**
+ * A line short enough for one row: the first sentence, without a leading "Name:" or "The camera"/"The subject", then
+ * as many whole clauses as fit, else whole words, never ending on a loose word. No "…": it reads as a whole phrase.
+ */
+export function shortLine(text: string, max = LINE_MAX): string {
+ let s = (text.split(/\.\s/)[0] ?? text).trim().replace(/[.…]+$/, "");
+ s = s.replace(/^[A-Z][\w'’ -]{1,20}:\s+(?=[a-z])/, "");
+ s = s.replace(/^the (?:camera|subject)\s+(?!is\b|has\b|was\b)/i, "");
+ const up = (x: string) => x.charAt(0).toUpperCase() + x.slice(1);
+ if (s.length <= max) return up(s);
+ // The most whole clauses that fit (a clause ends at a comma, a semicolon, a colon, a bracket or a dash).
+ const ends = [...s.matchAll(/\s*[,;:(—–]\s*|\s+-\s+/g)].map((m) => m.index).filter((i) => i >= 12 && i <= max);
+ if (ends.length) return up(s.slice(0, Math.max(...ends)));
+ const first = s.split(/\s*[,;:(—–]\s*|\s+-\s+/)[0] ?? s;
+ const clause = first.length >= 12 ? first : s;
+ let cut = clause.slice(0, max + 1);
+ cut = cut.slice(0, Math.max(cut.lastIndexOf(" "), 0)) || clause.slice(0, max);
+ while (LOOSE_END.test(cut)) cut = cut.replace(LOOSE_END, "");
+ return up(cut.replace(/[,;:]$/, ""));
+}
+
+/** A preset's line in the menus: its own short line (MENU_LINES), Home's caption, else its description, made short. */
+export function presetLine(p: Pick<Preset, "id" | "description">): string {
+ return MENU_LINES[p.id] ?? shortLine(CAPTIONS.get(p.id) ?? p.description);
+}
+
+/** A preset's own cover (never another shot's stand-in), with its small copies (the mini when made from this poster) and framing. */
+export function presetMegaCover(id: string): MegaCover | undefined {
+ const c = presetCover(id);
+ if (!c || !hasOwnCover(id)) return undefined;
+ const framing = coverFraming(c.poster);
+ return { poster: c.poster, thumb: c.thumb, ...(hasMini(c.poster) && PRESET_MINIS[id] && { mini: miniOf(c.poster) }), ...(framing && { framing }) };
+}
+
+/** 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) });
+
+/**
+ * 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.
+ */
+export function presetColumns(items: readonly Preset[], groups: readonly PresetGroup[], family?: string): MegaColumn[] {
+ const ranked = featuredAll(items);
+ const inGroup = (g: PresetGroup) => (p: Preset) => g.categories.includes(menuCategory(p));
+ const firstAt = (g: PresetGroup) => ranked.findIndex(inGroup(g));
+ return [...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;
+ return {
+ id: g.id,
+ label: g.label,
+ chip: g.chip,
+ ...(family && { family }),
+ ...(lead && { lead: presetItem(lead) }),
+ rows: rest.slice(0, ROW_CAPS.tall).map(presetItem),
+ };
+ });
+}
+
+export function appsMenu(): MegaModel {
+ return {
+ id: "apps",
+ count: APPS.length,
+ countLine: `${APPS.length} apps, grouped by what they change`,
+ seeAll: { href: "/apps", name: "See all apps" },
+ columns: presetColumns(APPS, APP_GROUPS),
+ };
+}
+
+export function motionsMenu(): MegaModel {
+ return {
+ id: "motions",
+ count: MOTIONS.length + EFFECTS.length,
+ countLine: `${MOTIONS.length} camera motions and ${EFFECTS.length} effects, for any photo`,
+ seeAll: { href: "/motions-and-effects", name: "See all motions and effects" },
+ families: [
+ { id: "motions", label: "Camera motions", count: MOTIONS.length, href: "/motions", span: MOTION_GROUPS.length },
+ { id: "effects", label: "Effects", count: EFFECTS.length, href: "/effects", span: EFFECT_GROUPS.length },
+ ],
+ columns: [...presetColumns(MOTIONS, MOTION_GROUPS, "motions"), ...presetColumns(EFFECTS, EFFECT_GROUPS, "effects")],
+ };
+}
+
+/** Who the Canvas menu is for: a visitor (the owner sees the same boards: menus show real covers only). */
+const VISITOR: Viewing = { visitor: true, hasCover: (id) => !!templateCover("canvas", id) };
+
+/** A template cover as a menu tile shows it: its peak frame (the finished scene), never a clip. */
+function templateMegaCover(id: string): MegaCover | undefined {
+ const c = templateCover("canvas", id);
+ if (!c) return undefined;
+ const framing = coverFraming(c.poster);
+ return { poster: c.poster, thumb: c.thumb, ...(framing && { framing }) };
+}
+
+/**
+ * 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
+ * /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`).
+ */
+export function canvasMenu(): MegaModel {
+ const sections = templateSections(templateCards(), VISITOR);
+ const n = sections.reduce((sum, s) => sum + s.items.length, 0);
+ const intro = canvasIntro();
+ const introCover = intro && templateMegaCover(intro.templateId);
+ const shown = sections.map((s) => ({ ...s, items: s.items.filter((t) => !introCover || t.id !== intro?.templateId) })).filter((s) => s.items.length > 0);
+ return {
+ id: "canvas",
+ count: n,
+ countLine: `${n} ready boards that run as they are`,
+ seeAll: { href: "/canvas", name: "See all of Canvas" },
+ columns: [
+ {
+ id: "start",
+ label: "Start here",
+ chip: "Start",
+ span: 2,
+ owner: "canvas-start",
+ lead: {
+ id: "whats-a-canvas",
+ href: "/canvas",
+ label: "What's a canvas?",
+ line: "Your photo, a scene, a film",
+ icon: "Network",
+ ...(introCover && { cover: introCover }),
+ },
+ rows: [],
+ },
+ ...shown.map(
+ (s, i): MegaColumn => ({
+ id: s.key || "films",
+ label: s.title,
+ 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) })),
+ // 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" } }),
+ }),
+ ),
+ ],
+ };
+}
+
+export const SERVER_MENUS = { apps: appsMenu, motions: motionsMenu, canvas: canvasMenu } as const;
diff --git a/src/lib/mega-menus.ts b/src/lib/mega-menus.ts
new file mode 100644
index 00000000..7f69fce1
--- /dev/null
+++ b/src/lib/mega-menus.ts
@@ -0,0 +1,196 @@
+/**
+ * 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.
+ */
+import type { CoverFraming } from "./cover-framing";
+import { area } from "./nav-areas";
+import { launcherColumns, studioCount, type NavEntry, type NavIconName, type ViewerKind } from "./nav-model";
+
+export type MegaId = "studios" | "apps" | "motions" | "canvas";
+
+/** The menus fetched from the server (Studios is in the bundle). */
+export type FetchedMegaId = Exclude<MegaId, "studios">;
+export const FETCHED_MENUS: readonly FetchedMegaId[] = ["apps", "motions", "canvas"];
+
+/** Where a fetched menu's data is: a static file, made at build time. */
+export const menuUrl = (id: FetchedMegaId) => `/nav-menus/${id}`;
+
+/** A cover at its versioned URLs (never built here: presetCover() and templateCover() give them). */
+export interface MegaCover {
+ /** The full still, for a lead card. */
+ poster: string;
+ /** Its 320 px copy, for a lead card on a small screen and a 16:9 tile. */
+ thumb: string;
+ /** Its 96 px copy, for a row and a phone tile (a preset's own poster only). */
+ mini?: string;
+ /** How it sits in a box of another shape (cover-framing.ts). */
+ framing?: CoverFraming;
+}
+
+export interface MegaItem {
+ id: string;
+ href: string;
+ label: string;
+ /** One line (CSS cuts it to fit; the whole of it is the row's title). */
+ line?: string;
+ /** Its cover, inline (the fetched menus). */
+ cover?: MegaCover;
+ /** Its cover as a preset id the nav's covers resolve (Studios: useNavCover). */
+ navCover?: string;
+ /** Shown on the muted fill when there is no cover. */
+ icon?: NavIconName;
+ /** A phone tile's name (12 characters at most). */
+ short?: string;
+ /** ISO date: a "New" badge until then. */
+ newUntil?: string;
+}
+
+export interface MegaColumn {
+ id: string;
+ /** The column's name over it. */
+ label: string;
+ /** Its filter chip on a phone. */
+ chip: string;
+ /** The family it belongs to (Motions & effects). */
+ family?: string;
+ /** list: a lead card and rows (the default); tiles: cover cards of the same size, `span` across. */
+ variant?: "list" | "tiles";
+ /** How many of the grid's six tracks it takes (1 by default). */
+ span?: number;
+ lead?: MegaItem;
+ rows: MegaItem[];
+ /** A "See all" link at the end of its label row (tiles only). */
+ more?: { href: string; label: string };
+ /** For the owner, the browser draws this column its own way: "canvas-start" is New board and their recent boards. */
+ owner?: "canvas-start";
+}
+
+export interface MegaFamily {
+ id: string;
+ label: string;
+ count: number;
+ href: string;
+ /** How many grid tracks its columns take. */
+ span: number;
+}
+
+export interface MegaModel {
+ id: MegaId;
+ /** The true count, as the header line says it. */
+ count: number;
+ /** "127 apps, grouped by what they change". */
+ countLine: string;
+ /** The area page: "See all" at the top. `name` is the link's accessible name. */
+ seeAll: { href: string; name: string };
+ families?: MegaFamily[];
+ columns: MegaColumn[];
+}
+
+/** 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 }> = {
+ 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" },
+ canvas: { label: "Canvas", href: "/canvas", menu: "Canvas menu", panel: "Canvas ready boards" },
+};
+
+/** The panel's element id ("studios-launcher", "apps-launcher" …). */
+export const megaPanelId = (id: MegaId) => `${id}-launcher`;
+
+/**
+ * Rows a list column shows under its lead by the window's height (the panel never scrolls inside): below 800 px, 800
+ * to 959 px, and from 960 px. Seven at most, as Studios: "See all" carries the rest. The data holds at most `tall`.
+ */
+export const ROW_CAPS = { short: 6, mid: 7, tall: 7 } as const;
+
+/** Tiles across a tiles column, and its rows: two (one below 900 px of height when it has two sections). */
+export const TILE_COLS = 4;
+export const TILE_ROWS = 2;
+
+/**
+ * Where an arrow key goes from `at` in columns of `lengths` links (row 0 is the lead card): up and down within the
+ * column, stopping at its ends; left and right to the same row of the neighbouring column, or its last when shorter;
+ * Home and End to the column's first and last. Null when the key goes nowhere (an edge, another key).
+ */
+export function megaMove(lengths: readonly number[], at: { col: number; row: number }, key: string): { col: number; row: number } | null {
+ const { col, row } = at;
+ const len = lengths[col] ?? 0;
+ if (!len) return null;
+ let next: { col: number; row: number } | null = null;
+ if (key === "ArrowDown") next = row < len - 1 ? { col, row: row + 1 } : null;
+ else if (key === "ArrowUp") next = row > 0 ? { col, row: row - 1 } : null;
+ else if (key === "Home") next = { col, row: 0 };
+ else if (key === "End") next = { col, row: len - 1 };
+ else if (key === "ArrowLeft" || key === "ArrowRight") {
+ let c = col + (key === "ArrowLeft" ? -1 : 1);
+ while (c >= 0 && c < lengths.length && !lengths[c]) c += key === "ArrowLeft" ? -1 : 1;
+ next = c >= 0 && c < lengths.length ? { col: c, row: Math.min(row, lengths[c] - 1) } : null;
+ }
+ return next && (next.col !== col || next.row !== row) ? next : null;
+}
+
+const studioItem = (e: NavEntry): MegaItem => ({
+ id: e.id,
+ href: e.href,
+ label: e.label,
+ line: e.what,
+ ...(e.cover && { navCover: e.cover }),
+ icon: e.icon,
+ ...(e.short && { short: e.short }),
+ ...(e.newUntil && { newUntil: e.newUntil }),
+});
+
+/** Studios as a menu: the launcher's columns (launcherColumns) for who is looking, as the bar has always shown them. */
+export function studiosMenu(kind: ViewerKind | undefined): MegaModel {
+ const n = studioCount();
+ return {
+ id: "studios",
+ count: n,
+ countLine: `${n} studios, grouped by what you want to make`,
+ seeAll: { href: MEGA_AREAS.studios.href, name: "See all studios" },
+ columns: launcherColumns(kind).map((c) => ({ id: c.group.id, label: c.group.label, chip: c.group.chip, lead: studioItem(c.lead), rows: c.rest.map(studioItem) })),
+ };
+}
+
+/** 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]);
+
+/** A preset's page (as its gallery card links it). */
+const presetPage = (id: string) => (id.startsWith("app-") ? `/apps/${id}` : `/video?preset=${id}`);
+
+/** A preset's own poster and its copies, from its version: /previews/presets/<id>.jpg?v=<v> (thumbs/, mini/). */
+function presetUrls(id: string, v: string): MegaCover {
+ const poster = `/previews/presets/${id}.jpg?v=${v}`;
+ 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 };
+
+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 });
+ return {
+ ...rest,
+ ...(href !== presetPage(e.id) && { href }),
+ ...(usual ? { cv: v![2], ...(cover!.framing && { cover: { framing: cover!.framing } 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?.framing && { framing: cover.framing }) } } : cover && { cover }) };
+}
+
+/** A menu as its file carries it (smaller: presets' covers by version): packMenu on the server, unpackMenu in the browser. */
+export function packMenu(m: MegaModel): unknown {
+ return { ...m, columns: m.columns.map(({ lead, rows, ...c }) => ({ ...c, ...(lead && { lead: packItem(lead) }), rows: rows.map(packItem) })) };
+}
+
+export function unpackMenu(w: unknown): MegaModel {
+ const m = w as Omit<MegaModel, "columns"> & { columns: (Omit<MegaColumn, "lead" | "rows"> & { lead?: WireItem; rows: WireItem[] })[] };
+ return { ...m, columns: m.columns.map(({ lead, rows, ...c }) => ({ ...c, ...(lead && { lead: unpackItem(lead) }), rows: rows.map(unpackItem) })) };
+}
diff --git a/src/lib/menu-lines.ts b/src/lib/menu-lines.ts
new file mode 100644
index 00000000..b0234deb
--- /dev/null
+++ b/src/lib/menu-lines.ts
@@ -0,0 +1,120 @@
+/**
+ * Short lines for the bar's menus (one row: about 26 characters), for the presets and ready boards the menus show first, where Home's
+ * caption or the description, made short (shortLine in mega-menus.server.ts), wouldn't read as a whole phrase.
+ * Plain words for what you get. A test keeps every line the menus show within LINE_MAX.
+ */
+export const MENU_LINES: Record<string, string> = {
+ // Apps: Camera & light
+ "app-behind-the-scenes": "The film set behind a shot",
+ "app-relight": "Relight any photo",
+ "app-angles": "Re-shoot from any angle",
+ "app-shots": "Storyboard from one photo",
+ "app-match-lighting": "Match a shot's lighting",
+ "app-match-colors": "Match a reference's colors",
+ "app-zooms": "Nine zooms, macro to wide",
+ "app-what-s-next": "Where the story goes next",
+ // Product & ads
+ "app-product-shot": "Your product, relit",
+ "app-bullet-time-scene": "A freeze-frame 360° spin",
+ "app-bullet-time-splash": "A frozen 360° water splash",
+ "app-product-placement": "Your product in any scene",
+ "app-link-to-video-ad": "A product link to an ad",
+ // Restyle & fix
+ "app-color-grading": "Film grades in one click",
+ "app-sketch-to-real": "A sketch to a real photo",
+ "app-breakdown": "An image split into parts",
+ "app-colorize": "Black & white to color",
+ "app-restore-photo": "Old prints, sharp & clean",
+ "app-remove-background": "Clean cut-out, one click",
+ // People & fashion
+ "app-outfit-swap": "Wear a photo's outfit",
+ "app-tap-to-recolor": "Recolor one piece you tap",
+ "app-steal-the-look": "Copy a reference's look",
+ "app-outfit-shot": "Clothes to a photoshoot",
+ "app-style-snap": "An instant outfit makeover",
+ "app-face-swap": "Your face on another photo",
+ // Video & sound
+ "app-video-background-remover": "Cut out a video's subject",
+ "app-clean-up-voice": "A clean voice, no echo",
+ "app-bring-to-life": "Subtle motion for a photo",
+ "app-clipcut": "A selfie to an outfit clip",
+ // Just for fun
+ "app-signboard": "Your photo as a mural",
+ "app-j-poster": "A bold Japanese poster",
+ "app-giallo-horror": "A 70s Italian horror scene",
+ "app-latex": "Glossy black latex look",
+ "app-sand-worm": "A sand worm behind you",
+ "app-storm-creature": "A storm beast behind you",
+ "app-renaissance": "A Renaissance portrait",
+ "app-3d-rotation": "You as a spinning 3D model",
+ // Camera motions: Push, pull & pan
+ "motion-dolly-in": "A slow push in toward them",
+ "motion-tracking": "Travels alongside them",
+ "motion-zoom-in": "A slow, steady zoom in",
+ "motion-double-dolly": "Glides along with them",
+ "motion-super-dolly-in": "Wide to extreme close-up",
+ "motion-super-dolly-out": "Close-up to wide, fast",
+ "motion-rapid-zoom-out": "A fast zoom out from them",
+ "motion-pan": "A slow pan across a scene",
+ // Orbit, crane & drone
+ "motion-crane-up": "Rises to reveal the scene",
+ "motion-glam": "A fast glam arc",
+ "motion-fpv-drone": "A fast FPV drone dive",
+ "motion-crane-down": "Cranes down to eye level",
+ "motion-arc-left": "Arcs left around them",
+ "motion-aerial-pullback": "An aerial pull back and up",
+ "motion-helicopter-shot": "Circles high overhead",
+ // Handheld, speed & styles
+ "motion-catwalk": "A confident runway walk",
+ "motion-classic-static": "Locked off, painterly",
+ "motion-snorricam": "Camera rigged to them",
+ "motion-documentary-snap": "Handheld, with snap zooms",
+ "motion-static": "A still tripod shot",
+ "motion-dreamy-flow": "A dreamy, floating camera",
+ "motion-epic-scale": "Sweeping, epic moves",
+ "motion-intimate-observer": "A close, quiet observer",
+ // Effects: Blockbuster & magic
+ "effect-sand-storm": "A wall of sand sweeps in",
+ "effect-levitation": "They float off the ground",
+ "effect-nature-bloom": "Flowers overgrow it all",
+ "effect-pearl-earring": "Girl with a Pearl Earring",
+ "effect-blue-depth": "Sinking into the deep blue",
+ "effect-invisible": "They fade away completely",
+ "effect-disintegration": "They crumble into dust",
+ // Viral & social
+ "effect-outfit-switch": "A spin into a new outfit",
+ "effect-exploded-view": "A product splits apart",
+ "effect-display-transition": "Push into a screen's scene",
+ "effect-train-rush": "A train rushes past behind",
+ "effect-ballet": "Graceful ballet turns",
+ "effect-column-wipe": "A column-flip transition",
+ "effect-color-rain": "A rain of vivid paint",
+ "effect-hair-style": "A hair flip, close up",
+ // Looks, grades & light
+ "effect-lens-flare": "An anamorphic flare",
+ "effect-magazine": "A printed editorial spread",
+ "effect-film-colors": "Graded like 35mm film",
+ "effect-black-gloss": "Inky blacks, luxe gloss",
+ "effect-crimson-vigil": "Deep reds in the shadows",
+ "effect-bleached-warm": "Sun-washed golden tones",
+ "effect-cold-steel": "Steel-blue, icy light",
+ "effect-broken-mirror": "Shatters like a mirror",
+ "app-packshot": "Clean e-commerce photos",
+ "app-chameleon": "Color-shifting morph",
+ "app-object-remover": "Erase anything you name",
+ "motion-lazy-susan": "A turntable spin",
+ "motion-slow-motion": "Every droplet, slowed",
+ "effect-smash-and-grab": "Glass shatters, slow-mo",
+ "effect-car-drive": "A coastal road drive",
+ "effect-dirty-lens": "Rain beads on the lens",
+ // Canvas: ready boards (Effect films)
+ "effect-chain-pearl-earring": "A Golden Age portrait",
+ "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-blue-depth": "You drift in deep blue",
+ "effect-chain-dolphin-ride": "You ride a dolphin",
+ "effect-chain-skatedog": "A dog on a skateboard",
+ "effect-chain-street-colossus": "As tall as the buildings",
+ "effect-chain-agamemnon": "A king before his army",
+};
diff --git a/src/lib/nav-covers.ts b/src/lib/nav-covers.ts
index 8d57bc66..3cbd1255 100644
--- a/src/lib/nav-covers.ts
+++ b/src/lib/nav-covers.ts
@@ -5,6 +5,7 @@
import "server-only";
import { coverFraming, type CoverFraming } from "./cover-framing";
import { coverIds } from "./nav-model";
+import { hasMini, miniOf } from "./preset-cards";
import { presetCover } from "./preset-covers";
export interface NavCover {
@@ -12,6 +13,8 @@ export interface NavCover {
thumb: string;
/** The full still, for the 4:3 cards. */
poster: string;
+ /** Its 96 px copy, for the launcher's rows and the phone's tiles (a preset's own poster only). */
+ mini?: string;
/** How it sits in a square tile or pill (cover-framing.ts), when it isn't centred there. */
framing?: CoverFraming;
}
@@ -29,7 +32,8 @@ export function navCovers(): NavCovers {
const c = presetCover(id);
if (!c) throw new Error(`The navigation names ${id}, which has no cover`);
const framing = coverFraming(c.poster);
- out[id] = { thumb: c.thumb, poster: c.poster, ...(framing && { framing }) };
+ const mini = hasMini(c.poster) ? miniOf(c.poster) : undefined;
+ out[id] = { thumb: c.thumb, poster: c.poster, ...(mini && { mini }), ...(framing && { framing }) };
}
cached = out;
return out;
diff --git a/src/lib/nav-model.ts b/src/lib/nav-model.ts
index 44e87f1b..c0fa2585 100644
--- a/src/lib/nav-model.ts
+++ b/src/lib/nav-model.ts
@@ -230,7 +230,7 @@ const TOOL_COPY: Record<string, { what: string; keywords: string; cover?: string
"audio-dialogue": { what: "A conversation, one voice each", keywords: "conversation podcast two speakers multi voice" },
"audio-voice-change": { what: "Swap the voice, keep the timing", keywords: "voice changer convert speech to speech" },
"audio-design": { what: "A new voice from a few words", keywords: "voice design create custom new voice describe" },
- "audio-translate": { what: "Your video in another language", keywords: "dub dubbing localize translate lip sync", cover: "app-asmr-promo", label: "Translate & dub", short: "Translate" },
+ "audio-translate": { what: "Dub into any language", keywords: "dub dubbing localize translate lip sync", cover: "app-asmr-promo", label: "Translate & dub", short: "Translate" },
"audio-transcribe": { what: "Words from any clip", keywords: "subtitles text speech to text srt vtt captions" },
"audio-clean": { what: "Remove noise and echo", keywords: "denoise podcast mic fix reverb enhance speech", cover: "app-clean-up-voice", short: "Clean up" },
"audio-split": { what: "Voice and music apart", keywords: "stems karaoke separate vocals instrumental" },
@@ -639,7 +639,7 @@ export function activeEntry(pathname: string, search: URLSearchParams): NavEntry
}
/** Whether an entry shows its "New" badge now (the browser's clock). */
-export function isNew(e: NavEntry, now: number = Date.now()): boolean {
+export function isNew(e: Pick<NavEntry, "newUntil">, now: number = Date.now()): boolean {
return !!e.newUntil && now < Date.parse(e.newUntil);
}
diff --git a/src/lib/preset-cards.ts b/src/lib/preset-cards.ts
index 299dbc19..09f5664d 100644
--- a/src/lib/preset-cards.ts
+++ b/src/lib/preset-cards.ts
@@ -184,8 +184,10 @@ export interface PresetPreview {
* Shown at rest instead of the poster: the clip's peak frame (preset-peaks.generated.ts, onPeak), where the clip
* starts (`at`, in seconds) when it plays by itself, so nothing jumps. Its loop comes back to `from`, just before
* the change starts, and a hover starts there. Home's cards and the preset header; the galleries keep their posters.
+ * `until`: the loop goes back to `from` from here instead of the clip's end (a template cover plays only the finished
+ * scene, never the photo it started from); the clip's last stretch, where it fades back, is never shown either.
*/
- rest?: { src: string; at: number; from: number };
+ rest?: { src: string; at: number; from: number; until?: number };
scene: PreviewScene;
move?: CameraMove;
fx?: PreviewFx;
@@ -411,6 +413,11 @@ export const isCover = (p: Pick<PresetPreview, "move" | "fx">) => !p.move && !p.
*/
export const thumbOf = (poster: string) => poster.replace(/\/([^/]+)$/, "/thumbs/$1");
+/** A preset poster's 96 px copy (mini/ next to it, the same version): the menus' rows and the phone's tiles (pnpm eval:covers). */
+export const miniOf = (poster: string) => poster.replace(/\/([^/]+)$/, "/mini/$1");
+/** Whether a poster has a mini copy: a preset's own poster (/previews/presets/<id>.jpg), not a peak frame or a template's. */
+export const hasMini = (poster: string) => /^\/previews\/presets\/[^/]+\.jpg(\?|$)/.test(poster);
+
/** The card resting on its clip's peak frame (preset-peaks.generated.ts) when it has one, else as it is. */
export function onPeak(card: PresetCardData): PresetCardData {
const peak = PRESET_PEAKS[card.id];
diff --git a/src/lib/preset-featured.ts b/src/lib/preset-featured.ts
index dfd98c9c..4b66f1e7 100644
--- a/src/lib/preset-featured.ts
+++ b/src/lib/preset-featured.ts
@@ -9,9 +9,9 @@ import { interleaveByCategory } from "@/lib/preset-cards";
const ORDER: Record<"app" | "motion" | "effect", string[]> = {
app: [
`
- app-behind-the-scenes app-relight app-macroshot-product app-sketch-to-real app-age-shift app-makeup-studio
+ app-behind-the-scenes app-relight app-macroshot-product app-color-grading app-age-shift app-makeup-studio
app-angles app-shots app-match-lighting app-match-colors app-product-shot app-bullet-time-scene
- app-bullet-time-splash app-chameleon app-outfit-swap app-tap-to-recolor app-steal-the-look app-outfit-shot app-color-grading
+ app-bullet-time-splash app-chameleon app-outfit-swap app-tap-to-recolor app-steal-the-look app-outfit-shot app-sketch-to-real
app-video-face-swap app-video-background-remover app-clean-up-voice app-breakdown
`,
`
diff --git a/src/lib/preset-minis.generated.ts b/src/lib/preset-minis.generated.ts
new file mode 100644
index 00000000..1a75fb86
--- /dev/null
+++ b/src/lib/preset-minis.generated.ts
@@ -0,0 +1,502 @@
+/**
+ * The presets whose poster has its 96 px copy for the bar's menus (public/previews/presets/mini/<id>.jpg), each with
+ * the content version of the poster it was made from. The menus show a mini only for a preset listed here; a test
+ * checks every version against its poster. Generated by pnpm eval:covers (writeThumbs): run it again rather than
+ * editing.
+ */
+export const PRESET_MINIS: Record<string, string> = {
+ "app-3d-figure": "30480e27",
+ "app-3d-render": "0f7560f2",
+ "app-3d-rotation": "26df6d54",
+ "app-60s-cafe": "12297176",
+ "app-ad-creative": "2d390dc1",
+ "app-age-shift": "9bf375f6",
+ "app-ai-influencer": "c3441eeb",
+ "app-ai-stylist": "8a871036",
+ "app-angles": "2602bbcf",
+ "app-any-angle": "281aeb88",
+ "app-asmr-add-on": "0e322e1c",
+ "app-asmr-classic": "b4ff2a21",
+ "app-asmr-host": "062b9b6f",
+ "app-asmr-promo": "82bfc5ff",
+ "app-banana-eating": "04ba3834",
+ "app-behind-the-scenes": "be67f8d3",
+ "app-billboard-ad": "9249ea4c",
+ "app-breakdown": "129678e2",
+ "app-brick-cube": "d0b89d00",
+ "app-bring-to-life": "ba30d589",
+ "app-bullet-time-scene": "9568f08c",
+ "app-bullet-time-splash": "14775095",
+ "app-bullet-time-white": "5c552a1e",
+ "app-burning-sunset": "2fc177cc",
+ "app-chameleon": "3ff780af",
+ "app-change-background": "cf02c047",
+ "app-character-swap": "e0d682b6",
+ "app-clean-up-voice": "1246a3a9",
+ "app-click-to-ad": "9f437405",
+ "app-clipcut": "fe19b295",
+ "app-cloud-surf": "cb777c95",
+ "app-color-grading": "b1690875",
+ "app-colorize": "db5ef65d",
+ "app-comic-book": "196bad84",
+ "app-commercial-faces": "9b034c6f",
+ "app-dance": "4bed0439",
+ "app-expand-image": "3a99d701",
+ "app-expression-edit": "ac9558b1",
+ "app-face-swap": "400bffeb",
+ "app-figurine": "eb5d0ea6",
+ "app-fridge-ad": "77b24cd2",
+ "app-fuobe-angles": "5e78337c",
+ "app-game-dump": "888a9784",
+ "app-ghoulgao": "2dc8da41",
+ "app-giallo-horror": "981f017b",
+ "app-giant-product": "fd74b9b4",
+ "app-glitter-sticker": "1bc13a7b",
+ "app-graffiti-ad": "1884b70f",
+ "app-gtai": "9512d5c4",
+ "app-hairstyle-try-on": "482717bb",
+ "app-head-swap": "7c8a043e",
+ "app-headshot-generator": "cb2ac18f",
+ "app-hook-frame": "bfdb0988",
+ "app-hug": "98b8654f",
+ "app-idol": "d6a24384",
+ "app-image-to-3d": "7586b571",
+ "app-j-magazine": "a63c1a83",
+ "app-j-poster": "6f3030ba",
+ "app-japanese-show": "956cb278",
+ "app-kick-ad": "50e9166a",
+ "app-latex": "33785580",
+ "app-link-to-video-ad": "f811db68",
+ "app-macro-scene": "4cd9c2f7",
+ "app-macroshot-product": "266c3bfe",
+ "app-magic-button": "3c95d4a6",
+ "app-makeup-studio": "4cb18d5c",
+ "app-mascot": "ffbbc51a",
+ "app-match-colors": "1df1ab76",
+ "app-match-lighting": "6224267d",
+ "app-melting-doodle": "f1c5ac7f",
+ "app-meme-generator": "f37a796c",
+ "app-micro-beasts": "8bb01577",
+ "app-mugshot": "81ca4d90",
+ "app-mukbang": "e0c2fad5",
+ "app-nano-strike": "0fb1d26c",
+ "app-nano-theft": "ba30f9ae",
+ "app-object-remover": "4eee6a5d",
+ "app-outfit-shot": "c5ba659a",
+ "app-outfit-swap": "faad14ee",
+ "app-outfit-vending": "9f60886a",
+ "app-packshot": "dbffe286",
+ "app-paint-app": "03919033",
+ "app-photo-to-3d": "04b16da3",
+ "app-pixel-game": "44331f72",
+ "app-plushies": "536dc1fc",
+ "app-poster": "ee6fa915",
+ "app-product-360": "efbc6804",
+ "app-product-placement": "e88d7558",
+ "app-product-shot": "b3eebf2f",
+ "app-rap-god": "bf3dc8d3",
+ "app-recast": "95a37b8b",
+ "app-relight": "e0f58bc1",
+ "app-remove-background": "bab02a87",
+ "app-renaissance": "02992e4f",
+ "app-restore-photo": "17db01e8",
+ "app-roller-coaster": "96d213ef",
+ "app-sand-worm": "cf9d4d16",
+ "app-shots": "c0a661fe",
+ "app-signboard": "4e55f9f0",
+ "app-similarity-score": "6c2db952",
+ "app-simlife": "e1eb5774",
+ "app-sketch-to-real": "c9833ac6",
+ "app-skibidi": "a651f9b6",
+ "app-skin-enhancer": "44c124d5",
+ "app-social-media-icon": "419f4eae",
+ "app-steal-the-look": "3755725b",
+ "app-steam-it": "ff42370c",
+ "app-sticker-match-cut": "1cc9b550",
+ "app-sticker-pack": "6d6256a9",
+ "app-storm-creature": "aa1fb296",
+ "app-style-snap": "cc67fee4",
+ "app-style-transfer": "21964d32",
+ "app-talking-photo": "13919f39",
+ "app-tap-to-recolor": "e0a97040",
+ "app-text-edit": "8ffc3bc2",
+ "app-this-is-fine": "7d9c225f",
+ "app-transitions": "fb15f0fd",
+ "app-truck-ad": "ad618444",
+ "app-unboxing-video": "a78007c8",
+ "app-upscale": "7a9822d7",
+ "app-urban-cuts": "fd215394",
+ "app-vectorize": "308e52e6",
+ "app-victory-card": "37f5244e",
+ "app-video-background-remover": "8b795626",
+ "app-video-face-swap": "8c114fd9",
+ "app-virtual-try-on": "3fc9648e",
+ "app-volcano-ad": "64f335f5",
+ "app-what-s-next": "996471fb",
+ "app-yes-kiss": "64102263",
+ "app-zoom-out": "8e88090a",
+ "app-zooms": "6cd69a93",
+ "effect-acid": "4cefb32f",
+ "effect-act-natural": "6b2f20a0",
+ "effect-agamemnon": "52643c88",
+ "effect-agent-reveal": "548e935a",
+ "effect-air-bending": "1af941aa",
+ "effect-akrill": "86011e34",
+ "effect-angel-wings": "d704bf87",
+ "effect-angry-mode": "8a1cb7e2",
+ "effect-animalization": "446b3f30",
+ "effect-aquarium": "650d9983",
+ "effect-architecture-wave": "1a70d36f",
+ "effect-atomic": "b87a944c",
+ "effect-attack-of-clones": "3139b116",
+ "effect-ballet": "2409ebe5",
+ "effect-balloon": "116c7744",
+ "effect-beach-ride": "a1d6eca6",
+ "effect-beast-appearance": "d0ead354",
+ "effect-black-gloss": "c57486df",
+ "effect-black-tears": "afab7af5",
+ "effect-bleach-bypass": "68d43e40",
+ "effect-bleached-warm": "edfe5f77",
+ "effect-bloom-mouth": "b6b12e91",
+ "effect-blue-depth": "309ab812",
+ "effect-boarding-pass": "a9f93045",
+ "effect-boiling-point": "74ad3334",
+ "effect-broken-mirror": "19e02fa6",
+ "effect-bubbles": "65ddffe2",
+ "effect-buddy": "f48f34a5",
+ "effect-building-explosion": "bf139f49",
+ "effect-burning-man": "3f4a175b",
+ "effect-cakeify": "bcc3c238",
+ "effect-candy-pink": "104e4d6d",
+ "effect-cannabis": "bd8116dc",
+ "effect-canvas": "ab3c82a7",
+ "effect-car-drive": "539bdc54",
+ "effect-car-explosion": "6c923224",
+ "effect-censorship": "9e75d5cd",
+ "effect-classic-bw": "933ae03e",
+ "effect-clone-explosion": "ea83895f",
+ "effect-clones": "7c6c750d",
+ "effect-clothes-rain": "49264c57",
+ "effect-cold-steel": "129e9414",
+ "effect-cold-vision": "5268af6f",
+ "effect-color-rain": "4f57e234",
+ "effect-column-wipe": "6f2c3faa",
+ "effect-comic": "849a8c47",
+ "effect-contre-jour": "a053956a",
+ "effect-cotton-cloud": "edf4375a",
+ "effect-crimson-vigil": "6533f08a",
+ "effect-crush": "6149c0b5",
+ "effect-crying": "f05bc2be",
+ "effect-cutout": "f117f094",
+ "effect-cyborg": "0baa6de4",
+ "effect-cyclope": "43769592",
+ "effect-datamosh": "1a1ae8e3",
+ "effect-deflate": "0caceea4",
+ "effect-diamond": "77c62c84",
+ "effect-dirty-lens": "48a797b0",
+ "effect-disintegration": "6c73393c",
+ "effect-display-transition": "bbe0b68f",
+ "effect-dolphin-ride": "246a39c7",
+ "effect-dream-date": "7a46d2b8",
+ "effect-drunk-master": "27bedadc",
+ "effect-duplicate": "acfc202b",
+ "effect-earth-element": "5f82f487",
+ "effect-earth-wave": "540341c0",
+ "effect-earth-zoom-out": "220d3266",
+ "effect-eating": "d9582af6",
+ "effect-exploded-view": "f717e160",
+ "effect-explosion": "44b8d119",
+ "effect-fairies-around": "235b5e50",
+ "effect-fairytale-castle": "1ea43afb",
+ "effect-fallen-angel": "d1875769",
+ "effect-film-colors": "6cb723f9",
+ "effect-fire-breath": "10caaa2f",
+ "effect-fire-element": "1df22c2d",
+ "effect-firelava": "5a069972",
+ "effect-firework": "3622172a",
+ "effect-fix-and-pose": "7ba86c4a",
+ "effect-flame-on": "2c9801d5",
+ "effect-flame-transition": "54324e1a",
+ "effect-flash-comic": "2d61609a",
+ "effect-flashback": "2c6fdbc1",
+ "effect-floating-fall": "d60528a9",
+ "effect-floating-fish": "54751696",
+ "effect-flood": "c3a04952",
+ "effect-floral-eyes": "2e7d3fbc",
+ "effect-fragments": "4426dbc8",
+ "effect-freezing": "1f9829e6",
+ "effect-frozen-in-motion": "6af29a8d",
+ "effect-garden-bloom": "ceaf9951",
+ "effect-gas-transformation": "e6dab516",
+ "effect-giant": "c0faff76",
+ "effect-giant-grab": "fc7c36bd",
+ "effect-giant-people": "3bf033c8",
+ "effect-glitch": "95edad24",
+ "effect-glow-trace": "e3253977",
+ "effect-glowing-fish": "78e44d3d",
+ "effect-glowshift": "5a14a9e0",
+ "effect-gorilla-transfer": "bc318a4d",
+ "effect-group-photo": "830e0bd5",
+ "effect-hair-style": "38406656",
+ "effect-hand-paint": "2f14add3",
+ "effect-hand-transition": "34b9f43c",
+ "effect-handheld-run": "69e3991e",
+ "effect-happy": "9dbbb852",
+ "effect-happy-mode": "4ce3fa32",
+ "effect-head-explosion": "f561021a",
+ "effect-head-off": "6c7efe17",
+ "effect-helicopter-escape": "87e61b2a",
+ "effect-hero-flight": "e1f5d1a8",
+ "effect-high-flip": "34e8874f",
+ "effect-hole-transition": "7a216438",
+ "effect-horror-face": "8ddbe7ea",
+ "effect-hyper-neon": "58423d14",
+ "effect-i-can-fly": "7681c752",
+ "effect-ice-rose": "1a1e5b8d",
+ "effect-infinite-clones": "c46e6aca",
+ "effect-inflate": "a099547b",
+ "effect-innerlight": "8d5b881e",
+ "effect-invisible": "4f2a2975",
+ "effect-jelly-drift": "02a633eb",
+ "effect-jump-transition": "d4af9faa",
+ "effect-lacewalker": "48119efe",
+ "effect-lava": "ea053ed7",
+ "effect-layer-mixed-media": "41341b7c",
+ "effect-lens-crack": "3ef8657d",
+ "effect-lens-flare": "b0fb463a",
+ "effect-levitation": "0ac84a55",
+ "effect-lidar-transition": "db36d3ac",
+ "effect-lime-jam": "c4cc8be7",
+ "effect-live-concert": "4d168eb7",
+ "effect-look-boom": "0363f3ca",
+ "effect-lsd": "8c450b3a",
+ "effect-luminous-gaze": "284d9eb2",
+ "effect-magazine": "023328be",
+ "effect-marble": "46322ab9",
+ "effect-medusa-gorgona": "8b3fe439",
+ "effect-melt-transition": "ea151eb4",
+ "effect-melting": "a3cd8e02",
+ "effect-mighty-fighter": "f35e36c8",
+ "effect-modern": "370e59ae",
+ "effect-monet-muse": "8d472786",
+ "effect-money-rain": "35332aab",
+ "effect-monster-dab": "2746d170",
+ "effect-monstrosity": "79313fd5",
+ "effect-moonwalk": "44bbc44a",
+ "effect-morning-routine": "e748b9d4",
+ "effect-morphskin": "96049d13",
+ "effect-motor-ride": "2042a2bd",
+ "effect-multiverse": "c8892427",
+ "effect-muscle-up": "9ca4989b",
+ "effect-mystification": "3d32efbb",
+ "effect-naturalistic-clean": "586f50f5",
+ "effect-nature-bloom": "0303fdd0",
+ "effect-noir": "2a27fc90",
+ "effect-northern-lights": "43b442b1",
+ "effect-nostalgic-blue": "17ac07ef",
+ "effect-objects-around": "e683c3e5",
+ "effect-ocean": "6d162d86",
+ "effect-oni-mask": "3e98bbc4",
+ "effect-origami": "880b4c95",
+ "effect-outfit-check": "665c1d3f",
+ "effect-outfit-switch": "fa44cdbf",
+ "effect-overexposed": "b83a8a56",
+ "effect-overhead-fall": "610b5537",
+ "effect-overtime": "05a5ca0c",
+ "effect-paint-splash": "a15f6700",
+ "effect-palette": "3aaea790",
+ "effect-paparazzi": "9f9818b7",
+ "effect-paper": "8e5400d1",
+ "effect-particles": "57d2eb14",
+ "effect-peak-moment": "30cf3f2c",
+ "effect-pearl-earring": "ce186d7a",
+ "effect-pigeons": "49b8a50a",
+ "effect-pixelated-face": "53bbd94b",
+ "effect-pizza-fall": "a5df16da",
+ "effect-plasma-explosion": "3f1e9bac",
+ "effect-plate-check": "12026dd4",
+ "effect-point-cloud": "a8c4707c",
+ "effect-polygon": "b8e4efea",
+ "effect-pool-jump": "60104437",
+ "effect-portal": "f257d66a",
+ "effect-powder-explosion": "d588752a",
+ "effect-practicals": "52913f19",
+ "effect-push-to-glass": "ab4b7f77",
+ "effect-random-glow": "d7ba9e72",
+ "effect-raven-transition": "866d5180",
+ "effect-red-carpet": "8107f28e",
+ "effect-saint-glow": "35de9ee0",
+ "effect-sakura-petals": "5248ab89",
+ "effect-sand-cut": "7979ba8a",
+ "effect-sand-storm": "e5233971",
+ "effect-scrapbook-collage": "73b0838c",
+ "effect-seamless-transition": "d83cc4a7",
+ "effect-selfception": "970ab481",
+ "effect-selfie": "db498b2f",
+ "effect-selfie-outfit": "9100bf4b",
+ "effect-selfie-posing": "8e731644",
+ "effect-set-on-fire": "60b12cba",
+ "effect-shadow-smoke": "6d9a84af",
+ "effect-shocked": "63233c10",
+ "effect-silhouette": "49559ef8",
+ "effect-skatedog": "e7c9d664",
+ "effect-sketch": "8de31c20",
+ "effect-skin-surge": "395d3f7f",
+ "effect-smash-and-grab": "4140cf21",
+ "effect-smoke-transition": "15c4a555",
+ "effect-sodium-decay": "7dfdac83",
+ "effect-soft-cross": "878a5f2c",
+ "effect-soft-palette": "8635bf1e",
+ "effect-soul-jump": "05caefc2",
+ "effect-spiders-from-mouth": "7deeabb3",
+ "effect-spirit-animal": "59da12d4",
+ "effect-splash-transition": "3468bf7f",
+ "effect-squish": "a5a63c08",
+ "effect-starship-troopers": "30110a5a",
+ "effect-static-posing": "96b17cf9",
+ "effect-stop-world": "7fadc462",
+ "effect-street-colossus": "8b867349",
+ "effect-studio-slide": "14d843ef",
+ "effect-sunglasses": "342ed988",
+ "effect-super-fast-run": "5ca559de",
+ "effect-super-saiyan": "3f529a79",
+ "effect-superstar": "bacd1cb6",
+ "effect-tattoo-animation": "0a3e9d5a",
+ "effect-teal-orange-epic": "c569c3c8",
+ "effect-tentacles": "50a66ae1",
+ "effect-thunder-god": "30e32396",
+ "effect-tiny-planet": "2c0a2f72",
+ "effect-toxic": "cd9144d7",
+ "effect-tracking": "d43e5df6",
+ "effect-train-rush": "934988d1",
+ "effect-trucksition": "617375a2",
+ "effect-turn-into-statue": "256ba3a6",
+ "effect-turning-metal": "b5bec58f",
+ "effect-turning-monkey": "21169e9f",
+ "effect-two-color": "dc740610",
+ "effect-ultraviolet": "b38df125",
+ "effect-vanish": "6bc0cd9a",
+ "effect-vintage": "fd95c1ca",
+ "effect-visor-x": "36baac43",
+ "effect-water-bending": "af79d164",
+ "effect-water-element": "87b4b63b",
+ "effect-water-splash": "72be6e49",
+ "effect-werewolf": "8f20ec7d",
+ "effect-wild-ride": "b57d1364",
+ "effect-wind-to-face": "3435c558",
+ "effect-window": "442f0ef7",
+ "effect-windows": "0d4c49f7",
+ "effect-wireframe": "93152dcf",
+ "effect-wonderland": "a5120403",
+ "effect-world-morphing": "f46c6b00",
+ "effect-x-ray": "84874aa3",
+ "effect-yacht": "f170ee86",
+ "motion-360-orbit": "2fd0ecf2",
+ "motion-3d-rotation": "8d4cc601",
+ "motion-action-run": "a3923a64",
+ "motion-aerial-pullback": "b2ab7fdf",
+ "motion-arc-left": "ce97d481",
+ "motion-arc-right": "ddfc6cff",
+ "motion-baseball-kick": "b8bb8221",
+ "motion-basketball-dunks": "f3f5bb76",
+ "motion-boxing": "55132a45",
+ "motion-bts": "f0ba78ae",
+ "motion-buckle-up": "a40703f9",
+ "motion-bullet-time": "1979e2af",
+ "motion-car-chasing": "3607a885",
+ "motion-car-grip": "cb51b783",
+ "motion-catwalk": "92cbdbef",
+ "motion-classic-static": "44d8e4ff",
+ "motion-crane-down": "286205d3",
+ "motion-crane-over-the-head": "48195d80",
+ "motion-crane-up": "717a4da9",
+ "motion-crash-zoom-in": "cfad0b12",
+ "motion-crash-zoom-out": "e2e467d4",
+ "motion-documentary-snap": "c132f5d8",
+ "motion-dolly-in": "e5e042c1",
+ "motion-dolly-left": "1e3f4f86",
+ "motion-dolly-out": "de8e055c",
+ "motion-dolly-right": "8733bd6c",
+ "motion-dolly-zoom-in": "8a4774aa",
+ "motion-dolly-zoom-out": "7309c323",
+ "motion-double-dolly": "388e91a8",
+ "motion-downhill-pov": "94fea387",
+ "motion-dreamy-flow": "2dc6f3cc",
+ "motion-drone-reveal": "a1f6c971",
+ "motion-dutch-angle": "a670d584",
+ "motion-earth-zoom-out": "aabb9b5b",
+ "motion-eating-zoom": "10bc7b9e",
+ "motion-epic-scale": "8924a48a",
+ "motion-eyes-in": "4f2281c8",
+ "motion-face-punch": "1ac0a038",
+ "motion-fisheye": "ffed5960",
+ "motion-flying": "2d3c780f",
+ "motion-flying-cam-transition": "3530e5b0",
+ "motion-focus-change": "58c3dce7",
+ "motion-fpv-drone": "868e1660",
+ "motion-general": "beec50c4",
+ "motion-glam": "876a5286",
+ "motion-handheld": "b392ee7f",
+ "motion-head-tracking": "e8f3d914",
+ "motion-helicopter-shot": "6ae4be41",
+ "motion-hero-cam": "19bdb1cf",
+ "motion-hyperlapse": "a51c7bfe",
+ "motion-impossible-camera": "50194fcf",
+ "motion-incline": "38f37aa2",
+ "motion-intimate-observer": "daf4bcdf",
+ "motion-jib-down": "d613e351",
+ "motion-jib-up": "5c85aa60",
+ "motion-kiss": "1627d276",
+ "motion-lazy-orbit": "af76eca5",
+ "motion-lazy-susan": "32dfe1e0",
+ "motion-low-shutter": "54579625",
+ "motion-moonwalk-left": "3374bab8",
+ "motion-moonwalk-right": "f8444be1",
+ "motion-mouth-in": "c1ae4ee3",
+ "motion-object-pov": "c1df23eb",
+ "motion-one-take": "06b96b4a",
+ "motion-overhead": "09404e37",
+ "motion-pan": "61352176",
+ "motion-pan-left": "5d8508cc",
+ "motion-pan-right": "8d2936a8",
+ "motion-pedestal-down": "8b6dbb56",
+ "motion-pov": "3c4aa505",
+ "motion-rap-flex": "f5716b2a",
+ "motion-rapid-zoom-in": "c728ae43",
+ "motion-rapid-zoom-out": "e1a9ebc4",
+ "motion-raw-chaos": "aca71a30",
+ "motion-road-rush": "500d8667",
+ "motion-robo-arm": "ae884dc9",
+ "motion-robot-arm": "04888abd",
+ "motion-roll-transition": "da483dba",
+ "motion-silent-machine": "fc07ad7b",
+ "motion-skate-cruise": "7b6b25e1",
+ "motion-skateboard-glide": "5ec73620",
+ "motion-skateboard-ollie": "24b09076",
+ "motion-ski-carving": "051c3563",
+ "motion-ski-powder": "65cdb6ef",
+ "motion-slow-motion": "b46524ff",
+ "motion-snorricam": "541189c5",
+ "motion-snowboard-carving": "73de0166",
+ "motion-snowboard-powder": "dea42716",
+ "motion-static": "9d8df1db",
+ "motion-super-dolly-in": "90ec95d3",
+ "motion-super-dolly-out": "306f27d3",
+ "motion-through-object-in": "5aaf3b75",
+ "motion-through-object-out": "5132eed9",
+ "motion-tilt-down": "ea7dfdb3",
+ "motion-tilt-up": "336061af",
+ "motion-timelapse": "4fffd570",
+ "motion-timelapse-glam": "35690a08",
+ "motion-timelapse-human": "daec6f29",
+ "motion-timelapse-landscape": "c95a58c1",
+ "motion-tracking": "c50aa851",
+ "motion-truck-left": "9a90fe70",
+ "motion-truck-right": "3979ff4c",
+ "motion-whip-pan": "3c407a0f",
+ "motion-wiggle": "cfcc24b8",
+ "motion-yoyo-zoom": "a0669818",
+ "motion-zoom": "1597e4ca",
+ "motion-zoom-in": "9c0d85dc",
+ "motion-zoom-out": "ef6f3c94"
+};
diff --git a/src/lib/template-covers.ts b/src/lib/template-covers.ts
index dd624dfb..ef834cb5 100644
--- a/src/lib/template-covers.ts
+++ b/src/lib/template-covers.ts
@@ -66,15 +66,34 @@ function read(key: string, entry: TemplateCoverEntry): TemplateCover {
};
}
+/**
+ * How much of a clip around its peak frame a template cover plays (s): the finished scene only. An effect clip opens on
+ * the photo that went in and fades back to it at the end, so a card that played it whole would show that photo most
+ * of the time.
+ */
+export const PEAK_WINDOW = { before: 0.6, after: 0.6 } as const;
+
+/** A still taken from the middle of an effect's clip (its peak: /previews/presets/peak/), not a reveal's last frame. */
+const PEAK_STILL = /^\/previews\/presets\/peak\//;
+
/**
* A cover as the preset previews take it (PresetPreview, usePreviewPlayback): its poster and clip, and for a clip
- * whose poster is a later frame, a rest on it, so the clip starts there and loops back to its start.
+ * whose poster is a later frame, a rest on it. A reveal (its poster is the last frame) starts there and loops from 0.
+ * An effect's clip shown by its peak (the finished scene) plays only the stretch around it: a hover starts a little
+ * before the peak, and the loop comes back there, never to the clip's start (the photo that went in).
*/
export function templatePreview(c: TemplateCover): PresetPreview {
+ const at = c.at;
+ const peak = PEAK_STILL.test(c.poster);
return {
poster: c.poster,
...(c.video && { video: c.video }),
- ...(c.video && c.at !== undefined && { rest: { src: c.poster, at: c.at, from: 0 } }),
+ ...(c.video &&
+ at !== undefined && {
+ rest: peak
+ ? { src: c.poster, at, from: Math.max(0, +(at - PEAK_WINDOW.before).toFixed(3)), until: +(at + PEAK_WINDOW.after).toFixed(3) }
+ : { src: c.poster, at, from: 0 },
+ }),
scene: "product",
};
}
diff --git a/tests/canvas-starters.test.ts b/tests/canvas-starters.test.ts
index 7abb2ebd..0489fdd9 100644
--- a/tests/canvas-starters.test.ts
+++ b/tests/canvas-starters.test.ts
@@ -4,7 +4,8 @@ import { describe, expect, it } from "vitest";
import { getModel, getPreset } from "@/lib/catalog";
import { CANVAS_TEMPLATES, isGenerator, planCanvas } from "@/lib/catalog/canvas";
import { firstTemplates, moreTemplates, TEMPLATE_SECTIONS, templateSections, type Viewing } from "@/lib/canvas-sections";
-import { canvasIntro, templateCards, templateDetail, templateIds } from "@/lib/canvas-template-cards";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { canvasIntro, templateCards, templateDetail, templateIds, templateModels } from "@/lib/canvas-template-cards";
import { guestRead, isLibraryChange } from "@/lib/guest-access";
import { templateCover } from "@/lib/template-covers";
@@ -12,7 +13,13 @@ import { templateCover } from "@/lib/template-covers";
// Visitors see a board only once its real cover exists, and never the model names or the engine words.
const { TemplateCard } = await import("@/components/canvas/template-card");
-const html = (props: Record<string, unknown>) => renderToStaticMarkup(createElement(TemplateCard as FC<Record<string, unknown>>, props));
+// The model names come from the owner's own request (useTemplateModels), as if it had answered.
+const MODELS = templateModels();
+const html = (props: Record<string, unknown>) => {
+ const qc = new QueryClient();
+ qc.setQueryData(["canvas-template-models"], MODELS);
+ return renderToStaticMarkup(createElement(QueryClientProvider, { client: qc }, createElement(TemplateCard as FC<Record<string, unknown>>, props)));
+};
const cards = templateCards();
const hasCover = (id: string) => !!templateCover("canvas", id);
@@ -128,13 +135,13 @@ describe("A template's card", () => {
expect(h).toContain("/previews/presets/peak/effect-pearl-earring.jpg?v=");
expect(h).not.toContain("Use template");
expect(h).not.toMatch(ENGINE_WORDS);
- for (const m of t.byEngine.open.models) expect(h).not.toContain(m);
+ for (const m of MODELS[t.id].open.models) expect(h).not.toContain(m);
});
it("for the owner: Use template, the models it runs on, and No cover yet where visitors see nothing", () => {
const h = html({ t, engine: "open", busy: false, owner: true, onUse: () => {} });
expect(h).toContain("Use template");
- expect(h).toContain(t.byEngine.open.models[0]);
+ expect(h).toContain(MODELS[t.id].open.models[0]);
expect(h).toContain("free on your GPU");
expect(h).not.toContain("No cover yet");
expect(html({ t: blank, engine: "open", busy: false, owner: true, onUse: () => {} })).toContain(hasCover("script-film") ? "Use template" : "No cover yet");
@@ -167,7 +174,9 @@ describe("A template's page and the first screen's strip", () => {
it("the strip is one real effect film: its first frame, its peak and its clip, each at a versioned URL", () => {
const intro = canvasIntro()!;
- expect(intro.photo.src).toMatch(/^\/previews\/presets\/effect-pearl-earring\.jpg\?v=[0-9a-f]{8}$/);
+ // Agamemnon: a man in a white shirt on a hillside, then a bronze-armoured king (the photo and the scene differ at a glance).
+ expect(intro.templateId).toBe("effect-chain-agamemnon");
+ expect(intro.photo.src).toMatch(/^\/previews\/presets\/effect-agamemnon\.jpg\?v=[0-9a-f]{8}$/);
expect(intro.film.poster).toMatch(/\?v=[0-9a-f]{8}$/);
expect(intro.film.video).toMatch(/\.mp4\?v=[0-9a-f]{8}$/);
expect(canvasIntro("script-film")).toBeUndefined();
@@ -178,3 +187,50 @@ describe("A template's page and the first screen's strip", () => {
expect(isLibraryChange("POST", "/api/canvases")).toBe(true);
});
});
+
+describe("A template's cover on its card", () => {
+ const covered = cards.filter((c) => hasCover(c.id));
+ // The boards with no cover yet, and one made up (every board may have its cover by now).
+ const bare = [...cards.filter((c) => !hasCover(c.id)), { ...cards[0], id: "effect-chain-not-yet" }];
+ // The cover box: the card's first 16:9 box, up to the card's body.
+ const coverBox = (h: string) => h.slice(h.indexOf("aspect-[16/9]"), h.indexOf("<h3"));
+
+ it("shows the finished scene whole: nothing over it but the icon badge, the steps under the title", () => {
+ for (const t of covered) {
+ const h = html({ t, engine: "open", busy: false });
+ expect(coverBox(h), t.id).not.toContain("data-step-flow");
+ expect(h.slice(h.indexOf("<h3")), t.id).toContain("data-step-flow");
+ expect(coverBox(h), t.id).not.toContain("bg-black/60");
+ }
+ });
+
+ it("for the owner, one without a cover is a tinted panel with its icon and No cover yet, its steps under the title as on every card", () => {
+ for (const t of bare) {
+ const h = html({ t, engine: "open", busy: false, owner: true, onUse: () => {} });
+ expect(h, t.id).toContain("No cover yet");
+ expect(h, t.id).toContain("data-no-cover");
+ expect(h, t.id).not.toContain("<svg viewBox=");
+ // The same line as a covered card's, so a row of cards keeps one height.
+ expect(h.slice(h.indexOf("<h3")), t.id).toContain("data-step-flow");
+ }
+ });
+
+ it("a visitor never gets one without a cover, and the model line is the owner's", () => {
+ const shown = templateSections(cards, visitor).flatMap((s) => s.items);
+ expect(shown.every((t) => hasCover(t.id))).toBe(true);
+ for (const t of cards.filter((c) => !hasCover(c.id))) expect(shown.map((x) => x.id)).not.toContain(t.id);
+ for (const t of shown) {
+ const h = html({ t, engine: "open", busy: false });
+ for (const m of [...MODELS[t.id].open.models, ...MODELS[t.id].cloud.models]) expect(h, `${t.id}: ${m}`).not.toContain(m);
+ expect(h).not.toMatch(/Fuobe DoP|Qwen|free on your GPU/);
+ }
+ });
+
+ it("the page's data holds no model name (the owner's line asks for them: GET /api/canvases/template-models, closed to visitors)", () => {
+ const data = JSON.stringify(templateCards());
+ const names = new Set(Object.values(MODELS).flatMap((m) => [...m.open.models, ...m.cloud.models]));
+ expect(names.size).toBeGreaterThan(0);
+ for (const n of names) expect(data, n).not.toContain(`"${n}"`);
+ expect(guestRead("/api/canvases/template-models")).toEqual({ kind: "closed" });
+ });
+});
diff --git a/tests/cover-framing.test.ts b/tests/cover-framing.test.ts
index 49f115b4..9483e7b6 100644
--- a/tests/cover-framing.test.ts
+++ b/tests/cover-framing.test.ts
@@ -129,7 +129,9 @@ describe("the Canvas templates (16:9)", () => {
expect(art("effect-chain-agamemnon")).toContain(style("50% 0%"));
expect(art("effect-chain-dolphin-ride")).toContain(style("50% 30%"));
expect(art("effect-chain-pearl-earring")).toContain(style("50% 0%"));
- expect(art("effect-chain-skatedog")).toContain("aspect-[4/3]");
+ // Skatedog fills its 16:9 tile from its lower part (the person, the dog, both boards): no bars at the sides.
+ expect(art("effect-chain-skatedog")).toContain(style("50% 80%"));
+ expect(art("effect-chain-skatedog")).not.toContain("aspect-[4/3]");
expect(art("effect-chain-superstar")).not.toContain("object-position");
});
});
diff --git a/tests/covers-from-masters.test.ts b/tests/covers-from-masters.test.ts
index ed1bbec8..28c48ae1 100644
--- a/tests/covers-from-masters.test.ts
+++ b/tests/covers-from-masters.test.ts
@@ -290,7 +290,11 @@ describe("covers from masters", () => {
const pub = path.join(dir, "restamp-public");
const presets = path.join(pub, "previews", "presets");
fs.mkdirSync(path.join(presets, "thumbs"), { recursive: true });
- for (const [f, bytes] of [["app-relight.jpg", "a"], ["thumbs/app-relight.jpg", "b"], ["effect-flame-on.jpg", "c"], ["thumbs/effect-flame-on.jpg", "d"], ["effect-flame-on.mp4", "e"]]) fs.writeFileSync(path.join(presets, f), bytes);
+ fs.mkdirSync(path.join(presets, "mini"), { recursive: true });
+ for (const [f, bytes] of [["app-relight.jpg", "a"], ["thumbs/app-relight.jpg", "b"], ["mini/app-relight.jpg", "b2"], ["effect-flame-on.jpg", "c"], ["thumbs/effect-flame-on.jpg", "d"], ["mini/effect-flame-on.jpg", "d2"], ["effect-flame-on.mp4", "e"]]) fs.writeFileSync(path.join(presets, f), bytes);
+ // Each mini is listed as made from its poster as it is (the minis list next to this public dir).
+ const minis = { "app-relight": sha8(path.join(presets, "app-relight.jpg")), "effect-flame-on": sha8(path.join(presets, "effect-flame-on.jpg")) };
+ fs.writeFileSync(path.join(pub, "preset-minis.generated.ts"), `export const PRESET_MINIS: Record<string, string> = ${JSON.stringify(minis)};\n`);
const manifest = path.join(dir, "restamp", "manifest.ts");
const meta = { run: "r", engine: "comfyui", model: "m", variant: "v" };
writeManifest(
@@ -341,7 +345,8 @@ describe("covers from masters", () => {
manifest,
);
const unwritten = fs.readFileSync(manifest, "utf8");
- const thumbs = ["/previews/presets/thumbs/app-headshot.jpg", "/previews/presets/thumbs/app-relight.jpg"];
+ // Each poster's 320 px copy and its 96 px one (the menus' rows).
+ const thumbs = ["/previews/presets/thumbs/app-headshot.jpg", "/previews/presets/mini/app-headshot.jpg", "/previews/presets/thumbs/app-relight.jpg", "/previews/presets/mini/app-relight.jpg"];
// A dry run lists the copies it would make, and makes none.
expect(versionCovers({ publicDir: pub, manifest, dryRun: true })).toMatchObject({ changed: 2, thumbs, unversioned: [] });
@@ -350,7 +355,8 @@ describe("covers from masters", () => {
expect(fs.readFileSync(manifest, "utf8")).toBe(unwritten);
// Then it makes them before hashing, so each version is of the poster and its new small copy.
expect(versionCovers({ publicDir: pub, manifest })).toMatchObject({ changed: 2, thumbs, unversioned: [] });
- for (const f of [thumb, newThumb]) expect(fs.readFileSync(f).subarray(0, 2), f).toEqual(Buffer.from([0xff, 0xd8]));
+ const minis = ["app-relight", "app-headshot"].map((id) => path.join(presets, "mini", `${id}.jpg`));
+ for (const f of [thumb, newThumb, ...minis]) expect(fs.readFileSync(f).subarray(0, 2), f).toEqual(Buffer.from([0xff, 0xd8]));
const m = readManifest(manifest);
expect(m["app-relight"].poster).toBe(`/previews/presets/app-relight.jpg?v=${sha8(poster, thumb)}`);
expect(m["app-headshot"].poster).toBe(`/previews/presets/app-headshot.jpg?v=${sha8(path.join(presets, "app-headshot.jpg"), newThumb)}`);
diff --git a/tests/e2e/_browser.mjs b/tests/e2e/_browser.mjs
index 555c5363..00a3c280 100644
--- a/tests/e2e/_browser.mjs
+++ b/tests/e2e/_browser.mjs
@@ -34,10 +34,17 @@ export function chromiumPath() {
return exe && fs.existsSync(exe) ? exe : undefined;
}
-/** `opts`: more launch options (`args`: Chromium flags, such as a host name mapped to this machine). */
+/**
+ * The browser engine the checks run in: E2E_BROWSER=webkit (Safari's) or firefox, else Chromium. Checks that read
+ * Chromium-only data (its DevTools protocol, layout-shift entries) skip themselves elsewhere.
+ */
+export const ENGINE = ["webkit", "firefox"].includes(process.env.E2E_BROWSER ?? "") ? process.env.E2E_BROWSER : "chromium";
+
+/** `opts`: more launch options (`args`: Chromium flags, such as a host name mapped to this machine; Chromium only). */
export async function launch(opts = {}) {
- const { chromium } = loadPlaywright();
- return chromium.launch({ executablePath: chromiumPath(), ...opts });
+ const pw = loadPlaywright();
+ if (ENGINE !== "chromium") return pw[ENGINE].launch({ ...opts, args: undefined });
+ return pw.chromium.launch({ executablePath: chromiumPath(), ...opts });
}
export const PHONE = { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true };
diff --git a/tests/e2e/mega-menus.mjs b/tests/e2e/mega-menus.mjs
new file mode 100644
index 00000000..4efe6104
--- /dev/null
+++ b/tests/e2e/mega-menus.mjs
@@ -0,0 +1,572 @@
+// The bar's grouped menus in a real browser: Studios, Apps, Motions & effects and Canvas, for a guest, an account and
+// the owner, at the desktop sizes they must fit without scrolling; their keys, links, loading and budgets; the phone's
+// Studios sheet with its four families; and the Canvas ready boards' covers on /canvas.
+// Usage: node tests/e2e/mega-menus.mjs [appUrl] [shotsDir]
+// E2E_BROWSER=webkit (Safari's engine) or firefox runs it there (the loading and budget checks are Chromium's).
+// E2E_OWNER_PASSWORD: the studio's password, when it has one. Account checks need public sign-up (throwaway qa
+// accounts, deleted at the end). MEGA_JS_BASELINE: a JSON file {"/": kB, "/apps": kB} of the cold JS a guest fetches
+// on main, to hold this build to +4 kB of it. MEGA_JS_APP: where to measure that, when the baseline came from a
+// server started with other settings (the same build started the same way as main's); defaults to appUrl.
+// Exits 1 if any check fails; shots of every open menu (1280, 1440, 1920; phone 390), light and dark, guest and owner,
+// go to shotsDir when given.
+import fs from "node:fs";
+import path from "node:path";
+import zlib from "node:zlib";
+import { ENGINE, launch, openRoute, PHONE, root } from "./_browser.mjs";
+
+const args = process.argv.slice(2).filter((a) => !a.startsWith("--"));
+const app = (args[0] ?? "http://localhost:3000").replace(/\/$/, "");
+const shots = args[1];
+if (shots) fs.mkdirSync(shots, { recursive: true });
+const failures = [];
+const check = (ok, what, detail = "") => {
+ console.log(`${ok ? "✓" : "✗"} ${what}${!ok && detail ? ` (${detail})` : ""}`);
+ if (!ok) failures.push(what);
+};
+const shot = async (page, name) => shots && (await page.screenshot({ path: path.join(shots, `${name}.png`) }));
+const publicSignup = !!(await fetch(`${app}/api/auth/me`).then((r) => r.json()).catch(() => null))?.publicSignup;
+/** Words a visitor never reads in a menu or on /canvas (owner-only status and model names). */
+const OWNER_WORDS = ["No cover yet", "Fuobe DoP", "free on your GPU", "Qwen", "Wan 2", "LTX", "Kling", "ComfyUI"];
+
+const MENUS = {
+ studios: { chevron: "Studios menu", line: /^\d+ studios, grouped by what you want to make$/, groups: 6, seeAll: "/studios", from: 0 },
+ apps: { chevron: "Apps menu", line: /^\d+ apps, grouped by what they change$/, groups: 6, seeAll: "/apps", from: 1280 },
+ motions: { chevron: "Motions & effects menu", line: /^\d+ camera motions and \d+ effects, for any photo$/, groups: 6, seeAll: "/motions-and-effects", from: 1280 },
+ canvas: { chevron: "Canvas menu", line: /^\d+ ready boards that run as they are$/, groups: 2, seeAll: "/canvas", from: 1440 },
+};
+const SIZES = [
+ { width: 1280, height: 720 },
+ { width: 1366, height: 768 },
+ { width: 1440, height: 900 },
+ { width: 1920, height: 1080 },
+];
+const SHOT_WIDTHS = [1280, 1440, 1920];
+
+const browser = await launch();
+const accounts = [];
+
+/** One throwaway qa account for the whole run (sign-up is rate limited), in a context kept open to delete it at the end. */
+let accountState;
+async function account() {
+ if (!accountState) {
+ const ctx = await browser.newContext();
+ const email = `qa-mega-${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}@example.com`;
+ const password = `Qa-${Math.random().toString(36).slice(2)}-${Date.now()}`;
+ const res = await ctx.request.post(`${app}/api/auth/signup`, { data: { email, password } });
+ if (!res.ok()) throw new Error(`sign-up answered ${res.status()}`);
+ accounts.push({ ctx, password });
+ accountState = await ctx.storageState();
+ }
+ return accountState;
+}
+async function as(who, device = { viewport: { width: 1440, height: 900 } }, extra = {}) {
+ const ctx = await browser.newContext({ ...device, ...extra });
+ ctx.errors = [];
+ if (who === "owner" && process.env.E2E_OWNER_PASSWORD) await ctx.request.post(`${app}/api/auth/login`, { data: { password: process.env.E2E_OWNER_PASSWORD } });
+ if (who === "account") await ctx.addCookies((await account()).cookies);
+ const me = (await (await ctx.request.get(`${app}/api/auth/me`)).json().catch(() => null)) ?? {};
+ if (who === "owner" && !me.owner) throw new Error("couldn't sign in as the owner (set E2E_OWNER_PASSWORD)");
+ return ctx;
+}
+async function page(ctx) {
+ const p = await ctx.newPage();
+ // Not errors: a resource that failed to load (its own checks catch those), and WebKit's words for a route's
+ // prefetch cut short by following a link ("… _rsc=… due to access control checks", logged or thrown).
+ const noise = (t) => /Failed to load resource/.test(t) || (/_rsc=/.test(t) && /due to access control checks/.test(t));
+ p.on("pageerror", (e) => !noise(e.message) && ctx.errors.push(`uncaught: ${e.message.split("\n")[0]}`));
+ p.on("console", (m) => m.type() === "error" && !noise(m.text()) && ctx.errors.push(m.text().slice(0, 200)));
+ return p;
+}
+const bar = (p) => p.locator("[data-top-bar]");
+const panelOf = (p, id) => p.locator(`#${id}-launcher`);
+const pathOf = (p) => new URL(p.url()).pathname;
+const at = (p) => p.evaluate(() => [document.activeElement?.getAttribute("data-col"), document.activeElement?.getAttribute("data-row")].join(","));
+const waitPath = (p, want) => p.waitForURL((u) => new URL(u).pathname === want, { timeout: 20_000 }).then(() => true, () => false);
+
+/** Opens a menu with its chevron and waits for its links and pictures. */
+async function openMenu(p, id) {
+ await bar(p).getByRole("button", { name: MENUS[id].chevron, exact: true }).click();
+ const panel = panelOf(p, id);
+ await panel.waitFor({ state: "visible" });
+ // Its first column's first item (the owner's Canvas column comes a moment after the rest).
+ await panel.locator('[data-col="0"][data-row="0"]').first().waitFor({ timeout: 10_000 });
+ await p
+ .waitForFunction((sel) => [...document.querySelectorAll(`${sel} img`)].filter((i) => i.checkVisibility()).every((i) => i.complete), `#${id}-launcher`, { timeout: 10_000 })
+ .catch(() => {});
+ await p.waitForTimeout(250);
+ return panel;
+}
+
+/** What an open panel shows: its header, fit, columns, pictures and words. */
+const measure = (panel) =>
+ panel.evaluate((el) => {
+ const links = [...el.querySelectorAll("[data-col]")].filter((a) => a.checkVisibility());
+ const imgs = [...el.querySelectorAll("img")].filter((i) => i.checkVisibility());
+ // Values that differ by more than a pixel (rounded), or none when they all agree within one.
+ const spread = (v) => (v.length && Math.max(...v) - Math.min(...v) > 1 ? [...new Set(v.map(Math.round))] : []);
+ return {
+ line: el.querySelector("[data-count-line]")?.textContent?.trim() ?? "",
+ inner: el.scrollHeight - el.clientHeight,
+ groups: el.querySelectorAll("[data-group]").length,
+ links: links.length,
+ offscreen: links.filter((a) => {
+ const r = a.getBoundingClientRect();
+ return r.bottom > innerHeight + 0.5 || r.right > innerWidth + 0.5 || r.top < 0;
+ }).length,
+ broken: imgs.filter((i) => !i.complete || i.naturalWidth === 0).map((i) => i.getAttribute("src")),
+ foreign: imgs.filter((i) => !/^\/(previews|samples)\//.test(new URL(i.currentSrc || i.src, location.href).pathname)).map((i) => i.src),
+ text: el.innerText,
+ // Lead cards of one height, and every column's first row on one line (a list column's row 1).
+ // (Within a pixel: columns of a fractional width round their 4:3 covers either way.)
+ leads: spread([...el.querySelectorAll('a[data-row="0"][class*="group/lead"]')].filter((a) => a.checkVisibility()).map((a) => a.getBoundingClientRect().height)),
+ firstRows: spread([...el.querySelectorAll('[data-group] > ul > li > a[data-row="1"]')].filter((a) => a.checkVisibility()).map((a) => a.getBoundingClientRect().top)),
+ // Lines cut with "…" (a row's or a lead's line wider than its box).
+ cut: [...el.querySelectorAll("[data-col] span.truncate.text-muted-foreground")].filter((s) => s.checkVisibility() && s.scrollWidth > s.clientWidth + 1).map((s) => s.textContent),
+ rowsMax: Math.max(0, ...[...el.querySelectorAll("[data-group] > ul")].map((u) => [...u.querySelectorAll(':scope > li > a[data-row]:not([data-row="0"])')].filter((a) => a.checkVisibility()).length)),
+ lit: document.querySelectorAll("[data-top-bar] [data-bar-split][data-open]").length,
+ panels: [...document.querySelectorAll("[data-mega-panel]")].filter((x) => !x.hidden).length,
+ };
+ });
+
+try {
+ // 1. Every menu, every viewer, every size: header, columns, fit, pictures, words; Esc gives focus back.
+ for (const who of ["guest", "owner", ...(publicSignup ? ["account"] : [])]) {
+ for (const size of SIZES) {
+ const ctx = await as(who, { viewport: size });
+ const p = await page(ctx);
+ await openRoute(p, `${app}/image`, { settleMs: 300 });
+ const label = `${who} ${size.width}x${size.height}`;
+ for (const [id, m] of Object.entries(MENUS)) {
+ if (size.width < m.from) {
+ check(!(await bar(p).getByRole("button", { name: m.chevron, exact: true }).isVisible()), `${label} ${id}: in More at this width`);
+ continue;
+ }
+ const panel = await openMenu(p, id);
+ const r = await measure(panel);
+ check(m.line.test(r.line), `${label} ${id}: header line with its count`, r.line);
+ check(r.inner <= 1 && r.offscreen === 0, `${label} ${id}: every item on screen, no scrolling inside`, `inner ${r.inner}, ${r.offscreen}/${r.links} off screen`);
+ check(r.groups === m.groups, `${label} ${id}: ${m.groups} groups`, String(r.groups));
+ check(r.broken.length === 0 && r.foreign.length === 0, `${label} ${id}: every picture loaded, from /previews/`, [...r.broken, ...r.foreign].slice(0, 3).join(" "));
+ check(r.lit === 1 && r.panels === 1, `${label} ${id}: one bar item open, one panel`, `${r.lit} lit, ${r.panels} panels`);
+ if (id !== "canvas") {
+ check(r.leads.length <= 1, `${label} ${id}: lead cards of one height`, r.leads.join(", "));
+ check(r.firstRows.length <= 1, `${label} ${id}: first rows on one line`, r.firstRows.join(", "));
+ check(r.rowsMax <= 7, `${label} ${id}: at most seven rows under a lead`, String(r.rowsMax));
+ }
+ if (size.width >= 1440) check(r.cut.length === 0, `${label} ${id}: no line cut off`, r.cut.slice(0, 4).join(" | "));
+ if (who !== "owner") {
+ const said = OWNER_WORDS.filter((w) => r.text.includes(w));
+ check(said.length === 0, `${label} ${id}: no owner-only words`, said.join(", "));
+ }
+ if (shots && who !== "account" && SHOT_WIDTHS.includes(size.width)) await shot(p, `${id}-${size.width}-${who}-light`);
+ await p.keyboard.press("Escape");
+ await panel.waitFor({ state: "hidden" });
+ const back = await bar(p).getByRole("button", { name: m.chevron, exact: true }).evaluate((b) => b === document.activeElement);
+ check(back, `${label} ${id}: Esc closes it and focus goes back to the chevron`);
+ }
+ check(ctx.errors.length === 0, `${label}: no console errors`, ctx.errors.join(" | "));
+ await ctx.close();
+ }
+ }
+
+ // 1b. Dark shots.
+ if (shots) {
+ for (const who of ["guest", "owner"]) {
+ for (const width of SHOT_WIDTHS) {
+ const size = SIZES.find((s) => s.width === width);
+ const ctx = await as(who, { viewport: size }, { colorScheme: "dark" });
+ const p = await page(ctx);
+ await openRoute(p, `${app}/image`, { settleMs: 300 });
+ for (const [id, m] of Object.entries(MENUS)) {
+ if (width < m.from) continue;
+ const panel = await openMenu(p, id);
+ await shot(p, `${id}-${width}-${who}-dark`);
+ await p.keyboard.press("Escape");
+ await panel.waitFor({ state: "hidden" });
+ }
+ await ctx.close();
+ }
+ }
+ }
+
+ // 2. Keys, one panel at a time, links and See all (guest, 1440x900).
+ {
+ const ctx = await as("guest");
+ const p = await page(ctx);
+ await openRoute(p, `${app}/image`, { settleMs: 300 });
+ for (const id of ["apps", "motions", "canvas"]) {
+ const chev = bar(p).getByRole("button", { name: MENUS[id].chevron, exact: true });
+ await chev.focus();
+ await p.keyboard.press("Enter");
+ const panel = panelOf(p, id);
+ await panel.waitFor({ state: "visible" });
+ await p.waitForFunction(() => document.activeElement?.closest("[data-mega-panel]"), null, { timeout: 10_000 }).catch(() => {});
+ check((await at(p)) === "0,0", `${id}: Enter on the chevron opens it on the first lead`, await at(p));
+ await p.keyboard.press("ArrowRight");
+ check((await at(p)) === "1,0", `${id}: Right goes to the next column's first item`, await at(p));
+ await p.keyboard.press("ArrowDown");
+ const down = await at(p);
+ check(down === "1,1", `${id}: Down goes down the column`, down);
+ await p.keyboard.press("End");
+ const end = await at(p);
+ await p.keyboard.press("Home");
+ check((await at(p)) === "1,0" && end.startsWith("1,"), `${id}: End and Home go to the column's ends`, `${end} → ${await at(p)}`);
+ await p.keyboard.press("ArrowLeft");
+ check((await at(p)) === "0,0", `${id}: Left comes back`, await at(p));
+ if (id === "motions") {
+ // From the last camera-motion column to the first effects column.
+ for (let i = 0; i < 3; i++) await p.keyboard.press("ArrowRight");
+ const fam = await p.evaluate(() => document.activeElement?.closest("[data-group]")?.getAttribute("data-group"));
+ check((await at(p)) === "3,0" && !["push", "orbit", "handheld"].includes(fam ?? ""), "motions: Right crosses from camera motions to effects", `${await at(p)} ${fam}`);
+ }
+ // Every item's link resolves (rows the window hides too).
+ const hrefs = [...new Set(await panel.locator("a[href]").evaluateAll((as_) => as_.map((a) => a.getAttribute("href"))))];
+ const bad = [];
+ for (const h of hrefs) {
+ const res = await ctx.request.get(app + h, { maxRedirects: 0 }).catch(() => null);
+ if (!res || res.status() >= 400) bad.push(`${h} ${res?.status()}`);
+ }
+ check(bad.length === 0, `${id}: all ${hrefs.length} links resolve`, bad.slice(0, 5).join(", "));
+ // Tab past the last link closes it.
+ // (The last link on screen: rows the window's height hides can't take focus.)
+ await panel.locator("a[href]:visible").last().focus();
+ await p.keyboard.press("Tab");
+ await p.waitForTimeout(150);
+ check(!(await panel.isVisible()), `${id}: Tab past its last link closes it`);
+ }
+ // ArrowDown on the name opens; Esc gives focus back to the name.
+ for (const [id, name] of [["apps", "Apps"], ["canvas", "Canvas"]]) {
+ const link = bar(p).getByRole("link", { name, exact: true });
+ await link.focus();
+ await p.keyboard.press("ArrowDown");
+ await p.waitForFunction(() => document.activeElement?.closest("[data-mega-panel]"), null, { timeout: 10_000 }).catch(() => {});
+ check((await at(p)) === "0,0", `${id}: ArrowDown on the name opens it on the first lead`);
+ await p.keyboard.press("Escape");
+ await p.waitForTimeout(150);
+ check(await link.evaluate((a) => a === document.activeElement), `${id}: Esc gives focus back to the name`);
+ }
+ // One at a time: a grouped menu replaces another, and Create's menu and a grouped menu close each other.
+ await openMenu(p, "apps");
+ await openMenu(p, "motions");
+ check(!(await panelOf(p, "apps").isVisible()) && (await panelOf(p, "motions").isVisible()), "opening Motions & effects closes Apps");
+ await bar(p).getByRole("button", { name: "Create menu", exact: true }).click();
+ await p.getByRole("menu").waitFor({ timeout: 5_000 }).catch(() => {});
+ check(!(await panelOf(p, "motions").isVisible()) && (await p.getByRole("menu").count()) === 1, "opening Create closes Motions & effects");
+ await p.keyboard.press("Escape");
+ await p.waitForTimeout(200);
+ // Resting the mouse: every grouped menu opens after a moment (not at once), keeps focus where it was, and closes
+ // once the pointer leaves the item and the panel. While one is open, moving onto another item switches at once.
+ for (const [id, name] of [["studios", /^Studios, \d+ studios$/], ["apps", "Apps"], ["canvas", "Canvas"]]) {
+ await p.mouse.move(6, 28);
+ await p.waitForTimeout(400);
+ const box = await bar(p).getByRole("link", { name, exact: typeof name === "string" }).boundingBox();
+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
+ await p.waitForTimeout(120);
+ const early = await panelOf(p, id).isVisible();
+ await p.waitForTimeout(500);
+ check(!early && (await panelOf(p, id).isVisible()), `resting on ${id} opens its menu after a moment, not at once`);
+ await p.mouse.move(6, 28, { steps: 4 });
+ await p.waitForTimeout(600);
+ check(!(await panelOf(p, id).isVisible()), `${id}: moving the mouse off the item and the panel closes it`);
+ }
+ {
+ await openMenu(p, "apps");
+ const box = await bar(p).getByRole("link", { name: "Canvas", exact: true }).boundingBox();
+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
+ await p.waitForTimeout(80);
+ check((await panelOf(p, "canvas").isVisible()) && !(await panelOf(p, "apps").isVisible()), "with Apps open, moving onto Canvas switches to it at once");
+ await p.keyboard.press("Escape");
+ await p.mouse.move(6, 28);
+ await p.waitForTimeout(600);
+ }
+ {
+ await p.mouse.move(700, 700);
+ const focusWas = await p.evaluate(() => document.activeElement?.tagName ?? "");
+ const box = await bar(p).getByRole("link", { name: "Motions & effects", exact: true }).boundingBox();
+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
+ await p.waitForTimeout(700);
+ check(await panelOf(p, "motions").isVisible(), "resting on Motions & effects opens its menu");
+ check((await p.evaluate(() => !document.activeElement?.closest("[data-mega-panel]"))) && focusWas !== "", "opened by resting: focus stays where it was");
+ // Into the panel and back out: it stays while the pointer is over it, then closes.
+ const pb = await panelOf(p, "motions").boundingBox();
+ await p.mouse.move(pb.x + pb.width / 2, pb.y + 120, { steps: 6 });
+ await p.waitForTimeout(500);
+ check(await panelOf(p, "motions").isVisible(), "Motions & effects stays open while the pointer is on its panel");
+ await p.mouse.move(6, 28, { steps: 4 }); // the bar's far left: off the item and the panel
+ await p.waitForTimeout(600);
+ check(!(await panelOf(p, "motions").isVisible()), "and closes once the pointer leaves it");
+ // A click on its chevron while hover-open keeps it open (pinned), with focus inside.
+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
+ await p.waitForTimeout(700);
+ await bar(p).getByRole("button", { name: MENUS.motions.chevron, exact: true }).click();
+ await p.mouse.move(700, 800);
+ await p.waitForTimeout(600);
+ check(await panelOf(p, "motions").isVisible(), "a click pins Motions & effects open after hovering");
+ await p.keyboard.press("Escape");
+ await p.waitForTimeout(200);
+ }
+ await p.mouse.move(700, 700);
+ // See all, and the families' See all.
+ for (const [id, name, want] of [
+ ["apps", "See all apps", "/apps"],
+ ["motions", "See all motions and effects", "/motions-and-effects"],
+ ["motions", "See all camera motions", "/motions"],
+ ["motions", "See all effects", "/effects"],
+ ["canvas", "See all of Canvas", "/canvas"],
+ ]) {
+ await openRoute(p, `${app}/image`, { settleMs: 300 });
+ const panel = await openMenu(p, id);
+ await panel.getByRole("link", { name, exact: true }).click();
+ check(await waitPath(p, want), `${id}: "${name}" opens ${want}`, pathOf(p));
+ }
+ // A row marks the page it is on.
+ await openRoute(p, `${app}/apps`, { settleMs: 300 });
+ const firstApp = await (async () => {
+ const panel = await openMenu(p, "apps");
+ return panel.locator('[data-col="0"][data-row="1"]').getAttribute("href");
+ })();
+ await openRoute(p, app + firstApp, { settleMs: 300 });
+ const panel = await openMenu(p, "apps");
+ check((await panel.locator(`a[href="${firstApp}"]`).getAttribute("aria-current")) === "page", "apps: the open app's row is marked as the page");
+ check(ctx.errors.length === 0, "keys and links: no console errors", ctx.errors.join(" | "));
+ await ctx.close();
+ }
+
+ // 3. Loading and budgets (guest, cold, 1440x900): read from Chromium's DevTools protocol, so in Chromium only.
+ if (ENGINE !== "chromium") console.log(` loading and budgets: Chromium only (this run: ${ENGINE})`);
+ else {
+ const ctx = await as("guest");
+ const p = await page(ctx);
+ const cdp = await ctx.newCDPSession(p);
+ await cdp.send("Network.enable");
+ const urls = new Map();
+ const bytes = new Map();
+ const at_ = new Map();
+ cdp.on("Network.requestWillBeSent", (e) => {
+ urls.set(e.requestId, e.request.url);
+ at_.set(e.requestId, Date.now());
+ });
+ cdp.on("Network.loadingFinished", (e) => bytes.set(e.requestId, e.encodedDataLength));
+ await p.addInitScript(() => {
+ window.__cls = 0;
+ new PerformanceObserver((l) => {
+ for (const e of l.getEntries()) if (!e.hadRecentInput) window.__cls += e.value;
+ }).observe({ type: "layout-shift", buffered: true });
+ });
+ await p.goto(`${app}/image`, { waitUntil: "domcontentloaded" });
+ const early = [...urls.values()].filter((u) => u.includes("/nav-menus/")).length;
+ await p.waitForLoadState("load");
+ await p.waitForTimeout(4000);
+ const idle = [...urls.values()].filter((u) => u.includes("/nav-menus/"));
+ const minis = [...urls.values()].filter((u) => /\/previews\/presets\/mini\//.test(u)).length;
+ check(early === 0, "no menu data with the page itself");
+ check(idle.length === 3, "idle: the three menus' data (apps, motions, canvas), once each", idle.map((u) => new URL(u).pathname).join(" "));
+ check(minis === 0, "idle: no menu pictures before a menu warms", String(minis));
+ // Gzipped as the site's front server sends it (next start here may send it plain).
+ const sizes = [];
+ for (const u of new Set(idle)) sizes.push([new URL(u).pathname, zlib.gzipSync(Buffer.from(await (await fetch(u)).arrayBuffer())).length]);
+ check(sizes.length === 3 && sizes.every(([, b]) => b > 0 && b <= 4096), "each menu's data is at most 4 KB gzipped", sizes.map(([u, b]) => `${u} ${b}`).join(", "));
+ // Warm, then open: the panel shows within a frame of the click; pictures within budget; nothing moves.
+ for (const id of ["apps", "motions", "canvas"]) {
+ const since = Date.now();
+ const chev = bar(p).getByRole("button", { name: MENUS[id].chevron, exact: true });
+ await chev.hover();
+ await p.waitForTimeout(1200);
+ await p.evaluate(() => (window.__cls = 0));
+ const ms = await p.evaluate(async (sel) => {
+ const b = document.querySelector(`[data-mega-trigger="${sel}"]`);
+ const t0 = performance.now();
+ b.click();
+ await new Promise((r) => requestAnimationFrame(() => r()));
+ const panel = document.getElementById(`${sel}-launcher`);
+ return panel && !panel.hidden && panel.querySelector("[data-col]") ? performance.now() - t0 : -1;
+ }, id);
+ check(ms >= 0 && ms < 100, `${id}: shows within 100 ms of the click once warmed`, `${ms.toFixed?.(1)} ms`);
+ await p.waitForTimeout(2500);
+ const img = [...urls].filter(([rid, u]) => at_.get(rid) >= since && /\/previews\//.test(u)).reduce((s, [rid]) => s + (bytes.get(rid) ?? 0), 0);
+ check(img <= 250 * 1024, `${id}: first open loads at most 250 KB of pictures at 1440x900`, `${Math.round(img / 1024)} KB`);
+ await p.keyboard.press("Escape");
+ await p.waitForTimeout(300);
+ const cls = await p.evaluate(() => window.__cls);
+ check(cls < 0.001, `${id}: opening and closing it moves nothing on the page (CLS)`, String(cls));
+ }
+ await ctx.close();
+ // Cold JS of / and /apps, from a browser of its own (one that already loaded these files serves some from memory):
+ // the scripts the page's HTML asks for (what it needs to start), not what idle work or its media fetch later, which
+ // varies from load to load.
+ const js = {};
+ const cold = await launch();
+ for (const route of ["/", "/apps"]) {
+ const c = await cold.newContext({ viewport: { width: 1440, height: 900 } });
+ const q = await c.newPage();
+ const s = await c.newCDPSession(q);
+ await s.send("Network.enable");
+ const u = new Map();
+ const b = new Map();
+ const by = new Map();
+ s.on("Network.requestWillBeSent", (e) => by.set(e.requestId, e.initiator?.type));
+ s.on("Network.responseReceived", (e) => u.set(e.requestId, e.response.url));
+ s.on("Network.loadingFinished", (e) => b.set(e.requestId, e.encodedDataLength));
+ await q.goto((process.env.MEGA_JS_APP ?? app).replace(/\/$/, "") + route, { waitUntil: "load" });
+ await q.waitForTimeout(400);
+ js[route] = +([...u].filter(([id, x]) => /\.js(\?|$)/.test(x) && by.get(id) === "parser").reduce((sum, [id]) => sum + (b.get(id) ?? 0), 0) / 1024).toFixed(1);
+ await c.close();
+ }
+ await cold.close();
+ console.log(` cold JS: / ${js["/"]} KB, /apps ${js["/apps"]} KB`);
+ if (process.env.MEGA_JS_BASELINE) {
+ const base = JSON.parse(fs.readFileSync(process.env.MEGA_JS_BASELINE, "utf8"));
+ for (const r of ["/", "/apps"]) {
+ const was = base[r]?.jsKB ?? base[r];
+ check(js[r] - was <= 4, `${r}: cold JS within 4 KB of main`, `${was} → ${js[r]} KB`);
+ }
+ }
+ }
+
+ // 4. The bar fits at each width for each viewer.
+ for (const who of ["guest", "owner", ...(publicSignup ? ["account"] : [])]) {
+ for (const width of [1280, 1440, 1536, 1600]) {
+ const ctx = await as(who, { viewport: { width, height: 900 } });
+ const p = await page(ctx);
+ await openRoute(p, `${app}/image`, { settleMs: 300 });
+ const cut = await bar(p).evaluate((h) => {
+ const over = (el) => el.scrollWidth - el.clientWidth;
+ return Math.max(over(h), ...[...h.querySelectorAll("nav")].map(over));
+ });
+ check(cut <= 1, `bar at ${width} (${who}): everything fits`, `${cut}px cut`);
+ await ctx.close();
+ }
+ }
+
+ // 5. Phone: the Studios sheet's families.
+ for (const who of ["guest", "owner"]) {
+ for (const size of [PHONE.viewport, { width: 360, height: 740 }]) {
+ for (const scheme of size.width === 390 ? ["light", "dark"] : ["light"]) {
+ const label = `${who} ${size.width}x${size.height} ${scheme}`;
+ const ctx = await as(who, { ...PHONE, viewport: size }, { colorScheme: scheme });
+ const p = await page(ctx);
+ await openRoute(p, `${app}/image`, { settleMs: 300 });
+ await p.locator("[data-phone-tabs]").getByRole("button", { name: "Studios" }).tap();
+ const sheet = p.locator("#phone-sheet");
+ await sheet.waitFor({ state: "visible" });
+ const fams = sheet.getByRole("group", { name: "What to show" }).getByRole("button");
+ check((await fams.count()) === 4, `${label}: four families in the sheet`);
+ const tops = [];
+ for (const [fam, name] of [["studios", "Studios"], ["apps", "Apps"], ["motions", "Motions & effects"], ["canvas", "Canvas"]]) {
+ await sheet.getByRole("group", { name: "What to show" }).getByRole("button", { name, exact: true }).tap();
+ const body = sheet.locator(`[data-sheet-family="${fam}"]`);
+ await body.locator("a[href]").first().waitFor({ timeout: 10_000 });
+ await p.waitForTimeout(500);
+ tops.push(Math.round((await sheet.boundingBox()).y));
+ // One See all tile at most (the families' own pages are their chips' and the panel's).
+ const seeAll = await body.locator("ul a[href]").evaluateAll((as_) => as_.filter((a) => /^See all/.test(a.getAttribute("aria-label") ?? a.textContent.trim())).length);
+ check(seeAll <= 1, `${label} ${fam}: one See all tile`, String(seeAll));
+ const r = await body.evaluate((el) => {
+ const links = [...el.querySelectorAll("ul a[href]")];
+ return {
+ n: links.length,
+ off: links.filter((a) => a.getBoundingClientRect().bottom > innerHeight - 0).length,
+ inner: el.scrollHeight - el.clientHeight,
+ page: document.documentElement.scrollWidth - document.documentElement.clientWidth,
+ text: el.innerText,
+ };
+ });
+ const below = await p.locator("[data-phone-tabs]").evaluate((t) => t.getBoundingClientRect().top).catch(() => size.height);
+ const fits = await body.evaluate((el, limit) => [...el.querySelectorAll("ul a[href]")].every((a) => a.getBoundingClientRect().bottom <= limit + 0.5), Math.min(below, size.height));
+ if (fam !== "canvas" && size.height >= 844) check(fits && r.inner <= 1, `${label} ${fam}: All fits without scrolling`, `${r.n} tiles, inner ${r.inner}`);
+ else check(r.page <= 0, `${label} ${fam}: scrolls inside the sheet only`, `${r.page}px sideways`);
+ if (who === "guest") {
+ const said = OWNER_WORDS.filter((w) => r.text.includes(w));
+ check(said.length === 0, `${label} ${fam}: no owner-only words`, said.join(", "));
+ }
+ if (fam !== "studios" && fam !== "canvas") {
+ const chips = sheet.locator('[role="group"][aria-label^="Show one group"] button[aria-pressed]');
+ await chips.nth(1).tap();
+ await p.waitForTimeout(200);
+ const n = await body.locator("ul a[href]").count();
+ check(n >= 6 && n <= 13, `${label} ${fam}: a chip shows its group (lead, rows and See all)`, String(n));
+ await chips.nth(0).tap();
+ await p.waitForTimeout(400); // the chips' colour change settles before the shot
+ }
+ if (shots && size.width === 390) await shot(p, `phone-${fam}-390-${who}-${scheme}`);
+ }
+ check(new Set(tops).size === 1, `${label}: the sheet keeps one height across the families`, tops.join(", "));
+ check(ctx.errors.length === 0, `${label}: no console errors`, ctx.errors.join(" | "));
+ await ctx.close();
+ }
+ }
+ }
+
+ // 6. /canvas: the finished look only, nothing over the subject, no cover-less card for visitors.
+ const gen = fs.readFileSync(path.join(root, "src/lib/template-covers.generated.ts"), "utf8");
+ const peakAt = new Map([...gen.matchAll(/"video":"([^"?]+)[^"]*","at":([0-9.]+)/g)].map((m) => [m[1], Number(m[2])]));
+ for (const who of ["guest", "owner"]) {
+ for (const device of [{ viewport: { width: 1440, height: 900 } }, PHONE]) {
+ const label = `/canvas ${who} ${device.viewport.width}`;
+ const ctx = await as(who, device);
+ const p = await page(ctx);
+ await openRoute(p, `${app}/canvas`, { settleMs: 1200 });
+ const cards = await p.locator("article").evaluateAll((els) =>
+ els
+ .filter((el) => el.querySelector("h3"))
+ .map((el) => {
+ const box = el.querySelector("[class*='aspect-[16/9]']")?.getBoundingClientRect();
+ const flow = el.querySelector("[data-step-flow]")?.getBoundingClientRect();
+ return {
+ name: el.querySelector("h3").textContent.trim(),
+ still: el.querySelector("img")?.getAttribute("src") ?? "",
+ noCover: !!el.querySelector("[data-no-cover]"),
+ svg: !!el.querySelector("[data-no-cover] svg[viewBox]:not([class*='lucide'])"),
+ chip: el.textContent.includes("No cover yet"),
+ over: !!(box && flow && flow.top < box.bottom && flow.bottom > box.top),
+ text: el.innerText,
+ };
+ }),
+ );
+ const covered = cards.filter((c) => !c.noCover);
+ // The finished scene: a peak frame of its clip, or a still made as the board's cover.
+ const finished = (s) => /\/previews\/(presets\/peak|templates\/canvas)\//.test(s);
+ check(covered.length > 0 && covered.every((c) => finished(c.still)), `${label}: every cover is its finished scene (a peak frame or a scene still)`, covered.filter((c) => !finished(c.still)).map((c) => c.name).join(", "));
+ check(covered.every((c) => !c.over), `${label}: the steps line never sits on a cover`, covered.filter((c) => c.over).map((c) => c.name).join(", "));
+ if (who === "guest") {
+ check(cards.every((c) => !c.noCover), `${label}: no card without a cover`, cards.filter((c) => c.noCover).map((c) => c.name).join(", "));
+ const said = OWNER_WORDS.filter((w) => cards.some((c) => c.text.includes(w)));
+ check(said.length === 0, `${label}: no model line or owner words`, said.join(", "));
+ } else {
+ const bare = cards.filter((c) => c.noCover);
+ check(bare.every((c) => c.chip && !c.svg), `${label}: cards without a cover (${bare.length}) show "No cover yet" and no diagram`, bare.map((c) => `${c.name}${c.svg ? " svg" : ""}${c.chip ? "" : " no-chip"}`).join(", "));
+ }
+ if (device.viewport.width === 1440 && who === "guest") {
+ // A playing card never shows the clip before its peak window (the photo that went in).
+ const loc = p.locator("article").filter({ has: p.locator("video") });
+ const n = Math.min(await loc.count(), 7);
+ const early = [];
+ for (let i = 0; i < n; i++) {
+ const c = loc.nth(i);
+ await c.scrollIntoViewIfNeeded();
+ await c.hover();
+ const src = await c.locator("video").first().getAttribute("src");
+ const peak = peakAt.get((src ?? "").split("?")[0]);
+ let min = Infinity;
+ for (let k = 0; k < 14; k++) {
+ await p.waitForTimeout(300);
+ const t = await c.locator("video").first().evaluate((v) => (v.paused && v.currentTime === 0 ? null : v.currentTime));
+ if (t !== null) min = Math.min(min, t);
+ }
+ if (peak !== undefined && min < peak - 0.6 - 0.15) early.push(`${src} ${min.toFixed(2)} < ${peak}`);
+ await p.mouse.move(0, 0);
+ }
+ check(n > 0 && early.length === 0, `${label}: hovered clips play only around their peak, loops included`, early.join("; "));
+ if (shots) await shot(p, "canvas-1440-guest");
+ }
+ await ctx.close();
+ }
+ }
+} catch (e) {
+ check(false, "run", e.stack ?? String(e));
+} finally {
+ for (const { ctx, password } of accounts) await ctx.request.delete(`${app}/api/auth/me`, { data: { password } }).catch(() => {});
+ await browser.close();
+}
+console.log(failures.length ? `\n${failures.length} failed` : "\nall passed");
+process.exit(failures.length ? 1 : 0);
diff --git a/tests/e2e/nav-hubs.mjs b/tests/e2e/nav-hubs.mjs
index 285491ab..8e37a143 100644
--- a/tests/e2e/nav-hubs.mjs
+++ b/tests/e2e/nav-hubs.mjs
@@ -65,11 +65,15 @@ try {
await openRoute(p, `${app}/image`);
const items = [
{ name: "Create", href: "/create", chevron: "Create menu", seeAll: "See all of Create" },
- { name: /^Studios, \d+ studios$/, href: "/studios", chevron: "Studios menu", seeAll: "See all studios" },
- { name: "Motions & effects", href: "/motions-and-effects", chevron: "Motions & effects menu", seeAll: "See all motions & effects" },
+ { name: /^Studios, \d+ studios$/, href: "/studios", chevron: "Studios menu", seeAll: "See all studios", panel: "#studios-launcher", hover: true },
+ { name: "Apps", href: "/apps", chevron: "Apps menu", seeAll: "See all apps", panel: "#apps-launcher", hover: true },
+ { name: "Motions & effects", href: "/motions-and-effects", chevron: "Motions & effects menu", seeAll: "See all motions and effects", panel: "#motions-launcher", hover: true },
+ { name: "Canvas", href: "/canvas", chevron: "Canvas menu", seeAll: "See all of Canvas", panel: "#canvas-launcher", hover: true },
];
+ // The grouped menus (a panel under the bar) and Create (a menu).
const seeAllIn = (it) =>
- (it.href === "/studios" ? p.locator("#studios-launcher").getByRole("link", { name: it.seeAll, exact: true }) : p.getByRole("menu").getByRole("menuitem", { name: it.seeAll, exact: true }));
+ (it.panel ? p.locator(it.panel).getByRole("link", { name: it.seeAll, exact: true }) : p.getByRole("menu").getByRole("menuitem", { name: it.seeAll, exact: true }));
+ const anyPanel = () => p.locator("[data-mega-panel]:visible").count().then((n) => n > 0);
for (const it of items) {
await openRoute(p, `${app}/image`, { settleMs: 300 });
await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).click();
@@ -79,12 +83,12 @@ try {
const current = await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).getAttribute("aria-current");
const others = await bar(p).locator('[data-bar-split] a[aria-current="page"]').count();
check(current === "page" && others === 1, `${it.href}: its name is aria-current=page, and no other split item's`, `${current}, ${others}`);
- check((await p.getByRole("menu").count()) === 0 && !(await p.locator("#studios-launcher").isVisible().catch(() => false)), `${it.href}: following the name opens no menu`);
+ check((await p.getByRole("menu").count()) === 0 && !(await anyPanel()), `${it.href}: following the name opens no menu`);
}
// The chevron: click opens, Esc closes and gives focus back to it.
await openRoute(p, `${app}/image`, { settleMs: 300 });
- for (const name of ["Create menu", "Motions & effects menu"]) {
+ for (const name of ["Create menu"]) {
const chev = bar(p).getByRole("button", { name, exact: true });
await chev.click();
const menu = p.getByRole("menu");
@@ -95,15 +99,18 @@ try {
await menu.waitFor({ state: "detached" }).catch(() => {});
check(await chev.evaluate((b) => b === document.activeElement), `${name}: Esc closes it and focus goes back to the chevron`);
}
- {
- const chev = bar(p).getByRole("button", { name: "Studios menu", exact: true });
- const panel = p.locator("#studios-launcher");
+ for (const it of items.filter((x) => x.panel)) {
+ const chev = bar(p).getByRole("button", { name: it.chevron, exact: true });
+ const panel = p.locator(it.panel);
await chev.click();
await panel.waitFor({ state: "visible" });
- check(/^Cinema Studio/.test(await activeName(p)), "Studios menu: the chevron opens the launcher on Cinema Studio", await activeName(p));
+ await p.waitForFunction(() => document.activeElement?.closest("[data-mega-panel]"), null, { timeout: 5_000 }).catch(() => {});
+ const at = await p.evaluate(() => [document.activeElement?.getAttribute("data-col"), document.activeElement?.getAttribute("data-row")].join(","));
+ const first = it.href === "/studios" ? /^Cinema Studio/.test(await activeName(p)) : at === "0,0";
+ check(first && pathOf(p) === "/image", `${it.chevron}: the chevron opens the panel on its first lead card`, `${at} ${await activeName(p)}`);
await p.keyboard.press("Escape");
await panel.waitFor({ state: "hidden" });
- check(await chev.evaluate((b) => b === document.activeElement), "Studios menu: Esc closes it and focus goes back to the chevron");
+ check(await chev.evaluate((b) => b === document.activeElement), `${it.chevron}: Esc closes it and focus goes back to the chevron`);
}
// ArrowDown on a name opens its menu on the first row.
@@ -112,20 +119,21 @@ try {
await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).focus();
await p.keyboard.press("ArrowDown");
await p.waitForTimeout(250);
+ // A fetched menu's links may come a moment later: focus moves in once they are there.
+ if (it.panel) await p.waitForFunction(() => document.activeElement?.closest("[data-mega-panel]"), null, { timeout: 5_000 }).catch(() => {});
const role = await activeRole(p);
const name = await activeName(p);
- const ok = it.href === "/studios" ? /^Cinema Studio/.test(name) : role === "menuitem";
+ const at = await p.evaluate(() => [document.activeElement?.getAttribute("data-col"), document.activeElement?.getAttribute("data-row")].join(","));
+ const ok = it.panel ? at === "0,0" : role === "menuitem";
check(ok && pathOf(p) === "/image", `${it.href}: ArrowDown on the name opens the menu on its first row`, `${role} ${name}`);
await p.keyboard.press("Escape");
- if (it.href !== "/studios") {
- await p.waitForTimeout(150);
- const back = await bar(p).getByRole("link", { name: it.name, exact: true }).evaluate((a) => a === document.activeElement);
- check(back, `${it.href}: Esc after ArrowDown on the name gives focus back to the name`);
- }
+ await p.waitForTimeout(150);
+ const back = await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).evaluate((a) => a === document.activeElement);
+ check(back, `${it.href}: Esc after ArrowDown on the name gives focus back to the name`);
}
- // A mouse resting on Create or Motions & effects opens its menu after a moment, leaves focus in the prompt being
- // typed, and leaving closes it. The Studios launcher (it spans the page) opens by a click or a key only.
+ // A mouse resting on any item with a menu opens it after a moment, leaves focus in the prompt being typed, and
+ // leaving closes it.
await openRoute(p, `${app}/image`, { settleMs: 300 });
const prompt = p.locator("main textarea").first();
for (const it of items) {
@@ -134,11 +142,11 @@ try {
const box = await label.boundingBox();
await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
await p.waitForTimeout(120);
- const early = it.href === "/studios" ? await p.locator("#studios-launcher").isVisible().catch(() => false) : (await p.getByRole("menu").count()) > 0;
+ const early = it.panel ? await anyPanel() : (await p.getByRole("menu").count()) > 0;
await p.waitForTimeout(450);
- const late = it.href === "/studios" ? await p.locator("#studios-launcher").isVisible().catch(() => false) : (await p.getByRole("menu").count()) > 0;
- if (it.href === "/studios") {
- check(!early && !late, "/studios: resting the mouse on Studios opens nothing (the launcher opens by a click or a key)", `${early} → ${late}`);
+ const late = it.panel ? await anyPanel() : (await p.getByRole("menu").count()) > 0;
+ if (it.panel && !it.hover) {
+ check(!early && !late, `${it.href}: resting the mouse on it opens nothing (its panel opens by a click or a key)`, `${early} → ${late}`);
} else {
check(!early && late, `${it.href}: resting the mouse on it opens its menu after a moment, not at once`, `${early} → ${late}`);
check((await seeAllIn(it).count()) === 1, `${it.href}: the menu has its See all`);
@@ -147,7 +155,10 @@ try {
check(kept, `${it.href}: resting on it leaves focus in the prompt`, await activeName(p));
await p.mouse.move(700, 800);
await p.waitForTimeout(600);
- const gone = it.href === "/studios" ? !(await p.locator("#studios-launcher").isVisible().catch(() => false)) : (await p.getByRole("menu").count()) === 0;
+ // Away from the item and its panel (a full-width panel reaches down the page): the bar's far left.
+ if (it.hover && it.panel) await p.mouse.move(6, 28);
+ await p.waitForTimeout(it.hover ? 400 : 0);
+ const gone = it.panel ? !(await anyPanel()) : (await p.getByRole("menu").count()) === 0;
check(gone, `${it.href}: moving the mouse away closes it`);
}
@@ -166,12 +177,12 @@ try {
}
// On an area's own page, resting on its name opens nothing over it.
- for (const it of items.filter((x) => x.href !== "/studios")) {
+ for (const it of items.filter((x) => !x.panel || x.hover)) {
await openRoute(p, app + it.href, { settleMs: 300 });
- const box = await bar(p).getByRole("link", { name: it.name, exact: true }).boundingBox();
+ const box = await bar(p).getByRole("link", { name: it.name, exact: typeof it.name === "string" }).boundingBox();
await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
await p.waitForTimeout(700);
- check((await p.getByRole("menu").count()) === 0, `${it.href}: resting on its own name there opens nothing`);
+ check((await p.getByRole("menu").count()) === 0 && !(await anyPanel()), `${it.href}: resting on its own name there opens nothing`);
await p.mouse.move(700, 800);
}
@@ -274,7 +285,8 @@ try {
if (tab === "Studios") {
const tiles = sheet.locator("ul").first().getByRole("link");
const seen = await tiles.evaluateAll((els) => els.map((el) => el.getBoundingClientRect()).map((r) => r.top >= 0 && r.bottom <= innerHeight));
- check(seen.length === 33 && seen.every(Boolean), "phone Studios sheet: all 33 tiles fit 390x844 with See all in the header", `${seen.filter(Boolean).length}/${seen.length}`);
+ // 33 studio tiles and the See all tile that ends the grid.
+ check(seen.length === 34 && seen.every(Boolean), "phone Studios sheet: all 33 tiles and See all fit 390x844", `${seen.filter(Boolean).length}/${seen.length}`);
check((await sheet.getByRole("button", { name: "Search everything" }).count()) === 1, "phone Studios sheet: Search everything is an icon button");
if (shots) await p.screenshot({ path: path.join(shots, "phone-studios-sheet-390.png") });
}
diff --git a/tests/e2e/nav.mjs b/tests/e2e/nav.mjs
index 55860fbc..9f376cd1 100644
--- a/tests/e2e/nav.mjs
+++ b/tests/e2e/nav.mjs
@@ -79,14 +79,19 @@ try {
order.push(f?.name ?? "");
if (i > 0 && !f?.ring) rings = false;
}
- // Create, Studios and Motions & effects are a link to their page, then their menu's chevron.
- const want = ["Skip to content", "Fuobe home", "Create", "Create menu", /^Studios, [0-9]+ studios$/, "Studios menu", "Apps", "Motions & effects", "Motions & effects menu", "Canvas", "Assist", "Library", /^Search/, "New creation"];
+ // Create, Studios, Apps, Motions & effects and Canvas are a link to their page, then their menu's chevron.
+ const want = ["Skip to content", "Fuobe home", "Create", "Create menu", /^Studios, [0-9]+ studios$/, "Studios menu", "Apps", "Apps menu", "Motions & effects", "Motions & effects menu", "Canvas", "Canvas menu", "Assist", "Library", /^Search/, "New creation"];
+ for (let i = order.length; i < want.length; i++) {
+ await p.keyboard.press("Tab");
+ order.push((await focused(p))?.name ?? "");
+ }
const ok = want.every((w, i) => (typeof w === "string" ? order[i] === w : w.test(order[i])));
- check(ok, "Tab order: Skip, wordmark, Create (+ menu), Studios (+ menu), Apps, Motions & effects (+ menu), Canvas, Assist, Library, Search, New creation", order.join(" › "));
+ check(ok, "Tab order: Skip, wordmark, Create, Studios, Apps, Motions & effects, Canvas (each + menu), Assist, Library, Search, New creation", order.join(" › "));
check(rings, "every bar stop shows a focus ring");
- // The search field is 280 px from 1440 (an lg rule must not win over it) and its name is the words it shows.
- const field = await p.locator('[data-top-bar] button[aria-keyshortcuts="/ Meta+K Control+K"]').evaluate((b) => ({ w: b.getBoundingClientRect().width, text: b.innerText.trim(), label: b.getAttribute("aria-label") }));
- check(field.w >= 270 && field.text.startsWith("Search studios, apps, effects…") && !field.label, "search field: 280 px at 1440, its name is its visible words", JSON.stringify(field));
+ // The search field is 220 px from 1440 (280 from 1600; an lg rule must not win over it), says "Search Fuobe" on one line
+ // until 1600, and its name is the words it shows.
+ const field = await p.locator('[data-top-bar] button[aria-keyshortcuts="/ Meta+K Control+K"]').evaluate((b) => ({ w: b.getBoundingClientRect().width, h: b.querySelector("span").getBoundingClientRect().height, text: b.innerText.trim(), label: b.getAttribute("aria-label") }));
+ check(field.w >= 215 && field.w <= 225 && field.text.startsWith("Search Fuobe") && field.h < 30 && !field.label, "search field: 220 px at 1440, one line, its name is its visible words", JSON.stringify(field));
// Hovering the bar loads no routes ahead; opening the launcher loads its own.
const reqs = [];
p.on("request", (r) => r.headers()["next-router-prefetch"] && reqs.push(r.url()));
@@ -115,6 +120,11 @@ try {
await p.keyboard.press("Enter");
await panel.waitFor({ state: "visible" });
check((await trigger.getAttribute("aria-expanded")) === "true", "launcher: Enter opens it (aria-expanded)");
+ // The panel's body is a chunk of its own: on a page this fresh it may still be on its way, and focus moves in when
+ // its links arrive (within a second; a warmed or idle page has it already).
+ const t0 = Date.now();
+ await p.waitForFunction(() => !!document.activeElement?.closest("#studios-launcher"), null, { timeout: 1000 }).catch(() => {});
+ check(Date.now() - t0 < 1000, "launcher: focus moves into it within a second of a cold open", `${Date.now() - t0} ms`);
const first = await focused(p);
check(/^Cinema Studio/.test(first?.name ?? ""), "launcher: focus starts on Cinema Studio", first?.name);
await p.keyboard.press("ArrowRight");
@@ -284,10 +294,11 @@ try {
await p.waitForTimeout(350);
const tiles = sheet.locator("ul").first().getByRole("link");
const seen = await inView(tiles);
- if (size.height >= 844) check(seen.length === 33 && seen.every(Boolean), `${label}: the Studios sheet shows all 33 without scrolling`, `${seen.filter(Boolean).length}/${seen.length}`);
- else check(seen.length === 33, `${label}: the Studios sheet lists all 33 (it scrolls inside at this height)`, String(seen.length));
+ // 33 tiles and the closing See all.
+ if (size.height >= 844) check(seen.length === 34 && seen.every(Boolean), `${label}: the Studios sheet shows all 33 and See all without scrolling`, `${seen.filter(Boolean).length}/${seen.length}`);
+ else check(seen.length === 34, `${label}: the Studios sheet lists all 33 and See all (it scrolls inside at this height)`, String(seen.length));
await sheet.getByRole("button", { name: /^Film/ }).tap();
- check((await sheet.locator("ul").first().getByRole("link").count()) === 8, `${label}: the Film chip shows 8`);
+ check((await sheet.locator("ul").first().getByRole("link").count()) === 9, `${label}: the Film chip shows 8 and See all`);
if (size.height >= 844) await shot(p, "phone-studios-sheet-film-390");
await tabs.locator('[data-tab="library"]').tap();
const went = await (p.waitForURL((u) => new URL(u).pathname === "/library", { timeout: 20_000 }).then(() => sheet.waitFor({ state: "detached", timeout: 5_000 }))).then(() => true, () => false);
diff --git a/tests/mega-menus.test.ts b/tests/mega-menus.test.ts
new file mode 100644
index 00000000..38c6eec5
--- /dev/null
+++ b/tests/mega-menus.test.ts
@@ -0,0 +1,212 @@
+import fs from "node:fs";
+import path from "node:path";
+import { gzipSync } from "node:zlib";
+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 } from "@/components/nav/mega-panel";
+import { CANVAS_INTRO } from "@/lib/canvas-template-cards";
+import { MENU_LINES } from "@/lib/menu-lines";
+import type { Preset } from "@/lib/catalog/types";
+import { launcherColumns } from "@/lib/nav-model";
+import { featuredAll } from "@/lib/preset-featured";
+import { PRESET_COVERS } from "@/lib/preset-covers.generated";
+import { templateCover } from "@/lib/template-covers";
+
+const PUBLIC = path.resolve(__dirname, "../public");
+const file = (url: string) => path.join(PUBLIC, url.split("?")[0]);
+
+function mapsOnce(items: readonly Preset[], groups: readonly PresetGroup[]) {
+ for (const cat of new Set(items.map(menuCategory))) {
+ expect(groups.filter((g) => g.categories.includes(cat)).map((g) => g.id), `category ${cat}`).toHaveLength(1);
+ }
+ // No group names a category the catalog doesn't have.
+ for (const g of groups) for (const cat of g.categories) expect(items.some((p) => menuCategory(p) === cat), `${g.id}: ${cat}`).toBe(true);
+}
+
+describe("the fetched menus' groups", () => {
+ it("map every catalog category to exactly one column", () => {
+ mapsOnce(APPS, APP_GROUPS);
+ mapsOnce(MOTIONS, MOTION_GROUPS);
+ mapsOnce(EFFECTS, EFFECT_GROUPS);
+ });
+
+ it("say the true counts", () => {
+ expect(appsMenu().count).toBe(APPS.length);
+ expect(appsMenu().countLine).toBe(`${APPS.length} apps, grouped by what they change`);
+ const m = motionsMenu();
+ expect(m.countLine).toBe(`${MOTIONS.length} camera motions and ${EFFECTS.length} effects, for any photo`);
+ expect(m.families?.map((f) => [f.href, f.count])).toEqual([
+ ["/motions", MOTIONS.length],
+ ["/effects", EFFECTS.length],
+ ]);
+ });
+
+ it("have six columns, motions left of effects", () => {
+ expect(appsMenu().columns).toHaveLength(6);
+ const m = motionsMenu();
+ expect(m.columns).toHaveLength(6);
+ expect(m.columns.map((c) => c.family)).toEqual(["motions", "motions", "motions", "effects", "effects", "effects"]);
+ });
+});
+
+describe.each([
+ ["apps", appsMenu, APPS],
+ ["motions", motionsMenu, [...MOTIONS, ...EFFECTS]],
+] as const)("the %s menu", (_id, build, items) => {
+ const menu = build();
+ // 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", () => {
+ for (const c of menu.columns) {
+ const ids = [c.lead!, ...c.rows].map((e) => e.id);
+ const order = ids.map((id) => rank.get(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);
+ }
+ });
+
+ 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("orders its columns by their strongest preset (within a family)", () => {
+ const families = [...new Set(menu.columns.map((c) => c.family ?? ""))];
+ for (const f of families) {
+ const firsts = menu.columns.filter((c) => (c.family ?? "") === f).map((c) => rank.get(c.lead!.id)!);
+ expect(firsts).toEqual([...firsts].sort((a, b) => a - b));
+ }
+ });
+
+ it("names each item once, with a cover at a versioned URL whose files exist, an href, and a plain line", () => {
+ const all = megaItems(menu);
+ 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);
+ 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).
+ expect(e.line!.length, `${e.id}: ${e.line}`).toBeLessThanOrEqual(LINE_MAX);
+ expect(e.line, e.id).not.toMatch(/…$/);
+ expect(items.some((p) => p.category === e.line), `${e.id} line is a category`).toBe(false);
+ }
+ });
+});
+
+describe("the Canvas menu", () => {
+ const menu = canvasMenu();
+ const boards = menu.columns.filter((c) => c.variant === "tiles").flatMap((c) => c.rows);
+
+ 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.
+ 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));
+ 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);
+ expect(menu.countLine).toBe(`${visible.length} ready boards that run as they are`);
+ for (const b of boards) {
+ 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", () => {
+ for (const b of boards) {
+ const t = CANVAS_TEMPLATES.find((x) => x.id === b.id)!;
+ expect(b.line!.length, `${b.id}: ${b.line}`).toBeLessThanOrEqual(LINE_MAX);
+ expect([MENU_LINES[b.id], shortLine(t.description)], b.id).toContain(b.line);
+ // No cut-off phrase ("You step", "You take the stage under"): a written line, or the whole first sentence.
+ if (!MENU_LINES[b.id]) expect(t.description.split(/\.\s/)[0].replace(/\.$/, ""), b.id).toBe(b.line);
+ }
+ });
+
+ it("starts with What's a canvas? on a board whose scene the tiles leave out, and ends with See all", () => {
+ expect(menu.columns[0].lead?.label).toBe("What's a canvas?");
+ expect(menu.columns[0].owner).toBe("canvas-start");
+ expect(menu.columns[0].lead?.cover?.poster).toBe(templateCover("canvas", CANVAS_INTRO)!.poster);
+ expect(boards.map((b) => b.id)).not.toContain(CANVAS_INTRO);
+ expect(menu.columns.at(-1)?.more).toEqual({ href: "/canvas?tab=templates", label: "See all ready boards" });
+ });
+
+ 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);
+ });
+});
+
+describe("the menus' size", () => {
+ it.each(Object.keys(SERVER_MENUS) as (keyof typeof SERVER_MENUS)[])("%s is at most 4 KB gzipped", (id) => {
+ const menu = SERVER_MENUS[id]();
+ const wire = JSON.stringify(packMenu(menu));
+ expect(gzipSync(wire).length).toBeLessThanOrEqual(4096);
+ // The browser gets back exactly the menu the server built.
+ expect(unpackMenu(JSON.parse(wire))).toEqual(menu);
+ });
+});
+
+describe("Studios as a menu", () => {
+ it("is the launcher's columns as they were", () => {
+ for (const kind of [undefined, "guest", "account", "owner"] as const) {
+ const m: MegaModel = studiosMenu(kind);
+ expect(m.columns.map((c) => [c.id, c.lead?.id, ...c.rows.map((r) => r.id)])).toEqual(launcherColumns(kind).map((c) => [c.group.id, c.lead.id, ...c.rest.map((e) => e.id)]));
+ }
+ });
+});
+
+describe("a preset's line", () => {
+ it("is its menu line, else Home's caption or the description made short, never ending on a loose word", () => {
+ expect(presetLine({ id: "motion-dolly-in", description: "x" })).toBe("A slow push in toward them");
+ expect(presetLine({ id: "x", description: "A fast, punchy move. More here." })).toBe("A fast, punchy move");
+ expect(shortLine("The camera slowly and steadily zooms in on the subject, building tension")).toBe("Slowly and steadily zooms");
+ expect(shortLine("Tap a piece, pick a colour; the fabric stays")).toBe("Tap a piece, pick a colour");
+ });
+});
+
+describe("the menus' groups by what an app takes", () => {
+ it("put an app that takes no photo (a voice, a video) with the video apps", () => {
+ const voice = { type: "app", category: "Utility", inputs: [{ accept: "audio" }] } as unknown as Preset;
+ const photo = { type: "app", category: "Utility", inputs: [{ accept: "image" }] } as unknown as Preset;
+ expect(menuCategory(voice)).toBe("Video");
+ expect(menuCategory(photo)).toBe("Utility");
+ const restyle = appsMenu().columns.find((c) => c.id === "restyle")!;
+ expect([restyle.lead!, ...restyle.rows].map((e) => e.id)).not.toContain("app-clean-up-voice");
+ });
+});
+
+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).
+ const lengths = [7, 7, 7, 7, 7, 7];
+ expect(megaMove(lengths, { col: 2, row: 6 }, "ArrowRight")).toEqual({ col: 3, row: 6 });
+ expect(megaMove(lengths, { col: 0, row: 6 }, "ArrowDown")).toBeNull();
+ // Canvas: a 2-track start column (one link), then four tile columns of two rows.
+ expect(megaMove([1, 2, 2, 2, 2], { col: 0, row: 0 }, "ArrowRight")).toEqual({ col: 1, row: 0 });
+ expect(megaMove([1, 2, 2, 2, 2], { col: 1, row: 1 }, "ArrowLeft")).toEqual({ col: 0, row: 0 });
+ expect(megaMove([1, 2, 2, 2, 2], { col: 4, row: 0 }, "End")).toEqual({ col: 4, row: 1 });
+ });
+});
diff --git a/tests/nav-bar.test.ts b/tests/nav-bar.test.ts
index b5981354..bfa01bba 100644
--- a/tests/nav-bar.test.ts
+++ b/tests/nav-bar.test.ts
@@ -32,7 +32,8 @@ vi.mock("@/lib/api", async (load) => ({
}));
const { TopBar, barActive, prefetchHrefs } = await import("@/components/nav/top-bar");
-const { LauncherColumns, launcherCurrent, launcherMove, LAUNCHER_ID } = await import("@/components/nav/studios-launcher");
+const { launcherCurrent, launcherMove, LAUNCHER_ID } = await import("@/components/nav/mega-launcher");
+const { LauncherColumns } = await import("@/components/nav/mega-panel");
const { CREATE_HREFS, createColumns } = await import("@/components/nav/create-menu");
const { AccountSections } = await import("@/components/nav/account-menu");
const { avatarDot, refillWords } = await import("@/components/nav/status-chips");
@@ -162,12 +163,14 @@ describe("the launcher's columns", () => {
for (const e of [c.lead, ...c.rest]) {
const cover = covers[e.cover!];
expect(cover, e.id).toBeDefined();
- expect(html).toContain(`src="${cover.thumb.replaceAll("&", "&amp;")}"`);
+ // 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("&", "&amp;")}"`);
}
// The lead's 4:3 card picks the poster on sharp screens.
expect(html).toContain(`${covers[c.lead.cover!].poster} 512w`);
}
- expect(count(html, 'loading="eager"')).toBe(33);
+ // The six lead cards load as the panel warms; a row's picture when the row shows (lazy).
+ expect(count(html, 'loading="eager"')).toBe(6);
expect(count(html, 'alt=""')).toBe(33);
});
@@ -369,14 +372,14 @@ describe("split items: the name goes to the area page, the chevron opens the men
/** The opening tag of the link to `href` in the bar's markup. */
const linkTo = (html: string, href: string) => anchors(html).find((a) => a.href === href)?.tag ?? "";
- it("gives Create, Studios and Motions & effects a link to their page and a named chevron, in one pill", () => {
+ it("gives Create, Studios, Apps, Motions & effects and Canvas a link to their page and a named chevron, in one pill", () => {
const html = render(createElement(TopBar));
- for (const href of ["/create", "/studios", "/motions-and-effects"]) expect(linkTo(html, href), href).not.toBe("");
+ for (const href of ["/create", "/studios", "/apps", "/motions-and-effects", "/canvas"]) expect(linkTo(html, href), href).not.toBe("");
expect(linkTo(html, "/studios")).toContain(`aria-label="Studios, ${studioCount()} studios"`);
- for (const name of ["Create menu", "Studios menu", "Motions &amp; effects menu"]) expect(html, name).toContain(`aria-label="${name}"`);
+ for (const name of ["Create menu", "Studios menu", "Apps menu", "Motions &amp; effects menu", "Canvas menu"]) expect(html, name).toContain(`aria-label="${name}"`);
// The Studios chevron is still the launcher's disclosure button (search hands focus back to it).
expect(html).toMatch(/<button[^>]*aria-label="Studios menu"[^>]*aria-expanded="false"[^>]*data-studios-trigger/);
- expect(count(html, "data-bar-split")).toBe(3);
+ expect(count(html, "data-bar-split")).toBe(5);
});
it("marks the name on its own page and the pill inside its area, never both items", () => {
@@ -395,7 +398,7 @@ describe("split items: the name goes to the area page, the chevron opens the men
});
it("links the launcher's header to every studio with previews", async () => {
- const { LauncherPanel } = await import("@/components/nav/studios-launcher");
+ const { LauncherPanel } = await import("@/components/nav/mega-panel");
const html = render(createElement(LauncherPanel, { onClose: () => {}, onSearch: () => {} }));
expect(linkTo(html, "/studios")).not.toBe("");
expect(words(html)).toContain("See all");
diff --git a/tests/nav-states.test.ts b/tests/nav-states.test.ts
index 6145dcd5..468af42d 100644
--- a/tests/nav-states.test.ts
+++ b/tests/nav-states.test.ts
@@ -34,7 +34,7 @@ vi.mock("@/lib/api", async (load) => ({
const { modalityForKey, modalityForPointer } = await import("@/components/nav/input-modality");
const { columnMove, CreateList } = await import("@/components/nav/create-menu");
-const { LauncherColumns } = await import("@/components/nav/studios-launcher");
+const { LauncherColumns } = await import("@/components/nav/mega-panel");
const { AccountSections } = await import("@/components/nav/account-menu");
const { NavUiProvider } = await import("@/components/nav/nav-ui");
const { navCovers } = await import("@/lib/nav-covers");
diff --git a/tests/phone-nav.test.ts b/tests/phone-nav.test.ts
index 332c2ada..6a396faa 100644
--- a/tests/phone-nav.test.ts
+++ b/tests/phone-nav.test.ts
@@ -186,7 +186,8 @@ describe("the tab bar", () => {
describe("the Studios sheet", () => {
const sheet = (props: { group?: (typeof LAUNCHER_GROUPS)[number]["id"] } = {}) => createElement(StudiosSheet, { ...props, onSearch: () => {} });
- const tiles = (html: string) => hrefs(html).filter((h) => h !== "/" && h !== "/library");
+ // The grid ends on a See all tile (/studios): the family's whole set.
+ const tiles = (html: string) => hrefs(html).filter((h) => h !== "/" && h !== "/library" && h !== "/studios");
it("shows every studio, Apps and the Sound modes (33 tiles, 28 studios), in launcher order, each with a real cover", () => {
const html = at("/", () => sheet());
@@ -197,7 +198,8 @@ describe("the Studios sheet", () => {
for (const e of all) {
expect(e.cover, e.id).toBeTruthy();
expect(covers[e.cover!], e.id).toBeTruthy();
- expect(html, e.id).toContain(`src="${covers[e.cover!].thumb}"`);
+ // A tile shows the 96 px copy.
+ expect(html, e.id).toContain(`src="${covers[e.cover!].mini ?? covers[e.cover!].thumb}"`);
}
});
diff --git a/tests/preset-covers.test.ts b/tests/preset-covers.test.ts
index 4f68ae53..2a4fb1f1 100644
--- a/tests/preset-covers.test.ts
+++ b/tests/preset-covers.test.ts
@@ -9,6 +9,9 @@ import { previewFor, toPresetCard } from "@/lib/preset-card-data";
import { isCover, onPeak, presetCard } from "@/lib/preset-cards";
import { coverPreview, presetCover, thumbOf } from "@/lib/preset-covers";
import { HOME_BENTO_MEDIA } from "@/lib/home-bento.generated";
+import { hasMini, miniOf } from "@/lib/preset-cards";
+import { PRESET_MINIS } from "@/lib/preset-minis.generated";
+import { contentVersion } from "../scripts/eval/lib/covers.mjs";
import { PRESET_BEFORE_AFTER } from "@/lib/preset-before-after.generated";
import { PRESET_COVERS } from "@/lib/preset-covers.generated";
import { PRESET_HD } from "@/lib/preset-hd.generated";
@@ -84,8 +87,22 @@ describe("the preset covers manifest", () => {
for (const [id, v] of Object.entries(PRESET_BEFORE_AFTER)) expect(v, id).toBe(versionOf(...beforeAfterFiles(id).map(fileOf)));
});
+ it("has a mini copy (the menus' rows) of every preset's own poster, made from that poster as it is now", () => {
+ const own = entries.filter(([, e]) => hasMini(e.poster));
+ for (const [id, e] of own) {
+ const poster = path.join(root, "public", e.poster.split("?")[0]);
+ expect(fs.existsSync(path.join(root, "public", miniOf(e.poster).split("?")[0])), id).toBe(true);
+ // Made again when the poster changes (pnpm eval:covers): an old mini would show under the new version for a year.
+ expect(PRESET_MINIS[id], id).toBe(contentVersion([poster]));
+ }
+ expect(Object.keys(PRESET_MINIS).sort()).toEqual(own.map(([id]) => id).sort());
+ });
+
it("leaves no cover file in public/previews that no entry names (with its poster's small copy for the pickers, and its clip's peak frame and its small copy and its HD before/after for Home)", () => {
- const named = new Set(entries.flatMap(([, e]) => [e.poster, thumbOf(e.poster), e.video].filter((u): u is string => !!u).map((u) => u.split("?")[0])));
+ // A preset's own poster also has its 96 px copy for the menus' rows (mini/).
+ const named = new Set(
+ entries.flatMap(([, e]) => [e.poster, thumbOf(e.poster), hasMini(e.poster) ? miniOf(e.poster) : undefined, e.video].filter((u): u is string => !!u).map((u) => u.split("?")[0])),
+ );
for (const id of Object.keys(PRESET_PEAKS)) for (const f of [`/previews/presets/peak/${id}.jpg`, thumbOf(`/previews/presets/peak/${id}.jpg`)]) named.add(f);
for (const id of Object.keys(PRESET_BEFORE_AFTER)) for (const f of beforeAfterFiles(id)) named.add(f);
// The larger copies (scripts/gen-preset-hd.mjs, tests/preset-hd.test.ts).
@@ -190,10 +207,15 @@ describe("the preset covers manifest", () => {
"components/preset-header.tsx",
"components/studio/preset-chips.tsx",
"lib/canvas-template-cards.ts",
+ "lib/home-bento.ts",
+ "lib/mega-menus.server.ts",
"lib/nav-covers.ts",
"lib/palette-index.ts",
+ "lib/starters/catalog.ts",
]);
expect(fs.readFileSync(path.join(root, "src", "lib", "nav-covers.ts"), "utf8")).toMatch(/^import "server-only";$/m);
+ // The bar's fetched menus are built on the server and served as static files (/nav-menus/<id>).
+ expect(fs.readFileSync(path.join(root, "src", "lib", "mega-menus.server.ts"), "utf8")).toMatch(/^import "server-only";$/m);
// Client code takes the covers' type only (the covers come as props).
for (const f of importers(/^import (?!type )[^;]*from "[^"]*nav-covers";/m)) expect(sources.find((s) => s.file === f)!.text, f).not.toMatch(/^["']use client["'];?$/m);
// The index is server code: the prerendered route, and Home's showcase (server-only) for model links.
diff --git a/tests/tab-rows.test.ts b/tests/tab-rows.test.ts
index c8cb0a58..ec912566 100644
--- a/tests/tab-rows.test.ts
+++ b/tests/tab-rows.test.ts
@@ -44,7 +44,9 @@ const ROWS: [file: string, label: string][] = [
["src/components/ads/ad-editor.tsx", 'aria-label="Format"'],
["src/components/studio/media-slot.tsx", 'aria-label="Kind"'],
["src/components/genjutsu/look-picker.tsx", 'aria-label="Where the look comes from"'],
- ["src/components/nav/studios-sheet.tsx", 'aria-label="Show the studios for one goal"'],
+ // The sheet's group chips (the label names the family shown) and its family switch.
+ ["src/components/nav/studios-sheet.tsx", '"Show the studios for one goal"'],
+ ["src/components/nav/studios-sheet.tsx", 'aria-label="What to show"'],
["src/components/nav/search-palette.tsx", 'aria-label="Show the studios for one goal"'],
];
diff --git a/tests/template-covers.test.ts b/tests/template-covers.test.ts
index 80600820..3e8bfb05 100644
--- a/tests/template-covers.test.ts
+++ b/tests/template-covers.test.ts
@@ -262,3 +262,28 @@ describe.skipIf(!hasFfmpeg)("pnpm eval:covers --templates", () => {
expect(templateCover("examples", "storyboard-heist", { "examples/storyboard-heist": gen.slimEntry("examples/storyboard-heist", board) } as never)?.frames).toHaveLength(6);
});
});
+
+describe("a template cover that rests on its peak", () => {
+ it("plays only the finished scene around it: a hover and every loop start just before the peak, never at the clip's start", async () => {
+ const { PEAK_WINDOW, templatePreview } = await import("@/lib/template-covers");
+ const cover = (k: string) => templateCover(k.split("/")[0] as TemplateGroup, k.split("/")[1]);
+ const rests = Object.keys(TEMPLATE_COVERS).filter((k) => cover(k)?.at !== undefined);
+ const withPeak = rests.filter((k) => cover(k)!.poster.startsWith("/previews/presets/peak/"));
+ expect(withPeak.length).toBeGreaterThan(0);
+ // Every Canvas ready board's cover is an effect's peak.
+ expect(rests.filter((k) => k.startsWith("canvas/")).every((k) => withPeak.includes(k))).toBe(true);
+ // A reveal (its poster is the clip's last frame) still plays from the start up to it.
+ for (const key of rests.filter((k) => !withPeak.includes(k))) expect(templatePreview(cover(key)!).rest, key).toEqual({ src: cover(key)!.poster, at: cover(key)!.at, from: 0 });
+ for (const key of withPeak) {
+ const [group, id] = key.split("/") as [TemplateGroup, string];
+ const c = templateCover(group, id)!;
+ const rest = templatePreview(c).rest!;
+ expect(rest.at, key).toBe(c.at);
+ expect(rest.from, key).toBeCloseTo(Math.max(0, c.at! - PEAK_WINDOW.before), 3);
+ expect(rest.from, key).toBeGreaterThan(0);
+ expect(rest.until, key).toBeCloseTo(c.at! + PEAK_WINDOW.after, 3);
+ // Each canvas clip is 4 s long and its peak is within it.
+ if (group === "canvas") expect(c.at!, key).toBeLessThan(4);
+ }
+ });
+});