@remotion/cli 4.0.23 → 4.0.25

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 (31) hide show
  1. package/dist/ansi/ansi-diff.d.ts +1 -0
  2. package/dist/config/height.js +2 -2
  3. package/dist/config/image-format.d.ts +1 -1
  4. package/dist/config/index.d.ts +1 -1
  5. package/dist/config/presets-profile.d.ts +3 -0
  6. package/dist/config/presets-profile.js +12 -0
  7. package/dist/config/width.js +2 -2
  8. package/dist/editor/components/CurrentComposition.d.ts +0 -1
  9. package/dist/editor/components/NewComposition/RemInput.d.ts +2 -2
  10. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  11. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  12. package/dist/editor/components/RenderModal/OptionExplainer.js +1 -1
  13. package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
  14. package/dist/editor/helpers/colors.d.ts +1 -1
  15. package/dist/editor/icons/Checkmark.d.ts +0 -1
  16. package/dist/get-cli-options.d.ts +1 -1
  17. package/dist/get-env.js +16 -6
  18. package/dist/index.d.ts +5 -5
  19. package/dist/preview-server/dev-middleware/compatible-api.d.ts +1 -0
  20. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  21. package/dist/preview-server/hot-middleware/client.d.ts +2 -0
  22. package/dist/preview-server/hot-middleware/client.js +2 -0
  23. package/dist/preview-server/live-events.js +2 -1
  24. package/dist/preview-server/start-server.js +1 -1
  25. package/dist/validate.d.ts +2 -0
  26. package/dist/validate.js +6 -0
  27. package/package.json +9 -8
  28. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +0 -14
  29. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +0 -42
  30. package/dist/editor/components/RightPanel.d.ts +0 -8
  31. package/dist/editor/components/RightPanel.js +0 -79
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="bun-types" />
2
3
  type Options = {
3
4
  width?: number;
4
5
  height?: number;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHeight = exports.overrideHeight = void 0;
4
- const remotion_1 = require("remotion");
4
+ const validate_1 = require("../validate");
5
5
  let specifiedHeight;
6
6
  const overrideHeight = (newHeight) => {
7
- remotion_1.Internals.validateDimension(newHeight, 'height', 'passed to `overrideHeight()`');
7
+ (0, validate_1.validateDimension)(newHeight, 'height', 'passed to `overrideHeight()`');
8
8
  specifiedHeight = newHeight;
9
9
  };
10
10
  exports.overrideHeight = overrideHeight;
@@ -2,4 +2,4 @@ import type { StillImageFormat, VideoImageFormat } from '@remotion/renderer';
2
2
  export declare const setStillImageFormat: (format: StillImageFormat) => void;
3
3
  export declare const setVideoImageFormat: (format: VideoImageFormat) => void;
4
4
  export declare const getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
5
- export declare const getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
5
+ export declare const getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
@@ -300,7 +300,7 @@ export declare const ConfigInternals: {
300
300
  getShouldOutputImageSequence: (frameRange: FrameRange | null) => boolean;
301
301
  getDotEnvLocation: () => string | null;
302
302
  getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
303
- getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
303
+ getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
304
304
  getWebpackOverrideFn: () => WebpackOverrideFn;
305
305
  getWebpackCaching: () => boolean;
306
306
  getOutputLocation: () => string | null;
@@ -0,0 +1,3 @@
1
+ import type { x264Preset } from '@remotion/renderer';
2
+ export declare const getPresetProfile: () => x264Preset | undefined;
3
+ export declare const setPresetProfile: (profile: x264Preset | undefined) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setPresetProfile = exports.getPresetProfile = void 0;
4
+ let preset;
5
+ const getPresetProfile = () => {
6
+ return preset;
7
+ };
8
+ exports.getPresetProfile = getPresetProfile;
9
+ const setPresetProfile = (profile) => {
10
+ preset = profile;
11
+ };
12
+ exports.setPresetProfile = setPresetProfile;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWidth = exports.overrideWidth = void 0;
4
- const remotion_1 = require("remotion");
4
+ const validate_1 = require("../validate");
5
5
  let passedWidth = null;
6
6
  const overrideWidth = (newWidth) => {
7
7
  if (typeof newWidth !== 'number') {
8
- remotion_1.Internals.validateDimension(newWidth, 'width', 'passed to `setWidth()`');
8
+ (0, validate_1.validateDimension)(newWidth, 'width', 'passed to `setWidth()`');
9
9
  }
10
10
  passedWidth = newWidth;
11
11
  };
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const CurrentComposition: () => JSX.Element;
@@ -12,6 +12,6 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
12
12
  status: 'error' | 'warning' | 'ok';
13
13
  isFocused: boolean;
14
14
  isHovered: boolean;
15
- }) => "hsla(0, 0%, 100%, 0.15)" | "#ff3232" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#f1c40f";
16
- export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & React.RefAttributes<HTMLInputElement>>;
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, "status" | "key" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & 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, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
7
+ export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & 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, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
6
+ export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
7
7
  export {};
@@ -51,6 +51,6 @@ const copyWrapper = {
51
51
  justifyContent: 'flex-end',
52
52
  };
53
53
  const OptionExplainer = ({ option }) => {
54
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "__remotion-info-button-container", children: [(0, jsx_runtime_1.jsxs)("div", { style: padding, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { style: title, children: option.name }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("a", { style: link, href: option.docLink, target: "_blank", children: "Docs" })] }), (0, jsx_runtime_1.jsx)("div", { style: description, children: option.description })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 0.5, block: true }), (0, jsx_runtime_1.jsx)(MenuDivider_1.MenuDivider, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 0.5, block: true }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: infoRow, children: [(0, jsx_runtime_1.jsx)("div", { style: infoRowLabel, children: "CLI flag" }), (0, jsx_runtime_1.jsx)("div", { style: flexSpacer }), (0, jsx_runtime_1.jsx)("code", { children: option.cliFlag }), (0, jsx_runtime_1.jsx)("div", { style: copyWrapper, children: (0, jsx_runtime_1.jsx)(CliCopyButton_1.CliCopyButton, { valueToCopy: option.cliFlag }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: infoRow, children: [(0, jsx_runtime_1.jsx)("div", { style: infoRowLabel, children: "Node.JS option" }), (0, jsx_runtime_1.jsx)("div", { style: flexSpacer }), (0, jsx_runtime_1.jsx)("code", { children: option.ssrName }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 3.75 })] }), (0, jsx_runtime_1.jsx)("div", { style: infoRow })] })] }));
54
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "__remotion-info-button-container", children: [(0, jsx_runtime_1.jsxs)("div", { style: padding, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { style: title, children: option.name }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("a", { style: link, href: option.docLink, target: "_blank", children: "Docs" })] }), (0, jsx_runtime_1.jsx)("div", { style: description, children: option.description('ssr') })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 0.5, block: true }), (0, jsx_runtime_1.jsx)(MenuDivider_1.MenuDivider, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 0.5, block: true }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: infoRow, children: [(0, jsx_runtime_1.jsx)("div", { style: infoRowLabel, children: "CLI flag" }), (0, jsx_runtime_1.jsx)("div", { style: flexSpacer }), (0, jsx_runtime_1.jsx)("code", { children: option.cliFlag }), (0, jsx_runtime_1.jsx)("div", { style: copyWrapper, children: (0, jsx_runtime_1.jsx)(CliCopyButton_1.CliCopyButton, { valueToCopy: option.cliFlag }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: infoRow, children: [(0, jsx_runtime_1.jsx)("div", { style: infoRowLabel, children: "Node.JS option" }), (0, jsx_runtime_1.jsx)("div", { style: flexSpacer }), (0, jsx_runtime_1.jsx)("code", { children: option.ssrName }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 3.75 })] }), (0, jsx_runtime_1.jsx)("div", { style: infoRow })] })] }));
55
55
  };
56
56
  exports.OptionExplainer = OptionExplainer;
@@ -1,2 +1,2 @@
1
1
  import type { Codec } from '@remotion/renderer';
2
- export declare const humanReadableCodec: (codec: Codec) => "AAC" | "MP3" | "GIF" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
2
+ export declare const humanReadableCodec: (codec: Codec) => "GIF" | "AAC" | "MP3" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
@@ -16,4 +16,4 @@ export declare const BLUE_DISABLED = "#284f73";
16
16
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
17
17
  selected: boolean;
18
18
  hovered: boolean;
19
- }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "rgba(255, 255, 255, 0.06)" | "hsla(0, 0%, 100%, 0.25)";
19
+ }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const Checkmark: () => JSX.Element;
@@ -34,6 +34,6 @@ export declare const getCliOptions: (options: {
34
34
  videoBitrate: string | null;
35
35
  height: number | null;
36
36
  width: number | null;
37
- configFileImageFormat: "none" | "png" | "jpeg" | undefined;
37
+ configFileImageFormat: "png" | "jpeg" | "none" | undefined;
38
38
  offthreadVideoCacheSizeInBytes: number | null;
39
39
  }>;
package/dist/get-env.js CHANGED
@@ -56,7 +56,12 @@ const getEnvForEnvFile = async (processEnv, envFile, onUpdate) => {
56
56
  try {
57
57
  const envFileData = await node_fs_1.default.promises.readFile(envFile);
58
58
  if (onUpdate) {
59
- watchEnvFile({ processEnv, envFile, onUpdate });
59
+ if (typeof node_fs_1.default.watchFile === 'undefined') {
60
+ log_1.Log.warn('Unsupported feature (fs.watchFile): .env file will not hot reload.');
61
+ }
62
+ else {
63
+ watchEnvFile({ processEnv, envFile, onUpdate });
64
+ }
60
65
  }
61
66
  return {
62
67
  ...processEnv,
@@ -96,11 +101,16 @@ const getEnvironmentVariables = (onUpdate) => {
96
101
  const defaultEnvFile = node_path_1.default.resolve(remotionRoot, '.env');
97
102
  if (!node_fs_1.default.existsSync(defaultEnvFile)) {
98
103
  if (onUpdate) {
99
- watchEnvFile({
100
- processEnv,
101
- envFile: defaultEnvFile,
102
- onUpdate,
103
- });
104
+ if (typeof node_fs_1.default.watchFile === 'undefined') {
105
+ log_1.Log.warn('Unsupported Bun feature: .env file will not hot reload.');
106
+ }
107
+ else {
108
+ watchEnvFile({
109
+ processEnv,
110
+ envFile: defaultEnvFile,
111
+ onUpdate,
112
+ });
113
+ }
104
114
  }
105
115
  return Promise.resolve(processEnv);
106
116
  }
package/dist/index.d.ts CHANGED
@@ -119,7 +119,7 @@ export declare const CliInternals: {
119
119
  videoBitrate: string | null;
120
120
  height: number | null;
121
121
  width: number | null;
122
- configFileImageFormat: "none" | "png" | "jpeg" | undefined;
122
+ configFileImageFormat: "png" | "jpeg" | "none" | undefined;
123
123
  offthreadVideoCacheSizeInBytes: number | null;
124
124
  }>;
125
125
  loadConfig: (remotionRoot: string) => Promise<string | null>;
@@ -129,7 +129,7 @@ export declare const CliInternals: {
129
129
  parsedCli: {
130
130
  "browser-executable": import("@remotion/renderer").BrowserExecutable;
131
131
  "pixel-format": "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
132
- "image-format": "none" | "png" | "jpeg" | "pdf" | "webp";
132
+ "image-format": "png" | "jpeg" | "pdf" | "webp" | "none";
133
133
  "prores-profile": "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy";
134
134
  "x264-preset": "medium" | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "slow" | "slower" | "veryslow" | "placebo";
135
135
  "bundle-cache": string;
@@ -196,7 +196,7 @@ export declare const CliInternals: {
196
196
  downloadName: string | null;
197
197
  outName: string | null;
198
198
  configImageFormat: "png" | "jpeg" | "pdf" | "webp" | null;
199
- cliFlag: "none" | "png" | "jpeg" | "pdf" | "webp" | null;
199
+ cliFlag: "png" | "jpeg" | "pdf" | "webp" | "none" | null;
200
200
  isLambda: boolean;
201
201
  fromUi: "png" | "jpeg" | "pdf" | "webp" | null;
202
202
  }) => {
@@ -211,8 +211,8 @@ export declare const CliInternals: {
211
211
  };
212
212
  getVideoImageFormat: ({ codec, uiImageFormat, }: {
213
213
  codec: import("@remotion/renderer").CodecOrUndefined;
214
- uiImageFormat: "none" | "png" | "jpeg" | null;
215
- }) => "none" | "png" | "jpeg";
214
+ uiImageFormat: "png" | "jpeg" | "none" | null;
215
+ }) => "png" | "jpeg" | "none";
216
216
  printCompositions: (compositions: import("remotion").VideoConfig[]) => void;
217
217
  getFinalOutputCodec: ({ cliFlag, configFile, downloadName, outName, uiCodec, }: {
218
218
  cliFlag: import("@remotion/renderer").CodecOrUndefined;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
+ /// <reference types="bun-types" />
4
5
  import type { ReadStream } from 'node:fs';
5
6
  import type { IncomingMessage, ServerResponse } from 'node:http';
6
7
  export declare function setHeaderForResponse(res: ServerResponse, name: string, value: string | number): void;
@@ -11,5 +11,5 @@ type Range = {
11
11
  type Ranges = Range[] & {
12
12
  type?: string;
13
13
  };
14
- export declare function parseRange(size: number, str: string | string[]): -1 | -2 | Ranges;
14
+ export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
15
15
  export {};
@@ -1,3 +1,5 @@
1
+ /// <reference lib="dom" />
2
+ /// <reference lib="dom.iterable" />
1
3
  import type { HotMiddlewareMessage } from './types';
2
4
  declare function eventSourceWrapper(): {
3
5
  addMessageListener(fn: (msg: MessageEvent) => void): void;
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /// <reference lib="dom" />
3
+ /// <reference lib="dom.iterable" />
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  /* eslint-disable no-console */
4
6
  /**
@@ -11,11 +11,12 @@ const makeLiveEventsRouter = () => {
11
11
  let clients = [];
12
12
  const router = (request, response) => {
13
13
  const headers = {
14
- 'content-type': 'text/event-stream',
14
+ 'content-type': 'text/event-stream;charset=utf-8',
15
15
  connection: 'keep-alive',
16
16
  'cache-control': 'no-cache',
17
17
  };
18
18
  response.writeHead(200, headers);
19
+ response.write('\n');
19
20
  if (request.method === 'OPTIONS') {
20
21
  response.end();
21
22
  return;
@@ -52,7 +52,7 @@ const startServer = async (options) => {
52
52
  (0, routes_1.handleRoutes)({
53
53
  hash: options.hash,
54
54
  hashPrefix: options.hashPrefix,
55
- request,
55
+ request: request,
56
56
  response,
57
57
  liveEventsServer,
58
58
  getCurrentInputProps: options.getCurrentInputProps,
@@ -0,0 +1,2 @@
1
+ import { Internals } from 'remotion';
2
+ export declare const validateDimension: typeof Internals.validateDimension;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDimension = void 0;
4
+ /* eslint-disable prefer-destructuring */
5
+ const remotion_1 = require("remotion");
6
+ exports.validateDimension = remotion_1.Internals.validateDimension;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.23",
3
+ "version": "4.0.25",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -35,11 +35,11 @@
35
35
  "prompts": "2.4.1",
36
36
  "semver": "7.5.3",
37
37
  "source-map": "0.6.1",
38
- "@remotion/renderer": "4.0.23",
39
- "remotion": "4.0.23",
40
- "@remotion/bundler": "4.0.23",
41
- "@remotion/media-utils": "4.0.23",
42
- "@remotion/player": "4.0.23"
38
+ "@remotion/bundler": "4.0.25",
39
+ "@remotion/media-utils": "4.0.25",
40
+ "@remotion/player": "4.0.25",
41
+ "@remotion/renderer": "4.0.25",
42
+ "remotion": "4.0.25"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",
@@ -48,6 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@jonny/eslint-config": "3.0.266",
50
50
  "@types/minimist": "^1.2.2",
51
+ "bun-types": "0.8.0",
51
52
  "@types/node": "18.14.6",
52
53
  "@types/prompts": "^2.4.1",
53
54
  "@types/react": "18.0.26",
@@ -64,8 +65,8 @@
64
65
  "react-dom": "^18.0.0",
65
66
  "vitest": "0.31.1",
66
67
  "zod": "^3.21.4",
67
- "@remotion/zod-types": "4.0.23",
68
- "@remotion/tailwind": "4.0.23"
68
+ "@remotion/zod-types": "4.0.25",
69
+ "@remotion/tailwind": "4.0.25"
69
70
  },
70
71
  "keywords": [
71
72
  "remotion",
@@ -1,14 +0,0 @@
1
- export type SerializedJSONWithCustomFields = {
2
- serializedString: string;
3
- customDateUsed: boolean;
4
- customFileUsed: boolean;
5
- mapUsed: boolean;
6
- setUsed: boolean;
7
- };
8
- export declare const FILE_TOKEN = "remotion-file:";
9
- export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
10
- data: unknown;
11
- indent: number | undefined;
12
- staticBase: string;
13
- }) => SerializedJSONWithCustomFields;
14
- export declare const deserializeJSONWithCustomFields: (data: string) => any;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeJSONWithCustomFields = exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
4
- const DATE_TOKEN = 'remotion-date:';
5
- exports.FILE_TOKEN = 'remotion-file:';
6
- const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
7
- let customDateUsed = false;
8
- let customFileUsed = false;
9
- let mapUsed = false;
10
- let setUsed = false;
11
- const serializedString = JSON.stringify(data, function (key, value) {
12
- const item = this[key];
13
- if (item instanceof Date) {
14
- customDateUsed = true;
15
- return `${DATE_TOKEN}${item.toISOString()}`;
16
- }
17
- if (item instanceof Map) {
18
- mapUsed = true;
19
- return value;
20
- }
21
- if (item instanceof Set) {
22
- setUsed = true;
23
- return value;
24
- }
25
- if (typeof item === 'string' && item.startsWith(staticBase)) {
26
- customFileUsed = true;
27
- return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
28
- }
29
- return value;
30
- }, indent);
31
- return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
32
- };
33
- exports.serializeJSONWithDate = serializeJSONWithDate;
34
- const deserializeJSONWithCustomFields = (data) => {
35
- return JSON.parse(data, (_, value) => {
36
- if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
37
- return new Date(value.replace(DATE_TOKEN, ''));
38
- }
39
- return value;
40
- });
41
- };
42
- exports.deserializeJSONWithCustomFields = deserializeJSONWithCustomFields;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- type SidebarPanel = 'input-props' | 'renders';
3
- export declare const persistSelectedPanel: (panel: SidebarPanel) => void;
4
- export declare const rightSidebarTabs: React.RefObject<{
5
- selectRendersPanel: () => void;
6
- }>;
7
- export declare const RightPanel: React.FC<{}>;
8
- export {};
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RightPanel = exports.rightSidebarTabs = exports.persistSelectedPanel = 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 persistSelectedPanel = (panel) => {
43
- localStorage.setItem(localStorageKey, panel);
44
- };
45
- exports.persistSelectedPanel = persistSelectedPanel;
46
- exports.rightSidebarTabs = (0, react_1.createRef)();
47
- const RightPanel = () => {
48
- const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel());
49
- const onCompositionsSelected = (0, react_1.useCallback)(() => {
50
- setPanel('input-props');
51
- (0, exports.persistSelectedPanel)('input-props');
52
- }, []);
53
- const onRendersSelected = (0, react_1.useCallback)(() => {
54
- setPanel('renders');
55
- (0, exports.persistSelectedPanel)('renders');
56
- }, []);
57
- (0, react_1.useImperativeHandle)(exports.rightSidebarTabs, () => {
58
- return {
59
- selectRendersPanel: () => {
60
- setPanel('renders');
61
- (0, exports.persistSelectedPanel)('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: onCompositionsSelected, 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.RightPanel = RightPanel;