@remotion/cli 4.0.44 → 4.0.46

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 (57) hide show
  1. package/dist/config/index.d.ts +1 -1
  2. package/dist/config/log.d.ts +1 -1
  3. package/dist/editor/components/Canvas.js +10 -28
  4. package/dist/editor/components/CanvasOrLoading.js +1 -1
  5. package/dist/editor/components/CheckboardToggle.js +0 -5
  6. package/dist/editor/components/CompositionSelectorItem.js +1 -7
  7. package/dist/editor/components/CurrentComposition.d.ts +0 -1
  8. package/dist/editor/components/CurrentCompositionSideEffects.js +4 -0
  9. package/dist/editor/components/EditorContent.js +3 -1
  10. package/dist/editor/components/FilePreview.d.ts +2 -1
  11. package/dist/editor/components/FilePreview.js +10 -3
  12. package/dist/editor/components/InitialCompositionLoader.js +9 -2
  13. package/dist/editor/components/LoopToggle.js +0 -7
  14. package/dist/editor/components/MuteToggle.js +0 -7
  15. package/dist/editor/components/NewComposition/RemInput.d.ts +2 -2
  16. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  17. package/dist/editor/components/PlayPause.js +0 -4
  18. package/dist/editor/components/Preview.d.ts +3 -2
  19. package/dist/editor/components/Preview.js +13 -72
  20. package/dist/editor/components/PreviewToolbar.js +4 -1
  21. package/dist/editor/components/RenderPreview.d.ts +2 -0
  22. package/dist/editor/components/RenderPreview.js +4 -3
  23. package/dist/editor/components/RenderQueue/RenderQueueCopyToClipboard.js +3 -2
  24. package/dist/editor/components/RenderQueue/RenderQueueItem.d.ts +1 -0
  25. package/dist/editor/components/RenderQueue/RenderQueueItem.js +55 -2
  26. package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.js +2 -1
  27. package/dist/editor/components/RenderQueue/RenderQueueItemStatus.js +35 -4
  28. package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.js +3 -2
  29. package/dist/editor/components/RenderQueue/RenderQueueOutputName.js +3 -11
  30. package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +2 -1
  31. package/dist/editor/components/RenderQueue/RenderQueueRepeat.js +2 -1
  32. package/dist/editor/components/RenderQueue/index.js +16 -1
  33. package/dist/editor/components/SizeSelector.js +15 -6
  34. package/dist/editor/components/StaticFilePreview.d.ts +2 -0
  35. package/dist/editor/components/StaticFilePreview.js +2 -10
  36. package/dist/editor/components/TimelineInOutToggle.js +0 -6
  37. package/dist/editor/components/UpdateCheck.d.ts +0 -1
  38. package/dist/editor/components/ZoomPersistor.js +9 -3
  39. package/dist/editor/components/layout.d.ts +2 -1
  40. package/dist/editor/components/layout.js +2 -2
  41. package/dist/editor/helpers/colors.d.ts +1 -1
  42. package/dist/editor/helpers/get-asset-metadata.d.ts +11 -0
  43. package/dist/editor/helpers/get-asset-metadata.js +64 -0
  44. package/dist/editor/helpers/is-current-selected-still.d.ts +1 -0
  45. package/dist/editor/helpers/is-current-selected-still.js +14 -1
  46. package/dist/editor/helpers/render-modal-sections.d.ts +0 -1
  47. package/dist/get-cli-options.d.ts +2 -2
  48. package/dist/index.d.ts +10 -10
  49. package/dist/log.d.ts +4 -4
  50. package/dist/preview-server/routes.d.ts +5 -4
  51. package/dist/preview-server/routes.js +52 -8
  52. package/dist/preview-server/serve-static.d.ts +6 -1
  53. package/dist/preview-server/serve-static.js +1 -4
  54. package/dist/preview-server/start-server.d.ts +4 -2
  55. package/dist/preview-server/start-server.js +4 -2
  56. package/dist/studio.js +9 -4
  57. package/package.json +9 -9
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RenderQueueItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const colors_1 = require("../../helpers/colors");
5
8
  const layout_1 = require("../layout");
6
9
  const RenderQueueCopyToClipboard_1 = require("./RenderQueueCopyToClipboard");
7
10
  const RenderQueueError_1 = require("./RenderQueueError");
@@ -35,7 +38,57 @@ const subtitle = {
35
38
  display: 'flex',
36
39
  overflow: 'hidden',
37
40
  };
38
- const RenderQueueItem = ({ job }) => {
39
- 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 }), (0, RenderQueueCopyToClipboard_1.supportsCopyingToClipboard)(job) ? ((0, jsx_runtime_1.jsx)(RenderQueueCopyToClipboard_1.RenderQueueCopyToClipboard, { job: job })) : null, 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 })), job.status === 'done' ? (0, jsx_runtime_1.jsx)(RenderQueueOpenInFolder_1.RenderQueueOpenInFinderItem, { job: job }) : null] }));
41
+ const SELECTED_CLASSNAME = '__remotion_selected_classname';
42
+ const RenderQueueItem = ({ job, selected }) => {
43
+ const [hovered, setHovered] = (0, react_1.useState)(false);
44
+ const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
45
+ const onPointerEnter = (0, react_1.useCallback)(() => {
46
+ setHovered(true);
47
+ }, []);
48
+ const onPointerLeave = (0, react_1.useCallback)(() => {
49
+ setHovered(false);
50
+ }, []);
51
+ const isHoverable = job.status === 'done';
52
+ const containerStyle = (0, react_1.useMemo)(() => {
53
+ return {
54
+ ...container,
55
+ backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
56
+ hovered: isHoverable && hovered,
57
+ selected,
58
+ }),
59
+ userSelect: 'none',
60
+ };
61
+ }, [hovered, isHoverable, selected]);
62
+ const scrollCurrentIntoView = (0, react_1.useCallback)(() => {
63
+ var _a;
64
+ (_a = document
65
+ .querySelector(`.${SELECTED_CLASSNAME}`)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
66
+ }, []);
67
+ const onClick = (0, react_1.useCallback)(() => {
68
+ if (job.status !== 'done') {
69
+ return;
70
+ }
71
+ setCanvasContent((c) => {
72
+ const isAlreadySelected = c && c.type === 'output' && c.path === `/${job.outName}`;
73
+ if (isAlreadySelected && !selected) {
74
+ scrollCurrentIntoView();
75
+ return c;
76
+ }
77
+ return { type: 'output', path: `/${job.outName}` };
78
+ });
79
+ window.history.pushState({}, 'Studio', `/outputs/${job.outName}`);
80
+ }, [
81
+ job.outName,
82
+ job.status,
83
+ scrollCurrentIntoView,
84
+ selected,
85
+ setCanvasContent,
86
+ ]);
87
+ (0, react_1.useEffect)(() => {
88
+ if (selected) {
89
+ scrollCurrentIntoView();
90
+ }
91
+ }, [scrollCurrentIntoView, selected]);
92
+ return ((0, jsx_runtime_1.jsxs)(layout_1.Row, { onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: containerStyle, align: "center", onClick: onClick, className: selected ? SELECTED_CLASSNAME : undefined, 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 }), (0, RenderQueueCopyToClipboard_1.supportsCopyingToClipboard)(job) ? ((0, jsx_runtime_1.jsx)(RenderQueueCopyToClipboard_1.RenderQueueCopyToClipboard, { job: job })) : null, 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 })), job.status === 'done' ? (0, jsx_runtime_1.jsx)(RenderQueueOpenInFolder_1.RenderQueueOpenInFinderItem, { job: job }) : null] }));
40
93
  };
41
94
  exports.RenderQueueItem = RenderQueueItem;
@@ -7,7 +7,8 @@ const InlineAction_1 = require("../InlineAction");
7
7
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
8
8
  const actions_1 = require("./actions");
9
9
  const RenderQueueCancelButton = ({ job }) => {
10
- const onClick = (0, react_1.useCallback)(() => {
10
+ const onClick = (0, react_1.useCallback)((e) => {
11
+ e.stopPropagation();
11
12
  (0, actions_1.cancelRenderJob)(job).catch((err) => {
12
13
  (0, NotificationCenter_1.sendErrorNotification)(`Could not cancel job: ${err.message}`);
13
14
  });
@@ -1,8 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.RenderQueueItemStatus = void 0;
4
27
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
28
+ const react_1 = __importStar(require("react"));
6
29
  const colors_1 = require("../../helpers/colors");
7
30
  const modals_1 = require("../../state/modals");
8
31
  const CircularProgress_1 = require("./CircularProgress");
@@ -19,7 +42,15 @@ const invisibleStyle = {
19
42
  };
20
43
  const RenderQueueItemStatus = ({ job }) => {
21
44
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
22
- const openProgress = (0, react_1.useCallback)(() => {
45
+ const [hovered, setHovered] = react_1.default.useState(false);
46
+ const onPointerEnter = (0, react_1.useCallback)(() => {
47
+ setHovered(true);
48
+ }, []);
49
+ const onPointerLeave = (0, react_1.useCallback)(() => {
50
+ setHovered(false);
51
+ }, []);
52
+ const onClick = (0, react_1.useCallback)((e) => {
53
+ e.stopPropagation();
23
54
  setSelectedModal({
24
55
  type: 'render-progress',
25
56
  jobId: job.id,
@@ -32,11 +63,11 @@ const RenderQueueItemStatus = ({ job }) => {
32
63
  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" }) }));
33
64
  }
34
65
  if (job.status === 'done') {
35
- return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: invisibleStyle, onClick: openProgress, children: (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" }) }) }));
66
+ return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: invisibleStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: hovered ? 'white' : 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" }) }) }));
36
67
  }
37
68
  if (job.status === 'running') {
38
69
  // Add a minimum progress to avoid the progress bar from disappearing
39
- return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: invisibleStyle, onClick: openProgress, children: (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress.value) }) }));
70
+ return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: invisibleStyle, onClick: onClick, children: (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress.value) }) }));
40
71
  }
41
72
  throw new Error('Unknown job status');
42
73
  };
@@ -7,8 +7,9 @@ const folder_1 = require("../../icons/folder");
7
7
  const InlineAction_1 = require("../InlineAction");
8
8
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
9
9
  const actions_1 = require("./actions");
10
- const RenderQueueOpenInFinderItem = ({ job, }) => {
11
- const onClick = (0, react_1.useCallback)(() => {
10
+ const RenderQueueOpenInFinderItem = ({ job }) => {
11
+ const onClick = (0, react_1.useCallback)((e) => {
12
+ e.stopPropagation();
12
13
  (0, actions_1.openInFileExplorer)({ directory: job.outName }).catch((err) => {
13
14
  (0, NotificationCenter_1.sendErrorNotification)(`Could not open file: ${err.message}`);
14
15
  });
@@ -3,24 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RenderQueueOutputName = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const NotificationCenter_1 = require("../Notifications/NotificationCenter");
7
- const actions_1 = require("./actions");
8
6
  const item_style_1 = require("./item-style");
9
7
  const RenderQueueOutputName = ({ job }) => {
10
- const onClick = (0, react_1.useCallback)(() => {
11
- if (job.deletedOutputLocation)
12
- return;
13
- (0, actions_1.openInFileExplorer)({ directory: job.outName }).catch((err) => {
14
- (0, NotificationCenter_1.sendErrorNotification)(err.message);
15
- });
16
- }, [job]);
17
8
  const style = (0, react_1.useMemo)(() => {
18
9
  return {
19
10
  ...item_style_1.renderQueueItemSubtitleStyle,
20
- cursor: job.deletedOutputLocation ? 'inherit' : 'pointer',
21
11
  textDecoration: job.deletedOutputLocation ? 'line-through' : 'none',
12
+ color: item_style_1.renderQueueItemSubtitleStyle.color,
13
+ cursor: 'inherit',
22
14
  };
23
15
  }, [job.deletedOutputLocation]);
24
- 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 }));
16
+ return ((0, jsx_runtime_1.jsx)("span", { style: style, title: job.deletedOutputLocation ? 'File was deleted' : job.outName, children: job.outName }));
25
17
  };
26
18
  exports.RenderQueueOutputName = RenderQueueOutputName;
@@ -7,7 +7,8 @@ const InlineAction_1 = require("../InlineAction");
7
7
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
8
8
  const actions_1 = require("./actions");
9
9
  const RenderQueueRemoveItem = ({ job }) => {
10
- const onClick = (0, react_1.useCallback)(() => {
10
+ const onClick = (0, react_1.useCallback)((e) => {
11
+ e.stopPropagation();
11
12
  (0, actions_1.removeRenderJob)(job)
12
13
  .then(() => {
13
14
  var _a;
@@ -8,7 +8,8 @@ const modals_1 = require("../../state/modals");
8
8
  const InlineAction_1 = require("../InlineAction");
9
9
  const RenderQueueRepeatItem = ({ job }) => {
10
10
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
11
- const onClick = (0, react_1.useCallback)(() => {
11
+ const onClick = (0, react_1.useCallback)((e) => {
12
+ e.stopPropagation();
12
13
  const retryPayload = (0, make_retry_payload_1.makeRetryPayload)(job);
13
14
  setSelectedModal(retryPayload);
14
15
  }, [job, setSelectedModal]);
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.RenderQueue = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
+ const remotion_1 = require("remotion");
29
30
  const client_id_1 = require("../../helpers/client-id");
30
31
  const colors_1 = require("../../helpers/colors");
31
32
  const layout_1 = require("../layout");
@@ -59,6 +60,7 @@ const renderQueue = {
59
60
  const RenderQueue = () => {
60
61
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx).type;
61
62
  const { jobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
63
+ const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
62
64
  const previousJobCount = react_1.default.useRef(jobs.length);
63
65
  const jobCount = jobs.length;
64
66
  const divRef = react_1.default.useRef(null);
@@ -75,6 +77,19 @@ const RenderQueue = () => {
75
77
  }
76
78
  previousJobCount.current = jobCount;
77
79
  }, [jobCount]);
80
+ const selectedJob = (0, react_1.useMemo)(() => {
81
+ let selectedIndex = -1;
82
+ for (let i = 0; i < jobs.length; i++) {
83
+ const job = jobs[i];
84
+ if (canvasContent &&
85
+ canvasContent.type === 'output' &&
86
+ canvasContent.path === `/${job.outName}` &&
87
+ job.status === 'done') {
88
+ selectedIndex = i;
89
+ }
90
+ }
91
+ return selectedIndex;
92
+ }, [canvasContent, jobs]);
78
93
  if (connectionStatus === 'disconnected') {
79
94
  return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The studio server has disconnected." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true })] }));
80
95
  }
@@ -82,7 +97,7 @@ const RenderQueue = () => {
82
97
  return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "No renders in the queue." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true })] }));
83
98
  }
84
99
  return ((0, jsx_runtime_1.jsx)("div", { ref: divRef, style: renderQueue, className: ['css-reset', is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME].join(' '), children: jobs.map((j, index) => {
85
- return ((0, jsx_runtime_1.jsx)("div", { style: index === jobs.length - 1 ? undefined : separatorStyle, children: (0, jsx_runtime_1.jsx)(RenderQueueItem_1.RenderQueueItem, { job: j }) }, j.id));
100
+ return ((0, jsx_runtime_1.jsx)("div", { style: index === jobs.length - 1 ? undefined : separatorStyle, children: (0, jsx_runtime_1.jsx)(RenderQueueItem_1.RenderQueueItem, { selected: selectedJob === index, job: j }) }, j.id));
86
101
  }) }));
87
102
  };
88
103
  exports.RenderQueue = RenderQueue;
@@ -67,8 +67,8 @@ const getUniqueSizes = (size) => {
67
67
  });
68
68
  };
69
69
  exports.getUniqueSizes = getUniqueSizes;
70
+ const zoomableFileTypes = ['video', 'image'];
70
71
  const SizeSelector = () => {
71
- const zoomableFileTypes = ['video', 'image'];
72
72
  const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
73
73
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
74
74
  const style = (0, react_1.useMemo)(() => {
@@ -77,13 +77,22 @@ const SizeSelector = () => {
77
77
  };
78
78
  }, []);
79
79
  const zoomable = (0, react_1.useMemo)(() => {
80
- if ((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset') {
81
- if (zoomableFileTypes.includes((0, Preview_1.getPreviewFileType)(canvasContent.asset))) {
82
- return true;
83
- }
80
+ if (!canvasContent) {
81
+ return null;
82
+ }
83
+ if (canvasContent.type === 'composition') {
84
+ return true;
85
+ }
86
+ if (canvasContent.type === 'asset' &&
87
+ zoomableFileTypes.includes((0, Preview_1.getPreviewFileType)(canvasContent.asset))) {
88
+ return true;
89
+ }
90
+ if (canvasContent.type === 'output' &&
91
+ zoomableFileTypes.includes((0, Preview_1.getPreviewFileType)(canvasContent.path))) {
92
+ return true;
84
93
  }
85
94
  return false;
86
- }, [canvasContent, zoomableFileTypes]);
95
+ }, [canvasContent]);
87
96
  const items = (0, react_1.useMemo)(() => {
88
97
  return (0, exports.getUniqueSizes)(size).map((newSize) => {
89
98
  return {
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import type { AssetMetadata } from '../helpers/get-asset-metadata';
2
3
  export declare const StaticFilePreview: React.FC<{
3
4
  currentAsset: string;
5
+ assetMetadata: AssetMetadata | null;
4
6
  }>;
@@ -4,7 +4,6 @@ exports.StaticFilePreview = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
- const format_bytes_1 = require("../../format-bytes");
8
7
  const client_id_1 = require("../helpers/client-id");
9
8
  const colors_1 = require("../helpers/colors");
10
9
  const FilePreview_1 = require("./FilePreview");
@@ -20,7 +19,7 @@ const errMsgStyle = {
20
19
  ...msgStyle,
21
20
  color: colors_1.LIGHT_TEXT,
22
21
  };
23
- const StaticFilePreview = ({ currentAsset, }) => {
22
+ const StaticFilePreview = ({ currentAsset, assetMetadata }) => {
24
23
  const fileType = (0, Preview_1.getPreviewFileType)(currentAsset);
25
24
  const staticFileSrc = (0, remotion_1.staticFile)(currentAsset);
26
25
  const staticFiles = (0, remotion_1.getStaticFiles)();
@@ -32,16 +31,9 @@ const StaticFilePreview = ({ currentAsset, }) => {
32
31
  if (!exists) {
33
32
  return ((0, jsx_runtime_1.jsxs)("div", { style: errMsgStyle, children: [currentAsset, " does not exist in your public folder."] }));
34
33
  }
35
- const fileSize = (() => {
36
- const fileFromStaticFiles = staticFiles.find((file) => file.name === currentAsset);
37
- if (fileFromStaticFiles) {
38
- return (0, format_bytes_1.formatBytes)(fileFromStaticFiles === null || fileFromStaticFiles === void 0 ? void 0 : fileFromStaticFiles.sizeInBytes);
39
- }
40
- return null;
41
- })();
42
34
  if (!currentAsset) {
43
35
  return null;
44
36
  }
45
- return ((0, jsx_runtime_1.jsx)(FilePreview_1.FilePreview, { currentAsset: currentAsset, fileSize: fileSize, fileType: fileType, src: staticFileSrc }));
37
+ return ((0, jsx_runtime_1.jsx)(FilePreview_1.FilePreview, { currentAsset: currentAsset, fileType: fileType, src: staticFileSrc, assetMetadata: assetMetadata }));
46
38
  };
47
39
  exports.StaticFilePreview = StaticFilePreview;
@@ -6,7 +6,6 @@ const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
7
  const truthy_1 = require("../../truthy");
8
8
  const colors_1 = require("../helpers/colors");
9
- const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
10
9
  const use_keybinding_1 = require("../helpers/use-keybinding");
11
10
  const timelineInOutPointer_1 = require("../icons/timelineInOutPointer");
12
11
  const in_out_1 = require("../state/in-out");
@@ -27,9 +26,7 @@ exports.defaultInOutValue = { inFrame: null, outFrame: null };
27
26
  const TimelineInOutPointToggle = () => {
28
27
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
29
28
  const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
30
- const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
31
29
  const { setInAndOutFrames } = (0, in_out_1.useTimelineSetInOutFramePosition)();
32
- const isStill = (0, is_current_selected_still_1.useIsStill)();
33
30
  const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
34
31
  const keybindings = (0, use_keybinding_1.useKeybinding)();
35
32
  const onInOutClear = (0, react_1.useCallback)((composition) => {
@@ -235,9 +232,6 @@ const TimelineInOutPointToggle = () => {
235
232
  outMarkClick: onOutMark,
236
233
  };
237
234
  }, [confId, onInMark, onInOutClear, onOutMark]);
238
- if (isStill || canvasContent === null || canvasContent.type === 'asset') {
239
- return null;
240
- }
241
235
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: getTooltipText('In', 'I'), "aria-label": getTooltipText('In', 'I'), onClick: (e) => onInMark(e), onContextMenu: clearInMark, disabled: !videoConfig || timelinePosition === 0, children: (0, jsx_runtime_1.jsx)(timelineInOutPointer_1.TimelineInPointer, { color: inFrame === null ? 'white' : colors_1.BLUE, style: style }) }), (0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: getTooltipText('Out', 'O'), "aria-label": getTooltipText('Out', 'O'), onClick: onOutMark, onContextMenu: clearOutMark, disabled: !videoConfig || timelinePosition === videoConfig.durationInFrames - 1, children: (0, jsx_runtime_1.jsx)(timelineInOutPointer_1.TimelineOutPointer, { color: outFrame === null ? 'white' : colors_1.BLUE, style: style }) })] }));
242
236
  };
243
237
  exports.TimelineInOutPointToggle = TimelineInOutPointToggle;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PackageManager } from '../../preview-server/get-package-manager';
3
2
  export type UpdateInfo = {
4
3
  currentVersion: string;
@@ -20,12 +20,18 @@ const getZoomForComposition = (composition) => {
20
20
  };
21
21
  exports.getZoomForComposition = getZoomForComposition;
22
22
  const deriveCanvasContentFromUrl = () => {
23
- const substrings = window.location.pathname.split('/');
23
+ const substrings = window.location.pathname.split('/').filter(Boolean);
24
24
  const lastPart = substrings[substrings.length - 1];
25
- if (substrings.includes('assets')) {
25
+ if (substrings[0] === 'assets') {
26
26
  return {
27
27
  type: 'asset',
28
- asset: decodeURIComponent(window.location.pathname.substring(8)),
28
+ asset: decodeURIComponent(window.location.pathname.substring('/assets/'.length)),
29
+ };
30
+ }
31
+ if (substrings[0] === 'outputs') {
32
+ return {
33
+ type: 'output',
34
+ path: decodeURIComponent(window.location.pathname.substring('/outputs/'.length)),
29
35
  };
30
36
  }
31
37
  if (lastPart) {
@@ -1,3 +1,4 @@
1
+ import type { HTMLAttributes } from 'react';
1
2
  import React from 'react';
2
3
  export declare const SPACING_UNIT = 8;
3
4
  export declare const Spacing: React.FC<{
@@ -15,7 +16,7 @@ export declare const Row: React.FC<{
15
16
  flex?: number;
16
17
  className?: string;
17
18
  children: React.ReactNode;
18
- }>;
19
+ } & HTMLAttributes<HTMLDivElement>>;
19
20
  export declare const Column: React.FC<{
20
21
  justify?: 'center';
21
22
  align?: 'center';
@@ -19,7 +19,7 @@ exports.Spacing = Spacing;
19
19
  const flexCss = { flex: 1 };
20
20
  const Flex = ({ children }) => (0, jsx_runtime_1.jsx)("div", { style: flexCss, children: children });
21
21
  exports.Flex = Flex;
22
- const Row = ({ children, justify, className, align, flex, style = {} }) => {
22
+ const Row = ({ children, justify, className, align, flex, style = {}, ...other }) => {
23
23
  const finalStyle = (0, react_1.useMemo)(() => {
24
24
  return {
25
25
  ...style,
@@ -30,7 +30,7 @@ const Row = ({ children, justify, className, align, flex, style = {} }) => {
30
30
  flex: flex !== null && flex !== void 0 ? flex : undefined,
31
31
  };
32
32
  }, [align, flex, justify, style]);
33
- return ((0, jsx_runtime_1.jsx)("div", { className: className, style: finalStyle, children: children }));
33
+ return ((0, jsx_runtime_1.jsx)("div", { className: className, style: finalStyle, ...other, children: children }));
34
34
  };
35
35
  exports.Row = Row;
36
36
  const Column = ({ children, justify, className, align, style = {} }) => {
@@ -16,4 +16,4 @@ export declare const BLUE_DISABLED = "#284f73";
16
16
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
17
17
  selected: boolean;
18
18
  hovered: boolean;
19
- }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
19
+ }) => "transparent" | "hsla(0, 0%, 100%, 0.25)" | "hsla(0, 0%, 100%, 0.15)" | "rgba(255, 255, 255, 0.06)";
@@ -0,0 +1,11 @@
1
+ import type { CanvasContent } from 'remotion';
2
+ import type { Dimensions } from './is-current-selected-still';
3
+ export declare const remotion_outputsBase: string;
4
+ export type AssetMetadata = {
5
+ type: 'not-found';
6
+ } | {
7
+ type: 'found';
8
+ size: number;
9
+ dimensions: Dimensions | 'none' | null;
10
+ };
11
+ export declare const getAssetMetadata: (canvasContent: CanvasContent) => Promise<AssetMetadata>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAssetMetadata = exports.remotion_outputsBase = void 0;
4
+ const media_utils_1 = require("@remotion/media-utils");
5
+ const remotion_1 = require("remotion");
6
+ const Preview_1 = require("../components/Preview");
7
+ exports.remotion_outputsBase = window.remotion_staticBase.replace('static', 'outputs');
8
+ const getSrcFromCanvasContent = (canvasContent) => {
9
+ if (canvasContent.type === 'asset') {
10
+ return (0, remotion_1.staticFile)(canvasContent.asset);
11
+ }
12
+ if (canvasContent.type === 'composition') {
13
+ throw new Error('cannot get dimensions for composition');
14
+ }
15
+ return exports.remotion_outputsBase + canvasContent.path;
16
+ };
17
+ const getAssetMetadata = async (canvasContent) => {
18
+ const src = getSrcFromCanvasContent(canvasContent);
19
+ const file = await fetch(src, {
20
+ method: 'HEAD',
21
+ });
22
+ if (file.status === 404) {
23
+ return { type: 'not-found' };
24
+ }
25
+ if (file.status !== 200) {
26
+ throw new Error(`Expected status code 200 or 404 for file, got ${file.status}`);
27
+ }
28
+ const size = file.headers.get('content-length');
29
+ if (!size) {
30
+ throw new Error('Unexpected error: content-length is null');
31
+ }
32
+ const fileType = (0, Preview_1.getPreviewFileType)(src);
33
+ if (fileType === 'video') {
34
+ const resolution = await (0, media_utils_1.getVideoMetadata)(src);
35
+ return {
36
+ type: 'found',
37
+ size: Number(size),
38
+ dimensions: { width: resolution.width, height: resolution.height },
39
+ };
40
+ }
41
+ if (fileType === 'image') {
42
+ const resolution = await new Promise((resolve, reject) => {
43
+ const img = new Image();
44
+ img.onload = () => {
45
+ resolve({
46
+ type: 'found',
47
+ size: Number(size),
48
+ dimensions: { width: img.width, height: img.height },
49
+ });
50
+ };
51
+ img.onerror = () => {
52
+ reject(new Error('Failed to load image'));
53
+ };
54
+ img.src = src;
55
+ });
56
+ return resolution;
57
+ }
58
+ return {
59
+ type: 'found',
60
+ dimensions: 'none',
61
+ size: Number(size),
62
+ };
63
+ };
64
+ exports.getAssetMetadata = getAssetMetadata;
@@ -3,3 +3,4 @@ export type Dimensions = {
3
3
  height: number;
4
4
  };
5
5
  export declare const useIsStill: () => boolean;
6
+ export declare const useIsVideoComposition: () => boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIsStill = void 0;
3
+ exports.useIsVideoComposition = exports.useIsStill = void 0;
4
+ const react_1 = require("react");
4
5
  const remotion_1 = require("remotion");
5
6
  const is_composition_still_1 = require("./is-composition-still");
6
7
  const useIsStill = () => {
@@ -11,3 +12,15 @@ const useIsStill = () => {
11
12
  return (0, is_composition_still_1.isCompositionStill)(resolved.result);
12
13
  };
13
14
  exports.useIsStill = useIsStill;
15
+ const useIsVideoComposition = () => {
16
+ const isStill = (0, exports.useIsStill)();
17
+ const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
18
+ if (canvasContent === null) {
19
+ return false;
20
+ }
21
+ if (isStill) {
22
+ return false;
23
+ }
24
+ return canvasContent.type === 'composition';
25
+ };
26
+ exports.useIsVideoComposition = useIsVideoComposition;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Codec } from '@remotion/renderer';
3
2
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
4
3
  type Section = 'general' | 'picture' | 'advanced' | 'data' | 'gif' | 'audio';
@@ -15,13 +15,13 @@ export declare const getCliOptions: (options: {
15
15
  browser: "chrome";
16
16
  crf: import("@remotion/renderer").Crf | null;
17
17
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
18
- proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
18
+ proResProfile: "light" | "4444-xq" | "4444" | "hq" | "standard" | "proxy" | undefined;
19
19
  x264Preset: "medium" | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "slow" | "slower" | "veryslow" | "placebo" | undefined;
20
20
  everyNthFrame: number;
21
21
  numberOfGifLoops: import("./config/number-of-gif-loops").Loop;
22
22
  stillFrame: number;
23
23
  browserExecutable: BrowserExecutable;
24
- logLevel: "verbose" | "info" | "warn" | "error";
24
+ logLevel: "error" | "verbose" | "info" | "warn";
25
25
  scale: number;
26
26
  chromiumOptions: ChromiumOptions;
27
27
  overwrite: boolean;