@remotion/cli 4.1.0-alpha1 → 4.1.0-alpha10
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/benchmark.js +16 -7
- package/dist/chalk/index.d.ts +2 -1
- package/dist/codemods/stringify-with-path.js +24 -19
- package/dist/compositions.js +9 -4
- package/dist/config/index.d.ts +24 -0
- package/dist/config/index.js +19 -1
- package/dist/editor/components/AssetSelector.d.ts +2 -0
- package/dist/editor/components/AssetSelector.js +30 -0
- package/dist/editor/components/AssetSelectorItem.d.ts +6 -0
- package/dist/editor/components/AssetSelectorItem.js +109 -0
- package/dist/editor/components/Canvas.js +4 -4
- package/dist/editor/components/CanvasOrLoading.js +20 -1
- package/dist/editor/components/CopyButton.js +5 -2
- package/dist/editor/components/Editor.js +1 -3
- package/dist/editor/components/ExplorerPanel.d.ts +8 -0
- package/dist/editor/components/ExplorerPanel.js +67 -0
- package/dist/editor/components/FramePersistor.d.ts +0 -2
- package/dist/editor/components/FramePersistor.js +4 -24
- package/dist/editor/components/FullscreenToggle.d.ts +2 -0
- package/dist/editor/components/FullscreenToggle.js +25 -0
- package/dist/editor/components/GlobalKeybindings.js +1 -1
- package/dist/editor/components/InitialCompositionLoader.js +1 -22
- package/dist/editor/components/KeyboardShortcutsExplainer.js +1 -1
- package/dist/editor/components/NewComposition/InputDragger.js +13 -1
- package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
- package/dist/editor/components/OpenEditorButton.js +5 -2
- package/dist/editor/components/OptionsPanel.d.ts +8 -0
- package/dist/editor/components/OptionsPanel.js +79 -0
- package/dist/editor/components/PlayPause.js +4 -4
- package/dist/editor/components/PlaybackRateSelector.js +1 -1
- package/dist/editor/components/PreviewToolbar.js +3 -1
- package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.js +3 -3
- package/dist/editor/components/RenderModal/DataEditor.d.ts +2 -0
- package/dist/editor/components/RenderModal/DataEditor.js +13 -10
- package/dist/editor/components/RenderModal/FrameRangeSetting.js +9 -25
- package/dist/editor/components/RenderModal/MultiRangeSlider.d.ts +12 -0
- package/dist/editor/components/RenderModal/MultiRangeSlider.js +50 -0
- package/dist/editor/components/RenderModal/RenderModal.js +7 -3
- package/dist/editor/components/RenderModal/RenderModalBasic.d.ts +2 -3
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -2
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +10 -11
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +26 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -3
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -2
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +7 -7
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodFieldValidation.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +29 -10
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +0 -1
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +9 -3
- package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
- package/dist/editor/components/RenderQueue/actions.d.ts +1 -1
- package/dist/editor/components/RenderQueue/actions.js +12 -4
- package/dist/editor/components/RightPanel.js +45 -12
- package/dist/editor/components/SetTimelineInOutProvider.js +5 -4
- package/dist/editor/components/SidebarRenderButton.js +3 -1
- package/dist/editor/components/Timeline/TimelineDragHandler.js +45 -19
- package/dist/editor/components/TimelineInOutToggle.d.ts +2 -1
- package/dist/editor/components/TimelineInOutToggle.js +82 -67
- package/dist/editor/helpers/is-composition-still.d.ts +1 -1
- package/dist/editor/helpers/is-current-selected-still.js +5 -6
- package/dist/editor/helpers/use-menu-structure.js +25 -1
- package/dist/editor/icons/keys.js +1 -0
- package/dist/editor/state/canvas-ref.d.ts +2 -0
- package/dist/editor/state/canvas-ref.js +5 -0
- package/dist/editor/state/in-out.d.ts +3 -2
- package/dist/editor/state/in-out.js +22 -5
- package/dist/editor/state/marks.d.ts +3 -2
- package/dist/editor/state/marks.js +6 -6
- package/dist/error-with-stack-frame.d.ts +19 -0
- package/dist/error-with-stack-frame.js +81 -0
- package/dist/get-composition-id.d.ts +6 -6
- package/dist/get-composition-id.js +13 -6
- package/dist/get-composition-with-dimension-override.d.ts +6 -6
- package/dist/get-composition-with-dimension-override.js +3 -3
- package/dist/handle-common-errors.js +8 -0
- package/dist/handle-javascript-error.d.ts +20 -0
- package/dist/handle-javascript-error.js +81 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.js +5 -2
- package/dist/log.d.ts +6 -1
- package/dist/parse-command-line.js +1 -1
- package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
- package/dist/preview-server/dev-middleware/setup-hooks.js +1 -1
- package/dist/preview-server/render-queue/job.d.ts +2 -2
- package/dist/preview-server/render-queue/make-retry-payload.js +3 -2
- package/dist/preview-server/render-queue/open-directory-in-finder.js +11 -5
- package/dist/preview-server/render-queue/process-still.js +1 -1
- package/dist/preview-server/render-queue/process-video.js +1 -1
- package/dist/preview-server/routes/add-render.js +2 -2
- package/dist/preview-server/routes/update-default-props.js +1 -2
- package/dist/print-compositions.d.ts +2 -2
- package/dist/print-error.js +6 -3
- package/dist/progress-bar.js +2 -5
- package/dist/render-flows/render.d.ts +2 -2
- package/dist/render-flows/render.js +31 -22
- package/dist/render-flows/still.d.ts +2 -2
- package/dist/render-flows/still.js +20 -14
- package/dist/render.js +6 -1
- package/dist/setup-cache.js +1 -1
- package/dist/still.js +6 -1
- package/dist/symbolicate-error.d.ts +3 -0
- package/dist/symbolicate-error.js +24 -0
- package/dist/symbolicate-errors.d.ts +7 -0
- package/dist/symbolicate-errors.js +90 -0
- package/dist/symbolicate-stacktrace.d.ts +28 -0
- package/dist/symbolicate-stacktrace.js +135 -0
- package/dist/symbolicateable-error.d.ts +16 -0
- package/dist/symbolicateable-error.js +18 -0
- package/package.json +11 -11
- package/styles/styles.css +53 -0
|
@@ -1,41 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FramePersistor = exports.
|
|
3
|
+
exports.FramePersistor = exports.getCurrentCompositionFromUrl = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const getCurrentCompositionFromUrl = () => {
|
|
7
7
|
return window.location.pathname.substr(1);
|
|
8
8
|
};
|
|
9
9
|
exports.getCurrentCompositionFromUrl = getCurrentCompositionFromUrl;
|
|
10
|
-
const makeKey = (composition) => {
|
|
11
|
-
return `remotion.time.${composition}`;
|
|
12
|
-
};
|
|
13
|
-
const persistCurrentFrame = (frame) => {
|
|
14
|
-
const currentComposition = (0, exports.getCurrentCompositionFromUrl)();
|
|
15
|
-
if (!currentComposition) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
localStorage.setItem(makeKey(currentComposition), String(frame));
|
|
19
|
-
};
|
|
20
|
-
exports.persistCurrentFrame = persistCurrentFrame;
|
|
21
|
-
const getFrameForComposition = (composition) => {
|
|
22
|
-
const frame = localStorage.getItem(makeKey(composition));
|
|
23
|
-
return frame ? Number(frame) : 0;
|
|
24
|
-
};
|
|
25
|
-
exports.getFrameForComposition = getFrameForComposition;
|
|
26
10
|
const FramePersistor = () => {
|
|
27
11
|
const [playing] = remotion_1.Internals.Timeline.usePlayingState();
|
|
12
|
+
const config = (0, remotion_1.useVideoConfig)();
|
|
28
13
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
29
|
-
const { currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
30
|
-
const isActive = currentComposition === (0, exports.getCurrentCompositionFromUrl)();
|
|
31
14
|
(0, react_1.useEffect)(() => {
|
|
32
|
-
if (!isActive) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
15
|
if (!playing) {
|
|
36
|
-
(
|
|
16
|
+
remotion_1.Internals.persistCurrentFrame(frame, config.id);
|
|
37
17
|
}
|
|
38
|
-
}, [
|
|
18
|
+
}, [config.id, frame, playing]);
|
|
39
19
|
return null;
|
|
40
20
|
};
|
|
41
21
|
exports.FramePersistor = FramePersistor;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FullScreenToggle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const canvas_ref_1 = require("../state/canvas-ref");
|
|
7
|
+
const preview_size_1 = require("../state/preview-size");
|
|
8
|
+
const ControlButton_1 = require("./ControlButton");
|
|
9
|
+
const FullScreenToggle = () => {
|
|
10
|
+
const { setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
|
|
11
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
12
|
+
var _a;
|
|
13
|
+
(_a = canvas_ref_1.canvasRef.current) === null || _a === void 0 ? void 0 : _a.requestFullscreen();
|
|
14
|
+
if (document.fullscreenElement)
|
|
15
|
+
setSize(() => ({
|
|
16
|
+
size: 'auto',
|
|
17
|
+
translation: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
}, [setSize]);
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: "Enter fullscreen preview", "aria-label": "Enter fullscreen preview", onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 448 512", fill: "#fff", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z" }) }) }));
|
|
24
|
+
};
|
|
25
|
+
exports.FullScreenToggle = FullScreenToggle;
|
|
@@ -4,37 +4,16 @@ exports.InitialCompositionLoader = exports.useSelectComposition = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const folders_1 = require("../state/folders");
|
|
7
|
-
const marks_1 = require("../state/marks");
|
|
8
|
-
const timeline_zoom_1 = require("../state/timeline-zoom");
|
|
9
7
|
const CompositionSelector_1 = require("./CompositionSelector");
|
|
10
8
|
const FramePersistor_1 = require("./FramePersistor");
|
|
11
|
-
const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
12
|
-
const TimelineInOutToggle_1 = require("./TimelineInOutToggle");
|
|
13
|
-
const ZoomPersistor_1 = require("./ZoomPersistor");
|
|
14
9
|
const useSelectComposition = () => {
|
|
15
|
-
const setCurrentFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
16
|
-
const { setCurrentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
17
10
|
const { setFoldersExpanded } = (0, react_1.useContext)(folders_1.FolderContext);
|
|
18
|
-
const {
|
|
11
|
+
const { setCurrentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
19
12
|
return (c, push) => {
|
|
20
|
-
var _a;
|
|
21
|
-
(_a = TimelineInOutToggle_1.inOutHandles.current) === null || _a === void 0 ? void 0 : _a.setMarks((0, marks_1.loadMarks)(c.id, c.durationInFrames));
|
|
22
13
|
if (push) {
|
|
23
14
|
window.history.pushState({}, 'Studio', `/${c.id}`);
|
|
24
15
|
}
|
|
25
|
-
const frame = (0, FramePersistor_1.getFrameForComposition)(c.id);
|
|
26
|
-
const zoom = (0, ZoomPersistor_1.getZoomForComposition)(c.id);
|
|
27
|
-
const frameInBounds = Math.min(c.durationInFrames - 1, frame);
|
|
28
|
-
setCurrentFrame(frameInBounds);
|
|
29
16
|
setCurrentComposition(c.id);
|
|
30
|
-
setZoom(() => zoom);
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
33
|
-
direction: 'center',
|
|
34
|
-
frame,
|
|
35
|
-
durationInFrames: c.durationInFrames,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
17
|
const { folderName, parentFolderName } = c;
|
|
39
18
|
if (folderName !== null) {
|
|
40
19
|
setFoldersExpanded((ex) => {
|
|
@@ -52,6 +52,6 @@ const li = {
|
|
|
52
52
|
fontSize: 14,
|
|
53
53
|
};
|
|
54
54
|
const KeyboardShortcutsExplainer = () => {
|
|
55
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? ((0, jsx_runtime_1.jsxs)("div", { style: keyboardShortcutsDisabled, children: ["Keyboard shortcuts disabled either due to:", (0, jsx_runtime_1.jsxs)("ul", { style: ul, children: [(0, jsx_runtime_1.jsx)("li", { style: li, children: "a) --disable-keyboard-shortcuts being passed" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: "b) Config.setKeyboardShortcutsEnabled(false) being set or" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: " c) a Remotion version mismatch." })] })] })) : null, (0, jsx_runtime_1.jsxs)(layout_1.Row, { style: container, children: [(0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second back" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Previous frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Space" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Next frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second forward" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "A" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to beginning" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "E" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to end" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reverse playback" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "L" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Speed up" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Enter" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause & return to playback start" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Sidebar" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "B" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle left sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle right sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "G" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle both sidebars" })] }), (0, jsx_runtime_1.jsx)("br", {})] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 8 }), (0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Navigation" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "N" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "New composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "R" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Render composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "T" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle checkerboard transparency" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "?" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Show keyboard shortcuts" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Quick Switcher" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback range" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "I" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set In Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "O" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set Out Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "X" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Clear In/Out Points" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Zoom" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "+" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom in" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "-" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom out" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "0" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reset zoom" })] })] })] })] }));
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? ((0, jsx_runtime_1.jsxs)("div", { style: keyboardShortcutsDisabled, children: ["Keyboard shortcuts disabled either due to:", (0, jsx_runtime_1.jsxs)("ul", { style: ul, children: [(0, jsx_runtime_1.jsx)("li", { style: li, children: "a) --disable-keyboard-shortcuts being passed" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: "b) Config.setKeyboardShortcutsEnabled(false) being set or" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: " c) a Remotion version mismatch." })] })] })) : null, (0, jsx_runtime_1.jsxs)(layout_1.Row, { style: container, children: [(0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second back" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Previous frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Space" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Next frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second forward" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "A" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to beginning" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "E" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to end" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reverse playback" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "L" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Speed up" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Enter" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause & return to playback start" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Sidebar" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "B" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle left sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle right sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "G" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle both sidebars" })] }), (0, jsx_runtime_1.jsx)("br", {})] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 8 }), (0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Navigation" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "N" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "New composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "R" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Render composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "T" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle checkerboard transparency" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "?" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Show keyboard shortcuts" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Quick Switcher" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback range" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "I" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set In Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "O" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set Out Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "X" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Clear In/Out Points" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Zoom" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "+" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom in" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "-" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom out" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "0" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reset zoom" })] }), ' ', (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Props Editor" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "S" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Save" })] })] })] })] }));
|
|
56
56
|
};
|
|
57
57
|
exports.KeyboardShortcutsExplainer = KeyboardShortcutsExplainer;
|
|
@@ -9,6 +9,9 @@ const noop_1 = require("../../helpers/noop");
|
|
|
9
9
|
const input_dragger_click_lock_1 = require("../../state/input-dragger-click-lock");
|
|
10
10
|
const z_index_1 = require("../../state/z-index");
|
|
11
11
|
const RemInput_1 = require("./RemInput");
|
|
12
|
+
const isInt = (num) => {
|
|
13
|
+
return num % 1 === 0;
|
|
14
|
+
};
|
|
12
15
|
const InputDragger = ({ onValueChange, min: _min, max: _max, step: _step, value, onTextChange, formatter = (q) => String(q), status, rightAlign, ...props }) => {
|
|
13
16
|
const [inputFallback, setInputFallback] = (0, react_1.useState)(false);
|
|
14
17
|
const fallbackRef = (0, react_1.useRef)(null);
|
|
@@ -99,8 +102,17 @@ const InputDragger = ({ onValueChange, min: _min, max: _max, step: _step, value,
|
|
|
99
102
|
(_a = fallbackRef.current) === null || _a === void 0 ? void 0 : _a.select();
|
|
100
103
|
}
|
|
101
104
|
}, [inputFallback]);
|
|
105
|
+
const deriveStep = (0, react_1.useMemo)(() => {
|
|
106
|
+
if (_step !== undefined) {
|
|
107
|
+
return _step;
|
|
108
|
+
}
|
|
109
|
+
if (typeof _min === 'number' && isInt(_min)) {
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
return 0.0001;
|
|
113
|
+
}, [_min, _step]);
|
|
102
114
|
if (inputFallback) {
|
|
103
|
-
return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: onEscape, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { ref: fallbackRef, autoFocus: true, onKeyPress: onKeyPress, onBlur: onBlur, min: _min, step:
|
|
115
|
+
return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: onEscape, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { ref: fallbackRef, autoFocus: true, onKeyPress: onKeyPress, onBlur: onBlur, min: _min, max: _max, step: deriveStep, defaultValue: value, status: status, pattern: '[0-9]*[.]?[0-9]*', rightAlign: rightAlign, ...props }) }));
|
|
104
116
|
}
|
|
105
117
|
return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: style, onClick: onClick, onPointerDown: onPointerDown, children: (0, jsx_runtime_1.jsx)("span", { style: span, children: formatter(value) }) }));
|
|
106
118
|
};
|
|
@@ -13,5 +13,5 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
|
|
|
13
13
|
isFocused: boolean;
|
|
14
14
|
isHovered: boolean;
|
|
15
15
|
}) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#ff3232" | "#f1c40f";
|
|
16
|
-
export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "
|
|
16
|
+
export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & React.RefAttributes<HTMLInputElement>>;
|
|
17
17
|
export {};
|
|
@@ -4,5 +4,5 @@ type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>
|
|
|
4
4
|
status: RemInputStatus;
|
|
5
5
|
name: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "
|
|
7
|
+
export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
|
|
8
8
|
export {};
|
|
@@ -3,5 +3,5 @@ type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextAreaEleme
|
|
|
3
3
|
status: 'error' | 'warning' | 'ok';
|
|
4
4
|
};
|
|
5
5
|
export declare const inputBaseStyle: React.CSSProperties;
|
|
6
|
-
export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "
|
|
6
|
+
export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
7
7
|
export {};
|
|
@@ -12,8 +12,11 @@ const svgStyle = {
|
|
|
12
12
|
};
|
|
13
13
|
const buttonStyle = {
|
|
14
14
|
border: 'none',
|
|
15
|
-
width: '
|
|
16
|
-
height: '
|
|
15
|
+
width: '20px',
|
|
16
|
+
height: '20px',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
17
20
|
};
|
|
18
21
|
const OpenEditorButton = () => {
|
|
19
22
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type OptionsSidebarPanel = 'input-props' | 'renders';
|
|
3
|
+
export declare const persistSelectedOptionsSidebarPanel: (panel: OptionsSidebarPanel) => void;
|
|
4
|
+
export declare const optionsSidebarTabs: React.RefObject<{
|
|
5
|
+
selectRendersPanel: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const OptionsPanel: React.FC<{}>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptionsPanel = exports.optionsSidebarTabs = exports.persistSelectedOptionsSidebarPanel = 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 colors_1 = require("../helpers/colors");
|
|
8
|
+
const DataEditor_1 = require("./RenderModal/DataEditor");
|
|
9
|
+
const RenderQueue_1 = require("./RenderQueue");
|
|
10
|
+
const RendersTab_1 = require("./RendersTab");
|
|
11
|
+
const Tabs_1 = require("./Tabs");
|
|
12
|
+
const container = {
|
|
13
|
+
height: '100%',
|
|
14
|
+
width: '100%',
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
};
|
|
19
|
+
const PropsEditor = ({ composition }) => {
|
|
20
|
+
const { props, updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
21
|
+
const setInputProps = (0, react_1.useCallback)((newProps) => {
|
|
22
|
+
updateProps({
|
|
23
|
+
id: composition.id,
|
|
24
|
+
defaultProps: composition.defaultProps,
|
|
25
|
+
newProps,
|
|
26
|
+
});
|
|
27
|
+
}, [composition.defaultProps, composition.id, updateProps]);
|
|
28
|
+
const actualProps = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = props[composition.id]) !== null && _a !== void 0 ? _a : composition.defaultProps) !== null && _b !== void 0 ? _b : {}; }, [composition.defaultProps, composition.id, props]);
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, { unresolvedComposition: composition, inputProps: actualProps, setInputProps: setInputProps, mayShowSaveButton: true, propsEditType: "default-props" }, composition.id));
|
|
30
|
+
};
|
|
31
|
+
const localStorageKey = 'remotion.sidebarPanel';
|
|
32
|
+
const getSelectedPanel = () => {
|
|
33
|
+
const panel = localStorage.getItem(localStorageKey);
|
|
34
|
+
if (panel === 'renders') {
|
|
35
|
+
return 'renders';
|
|
36
|
+
}
|
|
37
|
+
return 'input-props';
|
|
38
|
+
};
|
|
39
|
+
const tabsContainer = {
|
|
40
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
41
|
+
};
|
|
42
|
+
const persistSelectedOptionsSidebarPanel = (panel) => {
|
|
43
|
+
localStorage.setItem(localStorageKey, panel);
|
|
44
|
+
};
|
|
45
|
+
exports.persistSelectedOptionsSidebarPanel = persistSelectedOptionsSidebarPanel;
|
|
46
|
+
exports.optionsSidebarTabs = (0, react_1.createRef)();
|
|
47
|
+
const OptionsPanel = () => {
|
|
48
|
+
const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel());
|
|
49
|
+
const onPropsSelected = (0, react_1.useCallback)(() => {
|
|
50
|
+
setPanel('input-props');
|
|
51
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('input-props');
|
|
52
|
+
}, []);
|
|
53
|
+
const onRendersSelected = (0, react_1.useCallback)(() => {
|
|
54
|
+
setPanel('renders');
|
|
55
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('renders');
|
|
56
|
+
}, []);
|
|
57
|
+
(0, react_1.useImperativeHandle)(exports.optionsSidebarTabs, () => {
|
|
58
|
+
return {
|
|
59
|
+
selectRendersPanel: () => {
|
|
60
|
+
setPanel('renders');
|
|
61
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('renders');
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}, []);
|
|
65
|
+
const { compositions, currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
66
|
+
const composition = (0, react_1.useMemo)(() => {
|
|
67
|
+
for (const comp of compositions) {
|
|
68
|
+
if (comp.id === currentComposition) {
|
|
69
|
+
return comp;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}, [compositions, currentComposition]);
|
|
74
|
+
if (composition === null) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsx)("div", { style: tabsContainer, children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onPropsSelected, children: "Props" }), (0, jsx_runtime_1.jsx)(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' })] }) }), panel === 'renders' ? ((0, jsx_runtime_1.jsx)(RenderQueue_1.RenderQueue, {})) : ((0, jsx_runtime_1.jsx)(PropsEditor, { composition: composition }))] }));
|
|
78
|
+
};
|
|
79
|
+
exports.OptionsPanel = OptionsPanel;
|
|
@@ -114,11 +114,11 @@ const PlayPause = ({ playbackRate, loop }) => {
|
|
|
114
114
|
frameForward(1);
|
|
115
115
|
}, [frameForward]);
|
|
116
116
|
const jumpToStart = (0, react_1.useCallback)(() => {
|
|
117
|
-
seek(0);
|
|
118
|
-
}, [seek]);
|
|
117
|
+
seek(inFrame !== null && inFrame !== void 0 ? inFrame : 0);
|
|
118
|
+
}, [seek, inFrame]);
|
|
119
119
|
const jumpToEnd = (0, react_1.useCallback)(() => {
|
|
120
|
-
seek((0, imperative_state_1.getCurrentDuration)() - 1);
|
|
121
|
-
}, [seek]);
|
|
120
|
+
seek(outFrame !== null && outFrame !== void 0 ? outFrame : (0, imperative_state_1.getCurrentDuration)() - 1);
|
|
121
|
+
}, [seek, outFrame]);
|
|
122
122
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
123
123
|
(0, react_1.useEffect)(() => {
|
|
124
124
|
const arrowLeft = keybindings.registerKeybinding({
|
|
@@ -9,7 +9,7 @@ const playbackrate_1 = require("../state/playbackrate");
|
|
|
9
9
|
const ControlButton_1 = require("./ControlButton");
|
|
10
10
|
const ComboBox_1 = require("./NewComposition/ComboBox");
|
|
11
11
|
const commonPlaybackRates = [
|
|
12
|
-
-4, -2, -1, -0.5, -0.25, 0.25, 0.5, 1, 2, 4,
|
|
12
|
+
-4, -2, -1, -0.5, -0.25, 0.25, 0.5, 1, 1.5, 2, 4,
|
|
13
13
|
];
|
|
14
14
|
const getPlaybackRateLabel = (playbackRate) => {
|
|
15
15
|
return `${playbackRate}x`;
|
|
@@ -9,6 +9,7 @@ const timeline_layout_1 = require("../helpers/timeline-layout");
|
|
|
9
9
|
const loop_1 = require("../state/loop");
|
|
10
10
|
const CheckboardToggle_1 = require("./CheckboardToggle");
|
|
11
11
|
const FpsCounter_1 = require("./FpsCounter");
|
|
12
|
+
const FullscreenToggle_1 = require("./FullscreenToggle");
|
|
12
13
|
const layout_1 = require("./layout");
|
|
13
14
|
const LoopToggle_1 = require("./LoopToggle");
|
|
14
15
|
const MuteToggle_1 = require("./MuteToggle");
|
|
@@ -45,6 +46,7 @@ const PreviewToolbar = () => {
|
|
|
45
46
|
const { mediaMuted } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
|
|
46
47
|
const { setMediaMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
|
|
47
48
|
const [loop, setLoop] = (0, react_1.useState)((0, loop_1.loadLoopOption)());
|
|
48
|
-
|
|
49
|
+
const isFullscreenSupported = document.fullscreenEnabled || document.webkitFullscreenEnabled;
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsxs)("div", { style: sideContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: padding }), (0, jsx_runtime_1.jsx)(TimelineZoomControls_1.TimelineZoomControls, {})] }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(SizeSelector_1.SizeSelector, {}), (0, jsx_runtime_1.jsx)(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(PlayPause_1.PlayPause, { loop: loop, playbackRate: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(LoopToggle_1.LoopToggle, { loop: loop, setLoop: setLoop }), (0, jsx_runtime_1.jsx)(CheckboardToggle_1.CheckboardToggle, {}), (0, jsx_runtime_1.jsx)(TimelineInOutToggle_1.TimelineInOutPointToggle, {}), (0, jsx_runtime_1.jsx)(MuteToggle_1.MuteToggle, { muted: mediaMuted, setMuted: setMediaMuted }), isFullscreenSupported && (0, jsx_runtime_1.jsx)(FullscreenToggle_1.FullScreenToggle, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsxs)("div", { style: sideContainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(FpsCounter_1.FpsCounter, { playbackSpeed: playbackRate }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }), (0, jsx_runtime_1.jsx)(RenderButton_1.RenderButton, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1.5 })] }), (0, jsx_runtime_1.jsx)(PlaybackKeyboardShortcutsManager_1.PlaybackKeyboardShortcutsManager, { setPlaybackRate: setPlaybackRate }), (0, jsx_runtime_1.jsx)(PlaybackRatePersistor_1.PlaybackRatePersistor, {})] }));
|
|
49
51
|
};
|
|
50
52
|
exports.PreviewToolbar = PreviewToolbar;
|
|
@@ -98,14 +98,14 @@ const QuickSwitcherResult = ({ result, selected }) => {
|
|
|
98
98
|
fontSize: 15,
|
|
99
99
|
};
|
|
100
100
|
}, [hovered, result.type, selected]);
|
|
101
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? ((0, jsx_runtime_1.jsx)(still_1.StillIcon, { color: selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })) : ((0, jsx_runtime_1.jsx)(video_1.FilmIcon, { color: selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle }))) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelContainer, children: result.type === 'search-result' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", {
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? ((0, jsx_runtime_1.jsx)(still_1.StillIcon, { color: selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })) : ((0, jsx_runtime_1.jsx)(video_1.FilmIcon, { color: selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle }))) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelContainer, children: result.type === 'search-result' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", {
|
|
102
102
|
// eslint-disable-next-line react/no-danger
|
|
103
103
|
dangerouslySetInnerHTML: {
|
|
104
104
|
__html: result.titleLine,
|
|
105
|
-
} }), (0, jsx_runtime_1.jsx)("div", {
|
|
105
|
+
}, style: labelStyle }), (0, jsx_runtime_1.jsx)("div", {
|
|
106
106
|
// eslint-disable-next-line react/no-danger
|
|
107
107
|
dangerouslySetInnerHTML: {
|
|
108
108
|
__html: result.subtitleLine,
|
|
109
|
-
} })] })) : ((0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: result.title })) })] }, result.id));
|
|
109
|
+
}, style: labelStyle })] })) : ((0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: result.title })) })] }, result.id));
|
|
110
110
|
};
|
|
111
111
|
exports.QuickSwitcherResult = QuickSwitcherResult;
|
|
@@ -17,4 +17,6 @@ export declare const DataEditor: React.FC<{
|
|
|
17
17
|
setInputProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
18
18
|
mayShowSaveButton: boolean;
|
|
19
19
|
propsEditType: PropsEditType;
|
|
20
|
+
saving: boolean;
|
|
21
|
+
setSaving: React.Dispatch<React.SetStateAction<boolean>>;
|
|
20
22
|
}>;
|
|
@@ -39,7 +39,6 @@ const SegmentedControl_1 = require("../SegmentedControl");
|
|
|
39
39
|
const get_render_modal_warnings_1 = require("./get-render-modal-warnings");
|
|
40
40
|
const RenderModalJSONPropsEditor_1 = require("./RenderModalJSONPropsEditor");
|
|
41
41
|
const extract_enum_json_paths_1 = require("./SchemaEditor/extract-enum-json-paths");
|
|
42
|
-
const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
|
|
43
42
|
const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
|
|
44
43
|
const SchemaErrorMessages_1 = require("./SchemaEditor/SchemaErrorMessages");
|
|
45
44
|
const WarningIndicatorButton_1 = require("./WarningIndicatorButton");
|
|
@@ -88,10 +87,8 @@ const getPersistedShowWarningState = () => {
|
|
|
88
87
|
const setPersistedShowWarningState = (val) => {
|
|
89
88
|
localStorage.setItem(persistanceKey, String(Boolean(val)));
|
|
90
89
|
};
|
|
91
|
-
const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowSaveButton, propsEditType, }) => {
|
|
90
|
+
const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowSaveButton, propsEditType, saving, setSaving, }) => {
|
|
92
91
|
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
93
|
-
const [valBeforeSafe, setValBeforeSafe] = (0, react_1.useState)(inputProps);
|
|
94
|
-
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
95
92
|
const [showWarning, setShowWarningWithoutPersistance] = (0, react_1.useState)(() => getPersistedShowWarningState());
|
|
96
93
|
const inJSONEditor = mode === 'json';
|
|
97
94
|
const serializedJSON = (0, react_1.useMemo)(() => {
|
|
@@ -99,7 +96,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
99
96
|
return null;
|
|
100
97
|
}
|
|
101
98
|
const value = inputProps;
|
|
102
|
-
return
|
|
99
|
+
return remotion_1.Internals.serializeJSONWithDate({
|
|
103
100
|
data: value,
|
|
104
101
|
indent: 2,
|
|
105
102
|
staticBase: window.remotion_staticBase,
|
|
@@ -215,7 +212,6 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
215
212
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
216
213
|
return;
|
|
217
214
|
}
|
|
218
|
-
setValBeforeSafe(inputProps);
|
|
219
215
|
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
220
216
|
if (!response.success) {
|
|
221
217
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
|
|
@@ -224,14 +220,15 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
224
220
|
}, [unresolvedComposition.id, inputProps, schema, z]);
|
|
225
221
|
(0, react_1.useEffect)(() => {
|
|
226
222
|
setSaving(false);
|
|
227
|
-
}, [fastRefreshes]);
|
|
223
|
+
}, [fastRefreshes, setSaving]);
|
|
228
224
|
const onSave = (0, react_1.useCallback)((updater) => {
|
|
225
|
+
var _a;
|
|
229
226
|
if (schema === 'no-zod' || schema === 'no-schema' || z === null) {
|
|
230
227
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
231
228
|
return;
|
|
232
229
|
}
|
|
233
230
|
setSaving(true);
|
|
234
|
-
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, updater(unresolvedComposition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
231
|
+
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, updater((_a = unresolvedComposition.defaultProps) !== null && _a !== void 0 ? _a : {}), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
235
232
|
.then((response) => {
|
|
236
233
|
if (!response.success) {
|
|
237
234
|
console.log(response.stack);
|
|
@@ -242,7 +239,13 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
242
239
|
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
|
|
243
240
|
setSaving(false);
|
|
244
241
|
});
|
|
245
|
-
}, [
|
|
242
|
+
}, [
|
|
243
|
+
schema,
|
|
244
|
+
z,
|
|
245
|
+
setSaving,
|
|
246
|
+
unresolvedComposition.id,
|
|
247
|
+
unresolvedComposition.defaultProps,
|
|
248
|
+
]);
|
|
246
249
|
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx).type;
|
|
247
250
|
const warnings = (0, react_1.useMemo)(() => {
|
|
248
251
|
return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
|
|
@@ -291,6 +294,6 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
291
294
|
}
|
|
292
295
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
293
296
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
294
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, defaultProps: unresolvedComposition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, onSave: onUpdate,
|
|
297
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, defaultProps: unresolvedComposition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, onSave: onUpdate, showSaveButton: showSaveButton, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema }))] }));
|
|
295
298
|
};
|
|
296
299
|
exports.DataEditor = DataEditor;
|
|
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FrameRangeSetting = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
|
-
const RemInput_1 = require("../NewComposition/RemInput");
|
|
8
6
|
const layout_1 = require("./layout");
|
|
7
|
+
const MultiRangeSlider_1 = require("./MultiRangeSlider");
|
|
8
|
+
const numberWrapper = {
|
|
9
|
+
minWidth: '39px',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
justifyContent: 'flex-end',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
fontSize: '14px',
|
|
14
|
+
};
|
|
9
15
|
const FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames, setStartFrame }) => {
|
|
10
|
-
const maxStartFrame = endFrame - 1;
|
|
11
16
|
const minStartFrame = 0;
|
|
12
|
-
const minEndFrame = startFrame + 1;
|
|
13
17
|
const maxEndFrame = durationInFrames - 1;
|
|
14
18
|
const onStartFrameChangedDirectly = (0, react_1.useCallback)((newStartFrame) => {
|
|
15
19
|
setStartFrame(newStartFrame);
|
|
@@ -17,26 +21,6 @@ const FrameRangeSetting = ({ startFrame, endFrame, setEndFrame, durationInFrames
|
|
|
17
21
|
const onEndFrameChangedDirectly = (0, react_1.useCallback)((newEndFrame) => {
|
|
18
22
|
setEndFrame(newEndFrame);
|
|
19
23
|
}, [setEndFrame]);
|
|
20
|
-
|
|
21
|
-
setStartFrame((q) => {
|
|
22
|
-
const newStartFrame = parseInt(e, 10);
|
|
23
|
-
if (Number.isNaN(newStartFrame)) {
|
|
24
|
-
return q;
|
|
25
|
-
}
|
|
26
|
-
const newStartFrameClamped = Math.min(maxStartFrame, Math.max(newStartFrame, minStartFrame));
|
|
27
|
-
return newStartFrameClamped;
|
|
28
|
-
});
|
|
29
|
-
}, [maxStartFrame, setStartFrame]);
|
|
30
|
-
const onEndFrameChanged = (0, react_1.useCallback)((e) => {
|
|
31
|
-
setEndFrame((q) => {
|
|
32
|
-
const newEndFrame = parseInt(e, 10);
|
|
33
|
-
if (Number.isNaN(newEndFrame)) {
|
|
34
|
-
return q;
|
|
35
|
-
}
|
|
36
|
-
const newEndFrameClamped = Math.min(maxEndFrame, Math.max(newEndFrame, minEndFrame));
|
|
37
|
-
return newEndFrameClamped;
|
|
38
|
-
});
|
|
39
|
-
}, [maxEndFrame, minEndFrame, setEndFrame]);
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame range" }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.rightRow, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: startFrame, onTextChange: onStartFrameChanged, placeholder: `${minStartFrame}-${maxStartFrame}`, onValueChange: onStartFrameChangedDirectly, name: "startFrame", step: 1, min: minStartFrame, max: maxStartFrame, status: "ok", rightAlign: true }) }), (0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: endFrame, onTextChange: onEndFrameChanged, placeholder: `${minEndFrame}-${maxEndFrame}`, onValueChange: onEndFrameChangedDirectly, name: "endFrame", step: 1, min: minEndFrame, max: maxEndFrame, status: "ok", rightAlign: true }) })] })] }));
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame range" }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.rightRow, children: [(0, jsx_runtime_1.jsx)("div", { style: numberWrapper, children: startFrame }), (0, jsx_runtime_1.jsx)(MultiRangeSlider_1.MultiRangeSlider, { min: minStartFrame, max: maxEndFrame, start: startFrame, end: endFrame, step: 1, onLeftThumbDrag: onStartFrameChangedDirectly, onRightThumbDrag: onEndFrameChangedDirectly }), (0, jsx_runtime_1.jsx)("div", { style: numberWrapper, children: endFrame })] })] }));
|
|
41
25
|
};
|
|
42
26
|
exports.FrameRangeSetting = FrameRangeSetting;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
interface MultiRangeSliderProps {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
step: number;
|
|
8
|
+
onLeftThumbDrag: (newVal: number) => void;
|
|
9
|
+
onRightThumbDrag: (newVal: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const MultiRangeSlider: FC<MultiRangeSliderProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MultiRangeSlider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../../helpers/colors");
|
|
7
|
+
const container = {
|
|
8
|
+
borderColor: 'black',
|
|
9
|
+
borderStyle: 'solid',
|
|
10
|
+
height: 39,
|
|
11
|
+
width: 220,
|
|
12
|
+
position: 'relative',
|
|
13
|
+
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
14
|
+
marginLeft: 8,
|
|
15
|
+
marginRight: 8,
|
|
16
|
+
borderRadius: 2,
|
|
17
|
+
};
|
|
18
|
+
const slider = {
|
|
19
|
+
position: 'relative',
|
|
20
|
+
height: 38,
|
|
21
|
+
width: 220,
|
|
22
|
+
};
|
|
23
|
+
const sliderRange = {
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
top: 0,
|
|
26
|
+
backgroundColor: colors_1.BLUE,
|
|
27
|
+
height: 39,
|
|
28
|
+
};
|
|
29
|
+
const MultiRangeSlider = ({ min, max, start, end, step, onLeftThumbDrag, onRightThumbDrag, }) => {
|
|
30
|
+
const getPercent = (0, react_1.useCallback)((value) => Math.round(((value - min) / (max - min)) * 100), [min, max]);
|
|
31
|
+
const rangeStyle = (0, react_1.useMemo)(() => {
|
|
32
|
+
const minPercent = getPercent(start);
|
|
33
|
+
const maxPercent = getPercent(end);
|
|
34
|
+
return {
|
|
35
|
+
...sliderRange,
|
|
36
|
+
left: `${minPercent}%`,
|
|
37
|
+
width: `${maxPercent - minPercent}%`,
|
|
38
|
+
};
|
|
39
|
+
}, [end, getPercent, start]);
|
|
40
|
+
const onChangeLeft = (0, react_1.useCallback)((event) => {
|
|
41
|
+
const value = Math.min(Number(event.target.value), end - 1);
|
|
42
|
+
onLeftThumbDrag(value);
|
|
43
|
+
}, [end, onLeftThumbDrag]);
|
|
44
|
+
const onChangeRight = (0, react_1.useCallback)((event) => {
|
|
45
|
+
const value = Math.max(Number(event.target.value), start + 1);
|
|
46
|
+
onRightThumbDrag(value);
|
|
47
|
+
}, [onRightThumbDrag, start]);
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsxs)("div", { style: slider, children: [(0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: start, step: step, onChange: onChangeLeft, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: end, step: step, onChange: onChangeRight, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("div", { style: rangeStyle })] }) }));
|
|
49
|
+
};
|
|
50
|
+
exports.MultiRangeSlider = MultiRangeSlider;
|