@hyperframes/studio 0.8.204 → 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-CttA4PW7.js → hyperframes-player-DzdSmJdB.js} +3 -3
- package/dist/assets/{index-DpxSurnJ.js → index-C8hp9Y7c.js} +1 -1
- package/dist/assets/{index-DmST2bTJ.js → index-dy6GQJn4.js} +116 -116
- package/dist/index.d.ts +4 -3
- package/dist/index.html +1 -1
- package/dist/index.js +607 -477
- package/package.json +8 -8
- package/src/components/DesktopGuideCard.tsx +1 -1
- package/src/components/OpenInDesktopButton.dom.test.tsx +27 -5
- 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { buildProjectApiPath } from "../../utils/projectRouting";
|
|
2
2
|
import { memo, useCallback, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { RenderQueueInfo } from "./RenderQueueInfo";
|
|
4
|
+
import { RenderPreview } from "./RenderPreview";
|
|
4
5
|
import { Button } from "../ui/Button";
|
|
5
6
|
import { IconButton } from "../ui/IconButton";
|
|
6
7
|
import { Tooltip } from "../ui/Tooltip";
|
|
@@ -13,19 +14,6 @@ interface RenderQueueItemProps {
|
|
|
13
14
|
onCancel: () => void;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
function formatDuration(ms: number): string {
|
|
17
|
-
if (ms < 1000) return `${ms}ms`;
|
|
18
|
-
const s = Math.round(ms / 1000);
|
|
19
|
-
return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function formatTimeAgo(timestamp: number): string {
|
|
23
|
-
const diff = Date.now() - timestamp;
|
|
24
|
-
if (diff < 60000) return "just now";
|
|
25
|
-
if (diff < 3600000) return `${Math.floor(diff / 60000)}m ago`;
|
|
26
|
-
return `${Math.floor(diff / 3600000)}h ago`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
/** Static frame extracted once via hidden video + canvas. */
|
|
30
18
|
|
|
31
19
|
export const RenderQueueItem = memo(function RenderQueueItem({
|
|
@@ -85,28 +73,13 @@ export const RenderQueueItem = memo(function RenderQueueItem({
|
|
|
85
73
|
].join(" ")}
|
|
86
74
|
>
|
|
87
75
|
{isComplete && (
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
loop
|
|
96
|
-
playsInline
|
|
97
|
-
onCanPlay={() => setVideoReady(true)}
|
|
98
|
-
className="absolute inset-0 w-full h-full object-contain transition-opacity duration-150"
|
|
99
|
-
style={{ opacity: videoReady ? 1 : 0 }}
|
|
100
|
-
/>
|
|
101
|
-
)}
|
|
102
|
-
{/* Static frame — visible when not hovering */}
|
|
103
|
-
<div
|
|
104
|
-
className="absolute inset-0 transition-opacity duration-150"
|
|
105
|
-
style={{ opacity: hovered && videoReady ? 0 : 1 }}
|
|
106
|
-
>
|
|
107
|
-
<VideoFrameThumbnail src={viewSrc} />
|
|
108
|
-
</div>
|
|
109
|
-
</>
|
|
76
|
+
<RenderPreview
|
|
77
|
+
filename={job.filename}
|
|
78
|
+
src={viewSrc}
|
|
79
|
+
hovered={hovered}
|
|
80
|
+
ready={videoReady}
|
|
81
|
+
onReady={() => setVideoReady(true)}
|
|
82
|
+
/>
|
|
110
83
|
)}
|
|
111
84
|
{isRendering && (
|
|
112
85
|
<div className="w-full h-full flex items-center justify-center">
|
|
@@ -125,50 +98,7 @@ export const RenderQueueItem = memo(function RenderQueueItem({
|
|
|
125
98
|
)}
|
|
126
99
|
</button>
|
|
127
100
|
|
|
128
|
-
{
|
|
129
|
-
<div className="flex-1 min-w-0">
|
|
130
|
-
<div className="flex items-center gap-1.5">
|
|
131
|
-
<span className="text-step-11 font-medium text-text-2 truncate">{job.filename}</span>
|
|
132
|
-
{job.durationMs && (
|
|
133
|
-
<span className="text-step-9 text-text-5 shrink-0">
|
|
134
|
-
{formatDuration(job.durationMs)}
|
|
135
|
-
</span>
|
|
136
|
-
)}
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
{isRendering && (
|
|
140
|
-
<div className="mt-1">
|
|
141
|
-
<div className="flex items-center justify-between mb-0.5">
|
|
142
|
-
<span className="text-step-9 text-text-4">{job.stage || "Rendering"}</span>
|
|
143
|
-
<span className="text-step-9 font-mono text-accent-ink">{job.progress}%</span>
|
|
144
|
-
</div>
|
|
145
|
-
<div
|
|
146
|
-
className="w-full h-1 bg-border rounded-full overflow-hidden"
|
|
147
|
-
role="progressbar"
|
|
148
|
-
aria-valuenow={job.progress}
|
|
149
|
-
aria-valuemin={0}
|
|
150
|
-
aria-valuemax={100}
|
|
151
|
-
aria-label={`Render progress: ${job.progress}%`}
|
|
152
|
-
>
|
|
153
|
-
<div
|
|
154
|
-
className="h-full bg-accent rounded-full transition-all duration-300"
|
|
155
|
-
style={{ width: `${job.progress}%` }}
|
|
156
|
-
/>
|
|
157
|
-
</div>
|
|
158
|
-
</div>
|
|
159
|
-
)}
|
|
160
|
-
|
|
161
|
-
{job.status === "failed" && job.error && (
|
|
162
|
-
<span className="text-step-9 text-danger-ink mt-0.5 block">{job.error}</span>
|
|
163
|
-
)}
|
|
164
|
-
{job.status === "cancelled" && (
|
|
165
|
-
<span className="text-step-9 text-text-4 mt-0.5 block">Cancelled</span>
|
|
166
|
-
)}
|
|
167
|
-
|
|
168
|
-
{!isRendering && (
|
|
169
|
-
<span className="text-step-9 text-text-5">{formatTimeAgo(job.createdAt)}</span>
|
|
170
|
-
)}
|
|
171
|
-
</div>
|
|
101
|
+
<RenderQueueInfo job={job} />
|
|
172
102
|
|
|
173
103
|
{/* Actions — always visible to prevent layout shifts */}
|
|
174
104
|
<div className="flex items-center gap-1.5 shrink-0">
|
|
@@ -29,7 +29,7 @@ export const RenderQueuePanel = memo(function RenderQueuePanel() {
|
|
|
29
29
|
ffmpeg={renderQueue.ffmpeg}
|
|
30
30
|
ffmpegChecking={renderQueue.ffmpegChecking}
|
|
31
31
|
onRecheckFfmpeg={renderQueue.recheckFfmpeg}
|
|
32
|
-
onStartRender={async (format, quality, resolution, fps, gpu) => {
|
|
32
|
+
onStartRender={async (format, quality, resolution, fps, gpu, gifLoop) => {
|
|
33
33
|
await waitForPendingDomEditSaves();
|
|
34
34
|
// No `composition`: startRender targets the active one by default.
|
|
35
35
|
await renderQueue.startRender({
|
|
@@ -38,6 +38,7 @@ export const RenderQueuePanel = memo(function RenderQueuePanel() {
|
|
|
38
38
|
format,
|
|
39
39
|
resolution,
|
|
40
40
|
gpu,
|
|
41
|
+
gifLoop,
|
|
41
42
|
// Render what the user is previewing: active variable overrides
|
|
42
43
|
// from the Variables panel ride along (undefined = defaults).
|
|
43
44
|
variables: usePreviewVariablesStore.getState().values ?? undefined,
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { SelectOption } from "../ui/Select";
|
|
2
|
+
import type { StartRenderHandler } from "./RenderQueue";
|
|
3
|
+
import type { ResolutionPreset } from "./useRenderQueue";
|
|
4
|
+
|
|
1
5
|
const RENDER_SETTINGS_KEY = "hf-studio-render-settings";
|
|
2
6
|
|
|
3
7
|
export interface PersistedRenderSettings {
|
|
4
|
-
format: "mp4" | "webm" | "mov";
|
|
8
|
+
format: "mp4" | "webm" | "mov" | "gif";
|
|
5
9
|
quality: "draft" | "standard" | "high";
|
|
6
10
|
fps: 24 | 30 | 60;
|
|
7
11
|
gpu: boolean;
|
|
@@ -13,7 +17,7 @@ export function getPersistedRenderSettings(): PersistedRenderSettings {
|
|
|
13
17
|
if (raw) {
|
|
14
18
|
const parsed = JSON.parse(raw);
|
|
15
19
|
return {
|
|
16
|
-
format: ["mp4", "webm", "mov"].includes(parsed.format) ? parsed.format : "mp4",
|
|
20
|
+
format: ["mp4", "webm", "mov", "gif"].includes(parsed.format) ? parsed.format : "mp4",
|
|
17
21
|
quality: ["draft", "standard", "high"].includes(parsed.quality)
|
|
18
22
|
? parsed.quality
|
|
19
23
|
: "standard",
|
|
@@ -39,3 +43,58 @@ export function persistRenderSettings(
|
|
|
39
43
|
/* ignore */
|
|
40
44
|
}
|
|
41
45
|
}
|
|
46
|
+
|
|
47
|
+
export function resolveRenderFormat(value: string): PersistedRenderSettings["format"] {
|
|
48
|
+
return (["mp4", "webm", "mov", "gif"] as const).find((format) => format === value) ?? "mp4";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function startConfiguredRender(
|
|
52
|
+
onStartRender: StartRenderHandler,
|
|
53
|
+
settings: PersistedRenderSettings & { resolution: ResolutionPreset | "auto"; gifLoop: number },
|
|
54
|
+
): void | Promise<void> {
|
|
55
|
+
const { format, quality, resolution, fps, gpu, gifLoop } = settings;
|
|
56
|
+
if (format === "gif") return onStartRender(format, quality, resolution, fps, false, gifLoop);
|
|
57
|
+
return onStartRender(format, quality, resolution, fps, gpu);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function isRenderExportBlocked(
|
|
61
|
+
isRendering: boolean,
|
|
62
|
+
missingFfmpeg: boolean,
|
|
63
|
+
invalidGifLoop: boolean,
|
|
64
|
+
): boolean {
|
|
65
|
+
return isRendering || missingFfmpeg || invalidGifLoop;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const FORMAT_INFO: Record<"mp4" | "webm" | "mov" | "gif", { label: string; desc: string }> =
|
|
69
|
+
{
|
|
70
|
+
gif: { label: "GIF", desc: "Animated image for docs and chat. No audio; up to 30 fps." },
|
|
71
|
+
mp4: { label: "MP4", desc: "Best for general use. Smallest file, universal playback." },
|
|
72
|
+
mov: {
|
|
73
|
+
label: "MOV (ProRes 4444)",
|
|
74
|
+
desc: "Transparent video. Works in Final Cut Pro, DaVinci Resolve, and most video editors. Large files.",
|
|
75
|
+
},
|
|
76
|
+
webm: {
|
|
77
|
+
label: "WebM (VP9)",
|
|
78
|
+
desc: "Transparent video for web. Smaller than MOV but limited editor support.",
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const FPS_OPTIONS: SelectOption[] = [
|
|
83
|
+
{ value: "24", label: "24 fps" },
|
|
84
|
+
{ value: "30", label: "30 fps" },
|
|
85
|
+
{ value: "60", label: "60 fps" },
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
export function resolveRenderFps(
|
|
89
|
+
format: PersistedRenderSettings["format"],
|
|
90
|
+
fps: PersistedRenderSettings["fps"],
|
|
91
|
+
): PersistedRenderSettings["fps"] {
|
|
92
|
+
return format === "gif" && fps === 60 ? 30 : fps;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function getRenderFpsOptions(format: PersistedRenderSettings["format"]): SelectOption[] {
|
|
96
|
+
return FPS_OPTIONS.map((option) => ({
|
|
97
|
+
...option,
|
|
98
|
+
disabled: format === "gif" && option.value === "60",
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
@@ -29,10 +29,11 @@ export type ResolutionPreset = CanvasResolution;
|
|
|
29
29
|
export interface StartRenderOptions {
|
|
30
30
|
fps?: number;
|
|
31
31
|
quality?: "draft" | "standard" | "high";
|
|
32
|
-
format?: "mp4" | "webm" | "mov";
|
|
32
|
+
format?: "mp4" | "webm" | "mov" | "gif";
|
|
33
33
|
/** `"auto"` (default) renders at the composition's authored dimensions. */
|
|
34
34
|
resolution?: ResolutionPreset | "auto";
|
|
35
35
|
gpu?: boolean;
|
|
36
|
+
gifLoop?: number;
|
|
36
37
|
/**
|
|
37
38
|
* Render a specific composition file. Omit it to render the composition the
|
|
38
39
|
* user currently has open — only the sidebar's per-composition Render button
|
|
@@ -236,6 +237,7 @@ export function useRenderQueue(
|
|
|
236
237
|
composition?: string;
|
|
237
238
|
variables?: Record<string, unknown>;
|
|
238
239
|
gpu?: boolean;
|
|
240
|
+
gifLoop?: number;
|
|
239
241
|
telemetryDistinctId?: string;
|
|
240
242
|
telemetryOptOut?: boolean;
|
|
241
243
|
} = {
|
|
@@ -261,6 +263,7 @@ export function useRenderQueue(
|
|
|
261
263
|
if (resolution && resolution !== "auto") body.resolution = resolution;
|
|
262
264
|
if (composition) body.composition = composition;
|
|
263
265
|
if (opts.gpu) body.gpu = true;
|
|
266
|
+
if (format === "gif" && opts.gifLoop !== undefined) body.gifLoop = opts.gifLoop;
|
|
264
267
|
if (opts.variables && Object.keys(opts.variables).length > 0) {
|
|
265
268
|
body.variables = opts.variables;
|
|
266
269
|
}
|
|
@@ -304,7 +307,12 @@ export function useRenderQueue(
|
|
|
304
307
|
}
|
|
305
308
|
const { jobId } = await res.json();
|
|
306
309
|
|
|
307
|
-
const FORMAT_EXT: Record<string, string> = {
|
|
310
|
+
const FORMAT_EXT: Record<string, string> = {
|
|
311
|
+
mp4: ".mp4",
|
|
312
|
+
webm: ".webm",
|
|
313
|
+
mov: ".mov",
|
|
314
|
+
gif: ".gif",
|
|
315
|
+
};
|
|
308
316
|
const ext = FORMAT_EXT[format] ?? ".mp4";
|
|
309
317
|
const job: RenderJob = {
|
|
310
318
|
id: jobId,
|
|
@@ -65,3 +65,16 @@ describe("GPU encoding", () => {
|
|
|
65
65
|
expect(body["gpu"]).toBeUndefined();
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
|
+
|
|
69
|
+
describe("GIF export transport", () => {
|
|
70
|
+
it.each([0, 3, 65535])("forwards loop count %i and creates a GIF queue item", async (gifLoop) => {
|
|
71
|
+
const body = await renderBody(null, { format: "gif", gifLoop });
|
|
72
|
+
expect(body).toMatchObject({ format: "gif", gifLoop });
|
|
73
|
+
expect(queue?.api().jobs).toEqual([expect.objectContaining({ filename: "j1.gif" })]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("omits GIF options for video exports", async () => {
|
|
77
|
+
const body = await renderBody(null, { format: "mp4", gifLoop: 3 });
|
|
78
|
+
expect(body).not.toHaveProperty("gifLoop");
|
|
79
|
+
});
|
|
80
|
+
});
|