@remotion/studio 4.0.498 → 4.0.499
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/AssetSelectorItem.js +31 -3
- package/dist/components/Canvas.js +162 -7
- package/dist/components/CompositionSelector.js +13 -10
- package/dist/components/CompositionSelectorItem.js +21 -13
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorRuler/Ruler.js +5 -3
- package/dist/components/ForceSpecificCursor.js +13 -1
- package/dist/components/NewComposition/InputDragger.d.ts +27 -0
- package/dist/components/NewComposition/InputDragger.js +151 -23
- 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/TimelineInOutDragHandler.js +25 -1
- package/dist/components/Timeline/TimelineLayerEye.js +4 -1
- package/dist/components/Timeline/TimelineSequence.js +6 -1
- package/dist/components/Timeline/TimelineSequenceName.js +1 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +29 -11
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +6 -4
- package/dist/components/TopPanel.js +2 -1
- package/dist/components/composition-drop-preview.d.ts +33 -0
- package/dist/components/composition-drop-preview.js +67 -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/esm/{chunk-7a6q9hk2.js → chunk-pk1zwsn1.js} +3549 -2482
- package/dist/esm/internals.mjs +3549 -2482
- package/dist/esm/previewEntry.mjs +8342 -7275
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-effective-translation.d.ts +13 -1
- package/dist/helpers/get-effective-translation.js +12 -6
- package/dist/helpers/ruler-canvas-size.d.ts +7 -0
- package/dist/helpers/ruler-canvas-size.js +14 -1
- package/dist/helpers/use-image-metadata.d.ts +1 -0
- package/dist/helpers/use-image-metadata.js +8 -5
- package/dist/helpers/use-media-metadata.d.ts +1 -0
- package/dist/helpers/use-media-metadata.js +8 -5
- package/package.json +13 -12
|
@@ -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,7 +114,7 @@ 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("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, 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, maxFlexerSize: null, maxAntiFlexerSize: MAX_SIDEBAR_WIDTH, id: "canvas-to-right-sidebar", orientation: "vertical", children: [
|
|
117
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' ? (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] }) })
|
|
118
119
|
] }) }), jsx_runtime_1.jsx(PreviewToolbar_1.PreviewToolbar, { bufferStateDelayInMilliseconds: bufferStateDelayInMilliseconds, readOnlyStudio: readOnlyStudio }), jsx_runtime_1.jsx(CurrentCompositionSideEffects_1.TitleUpdater, {})
|
|
119
120
|
] }) }));
|
|
@@ -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,67 @@
|
|
|
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
|
+
points: [
|
|
17
|
+
{ x: left * scale, y: top * scale },
|
|
18
|
+
{ x: right * scale, y: top * scale },
|
|
19
|
+
{ x: right * scale, y: bottom * scale },
|
|
20
|
+
{ x: left * scale, y: bottom * scale },
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
const snap = (0, selected_outline_snap_1.findSelectedOutlineSnap)({
|
|
24
|
+
allowX: true,
|
|
25
|
+
allowY: true,
|
|
26
|
+
deltaX: 0,
|
|
27
|
+
deltaY: 0,
|
|
28
|
+
outlines: [outline],
|
|
29
|
+
scale,
|
|
30
|
+
targets: (0, selected_outline_snap_1.getSelectedOutlineSnapTargets)({
|
|
31
|
+
compositionHeight: destinationDimensions.height,
|
|
32
|
+
compositionWidth: destinationDimensions.width,
|
|
33
|
+
guides: [],
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
centerX: dropPosition.centerX + ((_a = snap.snapOffsetX) !== null && _a !== void 0 ? _a : 0),
|
|
38
|
+
centerY: dropPosition.centerY + ((_b = snap.snapOffsetY) !== null && _b !== void 0 ? _b : 0),
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.snapCompositionDropPosition = snapCompositionDropPosition;
|
|
42
|
+
const getCompositionDropPreviewBox = ({ canvasSize, destinationDimensions, preview, previewSize, }) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const scale = (0, studio_fit_padding_1.calculateStudioScale)({
|
|
45
|
+
canvasSize,
|
|
46
|
+
compositionHeight: destinationDimensions.height,
|
|
47
|
+
compositionWidth: destinationDimensions.width,
|
|
48
|
+
previewSize: previewSize.size,
|
|
49
|
+
});
|
|
50
|
+
const position = (0, import_assets_1.getCompositionPositionForDrop)({
|
|
51
|
+
compositionDimensions: preview.compositionDimensions,
|
|
52
|
+
dropPosition: preview.dropPosition,
|
|
53
|
+
});
|
|
54
|
+
const contentLeft = canvasSize.width / 2 -
|
|
55
|
+
(destinationDimensions.width * scale) / 2 -
|
|
56
|
+
previewSize.translation.x;
|
|
57
|
+
const contentTop = canvasSize.height / 2 -
|
|
58
|
+
(destinationDimensions.height * scale) / 2 -
|
|
59
|
+
previewSize.translation.y;
|
|
60
|
+
return {
|
|
61
|
+
left: contentLeft + ((_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : 0) * scale,
|
|
62
|
+
top: contentTop + ((_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : 0) * scale,
|
|
63
|
+
width: preview.compositionDimensions.width * scale,
|
|
64
|
+
height: preview.compositionDimensions.height * scale,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
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
|
},
|