@remotion/cli 3.3.32 → 3.3.34
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/config/log.d.ts +1 -1
- package/dist/convert-entry-point-to-serve-url.d.ts +1 -0
- package/dist/convert-entry-point-to-serve-url.js +15 -0
- package/dist/editor/components/CollapsableOptions.d.ts +6 -0
- package/dist/editor/components/CollapsableOptions.js +35 -0
- package/dist/editor/components/InlineAction.d.ts +5 -0
- package/dist/editor/components/InlineAction.js +34 -0
- package/dist/editor/components/Modals.d.ts +2 -0
- package/dist/editor/components/Modals.js +23 -0
- package/dist/editor/components/NewComposition/InputDragger.d.ts +1 -0
- package/dist/editor/components/NewComposition/InputDragger.js +22 -4
- package/dist/editor/components/NewComposition/NewCompDuration.js +5 -3
- package/dist/editor/components/NewComposition/NewComposition.js +5 -5
- package/dist/editor/components/RenderButton.d.ts +6 -0
- package/dist/editor/components/RenderButton.js +46 -0
- package/dist/editor/components/RenderModal/RenderErrorModal.d.ts +5 -0
- package/dist/editor/components/RenderModal/RenderErrorModal.js +64 -0
- package/dist/editor/components/RenderModal/RenderModal.d.ts +14 -0
- package/dist/editor/components/RenderModal/RenderModal.js +377 -0
- package/dist/editor/components/RenderQueue/CircularProgress.d.ts +5 -0
- package/dist/editor/components/RenderQueue/CircularProgress.js +18 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.js +26 -0
- package/dist/editor/components/RenderQueue/RenderQueueItem.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueItem.js +39 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.js +22 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemStatus.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemStatus.js +27 -0
- package/dist/editor/components/RenderQueue/RenderQueueOutputName.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueOutputName.js +24 -0
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.js +27 -0
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +22 -0
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.js +22 -0
- package/dist/editor/components/RenderQueue/actions.d.ts +35 -0
- package/dist/editor/components/RenderQueue/actions.js +84 -0
- package/dist/editor/components/RenderQueue/context.d.ts +19 -0
- package/dist/editor/components/RenderQueue/context.js +56 -0
- package/dist/editor/components/RenderQueue/index.d.ts +2 -0
- package/dist/editor/components/RenderQueue/index.js +18 -0
- package/dist/editor/components/RenderQueue/item-style.d.ts +2 -0
- package/dist/editor/components/RenderQueue/item-style.js +21 -0
- package/dist/editor/components/RenderToolbarIcon.d.ts +2 -0
- package/dist/editor/components/RenderToolbarIcon.js +56 -0
- package/dist/editor/components/RendersTab.d.ts +6 -0
- package/dist/editor/components/RendersTab.js +43 -0
- package/dist/editor/components/SegmentedControl.d.ts +16 -0
- package/dist/editor/components/SegmentedControl.js +63 -0
- package/dist/editor/components/SidebarContent.d.ts +5 -0
- package/dist/editor/components/SidebarContent.js +51 -0
- package/dist/editor/components/Tabs/index.d.ts +11 -0
- package/dist/editor/components/Tabs/index.js +51 -0
- package/dist/editor/components/Timeline/Timeline.js +11 -5
- package/dist/editor/helpers/client-id.d.ts +17 -0
- package/dist/editor/helpers/client-id.js +46 -0
- package/dist/editor/helpers/use-file-existence.d.ts +1 -0
- package/dist/editor/helpers/use-file-existence.js +66 -0
- package/dist/editor/icons/RenderStillIcon.d.ts +3 -0
- package/dist/editor/icons/RenderStillIcon.js +8 -0
- package/dist/editor/icons/render.d.ts +5 -0
- package/dist/editor/icons/render.js +8 -0
- package/dist/editor/icons/video.d.ts +5 -0
- package/dist/editor/icons/video.js +8 -0
- package/dist/editor/state/z-index.js +24 -11
- package/dist/file-watcher.d.ts +9 -0
- package/dist/file-watcher.js +35 -0
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/get-default-out-name.d.ts +5 -0
- package/dist/get-default-out-name.js +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/preview-server/api-routes.d.ts +4 -0
- package/dist/preview-server/api-routes.js +17 -0
- package/dist/preview-server/api-types.d.ts +27 -0
- package/dist/preview-server/api-types.js +2 -0
- package/dist/preview-server/file-existence-watchers.d.ts +13 -0
- package/dist/preview-server/file-existence-watchers.js +62 -0
- package/dist/preview-server/handler.d.ts +9 -0
- package/dist/preview-server/handler.js +34 -0
- package/dist/preview-server/parse-body.d.ts +2 -0
- package/dist/preview-server/parse-body.js +16 -0
- package/dist/preview-server/render-queue/job.d.ts +86 -0
- package/dist/preview-server/render-queue/job.js +2 -0
- package/dist/preview-server/render-queue/make-retry-payload.d.ts +3 -0
- package/dist/preview-server/render-queue/make-retry-payload.js +37 -0
- package/dist/preview-server/render-queue/open-directory-in-finder.d.ts +1 -0
- package/dist/preview-server/render-queue/open-directory-in-finder.js +34 -0
- package/dist/preview-server/render-queue/process-still.d.ts +8 -0
- package/dist/preview-server/render-queue/process-still.js +50 -0
- package/dist/preview-server/render-queue/process-video.d.ts +8 -0
- package/dist/preview-server/render-queue/process-video.js +59 -0
- package/dist/preview-server/render-queue/queue.d.ts +21 -0
- package/dist/preview-server/render-queue/queue.js +185 -0
- package/dist/preview-server/routes/add-render.d.ts +3 -0
- package/dist/preview-server/routes/add-render.js +54 -0
- package/dist/preview-server/routes/cancel-render.d.ts +3 -0
- package/dist/preview-server/routes/cancel-render.js +9 -0
- package/dist/preview-server/routes/open-in-file-explorer.d.ts +3 -0
- package/dist/preview-server/routes/open-in-file-explorer.js +14 -0
- package/dist/preview-server/routes/remove-render.d.ts +3 -0
- package/dist/preview-server/routes/remove-render.js +9 -0
- package/dist/preview-server/routes/subscribe-to-file-existence.d.ts +3 -0
- package/dist/preview-server/routes/subscribe-to-file-existence.js +13 -0
- package/dist/preview-server/routes/unsubscribe-from-file-existence.d.ts +3 -0
- package/dist/preview-server/routes/unsubscribe-from-file-existence.js +13 -0
- package/dist/preview-server/start-server.js +2 -1
- package/dist/render-flows/render.d.ts +38 -0
- package/dist/render-flows/render.js +256 -0
- package/dist/render-flows/still.d.ts +32 -0
- package/dist/render-flows/still.js +170 -0
- package/dist/render.js +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const client_1 = require("@remotion/renderer/client");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
8
|
+
const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
9
|
+
const colors_1 = require("../../helpers/colors");
|
|
10
|
+
const use_file_existence_1 = require("../../helpers/use-file-existence");
|
|
11
|
+
const modals_1 = require("../../state/modals");
|
|
12
|
+
const CollapsableOptions_1 = require("../CollapsableOptions");
|
|
13
|
+
const layout_1 = require("../layout");
|
|
14
|
+
const ModalContainer_1 = require("../ModalContainer");
|
|
15
|
+
const ModalHeader_1 = require("../ModalHeader");
|
|
16
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
17
|
+
const RemInput_1 = require("../NewComposition/RemInput");
|
|
18
|
+
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
19
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
20
|
+
const SegmentedControl_1 = require("../SegmentedControl");
|
|
21
|
+
const SidebarContent_1 = require("../SidebarContent");
|
|
22
|
+
const initialState = { type: 'idle' };
|
|
23
|
+
const reducer = (state, action) => {
|
|
24
|
+
if (action.type === 'start') {
|
|
25
|
+
return {
|
|
26
|
+
type: 'load',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (action.type === 'fail') {
|
|
30
|
+
return {
|
|
31
|
+
type: 'error',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (action.type === 'succeed') {
|
|
35
|
+
return {
|
|
36
|
+
type: 'success',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return state;
|
|
40
|
+
};
|
|
41
|
+
const container = {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
padding: '12px 16px',
|
|
46
|
+
width: '100%',
|
|
47
|
+
borderBottom: '1px solid black',
|
|
48
|
+
};
|
|
49
|
+
const optionRow = {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexDirection: 'row',
|
|
52
|
+
alignItems: 'flex-start',
|
|
53
|
+
minHeight: 40,
|
|
54
|
+
paddingLeft: 16,
|
|
55
|
+
paddingRight: 16,
|
|
56
|
+
};
|
|
57
|
+
const label = {
|
|
58
|
+
width: 150,
|
|
59
|
+
fontSize: 14,
|
|
60
|
+
lineHeight: '40px',
|
|
61
|
+
color: colors_1.LIGHT_TEXT,
|
|
62
|
+
};
|
|
63
|
+
const rightRow = {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
justifyContent: 'flex-end',
|
|
67
|
+
alignSelf: 'center',
|
|
68
|
+
flex: 1,
|
|
69
|
+
};
|
|
70
|
+
const buttonRow = {
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
justifyContent: 'flex-end',
|
|
74
|
+
borderTop: '1px solid black',
|
|
75
|
+
paddingTop: 8,
|
|
76
|
+
paddingBottom: 8,
|
|
77
|
+
paddingLeft: 16,
|
|
78
|
+
paddingRight: 16,
|
|
79
|
+
};
|
|
80
|
+
const input = {
|
|
81
|
+
minWidth: 250,
|
|
82
|
+
textAlign: 'right',
|
|
83
|
+
};
|
|
84
|
+
const MIN_QUALITY = 1;
|
|
85
|
+
const MAX_QUALITY = 100;
|
|
86
|
+
const MIN_SCALE = 0.1;
|
|
87
|
+
const MAX_SCALE = 10;
|
|
88
|
+
const RenderModal = ({ compositionId, initialFrame, initialImageFormat, initialQuality, initialScale, initialVerbose, initialOutName, initialRenderType, initialCodec, }) => {
|
|
89
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
90
|
+
const onQuit = (0, react_1.useCallback)(() => {
|
|
91
|
+
setSelectedModal(null);
|
|
92
|
+
}, [setSelectedModal]);
|
|
93
|
+
const isMounted = (0, react_1.useRef)(true);
|
|
94
|
+
const [state, dispatch] = (0, react_1.useReducer)(reducer, initialState);
|
|
95
|
+
const [frame, setFrame] = (0, react_1.useState)(() => initialFrame);
|
|
96
|
+
const [imageFormat, setImageFormat] = (0, react_1.useState)(() => initialImageFormat);
|
|
97
|
+
const [videoCodec, setVideoCodec] = (0, react_1.useState)(initialCodec);
|
|
98
|
+
const [videoImageFormat, setVideoImageFormat] = (0, react_1.useState)('jpeg');
|
|
99
|
+
const [renderMode, setRenderMode] = (0, react_1.useState)(initialRenderType);
|
|
100
|
+
const [quality, setQuality] = (0, react_1.useState)(() => initialQuality !== null && initialQuality !== void 0 ? initialQuality : 80);
|
|
101
|
+
const [scale, setScale] = (0, react_1.useState)(() => initialScale);
|
|
102
|
+
const [verbose, setVerboseLogging] = (0, react_1.useState)(() => initialVerbose);
|
|
103
|
+
const [outName, setOutName] = (0, react_1.useState)(() => initialOutName);
|
|
104
|
+
const dispatchIfMounted = (0, react_1.useCallback)((payload) => {
|
|
105
|
+
if (isMounted.current === false)
|
|
106
|
+
return;
|
|
107
|
+
dispatch(payload);
|
|
108
|
+
}, []);
|
|
109
|
+
const onValueChange = (0, react_1.useCallback)((e) => {
|
|
110
|
+
setOutName(e.target.value);
|
|
111
|
+
}, []);
|
|
112
|
+
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
113
|
+
const currentComposition = (0, react_1.useMemo)(() => {
|
|
114
|
+
for (const composition of compositions) {
|
|
115
|
+
if (composition.id === compositionId) {
|
|
116
|
+
return composition;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}, [compositionId, compositions]);
|
|
121
|
+
if (currentComposition === null) {
|
|
122
|
+
throw new Error('This composition does not exist');
|
|
123
|
+
}
|
|
124
|
+
const getStringBeforeSuffix = (0, react_1.useCallback)((fileName) => {
|
|
125
|
+
const dotPos = fileName.lastIndexOf('.');
|
|
126
|
+
const bitBeforeDot = fileName.substring(0, dotPos);
|
|
127
|
+
return bitBeforeDot;
|
|
128
|
+
}, []);
|
|
129
|
+
const setCodec = (0, react_1.useCallback)((codec) => {
|
|
130
|
+
setVideoCodec(codec);
|
|
131
|
+
setOutName((prev) => {
|
|
132
|
+
// TODO: Check file extension for h264-mkv (render throws error atm)
|
|
133
|
+
const codecSuffix = client_1.BrowserSafeApis.getFileExtensionFromCodec(codec, 'final');
|
|
134
|
+
const newFileName = getStringBeforeSuffix(prev) + '.' + codecSuffix;
|
|
135
|
+
return newFileName;
|
|
136
|
+
});
|
|
137
|
+
}, [getStringBeforeSuffix]);
|
|
138
|
+
const setStillFormat = (0, react_1.useCallback)((format) => {
|
|
139
|
+
setImageFormat(format);
|
|
140
|
+
setOutName((prev) => {
|
|
141
|
+
const newFileName = getStringBeforeSuffix(prev) + '.' + format;
|
|
142
|
+
return newFileName;
|
|
143
|
+
});
|
|
144
|
+
}, [getStringBeforeSuffix]);
|
|
145
|
+
const onClickStill = (0, react_1.useCallback)(() => {
|
|
146
|
+
var _a;
|
|
147
|
+
(_a = SidebarContent_1.leftSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectRendersPanel();
|
|
148
|
+
dispatchIfMounted({ type: 'start' });
|
|
149
|
+
(0, actions_1.addStillRenderJob)({
|
|
150
|
+
compositionId,
|
|
151
|
+
outName,
|
|
152
|
+
imageFormat,
|
|
153
|
+
quality: imageFormat === 'jpeg' ? quality : null,
|
|
154
|
+
frame,
|
|
155
|
+
scale,
|
|
156
|
+
verbose,
|
|
157
|
+
})
|
|
158
|
+
.then(() => {
|
|
159
|
+
dispatchIfMounted({ type: 'succeed' });
|
|
160
|
+
setSelectedModal(null);
|
|
161
|
+
})
|
|
162
|
+
.catch(() => {
|
|
163
|
+
dispatchIfMounted({ type: 'fail' });
|
|
164
|
+
});
|
|
165
|
+
}, [
|
|
166
|
+
compositionId,
|
|
167
|
+
dispatchIfMounted,
|
|
168
|
+
frame,
|
|
169
|
+
imageFormat,
|
|
170
|
+
outName,
|
|
171
|
+
quality,
|
|
172
|
+
scale,
|
|
173
|
+
setSelectedModal,
|
|
174
|
+
verbose,
|
|
175
|
+
]);
|
|
176
|
+
const onClickVideo = (0, react_1.useCallback)(() => {
|
|
177
|
+
var _a;
|
|
178
|
+
(_a = SidebarContent_1.leftSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectRendersPanel();
|
|
179
|
+
dispatchIfMounted({ type: 'start' });
|
|
180
|
+
(0, actions_1.addVideoRenderJob)({
|
|
181
|
+
compositionId,
|
|
182
|
+
outName,
|
|
183
|
+
imageFormat: videoImageFormat,
|
|
184
|
+
quality: imageFormat === 'jpeg' ? quality : null,
|
|
185
|
+
scale,
|
|
186
|
+
verbose,
|
|
187
|
+
// TODO: Make this configurable
|
|
188
|
+
codec: videoCodec,
|
|
189
|
+
})
|
|
190
|
+
.then(() => {
|
|
191
|
+
dispatchIfMounted({ type: 'succeed' });
|
|
192
|
+
setSelectedModal(null);
|
|
193
|
+
})
|
|
194
|
+
.catch(() => {
|
|
195
|
+
dispatchIfMounted({ type: 'fail' });
|
|
196
|
+
});
|
|
197
|
+
}, [
|
|
198
|
+
compositionId,
|
|
199
|
+
dispatchIfMounted,
|
|
200
|
+
imageFormat,
|
|
201
|
+
outName,
|
|
202
|
+
quality,
|
|
203
|
+
scale,
|
|
204
|
+
setSelectedModal,
|
|
205
|
+
verbose,
|
|
206
|
+
videoCodec,
|
|
207
|
+
videoImageFormat,
|
|
208
|
+
]);
|
|
209
|
+
const onQualityChangedDirectly = (0, react_1.useCallback)((newQuality) => {
|
|
210
|
+
setQuality(newQuality);
|
|
211
|
+
}, []);
|
|
212
|
+
const onQualityChanged = (0, react_1.useCallback)((e) => {
|
|
213
|
+
setQuality((q) => {
|
|
214
|
+
const newQuality = parseInt(e, 10);
|
|
215
|
+
if (Number.isNaN(newQuality)) {
|
|
216
|
+
return q;
|
|
217
|
+
}
|
|
218
|
+
const newQualityClamped = Math.min(MAX_QUALITY, Math.max(newQuality, MIN_QUALITY));
|
|
219
|
+
return newQualityClamped;
|
|
220
|
+
});
|
|
221
|
+
}, []);
|
|
222
|
+
const onScaleSetDirectly = (0, react_1.useCallback)((newScale) => {
|
|
223
|
+
setScale(newScale);
|
|
224
|
+
}, []);
|
|
225
|
+
const onScaleChanged = (0, react_1.useCallback)((e) => {
|
|
226
|
+
setScale((q) => {
|
|
227
|
+
const newScale = parseFloat(e);
|
|
228
|
+
if (Number.isNaN(newScale)) {
|
|
229
|
+
return q;
|
|
230
|
+
}
|
|
231
|
+
const newScaleClamped = Math.min(MAX_SCALE, Math.max(newScale, MIN_SCALE));
|
|
232
|
+
return newScaleClamped;
|
|
233
|
+
});
|
|
234
|
+
}, []);
|
|
235
|
+
const onFrameSetDirectly = (0, react_1.useCallback)((newFrame) => {
|
|
236
|
+
console.log(newFrame);
|
|
237
|
+
if (newFrame > currentComposition.durationInFrames - 1) {
|
|
238
|
+
setFrame(currentComposition.durationInFrames - 1);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
setFrame(newFrame);
|
|
242
|
+
}
|
|
243
|
+
}, [currentComposition.durationInFrames, setFrame]);
|
|
244
|
+
const onFrameChanged = (0, react_1.useCallback)((e) => {
|
|
245
|
+
setFrame((q) => {
|
|
246
|
+
const newFrame = parseFloat(e);
|
|
247
|
+
if (Number.isNaN(newFrame)) {
|
|
248
|
+
return q;
|
|
249
|
+
}
|
|
250
|
+
// TODO: User could change frame inbetween 😈
|
|
251
|
+
return newFrame > currentComposition.durationInFrames - 1
|
|
252
|
+
? currentComposition.durationInFrames - 1
|
|
253
|
+
: newFrame;
|
|
254
|
+
});
|
|
255
|
+
}, []);
|
|
256
|
+
(0, react_1.useEffect)(() => {
|
|
257
|
+
return () => {
|
|
258
|
+
isMounted.current = false;
|
|
259
|
+
};
|
|
260
|
+
}, []);
|
|
261
|
+
const existence = (0, use_file_existence_1.useFileExistence)(outName);
|
|
262
|
+
const imageFormatOptions = (0, react_1.useMemo)(() => {
|
|
263
|
+
return [
|
|
264
|
+
{
|
|
265
|
+
label: 'PNG',
|
|
266
|
+
onClick: renderMode === 'still'
|
|
267
|
+
? () => setStillFormat('png')
|
|
268
|
+
: () => setVideoImageFormat('png'),
|
|
269
|
+
key: 'png',
|
|
270
|
+
selected: renderMode === 'still'
|
|
271
|
+
? imageFormat === 'png'
|
|
272
|
+
: videoImageFormat === 'png',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: 'JPEG',
|
|
276
|
+
onClick: renderMode === 'still'
|
|
277
|
+
? () => setStillFormat('jpeg')
|
|
278
|
+
: () => setVideoImageFormat('jpeg'),
|
|
279
|
+
key: 'jpeg',
|
|
280
|
+
selected: renderMode === 'still'
|
|
281
|
+
? imageFormat === 'jpeg'
|
|
282
|
+
: videoImageFormat === 'jpeg',
|
|
283
|
+
},
|
|
284
|
+
];
|
|
285
|
+
}, [imageFormat, renderMode, setStillFormat, videoImageFormat]);
|
|
286
|
+
const videoCodecOptions = (0, react_1.useMemo)(() => {
|
|
287
|
+
const codecs = [
|
|
288
|
+
'h264',
|
|
289
|
+
'h265',
|
|
290
|
+
'vp8',
|
|
291
|
+
'vp9',
|
|
292
|
+
'mp3',
|
|
293
|
+
'aac',
|
|
294
|
+
'wav',
|
|
295
|
+
'prores',
|
|
296
|
+
'gif',
|
|
297
|
+
];
|
|
298
|
+
return codecs.map((codec) => {
|
|
299
|
+
return {
|
|
300
|
+
label: codec,
|
|
301
|
+
onClick: () => setCodec(codec),
|
|
302
|
+
key: codec,
|
|
303
|
+
selected: videoCodec === codec,
|
|
304
|
+
};
|
|
305
|
+
});
|
|
306
|
+
}, [setCodec, videoCodec]);
|
|
307
|
+
const renderTabOptions = (0, react_1.useMemo)(() => {
|
|
308
|
+
if ((currentComposition === null || currentComposition === void 0 ? void 0 : currentComposition.durationInFrames) < 2) {
|
|
309
|
+
return [
|
|
310
|
+
{
|
|
311
|
+
label: 'Still',
|
|
312
|
+
onClick: () => {
|
|
313
|
+
setRenderMode('still');
|
|
314
|
+
setStillFormat(imageFormat);
|
|
315
|
+
},
|
|
316
|
+
key: 'still',
|
|
317
|
+
selected: renderMode === 'still',
|
|
318
|
+
},
|
|
319
|
+
];
|
|
320
|
+
}
|
|
321
|
+
return [
|
|
322
|
+
{
|
|
323
|
+
label: 'Still',
|
|
324
|
+
onClick: () => {
|
|
325
|
+
setRenderMode('still');
|
|
326
|
+
setStillFormat(imageFormat);
|
|
327
|
+
},
|
|
328
|
+
key: 'still',
|
|
329
|
+
selected: renderMode === 'still',
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
label: 'Video',
|
|
333
|
+
onClick: () => {
|
|
334
|
+
setRenderMode('video');
|
|
335
|
+
setCodec(videoCodec);
|
|
336
|
+
},
|
|
337
|
+
key: 'video',
|
|
338
|
+
selected: renderMode === 'video',
|
|
339
|
+
},
|
|
340
|
+
];
|
|
341
|
+
}, [
|
|
342
|
+
currentComposition === null || currentComposition === void 0 ? void 0 : currentComposition.durationInFrames,
|
|
343
|
+
imageFormat,
|
|
344
|
+
renderMode,
|
|
345
|
+
setCodec,
|
|
346
|
+
setStillFormat,
|
|
347
|
+
videoCodec,
|
|
348
|
+
]);
|
|
349
|
+
const onVerboseLoggingChanged = (0, react_1.useCallback)((e) => {
|
|
350
|
+
setVerboseLogging(e.target.checked);
|
|
351
|
+
}, []);
|
|
352
|
+
if (renderMode === 'still') {
|
|
353
|
+
return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderTabOptions, needsWrapping: false }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Format" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: true }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Output name" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput
|
|
354
|
+
// TODO: Validate and reject folders or weird file names
|
|
355
|
+
, {
|
|
356
|
+
// TODO: Validate and reject folders or weird file names
|
|
357
|
+
warning: existence, style: input, type: "text", value: outName, onChange: onValueChange }), existence ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: "Will be overwritten" })) : null] }) })] }), currentComposition.durationInFrames > 1 ? ((0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Frame" }), (0, jsx_runtime_1.jsxs)("div", { style: rightRow, children: [(0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: frame, onTextChange: onFrameChanged,
|
|
358
|
+
// TODO: Actual frame
|
|
359
|
+
placeholder: "0-100",
|
|
360
|
+
// TODO: Debug the number input field
|
|
361
|
+
onValueChange: onFrameSetDirectly, name: "frame", step: 1, min: 0,
|
|
362
|
+
// TODO: Add actual frame
|
|
363
|
+
max: currentComposition.durationInFrames - 1 }), ' '] })] })) : null, (0, jsx_runtime_1.jsxs)(CollapsableOptions_1.CollapsableOptions, { showLabel: "Show advanced settings", hideLabel: "Hide advanced settings", children: [(0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Scale" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: scale, onTextChange: onScaleChanged, placeholder: "0.1-10",
|
|
364
|
+
// TODO: Does not allow non-integer steps
|
|
365
|
+
// TODO: Cannot click and type in 0.2
|
|
366
|
+
onValueChange: onScaleSetDirectly, name: "scale", step: 0.1, min: MIN_SCALE, max: MAX_SCALE }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)("input", { type: 'checkbox', checked: verbose, onChange: onVerboseLoggingChanged }) })] }), imageFormat === 'jpeg' && ((0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "JPEG Quality" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: quality, onTextChange: onQualityChanged, placeholder: "0-100", onValueChange: onQualityChangedDirectly, name: "quality", step: 1, min: MIN_QUALITY, max: MAX_QUALITY }) })] }))] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsx)("div", { style: buttonRow, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: true, onClick: onClickStill, disabled: state.type === 'load', children: state.type === 'idle' ? 'Render still' : 'Rendering...' }) })] })] }));
|
|
367
|
+
}
|
|
368
|
+
return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderTabOptions, needsWrapping: false }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Codec" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: videoCodecOptions, needsWrapping: true }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Output name" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput
|
|
369
|
+
// TODO: Validate and reject folders or weird file names
|
|
370
|
+
, {
|
|
371
|
+
// TODO: Validate and reject folders or weird file names
|
|
372
|
+
warning: existence, style: input, type: "text", value: outName, onChange: onValueChange }), existence ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: "Will be overwritten" })) : null] }) })] }), (0, jsx_runtime_1.jsxs)(CollapsableOptions_1.CollapsableOptions, { showLabel: "Show advanced settings", hideLabel: "Hide advanced settings", children: [(0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Scale" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: scale, onTextChange: onScaleChanged, placeholder: "0.1-10",
|
|
373
|
+
// TODO: Direct input does not allow non-integer steps
|
|
374
|
+
// TODO: Cannot click and type in 0.2
|
|
375
|
+
onValueChange: onScaleSetDirectly, name: "scale", step: 0.1, min: MIN_SCALE, max: MAX_SCALE }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)("input", { type: 'checkbox', checked: verbose, onChange: onVerboseLoggingChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: false }) })] }), videoImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "JPEG Quality" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: quality, onTextChange: onQualityChanged, placeholder: "0-100", onValueChange: onQualityChangedDirectly, name: "quality", step: 1, min: MIN_QUALITY, max: MAX_QUALITY }) })] }))] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsx)("div", { style: buttonRow, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: true, onClick: onClickVideo, disabled: state.type === 'load', children: state.type === 'idle' ? 'Render video' : 'Rendering...' }) })] })] }));
|
|
376
|
+
};
|
|
377
|
+
exports.RenderModal = RenderModal;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CircularProgress = exports.RENDER_STATUS_INDICATOR_SIZE = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../../helpers/colors");
|
|
6
|
+
exports.RENDER_STATUS_INDICATOR_SIZE = 16;
|
|
7
|
+
const STROKE_WIDTH = 3;
|
|
8
|
+
const container = {
|
|
9
|
+
height: exports.RENDER_STATUS_INDICATOR_SIZE,
|
|
10
|
+
width: exports.RENDER_STATUS_INDICATOR_SIZE,
|
|
11
|
+
transform: `rotate(-90deg)`,
|
|
12
|
+
};
|
|
13
|
+
const CircularProgress = ({ progress }) => {
|
|
14
|
+
const r = exports.RENDER_STATUS_INDICATOR_SIZE / 2 - STROKE_WIDTH;
|
|
15
|
+
const circumference = r * Math.PI * 2;
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)("svg", { style: container, viewBox: `0 0 ${exports.RENDER_STATUS_INDICATOR_SIZE} ${exports.RENDER_STATUS_INDICATOR_SIZE}`, children: (0, jsx_runtime_1.jsx)("circle", { r: exports.RENDER_STATUS_INDICATOR_SIZE / 2 - STROKE_WIDTH, stroke: colors_1.LIGHT_TEXT, fill: "none", strokeWidth: STROKE_WIDTH, cx: exports.RENDER_STATUS_INDICATOR_SIZE / 2, cy: exports.RENDER_STATUS_INDICATOR_SIZE / 2, strokeDasharray: `${circumference} ${circumference}`, strokeMiterlimit: 0, strokeDashoffset: (1 - progress) * circumference }) }));
|
|
17
|
+
};
|
|
18
|
+
exports.CircularProgress = CircularProgress;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueError = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const modals_1 = require("../../state/modals");
|
|
7
|
+
const z_index_1 = require("../../state/z-index");
|
|
8
|
+
const item_style_1 = require("./item-style");
|
|
9
|
+
const outputLocation = {
|
|
10
|
+
...item_style_1.renderQueueItemSubtitleStyle,
|
|
11
|
+
};
|
|
12
|
+
const RenderQueueError = ({ job }) => {
|
|
13
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
14
|
+
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
15
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
16
|
+
setSelectedModal({
|
|
17
|
+
type: 'render-error',
|
|
18
|
+
job,
|
|
19
|
+
});
|
|
20
|
+
}, [job, setSelectedModal]);
|
|
21
|
+
if (job.status !== 'failed') {
|
|
22
|
+
throw new Error('should not have rendered this component');
|
|
23
|
+
}
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("button", { onClick: onClick, type: "button", style: outputLocation, tabIndex: tabIndex, title: job.error.message, children: job.error.message }));
|
|
25
|
+
};
|
|
26
|
+
exports.RenderQueueError = RenderQueueError;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const layout_1 = require("../layout");
|
|
6
|
+
const RenderQueueError_1 = require("./RenderQueueError");
|
|
7
|
+
const RenderQueueItemCancelButton_1 = require("./RenderQueueItemCancelButton");
|
|
8
|
+
const RenderQueueItemStatus_1 = require("./RenderQueueItemStatus");
|
|
9
|
+
const RenderQueueOutputName_1 = require("./RenderQueueOutputName");
|
|
10
|
+
const RenderQueueProgressMessage_1 = require("./RenderQueueProgressMessage");
|
|
11
|
+
const RenderQueueRemoveItem_1 = require("./RenderQueueRemoveItem");
|
|
12
|
+
const RenderQueueRepeat_1 = require("./RenderQueueRepeat");
|
|
13
|
+
const container = {
|
|
14
|
+
padding: 12,
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
paddingBottom: 10,
|
|
18
|
+
paddingRight: 4,
|
|
19
|
+
};
|
|
20
|
+
const title = {
|
|
21
|
+
fontSize: 13,
|
|
22
|
+
lineHeight: 1,
|
|
23
|
+
};
|
|
24
|
+
const right = {
|
|
25
|
+
flex: 1,
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
};
|
|
30
|
+
const subtitle = {
|
|
31
|
+
maxWidth: '100%',
|
|
32
|
+
flex: 1,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
};
|
|
36
|
+
const RenderQueueItem = ({ job }) => {
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(layout_1.Row, { style: container, align: "center", children: [(0, jsx_runtime_1.jsx)(RenderQueueItemStatus_1.RenderQueueItemStatus, { job: job }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsxs)("div", { style: right, children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: job.compositionId }), (0, jsx_runtime_1.jsx)("div", { style: subtitle, children: job.status === 'done' ? ((0, jsx_runtime_1.jsx)(RenderQueueOutputName_1.RenderQueueOutputName, { job: job })) : job.status === 'failed' ? ((0, jsx_runtime_1.jsx)(RenderQueueError_1.RenderQueueError, { job: job })) : job.status === 'running' ? ((0, jsx_runtime_1.jsx)(RenderQueueProgressMessage_1.RenderQueueProgressMessage, { job: job })) : null })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), job.status === 'done' || job.status === 'failed' ? ((0, jsx_runtime_1.jsx)(RenderQueueRepeat_1.RenderQueueRepeatItem, { job: job })) : null, job.status === 'running' ? ((0, jsx_runtime_1.jsx)(RenderQueueItemCancelButton_1.RenderQueueCancelButton, { job: job })) : ((0, jsx_runtime_1.jsx)(RenderQueueRemoveItem_1.RenderQueueRemoveItem, { job: job }))] }));
|
|
38
|
+
};
|
|
39
|
+
exports.RenderQueueItem = RenderQueueItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueCancelButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const InlineAction_1 = require("../InlineAction");
|
|
7
|
+
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
8
|
+
const actions_1 = require("./actions");
|
|
9
|
+
const RenderQueueCancelButton = ({ job }) => {
|
|
10
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
11
|
+
(0, actions_1.cancelRenderJob)(job).catch((err) => {
|
|
12
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Could not cancel job: ${err.message}`);
|
|
13
|
+
});
|
|
14
|
+
}, [job]);
|
|
15
|
+
const icon = (0, react_1.useMemo)(() => {
|
|
16
|
+
return {
|
|
17
|
+
height: 14,
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: icon, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: "currentcolor", d: "M367.2 412.5L99.5 144.8C77.1 176.1 64 214.5 64 256c0 106 86 192 192 192c41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3C434.9 335.9 448 297.5 448 256c0-106-86-192-192-192c-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM512 256c0 141.4-114.6 256-256 256S0 397.4 0 256S114.6 0 256 0S512 114.6 512 256z" }) }) }));
|
|
21
|
+
};
|
|
22
|
+
exports.RenderQueueCancelButton = RenderQueueCancelButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueItemStatus = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../../helpers/colors");
|
|
6
|
+
const CircularProgress_1 = require("./CircularProgress");
|
|
7
|
+
const iconStyle = {
|
|
8
|
+
height: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
|
|
9
|
+
width: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
|
|
10
|
+
};
|
|
11
|
+
const RenderQueueItemStatus = ({ job }) => {
|
|
12
|
+
if (job.status === 'failed') {
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.FAIL_COLOR, d: "M0 160V352L160 512H352L512 352V160L352 0H160L0 160zm353.9 32l-17 17-47 47 47 47 17 17L320 353.9l-17-17-47-47-47 47-17 17L158.1 320l17-17 47-47-47-47-17-17L192 158.1l17 17 47 47 47-47 17-17L353.9 192z" }) }) }));
|
|
14
|
+
}
|
|
15
|
+
if (job.status === 'idle') {
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }) }));
|
|
17
|
+
}
|
|
18
|
+
if (job.status === 'done') {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM369 209L241 337l-17 17-17-17-64-64-17-17L160 222.1l17 17 47 47L335 175l17-17L385.9 192l-17 17z" }) }));
|
|
20
|
+
}
|
|
21
|
+
if (job.status === 'running') {
|
|
22
|
+
// Add a minimum progress to avoid the progress bar from disappearing
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress) });
|
|
24
|
+
}
|
|
25
|
+
throw new Error('Unknown job status');
|
|
26
|
+
};
|
|
27
|
+
exports.RenderQueueItemStatus = RenderQueueItemStatus;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueOutputName = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
7
|
+
const actions_1 = require("./actions");
|
|
8
|
+
const item_style_1 = require("./item-style");
|
|
9
|
+
const RenderQueueOutputName = ({ job }) => {
|
|
10
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
11
|
+
(0, actions_1.openInFileExplorer)({ directory: job.outName }).catch((err) => {
|
|
12
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Could not open file: ${err.message}`);
|
|
13
|
+
});
|
|
14
|
+
}, [job.outName]);
|
|
15
|
+
const style = (0, react_1.useMemo)(() => {
|
|
16
|
+
return {
|
|
17
|
+
...item_style_1.renderQueueItemSubtitleStyle,
|
|
18
|
+
cursor: job.deletedOutputLocation ? 'inherit' : 'pointer',
|
|
19
|
+
textDecoration: job.deletedOutputLocation ? 'line-through' : 'none',
|
|
20
|
+
};
|
|
21
|
+
}, [job.deletedOutputLocation]);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("button", { onClick: onClick, type: "button", style: style, disabled: job.deletedOutputLocation, title: job.deletedOutputLocation ? 'File was deleted' : job.outName, children: job.outName }));
|
|
23
|
+
};
|
|
24
|
+
exports.RenderQueueOutputName = RenderQueueOutputName;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueProgressMessage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const modals_1 = require("../../state/modals");
|
|
7
|
+
const z_index_1 = require("../../state/z-index");
|
|
8
|
+
const item_style_1 = require("./item-style");
|
|
9
|
+
const outputLocation = {
|
|
10
|
+
...item_style_1.renderQueueItemSubtitleStyle,
|
|
11
|
+
};
|
|
12
|
+
const RenderQueueProgressMessage = ({ job }) => {
|
|
13
|
+
if (job.status !== 'running') {
|
|
14
|
+
throw new Error('should not have rendered this component');
|
|
15
|
+
}
|
|
16
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
17
|
+
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
18
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
19
|
+
// TODO: Show progress instead
|
|
20
|
+
setSelectedModal({
|
|
21
|
+
type: 'render-error',
|
|
22
|
+
job,
|
|
23
|
+
});
|
|
24
|
+
}, [job, setSelectedModal]);
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("button", { onClick: onClick, type: "button", style: outputLocation, tabIndex: tabIndex, title: job.message, children: job.message }));
|
|
26
|
+
};
|
|
27
|
+
exports.RenderQueueProgressMessage = RenderQueueProgressMessage;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderQueueRemoveItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const InlineAction_1 = require("../InlineAction");
|
|
7
|
+
const actions_1 = require("./actions");
|
|
8
|
+
const RenderQueueRemoveItem = ({ job }) => {
|
|
9
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
10
|
+
(0, actions_1.removeRenderJob)(job).catch((err) => {
|
|
11
|
+
// TODO: Handle error
|
|
12
|
+
console.log(err);
|
|
13
|
+
});
|
|
14
|
+
}, [job]);
|
|
15
|
+
const icon = (0, react_1.useMemo)(() => {
|
|
16
|
+
return {
|
|
17
|
+
height: 16,
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: icon, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 320 512", children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z" }) }) }));
|
|
21
|
+
};
|
|
22
|
+
exports.RenderQueueRemoveItem = RenderQueueRemoveItem;
|