@remotion/studio 4.0.471 → 4.0.473
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/rename-static-file.d.ts +6 -0
- package/dist/api/rename-static-file.js +18 -0
- package/dist/components/AssetSelector.js +55 -5
- package/dist/components/AssetSelectorItem.js +153 -27
- package/dist/components/Canvas.js +147 -0
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +12 -4
- package/dist/components/ConfirmationDialog-types.d.ts +8 -0
- package/dist/components/ConfirmationDialog-types.js +2 -0
- package/dist/components/ConfirmationDialog.d.ts +7 -0
- package/dist/components/ConfirmationDialog.js +103 -0
- package/dist/components/ContextMenu.d.ts +9 -1
- package/dist/components/ContextMenu.js +99 -47
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/Editor.js +14 -6
- package/dist/components/EditorContent.js +15 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.js +2 -0
- package/dist/components/ExplorerPanel.d.ts +0 -4
- package/dist/components/ExplorerPanel.js +8 -4
- package/dist/components/ExplorerPanelRef.d.ts +4 -0
- package/dist/components/ExplorerPanelRef.js +5 -0
- package/dist/components/FilePreview.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.d.ts +0 -1
- package/dist/components/InitialCompositionLoader.js +5 -27
- package/dist/components/Menu/MenuItem.js +7 -1
- package/dist/components/Menu/SubMenu.js +5 -1
- package/dist/components/Menu/portals.js +17 -8
- package/dist/components/MenuToolbar.js +5 -1
- package/dist/components/ModalContainer.js +6 -1
- package/dist/components/Modals.js +8 -2
- package/dist/components/NewComposition/CodemodFooter.js +2 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
- package/dist/components/NewComposition/DeleteFolder.js +39 -0
- package/dist/components/NewComposition/DeleteStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/DeleteStaticFile.js +44 -0
- package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
- package/dist/components/NewComposition/RenameFolder.js +60 -0
- package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/RenameStaticFile.js +118 -0
- package/dist/components/OptionsPanel.js +5 -1
- package/dist/components/OutlineToggle.d.ts +2 -0
- package/dist/components/OutlineToggle.js +20 -0
- package/dist/components/Preview.d.ts +0 -2
- package/dist/components/Preview.js +23 -33
- package/dist/components/PreviewToolbar.js +19 -6
- package/dist/components/RenderButton.js +8 -2
- package/dist/components/RenderPreview.js +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +105 -4
- package/dist/components/SelectedOutlineOverlay.js +578 -59
- package/dist/components/ShowOutlinesProvider.d.ts +4 -0
- package/dist/components/ShowOutlinesProvider.js +24 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/Splitter/SplitterContainer.js +9 -0
- package/dist/components/Splitter/SplitterHandle.js +65 -70
- package/dist/components/StaticFilePreview.js +2 -2
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
- package/dist/components/Timeline/Timeline.js +50 -15
- package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
- package/dist/components/Timeline/TimelineArrayField.js +210 -0
- package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
- package/dist/components/Timeline/TimelineBooleanField.js +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +43 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +479 -0
- package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
- package/dist/components/Timeline/TimelineColorField.js +2 -8
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +12 -2
- package/dist/components/Timeline/TimelineEffectItem.js +3 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +146 -26
- package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
- package/dist/components/Timeline/TimelineEnumField.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +41 -37
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -21
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
- package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
- package/dist/components/Timeline/TimelineLayerEye.js +8 -3
- package/dist/components/Timeline/TimelineList.js +2 -2
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
- package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
- package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
- package/dist/components/Timeline/TimelineNumberField.js +7 -11
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
- package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +41 -24
- package/dist/components/Timeline/TimelineRowChrome.js +8 -7
- package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
- package/dist/components/Timeline/TimelineScaleField.js +314 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
- package/dist/components/Timeline/TimelineSchemaField.js +8 -42
- package/dist/components/Timeline/TimelineSelection.js +3 -2
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +51 -10
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +282 -28
- package/dist/components/Timeline/TimelineSequencePropItem.js +161 -35
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +525 -0
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineTranslateField.js +21 -25
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
- package/dist/components/Timeline/apply-effect-response-to-code-values.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-code-values.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.js +4 -0
- package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
- package/dist/components/Timeline/call-move-keyframe.js +71 -0
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
- package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +7 -4
- package/dist/components/Timeline/delete-selected-timeline-item.js +33 -21
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
- package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
- package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
- package/dist/components/Timeline/get-node-keyframes.js +38 -5
- package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
- package/dist/components/Timeline/reset-selected-timeline-props.js +22 -8
- package/dist/components/Timeline/save-effect-prop.d.ts +14 -3
- package/dist/components/Timeline/save-effect-prop.js +36 -18
- package/dist/components/Timeline/save-prop-queue.d.ts +2 -1
- package/dist/components/Timeline/save-prop-queue.js +5 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -7
- package/dist/components/Timeline/save-sequence-prop.js +33 -30
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
- package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
- package/dist/components/Timeline/timeline-asset-link.js +37 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
- package/dist/components/Timeline/timeline-field-utils.js +5 -1
- package/dist/components/Timeline/timeline-translate-utils.js +9 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +378 -0
- package/dist/components/TopPanel.d.ts +1 -1
- package/dist/components/folder-menu-items.d.ts +12 -0
- package/dist/components/folder-menu-items.js +147 -0
- package/dist/components/import-assets.d.ts +22 -0
- package/dist/components/import-assets.js +294 -0
- package/dist/components/load-canvas-content-from-url.d.ts +1 -0
- package/dist/components/load-canvas-content-from-url.js +9 -3
- package/dist/components/use-select-asset.d.ts +1 -0
- package/dist/components/use-select-asset.js +30 -0
- package/dist/error-overlay/error-origin.d.ts +3 -0
- package/dist/error-overlay/error-origin.js +42 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
- package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
- package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
- package/dist/esm/{chunk-z0z9d4r0.js → chunk-q0jkt0zq.js} +23062 -17350
- package/dist/esm/internals.mjs +23062 -17350
- package/dist/esm/previewEntry.mjs +22351 -16615
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +7 -3
- package/dist/helpers/create-folder-tree.js +1 -0
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-folder-id.d.ts +4 -0
- package/dist/helpers/get-folder-id.js +7 -0
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
- package/dist/helpers/install-required-package.d.ts +1 -0
- package/dist/helpers/install-required-package.js +39 -0
- package/dist/helpers/remote-asset-drag.d.ts +4 -0
- package/dist/helpers/remote-asset-drag.js +73 -0
- package/dist/helpers/timeline-layout.js +5 -1
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/helpers/validate-folder-rename.d.ts +6 -0
- package/dist/helpers/validate-folder-rename.js +19 -0
- package/dist/hot-middleware-client/client.js +6 -0
- package/dist/state/editor-outlines.d.ts +8 -0
- package/dist/state/editor-outlines.js +18 -0
- package/dist/state/modals.d.ts +29 -2
- package/dist/state/scale-lock.d.ts +18 -0
- package/dist/state/scale-lock.js +59 -0
- package/package.json +10 -10
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShowOutlinesProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editor_outlines_1 = require("../state/editor-outlines");
|
|
7
|
+
const ShowOutlinesProvider = ({ children }) => {
|
|
8
|
+
const [editorShowOutlines, setEditorShowOutlinesState] = (0, react_1.useState)(() => (0, editor_outlines_1.loadEditorShowOutlinesOption)());
|
|
9
|
+
const setEditorShowOutlines = (0, react_1.useCallback)((newValue) => {
|
|
10
|
+
setEditorShowOutlinesState((prevState) => {
|
|
11
|
+
const newVal = newValue(prevState);
|
|
12
|
+
(0, editor_outlines_1.persistEditorShowOutlinesOption)(newVal);
|
|
13
|
+
return newVal;
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
const editorShowOutlinesCtx = (0, react_1.useMemo)(() => {
|
|
17
|
+
return {
|
|
18
|
+
editorShowOutlines,
|
|
19
|
+
setEditorShowOutlines,
|
|
20
|
+
};
|
|
21
|
+
}, [editorShowOutlines, setEditorShowOutlines]);
|
|
22
|
+
return (jsx_runtime_1.jsx(editor_outlines_1.EditorShowOutlinesContext.Provider, { value: editorShowOutlinesCtx, children: children }));
|
|
23
|
+
};
|
|
24
|
+
exports.ShowOutlinesProvider = ShowOutlinesProvider;
|
|
@@ -4,10 +4,10 @@ exports.SizeSelector = exports.getUniqueSizes = exports.getPreviewSizeLabel = vo
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
7
8
|
const Checkmark_1 = require("../icons/Checkmark");
|
|
8
9
|
const ControlButton_1 = require("./ControlButton");
|
|
9
10
|
const ComboBox_1 = require("./NewComposition/ComboBox");
|
|
10
|
-
const Preview_1 = require("./Preview");
|
|
11
11
|
const commonPreviewSizes = [
|
|
12
12
|
{
|
|
13
13
|
size: 'auto',
|
|
@@ -83,11 +83,11 @@ const SizeSelector = () => {
|
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
85
|
if (canvasContent.type === 'asset' &&
|
|
86
|
-
zoomableFileTypes.includes((0,
|
|
86
|
+
zoomableFileTypes.includes((0, get_preview_file_type_1.getPreviewFileType)(canvasContent.asset))) {
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
89
|
if (canvasContent.type === 'output' &&
|
|
90
|
-
zoomableFileTypes.includes((0,
|
|
90
|
+
zoomableFileTypes.includes((0, get_preview_file_type_1.getPreviewFileType)(canvasContent.path))) {
|
|
91
91
|
return true;
|
|
92
92
|
}
|
|
93
93
|
return false;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SplitterContainer = exports.containerColumn = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const player_1 = require("@remotion/player");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const timeline_1 = require("../../state/timeline");
|
|
7
8
|
const SplitterContext_1 = require("./SplitterContext");
|
|
@@ -46,6 +47,14 @@ const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFle
|
|
|
46
47
|
persistFlex,
|
|
47
48
|
ref,
|
|
48
49
|
]);
|
|
50
|
+
(0, react_1.useEffect)(() => {
|
|
51
|
+
const frame = requestAnimationFrame(() => {
|
|
52
|
+
player_1.PlayerInternals.updateAllElementsSizes();
|
|
53
|
+
});
|
|
54
|
+
return () => {
|
|
55
|
+
cancelAnimationFrame(frame);
|
|
56
|
+
};
|
|
57
|
+
});
|
|
49
58
|
return (jsx_runtime_1.jsx(SplitterContext_1.SplitterContext.Provider, { value: value, children: jsx_runtime_1.jsx("div", { ref: ref, style: orientation === 'horizontal' ? exports.containerColumn : containerRow, children: children }) }));
|
|
50
59
|
};
|
|
51
60
|
exports.SplitterContainer = SplitterContainer;
|
|
@@ -18,97 +18,92 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
|
|
|
18
18
|
if (!context) {
|
|
19
19
|
throw new Error('Cannot find splitter context');
|
|
20
20
|
}
|
|
21
|
-
const [lastPointerUp, setLastPointerUp] = (0, react_1.useState)(() => Date.now());
|
|
22
21
|
const ref = (0, react_1.useRef)(null);
|
|
22
|
+
// Keep the latest props/context readable inside the long-lived pointerdown
|
|
23
|
+
// listener without re-subscribing it on every render.
|
|
24
|
+
const latest = (0, react_1.useRef)({ context, allowToCollapse, onCollapse });
|
|
25
|
+
latest.current = { context, allowToCollapse, onCollapse };
|
|
23
26
|
(0, react_1.useEffect)(() => {
|
|
24
|
-
if (context.isDragging.current) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
27
|
const { current } = ref;
|
|
28
28
|
if (!current) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
throw new Error('cannot get value if not dragging');
|
|
34
|
-
}
|
|
35
|
-
if (!context.ref.current) {
|
|
36
|
-
throw new Error('domRect is not mounted');
|
|
37
|
-
}
|
|
38
|
-
const { width, height } = context.ref.current.getBoundingClientRect();
|
|
39
|
-
const change = (() => {
|
|
40
|
-
if (context.orientation === 'vertical') {
|
|
41
|
-
return ((e.clientX - context.isDragging.current.x) /
|
|
42
|
-
(width - exports.SPLITTER_HANDLE_SIZE));
|
|
43
|
-
}
|
|
44
|
-
return ((e.clientY - context.isDragging.current.y) /
|
|
45
|
-
(height - exports.SPLITTER_HANDLE_SIZE));
|
|
46
|
-
})();
|
|
47
|
-
const newFlex = context.flexValue + change;
|
|
48
|
-
if (clamp) {
|
|
49
|
-
return Math.min(context.maxFlex, Math.max(context.minFlex, newFlex));
|
|
50
|
-
}
|
|
51
|
-
return newFlex;
|
|
52
|
-
};
|
|
31
|
+
// Cleanup for the listeners that only exist for the duration of a drag.
|
|
32
|
+
let endDrag = null;
|
|
53
33
|
const onPointerDown = (e) => {
|
|
54
|
-
var _a;
|
|
55
34
|
if (e.button !== 0) {
|
|
56
35
|
return;
|
|
57
36
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
// Prevent deselection of currently selected items
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
// Capture the context and starting flex once, at drag start. The flex
|
|
40
|
+
// value updates on every pointermove, so it must not be re-read live.
|
|
41
|
+
const dragContext = latest.current.context;
|
|
42
|
+
const start = { x: e.clientX, y: e.clientY };
|
|
43
|
+
const startFlex = dragContext.flexValue;
|
|
44
|
+
dragContext.isDragging.current = start;
|
|
45
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(dragContext.orientation === 'horizontal' ? 'row-resize' : 'col-resize');
|
|
46
|
+
current.classList.add('remotion-splitter-active');
|
|
47
|
+
const getNewValue = (ev, clamp) => {
|
|
48
|
+
if (!dragContext.ref.current) {
|
|
49
|
+
throw new Error('domRect is not mounted');
|
|
50
|
+
}
|
|
51
|
+
const { width, height } = dragContext.ref.current.getBoundingClientRect();
|
|
52
|
+
const change = dragContext.orientation === 'vertical'
|
|
53
|
+
? (ev.clientX - start.x) / (width - exports.SPLITTER_HANDLE_SIZE)
|
|
54
|
+
: (ev.clientY - start.y) / (height - exports.SPLITTER_HANDLE_SIZE);
|
|
55
|
+
const newFlex = startFlex + change;
|
|
56
|
+
if (clamp) {
|
|
57
|
+
return Math.min(dragContext.maxFlex, Math.max(dragContext.minFlex, newFlex));
|
|
58
|
+
}
|
|
59
|
+
return newFlex;
|
|
61
60
|
};
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
endDrag = () => {
|
|
62
|
+
dragContext.isDragging.current = false;
|
|
63
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
64
|
+
current.classList.remove('remotion-splitter-active');
|
|
65
|
+
window.removeEventListener('pointermove', onPointerMove);
|
|
66
|
+
window.removeEventListener('pointerup', onPointerUp);
|
|
67
|
+
endDrag = null;
|
|
68
|
+
player_1.PlayerInternals.updateAllElementsSizes();
|
|
69
|
+
};
|
|
70
|
+
const onPointerMove = (ev) => {
|
|
71
|
+
if (!dragContext.isDragging.current) {
|
|
66
72
|
return;
|
|
67
73
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (context.isDragging.current) {
|
|
76
|
-
const val = getNewValue(e, true);
|
|
77
|
-
context.setFlexValue(val);
|
|
78
|
-
if (allowToCollapse === 'left') {
|
|
79
|
-
const unclamped = getNewValue(e, false);
|
|
80
|
-
if (unclamped < context.minFlex / 2) {
|
|
81
|
-
cleanup();
|
|
82
|
-
onCollapse();
|
|
83
|
-
setLastPointerUp(Date.now());
|
|
74
|
+
dragContext.setFlexValue(getNewValue(ev, true));
|
|
75
|
+
const collapse = latest.current.allowToCollapse;
|
|
76
|
+
if (collapse === 'left') {
|
|
77
|
+
const unclamped = getNewValue(ev, false);
|
|
78
|
+
if (unclamped < dragContext.minFlex / 2) {
|
|
79
|
+
endDrag === null || endDrag === void 0 ? void 0 : endDrag();
|
|
80
|
+
latest.current.onCollapse();
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
|
-
if (
|
|
87
|
-
const unclamped = 1 - getNewValue(
|
|
88
|
-
if (unclamped < (1 -
|
|
89
|
-
|
|
90
|
-
onCollapse();
|
|
91
|
-
setLastPointerUp(Date.now());
|
|
83
|
+
else if (collapse === 'right') {
|
|
84
|
+
const unclamped = 1 - getNewValue(ev, false);
|
|
85
|
+
if (unclamped < (1 - dragContext.maxFlex) / 2) {
|
|
86
|
+
endDrag === null || endDrag === void 0 ? void 0 : endDrag();
|
|
87
|
+
latest.current.onCollapse();
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
window.
|
|
103
|
-
|
|
90
|
+
};
|
|
91
|
+
const onPointerUp = (ev) => {
|
|
92
|
+
if (!dragContext.isDragging.current) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
dragContext.persistFlex(getNewValue(ev, true));
|
|
96
|
+
endDrag === null || endDrag === void 0 ? void 0 : endDrag();
|
|
97
|
+
};
|
|
98
|
+
window.addEventListener('pointermove', onPointerMove);
|
|
99
|
+
window.addEventListener('pointerup', onPointerUp);
|
|
104
100
|
};
|
|
105
101
|
current.addEventListener('pointerdown', onPointerDown);
|
|
106
102
|
return () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
103
|
+
current.removeEventListener('pointerdown', onPointerDown);
|
|
104
|
+
endDrag === null || endDrag === void 0 ? void 0 : endDrag();
|
|
110
105
|
};
|
|
111
|
-
}, [
|
|
106
|
+
}, []);
|
|
112
107
|
(0, react_1.useEffect)(() => {
|
|
113
108
|
const { current } = ref;
|
|
114
109
|
if (!current) {
|
|
@@ -6,8 +6,8 @@ const react_1 = require("react");
|
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const client_id_1 = require("../helpers/client-id");
|
|
8
8
|
const colors_1 = require("../helpers/colors");
|
|
9
|
+
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
9
10
|
const FilePreview_1 = require("./FilePreview");
|
|
10
|
-
const Preview_1 = require("./Preview");
|
|
11
11
|
const use_static_files_1 = require("./use-static-files");
|
|
12
12
|
const msgStyle = {
|
|
13
13
|
fontSize: 13,
|
|
@@ -21,7 +21,7 @@ const errMsgStyle = {
|
|
|
21
21
|
color: colors_1.LIGHT_TEXT,
|
|
22
22
|
};
|
|
23
23
|
const StaticFilePreview = ({ currentAsset, assetMetadata }) => {
|
|
24
|
-
const fileType = (0,
|
|
24
|
+
const fileType = (0, get_preview_file_type_1.getPreviewFileType)(currentAsset);
|
|
25
25
|
const staticFileSrc = (0, remotion_1.staticFile)(currentAsset);
|
|
26
26
|
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
27
27
|
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CanUpdateSequencePropStatusKeyframed, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
|
|
3
|
+
export type KeyframeSettingsModalState = {
|
|
4
|
+
type: 'keyframe-settings';
|
|
5
|
+
fileName: string;
|
|
6
|
+
nodePath: SequencePropsSubscriptionKey;
|
|
7
|
+
fieldKey: string;
|
|
8
|
+
fieldLabel: string;
|
|
9
|
+
status: CanUpdateSequencePropStatusKeyframed;
|
|
10
|
+
schema: SequenceSchema;
|
|
11
|
+
effectIndex: number | null;
|
|
12
|
+
};
|
|
13
|
+
export declare const KeyframeSettingsModal: React.FC<{
|
|
14
|
+
readonly state: KeyframeSettingsModalState;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyframeSettingsModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
8
|
+
const colors_1 = require("../../helpers/colors");
|
|
9
|
+
const modals_1 = require("../../state/modals");
|
|
10
|
+
const Button_1 = require("../Button");
|
|
11
|
+
const layout_1 = require("../layout");
|
|
12
|
+
const ModalButton_1 = require("../ModalButton");
|
|
13
|
+
const ModalFooter_1 = require("../ModalFooter");
|
|
14
|
+
const ModalHeader_1 = require("../ModalHeader");
|
|
15
|
+
const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
16
|
+
const DismissableModal_1 = require("../NewComposition/DismissableModal");
|
|
17
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
18
|
+
const call_update_keyframe_settings_1 = require("./call-update-keyframe-settings");
|
|
19
|
+
const container = {
|
|
20
|
+
padding: 16,
|
|
21
|
+
width: 520,
|
|
22
|
+
};
|
|
23
|
+
const row = {
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'space-between',
|
|
27
|
+
marginBottom: 12,
|
|
28
|
+
};
|
|
29
|
+
const label = {
|
|
30
|
+
fontSize: 13,
|
|
31
|
+
};
|
|
32
|
+
const helperText = {
|
|
33
|
+
color: 'rgba(255, 255, 255, 0.6)',
|
|
34
|
+
fontSize: 12,
|
|
35
|
+
lineHeight: 1.4,
|
|
36
|
+
marginTop: 4,
|
|
37
|
+
};
|
|
38
|
+
const comboStyle = {
|
|
39
|
+
minWidth: 150,
|
|
40
|
+
};
|
|
41
|
+
const posterizeInputStyle = {
|
|
42
|
+
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
43
|
+
borderRadius: 4,
|
|
44
|
+
minWidth: 64,
|
|
45
|
+
textAlign: 'right',
|
|
46
|
+
};
|
|
47
|
+
const extrapolateOptions = [
|
|
48
|
+
'extend',
|
|
49
|
+
'clamp',
|
|
50
|
+
'identity',
|
|
51
|
+
'wrap',
|
|
52
|
+
];
|
|
53
|
+
const labelForExtrapolate = (value) => value[0].toUpperCase() + value.slice(1);
|
|
54
|
+
const getExtrapolateValues = (onSelect) => {
|
|
55
|
+
return extrapolateOptions.map((value) => ({
|
|
56
|
+
type: 'item',
|
|
57
|
+
id: value,
|
|
58
|
+
keyHint: null,
|
|
59
|
+
label: labelForExtrapolate(value),
|
|
60
|
+
leftItem: null,
|
|
61
|
+
disabled: false,
|
|
62
|
+
onClick: () => onSelect(value),
|
|
63
|
+
quickSwitcherLabel: null,
|
|
64
|
+
subMenu: null,
|
|
65
|
+
value,
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
const KeyframeSettingsModal = ({ state }) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
71
|
+
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
72
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
73
|
+
const [left, setLeft] = (0, react_1.useState)(state.status.clamping.left);
|
|
74
|
+
const [right, setRight] = (0, react_1.useState)(state.status.clamping.right);
|
|
75
|
+
const [posterize, setPosterize] = (0, react_1.useState)((_a = state.status.posterize) !== null && _a !== void 0 ? _a : 0);
|
|
76
|
+
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
77
|
+
const canEditClamping = state.status.interpolationFunction === 'interpolate';
|
|
78
|
+
const close = (0, react_1.useCallback)(() => {
|
|
79
|
+
setSelectedModal(null);
|
|
80
|
+
}, [setSelectedModal]);
|
|
81
|
+
const leftOptions = (0, react_1.useMemo)(() => getExtrapolateValues(setLeft), []);
|
|
82
|
+
const rightOptions = (0, react_1.useMemo)(() => getExtrapolateValues(setRight), []);
|
|
83
|
+
const onPosterizeChange = (0, react_1.useCallback)((value) => {
|
|
84
|
+
setPosterize(Math.max(0, Math.round(value)));
|
|
85
|
+
}, []);
|
|
86
|
+
const posterizeFormatter = (0, react_1.useCallback)((value) => {
|
|
87
|
+
const numericValue = Number(value);
|
|
88
|
+
return String(Math.round(numericValue));
|
|
89
|
+
}, []);
|
|
90
|
+
const onSave = (0, react_1.useCallback)(() => {
|
|
91
|
+
if (previewServerState.type !== 'connected') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const settings = {
|
|
95
|
+
clamping: canEditClamping ? { left, right } : undefined,
|
|
96
|
+
posterize: posterize <= 0 ? undefined : posterize,
|
|
97
|
+
};
|
|
98
|
+
setSaving(true);
|
|
99
|
+
const promise = state.effectIndex === null
|
|
100
|
+
? (0, call_update_keyframe_settings_1.callUpdateSequenceKeyframeSettings)({
|
|
101
|
+
fileName: state.fileName,
|
|
102
|
+
nodePath: state.nodePath,
|
|
103
|
+
fieldKey: state.fieldKey,
|
|
104
|
+
settings,
|
|
105
|
+
schema: state.schema,
|
|
106
|
+
setCodeValues,
|
|
107
|
+
clientId: previewServerState.clientId,
|
|
108
|
+
})
|
|
109
|
+
: (0, call_update_keyframe_settings_1.callUpdateEffectKeyframeSettings)({
|
|
110
|
+
fileName: state.fileName,
|
|
111
|
+
nodePath: state.nodePath,
|
|
112
|
+
effectIndex: state.effectIndex,
|
|
113
|
+
fieldKey: state.fieldKey,
|
|
114
|
+
settings,
|
|
115
|
+
schema: state.schema,
|
|
116
|
+
setCodeValues,
|
|
117
|
+
clientId: previewServerState.clientId,
|
|
118
|
+
});
|
|
119
|
+
promise.then(close).finally(() => {
|
|
120
|
+
setSaving(false);
|
|
121
|
+
});
|
|
122
|
+
}, [
|
|
123
|
+
canEditClamping,
|
|
124
|
+
close,
|
|
125
|
+
left,
|
|
126
|
+
posterize,
|
|
127
|
+
previewServerState,
|
|
128
|
+
right,
|
|
129
|
+
setCodeValues,
|
|
130
|
+
state,
|
|
131
|
+
]);
|
|
132
|
+
const saveDisabled = saving || previewServerState.type !== 'connected';
|
|
133
|
+
return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
|
|
134
|
+
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Keyframe settings: ${state.fieldLabel}` }), jsx_runtime_1.jsxs("div", { style: container, children: [canEditClamping ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
135
|
+
jsx_runtime_1.jsxs("div", { style: row, children: [
|
|
136
|
+
jsx_runtime_1.jsx("div", { style: label, children: "Extrapolate left" }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: leftOptions, selectedId: left, title: "Extrapolate left", style: comboStyle })
|
|
137
|
+
] }), jsx_runtime_1.jsxs("div", { style: row, children: [
|
|
138
|
+
jsx_runtime_1.jsx("div", { style: label, children: "Extrapolate right" }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: rightOptions, selectedId: right, title: "Extrapolate right", style: comboStyle })
|
|
139
|
+
] })
|
|
140
|
+
] })) : null, jsx_runtime_1.jsxs("div", { style: row, children: [
|
|
141
|
+
jsx_runtime_1.jsxs("div", { children: [
|
|
142
|
+
jsx_runtime_1.jsx("div", { style: label, children: "Posterize" }), jsx_runtime_1.jsx("div", { style: helperText, children: "Use 0 to turn posterization off." })
|
|
143
|
+
] }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: posterize, status: "ok", onValueChange: onPosterizeChange, onValueChangeEnd: onPosterizeChange, onTextChange: () => undefined, min: 0, step: 1, formatter: posterizeFormatter, rightAlign: true, style: posterizeInputStyle })
|
|
144
|
+
] })
|
|
145
|
+
] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsxs(layout_1.Row, { justify: "flex-end", align: "center", children: [
|
|
146
|
+
jsx_runtime_1.jsx(Button_1.Button, { onClick: close, children: "Cancel" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx(ModalButton_1.ModalButton, { onClick: onSave, disabled: saveDisabled, children: "Save" })
|
|
147
|
+
] }) })
|
|
148
|
+
] }));
|
|
149
|
+
};
|
|
150
|
+
exports.KeyframeSettingsModal = KeyframeSettingsModal;
|
|
@@ -44,6 +44,7 @@ const is_current_selected_still_1 = require("../../helpers/is-current-selected-s
|
|
|
44
44
|
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
45
45
|
const call_api_1 = require("../call-api");
|
|
46
46
|
const ContextMenu_1 = require("../ContextMenu");
|
|
47
|
+
const import_assets_1 = require("../import-assets");
|
|
47
48
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
48
49
|
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
49
50
|
const SplitterContainer_1 = require("../Splitter/SplitterContainer");
|
|
@@ -77,12 +78,14 @@ const container = {
|
|
|
77
78
|
backgroundColor: colors_1.BACKGROUND,
|
|
78
79
|
};
|
|
79
80
|
const noop = () => undefined;
|
|
80
|
-
const
|
|
81
|
+
const TimelineContextMenuArea = ({ children }) => {
|
|
81
82
|
var _a, _b;
|
|
82
|
-
const { clearSelection } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
83
83
|
const { compositions, canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
84
84
|
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
85
85
|
const [isAddingSolid, setIsAddingSolid] = (0, react_1.useState)(false);
|
|
86
|
+
const [isAddingAsset, setIsAddingAsset] = (0, react_1.useState)(false);
|
|
87
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
88
|
+
const previewConnected = previewServerState.type === 'connected';
|
|
86
89
|
const currentCompositionId = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ? canvasContent.compositionId : null;
|
|
87
90
|
const currentComposition = (0, react_1.useMemo)(() => {
|
|
88
91
|
var _a;
|
|
@@ -97,20 +100,18 @@ const TimelineClearSelectionArea = ({ children }) => {
|
|
|
97
100
|
compositionFile,
|
|
98
101
|
compositionId: currentCompositionId,
|
|
99
102
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// and should clear the current selection.
|
|
103
|
-
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
104
|
-
if (e.button !== 0) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
clearSelection();
|
|
108
|
-
}, [clearSelection]);
|
|
109
|
-
const canInsertSolid = (compositionComponentInfo === null || compositionComponentInfo === void 0 ? void 0 : compositionComponentInfo.canAddSequence) === true &&
|
|
103
|
+
const canInsertSolid = previewConnected &&
|
|
104
|
+
(compositionComponentInfo === null || compositionComponentInfo === void 0 ? void 0 : compositionComponentInfo.canAddSequence) === true &&
|
|
110
105
|
currentCompositionId !== null &&
|
|
111
106
|
compositionFile !== null &&
|
|
112
107
|
videoConfig !== null &&
|
|
113
108
|
!isAddingSolid;
|
|
109
|
+
const canInsertAsset = previewConnected &&
|
|
110
|
+
!window.remotion_isReadOnlyStudio &&
|
|
111
|
+
(compositionComponentInfo === null || compositionComponentInfo === void 0 ? void 0 : compositionComponentInfo.canAddSequence) === true &&
|
|
112
|
+
currentCompositionId !== null &&
|
|
113
|
+
compositionFile !== null &&
|
|
114
|
+
!isAddingAsset;
|
|
114
115
|
const insertSolid = (0, react_1.useCallback)(async () => {
|
|
115
116
|
if (!canInsertSolid ||
|
|
116
117
|
currentCompositionId === null ||
|
|
@@ -142,6 +143,28 @@ const TimelineClearSelectionArea = ({ children }) => {
|
|
|
142
143
|
setIsAddingSolid(false);
|
|
143
144
|
}
|
|
144
145
|
}, [canInsertSolid, compositionFile, currentCompositionId, videoConfig]);
|
|
146
|
+
const insertAsset = (0, react_1.useCallback)(async () => {
|
|
147
|
+
if (!canInsertAsset ||
|
|
148
|
+
currentCompositionId === null ||
|
|
149
|
+
compositionFile === null) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const files = await (0, import_assets_1.pickFilesToImport)();
|
|
153
|
+
if (files.length === 0) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
setIsAddingAsset(true);
|
|
157
|
+
try {
|
|
158
|
+
await (0, import_assets_1.importAssets)({
|
|
159
|
+
files,
|
|
160
|
+
compositionFile,
|
|
161
|
+
compositionId: currentCompositionId,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
setIsAddingAsset(false);
|
|
166
|
+
}
|
|
167
|
+
}, [canInsertAsset, compositionFile, currentCompositionId]);
|
|
145
168
|
const contextMenuItems = (0, react_1.useMemo)(() => {
|
|
146
169
|
return [
|
|
147
170
|
{
|
|
@@ -156,9 +179,21 @@ const TimelineClearSelectionArea = ({ children }) => {
|
|
|
156
179
|
quickSwitcherLabel: null,
|
|
157
180
|
disabled: !canInsertSolid,
|
|
158
181
|
},
|
|
182
|
+
{
|
|
183
|
+
type: 'item',
|
|
184
|
+
id: 'insert-asset',
|
|
185
|
+
label: 'Add asset',
|
|
186
|
+
value: 'insert-asset',
|
|
187
|
+
onClick: insertAsset,
|
|
188
|
+
keyHint: null,
|
|
189
|
+
leftItem: null,
|
|
190
|
+
subMenu: null,
|
|
191
|
+
quickSwitcherLabel: null,
|
|
192
|
+
disabled: !canInsertAsset,
|
|
193
|
+
},
|
|
159
194
|
];
|
|
160
|
-
}, [insertSolid, canInsertSolid]);
|
|
161
|
-
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { ref: timeline_refs_1.timelineVerticalScroll, values: contextMenuItems, onOpen: null, style: container, className: 'css-reset ' + is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME,
|
|
195
|
+
}, [insertSolid, canInsertSolid, insertAsset, canInsertAsset]);
|
|
196
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { ref: timeline_refs_1.timelineVerticalScroll, values: contextMenuItems, onOpen: null, style: container, className: 'css-reset ' + is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: children }));
|
|
162
197
|
};
|
|
163
198
|
const TimelineInner = () => {
|
|
164
199
|
var _a;
|
|
@@ -188,7 +223,7 @@ const TimelineInner = () => {
|
|
|
188
223
|
: filtered;
|
|
189
224
|
}, [filtered]);
|
|
190
225
|
const hasBeenCut = filtered.length > shown.length;
|
|
191
|
-
return (jsx_runtime_1.jsxs(
|
|
226
|
+
return (jsx_runtime_1.jsxs(TimelineContextMenuArea, { children: [sequences.map((sequence) => {
|
|
192
227
|
if (!sequence.controls || !previewConnected || !sequence.getStack()) {
|
|
193
228
|
return null;
|
|
194
229
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
3
|
+
export declare const TimelineArrayField: React.FC<{
|
|
4
|
+
readonly field: SchemaFieldInfo;
|
|
5
|
+
readonly effectiveValue: unknown;
|
|
6
|
+
readonly onSave: TimelineFieldOnSave;
|
|
7
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
8
|
+
readonly onDragEnd: () => void;
|
|
9
|
+
}>;
|