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.

Galleries: slim preset cards, procedural previews, filters and paging

Claudee71e8c41797c
diff --git a/public/samples/previews/city-bg.svg b/public/samples/previews/city-bg.svg
new file mode 100644
index 00000000..11ffcd90
--- /dev/null
+++ b/public/samples/previews/city-bg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ct-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0b0f2e"/><stop offset=".55" stop-color="#2c2163"/><stop offset="1" stop-color="#7a3478"/></linearGradient><radialGradient id="ct-glow"><stop offset="0" stop-color="#ff5b6e" stop-opacity=".9"/><stop offset="1" stop-color="#ff5b6e" stop-opacity="0"/></radialGradient><radialGradient id="ct-lamp"><stop offset="0" stop-color="#ffe7a8" stop-opacity=".9"/><stop offset="1" stop-color="#ffe7a8" stop-opacity="0"/></radialGradient><linearGradient id="ct-road" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a2150"/><stop offset="1" stop-color="#120e26"/></linearGradient></defs><rect width="400" height="300" fill="url(#ct-sky)"/><circle cx="318" cy="52" r="15" fill="#f4ecff" opacity=".9"/><g fill="#fff" opacity=".6"><circle cx="40" cy="24" r=".9"/><circle cx="120" cy="40" r=".7"/><circle cx="200" cy="18" r="1"/><circle cx="262" cy="34" r=".7"/><circle cx="372" cy="90" r=".8"/></g><path d="M0 196 V150 H22 V132 H40 V158 H58 V120 H76 V164 H96 V140 H118 V170 H140 V128 H156 V112 H172 V150 H190 V170 H214 V136 H232 V160 H252 V118 H270 V150 H290 V128 H312 V164 H332 V142 H352 V120 H370 V158 H400 V196Z" fill="#1d1846"/><g fill="#ffd27a" opacity=".55"><rect x="62" y="128" width="3" height="3"/><rect x="68" y="140" width="3" height="3"/><rect x="160" y="120" width="3" height="3"/><rect x="164" y="134" width="3" height="3"/><rect x="256" y="126" width="3" height="3"/><rect x="262" y="140" width="3" height="3"/><rect x="356" y="128" width="3" height="3"/><rect x="25" y="140" width="3" height="3"/><rect x="296" y="136" width="3" height="3"/></g></svg>
diff --git a/public/samples/previews/city-fg.svg b/public/samples/previews/city-fg.svg
new file mode 100644
index 00000000..24cd7674
--- /dev/null
+++ b/public/samples/previews/city-fg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ct-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0b0f2e"/><stop offset=".55" stop-color="#2c2163"/><stop offset="1" stop-color="#7a3478"/></linearGradient><radialGradient id="ct-glow"><stop offset="0" stop-color="#ff5b6e" stop-opacity=".9"/><stop offset="1" stop-color="#ff5b6e" stop-opacity="0"/></radialGradient><radialGradient id="ct-lamp"><stop offset="0" stop-color="#ffe7a8" stop-opacity=".9"/><stop offset="1" stop-color="#ffe7a8" stop-opacity="0"/></radialGradient><linearGradient id="ct-road" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a2150"/><stop offset="1" stop-color="#120e26"/></linearGradient></defs><path d="M18 300 V128 Q18 116 30 116 H50" fill="none" stroke="#0d0a20" stroke-width="5"/><circle cx="52" cy="120" r="22" fill="url(#ct-lamp)"/><path d="M382 300 V136 Q382 124 370 124 H352" fill="none" stroke="#0d0a20" stroke-width="5"/><circle cx="350" cy="128" r="20" fill="url(#ct-lamp)"/><g opacity=".5"><path d="M110 296 h40" stroke="#ff4fa3" stroke-width="2"/><path d="M252 292 h44" stroke="#3de0ff" stroke-width="2"/></g></svg>
diff --git a/public/samples/previews/city-mid.svg b/public/samples/previews/city-mid.svg
new file mode 100644
index 00000000..fe790a92
--- /dev/null
+++ b/public/samples/previews/city-mid.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ct-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0b0f2e"/><stop offset=".55" stop-color="#2c2163"/><stop offset="1" stop-color="#7a3478"/></linearGradient><radialGradient id="ct-glow"><stop offset="0" stop-color="#ff5b6e" stop-opacity=".9"/><stop offset="1" stop-color="#ff5b6e" stop-opacity="0"/></radialGradient><radialGradient id="ct-lamp"><stop offset="0" stop-color="#ffe7a8" stop-opacity=".9"/><stop offset="1" stop-color="#ffe7a8" stop-opacity="0"/></radialGradient><linearGradient id="ct-road" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a2150"/><stop offset="1" stop-color="#120e26"/></linearGradient></defs><path d="M0 300 V96 H44 V82 H70 V300Z" fill="#15112f"/><path d="M330 300 V90 H356 V74 H400 V300Z" fill="#15112f"/><g opacity=".9"><rect x="12" y="110" width="40" height="10" rx="2" fill="#ff4fa3"/><rect x="340" y="104" width="44" height="9" rx="2" fill="#3de0ff"/><rect x="18" y="150" width="6" height="40" rx="2" fill="#3de0ff"/><rect x="372" y="140" width="6" height="34" rx="2" fill="#ff4fa3"/></g><g fill="#ffd27a" opacity=".45"><rect x="10" y="200" width="6" height="6"/><rect x="30" y="220" width="6" height="6"/><rect x="50" y="200" width="6" height="6"/><rect x="346" y="196" width="6" height="6"/><rect x="368" y="220" width="6" height="6"/></g><path d="M70 300 L188 196 H212 L330 300Z" fill="url(#ct-road)"/><g fill="#f4ecff" opacity=".55"><path d="M198 204 h4 l1 10 h-6z"/><path d="M196 226 h8 l2 16 h-12z"/><path d="M193 258 h14 l3 26 h-20z"/></g></svg>
diff --git a/public/samples/previews/city-subject.svg b/public/samples/previews/city-subject.svg
new file mode 100644
index 00000000..491ae933
--- /dev/null
+++ b/public/samples/previews/city-subject.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ct-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0b0f2e"/><stop offset=".55" stop-color="#2c2163"/><stop offset="1" stop-color="#7a3478"/></linearGradient><radialGradient id="ct-glow"><stop offset="0" stop-color="#ff5b6e" stop-opacity=".9"/><stop offset="1" stop-color="#ff5b6e" stop-opacity="0"/></radialGradient><radialGradient id="ct-lamp"><stop offset="0" stop-color="#ffe7a8" stop-opacity=".9"/><stop offset="1" stop-color="#ffe7a8" stop-opacity="0"/></radialGradient><linearGradient id="ct-road" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a2150"/><stop offset="1" stop-color="#120e26"/></linearGradient></defs><g transform="translate(200 236)"><ellipse cx="0" cy="22" rx="46" ry="6" fill="#000" opacity=".35"/><path d="M-40 18 Q-42 -2 -30 -8 L-22 -26 Q-18 -32 -10 -32 H10 Q18 -32 22 -26 L30 -8 Q42 -2 40 18Z" fill="#d8344f"/><path d="M-19 -24 Q-16 -28 -10 -28 H10 Q16 -28 19 -24 L24 -10 H-24Z" fill="#2a2150"/><rect x="-36" y="-2" width="14" height="6" rx="2" fill="#ff3049"/><rect x="22" y="-2" width="14" height="6" rx="2" fill="#ff3049"/><rect x="-12" y="4" width="24" height="7" rx="1.5" fill="#f4ecff" opacity=".85"/><rect x="-38" y="14" width="12" height="10" rx="2" fill="#16122c"/><rect x="26" y="14" width="12" height="10" rx="2" fill="#16122c"/><circle cx="-29" cy="1" r="16" fill="url(#ct-glow)"/><circle cx="29" cy="1" r="16" fill="url(#ct-glow)"/></g></svg>
diff --git a/public/samples/previews/city.svg b/public/samples/previews/city.svg
new file mode 100644
index 00000000..5fdef763
--- /dev/null
+++ b/public/samples/previews/city.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ct-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0b0f2e"/><stop offset=".55" stop-color="#2c2163"/><stop offset="1" stop-color="#7a3478"/></linearGradient><radialGradient id="ct-glow"><stop offset="0" stop-color="#ff5b6e" stop-opacity=".9"/><stop offset="1" stop-color="#ff5b6e" stop-opacity="0"/></radialGradient><radialGradient id="ct-lamp"><stop offset="0" stop-color="#ffe7a8" stop-opacity=".9"/><stop offset="1" stop-color="#ffe7a8" stop-opacity="0"/></radialGradient><linearGradient id="ct-road" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a2150"/><stop offset="1" stop-color="#120e26"/></linearGradient></defs><rect width="400" height="300" fill="url(#ct-sky)"/><circle cx="318" cy="52" r="15" fill="#f4ecff" opacity=".9"/><g fill="#fff" opacity=".6"><circle cx="40" cy="24" r=".9"/><circle cx="120" cy="40" r=".7"/><circle cx="200" cy="18" r="1"/><circle cx="262" cy="34" r=".7"/><circle cx="372" cy="90" r=".8"/></g><path d="M0 196 V150 H22 V132 H40 V158 H58 V120 H76 V164 H96 V140 H118 V170 H140 V128 H156 V112 H172 V150 H190 V170 H214 V136 H232 V160 H252 V118 H270 V150 H290 V128 H312 V164 H332 V142 H352 V120 H370 V158 H400 V196Z" fill="#1d1846"/><g fill="#ffd27a" opacity=".55"><rect x="62" y="128" width="3" height="3"/><rect x="68" y="140" width="3" height="3"/><rect x="160" y="120" width="3" height="3"/><rect x="164" y="134" width="3" height="3"/><rect x="256" y="126" width="3" height="3"/><rect x="262" y="140" width="3" height="3"/><rect x="356" y="128" width="3" height="3"/><rect x="25" y="140" width="3" height="3"/><rect x="296" y="136" width="3" height="3"/></g><path d="M0 300 V96 H44 V82 H70 V300Z" fill="#15112f"/><path d="M330 300 V90 H356 V74 H400 V300Z" fill="#15112f"/><g opacity=".9"><rect x="12" y="110" width="40" height="10" rx="2" fill="#ff4fa3"/><rect x="340" y="104" width="44" height="9" rx="2" fill="#3de0ff"/><rect x="18" y="150" width="6" height="40" rx="2" fill="#3de0ff"/><rect x="372" y="140" width="6" height="34" rx="2" fill="#ff4fa3"/></g><g fill="#ffd27a" opacity=".45"><rect x="10" y="200" width="6" height="6"/><rect x="30" y="220" width="6" height="6"/><rect x="50" y="200" width="6" height="6"/><rect x="346" y="196" width="6" height="6"/><rect x="368" y="220" width="6" height="6"/></g><path d="M70 300 L188 196 H212 L330 300Z" fill="url(#ct-road)"/><g fill="#f4ecff" opacity=".55"><path d="M198 204 h4 l1 10 h-6z"/><path d="M196 226 h8 l2 16 h-12z"/><path d="M193 258 h14 l3 26 h-20z"/></g><g transform="translate(200 236)"><ellipse cx="0" cy="22" rx="46" ry="6" fill="#000" opacity=".35"/><path d="M-40 18 Q-42 -2 -30 -8 L-22 -26 Q-18 -32 -10 -32 H10 Q18 -32 22 -26 L30 -8 Q42 -2 40 18Z" fill="#d8344f"/><path d="M-19 -24 Q-16 -28 -10 -28 H10 Q16 -28 19 -24 L24 -10 H-24Z" fill="#2a2150"/><rect x="-36" y="-2" width="14" height="6" rx="2" fill="#ff3049"/><rect x="22" y="-2" width="14" height="6" rx="2" fill="#ff3049"/><rect x="-12" y="4" width="24" height="7" rx="1.5" fill="#f4ecff" opacity=".85"/><rect x="-38" y="14" width="12" height="10" rx="2" fill="#16122c"/><rect x="26" y="14" width="12" height="10" rx="2" fill="#16122c"/><circle cx="-29" cy="1" r="16" fill="url(#ct-glow)"/><circle cx="29" cy="1" r="16" fill="url(#ct-glow)"/></g><path d="M18 300 V128 Q18 116 30 116 H50" fill="none" stroke="#0d0a20" stroke-width="5"/><circle cx="52" cy="120" r="22" fill="url(#ct-lamp)"/><path d="M382 300 V136 Q382 124 370 124 H352" fill="none" stroke="#0d0a20" stroke-width="5"/><circle cx="350" cy="128" r="20" fill="url(#ct-lamp)"/><g opacity=".5"><path d="M110 296 h40" stroke="#ff4fa3" stroke-width="2"/><path d="M252 292 h44" stroke="#3de0ff" stroke-width="2"/></g></svg>
diff --git a/public/samples/previews/landscape-bg.svg b/public/samples/previews/landscape-bg.svg
new file mode 100644
index 00000000..e60c3243
--- /dev/null
+++ b/public/samples/previews/landscape-bg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ls-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#262a66"/><stop offset=".42" stop-color="#7c5aa8"/><stop offset=".72" stop-color="#ee9486"/><stop offset="1" stop-color="#ffd59f"/></linearGradient><radialGradient id="ls-sun"><stop offset="0" stop-color="#fff7da"/><stop offset=".3" stop-color="#ffe3a6" stop-opacity=".9"/><stop offset="1" stop-color="#ffc98a" stop-opacity="0"/></radialGradient><linearGradient id="ls-far" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a684bf"/><stop offset="1" stop-color="#c799b4"/></linearGradient><linearGradient id="ls-near" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5d4c8c"/><stop offset="1" stop-color="#46396f"/></linearGradient><linearGradient id="ls-hill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a3164"/><stop offset="1" stop-color="#262043"/></linearGradient></defs><rect width="400" height="300" fill="url(#ls-sky)"/><circle cx="252" cy="176" r="78" fill="url(#ls-sun)"/><circle cx="252" cy="176" r="19" fill="#fff5da"/><g fill="#fff" opacity=".16"><ellipse cx="86" cy="62" rx="54" ry="9"/><ellipse cx="120" cy="54" rx="30" ry="8"/><ellipse cx="318" cy="88" rx="46" ry="7"/><ellipse cx="292" cy="82" rx="24" ry="6"/></g><g fill="#fff" opacity=".7"><circle cx="40" cy="30" r=".9"/><circle cx="160" cy="18" r=".8"/><circle cx="350" cy="26" r="1"/><circle cx="212" cy="40" r=".7"/></g></svg>
diff --git a/public/samples/previews/landscape-fg.svg b/public/samples/previews/landscape-fg.svg
new file mode 100644
index 00000000..4593581e
--- /dev/null
+++ b/public/samples/previews/landscape-fg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ls-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#262a66"/><stop offset=".42" stop-color="#7c5aa8"/><stop offset=".72" stop-color="#ee9486"/><stop offset="1" stop-color="#ffd59f"/></linearGradient><radialGradient id="ls-sun"><stop offset="0" stop-color="#fff7da"/><stop offset=".3" stop-color="#ffe3a6" stop-opacity=".9"/><stop offset="1" stop-color="#ffc98a" stop-opacity="0"/></radialGradient><linearGradient id="ls-far" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a684bf"/><stop offset="1" stop-color="#c799b4"/></linearGradient><linearGradient id="ls-near" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5d4c8c"/><stop offset="1" stop-color="#46396f"/></linearGradient><linearGradient id="ls-hill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a3164"/><stop offset="1" stop-color="#262043"/></linearGradient></defs><path d="M0 300 V258 Q18 246 34 258 Q52 252 70 264 Q92 270 112 286 L126 300Z" fill="#171329"/><path d="M400 300 V250 Q382 242 366 256 Q346 252 330 268 Q312 280 304 300Z" fill="#171329"/><g stroke="#171329" stroke-width="2.2" stroke-linecap="round" fill="none"><path d="M18 258 Q14 236 6 222"/><path d="M28 256 Q30 232 24 214"/><path d="M42 262 Q48 244 46 230"/><path d="M372 254 Q376 232 386 220"/><path d="M360 258 Q356 238 362 224"/><path d="M386 250 Q394 236 398 226"/></g></svg>
diff --git a/public/samples/previews/landscape-mid.svg b/public/samples/previews/landscape-mid.svg
new file mode 100644
index 00000000..a06c634d
--- /dev/null
+++ b/public/samples/previews/landscape-mid.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ls-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#262a66"/><stop offset=".42" stop-color="#7c5aa8"/><stop offset=".72" stop-color="#ee9486"/><stop offset="1" stop-color="#ffd59f"/></linearGradient><radialGradient id="ls-sun"><stop offset="0" stop-color="#fff7da"/><stop offset=".3" stop-color="#ffe3a6" stop-opacity=".9"/><stop offset="1" stop-color="#ffc98a" stop-opacity="0"/></radialGradient><linearGradient id="ls-far" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a684bf"/><stop offset="1" stop-color="#c799b4"/></linearGradient><linearGradient id="ls-near" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5d4c8c"/><stop offset="1" stop-color="#46396f"/></linearGradient><linearGradient id="ls-hill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a3164"/><stop offset="1" stop-color="#262043"/></linearGradient></defs><path d="M0 186 L38 164 L76 176 L126 136 L172 170 L214 148 L258 175 L302 142 L344 168 L400 148 V300 H0Z" fill="url(#ls-far)" opacity=".9"/><path d="M0 214 L52 188 L104 205 L158 180 L216 208 L276 186 L330 204 L400 182 V300 H0Z" fill="url(#ls-near)"/></svg>
diff --git a/public/samples/previews/landscape-subject.svg b/public/samples/previews/landscape-subject.svg
new file mode 100644
index 00000000..e0d12cb6
--- /dev/null
+++ b/public/samples/previews/landscape-subject.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ls-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#262a66"/><stop offset=".42" stop-color="#7c5aa8"/><stop offset=".72" stop-color="#ee9486"/><stop offset="1" stop-color="#ffd59f"/></linearGradient><radialGradient id="ls-sun"><stop offset="0" stop-color="#fff7da"/><stop offset=".3" stop-color="#ffe3a6" stop-opacity=".9"/><stop offset="1" stop-color="#ffc98a" stop-opacity="0"/></radialGradient><linearGradient id="ls-far" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a684bf"/><stop offset="1" stop-color="#c799b4"/></linearGradient><linearGradient id="ls-near" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5d4c8c"/><stop offset="1" stop-color="#46396f"/></linearGradient><linearGradient id="ls-hill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a3164"/><stop offset="1" stop-color="#262043"/></linearGradient></defs><path d="M-20 300 C 54 244, 150 226, 232 234 C 302 241, 362 254, 420 270 V300Z" fill="url(#ls-hill)"/><g transform="translate(232 190)"><circle cx="0" cy="0" r="5.4" fill="#191530"/><path d="M-6.5 7.5 Q0 4.5 6.5 7.5 L8.5 30 L-8.5 30Z" fill="#d24a3e"/><path d="M-6.5 7.5 L-11 24 L-8.6 25 L-4.5 14Z" fill="#b83c33"/><path d="M-4 30 L-5 46 L-1.6 46 L0 34 L1.6 46 L5 46 L4 30Z" fill="#191530"/><path d="M3 9 L9 6 L10 22 L5 24Z" fill="#2d2752"/></g></svg>
diff --git a/public/samples/previews/landscape.svg b/public/samples/previews/landscape.svg
new file mode 100644
index 00000000..11c138aa
--- /dev/null
+++ b/public/samples/previews/landscape.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="ls-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#262a66"/><stop offset=".42" stop-color="#7c5aa8"/><stop offset=".72" stop-color="#ee9486"/><stop offset="1" stop-color="#ffd59f"/></linearGradient><radialGradient id="ls-sun"><stop offset="0" stop-color="#fff7da"/><stop offset=".3" stop-color="#ffe3a6" stop-opacity=".9"/><stop offset="1" stop-color="#ffc98a" stop-opacity="0"/></radialGradient><linearGradient id="ls-far" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a684bf"/><stop offset="1" stop-color="#c799b4"/></linearGradient><linearGradient id="ls-near" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5d4c8c"/><stop offset="1" stop-color="#46396f"/></linearGradient><linearGradient id="ls-hill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a3164"/><stop offset="1" stop-color="#262043"/></linearGradient></defs><rect width="400" height="300" fill="url(#ls-sky)"/><circle cx="252" cy="176" r="78" fill="url(#ls-sun)"/><circle cx="252" cy="176" r="19" fill="#fff5da"/><g fill="#fff" opacity=".16"><ellipse cx="86" cy="62" rx="54" ry="9"/><ellipse cx="120" cy="54" rx="30" ry="8"/><ellipse cx="318" cy="88" rx="46" ry="7"/><ellipse cx="292" cy="82" rx="24" ry="6"/></g><g fill="#fff" opacity=".7"><circle cx="40" cy="30" r=".9"/><circle cx="160" cy="18" r=".8"/><circle cx="350" cy="26" r="1"/><circle cx="212" cy="40" r=".7"/></g><path d="M0 186 L38 164 L76 176 L126 136 L172 170 L214 148 L258 175 L302 142 L344 168 L400 148 V300 H0Z" fill="url(#ls-far)" opacity=".9"/><path d="M0 214 L52 188 L104 205 L158 180 L216 208 L276 186 L330 204 L400 182 V300 H0Z" fill="url(#ls-near)"/><path d="M-20 300 C 54 244, 150 226, 232 234 C 302 241, 362 254, 420 270 V300Z" fill="url(#ls-hill)"/><g transform="translate(232 190)"><circle cx="0" cy="0" r="5.4" fill="#191530"/><path d="M-6.5 7.5 Q0 4.5 6.5 7.5 L8.5 30 L-8.5 30Z" fill="#d24a3e"/><path d="M-6.5 7.5 L-11 24 L-8.6 25 L-4.5 14Z" fill="#b83c33"/><path d="M-4 30 L-5 46 L-1.6 46 L0 34 L1.6 46 L5 46 L4 30Z" fill="#191530"/><path d="M3 9 L9 6 L10 22 L5 24Z" fill="#2d2752"/></g><path d="M0 300 V258 Q18 246 34 258 Q52 252 70 264 Q92 270 112 286 L126 300Z" fill="#171329"/><path d="M400 300 V250 Q382 242 366 256 Q346 252 330 268 Q312 280 304 300Z" fill="#171329"/><g stroke="#171329" stroke-width="2.2" stroke-linecap="round" fill="none"><path d="M18 258 Q14 236 6 222"/><path d="M28 256 Q30 232 24 214"/><path d="M42 262 Q48 244 46 230"/><path d="M372 254 Q376 232 386 220"/><path d="M360 258 Q356 238 362 224"/><path d="M386 250 Q394 236 398 226"/></g></svg>
diff --git a/public/samples/previews/portrait-bg.svg b/public/samples/previews/portrait-bg.svg
new file mode 100644
index 00000000..82cf348f
--- /dev/null
+++ b/public/samples/previews/portrait-bg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pt-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#34396a"/><stop offset=".55" stop-color="#7a5890"/><stop offset="1" stop-color="#e59f7e"/></linearGradient><radialGradient id="pt-bokeh"><stop offset="0" stop-color="#fff" stop-opacity=".55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient><linearGradient id="pt-skin" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f2c29d"/><stop offset=".7" stop-color="#e3a681"/><stop offset="1" stop-color="#c98a68"/></linearGradient><linearGradient id="pt-top" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2f8f8a"/><stop offset="1" stop-color="#1f6763"/></linearGradient><linearGradient id="pt-hair" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a2420"/><stop offset="1" stop-color="#22140f"/></linearGradient></defs><rect width="400" height="300" fill="url(#pt-bg)"/><g opacity=".9"><circle cx="64" cy="70" r="26" fill="url(#pt-bokeh)"/><circle cx="330" cy="58" r="20" fill="url(#pt-bokeh)"/><circle cx="352" cy="190" r="30" fill="url(#pt-bokeh)"/><circle cx="40" cy="200" r="18" fill="url(#pt-bokeh)"/><circle cx="292" cy="120" r="12" fill="url(#pt-bokeh)"/></g></svg>
diff --git a/public/samples/previews/portrait-fg.svg b/public/samples/previews/portrait-fg.svg
new file mode 100644
index 00000000..30daceaf
--- /dev/null
+++ b/public/samples/previews/portrait-fg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pt-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#34396a"/><stop offset=".55" stop-color="#7a5890"/><stop offset="1" stop-color="#e59f7e"/></linearGradient><radialGradient id="pt-bokeh"><stop offset="0" stop-color="#fff" stop-opacity=".55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient><linearGradient id="pt-skin" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f2c29d"/><stop offset=".7" stop-color="#e3a681"/><stop offset="1" stop-color="#c98a68"/></linearGradient><linearGradient id="pt-top" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2f8f8a"/><stop offset="1" stop-color="#1f6763"/></linearGradient><linearGradient id="pt-hair" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a2420"/><stop offset="1" stop-color="#22140f"/></linearGradient></defs><g opacity=".5"><circle cx="20" cy="282" r="36" fill="#fff" fill-opacity=".14"/><circle cx="388" cy="24" r="30" fill="#fff" fill-opacity=".12"/></g></svg>
diff --git a/public/samples/previews/portrait-mid.svg b/public/samples/previews/portrait-mid.svg
new file mode 100644
index 00000000..8c4d740f
--- /dev/null
+++ b/public/samples/previews/portrait-mid.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pt-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#34396a"/><stop offset=".55" stop-color="#7a5890"/><stop offset="1" stop-color="#e59f7e"/></linearGradient><radialGradient id="pt-bokeh"><stop offset="0" stop-color="#fff" stop-opacity=".55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient><linearGradient id="pt-skin" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f2c29d"/><stop offset=".7" stop-color="#e3a681"/><stop offset="1" stop-color="#c98a68"/></linearGradient><linearGradient id="pt-top" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2f8f8a"/><stop offset="1" stop-color="#1f6763"/></linearGradient><linearGradient id="pt-hair" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a2420"/><stop offset="1" stop-color="#22140f"/></linearGradient></defs><g opacity=".55"><circle cx="110" cy="36" r="40" fill="url(#pt-bokeh)"/><circle cx="380" cy="270" r="46" fill="url(#pt-bokeh)"/></g><path d="M300 300 Q318 210 352 180 Q340 230 346 300Z" fill="#2b2f58" opacity=".55"/><path d="M330 300 Q340 236 380 214 Q364 262 368 300Z" fill="#2b2f58" opacity=".45"/></svg>
diff --git a/public/samples/previews/portrait-subject.svg b/public/samples/previews/portrait-subject.svg
new file mode 100644
index 00000000..e65abc95
--- /dev/null
+++ b/public/samples/previews/portrait-subject.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pt-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#34396a"/><stop offset=".55" stop-color="#7a5890"/><stop offset="1" stop-color="#e59f7e"/></linearGradient><radialGradient id="pt-bokeh"><stop offset="0" stop-color="#fff" stop-opacity=".55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient><linearGradient id="pt-skin" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f2c29d"/><stop offset=".7" stop-color="#e3a681"/><stop offset="1" stop-color="#c98a68"/></linearGradient><linearGradient id="pt-top" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2f8f8a"/><stop offset="1" stop-color="#1f6763"/></linearGradient><linearGradient id="pt-hair" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a2420"/><stop offset="1" stop-color="#22140f"/></linearGradient></defs><path d="M150 112 Q148 62 200 58 Q252 62 250 112 Q254 168 236 200 L164 200 Q146 168 150 112Z" fill="url(#pt-hair)"/><rect x="186" y="160" width="28" height="44" rx="10" fill="#d5966f"/><path d="M96 300 Q102 222 156 206 Q178 198 200 214 Q222 198 244 206 Q298 222 304 300Z" fill="url(#pt-top)"/><path d="M178 206 Q200 228 222 206" fill="none" stroke="#e3a681" stroke-width="8" stroke-linecap="round"/><ellipse cx="200" cy="124" rx="35" ry="44" fill="url(#pt-skin)"/><path d="M166 112 Q170 70 206 72 Q238 76 238 112 Q222 90 196 92 Q176 94 166 112Z" fill="url(#pt-hair)"/><g fill="#3b2621"><ellipse cx="186" cy="124" rx="3.2" ry="2.2"/><ellipse cx="214" cy="124" rx="3.2" ry="2.2"/></g><g stroke="#3b2621" stroke-width="1.6" stroke-linecap="round" fill="none" opacity=".8"><path d="M180 116 Q186 113 192 116"/><path d="M208 116 Q214 113 220 116"/></g><path d="M200 128 Q197 140 201 143" fill="none" stroke="#b97a5a" stroke-width="1.6" stroke-linecap="round"/><path d="M190 152 Q200 158 210 152" fill="none" stroke="#a5524a" stroke-width="2.6" stroke-linecap="round"/><g fill="#e98f7c" opacity=".35"><ellipse cx="180" cy="140" rx="7" ry="4"/><ellipse cx="220" cy="140" rx="7" ry="4"/></g></svg>
diff --git a/public/samples/previews/portrait.svg b/public/samples/previews/portrait.svg
new file mode 100644
index 00000000..b370c164
--- /dev/null
+++ b/public/samples/previews/portrait.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pt-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#34396a"/><stop offset=".55" stop-color="#7a5890"/><stop offset="1" stop-color="#e59f7e"/></linearGradient><radialGradient id="pt-bokeh"><stop offset="0" stop-color="#fff" stop-opacity=".55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient><linearGradient id="pt-skin" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f2c29d"/><stop offset=".7" stop-color="#e3a681"/><stop offset="1" stop-color="#c98a68"/></linearGradient><linearGradient id="pt-top" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2f8f8a"/><stop offset="1" stop-color="#1f6763"/></linearGradient><linearGradient id="pt-hair" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a2420"/><stop offset="1" stop-color="#22140f"/></linearGradient></defs><rect width="400" height="300" fill="url(#pt-bg)"/><g opacity=".9"><circle cx="64" cy="70" r="26" fill="url(#pt-bokeh)"/><circle cx="330" cy="58" r="20" fill="url(#pt-bokeh)"/><circle cx="352" cy="190" r="30" fill="url(#pt-bokeh)"/><circle cx="40" cy="200" r="18" fill="url(#pt-bokeh)"/><circle cx="292" cy="120" r="12" fill="url(#pt-bokeh)"/></g><g opacity=".55"><circle cx="110" cy="36" r="40" fill="url(#pt-bokeh)"/><circle cx="380" cy="270" r="46" fill="url(#pt-bokeh)"/></g><path d="M300 300 Q318 210 352 180 Q340 230 346 300Z" fill="#2b2f58" opacity=".55"/><path d="M330 300 Q340 236 380 214 Q364 262 368 300Z" fill="#2b2f58" opacity=".45"/><path d="M150 112 Q148 62 200 58 Q252 62 250 112 Q254 168 236 200 L164 200 Q146 168 150 112Z" fill="url(#pt-hair)"/><rect x="186" y="160" width="28" height="44" rx="10" fill="#d5966f"/><path d="M96 300 Q102 222 156 206 Q178 198 200 214 Q222 198 244 206 Q298 222 304 300Z" fill="url(#pt-top)"/><path d="M178 206 Q200 228 222 206" fill="none" stroke="#e3a681" stroke-width="8" stroke-linecap="round"/><ellipse cx="200" cy="124" rx="35" ry="44" fill="url(#pt-skin)"/><path d="M166 112 Q170 70 206 72 Q238 76 238 112 Q222 90 196 92 Q176 94 166 112Z" fill="url(#pt-hair)"/><g fill="#3b2621"><ellipse cx="186" cy="124" rx="3.2" ry="2.2"/><ellipse cx="214" cy="124" rx="3.2" ry="2.2"/></g><g stroke="#3b2621" stroke-width="1.6" stroke-linecap="round" fill="none" opacity=".8"><path d="M180 116 Q186 113 192 116"/><path d="M208 116 Q214 113 220 116"/></g><path d="M200 128 Q197 140 201 143" fill="none" stroke="#b97a5a" stroke-width="1.6" stroke-linecap="round"/><path d="M190 152 Q200 158 210 152" fill="none" stroke="#a5524a" stroke-width="2.6" stroke-linecap="round"/><g fill="#e98f7c" opacity=".35"><ellipse cx="180" cy="140" rx="7" ry="4"/><ellipse cx="220" cy="140" rx="7" ry="4"/></g><g opacity=".5"><circle cx="20" cy="282" r="36" fill="#fff" fill-opacity=".14"/><circle cx="388" cy="24" r="30" fill="#fff" fill-opacity=".12"/></g></svg>
diff --git a/public/samples/previews/product-bg.svg b/public/samples/previews/product-bg.svg
new file mode 100644
index 00000000..129e8bad
--- /dev/null
+++ b/public/samples/previews/product-bg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pd-bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f5ddc9"/><stop offset="1" stop-color="#e2ab97"/></linearGradient><linearGradient id="pd-pod" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#e9d8c9"/><stop offset=".6" stop-color="#f7ece2"/><stop offset="1" stop-color="#d4bba8"/></linearGradient><linearGradient id="pd-glass" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f6b48d" stop-opacity=".95"/><stop offset=".5" stop-color="#ffd7b5" stop-opacity=".9"/><stop offset="1" stop-color="#e58f6b" stop-opacity=".95"/></linearGradient></defs><rect width="400" height="300" fill="url(#pd-bg)"/><circle cx="214" cy="128" r="92" fill="#fbeadb" opacity=".8"/><path d="M0 230 H400 V300 H0Z" fill="#dca08b" opacity=".45"/></svg>
diff --git a/public/samples/previews/product-fg.svg b/public/samples/previews/product-fg.svg
new file mode 100644
index 00000000..3e92b9b5
--- /dev/null
+++ b/public/samples/previews/product-fg.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pd-bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f5ddc9"/><stop offset="1" stop-color="#e2ab97"/></linearGradient><linearGradient id="pd-pod" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#e9d8c9"/><stop offset=".6" stop-color="#f7ece2"/><stop offset="1" stop-color="#d4bba8"/></linearGradient><linearGradient id="pd-glass" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f6b48d" stop-opacity=".95"/><stop offset=".5" stop-color="#ffd7b5" stop-opacity=".9"/><stop offset="1" stop-color="#e58f6b" stop-opacity=".95"/></linearGradient></defs><path d="M24 300 Q40 250 92 238 Q70 270 74 300Z" fill="#6f8f6a"/><path d="M44 300 Q58 268 92 238" fill="none" stroke="#56724f" stroke-width="2"/><path d="M380 300 Q366 262 318 252 Q338 278 334 300Z" fill="#7c9a74"/><ellipse cx="300" cy="292" rx="16" ry="7" fill="#c7a596"/><ellipse cx="120" cy="294" rx="10" ry="5" fill="#d4b4a5"/></svg>
diff --git a/public/samples/previews/product-mid.svg b/public/samples/previews/product-mid.svg
new file mode 100644
index 00000000..b3f75f3e
--- /dev/null
+++ b/public/samples/previews/product-mid.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pd-bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f5ddc9"/><stop offset="1" stop-color="#e2ab97"/></linearGradient><linearGradient id="pd-pod" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#e9d8c9"/><stop offset=".6" stop-color="#f7ece2"/><stop offset="1" stop-color="#d4bba8"/></linearGradient><linearGradient id="pd-glass" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f6b48d" stop-opacity=".95"/><stop offset=".5" stop-color="#ffd7b5" stop-opacity=".9"/><stop offset="1" stop-color="#e58f6b" stop-opacity=".95"/></linearGradient></defs><ellipse cx="200" cy="268" rx="104" ry="14" fill="#b98472" opacity=".45"/><path d="M118 214 V258 Q200 278 282 258 V214Z" fill="url(#pd-pod)"/><ellipse cx="200" cy="214" rx="82" ry="14" fill="#fbf3ec"/></svg>
diff --git a/public/samples/previews/product-subject.svg b/public/samples/previews/product-subject.svg
new file mode 100644
index 00000000..06d4f525
--- /dev/null
+++ b/public/samples/previews/product-subject.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pd-bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f5ddc9"/><stop offset="1" stop-color="#e2ab97"/></linearGradient><linearGradient id="pd-pod" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#e9d8c9"/><stop offset=".6" stop-color="#f7ece2"/><stop offset="1" stop-color="#d4bba8"/></linearGradient><linearGradient id="pd-glass" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f6b48d" stop-opacity=".95"/><stop offset=".5" stop-color="#ffd7b5" stop-opacity=".9"/><stop offset="1" stop-color="#e58f6b" stop-opacity=".95"/></linearGradient></defs><ellipse cx="200" cy="212" rx="34" ry="6" fill="#9c6b5c" opacity=".35"/><rect x="186" y="98" width="28" height="22" rx="4" fill="#2c2a33"/><rect x="190" y="92" width="20" height="10" rx="3" fill="#3a3843"/><rect x="166" y="116" width="68" height="96" rx="14" fill="url(#pd-glass)"/><rect x="172" y="150" width="56" height="56" rx="10" fill="#e07a52" opacity=".55"/><rect x="180" y="160" width="40" height="18" rx="3" fill="#fff6ee" opacity=".9"/><path d="M176 126 Q174 160 180 196" fill="none" stroke="#fff" stroke-width="4" stroke-linecap="round" opacity=".55"/></svg>
diff --git a/public/samples/previews/product.svg b/public/samples/previews/product.svg
new file mode 100644
index 00000000..1ee01fb5
--- /dev/null
+++ b/public/samples/previews/product.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice"><defs><linearGradient id="pd-bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f5ddc9"/><stop offset="1" stop-color="#e2ab97"/></linearGradient><linearGradient id="pd-pod" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#e9d8c9"/><stop offset=".6" stop-color="#f7ece2"/><stop offset="1" stop-color="#d4bba8"/></linearGradient><linearGradient id="pd-glass" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f6b48d" stop-opacity=".95"/><stop offset=".5" stop-color="#ffd7b5" stop-opacity=".9"/><stop offset="1" stop-color="#e58f6b" stop-opacity=".95"/></linearGradient></defs><rect width="400" height="300" fill="url(#pd-bg)"/><circle cx="214" cy="128" r="92" fill="#fbeadb" opacity=".8"/><path d="M0 230 H400 V300 H0Z" fill="#dca08b" opacity=".45"/><ellipse cx="200" cy="268" rx="104" ry="14" fill="#b98472" opacity=".45"/><path d="M118 214 V258 Q200 278 282 258 V214Z" fill="url(#pd-pod)"/><ellipse cx="200" cy="214" rx="82" ry="14" fill="#fbf3ec"/><ellipse cx="200" cy="212" rx="34" ry="6" fill="#9c6b5c" opacity=".35"/><rect x="186" y="98" width="28" height="22" rx="4" fill="#2c2a33"/><rect x="190" y="92" width="20" height="10" rx="3" fill="#3a3843"/><rect x="166" y="116" width="68" height="96" rx="14" fill="url(#pd-glass)"/><rect x="172" y="150" width="56" height="56" rx="10" fill="#e07a52" opacity=".55"/><rect x="180" y="160" width="40" height="18" rx="3" fill="#fff6ee" opacity=".9"/><path d="M176 126 Q174 160 180 196" fill="none" stroke="#fff" stroke-width="4" stroke-linecap="round" opacity=".55"/><path d="M24 300 Q40 250 92 238 Q70 270 74 300Z" fill="#6f8f6a"/><path d="M44 300 Q58 268 92 238" fill="none" stroke="#56724f" stroke-width="2"/><path d="M380 300 Q366 262 318 252 Q338 278 334 300Z" fill="#7c9a74"/><ellipse cx="300" cy="292" rx="16" ry="7" fill="#c7a596"/><ellipse cx="120" cy="294" rx="10" ry="5" fill="#d4b4a5"/></svg>
diff --git a/scripts/gen-preview-scenes.mjs b/scripts/gen-preview-scenes.mjs
new file mode 100644
index 00000000..0036ab49
--- /dev/null
+++ b/scripts/gen-preview-scenes.mjs
@@ -0,0 +1,75 @@
+#!/usr/bin/env node
+/**
+ * Writes the bundled sample stills used by the procedural preset previews (camera motions,
+ * effects, apps) until real preview clips exist.
+ *
+ * Each scene is drawn in four depth layers (bg, mid, subject, fg) so a preview can move them at
+ * different rates: a zoom scales them together, a dolly scales the near layers more, a truck
+ * shifts them with parallax, a dolly zoom keeps the subject still while the background grows.
+ *
+ * Output (all in public/samples/previews/, which the sign-in proxy leaves public):
+ * <scene>.svg the composite still (poster)
+ * <scene>-<layer>.svg one file per layer, transparent outside its shapes
+ *
+ * Run: node scripts/gen-preview-scenes.mjs
+ */
+import fs from "node:fs";
+import path from "node:path";
+
+const OUT = path.join(path.dirname(new URL(import.meta.url).pathname), "..", "public", "samples", "previews");
+const W = 400;
+const H = 300;
+
+const svg = (body, defs = "") =>
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMid slice">${defs ? `<defs>${defs}</defs>` : ""}${body}</svg>\n`;
+
+// Golden-hour valley: a hiker on a ridge. Used by most camera moves.
+const landscape = {
+ defs: `<linearGradient id="ls-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#262a66"/><stop offset=".42" stop-color="#7c5aa8"/><stop offset=".72" stop-color="#ee9486"/><stop offset="1" stop-color="#ffd59f"/></linearGradient><radialGradient id="ls-sun"><stop offset="0" stop-color="#fff7da"/><stop offset=".3" stop-color="#ffe3a6" stop-opacity=".9"/><stop offset="1" stop-color="#ffc98a" stop-opacity="0"/></radialGradient><linearGradient id="ls-far" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#a684bf"/><stop offset="1" stop-color="#c799b4"/></linearGradient><linearGradient id="ls-near" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5d4c8c"/><stop offset="1" stop-color="#46396f"/></linearGradient><linearGradient id="ls-hill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a3164"/><stop offset="1" stop-color="#262043"/></linearGradient>`,
+ bg: `<rect width="${W}" height="${H}" fill="url(#ls-sky)"/><circle cx="252" cy="176" r="78" fill="url(#ls-sun)"/><circle cx="252" cy="176" r="19" fill="#fff5da"/><g fill="#fff" opacity=".16"><ellipse cx="86" cy="62" rx="54" ry="9"/><ellipse cx="120" cy="54" rx="30" ry="8"/><ellipse cx="318" cy="88" rx="46" ry="7"/><ellipse cx="292" cy="82" rx="24" ry="6"/></g><g fill="#fff" opacity=".7"><circle cx="40" cy="30" r=".9"/><circle cx="160" cy="18" r=".8"/><circle cx="350" cy="26" r="1"/><circle cx="212" cy="40" r=".7"/></g>`,
+ mid: `<path d="M0 186 L38 164 L76 176 L126 136 L172 170 L214 148 L258 175 L302 142 L344 168 L400 148 V300 H0Z" fill="url(#ls-far)" opacity=".9"/><path d="M0 214 L52 188 L104 205 L158 180 L216 208 L276 186 L330 204 L400 182 V300 H0Z" fill="url(#ls-near)"/>`,
+ subject: `<path d="M-20 300 C 54 244, 150 226, 232 234 C 302 241, 362 254, 420 270 V300Z" fill="url(#ls-hill)"/><g transform="translate(232 190)"><circle cx="0" cy="0" r="5.4" fill="#191530"/><path d="M-6.5 7.5 Q0 4.5 6.5 7.5 L8.5 30 L-8.5 30Z" fill="#d24a3e"/><path d="M-6.5 7.5 L-11 24 L-8.6 25 L-4.5 14Z" fill="#b83c33"/><path d="M-4 30 L-5 46 L-1.6 46 L0 34 L1.6 46 L5 46 L4 30Z" fill="#191530"/><path d="M3 9 L9 6 L10 22 L5 24Z" fill="#2d2752"/></g>`,
+ fg: `<path d="M0 300 V258 Q18 246 34 258 Q52 252 70 264 Q92 270 112 286 L126 300Z" fill="#171329"/><path d="M400 300 V250 Q382 242 366 256 Q346 252 330 268 Q312 280 304 300Z" fill="#171329"/><g stroke="#171329" stroke-width="2.2" stroke-linecap="round" fill="none"><path d="M18 258 Q14 236 6 222"/><path d="M28 256 Q30 232 24 214"/><path d="M42 262 Q48 244 46 230"/><path d="M372 254 Q376 232 386 220"/><path d="M360 258 Q356 238 362 224"/><path d="M386 250 Q394 236 398 226"/></g>`,
+};
+
+// Studio portrait: one person, head and shoulders. Used by faces, UGC, identity and fashion.
+const portrait = {
+ defs: `<linearGradient id="pt-bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#34396a"/><stop offset=".55" stop-color="#7a5890"/><stop offset="1" stop-color="#e59f7e"/></linearGradient><radialGradient id="pt-bokeh"><stop offset="0" stop-color="#fff" stop-opacity=".55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient><linearGradient id="pt-skin" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f2c29d"/><stop offset=".7" stop-color="#e3a681"/><stop offset="1" stop-color="#c98a68"/></linearGradient><linearGradient id="pt-top" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2f8f8a"/><stop offset="1" stop-color="#1f6763"/></linearGradient><linearGradient id="pt-hair" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a2420"/><stop offset="1" stop-color="#22140f"/></linearGradient>`,
+ bg: `<rect width="${W}" height="${H}" fill="url(#pt-bg)"/><g opacity=".9"><circle cx="64" cy="70" r="26" fill="url(#pt-bokeh)"/><circle cx="330" cy="58" r="20" fill="url(#pt-bokeh)"/><circle cx="352" cy="190" r="30" fill="url(#pt-bokeh)"/><circle cx="40" cy="200" r="18" fill="url(#pt-bokeh)"/><circle cx="292" cy="120" r="12" fill="url(#pt-bokeh)"/></g>`,
+ mid: `<g opacity=".55"><circle cx="110" cy="36" r="40" fill="url(#pt-bokeh)"/><circle cx="380" cy="270" r="46" fill="url(#pt-bokeh)"/></g><path d="M300 300 Q318 210 352 180 Q340 230 346 300Z" fill="#2b2f58" opacity=".55"/><path d="M330 300 Q340 236 380 214 Q364 262 368 300Z" fill="#2b2f58" opacity=".45"/>`,
+ subject: `<path d="M150 112 Q148 62 200 58 Q252 62 250 112 Q254 168 236 200 L164 200 Q146 168 150 112Z" fill="url(#pt-hair)"/><rect x="186" y="160" width="28" height="44" rx="10" fill="#d5966f"/><path d="M96 300 Q102 222 156 206 Q178 198 200 214 Q222 198 244 206 Q298 222 304 300Z" fill="url(#pt-top)"/><path d="M178 206 Q200 228 222 206" fill="none" stroke="#e3a681" stroke-width="8" stroke-linecap="round"/><ellipse cx="200" cy="124" rx="35" ry="44" fill="url(#pt-skin)"/><path d="M166 112 Q170 70 206 72 Q238 76 238 112 Q222 90 196 92 Q176 94 166 112Z" fill="url(#pt-hair)"/><g fill="#3b2621"><ellipse cx="186" cy="124" rx="3.2" ry="2.2"/><ellipse cx="214" cy="124" rx="3.2" ry="2.2"/></g><g stroke="#3b2621" stroke-width="1.6" stroke-linecap="round" fill="none" opacity=".8"><path d="M180 116 Q186 113 192 116"/><path d="M208 116 Q214 113 220 116"/></g><path d="M200 128 Q197 140 201 143" fill="none" stroke="#b97a5a" stroke-width="1.6" stroke-linecap="round"/><path d="M190 152 Q200 158 210 152" fill="none" stroke="#a5524a" stroke-width="2.6" stroke-linecap="round"/><g fill="#e98f7c" opacity=".35"><ellipse cx="180" cy="140" rx="7" ry="4"/><ellipse cx="220" cy="140" rx="7" ry="4"/></g>`,
+ fg: `<g opacity=".5"><circle cx="20" cy="282" r="36" fill="#fff" fill-opacity=".14"/><circle cx="388" cy="24" r="30" fill="#fff" fill-opacity=".12"/></g>`,
+};
+
+// Neon city at night, a car on the street. Used by drones, vehicles, destruction and viral effects.
+const city = {
+ defs: `<linearGradient id="ct-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0b0f2e"/><stop offset=".55" stop-color="#2c2163"/><stop offset="1" stop-color="#7a3478"/></linearGradient><radialGradient id="ct-glow"><stop offset="0" stop-color="#ff5b6e" stop-opacity=".9"/><stop offset="1" stop-color="#ff5b6e" stop-opacity="0"/></radialGradient><radialGradient id="ct-lamp"><stop offset="0" stop-color="#ffe7a8" stop-opacity=".9"/><stop offset="1" stop-color="#ffe7a8" stop-opacity="0"/></radialGradient><linearGradient id="ct-road" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a2150"/><stop offset="1" stop-color="#120e26"/></linearGradient>`,
+ bg: `<rect width="${W}" height="${H}" fill="url(#ct-sky)"/><circle cx="318" cy="52" r="15" fill="#f4ecff" opacity=".9"/><g fill="#fff" opacity=".6"><circle cx="40" cy="24" r=".9"/><circle cx="120" cy="40" r=".7"/><circle cx="200" cy="18" r="1"/><circle cx="262" cy="34" r=".7"/><circle cx="372" cy="90" r=".8"/></g><path d="M0 196 V150 H22 V132 H40 V158 H58 V120 H76 V164 H96 V140 H118 V170 H140 V128 H156 V112 H172 V150 H190 V170 H214 V136 H232 V160 H252 V118 H270 V150 H290 V128 H312 V164 H332 V142 H352 V120 H370 V158 H400 V196Z" fill="#1d1846"/><g fill="#ffd27a" opacity=".55"><rect x="62" y="128" width="3" height="3"/><rect x="68" y="140" width="3" height="3"/><rect x="160" y="120" width="3" height="3"/><rect x="164" y="134" width="3" height="3"/><rect x="256" y="126" width="3" height="3"/><rect x="262" y="140" width="3" height="3"/><rect x="356" y="128" width="3" height="3"/><rect x="25" y="140" width="3" height="3"/><rect x="296" y="136" width="3" height="3"/></g>`,
+ mid: `<path d="M0 300 V96 H44 V82 H70 V300Z" fill="#15112f"/><path d="M330 300 V90 H356 V74 H400 V300Z" fill="#15112f"/><g opacity=".9"><rect x="12" y="110" width="40" height="10" rx="2" fill="#ff4fa3"/><rect x="340" y="104" width="44" height="9" rx="2" fill="#3de0ff"/><rect x="18" y="150" width="6" height="40" rx="2" fill="#3de0ff"/><rect x="372" y="140" width="6" height="34" rx="2" fill="#ff4fa3"/></g><g fill="#ffd27a" opacity=".45"><rect x="10" y="200" width="6" height="6"/><rect x="30" y="220" width="6" height="6"/><rect x="50" y="200" width="6" height="6"/><rect x="346" y="196" width="6" height="6"/><rect x="368" y="220" width="6" height="6"/></g><path d="M70 300 L188 196 H212 L330 300Z" fill="url(#ct-road)"/><g fill="#f4ecff" opacity=".55"><path d="M198 204 h4 l1 10 h-6z"/><path d="M196 226 h8 l2 16 h-12z"/><path d="M193 258 h14 l3 26 h-20z"/></g>`,
+ subject: `<g transform="translate(200 236)"><ellipse cx="0" cy="22" rx="46" ry="6" fill="#000" opacity=".35"/><path d="M-40 18 Q-42 -2 -30 -8 L-22 -26 Q-18 -32 -10 -32 H10 Q18 -32 22 -26 L30 -8 Q42 -2 40 18Z" fill="#d8344f"/><path d="M-19 -24 Q-16 -28 -10 -28 H10 Q16 -28 19 -24 L24 -10 H-24Z" fill="#2a2150"/><rect x="-36" y="-2" width="14" height="6" rx="2" fill="#ff3049"/><rect x="22" y="-2" width="14" height="6" rx="2" fill="#ff3049"/><rect x="-12" y="4" width="24" height="7" rx="1.5" fill="#f4ecff" opacity=".85"/><rect x="-38" y="14" width="12" height="10" rx="2" fill="#16122c"/><rect x="26" y="14" width="12" height="10" rx="2" fill="#16122c"/><circle cx="-29" cy="1" r="16" fill="url(#ct-glow)"/><circle cx="29" cy="1" r="16" fill="url(#ct-glow)"/></g>`,
+ fg: `<path d="M18 300 V128 Q18 116 30 116 H50" fill="none" stroke="#0d0a20" stroke-width="5"/><circle cx="52" cy="120" r="22" fill="url(#ct-lamp)"/><path d="M382 300 V136 Q382 124 370 124 H352" fill="none" stroke="#0d0a20" stroke-width="5"/><circle cx="350" cy="128" r="20" fill="url(#ct-lamp)"/><g opacity=".5"><path d="M110 296 h40" stroke="#ff4fa3" stroke-width="2"/><path d="M252 292 h44" stroke="#3de0ff" stroke-width="2"/></g>`,
+};
+
+// Product on a podium. Used by product apps and commercial effects.
+const product = {
+ defs: `<linearGradient id="pd-bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f5ddc9"/><stop offset="1" stop-color="#e2ab97"/></linearGradient><linearGradient id="pd-pod" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#e9d8c9"/><stop offset=".6" stop-color="#f7ece2"/><stop offset="1" stop-color="#d4bba8"/></linearGradient><linearGradient id="pd-glass" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#f6b48d" stop-opacity=".95"/><stop offset=".5" stop-color="#ffd7b5" stop-opacity=".9"/><stop offset="1" stop-color="#e58f6b" stop-opacity=".95"/></linearGradient>`,
+ bg: `<rect width="${W}" height="${H}" fill="url(#pd-bg)"/><circle cx="214" cy="128" r="92" fill="#fbeadb" opacity=".8"/><path d="M0 230 H400 V300 H0Z" fill="#dca08b" opacity=".45"/>`,
+ mid: `<ellipse cx="200" cy="268" rx="104" ry="14" fill="#b98472" opacity=".45"/><path d="M118 214 V258 Q200 278 282 258 V214Z" fill="url(#pd-pod)"/><ellipse cx="200" cy="214" rx="82" ry="14" fill="#fbf3ec"/>`,
+ subject: `<ellipse cx="200" cy="212" rx="34" ry="6" fill="#9c6b5c" opacity=".35"/><rect x="186" y="98" width="28" height="22" rx="4" fill="#2c2a33"/><rect x="190" y="92" width="20" height="10" rx="3" fill="#3a3843"/><rect x="166" y="116" width="68" height="96" rx="14" fill="url(#pd-glass)"/><rect x="172" y="150" width="56" height="56" rx="10" fill="#e07a52" opacity=".55"/><rect x="180" y="160" width="40" height="18" rx="3" fill="#fff6ee" opacity=".9"/><path d="M176 126 Q174 160 180 196" fill="none" stroke="#fff" stroke-width="4" stroke-linecap="round" opacity=".55"/>`,
+ fg: `<path d="M24 300 Q40 250 92 238 Q70 270 74 300Z" fill="#6f8f6a"/><path d="M44 300 Q58 268 92 238" fill="none" stroke="#56724f" stroke-width="2"/><path d="M380 300 Q366 262 318 252 Q338 278 334 300Z" fill="#7c9a74"/><ellipse cx="300" cy="292" rx="16" ry="7" fill="#c7a596"/><ellipse cx="120" cy="294" rx="10" ry="5" fill="#d4b4a5"/>`,
+};
+
+const SCENES = { landscape, portrait, city, product };
+const LAYERS = ["bg", "mid", "subject", "fg"];
+
+fs.mkdirSync(OUT, { recursive: true });
+let total = 0;
+for (const [name, s] of Object.entries(SCENES)) {
+ const write = (file, content) => {
+ fs.writeFileSync(path.join(OUT, file), content);
+ total += content.length;
+ };
+ write(`${name}.svg`, svg(LAYERS.map((l) => s[l]).join(""), s.defs));
+ for (const l of LAYERS) write(`${name}-${l}.svg`, svg(s[l], s.defs));
+}
+console.log(`wrote ${Object.keys(SCENES).length * (LAYERS.length + 1)} files (${total} bytes) to ${path.relative(process.cwd(), OUT)}`);
diff --git a/src/app/(studio)/apps/page.tsx b/src/app/(studio)/apps/page.tsx
index 129d229d..c95a5610 100644
--- a/src/app/(studio)/apps/page.tsx
+++ b/src/app/(studio)/apps/page.tsx
@@ -1,7 +1,8 @@
import type { Metadata } from "next";
-import { PageShell } from "@/components/page-shell";
-import { PageHeader, PresetGallery } from "@/components/preset-gallery";
+import { PageHeader, PageShell } from "@/components/page-shell";
+import { PresetGallery } from "@/components/preset-gallery";
import { APPS } from "@/lib/catalog";
+import { toPresetCard } from "@/lib/preset-cards";
export const metadata: Metadata = { title: "Apps" };
@@ -12,7 +13,8 @@ export default function Page() {
title="Apps"
description="One-click tools for faces, products, styles and fun. Every app runs on a frontier cloud model or an open-source ComfyUI workflow."
/>
- <PresetGallery presets={APPS} href="/apps/{id}" />
+ {/* Slim card data only: no prompt templates, routes or LoRA URLs in the page payload. */}
+ <PresetGallery presets={APPS.map(toPresetCard)} href="/apps/{id}" noun="apps" />
</PageShell>
);
}
diff --git a/src/app/(studio)/effects/page.tsx b/src/app/(studio)/effects/page.tsx
index ec19914a..cbe163ca 100644
--- a/src/app/(studio)/effects/page.tsx
+++ b/src/app/(studio)/effects/page.tsx
@@ -1,7 +1,8 @@
import type { Metadata } from "next";
-import { PageShell } from "@/components/page-shell";
-import { PageHeader, PresetGallery } from "@/components/preset-gallery";
+import { PageHeader, PageShell } from "@/components/page-shell";
+import { PresetGallery } from "@/components/preset-gallery";
import { EFFECTS } from "@/lib/catalog";
+import { toPresetCard } from "@/lib/preset-cards";
export const metadata: Metadata = { title: "Effects" };
@@ -12,7 +13,7 @@ export default function Page() {
title="Effects"
description="Explosions, transformations and viral VFX from a single photo. Open-source versions use Wan effect LoRAs where available."
/>
- <PresetGallery presets={EFFECTS} href="/video?preset={id}" />
+ <PresetGallery presets={EFFECTS.map(toPresetCard)} href="/video?preset={id}" noun="effects" />
</PageShell>
);
}
diff --git a/src/app/(studio)/motions/page.tsx b/src/app/(studio)/motions/page.tsx
index 9829151b..28b07e82 100644
--- a/src/app/(studio)/motions/page.tsx
+++ b/src/app/(studio)/motions/page.tsx
@@ -1,7 +1,8 @@
import type { Metadata } from "next";
-import { PageShell } from "@/components/page-shell";
-import { PageHeader, PresetGallery } from "@/components/preset-gallery";
+import { PageHeader, PageShell } from "@/components/page-shell";
+import { PresetGallery } from "@/components/preset-gallery";
import { MOTIONS } from "@/lib/catalog";
+import { toPresetCard } from "@/lib/preset-cards";
export const metadata: Metadata = { title: "Camera motions" };
@@ -12,7 +13,7 @@ export default function Page() {
title="Camera motions"
description="Director-grade camera moves for any image. Pick a move, drop in a start frame, and it runs on Kling, Veo, Seedance… or Wan 2.2 on your own GPU."
/>
- <PresetGallery presets={MOTIONS} href="/video?preset={id}" />
+ <PresetGallery presets={MOTIONS.map(toPresetCard)} href="/video?preset={id}" noun="moves" />
</PageShell>
);
}
diff --git a/src/app/(studio)/page.tsx b/src/app/(studio)/page.tsx
index cdd122bf..f84aabd7 100644
--- a/src/app/(studio)/page.tsx
+++ b/src/app/(studio)/page.tsx
@@ -1,5 +1,20 @@
import { HomeView } from "@/components/home-view";
+import { APPS, EFFECTS, MOTIONS } from "@/lib/catalog";
+import { toPresetCard } from "@/lib/preset-cards";
+const HOME_MOTIONS = ["motion-crash-zoom-in", "motion-360-orbit", "motion-bullet-time", "motion-fpv-drone", "motion-dolly-zoom-in", "motion-snorricam"];
+
+/** The catalog stays on the server: the home view gets 18 slim cards and three counts. */
export default function Page() {
- return <HomeView />;
+ return (
+ <HomeView
+ counts={{ motions: MOTIONS.length, effects: EFFECTS.length, apps: APPS.length }}
+ motions={MOTIONS.filter((m) => HOME_MOTIONS.includes(m.id)).map(toPresetCard)}
+ apps={APPS.slice(0, 12)
+ .filter((a) => a.badges?.includes("top") || a.category === "Camera")
+ .slice(0, 6)
+ .map(toPresetCard)}
+ effects={EFFECTS.slice(0, 6).map(toPresetCard)}
+ />
+ );
}
diff --git a/src/app/globals.css b/src/app/globals.css
index 506b0be2..25d86bc8 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -309,3 +309,277 @@
.prose-fuobe th { text-align: left; font-weight: 600; padding: 10px 14px; background: var(--muted); }
.prose-fuobe td { padding: 8px 14px; border-top: 0.5px solid var(--border); vertical-align: top; }
.prose-fuobe blockquote { border-left: 3px solid var(--border); padding-left: 1em; color: var(--muted-foreground); }
+
+/* ---------------------------------------------------------------------------------------------
+ * Horizontal scrollers with fade edges (gallery category strip): data-fade-start / -end are set
+ * by the scroll handler when there is more to see on that side.
+ * ------------------------------------------------------------------------------------------- */
+.fade-x {
+ --fade-l: 0px;
+ --fade-r: 0px;
+ mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
+}
+.fade-x[data-fade-start] { --fade-l: 32px; }
+.fade-x[data-fade-end] { --fade-r: 32px; }
+
+/* Sidebar groups that remember being collapsed (app-sidebar.tsx). In icon mode every item shows. */
+[data-nav-group][data-open="false"] [data-nav-items] { display: none; }
+[data-collapsible="icon"] [data-nav-group] [data-nav-items] { display: flex; }
+
+/* ---------------------------------------------------------------------------------------------
+ * Procedural preset previews (preset-preview.tsx, src/lib/preset-cards.ts).
+ * A camera move animates --pv-t from 0 to 1; every depth layer turns it into its own transform:
+ * translate = (pan + tx·d + orbit·o)% · t, scale = 1 + base + (zoom + dolly·d) · t, rotate = roll · t
+ * (the same formula as layerTransform() in preset-cards.ts, which the tests check for coverage).
+ * Effects and apps add a treatment (.pv-fx) whose resting styles are the poster frame.
+ * ------------------------------------------------------------------------------------------- */
+@property --pv-t {
+ syntax: "<number>";
+ inherits: true;
+ initial-value: 0;
+}
+
+.pv { position: absolute; inset: 0; overflow: hidden; isolation: isolate; contain: layout paint; }
+.pv i { position: absolute; display: block; pointer-events: none; }
+.pv-cam, .pv-shake, .pv-fx { position: absolute; inset: 0; }
+.pv-cam { --pv-t: 0; }
+.pv-img {
+ position: absolute; left: -12%; top: -12%; width: 124%; height: 124%; max-width: none;
+ object-fit: cover; user-select: none; pointer-events: none;
+}
+.pv-layer {
+ transform:
+ translate(
+ calc((var(--pv-panX, 0) + var(--pv-tx, 0) * var(--d) + var(--pv-orbit, 0) * var(--o)) * var(--pv-t) * 1%),
+ calc((var(--pv-panY, 0) + var(--pv-ty, 0) * var(--d)) * var(--pv-t) * 1%)
+ )
+ scale(calc(1 + var(--pv-base, 0) + (var(--pv-zoom, 0) + var(--pv-dolly, 0) * var(--d)) * var(--pv-t)))
+ rotate(calc(var(--pv-roll, 0) * var(--pv-t) * 1deg));
+}
+.pv-tint {
+ inset: 0; z-index: 6; mix-blend-mode: soft-light; opacity: 0.55;
+ background: linear-gradient(135deg, oklch(0.78 0.15 var(--pv-hue, 282)), oklch(0.5 0.2 calc(var(--pv-hue, 282) + 50)));
+}
+.pv-fx { z-index: 5; }
+.pv[data-playing] .pv-layer, .pv[data-playing] .pv-cam { will-change: transform; }
+
+/* Timing profiles */
+.pv[data-playing] .pv-cam { animation: pv-t-up var(--pv-dur, 3s) cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
+.pv[data-playing][data-profile="ease-rev"] .pv-cam { animation-name: pv-t-down; }
+.pv[data-playing][data-profile="slow"] .pv-cam { animation-timing-function: ease-in-out; }
+.pv[data-playing][data-profile="loop"] .pv-cam { animation: pv-t-up var(--pv-dur, 3s) linear infinite; }
+.pv[data-playing][data-profile="crash"] .pv-cam { animation: pv-t-crash var(--pv-dur, 2.4s) linear infinite; }
+.pv[data-playing][data-profile="crash-rev"] .pv-cam { animation: pv-t-crash-rev var(--pv-dur, 2.4s) linear infinite; }
+.pv[data-playing][data-profile="yoyo"] .pv-cam { animation: pv-t-yoyo var(--pv-dur, 3s) ease-in-out infinite; }
+.pv[data-playing][data-profile="whip"] .pv-cam { animation: pv-t-whip var(--pv-dur, 2.6s) ease-in-out infinite; }
+.pv[data-playing]:not([data-profile]) .pv-cam { animation: none; }
+@keyframes pv-t-up { from { --pv-t: 0; } to { --pv-t: 1; } }
+@keyframes pv-t-down { from { --pv-t: 1; } to { --pv-t: 0; } }
+@keyframes pv-t-crash {
+ 0%, 24% { --pv-t: 0; animation-timing-function: cubic-bezier(0.8, 0, 0.9, 0.5); }
+ 36%, 80% { --pv-t: 1; animation-timing-function: ease-in-out; }
+ 100% { --pv-t: 0; }
+}
+@keyframes pv-t-crash-rev {
+ 0%, 24% { --pv-t: 1; animation-timing-function: cubic-bezier(0.8, 0, 0.9, 0.5); }
+ 36%, 80% { --pv-t: 0; animation-timing-function: ease-in-out; }
+ 100% { --pv-t: 1; }
+}
+@keyframes pv-t-yoyo { 0%, 100% { --pv-t: 0; } 28% { --pv-t: 1; } 50% { --pv-t: 0.3; } 74% { --pv-t: 1; } }
+@keyframes pv-t-whip { 0%, 28% { --pv-t: 0; } 40%, 68% { --pv-t: 1; } 80%, 100% { --pv-t: 0; } }
+
+/* Camera-wide extras */
+.pv[data-playing][data-stage="handheld"] .pv-shake { animation: pv-handheld 2.1s ease-in-out infinite; }
+.pv[data-playing][data-stage="walk"] .pv-shake { animation: pv-walk 0.9s ease-in-out infinite; }
+.pv[data-playing][data-stage="bank"] .pv-shake { animation: pv-bank 2.2s ease-in-out infinite alternate; }
+.pv[data-playing][data-stage="impact"] .pv-shake { animation: pv-impact var(--pv-dur, 1.4s) linear infinite; }
+.pv[data-playing][data-stage="float"] .pv-shake { animation: pv-float 2.6s ease-in-out infinite; }
+.pv[data-playing][data-stage="flicker"] .pv-shake { animation: pv-flicker 1.2s steps(1) infinite; }
+.pv[data-playing][data-stage="rack"] .pv-l-bg, .pv[data-playing][data-stage="rack"] .pv-l-mid { animation: pv-blur-in var(--pv-dur, 3s) ease-in-out infinite alternate; }
+.pv[data-playing][data-stage="rack"] .pv-l-subject, .pv[data-playing][data-stage="rack"] .pv-l-fg { animation: pv-blur-out var(--pv-dur, 3s) ease-in-out infinite alternate; }
+/* Subject-only extras use the individual translate/scale properties, so they add to the move. */
+.pv[data-playing][data-stage="bounce"] .pv-l-subject { animation: pv-bounce 1.3s cubic-bezier(0.3, 0, 0.3, 1) infinite; }
+.pv[data-playing][data-stage="slide"] .pv-l-subject { animation: pv-slide var(--pv-dur, 3s) ease-in-out infinite alternate; }
+.pv[data-playing][data-stage="turn"] .pv-l-subject { animation: pv-turn 2.4s ease-in-out infinite; }
+.pv[data-playing][data-through] .pv-l-fg { animation: pv-through var(--pv-dur, 3s) cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
+.pv[data-playing][data-profile="ease-rev"][data-through] .pv-l-fg { animation-direction: alternate-reverse; }
+@keyframes pv-handheld {
+ 0%, 100% { translate: 0 0; rotate: 0deg; }
+ 18% { translate: -0.9% 0.6%; rotate: -0.5deg; }
+ 37% { translate: 0.7% -0.4%; rotate: 0.4deg; }
+ 56% { translate: -0.4% -0.8%; rotate: -0.25deg; }
+ 77% { translate: 0.9% 0.5%; rotate: 0.5deg; }
+}
+@keyframes pv-walk { 0%, 50%, 100% { translate: 0 0; } 25%, 75% { translate: 0 -1.1%; } }
+@keyframes pv-bank { from { rotate: -5deg; } to { rotate: 5deg; } }
+@keyframes pv-impact {
+ 0%, 30%, 52%, 100% { translate: 0 0; }
+ 34% { translate: -2.2% 1%; } 38% { translate: 2% -1.2%; } 42% { translate: -1.4% 0.8%; } 47% { translate: 0.9% -0.5%; }
+}
+@keyframes pv-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -1.6%; } }
+@keyframes pv-flicker { 0%, 100% { filter: none; } 20% { filter: brightness(1.18); } 45% { filter: brightness(0.92); } 70% { filter: brightness(1.1); } }
+@keyframes pv-blur-in { from { filter: blur(0); } to { filter: blur(3px); } }
+@keyframes pv-blur-out { from { filter: blur(3px); } to { filter: blur(0); } }
+@keyframes pv-bounce { 0%, 100% { translate: 0 0; } 42%, 58% { translate: 0 -8%; } }
+@keyframes pv-slide { from { translate: 0 0; } to { translate: calc(var(--pv-tx, 6) * -1.5%) 0; } }
+@keyframes pv-turn { 0%, 100% { scale: 1 1; } 50% { scale: 0.86 1; } }
+@keyframes pv-through { 0% { opacity: 1; } 70% { opacity: 0.25; } 100% { opacity: 0; } }
+
+/* ----- Treatments (effects and apps) ----- */
+.pv-spark {
+ --x: calc(12% + mod(var(--i) * 37, 76) * 1%);
+ --y: calc(14% + mod(var(--i) * 53, 64) * 1%);
+ left: var(--x); top: var(--y); width: 10px; height: 10px; margin: -5px;
+ background: radial-gradient(circle, #fff 0 18%, oklch(0.95 0.08 90 / 0.8) 30%, transparent 62%);
+ clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
+ opacity: 0.75; scale: 0.7;
+}
+.pv[data-playing] .pv-spark { animation: pv-twinkle 1.4s ease-in-out infinite; animation-delay: calc(var(--i) * -0.23s); }
+@keyframes pv-twinkle { 0%, 100% { opacity: 0; scale: 0.3; } 50% { opacity: 1; scale: 1.15; } }
+.pv[data-fx="sparkle"] .pv-spark { width: 12px; height: 12px; }
+.pv[data-playing][data-fx="sparkle"] .pv-spark { animation: pv-twinkle 1.4s ease-in-out infinite, pv-fall 2.8s linear infinite; animation-delay: calc(var(--i) * -0.31s); }
+@keyframes pv-fall { from { translate: 0 -30%; } to { translate: 0 260%; } }
+
+.pv-fire {
+ left: -10%; right: -10%; bottom: -12%; height: 64%; transform-origin: 50% 100%;
+ background:
+ radial-gradient(45% 75% at 28% 100%, #fff1a8 0, #ffb13b 30%, #ff5a1f 55%, transparent 72%),
+ radial-gradient(40% 70% at 72% 100%, #ffe58a 0, #ff8a2a 34%, #ff3d1f 58%, transparent 74%);
+ mix-blend-mode: screen; filter: blur(3px); opacity: 0.9;
+}
+.pv-fire-2 { height: 48%; opacity: 0.75; scale: -1 1; }
+.pv[data-playing] .pv-fire { animation: pv-flame 0.55s ease-in-out infinite alternate; }
+.pv[data-playing] .pv-fire-2 { animation-duration: 0.42s; animation-delay: -0.2s; }
+@keyframes pv-flame { from { transform: scale(1, 0.9) skewX(-3deg); } to { transform: scale(1.05, 1.15) skewX(3deg); } }
+.pv[data-fx="fire"] .pv-spark { top: auto; bottom: 10%; background: radial-gradient(circle, #ffe9a0 0 25%, #ff7a2a 45%, transparent 65%); clip-path: none; }
+.pv[data-playing][data-fx="fire"] .pv-spark { animation: pv-ember 1.6s ease-out infinite; animation-delay: calc(var(--i) * -0.33s); }
+@keyframes pv-ember { from { translate: 0 0; opacity: 1; } to { translate: 12px -120px; opacity: 0; } }
+
+.pv-wave { left: -60%; width: 220%; aspect-ratio: 1; top: 64%; border-radius: 43%; background: oklch(0.62 0.13 230 / 0.55); }
+.pv-wave-2 { top: 70%; border-radius: 40%; background: oklch(0.72 0.12 210 / 0.5); rotate: 40deg; }
+.pv[data-playing] .pv-wave { animation: pv-spin 5s linear infinite; }
+.pv[data-playing] .pv-wave-2 { animation-duration: 3.6s; animation-direction: reverse; }
+.pv[data-playing][data-fx="water"] .pv-fx { animation: pv-rise 3s ease-in-out infinite alternate; }
+@keyframes pv-spin { to { rotate: 360deg; } }
+@keyframes pv-rise { from { translate: 0 6%; } to { translate: 0 -14%; } }
+
+.pv-frost { inset: 0; background: radial-gradient(ellipse at center, transparent 38%, oklch(0.93 0.05 220 / 0.55) 72%, oklch(0.97 0.03 220 / 0.92) 100%); mix-blend-mode: screen; }
+.pv[data-fx="ice"] .pv-cam { filter: saturate(0.75) hue-rotate(-12deg); }
+.pv[data-playing] .pv-frost { animation: pv-freeze 2.6s ease-in-out infinite alternate; }
+@keyframes pv-freeze { from { opacity: 0.25; scale: 1.25; } to { opacity: 1; scale: 1; } }
+
+.pv-streaks {
+ top: 0; bottom: 0; left: -100%; width: 300%;
+ background: repeating-linear-gradient(98deg, transparent 0 22px, oklch(1 0 0 / 0.38) 22px 24px, transparent 24px 58px, oklch(1 0 0 / 0.22) 58px 59px, transparent 59px 90px);
+ mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
+}
+.pv[data-playing] .pv-streaks { animation: pv-gust 0.9s linear infinite; }
+@keyframes pv-gust { to { translate: 33.33% 0; } }
+
+.pv-bolt { position: absolute; left: 54%; top: -4%; width: 18%; height: 72%; fill: #f4f7ff; filter: drop-shadow(0 0 6px #9fc4ff); opacity: 0; }
+.pv-flash { inset: 0; background: #fff; opacity: 0; mix-blend-mode: soft-light; }
+.pv[data-fx="lightning"] .pv-bolt { opacity: 0.85; }
+.pv[data-playing][data-fx="lightning"] .pv-bolt { animation: pv-strike 2.2s steps(1) infinite; }
+.pv[data-playing][data-fx="lightning"] .pv-flash, .pv[data-playing][data-fx="explode"] .pv-flash { animation: pv-strike 2.2s steps(1) infinite; }
+@keyframes pv-strike { 0%, 100% { opacity: 0; } 8% { opacity: 1; } 12% { opacity: 0; } 16% { opacity: 0.8; } 22% { opacity: 0; } }
+
+.pv-burst {
+ left: 50%; top: 52%; width: 120%; aspect-ratio: 1; translate: -50% -50%; scale: 0.55; border-radius: 50%;
+ background: radial-gradient(circle, #fffbe0 0, #ffd166 18%, #ff7b2e 36%, oklch(0.5 0.2 30 / 0.6) 52%, transparent 66%);
+ mix-blend-mode: screen; opacity: 0.85;
+}
+.pv[data-playing][data-fx="explode"] .pv-burst { animation: pv-boom 2.2s cubic-bezier(0.2, 0.7, 0.3, 1) infinite; }
+.pv[data-playing][data-fx="explode"] .pv-shake { animation: pv-impact 2.2s linear infinite; }
+@keyframes pv-boom { 0%, 6% { scale: 0.05; opacity: 1; } 40% { scale: 1.1; opacity: 0.9; } 80%, 100% { scale: 1.5; opacity: 0; } }
+
+.pv-halo { left: 50%; top: 46%; width: 80%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, oklch(0.98 0.06 90 / 0.8), oklch(0.9 0.12 80 / 0.35) 40%, transparent 68%); mix-blend-mode: screen; }
+.pv[data-playing] .pv-halo { animation: pv-pulse 1.8s ease-in-out infinite; }
+@keyframes pv-pulse { 0%, 100% { opacity: 0.55; scale: 0.9; } 50% { opacity: 1; scale: 1.12; } }
+
+.pv-petal { left: calc(8% + mod(var(--i) * 29, 84) * 1%); top: calc(-6% + mod(var(--i) * 41, 70) * 1%); width: 9px; height: 6px; border-radius: 60% 0 60% 0; background: oklch(0.86 0.09 355); rotate: calc(var(--i) * 47deg); opacity: 0.9; }
+.pv[data-playing] .pv-petal { animation: pv-drift 3.2s linear infinite; animation-delay: calc(var(--i) * -0.4s); }
+@keyframes pv-drift { from { translate: -10px -40px; rotate: 0deg; } to { translate: 30px 260px; rotate: 300deg; } }
+
+.pv-shade { inset: 0; background: oklch(0.15 0.03 280 / 0.45); mix-blend-mode: multiply; }
+.pv-light { left: 0; top: 0; width: 90%; aspect-ratio: 1; translate: -30% -25%; border-radius: 50%; background: radial-gradient(circle, oklch(0.97 0.08 75 / 0.9), oklch(0.85 0.12 60 / 0.3) 45%, transparent 70%); mix-blend-mode: screen; }
+.pv[data-playing] .pv-light { animation: pv-sweep 3.2s ease-in-out infinite alternate; }
+@keyframes pv-sweep { from { translate: -30% -25%; } to { translate: 45% 10%; } }
+
+.pv-vignette { inset: 0; background: radial-gradient(ellipse at center, transparent 30%, oklch(0.1 0.02 20 / 0.85) 95%); }
+.pv-blood { inset: 0; background: oklch(0.45 0.2 25 / 0.35); mix-blend-mode: multiply; opacity: 0.6; }
+.pv[data-playing] .pv-vignette { animation: pv-pulse 1.1s ease-in-out infinite; }
+.pv[data-playing] .pv-blood { animation: pv-strike 1.8s steps(1) infinite; }
+.pv[data-playing][data-fx="dark"] .pv-shake { animation: pv-handheld 0.8s linear infinite; }
+
+.pv-flare { left: -30%; top: 30%; width: 160%; height: 26%; background: radial-gradient(closest-side, oklch(1 0 0 / 0.95), oklch(0.85 0.1 220 / 0.55) 18%, transparent 65%), linear-gradient(to bottom, transparent 46%, oklch(0.9 0.1 210 / 0.75) 50%, transparent 54%); mix-blend-mode: screen; translate: -18% 0; }
+.pv-flash-soft { background: oklch(0.95 0.06 220); }
+.pv[data-playing] .pv-flare { animation: pv-glide 2.4s ease-in-out infinite alternate; }
+.pv[data-playing][data-fx="flare"] .pv-flash { animation: pv-strike 2.4s steps(1) infinite; }
+@keyframes pv-glide { from { translate: -22% 0; } to { translate: 22% 0; } }
+
+/* Wipes between the original and a treated copy; the seam rides the edge. */
+.pv-wipe-h { clip-path: inset(0 0 0 var(--w, 50%)); }
+.pv-wipe-v { clip-path: inset(var(--w, 50%) 0 0 0); }
+.pv-halftone { position: absolute; inset: 0; display: block; }
+.pv-halftone::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, oklch(0.2 0.02 280 / 0.45) 0 1.1px, transparent 1.6px) 0 0 / 6px 6px; mix-blend-mode: multiply; }
+.pv-inked { filter: grayscale(1) contrast(1.7) brightness(1.05); }
+.pv-graded { filter: sepia(0.45) saturate(1.7) hue-rotate(calc(var(--pv-hue, 282) * 1deg - 30deg)) contrast(1.1); }
+.pv-soft { filter: blur(3px) saturate(0.7) brightness(0.95); }
+.pv-morph { filter: hue-rotate(150deg) saturate(1.6) contrast(1.15) brightness(1.05); }
+.pv-recolor { filter: hue-rotate(calc(var(--pv-hue, 282) * 1deg)) saturate(1.4); }
+.pv-seam { background: oklch(1 0 0 / 0.9); box-shadow: 0 0 10px oklch(1 0 0 / 0.8); }
+.pv-seam-v { top: 0; bottom: 0; width: 2px; left: var(--w, 50%); }
+.pv-seam-h { left: 0; right: 0; height: 2px; top: var(--w, 50%); }
+.pv-knob::after { content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; translate: -50% -50%; border-radius: 9999px; background: #fff; box-shadow: 0 1px 4px oklch(0 0 0 / 0.35); }
+@property --w { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
+.pv[data-fx] .pv-fx { --w: 50%; }
+.pv[data-fx="wipe"] .pv-fx { --w: 62%; }
+.pv[data-playing] .pv-fx:has(.pv-seam) { animation: pv-wipe 3s ease-in-out infinite alternate; }
+@keyframes pv-wipe { from { --w: 100%; } to { --w: 0%; } }
+
+.pv-rgb { filter: drop-shadow(3px 0 0 oklch(0.65 0.25 20 / 0.7)) drop-shadow(-3px 0 0 oklch(0.8 0.15 200 / 0.7)); opacity: 0.6; mix-blend-mode: screen; }
+.pv-slice { clip-path: inset(38% 0 48% 0); translate: 4% 0; }
+.pv-slice-2 { clip-path: inset(66% 0 22% 0); translate: -3% 0; }
+.pv[data-playing] .pv-slice { animation: pv-jitter 0.6s steps(2) infinite; }
+.pv[data-playing] .pv-slice-2 { animation-duration: 0.45s; animation-direction: reverse; }
+.pv[data-playing] .pv-rgb { animation: pv-strike 1.2s steps(1) infinite; }
+@keyframes pv-jitter { 0% { translate: 5% 0; } 25% { translate: -4% 0; } 50% { translate: 2% 0; } 75% { translate: -6% 0; } 100% { translate: 3% 0; } }
+
+.pv-ring { inset: 0; box-shadow: inset 0 0 0 999px oklch(0.15 0.02 280 / 0); }
+.pv[data-playing][data-fx="tiny"] .pv-cam { animation: pv-planet 3.2s ease-in-out infinite alternate; }
+@keyframes pv-planet { from { clip-path: circle(80% at 50% 50%); scale: 1; rotate: 0deg; } to { clip-path: circle(36% at 50% 50%); scale: 0.92; rotate: -25deg; } }
+
+.pv-grid { inset: 0; opacity: 0.25; background: linear-gradient(oklch(0.85 0.12 200 / 0.6) 1px, transparent 1px) 0 0 / 100% 14px, linear-gradient(90deg, oklch(0.85 0.12 200 / 0.6) 1px, transparent 1px) 0 0 / 14px 100%; mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 60%); }
+.pv-scanline { left: 0; right: 0; top: 38%; height: 3px; background: oklch(0.85 0.15 200); box-shadow: 0 0 12px 3px oklch(0.8 0.15 200 / 0.7); }
+.pv[data-playing] .pv-scanline { animation: pv-scan 1.8s ease-in-out infinite alternate; }
+@keyframes pv-scan { from { top: 14%; } to { top: 82%; } }
+.pv-brackets { left: 30%; right: 30%; top: 16%; bottom: 30%; --c: oklch(1 0 0 / 0.9); background: linear-gradient(var(--c), var(--c)) 0 0 / 14px 2px, linear-gradient(var(--c), var(--c)) 0 0 / 2px 14px, linear-gradient(var(--c), var(--c)) 100% 0 / 14px 2px, linear-gradient(var(--c), var(--c)) 100% 0 / 2px 14px, linear-gradient(var(--c), var(--c)) 0 100% / 14px 2px, linear-gradient(var(--c), var(--c)) 0 100% / 2px 14px, linear-gradient(var(--c), var(--c)) 100% 100% / 14px 2px, linear-gradient(var(--c), var(--c)) 100% 100% / 2px 14px; background-repeat: no-repeat; }
+.pv-brackets-wide { left: 10%; right: 10%; top: 12%; bottom: 12%; }
+.pv[data-playing] .pv-brackets-wide { animation: pv-frame 2.6s ease-in-out infinite alternate; }
+.pv[data-playing][data-fx="frame"] .pv-cam { animation: pv-push 2.6s ease-in-out infinite alternate; }
+@keyframes pv-frame { from { inset: 12% 10%; } to { inset: 24% 24%; } }
+@keyframes pv-push { from { scale: 1; } to { scale: 1.18; } }
+.pv-rec { left: 13%; top: 15%; width: 7px; height: 7px; border-radius: 9999px; background: oklch(0.63 0.24 25); box-shadow: 0 0 6px oklch(0.63 0.24 25); }
+.pv[data-playing] .pv-rec { animation: pv-strike 1s steps(1) infinite reverse; }
+
+.pv-shine { top: -20%; bottom: -20%; width: 28%; left: 10%; rotate: 18deg; background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.55), transparent); mix-blend-mode: soft-light; }
+.pv[data-playing] .pv-shine { animation: pv-shine 2.2s ease-in-out infinite; }
+.pv[data-playing][data-fx="shine"] .pv-cam { animation: pv-push 4.4s ease-in-out infinite alternate; }
+@keyframes pv-shine { 0% { left: -40%; } 60%, 100% { left: 120%; } }
+
+.pv-progress { left: 8%; right: 8%; bottom: 9%; height: 3px; border-radius: 9999px; background: linear-gradient(90deg, #fff var(--p, 32%), oklch(1 0 0 / 0.35) var(--p, 32%)); }
+.pv-play { left: 50%; top: 46%; width: 30px; height: 30px; translate: -50% -50%; border-radius: 9999px; background: oklch(0 0 0 / 0.35) linear-gradient(#fff, #fff) 55% 50% / 0 0 no-repeat; }
+.pv-play::after { content: ""; position: absolute; left: 12px; top: 9px; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
+@property --p { syntax: "<percentage>"; inherits: true; initial-value: 32%; }
+.pv[data-playing] .pv-progress { animation: pv-progress 3.2s linear infinite; }
+.pv[data-playing] .pv-play { opacity: 0; transition: opacity 200ms; }
+.pv[data-playing][data-fx="play"] .pv-cam { animation: pv-push 3.2s ease-in-out infinite alternate; }
+@keyframes pv-progress { from { --p: 0%; } to { --p: 100%; } }
+
+.pv[data-playing][data-fx="pop"] .pv-cam { animation: pv-pop 1.6s cubic-bezier(0.3, 1.4, 0.5, 1) infinite; }
+.pv[data-playing][data-fx="morph"] .pv-cam, .pv[data-playing][data-fx="glow"] .pv-cam { animation: pv-push 3s ease-in-out infinite alternate; }
+@keyframes pv-pop { 0%, 100% { scale: 1; } 30% { scale: 1.1; } 55% { scale: 1.03; } }
+
+@media (prefers-reduced-motion: reduce) {
+ .pv, .pv * { animation: none !important; transition: none !important; }
+}
diff --git a/src/components/home-view.tsx b/src/components/home-view.tsx
index a621a481..2e29af81 100644
--- a/src/components/home-view.tsx
+++ b/src/components/home-view.tsx
@@ -3,25 +3,35 @@
import Link from "next/link";
import { ArrowRight, AudioLines, Film, ImageIcon, Mic2, ScanFace, Sparkles, Video, Wand2, ZoomIn } from "lucide-react";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { lazy, Suspense, useState } from "react";
import { PageShell } from "@/components/page-shell";
import { PresetCard } from "@/components/preset-gallery";
-import { Feed } from "@/components/studio/feed";
-import { APPS, EFFECTS, MOTIONS } from "@/lib/catalog";
+import { Skeleton } from "@/components/ui/skeleton";
import { useEngine, useGenerations, useStatus } from "@/lib/api";
import { EngineSwitch } from "@/components/studio/engine-switch";
+import type { PresetCardData } from "@/lib/preset-cards";
import { cn } from "@/lib/utils";
+// The feed (and the viewer behind it) is only needed once there is something recent to show.
+const Feed = lazy(() => import("@/components/studio/feed").then((m) => ({ default: m.Feed })));
+
const MODES = [
{ id: "image", label: "Image", icon: ImageIcon, href: "/image", placeholder: "Describe an image…" },
{ id: "video", label: "Video", icon: Video, href: "/video", placeholder: "Describe a shot…" },
{ id: "edit", label: "Edit", icon: Wand2, href: "/edit", placeholder: "Describe a change (you'll add the image next)…" },
];
-const TOOLS = [
- { href: "/motions", label: "Camera motions", desc: `${MOTIONS.length} director moves`, icon: Film, hue: 280 },
- { href: "/effects", label: "Effects", desc: `${EFFECTS.length} viral VFX`, icon: Sparkles, hue: 20 },
- { href: "/apps", label: "Apps", desc: `${APPS.length} one-click tools`, icon: Wand2, hue: 200 },
+interface Counts {
+ motions: number;
+ effects: number;
+ apps: number;
+}
+
+/** Tool tiles. Append one entry per new destination; the grid fits any count. */
+const tools = (c: Counts) => [
+ { href: "/motions", label: "Camera motions", desc: `${c.motions} director moves`, icon: Film, hue: 280 },
+ { href: "/effects", label: "Effects", desc: `${c.effects} viral VFX`, icon: Sparkles, hue: 20 },
+ { href: "/apps", label: "Apps", desc: `${c.apps} one-click tools`, icon: Wand2, hue: 200 },
{ href: "/lipsync", label: "Lipsync", desc: "Talking avatars", icon: Mic2, hue: 150 },
{ href: "/elements", label: "Elements", desc: "@ characters, places, props", icon: ScanFace, hue: 320 },
{ href: "/upscale", label: "Upscale", desc: "Images & video", icon: ZoomIn, hue: 240 },
@@ -42,7 +52,17 @@ function Row({ title, href, children }: { title: string; href: string; children:
);
}
-export function HomeView() {
+function CardRow({ cards, href }: { cards: PresetCardData[]; href: (c: PresetCardData) => string }) {
+ return (
+ <div className="grid grid-cols-2 gap-1 sm:grid-cols-4 lg:grid-cols-6">
+ {cards.map((p) => (
+ <PresetCard key={p.id} preset={p} href={href(p)} compact />
+ ))}
+ </div>
+ );
+}
+
+export function HomeView({ counts, motions, apps, effects }: { counts: Counts; motions: PresetCardData[]; apps: PresetCardData[]; effects: PresetCardData[] }) {
const router = useRouter();
const [mode, setMode] = useState(MODES[0]);
const [prompt, setPrompt] = useState("");
@@ -71,34 +91,40 @@ export function HomeView() {
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
onKeyDown={(e) => {
- if (e.key === "Enter" && !e.shiftKey) {
+ if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
e.preventDefault();
go();
}
}}
rows={2}
autoFocus
+ aria-label="Describe what to create"
placeholder={mode.placeholder}
className="field-sizing-content max-h-48 min-h-14 w-full resize-none bg-transparent px-2.5 py-1.5 text-base outline-none placeholder:text-subtle-foreground"
/>
<div className="flex items-center gap-1.5">
- {MODES.map((m) => (
- <button
- key={m.id}
- onClick={() => setMode(m)}
- className={cn(
- "inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] font-medium transition-colors",
- mode.id === m.id ? "bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent",
- )}
- >
- <m.icon className="size-3.5" /> {m.label}
- </button>
- ))}
+ <div role="radiogroup" aria-label="What to make" className="flex min-w-0 items-center gap-1">
+ {MODES.map((m) => (
+ <button
+ key={m.id}
+ type="button"
+ role="radio"
+ aria-checked={mode.id === m.id}
+ onClick={() => setMode(m)}
+ className={cn(
+ "inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] font-medium whitespace-nowrap transition-colors",
+ mode.id === m.id ? "bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent",
+ )}
+ >
+ <m.icon className="size-3.5" /> {m.label}
+ </button>
+ ))}
+ </div>
<div className="ml-auto flex items-center gap-2">
<span className="hidden sm:block">
<EngineSwitch value={engine} onChange={setEngine} size="sm" />
</span>
- <button onClick={go} className="grid size-10 place-items-center rounded-full bg-primary text-primary-foreground transition hover:opacity-90" aria-label="Start">
+ <button onClick={go} className="grid size-10 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground transition hover:opacity-90" aria-label="Start">
<ArrowRight className="size-4" />
</button>
</div>
@@ -115,14 +141,14 @@ export function HomeView() {
)}
</div>
- <div className="mt-14 grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7">
- {TOOLS.map((t) => (
- <Link key={t.href} href={t.href} className="group flex flex-col gap-2 rounded-xl border bg-background p-3 transition-colors hover:bg-accent">
+ <div className="mt-14 grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-[repeat(auto-fit,minmax(128px,1fr))]">
+ {tools(counts).map((t) => (
+ <Link key={t.href} href={t.href} className="group flex min-w-0 flex-col gap-2 rounded-xl border bg-background p-3 transition-colors hover:bg-accent">
<span className="grid size-9 place-items-center rounded-lg text-white" style={{ background: `linear-gradient(135deg, oklch(0.75 0.15 ${t.hue}), oklch(0.55 0.2 ${t.hue + 40}))` }}>
<t.icon className="size-4 transition-transform group-hover:scale-110" />
</span>
- <span>
- <span className="block text-[13px] font-medium">{t.label}</span>
+ <span className="min-w-0">
+ <span className="block truncate text-[13px] font-medium">{t.label}</span>
<span className="block text-[12px] text-muted-foreground">{t.desc}</span>
</span>
</Link>
@@ -132,29 +158,26 @@ export function HomeView() {
<div className="mt-14 space-y-12">
{!!recent.data?.length && (
<Row title="Recent" href="/library">
- <Feed items={recent.data.slice(0, 3)} />
+ <Suspense
+ fallback={
+ <div className="flex gap-2">
+ <Skeleton className="h-56 w-56 rounded-xl" />
+ <Skeleton className="h-56 w-56 rounded-xl" />
+ </div>
+ }
+ >
+ <Feed items={recent.data.slice(0, 3)} />
+ </Suspense>
</Row>
)}
<Row title="Camera motions" href="/motions">
- <div className="grid grid-cols-2 gap-1 sm:grid-cols-4 lg:grid-cols-6">
- {MOTIONS.filter((m) => ["motion-crash-zoom-in", "motion-360-orbit", "motion-bullet-time", "motion-fpv-drone", "motion-dolly-zoom-in", "motion-snorricam"].includes(m.id)).map((p) => (
- <PresetCard key={p.id} preset={p} href={`/video?preset=${p.id}`} compact />
- ))}
- </div>
+ <CardRow cards={motions} href={(p) => `/video?preset=${p.id}`} />
</Row>
<Row title="Popular apps" href="/apps">
- <div className="grid grid-cols-2 gap-1 sm:grid-cols-4 lg:grid-cols-6">
- {APPS.slice(0, 12).filter((a) => a.badges?.includes("top") || a.category === "Camera").slice(0, 6).map((p) => (
- <PresetCard key={p.id} preset={p} href={`/apps/${p.id}`} compact />
- ))}
- </div>
+ <CardRow cards={apps} href={(p) => `/apps/${p.id}`} />
</Row>
<Row title="Effects" href="/effects">
- <div className="grid grid-cols-2 gap-1 sm:grid-cols-4 lg:grid-cols-6">
- {EFFECTS.slice(0, 6).map((p) => (
- <PresetCard key={p.id} preset={p} href={`/video?preset=${p.id}`} compact />
- ))}
- </div>
+ <CardRow cards={effects} href={(p) => `/video?preset=${p.id}`} />
</Row>
</div>
</PageShell>
diff --git a/src/components/page-shell.tsx b/src/components/page-shell.tsx
index 5b72fc94..b841b356 100644
--- a/src/components/page-shell.tsx
+++ b/src/components/page-shell.tsx
@@ -1,13 +1,26 @@
import { SidebarTrigger } from "@/components/ui/sidebar";
+import { cn } from "@/lib/utils";
/** Scrollable page body for non-studio pages (galleries, settings, library). */
export function PageShell({ children, wide }: { children: React.ReactNode; wide?: boolean }) {
return (
- <div className="flex min-h-svh flex-col">
- <div className="sticky top-0 z-20 flex h-12 items-center px-3 md:hidden">
+ <div className="flex min-h-svh min-w-0 flex-col">
+ <div className="sticky top-0 z-20 flex h-12 items-center bg-background/85 px-3 backdrop-blur md:hidden">
<SidebarTrigger />
</div>
- <div className={`mx-auto w-full flex-1 px-4 pt-4 pb-16 sm:px-8 md:pt-12 ${wide ? "max-w-[1400px]" : "max-w-[1200px]"}`}>{children}</div>
+ <div className={cn("mx-auto w-full min-w-0 flex-1 px-4 pt-4 pb-16 sm:px-8 md:pt-12", wide ? "max-w-[1400px]" : "max-w-[1200px]")}>{children}</div>
+ </div>
+ );
+}
+
+export function PageHeader({ title, description, children }: { title: string; description?: React.ReactNode; children?: React.ReactNode }) {
+ return (
+ <div className="flex flex-wrap items-end justify-between gap-4 pb-6">
+ <div className="min-w-0">
+ <h1 className="font-heading text-[34px] leading-tight">{title}</h1>
+ {description && <p className="mt-1 max-w-2xl text-[15px] text-muted-foreground">{description}</p>}
+ </div>
+ {children}
</div>
);
}
diff --git a/src/components/preset-gallery.tsx b/src/components/preset-gallery.tsx
index 705645cf..6ab77b7a 100644
--- a/src/components/preset-gallery.tsx
+++ b/src/components/preset-gallery.tsx
@@ -1,77 +1,254 @@
"use client";
import Link from "next/link";
-import { Cloud, Cpu, Search, Sparkles } from "lucide-react";
-import { useMemo, useState } from "react";
+import { Cloud, Cpu, Lock, Search, Sparkles, X } from "lucide-react";
+import { memo, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
+import { PageHeader } from "@/components/page-shell";
import { PRESET_ICONS } from "@/components/preset-icons";
-import { useEngine } from "@/lib/api";
-import type { Preset } from "@/lib/catalog/types";
+import { PresetPreview, usePreviewPlayback } from "@/components/preset-preview";
+import { useEngineMode } from "@/lib/api";
+import { searchText, type PresetCardData } from "@/lib/preset-cards";
import { cn } from "@/lib/utils";
-export function PresetCard({ preset, href, compact }: { preset: Preset; href: string; compact?: boolean }) {
- const Icon = PRESET_ICONS[preset.look.icon] ?? Sparkles;
+export { PageHeader };
+
+/** A tiny label shown on hover/focus (CSS only: a gallery has hundreds of these). */
+function EngineChip({ engine }: { engine: "cloud" | "open" }) {
+ const label = engine === "cloud" ? "Runs on cloud models" : "Runs on open-source models";
+ const Icon = engine === "cloud" ? Cloud : Cpu;
+ return (
+ <span role="img" aria-label={label} className="group/eng pointer-events-auto relative grid size-5 place-items-center rounded-full bg-black/35 text-white">
+ <Icon className="size-3" />
+ <span
+ aria-hidden
+ className="pointer-events-none absolute right-0 bottom-full z-10 mb-1.5 rounded-md bg-tooltip px-2 py-1 text-[11px] whitespace-nowrap text-tooltip-foreground opacity-0 shadow-soft transition-opacity group-hover/eng:opacity-100"
+ >
+ {engine === "cloud" ? "Cloud" : "Open source"}
+ </span>
+ </span>
+ );
+}
+
+export const PresetCard = memo(function PresetCard({ preset, href, compact }: { preset: PresetCardData; href: string; compact?: boolean }) {
+ const Icon = PRESET_ICONS[preset.icon] ?? Sparkles;
+ const { ref, playing, handlers } = usePreviewPlayback<HTMLAnchorElement>(preset.id);
return (
<Link
+ ref={ref}
href={href}
- className="group flex flex-col gap-2 rounded-xl p-1.5 transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring"
+ {...handlers}
+ className="group/card flex min-w-0 flex-col gap-2 rounded-xl p-1.5 transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring"
>
- <div
- className={cn("relative grid place-items-center overflow-hidden rounded-lg text-white", compact ? "aspect-[4/3]" : "aspect-[4/3]")}
- style={{ background: `linear-gradient(135deg, ${preset.look.from}, ${preset.look.to})` }}
- >
- <div
- className="absolute inset-0 opacity-0 transition-opacity duration-500 group-hover:opacity-100"
- style={{ background: `radial-gradient(circle at 30% 20%, oklch(1 0 0 / 35%), transparent 60%)` }}
- />
- <Icon className="size-8 drop-shadow transition-transform duration-500 ease-enter group-hover:scale-125 group-hover:rotate-[-6deg]" />
- <div className="absolute right-1.5 bottom-1.5 flex gap-1">
- {preset.cloud && (
- <span className="grid size-5 place-items-center rounded-full bg-black/25 backdrop-blur" title="Cloud version">
- <Cloud className="size-3" />
- </span>
- )}
- {preset.open && (
- <span className="grid size-5 place-items-center rounded-full bg-black/25 backdrop-blur" title="Open-source version">
- <Cpu className="size-3" />
- </span>
- )}
- </div>
- {preset.badges?.includes("top") && (
+ <div className="relative aspect-[4/3] overflow-hidden rounded-lg bg-muted">
+ <PresetPreview preview={preset.preview} hue={preset.hue} playing={playing} />
+ <span className="pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-black/40 to-transparent" />
+ <span className="pointer-events-none absolute bottom-1.5 left-1.5 grid size-6 place-items-center rounded-md bg-black/30 text-white">
+ <Icon className="size-3.5" />
+ </span>
+ <span className="pointer-events-none absolute right-1.5 bottom-1.5 flex gap-1">
+ {preset.cloud && <EngineChip engine="cloud" />}
+ {preset.open && <EngineChip engine="open" />}
+ </span>
+ {preset.top && (
<span className="absolute top-1.5 left-1.5 rounded-[4px] bg-highlight px-1 text-[10px] font-semibold text-highlight-foreground">Popular</span>
)}
</div>
- <div className="px-0.5">
+ <div className="min-w-0 px-0.5">
<p className="truncate text-[13px] font-medium">{preset.name}</p>
{!compact && <p className="line-clamp-2 text-[12px] leading-snug text-muted-foreground">{preset.description}</p>}
</div>
</Link>
);
+});
+
+type RunsOn = "all" | "cloud" | "open";
+const RUNS_ON: { value: RunsOn; label: string; icon?: typeof Cloud }[] = [
+ { value: "all", label: "All" },
+ { value: "cloud", label: "Cloud", icon: Cloud },
+ { value: "open", label: "Open source", icon: Cpu },
+];
+
+/** "Runs on: All · Cloud · Open source", as a radio group with arrow-key support. */
+function RunsOnControl({ value, onChange, locked }: { value: RunsOn; onChange: (v: RunsOn) => void; locked?: "cloud" | "open" }) {
+ if (locked)
+ return (
+ <Link
+ href="/settings#engine"
+ className="inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-muted px-3 text-[13px] text-muted-foreground hover:text-foreground"
+ title="Set in Settings → Engine mode"
+ >
+ <Lock className="size-3.5" /> {locked === "open" ? "Open source only" : "Cloud only"}
+ </Link>
+ );
+ return (
+ <div className="flex shrink-0 items-center gap-2">
+ <span id="runs-on-label" className="text-[12px] whitespace-nowrap text-muted-foreground">
+ Runs on
+ </span>
+ <div
+ role="radiogroup"
+ aria-labelledby="runs-on-label"
+ className="flex h-9 items-center rounded-full bg-muted p-0.5"
+ onKeyDown={(e) => {
+ if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
+ e.preventDefault();
+ const i = RUNS_ON.findIndex((o) => o.value === value);
+ const next = RUNS_ON[(i + (e.key === "ArrowRight" ? 1 : RUNS_ON.length - 1)) % RUNS_ON.length];
+ onChange(next.value);
+ (e.currentTarget.querySelector(`[data-value="${next.value}"]`) as HTMLElement | null)?.focus();
+ }}
+ >
+ {RUNS_ON.map((o) => (
+ <button
+ key={o.value}
+ type="button"
+ role="radio"
+ aria-checked={value === o.value}
+ tabIndex={value === o.value ? 0 : -1}
+ data-value={o.value}
+ onClick={() => onChange(o.value)}
+ className={cn(
+ "inline-flex h-8 items-center gap-1.5 rounded-full px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:px-3",
+ value === o.value && "bg-background text-foreground shadow-soft",
+ )}
+ >
+ {o.icon && <o.icon className="size-3.5" />}
+ {o.label}
+ </button>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+/** Keeps data-fade-start / data-fade-end on a horizontal scroller in sync with its scroll position. */
+function useFadeEdges<T extends HTMLElement>() {
+ const ref = useRef<T>(null);
+ useEffect(() => {
+ const el = ref.current;
+ if (!el) return;
+ const update = () => {
+ el.toggleAttribute("data-fade-start", el.scrollLeft > 2);
+ el.toggleAttribute("data-fade-end", el.scrollLeft + el.clientWidth < el.scrollWidth - 2);
+ };
+ update();
+ el.addEventListener("scroll", update, { passive: true });
+ const ro = new ResizeObserver(update);
+ ro.observe(el);
+ return () => {
+ el.removeEventListener("scroll", update);
+ ro.disconnect();
+ };
+ }, []);
+ return ref;
}
-export function PresetGallery({ presets, href }: { presets: Preset[]; /** "{id}" is replaced with the preset id. */ href: string }) {
+const FIRST_PAGE = 30;
+const PAGE = 40;
+
+const GRID = "grid grid-cols-2 gap-1 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5";
+
+export function PresetGallery({
+ presets,
+ href,
+ noun = "presets",
+}: {
+ presets: PresetCardData[];
+ /** "{id}" is replaced with the preset id. */
+ href: string;
+ /** Plural shown in the result count, e.g. "effects". */
+ noun?: string;
+}) {
const [cat, setCat] = useState("All");
const [q, setQ] = useState("");
- const [engine, , mode] = useEngine();
- const [onlyEngineChoice, setOnlyEngine] = useState(false);
- // When the install is locked to one engine, only show presets that engine can run.
- const onlyEngine = mode !== "both" || onlyEngineChoice;
+ const [runsOnChoice, setRunsOn] = useState<RunsOn>("all");
+ const [shown, setShown] = useState(FIRST_PAGE);
+ // "both" until hydrated, so the server HTML and the first client render agree.
+ const mode = useEngineMode();
+ const locked = mode === "both" ? undefined : mode;
+ const runsOn: RunsOn = locked ?? runsOnChoice;
+ const query = useDeferredValue(q.trim().toLowerCase());
+
+ const index = useMemo(() => presets.map((p) => [p, searchText(p)] as const), [presets]);
const cats = useMemo(() => ["All", ...new Set(presets.map((p) => p.category))], [presets]);
- const list = presets.filter(
- (p) =>
- (cat === "All" || p.category === cat) &&
- (!q || `${p.name} ${p.description} ${p.category}`.toLowerCase().includes(q.toLowerCase())) &&
- (!onlyEngine || (engine === "open" ? p.open : p.cloud)),
+ const list = useMemo(
+ () =>
+ index
+ .filter(([p, text]) => (cat === "All" || p.category === cat) && (!query || text.includes(query)) && (runsOn === "all" || p[runsOn]))
+ .map(([p]) => p),
+ [index, cat, query, runsOn],
);
+ // A new filter starts from the first page again.
+ const filterKey = `${cat}|${query}|${runsOn}`;
+ const [lastKey, setLastKey] = useState(filterKey);
+ if (lastKey !== filterKey) {
+ setLastKey(filterKey);
+ setShown(FIRST_PAGE);
+ }
+
+ const more = useCallback(() => setShown((n) => n + PAGE), []);
+ const sentinel = useRef<HTMLButtonElement>(null);
+ const hasMore = shown < list.length;
+ useEffect(() => {
+ const el = sentinel.current;
+ if (!el || !hasMore || typeof IntersectionObserver === "undefined") return;
+ const io = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && more(), { rootMargin: "600px 0px" });
+ io.observe(el);
+ return () => io.disconnect();
+ }, [hasMore, more, shown]);
+
+ const strip = useFadeEdges<HTMLDivElement>();
+ const stale = q.trim().toLowerCase() !== query;
+
return (
<div className="space-y-4">
- <div className="flex flex-wrap items-center gap-2">
- <div className="scrollbar-none flex min-w-0 flex-1 gap-1 overflow-x-auto">
+ <div className="space-y-3">
+ <div className="flex flex-col gap-2 sm:flex-row sm:items-center">
+ <div className="relative w-full sm:w-80">
+ <Search className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
+ <input
+ type="search"
+ value={q}
+ onChange={(e) => setQ(e.target.value)}
+ placeholder={`Search ${presets.length} ${noun}`}
+ aria-label={`Search ${noun}`}
+ className="h-9 w-full rounded-full border bg-background pr-9 pl-9 text-[14px] outline-none placeholder:text-subtle-foreground focus:border-primary focus:ring-4 focus:ring-brand-faint [&::-webkit-search-cancel-button]:hidden"
+ />
+ {q && (
+ <button
+ type="button"
+ onClick={() => setQ("")}
+ className="absolute top-1/2 right-1.5 grid size-6 -translate-y-1/2 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground"
+ aria-label="Clear search"
+ >
+ <X className="size-3.5" />
+ </button>
+ )}
+ </div>
+ <div className="flex items-center justify-between gap-2 sm:ml-auto sm:justify-end">
+ <span className="order-last text-[12px] whitespace-nowrap text-muted-foreground tabular-nums sm:order-first sm:mr-2" aria-live="polite">
+ {list.length === presets.length ? `${presets.length} ${noun}` : `${list.length} of ${presets.length}`}
+ </span>
+ <RunsOnControl value={runsOn} onChange={setRunsOn} locked={locked} />
+ </div>
+ </div>
+ <div
+ ref={strip}
+ role="group"
+ aria-label="Categories"
+ className="fade-x scrollbar-none -mx-1 flex snap-x scroll-px-1 gap-1 overflow-x-auto px-1"
+ >
{cats.map((c) => (
<button
key={c}
- onClick={() => setCat(c)}
+ type="button"
+ aria-pressed={cat === c}
+ onClick={(e) => {
+ setCat(c);
+ e.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "smooth" });
+ }}
className={cn(
- "h-8 shrink-0 rounded-full px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
+ "h-8 shrink-0 snap-start rounded-full px-3 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
cat === c && "bg-secondary text-foreground",
)}
>
@@ -79,48 +256,72 @@ export function PresetGallery({ presets, href }: { presets: Preset[]; /** "{id}"
</button>
))}
</div>
- {mode === "both" && (
+ </div>
+ {list.length ? (
+ <>
+ <div className={cn(GRID, "transition-opacity", stale && "opacity-70")}>
+ {list.slice(0, shown).map((p) => (
+ <PresetCard key={p.id} preset={p} href={href.replace("{id}", p.id)} />
+ ))}
+ </div>
+ {hasMore && (
+ <div className="flex justify-center pt-2">
+ <button
+ ref={sentinel}
+ type="button"
+ onClick={more}
+ className="h-9 rounded-full border bg-background px-4 text-[13px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
+ >
+ Show more · {list.length - shown} left
+ </button>
+ </div>
+ )}
+ </>
+ ) : (
+ <div className="py-16 text-center">
+ <p className="font-heading text-[22px]">{query ? `No matches for “${q.trim()}”` : `No ${noun} here`}</p>
+ <p className="mt-1 text-[13px] text-muted-foreground">
+ {runsOn !== "all" && !locked ? "Try another engine, or clear the filters." : "Try another word or category."}
+ </p>
<button
- onClick={() => setOnlyEngine((v) => !v)}
- className={cn(
- "h-8 rounded-full border px-3 text-[13px] text-muted-foreground hover:bg-accent",
- onlyEngine && "border-primary bg-brand-faint text-brand-text",
- )}
+ type="button"
+ onClick={() => {
+ setQ("");
+ setCat("All");
+ if (!locked) setRunsOn("all");
+ }}
+ className="mt-4 h-8 rounded-full border px-3 text-[13px] font-medium hover:bg-accent"
>
- Only {engine === "open" ? "open source" : "cloud"}
+ Clear filters
</button>
- )}
- <div className="relative">
- <Search className="pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground" />
- <input
- value={q}
- onChange={(e) => setQ(e.target.value)}
- placeholder="Search"
- className="h-8 w-44 rounded-lg border bg-background pr-2 pl-8 text-sm outline-none focus:border-primary"
- />
</div>
- </div>
- {list.length ? (
- <div className="grid grid-cols-2 gap-1 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5">
- {list.map((p) => (
- <PresetCard key={p.id} preset={p} href={href.replace("{id}", p.id)} />
- ))}
- </div>
- ) : (
- <p className="py-16 text-center text-sm text-muted-foreground">No matches for “{q}”.</p>
)}
</div>
);
}
-export function PageHeader({ title, description, children }: { title: string; description?: string; children?: React.ReactNode }) {
+/** Skeleton for the gallery pages (loading.tsx). */
+export function PresetGallerySkeleton() {
return (
- <div className="flex flex-wrap items-end justify-between gap-4 pb-6">
- <div>
- <h1 className="font-heading text-[34px] leading-tight">{title}</h1>
- {description && <p className="mt-1 max-w-2xl text-[15px] text-muted-foreground">{description}</p>}
+ <div className="space-y-4" aria-hidden>
+ <div className="flex flex-col gap-2 sm:flex-row sm:items-center">
+ <div className="h-9 w-full animate-pulse rounded-full bg-muted sm:w-80" />
+ <div className="h-9 w-56 animate-pulse rounded-full bg-muted sm:ml-auto" />
+ </div>
+ <div className="flex gap-1 overflow-hidden">
+ {Array.from({ length: 9 }, (_, i) => (
+ <div key={i} className="h-8 w-20 shrink-0 animate-pulse rounded-full bg-muted" />
+ ))}
+ </div>
+ <div className={GRID}>
+ {Array.from({ length: 10 }, (_, i) => (
+ <div key={i} className="space-y-2 p-1.5">
+ <div className="aspect-[4/3] animate-pulse rounded-lg bg-muted" />
+ <div className="h-3.5 w-2/3 animate-pulse rounded bg-muted" />
+ <div className="h-3 w-full animate-pulse rounded bg-muted" />
+ </div>
+ ))}
</div>
- {children}
</div>
);
}
diff --git a/src/components/preset-preview.tsx b/src/components/preset-preview.tsx
new file mode 100644
index 00000000..0e563714
--- /dev/null
+++ b/src/components/preset-preview.tsx
@@ -0,0 +1,379 @@
+"use client";
+
+import { memo, useEffect, useRef, useState, useSyncExternalStore } from "react";
+import {
+ CAMERA_MOVES,
+ LAYER_DEPTH,
+ LAYER_OFFSET,
+ moveVars,
+ PREVIEW_LAYERS,
+ sceneLayer,
+ scenePoster,
+ type MoveSpec,
+ type PresetPreview as Preview,
+ type PreviewLayer,
+ type PreviewScene,
+} from "@/lib/preset-cards";
+
+/*
+ * Which preview plays. One at a time everywhere: the hovered or focused card on devices that can
+ * hover, otherwise the card nearest the middle of the screen while it's mostly in view (phones).
+ * Nothing plays when the user prefers reduced motion.
+ */
+type Listener = () => void;
+const listeners = new Set<Listener>();
+let active: string | null = null;
+const emit = () => listeners.forEach((l) => l());
+const subscribe = (l: Listener) => {
+ listeners.add(l);
+ return () => listeners.delete(l);
+};
+
+function setActive(id: string | null) {
+ if (active === id) return;
+ active = id;
+ emit();
+}
+
+const mq = (q: string) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
+const canHover = () => mq("(hover: hover) and (pointer: fine)");
+const reducedMotion = () => mq("(prefers-reduced-motion: reduce)");
+
+/** Touch devices: the most visible card closest to the viewport's middle plays. */
+const watched = new Map<Element, string>();
+const ratios = new Map<Element, number>();
+let observer: IntersectionObserver | null = null;
+let raf = 0;
+
+function pickCentered() {
+ raf = 0;
+ const mid = window.innerHeight / 2;
+ let best: string | null = null;
+ let bestDist = Infinity;
+ for (const [el, ratio] of ratios) {
+ if (ratio < 0.6) continue;
+ const r = el.getBoundingClientRect();
+ const dist = Math.abs(r.top + r.height / 2 - mid);
+ if (dist < bestDist) {
+ bestDist = dist;
+ best = watched.get(el) ?? null;
+ }
+ }
+ setActive(best);
+}
+
+const onScroll = () => {
+ raf ||= requestAnimationFrame(pickCentered);
+};
+
+function watch(el: Element, id: string) {
+ if (typeof IntersectionObserver === "undefined") return () => {};
+ observer ??= new IntersectionObserver(
+ (entries) => {
+ for (const e of entries) ratios.set(e.target, e.isIntersecting ? e.intersectionRatio : 0);
+ raf ||= requestAnimationFrame(pickCentered);
+ },
+ { threshold: [0, 0.6, 0.85, 1] },
+ );
+ if (!watched.size) window.addEventListener("scroll", onScroll, { passive: true, capture: true });
+ watched.set(el, id);
+ observer.observe(el);
+ return () => {
+ observer?.unobserve(el);
+ watched.delete(el);
+ ratios.delete(el);
+ if (!watched.size) window.removeEventListener("scroll", onScroll, { capture: true });
+ if (active === id) setActive(null);
+ };
+}
+
+/**
+ * Wire a card element to the playback store. Returns whether its preview should play and the
+ * handlers to spread on the card (hover and focus on desktop; touch devices use visibility).
+ */
+export function usePreviewPlayback<T extends HTMLElement>(id: string) {
+ const ref = useRef<T | null>(null);
+ const playing = useSyncExternalStore(
+ subscribe,
+ () => active === id,
+ () => false,
+ );
+ useEffect(() => {
+ const el = ref.current;
+ if (!el || canHover() || reducedMotion()) return;
+ return watch(el, id);
+ }, [id]);
+ useEffect(
+ () => () => {
+ if (active === id) setActive(null);
+ },
+ [id],
+ );
+ const on = () => {
+ if (!reducedMotion()) setActive(id);
+ };
+ const off = () => {
+ if (active === id) setActive(null);
+ };
+ return {
+ ref,
+ playing,
+ handlers: {
+ onPointerEnter: (e: React.PointerEvent) => e.pointerType === "mouse" && on(),
+ onPointerLeave: (e: React.PointerEvent) => e.pointerType === "mouse" && off(),
+ onFocus: on,
+ onBlur: off,
+ },
+ };
+}
+
+const layerVars = (l: PreviewLayer) => ({ "--d": LAYER_DEPTH[l], "--o": LAYER_OFFSET[l] }) as React.CSSProperties;
+
+/** The other still a transition wipes to. */
+const NEXT_SCENE: Record<PreviewScene, PreviewScene> = { landscape: "city", city: "landscape", portrait: "landscape", product: "portrait" };
+
+function Sparks({ n = 6 }: { n?: number }) {
+ return (
+ <>
+ {Array.from({ length: n }, (_, i) => (
+ <i key={i} className="pv-spark" style={{ "--i": i } as React.CSSProperties} />
+ ))}
+ </>
+ );
+}
+
+function Dup({ src, className }: { src: string; className: string }) {
+ // eslint-disable-next-line @next/next/no-img-element
+ return <img src={src} alt="" draggable={false} decoding="async" className={`pv-img ${className}`} />;
+}
+
+/** Per-treatment overlay markup; the look and motion live in globals.css (`.pv-*`). */
+function Fx({ fx, scene }: { fx: NonNullable<Preview["fx"]>; scene: PreviewScene }) {
+ const poster = scenePoster(scene);
+ switch (fx) {
+ case "fire":
+ return (
+ <>
+ <i className="pv-fire" />
+ <i className="pv-fire pv-fire-2" />
+ <Sparks n={5} />
+ </>
+ );
+ case "water":
+ return (
+ <>
+ <i className="pv-wave" />
+ <i className="pv-wave pv-wave-2" />
+ </>
+ );
+ case "ice":
+ return (
+ <>
+ <i className="pv-frost" />
+ <Sparks n={4} />
+ </>
+ );
+ case "wind":
+ return <i className="pv-streaks" />;
+ case "lightning":
+ return (
+ <>
+ <svg className="pv-bolt" viewBox="0 0 40 100" aria-hidden>
+ <path d="M24 0 L8 52 H20 L12 100 L34 40 H22 L30 0Z" />
+ </svg>
+ <i className="pv-flash" />
+ </>
+ );
+ case "explode":
+ return (
+ <>
+ <i className="pv-burst" />
+ <i className="pv-flash" />
+ <Sparks n={6} />
+ </>
+ );
+ case "glow":
+ return (
+ <>
+ <i className="pv-halo" />
+ <Sparks n={6} />
+ </>
+ );
+ case "sparkle":
+ return <Sparks n={9} />;
+ case "petals":
+ return (
+ <>
+ {Array.from({ length: 8 }, (_, i) => (
+ <i key={i} className="pv-petal" style={{ "--i": i } as React.CSSProperties} />
+ ))}
+ </>
+ );
+ case "relight":
+ return (
+ <>
+ <i className="pv-shade" />
+ <i className="pv-light" />
+ </>
+ );
+ case "dark":
+ return (
+ <>
+ <i className="pv-vignette" />
+ <i className="pv-blood" />
+ </>
+ );
+ case "flare":
+ return (
+ <>
+ <i className="pv-flare" />
+ <i className="pv-flash pv-flash-soft" />
+ </>
+ );
+ case "morph":
+ case "swap":
+ return (
+ <>
+ <Dup src={sceneLayer(scene, "subject")} className={`pv-wipe-v ${fx === "morph" ? "pv-morph" : "pv-recolor"}`} />
+ <i className="pv-seam pv-seam-h" />
+ </>
+ );
+ case "grade":
+ return (
+ <>
+ <Dup src={poster} className="pv-wipe-h pv-graded" />
+ <i className="pv-seam pv-seam-v" />
+ </>
+ );
+ case "halftone":
+ return (
+ <>
+ <span className="pv-wipe-h pv-halftone">
+ <Dup src={poster} className="pv-inked" />
+ </span>
+ <i className="pv-seam pv-seam-v" />
+ </>
+ );
+ case "sharpen":
+ return (
+ <>
+ <Dup src={poster} className="pv-wipe-h pv-soft" />
+ <i className="pv-seam pv-seam-v pv-knob" />
+ </>
+ );
+ case "wipe":
+ return (
+ <>
+ <Dup src={scenePoster(NEXT_SCENE[scene])} className="pv-wipe-h" />
+ <i className="pv-seam pv-seam-v" />
+ </>
+ );
+ case "glitch":
+ return (
+ <>
+ <Dup src={poster} className="pv-rgb" />
+ <Dup src={poster} className="pv-slice" />
+ <Dup src={poster} className="pv-slice pv-slice-2" />
+ </>
+ );
+ case "tiny":
+ return <i className="pv-ring" />;
+ case "scan":
+ return (
+ <>
+ <i className="pv-grid" />
+ <i className="pv-scanline" />
+ <i className="pv-brackets" />
+ </>
+ );
+ case "shine":
+ return <i className="pv-shine" />;
+ case "frame":
+ return (
+ <>
+ <i className="pv-brackets pv-brackets-wide" />
+ <i className="pv-rec" />
+ </>
+ );
+ case "play":
+ return (
+ <>
+ <i className="pv-progress" />
+ <i className="pv-play" />
+ </>
+ );
+ case "pop":
+ default:
+ return <Sparks n={6} />;
+ }
+}
+
+/**
+ * A preset's preview: a real clip when the catalog has one, otherwise the procedural version, a
+ * camera move over a layered sample still (motions) or an animated treatment (effects, apps).
+ * At rest it shows the poster frame (and the treatment's still frame); `playing` runs it. The depth
+ * layers a camera move needs are only mounted once the card first plays.
+ */
+export const PresetPreview = memo(function PresetPreview({ preview, hue, playing }: { preview: Preview; hue: number; playing: boolean }) {
+ const video = useRef<HTMLVideoElement>(null);
+ const [armed, setArmed] = useState(false);
+ if (playing && !armed) setArmed(true);
+ useEffect(() => {
+ const v = video.current;
+ if (!v) return;
+ if (playing) void v.play().catch(() => {});
+ else {
+ v.pause();
+ v.currentTime = 0;
+ }
+ }, [playing]);
+
+ if (preview.video)
+ return (
+ <video
+ ref={video}
+ src={preview.video}
+ poster={preview.poster}
+ muted
+ loop
+ playsInline
+ preload="none"
+ className="absolute inset-0 size-full object-cover"
+ aria-hidden
+ />
+ );
+
+ const spec: MoveSpec | undefined = preview.move ? CAMERA_MOVES[preview.move] : undefined;
+ const style = { "--pv-hue": hue, ...(spec ? moveVars(spec) : {}) } as React.CSSProperties;
+ return (
+ <div
+ className="pv"
+ style={style}
+ data-playing={playing || undefined}
+ data-profile={spec?.profile}
+ data-stage={spec?.stage}
+ data-through={spec?.through || undefined}
+ data-fx={preview.fx}
+ aria-hidden
+ >
+ <div className="pv-cam">
+ <div className="pv-shake">
+ {/* The poster stays underneath, so nothing flashes while the layers load. */}
+ <Dup src={preview.poster} className="pv-poster" />
+ {spec &&
+ armed &&
+ PREVIEW_LAYERS.map((l) => (
+ // eslint-disable-next-line @next/next/no-img-element
+ <img key={l} src={sceneLayer(preview.scene, l)} alt="" draggable={false} decoding="async" className={`pv-img pv-layer pv-l-${l}`} style={layerVars(l)} />
+ ))}
+ {preview.fx && (
+ <div className="pv-fx">
+ <Fx fx={preview.fx} scene={preview.scene} />
+ </div>
+ )}
+ </div>
+ </div>
+ <i className="pv-tint" />
+ </div>
+ );
+});
diff --git a/src/lib/preset-cards.ts b/src/lib/preset-cards.ts
new file mode 100644
index 00000000..d707e00b
--- /dev/null
+++ b/src/lib/preset-cards.ts
@@ -0,0 +1,420 @@
+/**
+ * Slim preset card data for the galleries, and the procedural previews shown on each card.
+ *
+ * Gallery pages are server components: they map the full catalog `Preset` (prompt templates,
+ * routes, LoRA URLs, parity notes) to `PresetCardData` here, so only what a card shows reaches
+ * the browser. Until real preview clips exist, every card gets a procedural preview: a camera
+ * move over a bundled layered still for motions, a per-category animated treatment for effects
+ * and apps. Pure module, safe on both sides.
+ */
+import type { Preset } from "./catalog/types";
+
+/** Bundled sample stills (public/samples/previews, see scripts/gen-preview-scenes.mjs). */
+export type PreviewScene = "landscape" | "portrait" | "city" | "product";
+
+export const PREVIEW_LAYERS = ["bg", "mid", "subject", "fg"] as const;
+export type PreviewLayer = (typeof PREVIEW_LAYERS)[number];
+
+export const scenePoster = (scene: PreviewScene) => `/samples/previews/${scene}.svg`;
+export const sceneLayer = (scene: PreviewScene, layer: PreviewLayer) => `/samples/previews/${scene}-${layer}.svg`;
+
+/** Timing curve of the camera move, see the `pv-*` keyframes in globals.css. */
+export type MoveProfile = "ease" | "ease-rev" | "crash" | "crash-rev" | "yoyo" | "slow" | "whip" | "loop";
+/**
+ * Extra motion on top of the move (keyframes in globals.css): camera-wide ones shake or bank the
+ * whole frame, subject ones (bounce, slide, turn) move only the subject layer.
+ */
+export type MoveStage = "handheld" | "walk" | "bank" | "rack" | "impact" | "float" | "flicker" | "bounce" | "slide" | "turn";
+
+/** How far each layer sits from the camera (parallax weight), and from the subject (orbit weight). */
+export const LAYER_DEPTH: Record<PreviewLayer, number> = { bg: 0.15, mid: 0.45, subject: 0.7, fg: 1 };
+export const LAYER_OFFSET: Record<PreviewLayer, number> = { bg: -1, mid: -0.5, subject: 0, fg: 1 };
+/** Each layer overflows the card by this much on every side, so moves never show its edge. */
+export const LAYER_BLEED = 0.12;
+
+/**
+ * A camera move, as amounts reached at the end of the move (t = 1). For a layer with depth `d`
+ * and subject offset `o`: translate = (pan + tx·d + orbit·o)% of the layer, scale = 1 + zoom + dolly·d,
+ * rotate = roll degrees (plus a constant `base` zoom). `layerTransform()` is the same formula the `.pv-layer` rule computes in CSS.
+ */
+export interface MoveSpec {
+ profile: MoveProfile;
+ /** Seconds for one pass. */
+ duration?: number;
+ panX?: number;
+ panY?: number;
+ tx?: number;
+ ty?: number;
+ orbit?: number;
+ zoom?: number;
+ dolly?: number;
+ roll?: number;
+ /** Zoom held for the whole move (rolls need it from the first frame to hide the corners). */
+ base?: number;
+ stage?: MoveStage;
+ /** Foreground rushes past and fades (through-object moves). */
+ through?: boolean;
+}
+
+export const CAMERA_MOVES = {
+ "zoom-in": { profile: "ease", zoom: 0.32 },
+ "zoom-out": { profile: "ease-rev", zoom: 0.32 },
+ "optical-zoom": { profile: "slow", zoom: 0.22 },
+ "dolly-in": { profile: "ease", dolly: 0.42 },
+ "dolly-out": { profile: "ease-rev", dolly: 0.42 },
+ "super-dolly-in": { profile: "ease", dolly: 1.1, duration: 2.4 },
+ "super-dolly-out": { profile: "ease-rev", dolly: 1.1, duration: 2.4 },
+ "crash-in": { profile: "crash", zoom: 0.85 },
+ "crash-out": { profile: "crash-rev", zoom: 0.85 },
+ "rapid-in": { profile: "crash", zoom: 0.5, duration: 1.8 },
+ "rapid-out": { profile: "crash-rev", zoom: 0.5, duration: 1.8 },
+ // Dolly zoom: zoom = -dolly × subject depth, so the subject keeps its size while the background
+ // shrinks away (dolly in + zoom out) or looms (dolly out + zoom in).
+ "dolly-zoom-in": { profile: "ease-rev", dolly: -0.6, zoom: 0.42 },
+ "dolly-zoom-out": { profile: "ease", dolly: -0.6, zoom: 0.42 },
+ yoyo: { profile: "yoyo", zoom: 0.38 },
+ "through-in": { profile: "ease", dolly: 0.9, through: true },
+ "through-out": { profile: "ease-rev", dolly: 0.9, through: true },
+ "earth-out": { profile: "ease-rev", zoom: 1.6, duration: 3.6 },
+ "orbit-left": { profile: "ease", orbit: 9, zoom: 0.04 },
+ "orbit-right": { profile: "ease", orbit: -9, zoom: 0.04 },
+ "orbit-360": { profile: "ease", orbit: 14, zoom: 0.16, duration: 2.2 },
+ "lazy-orbit": { profile: "slow", orbit: 7, zoom: 0.03 },
+ "bullet-time": { profile: "slow", orbit: 11, zoom: 0.08, stage: "flicker" },
+ turntable: { profile: "slow", orbit: 6, zoom: 0.02, stage: "turn" },
+ "crane-up": { profile: "ease", ty: 10, zoom: 0.04 },
+ "crane-down": { profile: "ease", ty: -10, zoom: 0.04 },
+ "crane-over": { profile: "ease", ty: 13, zoom: 0.16 },
+ overhead: { profile: "slow", zoom: 0.2, roll: 8 },
+ "tilt-up": { profile: "ease", panY: 7, zoom: 0.03 },
+ "tilt-down": { profile: "ease", panY: -7, zoom: 0.03 },
+ "pan-left": { profile: "ease", panX: 8, zoom: 0.03 },
+ "pan-right": { profile: "ease", panX: -8, zoom: 0.03 },
+ "whip-pan": { profile: "whip", panX: -16, zoom: 0.25, stage: "rack" },
+ "truck-left": { profile: "ease", tx: 9 },
+ "truck-right": { profile: "ease", tx: -9 },
+ tracking: { profile: "ease", tx: -9, zoom: 0.03, stage: "walk" },
+ "double-dolly": { profile: "ease", dolly: 0.3, orbit: 6, zoom: 0.02 },
+ dutch: { profile: "ease", roll: -9, zoom: 0.14 },
+ roll: { profile: "loop", roll: 360, base: 0.42, duration: 2 },
+ incline: { profile: "ease", roll: -5, ty: 6, zoom: 0.12 },
+ handheld: { profile: "slow", zoom: 0.06, stage: "handheld" },
+ snorricam: { profile: "slow", orbit: 5, zoom: 0.06, stage: "handheld" },
+ pov: { profile: "slow", dolly: 0.22, zoom: 0.04, stage: "walk" },
+ fpv: { profile: "ease", dolly: 0.9, zoom: 0.06, stage: "bank", duration: 2.2 },
+ "drone-rise": { profile: "ease-rev", zoom: 0.36, ty: -8 },
+ "road-rush": { profile: "crash", dolly: 0.7, zoom: 0.05, stage: "handheld", duration: 1.6 },
+ "robo-arm": { profile: "whip", orbit: 12, dolly: 0.3, zoom: 0.1 },
+ static: { profile: "slow", zoom: 0.015 },
+ hyperlapse: { profile: "ease", dolly: 0.6, stage: "flicker", duration: 1.8 },
+ timelapse: { profile: "slow", zoom: 0.05, stage: "flicker" },
+ "slow-mo": { profile: "slow", dolly: 0.14, duration: 6 },
+ "rack-focus": { profile: "ease", zoom: 0.04, stage: "rack" },
+ "low-shutter": { profile: "whip", panX: -6, zoom: 0.06, stage: "rack" },
+ spin: { profile: "loop", roll: 360, base: 0.42, duration: 3 },
+ jump: { profile: "slow", zoom: 0.05, stage: "bounce" },
+ "slide-left": { profile: "ease", tx: 6, stage: "slide" },
+ "slide-right": { profile: "ease", tx: -6, stage: "slide" },
+ impact: { profile: "crash", zoom: 0.1, stage: "impact", duration: 1.4 },
+ float: { profile: "slow", ty: -6, zoom: 0.04, stage: "float" },
+} satisfies Record<string, MoveSpec>;
+
+/** Where a layer is at time t (0..1) of a move: translate in % of the layer, scale, rotate in degrees. */
+export function layerTransform(spec: MoveSpec, layer: PreviewLayer, t: number) {
+ const d = LAYER_DEPTH[layer];
+ const o = LAYER_OFFSET[layer];
+ return {
+ x: ((spec.panX ?? 0) + (spec.tx ?? 0) * d + (spec.orbit ?? 0) * o) * t,
+ y: ((spec.panY ?? 0) + (spec.ty ?? 0) * d) * t,
+ scale: 1 + (spec.base ?? 0) + ((spec.zoom ?? 0) + (spec.dolly ?? 0) * d) * t,
+ rotate: (spec.roll ?? 0) * t,
+ };
+}
+
+/** CSS custom properties that drive a move (read by the `.pv-*` rules in globals.css). */
+export function moveVars(spec: MoveSpec): Record<string, string | number> {
+ const v: Record<string, string | number> = { "--pv-dur": `${spec.duration ?? (spec.profile === "slow" ? 4.8 : 3)}s` };
+ for (const k of ["panX", "panY", "tx", "ty", "orbit", "zoom", "dolly", "roll", "base"] as const) if (spec[k]) v[`--pv-${k}`] = spec[k]!;
+ return v;
+}
+
+export type CameraMove = keyof typeof CAMERA_MOVES;
+
+/** Per-category treatments for effects and apps (classes `pv-fx-*` in globals.css). */
+export const FX = [
+ "fire",
+ "water",
+ "ice",
+ "wind",
+ "lightning",
+ "explode",
+ "glow",
+ "sparkle",
+ "morph",
+ "grade",
+ "relight",
+ "glitch",
+ "flare",
+ "wipe",
+ "halftone",
+ "petals",
+ "dark",
+ "tiny",
+ "scan",
+ "shine",
+ "swap",
+ "sharpen",
+ "frame",
+ "pop",
+ "play",
+] as const;
+export type PreviewFx = (typeof FX)[number];
+
+export interface PresetPreview {
+ /** Still shown before (and under) the preview. */
+ poster: string;
+ /** A real example clip, once one exists: played instead of the procedural preview. */
+ video?: string;
+ scene: PreviewScene;
+ move?: CameraMove;
+ fx?: PreviewFx;
+}
+
+export interface PresetCardData {
+ id: string;
+ name: string;
+ description: string;
+ category: string;
+ /** Lucide icon name (resolved by PRESET_ICONS). */
+ icon: string;
+ /** Hue of the preset's look, tints the preview. */
+ hue: number;
+ top?: true;
+ cloud: boolean;
+ open: boolean;
+ preview: PresetPreview;
+}
+
+const has = (s: string, ...words: string[]) => words.some((w) => s.includes(w));
+/** Whole-word match, for short words that hide inside others ("ice" in "price", "wind" in "windows"). */
+const word = (s: string, ...words: string[]) => words.some((w) => new RegExp(`(^|[^a-z])${w}([^a-z]|$)`).test(s));
+
+/** Which camera move a motion preset previews, from its id, name and category. */
+export function motionMove(p: Pick<Preset, "id" | "name" | "category">): CameraMove {
+ const n = `${p.id.replace(/^motion-/, "")} ${p.name}`.toLowerCase();
+ const left = has(n, "left");
+ const right = has(n, "right");
+ // Specific moves first: names overlap ("crash zoom in" contains "zoom in").
+ if (has(n, "dolly zoom")) return has(n, "out") ? "dolly-zoom-out" : "dolly-zoom-in";
+ if (has(n, "crash zoom")) return has(n, "out") ? "crash-out" : "crash-in";
+ if (has(n, "rapid zoom")) return has(n, "out") ? "rapid-out" : "rapid-in";
+ if (has(n, "super dolly")) return has(n, "out") ? "super-dolly-out" : "super-dolly-in";
+ if (has(n, "yoyo")) return "yoyo";
+ if (has(n, "through object")) return has(n, "out") ? "through-out" : "through-in";
+ if (has(n, "earth zoom")) return "earth-out";
+ if (has(n, "double dolly")) return "double-dolly";
+ if (has(n, "dolly")) return left ? "truck-left" : right ? "truck-right" : has(n, "out") ? "dolly-out" : "dolly-in";
+ if (has(n, "eyes in", "mouth in", "eating zoom")) return "crash-in";
+ if (has(n, "zoom out")) return "zoom-out";
+ if (has(n, "zoom in")) return "zoom-in";
+ if (n.trim() === "zoom zoom") return "optical-zoom";
+ if (has(n, "360", "orbit")) return has(n, "lazy") ? "lazy-orbit" : "orbit-360";
+ if (has(n, "arc")) return left ? "orbit-left" : "orbit-right";
+ if (has(n, "bullet")) return "bullet-time";
+ if (has(n, "lazy susan", "3d rotation")) return "turntable";
+ if (has(n, "glam")) return has(n, "timelapse") ? "timelapse" : "orbit-right";
+ if (has(n, "over the head")) return "crane-over";
+ if (has(n, "crane", "jib", "pedestal")) return has(n, "down") ? "crane-down" : "crane-up";
+ if (has(n, "tilt")) return has(n, "down") ? "tilt-down" : "tilt-up";
+ if (has(n, "overhead")) return "overhead";
+ if (has(n, "buckle")) return "road-rush";
+ if (has(n, "whip")) return "whip-pan";
+ if (has(n, "pan")) return left ? "pan-left" : right ? "pan-right" : "pan-right";
+ if (has(n, "truck")) return left ? "truck-left" : "truck-right";
+ if (has(n, "dutch")) return "dutch";
+ if (has(n, "incline")) return "incline";
+ if (has(n, "roll")) return "roll";
+ if (has(n, "snorricam")) return "snorricam";
+ if (has(n, "fpv", "flying cam", "flying")) return "fpv";
+ if (has(n, "drone", "aerial", "helicopter")) return "drone-rise";
+ if (has(n, "road rush", "car chasing", "car grip")) return "road-rush";
+ if (has(n, "robo")) return "robo-arm";
+ if (has(n, "hyperlapse")) return "hyperlapse";
+ if (has(n, "timelapse")) return "timelapse";
+ if (has(n, "slow motion")) return "slow-mo";
+ if (has(n, "low shutter")) return "low-shutter";
+ if (has(n, "focus")) return "rack-focus";
+ if (has(n, "static")) return "static";
+ if (has(n, "dunk", "ollie", "kick")) return "jump";
+ if (has(n, "moonwalk")) return left ? "slide-left" : "slide-right";
+ if (has(n, "skate", "snowboard") || word(n, "ski")) return left ? "slide-left" : "slide-right";
+ if (has(n, "boxing", "punch")) return "impact";
+ if (has(n, "dreamy", "kiss")) return "float";
+ if (has(n, "epic")) return "drone-rise";
+ if (has(n, "impossible")) return "through-in";
+ if (has(n, "intimate", "silent machine")) return "slow-mo";
+ if (has(n, "one take", "tracking", "catwalk", "head tracking")) return "tracking";
+ if (has(n, "documentary", "raw chaos", "handheld", "bts", "wiggle", "hero cam", "rap flex")) return "handheld";
+ if (has(n, "pov", "action run", "downhill")) return "pov";
+ if (has(n, "fisheye")) return "crash-in";
+ if (has(n, "general")) return "dolly-in";
+ // Category fallbacks.
+ const c = p.category.toLowerCase();
+ if (has(c, "orbit")) return "orbit-right";
+ if (has(c, "vertical")) return "crane-up";
+ if (has(c, "lateral")) return "truck-right";
+ if (has(c, "handheld")) return "handheld";
+ if (has(c, "drone")) return "fpv";
+ return "dolly-in";
+}
+
+/** Treatments named by the preset itself (fire, water, glitch…), shared by effects and apps. */
+function keywordFx(n: string): PreviewFx | null {
+ if (has(n, "firework", "confetti", "glitter", "fairies", "northern lights", "spark") || word(n, "rain", "money")) return "sparkle";
+ if (has(n, "fire", "flame", "lava", "burn", "inferno", "volcano")) return "fire";
+ if (has(n, "water", "flood", "splash", "ocean", "aquarium", "bubble", "jelly", "dolphin") || word(n, "pool", "fish")) return "water";
+ if (has(n, "freez", "frozen", "snow") || word(n, "ice")) return "ice";
+ if (has(n, "air bending", "storm", "tornado", "smoke") || word(n, "wind", "air", "sand", "gas")) return "wind";
+ if (has(n, "thunder", "lightning", "plasma", "atomic")) return "lightning";
+ if (has(n, "explo", "boom", "crush", "smash", "crack", "disintegrat", "head off", "boiling", "earth")) return "explode";
+ if (has(n, "glitch", "datamosh", "pixel", "censor", "x-ray", "visor", "lidar", "point cloud", "wireframe", "polygon")) return "glitch";
+ if (has(n, "flare", "paparazzi", "flash")) return "flare";
+ if (has(n, "bloom", "flower", "petal", "sakura", "garden", "floral") || word(n, "rose")) return "petals";
+ if (has(n, "tiny planet", "giant", "colossus")) return "tiny";
+ if (has(n, "noir", "vintage", "two color", "ultraviolet", "bleach", "color grad", "colorize")) return "grade";
+ if (has(n, "horror", "black tears", "tentacle", "spider", "monster", "demon", "werewolf", "zombie", "ghoul", "giallo")) return "dark";
+ if (has(n, "statue", "metal", "melt", "cyborg", "diamond", "clone", "duplicate", "morph", "inflate", "deflate", "squish", "cake", "figur", "plush")) return "morph";
+ if (has(n, "comic", "sketch", "paint", "collage", "magazine", "origami", "paper", "style transfer")) return "halftone";
+ return null;
+}
+
+/** Which treatment an effect previews. */
+export function effectFx(p: Pick<Preset, "id" | "name" | "category">): PreviewFx {
+ const n = p.name.toLowerCase();
+ const c = p.category.toLowerCase();
+ if (c === "color grade") return "grade";
+ if (c === "transitions" || has(n, "transition", "morphing", "switch")) return "wipe";
+ const k = keywordFx(n);
+ if (k) return k;
+ if (c === "relight" || has(n, "light", "glow", "neon")) return "relight";
+ if (c === "mixed media") return "halftone";
+ if (c === "horror") return "dark";
+ if (c === "transform") return "morph";
+ if (c === "magic" || has(n, "angel", "wings", "levitat", "portal", "invisible", "saiyan", "soul") || word(n, "fly")) return "glow";
+ if (c === "nature") return "petals";
+ if (c === "scale") return "tiny";
+ if (c === "commercial") return "shine";
+ if (c === "destruction") return "explode";
+ if (c === "elements") return "wind";
+ if (c === "stylize") return "glitch";
+ return "pop";
+}
+
+/** Which treatment an app previews. */
+export function appFx(p: Pick<Preset, "id" | "name" | "category">): PreviewFx {
+ const n = p.name.toLowerCase();
+ const c = p.category.toLowerCase();
+ if (has(n, "swap", "try-on", "try on", "outfit", "stylist", "style snap", "steal the look", "recast", "hairstyle", "makeup")) return "swap";
+ if (has(n, "remove background", "background remover", "object remover", "change background")) return "wipe";
+ if (has(n, "upscale", "enhance", "restore", "sharpen", "denoise", "text edit")) return "sharpen";
+ if (has(n, "relight", "lighting")) return "relight";
+ if (has(n, "color")) return "grade";
+ if (has(n, "transition", "match cut")) return "wipe";
+ if (has(n, "predict", "score", "breakdown", "headshot", "commercial faces", "influencer")) return "scan";
+ if (has(n, "age", "expression")) return "morph";
+ if (word(n, "angles?", "shots?", "zooms?", "zoom out", "frame") || has(n, "expand", "what's next", "what’s next", "behind the scenes")) return "frame";
+ const k = keywordFx(n);
+ if (k) return k;
+ if (c === "identity") return "scan";
+ if (c === "fashion") return "swap";
+ if (c === "product") return "shine";
+ if (c === "style") return "halftone";
+ if (c === "utility") return "sharpen";
+ if (c === "camera") return "frame";
+ if (c === "video") return "play";
+ return "pop";
+}
+
+/** Which bundled still a preset's preview runs on. */
+export function previewScene(p: Pick<Preset, "type" | "name" | "category">): PreviewScene {
+ const n = p.name.toLowerCase();
+ const c = p.category.toLowerCase();
+ if (p.type === "motion") {
+ if (has(n, "eyes", "mouth", "eating", "kiss", "snorricam", "head tracking", "rap flex", "selfie", "fisheye", "glam", "lazy susan", "intimate")) return "portrait";
+ if (c.includes("drone") || has(n, "road", "car", "buckle", "robo", "hyperlapse")) return "city";
+ return "landscape";
+ }
+ if (p.type === "app") {
+ if (c === "product" || has(n, "product", "packshot", "ad ", "billboard", "unboxing")) return "product";
+ if (has(n, "urban", "clipcut", "truck", "roller")) return "city";
+ if (["identity", "fashion", "fun", "video"].includes(c) || has(n, "face", "portrait", "headshot", "hair", "makeup", "selfie")) return "portrait";
+ return "landscape";
+ }
+ if (c === "commercial") return "product";
+ if (has(n, "car", "building", "street", "city", "train", "helicopter", "road", "giant", "colossus", "concert", "tiny planet")) return "city";
+ if (has(n, "fish", "ocean", "flood", "water", "sand", "earth", "nature", "garden", "northern", "timelapse", "planet")) return "landscape";
+ if (["destruction", "scale"].includes(c)) return "city";
+ if (["elements", "nature", "color grade", "transitions"].includes(c)) return "landscape";
+ return "portrait";
+}
+
+export function previewFor(p: Pick<Preset, "id" | "type" | "name" | "category">): PresetPreview {
+ const scene = previewScene(p);
+ return {
+ poster: scenePoster(scene),
+ scene,
+ ...(p.type === "motion" ? { move: motionMove(p) } : { fx: p.type === "effect" ? effectFx(p) : appFx(p) }),
+ };
+}
+
+/** The hue a preset's look was built from (`oklch(L C <hue>)`), for tinting its preview. */
+export function lookHue(look: Preset["look"]): number {
+ const m = /oklch\([^)]*?\s([\d.]+)\s*\)/.exec(look.from);
+ return m ? Math.round(Number(m[1])) % 360 : 282;
+}
+
+/** Shorten to at most `max` characters at a word boundary (cards show two lines). */
+export function clip(s: string, max: number): string {
+ if (s.length <= max) return s;
+ const cut = s.slice(0, max - 1);
+ return `${cut.slice(0, Math.max(cut.lastIndexOf(" "), max * 0.6)).replace(/[\s,;:.–—-]+$/, "")}…`;
+}
+
+/** What a gallery card needs, and nothing else. */
+export function toPresetCard(p: Preset): PresetCardData {
+ return {
+ id: p.id,
+ name: p.name,
+ description: clip(p.description, 100),
+ category: p.category,
+ icon: p.look.icon,
+ hue: lookHue(p.look),
+ ...(p.badges?.includes("top") ? { top: true as const } : {}),
+ cloud: !!p.cloud,
+ open: !!p.open,
+ preview: previewFor(p),
+ };
+}
+
+/** Lower-cased text a gallery search matches against. */
+export const searchText = (c: Pick<PresetCardData, "name" | "description" | "category">) => `${c.name} ${c.description} ${c.category}`.toLowerCase();
+
+const lowerFirst = (s: string) => (/^[A-Z][a-z]/.test(s) ? s[0].toLowerCase() + s.slice(1) : s);
+const article = (s: string) => (/^(a|an|the|your|my)\s/i.test(s) ? s : `${/^[aeiou]/i.test(s) ? "an" : "a"} ${s}`);
+
+function joinList(items: string[]): string {
+ if (items.length <= 1) return items[0] ?? "";
+ return `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
+}
+
+/** One line telling the user what to do with a preset, e.g. "Add a target photo and a face, then Generate." */
+export function presetHowTo(p: Pick<Preset, "inputs" | "userPrompt" | "type">): string {
+ const needs = p.inputs.filter((i) => i.required).map((i) => article(lowerFirst(i.label)));
+ const optional = p.inputs.filter((i) => !i.required).map((i) => article(lowerFirst(i.label)));
+ const say = p.userPrompt === "required" ? "describe what you want" : p.userPrompt === "optional" ? "add a few words if you like" : "";
+ if (!needs.length) {
+ const first = p.userPrompt === "required" ? "Describe what you want" : optional.length ? `Add ${joinList(optional)} (optional)` : "Press Generate";
+ return first === "Press Generate" ? "Press Generate — no inputs needed." : `${first}, then Generate.`;
+ }
+ return `Add ${joinList(needs)}${say ? `, ${say}` : ""}, then Generate.`;
+}
diff --git a/tests/preset-cards.test.ts b/tests/preset-cards.test.ts
new file mode 100644
index 00000000..8eef90ac
--- /dev/null
+++ b/tests/preset-cards.test.ts
@@ -0,0 +1,264 @@
+import { describe, expect, it } from "vitest";
+import { APPS, EFFECTS, MOTIONS } from "@/lib/catalog";
+import {
+ appFx,
+ CAMERA_MOVES,
+ effectFx,
+ FX,
+ LAYER_BLEED,
+ layerTransform,
+ lookHue,
+ motionMove,
+ moveVars,
+ PREVIEW_LAYERS,
+ presetHowTo,
+ previewFor,
+ searchText,
+ toPresetCard,
+ type CameraMove,
+ type MoveSpec,
+ type PreviewLayer,
+} from "@/lib/preset-cards";
+import type { Preset } from "@/lib/catalog/types";
+
+const byName = (list: Preset[], name: string) => {
+ const p = list.find((x) => x.name === name);
+ if (!p) throw new Error(`no preset named ${name}`);
+ return p;
+};
+
+describe("motion → camera move", () => {
+ it("gives every one of the camera motions a known move", () => {
+ expect(MOTIONS.length).toBeGreaterThanOrEqual(100);
+ for (const m of MOTIONS) expect(Object.keys(CAMERA_MOVES), m.name).toContain(motionMove(m));
+ });
+
+ it.each<[string, CameraMove]>([
+ ["Zoom In", "zoom-in"],
+ ["Zoom Out", "zoom-out"],
+ ["Zoom", "optical-zoom"],
+ ["Crash Zoom In", "crash-in"],
+ ["Crash Zoom Out", "crash-out"],
+ ["Rapid Zoom In", "rapid-in"],
+ ["Dolly In", "dolly-in"],
+ ["Dolly Out", "dolly-out"],
+ ["Super Dolly In", "super-dolly-in"],
+ ["Dolly Zoom In", "dolly-zoom-in"],
+ ["Dolly Zoom Out", "dolly-zoom-out"],
+ ["Dolly Left", "truck-left"],
+ ["Truck Right", "truck-right"],
+ ["YoYo Zoom", "yoyo"],
+ ["Through Object In", "through-in"],
+ ["360 Orbit", "orbit-360"],
+ ["Arc Left", "orbit-left"],
+ ["Arc Right", "orbit-right"],
+ ["Lazy Orbit", "lazy-orbit"],
+ ["Bullet Time", "bullet-time"],
+ ["Lazy Susan", "turntable"],
+ ["Crane Up", "crane-up"],
+ ["Crane Down", "crane-down"],
+ ["Crane Over The Head", "crane-over"],
+ ["Jib Down", "crane-down"],
+ ["Tilt Up", "tilt-up"],
+ ["Tilt Down", "tilt-down"],
+ ["Pan Left", "pan-left"],
+ ["Pan Right", "pan-right"],
+ ["Whip Pan", "whip-pan"],
+ ["Dutch Angle", "dutch"],
+ ["Handheld", "handheld"],
+ ["Snorricam", "snorricam"],
+ ["FPV Drone", "fpv"],
+ ["Drone Reveal", "drone-rise"],
+ ["Road Rush", "road-rush"],
+ ["Hyperlapse", "hyperlapse"],
+ ["Timelapse", "timelapse"],
+ ["Slow Motion", "slow-mo"],
+ ["Focus Change", "rack-focus"],
+ ["Static", "static"],
+ ["Earth Zoom Out", "earth-out"],
+ ["Skateboard Ollie", "jump"],
+ ["Moonwalk Left", "slide-left"],
+ ["Boxing", "impact"],
+ ["Roll Transition", "roll"],
+ ])("%s → %s", (name, move) => {
+ expect(motionMove(byName(MOTIONS, name))).toBe(move);
+ });
+
+ it("spreads the motions over many different moves", () => {
+ const counts = new Map<string, number>();
+ for (const m of MOTIONS) counts.set(motionMove(m), (counts.get(motionMove(m)) ?? 0) + 1);
+ expect(counts.size).toBeGreaterThanOrEqual(40);
+ // The generic fallback ("dolly-in") stays rare: almost every motion gets its own reading.
+ expect(counts.get("dolly-in") ?? 0).toBeLessThanOrEqual(3);
+ expect(Math.max(...counts.values())).toBeLessThanOrEqual(10);
+ });
+
+ it("keeps the subject the same size during a dolly zoom", () => {
+ for (const k of ["dolly-zoom-in", "dolly-zoom-out"] as const) {
+ expect(layerTransform(CAMERA_MOVES[k], "subject", 1).scale).toBeCloseTo(1, 5);
+ expect(layerTransform(CAMERA_MOVES[k], "bg", 1).scale).not.toBeCloseTo(1, 2);
+ }
+ });
+
+ it("separates zooms (no parallax) from dollies and trucks (parallax)", () => {
+ const zoom = CAMERA_MOVES["zoom-in"];
+ expect(layerTransform(zoom, "bg", 1).scale).toBe(layerTransform(zoom, "fg", 1).scale);
+ const dolly = CAMERA_MOVES["dolly-in"];
+ expect(layerTransform(dolly, "fg", 1).scale).toBeGreaterThan(layerTransform(dolly, "bg", 1).scale);
+ const truck = CAMERA_MOVES["truck-left"];
+ expect(Math.abs(layerTransform(truck, "fg", 1).x)).toBeGreaterThan(Math.abs(layerTransform(truck, "bg", 1).x));
+ const pan = CAMERA_MOVES["pan-left"];
+ expect(layerTransform(pan, "fg", 1).x).toBe(layerTransform(pan, "bg", 1).x);
+ const orbit = CAMERA_MOVES["orbit-left"];
+ expect(Math.sign(layerTransform(orbit, "fg", 1).x)).toBe(-Math.sign(layerTransform(orbit, "bg", 1).x));
+ });
+
+ // Card is 1 × 0.75 (4:3), centered. A layer is the card plus LAYER_BLEED on each side, moved by
+ // translate(x%, y%) scale(s) rotate(r) around its center (CSS order).
+ function covers(spec: MoveSpec, layer: PreviewLayer, t: number): boolean {
+ const W = 1 + 2 * LAYER_BLEED;
+ const H = 0.75 * W;
+ const { x, y, scale, rotate } = layerTransform(spec, layer, t);
+ const T = [(x / 100) * W, (y / 100) * H];
+ const a = (-rotate * Math.PI) / 180;
+ // The background must cover the whole card; the other layers only their sides and bottom.
+ const points =
+ layer === "bg"
+ ? [[-0.5, -0.375], [0.5, -0.375], [-0.5, 0.375], [0.5, 0.375]]
+ : [[-0.5, 0.375], [0.5, 0.375], [-0.5, 0], [0.5, 0]];
+ return points.every(([cx, cy]) => {
+ const dx = (cx - T[0]) / scale;
+ const dy = (cy - T[1]) / scale;
+ const px = dx * Math.cos(a) - dy * Math.sin(a);
+ const py = dx * Math.sin(a) + dy * Math.cos(a);
+ return Math.abs(px) <= W / 2 + 1e-9 && Math.abs(py) <= H / 2 + 1e-9;
+ });
+ }
+
+ it("never shows a layer's edge inside the card, at any point of any move", () => {
+ const bad: string[] = [];
+ for (const [name, spec] of Object.entries(CAMERA_MOVES) as [string, MoveSpec][]) {
+ for (const layer of PREVIEW_LAYERS) {
+ if (layer === "fg" && spec.through) continue; // the foreground flies past and fades out
+ for (let t = 0; t <= 1.0001; t += 0.025) if (!covers(spec, layer, t)) bad.push(`${name}/${layer}@${t.toFixed(3)}`);
+ }
+ }
+ expect(bad).toEqual([]);
+ });
+
+ it("turns a move into CSS variables", () => {
+ expect(moveVars(CAMERA_MOVES["truck-left"])).toEqual({ "--pv-dur": "3s", "--pv-tx": 9 });
+ expect(moveVars(CAMERA_MOVES.handheld)["--pv-dur"]).toBe("4.8s");
+ });
+});
+
+describe("effect and app treatments", () => {
+ it("gives every effect and app a known treatment", () => {
+ for (const e of EFFECTS) expect(FX, e.name).toContain(effectFx(e));
+ for (const a of APPS) expect(FX, a.name).toContain(appFx(a));
+ });
+
+ it.each<[string, string]>([
+ ["Set On Fire", "fire"],
+ ["Firework", "sparkle"],
+ ["Water Splash", "water"],
+ ["Freezing", "ice"],
+ ["Sand Storm", "wind"],
+ ["Thunder God", "lightning"],
+ ["Building Explosion", "explode"],
+ ["Glitch", "glitch"],
+ ["Lens Flare", "flare"],
+ ["Sakura Petals", "petals"],
+ ["Tiny Planet", "tiny"],
+ ["Bleach Bypass", "grade"],
+ ["Silhouette", "relight"],
+ ["Column Wipe", "wipe"],
+ ["Comic", "halftone"],
+ ["Horror Face", "dark"],
+ ["Turn Into Statue", "morph"],
+ ["Angel Wings", "glow"],
+ ["Windows", "halftone"],
+ ])("effect %s → %s", (name, fx) => {
+ expect(effectFx(byName(EFFECTS, name))).toBe(fx);
+ });
+
+ it.each<[string, string]>([
+ ["Face Swap", "swap"],
+ ["Headshot Generator", "scan"],
+ ["Upscale", "sharpen"],
+ ["Packshot", "shine"],
+ ["Relight", "relight"],
+ ["Match Colors", "grade"],
+ ["Angles", "frame"],
+ ["Remove Background", "wipe"],
+ ])("app %s → %s", (name, fx) => {
+ expect(appFx(byName(APPS, name))).toBe(fx);
+ });
+
+ it("puts people presets on the portrait still and products on the product still", () => {
+ expect(previewFor(byName(APPS, "Face Swap")).scene).toBe("portrait");
+ expect(previewFor(byName(APPS, "Packshot")).scene).toBe("product");
+ expect(previewFor(byName(MOTIONS, "FPV Drone")).scene).toBe("city");
+ expect(previewFor(byName(MOTIONS, "Crane Up")).scene).toBe("landscape");
+ expect(previewFor(byName(MOTIONS, "Crane Up")).poster).toBe("/samples/previews/landscape.svg");
+ });
+});
+
+describe("slim card DTOs", () => {
+ it("keeps only what a card shows", () => {
+ const p = byName(APPS, "Face Swap");
+ const card = toPresetCard(p);
+ expect(Object.keys(card).sort()).toEqual(
+ ["category", "cloud", "description", "hue", "icon", "id", "name", "open", "preview", ...(p.badges?.includes("top") ? ["top"] : [])].sort(),
+ );
+ expect(card).toMatchObject({ id: p.id, name: p.name, cloud: true, open: true, icon: p.look.icon });
+ const json = JSON.stringify(card);
+ // No prompt templates, routes, model ids or LoRA URLs reach the browser.
+ expect(json).not.toContain(p.promptTemplate.slice(0, 20));
+ expect(json).not.toMatch(/modelId|loras|https?:|promptTemplate|parity/);
+ });
+
+ it("is a small fraction of the full preset payload", () => {
+ for (const list of [APPS, MOTIONS, EFFECTS]) {
+ const full = JSON.stringify(list).length;
+ const slim = JSON.stringify(list.map(toPresetCard)).length;
+ expect(slim / full).toBeLessThan(0.45);
+ }
+ // The 255-card effects gallery ships well under 80 KB of card data.
+ expect(JSON.stringify(EFFECTS.map(toPresetCard)).length).toBeLessThan(80_000);
+ });
+
+ it("reads the hue back from the preset look", () => {
+ expect(lookHue({ icon: "Zap", from: "oklch(0.72 0.16 123)", to: "oklch(0.55 0.2 173)" })).toBe(123);
+ expect(lookHue({ icon: "Zap", from: "#fff", to: "#000" })).toBe(282);
+ });
+
+ it("marks only presets that have a route on each engine", () => {
+ const cards = [...APPS, ...MOTIONS, ...EFFECTS].map((p) => [p, toPresetCard(p)] as const);
+ for (const [p, c] of cards) {
+ expect(c.cloud).toBe(!!p.cloud);
+ expect(c.open).toBe(!!p.open);
+ }
+ });
+
+ it("searches name, description and category", () => {
+ expect(searchText({ name: "Crash Zoom In", description: "A sudden zoom", category: "Push & Pull" })).toBe("crash zoom in a sudden zoom push & pull");
+ });
+});
+
+describe("preset how-to line", () => {
+ it("names the required inputs", () => {
+ expect(presetHowTo(byName(APPS, "Face Swap"))).toMatch(/^Add .+ and .+, then Generate\.$/);
+ expect(presetHowTo({ type: "motion", userPrompt: "optional", inputs: [{ key: "image", label: "Start frame", accept: "image", required: true }] })).toBe(
+ "Add a start frame, add a few words if you like, then Generate.",
+ );
+ expect(presetHowTo({ type: "app", userPrompt: "none", inputs: [{ key: "image", label: "Your photo", accept: "image", required: true }] })).toBe(
+ "Add your photo, then Generate.",
+ );
+ });
+
+ it("handles presets without inputs", () => {
+ expect(presetHowTo({ type: "app", userPrompt: "required", inputs: [] })).toBe("Describe what you want, then Generate.");
+ expect(presetHowTo({ type: "app", userPrompt: "none", inputs: [] })).toBe("Press Generate — no inputs needed.");
+ });
+});