@remotion/studio 4.0.485 → 4.0.486
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/ResolveCompositionConfigInStudio.js +42 -0
- package/dist/components/AssetSelector.js +1 -1
- package/dist/components/AssetSelectorItem.js +9 -9
- package/dist/components/AudioWaveform.js +3 -3
- package/dist/components/Button.js +2 -2
- package/dist/components/Canvas.js +28 -0
- package/dist/components/CanvasOrLoading.js +1 -1
- package/dist/components/CheckboardToggle.js +1 -1
- package/dist/components/Checkbox.js +3 -3
- package/dist/components/ColorPicker/AlphaSlider.js +4 -3
- package/dist/components/ColorPicker/ColorPicker.js +4 -4
- package/dist/components/ColorPicker/ColorPickerPopup.js +10 -10
- package/dist/components/ColorPicker/HueSlider.js +4 -3
- package/dist/components/ColorPicker/SaturationValueArea.js +5 -4
- package/dist/components/ColorPicker/checker.d.ts +1 -1
- package/dist/components/ColorPicker/checker.js +3 -3
- package/dist/components/CompactExplanation.js +3 -3
- package/dist/components/CompositionSelector.js +141 -5
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +103 -11
- package/dist/components/CopyButton.js +3 -2
- package/dist/components/CurrentAsset.d.ts +3 -1
- package/dist/components/CurrentAsset.js +15 -2
- package/dist/components/EffectPickerModal.js +1 -1
- package/dist/components/FilePreview.js +2 -1
- package/dist/components/FpsCounter.js +3 -2
- package/dist/components/FullscreenToggle.js +2 -1
- package/dist/components/GlobalKeybindings.js +0 -12
- package/dist/components/InlineAction.js +2 -2
- package/dist/components/InlineEditableTitle.d.ts +1 -0
- package/dist/components/InlineEditableTitle.js +12 -7
- package/dist/components/InspectorInfoHeader.js +2 -2
- package/dist/components/InspectorPanel/DefaultInspector.d.ts +1 -0
- package/dist/components/InspectorPanel/DefaultInspector.js +2 -2
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +1 -1
- package/dist/components/InspectorPanel/common.js +2 -2
- package/dist/components/InspectorPanel/styles.js +3 -3
- package/dist/components/InspectorPanel.d.ts +1 -0
- package/dist/components/InspectorPanel.js +2 -2
- package/dist/components/InspectorSequenceSection.js +1 -1
- package/dist/components/InstallablePackage.js +1 -1
- package/dist/components/KeyboardShortcutsExplainer.js +5 -5
- package/dist/components/LoopToggle.js +1 -1
- package/dist/components/Menu/MenuDivider.js +1 -1
- package/dist/components/Menu/MenuItem.js +1 -1
- package/dist/components/Menu/MenuSubItem.js +1 -1
- package/dist/components/Menu/styles.js +3 -3
- package/dist/components/MenuToolbar.js +2 -2
- package/dist/components/ModalButton.js +1 -1
- package/dist/components/ModalContainer.js +3 -3
- package/dist/components/ModalFooter.js +2 -1
- package/dist/components/ModalHeader.js +3 -2
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/CancelButton.js +4 -3
- package/dist/components/NewComposition/ComboBox.js +3 -3
- package/dist/components/NewComposition/InputDragger.js +11 -3
- package/dist/components/NewComposition/MenuContent.js +1 -1
- package/dist/components/NewComposition/NewComposition.js +4 -1
- package/dist/components/NewComposition/NewFolder.d.ts +5 -0
- package/dist/components/NewComposition/NewFolder.js +86 -0
- package/dist/components/NewComposition/RemInput.js +3 -3
- package/dist/components/NewComposition/RemTextarea.js +1 -1
- package/dist/components/NewComposition/RenameStaticFile.js +20 -59
- package/dist/components/NewComposition/ValidationMessage.js +1 -1
- package/dist/components/NewComposition/use-rename-static-file.d.ts +18 -0
- package/dist/components/NewComposition/use-rename-static-file.js +90 -0
- package/dist/components/NoRegisterRoot.js +3 -2
- package/dist/components/Notifications/ColorDot.js +3 -2
- package/dist/components/Notifications/Notification.js +4 -4
- package/dist/components/Notifications/NotificationCenter.js +2 -1
- package/dist/components/Notifications/ServerDisconnected.js +5 -4
- package/dist/components/OptionsPanel.js +1 -1
- package/dist/components/OutlineToggle.js +1 -1
- package/dist/components/PlayPause.js +4 -3
- package/dist/components/PreviewToolbar.js +1 -1
- package/dist/components/QuickSwitcher/AlgoliaCredit.js +2 -1
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -1
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +2 -2
- package/dist/components/RefreshCompositionOverlay.js +2 -1
- package/dist/components/RenderButton.js +9 -9
- package/dist/components/RenderModal/CliCopyButton.js +1 -1
- package/dist/components/RenderModal/ClientRenderProgress.js +1 -1
- package/dist/components/RenderModal/DataEditor.js +1 -1
- package/dist/components/RenderModal/GuiRenderStatus.js +1 -1
- package/dist/components/RenderModal/InfoBubble.js +2 -2
- package/dist/components/RenderModal/InfoTooltip.js +3 -3
- package/dist/components/RenderModal/InlineEyeIcon.js +2 -1
- package/dist/components/RenderModal/InlineRemoveButton.js +2 -1
- package/dist/components/RenderModal/MultiRangeSlider.js +1 -1
- package/dist/components/RenderModal/OptionExplainer.js +2 -2
- package/dist/components/RenderModal/RenderModalHr.js +2 -1
- package/dist/components/RenderModal/RenderStatusModal.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaResetButton.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaVerticalGuide.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +2 -1
- package/dist/components/RenderModal/ServerRenderModal.js +1 -1
- package/dist/components/RenderModal/WarningIndicatorButton.js +4 -6
- package/dist/components/RenderModal/WebRenderModalAudio.js +4 -3
- package/dist/components/RenderModal/WebRenderModalLicense.js +2 -2
- package/dist/components/RenderModal/WebRenderModalPicture.js +2 -1
- package/dist/components/RenderModal/render-modals.js +3 -3
- package/dist/components/RenderPreview.js +1 -1
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +2 -1
- package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -1
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +2 -1
- package/dist/components/RenderQueue/RenderQueueItemStatus.js +1 -1
- package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +2 -1
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +2 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +2 -1
- package/dist/components/RenderQueue/index.js +1 -1
- package/dist/components/RendersTab.js +2 -2
- package/dist/components/SegmentedControl.js +3 -3
- package/dist/components/SelectedOutlineElement.d.ts +5 -0
- package/dist/components/SelectedOutlineElement.js +7 -7
- package/dist/components/SelectedOutlineOverlay.js +1 -1
- package/dist/components/SelectedOutlineUvControls.js +5 -5
- package/dist/components/SidebarCollapserControls.js +5 -4
- package/dist/components/Splitter/SplitterElement.js +2 -1
- package/dist/components/StaticFilePreview.js +1 -1
- package/dist/components/Tabs/index.js +3 -3
- package/dist/components/Tabs/vertical.js +3 -3
- package/dist/components/TextViewer.js +2 -1
- package/dist/components/TimeValue.js +1 -1
- package/dist/components/Timeline/EasingEditorModal.js +8 -8
- package/dist/components/Timeline/KeyframeSettingsModal.js +1 -1
- package/dist/components/Timeline/LoopedIndicator.js +2 -2
- package/dist/components/Timeline/MaxTimelineTracks.js +3 -2
- package/dist/components/Timeline/TimelineArrayField.js +6 -5
- package/dist/components/Timeline/TimelineColorField.js +2 -1
- package/dist/components/Timeline/TimelineEffectItem.js +3 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +2 -2
- package/dist/components/Timeline/TimelineExpandArrowButton.js +3 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +2 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +1 -1
- package/dist/components/Timeline/TimelineFieldLabel.js +2 -1
- package/dist/components/Timeline/TimelineFontFamilyField.d.ts +11 -0
- package/dist/components/Timeline/TimelineFontFamilyField.js +545 -0
- package/dist/components/Timeline/TimelineImageInfo.js +2 -1
- package/dist/components/Timeline/TimelineInOutPointer.js +2 -1
- package/dist/components/Timeline/TimelineInOutPointerHandle.js +2 -4
- package/dist/components/Timeline/TimelineKeyframeControls.js +2 -2
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +1 -1
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +1 -1
- package/dist/components/Timeline/TimelineLayerEye.js +3 -3
- package/dist/components/Timeline/TimelineMediaInfo.js +2 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +4 -0
- package/dist/components/Timeline/TimelineRotationField.js +4 -3
- package/dist/components/Timeline/TimelineScaleField.js +1 -1
- package/dist/components/Timeline/TimelineSchemaField.d.ts +2 -0
- package/dist/components/Timeline/TimelineSchemaField.js +47 -7
- package/dist/components/Timeline/TimelineScrollable.js +3 -2
- package/dist/components/Timeline/TimelineSelection.js +6 -6
- package/dist/components/Timeline/TimelineSequence.js +17 -20
- package/dist/components/Timeline/TimelineSequenceFrame.js +3 -2
- package/dist/components/Timeline/TimelineSequenceItem.js +8 -7
- package/dist/components/Timeline/TimelineSequenceName.js +3 -2
- package/dist/components/Timeline/TimelineSequencePropItem.js +2 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +20 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +128 -11
- package/dist/components/Timeline/TimelineSlider.js +2 -1
- package/dist/components/Timeline/TimelineSliderHandle.js +2 -1
- package/dist/components/Timeline/TimelineTimeIndicators.js +1 -1
- package/dist/components/Timeline/TimelineVideoInfo.js +2 -1
- package/dist/components/Timeline/TimelineZoomControls.js +4 -3
- package/dist/components/Timeline/call-move-keyframe.d.ts +5 -0
- package/dist/components/Timeline/call-move-keyframe.js +14 -3
- package/dist/components/Timeline/google-fonts-list.d.ts +6 -0
- package/dist/components/Timeline/google-fonts-list.js +1512 -0
- package/dist/components/Timeline/save-sequence-prop.d.ts +8 -1
- package/dist/components/Timeline/save-sequence-prop.js +63 -19
- package/dist/components/Timeline/timeline-rotation-field-utils.d.ts +5 -0
- package/dist/components/Timeline/timeline-rotation-field-utils.js +16 -0
- package/dist/components/Timeline/timeline-scroll-logic.js +5 -2
- package/dist/components/TimelineInOutToggle.js +1 -1
- package/dist/components/UpdateCheck.js +2 -2
- package/dist/components/UpdateModal/OpenIssueButton.js +1 -1
- package/dist/components/VisualControls/ClickableFileName.js +2 -2
- package/dist/components/effect-drag-and-drop.js +1 -0
- package/dist/components/import-assets.d.ts +7 -1
- package/dist/components/import-assets.js +55 -1
- package/dist/components/selected-outline-measurement.js +2 -1
- package/dist/error-overlay/remotion-overlay/CalculateMetadataErrorExplainer.js +2 -2
- package/dist/error-overlay/remotion-overlay/CodeFrame.js +7 -5
- package/dist/error-overlay/remotion-overlay/CompositionIdListItem.js +2 -2
- package/dist/error-overlay/remotion-overlay/DismissButton.js +3 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +3 -2
- package/dist/error-overlay/remotion-overlay/ErrorMessage.js +4 -4
- package/dist/error-overlay/remotion-overlay/HelpLink.js +1 -1
- package/dist/error-overlay/remotion-overlay/MediaPlaybackErrorExplainer.js +4 -4
- package/dist/error-overlay/remotion-overlay/Overlay.js +3 -2
- package/dist/error-overlay/remotion-overlay/StackFrame.js +4 -3
- package/dist/error-overlay/remotion-overlay/Symbolicating.js +2 -1
- package/dist/error-overlay/remotion-overlay/carets.js +3 -2
- package/dist/esm/{chunk-103pp4n7.js → chunk-975rp13y.js} +9143 -6061
- package/dist/esm/chunk-jefhcs5z.js +164 -0
- package/dist/esm/internals.mjs +9144 -6028
- package/dist/esm/previewEntry.mjs +8335 -5215
- package/dist/esm/renderEntry.mjs +8 -5
- package/dist/helpers/checkerboard-background.js +4 -12
- package/dist/helpers/colors.d.ts +99 -7
- package/dist/helpers/colors.js +118 -10
- package/dist/helpers/inject-css.js +85 -83
- package/dist/helpers/timeline-layout.d.ts +4 -2
- package/dist/helpers/use-menu-structure.js +31 -3
- package/dist/helpers/validate-folder-rename.js +2 -10
- package/dist/helpers/validate-new-folder-name.d.ts +5 -0
- package/dist/helpers/validate-new-folder-name.js +16 -0
- package/dist/hot-middleware-client/client.js +3 -2
- package/dist/icons/Checkmark.js +2 -1
- package/dist/icons/audio.js +2 -1
- package/dist/icons/caret.js +2 -2
- package/dist/icons/certificate.js +2 -1
- package/dist/icons/data.js +2 -1
- package/dist/icons/eyedropper.js +2 -1
- package/dist/icons/file.js +2 -1
- package/dist/icons/frame.js +2 -1
- package/dist/icons/gear.js +2 -1
- package/dist/icons/gif.js +2 -1
- package/dist/icons/jump-to-start.js +2 -1
- package/dist/icons/keys.js +4 -3
- package/dist/icons/media-volume.js +1 -1
- package/dist/icons/minus.js +2 -1
- package/dist/icons/pause.js +2 -1
- package/dist/icons/play.js +2 -1
- package/dist/icons/redo.js +2 -1
- package/dist/icons/step-back.js +2 -1
- package/dist/icons/step-forward.js +2 -1
- package/dist/icons/undo.js +2 -1
- package/dist/previewEntry.js +2 -1
- package/dist/renderEntry.js +4 -3
- package/dist/state/modals.d.ts +4 -0
- package/package.json +11 -11
- package/dist/esm/chunk-6jf1natv.js +0 -25
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompositionSelector = exports.useCompositionNavigation = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const remotion_1 = require("remotion");
|
|
7
8
|
const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
|
|
@@ -14,6 +15,8 @@ const modals_1 = require("../state/modals");
|
|
|
14
15
|
const z_index_1 = require("../state/z-index");
|
|
15
16
|
const CompositionSelectorItem_1 = require("./CompositionSelectorItem");
|
|
16
17
|
const InitialCompositionLoader_1 = require("./InitialCompositionLoader");
|
|
18
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
19
|
+
const actions_1 = require("./RenderQueue/actions");
|
|
17
20
|
const useCompositionNavigation = () => {
|
|
18
21
|
const { compositions, canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
19
22
|
const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
|
|
@@ -60,10 +63,10 @@ const container = {
|
|
|
60
63
|
};
|
|
61
64
|
const quickSwitcherArea = {
|
|
62
65
|
padding: '4px 12px',
|
|
63
|
-
borderBottom: `1px solid ${colors_1.
|
|
66
|
+
borderBottom: `1px solid ${colors_1.BLACK_HEX}`,
|
|
64
67
|
};
|
|
65
68
|
const quickSwitcherTrigger = {
|
|
66
|
-
backgroundColor:
|
|
69
|
+
backgroundColor: colors_1.WHITE_ALPHA_06,
|
|
67
70
|
borderRadius: 5,
|
|
68
71
|
padding: '4px 10px',
|
|
69
72
|
color: colors_1.LIGHT_TEXT,
|
|
@@ -80,10 +83,34 @@ const shortcutLabel = {
|
|
|
80
83
|
fontSize: 11,
|
|
81
84
|
opacity: 0.6,
|
|
82
85
|
};
|
|
86
|
+
const autoScrollThreshold = 70;
|
|
87
|
+
const maxAutoScrollSpeed = 18;
|
|
88
|
+
const getAutoScrollSpeed = ({ clientY, element, }) => {
|
|
89
|
+
const { top, bottom } = element.getBoundingClientRect();
|
|
90
|
+
const threshold = Math.min(autoScrollThreshold, element.clientHeight / 2);
|
|
91
|
+
if (threshold <= 0) {
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
const distanceToTop = clientY - top;
|
|
95
|
+
const distanceToBottom = bottom - clientY;
|
|
96
|
+
if (distanceToTop < threshold) {
|
|
97
|
+
const progress = Math.min(1, (threshold - distanceToTop) / threshold);
|
|
98
|
+
return -Math.ceil(progress * maxAutoScrollSpeed);
|
|
99
|
+
}
|
|
100
|
+
if (distanceToBottom < threshold) {
|
|
101
|
+
const progress = Math.min(1, (threshold - distanceToBottom) / threshold);
|
|
102
|
+
return Math.ceil(progress * maxAutoScrollSpeed);
|
|
103
|
+
}
|
|
104
|
+
return 0;
|
|
105
|
+
};
|
|
83
106
|
const CompositionSelector = () => {
|
|
84
107
|
const { compositions, canvasContent, folders } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
85
108
|
const { foldersExpanded } = (0, react_1.useContext)(persist_open_folders_1.ExpandedFoldersContext);
|
|
86
109
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
110
|
+
const [rootDragHovered, setRootDragHovered] = (0, react_1.useState)(false);
|
|
111
|
+
const listRef = (0, react_1.useRef)(null);
|
|
112
|
+
const autoScrollAnimation = (0, react_1.useRef)(null);
|
|
113
|
+
const autoScrollSpeed = (0, react_1.useRef)(0);
|
|
87
114
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
88
115
|
const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
|
|
89
116
|
const sortedCompositions = (0, react_1.useMemo)(() => {
|
|
@@ -99,8 +126,9 @@ const CompositionSelector = () => {
|
|
|
99
126
|
return {
|
|
100
127
|
flex: 1,
|
|
101
128
|
overflowY: 'auto',
|
|
129
|
+
backgroundColor: rootDragHovered ? colors_1.WHITE_ALPHA_12 : colors_1.BACKGROUND,
|
|
102
130
|
};
|
|
103
|
-
}, []);
|
|
131
|
+
}, [rootDragHovered]);
|
|
104
132
|
const toggleFolder = (0, react_1.useCallback)((folderName, parentName) => {
|
|
105
133
|
var _a;
|
|
106
134
|
(_a = remotion_1.Internals.compositionSelectorRef.current) === null || _a === void 0 ? void 0 : _a.toggleFolder(folderName, parentName);
|
|
@@ -112,11 +140,119 @@ const CompositionSelector = () => {
|
|
|
112
140
|
invocationTimestamp: Date.now(),
|
|
113
141
|
});
|
|
114
142
|
}, [setSelectedModal]);
|
|
143
|
+
const clearRootDragHover = (0, react_1.useCallback)(() => {
|
|
144
|
+
setRootDragHovered(false);
|
|
145
|
+
}, []);
|
|
146
|
+
const stopCompositionListAutoScroll = (0, react_1.useCallback)(() => {
|
|
147
|
+
autoScrollSpeed.current = 0;
|
|
148
|
+
if (autoScrollAnimation.current !== null) {
|
|
149
|
+
cancelAnimationFrame(autoScrollAnimation.current);
|
|
150
|
+
autoScrollAnimation.current = null;
|
|
151
|
+
}
|
|
152
|
+
}, []);
|
|
153
|
+
const runCompositionListAutoScroll = (0, react_1.useCallback)(() => {
|
|
154
|
+
const listElement = listRef.current;
|
|
155
|
+
const speed = autoScrollSpeed.current;
|
|
156
|
+
if (listElement === null || speed === 0) {
|
|
157
|
+
autoScrollAnimation.current = null;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const scrollTopBefore = listElement.scrollTop;
|
|
161
|
+
listElement.scrollTop += speed;
|
|
162
|
+
if (listElement.scrollTop === scrollTopBefore) {
|
|
163
|
+
autoScrollAnimation.current = null;
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
autoScrollAnimation.current = requestAnimationFrame(runCompositionListAutoScroll);
|
|
167
|
+
}, []);
|
|
168
|
+
const setCompositionListAutoScrollSpeed = (0, react_1.useCallback)((speed) => {
|
|
169
|
+
if (speed === 0) {
|
|
170
|
+
stopCompositionListAutoScroll();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
autoScrollSpeed.current = speed;
|
|
174
|
+
if (autoScrollAnimation.current === null) {
|
|
175
|
+
autoScrollAnimation.current = requestAnimationFrame(runCompositionListAutoScroll);
|
|
176
|
+
}
|
|
177
|
+
}, [runCompositionListAutoScroll, stopCompositionListAutoScroll]);
|
|
178
|
+
const onCompositionListDragOverCapture = (0, react_1.useCallback)((event) => {
|
|
179
|
+
if (window.remotion_isReadOnlyStudio ||
|
|
180
|
+
!Array.from(event.dataTransfer.types).includes(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE)) {
|
|
181
|
+
stopCompositionListAutoScroll();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const listElement = listRef.current;
|
|
185
|
+
if (listElement === null) {
|
|
186
|
+
stopCompositionListAutoScroll();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
setCompositionListAutoScrollSpeed(getAutoScrollSpeed({ clientY: event.clientY, element: listElement }));
|
|
190
|
+
}, [setCompositionListAutoScrollSpeed, stopCompositionListAutoScroll]);
|
|
191
|
+
(0, react_1.useEffect)(() => {
|
|
192
|
+
return stopCompositionListAutoScroll;
|
|
193
|
+
}, [stopCompositionListAutoScroll]);
|
|
194
|
+
const onRootDragOver = (0, react_1.useCallback)((event) => {
|
|
195
|
+
if (window.remotion_isReadOnlyStudio ||
|
|
196
|
+
!Array.from(event.dataTransfer.types).includes(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
event.dataTransfer.dropEffect = 'move';
|
|
201
|
+
setRootDragHovered(true);
|
|
202
|
+
}, []);
|
|
203
|
+
const onRootDragLeave = (0, react_1.useCallback)((event) => {
|
|
204
|
+
const { relatedTarget } = event;
|
|
205
|
+
if (relatedTarget instanceof Node &&
|
|
206
|
+
event.currentTarget.contains(relatedTarget)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
stopCompositionListAutoScroll();
|
|
210
|
+
setRootDragHovered(false);
|
|
211
|
+
}, [stopCompositionListAutoScroll]);
|
|
212
|
+
const onRootDrop = (0, react_1.useCallback)(async (event) => {
|
|
213
|
+
if (window.remotion_isReadOnlyStudio) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const raw = event.dataTransfer.getData(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE);
|
|
217
|
+
const parsed = raw ? (0, studio_shared_1.parseCompositionDragData)(raw) : null;
|
|
218
|
+
if (parsed === null) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
event.stopPropagation();
|
|
223
|
+
stopCompositionListAutoScroll();
|
|
224
|
+
setRootDragHovered(false);
|
|
225
|
+
const composition = compositions.find((c) => c.id === parsed.compositionId);
|
|
226
|
+
if (!composition || composition.folderName === null) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const notification = (0, NotificationCenter_1.showNotification)(`Moving ${parsed.compositionId}...`, null);
|
|
230
|
+
const controller = new AbortController();
|
|
231
|
+
try {
|
|
232
|
+
const result = await (0, actions_1.applyCodemod)({
|
|
233
|
+
codemod: {
|
|
234
|
+
type: 'move-composition-to-folder',
|
|
235
|
+
idToMove: parsed.compositionId,
|
|
236
|
+
folderName: null,
|
|
237
|
+
parentName: null,
|
|
238
|
+
},
|
|
239
|
+
dryRun: false,
|
|
240
|
+
signal: controller.signal,
|
|
241
|
+
symbolicatedStack: null,
|
|
242
|
+
});
|
|
243
|
+
notification.replaceContent(result.success
|
|
244
|
+
? `Moved ${parsed.compositionId} outside of folder`
|
|
245
|
+
: result.reason, result.success ? 2000 : 4000);
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
notification.replaceContent(err instanceof Error ? err.message : String(err), 4000);
|
|
249
|
+
}
|
|
250
|
+
}, [compositions, stopCompositionListAutoScroll]);
|
|
115
251
|
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
116
|
-
jsx_runtime_1.jsx("div", { style: quickSwitcherArea, children: jsx_runtime_1.jsxs("button", { type: "button", style: quickSwitcherTrigger, onClick: openQuickSwitcher, tabIndex: tabIndex, children: ["Search...", (0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? null : (jsx_runtime_1.jsxs("span", { style: shortcutLabel, children: [ShortcutHint_1.cmdOrCtrlCharacter, "+K"] }))] }) }), jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: list, children: items.map((c) => {
|
|
252
|
+
jsx_runtime_1.jsx("div", { style: quickSwitcherArea, children: jsx_runtime_1.jsxs("button", { type: "button", style: quickSwitcherTrigger, onClick: openQuickSwitcher, tabIndex: tabIndex, children: ["Search...", (0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? null : (jsx_runtime_1.jsxs("span", { style: shortcutLabel, children: [ShortcutHint_1.cmdOrCtrlCharacter, "+K"] }))] }) }), jsx_runtime_1.jsx("div", { ref: listRef, className: "__remotion-vertical-scrollbar", style: list, onDragOverCapture: onCompositionListDragOverCapture, onDragEndCapture: stopCompositionListAutoScroll, onDragOver: onRootDragOver, onDragLeave: onRootDragLeave, onDropCapture: stopCompositionListAutoScroll, onDrop: onRootDrop, children: items.map((c) => {
|
|
117
253
|
return (jsx_runtime_1.jsx(CompositionSelectorItem_1.CompositionSelectorItem, { level: 0, currentComposition: canvasContent && canvasContent.type === 'composition'
|
|
118
254
|
? canvasContent.compositionId
|
|
119
|
-
: null, selectComposition: selectComposition, toggleFolder: toggleFolder, tabIndex: tabIndex, item: c }, c.key + c.type));
|
|
255
|
+
: null, selectComposition: selectComposition, toggleFolder: toggleFolder, clearRootDragHover: clearRootDragHover, tabIndex: tabIndex, item: c }, c.key + c.type));
|
|
120
256
|
}) })
|
|
121
257
|
] }));
|
|
122
258
|
};
|
|
@@ -19,5 +19,6 @@ export declare const CompositionSelectorItem: React.FC<{
|
|
|
19
19
|
readonly tabIndex: number;
|
|
20
20
|
readonly selectComposition: (c: _InternalTypes['AnyComposition'], push: boolean) => void;
|
|
21
21
|
readonly toggleFolder: (folderName: string, parentName: string | null) => void;
|
|
22
|
+
readonly clearRootDragHover: () => void;
|
|
22
23
|
readonly level: number;
|
|
23
24
|
}>;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CompositionSelectorItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const client_id_1 = require("../helpers/client-id");
|
|
7
8
|
const colors_1 = require("../helpers/colors");
|
|
9
|
+
const get_folder_id_1 = require("../helpers/get-folder-id");
|
|
8
10
|
const is_composition_still_1 = require("../helpers/is-composition-still");
|
|
9
11
|
const noop_1 = require("../helpers/noop");
|
|
10
12
|
const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
|
|
@@ -17,6 +19,8 @@ const CompositionContextButton_1 = require("./CompositionContextButton");
|
|
|
17
19
|
const ContextMenu_1 = require("./ContextMenu");
|
|
18
20
|
const folder_menu_items_1 = require("./folder-menu-items");
|
|
19
21
|
const layout_1 = require("./layout");
|
|
22
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
23
|
+
const actions_1 = require("./RenderQueue/actions");
|
|
20
24
|
const SidebarRenderButton_1 = require("./SidebarRenderButton");
|
|
21
25
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
22
26
|
const COMPOSITION_ITEM_HEIGHT = 32;
|
|
@@ -52,7 +56,7 @@ const iconStyle = {
|
|
|
52
56
|
height: 18,
|
|
53
57
|
flexShrink: 0,
|
|
54
58
|
};
|
|
55
|
-
const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, selectComposition, toggleFolder, }) => {
|
|
59
|
+
const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, selectComposition, toggleFolder, clearRootDragHover, }) => {
|
|
56
60
|
const selected = (0, react_1.useMemo)(() => {
|
|
57
61
|
if (item.type === 'composition') {
|
|
58
62
|
return currentComposition === item.composition.id;
|
|
@@ -66,6 +70,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
66
70
|
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
67
71
|
setHovered(false);
|
|
68
72
|
}, []);
|
|
73
|
+
const [dragHovered, setDragHovered] = (0, react_1.useState)(false);
|
|
69
74
|
const compositionRowRef = (0, react_1.useRef)(null);
|
|
70
75
|
const compositionId = item.type === 'composition' ? item.composition.id : null;
|
|
71
76
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -81,14 +86,16 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
81
86
|
const style = (0, react_1.useMemo)(() => {
|
|
82
87
|
return {
|
|
83
88
|
...itemStyle,
|
|
84
|
-
backgroundColor:
|
|
89
|
+
backgroundColor: dragHovered
|
|
90
|
+
? colors_1.WHITE_ALPHA_12
|
|
91
|
+
: (0, colors_1.getBackgroundFromHoverState)({ hovered, selected }),
|
|
85
92
|
paddingLeft: 12 + level * 8,
|
|
86
93
|
};
|
|
87
|
-
}, [hovered, level, selected]);
|
|
94
|
+
}, [dragHovered, hovered, level, selected]);
|
|
88
95
|
const label = (0, react_1.useMemo)(() => {
|
|
89
96
|
return {
|
|
90
97
|
...labelStyle,
|
|
91
|
-
color: selected || hovered ?
|
|
98
|
+
color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT,
|
|
92
99
|
};
|
|
93
100
|
}, [hovered, selected]);
|
|
94
101
|
const onClick = (0, react_1.useCallback)((evt) => {
|
|
@@ -130,16 +137,101 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
130
137
|
readOnlyStudio: window.remotion_isReadOnlyStudio,
|
|
131
138
|
});
|
|
132
139
|
}, [connectionStatus, item, resolvedLocation, setSelectedModal]);
|
|
140
|
+
const onCompositionDragStart = (0, react_1.useCallback)((event) => {
|
|
141
|
+
var _a;
|
|
142
|
+
if (item.type !== 'composition' || window.remotion_isReadOnlyStudio) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
event.dataTransfer.effectAllowed = 'copyMove';
|
|
147
|
+
event.dataTransfer.setData(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE, JSON.stringify((0, studio_shared_1.makeCompositionDragData)({
|
|
148
|
+
compositionFile: (_a = resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) !== null && _a !== void 0 ? _a : null,
|
|
149
|
+
compositionId: item.composition.id,
|
|
150
|
+
})));
|
|
151
|
+
}, [item, resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source]);
|
|
152
|
+
const onFolderDragOver = (0, react_1.useCallback)((event) => {
|
|
153
|
+
if (item.type !== 'folder' ||
|
|
154
|
+
window.remotion_isReadOnlyStudio ||
|
|
155
|
+
!Array.from(event.dataTransfer.types).includes(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
event.dataTransfer.dropEffect = 'move';
|
|
161
|
+
clearRootDragHover();
|
|
162
|
+
setDragHovered(true);
|
|
163
|
+
}, [clearRootDragHover, item]);
|
|
164
|
+
const onFolderDragLeave = (0, react_1.useCallback)(() => {
|
|
165
|
+
setDragHovered(false);
|
|
166
|
+
}, []);
|
|
167
|
+
const onFolderChildListDragOver = (0, react_1.useCallback)((event) => {
|
|
168
|
+
if (item.type !== 'folder' ||
|
|
169
|
+
window.remotion_isReadOnlyStudio ||
|
|
170
|
+
!Array.from(event.dataTransfer.types).includes(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
event.stopPropagation();
|
|
175
|
+
event.dataTransfer.dropEffect = 'move';
|
|
176
|
+
clearRootDragHover();
|
|
177
|
+
}, [clearRootDragHover, item]);
|
|
178
|
+
const onFolderDrop = (0, react_1.useCallback)(async (event) => {
|
|
179
|
+
if (item.type !== 'folder' || window.remotion_isReadOnlyStudio) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const raw = event.dataTransfer.getData(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE);
|
|
183
|
+
const parsed = raw ? (0, studio_shared_1.parseCompositionDragData)(raw) : null;
|
|
184
|
+
if (parsed === null) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
event.stopPropagation();
|
|
189
|
+
clearRootDragHover();
|
|
190
|
+
setDragHovered(false);
|
|
191
|
+
const isAlreadyDirectChild = item.items.some((child) => {
|
|
192
|
+
return (child.type === 'composition' &&
|
|
193
|
+
child.composition.id === parsed.compositionId);
|
|
194
|
+
});
|
|
195
|
+
if (isAlreadyDirectChild) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const folderId = (0, get_folder_id_1.getFolderId)({
|
|
199
|
+
folderName: item.folderName,
|
|
200
|
+
parentName: item.parentName,
|
|
201
|
+
});
|
|
202
|
+
const notification = (0, NotificationCenter_1.showNotification)(`Moving ${parsed.compositionId}...`, null);
|
|
203
|
+
const controller = new AbortController();
|
|
204
|
+
try {
|
|
205
|
+
const result = await (0, actions_1.applyCodemod)({
|
|
206
|
+
codemod: {
|
|
207
|
+
type: 'move-composition-to-folder',
|
|
208
|
+
idToMove: parsed.compositionId,
|
|
209
|
+
folderName: item.folderName,
|
|
210
|
+
parentName: item.parentName,
|
|
211
|
+
},
|
|
212
|
+
dryRun: false,
|
|
213
|
+
signal: controller.signal,
|
|
214
|
+
symbolicatedStack: null,
|
|
215
|
+
});
|
|
216
|
+
notification.replaceContent(result.success
|
|
217
|
+
? `Moved ${parsed.compositionId} to ${folderId}`
|
|
218
|
+
: result.reason, result.success ? 2000 : 4000);
|
|
219
|
+
if (result.success && !item.expanded) {
|
|
220
|
+
toggleFolder(item.folderName, item.parentName);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
notification.replaceContent(err instanceof Error ? err.message : String(err), 4000);
|
|
225
|
+
}
|
|
226
|
+
}, [clearRootDragHover, item, toggleFolder]);
|
|
133
227
|
if (item.type === 'folder') {
|
|
134
228
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
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("div", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ?
|
|
136
|
-
] }) }) }), item.expanded
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
140
|
-
: null] }));
|
|
229
|
+
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 })
|
|
230
|
+
] }) }) }), item.expanded ? (jsx_runtime_1.jsx("div", { onDragOver: onFolderChildListDragOver, onDrop: onFolderDrop, children: item.items.map((childItem) => {
|
|
231
|
+
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));
|
|
232
|
+
}) })) : null] }));
|
|
141
233
|
}
|
|
142
|
-
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, type: "button", title: item.composition.id, className: "__remotion-composition", "data-compname": item.composition.id, children: [(0, is_composition_still_1.isCompositionStill)(item.composition) ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: hovered || selected ?
|
|
234
|
+
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: [(0, is_composition_still_1.isCompositionStill)(item.composition) ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { 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 })
|
|
143
235
|
] }) }) }));
|
|
144
236
|
};
|
|
145
237
|
exports.CompositionSelectorItem = CompositionSelectorItem;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CopyButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../helpers/colors");
|
|
6
7
|
const copy_text_1 = require("../helpers/copy-text");
|
|
7
8
|
const Button_1 = require("./Button");
|
|
8
9
|
const layout_1 = require("./layout");
|
|
@@ -10,13 +11,13 @@ const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
|
10
11
|
const iconStyle = {
|
|
11
12
|
width: 16,
|
|
12
13
|
height: 16,
|
|
13
|
-
color:
|
|
14
|
+
color: colors_1.WHITE,
|
|
14
15
|
};
|
|
15
16
|
const buttonContainerStyle = {
|
|
16
17
|
display: 'flex',
|
|
17
18
|
minWidth: '114px',
|
|
18
19
|
};
|
|
19
|
-
const copyIcon = (jsx_runtime_1.jsx("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "far", "data-icon": "clipboard", className: "svg-inline--fa fa-clipboard fa-w-12", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", style: iconStyle, children: jsx_runtime_1.jsx("path", { fill:
|
|
20
|
+
const copyIcon = (jsx_runtime_1.jsx("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "far", "data-icon": "clipboard", className: "svg-inline--fa fa-clipboard fa-w-12", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", style: iconStyle, children: jsx_runtime_1.jsx("path", { fill: colors_1.CURRENT_COLOR, d: "M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm144 418c0 3.3-2.7 6-6 6H54c-3.3 0-6-2.7-6-6V118c0-3.3 2.7-6 6-6h42v36c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-36h42c3.3 0 6 2.7 6 6z" }) }));
|
|
20
21
|
const labelStyle = {
|
|
21
22
|
fontSize: 14,
|
|
22
23
|
};
|
|
@@ -3,4 +3,6 @@ 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
5
|
export declare const getCurrentAssetMediaDetailLines: (mediaMetadata: MediaMetadata) => string[];
|
|
6
|
-
export declare const CurrentAsset: React.FC
|
|
6
|
+
export declare const CurrentAsset: React.FC<{
|
|
7
|
+
readonly readOnlyStudio: boolean;
|
|
8
|
+
}>;
|
|
@@ -5,11 +5,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
|
+
const client_id_1 = require("../helpers/client-id");
|
|
8
9
|
const format_media_duration_1 = require("../helpers/format-media-duration");
|
|
9
10
|
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
10
11
|
const render_codec_label_1 = require("../helpers/render-codec-label");
|
|
11
12
|
const use_media_metadata_1 = require("../helpers/use-media-metadata");
|
|
13
|
+
const InlineEditableTitle_1 = require("./InlineEditableTitle");
|
|
12
14
|
const InspectorInfoHeader_1 = require("./InspectorInfoHeader");
|
|
15
|
+
const use_rename_static_file_1 = require("./NewComposition/use-rename-static-file");
|
|
13
16
|
const use_static_files_1 = require("./use-static-files");
|
|
14
17
|
exports.CURRENT_ASSET_HEIGHT = InspectorInfoHeader_1.INSPECTOR_INFO_HEADER_MIN_HEIGHT;
|
|
15
18
|
const getCurrentAssetMetadataSource = (assetName) => {
|
|
@@ -52,11 +55,17 @@ const getCurrentAssetMediaDetailLines = (mediaMetadata) => {
|
|
|
52
55
|
return detailLines;
|
|
53
56
|
};
|
|
54
57
|
exports.getCurrentAssetMediaDetailLines = getCurrentAssetMediaDetailLines;
|
|
55
|
-
const CurrentAsset = () => {
|
|
58
|
+
const CurrentAsset = ({ readOnlyStudio }) => {
|
|
56
59
|
var _a;
|
|
57
60
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
61
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
62
|
+
.previewServerState.type;
|
|
58
63
|
const assetName = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset' ? canvasContent.asset : null;
|
|
59
64
|
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
65
|
+
const renameFile = (0, use_rename_static_file_1.useRenameStaticFile)({
|
|
66
|
+
relativePath: assetName !== null && assetName !== void 0 ? assetName : '',
|
|
67
|
+
staticFiles,
|
|
68
|
+
});
|
|
60
69
|
const sizeInBytes = (0, react_1.useMemo)(() => {
|
|
61
70
|
var _a;
|
|
62
71
|
if (!assetName) {
|
|
@@ -67,6 +76,10 @@ const CurrentAsset = () => {
|
|
|
67
76
|
}, [assetName, staticFiles]);
|
|
68
77
|
const src = (0, exports.getCurrentAssetMetadataSource)(assetName);
|
|
69
78
|
const mediaMetadata = (0, use_media_metadata_1.useMediaMetadata)(src);
|
|
79
|
+
const canRename = connectionStatus === 'connected' && !readOnlyStudio;
|
|
80
|
+
const onRename = (0, react_1.useCallback)((newName) => {
|
|
81
|
+
renameFile(newName).catch(() => undefined);
|
|
82
|
+
}, [renameFile]);
|
|
70
83
|
if (!assetName) {
|
|
71
84
|
return jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoHeader, {});
|
|
72
85
|
}
|
|
@@ -87,7 +100,7 @@ const CurrentAsset = () => {
|
|
|
87
100
|
? (0, exports.getCurrentAssetMediaDetailLines)(mediaMetadata)
|
|
88
101
|
: [];
|
|
89
102
|
return (jsx_runtime_1.jsxs(InspectorInfoHeader_1.InspectorInfoHeader, { children: [
|
|
90
|
-
jsx_runtime_1.jsx(
|
|
103
|
+
jsx_runtime_1.jsx(InlineEditableTitle_1.InlineEditableTitle, { value: fileName, canRename: canRename, getInitialSelection: use_rename_static_file_1.getStaticFileRenameSelection, onCommit: onRename, title: assetName }), subtitleParts.length > 0 ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: subtitleParts.join(' · ') })) : null, mediaMetadata ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: (0, format_media_duration_1.formatMediaDuration)(mediaMetadata.duration) })) : null, mediaDetailLines.map((line) => {
|
|
91
104
|
return jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: line }, line);
|
|
92
105
|
})] }));
|
|
93
106
|
};
|
|
@@ -69,7 +69,7 @@ const EffectPickerResult = ({ item, selected, onSelected }) => {
|
|
|
69
69
|
const labelStyle = (0, react_1.useMemo)(() => {
|
|
70
70
|
return {
|
|
71
71
|
...label,
|
|
72
|
-
color: selected || hovered ?
|
|
72
|
+
color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT,
|
|
73
73
|
};
|
|
74
74
|
}, [hovered, selected]);
|
|
75
75
|
const onClick = (0, react_1.useCallback)(() => {
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FilePreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
|
+
const colors_1 = require("../helpers/colors");
|
|
6
7
|
const JSONViewer_1 = require("./JSONViewer");
|
|
7
8
|
const layout_1 = require("./layout");
|
|
8
9
|
const TextViewer_1 = require("./TextViewer");
|
|
9
10
|
const msgStyle = {
|
|
10
11
|
fontSize: 13,
|
|
11
|
-
color:
|
|
12
|
+
color: colors_1.WHITE,
|
|
12
13
|
fontFamily: 'sans-serif',
|
|
13
14
|
display: 'flex',
|
|
14
15
|
justifyContent: 'center',
|
|
@@ -4,8 +4,9 @@ exports.FpsCounter = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const colors_1 = require("../helpers/colors");
|
|
7
8
|
const label = {
|
|
8
|
-
color:
|
|
9
|
+
color: colors_1.WHITE,
|
|
9
10
|
fontSize: 15,
|
|
10
11
|
fontFamily: 'Arial, Helvetica, sans-serif',
|
|
11
12
|
whiteSpace: 'nowrap',
|
|
@@ -58,7 +59,7 @@ const FpsCounter = ({ playbackSpeed }) => {
|
|
|
58
59
|
const expectedFps = Math.abs(playbackSpeed) * videoConfig.fps;
|
|
59
60
|
return {
|
|
60
61
|
...label,
|
|
61
|
-
color: fps < expectedFps * 0.9 ?
|
|
62
|
+
color: fps < expectedFps * 0.9 ? colors_1.RED : colors_1.WHITE,
|
|
62
63
|
};
|
|
63
64
|
}, [fps, playbackSpeed, videoConfig]);
|
|
64
65
|
if (fps === 0) {
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const no_react_1 = require("remotion/no-react");
|
|
8
|
+
const colors_1 = require("../helpers/colors");
|
|
8
9
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
9
10
|
const canvas_ref_1 = require("../state/canvas-ref");
|
|
10
11
|
const ControlButton_1 = require("./ControlButton");
|
|
@@ -43,6 +44,6 @@ const FullScreenToggle = () => {
|
|
|
43
44
|
f.unregister();
|
|
44
45
|
};
|
|
45
46
|
}, [keybindings, onClick]);
|
|
46
|
-
return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: jsx_runtime_1.jsx("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 448 512", fill:
|
|
47
|
+
return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: jsx_runtime_1.jsx("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 448 512", fill: colors_1.WHITE_HEX, children: jsx_runtime_1.jsx("path", { d: "M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z" }) }) }));
|
|
47
48
|
};
|
|
48
49
|
exports.FullScreenToggle = FullScreenToggle;
|
|
@@ -106,17 +106,6 @@ const GlobalKeybindings = ({ readOnlyStudio }) => {
|
|
|
106
106
|
event.preventDefault();
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
const nKey = keybindings.registerKeybinding({
|
|
110
|
-
event: 'keypress',
|
|
111
|
-
key: 'n',
|
|
112
|
-
callback: () => {
|
|
113
|
-
(0, NotificationCenter_1.showNotification)(`To make a new composition, right-click an existing one and select "Duplicate"`, 5000);
|
|
114
|
-
},
|
|
115
|
-
commandCtrlKey: false,
|
|
116
|
-
preventDefault: true,
|
|
117
|
-
triggerIfInputFieldFocused: false,
|
|
118
|
-
keepRegisteredWhenNotHighestContext: false,
|
|
119
|
-
});
|
|
120
109
|
const cmdKKey = keybindings.registerKeybinding({
|
|
121
110
|
event: 'keydown',
|
|
122
111
|
key: 'k',
|
|
@@ -200,7 +189,6 @@ const GlobalKeybindings = ({ readOnlyStudio }) => {
|
|
|
200
189
|
keepRegisteredWhenNotHighestContext: false,
|
|
201
190
|
});
|
|
202
191
|
return () => {
|
|
203
|
-
nKey.unregister();
|
|
204
192
|
for (const sequencePropKey of sequencePropKeys) {
|
|
205
193
|
sequencePropKey.unregister();
|
|
206
194
|
}
|
|
@@ -18,7 +18,7 @@ const InlineAction = ({ renderAction, onClick, disabled, title, }) => {
|
|
|
18
18
|
return {
|
|
19
19
|
border: 'none',
|
|
20
20
|
background: disabled
|
|
21
|
-
?
|
|
21
|
+
? colors_1.TRANSPARENT
|
|
22
22
|
: (0, colors_1.getBackgroundFromHoverState)({ hovered, selected: false }),
|
|
23
23
|
height: 24,
|
|
24
24
|
width: 24,
|
|
@@ -30,6 +30,6 @@ const InlineAction = ({ renderAction, onClick, disabled, title, }) => {
|
|
|
30
30
|
pointerEvents: disabled ? 'none' : 'auto',
|
|
31
31
|
};
|
|
32
32
|
}, [disabled, hovered]);
|
|
33
|
-
return (jsx_runtime_1.jsx("button", { type: "button", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, title: title, children: renderAction(hovered ?
|
|
33
|
+
return (jsx_runtime_1.jsx("button", { type: "button", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, title: title, children: renderAction(hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT) }));
|
|
34
34
|
};
|
|
35
35
|
exports.InlineAction = InlineAction;
|
|
@@ -2,6 +2,7 @@ import type * as React from 'react';
|
|
|
2
2
|
export declare const InlineEditableTitle: React.FC<{
|
|
3
3
|
readonly value: string;
|
|
4
4
|
readonly canRename: boolean;
|
|
5
|
+
readonly getInitialSelection?: (value: string) => [number, number];
|
|
5
6
|
readonly onCommit: (newValue: string) => void;
|
|
6
7
|
readonly title?: string;
|
|
7
8
|
}>;
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
7
7
|
const titleWrapper = {
|
|
8
8
|
boxSizing: 'border-box',
|
|
9
|
-
color:
|
|
9
|
+
color: colors_1.WHITE,
|
|
10
10
|
fontSize: 12,
|
|
11
11
|
height: 18,
|
|
12
12
|
lineHeight: '18px',
|
|
@@ -37,10 +37,10 @@ const titleGridItem = {
|
|
|
37
37
|
};
|
|
38
38
|
const titleInput = {
|
|
39
39
|
appearance: 'none',
|
|
40
|
-
backgroundColor:
|
|
40
|
+
backgroundColor: colors_1.TRANSPARENT,
|
|
41
41
|
border: 'none',
|
|
42
42
|
boxShadow: 'none',
|
|
43
|
-
color:
|
|
43
|
+
color: colors_1.WHITE,
|
|
44
44
|
fontFamily: 'inherit',
|
|
45
45
|
fontSize: 12,
|
|
46
46
|
height: 18,
|
|
@@ -53,7 +53,7 @@ const titleInput = {
|
|
|
53
53
|
WebkitAppearance: 'none',
|
|
54
54
|
width: '100%',
|
|
55
55
|
};
|
|
56
|
-
const InlineEditableTitle = ({ value, canRename, onCommit, title }) => {
|
|
56
|
+
const InlineEditableTitle = ({ value, canRename, getInitialSelection, onCommit, title }) => {
|
|
57
57
|
const [isEditing, setIsEditing] = (0, react_1.useState)(false);
|
|
58
58
|
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
59
59
|
const [draftValue, setDraftValue] = (0, react_1.useState)(value);
|
|
@@ -70,8 +70,13 @@ const InlineEditableTitle = ({ value, canRename, onCommit, title }) => {
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
input.focus();
|
|
73
|
+
if (getInitialSelection) {
|
|
74
|
+
const [start, end] = getInitialSelection(value);
|
|
75
|
+
input.setSelectionRange(start, end);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
73
78
|
input.select();
|
|
74
|
-
}, []);
|
|
79
|
+
}, [getInitialSelection, value]);
|
|
75
80
|
const commit = (0, react_1.useCallback)((newValue) => {
|
|
76
81
|
if (cancelledRef.current) {
|
|
77
82
|
return;
|
|
@@ -109,8 +114,8 @@ const InlineEditableTitle = ({ value, canRename, onCommit, title }) => {
|
|
|
109
114
|
const backgroundColor = isEditing
|
|
110
115
|
? colors_1.INPUT_BACKGROUND
|
|
111
116
|
: isHovered && canRename
|
|
112
|
-
? colors_1.
|
|
113
|
-
:
|
|
117
|
+
? colors_1.WHITE_ALPHA_06
|
|
118
|
+
: colors_1.TRANSPARENT;
|
|
114
119
|
const innerStyle = (0, react_1.useMemo)(() => {
|
|
115
120
|
return {
|
|
116
121
|
...titleInner,
|