@remotion/studio 4.0.471 → 4.0.473
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 +55 -5
- package/dist/components/AssetSelectorItem.js +153 -27
- package/dist/components/Canvas.js +147 -0
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +12 -4
- 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 +99 -47
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/Editor.js +14 -6
- 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 +8 -2
- package/dist/components/NewComposition/CodemodFooter.js +2 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
- package/dist/components/NewComposition/DeleteFolder.js +39 -0
- package/dist/components/NewComposition/DeleteStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/DeleteStaticFile.js +44 -0
- package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
- package/dist/components/NewComposition/RenameFolder.js +60 -0
- 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 +105 -4
- package/dist/components/SelectedOutlineOverlay.js +578 -59
- 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/SplitterContainer.js +9 -0
- package/dist/components/Splitter/SplitterHandle.js +65 -70
- 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/Timeline.js +50 -15
- package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
- package/dist/components/Timeline/TimelineArrayField.js +210 -0
- package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
- package/dist/components/Timeline/TimelineBooleanField.js +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +43 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +479 -0
- package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
- package/dist/components/Timeline/TimelineColorField.js +2 -8
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +12 -2
- package/dist/components/Timeline/TimelineEffectItem.js +3 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +146 -26
- package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
- package/dist/components/Timeline/TimelineEnumField.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +41 -37
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -21
- 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/TimelineKeyframedValue.d.ts +7 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
- package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
- package/dist/components/Timeline/TimelineLayerEye.js +8 -3
- 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.d.ts +2 -2
- package/dist/components/Timeline/TimelineNumberField.js +7 -11
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
- package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +41 -24
- package/dist/components/Timeline/TimelineRowChrome.js +8 -7
- package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
- package/dist/components/Timeline/TimelineScaleField.js +314 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
- package/dist/components/Timeline/TimelineSchemaField.js +8 -42
- package/dist/components/Timeline/TimelineSelection.js +3 -2
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +51 -10
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +282 -28
- package/dist/components/Timeline/TimelineSequencePropItem.js +161 -35
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +525 -0
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineTranslateField.js +21 -25
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
- package/dist/components/Timeline/apply-effect-response-to-code-values.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-code-values.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.js +4 -0
- 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-timeline-item.d.ts +7 -4
- package/dist/components/Timeline/delete-selected-timeline-item.js +33 -21
- 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 +5 -2
- package/dist/components/Timeline/get-node-keyframes.js +38 -5
- package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
- package/dist/components/Timeline/reset-selected-timeline-props.js +22 -8
- package/dist/components/Timeline/save-effect-prop.d.ts +14 -3
- package/dist/components/Timeline/save-effect-prop.js +36 -18
- package/dist/components/Timeline/save-prop-queue.d.ts +2 -1
- package/dist/components/Timeline/save-prop-queue.js +5 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -7
- package/dist/components/Timeline/save-sequence-prop.js +33 -30
- 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 +1 -0
- package/dist/components/Timeline/timeline-field-utils.js +5 -1
- package/dist/components/Timeline/timeline-translate-utils.js +9 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +378 -0
- package/dist/components/TopPanel.d.ts +1 -1
- package/dist/components/folder-menu-items.d.ts +12 -0
- package/dist/components/folder-menu-items.js +147 -0
- package/dist/components/import-assets.d.ts +22 -0
- package/dist/components/import-assets.js +294 -0
- 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-z0z9d4r0.js → chunk-q0jkt0zq.js} +23062 -17350
- package/dist/esm/internals.mjs +23062 -17350
- package/dist/esm/previewEntry.mjs +22351 -16615
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +7 -3
- package/dist/helpers/create-folder-tree.js +1 -0
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-folder-id.d.ts +4 -0
- package/dist/helpers/get-folder-id.js +7 -0
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -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.js +5 -1
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/helpers/validate-folder-rename.d.ts +6 -0
- package/dist/helpers/validate-folder-rename.js +19 -0
- 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 +29 -2
- package/dist/state/scale-lock.d.ts +18 -0
- package/dist/state/scale-lock.js +59 -0
- package/package.json +10 -10
|
@@ -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,17 +112,37 @@ 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('/');
|
|
95
136
|
};
|
|
137
|
+
const differentExistingFile = Array.from(files).find((file) => {
|
|
138
|
+
const filePath = makePath(file);
|
|
139
|
+
return staticFiles.some((staticFile) => staticFile.name === filePath &&
|
|
140
|
+
staticFile.sizeInBytes !== file.size);
|
|
141
|
+
});
|
|
142
|
+
if (differentExistingFile) {
|
|
143
|
+
(0, NotificationCenter_1.showNotification)(`File with name ${makePath(differentExistingFile)} already exists and is different`, 4000);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
96
146
|
for (const file of files) {
|
|
97
147
|
const body = await file.arrayBuffer();
|
|
98
148
|
await (0, write_static_file_1.writeStaticFile)({
|
|
@@ -113,7 +163,7 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
113
163
|
finally {
|
|
114
164
|
setDropLocation(null);
|
|
115
165
|
}
|
|
116
|
-
}, [dropLocation]);
|
|
166
|
+
}, [dropLocation, staticFiles]);
|
|
117
167
|
return (jsx_runtime_1.jsxs("div", { style: container, onDragOver: shouldAllowUpload ? onDragOver : undefined, onDrop: shouldAllowUpload ? onDrop : undefined, children: [showCurrentAsset ? jsx_runtime_1.jsx(CurrentAsset_1.CurrentAsset, {}) : null, staticFiles.length === 0 ? (publicFolderExists ? (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, place a file in the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
|
|
118
168
|
" folder of your project or drag and drop a file here."] }) })) : (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, create a folder called", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
|
|
119
169
|
" in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
|
|
@@ -32,25 +32,27 @@ 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 client_id_1 = require("../helpers/client-id");
|
|
44
43
|
const colors_1 = require("../helpers/colors");
|
|
45
44
|
const copy_text_1 = require("../helpers/copy-text");
|
|
46
45
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
47
46
|
const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
|
|
48
47
|
const url_state_1 = require("../helpers/url-state");
|
|
49
|
-
const use_asset_drag_events_1 =
|
|
48
|
+
const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-events"));
|
|
50
49
|
const clipboard_1 = require("../icons/clipboard");
|
|
51
50
|
const file_1 = require("../icons/file");
|
|
52
51
|
const folder_1 = require("../icons/folder");
|
|
52
|
+
const modals_1 = require("../state/modals");
|
|
53
53
|
const sidebar_1 = require("../state/sidebar");
|
|
54
|
+
const ContextMenu_1 = require("./ContextMenu");
|
|
55
|
+
const import_assets_1 = require("./import-assets");
|
|
54
56
|
const InlineAction_1 = require("./InlineAction");
|
|
55
57
|
const layout_1 = require("./layout");
|
|
56
58
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
@@ -128,13 +130,19 @@ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dr
|
|
|
128
130
|
return (jsx_runtime_1.jsxs("div", { onDragEnter: onDragEnter, onDragLeave: onDragLeave, style: {
|
|
129
131
|
backgroundColor: isDropDiv ? colors_1.CLEAR_HOVER : colors_1.BACKGROUND,
|
|
130
132
|
}, children: [
|
|
131
|
-
jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: () => {
|
|
133
|
+
jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
|
|
134
|
+
if (!(0, use_asset_drag_events_1.isFileDragEvent)(event)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
132
137
|
if (!item.expanded) {
|
|
133
138
|
openFolderTimerRef.current = window.setTimeout(() => {
|
|
134
139
|
toggleFolder(item.name, parentFolder);
|
|
135
140
|
}, 1000);
|
|
136
141
|
}
|
|
137
|
-
}, onDragLeave: () => {
|
|
142
|
+
}, onDragLeave: (event) => {
|
|
143
|
+
if (!(0, use_asset_drag_events_1.isFileDragEvent)(event)) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
138
146
|
if (openFolderTimerRef.current) {
|
|
139
147
|
clearTimeout(openFolderTimerRef.current);
|
|
140
148
|
}
|
|
@@ -156,7 +164,11 @@ exports.AssetFolderTree = AssetFolderTree;
|
|
|
156
164
|
const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
|
|
157
165
|
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
158
166
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
167
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
159
168
|
const { setSidebarCollapsedState } = (0, react_1.useContext)(sidebar_1.SidebarContext);
|
|
169
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
170
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
171
|
+
.previewServerState.type;
|
|
160
172
|
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
161
173
|
setHovered(true);
|
|
162
174
|
}, []);
|
|
@@ -171,6 +183,9 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
171
183
|
}
|
|
172
184
|
return false;
|
|
173
185
|
}, [canvasContent, relativePath]);
|
|
186
|
+
const canDragAsset = (0, react_1.useMemo)(() => {
|
|
187
|
+
return !readOnlyStudio && (0, import_assets_1.getAssetElementFromPath)(relativePath) !== null;
|
|
188
|
+
}, [readOnlyStudio, relativePath]);
|
|
174
189
|
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
175
190
|
setHovered(false);
|
|
176
191
|
}, []);
|
|
@@ -195,6 +210,18 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
195
210
|
setCanvasContent,
|
|
196
211
|
setSidebarCollapsedState,
|
|
197
212
|
]);
|
|
213
|
+
const onDragStart = (0, react_1.useCallback)((e) => {
|
|
214
|
+
if (!canDragAsset) {
|
|
215
|
+
e.preventDefault();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
setIsDragging(true);
|
|
219
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
220
|
+
e.dataTransfer.setData(studio_shared_1.ASSET_DRAG_MIME_TYPE, JSON.stringify((0, studio_shared_1.makeAssetDragData)(relativePath)));
|
|
221
|
+
}, [canDragAsset, relativePath]);
|
|
222
|
+
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
223
|
+
setIsDragging(false);
|
|
224
|
+
}, []);
|
|
198
225
|
const style = (0, react_1.useMemo)(() => {
|
|
199
226
|
return {
|
|
200
227
|
...itemStyle,
|
|
@@ -221,21 +248,17 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
221
248
|
const renderCopyAction = (0, react_1.useCallback)((color) => {
|
|
222
249
|
return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { style: revealIconStyle, color: color });
|
|
223
250
|
}, []);
|
|
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);
|
|
251
|
+
const copyFileName = (0, react_1.useCallback)(() => {
|
|
252
|
+
(0, copy_text_1.copyText)(item.name)
|
|
253
|
+
.then(() => {
|
|
254
|
+
(0, NotificationCenter_1.showNotification)(`Copied '${item.name}' to clipboard`, 1000);
|
|
255
|
+
})
|
|
256
|
+
.catch((err) => {
|
|
257
|
+
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
234
258
|
});
|
|
235
|
-
}, [item.name
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
const content = `staticFile("${[parentFolder, item.name].join('/')}")`;
|
|
259
|
+
}, [item.name]);
|
|
260
|
+
const copyStaticFilePath = (0, react_1.useCallback)(() => {
|
|
261
|
+
const content = `staticFile("${relativePath}")`;
|
|
239
262
|
(0, copy_text_1.copyText)(content)
|
|
240
263
|
.then(() => {
|
|
241
264
|
(0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
|
|
@@ -243,10 +266,113 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
243
266
|
.catch((err) => {
|
|
244
267
|
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
245
268
|
});
|
|
246
|
-
}, [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
269
|
+
}, [relativePath]);
|
|
270
|
+
const openAssetInExplorer = (0, react_1.useCallback)(() => {
|
|
271
|
+
if (!window.remotion_publicFolderExists) {
|
|
272
|
+
(0, NotificationCenter_1.showNotification)('Could not find the public folder', 2000);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
(0, actions_1.openInFileExplorer)({
|
|
276
|
+
directory: window.remotion_publicFolderExists + '/' + relativePath,
|
|
277
|
+
}).catch((err) => {
|
|
278
|
+
(0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
|
|
279
|
+
});
|
|
280
|
+
}, [relativePath]);
|
|
281
|
+
const serverActionDisabled = readOnlyStudio || connectionStatus !== 'connected';
|
|
282
|
+
const contextMenu = (0, react_1.useMemo)(() => {
|
|
283
|
+
return [
|
|
284
|
+
{
|
|
285
|
+
id: 'copy-asset-file-name',
|
|
286
|
+
keyHint: null,
|
|
287
|
+
label: 'Copy file name',
|
|
288
|
+
leftItem: null,
|
|
289
|
+
onClick: copyFileName,
|
|
290
|
+
quickSwitcherLabel: 'Copy asset file name',
|
|
291
|
+
subMenu: null,
|
|
292
|
+
type: 'item',
|
|
293
|
+
value: 'copy-asset-file-name',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: 'copy-asset-static-file-path',
|
|
297
|
+
keyHint: null,
|
|
298
|
+
label: 'Copy staticFile() path',
|
|
299
|
+
leftItem: null,
|
|
300
|
+
onClick: copyStaticFilePath,
|
|
301
|
+
quickSwitcherLabel: 'Copy staticFile() path',
|
|
302
|
+
subMenu: null,
|
|
303
|
+
type: 'item',
|
|
304
|
+
value: 'copy-asset-static-file-path',
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
type: 'divider',
|
|
308
|
+
id: 'asset-file-actions-divider',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
id: 'open-asset-in-explorer',
|
|
312
|
+
keyHint: null,
|
|
313
|
+
label: 'Open in Explorer',
|
|
314
|
+
leftItem: null,
|
|
315
|
+
onClick: openAssetInExplorer,
|
|
316
|
+
quickSwitcherLabel: 'Open asset in Explorer',
|
|
317
|
+
subMenu: null,
|
|
318
|
+
type: 'item',
|
|
319
|
+
value: 'open-asset-in-explorer',
|
|
320
|
+
disabled: serverActionDisabled || window.remotion_publicFolderExists === null,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
id: 'rename-asset',
|
|
324
|
+
keyHint: null,
|
|
325
|
+
label: 'Rename...',
|
|
326
|
+
leftItem: null,
|
|
327
|
+
onClick: () => {
|
|
328
|
+
setSelectedModal({
|
|
329
|
+
type: 'rename-static-file',
|
|
330
|
+
relativePath,
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
quickSwitcherLabel: 'Rename asset...',
|
|
334
|
+
subMenu: null,
|
|
335
|
+
type: 'item',
|
|
336
|
+
value: 'rename-asset',
|
|
337
|
+
disabled: serverActionDisabled,
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: 'delete-asset',
|
|
341
|
+
keyHint: null,
|
|
342
|
+
label: 'Delete...',
|
|
343
|
+
leftItem: null,
|
|
344
|
+
onClick: () => {
|
|
345
|
+
setSelectedModal({
|
|
346
|
+
type: 'delete-static-file',
|
|
347
|
+
relativePath,
|
|
348
|
+
});
|
|
349
|
+
},
|
|
350
|
+
quickSwitcherLabel: 'Delete asset...',
|
|
351
|
+
subMenu: null,
|
|
352
|
+
type: 'item',
|
|
353
|
+
value: 'delete-asset',
|
|
354
|
+
disabled: serverActionDisabled,
|
|
355
|
+
},
|
|
356
|
+
];
|
|
357
|
+
}, [
|
|
358
|
+
copyFileName,
|
|
359
|
+
copyStaticFilePath,
|
|
360
|
+
openAssetInExplorer,
|
|
361
|
+
relativePath,
|
|
362
|
+
serverActionDisabled,
|
|
363
|
+
setSelectedModal,
|
|
364
|
+
]);
|
|
365
|
+
const revealInExplorer = (0, react_1.useCallback)((e) => {
|
|
366
|
+
e.stopPropagation();
|
|
367
|
+
openAssetInExplorer();
|
|
368
|
+
}, [openAssetInExplorer]);
|
|
369
|
+
const copyToClipboard = (0, react_1.useCallback)((e) => {
|
|
370
|
+
e.stopPropagation();
|
|
371
|
+
copyStaticFilePath();
|
|
372
|
+
}, [copyStaticFilePath]);
|
|
373
|
+
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: [
|
|
374
|
+
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: [
|
|
375
|
+
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: [
|
|
376
|
+
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 })
|
|
377
|
+
] }))] })) : null] }) }) }));
|
|
252
378
|
};
|
|
@@ -5,11 +5,15 @@ 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");
|
|
11
|
+
const client_id_1 = require("../helpers/client-id");
|
|
10
12
|
const colors_1 = require("../helpers/colors");
|
|
11
13
|
const get_asset_metadata_1 = require("../helpers/get-asset-metadata");
|
|
12
14
|
const get_effective_translation_1 = require("../helpers/get-effective-translation");
|
|
15
|
+
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
16
|
+
const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
|
|
13
17
|
const smooth_zoom_1 = require("../helpers/smooth-zoom");
|
|
14
18
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
15
19
|
const canvas_ref_1 = require("../state/canvas-ref");
|
|
@@ -18,9 +22,11 @@ const editor_zoom_gestures_1 = require("../state/editor-zoom-gestures");
|
|
|
18
22
|
const EditorGuides_1 = __importDefault(require("./EditorGuides"));
|
|
19
23
|
const EditorRuler_1 = require("./EditorRuler");
|
|
20
24
|
const use_is_ruler_visible_1 = require("./EditorRuler/use-is-ruler-visible");
|
|
25
|
+
const import_assets_1 = require("./import-assets");
|
|
21
26
|
const layout_1 = require("./layout");
|
|
22
27
|
const Preview_1 = require("./Preview");
|
|
23
28
|
const ResetZoomButton_1 = require("./ResetZoomButton");
|
|
29
|
+
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
24
30
|
const getContainerStyle = (editorZoomGestures) => ({
|
|
25
31
|
flex: 1,
|
|
26
32
|
display: 'flex',
|
|
@@ -35,7 +41,47 @@ const resetZoom = {
|
|
|
35
41
|
right: layout_1.SPACING_UNIT * 2,
|
|
36
42
|
};
|
|
37
43
|
const ZOOM_PX_FACTOR = 0.003;
|
|
44
|
+
const isFileDragEvent = (event) => {
|
|
45
|
+
var _a;
|
|
46
|
+
var _b;
|
|
47
|
+
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes('Files');
|
|
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 isRemoteAssetDragEvent = (event) => {
|
|
55
|
+
return (!isFileDragEvent(event) &&
|
|
56
|
+
!isAssetDragEvent(event) &&
|
|
57
|
+
(0, remote_asset_drag_1.hasRemoteAssetDragData)(event.dataTransfer));
|
|
58
|
+
};
|
|
59
|
+
const getAssetDragPath = (event) => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
var _c;
|
|
62
|
+
const value = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData(studio_shared_1.ASSET_DRAG_MIME_TYPE);
|
|
63
|
+
if (!value) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return (_c = (_b = (0, studio_shared_1.parseAssetDragData)(value)) === null || _b === void 0 ? void 0 : _b.assetPath) !== null && _c !== void 0 ? _c : null;
|
|
67
|
+
};
|
|
68
|
+
const isDragEventInsideCanvas = (event) => {
|
|
69
|
+
const { current } = canvas_ref_1.canvasRef;
|
|
70
|
+
if (!current) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const targetIsNode = event.target instanceof Node;
|
|
74
|
+
if (targetIsNode && current.contains(event.target)) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
const rect = current.getBoundingClientRect();
|
|
78
|
+
return (event.clientX >= rect.left &&
|
|
79
|
+
event.clientX <= rect.right &&
|
|
80
|
+
event.clientY >= rect.top &&
|
|
81
|
+
event.clientY <= rect.bottom);
|
|
82
|
+
};
|
|
38
83
|
const Canvas = ({ canvasContent, size }) => {
|
|
84
|
+
var _a, _b;
|
|
39
85
|
const { setSize, size: previewSize } = (0, react_1.useContext)(remotion_1.Internals.PreviewSizeContext);
|
|
40
86
|
const { editorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
|
|
41
87
|
const previewSnapshotRef = (0, react_1.useRef)({
|
|
@@ -50,7 +96,30 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
50
96
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
51
97
|
const areRulersVisible = (0, use_is_ruler_visible_1.useIsRulerVisible)();
|
|
52
98
|
const { editorShowGuides } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
99
|
+
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
100
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
101
|
+
const [isAddingAsset, setIsAddingAsset] = (0, react_1.useState)(false);
|
|
53
102
|
const [assetResolution, setAssetResolution] = (0, react_1.useState)(null);
|
|
103
|
+
const currentCompositionId = canvasContent.type === 'composition' ? canvasContent.compositionId : null;
|
|
104
|
+
const currentComposition = (0, react_1.useMemo)(() => {
|
|
105
|
+
var _a;
|
|
106
|
+
if (currentCompositionId === null) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return ((_a = compositions.find((composition) => composition.id === currentCompositionId)) !== null && _a !== void 0 ? _a : null);
|
|
110
|
+
}, [compositions, currentCompositionId]);
|
|
111
|
+
const resolvedCompositionLocation = (0, use_resolved_stack_1.useResolvedStack)((_a = currentComposition === null || currentComposition === void 0 ? void 0 : currentComposition.stack) !== null && _a !== void 0 ? _a : null);
|
|
112
|
+
const compositionFile = (_b = resolvedCompositionLocation === null || resolvedCompositionLocation === void 0 ? void 0 : resolvedCompositionLocation.source) !== null && _b !== void 0 ? _b : null;
|
|
113
|
+
const compositionComponentInfo = (0, open_in_editor_1.useCachedCompositionComponentInfo)({
|
|
114
|
+
compositionFile,
|
|
115
|
+
compositionId: currentCompositionId,
|
|
116
|
+
});
|
|
117
|
+
const canDropAssets = previewServerState.type === 'connected' &&
|
|
118
|
+
!window.remotion_isReadOnlyStudio &&
|
|
119
|
+
(compositionComponentInfo === null || compositionComponentInfo === void 0 ? void 0 : compositionComponentInfo.canAddSequence) === true &&
|
|
120
|
+
currentCompositionId !== null &&
|
|
121
|
+
compositionFile !== null &&
|
|
122
|
+
!isAddingAsset;
|
|
54
123
|
const contentDimensions = (0, react_1.useMemo)(() => {
|
|
55
124
|
if ((canvasContent.type === 'asset' ||
|
|
56
125
|
canvasContent.type === 'output' ||
|
|
@@ -417,6 +486,84 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
417
486
|
(0, react_1.useEffect)(() => {
|
|
418
487
|
fetchMetadata();
|
|
419
488
|
}, [fetchMetadata]);
|
|
489
|
+
const onDragOver = (0, react_1.useCallback)((event) => {
|
|
490
|
+
if (!canDropAssets ||
|
|
491
|
+
(!isFileDragEvent(event) &&
|
|
492
|
+
!isAssetDragEvent(event) &&
|
|
493
|
+
!isRemoteAssetDragEvent(event)) ||
|
|
494
|
+
!isDragEventInsideCanvas(event)) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
event.preventDefault();
|
|
498
|
+
if (event.dataTransfer) {
|
|
499
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
500
|
+
}
|
|
501
|
+
}, [canDropAssets]);
|
|
502
|
+
const onDrop = (0, react_1.useCallback)(async (event) => {
|
|
503
|
+
var _a;
|
|
504
|
+
var _b;
|
|
505
|
+
if (!canDropAssets ||
|
|
506
|
+
compositionFile === null ||
|
|
507
|
+
currentCompositionId === null ||
|
|
508
|
+
(!isFileDragEvent(event) &&
|
|
509
|
+
!isAssetDragEvent(event) &&
|
|
510
|
+
!isRemoteAssetDragEvent(event)) ||
|
|
511
|
+
!isDragEventInsideCanvas(event)) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
event.preventDefault();
|
|
515
|
+
event.stopPropagation();
|
|
516
|
+
setIsAddingAsset(true);
|
|
517
|
+
try {
|
|
518
|
+
if (isFileDragEvent(event)) {
|
|
519
|
+
const files = Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
|
|
520
|
+
if (files.length === 0) {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
await (0, import_assets_1.importAssets)({
|
|
524
|
+
files,
|
|
525
|
+
compositionFile,
|
|
526
|
+
compositionId: currentCompositionId,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
else if (isAssetDragEvent(event)) {
|
|
530
|
+
const assetPath = getAssetDragPath(event);
|
|
531
|
+
if (assetPath === null) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
await (0, import_assets_1.insertExistingAssets)({
|
|
535
|
+
assetPaths: [assetPath],
|
|
536
|
+
compositionFile,
|
|
537
|
+
compositionId: currentCompositionId,
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
const url = (0, remote_asset_drag_1.getRemoteAssetUrlFromDataTransfer)(event.dataTransfer);
|
|
542
|
+
if (url === null) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
await (0, import_assets_1.importRemoteAsset)({
|
|
546
|
+
url,
|
|
547
|
+
compositionFile,
|
|
548
|
+
compositionId: currentCompositionId,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
finally {
|
|
553
|
+
setIsAddingAsset(false);
|
|
554
|
+
}
|
|
555
|
+
}, [canDropAssets, compositionFile, currentCompositionId]);
|
|
556
|
+
(0, react_1.useEffect)(() => {
|
|
557
|
+
if (!canDropAssets) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
document.addEventListener('dragover', onDragOver, { capture: true });
|
|
561
|
+
document.addEventListener('drop', onDrop, { capture: true });
|
|
562
|
+
return () => {
|
|
563
|
+
document.removeEventListener('dragover', onDragOver, { capture: true });
|
|
564
|
+
document.removeEventListener('drop', onDrop, { capture: true });
|
|
565
|
+
};
|
|
566
|
+
}, [canDropAssets, onDragOver, onDrop]);
|
|
420
567
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
421
568
|
jsx_runtime_1.jsxs("div", { ref: canvas_ref_1.canvasRef, style: getContainerStyle(editorZoomGestures), children: [size ? (jsx_runtime_1.jsx(Preview_1.VideoPreview, { canvasContent: canvasContent, contentDimensions: contentDimensions, canvasSize: size, assetMetadata: assetResolution, onRetryAssetMetadata: fetchMetadata })) : null, isFit ? null : (jsx_runtime_1.jsx("div", { style: resetZoom, className: "css-reset", children: jsx_runtime_1.jsx(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) })), editorShowGuides && canvasContent.type === 'composition' && (jsx_runtime_1.jsx(EditorGuides_1.default, { canvasSize: size, contentDimensions: contentDimensions, assetMetadata: assetResolution }))] }), areRulersVisible && (jsx_runtime_1.jsx(EditorRuler_1.EditorRulers, { contentDimensions: contentDimensions, canvasSize: size, assetMetadata: assetResolution, containerRef: canvas_ref_1.canvasRef }))] }));
|
|
422
569
|
};
|
|
@@ -15,6 +15,7 @@ const modals_1 = require("../state/modals");
|
|
|
15
15
|
const composition_menu_items_1 = require("./composition-menu-items");
|
|
16
16
|
const CompositionContextButton_1 = require("./CompositionContextButton");
|
|
17
17
|
const ContextMenu_1 = require("./ContextMenu");
|
|
18
|
+
const folder_menu_items_1 = require("./folder-menu-items");
|
|
18
19
|
const layout_1 = require("./layout");
|
|
19
20
|
const SidebarRenderButton_1 = require("./SidebarRenderButton");
|
|
20
21
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
@@ -108,7 +109,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
108
109
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
109
110
|
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
110
111
|
.previewServerState.type;
|
|
111
|
-
const resolvedLocation = (0, use_resolved_stack_1.useResolvedStack)(item.type === 'composition' ? item.composition.stack :
|
|
112
|
+
const resolvedLocation = (0, use_resolved_stack_1.useResolvedStack)(item.type === 'composition' ? item.composition.stack : item.folder.stack);
|
|
112
113
|
const contextMenu = (0, react_1.useMemo)(() => {
|
|
113
114
|
if (item.type === 'composition') {
|
|
114
115
|
return (0, composition_menu_items_1.getCompositionMenuItems)({
|
|
@@ -120,12 +121,19 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
120
121
|
readOnlyStudio: window.remotion_isReadOnlyStudio,
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
return
|
|
124
|
+
return (0, folder_menu_items_1.getFolderMenuItems)({
|
|
125
|
+
closeMenu: noop_1.noop,
|
|
126
|
+
connectionStatus,
|
|
127
|
+
folder: item.folder,
|
|
128
|
+
resolvedLocation,
|
|
129
|
+
setSelectedModal,
|
|
130
|
+
readOnlyStudio: window.remotion_isReadOnlyStudio,
|
|
131
|
+
});
|
|
124
132
|
}, [connectionStatus, item, resolvedLocation, setSelectedModal]);
|
|
125
133
|
if (item.type === 'folder') {
|
|
126
134
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
127
|
-
jsx_runtime_1.jsxs("button", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, type: "button", title: item.folderName, children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.folderName })
|
|
128
|
-
|
|
135
|
+
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("button", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, type: "button", title: item.folderName, children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.folderName }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered })
|
|
136
|
+
] }) }) }), item.expanded
|
|
129
137
|
? item.items.map((childItem) => {
|
|
130
138
|
return (jsx_runtime_1.jsx(exports.CompositionSelectorItem, { currentComposition: currentComposition, selectComposition: selectComposition, item: childItem, tabIndex: tabIndex, level: level + 1, toggleFolder: toggleFolder }, childItem.key + childItem.type));
|
|
131
139
|
})
|
|
@@ -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
|
+
}>;
|