@remotion/studio 4.0.221 → 4.0.222

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.
@@ -1,4 +1,5 @@
1
1
 
2
- > @remotion/studio@4.0.220 make /Users/jonathanburger/remotion/packages/studio
2
+ 
3
+ > @remotion/studio@4.0.221 make /Users/jonathanburger/remotion/packages/studio
3
4
  > bun --env-file=../.env.bundle bundle.ts
4
5
 
@@ -0,0 +1,85 @@
1
+
2
+ > @remotion/studio@4.0.217 test /Users/jonathanburger/remotion/packages/studio
3
+ > bun test src
4
+
5
+ bun test v1.1.29 (6d43b366)
6
+ 
7
+ src/test/stringify-default-props.test.ts:
8
+ ✓ Should stringify default props correctly [1.05ms]
9
+ ✓ Should stringify default props correctly [0.79ms]
10
+ 
11
+ src/test/sequenced-timeline.test.ts:
12
+ ✓ Should calculate sequences correctly [3.04ms]
13
+ 
14
+ src/test/create-zod-values.test.ts:
15
+ ✓ Should be able to create a string [2.51ms]
16
+ ✓ Should be able to create a number [0.12ms]
17
+ ✓ Should be able to create an object [0.10ms]
18
+ ✓ Should be able to create an array [0.08ms]
19
+ ✓ Should be able to create a union [0.09ms]
20
+ ✓ Zod literal [0.05ms]
21
+ ✓ Should be able to create a discriminated union [0.50ms]
22
+ ✓ Zod instanceof [0.11ms]
23
+ ✓ Zod intersection [0.19ms]
24
+ ✓ Zod tuples [0.11ms]
25
+ ✓ Zod record [0.10ms]
26
+ ✓ Zod map [0.09ms]
27
+ ✓ Zod lazy [0.05ms]
28
+ ✓ Zod set [0.12ms]
29
+ ✓ Zod function [0.14ms]
30
+ ✓ Zod undefined [0.05ms]
31
+ ✓ Zod null [0.10ms]
32
+ ✓ Zod enum [0.08ms]
33
+ ✓ Zod nativeEnum [0.11ms]
34
+ ✓ Zod optional [0.08ms]
35
+ ✓ Zod nullable [0.07ms]
36
+ ✓ Zod undefined [0.07ms]
37
+ ✓ Zod catch [0.07ms]
38
+ ✓ Zod promise [0.08ms]
39
+ ✓ Zod transform [0.11ms]
40
+ ✓ Zod branded [0.08ms]
41
+ ✓ Zod lazy [0.15ms]
42
+ ✓ Zod coerce [0.06ms]
43
+ ✓ Zod strict [0.08ms]
44
+ ✓ Should create a color [0.07ms]
45
+ ✓ Should create a textarea [0.04ms]
46
+ 
47
+ src/test/folder-tree.test.ts:
48
+ ✓ Should create a good folder tree with 1 item inside and 1 item outside [0.18ms]
49
+ ✓ Should handle nested folders well [0.14ms]
50
+ ✓ Should throw if two folders with the same name [0.10ms]
51
+ 
52
+ src/test/big-timeline.test.ts:
53
+ ✓ Should calculate timeline as expected [1.67ms]
54
+ 
55
+ src/test/smooth-zoom.test.ts:
56
+ ✓ Smoothen zoom
57
+ ✓ Unsmoothen zoom [0.03ms]
58
+ 
59
+ src/test/validate-gui-output-filename.test.ts:
60
+ ✓ Should catch dot after slash [2.26ms]
61
+ ✓ Should catch dot in front  [0.02ms]
62
+ 
63
+ src/test/timeline-sequence-layout.test.ts:
64
+ ✓ Should test timeline sequence layout without max media duration [0.10ms]
65
+ ✓ Should test timeline sequence layout with max media duration [0.04ms]
66
+ 
67
+ src/test/extract-zod-enums.test.ts:
68
+ ✓ Extract Zod enums [0.12ms]
69
+ ✓ Extract Zod enums #2 [0.40ms]
70
+ 
71
+ src/test/color-math.test.ts:
72
+ ✓ Color math [0.23ms]
73
+ 
74
+ src/test/format-time.test.ts:
75
+ ✓ Format time [0.02ms]
76
+ 
77
+ src/test/timeline.test.ts:
78
+ ✓ Should calculate timeline with no sequences [0.03ms]
79
+ ✓ Should calculate a basic timeline [0.06ms]
80
+ ✓ Should follow order of nesting [0.07ms]
81
+
82
+  51 pass
83
+  0 fail
84
+ 67 expect() calls
85
+ Ran 51 tests across 12 files. [68.00ms]
package/dist/Studio.js CHANGED
@@ -15,9 +15,11 @@ const getServerDisconnectedDomElement = () => {
15
15
  const Studio = ({ rootComponent, readOnly }) => {
16
16
  (0, react_1.useLayoutEffect)(() => {
17
17
  window.remotion_isStudio = true;
18
+ window.remotion_isReadOnlyStudio = true;
18
19
  remotion_1.Internals.enableSequenceStackTraces();
19
20
  return () => {
20
21
  window.remotion_isStudio = false;
22
+ window.remotion_isReadOnlyStudio = false;
21
23
  };
22
24
  }, []);
23
25
  (0, react_1.useLayoutEffect)(() => {
@@ -7,6 +7,9 @@ const deleteStaticFile = async (relativePath) => {
7
7
  if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
8
8
  throw new Error('deleteStaticFile() is only available in the Studio');
9
9
  }
10
+ if (window.remotion_isReadOnlyStudio) {
11
+ throw new Error('deleteStaticFile() is not available in Read-Only Studio');
12
+ }
10
13
  if (relativePath.startsWith(window.remotion_staticBase)) {
11
14
  relativePath = relativePath.substring(window.remotion_staticBase.length + 1);
12
15
  }
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.installPackages = void 0;
4
+ const remotion_1 = require("remotion");
4
5
  const call_api_1 = require("../components/call-api");
5
6
  const installPackages = (packageNames) => {
7
+ if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
8
+ throw new Error('installPackages() is only available in the Studio');
9
+ }
10
+ if (window.remotion_isReadOnlyStudio) {
11
+ throw new Error('installPackages() is not available in Read-Only Studio');
12
+ }
6
13
  return (0, call_api_1.callApi)('/api/install-package', { packageNames });
7
14
  };
8
15
  exports.installPackages = installPackages;
@@ -5,8 +5,15 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.restartStudio = void 0;
8
+ const remotion_1 = require("remotion");
8
9
  const call_api_1 = require("../components/call-api");
9
10
  const restartStudio = () => {
11
+ if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
12
+ throw new Error('restartStudio() is only available in the Studio');
13
+ }
14
+ if (window.remotion_isReadOnlyStudio) {
15
+ throw new Error('restartStudio() is not available in read-only Studio');
16
+ }
10
17
  return (0, call_api_1.callApi)('/api/restart-studio', {});
11
18
  };
12
19
  exports.restartStudio = restartStudio;
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.saveDefaultProps = void 0;
27
+ const remotion_1 = require("remotion");
27
28
  const extract_enum_json_paths_1 = require("../components/RenderModal/SchemaEditor/extract-enum-json-paths");
28
29
  const actions_1 = require("../components/RenderQueue/actions");
29
30
  const calc_new_props_1 = require("./helpers/calc-new-props");
@@ -33,6 +34,12 @@ const calc_new_props_1 = require("./helpers/calc-new-props");
33
34
  * @param {SafeDefaultPropsFunction} defaultProps A function that returns the new defaultProps for the composition.
34
35
  */
35
36
  const saveDefaultProps = async ({ compositionId, defaultProps, }) => {
37
+ if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
38
+ throw new Error('saveDefaultProps() is only available in the Studio');
39
+ }
40
+ if (window.remotion_isReadOnlyStudio) {
41
+ throw new Error('saveDefaultProps() is not available in read-only Studio');
42
+ }
36
43
  try {
37
44
  await Promise.resolve().then(() => __importStar(require('zod')));
38
45
  }
@@ -16,6 +16,9 @@ const watchPublicFolder = (callback) => {
16
16
  console.warn('The API is only available while using the Remotion Studio.');
17
17
  return { cancel: () => undefined };
18
18
  }
19
+ if (window.remotion_isReadOnlyStudio) {
20
+ throw new Error('watchPublicFolder() is not available in read-only Studio');
21
+ }
19
22
  const emitUpdate = () => {
20
23
  callback((0, get_static_files_1.getStaticFiles)());
21
24
  };
@@ -13,7 +13,12 @@ const watch_public_folder_1 = require("./watch-public-folder");
13
13
  const watchStaticFile = (fileName, callback) => {
14
14
  if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
15
15
  // eslint-disable-next-line no-console
16
- console.warn('The API is only available while using the Remotion Studio.');
16
+ console.warn('watchStaticFile() is only available while using the Remotion Studio.');
17
+ return { cancel: () => undefined };
18
+ }
19
+ if (window.remotion_isReadOnlyStudio) {
20
+ // eslint-disable-next-line no-console
21
+ console.warn('watchStaticFile() is only available in an interactive Studio.');
17
22
  return { cancel: () => undefined };
18
23
  }
19
24
  const withoutStaticBase = fileName.startsWith(window.remotion_staticBase)
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeStaticFile = void 0;
4
4
  const writeStaticFile = async ({ contents, filePath, }) => {
5
+ if (window.remotion_isReadOnlyStudio) {
6
+ throw new Error('writeStaticFile() is not available in read-only Studio');
7
+ }
5
8
  const url = new URL('/api/add-asset', window.location.origin);
6
9
  if (filePath.includes('\\')) {
7
10
  return Promise.reject(new Error('File path cannot contain backslashes'));
@@ -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)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#f1c40f" | "#ff3232";
15
+ }) => "#ff3232" | "hsla(0, 0%, 100%, 0.15)" | "#f1c40f" | "rgba(255, 255, 255, 0.05)" | "rgba(0, 0, 0, 0.6)";
16
16
  export declare const RemotionInput: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
17
17
  export {};
@@ -10,8 +10,17 @@ const createZodValues = (schema, zodRuntime, zodTypes) => {
10
10
  switch (typeName) {
11
11
  case zodRuntime.ZodFirstPartyTypeKind.ZodString:
12
12
  return '';
13
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
13
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNumber: {
14
+ for (const check of def.checks) {
15
+ if (check.kind === 'min') {
16
+ return check.value;
17
+ }
18
+ if (check.kind === 'max' && check.value < 0) {
19
+ return check.value;
20
+ }
21
+ }
14
22
  return 0;
23
+ }
15
24
  case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
16
25
  return BigInt(0);
17
26
  case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
@@ -3755,6 +3755,9 @@ var deleteStaticFile = async (relativePath) => {
3755
3755
  if (!getRemotionEnvironment().isStudio) {
3756
3756
  throw new Error("deleteStaticFile() is only available in the Studio");
3757
3757
  }
3758
+ if (window.remotion_isReadOnlyStudio) {
3759
+ throw new Error("deleteStaticFile() is not available in Read-Only Studio");
3760
+ }
3758
3761
  if (relativePath.startsWith(window.remotion_staticBase)) {
3759
3762
  relativePath = relativePath.substring(window.remotion_staticBase.length + 1);
3760
3763
  }
@@ -3855,9 +3858,19 @@ var reevaluateComposition = () => {
3855
3858
  Internals2.resolveCompositionsRef.current?.reloadCurrentlySelectedComposition();
3856
3859
  };
3857
3860
  // src/api/restart-studio.ts
3861
+ import { getRemotionEnvironment as getRemotionEnvironment3 } from "remotion";
3858
3862
  var restartStudio = () => {
3863
+ if (!getRemotionEnvironment3().isStudio) {
3864
+ throw new Error("restartStudio() is only available in the Studio");
3865
+ }
3866
+ if (window.remotion_isReadOnlyStudio) {
3867
+ throw new Error("restartStudio() is not available in read-only Studio");
3868
+ }
3859
3869
  return callApi("/api/restart-studio", {});
3860
3870
  };
3871
+ // src/api/save-default-props.ts
3872
+ import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
3873
+
3861
3874
  // src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
3862
3875
  var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
3863
3876
  const def = schema._def;
@@ -3990,6 +4003,12 @@ var saveDefaultProps = async ({
3990
4003
  compositionId,
3991
4004
  defaultProps
3992
4005
  }) => {
4006
+ if (!getRemotionEnvironment4().isStudio) {
4007
+ throw new Error("saveDefaultProps() is only available in the Studio");
4008
+ }
4009
+ if (window.remotion_isReadOnlyStudio) {
4010
+ throw new Error("saveDefaultProps() is not available in read-only Studio");
4011
+ }
3993
4012
  try {
3994
4013
  await Promise.resolve().then(() => (init_lib(), exports_lib));
3995
4014
  } catch {
@@ -4025,15 +4044,18 @@ var updateDefaultProps = ({
4025
4044
  window.dispatchEvent(new CustomEvent(Internals3.PROPS_UPDATED_EXTERNALLY));
4026
4045
  };
4027
4046
  // src/api/watch-public-folder.ts
4028
- import { getRemotionEnvironment as getRemotionEnvironment3 } from "remotion";
4047
+ import { getRemotionEnvironment as getRemotionEnvironment5 } from "remotion";
4029
4048
  var WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
4030
4049
  var watchPublicFolder = (callback) => {
4031
- if (!getRemotionEnvironment3().isStudio) {
4050
+ if (!getRemotionEnvironment5().isStudio) {
4032
4051
  console.warn("The API is only available while using the Remotion Studio.");
4033
4052
  return { cancel: () => {
4034
4053
  return;
4035
4054
  } };
4036
4055
  }
4056
+ if (window.remotion_isReadOnlyStudio) {
4057
+ throw new Error("watchPublicFolder() is not available in read-only Studio");
4058
+ }
4037
4059
  const emitUpdate = () => {
4038
4060
  callback(getStaticFiles());
4039
4061
  };
@@ -4044,10 +4066,16 @@ var watchPublicFolder = (callback) => {
4044
4066
  return { cancel };
4045
4067
  };
4046
4068
  // src/api/watch-static-file.ts
4047
- import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
4069
+ import { getRemotionEnvironment as getRemotionEnvironment6 } from "remotion";
4048
4070
  var watchStaticFile = (fileName, callback) => {
4049
- if (!getRemotionEnvironment4().isStudio) {
4050
- console.warn("The API is only available while using the Remotion Studio.");
4071
+ if (!getRemotionEnvironment6().isStudio) {
4072
+ console.warn("watchStaticFile() is only available while using the Remotion Studio.");
4073
+ return { cancel: () => {
4074
+ return;
4075
+ } };
4076
+ }
4077
+ if (window.remotion_isReadOnlyStudio) {
4078
+ console.warn("watchStaticFile() is only available in an interactive Studio.");
4051
4079
  return { cancel: () => {
4052
4080
  return;
4053
4081
  } };
@@ -4076,6 +4104,9 @@ var writeStaticFile = async ({
4076
4104
  contents,
4077
4105
  filePath
4078
4106
  }) => {
4107
+ if (window.remotion_isReadOnlyStudio) {
4108
+ throw new Error("writeStaticFile() is not available in read-only Studio");
4109
+ }
4079
4110
  const url = new URL("/api/add-asset", window.location.origin);
4080
4111
  if (filePath.includes("\\")) {
4081
4112
  return Promise.reject(new Error("File path cannot contain backslashes"));
@@ -3059,6 +3059,9 @@ var writeStaticFile = async ({
3059
3059
  contents,
3060
3060
  filePath
3061
3061
  }) => {
3062
+ if (window.remotion_isReadOnlyStudio) {
3063
+ throw new Error("writeStaticFile() is not available in read-only Studio");
3064
+ }
3062
3065
  const url = new URL("/api/add-asset", window.location.origin);
3063
3066
  if (filePath.includes("\\")) {
3064
3067
  return Promise.reject(new Error("File path cannot contain backslashes"));
@@ -4145,7 +4148,14 @@ import { Internals as Internals15 } from "remotion";
4145
4148
  import { NoReactInternals as NoReactInternals5 } from "remotion/no-react";
4146
4149
 
4147
4150
  // src/api/restart-studio.ts
4151
+ import { getRemotionEnvironment } from "remotion";
4148
4152
  var restartStudio = () => {
4153
+ if (!getRemotionEnvironment().isStudio) {
4154
+ throw new Error("restartStudio() is only available in the Studio");
4155
+ }
4156
+ if (window.remotion_isReadOnlyStudio) {
4157
+ throw new Error("restartStudio() is not available in read-only Studio");
4158
+ }
4149
4159
  return callApi("/api/restart-studio", {});
4150
4160
  };
4151
4161
 
@@ -10014,6 +10024,9 @@ import { Internals as Internals34 } from "remotion";
10014
10024
  import React59, { useCallback as useCallback41, useContext as useContext29 } from "react";
10015
10025
  import { Internals as Internals27 } from "remotion";
10016
10026
 
10027
+ // src/api/save-default-props.ts
10028
+ import { getRemotionEnvironment as getRemotionEnvironment3 } from "remotion";
10029
+
10017
10030
  // src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
10018
10031
  var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
10019
10032
  const def = schema._def;
@@ -10128,9 +10141,9 @@ var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
10128
10141
  };
10129
10142
 
10130
10143
  // src/api/helpers/calc-new-props.ts
10131
- import { Internals as Internals26, getRemotionEnvironment } from "remotion";
10144
+ import { Internals as Internals26, getRemotionEnvironment as getRemotionEnvironment2 } from "remotion";
10132
10145
  var calcNewProps = (compositionId, defaultProps) => {
10133
- if (!getRemotionEnvironment().isStudio) {
10146
+ if (!getRemotionEnvironment2().isStudio) {
10134
10147
  throw new Error("saveDefaultProps can only be called in the Remotion Studio.");
10135
10148
  }
10136
10149
  const { compositionsRef, editorPropsProviderRef } = Internals26;
@@ -10165,6 +10178,12 @@ var saveDefaultProps = async ({
10165
10178
  compositionId,
10166
10179
  defaultProps
10167
10180
  }) => {
10181
+ if (!getRemotionEnvironment3().isStudio) {
10182
+ throw new Error("saveDefaultProps() is only available in the Studio");
10183
+ }
10184
+ if (window.remotion_isReadOnlyStudio) {
10185
+ throw new Error("saveDefaultProps() is not available in read-only Studio");
10186
+ }
10168
10187
  try {
10169
10188
  await import("zod");
10170
10189
  } catch {
@@ -11228,8 +11247,17 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
11228
11247
  switch (typeName) {
11229
11248
  case zodRuntime.ZodFirstPartyTypeKind.ZodString:
11230
11249
  return "";
11231
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
11250
+ case zodRuntime.ZodFirstPartyTypeKind.ZodNumber: {
11251
+ for (const check of def.checks) {
11252
+ if (check.kind === "min") {
11253
+ return check.value;
11254
+ }
11255
+ if (check.kind === "max" && check.value < 0) {
11256
+ return check.value;
11257
+ }
11258
+ }
11232
11259
  return 0;
11260
+ }
11233
11261
  case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
11234
11262
  return BigInt(0);
11235
11263
  case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
@@ -19577,7 +19605,14 @@ import React136, { useCallback as useCallback92, useContext as useContext67, use
19577
19605
  import { VERSION as VERSION2 } from "remotion";
19578
19606
 
19579
19607
  // src/api/install-package.ts
19608
+ import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
19580
19609
  var installPackages = (packageNames) => {
19610
+ if (!getRemotionEnvironment4().isStudio) {
19611
+ throw new Error("installPackages() is only available in the Studio");
19612
+ }
19613
+ if (window.remotion_isReadOnlyStudio) {
19614
+ throw new Error("installPackages() is not available in Read-Only Studio");
19615
+ }
19581
19616
  return callApi("/api/install-package", { packageNames });
19582
19617
  };
19583
19618
 
@@ -27155,9 +27190,11 @@ var getServerDisconnectedDomElement = () => {
27155
27190
  var Studio = ({ rootComponent, readOnly }) => {
27156
27191
  useLayoutEffect2(() => {
27157
27192
  window.remotion_isStudio = true;
27193
+ window.remotion_isReadOnlyStudio = true;
27158
27194
  Internals61.enableSequenceStackTraces();
27159
27195
  return () => {
27160
27196
  window.remotion_isStudio = false;
27197
+ window.remotion_isReadOnlyStudio = false;
27161
27198
  };
27162
27199
  }, []);
27163
27200
  useLayoutEffect2(() => {
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.221",
6
+ "version": "4.0.222",
7
7
  "description": "APIs for interacting with the Remotion Studio",
8
8
  "main": "dist",
9
9
  "sideEffects": false,
@@ -18,18 +18,18 @@
18
18
  "memfs": "3.4.3",
19
19
  "source-map": "0.7.3",
20
20
  "open": "^8.4.2",
21
- "remotion": "4.0.221",
22
- "@remotion/player": "4.0.221",
23
- "@remotion/studio-shared": "4.0.221",
24
- "@remotion/media-utils": "4.0.221",
25
- "@remotion/renderer": "4.0.221"
21
+ "remotion": "4.0.222",
22
+ "@remotion/player": "4.0.222",
23
+ "@remotion/media-utils": "4.0.222",
24
+ "@remotion/renderer": "4.0.222",
25
+ "@remotion/studio-shared": "4.0.222"
26
26
  },
27
27
  "devDependencies": {
28
28
  "react": "18.3.1",
29
29
  "react-dom": "18.3.1",
30
30
  "@types/semver": "^7.3.4",
31
31
  "zod": "3.22.3",
32
- "@remotion/zod-types": "4.0.221"
32
+ "@remotion/zod-types": "4.0.222"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"