@remotion/studio 4.0.500 → 4.0.502
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/Studio.js +1 -1
- package/dist/api/delete-static-file.js +8 -3
- package/dist/api/rename-static-file.js +8 -0
- package/dist/api/watch-public-folder.js +2 -1
- package/dist/api/watch-static-file.js +2 -1
- package/dist/api/write-static-file.js +8 -3
- package/dist/components/AssetSelector.js +3 -1
- package/dist/components/AssetSelectorItem.d.ts +2 -1
- package/dist/components/AssetSelectorItem.js +7 -4
- package/dist/components/Canvas.js +9 -4
- package/dist/components/CaptionInspector.d.ts +10 -0
- package/dist/components/CaptionInspector.js +24 -0
- package/dist/components/CaptionTextEditor.d.ts +9 -0
- package/dist/components/CaptionTextEditor.js +132 -0
- package/dist/components/CompositionSelector.js +4 -4
- package/dist/components/CompositionSelectorItem.js +5 -5
- package/dist/components/CurrentAsset.js +3 -2
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorContexts.d.ts +0 -1
- package/dist/components/EditorContexts.js +2 -2
- package/dist/components/FpsCounter.js +3 -3
- package/dist/components/FullscreenToggle.d.ts +3 -1
- package/dist/components/FullscreenToggle.js +3 -2
- package/dist/components/GlobalKeybindings.js +2 -0
- package/dist/components/InitialCompositionLoader.d.ts +1 -1
- package/dist/components/InlineAction.js +2 -1
- package/dist/components/InlineCaptionInspector.d.ts +11 -0
- package/dist/components/InlineCaptionInspector.js +108 -0
- package/dist/components/InspectorPanel/CompositionInspector.js +5 -3
- package/dist/components/InspectorPanel/SelectedInspector.d.ts +1 -0
- package/dist/components/InspectorPanel/SelectedInspector.js +2 -2
- package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +1 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -4
- package/dist/components/InspectorPanel/inspector-section-collapse.d.ts +22 -0
- package/dist/components/InspectorPanel/inspector-section-collapse.js +165 -0
- package/dist/components/InspectorPanel/styles.js +7 -1
- package/dist/components/InspectorPanel/use-composition-actions.d.ts +4 -1
- package/dist/components/InspectorPanel/use-composition-actions.js +135 -7
- package/dist/components/InspectorPanel.js +2 -2
- package/dist/components/InspectorSequenceSection.d.ts +2 -1
- package/dist/components/InspectorSequenceSection.js +238 -8
- package/dist/components/LoopToggle.d.ts +1 -0
- package/dist/components/LoopToggle.js +9 -5
- package/dist/components/Menu/MenuSubItem.js +9 -1
- package/dist/components/MenuToolbar.js +8 -1
- package/dist/components/Modals.js +1 -1
- package/dist/components/ObserveDefaultPropsContext.js +7 -4
- package/dist/components/PlayPause.d.ts +1 -0
- package/dist/components/PlayPause.js +2 -4
- package/dist/components/PlaybackRateSelector.d.ts +9 -2
- package/dist/components/PlaybackRateSelector.js +21 -10
- package/dist/components/PreviewToolbar.js +19 -109
- package/dist/components/PreviewToolbarOverflowButton.d.ts +12 -0
- package/dist/components/PreviewToolbarOverflowButton.js +217 -0
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +6 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.js +2 -2
- package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +6 -0
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +42 -9
- package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +2 -0
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +7 -1
- package/dist/components/RenderButton.d.ts +1 -0
- package/dist/components/RenderButton.js +6 -4
- package/dist/components/RenderQueue/ClientRenderQueueProcessor.d.ts +0 -1
- package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -14
- package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -2
- package/dist/components/SelectedOutlineElement.js +1 -4
- package/dist/components/SelectedOutlineOverlay.js +17 -8
- package/dist/components/ShowOutlinesProvider.js +4 -1
- package/dist/components/SizeSelector.d.ts +6 -0
- package/dist/components/SizeSelector.js +17 -8
- package/dist/components/Splitter/SplitterContainer.d.ts +1 -0
- package/dist/components/Splitter/SplitterContainer.js +23 -3
- package/dist/components/Splitter/SplitterContext.d.ts +14 -0
- package/dist/components/Splitter/SplitterContext.js +16 -1
- package/dist/components/Splitter/SplitterHandle.js +8 -6
- package/dist/components/Timeline/Timeline.js +21 -6
- package/dist/components/Timeline/TimelineAssetField.d.ts +1 -1
- package/dist/components/Timeline/TimelineAssetField.js +37 -1
- package/dist/components/Timeline/TimelineDragHandler.js +1 -1
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +8 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +7 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +3 -1
- package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
- package/dist/components/Timeline/TimelineRowChrome.js +4 -3
- package/dist/components/Timeline/TimelineSelection.d.ts +4 -2
- package/dist/components/Timeline/TimelineSelection.js +9 -6
- package/dist/components/Timeline/TimelineSequence.js +1 -4
- package/dist/components/Timeline/TimelineSequenceItem.js +4 -5
- package/dist/components/Timeline/TimelineSequencePropItem.js +9 -10
- package/dist/components/Timeline/TimelineStack/get-stack.js +8 -0
- package/dist/components/Timeline/TimelineTrack.js +4 -2
- package/dist/components/Timeline/border-radius-representation.d.ts +16 -0
- package/dist/components/Timeline/border-radius-representation.js +60 -0
- package/dist/components/Timeline/delete-selected-timeline-item.js +1 -6
- package/dist/components/Timeline/get-sequence-prop-reset-changes.d.ts +10 -0
- package/dist/components/Timeline/get-sequence-prop-reset-changes.js +33 -0
- package/dist/components/Timeline/reset-selected-timeline-props.js +2 -8
- package/dist/components/Timeline/save-sequence-prop.d.ts +12 -1
- package/dist/components/Timeline/save-sequence-prop.js +28 -4
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -2
- package/dist/components/Timeline/sequence-props-subscription-store.js +3 -3
- package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
- package/dist/components/Timeline/use-timeline-asset-drop.js +4 -0
- package/dist/components/TopPanel.js +1 -1
- package/dist/components/UndoRedoButtons.js +15 -6
- package/dist/components/UpdateCheck.js +11 -4
- package/dist/components/default-props-api.d.ts +3 -0
- package/dist/components/default-props-api.js +19 -0
- package/dist/components/drop-handler-data.d.ts +1 -1
- package/dist/components/drop-handler-data.js +6 -6
- package/dist/components/effect-drag-and-drop.d.ts +1 -1
- package/dist/components/effect-drag-and-drop.js +3 -3
- package/dist/components/element-drag-and-drop.d.ts +1 -1
- package/dist/components/element-drag-and-drop.js +3 -3
- package/dist/components/handle-drop.d.ts +3 -2
- package/dist/components/handle-drop.js +2 -1
- package/dist/components/import-assets.d.ts +8 -6
- package/dist/components/import-assets.js +20 -7
- package/dist/components/sequence-props-api.d.ts +4 -0
- package/dist/components/sequence-props-api.js +26 -0
- package/dist/components/use-element-overwrite-confirmation.d.ts +2 -0
- package/dist/components/use-element-overwrite-confirmation.js +73 -0
- package/dist/components/use-static-files.js +7 -2
- package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +13 -2
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +1 -0
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +29 -5
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +4 -20
- package/dist/esm/{chunk-dr1y1vm3.js → chunk-fjv75ty4.js} +8478 -6609
- package/dist/esm/index.mjs +24 -8
- package/dist/esm/internals.mjs +8478 -6609
- package/dist/esm/previewEntry.mjs +8535 -6666
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/browser-studio-operations.d.ts +3 -0
- package/dist/helpers/browser-studio-operations.js +14 -0
- package/dist/helpers/client-id.d.ts +0 -1
- package/dist/helpers/client-id.js +15 -10
- package/dist/helpers/download-blob.d.ts +1 -0
- package/dist/helpers/download-blob.js +15 -0
- package/dist/helpers/inject-css.js +5 -3
- package/dist/helpers/open-in-editor.js +26 -5
- package/dist/helpers/preview-server-events.js +46 -9
- package/dist/helpers/use-create-composition.js +8 -6
- package/dist/helpers/use-menu-structure.js +29 -0
- package/dist/hot-middleware-client/client.js +3 -3
- package/dist/icons/border-radius.d.ts +4 -0
- package/dist/icons/border-radius.js +8 -0
- package/dist/icons/fullscreen.d.ts +4 -0
- package/dist/icons/fullscreen.js +6 -0
- package/dist/icons/upload.d.ts +4 -0
- package/dist/icons/upload.js +8 -0
- package/dist/previewEntry.js +1 -1
- package/dist/state/modals.d.ts +5 -0
- package/dist/state/timeline-sequence-hover.d.ts +17 -0
- package/dist/state/timeline-sequence-hover.js +33 -0
- package/package.json +13 -12
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSequencePropResetChanges = void 0;
|
|
4
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const isVisibleFieldSchema = (fieldSchema) => fieldSchema !== undefined && fieldSchema.type !== 'hidden';
|
|
7
|
+
const getDefaultValue = (fieldSchema) => fieldSchema.default !== undefined
|
|
8
|
+
? JSON.stringify(fieldSchema.default)
|
|
9
|
+
: null;
|
|
10
|
+
const getSequencePropResetChanges = ({ fileName, nodePath, fieldKey, value, defaultValue, schema, }) => {
|
|
11
|
+
const flatSchema = remotion_1.Internals.getFlatSchemaWithAllKeys(schema);
|
|
12
|
+
const longhandChanges = (0, studio_shared_1.getStylePropertyLonghandKeys)(fieldKey).flatMap((longhandKey) => {
|
|
13
|
+
const fieldSchema = flatSchema[longhandKey];
|
|
14
|
+
if (!isVisibleFieldSchema(fieldSchema)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
fileName,
|
|
20
|
+
nodePath,
|
|
21
|
+
fieldKey: longhandKey,
|
|
22
|
+
value: fieldSchema.default,
|
|
23
|
+
defaultValue: getDefaultValue(fieldSchema),
|
|
24
|
+
schema,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
});
|
|
28
|
+
return [
|
|
29
|
+
{ fileName, nodePath, fieldKey, value, defaultValue, schema },
|
|
30
|
+
...longhandChanges,
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
exports.getSequencePropResetChanges = getSequencePropResetChanges;
|
|
@@ -4,6 +4,7 @@ exports.resetSelectedTimelineProps = exports.getTimelinePropResetTargets = void
|
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
|
|
7
|
+
const get_sequence_prop_reset_changes_1 = require("./get-sequence-prop-reset-changes");
|
|
7
8
|
const save_effect_prop_1 = require("./save-effect-prop");
|
|
8
9
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
9
10
|
const isPropResetSelection = (selection) => selection.type === 'sequence-prop' ||
|
|
@@ -157,14 +158,7 @@ const resetSelectedTimelineProps = ({ selections, sequences, overrideIdsToNodePa
|
|
|
157
158
|
resetPromises.push((0, save_sequence_prop_1.saveSequenceProps)({
|
|
158
159
|
addedKeyframes: null,
|
|
159
160
|
movedKeyframes: null,
|
|
160
|
-
changes: sequencePropTargets.
|
|
161
|
-
fileName: target.fileName,
|
|
162
|
-
nodePath: target.nodePath,
|
|
163
|
-
fieldKey: target.fieldKey,
|
|
164
|
-
value: target.value,
|
|
165
|
-
defaultValue: target.defaultValue,
|
|
166
|
-
schema: target.schema,
|
|
167
|
-
})),
|
|
161
|
+
changes: sequencePropTargets.flatMap((target) => (0, get_sequence_prop_reset_changes_1.getSequencePropResetChanges)(target)),
|
|
168
162
|
setPropStatuses,
|
|
169
163
|
clientId,
|
|
170
164
|
undoLabel: sequencePropTargets.length > 1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SaveSequencePropSourceEdit } from '@remotion/studio-shared';
|
|
1
|
+
import { type CaptionPatch, type SaveSequencePropSourceEdit } from '@remotion/studio-shared';
|
|
2
2
|
import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey, InteractivitySchema } from 'remotion';
|
|
3
3
|
import type { AddSequenceKeyframeChange } from './call-add-keyframe';
|
|
4
4
|
import { type MoveEffectKeyframeChange, type MoveSequenceKeyframeChange } from './call-move-keyframe';
|
|
@@ -24,5 +24,16 @@ type SaveSequencePropsOptions = {
|
|
|
24
24
|
undoLabel: string;
|
|
25
25
|
redoLabel: string;
|
|
26
26
|
};
|
|
27
|
+
export declare const saveInlineCaptionPatches: ({ fileName, nodePath, schema, patches, nextCaptions, setPropStatuses, clientId, undoLabel, redoLabel, }: {
|
|
28
|
+
fileName: string;
|
|
29
|
+
nodePath: SequencePropsSubscriptionKey;
|
|
30
|
+
schema: InteractivitySchema;
|
|
31
|
+
patches: CaptionPatch[];
|
|
32
|
+
nextCaptions: unknown;
|
|
33
|
+
setPropStatuses: SetPropStatuses;
|
|
34
|
+
clientId: string;
|
|
35
|
+
undoLabel: string;
|
|
36
|
+
redoLabel: string;
|
|
37
|
+
}) => Promise<void>;
|
|
27
38
|
export declare const saveSequenceProps: ({ changes, addedKeyframes, movedKeyframes, setPropStatuses, clientId, undoLabel, redoLabel, }: SaveSequencePropsOptions) => Promise<void>;
|
|
28
39
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.saveSequenceProps = void 0;
|
|
3
|
+
exports.saveSequenceProps = exports.saveInlineCaptionPatches = void 0;
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
|
-
const
|
|
5
|
+
const sequence_props_api_1 = require("../sequence-props-api");
|
|
6
6
|
const call_move_keyframe_1 = require("./call-move-keyframe");
|
|
7
7
|
const save_prop_queue_1 = require("./save-prop-queue");
|
|
8
8
|
const serializeSequencePropValue = (value) => {
|
|
@@ -11,6 +11,30 @@ const serializeSequencePropValue = (value) => {
|
|
|
11
11
|
}
|
|
12
12
|
return { type: 'json', serialized: JSON.stringify(value) };
|
|
13
13
|
};
|
|
14
|
+
const saveInlineCaptionPatches = ({ fileName, nodePath, schema, patches, nextCaptions, setPropStatuses, clientId, undoLabel, redoLabel, }) => {
|
|
15
|
+
return (0, save_prop_queue_1.enqueueSavePropChange)({
|
|
16
|
+
nodePath,
|
|
17
|
+
setPropStatuses,
|
|
18
|
+
applyOptimistic: (previous) => (0, studio_shared_1.optimisticUpdateForPropStatuses)({
|
|
19
|
+
previous,
|
|
20
|
+
fieldKey: 'captions',
|
|
21
|
+
value: nextCaptions,
|
|
22
|
+
defaultValue: null,
|
|
23
|
+
schema,
|
|
24
|
+
}),
|
|
25
|
+
apiCall: () => (0, sequence_props_api_1.saveSequenceProps)({
|
|
26
|
+
edits: [],
|
|
27
|
+
captionPatches: [{ fileName, nodePath, schema, patches }],
|
|
28
|
+
addedKeyframes: null,
|
|
29
|
+
movedKeyframes: null,
|
|
30
|
+
clientId,
|
|
31
|
+
undoLabel,
|
|
32
|
+
redoLabel,
|
|
33
|
+
}),
|
|
34
|
+
errorLabel: 'Could not save captions',
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.saveInlineCaptionPatches = saveInlineCaptionPatches;
|
|
14
38
|
const saveSequenceProps = ({ changes, addedKeyframes, movedKeyframes, setPropStatuses, clientId, undoLabel, redoLabel, }) => {
|
|
15
39
|
const keyframesToAdd = addedKeyframes === null ? [] : addedKeyframes;
|
|
16
40
|
const sequenceKeyframes = movedKeyframes === null ? [] : movedKeyframes.sequenceKeyframes;
|
|
@@ -41,7 +65,7 @@ const saveSequenceProps = ({ changes, addedKeyframes, movedKeyframes, setPropSta
|
|
|
41
65
|
}),
|
|
42
66
|
apiCall: () => {
|
|
43
67
|
var _a;
|
|
44
|
-
return (0,
|
|
68
|
+
return (0, sequence_props_api_1.saveSequenceProps)({
|
|
45
69
|
edits: [
|
|
46
70
|
{
|
|
47
71
|
fileName: change.fileName,
|
|
@@ -86,7 +110,7 @@ const saveSequenceProps = ({ changes, addedKeyframes, movedKeyframes, setPropSta
|
|
|
86
110
|
schema: change.schema,
|
|
87
111
|
}));
|
|
88
112
|
}
|
|
89
|
-
return (0,
|
|
113
|
+
return (0, sequence_props_api_1.saveSequenceProps)({
|
|
90
114
|
edits: changes.map((change) => {
|
|
91
115
|
var _a;
|
|
92
116
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SequenceNodePath, InteractivitySchema, VideoConfigValues } from 'remotion';
|
|
2
|
-
import {
|
|
3
|
-
type SubscribeResult = Awaited<ReturnType<typeof
|
|
2
|
+
import { subscribeToSequenceProps } from '../sequence-props-api';
|
|
3
|
+
type SubscribeResult = Awaited<ReturnType<typeof subscribeToSequenceProps>>;
|
|
4
4
|
type ApplyResult = (result: SubscribeResult) => void;
|
|
5
5
|
export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, }: {
|
|
6
6
|
fileName: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.acquireSequencePropsSubscription = void 0;
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
-
const
|
|
6
|
+
const sequence_props_api_1 = require("../sequence-props-api");
|
|
7
7
|
const makeKey = ({ fileName, line, column, componentIdentity, sequenceKeys, assetKeys, effectKeys, videoConfigValues, }) => `${fileName}\0${line}\0${column}\0${componentIdentity !== null && componentIdentity !== void 0 ? componentIdentity : ''}\0${sequenceKeys.join('\0')}\0${assetKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}\0${JSON.stringify(videoConfigValues)}`;
|
|
8
8
|
const entries = new Map();
|
|
9
9
|
const acquireSequencePropsSubscription = ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, }) => {
|
|
@@ -22,7 +22,7 @@ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, comp
|
|
|
22
22
|
});
|
|
23
23
|
let entry = entries.get(key);
|
|
24
24
|
if (!entry) {
|
|
25
|
-
const promise = (0,
|
|
25
|
+
const promise = (0, sequence_props_api_1.subscribeToSequenceProps)({
|
|
26
26
|
fileName,
|
|
27
27
|
line,
|
|
28
28
|
column,
|
|
@@ -86,7 +86,7 @@ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, comp
|
|
|
86
86
|
if (!result.success) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
return (0,
|
|
89
|
+
return (0, sequence_props_api_1.unsubscribeFromSequenceProps)({
|
|
90
90
|
fileName: acquired.fileName,
|
|
91
91
|
nodePath: result.nodePath,
|
|
92
92
|
clientId: acquired.clientId,
|
|
@@ -11,6 +11,7 @@ const effect_drag_and_drop_1 = require("../effect-drag-and-drop");
|
|
|
11
11
|
const handle_drop_1 = require("../handle-drop");
|
|
12
12
|
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
13
13
|
const SvgImportDialog_1 = require("../SvgImportDialog");
|
|
14
|
+
const use_element_overwrite_confirmation_1 = require("../use-element-overwrite-confirmation");
|
|
14
15
|
const timeline_refs_1 = require("./timeline-refs");
|
|
15
16
|
const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
|
|
16
17
|
const use_resolved_stack_1 = require("./use-resolved-stack");
|
|
@@ -30,6 +31,7 @@ const useTimelineAssetDrop = () => {
|
|
|
30
31
|
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
31
32
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
32
33
|
const chooseSvgImportMode = (0, SvgImportDialog_1.useSvgImportDialog)();
|
|
34
|
+
const confirmElementOverwrite = (0, use_element_overwrite_confirmation_1.useElementOverwriteConfirmation)();
|
|
33
35
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
34
36
|
const [isAddingAsset, setIsAddingAsset] = (0, react_1.useState)(false);
|
|
35
37
|
const [assetDropFrame, setAssetDropFrame] = (0, react_1.useState)(null);
|
|
@@ -120,6 +122,7 @@ const useTimelineAssetDrop = () => {
|
|
|
120
122
|
await (0, handle_drop_1.handleDrop)({
|
|
121
123
|
chooseSvgImportMode,
|
|
122
124
|
compositionFile,
|
|
125
|
+
confirmElementOverwrite,
|
|
123
126
|
compositionId: currentCompositionId,
|
|
124
127
|
destinationDimensions: {
|
|
125
128
|
height: videoConfig.height,
|
|
@@ -142,6 +145,7 @@ const useTimelineAssetDrop = () => {
|
|
|
142
145
|
chooseSvgImportMode,
|
|
143
146
|
compositionComponentInfo === null || compositionComponentInfo === void 0 ? void 0 : compositionComponentInfo.canAddSequence,
|
|
144
147
|
compositionFile,
|
|
148
|
+
confirmElementOverwrite,
|
|
145
149
|
currentCompositionId,
|
|
146
150
|
getDropFrame,
|
|
147
151
|
videoConfig,
|
|
@@ -114,7 +114,7 @@ const TopPanelInner = ({ readOnlyStudio, onMounted, drawRef, bufferStateDelayInM
|
|
|
114
114
|
return (jsx_runtime_1.jsx(ObserveDefaultPropsContext_1.ObserveDefaultProps, { compositionId: (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition'
|
|
115
115
|
? canvasContent.compositionId
|
|
116
116
|
: null, readOnlyStudio: readOnlyStudio, children: jsx_runtime_1.jsxs("div", { style: container, 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, 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: [
|
|
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, minFlexerSize: null, 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, minFlexerSize: null, maxAntiFlexerSize: MAX_SIDEBAR_WIDTH, id: "canvas-to-right-sidebar", orientation: "vertical", children: [
|
|
118
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] }) })
|
|
119
119
|
] }) }), jsx_runtime_1.jsx(PreviewToolbar_1.PreviewToolbar, { bufferStateDelayInMilliseconds: bufferStateDelayInMilliseconds, readOnlyStudio: readOnlyStudio }), jsx_runtime_1.jsx(CurrentCompositionSideEffects_1.TitleUpdater, {})
|
|
120
120
|
] }) }));
|
|
@@ -4,6 +4,7 @@ exports.UndoRedoButtons = void 0;
|
|
|
4
4
|
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
|
+
const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
|
|
7
8
|
const client_id_1 = require("../helpers/client-id");
|
|
8
9
|
const is_mac_1 = require("../helpers/is-mac");
|
|
9
10
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
@@ -37,7 +38,11 @@ const UndoRedoButtons = () => {
|
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
undoInFlight.current = true;
|
|
40
|
-
(0,
|
|
41
|
+
const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
|
|
42
|
+
const promise = browserStudioOperations
|
|
43
|
+
? browserStudioOperations.undo()
|
|
44
|
+
: (0, call_api_1.callApi)('/api/undo', {});
|
|
45
|
+
promise
|
|
41
46
|
.catch(() => {
|
|
42
47
|
// Ignore errors
|
|
43
48
|
})
|
|
@@ -50,7 +55,11 @@ const UndoRedoButtons = () => {
|
|
|
50
55
|
return;
|
|
51
56
|
}
|
|
52
57
|
redoInFlight.current = true;
|
|
53
|
-
(0,
|
|
58
|
+
const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
|
|
59
|
+
const promise = browserStudioOperations
|
|
60
|
+
? browserStudioOperations.redo()
|
|
61
|
+
: (0, call_api_1.callApi)('/api/redo', {});
|
|
62
|
+
promise
|
|
54
63
|
.catch(() => {
|
|
55
64
|
// Ignore errors
|
|
56
65
|
})
|
|
@@ -121,11 +130,11 @@ const UndoRedoButtons = () => {
|
|
|
121
130
|
? `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Shift+Z)`
|
|
122
131
|
: `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Y)`;
|
|
123
132
|
const renderUndo = (0, react_1.useCallback)((color) => {
|
|
124
|
-
return
|
|
125
|
-
}, [
|
|
133
|
+
return jsx_runtime_1.jsx(undo_1.UndoIcon, { style: { ...iconStyle, color } });
|
|
134
|
+
}, []);
|
|
126
135
|
const renderRedo = (0, react_1.useCallback)((color) => {
|
|
127
|
-
return
|
|
128
|
-
}, [
|
|
136
|
+
return jsx_runtime_1.jsx(redo_1.RedoIcon, { style: { ...iconStyle, color } });
|
|
137
|
+
}, []);
|
|
129
138
|
const canUndo = undoFile !== null;
|
|
130
139
|
const canRedo = redoFile !== null;
|
|
131
140
|
if (!canUndo && !canRedo) {
|
|
@@ -10,7 +10,6 @@ const z_index_1 = require("../state/z-index");
|
|
|
10
10
|
const actions_1 = require("./RenderQueue/actions");
|
|
11
11
|
const buttonStyle = {
|
|
12
12
|
appearance: 'none',
|
|
13
|
-
color: colors_1.BLUE,
|
|
14
13
|
border: 'none',
|
|
15
14
|
fontWeight: 'bold',
|
|
16
15
|
backgroundColor: colors_1.TRANSPARENT,
|
|
@@ -24,6 +23,7 @@ const UpdateCheck = () => {
|
|
|
24
23
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
25
24
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
26
25
|
const [knownBugs, setKnownBugs] = (0, react_1.useState)(null);
|
|
26
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
27
27
|
const hasKnownBugs = (0, react_1.useMemo)(() => {
|
|
28
28
|
return knownBugs && knownBugs.length > 0;
|
|
29
29
|
}, [knownBugs]);
|
|
@@ -78,18 +78,25 @@ const UpdateCheck = () => {
|
|
|
78
78
|
const dynButtonStyle = (0, react_1.useMemo)(() => {
|
|
79
79
|
return {
|
|
80
80
|
...buttonStyle,
|
|
81
|
-
color: hasKnownBugs ? colors_1.WARNING_COLOR : colors_1.
|
|
81
|
+
color: hovered ? colors_1.WHITE : hasKnownBugs ? colors_1.WARNING_COLOR : colors_1.WHITE_ALPHA_80,
|
|
82
82
|
};
|
|
83
|
-
}, [hasKnownBugs]);
|
|
83
|
+
}, [hasKnownBugs, hovered]);
|
|
84
|
+
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
85
|
+
setHovered(true);
|
|
86
|
+
}, []);
|
|
87
|
+
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
88
|
+
setHovered(false);
|
|
89
|
+
}, []);
|
|
84
90
|
if (!info) {
|
|
85
91
|
return null;
|
|
86
92
|
}
|
|
87
93
|
if (!info.updateAvailable) {
|
|
88
94
|
return null;
|
|
89
95
|
}
|
|
90
|
-
return (jsx_runtime_1.jsx("button", { tabIndex: tabIndex, style: dynButtonStyle, onClick: openModal, type: "button", title: hasKnownBugs ? 'Bugfixes available' : 'Update available', children: hasKnownBugs ? ('Bugfixes available') : (jsx_runtime_1.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", style: {
|
|
96
|
+
return (jsx_runtime_1.jsx("button", { tabIndex: tabIndex, style: dynButtonStyle, onClick: openModal, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, type: "button", title: hasKnownBugs ? 'Bugfixes available' : 'Update available', children: hasKnownBugs ? ('Bugfixes available') : (jsx_runtime_1.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", style: {
|
|
91
97
|
height: 16,
|
|
92
98
|
width: 16,
|
|
99
|
+
color: 'inherit',
|
|
93
100
|
}, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.CURRENT_COLOR_LOWERCASE, d: "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM135.1 217.4c-4.5 4.2-7.1 10.1-7.1 16.3c0 12.3 10 22.3 22.3 22.3H208v96c0 17.7 14.3 32 32 32h32c17.7 0 32-14.3 32-32V256h57.7c12.3 0 22.3-10 22.3-22.3c0-6.2-2.6-12.1-7.1-16.3L269.8 117.5c-3.8-3.5-8.7-5.5-13.8-5.5s-10.1 2-13.8 5.5L135.1 217.4z" }) })) }));
|
|
94
101
|
};
|
|
95
102
|
exports.UpdateCheck = UpdateCheck;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SubscribeToDefaultPropsRequest, UnsubscribeFromDefaultPropsRequest } from '@remotion/studio-shared';
|
|
2
|
+
export declare const subscribeToDefaultProps: (request: SubscribeToDefaultPropsRequest) => Promise<import("@remotion/studio-shared").CanUpdateDefaultPropsResponse>;
|
|
3
|
+
export declare const unsubscribeFromDefaultProps: (request: UnsubscribeFromDefaultPropsRequest) => Promise<undefined>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unsubscribeFromDefaultProps = exports.subscribeToDefaultProps = void 0;
|
|
4
|
+
const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
|
|
5
|
+
const call_api_1 = require("./call-api");
|
|
6
|
+
const subscribeToDefaultProps = (request) => {
|
|
7
|
+
const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
|
|
8
|
+
return browserStudioOperations
|
|
9
|
+
? browserStudioOperations.subscribeToDefaultProps(request)
|
|
10
|
+
: (0, call_api_1.callApi)('/api/subscribe-to-default-props', request);
|
|
11
|
+
};
|
|
12
|
+
exports.subscribeToDefaultProps = subscribeToDefaultProps;
|
|
13
|
+
const unsubscribeFromDefaultProps = (request) => {
|
|
14
|
+
const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
|
|
15
|
+
return browserStudioOperations
|
|
16
|
+
? browserStudioOperations.unsubscribeFromDefaultProps(request)
|
|
17
|
+
: (0, call_api_1.callApi)('/api/unsubscribe-from-default-props', request);
|
|
18
|
+
};
|
|
19
|
+
exports.unsubscribeFromDefaultProps = unsubscribeFromDefaultProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentDragData, type CompositionDragData } from '@remotion/
|
|
1
|
+
import { type ComponentDragData, type CompositionDragData } from '@remotion/studio-protocol';
|
|
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 studio_protocol_1 = require("@remotion/studio-protocol");
|
|
5
5
|
const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
|
|
6
6
|
const isFileDragEvent = (event) => {
|
|
7
7
|
var _a;
|
|
@@ -12,7 +12,7 @@ exports.isFileDragEvent = isFileDragEvent;
|
|
|
12
12
|
const isRemotionDragEvent = (event, type) => {
|
|
13
13
|
var _a, _b;
|
|
14
14
|
var _c;
|
|
15
|
-
return (((_b =
|
|
15
|
+
return (((_b = studio_protocol_1.StudioProtocolInternals.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
16
|
};
|
|
17
17
|
const isAssetDragEvent = (event) => {
|
|
18
18
|
return isRemotionDragEvent(event, 'asset');
|
|
@@ -56,28 +56,28 @@ const isSupportedDropEvent = (event) => {
|
|
|
56
56
|
exports.isSupportedDropEvent = isSupportedDropEvent;
|
|
57
57
|
const getAssetDragPath = (event) => {
|
|
58
58
|
const parsed = event.dataTransfer
|
|
59
|
-
?
|
|
59
|
+
? studio_protocol_1.StudioProtocolInternals.parseDragData(event.dataTransfer)
|
|
60
60
|
: null;
|
|
61
61
|
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'asset' ? parsed.data.assetPath : null;
|
|
62
62
|
};
|
|
63
63
|
exports.getAssetDragPath = getAssetDragPath;
|
|
64
64
|
const getCompositionDragData = (event) => {
|
|
65
65
|
const parsed = event.dataTransfer
|
|
66
|
-
?
|
|
66
|
+
? studio_protocol_1.StudioProtocolInternals.parseDragData(event.dataTransfer)
|
|
67
67
|
: null;
|
|
68
68
|
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'composition' ? parsed.data : null;
|
|
69
69
|
};
|
|
70
70
|
exports.getCompositionDragData = getCompositionDragData;
|
|
71
71
|
const getComponentDragData = (event) => {
|
|
72
72
|
const parsed = event.dataTransfer
|
|
73
|
-
?
|
|
73
|
+
? studio_protocol_1.StudioProtocolInternals.parseDragData(event.dataTransfer)
|
|
74
74
|
: null;
|
|
75
75
|
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'component' ? parsed.data : null;
|
|
76
76
|
};
|
|
77
77
|
exports.getComponentDragData = getComponentDragData;
|
|
78
78
|
const getSfxDragUrl = (event) => {
|
|
79
79
|
const parsed = event.dataTransfer
|
|
80
|
-
?
|
|
80
|
+
? studio_protocol_1.StudioProtocolInternals.parseDragData(event.dataTransfer)
|
|
81
81
|
: null;
|
|
82
82
|
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'sfx' ? parsed.data.sfx.url : null;
|
|
83
83
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EffectDragData } from '@remotion/
|
|
1
|
+
import { type EffectDragData } from '@remotion/studio-protocol';
|
|
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,14 +1,14 @@
|
|
|
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
|
|
4
|
+
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const install_required_package_1 = require("../helpers/install-required-package");
|
|
7
7
|
const call_api_1 = require("./call-api");
|
|
8
8
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
9
9
|
const hasEffectDragType = (dataTransfer) => {
|
|
10
10
|
var _a;
|
|
11
|
-
return (((_a =
|
|
11
|
+
return (((_a = studio_protocol_1.StudioProtocolInternals.getDragPreviewMetadata(dataTransfer.types)) === null || _a === void 0 ? void 0 : _a.type) ===
|
|
12
12
|
'effect');
|
|
13
13
|
};
|
|
14
14
|
exports.hasEffectDragType = hasEffectDragType;
|
|
@@ -17,7 +17,7 @@ const hasExplicitEffectDragType = (dataTransfer) => {
|
|
|
17
17
|
};
|
|
18
18
|
exports.hasExplicitEffectDragType = hasExplicitEffectDragType;
|
|
19
19
|
const getEffectDragData = (dataTransfer) => {
|
|
20
|
-
const parsed =
|
|
20
|
+
const parsed = studio_protocol_1.StudioProtocolInternals.parseDragData(dataTransfer);
|
|
21
21
|
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'effect' ? parsed.data : null;
|
|
22
22
|
};
|
|
23
23
|
exports.getEffectDragData = getEffectDragData;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ElementDragData } from '@remotion/
|
|
1
|
+
import { type ElementDragData } from '@remotion/studio-protocol';
|
|
2
2
|
export declare const hasElementDragType: (dataTransfer: DataTransfer | null) => boolean;
|
|
3
3
|
export declare const getElementDragData: (dataTransfer: DataTransfer | null) => ElementDragData | null;
|
|
@@ -1,18 +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 studio_protocol_1 = require("@remotion/studio-protocol");
|
|
5
5
|
const hasElementDragType = (dataTransfer) => {
|
|
6
6
|
var _a;
|
|
7
7
|
var _b;
|
|
8
|
-
return (((_a =
|
|
8
|
+
return (((_a = studio_protocol_1.StudioProtocolInternals.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');
|
|
9
9
|
};
|
|
10
10
|
exports.hasElementDragType = hasElementDragType;
|
|
11
11
|
const getElementDragData = (dataTransfer) => {
|
|
12
12
|
if (!dataTransfer) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
|
-
const parsed =
|
|
15
|
+
const parsed = studio_protocol_1.StudioProtocolInternals.parseDragData(dataTransfer);
|
|
16
16
|
return (parsed === null || parsed === void 0 ? void 0 : parsed.type) === 'element' ? parsed.data : null;
|
|
17
17
|
};
|
|
18
18
|
exports.getElementDragData = getElementDragData;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Dimensions } from '../helpers/is-current-selected-still';
|
|
2
|
-
import { type InsertElementDropPosition } from './import-assets';
|
|
2
|
+
import { type ConfirmElementOverwrite, type InsertElementDropPosition } from './import-assets';
|
|
3
3
|
import type { SvgImportMode } from './SvgImportDialog';
|
|
4
|
-
export declare const handleDrop: ({ chooseSvgImportMode, compositionFile, compositionId, destinationDimensions, dropPosition, event, fps, from, }: {
|
|
4
|
+
export declare const handleDrop: ({ chooseSvgImportMode, compositionFile, confirmElementOverwrite, compositionId, destinationDimensions, dropPosition, event, fps, from, }: {
|
|
5
5
|
chooseSvgImportMode: () => Promise<SvgImportMode | null>;
|
|
6
6
|
compositionFile: string;
|
|
7
|
+
confirmElementOverwrite: ConfirmElementOverwrite;
|
|
7
8
|
compositionId: string;
|
|
8
9
|
destinationDimensions: Dimensions | null;
|
|
9
10
|
dropPosition: InsertElementDropPosition | null;
|
|
@@ -5,7 +5,7 @@ const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
|
|
|
5
5
|
const drop_handler_data_1 = require("./drop-handler-data");
|
|
6
6
|
const element_drag_and_drop_1 = require("./element-drag-and-drop");
|
|
7
7
|
const import_assets_1 = require("./import-assets");
|
|
8
|
-
const handleDrop = async ({ chooseSvgImportMode, compositionFile, compositionId, destinationDimensions, dropPosition, event, fps, from, }) => {
|
|
8
|
+
const handleDrop = async ({ chooseSvgImportMode, compositionFile, confirmElementOverwrite, compositionId, destinationDimensions, dropPosition, event, fps, from, }) => {
|
|
9
9
|
var _a;
|
|
10
10
|
var _b;
|
|
11
11
|
if ((0, drop_handler_data_1.isFileDragEvent)(event)) {
|
|
@@ -80,6 +80,7 @@ const handleDrop = async ({ chooseSvgImportMode, compositionFile, compositionId,
|
|
|
80
80
|
await (0, import_assets_1.insertElement)({
|
|
81
81
|
compositionFile,
|
|
82
82
|
compositionId,
|
|
83
|
+
confirmOverwrite: confirmElementOverwrite,
|
|
83
84
|
dropPosition,
|
|
84
85
|
element: element.element,
|
|
85
86
|
from,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type CompositionDragData, type ComponentProp } from '@remotion/
|
|
2
|
-
import { type FileType, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
|
|
1
|
+
import { type CompositionDragData, type ComponentProp } from '@remotion/studio-protocol';
|
|
2
|
+
import { type FileType, type InsertElementFileConflict, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
|
|
3
3
|
import type { Dimensions } from '../helpers/is-current-selected-still';
|
|
4
4
|
export type InsertElementDropPosition = {
|
|
5
5
|
readonly centerX: number;
|
|
6
6
|
readonly centerY: number;
|
|
7
7
|
};
|
|
8
|
+
export type ConfirmElementOverwrite = (conflict: InsertElementFileConflict) => Promise<boolean>;
|
|
8
9
|
export declare const getAssetElement: ({ fileType, src, }: {
|
|
9
10
|
fileType: FileType;
|
|
10
11
|
src: string;
|
|
@@ -63,7 +64,7 @@ export declare const getAssetPositionForDrop: ({ assetDimensions, destinationDim
|
|
|
63
64
|
}) => InsertableCompositionElementPosition | null;
|
|
64
65
|
export declare const getComponentDimensions: (component: {
|
|
65
66
|
componentName: string;
|
|
66
|
-
dimensions?: import("@remotion/
|
|
67
|
+
dimensions?: import("@remotion/studio-protocol").ComponentDimensions | undefined;
|
|
67
68
|
importName: string;
|
|
68
69
|
importPath: string;
|
|
69
70
|
props: ComponentProp[];
|
|
@@ -127,7 +128,7 @@ export declare const insertExistingAssets: ({ assetPaths, compositionFile, compo
|
|
|
127
128
|
export declare const insertComponent: ({ component, compositionFile, compositionId, dropPosition, from, }: {
|
|
128
129
|
component: {
|
|
129
130
|
componentName: string;
|
|
130
|
-
dimensions?: import("@remotion/
|
|
131
|
+
dimensions?: import("@remotion/studio-protocol").ComponentDimensions | undefined;
|
|
131
132
|
importName: string;
|
|
132
133
|
importPath: string;
|
|
133
134
|
props: ComponentProp[];
|
|
@@ -144,16 +145,17 @@ export declare const insertComposition: ({ composition, compositionFile, composi
|
|
|
144
145
|
dropPosition: InsertElementDropPosition | null;
|
|
145
146
|
from: number | null;
|
|
146
147
|
}) => Promise<void>;
|
|
147
|
-
export declare const insertElement: ({ compositionFile, compositionId, dropPosition, element, from, }: {
|
|
148
|
+
export declare const insertElement: ({ compositionFile, compositionId, confirmOverwrite, dropPosition, element, from, }: {
|
|
148
149
|
compositionFile: string;
|
|
149
150
|
compositionId: string;
|
|
151
|
+
confirmOverwrite: ConfirmElementOverwrite;
|
|
150
152
|
dropPosition: InsertElementDropPosition | null;
|
|
151
153
|
element: {
|
|
152
154
|
dependencies: string[];
|
|
153
155
|
slug: string;
|
|
154
156
|
displayName: string;
|
|
155
157
|
sourceCode: string;
|
|
156
|
-
dimensions: import("@remotion/
|
|
158
|
+
dimensions: import("@remotion/studio-protocol").ComponentDimensions | null;
|
|
157
159
|
};
|
|
158
160
|
from: number | null;
|
|
159
161
|
}) => Promise<void>;
|
|
@@ -872,21 +872,34 @@ const insertComposition = async ({ composition, compositionFile, compositionId,
|
|
|
872
872
|
}
|
|
873
873
|
};
|
|
874
874
|
exports.insertComposition = insertComposition;
|
|
875
|
-
const insertElement = async ({ compositionFile, compositionId, dropPosition, element, from, }) => {
|
|
875
|
+
const insertElement = async ({ compositionFile, compositionId, confirmOverwrite, dropPosition, element, from, }) => {
|
|
876
876
|
try {
|
|
877
877
|
await (0, install_required_package_1.installRequiredPackages)(element.dependencies);
|
|
878
|
-
const
|
|
878
|
+
const position = (0, exports.getElementPositionForDrop)({
|
|
879
|
+
dimensions: element.dimensions,
|
|
880
|
+
dropPosition,
|
|
881
|
+
});
|
|
882
|
+
const callInsertElementApi = (overwriteExisting) => (0, call_api_1.callApi)('/api/insert-element', {
|
|
879
883
|
compositionFile,
|
|
880
884
|
compositionId,
|
|
881
885
|
element,
|
|
882
886
|
from,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
dropPosition,
|
|
886
|
-
}),
|
|
887
|
+
overwriteExisting,
|
|
888
|
+
position,
|
|
887
889
|
});
|
|
890
|
+
let response = await callInsertElementApi(false);
|
|
891
|
+
if (!response.success && response.type === 'file-conflict') {
|
|
892
|
+
const shouldOverwrite = await confirmOverwrite(response.conflict);
|
|
893
|
+
if (!shouldOverwrite) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
response = await callInsertElementApi(true);
|
|
897
|
+
}
|
|
888
898
|
if (!response.success) {
|
|
889
|
-
|
|
899
|
+
const reason = response.type === 'error'
|
|
900
|
+
? response.reason
|
|
901
|
+
: `Element file still conflicts: ${response.conflict.filePath}`;
|
|
902
|
+
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${reason}`, 4000);
|
|
890
903
|
return;
|
|
891
904
|
}
|
|
892
905
|
(0, NotificationCenter_1.showNotification)(`Added ${element.displayName} to source file`, 2000);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SaveSequencePropsRequest, SaveSequencePropsResponse, SubscribeToSequencePropsRequest, SubscribeToSequencePropsResponse, UnsubscribeFromSequencePropsRequest } from '@remotion/studio-shared';
|
|
2
|
+
export declare const saveSequenceProps: (request: SaveSequencePropsRequest) => Promise<SaveSequencePropsResponse>;
|
|
3
|
+
export declare const subscribeToSequenceProps: (request: SubscribeToSequencePropsRequest) => Promise<SubscribeToSequencePropsResponse>;
|
|
4
|
+
export declare const unsubscribeFromSequenceProps: (request: UnsubscribeFromSequencePropsRequest) => Promise<undefined>;
|