@remotion/studio 4.0.493 → 4.0.495
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/get-static-files.d.ts +1 -1
- package/dist/components/AssetFileIcon.d.ts +7 -0
- package/dist/components/AssetFileIcon.js +24 -0
- package/dist/components/AssetSelectorItem.js +13 -7
- package/dist/components/Canvas.js +194 -36
- package/dist/components/CompositionSelectorItem.js +15 -8
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +17 -1
- package/dist/components/Editor.js +2 -4
- package/dist/components/InitialCompositionLoader.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.js +6 -1
- package/dist/components/InspectorPanel/AssetInspector.d.ts +4 -0
- package/dist/components/InspectorPanel/AssetInspector.js +11 -0
- package/dist/components/InspectorPanel/{DefaultInspector.d.ts → CompositionInspector.d.ts} +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +114 -0
- package/dist/components/InspectorPanel/CompositionInspectorHeader.d.ts +1 -0
- package/dist/components/{CurrentComposition.js → InspectorPanel/CompositionInspectorHeader.js} +16 -16
- package/dist/components/InspectorPanel/{CompositionDimensions.d.ts → CompositionMetadata.d.ts} +1 -1
- package/dist/components/InspectorPanel/{CompositionDimensions.js → CompositionMetadata.js} +17 -8
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +2 -2
- package/dist/components/InspectorPanel/EasingInspector.js +3 -5
- package/dist/components/InspectorPanel/KeyframeInspector.js +2 -2
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +34 -1
- package/dist/components/InspectorPanel/common.d.ts +8 -0
- package/dist/components/InspectorPanel/common.js +31 -8
- package/dist/components/InspectorPanel/styles.d.ts +5 -3
- package/dist/components/InspectorPanel/styles.js +13 -4
- package/dist/components/InspectorPanel/use-composition-actions.d.ts +8 -0
- package/dist/components/InspectorPanel/use-composition-actions.js +114 -0
- package/dist/components/InspectorPanel.js +11 -2
- package/dist/components/InspectorSequenceSection.d.ts +0 -1
- package/dist/components/InspectorSequenceSection.js +9 -48
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/InputDragger.d.ts +6 -0
- package/dist/components/NewComposition/InputDragger.js +26 -13
- package/dist/components/NewComposition/NewComposition.js +8 -1
- package/dist/components/NewComposition/ValidationMessage.d.ts +1 -1
- package/dist/components/Preview.js +15 -7
- package/dist/components/RenderModal/RenderModalOutputName.js +34 -1
- package/dist/components/SelectedOutlineOverlay.js +1 -0
- package/dist/components/SvgImportDialog.d.ts +7 -0
- package/dist/components/SvgImportDialog.js +103 -0
- package/dist/components/Timeline/Timeline.js +2 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +11 -1
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +2 -0
- package/dist/components/Timeline/TimelineKeyframeControls.js +1 -0
- package/dist/components/Timeline/TimelineList.js +9 -4
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +42 -6
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +2 -1
- package/dist/components/Timeline/TimelineSequenceItem.js +33 -13
- package/dist/components/Timeline/TimelineTrack.js +2 -1
- package/dist/components/Timeline/call-delete-keyframe.d.ts +1 -0
- package/dist/components/Timeline/call-delete-keyframe.js +4 -0
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +4 -2
- package/dist/components/Timeline/delete-selected-keyframe.js +48 -5
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +3 -1
- package/dist/components/Timeline/delete-selected-timeline-item.js +3 -1
- package/dist/components/Timeline/nest-timeline-tracks.d.ts +8 -0
- package/dist/components/Timeline/nest-timeline-tracks.js +25 -0
- package/dist/components/Timeline/timeline-scroll-logic.d.ts +8 -4
- package/dist/components/Timeline/timeline-scroll-logic.js +29 -15
- package/dist/components/import-assets.d.ts +41 -3
- package/dist/components/import-assets.js +148 -24
- package/dist/components/layout.d.ts +1 -0
- package/dist/components/layout.js +2 -1
- package/dist/components/selected-outline-measurement.d.ts +2 -1
- package/dist/components/selected-outline-measurement.js +3 -1
- package/dist/esm/{chunk-mndqr3zx.js → chunk-784jbkzs.js} +8604 -7249
- package/dist/esm/internals.mjs +8604 -7249
- package/dist/esm/previewEntry.mjs +8704 -7349
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/client-id.js +2 -1
- package/dist/helpers/clipboard-figma.d.ts +4 -0
- package/dist/helpers/clipboard-figma.js +41 -0
- package/dist/helpers/clipboard-images.d.ts +10 -0
- package/dist/helpers/clipboard-images.js +77 -0
- package/dist/helpers/clipboard-svg.d.ts +3 -0
- package/dist/helpers/clipboard-svg.js +47 -0
- package/dist/helpers/get-effective-translation.d.ts +2 -1
- package/dist/helpers/get-effective-translation.js +15 -7
- package/dist/helpers/get-preview-file-type.d.ts +1 -1
- package/dist/helpers/get-preview-file-type.js +5 -1
- package/dist/helpers/get-sequence-double-click-action.d.ts +6 -0
- package/dist/helpers/get-sequence-double-click-action.js +10 -1
- package/dist/helpers/inject-css.js +9 -2
- package/dist/helpers/studio-fit-padding.d.ts +41 -0
- package/dist/helpers/studio-fit-padding.js +64 -0
- package/dist/helpers/use-image-metadata.d.ts +8 -0
- package/dist/helpers/use-image-metadata.js +82 -0
- package/dist/helpers/use-studio-canvas-dimensions.js +2 -2
- package/dist/icons/audio.d.ts +3 -0
- package/dist/icons/audio.js +3 -1
- package/dist/icons/font.d.ts +4 -0
- package/dist/icons/font.js +8 -0
- package/dist/icons/frame.d.ts +3 -1
- package/dist/icons/frame.js +1 -1
- package/dist/icons/json.d.ts +4 -0
- package/dist/icons/json.js +8 -0
- package/dist/icons/magnet.js +1 -1
- package/dist/icons/scissors.d.ts +5 -0
- package/dist/icons/scissors.js +8 -0
- package/dist/icons/solid.d.ts +5 -0
- package/dist/icons/solid.js +8 -0
- package/dist/icons/video.d.ts +3 -0
- package/dist/icons/video.js +5 -1
- package/dist/state/modals.d.ts +8 -1
- package/dist/state/timeline-zoom.js +12 -11
- package/package.json +11 -11
- package/dist/components/CurrentComposition.d.ts +0 -2
- package/dist/components/InspectorPanel/DefaultInspector.js +0 -97
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const getStaticFiles: () => StaticFile[];
|
|
2
2
|
export type StaticFile = {
|
|
3
3
|
/**
|
|
4
|
-
* A string that you can pass to the `src` attribute of an `<Audio>`, `<Img>`, `<Video>`, `<Html5Audio>`, `<Html5Video>` or `<OffthreadVideo>` element.
|
|
4
|
+
* A string that you can pass to the `src` attribute of an `<Audio>`, `<CanvasImage>`, `<Img>`, `<Video>`, `<Html5Audio>`, `<Html5Video>` or `<OffthreadVideo>` element.
|
|
5
5
|
*/
|
|
6
6
|
src: string;
|
|
7
7
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
import type { AssetFileType } from '../helpers/get-preview-file-type';
|
|
3
|
+
export declare const AssetFileIcon: ({ fileType, ...props }: SVGProps<SVGSVGElement> & {
|
|
4
|
+
readonly color: string;
|
|
5
|
+
} & {
|
|
6
|
+
readonly fileType: AssetFileType;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetFileIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const audio_1 = require("../icons/audio");
|
|
6
|
+
const file_1 = require("../icons/file");
|
|
7
|
+
const font_1 = require("../icons/font");
|
|
8
|
+
const frame_1 = require("../icons/frame");
|
|
9
|
+
const json_1 = require("../icons/json");
|
|
10
|
+
const video_1 = require("../icons/video");
|
|
11
|
+
const iconByFileType = {
|
|
12
|
+
audio: audio_1.AudioFileIcon,
|
|
13
|
+
font: font_1.FontFileIcon,
|
|
14
|
+
image: frame_1.PicIcon,
|
|
15
|
+
json: json_1.JsonFileIcon,
|
|
16
|
+
other: file_1.FileIcon,
|
|
17
|
+
txt: file_1.FileIcon,
|
|
18
|
+
video: video_1.VideoFileIcon,
|
|
19
|
+
};
|
|
20
|
+
const AssetFileIcon = ({ fileType, ...props }) => {
|
|
21
|
+
const Icon = iconByFileType[fileType];
|
|
22
|
+
return jsx_runtime_1.jsx(Icon, { ...props });
|
|
23
|
+
};
|
|
24
|
+
exports.AssetFileIcon = AssetFileIcon;
|
|
@@ -44,15 +44,16 @@ 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 get_file_manager_name_1 = require("../helpers/get-file-manager-name");
|
|
47
|
+
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
47
48
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
48
49
|
const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
|
|
49
50
|
const url_state_1 = require("../helpers/url-state");
|
|
50
51
|
const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-events"));
|
|
51
52
|
const clipboard_1 = require("../icons/clipboard");
|
|
52
|
-
const file_1 = require("../icons/file");
|
|
53
53
|
const folder_1 = require("../icons/folder");
|
|
54
54
|
const modals_1 = require("../state/modals");
|
|
55
55
|
const sidebar_1 = require("../state/sidebar");
|
|
56
|
+
const AssetFileIcon_1 = require("./AssetFileIcon");
|
|
56
57
|
const ConfirmationDialog_1 = require("./ConfirmationDialog");
|
|
57
58
|
const ContextMenu_1 = require("./ContextMenu");
|
|
58
59
|
const import_assets_1 = require("./import-assets");
|
|
@@ -61,7 +62,6 @@ const layout_1 = require("./layout");
|
|
|
61
62
|
const styles_1 = require("./Menu/styles");
|
|
62
63
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
63
64
|
const actions_1 = require("./RenderQueue/actions");
|
|
64
|
-
const ASSET_ITEM_HEIGHT = 32;
|
|
65
65
|
const iconStyle = {
|
|
66
66
|
width: 18,
|
|
67
67
|
height: 18,
|
|
@@ -69,20 +69,23 @@ const iconStyle = {
|
|
|
69
69
|
};
|
|
70
70
|
const itemStyle = {
|
|
71
71
|
paddingRight: 10,
|
|
72
|
-
paddingTop:
|
|
73
|
-
paddingBottom:
|
|
72
|
+
paddingTop: 5,
|
|
73
|
+
paddingBottom: 5,
|
|
74
74
|
fontSize: 13,
|
|
75
75
|
display: 'flex',
|
|
76
76
|
textDecoration: 'none',
|
|
77
77
|
cursor: 'default',
|
|
78
78
|
alignItems: 'center',
|
|
79
79
|
marginBottom: 1,
|
|
80
|
+
marginLeft: 4,
|
|
81
|
+
marginRight: 4,
|
|
80
82
|
appearance: 'none',
|
|
81
83
|
border: 'none',
|
|
82
|
-
|
|
84
|
+
borderRadius: 4,
|
|
85
|
+
width: 'calc(100% - 8px)',
|
|
83
86
|
textAlign: 'left',
|
|
84
87
|
backgroundColor: colors_1.BACKGROUND,
|
|
85
|
-
height:
|
|
88
|
+
height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
|
|
86
89
|
userSelect: 'none',
|
|
87
90
|
WebkitUserSelect: 'none',
|
|
88
91
|
};
|
|
@@ -183,6 +186,9 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
183
186
|
const relativePath = (0, react_1.useMemo)(() => {
|
|
184
187
|
return parentFolder ? parentFolder + '/' + item.name : item.name;
|
|
185
188
|
}, [parentFolder, item.name]);
|
|
189
|
+
const previewFileType = (0, react_1.useMemo)(() => {
|
|
190
|
+
return (0, get_preview_file_type_1.getPreviewFileType)(relativePath);
|
|
191
|
+
}, [relativePath]);
|
|
186
192
|
const selected = (0, react_1.useMemo)(() => {
|
|
187
193
|
if (canvasContent && canvasContent.type === 'asset') {
|
|
188
194
|
return canvasContent.asset === relativePath;
|
|
@@ -398,7 +404,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
398
404
|
copyStaticFilePath();
|
|
399
405
|
}, [copyStaticFilePath]);
|
|
400
406
|
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: [
|
|
401
|
-
jsx_runtime_1.jsx(
|
|
407
|
+
jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, 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: [
|
|
402
408
|
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: [
|
|
403
409
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer })
|
|
404
410
|
] }))] })) : null] }) }) }));
|
|
@@ -8,7 +8,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
|
+
const get_static_files_1 = require("../api/get-static-files");
|
|
11
12
|
const client_id_1 = require("../helpers/client-id");
|
|
13
|
+
const clipboard_figma_1 = require("../helpers/clipboard-figma");
|
|
14
|
+
const clipboard_images_1 = require("../helpers/clipboard-images");
|
|
15
|
+
const clipboard_svg_1 = require("../helpers/clipboard-svg");
|
|
12
16
|
const colors_1 = require("../helpers/colors");
|
|
13
17
|
const get_asset_metadata_1 = require("../helpers/get-asset-metadata");
|
|
14
18
|
const get_effective_translation_1 = require("../helpers/get-effective-translation");
|
|
@@ -16,6 +20,7 @@ const install_required_package_1 = require("../helpers/install-required-package"
|
|
|
16
20
|
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
17
21
|
const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
|
|
18
22
|
const smooth_zoom_1 = require("../helpers/smooth-zoom");
|
|
23
|
+
const studio_fit_padding_1 = require("../helpers/studio-fit-padding");
|
|
19
24
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
20
25
|
const canvas_ref_1 = require("../state/canvas-ref");
|
|
21
26
|
const editor_guides_1 = require("../state/editor-guides");
|
|
@@ -29,8 +34,10 @@ const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
|
|
|
29
34
|
const element_drag_and_drop_1 = require("./element-drag-and-drop");
|
|
30
35
|
const import_assets_1 = require("./import-assets");
|
|
31
36
|
const layout_1 = require("./layout");
|
|
37
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
32
38
|
const Preview_1 = require("./Preview");
|
|
33
39
|
const ResetZoomButton_1 = require("./ResetZoomButton");
|
|
40
|
+
const SvgImportDialog_1 = require("./SvgImportDialog");
|
|
34
41
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
35
42
|
const elementInstallCompositionIdStyle = {
|
|
36
43
|
fontFamily: 'monospace',
|
|
@@ -83,6 +90,17 @@ const resetZoom = {
|
|
|
83
90
|
right: layout_1.SPACING_UNIT * 2,
|
|
84
91
|
};
|
|
85
92
|
const ZOOM_PX_FACTOR = 0.003;
|
|
93
|
+
const calculateCanvasScale = ({ addFitPadding, canvasSize, compositionHeight, compositionWidth, previewSize, }) => {
|
|
94
|
+
const options = {
|
|
95
|
+
canvasSize,
|
|
96
|
+
compositionHeight,
|
|
97
|
+
compositionWidth,
|
|
98
|
+
previewSize,
|
|
99
|
+
};
|
|
100
|
+
return addFitPadding
|
|
101
|
+
? (0, studio_fit_padding_1.calculateStudioScale)(options)
|
|
102
|
+
: remotion_1.Internals.calculateScale(options);
|
|
103
|
+
};
|
|
86
104
|
const isFileDragEvent = (event) => {
|
|
87
105
|
var _a;
|
|
88
106
|
var _b;
|
|
@@ -174,11 +192,12 @@ const getSfxDragUrl = (event) => {
|
|
|
174
192
|
}
|
|
175
193
|
return null;
|
|
176
194
|
};
|
|
177
|
-
const getDropPosition = ({ clientX, clientY, contentDimensions, previewSize, size, }) => {
|
|
195
|
+
const getDropPosition = ({ addFitPadding, clientX, clientY, contentDimensions, previewSize, size, }) => {
|
|
178
196
|
if (contentDimensions === null || contentDimensions === 'none') {
|
|
179
197
|
return null;
|
|
180
198
|
}
|
|
181
|
-
const scale =
|
|
199
|
+
const scale = calculateCanvasScale({
|
|
200
|
+
addFitPadding,
|
|
182
201
|
canvasSize: size,
|
|
183
202
|
compositionHeight: contentDimensions.height,
|
|
184
203
|
compositionWidth: contentDimensions.width,
|
|
@@ -224,6 +243,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
224
243
|
const touchPinchRef = (0, react_1.useRef)(null);
|
|
225
244
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
226
245
|
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
246
|
+
const chooseSvgImportMode = (0, SvgImportDialog_1.useSvgImportDialog)();
|
|
227
247
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
228
248
|
const areRulersVisible = (0, use_is_ruler_visible_1.useIsRulerVisible)();
|
|
229
249
|
const { editorShowGuides } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
@@ -258,6 +278,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
258
278
|
currentCompositionId !== null &&
|
|
259
279
|
compositionFile !== null;
|
|
260
280
|
const canDropAssets = canInstallElements && !isAddingAsset;
|
|
281
|
+
const cannotAddSequence = (compositionComponentInfo === null || compositionComponentInfo === void 0 ? void 0 : compositionComponentInfo.canAddSequence) === false;
|
|
261
282
|
const contentDimensions = (0, react_1.useMemo)(() => {
|
|
262
283
|
if ((canvasContent.type === 'asset' ||
|
|
263
284
|
canvasContent.type === 'output' ||
|
|
@@ -272,6 +293,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
272
293
|
return null;
|
|
273
294
|
}, [assetResolution, config, canvasContent]);
|
|
274
295
|
const isFit = previewSize.size === 'auto';
|
|
296
|
+
const addFitPadding = canvasContent.type === 'composition';
|
|
275
297
|
previewSnapshotRef.current = {
|
|
276
298
|
previewSize,
|
|
277
299
|
canvasSize: size,
|
|
@@ -298,7 +320,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
298
320
|
}
|
|
299
321
|
ev.preventDefault();
|
|
300
322
|
setSize((prevSize) => {
|
|
301
|
-
const scale =
|
|
323
|
+
const scale = calculateCanvasScale({
|
|
324
|
+
addFitPadding,
|
|
302
325
|
canvasSize: size,
|
|
303
326
|
compositionHeight: contentDimensions.height,
|
|
304
327
|
compositionWidth: contentDimensions.width,
|
|
@@ -310,6 +333,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
310
333
|
const added = smoothened + ev.deltaY * ZOOM_PX_FACTOR;
|
|
311
334
|
const unsmoothened = (0, smooth_zoom_1.unsmoothenZoom)(added);
|
|
312
335
|
return (0, get_effective_translation_1.applyZoomAroundFocalPoint)({
|
|
336
|
+
addFitPadding,
|
|
313
337
|
canvasSize: size,
|
|
314
338
|
contentDimensions,
|
|
315
339
|
previewSizeBefore: prevSize,
|
|
@@ -340,7 +364,14 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
340
364
|
}),
|
|
341
365
|
};
|
|
342
366
|
});
|
|
343
|
-
}, [
|
|
367
|
+
}, [
|
|
368
|
+
addFitPadding,
|
|
369
|
+
editorZoomGestures,
|
|
370
|
+
contentDimensions,
|
|
371
|
+
isFit,
|
|
372
|
+
setSize,
|
|
373
|
+
size,
|
|
374
|
+
]);
|
|
344
375
|
(0, react_1.useEffect)(() => {
|
|
345
376
|
const { current } = canvas_ref_1.canvasRef;
|
|
346
377
|
if (!current) {
|
|
@@ -371,7 +402,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
371
402
|
}
|
|
372
403
|
e.preventDefault();
|
|
373
404
|
suppressWheelFromWebKitPinchRef.current = true;
|
|
374
|
-
const fitted =
|
|
405
|
+
const fitted = calculateCanvasScale({
|
|
406
|
+
addFitPadding,
|
|
375
407
|
canvasSize: canvasSz,
|
|
376
408
|
compositionHeight: cdim.height,
|
|
377
409
|
compositionWidth: cdim.width,
|
|
@@ -392,7 +424,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
392
424
|
const dimensions = cdim;
|
|
393
425
|
e.preventDefault();
|
|
394
426
|
setSize((prevSize) => {
|
|
395
|
-
const scale =
|
|
427
|
+
const scale = calculateCanvasScale({
|
|
428
|
+
addFitPadding,
|
|
396
429
|
canvasSize: canvasSz,
|
|
397
430
|
compositionHeight: dimensions.height,
|
|
398
431
|
compositionWidth: dimensions.width,
|
|
@@ -400,6 +433,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
400
433
|
});
|
|
401
434
|
const oldNumeric = prevSize.size === 'auto' ? scale : prevSize.size;
|
|
402
435
|
return (0, get_effective_translation_1.applyZoomAroundFocalPoint)({
|
|
436
|
+
addFitPadding,
|
|
403
437
|
canvasSize: canvasSz,
|
|
404
438
|
contentDimensions: dimensions,
|
|
405
439
|
previewSizeBefore: prevSize,
|
|
@@ -427,7 +461,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
427
461
|
current.removeEventListener('gestureend', onGestureEnd);
|
|
428
462
|
current.removeEventListener('gesturecancel', onGestureEnd);
|
|
429
463
|
};
|
|
430
|
-
}, [editorZoomGestures, setSize, supportsWebKitPinch]);
|
|
464
|
+
}, [addFitPadding, editorZoomGestures, setSize, supportsWebKitPinch]);
|
|
431
465
|
(0, react_1.useEffect)(() => {
|
|
432
466
|
const { current } = canvas_ref_1.canvasRef;
|
|
433
467
|
if (!current || !editorZoomGestures) {
|
|
@@ -449,7 +483,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
449
483
|
if (initialDistance < 1e-6) {
|
|
450
484
|
return;
|
|
451
485
|
}
|
|
452
|
-
const fitted =
|
|
486
|
+
const fitted = calculateCanvasScale({
|
|
487
|
+
addFitPadding,
|
|
453
488
|
canvasSize: snap.canvasSize,
|
|
454
489
|
compositionHeight: snap.contentDimensions.height,
|
|
455
490
|
compositionWidth: snap.contentDimensions.width,
|
|
@@ -477,7 +512,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
477
512
|
setSize((prevSize) => {
|
|
478
513
|
const canvasSz = snap.canvasSize;
|
|
479
514
|
const cdim = snap.contentDimensions;
|
|
480
|
-
const scale =
|
|
515
|
+
const scale = calculateCanvasScale({
|
|
516
|
+
addFitPadding,
|
|
481
517
|
canvasSize: canvasSz,
|
|
482
518
|
compositionHeight: cdim.height,
|
|
483
519
|
compositionWidth: cdim.width,
|
|
@@ -485,6 +521,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
485
521
|
});
|
|
486
522
|
const oldNumeric = prevSize.size === 'auto' ? scale : prevSize.size;
|
|
487
523
|
return (0, get_effective_translation_1.applyZoomAroundFocalPoint)({
|
|
524
|
+
addFitPadding,
|
|
488
525
|
canvasSize: canvasSz,
|
|
489
526
|
contentDimensions: cdim,
|
|
490
527
|
previewSizeBefore: prevSize,
|
|
@@ -510,7 +547,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
510
547
|
current.removeEventListener('touchend', onTouchEnd);
|
|
511
548
|
current.removeEventListener('touchcancel', onTouchEnd);
|
|
512
549
|
};
|
|
513
|
-
}, [editorZoomGestures, setSize]);
|
|
550
|
+
}, [addFitPadding, editorZoomGestures, setSize]);
|
|
514
551
|
const onReset = (0, react_1.useCallback)(() => {
|
|
515
552
|
setSize(() => {
|
|
516
553
|
return {
|
|
@@ -530,7 +567,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
530
567
|
return;
|
|
531
568
|
}
|
|
532
569
|
setSize((prevSize) => {
|
|
533
|
-
const scale =
|
|
570
|
+
const scale = calculateCanvasScale({
|
|
571
|
+
addFitPadding,
|
|
534
572
|
canvasSize: size,
|
|
535
573
|
compositionHeight: contentDimensions.height,
|
|
536
574
|
compositionWidth: contentDimensions.width,
|
|
@@ -544,7 +582,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
544
582
|
size: Math.min(smooth_zoom_1.MAX_ZOOM, scale * 2),
|
|
545
583
|
};
|
|
546
584
|
});
|
|
547
|
-
}, [contentDimensions, setSize, size]);
|
|
585
|
+
}, [addFitPadding, contentDimensions, setSize, size]);
|
|
548
586
|
const onZoomOut = (0, react_1.useCallback)(() => {
|
|
549
587
|
if (!contentDimensions || contentDimensions === 'none') {
|
|
550
588
|
return;
|
|
@@ -553,7 +591,8 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
553
591
|
return;
|
|
554
592
|
}
|
|
555
593
|
setSize((prevSize) => {
|
|
556
|
-
const scale =
|
|
594
|
+
const scale = calculateCanvasScale({
|
|
595
|
+
addFitPadding,
|
|
557
596
|
canvasSize: size,
|
|
558
597
|
compositionHeight: contentDimensions.height,
|
|
559
598
|
compositionWidth: contentDimensions.width,
|
|
@@ -567,7 +606,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
567
606
|
size: Math.max(smooth_zoom_1.MIN_ZOOM, scale / 2),
|
|
568
607
|
};
|
|
569
608
|
});
|
|
570
|
-
}, [contentDimensions, setSize, size]);
|
|
609
|
+
}, [addFitPadding, contentDimensions, setSize, size]);
|
|
571
610
|
(0, react_1.useEffect)(() => {
|
|
572
611
|
const resetBinding = keybindings.registerKeybinding({
|
|
573
612
|
event: 'keydown',
|
|
@@ -748,36 +787,46 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
748
787
|
};
|
|
749
788
|
}, [activeElementInstallRequest, confirm]);
|
|
750
789
|
const onDragOver = (0, react_1.useCallback)((event) => {
|
|
751
|
-
if (!
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
!isRemoteAssetDragEvent(event)) ||
|
|
790
|
+
if ((!isFileDragEvent(event) &&
|
|
791
|
+
!isAssetDragEvent(event) &&
|
|
792
|
+
!isCompositionDragEvent(event) &&
|
|
793
|
+
!isComponentDragEvent(event) &&
|
|
794
|
+
!isElementDragEvent(event) &&
|
|
795
|
+
!isSfxDragEvent(event) &&
|
|
796
|
+
!isRemoteAssetDragEvent(event)) ||
|
|
759
797
|
!isDragEventInsideCanvas(event)) {
|
|
760
798
|
return;
|
|
761
799
|
}
|
|
800
|
+
if (!canDropAssets && !cannotAddSequence) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
762
803
|
event.preventDefault();
|
|
763
804
|
if (event.dataTransfer) {
|
|
764
|
-
event.dataTransfer.dropEffect = 'copy';
|
|
805
|
+
event.dataTransfer.dropEffect = canDropAssets ? 'copy' : 'none';
|
|
765
806
|
}
|
|
766
|
-
}, [canDropAssets]);
|
|
807
|
+
}, [canDropAssets, cannotAddSequence]);
|
|
767
808
|
const onDrop = (0, react_1.useCallback)(async (event) => {
|
|
768
809
|
var _a;
|
|
769
810
|
var _b;
|
|
811
|
+
if ((!isFileDragEvent(event) &&
|
|
812
|
+
!isAssetDragEvent(event) &&
|
|
813
|
+
!isCompositionDragEvent(event) &&
|
|
814
|
+
!isComponentDragEvent(event) &&
|
|
815
|
+
!isElementDragEvent(event) &&
|
|
816
|
+
!isSfxDragEvent(event) &&
|
|
817
|
+
!isRemoteAssetDragEvent(event)) ||
|
|
818
|
+
!isDragEventInsideCanvas(event)) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
if (cannotAddSequence) {
|
|
822
|
+
event.preventDefault();
|
|
823
|
+
event.stopPropagation();
|
|
824
|
+
(0, NotificationCenter_1.showNotification)('Cannot insert items into this composition component', 3000);
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
770
827
|
if (!canDropAssets ||
|
|
771
828
|
compositionFile === null ||
|
|
772
|
-
currentCompositionId === null
|
|
773
|
-
(!isFileDragEvent(event) &&
|
|
774
|
-
!isAssetDragEvent(event) &&
|
|
775
|
-
!isCompositionDragEvent(event) &&
|
|
776
|
-
!isComponentDragEvent(event) &&
|
|
777
|
-
!isElementDragEvent(event) &&
|
|
778
|
-
!isSfxDragEvent(event) &&
|
|
779
|
-
!isRemoteAssetDragEvent(event)) ||
|
|
780
|
-
!isDragEventInsideCanvas(event)) {
|
|
829
|
+
currentCompositionId === null) {
|
|
781
830
|
return;
|
|
782
831
|
}
|
|
783
832
|
if (event.dataTransfer &&
|
|
@@ -790,6 +839,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
790
839
|
setIsAddingAsset(true);
|
|
791
840
|
try {
|
|
792
841
|
const dropPosition = getDropPosition({
|
|
842
|
+
addFitPadding,
|
|
793
843
|
clientX: event.clientX,
|
|
794
844
|
clientY: event.clientY,
|
|
795
845
|
contentDimensions,
|
|
@@ -801,11 +851,19 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
801
851
|
if (files.length === 0) {
|
|
802
852
|
return;
|
|
803
853
|
}
|
|
854
|
+
const svgImportMode = (0, import_assets_1.hasSvgFile)(files)
|
|
855
|
+
? await chooseSvgImportMode()
|
|
856
|
+
: 'image';
|
|
857
|
+
if (svgImportMode === null) {
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
804
860
|
await (0, import_assets_1.importAssets)({
|
|
805
861
|
files,
|
|
806
862
|
compositionFile,
|
|
807
863
|
compositionId: currentCompositionId,
|
|
864
|
+
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
808
865
|
dropPosition,
|
|
866
|
+
svgImportMode,
|
|
809
867
|
});
|
|
810
868
|
}
|
|
811
869
|
else if (isAssetDragEvent(event)) {
|
|
@@ -817,6 +875,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
817
875
|
assetPaths: [assetPath],
|
|
818
876
|
compositionFile,
|
|
819
877
|
compositionId: currentCompositionId,
|
|
878
|
+
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
820
879
|
dropPosition,
|
|
821
880
|
});
|
|
822
881
|
}
|
|
@@ -873,6 +932,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
873
932
|
url,
|
|
874
933
|
compositionFile,
|
|
875
934
|
compositionId: currentCompositionId,
|
|
935
|
+
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
876
936
|
dropPosition,
|
|
877
937
|
});
|
|
878
938
|
}
|
|
@@ -881,24 +941,122 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
881
941
|
setIsAddingAsset(false);
|
|
882
942
|
}
|
|
883
943
|
}, [
|
|
944
|
+
addFitPadding,
|
|
884
945
|
canDropAssets,
|
|
946
|
+
cannotAddSequence,
|
|
947
|
+
chooseSvgImportMode,
|
|
885
948
|
compositionFile,
|
|
886
949
|
contentDimensions,
|
|
887
950
|
currentCompositionId,
|
|
888
951
|
previewSize,
|
|
889
952
|
size,
|
|
890
953
|
]);
|
|
891
|
-
(0, react_1.
|
|
892
|
-
|
|
954
|
+
const onPaste = (0, react_1.useCallback)(async (event) => {
|
|
955
|
+
const { activeElement } = document;
|
|
956
|
+
if (!canDropAssets ||
|
|
957
|
+
compositionFile === null ||
|
|
958
|
+
currentCompositionId === null ||
|
|
959
|
+
event.clipboardData === null ||
|
|
960
|
+
activeElement instanceof HTMLInputElement ||
|
|
961
|
+
activeElement instanceof HTMLTextAreaElement ||
|
|
962
|
+
(activeElement instanceof HTMLElement &&
|
|
963
|
+
activeElement.isContentEditable)) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
const dropPosition = contentDimensions === null || contentDimensions === 'none'
|
|
967
|
+
? null
|
|
968
|
+
: {
|
|
969
|
+
centerX: contentDimensions.width / 2,
|
|
970
|
+
centerY: contentDimensions.height / 2,
|
|
971
|
+
};
|
|
972
|
+
const figmaHtml = (0, clipboard_figma_1.getClipboardFigmaHtml)(event.clipboardData);
|
|
973
|
+
if (figmaHtml !== null) {
|
|
974
|
+
event.preventDefault();
|
|
975
|
+
setIsAddingAsset(true);
|
|
976
|
+
try {
|
|
977
|
+
await (0, import_assets_1.importFigmaClipboard)({
|
|
978
|
+
compositionFile,
|
|
979
|
+
compositionId: currentCompositionId,
|
|
980
|
+
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
981
|
+
dropPosition,
|
|
982
|
+
html: figmaHtml,
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
finally {
|
|
986
|
+
setIsAddingAsset(false);
|
|
987
|
+
}
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const svgMarkup = (0, clipboard_svg_1.getClipboardSvgMarkup)(event.clipboardData);
|
|
991
|
+
if (svgMarkup !== null) {
|
|
992
|
+
event.preventDefault();
|
|
993
|
+
setIsAddingAsset(true);
|
|
994
|
+
try {
|
|
995
|
+
await (0, import_assets_1.insertSvgMarkup)({
|
|
996
|
+
compositionFile,
|
|
997
|
+
compositionId: currentCompositionId,
|
|
998
|
+
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
999
|
+
dropPosition,
|
|
1000
|
+
markup: svgMarkup,
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
finally {
|
|
1004
|
+
setIsAddingAsset(false);
|
|
1005
|
+
}
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
const files = (0, clipboard_images_1.getClipboardImageFiles)({
|
|
1009
|
+
clipboardData: event.clipboardData,
|
|
1010
|
+
existingFileNames: (0, get_static_files_1.getStaticFiles)().map((file) => file.name),
|
|
1011
|
+
});
|
|
1012
|
+
if (files.length === 0) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
event.preventDefault();
|
|
1016
|
+
const svgImportMode = (0, import_assets_1.hasSvgFile)(files)
|
|
1017
|
+
? await chooseSvgImportMode()
|
|
1018
|
+
: 'image';
|
|
1019
|
+
if (svgImportMode === null) {
|
|
893
1020
|
return;
|
|
894
1021
|
}
|
|
1022
|
+
setIsAddingAsset(true);
|
|
1023
|
+
try {
|
|
1024
|
+
await (0, import_assets_1.importAssets)({
|
|
1025
|
+
files,
|
|
1026
|
+
compositionFile,
|
|
1027
|
+
compositionId: currentCompositionId,
|
|
1028
|
+
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
1029
|
+
dropPosition,
|
|
1030
|
+
svgImportMode,
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
finally {
|
|
1034
|
+
setIsAddingAsset(false);
|
|
1035
|
+
}
|
|
1036
|
+
}, [
|
|
1037
|
+
canDropAssets,
|
|
1038
|
+
chooseSvgImportMode,
|
|
1039
|
+
compositionFile,
|
|
1040
|
+
contentDimensions,
|
|
1041
|
+
currentCompositionId,
|
|
1042
|
+
]);
|
|
1043
|
+
(0, react_1.useEffect)(() => {
|
|
895
1044
|
document.addEventListener('dragover', onDragOver, { capture: true });
|
|
896
1045
|
document.addEventListener('drop', onDrop, { capture: true });
|
|
897
1046
|
return () => {
|
|
898
1047
|
document.removeEventListener('dragover', onDragOver, { capture: true });
|
|
899
1048
|
document.removeEventListener('drop', onDrop, { capture: true });
|
|
900
1049
|
};
|
|
901
|
-
}, [
|
|
1050
|
+
}, [onDragOver, onDrop]);
|
|
1051
|
+
(0, react_1.useEffect)(() => {
|
|
1052
|
+
if (!canDropAssets ||
|
|
1053
|
+
!keybindings.isHighestContext ||
|
|
1054
|
+
(0, use_keybinding_1.areKeyboardShortcutsDisabled)()) {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
document.addEventListener('paste', onPaste);
|
|
1058
|
+
return () => document.removeEventListener('paste', onPaste);
|
|
1059
|
+
}, [canDropAssets, keybindings.isHighestContext, onPaste]);
|
|
902
1060
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
903
1061
|
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 }))] }));
|
|
904
1062
|
};
|
|
@@ -22,23 +22,25 @@ const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
|
22
22
|
const actions_1 = require("./RenderQueue/actions");
|
|
23
23
|
const SidebarRenderButton_1 = require("./SidebarRenderButton");
|
|
24
24
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
25
|
-
const COMPOSITION_ITEM_HEIGHT = 32;
|
|
26
25
|
const itemStyle = {
|
|
27
26
|
paddingRight: 10,
|
|
28
|
-
paddingTop:
|
|
29
|
-
paddingBottom:
|
|
27
|
+
paddingTop: 5,
|
|
28
|
+
paddingBottom: 5,
|
|
30
29
|
fontSize: 13,
|
|
31
30
|
display: 'flex',
|
|
32
31
|
textDecoration: 'none',
|
|
33
32
|
cursor: 'default',
|
|
34
33
|
alignItems: 'center',
|
|
35
34
|
marginBottom: 1,
|
|
35
|
+
marginLeft: 4,
|
|
36
|
+
marginRight: 4,
|
|
36
37
|
appearance: 'none',
|
|
37
38
|
border: 'none',
|
|
38
|
-
|
|
39
|
+
borderRadius: 4,
|
|
40
|
+
width: 'calc(100% - 8px)',
|
|
39
41
|
textAlign: 'left',
|
|
40
42
|
backgroundColor: colors_1.BACKGROUND,
|
|
41
|
-
height:
|
|
43
|
+
height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
|
|
42
44
|
userSelect: 'none',
|
|
43
45
|
};
|
|
44
46
|
const labelStyle = {
|
|
@@ -69,6 +71,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
69
71
|
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
70
72
|
setHovered(false);
|
|
71
73
|
}, []);
|
|
74
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
72
75
|
const [dragHovered, setDragHovered] = (0, react_1.useState)(false);
|
|
73
76
|
const compositionRowRef = (0, react_1.useRef)(null);
|
|
74
77
|
const compositionId = item.type === 'composition' ? item.composition.id : null;
|
|
@@ -170,12 +173,16 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
170
173
|
event.preventDefault();
|
|
171
174
|
return;
|
|
172
175
|
}
|
|
176
|
+
setIsDragging(true);
|
|
173
177
|
event.dataTransfer.effectAllowed = 'copyMove';
|
|
174
178
|
event.dataTransfer.setData(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE, JSON.stringify((0, studio_shared_1.makeCompositionDragData)({
|
|
175
179
|
compositionFile: (_a = resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) !== null && _a !== void 0 ? _a : null,
|
|
176
180
|
compositionId: item.composition.id,
|
|
177
181
|
})));
|
|
178
182
|
}, [item, resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source]);
|
|
183
|
+
const onCompositionDragEnd = (0, react_1.useCallback)(() => {
|
|
184
|
+
setIsDragging(false);
|
|
185
|
+
}, []);
|
|
179
186
|
const onFolderDragOver = (0, react_1.useCallback)((event) => {
|
|
180
187
|
if (item.type !== 'folder' ||
|
|
181
188
|
window.remotion_isReadOnlyStudio ||
|
|
@@ -253,13 +260,13 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
253
260
|
}, [clearRootDragHover, item, toggleFolder]);
|
|
254
261
|
if (item.type === 'folder') {
|
|
255
262
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
256
|
-
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", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, onDragOver: onFolderDragOver, onDragLeave: onFolderDragLeave, onDrop: onFolderDrop, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? colors_1.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 })
|
|
263
|
+
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", { style: style, className: "__remotion-composition-selector-item", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, onDragOver: onFolderDragOver, onDragLeave: onFolderDragLeave, onDrop: onFolderDrop, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? colors_1.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 })
|
|
257
264
|
] }) }) }), item.expanded ? (jsx_runtime_1.jsx("div", { onDragOver: onFolderChildListDragOver, onDrop: onFolderDrop, children: item.items.map((childItem) => {
|
|
258
265
|
return (jsx_runtime_1.jsx(exports.CompositionSelectorItem, { currentComposition: currentComposition, selectComposition: selectComposition, item: childItem, tabIndex: tabIndex, level: level + 1, toggleFolder: toggleFolder, clearRootDragHover: clearRootDragHover }, childItem.key + childItem.type));
|
|
259
266
|
}) })) : null] }));
|
|
260
267
|
}
|
|
261
|
-
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("a", { ref: compositionRowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, draggable: !window.remotion_isReadOnlyStudio, onDragStart: onCompositionDragStart, type: "button", title: item.composition.id, className: "__remotion-composition", "data-compname": item.composition.id, children: [
|
|
262
|
-
jsx_runtime_1.jsx(CompositionOrStillIcon_1.CompositionOrStillIcon, { composition: item.composition, color: hovered || selected ? colors_1.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.composition.id }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered }), jsx_runtime_1.jsx(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered, composition: item.composition })
|
|
268
|
+
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("a", { ref: compositionRowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, draggable: !window.remotion_isReadOnlyStudio, onDragStart: onCompositionDragStart, onDragEnd: onCompositionDragEnd, type: "button", title: item.composition.id, className: "__remotion-composition __remotion-composition-selector-item", "data-compname": item.composition.id, children: [
|
|
269
|
+
jsx_runtime_1.jsx(CompositionOrStillIcon_1.CompositionOrStillIcon, { composition: item.composition, color: hovered || selected ? colors_1.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.composition.id }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered && !isDragging }), jsx_runtime_1.jsx(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered && !isDragging, composition: item.composition })
|
|
263
270
|
] }) }) }));
|
|
264
271
|
};
|
|
265
272
|
exports.CompositionSelectorItem = CompositionSelectorItem;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { MediaMetadata } from '../helpers/use-media-metadata';
|
|
3
3
|
export declare const CURRENT_ASSET_HEIGHT = 84;
|
|
4
4
|
export declare const getCurrentAssetMetadataSource: (assetName: string | null) => string | null;
|
|
5
|
+
export declare const getCurrentAssetImageMetadataSource: (assetName: string | null) => string | null;
|
|
5
6
|
export declare const getCurrentAssetMediaDetailLines: (mediaMetadata: MediaMetadata) => string[];
|
|
6
7
|
export declare const AssetInfo: React.FC<{
|
|
7
8
|
readonly assetName: string | null;
|