@hyperframes/studio 0.8.203 → 0.8.205
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.
- package/dist/assets/{hyperframes-player-C3pgGOtp.js → hyperframes-player-DzdSmJdB.js} +3 -3
- package/dist/assets/{index-5EFQxr70.js → index-C8hp9Y7c.js} +1 -1
- package/dist/assets/{index-BbcMyD3j.js → index-dy6GQJn4.js} +116 -116
- package/dist/{chunk-HZDCMUG4.js → chunk-Z5NKM57J.js} +2 -2
- package/dist/{domEditingLayers-SMVA3FEW.js → domEditingLayers-WMDSHU5P.js} +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.html +1 -1
- package/dist/index.js +609 -479
- package/package.json +8 -8
- package/src/components/DesktopGuideCard.tsx +1 -1
- package/src/components/OpenInDesktopButton.dom.test.tsx +27 -5
- package/src/components/editor/domEditingLayers.test.ts +38 -0
- package/src/components/editor/domEditingLayers.ts +2 -2
- package/src/components/renders/GifLoopInput.tsx +40 -0
- package/src/components/renders/GpuEncodingToggle.tsx +1 -1
- package/src/components/renders/RenderDurationNote.tsx +19 -0
- package/src/components/renders/RenderPreview.tsx +41 -0
- package/src/components/renders/RenderQueue.test.tsx +77 -0
- package/src/components/renders/RenderQueue.tsx +46 -41
- package/src/components/renders/RenderQueueInfo.tsx +61 -0
- package/src/components/renders/RenderQueueItem.test.tsx +46 -0
- package/src/components/renders/RenderQueueItem.tsx +10 -80
- package/src/components/renders/RenderQueuePanel.tsx +2 -1
- package/src/components/renders/renderSettings.ts +61 -2
- package/src/components/renders/useRenderQueue.ts +10 -2
- package/src/components/renders/useRenderQueueComposition.test.tsx +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.205",
|
|
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/core": "0.8.
|
|
64
|
-
"@hyperframes/parsers": "0.8.
|
|
65
|
-
"@hyperframes/
|
|
66
|
-
"@hyperframes/
|
|
67
|
-
"@hyperframes/shader-transitions": "0.8.
|
|
68
|
-
"@hyperframes/studio-server": "0.8.
|
|
63
|
+
"@hyperframes/core": "0.8.205",
|
|
64
|
+
"@hyperframes/parsers": "0.8.205",
|
|
65
|
+
"@hyperframes/sdk": "0.8.205",
|
|
66
|
+
"@hyperframes/player": "0.8.205",
|
|
67
|
+
"@hyperframes/shader-transitions": "0.8.205",
|
|
68
|
+
"@hyperframes/studio-server": "0.8.205"
|
|
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.
|
|
85
|
+
"@hyperframes/producer": "0.8.205"
|
|
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";
|
|
@@ -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 (
|
|
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 (
|
|
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 (
|
|
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: "
|
|
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: "
|
|
436
|
+
os: "freebsd",
|
|
415
437
|
app_installed: false,
|
|
416
438
|
download_available: false,
|
|
417
439
|
},
|
|
@@ -380,3 +380,41 @@ describe("domEditSelectionToFacts hasAudio", () => {
|
|
|
380
380
|
expect((await factsFor(`<div id="d1"></div>`)).hasAudio).toBe(false);
|
|
381
381
|
});
|
|
382
382
|
});
|
|
383
|
+
|
|
384
|
+
describe("collectDomEditLayerItems and clips the runtime hid", () => {
|
|
385
|
+
afterEach(() => {
|
|
386
|
+
document.body.innerHTML = "";
|
|
387
|
+
document.head.innerHTML = "";
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// As the runtime marks and styles a clip outside the playhead, with its rule that hides the clip's contents.
|
|
391
|
+
function filmWithHiddenScene(hiddenStyle: string): HTMLElement {
|
|
392
|
+
document.head.innerHTML = `<style>[data-hf-clip-hidden][data-hf-clip-hidden] * { visibility: hidden !important; }</style>`;
|
|
393
|
+
const cells = (prefix: string, n: number) =>
|
|
394
|
+
Array.from({ length: n }, (_, i) => `<div id="${prefix}-${i}"></div>`).join("");
|
|
395
|
+
document.body.innerHTML =
|
|
396
|
+
`<div data-composition-id="main">` +
|
|
397
|
+
`<div id="now" data-start="0" data-duration="5">${cells("now", 3)}</div>` +
|
|
398
|
+
`<div id="later" data-start="5" data-duration="5" data-hf-clip-hidden style="${hiddenStyle}">${cells("later", 50)}</div>` +
|
|
399
|
+
`</div>`;
|
|
400
|
+
return document.querySelector<HTMLElement>("[data-composition-id]")!;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
it("lists what is on screen without reading the style of anything inside a hidden clip", () => {
|
|
404
|
+
const root = filmWithHiddenScene("visibility: hidden");
|
|
405
|
+
const read = vi.spyOn(window, "getComputedStyle");
|
|
406
|
+
const ids = collectDomEditLayerItems(root, opts).map((item) => item.id);
|
|
407
|
+
const insideHidden = read.mock.calls.filter(([el]) =>
|
|
408
|
+
document.getElementById("later")!.contains(el),
|
|
409
|
+
);
|
|
410
|
+
expect(ids).toEqual(["now", "now-0", "now-1", "now-2"]);
|
|
411
|
+
expect(insideHidden).toHaveLength(0);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
// Older shader builds reveal a clip through its inline style alone, leaving the mark on.
|
|
415
|
+
it("still lists a marked clip whose inline style shows it", () => {
|
|
416
|
+
const root = filmWithHiddenScene("visibility: visible");
|
|
417
|
+
const ids = collectDomEditLayerItems(root, opts).map((item) => item.id);
|
|
418
|
+
expect(ids).toContain("later");
|
|
419
|
+
});
|
|
420
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
|
|
1
|
+
import { isClipHiddenByRuntime, PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
|
|
2
2
|
import { knownSourceAnswer, probeSourceElement, type ProbeTarget } from "./probeSourceElement";
|
|
3
3
|
import { isAudibleVideoNode } from "../../player/lib/timelineElementHelpers";
|
|
4
4
|
import type { PatchOperation } from "../../utils/sourcePatcher";
|
|
@@ -454,7 +454,7 @@ export function collectDomEditLayerItems(
|
|
|
454
454
|
const items: DomEditLayerItem[] = [];
|
|
455
455
|
// fallow-ignore-next-line complexity
|
|
456
456
|
const visit = (el: HTMLElement, depth: number) => {
|
|
457
|
-
if (items.length >= maxItems) return;
|
|
457
|
+
if (items.length >= maxItems || isClipHiddenByRuntime(el)) return;
|
|
458
458
|
|
|
459
459
|
const entry = readDomEditLayerWalkEntry(el, options.activeCompositionPath, cache);
|
|
460
460
|
if (entry) {
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { memo, useState, useRef, useEffect, useLayoutEffect, useId } from "react";
|
|
2
2
|
import { createPortal } from "react-dom";
|
|
3
3
|
import { CANVAS_DIMENSIONS } from "@hyperframes/parsers";
|
|
4
|
+
import { RenderDurationNote } from "./RenderDurationNote";
|
|
4
5
|
import { RenderQueueItem } from "./RenderQueueItem";
|
|
5
6
|
import { FfmpegRequiredNotice } from "./FfmpegRequiredNotice";
|
|
6
7
|
import type { FfmpegStatus } from "./useFfmpegStatus";
|
|
@@ -10,8 +11,18 @@ import { Select, type SelectOption } from "../ui/Select";
|
|
|
10
11
|
import { Tooltip } from "../ui/Tooltip";
|
|
11
12
|
import { resolveFloatingPanelPosition, type FloatingPosition } from "../editor/floatingPanel";
|
|
12
13
|
import type { RenderJob, ResolutionPreset } from "./useRenderQueue";
|
|
13
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
FORMAT_INFO,
|
|
16
|
+
resolveRenderFps,
|
|
17
|
+
getRenderFpsOptions,
|
|
18
|
+
getPersistedRenderSettings,
|
|
19
|
+
persistRenderSettings,
|
|
20
|
+
resolveRenderFormat,
|
|
21
|
+
startConfiguredRender,
|
|
22
|
+
isRenderExportBlocked,
|
|
23
|
+
} from "./renderSettings";
|
|
14
24
|
import { GpuEncodingToggle } from "./GpuEncodingToggle";
|
|
25
|
+
import { GifLoopInput, isInvalidGifLoop } from "./GifLoopInput";
|
|
15
26
|
import { trackStudioEvent } from "../../utils/studioTelemetry";
|
|
16
27
|
|
|
17
28
|
export interface CompositionDimensions {
|
|
@@ -20,11 +31,12 @@ export interface CompositionDimensions {
|
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
export type StartRenderHandler = (
|
|
23
|
-
format: "mp4" | "webm" | "mov",
|
|
34
|
+
format: "mp4" | "webm" | "mov" | "gif",
|
|
24
35
|
quality: "draft" | "standard" | "high",
|
|
25
36
|
resolution: ResolutionPreset | "auto",
|
|
26
37
|
fps: 24 | 30 | 60,
|
|
27
38
|
gpu?: boolean,
|
|
39
|
+
gifLoop?: number,
|
|
28
40
|
) => void | Promise<void>;
|
|
29
41
|
|
|
30
42
|
export interface RenderQueueProps {
|
|
@@ -136,21 +148,9 @@ function scaleOptionLabel(
|
|
|
136
148
|
return base;
|
|
137
149
|
}
|
|
138
150
|
|
|
139
|
-
const FORMAT_INFO: Record<"mp4" | "webm" | "mov", { label: string; desc: string }> = {
|
|
140
|
-
mp4: { label: "MP4", desc: "Best for general use. Smallest file, universal playback." },
|
|
141
|
-
mov: {
|
|
142
|
-
label: "MOV (ProRes 4444)",
|
|
143
|
-
desc: "Transparent video. Works in Final Cut Pro, DaVinci Resolve, and most video editors. Large files.",
|
|
144
|
-
},
|
|
145
|
-
webm: {
|
|
146
|
-
label: "WebM (VP9)",
|
|
147
|
-
desc: "Transparent video for web. Smaller than MOV but limited editor support.",
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
|
|
151
151
|
// Estimated, like COLOR_PICKER_SIZE in propertyPanelColor: only the flip
|
|
152
152
|
// decision uses the height, and the clamp keeps the panel on screen either way.
|
|
153
|
-
const FORMAT_PANEL_SIZE = { width: 208, height:
|
|
153
|
+
const FORMAT_PANEL_SIZE = { width: 208, height: 210 };
|
|
154
154
|
|
|
155
155
|
// Rich format guidance in a keyboard-reachable disclosure: the trigger is a
|
|
156
156
|
// real button (focusable, labelled), the panel is tied to it via
|
|
@@ -158,7 +158,7 @@ const FORMAT_PANEL_SIZE = { width: 208, height: 150 };
|
|
|
158
158
|
// for the one-line ui/Tooltip primitive, so this stays a local popover.
|
|
159
159
|
// It renders in a portal because the right panel is overflow-hidden: an
|
|
160
160
|
// in-flow absolute panel gets clipped at the panel edge.
|
|
161
|
-
function FormatInfoTooltip({ format }: { format: "mp4" | "webm" | "mov" }) {
|
|
161
|
+
function FormatInfoTooltip({ format }: { format: "mp4" | "webm" | "mov" | "gif" }) {
|
|
162
162
|
const [open, setOpen] = useState(false);
|
|
163
163
|
const [position, setPosition] = useState<FloatingPosition | null>(null);
|
|
164
164
|
const triggerRef = useRef<HTMLDivElement>(null);
|
|
@@ -243,7 +243,7 @@ function FormatInfoTooltip({ format }: { format: "mp4" | "webm" | "mov" }) {
|
|
|
243
243
|
<p className="text-step-10 font-semibold text-text-1 mb-0.5">{info.label}</p>
|
|
244
244
|
<p className="text-step-9 text-text-3 leading-tight">{info.desc}</p>
|
|
245
245
|
<div className="mt-1.5 pt-1.5 border-t border-border">
|
|
246
|
-
{(["mp4", "mov", "webm"] as const)
|
|
246
|
+
{(["mp4", "mov", "webm", "gif"] as const)
|
|
247
247
|
.filter((f) => f !== format)
|
|
248
248
|
.map((f) => (
|
|
249
249
|
<p key={f} className="text-step-9 text-text-4 leading-relaxed">
|
|
@@ -264,6 +264,7 @@ const FORMAT_OPTIONS: SelectOption[] = [
|
|
|
264
264
|
{ value: "mp4", label: "MP4" },
|
|
265
265
|
{ value: "mov", label: "MOV (ProRes)" },
|
|
266
266
|
{ value: "webm", label: "WebM" },
|
|
267
|
+
{ value: "gif", label: "GIF" },
|
|
267
268
|
];
|
|
268
269
|
|
|
269
270
|
const QUALITY_OPTIONS: SelectOption[] = [
|
|
@@ -272,17 +273,6 @@ const QUALITY_OPTIONS: SelectOption[] = [
|
|
|
272
273
|
{ value: "high", label: "High Quality" },
|
|
273
274
|
];
|
|
274
275
|
|
|
275
|
-
const FPS_OPTIONS: SelectOption[] = [
|
|
276
|
-
{ value: "24", label: "24 fps" },
|
|
277
|
-
{ value: "30", label: "30 fps" },
|
|
278
|
-
{ value: "60", label: "60 fps" },
|
|
279
|
-
];
|
|
280
|
-
|
|
281
|
-
function formatEta(ms: number): string {
|
|
282
|
-
const s = Math.round(ms / 1000);
|
|
283
|
-
return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
276
|
function FormatExportButton({
|
|
287
277
|
onStartRender,
|
|
288
278
|
isRendering,
|
|
@@ -301,17 +291,22 @@ function FormatExportButton({
|
|
|
301
291
|
onRecheckFfmpeg: () => void;
|
|
302
292
|
}) {
|
|
303
293
|
const persisted = getPersistedRenderSettings();
|
|
304
|
-
const [format, setFormat] = useState<"mp4" | "webm" | "mov">(persisted.format);
|
|
294
|
+
const [format, setFormat] = useState<"mp4" | "webm" | "mov" | "gif">(persisted.format);
|
|
305
295
|
const [quality, setQuality] = useState<"draft" | "standard" | "high">(persisted.quality);
|
|
306
296
|
const [resolution, setResolution] = useState<RenderScale>("auto");
|
|
307
|
-
const [
|
|
297
|
+
const [requestedFps, setFps] = useState<24 | 30 | 60>(persisted.fps);
|
|
298
|
+
const fps = resolveRenderFps(format, requestedFps);
|
|
308
299
|
const [gpu, setGpu] = useState(persisted.gpu);
|
|
300
|
+
const [gifLoop, setGifLoop] = useState("0");
|
|
301
|
+
const loopCount = Number(gifLoop);
|
|
302
|
+
const invalidGifLoop = isInvalidGifLoop(format, gifLoop);
|
|
309
303
|
|
|
310
304
|
// Only a definite "not installed" blocks Export. A null status means the
|
|
311
305
|
// probe gave no answer, and refusing to export on no answer would break
|
|
312
306
|
// setups that are perfectly fine. Holding the narrowed value rather than a
|
|
313
307
|
// boolean keeps the notice from re-testing what this line already decided.
|
|
314
308
|
const missingFfmpeg = ffmpeg && !ffmpeg.ok ? ffmpeg : null;
|
|
309
|
+
const exportBlocked = isRenderExportBlocked(isRendering, missingFfmpeg !== null, invalidGifLoop);
|
|
315
310
|
|
|
316
311
|
// MOV (ProRes) is a fixed-quality codec — quality selector has no effect.
|
|
317
312
|
const showQuality = format !== "mov";
|
|
@@ -337,9 +332,9 @@ function FormatExportButton({
|
|
|
337
332
|
options={FORMAT_OPTIONS}
|
|
338
333
|
disabled={isRendering}
|
|
339
334
|
onCommit={(next) => {
|
|
340
|
-
const v = next
|
|
335
|
+
const v = resolveRenderFormat(next);
|
|
341
336
|
setFormat(v);
|
|
342
|
-
persistRenderSettings(v, quality,
|
|
337
|
+
persistRenderSettings(v, quality, resolveRenderFps(v, requestedFps));
|
|
343
338
|
}}
|
|
344
339
|
/>
|
|
345
340
|
</div>
|
|
@@ -362,7 +357,7 @@ function FormatExportButton({
|
|
|
362
357
|
<Select
|
|
363
358
|
label="Frame rate"
|
|
364
359
|
value={String(fps)}
|
|
365
|
-
options={
|
|
360
|
+
options={getRenderFpsOptions(format)}
|
|
366
361
|
disabled={isRendering}
|
|
367
362
|
onCommit={(next) => {
|
|
368
363
|
const v = Number(next) as 24 | 30 | 60;
|
|
@@ -388,6 +383,13 @@ function FormatExportButton({
|
|
|
388
383
|
</div>
|
|
389
384
|
)}
|
|
390
385
|
</div>
|
|
386
|
+
<GifLoopInput
|
|
387
|
+
format={format}
|
|
388
|
+
value={gifLoop}
|
|
389
|
+
disabled={isRendering}
|
|
390
|
+
invalid={invalidGifLoop}
|
|
391
|
+
onChange={setGifLoop}
|
|
392
|
+
/>
|
|
391
393
|
<GpuEncodingToggle
|
|
392
394
|
format={format}
|
|
393
395
|
checked={gpu}
|
|
@@ -402,15 +404,22 @@ function FormatExportButton({
|
|
|
402
404
|
size="md"
|
|
403
405
|
data-testid="renders-export"
|
|
404
406
|
loading={isRendering}
|
|
405
|
-
disabled={
|
|
407
|
+
disabled={exportBlocked}
|
|
406
408
|
title={missingFfmpeg ? "Install FFmpeg to export. See the note above." : undefined}
|
|
407
409
|
onClick={() => {
|
|
408
410
|
// loading already disables the button; this guard also stops a
|
|
409
411
|
// double-click in the same frame from enqueueing two renders.
|
|
410
|
-
if (
|
|
412
|
+
if (exportBlocked) return;
|
|
411
413
|
const outputResolution = resolveResolution(resolution, compositionDimensions);
|
|
412
414
|
trackStudioEvent("render_start", { format, quality, resolution: outputResolution, fps });
|
|
413
|
-
void onStartRender
|
|
415
|
+
void startConfiguredRender(onStartRender, {
|
|
416
|
+
format,
|
|
417
|
+
quality,
|
|
418
|
+
resolution: outputResolution,
|
|
419
|
+
fps,
|
|
420
|
+
gpu,
|
|
421
|
+
gifLoop: loopCount,
|
|
422
|
+
});
|
|
414
423
|
}}
|
|
415
424
|
// Width only. A type size or a weight here would win the merge against
|
|
416
425
|
// the size recipe and leave this Export a step away from the header's
|
|
@@ -419,11 +428,7 @@ function FormatExportButton({
|
|
|
419
428
|
>
|
|
420
429
|
{isRendering ? "Rendering…" : "Export"}
|
|
421
430
|
</Button>
|
|
422
|
-
{lastRenderDurationMs
|
|
423
|
-
<p className="text-step-9 text-text-5 text-center -mt-1.5">
|
|
424
|
-
Last render took {formatEta(lastRenderDurationMs)}
|
|
425
|
-
</p>
|
|
426
|
-
)}
|
|
431
|
+
<RenderDurationNote durationMs={lastRenderDurationMs} isRendering={isRendering} />
|
|
427
432
|
</div>
|
|
428
433
|
);
|
|
429
434
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { RenderJob } from "./useRenderQueue";
|
|
2
|
+
|
|
3
|
+
function formatDuration(ms: number): string {
|
|
4
|
+
if (ms < 1000) return `${ms}ms`;
|
|
5
|
+
const s = Math.round(ms / 1000);
|
|
6
|
+
return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function formatTimeAgo(timestamp: number): string {
|
|
10
|
+
const diff = Date.now() - timestamp;
|
|
11
|
+
if (diff < 60000) return "just now";
|
|
12
|
+
if (diff < 3600000) return `${Math.floor(diff / 60000)}m ago`;
|
|
13
|
+
return `${Math.floor(diff / 3600000)}h ago`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function RenderQueueInfo({ job }: { job: RenderJob }) {
|
|
17
|
+
const isRendering = job.status === "rendering";
|
|
18
|
+
return (
|
|
19
|
+
<div className="flex-1 min-w-0">
|
|
20
|
+
<div className="flex items-center gap-1.5">
|
|
21
|
+
<span className="text-step-11 font-medium text-text-2 truncate">{job.filename}</span>
|
|
22
|
+
{job.durationMs && (
|
|
23
|
+
<span className="text-step-9 text-text-5 shrink-0">{formatDuration(job.durationMs)}</span>
|
|
24
|
+
)}
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
{isRendering && (
|
|
28
|
+
<div className="mt-1">
|
|
29
|
+
<div className="flex items-center justify-between mb-0.5">
|
|
30
|
+
<span className="text-step-9 text-text-4">{job.stage || "Rendering"}</span>
|
|
31
|
+
<span className="text-step-9 font-mono text-accent-ink">{job.progress}%</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div
|
|
34
|
+
className="w-full h-1 bg-border rounded-full overflow-hidden"
|
|
35
|
+
role="progressbar"
|
|
36
|
+
aria-valuenow={job.progress}
|
|
37
|
+
aria-valuemin={0}
|
|
38
|
+
aria-valuemax={100}
|
|
39
|
+
aria-label={`Render progress: ${job.progress}%`}
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
className="h-full bg-accent rounded-full transition-all duration-300"
|
|
43
|
+
style={{ width: `${job.progress}%` }}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
48
|
+
|
|
49
|
+
{job.status === "failed" && job.error && (
|
|
50
|
+
<span className="text-step-9 text-danger-ink mt-0.5 block">{job.error}</span>
|
|
51
|
+
)}
|
|
52
|
+
{job.status === "cancelled" && (
|
|
53
|
+
<span className="text-step-9 text-text-4 mt-0.5 block">Cancelled</span>
|
|
54
|
+
)}
|
|
55
|
+
|
|
56
|
+
{!isRendering && (
|
|
57
|
+
<span className="text-step-9 text-text-5">{formatTimeAgo(job.createdAt)}</span>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|