@remotion/studio 4.0.506 → 4.0.507
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/api/copy-render-output-to-asset.d.ts +4 -0
- package/dist/api/copy-render-output-to-asset.js +11 -0
- package/dist/components/AssetSelector.js +19 -4
- package/dist/components/AssetSelectorItem.js +2 -2
- package/dist/components/CodingAgentIcon.d.ts +4 -0
- package/dist/components/CodingAgentIcon.js +17 -0
- package/dist/components/ConfigureDefaultEditorModal.d.ts +1 -3
- package/dist/components/ConfigureDefaultEditorModal.js +67 -77
- package/dist/components/ConfigureLicenseModal.d.ts +1 -4
- package/dist/components/ConfigureLicenseModal.js +89 -81
- package/dist/components/ContextMenu.js +10 -8
- package/dist/components/EditorContexts.js +6 -5
- package/dist/components/ExpandedTracksProvider.js +10 -53
- package/dist/components/InspectorLocationCopy.js +8 -8
- package/dist/components/InspectorOpenInEditor.d.ts +1 -0
- package/dist/components/InspectorOpenInEditor.js +39 -49
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -0
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +22 -4
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
- package/dist/components/Menu/MenuSectionHeader.d.ts +4 -0
- package/dist/components/Menu/MenuSectionHeader.js +20 -0
- package/dist/components/Menu/SubMenu.js +13 -2
- package/dist/components/Menu/menu-tree-context.d.ts +3 -0
- package/dist/components/Menu/menu-tree-context.js +13 -0
- package/dist/components/NewComposition/ComboBox.d.ts +6 -1
- package/dist/components/NewComposition/MenuContent.js +27 -19
- package/dist/components/NewComposition/menu-typeahead.js +2 -2
- package/dist/components/Preview.js +29 -4
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/ServerRenderModal.js +4 -0
- package/dist/components/RenderQueue/RenderQueueItem.js +8 -2
- package/dist/components/RenderQueue/actions.d.ts +4 -2
- package/dist/components/RenderQueue/actions.js +4 -2
- package/dist/components/RenderQueue/index.js +3 -4
- package/dist/components/RenderQueue/use-render-output-file-drag.d.ts +8 -0
- package/dist/components/RenderQueue/use-render-output-file-drag.js +121 -0
- package/dist/components/SegmentedControl.js +0 -1
- package/dist/components/SelectedOutlineElement.d.ts +14 -17
- package/dist/components/SelectedOutlineElement.js +112 -930
- package/dist/components/SelectedOutlineKeyboardControls.d.ts +7 -0
- package/dist/components/SelectedOutlineKeyboardControls.js +261 -0
- package/dist/components/SelectedOutlineOverlay.d.ts +6 -13
- package/dist/components/SelectedOutlineOverlay.js +349 -864
- package/dist/components/SelectedOutlinePolygon.d.ts +25 -0
- package/dist/components/SelectedOutlinePolygon.js +359 -0
- package/dist/components/SelectedOutlineRenderer.d.ts +18 -0
- package/dist/components/SelectedOutlineRenderer.js +208 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +16 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +269 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +16 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +211 -0
- package/dist/components/SelectedOutlineSnapIndicators.d.ts +9 -0
- package/dist/components/SelectedOutlineSnapIndicators.js +29 -0
- package/dist/components/SelectedOutlineTransformOriginHandle.d.ts +9 -0
- package/dist/components/SelectedOutlineTransformOriginHandle.js +286 -0
- package/dist/components/SelectedOutlineUvControls.d.ts +3 -9
- package/dist/components/SelectedOutlineUvControls.js +57 -12
- package/dist/components/SettingsContext.d.ts +15 -0
- package/dist/components/SettingsContext.js +116 -0
- package/dist/components/SettingsModal.js +10 -4
- package/dist/components/SettingsModalFooter.d.ts +1 -3
- package/dist/components/SettingsModalFooter.js +4 -6
- package/dist/components/ShowOutlinesProvider.js +2 -3
- package/dist/components/Timeline/EasingEditorModal.js +66 -22
- package/dist/components/Timeline/Timeline.js +22 -5
- package/dist/components/Timeline/TimelineDuplicateCount.d.ts +4 -0
- package/dist/components/Timeline/TimelineDuplicateCount.js +28 -0
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +3 -23
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +4 -2
- package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +11 -1
- package/dist/components/Timeline/TimelineSequence.js +28 -25
- package/dist/components/Timeline/TimelineSequenceItem.js +49 -27
- package/dist/components/Timeline/TimelineTrack.js +2 -1
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -3
- package/dist/components/Timeline/get-sequence-context-menu-items.js +58 -53
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +36 -4
- package/dist/components/Timeline/{use-open-sequence-in-editor.d.ts → use-open-sequence-in-apps.d.ts} +4 -1
- package/dist/components/Timeline/{use-open-sequence-in-editor.js → use-open-sequence-in-apps.js} +20 -4
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +4 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +45 -1
- package/dist/components/get-open-in-menu-items.d.ts +12 -0
- package/dist/components/get-open-in-menu-items.js +83 -0
- package/dist/components/selected-outline-measurement.d.ts +2 -2
- package/dist/components/selected-outline-order.d.ts +12 -0
- package/dist/components/selected-outline-order.js +251 -0
- package/dist/components/selected-outline-types.d.ts +9 -10
- package/dist/components/svg-point-to-client-point.d.ts +2 -0
- package/dist/components/svg-point-to-client-point.js +10 -0
- package/dist/components/use-auto-save-config.d.ts +8 -0
- package/dist/components/use-auto-save-config.js +74 -0
- package/dist/components/use-default-editor-info.d.ts +1 -0
- package/dist/components/use-default-editor-info.js +10 -30
- package/dist/esm/{chunk-jefhcs5z.js → chunk-fgedsvhb.js} +1 -2
- package/dist/esm/{chunk-b49ec3nz.js → chunk-ptnd65a9.js} +10602 -9364
- package/dist/esm/internals.mjs +10601 -9363
- package/dist/esm/previewEntry.mjs +10462 -9224
- package/dist/esm/renderEntry.mjs +2 -2
- package/dist/helpers/are-sequence-node-path-infos-equal.d.ts +2 -0
- package/dist/helpers/are-sequence-node-path-infos-equal.js +27 -0
- package/dist/helpers/calculate-timeline.js +3 -3
- package/dist/helpers/client-id.js +8 -1
- package/dist/helpers/format-file-location.d.ts +1 -1
- package/dist/helpers/format-file-location.js +3 -3
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +3 -3
- package/dist/helpers/open-in-editor.d.ts +1 -0
- package/dist/helpers/open-in-editor.js +5 -1
- package/dist/helpers/studio-runtime-config.js +3 -0
- package/dist/helpers/timeline-node-path-key.d.ts +2 -0
- package/dist/helpers/timeline-node-path-key.js +3 -1
- package/dist/helpers/use-asset-drag-events.d.ts +2 -1
- package/dist/helpers/use-asset-drag-events.js +14 -6
- package/dist/helpers/use-menu-structure.js +2 -2
- package/dist/helpers/use-runtime-values.d.ts +1 -3
- package/dist/state/timeline-sequence-hover.d.ts +9 -3
- package/dist/state/timeline-sequence-hover.js +63 -12
- package/package.json +12 -12
|
@@ -8,7 +8,9 @@ const mobile_layout_1 = require("../../helpers/mobile-layout");
|
|
|
8
8
|
const studio_runtime_config_1 = require("../../helpers/studio-runtime-config");
|
|
9
9
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
10
10
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
11
|
+
const menu_tree_context_1 = require("../Menu/menu-tree-context");
|
|
11
12
|
const MenuDivider_1 = require("../Menu/MenuDivider");
|
|
13
|
+
const MenuSectionHeader_1 = require("../Menu/MenuSectionHeader");
|
|
12
14
|
const MenuSubItem_1 = require("../Menu/MenuSubItem");
|
|
13
15
|
const styles_1 = require("../Menu/styles");
|
|
14
16
|
const menu_typeahead_1 = require("./menu-typeahead");
|
|
@@ -27,6 +29,9 @@ const container = {
|
|
|
27
29
|
const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMenu, leaveLeftSpace, topItemCanBeUnselected, fixedHeight, }) => {
|
|
28
30
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
29
31
|
const containerRef = (0, react_1.useRef)(null);
|
|
32
|
+
const inheritedMenuTreeId = (0, react_1.useContext)(menu_tree_context_1.MenuTreeContext);
|
|
33
|
+
const localMenuTreeId = (0, react_1.useRef)((0, menu_tree_context_1.getNextMenuTreeId)());
|
|
34
|
+
const menuTreeId = inheritedMenuTreeId !== null && inheritedMenuTreeId !== void 0 ? inheritedMenuTreeId : localMenuTreeId.current;
|
|
30
35
|
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
31
36
|
const [subMenuActivated, setSubMenuActivated] = (0, react_1.useState)(false);
|
|
32
37
|
const typeaheadQueryRef = (0, react_1.useRef)('');
|
|
@@ -51,7 +56,7 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
|
|
|
51
56
|
}
|
|
52
57
|
}, []);
|
|
53
58
|
const isItemSelectable = (0, react_1.useCallback)((v) => {
|
|
54
|
-
return v.type
|
|
59
|
+
return v.type === 'item' && !v.disabled;
|
|
55
60
|
}, []);
|
|
56
61
|
const onArrowUp = (0, react_1.useCallback)(() => {
|
|
57
62
|
setSelectedItem((prevItem) => {
|
|
@@ -98,8 +103,8 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
|
|
|
98
103
|
if (!item) {
|
|
99
104
|
throw new Error('cannot find item');
|
|
100
105
|
}
|
|
101
|
-
if (item.type
|
|
102
|
-
throw new Error('cannot
|
|
106
|
+
if (item.type !== 'item') {
|
|
107
|
+
throw new Error('cannot select non-interactive menu item');
|
|
103
108
|
}
|
|
104
109
|
if (item.disabled) {
|
|
105
110
|
return;
|
|
@@ -118,8 +123,8 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
|
|
|
118
123
|
if (!item) {
|
|
119
124
|
throw new Error('cannot find item');
|
|
120
125
|
}
|
|
121
|
-
if (item.type
|
|
122
|
-
throw new Error('cannot
|
|
126
|
+
if (item.type !== 'item') {
|
|
127
|
+
throw new Error('cannot select non-interactive menu item');
|
|
123
128
|
}
|
|
124
129
|
if (!item.subMenu) {
|
|
125
130
|
return onNextMenu();
|
|
@@ -282,8 +287,8 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
|
|
|
282
287
|
// Can happen if resizing the window
|
|
283
288
|
return;
|
|
284
289
|
}
|
|
285
|
-
if (item.type
|
|
286
|
-
throw new Error('should not select
|
|
290
|
+
if (item.type !== 'item') {
|
|
291
|
+
throw new Error('should not select non-interactive menu item');
|
|
287
292
|
}
|
|
288
293
|
if (!item.subMenu && subMenuActivated) {
|
|
289
294
|
setSubMenuActivated(false);
|
|
@@ -303,18 +308,21 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
|
|
|
303
308
|
current.addEventListener('pointerleave', onPointerLeave);
|
|
304
309
|
return () => current.removeEventListener('pointerleave', onPointerLeave);
|
|
305
310
|
}, [onHide, subMenuActivated]);
|
|
306
|
-
return (jsx_runtime_1.jsx("div", { ref: containerRef, style: containerWithHeight, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: values.map((item) => {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (item.subMenu) {
|
|
313
|
-
return null;
|
|
311
|
+
return (jsx_runtime_1.jsx(menu_tree_context_1.MenuTreeContext.Provider, { value: menuTreeId, children: jsx_runtime_1.jsx("div", { ref: containerRef, "data-remotion-menu-tree-id": menuTreeId, style: containerWithHeight, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: values.map((item) => {
|
|
312
|
+
if (item.type === 'divider') {
|
|
313
|
+
return jsx_runtime_1.jsx(MenuDivider_1.MenuDivider, {}, item.id);
|
|
314
|
+
}
|
|
315
|
+
if (item.type === 'section-header') {
|
|
316
|
+
return (jsx_runtime_1.jsx(MenuSectionHeader_1.MenuSectionHeader, { children: item.label }, item.id));
|
|
314
317
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
const onClick = (id, e) => {
|
|
319
|
+
item.onClick(id, e);
|
|
320
|
+
if (item.subMenu) {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
onHide();
|
|
324
|
+
};
|
|
325
|
+
return (jsx_runtime_1.jsx(MenuSubItem_1.MenuSubItem, { selected: item.id === selectedItem, onActionChosen: onClick, onItemSelected: onItemSelected, label: item.label, id: item.id, keyHint: item.keyHint, leaveLeftSpace: leaveLeftSpace, leftItem: item.leftItem, subMenu: item.subMenu, onQuitMenu: onHide, onNextMenu: onNextMenu, subMenuActivated: subMenuActivated, setSubMenuActivated: setSubMenuActivated, disabled: item.disabled }, item.id));
|
|
326
|
+
}) }) }));
|
|
319
327
|
};
|
|
320
328
|
exports.MenuContent = MenuContent;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findTypeaheadMenuItem = void 0;
|
|
4
4
|
const getLabelToMatch = (value) => {
|
|
5
|
-
if (value.type
|
|
5
|
+
if (value.type !== 'item' || value.disabled) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
if (typeof value.label === 'string') {
|
|
@@ -19,7 +19,7 @@ const findTypeaheadMenuItem = ({ query, values, }) => {
|
|
|
19
19
|
const label = getLabelToMatch(value);
|
|
20
20
|
return label ? label.toLowerCase().startsWith(normalizedQuery) : false;
|
|
21
21
|
});
|
|
22
|
-
if (!matched || matched.type
|
|
22
|
+
if (!matched || matched.type !== 'item') {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
25
|
return matched.id;
|
|
@@ -69,6 +69,24 @@ const VideoPreview = ({ canvasSize, contentDimensions, canvasContent, assetMetad
|
|
|
69
69
|
exports.VideoPreview = VideoPreview;
|
|
70
70
|
const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent, assetMetadata }) => {
|
|
71
71
|
const { size: previewSize } = (0, react_1.useContext)(remotion_1.Internals.PreviewSizeContext);
|
|
72
|
+
const [canvasHovered, setCanvasHovered] = (0, react_1.useState)(false);
|
|
73
|
+
const compositionContainerRef = (0, react_1.useRef)(null);
|
|
74
|
+
(0, react_1.useEffect)(() => {
|
|
75
|
+
const compositionContainer = compositionContainerRef.current;
|
|
76
|
+
if (compositionContainer === null) {
|
|
77
|
+
setCanvasHovered(false);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const onPointerEnter = () => setCanvasHovered(true);
|
|
81
|
+
const onPointerLeave = () => setCanvasHovered(false);
|
|
82
|
+
setCanvasHovered(compositionContainer.matches(':hover'));
|
|
83
|
+
compositionContainer.addEventListener('pointerenter', onPointerEnter);
|
|
84
|
+
compositionContainer.addEventListener('pointerleave', onPointerLeave);
|
|
85
|
+
return () => {
|
|
86
|
+
compositionContainer.removeEventListener('pointerenter', onPointerEnter);
|
|
87
|
+
compositionContainer.removeEventListener('pointerleave', onPointerLeave);
|
|
88
|
+
};
|
|
89
|
+
}, [canvasContent.type]);
|
|
72
90
|
const { centerX, centerY, yCorrection, xCorrection, scale } = (0, react_1.useMemo)(() => {
|
|
73
91
|
if (contentDimensions === 'none') {
|
|
74
92
|
return {
|
|
@@ -129,8 +147,8 @@ const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent,
|
|
|
129
147
|
if (canvasContent.type === 'output-blob') {
|
|
130
148
|
return (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsx(RenderPreview_1.RenderPreview, { path: canvasContent.displayName, assetMetadata: assetMetadata, getBlob: canvasContent.getBlob }) }));
|
|
131
149
|
}
|
|
132
|
-
return (jsx_runtime_1.jsxs("div", { className: "remotion-studio-composition-container", style: outer, children: [
|
|
133
|
-
jsx_runtime_1.jsx(PortalContainer, { contentDimensions: contentDimensions, scale: scale, xCorrection: xCorrection, yCorrection: yCorrection }), jsx_runtime_1.jsx(SelectedOutlineOverlay_1.SelectedOutlineOverlay, { compositionHeight: contentDimensions.height, compositionWidth: contentDimensions.width, scale: scale, translationX: previewSize.translation.x, translationY: previewSize.translation.y })
|
|
150
|
+
return (jsx_runtime_1.jsxs("div", { ref: compositionContainerRef, className: "remotion-studio-composition-container", style: outer, children: [
|
|
151
|
+
jsx_runtime_1.jsx(PortalContainer, { contentDimensions: contentDimensions, scale: scale, xCorrection: xCorrection, yCorrection: yCorrection }), jsx_runtime_1.jsx(SelectedOutlineOverlay_1.SelectedOutlineOverlay, { canvasHovered: canvasHovered, compositionHeight: contentDimensions.height, compositionWidth: contentDimensions.width, scale: scale, translationX: previewSize.translation.x, translationY: previewSize.translation.y })
|
|
134
152
|
] }));
|
|
135
153
|
};
|
|
136
154
|
const PortalContainer = ({ scale, xCorrection, yCorrection, contentDimensions }) => {
|
|
@@ -154,13 +172,20 @@ const PortalContainer = ({ scale, xCorrection, yCorrection, contentDimensions })
|
|
|
154
172
|
xCorrection,
|
|
155
173
|
yCorrection,
|
|
156
174
|
]);
|
|
157
|
-
(0, react_1.
|
|
175
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
158
176
|
const { current } = portalContainer;
|
|
159
177
|
current === null || current === void 0 ? void 0 : current.appendChild(remotion_1.Internals.portalNode());
|
|
160
178
|
return () => {
|
|
161
|
-
|
|
179
|
+
const portalNode = remotion_1.Internals.portalNode();
|
|
180
|
+
if (current && portalNode.parentNode === current) {
|
|
181
|
+
current.removeChild(portalNode);
|
|
182
|
+
remotion_1.Internals.setPortalNodeCurrentScale(1);
|
|
183
|
+
}
|
|
162
184
|
};
|
|
163
185
|
}, []);
|
|
186
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
187
|
+
remotion_1.Internals.setPortalNodeCurrentScale(scale);
|
|
188
|
+
}, [scale]);
|
|
164
189
|
const onPointerDown = (0, react_1.useCallback)((event) => {
|
|
165
190
|
if (!(0, should_clear_selection_on_pointer_down_1.shouldClearSelectionOnPointerDown)(event)) {
|
|
166
191
|
return;
|
|
@@ -14,7 +14,7 @@ const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
|
14
14
|
const container = {
|
|
15
15
|
width: '100%',
|
|
16
16
|
};
|
|
17
|
-
const ZodEnumEditor = ({ schema, jsonPath, setValue, value, onRemove }) => {
|
|
17
|
+
const ZodEnumEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad }) => {
|
|
18
18
|
const onChange = (0, react_2.useCallback)((updater, { shouldSave }) => {
|
|
19
19
|
setValue(updater, { shouldSave });
|
|
20
20
|
}, [setValue]);
|
|
@@ -38,7 +38,7 @@ const ZodEnumEditor = ({ schema, jsonPath, setValue, value, onRemove }) => {
|
|
|
38
38
|
});
|
|
39
39
|
}, [enumValues, onChange, value]);
|
|
40
40
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
41
|
-
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad:
|
|
41
|
+
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
42
42
|
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, size: "small" }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
43
43
|
] }));
|
|
44
44
|
};
|
|
@@ -14,7 +14,7 @@ const SchemaLabel_1 = require("./SchemaLabel");
|
|
|
14
14
|
const zod_schema_type_1 = require("./zod-schema-type");
|
|
15
15
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
16
16
|
const labelStyle = {
|
|
17
|
-
fontFamily: '
|
|
17
|
+
fontFamily: 'monospace',
|
|
18
18
|
fontSize: 12,
|
|
19
19
|
color: colors_1.LIGHT_TEXT,
|
|
20
20
|
};
|
|
@@ -38,8 +38,8 @@ const ZodOrNullishEditor = ({ jsonPath, schema, setValue, value, onRemove, nulli
|
|
|
38
38
|
: (0, create_zod_values_1.createZodValues)(innerSchema, z, zodTypes);
|
|
39
39
|
setValue(() => val, { shouldSave: true });
|
|
40
40
|
}, [innerSchema, nullishValue, setValue, z, zodTypes]);
|
|
41
|
-
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [value === nullishValue ? (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null })) : (jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { value: value, setValue: setValue, jsonPath: jsonPath, schema: innerSchema, onRemove: onRemove, mayPad: false })), jsx_runtime_1.jsxs("
|
|
42
|
-
jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.
|
|
41
|
+
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [value === nullishValue ? (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null })) : (jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { value: value, setValue: setValue, jsonPath: jsonPath, schema: innerSchema, onRemove: onRemove, mayPad: false })), jsx_runtime_1.jsxs("label", { style: checkBoxWrapper, children: [
|
|
42
|
+
jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("code", { style: labelStyle, children: ["<", String(nullishValue), ">"] })
|
|
43
43
|
] })
|
|
44
44
|
] }));
|
|
45
45
|
};
|
|
@@ -78,7 +78,7 @@ const ZodSwitch = ({ schema, jsonPath, value, setValue, onRemove, mayPad }) => {
|
|
|
78
78
|
return (jsx_runtime_1.jsx(ZodArrayEditor_1.ZodArrayEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, onRemove: onRemove, mayPad: mayPad }));
|
|
79
79
|
}
|
|
80
80
|
if (typeName === 'enum') {
|
|
81
|
-
return (jsx_runtime_1.jsx(ZodEnumEditor_1.ZodEnumEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, onRemove: onRemove }));
|
|
81
|
+
return (jsx_runtime_1.jsx(ZodEnumEditor_1.ZodEnumEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, onRemove: onRemove, mayPad: mayPad }));
|
|
82
82
|
}
|
|
83
83
|
// In v3, effects wrap schemas (e.g. .refine(), .transform()).
|
|
84
84
|
// In v4, refine/transform are embedded as checks, so this only applies to v3.
|
|
@@ -388,6 +388,7 @@ const RenderModal = ({ readOnlyStudio, initialFrame, initialVideoImageFormat, in
|
|
|
388
388
|
chromeMode,
|
|
389
389
|
offthreadVideoThreads,
|
|
390
390
|
mediaCacheSizeInBytes,
|
|
391
|
+
licenseKey: renderDefaults.publicLicenseKey,
|
|
391
392
|
})
|
|
392
393
|
.then(() => {
|
|
393
394
|
dispatchIfMounted({ type: 'succeed' });
|
|
@@ -418,6 +419,7 @@ const RenderModal = ({ readOnlyStudio, initialFrame, initialVideoImageFormat, in
|
|
|
418
419
|
chromeMode,
|
|
419
420
|
offthreadVideoThreads,
|
|
420
421
|
mediaCacheSizeInBytes,
|
|
422
|
+
renderDefaults.publicLicenseKey,
|
|
421
423
|
]);
|
|
422
424
|
const [everyNthFrameSetting, setEveryNthFrameSetting] = (0, react_1.useState)(() => initialEveryNthFrame);
|
|
423
425
|
const everyNthFrame = (0, react_1.useMemo)(() => {
|
|
@@ -489,6 +491,7 @@ const RenderModal = ({ readOnlyStudio, initialFrame, initialVideoImageFormat, in
|
|
|
489
491
|
offthreadVideoThreads,
|
|
490
492
|
mediaCacheSizeInBytes,
|
|
491
493
|
sampleRate,
|
|
494
|
+
licenseKey: renderDefaults.publicLicenseKey,
|
|
492
495
|
})
|
|
493
496
|
.then(() => {
|
|
494
497
|
dispatchIfMounted({ type: 'succeed' });
|
|
@@ -545,6 +548,7 @@ const RenderModal = ({ readOnlyStudio, initialFrame, initialVideoImageFormat, in
|
|
|
545
548
|
offthreadVideoThreads,
|
|
546
549
|
mediaCacheSizeInBytes,
|
|
547
550
|
sampleRate,
|
|
551
|
+
renderDefaults.publicLicenseKey,
|
|
548
552
|
]);
|
|
549
553
|
const onClickSequence = (0, react_1.useCallback)(() => {
|
|
550
554
|
var _a;
|
|
@@ -21,12 +21,17 @@ const RenderQueueProgressMessage_1 = require("./RenderQueueProgressMessage");
|
|
|
21
21
|
const RenderQueueRemoveItem_1 = require("./RenderQueueRemoveItem");
|
|
22
22
|
const RenderQueueRepeat_1 = require("./RenderQueueRepeat");
|
|
23
23
|
const RenderQueueSavingMessage_1 = require("./RenderQueueSavingMessage");
|
|
24
|
+
const use_render_output_file_drag_1 = require("./use-render-output-file-drag");
|
|
24
25
|
const container = {
|
|
25
26
|
padding: 12,
|
|
26
27
|
display: 'flex',
|
|
27
28
|
flexDirection: 'row',
|
|
28
29
|
paddingBottom: 10,
|
|
29
30
|
paddingRight: 4,
|
|
31
|
+
marginBottom: 1,
|
|
32
|
+
marginLeft: 4,
|
|
33
|
+
borderRadius: 4,
|
|
34
|
+
width: 'calc(100% - 4px)',
|
|
30
35
|
};
|
|
31
36
|
const title = {
|
|
32
37
|
fontSize: 13,
|
|
@@ -49,6 +54,7 @@ const RenderQueueItem = ({ job, selected }) => {
|
|
|
49
54
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
50
55
|
const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
|
|
51
56
|
const isClientJob = (0, context_1.isClientRenderJob)(job);
|
|
57
|
+
const { canDrag, isDragging, onDragEnd, onDragStart } = (0, use_render_output_file_drag_1.useRenderOutputFileDrag)(job);
|
|
52
58
|
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
53
59
|
setHovered(true);
|
|
54
60
|
}, []);
|
|
@@ -138,9 +144,9 @@ const RenderQueueItem = ({ job, selected }) => {
|
|
|
138
144
|
job.status === 'failed' ||
|
|
139
145
|
job.status === 'cancelled') &&
|
|
140
146
|
!((0, context_1.isClientRenderJob)(job) && (0, client_side_render_types_1.isRestoredClientJob)(job));
|
|
141
|
-
return (jsx_runtime_1.jsxs(layout_1.Row, { onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: containerStyle, align: "center", onClick: onClick, className: selected ? SELECTED_CLASSNAME : undefined, children: [
|
|
147
|
+
return (jsx_runtime_1.jsxs(layout_1.Row, { "data-render-queue-item": job.id, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: containerStyle, align: "center", onClick: onClick, draggable: canDrag, onDragStart: onDragStart, onDragEnd: onDragEnd, className: selected ? SELECTED_CLASSNAME : undefined, children: [
|
|
142
148
|
jsx_runtime_1.jsx(RenderQueueItemStatus_1.RenderQueueItemStatus, { job: job }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("div", { style: right, children: [
|
|
143
149
|
jsx_runtime_1.jsx("div", { style: title, children: job.compositionId }), jsx_runtime_1.jsx("div", { style: subtitle, children: job.status === 'done' ? (jsx_runtime_1.jsx(RenderQueueOutputName_1.RenderQueueOutputName, { job: job })) : job.status === 'failed' ? (jsx_runtime_1.jsx(RenderQueueError_1.RenderQueueError, { job: job })) : job.status === 'running' ? (jsx_runtime_1.jsx(RenderQueueProgressMessage_1.RenderQueueProgressMessage, { job: job })) : job.status === 'saving' ? (jsx_runtime_1.jsx(RenderQueueSavingMessage_1.RenderQueueSavingMessage, {})) : job.status === 'cancelled' ? (jsx_runtime_1.jsx(RenderQueueCancelledMessage_1.RenderQueueCancelledMessage, {})) : null })
|
|
144
|
-
] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), canCopyToClipboard ? (jsx_runtime_1.jsx(RenderQueueCopyToClipboard_1.RenderQueueCopyToClipboard, { job: job })) : null, canRepeat ? jsx_runtime_1.jsx(RenderQueueRepeat_1.RenderQueueRepeatItem, { job: job }) : null, job.status === 'running' ? (jsx_runtime_1.jsx(RenderQueueItemCancelButton_1.RenderQueueCancelButton, { job: job })) : (jsx_runtime_1.jsx(RenderQueueRemoveItem_1.RenderQueueRemoveItem, { job: job })), job.status === 'done' ? (clientBlobInfo ? (jsx_runtime_1.jsx(RenderQueueDownloadItem_1.RenderQueueDownloadItem, { job: job })) : (jsx_runtime_1.jsx(RenderQueueOpenInFolder_1.RenderQueueOpenInFinderItem, { job: job }))) : null] }));
|
|
150
|
+
] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [canCopyToClipboard ? (jsx_runtime_1.jsx(RenderQueueCopyToClipboard_1.RenderQueueCopyToClipboard, { job: job })) : null, canRepeat ? jsx_runtime_1.jsx(RenderQueueRepeat_1.RenderQueueRepeatItem, { job: job }) : null, job.status === 'running' ? (jsx_runtime_1.jsx(RenderQueueItemCancelButton_1.RenderQueueCancelButton, { job: job })) : (jsx_runtime_1.jsx(RenderQueueRemoveItem_1.RenderQueueRemoveItem, { job: job })), job.status === 'done' ? (clientBlobInfo ? (jsx_runtime_1.jsx(RenderQueueDownloadItem_1.RenderQueueDownloadItem, { job: job })) : (jsx_runtime_1.jsx(RenderQueueOpenInFolder_1.RenderQueueOpenInFinderItem, { job: job }))) : null] })) : null] }));
|
|
145
151
|
};
|
|
146
152
|
exports.RenderQueueItem = RenderQueueItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EnumPath, RecastCodemod, RenderJob, VisualControlChange } from '@remotion/studio-shared';
|
|
2
|
-
export declare const addStillRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, multiProcessOnLinux, beepOnFinish, metadata, chromeMode, mediaCacheSizeInBytes, }: {
|
|
2
|
+
export declare const addStillRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, multiProcessOnLinux, beepOnFinish, metadata, chromeMode, mediaCacheSizeInBytes, licenseKey, }: {
|
|
3
3
|
compositionId: string;
|
|
4
4
|
outName: string;
|
|
5
5
|
imageFormat: "jpeg" | "pdf" | "png" | "webp";
|
|
@@ -18,6 +18,7 @@ export declare const addStillRenderJob: ({ compositionId, outName, imageFormat,
|
|
|
18
18
|
metadata: Record<string, string> | null;
|
|
19
19
|
chromeMode: "chrome-for-testing" | "headless-shell";
|
|
20
20
|
mediaCacheSizeInBytes: number | null;
|
|
21
|
+
licenseKey: string | null;
|
|
21
22
|
}) => Promise<undefined>;
|
|
22
23
|
export declare const addSequenceRenderJob: ({ compositionId, outName, imageFormat, startFrame, endFrame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, concurrency, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, jpegQuality, disallowParallelEncoding, multiProcessOnLinux, beepOnFinish, repro, metadata, chromeMode, mediaCacheSizeInBytes, }: {
|
|
23
24
|
compositionId: string;
|
|
@@ -43,7 +44,7 @@ export declare const addSequenceRenderJob: ({ compositionId, outName, imageForma
|
|
|
43
44
|
chromeMode: "chrome-for-testing" | "headless-shell";
|
|
44
45
|
mediaCacheSizeInBytes: number | null;
|
|
45
46
|
}) => Promise<undefined>;
|
|
46
|
-
export declare const addVideoRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, scale, logLevel, codec, concurrency, crf, gopSize, startFrame, endFrame, muted, enforceAudioTrack, proResProfile, x264Preset, pixelFormat, audioBitrate, videoBitrate, everyNthFrame, numberOfGifLoops, delayRenderTimeout, audioCodec, disallowParallelEncoding, chromiumOptions, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, colorSpace, multiProcessOnLinux, encodingMaxRate, encodingBufferSize, beepOnFinish, repro, forSeamlessAacConcatenation, separateAudioTo, metadata, hardwareAcceleration, chromeMode, mediaCacheSizeInBytes, sampleRate, }: {
|
|
47
|
+
export declare const addVideoRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, scale, logLevel, codec, concurrency, crf, gopSize, startFrame, endFrame, muted, enforceAudioTrack, proResProfile, x264Preset, pixelFormat, audioBitrate, videoBitrate, everyNthFrame, numberOfGifLoops, delayRenderTimeout, audioCodec, disallowParallelEncoding, chromiumOptions, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, colorSpace, multiProcessOnLinux, encodingMaxRate, encodingBufferSize, beepOnFinish, repro, forSeamlessAacConcatenation, separateAudioTo, metadata, hardwareAcceleration, chromeMode, mediaCacheSizeInBytes, sampleRate, licenseKey, }: {
|
|
47
48
|
compositionId: string;
|
|
48
49
|
outName: string;
|
|
49
50
|
imageFormat: "jpeg" | "none" | "png";
|
|
@@ -86,6 +87,7 @@ export declare const addVideoRenderJob: ({ compositionId, outName, imageFormat,
|
|
|
86
87
|
chromeMode: "chrome-for-testing" | "headless-shell";
|
|
87
88
|
mediaCacheSizeInBytes: number | null;
|
|
88
89
|
sampleRate: number;
|
|
90
|
+
licenseKey: string | null;
|
|
89
91
|
}) => Promise<undefined>;
|
|
90
92
|
export declare const unsubscribeFromFileExistenceWatcher: ({ file, clientId, }: {
|
|
91
93
|
file: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.applyVisualControlChange = exports.callUpdateDefaultPropsApi = exports.getProjectInfo = exports.updateAvailable = exports.cancelRenderJob = exports.removeRenderJob = exports.applyCodemod = exports.openInFileExplorer = exports.subscribeToFileExistenceWatcher = exports.unsubscribeFromFileExistenceWatcher = exports.addVideoRenderJob = exports.addSequenceRenderJob = exports.addStillRenderJob = void 0;
|
|
4
4
|
const no_react_1 = require("remotion/no-react");
|
|
5
5
|
const call_api_1 = require("../call-api");
|
|
6
|
-
const addStillRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, multiProcessOnLinux, beepOnFinish, metadata, chromeMode, mediaCacheSizeInBytes, }) => {
|
|
6
|
+
const addStillRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, multiProcessOnLinux, beepOnFinish, metadata, chromeMode, mediaCacheSizeInBytes, licenseKey, }) => {
|
|
7
7
|
return (0, call_api_1.callApi)('/api/render', {
|
|
8
8
|
compositionId,
|
|
9
9
|
type: 'still',
|
|
@@ -28,6 +28,7 @@ const addStillRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, f
|
|
|
28
28
|
metadata,
|
|
29
29
|
chromeMode,
|
|
30
30
|
mediaCacheSizeInBytes,
|
|
31
|
+
licenseKey,
|
|
31
32
|
});
|
|
32
33
|
};
|
|
33
34
|
exports.addStillRenderJob = addStillRenderJob;
|
|
@@ -63,7 +64,7 @@ const addSequenceRenderJob = ({ compositionId, outName, imageFormat, startFrame,
|
|
|
63
64
|
});
|
|
64
65
|
};
|
|
65
66
|
exports.addSequenceRenderJob = addSequenceRenderJob;
|
|
66
|
-
const addVideoRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, scale, logLevel, codec, concurrency, crf, gopSize, startFrame, endFrame, muted, enforceAudioTrack, proResProfile, x264Preset, pixelFormat, audioBitrate, videoBitrate, everyNthFrame, numberOfGifLoops, delayRenderTimeout, audioCodec, disallowParallelEncoding, chromiumOptions, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, colorSpace, multiProcessOnLinux, encodingMaxRate, encodingBufferSize, beepOnFinish, repro, forSeamlessAacConcatenation, separateAudioTo, metadata, hardwareAcceleration, chromeMode, mediaCacheSizeInBytes, sampleRate, }) => {
|
|
67
|
+
const addVideoRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, scale, logLevel, codec, concurrency, crf, gopSize, startFrame, endFrame, muted, enforceAudioTrack, proResProfile, x264Preset, pixelFormat, audioBitrate, videoBitrate, everyNthFrame, numberOfGifLoops, delayRenderTimeout, audioCodec, disallowParallelEncoding, chromiumOptions, envVariables, inputProps, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, colorSpace, multiProcessOnLinux, encodingMaxRate, encodingBufferSize, beepOnFinish, repro, forSeamlessAacConcatenation, separateAudioTo, metadata, hardwareAcceleration, chromeMode, mediaCacheSizeInBytes, sampleRate, licenseKey, }) => {
|
|
67
68
|
return (0, call_api_1.callApi)('/api/render', {
|
|
68
69
|
compositionId,
|
|
69
70
|
type: 'video',
|
|
@@ -112,6 +113,7 @@ const addVideoRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, s
|
|
|
112
113
|
chromeMode,
|
|
113
114
|
mediaCacheSizeInBytes,
|
|
114
115
|
sampleRate,
|
|
116
|
+
licenseKey,
|
|
115
117
|
});
|
|
116
118
|
};
|
|
117
119
|
exports.addVideoRenderJob = addVideoRenderJob;
|
|
@@ -42,9 +42,6 @@ const layout_1 = require("../layout");
|
|
|
42
42
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
43
43
|
const context_1 = require("./context");
|
|
44
44
|
const RenderQueueItem_1 = require("./RenderQueueItem");
|
|
45
|
-
const separatorStyle = {
|
|
46
|
-
borderBottom: `1px solid ${colors_1.BLACK_HEX}`,
|
|
47
|
-
};
|
|
48
45
|
const errorExplanation = {
|
|
49
46
|
fontSize: 14,
|
|
50
47
|
color: colors_1.LIGHT_TEXT,
|
|
@@ -65,6 +62,8 @@ const renderQueue = {
|
|
|
65
62
|
background: colors_1.BACKGROUND,
|
|
66
63
|
flex: 1,
|
|
67
64
|
overflowY: 'auto',
|
|
65
|
+
paddingTop: 4,
|
|
66
|
+
paddingBottom: 4,
|
|
68
67
|
};
|
|
69
68
|
const RenderQueue = () => {
|
|
70
69
|
const { jobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
|
|
@@ -105,7 +104,7 @@ const RenderQueue = () => {
|
|
|
105
104
|
] }));
|
|
106
105
|
}
|
|
107
106
|
return (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) => {
|
|
108
|
-
return (jsx_runtime_1.jsx(
|
|
107
|
+
return (jsx_runtime_1.jsx(RenderQueueItem_1.RenderQueueItem, { selected: selectedJob === index, job: j }, j.id));
|
|
109
108
|
}) }));
|
|
110
109
|
};
|
|
111
110
|
exports.RenderQueue = RenderQueue;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DragEventHandler } from 'react';
|
|
2
|
+
import type { AnyRenderJob } from './context';
|
|
3
|
+
export declare const useRenderOutputFileDrag: (job: AnyRenderJob) => {
|
|
4
|
+
canDrag: boolean;
|
|
5
|
+
isDragging: boolean;
|
|
6
|
+
onDragEnd: () => void;
|
|
7
|
+
onDragStart: DragEventHandler<HTMLDivElement>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRenderOutputFileDrag = void 0;
|
|
4
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const get_asset_metadata_1 = require("../../helpers/get-asset-metadata");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
const MAXIMUM_SAFE_FILE_DRAG_SIZE = 500 * 1024 * 1024;
|
|
9
|
+
const getFilename = (outName) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (_a = outName.split(/[/\\]/).at(-1)) !== null && _a !== void 0 ? _a : outName;
|
|
12
|
+
};
|
|
13
|
+
const isChrome = () => {
|
|
14
|
+
return (/Chrome\/\d/.test(navigator.userAgent) &&
|
|
15
|
+
!/(Edg|OPR|SamsungBrowser|YaBrowser)\//.test(navigator.userAgent));
|
|
16
|
+
};
|
|
17
|
+
const useRenderOutputFileDrag = (job) => {
|
|
18
|
+
const deletedOutputLocation = 'deletedOutputLocation' in job && job.deletedOutputLocation;
|
|
19
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
20
|
+
const [clientFile, setClientFile] = (0, react_1.useState)(null);
|
|
21
|
+
const clientBlobInfo = (0, react_1.useMemo)(() => {
|
|
22
|
+
if (!(0, context_1.isClientRenderJob)(job) ||
|
|
23
|
+
job.status !== 'done' ||
|
|
24
|
+
job.getBlob === undefined) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
getBlob: job.getBlob,
|
|
29
|
+
sizeInBytes: job.metadata.sizeInBytes,
|
|
30
|
+
};
|
|
31
|
+
}, [job]);
|
|
32
|
+
const clientJobWithBlob = clientBlobInfo !== null;
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
if (!clientBlobInfo ||
|
|
35
|
+
clientBlobInfo.sizeInBytes <= 0 ||
|
|
36
|
+
clientBlobInfo.sizeInBytes > MAXIMUM_SAFE_FILE_DRAG_SIZE ||
|
|
37
|
+
typeof File === 'undefined' ||
|
|
38
|
+
typeof URL.createObjectURL !== 'function') {
|
|
39
|
+
setClientFile(null);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let cancelled = false;
|
|
43
|
+
let objectUrl = null;
|
|
44
|
+
const filename = getFilename(job.outName);
|
|
45
|
+
clientBlobInfo
|
|
46
|
+
.getBlob()
|
|
47
|
+
.then((blob) => {
|
|
48
|
+
if (cancelled) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const file = new File([blob], filename, {
|
|
52
|
+
lastModified: blob instanceof File ? blob.lastModified : Date.now(),
|
|
53
|
+
type: blob.type,
|
|
54
|
+
});
|
|
55
|
+
objectUrl = URL.createObjectURL(file);
|
|
56
|
+
setClientFile({ file, objectUrl });
|
|
57
|
+
})
|
|
58
|
+
.catch(() => {
|
|
59
|
+
if (!cancelled) {
|
|
60
|
+
setClientFile(null);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return () => {
|
|
64
|
+
cancelled = true;
|
|
65
|
+
if (objectUrl) {
|
|
66
|
+
URL.revokeObjectURL(objectUrl);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [clientBlobInfo, job.outName]);
|
|
70
|
+
const canUseFileDrag = typeof DataTransfer !== 'undefined' &&
|
|
71
|
+
typeof window !== 'undefined' &&
|
|
72
|
+
typeof window.matchMedia === 'function' &&
|
|
73
|
+
window.matchMedia('(any-pointer: fine)').matches &&
|
|
74
|
+
navigator.maxTouchPoints === 0 &&
|
|
75
|
+
isChrome();
|
|
76
|
+
const canDrag = canUseFileDrag &&
|
|
77
|
+
job.status === 'done' &&
|
|
78
|
+
job.type !== 'sequence' &&
|
|
79
|
+
!deletedOutputLocation &&
|
|
80
|
+
(clientJobWithBlob ? clientFile !== null : true);
|
|
81
|
+
const onDragStart = (0, react_1.useCallback)((event) => {
|
|
82
|
+
if (!canDrag) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const filename = getFilename(job.outName);
|
|
88
|
+
const source = clientFile
|
|
89
|
+
? clientFile.objectUrl
|
|
90
|
+
: new URL(`${get_asset_metadata_1.remotion_outputsBase}/${job.outName}`, window.location.href).href;
|
|
91
|
+
const mimeType = (clientFile === null || clientFile === void 0 ? void 0 : clientFile.file.type) || 'application/octet-stream';
|
|
92
|
+
event.dataTransfer.clearData();
|
|
93
|
+
event.dataTransfer.effectAllowed = 'copy';
|
|
94
|
+
if (clientFile) {
|
|
95
|
+
const item = event.dataTransfer.items.add(clientFile.file);
|
|
96
|
+
if (item === null) {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const dragData = studio_protocol_1.StudioProtocolInternals.makeDragData({
|
|
103
|
+
type: 'render-output',
|
|
104
|
+
outputPath: job.outName,
|
|
105
|
+
fileName: filename,
|
|
106
|
+
});
|
|
107
|
+
event.dataTransfer.setData(dragData.mimeType, dragData.payload);
|
|
108
|
+
}
|
|
109
|
+
event.dataTransfer.setData('DownloadURL', `${mimeType}:${filename}:${source}`);
|
|
110
|
+
setIsDragging(true);
|
|
111
|
+
}
|
|
112
|
+
catch (_a) {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
}
|
|
115
|
+
}, [canDrag, clientFile, job.outName]);
|
|
116
|
+
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
117
|
+
setIsDragging(false);
|
|
118
|
+
}, []);
|
|
119
|
+
return { canDrag, isDragging, onDragEnd, onDragStart };
|
|
120
|
+
};
|
|
121
|
+
exports.useRenderOutputFileDrag = useRenderOutputFileDrag;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectedOutline } from './selected-outline-geometry';
|
|
3
|
-
import { type SelectedOutlineSnapPoint
|
|
4
|
-
import { type SelectedOutlineDragTarget, type SelectedOutlineRotationDragTarget, type SelectedOutlineScaleDragTarget, type SelectedOutlineTarget } from './selected-outline-types';
|
|
3
|
+
import { type SelectedOutlineSnapPoint } from './selected-outline-snap';
|
|
4
|
+
import { type SelectedOutlineDragTarget, type SelectedOutlineLayoutTarget, type SelectedOutlineRotationDragTarget, type SelectedOutlineScaleDragTarget, type SelectedOutlineTarget } from './selected-outline-types';
|
|
5
5
|
import type { TimelineSelection, TimelineSelectionInteraction } from './Timeline/TimelineSelection';
|
|
6
|
-
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly target: SelectedOutlineTarget | undefined;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const SelectedOutlineElement: React.FC<{
|
|
12
|
-
readonly allDragTargets: readonly SelectedOutlineDragTarget[];
|
|
13
|
-
readonly allDragOutlines: readonly SelectedOutline[];
|
|
14
|
-
readonly allRotationDragTargets: readonly SelectedOutlineRotationDragTarget[];
|
|
15
|
-
readonly allScaleDragTargets: readonly SelectedOutlineScaleDragTarget[];
|
|
6
|
+
type SelectedOutlineElementProps = {
|
|
7
|
+
readonly compositionHeight: number;
|
|
8
|
+
readonly compositionWidth: number;
|
|
16
9
|
readonly dragging: boolean;
|
|
17
|
-
readonly
|
|
10
|
+
readonly getAllDragOutlines: () => readonly SelectedOutline[];
|
|
11
|
+
readonly getAllDragTargets: () => readonly SelectedOutlineDragTarget[];
|
|
12
|
+
readonly getAllRotationDragTargets: () => readonly SelectedOutlineRotationDragTarget[];
|
|
13
|
+
readonly getAllScaleDragTargets: () => readonly SelectedOutlineScaleDragTarget[];
|
|
14
|
+
readonly getLatestTargetByKey: (key: string) => SelectedOutlineTarget | undefined;
|
|
15
|
+
readonly layoutTarget: SelectedOutlineLayoutTarget | undefined;
|
|
18
16
|
readonly outline: SelectedOutline;
|
|
19
17
|
readonly onDraggingChange: (dragging: boolean) => void;
|
|
20
|
-
readonly onHoverChange: (key: string | null) => void;
|
|
21
18
|
readonly onSnapPointsChange: (snapPoints: readonly SelectedOutlineSnapPoint[]) => void;
|
|
22
19
|
readonly onSelect: (item: TimelineSelection, interaction: TimelineSelectionInteraction) => void;
|
|
23
20
|
readonly scale: number;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
21
|
+
};
|
|
22
|
+
export declare const SelectedOutlineElement: React.NamedExoticComponent<SelectedOutlineElementProps>;
|
|
23
|
+
export {};
|