@hyperframes/studio 0.8.204 → 0.8.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/assets/hyperframes-player-lCVwx9d3.js +478 -0
  2. package/dist/assets/{index-DpxSurnJ.js → index-BNuxGFZK.js} +1 -1
  3. package/dist/assets/{index-DmST2bTJ.js → index-CwreIGoq.js} +132 -132
  4. package/dist/{chunk-Z5NKM57J.js → chunk-3EAFE522.js} +8 -4
  5. package/dist/{chunk-2YCKGJFD.js → chunk-DAZTBGYM.js} +1 -1
  6. package/dist/{chunk-T43DM7Q6.js → chunk-OGIOFEC7.js} +4 -2
  7. package/dist/{domEditingLayers-WMDSHU5P.js → domEditingLayers-7Z6J4UOK.js} +2 -2
  8. package/dist/index.d.ts +4 -3
  9. package/dist/index.html +1 -1
  10. package/dist/index.js +699 -554
  11. package/dist/player.js +2 -2
  12. package/package.json +8 -8
  13. package/src/components/DesktopGuideCard.tsx +1 -1
  14. package/src/components/MediaPreview.test.tsx +69 -0
  15. package/src/components/MediaPreview.tsx +10 -5
  16. package/src/components/OpenInDesktopButton.dom.test.tsx +27 -5
  17. package/src/components/editor/domEditLayerWalkCache.test.ts +48 -0
  18. package/src/components/editor/domEditLayerWalkCache.ts +6 -0
  19. package/src/components/editor/domEditingLayers.ts +3 -2
  20. package/src/components/renders/GifLoopInput.tsx +40 -0
  21. package/src/components/renders/GpuEncodingToggle.tsx +1 -1
  22. package/src/components/renders/RenderDurationNote.tsx +19 -0
  23. package/src/components/renders/RenderPreview.tsx +41 -0
  24. package/src/components/renders/RenderQueue.test.tsx +77 -0
  25. package/src/components/renders/RenderQueue.tsx +46 -41
  26. package/src/components/renders/RenderQueueInfo.tsx +61 -0
  27. package/src/components/renders/RenderQueueItem.test.tsx +46 -0
  28. package/src/components/renders/RenderQueueItem.tsx +10 -80
  29. package/src/components/renders/RenderQueuePanel.tsx +2 -1
  30. package/src/components/renders/renderSettings.ts +61 -2
  31. package/src/components/renders/useRenderQueue.ts +10 -2
  32. package/src/components/renders/useRenderQueueComposition.test.tsx +13 -0
  33. package/src/components/sidebar/PromptPreviewModal.test.tsx +22 -0
  34. package/src/components/sidebar/PromptPreviewModal.tsx +1 -0
  35. package/src/player/hooks/previewMessageRouter.test.ts +34 -0
  36. package/src/player/hooks/previewMessageRouter.ts +14 -3
  37. package/src/utils/sourceScopedSelectorIndex.ts +5 -2
  38. package/dist/assets/hyperframes-player-CttA4PW7.js +0 -478
package/dist/player.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Player
3
- } from "./chunk-2YCKGJFD.js";
3
+ } from "./chunk-DAZTBGYM.js";
4
4
  import "./chunk-7HZGKFFU.js";
5
- import "./chunk-T43DM7Q6.js";
5
+ import "./chunk-OGIOFEC7.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  Player
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio",
3
- "version": "0.8.204",
3
+ "version": "0.8.206",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,12 +60,12 @@
60
60
  "dockview-react": "8.3.1",
61
61
  "gsap": "^3.13.0",
62
62
  "mediabunny": "^1.45.3",
63
- "@hyperframes/parsers": "0.8.204",
64
- "@hyperframes/player": "0.8.204",
65
- "@hyperframes/shader-transitions": "0.8.204",
66
- "@hyperframes/sdk": "0.8.204",
67
- "@hyperframes/studio-server": "0.8.204",
68
- "@hyperframes/core": "0.8.204"
63
+ "@hyperframes/core": "0.8.206",
64
+ "@hyperframes/player": "0.8.206",
65
+ "@hyperframes/sdk": "0.8.206",
66
+ "@hyperframes/shader-transitions": "0.8.206",
67
+ "@hyperframes/studio-server": "0.8.206",
68
+ "@hyperframes/parsers": "0.8.206"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@tailwindcss/vite": "^4.3.3",
@@ -82,7 +82,7 @@
82
82
  "vite": "^6.4.2",
83
83
  "vitest": "^4.1.11",
84
84
  "zustand": "^5.0.0",
85
- "@hyperframes/producer": "0.8.204"
85
+ "@hyperframes/producer": "0.8.206"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "19",
@@ -15,7 +15,7 @@ export type DesktopRoute = {
15
15
 
16
16
  /** The OS for the download, and what "this …" calls the machine. */
17
17
  const platformName = (os: string): string =>
18
- os === "darwin" ? "Mac" : os === "linux" ? "Linux" : "your computer";
18
+ os === "darwin" ? "Mac" : os === "linux" ? "Linux" : os === "win32" ? "Windows" : "your computer";
19
19
  const deviceName = (os: string): string => (os === "darwin" ? "Mac" : "computer");
20
20
 
21
21
  const NOTE = "mt-0.5 text-step-12 text-text-2 text-pretty";
@@ -0,0 +1,69 @@
1
+ // @vitest-environment happy-dom
2
+ import { act } from "react";
3
+ import { createRoot, type Root } from "react-dom/client";
4
+ import { afterEach, describe, expect, it } from "vitest";
5
+ import { MediaPreview } from "./MediaPreview";
6
+
7
+ (globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
8
+
9
+ let root: Root | null = null;
10
+ let host: HTMLDivElement | null = null;
11
+
12
+ afterEach(() => {
13
+ if (root) act(() => root?.unmount());
14
+ root = null;
15
+ host = null;
16
+ document.body.replaceChildren();
17
+ });
18
+
19
+ async function renderPreview(projectId: string, filePath: string): Promise<HTMLDivElement> {
20
+ if (!root) {
21
+ host = document.createElement("div");
22
+ document.body.append(host);
23
+ root = createRoot(host);
24
+ }
25
+ await act(async () => {
26
+ root?.render(<MediaPreview projectId={projectId} filePath={filePath} />);
27
+ });
28
+ return host as HTMLDivElement;
29
+ }
30
+
31
+ describe("MediaPreview", () => {
32
+ it("retries a repaired file after visiting another media source", async () => {
33
+ const host = await renderPreview("test", "broken.png");
34
+ const failedImage = host.querySelector("img");
35
+ expect(failedImage).not.toBeNull();
36
+
37
+ await act(async () => {
38
+ failedImage?.dispatchEvent(new Event("error"));
39
+ });
40
+ expect(host.textContent).toContain("Couldn't load this file");
41
+
42
+ await renderPreview("test", "healthy.png");
43
+ expect(host.querySelector("img")?.getAttribute("src")).toContain("healthy.png");
44
+
45
+ await renderPreview("test", "broken.png");
46
+ expect(host.querySelector("img")?.getAttribute("src")).toContain("broken.png");
47
+ });
48
+
49
+ it("resets failure state when the project changes, but preserves a current failure", async () => {
50
+ const host = await renderPreview("first", "broken.png");
51
+ const image = host.querySelector("img");
52
+ await act(async () => {
53
+ image?.dispatchEvent(new Event("error"));
54
+ });
55
+ expect(host.textContent).toContain("Couldn't load this file");
56
+
57
+ await renderPreview("second", "broken.png");
58
+ expect(host.querySelector("img")?.getAttribute("src")).toContain("/second/preview/broken.png");
59
+
60
+ const secondImage = host.querySelector("img");
61
+ await act(async () => {
62
+ secondImage?.dispatchEvent(new Event("error"));
63
+ });
64
+ expect(host.textContent).toContain("Couldn't load this file");
65
+
66
+ await renderPreview("second", "broken.png");
67
+ expect(host.querySelector("img")).toBeNull();
68
+ });
69
+ });
@@ -1,5 +1,5 @@
1
1
  import { buildProjectApiPath } from "../utils/projectRouting";
2
- import { useState } from "react";
2
+ import { useEffect, useState } from "react";
3
3
  import { IMAGE_EXT, VIDEO_EXT, AUDIO_EXT } from "../utils/mediaTypes";
4
4
  import { encodeUrlPath } from "@hyperframes/parsers";
5
5
 
@@ -32,10 +32,15 @@ function MediaErrorPanel({ name, filePath }: { name: string; filePath: string })
32
32
  export function MediaPreview({ projectId, filePath }: { projectId: string; filePath: string }) {
33
33
  const serveUrl = buildProjectApiPath(projectId, `/preview/${encodeUrlPath(filePath)}`);
34
34
  const name = filePath.split("/").pop() ?? filePath;
35
- // Keyed by path so switching to another file clears a previous failure.
36
- const [failedPath, setFailedPath] = useState<string | null>(null);
37
- const failed = failedPath === filePath;
38
- const setFailed = () => setFailedPath(filePath);
35
+ const [failure, setFailure] = useState<{ source: string; failed: boolean }>({
36
+ source: serveUrl,
37
+ failed: false,
38
+ });
39
+ useEffect(() => {
40
+ setFailure({ source: serveUrl, failed: false });
41
+ }, [serveUrl]);
42
+ const failed = failure.source === serveUrl && failure.failed;
43
+ const setFailed = () => setFailure({ source: serveUrl, failed: true });
39
44
 
40
45
  if (failed) return <MediaErrorPanel name={name} filePath={filePath} />;
41
46
 
@@ -103,19 +103,19 @@ it("stays hidden where the server has no hand-off (the desktop's own Studio)", a
103
103
  expect(button()).toBeNull();
104
104
  });
105
105
 
106
- it("stays hidden when the app has no build for this machine (Windows)", async () => {
106
+ it("stays hidden when the app has no build for this machine (FreeBSD)", async () => {
107
107
  serve(Response.json({ available: false, handoff: true, downloadUrl: null }));
108
108
  await mount();
109
109
  expect(button()).toBeNull();
110
110
  });
111
111
 
112
- it("with the app installed but no download (Windows), shows only once the app can take the project", async () => {
112
+ it("with the app installed but no download (FreeBSD), shows only once the app can take the project", async () => {
113
113
  serve(Response.json({ available: true, handoff: false, downloadUrl: null }));
114
114
  await mount();
115
115
  expect(button()).toBeNull();
116
116
  });
117
117
 
118
- it("opens the project in an installed app that has no download (Windows)", async () => {
118
+ it("opens the project in an installed app that has no download (FreeBSD)", async () => {
119
119
  serve(Response.json({ available: true, handoff: true, downloadUrl: null }), {
120
120
  opened: true,
121
121
  app: "the HyperFrames desktop app",
@@ -381,6 +381,28 @@ it("where the app is installed but cannot take a project (Linux), step 3 shows t
381
381
  expect(posts).toBe(0);
382
382
  });
383
383
 
384
+ it("on Windows, step 1 names the Windows download and opens it tagged", async () => {
385
+ const opened: string[] = [];
386
+ vi.stubGlobal("open", (url: string) => (opened.push(url), { opener: {} }));
387
+ serve(
388
+ Response.json({
389
+ available: true,
390
+ handoff: false,
391
+ downloadUrl: `${DOWNLOAD}?os=windows`,
392
+ os: "win32",
393
+ installed: false,
394
+ }),
395
+ );
396
+ await mount();
397
+ expect(button()).not.toBeNull();
398
+ await act(async () => button()!.click());
399
+ await act(async () => cardButton("Download for Windows")!.click());
400
+ expect(opened).toEqual([tagged(`${DOWNLOAD}?os=windows`)]);
401
+ expect(events("desktop_cta_eligibility")).toEqual([
402
+ { eligibility: "download", os: "win32", app_installed: false, download_available: true },
403
+ ]);
404
+ });
405
+
384
406
  it("counts where the button can show, the app here, and platforms with no app", async () => {
385
407
  serve(
386
408
  Response.json({
@@ -402,7 +424,7 @@ it("counts where the button can show, the app here, and platforms with no app",
402
424
  available: false,
403
425
  handoff: false,
404
426
  downloadUrl: null,
405
- os: "win32",
427
+ os: "freebsd",
406
428
  installed: false,
407
429
  }),
408
430
  );
@@ -411,7 +433,7 @@ it("counts where the button can show, the app here, and platforms with no app",
411
433
  expect(events("desktop_cta_eligibility")).toEqual([
412
434
  {
413
435
  eligibility: "no_app_for_platform",
414
- os: "win32",
436
+ os: "freebsd",
415
437
  app_installed: false,
416
438
  download_available: false,
417
439
  },
@@ -148,6 +148,54 @@ describe("collectDomEditLayerItems incremental rebuild", () => {
148
148
  });
149
149
  });
150
150
 
151
+ it("queries the document for no selector when a walk meets elements it has not seen", () => {
152
+ const root = mountPreview(12);
153
+ const boxes = Array.from(root.querySelectorAll<HTMLElement>(".box"));
154
+ // The scenes a scrub has not reached yet: hidden, so no identity is read for them.
155
+ for (const box of boxes.slice(6)) box.style.display = "none";
156
+ const cache = createDomEditLayerWalkCache();
157
+ const observer = new MutationObserver(() => {});
158
+ observer.observe(document.documentElement, DOM_EDIT_LAYER_OBSERVER_INIT);
159
+ try {
160
+ collectDomEditLayerItems(root, opts, undefined, cache);
161
+ for (const box of boxes.slice(6)) box.style.display = "";
162
+ cache.ingest(observer.takeRecords());
163
+
164
+ const real = document.querySelectorAll.bind(document);
165
+ let queries = 0;
166
+ Object.defineProperty(document, "querySelectorAll", {
167
+ configurable: true,
168
+ value: (selector: string) => {
169
+ queries += 1;
170
+ return real(selector);
171
+ },
172
+ });
173
+ let kept: DomEditLayerItem[];
174
+ try {
175
+ kept = collectDomEditLayerItems(root, opts, undefined, cache);
176
+ } finally {
177
+ delete (document as Partial<Document>).querySelectorAll;
178
+ }
179
+ // The revealed cards are in the kept index for their selector.
180
+ expect(queries).toBe(0);
181
+ expect(shape(kept)).toEqual(shape(collectDomEditLayerItems(root, opts)));
182
+ } finally {
183
+ observer.disconnect();
184
+ }
185
+ });
186
+
187
+ it("builds the selector index again once a node is added", () => {
188
+ withWarmWalk(6, ({ root, cache, observer }) => {
189
+ const added = document.createElement("div");
190
+ added.className = "box";
191
+ root.insertBefore(added, root.firstElementChild);
192
+ cache.ingest(observer.takeRecords());
193
+
194
+ const kept = collectDomEditLayerItems(root, opts, undefined, cache);
195
+ expect(shape(kept)).toEqual(shape(collectDomEditLayerItems(root, opts)));
196
+ });
197
+ });
198
+
151
199
  /**
152
200
  * The equivalence half, and the one that would catch a wrong optimisation
153
201
  * rather than a missing one. Every mutation KIND the invalidation reasons
@@ -47,6 +47,7 @@ import {
47
47
  resolveDomLayerIdentity,
48
48
  } from "./domEditingElement";
49
49
  import type { DomEditSelection } from "./domEditingTypes";
50
+ import type { KeptIndexes } from "../../utils/sourceScopedSelectorIndex";
50
51
 
51
52
  /** How an element is addressed. Survives style writes; see `readIdentity`. */
52
53
  export type DomEditLayerIdentity = Pick<
@@ -160,16 +161,20 @@ export interface DomEditLayerWalkCache {
160
161
  ingest(records: MutationRecord[]): void;
161
162
  /** Forget every entry — the fallback for anything not attributable. */
162
163
  invalidateAll(): void;
164
+ /** Selector occurrence indexes, kept across walks and dropped with `identities`, which derive from them. */
165
+ readonly selectorIndex: KeptIndexes;
163
166
  }
164
167
 
165
168
  export function createDomEditLayerWalkCache(): DomEditLayerWalkCache {
166
169
  let presence = new WeakMap<HTMLElement, PresenceMemo>();
167
170
  let identities = new WeakMap<HTMLElement, IdentityMemo>();
168
171
  let scope: string | null = null;
172
+ const selectorIndex: KeptIndexes = new Map();
169
173
 
170
174
  const invalidateAll = () => {
171
175
  presence = new WeakMap();
172
176
  identities = new WeakMap();
177
+ selectorIndex.clear();
173
178
  };
174
179
 
175
180
  const drop = (el: HTMLElement | null) => {
@@ -262,6 +267,7 @@ export function createDomEditLayerWalkCache(): DomEditLayerWalkCache {
262
267
  }
263
268
  },
264
269
  invalidateAll,
270
+ selectorIndex,
265
271
  };
266
272
  }
267
273
 
@@ -487,10 +487,11 @@ export function collectDomEditLayerItems(
487
487
  // card or tile class. The walk is one synchronous read of a document it does
488
488
  // not mutate, so one index per selector serves the whole of it. The pass lives
489
489
  // here rather than in each caller because this function owns the loop.
490
- withSelectorIndexPass(root.ownerDocument, () => {
490
+ const walkRoots = () => {
491
491
  // Drilled into a group → show only its members; otherwise the whole tree.
492
492
  for (const el of groupScopedLayerRoots(root, options.activeGroupElement ?? null)) visit(el, 0);
493
- });
493
+ };
494
+ withSelectorIndexPass(root.ownerDocument, walkRoots, cache?.selectorIndex);
494
495
  return items;
495
496
  }
496
497
 
@@ -0,0 +1,40 @@
1
+ export function isInvalidGifLoop(format: string, value: string): boolean {
2
+ return format === "gif" && !isValidGifLoop(value);
3
+ }
4
+
5
+ function isValidGifLoop(value: string): boolean {
6
+ const count = Number(value);
7
+ return value.trim() !== "" && Number.isInteger(count) && count >= 0 && count <= 65535;
8
+ }
9
+
10
+ export function GifLoopInput({
11
+ format,
12
+ value,
13
+ disabled,
14
+ invalid,
15
+ onChange,
16
+ }: {
17
+ format: string;
18
+ value: string;
19
+ disabled: boolean;
20
+ invalid: boolean;
21
+ onChange: (value: string) => void;
22
+ }) {
23
+ if (format !== "gif") return null;
24
+ return (
25
+ <label className="flex flex-col gap-1 text-step-10 text-text-4">
26
+ GIF loop count (0 = forever, max 65535)
27
+ <input
28
+ type="number"
29
+ min={0}
30
+ max={65535}
31
+ step={1}
32
+ value={value}
33
+ disabled={disabled}
34
+ aria-invalid={invalid}
35
+ onChange={(event) => onChange(event.target.value)}
36
+ className="rounded-sm bg-input border border-border-input px-2 py-1 text-text-1"
37
+ />
38
+ </label>
39
+ );
40
+ }
@@ -4,7 +4,7 @@ export function GpuEncodingToggle({
4
4
  disabled,
5
5
  onToggle,
6
6
  }: {
7
- format: "mp4" | "webm" | "mov";
7
+ format: "mp4" | "webm" | "mov" | "gif";
8
8
  checked: boolean;
9
9
  disabled: boolean;
10
10
  onToggle: () => void;
@@ -0,0 +1,19 @@
1
+ function formatEta(ms: number): string {
2
+ const s = Math.round(ms / 1000);
3
+ return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`;
4
+ }
5
+
6
+ export function RenderDurationNote({
7
+ durationMs,
8
+ isRendering,
9
+ }: {
10
+ durationMs?: number;
11
+ isRendering: boolean;
12
+ }) {
13
+ if (durationMs === undefined || isRendering) return null;
14
+ return (
15
+ <p className="text-step-9 text-text-5 text-center -mt-1.5">
16
+ Last render took {formatEta(durationMs)}
17
+ </p>
18
+ );
19
+ }
@@ -0,0 +1,41 @@
1
+ import { VideoFrameThumbnail } from "../ui/VideoFrameThumbnail";
2
+
3
+ export function RenderPreview({
4
+ filename,
5
+ src,
6
+ hovered,
7
+ ready,
8
+ onReady,
9
+ }: {
10
+ filename: string;
11
+ src: string;
12
+ hovered: boolean;
13
+ ready: boolean;
14
+ onReady: () => void;
15
+ }) {
16
+ if (filename.endsWith(".gif")) {
17
+ return <img src={src} alt={filename} className="w-full h-full object-contain" />;
18
+ }
19
+ return (
20
+ <>
21
+ {hovered && (
22
+ <video
23
+ src={src}
24
+ autoPlay
25
+ muted
26
+ loop
27
+ playsInline
28
+ onCanPlay={onReady}
29
+ className="absolute inset-0 w-full h-full object-contain transition-opacity duration-150"
30
+ style={{ opacity: ready ? 1 : 0 }}
31
+ />
32
+ )}
33
+ <div
34
+ className="absolute inset-0 transition-opacity duration-150"
35
+ style={{ opacity: hovered && ready ? 0 : 1 }}
36
+ >
37
+ <VideoFrameThumbnail src={src} />
38
+ </div>
39
+ </>
40
+ );
41
+ }
@@ -275,3 +275,80 @@ describe("RenderQueue FFmpeg gate", () => {
275
275
  expect(exportButtonIn(host).disabled).toBe(false);
276
276
  });
277
277
  });
278
+
279
+ function mountGifQueue() {
280
+ localStorage.setItem("hf-studio-render-settings", JSON.stringify({ format: "gif" }));
281
+ const onStartRender: Mock<StartRenderHandler> = vi.fn();
282
+ return { onStartRender, host: mountRenderQueue(onStartRender) };
283
+ }
284
+
285
+ function enterGifLoop(host: HTMLElement, value: string) {
286
+ const input = host.querySelector<HTMLInputElement>('input[type="number"]');
287
+ if (!input) throw new Error("missing loop count");
288
+ act(() => {
289
+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
290
+ setter?.call(input, value);
291
+ input.dispatchEvent(new Event("input", { bubbles: true }));
292
+ });
293
+ return input;
294
+ }
295
+
296
+ describe("GIF export controls", () => {
297
+ it("offers GIF, persists the selection, and exports with infinite looping", async () => {
298
+ const onStartRender: Mock<StartRenderHandler> = vi.fn();
299
+ const host = mountRenderQueue(onStartRender);
300
+ await chooseByArrowing(triggerFor(host, "Format"), 3);
301
+ expect(getPersistedRenderSettings().format).toBe("gif");
302
+ const input = host.querySelector<HTMLInputElement>('input[type="number"]');
303
+ expect(input?.value).toBe("0");
304
+ act(() => exportButtonIn(host).click());
305
+ expect(onStartRender).toHaveBeenCalledWith("gif", "standard", "auto", 30, false, 0);
306
+ });
307
+
308
+ it("restores GIF settings and exports a finite loop count", () => {
309
+ const { host, onStartRender } = mountGifQueue();
310
+ enterGifLoop(host, "3");
311
+ act(() => exportButtonIn(host).click());
312
+ expect(onStartRender).toHaveBeenCalledWith("gif", "standard", "auto", 30, false, 3);
313
+ });
314
+
315
+ it.each(["", "-1", "1.5", "65536"])("blocks export for invalid GIF loop count %j", (value) => {
316
+ const { host, onStartRender } = mountGifQueue();
317
+ const input = enterGifLoop(host, value);
318
+ expect(input.getAttribute("aria-invalid")).toBe("true");
319
+ expect(exportButtonIn(host).disabled).toBe(true);
320
+ act(() => exportButtonIn(host).click());
321
+ expect(onStartRender).not.toHaveBeenCalled();
322
+ });
323
+ });
324
+
325
+ describe("GIF frame-rate controls", () => {
326
+ it("caps a saved GIF frame rate of 60 and disables that option", async () => {
327
+ localStorage.setItem("hf-studio-render-settings", JSON.stringify({ format: "gif", fps: 60 }));
328
+ const onStartRender: Mock<StartRenderHandler> = vi.fn();
329
+ const host = mountRenderQueue(onStartRender);
330
+ const fps = triggerFor(host, "Frame rate");
331
+ expect(fps.textContent).toContain("30 fps");
332
+ act(() => exportButtonIn(host).click());
333
+ expect(onStartRender).toHaveBeenCalledWith("gif", "standard", "auto", 30, false, 0);
334
+ act(() => fps.click());
335
+ await settle();
336
+ const sixty = Array.from(document.querySelectorAll('[role="option"]')).find((option) =>
337
+ option.textContent?.includes("60 fps"),
338
+ );
339
+ expect(sixty?.getAttribute("aria-disabled")).toBe("true");
340
+ });
341
+
342
+ it("switches a 60 fps video to a 30 fps GIF and preserves 60 fps for video", async () => {
343
+ localStorage.setItem("hf-studio-render-settings", JSON.stringify({ format: "mp4", fps: 60 }));
344
+ const onStartRender: Mock<StartRenderHandler> = vi.fn();
345
+ const host = mountRenderQueue(onStartRender);
346
+ act(() => exportButtonIn(host).click());
347
+ expect(onStartRender).toHaveBeenLastCalledWith("mp4", "standard", "auto", 60, false);
348
+ await chooseByArrowing(triggerFor(host, "Format"), 3);
349
+ expect(triggerFor(host, "Frame rate").textContent).toContain("30 fps");
350
+ expect(getPersistedRenderSettings()).toMatchObject({ format: "gif", fps: 30 });
351
+ act(() => exportButtonIn(host).click());
352
+ expect(onStartRender).toHaveBeenLastCalledWith("gif", "standard", "auto", 30, false, 0);
353
+ });
354
+ });