@remotion/studio 4.0.472 → 4.0.474
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/rename-static-file.d.ts +6 -0
- package/dist/api/rename-static-file.js +18 -0
- package/dist/components/AssetSelector.js +45 -4
- package/dist/components/AssetSelectorItem.js +177 -27
- package/dist/components/Canvas.js +131 -11
- package/dist/components/ConfirmationDialog-types.d.ts +8 -0
- package/dist/components/ConfirmationDialog-types.js +2 -0
- package/dist/components/ConfirmationDialog.d.ts +7 -0
- package/dist/components/ConfirmationDialog.js +103 -0
- package/dist/components/ContextMenu.d.ts +9 -1
- package/dist/components/ContextMenu.js +49 -5
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/EditorContent.js +15 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.js +2 -0
- package/dist/components/ExplorerPanel.d.ts +0 -4
- package/dist/components/ExplorerPanel.js +8 -4
- package/dist/components/ExplorerPanelRef.d.ts +4 -0
- package/dist/components/ExplorerPanelRef.js +5 -0
- package/dist/components/FilePreview.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.d.ts +0 -1
- package/dist/components/InitialCompositionLoader.js +5 -27
- package/dist/components/Menu/MenuItem.js +7 -1
- package/dist/components/Menu/SubMenu.js +5 -1
- package/dist/components/Menu/portals.js +17 -8
- package/dist/components/MenuToolbar.js +5 -1
- package/dist/components/ModalContainer.js +6 -1
- package/dist/components/Modals.js +5 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/InputDragger.d.ts +1 -0
- package/dist/components/NewComposition/InputDragger.js +9 -6
- package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/RenameStaticFile.js +118 -0
- package/dist/components/OptionsPanel.js +5 -1
- package/dist/components/OutlineToggle.d.ts +2 -0
- package/dist/components/OutlineToggle.js +20 -0
- package/dist/components/Preview.d.ts +0 -2
- package/dist/components/Preview.js +23 -33
- package/dist/components/PreviewToolbar.js +19 -6
- package/dist/components/RenderButton.js +8 -2
- package/dist/components/RenderPreview.js +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +29 -3
- package/dist/components/SelectedOutlineOverlay.js +259 -80
- package/dist/components/ShowOutlinesProvider.d.ts +4 -0
- package/dist/components/ShowOutlinesProvider.js +24 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/Splitter/SplitterHandle.js +2 -0
- package/dist/components/StaticFilePreview.js +2 -2
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
- package/dist/components/Timeline/SequencePropsObserver.js +3 -3
- package/dist/components/Timeline/Timeline.js +3 -13
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +26 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +242 -25
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +23 -11
- package/dist/components/Timeline/TimelineEffectItem.js +8 -7
- package/dist/components/Timeline/TimelineEffectPropItem.js +69 -19
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +6 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
- package/dist/components/Timeline/TimelineKeyframeControls.js +13 -23
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -22
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
- package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +120 -0
- package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
- package/dist/components/Timeline/TimelineList.js +2 -2
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
- package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
- package/dist/components/Timeline/TimelineNumberField.js +15 -7
- package/dist/components/Timeline/TimelineRotationField.js +17 -11
- package/dist/components/Timeline/TimelineScaleField.js +17 -13
- package/dist/components/Timeline/TimelineSelection.d.ts +15 -0
- package/dist/components/Timeline/TimelineSelection.js +26 -1
- package/dist/components/Timeline/TimelineSequence.js +6 -6
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +297 -36
- package/dist/components/Timeline/TimelineSequencePropItem.js +113 -48
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +69 -70
- package/dist/components/Timeline/TimelineTranslateField.js +24 -19
- package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
- package/dist/components/Timeline/apply-effect-response-to-prop-statuses.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-prop-statuses.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.d.ts +5 -5
- package/dist/components/Timeline/call-add-keyframe.js +6 -4
- package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
- package/dist/components/Timeline/call-delete-keyframe.js +7 -7
- package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
- package/dist/components/Timeline/call-move-keyframe.js +71 -0
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
- package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
- package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +10 -7
- package/dist/components/Timeline/delete-selected-timeline-item.js +37 -23
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
- package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
- package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
- package/dist/components/Timeline/get-node-keyframes.js +4 -4
- package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
- package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
- package/dist/components/Timeline/reset-selected-timeline-props.js +13 -12
- package/dist/components/Timeline/save-effect-prop.d.ts +16 -5
- package/dist/components/Timeline/save-effect-prop.js +37 -19
- package/dist/components/Timeline/save-prop-queue.d.ts +4 -3
- package/dist/components/Timeline/save-prop-queue.js +6 -3
- package/dist/components/Timeline/save-sequence-prop.d.ts +5 -10
- package/dist/components/Timeline/save-sequence-prop.js +35 -32
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
- package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
- package/dist/components/Timeline/timeline-asset-link.js +37 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
- package/dist/components/Timeline/timeline-field-utils.js +26 -5
- package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
- package/dist/components/Timeline/timeline-translate-utils.js +6 -4
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -7
- package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
- package/dist/components/Timeline/use-timeline-height.js +3 -3
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +380 -0
- package/dist/components/import-assets.d.ts +31 -0
- package/dist/components/import-assets.js +216 -17
- package/dist/components/load-canvas-content-from-url.d.ts +1 -0
- package/dist/components/load-canvas-content-from-url.js +9 -3
- package/dist/components/use-select-asset.d.ts +1 -0
- package/dist/components/use-select-asset.js +30 -0
- package/dist/error-overlay/error-origin.d.ts +3 -0
- package/dist/error-overlay/error-origin.js +42 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
- package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
- package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
- package/dist/esm/{chunk-48grt472.js → chunk-xjvc8qen.js} +21838 -18862
- package/dist/esm/internals.mjs +21838 -18862
- package/dist/esm/previewEntry.mjs +21127 -18127
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/install-required-package.d.ts +1 -0
- package/dist/helpers/install-required-package.js +39 -0
- package/dist/helpers/remote-asset-drag.d.ts +4 -0
- package/dist/helpers/remote-asset-drag.js +73 -0
- package/dist/helpers/timeline-layout.d.ts +6 -6
- package/dist/helpers/timeline-layout.js +5 -5
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/hot-middleware-client/client.js +6 -0
- package/dist/state/editor-outlines.d.ts +8 -0
- package/dist/state/editor-outlines.js +18 -0
- package/dist/state/modals.d.ts +16 -2
- package/package.json +10 -10
- package/dist/helpers/detect-file-type.d.ts +0 -69
- package/dist/helpers/detect-file-type.js +0 -278
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RenameStaticFileResponse } from '@remotion/studio-shared';
|
|
2
|
+
export declare const renameStaticFile: ({ oldRelativePath, newRelativePath, }: {
|
|
3
|
+
oldRelativePath: string;
|
|
4
|
+
newRelativePath: string;
|
|
5
|
+
}) => Promise<RenameStaticFileResponse>;
|
|
6
|
+
export { RenameStaticFileResponse };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renameStaticFile = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const call_api_1 = require("../components/call-api");
|
|
6
|
+
const renameStaticFile = ({ oldRelativePath, newRelativePath, }) => {
|
|
7
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
8
|
+
throw new Error('renameStaticFile() is only available in the Studio');
|
|
9
|
+
}
|
|
10
|
+
if (window.remotion_isReadOnlyStudio) {
|
|
11
|
+
throw new Error('renameStaticFile() is not available in Read-Only Studio');
|
|
12
|
+
}
|
|
13
|
+
return (0, call_api_1.callApi)('/api/rename-static-file', {
|
|
14
|
+
oldRelativePath,
|
|
15
|
+
newRelativePath,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.renameStaticFile = renameStaticFile;
|
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.AssetSelector = void 0;
|
|
7
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -13,7 +43,7 @@ const colors_1 = require("../helpers/colors");
|
|
|
13
43
|
const create_folder_tree_1 = require("../helpers/create-folder-tree");
|
|
14
44
|
const persist_boolean_map_1 = require("../helpers/persist-boolean-map");
|
|
15
45
|
const persist_open_folders_1 = require("../helpers/persist-open-folders");
|
|
16
|
-
const use_asset_drag_events_1 =
|
|
46
|
+
const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-events"));
|
|
17
47
|
const folders_1 = require("../state/folders");
|
|
18
48
|
const z_index_1 = require("../state/z-index");
|
|
19
49
|
const AssetSelectorItem_1 = require("./AssetSelectorItem");
|
|
@@ -82,13 +112,24 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
82
112
|
setDropLocation,
|
|
83
113
|
});
|
|
84
114
|
const onDragOver = (0, react_1.useCallback)((e) => {
|
|
115
|
+
if (!(0, use_asset_drag_events_1.isFileDragEvent)(e)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
85
118
|
e.preventDefault();
|
|
86
119
|
}, []);
|
|
87
120
|
const onDrop = (0, react_1.useCallback)(async (e) => {
|
|
88
121
|
try {
|
|
122
|
+
if (!(0, use_asset_drag_events_1.isFileDragEvent)(e)) {
|
|
123
|
+
setDropLocation(null);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
89
126
|
e.preventDefault();
|
|
90
127
|
e.stopPropagation();
|
|
91
128
|
const { files } = e.dataTransfer;
|
|
129
|
+
if (files.length === 0) {
|
|
130
|
+
setDropLocation(null);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
92
133
|
const assetPath = dropLocation !== null && dropLocation !== void 0 ? dropLocation : null;
|
|
93
134
|
const makePath = (file) => {
|
|
94
135
|
return [assetPath, file.name].filter(Boolean).join('/');
|
|
@@ -32,27 +32,32 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.AssetFolderTree = void 0;
|
|
40
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
const
|
|
38
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
39
|
+
const react_1 = require("react");
|
|
42
40
|
const remotion_1 = require("remotion");
|
|
43
41
|
const no_react_1 = require("remotion/no-react");
|
|
42
|
+
const delete_static_file_1 = require("../api/delete-static-file");
|
|
43
|
+
const client_id_1 = require("../helpers/client-id");
|
|
44
44
|
const colors_1 = require("../helpers/colors");
|
|
45
45
|
const copy_text_1 = require("../helpers/copy-text");
|
|
46
46
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
47
47
|
const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
|
|
48
48
|
const url_state_1 = require("../helpers/url-state");
|
|
49
|
-
const use_asset_drag_events_1 =
|
|
49
|
+
const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-events"));
|
|
50
50
|
const clipboard_1 = require("../icons/clipboard");
|
|
51
51
|
const file_1 = require("../icons/file");
|
|
52
52
|
const folder_1 = require("../icons/folder");
|
|
53
|
+
const modals_1 = require("../state/modals");
|
|
53
54
|
const sidebar_1 = require("../state/sidebar");
|
|
55
|
+
const ConfirmationDialog_1 = require("./ConfirmationDialog");
|
|
56
|
+
const ContextMenu_1 = require("./ContextMenu");
|
|
57
|
+
const import_assets_1 = require("./import-assets");
|
|
54
58
|
const InlineAction_1 = require("./InlineAction");
|
|
55
59
|
const layout_1 = require("./layout");
|
|
60
|
+
const styles_1 = require("./Menu/styles");
|
|
56
61
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
57
62
|
const actions_1 = require("./RenderQueue/actions");
|
|
58
63
|
const ASSET_ITEM_HEIGHT = 32;
|
|
@@ -128,13 +133,19 @@ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dr
|
|
|
128
133
|
return (jsx_runtime_1.jsxs("div", { onDragEnter: onDragEnter, onDragLeave: onDragLeave, style: {
|
|
129
134
|
backgroundColor: isDropDiv ? colors_1.CLEAR_HOVER : colors_1.BACKGROUND,
|
|
130
135
|
}, children: [
|
|
131
|
-
jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: () => {
|
|
136
|
+
jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
|
|
137
|
+
if (!(0, use_asset_drag_events_1.isFileDragEvent)(event)) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
132
140
|
if (!item.expanded) {
|
|
133
141
|
openFolderTimerRef.current = window.setTimeout(() => {
|
|
134
142
|
toggleFolder(item.name, parentFolder);
|
|
135
143
|
}, 1000);
|
|
136
144
|
}
|
|
137
|
-
}, onDragLeave: () => {
|
|
145
|
+
}, onDragLeave: (event) => {
|
|
146
|
+
if (!(0, use_asset_drag_events_1.isFileDragEvent)(event)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
138
149
|
if (openFolderTimerRef.current) {
|
|
139
150
|
clearTimeout(openFolderTimerRef.current);
|
|
140
151
|
}
|
|
@@ -156,7 +167,12 @@ exports.AssetFolderTree = AssetFolderTree;
|
|
|
156
167
|
const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
|
|
157
168
|
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
158
169
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
170
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
159
171
|
const { setSidebarCollapsedState } = (0, react_1.useContext)(sidebar_1.SidebarContext);
|
|
172
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
173
|
+
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
174
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
175
|
+
.previewServerState.type;
|
|
160
176
|
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
161
177
|
setHovered(true);
|
|
162
178
|
}, []);
|
|
@@ -171,6 +187,9 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
171
187
|
}
|
|
172
188
|
return false;
|
|
173
189
|
}, [canvasContent, relativePath]);
|
|
190
|
+
const canDragAsset = (0, react_1.useMemo)(() => {
|
|
191
|
+
return !readOnlyStudio && (0, import_assets_1.getAssetElementFromPath)(relativePath) !== null;
|
|
192
|
+
}, [readOnlyStudio, relativePath]);
|
|
174
193
|
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
175
194
|
setHovered(false);
|
|
176
195
|
}, []);
|
|
@@ -195,6 +214,18 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
195
214
|
setCanvasContent,
|
|
196
215
|
setSidebarCollapsedState,
|
|
197
216
|
]);
|
|
217
|
+
const onDragStart = (0, react_1.useCallback)((e) => {
|
|
218
|
+
if (!canDragAsset) {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
setIsDragging(true);
|
|
223
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
224
|
+
e.dataTransfer.setData(studio_shared_1.ASSET_DRAG_MIME_TYPE, JSON.stringify((0, studio_shared_1.makeAssetDragData)(relativePath)));
|
|
225
|
+
}, [canDragAsset, relativePath]);
|
|
226
|
+
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
227
|
+
setIsDragging(false);
|
|
228
|
+
}, []);
|
|
198
229
|
const style = (0, react_1.useMemo)(() => {
|
|
199
230
|
return {
|
|
200
231
|
...itemStyle,
|
|
@@ -221,21 +252,17 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
221
252
|
const renderCopyAction = (0, react_1.useCallback)((color) => {
|
|
222
253
|
return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { style: revealIconStyle, color: color });
|
|
223
254
|
}, []);
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
item.name,
|
|
232
|
-
}).catch((err) => {
|
|
233
|
-
(0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
|
|
255
|
+
const copyFileName = (0, react_1.useCallback)(() => {
|
|
256
|
+
(0, copy_text_1.copyText)(item.name)
|
|
257
|
+
.then(() => {
|
|
258
|
+
(0, NotificationCenter_1.showNotification)(`Copied '${item.name}' to clipboard`, 1000);
|
|
259
|
+
})
|
|
260
|
+
.catch((err) => {
|
|
261
|
+
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
234
262
|
});
|
|
235
|
-
}, [item.name
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
const content = `staticFile("${[parentFolder, item.name].join('/')}")`;
|
|
263
|
+
}, [item.name]);
|
|
264
|
+
const copyStaticFilePath = (0, react_1.useCallback)(() => {
|
|
265
|
+
const content = `staticFile("${relativePath}")`;
|
|
239
266
|
(0, copy_text_1.copyText)(content)
|
|
240
267
|
.then(() => {
|
|
241
268
|
(0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
|
|
@@ -243,10 +270,133 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
243
270
|
.catch((err) => {
|
|
244
271
|
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
245
272
|
});
|
|
246
|
-
}, [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
273
|
+
}, [relativePath]);
|
|
274
|
+
const openAssetInExplorer = (0, react_1.useCallback)(() => {
|
|
275
|
+
if (!window.remotion_publicFolderExists) {
|
|
276
|
+
(0, NotificationCenter_1.showNotification)('Could not find the public folder', 2000);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
(0, actions_1.openInFileExplorer)({
|
|
280
|
+
directory: window.remotion_publicFolderExists + '/' + relativePath,
|
|
281
|
+
}).catch((err) => {
|
|
282
|
+
(0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
|
|
283
|
+
});
|
|
284
|
+
}, [relativePath]);
|
|
285
|
+
const serverActionDisabled = readOnlyStudio || connectionStatus !== 'connected';
|
|
286
|
+
const deleteAsset = (0, react_1.useCallback)(() => {
|
|
287
|
+
confirm({
|
|
288
|
+
title: 'Delete asset',
|
|
289
|
+
message: (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: ["Do you want to delete the asset", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: relativePath }),
|
|
290
|
+
" from your public folder?"] })),
|
|
291
|
+
confirmLabel: 'Delete',
|
|
292
|
+
})
|
|
293
|
+
.then((confirmed) => {
|
|
294
|
+
if (!confirmed) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const notification = (0, NotificationCenter_1.showNotification)(`Deleting ${relativePath}...`, null);
|
|
298
|
+
(0, delete_static_file_1.deleteStaticFile)(relativePath)
|
|
299
|
+
.then(() => {
|
|
300
|
+
notification.replaceContent(`Deleted ${relativePath}`, 2000);
|
|
301
|
+
})
|
|
302
|
+
.catch((err) => {
|
|
303
|
+
notification.replaceContent(`Could not delete ${relativePath}: ${err.message}`, 3000);
|
|
304
|
+
});
|
|
305
|
+
})
|
|
306
|
+
.catch((err) => {
|
|
307
|
+
(0, NotificationCenter_1.showNotification)(`Could not delete ${relativePath}: ${err.message}`, 3000);
|
|
308
|
+
});
|
|
309
|
+
}, [confirm, relativePath]);
|
|
310
|
+
const contextMenu = (0, react_1.useMemo)(() => {
|
|
311
|
+
return [
|
|
312
|
+
{
|
|
313
|
+
id: 'copy-asset-file-name',
|
|
314
|
+
keyHint: null,
|
|
315
|
+
label: 'Copy file name',
|
|
316
|
+
leftItem: null,
|
|
317
|
+
onClick: copyFileName,
|
|
318
|
+
quickSwitcherLabel: 'Copy asset file name',
|
|
319
|
+
subMenu: null,
|
|
320
|
+
type: 'item',
|
|
321
|
+
value: 'copy-asset-file-name',
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: 'copy-asset-static-file-path',
|
|
325
|
+
keyHint: null,
|
|
326
|
+
label: 'Copy staticFile() path',
|
|
327
|
+
leftItem: null,
|
|
328
|
+
onClick: copyStaticFilePath,
|
|
329
|
+
quickSwitcherLabel: 'Copy staticFile() path',
|
|
330
|
+
subMenu: null,
|
|
331
|
+
type: 'item',
|
|
332
|
+
value: 'copy-asset-static-file-path',
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
type: 'divider',
|
|
336
|
+
id: 'asset-file-actions-divider',
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: 'open-asset-in-explorer',
|
|
340
|
+
keyHint: null,
|
|
341
|
+
label: 'Open in Explorer',
|
|
342
|
+
leftItem: null,
|
|
343
|
+
onClick: openAssetInExplorer,
|
|
344
|
+
quickSwitcherLabel: 'Open asset in Explorer',
|
|
345
|
+
subMenu: null,
|
|
346
|
+
type: 'item',
|
|
347
|
+
value: 'open-asset-in-explorer',
|
|
348
|
+
disabled: serverActionDisabled || window.remotion_publicFolderExists === null,
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
id: 'rename-asset',
|
|
352
|
+
keyHint: null,
|
|
353
|
+
label: 'Rename...',
|
|
354
|
+
leftItem: null,
|
|
355
|
+
onClick: () => {
|
|
356
|
+
setSelectedModal({
|
|
357
|
+
type: 'rename-static-file',
|
|
358
|
+
relativePath,
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
quickSwitcherLabel: 'Rename asset...',
|
|
362
|
+
subMenu: null,
|
|
363
|
+
type: 'item',
|
|
364
|
+
value: 'rename-asset',
|
|
365
|
+
disabled: serverActionDisabled,
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
id: 'delete-asset',
|
|
369
|
+
keyHint: null,
|
|
370
|
+
label: 'Delete...',
|
|
371
|
+
leftItem: null,
|
|
372
|
+
onClick: deleteAsset,
|
|
373
|
+
quickSwitcherLabel: 'Delete asset...',
|
|
374
|
+
subMenu: null,
|
|
375
|
+
type: 'item',
|
|
376
|
+
value: 'delete-asset',
|
|
377
|
+
disabled: serverActionDisabled,
|
|
378
|
+
},
|
|
379
|
+
];
|
|
380
|
+
}, [
|
|
381
|
+
copyFileName,
|
|
382
|
+
copyStaticFilePath,
|
|
383
|
+
openAssetInExplorer,
|
|
384
|
+
deleteAsset,
|
|
385
|
+
relativePath,
|
|
386
|
+
serverActionDisabled,
|
|
387
|
+
setSelectedModal,
|
|
388
|
+
]);
|
|
389
|
+
const revealInExplorer = (0, react_1.useCallback)((e) => {
|
|
390
|
+
e.stopPropagation();
|
|
391
|
+
openAssetInExplorer();
|
|
392
|
+
}, [openAssetInExplorer]);
|
|
393
|
+
const copyToClipboard = (0, react_1.useCallback)((e) => {
|
|
394
|
+
e.stopPropagation();
|
|
395
|
+
copyStaticFilePath();
|
|
396
|
+
}, [copyStaticFilePath]);
|
|
397
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
|
|
398
|
+
jsx_runtime_1.jsx(file_1.FileIcon, { style: iconStyle, color: colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name }), hovered && !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
399
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), serverActionDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
400
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Open in Explorer", renderAction: renderFileExplorerAction, onClick: revealInExplorer })
|
|
401
|
+
] }))] })) : null] }) }) }));
|
|
252
402
|
};
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Canvas = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
8
9
|
const react_1 = require("react");
|
|
9
10
|
const remotion_1 = require("remotion");
|
|
10
11
|
const client_id_1 = require("../helpers/client-id");
|
|
@@ -12,6 +13,7 @@ const colors_1 = require("../helpers/colors");
|
|
|
12
13
|
const get_asset_metadata_1 = require("../helpers/get-asset-metadata");
|
|
13
14
|
const get_effective_translation_1 = require("../helpers/get-effective-translation");
|
|
14
15
|
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
16
|
+
const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
|
|
15
17
|
const smooth_zoom_1 = require("../helpers/smooth-zoom");
|
|
16
18
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
17
19
|
const canvas_ref_1 = require("../state/canvas-ref");
|
|
@@ -44,6 +46,72 @@ const isFileDragEvent = (event) => {
|
|
|
44
46
|
var _b;
|
|
45
47
|
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes('Files');
|
|
46
48
|
};
|
|
49
|
+
const isAssetDragEvent = (event) => {
|
|
50
|
+
var _a;
|
|
51
|
+
var _b;
|
|
52
|
+
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.ASSET_DRAG_MIME_TYPE);
|
|
53
|
+
};
|
|
54
|
+
const isComponentDragEvent = (event) => {
|
|
55
|
+
var _a;
|
|
56
|
+
var _b;
|
|
57
|
+
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.COMPONENT_DRAG_MIME_TYPE);
|
|
58
|
+
};
|
|
59
|
+
const isSfxDragEvent = (event) => {
|
|
60
|
+
var _a;
|
|
61
|
+
var _b;
|
|
62
|
+
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.SFX_DRAG_MIME_TYPE);
|
|
63
|
+
};
|
|
64
|
+
const isRemoteAssetDragEvent = (event) => {
|
|
65
|
+
return (!isFileDragEvent(event) &&
|
|
66
|
+
!isAssetDragEvent(event) &&
|
|
67
|
+
!isComponentDragEvent(event) &&
|
|
68
|
+
!isSfxDragEvent(event) &&
|
|
69
|
+
(0, remote_asset_drag_1.hasRemoteAssetDragData)(event.dataTransfer));
|
|
70
|
+
};
|
|
71
|
+
const getAssetDragPath = (event) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
var _c;
|
|
74
|
+
const value = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData(studio_shared_1.ASSET_DRAG_MIME_TYPE);
|
|
75
|
+
if (!value) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return (_c = (_b = (0, studio_shared_1.parseAssetDragData)(value)) === null || _b === void 0 ? void 0 : _b.assetPath) !== null && _c !== void 0 ? _c : null;
|
|
79
|
+
};
|
|
80
|
+
const getComponentDragData = (event) => {
|
|
81
|
+
var _a;
|
|
82
|
+
for (const type of [
|
|
83
|
+
studio_shared_1.COMPONENT_DRAG_MIME_TYPE,
|
|
84
|
+
'application/json',
|
|
85
|
+
'text/plain',
|
|
86
|
+
]) {
|
|
87
|
+
const value = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData(type);
|
|
88
|
+
if (!value) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const parsed = (0, studio_shared_1.parseComponentDragData)(value);
|
|
92
|
+
if (parsed) {
|
|
93
|
+
return parsed;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
const getSfxDragUrl = (event) => {
|
|
99
|
+
const { dataTransfer } = event;
|
|
100
|
+
if (!dataTransfer) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
for (const type of [studio_shared_1.SFX_DRAG_MIME_TYPE, 'application/json', 'text/plain']) {
|
|
104
|
+
const value = dataTransfer.getData(type);
|
|
105
|
+
if (!value) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const parsed = (0, studio_shared_1.parseSfxDragData)(value);
|
|
109
|
+
if (parsed) {
|
|
110
|
+
return parsed.sfx.url;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
47
115
|
const isDragEventInsideCanvas = (event) => {
|
|
48
116
|
const { current } = canvas_ref_1.canvasRef;
|
|
49
117
|
if (!current) {
|
|
@@ -467,7 +535,11 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
467
535
|
}, [fetchMetadata]);
|
|
468
536
|
const onDragOver = (0, react_1.useCallback)((event) => {
|
|
469
537
|
if (!canDropAssets ||
|
|
470
|
-
!isFileDragEvent(event)
|
|
538
|
+
(!isFileDragEvent(event) &&
|
|
539
|
+
!isAssetDragEvent(event) &&
|
|
540
|
+
!isComponentDragEvent(event) &&
|
|
541
|
+
!isSfxDragEvent(event) &&
|
|
542
|
+
!isRemoteAssetDragEvent(event)) ||
|
|
471
543
|
!isDragEventInsideCanvas(event)) {
|
|
472
544
|
return;
|
|
473
545
|
}
|
|
@@ -482,23 +554,71 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
482
554
|
if (!canDropAssets ||
|
|
483
555
|
compositionFile === null ||
|
|
484
556
|
currentCompositionId === null ||
|
|
485
|
-
!isFileDragEvent(event)
|
|
557
|
+
(!isFileDragEvent(event) &&
|
|
558
|
+
!isAssetDragEvent(event) &&
|
|
559
|
+
!isComponentDragEvent(event) &&
|
|
560
|
+
!isSfxDragEvent(event) &&
|
|
561
|
+
!isRemoteAssetDragEvent(event)) ||
|
|
486
562
|
!isDragEventInsideCanvas(event)) {
|
|
487
563
|
return;
|
|
488
564
|
}
|
|
489
565
|
event.preventDefault();
|
|
490
566
|
event.stopPropagation();
|
|
491
|
-
const files = Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
|
|
492
|
-
if (files.length === 0) {
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
567
|
setIsAddingAsset(true);
|
|
496
568
|
try {
|
|
497
|
-
|
|
498
|
-
files
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
569
|
+
if (isFileDragEvent(event)) {
|
|
570
|
+
const files = Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
|
|
571
|
+
if (files.length === 0) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
await (0, import_assets_1.importAssets)({
|
|
575
|
+
files,
|
|
576
|
+
compositionFile,
|
|
577
|
+
compositionId: currentCompositionId,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
else if (isAssetDragEvent(event)) {
|
|
581
|
+
const assetPath = getAssetDragPath(event);
|
|
582
|
+
if (assetPath === null) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
await (0, import_assets_1.insertExistingAssets)({
|
|
586
|
+
assetPaths: [assetPath],
|
|
587
|
+
compositionFile,
|
|
588
|
+
compositionId: currentCompositionId,
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
else if (isSfxDragEvent(event)) {
|
|
592
|
+
const url = getSfxDragUrl(event);
|
|
593
|
+
if (url === null) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
await (0, import_assets_1.insertRemoteAudio)({
|
|
597
|
+
url,
|
|
598
|
+
compositionFile,
|
|
599
|
+
compositionId: currentCompositionId,
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
const componentDragData = getComponentDragData(event);
|
|
604
|
+
if (componentDragData !== null) {
|
|
605
|
+
await (0, import_assets_1.insertComponent)({
|
|
606
|
+
component: componentDragData.component,
|
|
607
|
+
compositionFile,
|
|
608
|
+
compositionId: currentCompositionId,
|
|
609
|
+
});
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
const url = (0, remote_asset_drag_1.getRemoteAssetUrlFromDataTransfer)(event.dataTransfer);
|
|
613
|
+
if (url === null) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
await (0, import_assets_1.importRemoteAsset)({
|
|
617
|
+
url,
|
|
618
|
+
compositionFile,
|
|
619
|
+
compositionId: currentCompositionId,
|
|
620
|
+
});
|
|
621
|
+
}
|
|
502
622
|
}
|
|
503
623
|
finally {
|
|
504
624
|
setIsAddingAsset(false);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type ConfirmationDialogOptions = {
|
|
3
|
+
readonly title: string;
|
|
4
|
+
readonly message: React.ReactNode;
|
|
5
|
+
readonly confirmLabel?: string;
|
|
6
|
+
readonly cancelLabel?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ConfirmationDialogFunction = (options: ConfirmationDialogOptions) => Promise<boolean>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfirmationDialogState } from '../state/modals';
|
|
3
|
+
import type { ConfirmationDialogFunction } from './ConfirmationDialog-types';
|
|
4
|
+
export declare const useConfirmationDialog: () => ConfirmationDialogFunction;
|
|
5
|
+
export declare const ConfirmationDialog: React.FC<{
|
|
6
|
+
readonly state: ConfirmationDialogState;
|
|
7
|
+
}>;
|