@remotion/studio 4.0.498 → 4.0.500
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/components/AssetSelector.js +8 -6
- package/dist/components/AssetSelectorItem.d.ts +24 -0
- package/dist/components/AssetSelectorItem.js +144 -83
- package/dist/components/Canvas.js +162 -7
- package/dist/components/CompositionSelector.js +15 -42
- package/dist/components/CompositionSelectorItem.js +21 -13
- package/dist/components/ControlButton.js +1 -0
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorRuler/Ruler.js +5 -3
- package/dist/components/ExplorerPanel.js +2 -1
- package/dist/components/ExplorerPanelRef.d.ts +2 -0
- package/dist/components/ForceSpecificCursor.js +13 -1
- package/dist/components/GlobalKeybindings.js +7 -1
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +2 -2
- package/dist/components/InlineDropdown.d.ts +1 -1
- package/dist/components/InlineDropdown.js +3 -2
- package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
- package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +8 -7
- package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +7 -7
- package/dist/components/InspectorPanel/common.d.ts +17 -4
- package/dist/components/InspectorPanel/common.js +60 -6
- package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
- package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
- package/dist/components/InspectorSequenceSection.js +43 -19
- package/dist/components/KeyboardShortcutsExplainer.js +4 -2
- package/dist/components/Menu/MenuItem.js +2 -1
- package/dist/components/MenuCompositionName.js +30 -7
- package/dist/components/MenuToolbar.d.ts +0 -1
- package/dist/components/MenuToolbar.js +8 -7
- package/dist/components/MobilePanel.d.ts +2 -1
- package/dist/components/MobilePanel.js +29 -25
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/Modals.js +1 -1
- package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
- package/dist/components/NewComposition/DismissableModal.js +2 -2
- package/dist/components/NewComposition/InputDragger.d.ts +34 -0
- package/dist/components/NewComposition/InputDragger.js +262 -23
- package/dist/components/OutlineToggle.d.ts +1 -3
- package/dist/components/OutlineToggle.js +2 -2
- package/dist/components/PreviewToolbar.js +10 -4
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +44 -0
- package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
- package/dist/components/QuickSwitcher/NoResults.js +1 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +5 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
- package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +5 -0
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +76 -12
- package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
- package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
- package/dist/components/QuickSwitcher/asset-search.js +42 -0
- package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
- package/dist/components/SelectedOutlineCropControls.js +299 -0
- package/dist/components/SelectedOutlineElement.js +83 -43
- package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
- package/dist/components/SelectedOutlineOverlay.js +130 -8
- package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
- package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
- package/dist/components/SidebarCollapserControls.d.ts +3 -1
- package/dist/components/SidebarCollapserControls.js +34 -29
- package/dist/components/SnappingToggle.d.ts +1 -3
- package/dist/components/SnappingToggle.js +2 -2
- package/dist/components/Splitter/SplitterContainer.d.ts +2 -0
- package/dist/components/Splitter/SplitterContainer.js +5 -1
- package/dist/components/Splitter/SplitterContext.d.ts +2 -0
- package/dist/components/Splitter/SplitterContext.js +2 -0
- package/dist/components/Splitter/SplitterElement.js +6 -1
- package/dist/components/Splitter/SplitterHandle.js +27 -2
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
- package/dist/components/Timeline/TimelineAssetField.js +52 -100
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
- package/dist/components/Timeline/TimelineColorField.js +20 -1
- package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
- package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
- package/dist/components/Timeline/TimelineInOutDragHandler.js +25 -1
- package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
- package/dist/components/Timeline/TimelineLayerEye.js +4 -1
- package/dist/components/Timeline/TimelineList.d.ts +2 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +7 -1
- package/dist/components/Timeline/TimelineSelection.d.ts +5 -5
- package/dist/components/Timeline/TimelineSelection.js +8 -6
- package/dist/components/Timeline/TimelineSequence.js +7 -6
- package/dist/components/Timeline/TimelineSequenceItem.js +57 -10
- package/dist/components/Timeline/TimelineSequenceName.js +1 -0
- package/dist/components/Timeline/TimelineSequencePropItem.js +27 -75
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +29 -12
- package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
- package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
- package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
- package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
- package/dist/components/Timeline/reset-selected-timeline-props.js +18 -10
- package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
- package/dist/components/Timeline/save-effect-prop.js +52 -1
- package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
- package/dist/components/Timeline/timeline-asset-link.js +17 -1
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
- package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +6 -4
- package/dist/components/TopPanel.js +3 -2
- package/dist/components/UndoRedoButtons.js +27 -5
- package/dist/components/composition-drop-preview.d.ts +33 -0
- package/dist/components/composition-drop-preview.js +68 -0
- package/dist/components/drop-handler-data.d.ts +1 -1
- package/dist/components/drop-handler-data.js +27 -60
- package/dist/components/effect-drag-and-drop.d.ts +1 -1
- package/dist/components/effect-drag-and-drop.js +7 -55
- package/dist/components/element-drag-and-drop.d.ts +1 -1
- package/dist/components/element-drag-and-drop.js +5 -17
- package/dist/components/handle-drop.js +0 -1
- package/dist/components/import-assets.d.ts +7 -8
- package/dist/components/import-assets.js +2 -9
- package/dist/components/menu-toolbar-height.d.ts +1 -0
- package/dist/components/menu-toolbar-height.js +4 -0
- package/dist/components/selected-outline-drag.d.ts +41 -4
- package/dist/components/selected-outline-drag.js +179 -2
- package/dist/components/selected-outline-geometry.d.ts +1 -0
- package/dist/components/selected-outline-measurement.d.ts +11 -0
- package/dist/components/selected-outline-measurement.js +64 -3
- package/dist/components/selected-outline-types.d.ts +44 -1
- package/dist/components/selected-outline-types.js +21 -1
- package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
- package/dist/esm/{chunk-7a6q9hk2.js → chunk-dr1y1vm3.js} +11851 -9494
- package/dist/esm/internals.mjs +11851 -9494
- package/dist/esm/previewEntry.mjs +55150 -52795
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.d.ts +2 -2
- package/dist/helpers/calculate-timeline.js +8 -28
- package/dist/helpers/get-effective-translation.d.ts +13 -1
- package/dist/helpers/get-effective-translation.js +12 -6
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
- package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
- package/dist/helpers/interactivity-enabled.d.ts +1 -0
- package/dist/helpers/interactivity-enabled.js +7 -2
- package/dist/helpers/is-mac.d.ts +1 -0
- package/dist/helpers/is-mac.js +4 -0
- package/dist/helpers/open-in-editor.d.ts +5 -1
- package/dist/helpers/open-in-editor.js +15 -1
- package/dist/helpers/ruler-canvas-size.d.ts +7 -0
- package/dist/helpers/ruler-canvas-size.js +14 -1
- package/dist/helpers/sort-by-nonce-history.js +97 -19
- package/dist/helpers/use-image-metadata.d.ts +1 -0
- package/dist/helpers/use-image-metadata.js +8 -5
- package/dist/helpers/use-keybinding.js +2 -3
- package/dist/helpers/use-media-metadata.d.ts +1 -0
- package/dist/helpers/use-media-metadata.js +8 -5
- package/dist/helpers/use-menu-structure.js +10 -1
- package/dist/icons/caret.d.ts +1 -0
- package/dist/icons/caret.js +2 -2
- package/dist/icons/pen.d.ts +5 -0
- package/dist/icons/pen.js +8 -0
- package/dist/state/modals.d.ts +5 -0
- package/package.json +13 -12
- package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
- package/dist/helpers/get-timeline-sequence-hash.js +0 -33
|
@@ -2,6 +2,10 @@ import type { CanUpdateSequencePropStatus, SequencePropsSubscriptionKey, TSequen
|
|
|
2
2
|
import type { ComboboxValue } from '../NewComposition/ComboBox';
|
|
3
3
|
import { type SetPropStatuses } from './save-sequence-prop';
|
|
4
4
|
export declare const shouldShowFreezeFrameMenuItem: (sequence: TSequence) => boolean;
|
|
5
|
+
export declare const isSequenceVisibleAtTimelinePosition: ({ sequence, timelinePosition, }: {
|
|
6
|
+
readonly sequence: TSequence;
|
|
7
|
+
readonly timelinePosition: number;
|
|
8
|
+
}) => boolean;
|
|
5
9
|
export declare const calculateSequenceFreezeFrame: ({ sequence, sequenceFrameOffset, timelinePosition, }: {
|
|
6
10
|
readonly sequence: TSequence;
|
|
7
11
|
readonly sequenceFrameOffset: number;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSequenceFreezeFrameMenuItem = exports.calculateSequenceFreezeFrame = exports.shouldShowFreezeFrameMenuItem = void 0;
|
|
3
|
+
exports.useSequenceFreezeFrameMenuItem = exports.calculateSequenceFreezeFrame = exports.isSequenceVisibleAtTimelinePosition = exports.shouldShowFreezeFrameMenuItem = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
6
6
|
const shouldShowFreezeFrameMenuItem = (sequence) => {
|
|
7
7
|
return sequence.type !== 'audio';
|
|
8
8
|
};
|
|
9
9
|
exports.shouldShowFreezeFrameMenuItem = shouldShowFreezeFrameMenuItem;
|
|
10
|
+
const isSequenceVisibleAtTimelinePosition = ({ sequence, timelinePosition, }) => {
|
|
11
|
+
return (timelinePosition >= sequence.from &&
|
|
12
|
+
timelinePosition < sequence.from + sequence.duration);
|
|
13
|
+
};
|
|
14
|
+
exports.isSequenceVisibleAtTimelinePosition = isSequenceVisibleAtTimelinePosition;
|
|
10
15
|
const calculateSequenceFreezeFrame = ({ sequence, sequenceFrameOffset, timelinePosition, }) => {
|
|
11
16
|
const rawFreezeFrame = Math.round(timelinePosition - sequence.from + sequenceFrameOffset);
|
|
12
17
|
const minFrame = sequenceFrameOffset;
|
|
@@ -20,7 +25,8 @@ const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOve
|
|
|
20
25
|
const freezeStatus = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.freeze;
|
|
21
26
|
const isFrozen = (freezeStatus === null || freezeStatus === void 0 ? void 0 : freezeStatus.status) === 'static' &&
|
|
22
27
|
typeof freezeStatus.codeValue === 'number';
|
|
23
|
-
const canToggleFreeze =
|
|
28
|
+
const canToggleFreeze = (0, exports.isSequenceVisibleAtTimelinePosition)({ sequence, timelinePosition }) &&
|
|
29
|
+
clientId !== null &&
|
|
24
30
|
Boolean(sequence.controls) &&
|
|
25
31
|
nodePath !== null &&
|
|
26
32
|
validatedSource !== null &&
|
|
@@ -49,7 +55,7 @@ const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOve
|
|
|
49
55
|
fileName: validatedSource,
|
|
50
56
|
nodePath,
|
|
51
57
|
fieldKey: 'freeze',
|
|
52
|
-
value: remove ?
|
|
58
|
+
value: remove ? undefined : freezeFrame,
|
|
53
59
|
defaultValue: null,
|
|
54
60
|
schema: sequence.controls.schema,
|
|
55
61
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TimelineTrackData } from '../../helpers/get-timeline-sequence-sort-key';
|
|
2
2
|
export declare const useTimelineHeight: ({ shown, hasBeenCut, }: {
|
|
3
|
-
shown:
|
|
3
|
+
shown: TimelineTrackData[];
|
|
4
4
|
hasBeenCut: boolean;
|
|
5
5
|
}) => number;
|
|
@@ -366,10 +366,12 @@ const useTimelineKeyframeDrag = ({ frame, nodePathInfo, onSelect, selectable, se
|
|
|
366
366
|
clearDraggedKeyframes();
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
setDraggedKeyframes(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
369
|
+
setDraggedKeyframes(shouldDragExistingSelection
|
|
370
|
+
? targets.map((target) => ({
|
|
371
|
+
nodePathInfo: target.nodePathInfo,
|
|
372
|
+
frame: target.displayFrame + delta,
|
|
373
|
+
}))
|
|
374
|
+
: []);
|
|
373
375
|
applyDragOverrides({
|
|
374
376
|
delta,
|
|
375
377
|
setDragOverrides,
|
|
@@ -68,6 +68,7 @@ const row = {
|
|
|
68
68
|
flex: 1,
|
|
69
69
|
minHeight: 0,
|
|
70
70
|
};
|
|
71
|
+
const MAX_SIDEBAR_WIDTH = 350;
|
|
71
72
|
const useResponsiveSidebarStatus = () => {
|
|
72
73
|
const { sidebarCollapsedStateLeft } = (0, react_1.useContext)(sidebar_1.SidebarContext);
|
|
73
74
|
const responsiveLeftStatus = (0, use_breakpoint_1.useBreakpoint)(1200) ? 'collapsed' : 'expanded';
|
|
@@ -113,8 +114,8 @@ const TopPanelInner = ({ readOnlyStudio, onMounted, drawRef, bufferStateDelayInM
|
|
|
113
114
|
return (jsx_runtime_1.jsx(ObserveDefaultPropsContext_1.ObserveDefaultProps, { compositionId: (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition'
|
|
114
115
|
? canvasContent.compositionId
|
|
115
116
|
: null, readOnlyStudio: readOnlyStudio, children: jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
116
|
-
jsx_runtime_1.jsx("div", { style: row, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseLeft, children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) }))) : null, actualStateLeft === 'expanded' ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, id: "canvas-to-right-sidebar", orientation: "vertical", children: [
|
|
117
|
-
jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx("div", { ref: drawRef, style: canvasContainerStyle, children: jsx_runtime_1.jsx(CanvasIfSizeIsAvailable_1.CanvasIfSizeIsAvailable, {}) }) }), actualStateRight === 'expanded' ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseRight, children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) }))) : null] }) })
|
|
117
|
+
jsx_runtime_1.jsx("div", { style: row, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, maxFlexerSize: MAX_SIDEBAR_WIDTH, maxAntiFlexerSize: null, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseLeft, side: "left", children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) }))) : null, actualStateLeft === 'expanded' && !isMobileLayout ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, maxFlexerSize: null, maxAntiFlexerSize: MAX_SIDEBAR_WIDTH, id: "canvas-to-right-sidebar", orientation: "vertical", children: [
|
|
118
|
+
jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx("div", { ref: drawRef, style: canvasContainerStyle, children: jsx_runtime_1.jsx(CanvasIfSizeIsAvailable_1.CanvasIfSizeIsAvailable, {}) }) }), actualStateRight === 'expanded' && !isMobileLayout ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseRight, side: "right", children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) }))) : null] }) })
|
|
118
119
|
] }) }), jsx_runtime_1.jsx(PreviewToolbar_1.PreviewToolbar, { bufferStateDelayInMilliseconds: bufferStateDelayInMilliseconds, readOnlyStudio: readOnlyStudio }), jsx_runtime_1.jsx(CurrentCompositionSideEffects_1.TitleUpdater, {})
|
|
119
120
|
] }) }));
|
|
120
121
|
};
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
|
|
7
7
|
const client_id_1 = require("../helpers/client-id");
|
|
8
|
+
const is_mac_1 = require("../helpers/is-mac");
|
|
8
9
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
9
10
|
const redo_1 = require("../icons/redo");
|
|
10
11
|
const undo_1 = require("../icons/undo");
|
|
@@ -74,11 +75,14 @@ const UndoRedoButtons = () => {
|
|
|
74
75
|
triggerIfInputFieldFocused: false,
|
|
75
76
|
keepRegisteredWhenNotHighestContext: false,
|
|
76
77
|
});
|
|
77
|
-
const
|
|
78
|
+
const redoWithShiftZ = keybindings.registerKeybinding({
|
|
78
79
|
event: 'keydown',
|
|
79
|
-
key: '
|
|
80
|
+
key: 'z',
|
|
80
81
|
commandCtrlKey: true,
|
|
81
|
-
callback: () => {
|
|
82
|
+
callback: (e) => {
|
|
83
|
+
if (!e.shiftKey) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
82
86
|
if (redoFile) {
|
|
83
87
|
onRedo();
|
|
84
88
|
}
|
|
@@ -87,9 +91,25 @@ const UndoRedoButtons = () => {
|
|
|
87
91
|
triggerIfInputFieldFocused: false,
|
|
88
92
|
keepRegisteredWhenNotHighestContext: false,
|
|
89
93
|
});
|
|
94
|
+
const redoWithY = is_mac_1.isMac
|
|
95
|
+
? null
|
|
96
|
+
: keybindings.registerKeybinding({
|
|
97
|
+
event: 'keydown',
|
|
98
|
+
key: 'y',
|
|
99
|
+
commandCtrlKey: true,
|
|
100
|
+
callback: () => {
|
|
101
|
+
if (redoFile) {
|
|
102
|
+
onRedo();
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
preventDefault: true,
|
|
106
|
+
triggerIfInputFieldFocused: false,
|
|
107
|
+
keepRegisteredWhenNotHighestContext: false,
|
|
108
|
+
});
|
|
90
109
|
return () => {
|
|
91
110
|
undo.unregister();
|
|
92
|
-
|
|
111
|
+
redoWithShiftZ.unregister();
|
|
112
|
+
redoWithY === null || redoWithY === void 0 ? void 0 : redoWithY.unregister();
|
|
93
113
|
};
|
|
94
114
|
}, [keybindings, onRedo, onUndo, redoFile, undoFile]);
|
|
95
115
|
const undoTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
|
|
@@ -97,7 +117,9 @@ const UndoRedoButtons = () => {
|
|
|
97
117
|
: `Undo (${ShortcutHint_1.cmdOrCtrlCharacter}+Z)`;
|
|
98
118
|
const redoTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
|
|
99
119
|
? 'Redo'
|
|
100
|
-
:
|
|
120
|
+
: is_mac_1.isMac
|
|
121
|
+
? `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Shift+Z)`
|
|
122
|
+
: `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Y)`;
|
|
101
123
|
const renderUndo = (0, react_1.useCallback)((color) => {
|
|
102
124
|
return (jsx_runtime_1.jsx(undo_1.UndoIcon, { style: { ...iconStyle, color, opacity: undoFile ? 1 : 0.5 } }));
|
|
103
125
|
}, [undoFile]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PreviewSize } from 'remotion';
|
|
2
|
+
import { type InsertElementDropPosition } from './import-assets';
|
|
3
|
+
type Dimensions = {
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
};
|
|
7
|
+
type CanvasSize = {
|
|
8
|
+
readonly width: number;
|
|
9
|
+
readonly height: number;
|
|
10
|
+
};
|
|
11
|
+
export type CompositionDropPreview = {
|
|
12
|
+
readonly compositionDimensions: Dimensions;
|
|
13
|
+
readonly dropPosition: InsertElementDropPosition;
|
|
14
|
+
};
|
|
15
|
+
export type CompositionDropPreviewBox = {
|
|
16
|
+
readonly left: number;
|
|
17
|
+
readonly top: number;
|
|
18
|
+
readonly width: number;
|
|
19
|
+
readonly height: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const snapCompositionDropPosition: ({ compositionDimensions, destinationDimensions, dropPosition, scale, }: {
|
|
22
|
+
readonly compositionDimensions: Dimensions;
|
|
23
|
+
readonly destinationDimensions: Dimensions;
|
|
24
|
+
readonly dropPosition: InsertElementDropPosition;
|
|
25
|
+
readonly scale: number;
|
|
26
|
+
}) => InsertElementDropPosition;
|
|
27
|
+
export declare const getCompositionDropPreviewBox: ({ canvasSize, destinationDimensions, preview, previewSize, }: {
|
|
28
|
+
readonly canvasSize: CanvasSize;
|
|
29
|
+
readonly destinationDimensions: Dimensions;
|
|
30
|
+
readonly preview: CompositionDropPreview;
|
|
31
|
+
readonly previewSize: PreviewSize;
|
|
32
|
+
}) => CompositionDropPreviewBox;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCompositionDropPreviewBox = exports.snapCompositionDropPosition = void 0;
|
|
4
|
+
const studio_fit_padding_1 = require("../helpers/studio-fit-padding");
|
|
5
|
+
const import_assets_1 = require("./import-assets");
|
|
6
|
+
const selected_outline_snap_1 = require("./selected-outline-snap");
|
|
7
|
+
const snapCompositionDropPosition = ({ compositionDimensions, destinationDimensions, dropPosition, scale, }) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const left = dropPosition.centerX - compositionDimensions.width / 2;
|
|
10
|
+
const top = dropPosition.centerY - compositionDimensions.height / 2;
|
|
11
|
+
const right = left + compositionDimensions.width;
|
|
12
|
+
const bottom = top + compositionDimensions.height;
|
|
13
|
+
const outline = {
|
|
14
|
+
key: 'composition-drop-preview',
|
|
15
|
+
dimensions: compositionDimensions,
|
|
16
|
+
uncroppedPoints: null,
|
|
17
|
+
points: [
|
|
18
|
+
{ x: left * scale, y: top * scale },
|
|
19
|
+
{ x: right * scale, y: top * scale },
|
|
20
|
+
{ x: right * scale, y: bottom * scale },
|
|
21
|
+
{ x: left * scale, y: bottom * scale },
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
const snap = (0, selected_outline_snap_1.findSelectedOutlineSnap)({
|
|
25
|
+
allowX: true,
|
|
26
|
+
allowY: true,
|
|
27
|
+
deltaX: 0,
|
|
28
|
+
deltaY: 0,
|
|
29
|
+
outlines: [outline],
|
|
30
|
+
scale,
|
|
31
|
+
targets: (0, selected_outline_snap_1.getSelectedOutlineSnapTargets)({
|
|
32
|
+
compositionHeight: destinationDimensions.height,
|
|
33
|
+
compositionWidth: destinationDimensions.width,
|
|
34
|
+
guides: [],
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
centerX: dropPosition.centerX + ((_a = snap.snapOffsetX) !== null && _a !== void 0 ? _a : 0),
|
|
39
|
+
centerY: dropPosition.centerY + ((_b = snap.snapOffsetY) !== null && _b !== void 0 ? _b : 0),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.snapCompositionDropPosition = snapCompositionDropPosition;
|
|
43
|
+
const getCompositionDropPreviewBox = ({ canvasSize, destinationDimensions, preview, previewSize, }) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const scale = (0, studio_fit_padding_1.calculateStudioScale)({
|
|
46
|
+
canvasSize,
|
|
47
|
+
compositionHeight: destinationDimensions.height,
|
|
48
|
+
compositionWidth: destinationDimensions.width,
|
|
49
|
+
previewSize: previewSize.size,
|
|
50
|
+
});
|
|
51
|
+
const position = (0, import_assets_1.getCompositionPositionForDrop)({
|
|
52
|
+
compositionDimensions: preview.compositionDimensions,
|
|
53
|
+
dropPosition: preview.dropPosition,
|
|
54
|
+
});
|
|
55
|
+
const contentLeft = canvasSize.width / 2 -
|
|
56
|
+
(destinationDimensions.width * scale) / 2 -
|
|
57
|
+
previewSize.translation.x;
|
|
58
|
+
const contentTop = canvasSize.height / 2 -
|
|
59
|
+
(destinationDimensions.height * scale) / 2 -
|
|
60
|
+
previewSize.translation.y;
|
|
61
|
+
return {
|
|
62
|
+
left: contentLeft + ((_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : 0) * scale,
|
|
63
|
+
top: contentTop + ((_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : 0) * scale,
|
|
64
|
+
width: preview.compositionDimensions.width * scale,
|
|
65
|
+
height: preview.compositionDimensions.height * scale,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
exports.getCompositionDropPreviewBox = getCompositionDropPreviewBox;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentDragData, type CompositionDragData } from '@remotion/
|
|
1
|
+
import { type ComponentDragData, type CompositionDragData } from '@remotion/drag-and-drop';
|
|
2
2
|
export declare const isFileDragEvent: (event: DragEvent) => boolean;
|
|
3
3
|
export declare const isAssetDragEvent: (event: DragEvent) => boolean;
|
|
4
4
|
export declare const isComponentDragEvent: (event: DragEvent) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSfxDragUrl = exports.getComponentDragData = exports.getCompositionDragData = exports.getAssetDragPath = exports.isSupportedDropEvent = exports.isRemoteAssetDragEvent = exports.isSfxDragEvent = exports.isElementDragEvent = exports.isCompositionDragEvent = exports.isComponentDragEvent = exports.isAssetDragEvent = exports.isFileDragEvent = void 0;
|
|
4
|
-
const
|
|
4
|
+
const drag_and_drop_1 = require("@remotion/drag-and-drop");
|
|
5
5
|
const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
|
|
6
6
|
const isFileDragEvent = (event) => {
|
|
7
7
|
var _a;
|
|
@@ -9,34 +9,29 @@ const isFileDragEvent = (event) => {
|
|
|
9
9
|
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes('Files');
|
|
10
10
|
};
|
|
11
11
|
exports.isFileDragEvent = isFileDragEvent;
|
|
12
|
+
const isRemotionDragEvent = (event, type) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
var _c;
|
|
15
|
+
return (((_b = drag_and_drop_1.DragAndDropInternals.getDragPreviewMetadata((_c = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _c !== void 0 ? _c : [])) === null || _b === void 0 ? void 0 : _b.type) === type);
|
|
16
|
+
};
|
|
12
17
|
const isAssetDragEvent = (event) => {
|
|
13
|
-
|
|
14
|
-
var _b;
|
|
15
|
-
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.ASSET_DRAG_MIME_TYPE);
|
|
18
|
+
return isRemotionDragEvent(event, 'asset');
|
|
16
19
|
};
|
|
17
20
|
exports.isAssetDragEvent = isAssetDragEvent;
|
|
18
21
|
const isComponentDragEvent = (event) => {
|
|
19
|
-
|
|
20
|
-
var _b;
|
|
21
|
-
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.COMPONENT_DRAG_MIME_TYPE);
|
|
22
|
+
return isRemotionDragEvent(event, 'component');
|
|
22
23
|
};
|
|
23
24
|
exports.isComponentDragEvent = isComponentDragEvent;
|
|
24
25
|
const isCompositionDragEvent = (event) => {
|
|
25
|
-
|
|
26
|
-
var _b;
|
|
27
|
-
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE);
|
|
26
|
+
return isRemotionDragEvent(event, 'composition');
|
|
28
27
|
};
|
|
29
28
|
exports.isCompositionDragEvent = isCompositionDragEvent;
|
|
30
29
|
const isElementDragEvent = (event) => {
|
|
31
|
-
|
|
32
|
-
var _b;
|
|
33
|
-
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.ELEMENT_DRAG_MIME_TYPE);
|
|
30
|
+
return isRemotionDragEvent(event, 'element');
|
|
34
31
|
};
|
|
35
32
|
exports.isElementDragEvent = isElementDragEvent;
|
|
36
33
|
const isSfxDragEvent = (event) => {
|
|
37
|
-
|
|
38
|
-
var _b;
|
|
39
|
-
return Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) !== null && _b !== void 0 ? _b : []).includes(studio_shared_1.SFX_DRAG_MIME_TYPE);
|
|
34
|
+
return isRemotionDragEvent(event, 'sfx');
|
|
40
35
|
};
|
|
41
36
|
exports.isSfxDragEvent = isSfxDragEvent;
|
|
42
37
|
const isRemoteAssetDragEvent = (event) => {
|
|
@@ -60,58 +55,30 @@ const isSupportedDropEvent = (event) => {
|
|
|
60
55
|
};
|
|
61
56
|
exports.isSupportedDropEvent = isSupportedDropEvent;
|
|
62
57
|
const getAssetDragPath = (event) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return (_c = (_b = (0, studio_shared_1.parseAssetDragData)(value)) === null || _b === void 0 ? void 0 : _b.assetPath) !== null && _c !== void 0 ? _c : null;
|
|
58
|
+
const parsed = event.dataTransfer
|
|
59
|
+
? drag_and_drop_1.DragAndDropInternals.parseDragData(event.dataTransfer)
|
|
60
|
+
: null;
|
|
61
|
+
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'asset' ? parsed.data.assetPath : null;
|
|
70
62
|
};
|
|
71
63
|
exports.getAssetDragPath = getAssetDragPath;
|
|
72
64
|
const getCompositionDragData = (event) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
return (0, studio_shared_1.parseCompositionDragData)(value);
|
|
65
|
+
const parsed = event.dataTransfer
|
|
66
|
+
? drag_and_drop_1.DragAndDropInternals.parseDragData(event.dataTransfer)
|
|
67
|
+
: null;
|
|
68
|
+
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'composition' ? parsed.data : null;
|
|
79
69
|
};
|
|
80
70
|
exports.getCompositionDragData = getCompositionDragData;
|
|
81
71
|
const getComponentDragData = (event) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
'text/plain',
|
|
87
|
-
]) {
|
|
88
|
-
const value = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData(type);
|
|
89
|
-
if (!value) {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
const parsed = (0, studio_shared_1.parseComponentDragData)(value);
|
|
93
|
-
if (parsed) {
|
|
94
|
-
return parsed;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
72
|
+
const parsed = event.dataTransfer
|
|
73
|
+
? drag_and_drop_1.DragAndDropInternals.parseDragData(event.dataTransfer)
|
|
74
|
+
: null;
|
|
75
|
+
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'component' ? parsed.data : null;
|
|
98
76
|
};
|
|
99
77
|
exports.getComponentDragData = getComponentDragData;
|
|
100
78
|
const getSfxDragUrl = (event) => {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
for (const type of [studio_shared_1.SFX_DRAG_MIME_TYPE, 'application/json', 'text/plain']) {
|
|
106
|
-
const value = dataTransfer.getData(type);
|
|
107
|
-
if (!value) {
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
const parsed = (0, studio_shared_1.parseSfxDragData)(value);
|
|
111
|
-
if (parsed) {
|
|
112
|
-
return parsed.sfx.url;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
79
|
+
const parsed = event.dataTransfer
|
|
80
|
+
? drag_and_drop_1.DragAndDropInternals.parseDragData(event.dataTransfer)
|
|
81
|
+
: null;
|
|
82
|
+
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'sfx' ? parsed.data.sfx.url : null;
|
|
116
83
|
};
|
|
117
84
|
exports.getSfxDragUrl = getSfxDragUrl;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EffectDragData } from '@remotion/
|
|
1
|
+
import { type EffectDragData } from '@remotion/drag-and-drop';
|
|
2
2
|
import type { SequencePropsSubscriptionKey } from 'remotion';
|
|
3
3
|
export declare const hasEffectDragType: (dataTransfer: DataTransfer) => boolean;
|
|
4
4
|
export declare const hasExplicitEffectDragType: (dataTransfer: DataTransfer) => boolean;
|
|
@@ -1,72 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addEffectToSequence = exports.addEffectFromDragData = exports.getEffectDragData = exports.hasExplicitEffectDragType = exports.hasEffectDragType = void 0;
|
|
4
|
+
const drag_and_drop_1 = require("@remotion/drag-and-drop");
|
|
4
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const install_required_package_1 = require("../helpers/install-required-package");
|
|
6
7
|
const call_api_1 = require("./call-api");
|
|
7
8
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
8
9
|
const hasEffectDragType = (dataTransfer) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(hasNonEffectRemotionDragType(dataTransfer) ||
|
|
13
|
-
hasNonRemotionImportableAssetDragType(dataTransfer))) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return types.some((type) => type === studio_shared_1.EFFECT_DRAG_MIME_TYPE || isGenericDragType(type));
|
|
10
|
+
var _a;
|
|
11
|
+
return (((_a = drag_and_drop_1.DragAndDropInternals.getDragPreviewMetadata(dataTransfer.types)) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
12
|
+
'effect');
|
|
17
13
|
};
|
|
18
14
|
exports.hasEffectDragType = hasEffectDragType;
|
|
19
15
|
const hasExplicitEffectDragType = (dataTransfer) => {
|
|
20
|
-
return
|
|
16
|
+
return (0, exports.hasEffectDragType)(dataTransfer);
|
|
21
17
|
};
|
|
22
18
|
exports.hasExplicitEffectDragType = hasExplicitEffectDragType;
|
|
23
|
-
const isGenericDragType = (type) => {
|
|
24
|
-
return type === 'application/json' || type === 'text/plain';
|
|
25
|
-
};
|
|
26
|
-
const isNonEffectRemotionDragType = (mimeType) => {
|
|
27
|
-
switch (mimeType) {
|
|
28
|
-
case studio_shared_1.EFFECT_DRAG_MIME_TYPE:
|
|
29
|
-
return false;
|
|
30
|
-
case studio_shared_1.ASSET_DRAG_MIME_TYPE:
|
|
31
|
-
case studio_shared_1.COMPOSITION_DRAG_MIME_TYPE:
|
|
32
|
-
case studio_shared_1.COMPONENT_DRAG_MIME_TYPE:
|
|
33
|
-
case studio_shared_1.ELEMENT_DRAG_MIME_TYPE:
|
|
34
|
-
case studio_shared_1.SFX_DRAG_MIME_TYPE:
|
|
35
|
-
return true;
|
|
36
|
-
default:
|
|
37
|
-
mimeType;
|
|
38
|
-
throw new Error(`Unhandled Remotion drag MIME type: ${mimeType}`);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const hasNonEffectRemotionDragType = (dataTransfer) => {
|
|
42
|
-
return Array.from(dataTransfer.types).some((type) => {
|
|
43
|
-
if (!(0, studio_shared_1.isRemotionDragMimeType)(type)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return isNonEffectRemotionDragType(type);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
const hasNonRemotionImportableAssetDragType = (dataTransfer) => {
|
|
50
|
-
return Array.from(dataTransfer.types).some((type) => {
|
|
51
|
-
return type === 'Files' || type === 'text/uri-list' || type === 'text/html';
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
19
|
const getEffectDragData = (dataTransfer) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'application/json',
|
|
58
|
-
'text/plain',
|
|
59
|
-
]) {
|
|
60
|
-
const value = dataTransfer.getData(type);
|
|
61
|
-
if (!value) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const parsed = (0, studio_shared_1.parseEffectDragData)(value);
|
|
65
|
-
if (parsed) {
|
|
66
|
-
return parsed;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
20
|
+
const parsed = drag_and_drop_1.DragAndDropInternals.parseDragData(dataTransfer);
|
|
21
|
+
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'effect' ? parsed.data : null;
|
|
70
22
|
};
|
|
71
23
|
exports.getEffectDragData = getEffectDragData;
|
|
72
24
|
const addEffectFromDragData = ({ clientId, dragData, fileName, nodePath, }) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ElementDragData } from '@remotion/
|
|
1
|
+
import { type ElementDragData } from '@remotion/drag-and-drop';
|
|
2
2
|
export declare const hasElementDragType: (dataTransfer: DataTransfer | null) => boolean;
|
|
3
3
|
export declare const getElementDragData: (dataTransfer: DataTransfer | null) => ElementDragData | null;
|
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getElementDragData = exports.hasElementDragType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const drag_and_drop_1 = require("@remotion/drag-and-drop");
|
|
5
5
|
const hasElementDragType = (dataTransfer) => {
|
|
6
6
|
var _a;
|
|
7
|
-
|
|
7
|
+
var _b;
|
|
8
|
+
return (((_a = drag_and_drop_1.DragAndDropInternals.getDragPreviewMetadata((_b = dataTransfer === null || dataTransfer === void 0 ? void 0 : dataTransfer.types) !== null && _b !== void 0 ? _b : [])) === null || _a === void 0 ? void 0 : _a.type) === 'element');
|
|
8
9
|
};
|
|
9
10
|
exports.hasElementDragType = hasElementDragType;
|
|
10
11
|
const getElementDragData = (dataTransfer) => {
|
|
11
12
|
if (!dataTransfer) {
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'application/json',
|
|
17
|
-
'text/plain',
|
|
18
|
-
]) {
|
|
19
|
-
const raw = dataTransfer.getData(type);
|
|
20
|
-
if (!raw) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const parsed = (0, studio_shared_1.parseElementDragData)(raw);
|
|
24
|
-
if (parsed) {
|
|
25
|
-
return parsed;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
15
|
+
const parsed = drag_and_drop_1.DragAndDropInternals.parseDragData(dataTransfer);
|
|
16
|
+
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'element' ? parsed.data : null;
|
|
29
17
|
};
|
|
30
18
|
exports.getElementDragData = getElementDragData;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CompositionDragData, type ComponentProp } from '@remotion/drag-and-drop';
|
|
2
|
+
import { type FileType, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
|
|
2
3
|
import type { Dimensions } from '../helpers/is-current-selected-still';
|
|
3
4
|
export type InsertElementDropPosition = {
|
|
4
5
|
readonly centerX: number;
|
|
@@ -51,9 +52,8 @@ export declare const getElementPositionForDrop: ({ dimensions, dropPosition, }:
|
|
|
51
52
|
dimensions: Dimensions | null;
|
|
52
53
|
dropPosition: InsertElementDropPosition | null;
|
|
53
54
|
}) => InsertableCompositionElementPosition | null;
|
|
54
|
-
export declare const getCompositionPositionForDrop: ({ compositionDimensions,
|
|
55
|
+
export declare const getCompositionPositionForDrop: ({ compositionDimensions, dropPosition, }: {
|
|
55
56
|
compositionDimensions: Dimensions;
|
|
56
|
-
destinationDimensions: Dimensions | null;
|
|
57
57
|
dropPosition: InsertElementDropPosition | null;
|
|
58
58
|
}) => InsertableCompositionElementPosition | null;
|
|
59
59
|
export declare const getAssetPositionForDrop: ({ assetDimensions, destinationDimensions, dropPosition, }: {
|
|
@@ -63,7 +63,7 @@ export declare const getAssetPositionForDrop: ({ assetDimensions, destinationDim
|
|
|
63
63
|
}) => InsertableCompositionElementPosition | null;
|
|
64
64
|
export declare const getComponentDimensions: (component: {
|
|
65
65
|
componentName: string;
|
|
66
|
-
dimensions?: import("@remotion/
|
|
66
|
+
dimensions?: import("@remotion/drag-and-drop").ComponentDimensions | undefined;
|
|
67
67
|
importName: string;
|
|
68
68
|
importPath: string;
|
|
69
69
|
props: ComponentProp[];
|
|
@@ -127,7 +127,7 @@ export declare const insertExistingAssets: ({ assetPaths, compositionFile, compo
|
|
|
127
127
|
export declare const insertComponent: ({ component, compositionFile, compositionId, dropPosition, from, }: {
|
|
128
128
|
component: {
|
|
129
129
|
componentName: string;
|
|
130
|
-
dimensions?: import("@remotion/
|
|
130
|
+
dimensions?: import("@remotion/drag-and-drop").ComponentDimensions | undefined;
|
|
131
131
|
importName: string;
|
|
132
132
|
importPath: string;
|
|
133
133
|
props: ComponentProp[];
|
|
@@ -137,11 +137,10 @@ export declare const insertComponent: ({ component, compositionFile, composition
|
|
|
137
137
|
dropPosition: InsertElementDropPosition | null;
|
|
138
138
|
from: number | null;
|
|
139
139
|
}) => Promise<void>;
|
|
140
|
-
export declare const insertComposition: ({ composition, compositionFile, compositionId,
|
|
140
|
+
export declare const insertComposition: ({ composition, compositionFile, compositionId, dropPosition, from, }: {
|
|
141
141
|
composition: CompositionDragData;
|
|
142
142
|
compositionFile: string;
|
|
143
143
|
compositionId: string;
|
|
144
|
-
destinationDimensions: Dimensions | null;
|
|
145
144
|
dropPosition: InsertElementDropPosition | null;
|
|
146
145
|
from: number | null;
|
|
147
146
|
}) => Promise<void>;
|
|
@@ -154,7 +153,7 @@ export declare const insertElement: ({ compositionFile, compositionId, dropPosit
|
|
|
154
153
|
slug: string;
|
|
155
154
|
displayName: string;
|
|
156
155
|
sourceCode: string;
|
|
157
|
-
dimensions: import("@remotion/
|
|
156
|
+
dimensions: import("@remotion/drag-and-drop").ComponentDimensions | null;
|
|
158
157
|
};
|
|
159
158
|
from: number | null;
|
|
160
159
|
}) => Promise<void>;
|
|
@@ -217,13 +217,7 @@ const getElementPositionForDrop = ({ dimensions, dropPosition, }) => {
|
|
|
217
217
|
return getCenteredPosition({ dimensions, dropPosition });
|
|
218
218
|
};
|
|
219
219
|
exports.getElementPositionForDrop = getElementPositionForDrop;
|
|
220
|
-
const getCompositionPositionForDrop = ({ compositionDimensions,
|
|
221
|
-
// No translation makes an equal-sized composition fill the destination.
|
|
222
|
-
if (destinationDimensions !== null &&
|
|
223
|
-
compositionDimensions.width === destinationDimensions.width &&
|
|
224
|
-
compositionDimensions.height === destinationDimensions.height) {
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
220
|
+
const getCompositionPositionForDrop = ({ compositionDimensions, dropPosition, }) => {
|
|
227
221
|
return getCenteredPosition({
|
|
228
222
|
dimensions: compositionDimensions,
|
|
229
223
|
dropPosition,
|
|
@@ -831,7 +825,7 @@ const serializeResolvedPropsForSourceCode = (props) => {
|
|
|
831
825
|
staticBase: window.remotion_staticBase,
|
|
832
826
|
}).serializedString;
|
|
833
827
|
};
|
|
834
|
-
const insertComposition = async ({ composition, compositionFile, compositionId,
|
|
828
|
+
const insertComposition = async ({ composition, compositionFile, compositionId, dropPosition, from, }) => {
|
|
835
829
|
if (composition.compositionId === compositionId) {
|
|
836
830
|
(0, NotificationCenter_1.showNotification)('Cannot add a composition to itself', 3000);
|
|
837
831
|
return;
|
|
@@ -864,7 +858,6 @@ const insertComposition = async ({ composition, compositionFile, compositionId,
|
|
|
864
858
|
serializedResolvedPropsWithCustomSchema: serializeResolvedPropsForSourceCode(calculated.props),
|
|
865
859
|
position: (0, exports.getCompositionPositionForDrop)({
|
|
866
860
|
compositionDimensions: dimensions,
|
|
867
|
-
destinationDimensions,
|
|
868
861
|
dropPosition,
|
|
869
862
|
}),
|
|
870
863
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MENU_TOOLBAR_HEIGHT = 30;
|