@remotion/studio 4.0.488 → 4.0.490

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.
Files changed (59) hide show
  1. package/dist/components/Canvas.js +30 -12
  2. package/dist/components/Editor.js +2 -5
  3. package/dist/components/GlobalKeybindings.js +2 -1
  4. package/dist/components/InspectorPanel/AlignmentControls.d.ts +5 -0
  5. package/dist/components/InspectorPanel/AlignmentControls.js +205 -0
  6. package/dist/components/InspectorPanel/EasingInspector.js +8 -2
  7. package/dist/components/InspectorPanel/KeyframeSettings.d.ts +5 -0
  8. package/dist/components/InspectorPanel/KeyframeSettings.js +142 -0
  9. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +2 -1
  10. package/dist/components/InspectorPanel/alignment-controls.d.ts +12 -0
  11. package/dist/components/InspectorPanel/alignment-controls.js +42 -0
  12. package/dist/components/InspectorSequenceSection.d.ts +1 -0
  13. package/dist/components/InspectorSequenceSection.js +2 -2
  14. package/dist/components/KeyboardShortcutsExplainer.js +2 -1
  15. package/dist/components/MobilePanel.js +9 -3
  16. package/dist/components/Modals.js +3 -3
  17. package/dist/components/NewComposition/CancelButton.d.ts +1 -0
  18. package/dist/components/NewComposition/CancelButton.js +6 -2
  19. package/dist/components/NewComposition/MenuContent.js +2 -2
  20. package/dist/components/Preview.js +1 -1
  21. package/dist/components/SelectedOutlineOverlay.d.ts +6 -1
  22. package/dist/components/SelectedOutlineOverlay.js +247 -9
  23. package/dist/components/Timeline/MaxTimelineTracks.js +2 -5
  24. package/dist/components/Timeline/TimelineClipboardKeybindings.js +3 -0
  25. package/dist/components/Timeline/TimelineEffectPropItem.js +2 -50
  26. package/dist/components/Timeline/TimelineSequenceItem.js +8 -10
  27. package/dist/components/Timeline/TimelineSequenceName.js +1 -3
  28. package/dist/components/Timeline/TimelineSequencePropItem.js +2 -49
  29. package/dist/components/import-assets.d.ts +1 -0
  30. package/dist/components/import-assets.js +1 -0
  31. package/dist/esm/{chunk-nn36hyt1.js → chunk-16nwrbrm.js} +4972 -4346
  32. package/dist/esm/index.mjs +21 -1
  33. package/dist/esm/internals.mjs +4972 -4346
  34. package/dist/esm/previewEntry.mjs +5010 -4384
  35. package/dist/esm/renderEntry.mjs +1 -1
  36. package/dist/helpers/install-required-package.d.ts +1 -0
  37. package/dist/helpers/install-required-package.js +3 -2
  38. package/dist/helpers/interactivity-enabled.js +2 -4
  39. package/dist/helpers/show-browser-rendering.js +2 -1
  40. package/dist/helpers/studio-runtime-config.d.ts +7 -0
  41. package/dist/helpers/studio-runtime-config.js +46 -0
  42. package/dist/helpers/use-keybinding.js +4 -3
  43. package/dist/helpers/use-menu-structure.js +2 -1
  44. package/dist/icons/align-bottom.d.ts +3 -0
  45. package/dist/icons/align-bottom.js +12 -0
  46. package/dist/icons/align-center-horizontal.d.ts +3 -0
  47. package/dist/icons/align-center-horizontal.js +12 -0
  48. package/dist/icons/align-center-vertical.d.ts +3 -0
  49. package/dist/icons/align-center-vertical.js +12 -0
  50. package/dist/icons/align-left.d.ts +3 -0
  51. package/dist/icons/align-left.js +12 -0
  52. package/dist/icons/align-right.d.ts +3 -0
  53. package/dist/icons/align-right.js +12 -0
  54. package/dist/icons/align-top.d.ts +3 -0
  55. package/dist/icons/align-top.js +12 -0
  56. package/dist/state/modals.d.ts +1 -2
  57. package/package.json +11 -11
  58. package/dist/components/Timeline/KeyframeSettingsModal.d.ts +0 -15
  59. package/dist/components/Timeline/KeyframeSettingsModal.js +0 -151
@@ -212,7 +212,7 @@ var renderContent = (Root) => {
212
212
  renderToDOM(/* @__PURE__ */ jsx("div", {
213
213
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
214
214
  }));
215
- import("./chunk-nn36hyt1.js").then(({ StudioInternals }) => {
215
+ import("./chunk-16nwrbrm.js").then(({ StudioInternals }) => {
216
216
  window.remotion_isStudio = true;
217
217
  window.remotion_isReadOnlyStudio = true;
218
218
  window.remotion_inputProps = "{}";
@@ -1 +1,2 @@
1
+ export declare const getMissingPackages: (packageNames: string[]) => string[];
1
2
  export declare const installRequiredPackages: (packageNames: string[]) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installRequiredPackages = void 0;
3
+ exports.installRequiredPackages = exports.getMissingPackages = void 0;
4
4
  const install_package_1 = require("../api/install-package");
5
5
  const NotificationCenter_1 = require("../components/Notifications/NotificationCenter");
6
6
  let installQueue = Promise.resolve();
@@ -10,6 +10,7 @@ const getMissingPackages = (packageNames) => {
10
10
  const installedPackages = (_a = window.remotion_installedPackages) !== null && _a !== void 0 ? _a : [];
11
11
  return uniquePackageNames.filter((packageName) => !installedPackages.includes(packageName));
12
12
  };
13
+ exports.getMissingPackages = getMissingPackages;
13
14
  const addInstalledPackages = (packageNames) => {
14
15
  var _a;
15
16
  const installedPackages = (_a = window.remotion_installedPackages) !== null && _a !== void 0 ? _a : [];
@@ -23,7 +24,7 @@ const formatPackageList = (packageNames) => {
23
24
  };
24
25
  const installRequiredPackages = async (packageNames) => {
25
26
  const runInstall = async () => {
26
- const missingPackages = getMissingPackages(packageNames);
27
+ const missingPackages = (0, exports.getMissingPackages)(packageNames);
27
28
  if (missingPackages.length === 0) {
28
29
  return;
29
30
  }
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.studioInteractivityEnabled = void 0;
4
- const interactivityEnabled = process.env.INTERACTIVITY_ENABLED;
5
- exports.studioInteractivityEnabled = interactivityEnabled === undefined || interactivityEnabled === null
6
- ? true
7
- : interactivityEnabled !== false && interactivityEnabled !== 'false';
4
+ const studio_runtime_config_1 = require("./studio-runtime-config");
5
+ exports.studioInteractivityEnabled = (0, studio_runtime_config_1.getStudioInteractivityEnabled)();
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SHOW_BROWSER_RENDERING = void 0;
4
- exports.SHOW_BROWSER_RENDERING = Boolean(process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED);
4
+ const studio_runtime_config_1 = require("./studio-runtime-config");
5
+ exports.SHOW_BROWSER_RENDERING = (0, studio_runtime_config_1.getStudioExperimentalClientSideRenderingEnabled)();
@@ -0,0 +1,7 @@
1
+ export declare const DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
2
+ export declare const getStudioAskAIEnabled: () => boolean;
3
+ export declare const getStudioInteractivityEnabled: () => boolean;
4
+ export declare const getStudioKeyboardShortcutsEnabled: () => boolean;
5
+ export declare const getStudioExperimentalClientSideRenderingEnabled: () => boolean;
6
+ export declare const getStudioMaxTimelineTracks: () => number;
7
+ export declare const getStudioBufferStateDelayInMilliseconds: () => number;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStudioBufferStateDelayInMilliseconds = exports.getStudioMaxTimelineTracks = exports.getStudioExperimentalClientSideRenderingEnabled = exports.getStudioKeyboardShortcutsEnabled = exports.getStudioInteractivityEnabled = exports.getStudioAskAIEnabled = exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
6
+ const defaultStudioRuntimeConfig = {
7
+ askAIEnabled: false,
8
+ bufferStateDelayInMilliseconds: null,
9
+ experimentalClientSideRenderingEnabled: false,
10
+ interactivityEnabled: true,
11
+ keyboardShortcutsEnabled: true,
12
+ maxTimelineTracks: null,
13
+ };
14
+ const getStudioRuntimeConfig = () => {
15
+ var _a;
16
+ if (typeof window === 'undefined') {
17
+ return defaultStudioRuntimeConfig;
18
+ }
19
+ return (_a = window.remotion_studioConfig) !== null && _a !== void 0 ? _a : defaultStudioRuntimeConfig;
20
+ };
21
+ const getStudioAskAIEnabled = () => {
22
+ return getStudioRuntimeConfig().askAIEnabled;
23
+ };
24
+ exports.getStudioAskAIEnabled = getStudioAskAIEnabled;
25
+ const getStudioInteractivityEnabled = () => {
26
+ return getStudioRuntimeConfig().interactivityEnabled;
27
+ };
28
+ exports.getStudioInteractivityEnabled = getStudioInteractivityEnabled;
29
+ const getStudioKeyboardShortcutsEnabled = () => {
30
+ return getStudioRuntimeConfig().keyboardShortcutsEnabled;
31
+ };
32
+ exports.getStudioKeyboardShortcutsEnabled = getStudioKeyboardShortcutsEnabled;
33
+ const getStudioExperimentalClientSideRenderingEnabled = () => {
34
+ return getStudioRuntimeConfig().experimentalClientSideRenderingEnabled;
35
+ };
36
+ exports.getStudioExperimentalClientSideRenderingEnabled = getStudioExperimentalClientSideRenderingEnabled;
37
+ const getStudioMaxTimelineTracks = () => {
38
+ var _a;
39
+ return (_a = getStudioRuntimeConfig().maxTimelineTracks) !== null && _a !== void 0 ? _a : studio_shared_1.DEFAULT_TIMELINE_TRACKS;
40
+ };
41
+ exports.getStudioMaxTimelineTracks = getStudioMaxTimelineTracks;
42
+ const getStudioBufferStateDelayInMilliseconds = () => {
43
+ var _a;
44
+ return ((_a = getStudioRuntimeConfig().bufferStateDelayInMilliseconds) !== null && _a !== void 0 ? _a : exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS);
45
+ };
46
+ exports.getStudioBufferStateDelayInMilliseconds = getStudioBufferStateDelayInMilliseconds;
@@ -4,12 +4,13 @@ exports.useKeybinding = exports.areKeyboardShortcutsDisabled = void 0;
4
4
  const react_1 = require("react");
5
5
  const keybindings_1 = require("../state/keybindings");
6
6
  const z_index_1 = require("../state/z-index");
7
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
7
+ const studio_runtime_config_1 = require("./studio-runtime-config");
8
+ if (!(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
8
9
  // eslint-disable-next-line no-console
9
10
  console.warn('Keyboard shortcuts disabled either due to: a) --disable-keyboard-shortcuts being passed b) Config.setKeyboardShortcutsEnabled(false) being set or c) a Remotion version mismatch.');
10
11
  }
11
12
  const areKeyboardShortcutsDisabled = () => {
12
- return !process.env.KEYBOARD_SHORTCUTS_ENABLED;
13
+ return !(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)();
13
14
  };
14
15
  exports.areKeyboardShortcutsDisabled = areKeyboardShortcutsDisabled;
15
16
  const useKeybinding = () => {
@@ -17,7 +18,7 @@ const useKeybinding = () => {
17
18
  const context = (0, react_1.useContext)(keybindings_1.KeybindingContext);
18
19
  const { isHighestContext } = (0, z_index_1.useZIndex)();
19
20
  const registerKeybinding = (0, react_1.useCallback)((options) => {
20
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
21
+ if (!(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
21
22
  return {
22
23
  unregister: () => undefined,
23
24
  };
@@ -32,6 +32,7 @@ const mobile_layout_1 = require("./mobile-layout");
32
32
  const open_in_editor_1 = require("./open-in-editor");
33
33
  const pick_color_1 = require("./pick-color");
34
34
  const show_browser_rendering_1 = require("./show-browser-rendering");
35
+ const studio_runtime_config_1 = require("./studio-runtime-config");
35
36
  const use_keybinding_1 = require("./use-keybinding");
36
37
  const openExternal = (link) => {
37
38
  window.open(link, '_blank');
@@ -682,7 +683,7 @@ const useMenuStructure = (closeMenu, readOnlyStudio) => {
682
683
  label: 'Tools',
683
684
  leaveLeftPadding: false,
684
685
  items: [
685
- process.env.ASK_AI_ENABLED
686
+ (0, studio_runtime_config_1.getStudioAskAIEnabled)()
686
687
  ? {
687
688
  id: 'ask-ai',
688
689
  value: 'ask-ai',
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const AlignBottomIcon: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlignBottomIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const align_right_1 = require("./align-right");
6
+ const AlignBottomIcon = (props) => {
7
+ return (jsx_runtime_1.jsx(align_right_1.AlignRightIcon, { ...props, style: {
8
+ ...props.style,
9
+ transform: 'rotate(90deg)',
10
+ } }));
11
+ };
12
+ exports.AlignBottomIcon = AlignBottomIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const AlignCenterHorizontalIcon: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlignCenterHorizontalIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const AlignCenterHorizontalIcon = (props) => {
6
+ var _a;
7
+ const color = (_a = props.color) !== null && _a !== void 0 ? _a : 'currentColor';
8
+ return (jsx_runtime_1.jsxs("svg", { ...props, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
9
+ jsx_runtime_1.jsx("path", { d: "M8 2V14", stroke: color, strokeOpacity: "0.5", strokeLinecap: "square" }), jsx_runtime_1.jsx("line", { x1: "3", y1: "6", x2: "12", y2: "6", stroke: color, strokeWidth: "2" }), jsx_runtime_1.jsx("line", { x1: "4", y1: "10", x2: "11", y2: "10", stroke: color, strokeWidth: "2" })
10
+ ] }));
11
+ };
12
+ exports.AlignCenterHorizontalIcon = AlignCenterHorizontalIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const AlignCenterVerticalIcon: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlignCenterVerticalIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const align_center_horizontal_1 = require("./align-center-horizontal");
6
+ const AlignCenterVerticalIcon = (props) => {
7
+ return (jsx_runtime_1.jsx(align_center_horizontal_1.AlignCenterHorizontalIcon, { ...props, style: {
8
+ ...props.style,
9
+ transform: 'rotate(90deg)',
10
+ } }));
11
+ };
12
+ exports.AlignCenterVerticalIcon = AlignCenterVerticalIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const AlignLeftIcon: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlignLeftIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const AlignLeftIcon = (props) => {
6
+ var _a;
7
+ const color = (_a = props.color) !== null && _a !== void 0 ? _a : 'currentColor';
8
+ return (jsx_runtime_1.jsxs("svg", { ...props, viewBox: "0 0 16 16", fill: "none", children: [
9
+ jsx_runtime_1.jsx("path", { d: "M2 2L2 14", stroke: color, strokeOpacity: "0.5", strokeLinecap: "square" }), jsx_runtime_1.jsx("line", { x1: "4", y1: "6", x2: "13", y2: "6", stroke: color, strokeWidth: "2" }), jsx_runtime_1.jsx("line", { x1: "4", y1: "10", x2: "11", y2: "10", stroke: color, strokeWidth: "2" })
10
+ ] }));
11
+ };
12
+ exports.AlignLeftIcon = AlignLeftIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const AlignRightIcon: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlignRightIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const AlignRightIcon = (props) => {
6
+ var _a;
7
+ const color = (_a = props.color) !== null && _a !== void 0 ? _a : 'currentColor';
8
+ return (jsx_runtime_1.jsxs("svg", { ...props, viewBox: "0 0 16 16", fill: "none", children: [
9
+ jsx_runtime_1.jsx("path", { d: "M14 2V14", stroke: color, strokeOpacity: "0.5", strokeLinecap: "square" }), jsx_runtime_1.jsx("line", { x1: "3", y1: "6", x2: "12", y2: "6", stroke: color, strokeWidth: "2" }), jsx_runtime_1.jsx("line", { x1: "5", y1: "10", x2: "12", y2: "10", stroke: color, strokeWidth: "2" })
10
+ ] }));
11
+ };
12
+ exports.AlignRightIcon = AlignRightIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const AlignTopIcon: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlignTopIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const align_left_1 = require("./align-left");
6
+ const AlignTopIcon = (props) => {
7
+ return (jsx_runtime_1.jsx(align_left_1.AlignLeftIcon, { ...props, style: {
8
+ ...props.style,
9
+ transform: 'rotate(90deg)',
10
+ } }));
11
+ };
12
+ exports.AlignTopIcon = AlignTopIcon;
@@ -7,7 +7,6 @@ import type { SequencePropsSubscriptionKey, _InternalTypes } from 'remotion';
7
7
  import type { CompType } from '../components/NewComposition/DuplicateComposition';
8
8
  import type { QuickSwitcherMode } from '../components/QuickSwitcher/NoResults';
9
9
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
10
- import type { KeyframeSettingsModalState } from '../components/Timeline/KeyframeSettingsModal';
11
10
  import type { Bug, UpdateInfo } from '../components/UpdateCheck';
12
11
  export type WebRenderModalState = {
13
12
  type: 'web-render';
@@ -138,7 +137,7 @@ export type ModalState = {
138
137
  relativePath: string;
139
138
  } | {
140
139
  type: 'input-props-override';
141
- } | KeyframeSettingsModalState | RenderModalState | WebRenderModalState | {
140
+ } | RenderModalState | WebRenderModalState | {
142
141
  type: 'render-progress';
143
142
  jobId: string;
144
143
  } | {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
4
4
  },
5
5
  "name": "@remotion/studio",
6
- "version": "4.0.488",
6
+ "version": "4.0.490",
7
7
  "description": "APIs for interacting with the Remotion Studio",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -25,15 +25,15 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "semver": "7.5.3",
28
- "remotion": "4.0.488",
29
- "@remotion/canvas-capture": "4.0.488",
30
- "@remotion/player": "4.0.488",
31
- "@remotion/media-utils": "4.0.488",
32
- "@remotion/renderer": "4.0.488",
33
- "@remotion/web-renderer": "4.0.488",
34
- "@remotion/studio-shared": "4.0.488",
35
- "@remotion/timeline-utils": "4.0.488",
36
- "@remotion/zod-types": "4.0.488",
28
+ "remotion": "4.0.490",
29
+ "@remotion/canvas-capture": "4.0.490",
30
+ "@remotion/player": "4.0.490",
31
+ "@remotion/media-utils": "4.0.490",
32
+ "@remotion/renderer": "4.0.490",
33
+ "@remotion/web-renderer": "4.0.490",
34
+ "@remotion/studio-shared": "4.0.490",
35
+ "@remotion/timeline-utils": "4.0.490",
36
+ "@remotion/zod-types": "4.0.490",
37
37
  "@jridgewell/trace-mapping": "0.3.31",
38
38
  "mediabunny": "1.50.8",
39
39
  "memfs": "3.4.3",
@@ -44,7 +44,7 @@
44
44
  "react": "19.2.3",
45
45
  "react-dom": "19.2.3",
46
46
  "@types/semver": "7.5.3",
47
- "@remotion/eslint-config-internal": "4.0.488",
47
+ "@remotion/eslint-config-internal": "4.0.490",
48
48
  "eslint": "9.19.0",
49
49
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
50
50
  },
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { CanUpdateSequencePropStatusKeyframed, SequencePropsSubscriptionKey, InteractivitySchema } 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: InteractivitySchema;
11
- effectIndex: number | null;
12
- };
13
- export declare const KeyframeSettingsModal: React.FC<{
14
- readonly state: KeyframeSettingsModalState;
15
- }>;
@@ -1,151 +0,0 @@
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: colors_1.WHITE_ALPHA_60,
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 { setPropStatuses } = (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
- type: 'settings',
96
- clamping: canEditClamping ? { left, right } : undefined,
97
- posterize: posterize <= 0 ? undefined : posterize,
98
- };
99
- setSaving(true);
100
- const promise = state.effectIndex === null
101
- ? (0, call_update_keyframe_settings_1.callUpdateSequenceKeyframeSettings)({
102
- fileName: state.fileName,
103
- nodePath: state.nodePath,
104
- fieldKey: state.fieldKey,
105
- settings,
106
- schema: state.schema,
107
- setPropStatuses,
108
- clientId: previewServerState.clientId,
109
- })
110
- : (0, call_update_keyframe_settings_1.callUpdateEffectKeyframeSettings)({
111
- fileName: state.fileName,
112
- nodePath: state.nodePath,
113
- effectIndex: state.effectIndex,
114
- fieldKey: state.fieldKey,
115
- settings,
116
- schema: state.schema,
117
- setPropStatuses,
118
- clientId: previewServerState.clientId,
119
- });
120
- promise.then(close).finally(() => {
121
- setSaving(false);
122
- });
123
- }, [
124
- canEditClamping,
125
- close,
126
- left,
127
- posterize,
128
- previewServerState,
129
- right,
130
- setPropStatuses,
131
- state,
132
- ]);
133
- const saveDisabled = saving || previewServerState.type !== 'connected';
134
- return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
135
- 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: [
136
- jsx_runtime_1.jsxs("div", { style: row, children: [
137
- 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 })
138
- ] }), jsx_runtime_1.jsxs("div", { style: row, children: [
139
- 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 })
140
- ] })
141
- ] })) : null, jsx_runtime_1.jsxs("div", { style: row, children: [
142
- jsx_runtime_1.jsxs("div", { children: [
143
- jsx_runtime_1.jsx("div", { style: label, children: "Posterize" }), jsx_runtime_1.jsx("div", { style: helperText, children: "Use 0 to turn posterization off." })
144
- ] }), 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 })
145
- ] })
146
- ] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsxs(layout_1.Row, { justify: "flex-end", align: "center", children: [
147
- 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" })
148
- ] }) })
149
- ] }));
150
- };
151
- exports.KeyframeSettingsModal = KeyframeSettingsModal;