@remotion/studio 4.0.152 → 4.0.154
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +85 -0
- package/dist/api/delete-static-file.d.ts +3 -0
- package/dist/api/delete-static-file.js +16 -0
- package/dist/api/helpers/calc-new-props.d.ts +11 -0
- package/dist/api/helpers/calc-new-props.js +36 -0
- package/dist/api/save-default-props.d.ts +7 -7
- package/dist/api/save-default-props.js +8 -27
- package/dist/api/update-default-props.d.ts +6 -0
- package/dist/api/update-default-props.js +21 -0
- package/dist/api/watch-public-folder.d.ts +13 -0
- package/dist/api/watch-public-folder.js +28 -0
- package/dist/api/watch-static-file.d.ts +1 -2
- package/dist/api/watch-static-file.js +5 -12
- package/dist/components/Editor.js +2 -1
- package/dist/components/PlayPause.js +1 -0
- package/dist/components/RenderModal/DataEditor.js +1 -1
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +7 -7
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +9 -9
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +26 -9
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +10 -10
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +9 -9
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +12 -12
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +6 -6
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +11 -11
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +7 -3
- package/dist/components/RenderModal/SchemaEditor/local-state.js +38 -15
- package/dist/components/RenderQueue/actions.js +15 -38
- package/dist/components/TopPanel.d.ts +5 -5
- package/dist/components/call-api.d.ts +2 -0
- package/dist/components/call-api.js +28 -0
- package/dist/esm/index.mjs +119 -57
- package/dist/esm/internals.mjs +428 -378
- package/dist/helpers/client-id.d.ts +2 -2
- package/dist/helpers/client-id.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -1
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,32 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.canUpdateDefaultProps = exports.callUpdateDefaultPropsApi = exports.getProjectInfo = exports.updateAvailable = exports.cancelRenderJob = exports.removeRenderJob = exports.applyCodemod = exports.copyToClipboard = exports.openInFileExplorer = exports.subscribeToFileExistenceWatcher = exports.unsubscribeFromFileExistenceWatcher = exports.addVideoRenderJob = exports.addSequenceRenderJob = exports.addStillRenderJob = void 0;
|
|
4
4
|
const no_react_1 = require("remotion/no-react");
|
|
5
|
-
const
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
fetch(endpoint, {
|
|
8
|
-
method: 'post',
|
|
9
|
-
headers: {
|
|
10
|
-
'content-type': 'application/json',
|
|
11
|
-
},
|
|
12
|
-
signal,
|
|
13
|
-
body: JSON.stringify(body),
|
|
14
|
-
})
|
|
15
|
-
.then((res) => res.json())
|
|
16
|
-
.then((data) => {
|
|
17
|
-
if (data.success) {
|
|
18
|
-
resolve(data.data);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
reject(new Error(data.error));
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
.catch((err) => {
|
|
25
|
-
reject(err);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
};
|
|
5
|
+
const call_api_1 = require("../call-api");
|
|
29
6
|
const addStillRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, frame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, offthreadVideoCacheSizeInBytes, multiProcessOnLinux, beepOnFinish, }) => {
|
|
30
|
-
return callApi('/api/render', {
|
|
7
|
+
return (0, call_api_1.callApi)('/api/render', {
|
|
31
8
|
compositionId,
|
|
32
9
|
type: 'still',
|
|
33
10
|
outName,
|
|
@@ -51,7 +28,7 @@ const addStillRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, f
|
|
|
51
28
|
};
|
|
52
29
|
exports.addStillRenderJob = addStillRenderJob;
|
|
53
30
|
const addSequenceRenderJob = ({ compositionId, outName, imageFormat, startFrame, endFrame, scale, logLevel, chromiumOptions, delayRenderTimeout, envVariables, inputProps, concurrency, offthreadVideoCacheSizeInBytes, jpegQuality, disallowParallelEncoding, multiProcessOnLinux, beepOnFinish, repro, }) => {
|
|
54
|
-
return callApi('/api/render', {
|
|
31
|
+
return (0, call_api_1.callApi)('/api/render', {
|
|
55
32
|
compositionId,
|
|
56
33
|
type: 'sequence',
|
|
57
34
|
outName,
|
|
@@ -79,7 +56,7 @@ const addSequenceRenderJob = ({ compositionId, outName, imageFormat, startFrame,
|
|
|
79
56
|
};
|
|
80
57
|
exports.addSequenceRenderJob = addSequenceRenderJob;
|
|
81
58
|
const addVideoRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, scale, logLevel, codec, concurrency, crf, startFrame, endFrame, muted, enforceAudioTrack, proResProfile, x264Preset, pixelFormat, audioBitrate, videoBitrate, everyNthFrame, numberOfGifLoops, delayRenderTimeout, audioCodec, disallowParallelEncoding, chromiumOptions, envVariables, inputProps, offthreadVideoCacheSizeInBytes, colorSpace, multiProcessOnLinux, encodingMaxRate, encodingBufferSize, beepOnFinish, repro, forSeamlessAacConcatenation, separateAudioTo, }) => {
|
|
82
|
-
return callApi('/api/render', {
|
|
59
|
+
return (0, call_api_1.callApi)('/api/render', {
|
|
83
60
|
compositionId,
|
|
84
61
|
type: 'video',
|
|
85
62
|
outName,
|
|
@@ -124,11 +101,11 @@ const addVideoRenderJob = ({ compositionId, outName, imageFormat, jpegQuality, s
|
|
|
124
101
|
};
|
|
125
102
|
exports.addVideoRenderJob = addVideoRenderJob;
|
|
126
103
|
const unsubscribeFromFileExistenceWatcher = ({ file, clientId, }) => {
|
|
127
|
-
return callApi('/api/unsubscribe-from-file-existence', { file, clientId });
|
|
104
|
+
return (0, call_api_1.callApi)('/api/unsubscribe-from-file-existence', { file, clientId });
|
|
128
105
|
};
|
|
129
106
|
exports.unsubscribeFromFileExistenceWatcher = unsubscribeFromFileExistenceWatcher;
|
|
130
107
|
const subscribeToFileExistenceWatcher = async ({ file, clientId, }) => {
|
|
131
|
-
const { exists } = await callApi('/api/subscribe-to-file-existence', {
|
|
108
|
+
const { exists } = await (0, call_api_1.callApi)('/api/subscribe-to-file-existence', {
|
|
132
109
|
file,
|
|
133
110
|
clientId,
|
|
134
111
|
});
|
|
@@ -139,7 +116,7 @@ const openInFileExplorer = ({ directory }) => {
|
|
|
139
116
|
const body = {
|
|
140
117
|
directory,
|
|
141
118
|
};
|
|
142
|
-
return callApi('/api/open-in-file-explorer', body);
|
|
119
|
+
return (0, call_api_1.callApi)('/api/open-in-file-explorer', body);
|
|
143
120
|
};
|
|
144
121
|
exports.openInFileExplorer = openInFileExplorer;
|
|
145
122
|
const copyToClipboard = ({ outName, binariesDirectory, }) => {
|
|
@@ -147,7 +124,7 @@ const copyToClipboard = ({ outName, binariesDirectory, }) => {
|
|
|
147
124
|
outName,
|
|
148
125
|
binariesDirectory,
|
|
149
126
|
};
|
|
150
|
-
return callApi('/api/copy-still-to-clipboard', body);
|
|
127
|
+
return (0, call_api_1.callApi)('/api/copy-still-to-clipboard', body);
|
|
151
128
|
};
|
|
152
129
|
exports.copyToClipboard = copyToClipboard;
|
|
153
130
|
const applyCodemod = ({ codemod, dryRun, signal, }) => {
|
|
@@ -155,31 +132,31 @@ const applyCodemod = ({ codemod, dryRun, signal, }) => {
|
|
|
155
132
|
codemod,
|
|
156
133
|
dryRun,
|
|
157
134
|
};
|
|
158
|
-
return callApi('/api/apply-codemod', body, signal);
|
|
135
|
+
return (0, call_api_1.callApi)('/api/apply-codemod', body, signal);
|
|
159
136
|
};
|
|
160
137
|
exports.applyCodemod = applyCodemod;
|
|
161
138
|
const removeRenderJob = (job) => {
|
|
162
|
-
return callApi('/api/remove-render', {
|
|
139
|
+
return (0, call_api_1.callApi)('/api/remove-render', {
|
|
163
140
|
jobId: job.id,
|
|
164
141
|
});
|
|
165
142
|
};
|
|
166
143
|
exports.removeRenderJob = removeRenderJob;
|
|
167
144
|
const cancelRenderJob = (job) => {
|
|
168
|
-
return callApi('/api/cancel', {
|
|
145
|
+
return (0, call_api_1.callApi)('/api/cancel', {
|
|
169
146
|
jobId: job.id,
|
|
170
147
|
});
|
|
171
148
|
};
|
|
172
149
|
exports.cancelRenderJob = cancelRenderJob;
|
|
173
150
|
const updateAvailable = (signal) => {
|
|
174
|
-
return callApi('/api/update-available', {}, signal);
|
|
151
|
+
return (0, call_api_1.callApi)('/api/update-available', {}, signal);
|
|
175
152
|
};
|
|
176
153
|
exports.updateAvailable = updateAvailable;
|
|
177
154
|
const getProjectInfo = (signal) => {
|
|
178
|
-
return callApi('/api/project-info', {}, signal);
|
|
155
|
+
return (0, call_api_1.callApi)('/api/project-info', {}, signal);
|
|
179
156
|
};
|
|
180
157
|
exports.getProjectInfo = getProjectInfo;
|
|
181
158
|
const callUpdateDefaultPropsApi = (compositionId, defaultProps, enumPaths) => {
|
|
182
|
-
return callApi('/api/update-default-props', {
|
|
159
|
+
return (0, call_api_1.callApi)('/api/update-default-props', {
|
|
183
160
|
compositionId,
|
|
184
161
|
defaultProps: no_react_1.NoReactInternals.serializeJSONWithDate({
|
|
185
162
|
data: defaultProps,
|
|
@@ -197,7 +174,7 @@ const canUpdateDefaultProps = (compositionId, readOnlyStudio) => {
|
|
|
197
174
|
reason: 'Read-only studio',
|
|
198
175
|
});
|
|
199
176
|
}
|
|
200
|
-
return callApi('/api/can-update-default-props', {
|
|
177
|
+
return (0, call_api_1.callApi)('/api/can-update-default-props', {
|
|
201
178
|
compositionId,
|
|
202
179
|
});
|
|
203
180
|
};
|
|
@@ -2,9 +2,9 @@ import type { Size } from '@remotion/player';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const useResponsiveSidebarStatus: () => 'collapsed' | 'expanded';
|
|
4
4
|
export declare const TopPanel: React.FC<{
|
|
5
|
-
readOnlyStudio: boolean;
|
|
6
|
-
onMounted: () => void;
|
|
7
|
-
size: Size | null;
|
|
8
|
-
drawRef: React.RefObject<HTMLDivElement>;
|
|
9
|
-
bufferStateDelayInMilliseconds: number;
|
|
5
|
+
readonly readOnlyStudio: boolean;
|
|
6
|
+
readonly onMounted: () => void;
|
|
7
|
+
readonly size: Size | null;
|
|
8
|
+
readonly drawRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
readonly bufferStateDelayInMilliseconds: number;
|
|
10
10
|
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callApi = void 0;
|
|
4
|
+
const callApi = (endpoint, body, signal) => {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
fetch(endpoint, {
|
|
7
|
+
method: 'post',
|
|
8
|
+
headers: {
|
|
9
|
+
'content-type': 'application/json',
|
|
10
|
+
},
|
|
11
|
+
signal,
|
|
12
|
+
body: JSON.stringify(body),
|
|
13
|
+
})
|
|
14
|
+
.then((res) => res.json())
|
|
15
|
+
.then((data) => {
|
|
16
|
+
if (data.success) {
|
|
17
|
+
resolve(data.data);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
reject(new Error(data.error));
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
.catch((err) => {
|
|
24
|
+
reject(err);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.callApi = callApi;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4212,6 +4212,43 @@ var init_lib = __esm(() => {
|
|
|
4212
4212
|
});
|
|
4213
4213
|
});
|
|
4214
4214
|
|
|
4215
|
+
// src/api/delete-static-file.ts
|
|
4216
|
+
import {getRemotionEnvironment} from "remotion";
|
|
4217
|
+
|
|
4218
|
+
// src/components/call-api.ts
|
|
4219
|
+
var callApi = (endpoint, body, signal) => {
|
|
4220
|
+
return new Promise((resolve, reject) => {
|
|
4221
|
+
fetch(endpoint, {
|
|
4222
|
+
method: "post",
|
|
4223
|
+
headers: {
|
|
4224
|
+
"content-type": "application/json"
|
|
4225
|
+
},
|
|
4226
|
+
signal,
|
|
4227
|
+
body: JSON.stringify(body)
|
|
4228
|
+
}).then((res) => res.json()).then((data) => {
|
|
4229
|
+
if (data.success) {
|
|
4230
|
+
resolve(data.data);
|
|
4231
|
+
} else {
|
|
4232
|
+
reject(new Error(data.error));
|
|
4233
|
+
}
|
|
4234
|
+
}).catch((err) => {
|
|
4235
|
+
reject(err);
|
|
4236
|
+
});
|
|
4237
|
+
});
|
|
4238
|
+
};
|
|
4239
|
+
|
|
4240
|
+
// src/api/delete-static-file.ts
|
|
4241
|
+
var deleteStaticFile = async (relativePath) => {
|
|
4242
|
+
if (!getRemotionEnvironment().isStudio) {
|
|
4243
|
+
throw new Error("deleteStaticFile() is only available in the Studio");
|
|
4244
|
+
}
|
|
4245
|
+
if (relativePath.startsWith(window.remotion_staticBase)) {
|
|
4246
|
+
relativePath = relativePath.substring(window.remotion_staticBase.length + 1);
|
|
4247
|
+
}
|
|
4248
|
+
const res = await callApi("/api/delete-static-file", { relativePath });
|
|
4249
|
+
return res;
|
|
4250
|
+
};
|
|
4251
|
+
|
|
4215
4252
|
// src/api/get-static-files.ts
|
|
4216
4253
|
var warnedServer = false;
|
|
4217
4254
|
var warnedPlayer = false;
|
|
@@ -4241,8 +4278,38 @@ var getStaticFiles = () => {
|
|
|
4241
4278
|
return window.remotion_staticFiles;
|
|
4242
4279
|
};
|
|
4243
4280
|
|
|
4244
|
-
// src/api/
|
|
4245
|
-
import {Internals, getRemotionEnvironment} from "remotion";
|
|
4281
|
+
// src/api/helpers/calc-new-props.ts
|
|
4282
|
+
import {Internals, getRemotionEnvironment as getRemotionEnvironment2} from "remotion";
|
|
4283
|
+
var calcNewProps = (compositionId, defaultProps) => {
|
|
4284
|
+
if (!getRemotionEnvironment2().isStudio) {
|
|
4285
|
+
throw new Error("saveDefaultProps can only be called in the Remotion Studio.");
|
|
4286
|
+
}
|
|
4287
|
+
const { compositionsRef, editorPropsProviderRef } = Internals;
|
|
4288
|
+
const compositionsStore = compositionsRef.current;
|
|
4289
|
+
if (!compositionsStore) {
|
|
4290
|
+
throw new Error("No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?");
|
|
4291
|
+
}
|
|
4292
|
+
const compositions = compositionsStore.getCompositions();
|
|
4293
|
+
const composition = compositions.find((c) => c.id === compositionId);
|
|
4294
|
+
if (!composition) {
|
|
4295
|
+
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(", ")}`);
|
|
4296
|
+
}
|
|
4297
|
+
const propsStore = editorPropsProviderRef.current;
|
|
4298
|
+
if (!propsStore) {
|
|
4299
|
+
throw new Error("No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?");
|
|
4300
|
+
}
|
|
4301
|
+
const savedDefaultProps = composition.defaultProps ?? {};
|
|
4302
|
+
const unsavedDefaultProps = propsStore.getProps()[compositionId] ?? savedDefaultProps;
|
|
4303
|
+
const generatedDefaultProps = defaultProps({
|
|
4304
|
+
schema: composition.schema,
|
|
4305
|
+
savedDefaultProps,
|
|
4306
|
+
unsavedDefaultProps
|
|
4307
|
+
});
|
|
4308
|
+
return {
|
|
4309
|
+
composition,
|
|
4310
|
+
generatedDefaultProps
|
|
4311
|
+
};
|
|
4312
|
+
};
|
|
4246
4313
|
|
|
4247
4314
|
// src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
|
|
4248
4315
|
var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
|
|
@@ -4359,26 +4426,6 @@ var extractEnumJsonPaths = (schema, zodRuntime, currentPath) => {
|
|
|
4359
4426
|
|
|
4360
4427
|
// src/components/RenderQueue/actions.ts
|
|
4361
4428
|
import {NoReactInternals} from "remotion/no-react";
|
|
4362
|
-
var callApi = (endpoint, body, signal) => {
|
|
4363
|
-
return new Promise((resolve, reject) => {
|
|
4364
|
-
fetch(endpoint, {
|
|
4365
|
-
method: "post",
|
|
4366
|
-
headers: {
|
|
4367
|
-
"content-type": "application/json"
|
|
4368
|
-
},
|
|
4369
|
-
signal,
|
|
4370
|
-
body: JSON.stringify(body)
|
|
4371
|
-
}).then((res) => res.json()).then((data) => {
|
|
4372
|
-
if (data.success) {
|
|
4373
|
-
resolve(data.data);
|
|
4374
|
-
} else {
|
|
4375
|
-
reject(new Error(data.error));
|
|
4376
|
-
}
|
|
4377
|
-
}).catch((err) => {
|
|
4378
|
-
reject(err);
|
|
4379
|
-
});
|
|
4380
|
-
});
|
|
4381
|
-
};
|
|
4382
4429
|
var callUpdateDefaultPropsApi = (compositionId, defaultProps, enumPaths) => {
|
|
4383
4430
|
return callApi("/api/update-default-props", {
|
|
4384
4431
|
compositionId,
|
|
@@ -4396,36 +4443,13 @@ var saveDefaultProps = async ({
|
|
|
4396
4443
|
compositionId,
|
|
4397
4444
|
defaultProps
|
|
4398
4445
|
}) => {
|
|
4399
|
-
if (!getRemotionEnvironment().isStudio) {
|
|
4400
|
-
throw new Error("saveDefaultProps can only be called in the Remotion Studio.");
|
|
4401
|
-
}
|
|
4402
4446
|
try {
|
|
4403
4447
|
await Promise.resolve().then(() => (init_lib(), exports_lib));
|
|
4404
4448
|
} catch {
|
|
4405
4449
|
throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
|
|
4406
4450
|
}
|
|
4407
4451
|
const z2 = await Promise.resolve().then(() => (init_lib(), exports_lib));
|
|
4408
|
-
const {
|
|
4409
|
-
const compositionsStore = compositionsRef.current;
|
|
4410
|
-
if (!compositionsStore) {
|
|
4411
|
-
throw new Error("No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?");
|
|
4412
|
-
}
|
|
4413
|
-
const compositions = compositionsStore.getCompositions();
|
|
4414
|
-
const composition = compositions.find((c) => c.id === compositionId);
|
|
4415
|
-
if (!composition) {
|
|
4416
|
-
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(", ")}`);
|
|
4417
|
-
}
|
|
4418
|
-
const propsStore = editorPropsProviderRef.current;
|
|
4419
|
-
if (!propsStore) {
|
|
4420
|
-
throw new Error("No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?");
|
|
4421
|
-
}
|
|
4422
|
-
const savedDefaultProps = composition.defaultProps ?? {};
|
|
4423
|
-
const unsavedDefaultProps = propsStore.getProps()[compositionId] ?? savedDefaultProps;
|
|
4424
|
-
const generatedDefaultProps = defaultProps({
|
|
4425
|
-
schema: composition.schema,
|
|
4426
|
-
savedDefaultProps,
|
|
4427
|
-
unsavedDefaultProps
|
|
4428
|
-
});
|
|
4452
|
+
const { generatedDefaultProps, composition } = calcNewProps(compositionId, defaultProps);
|
|
4429
4453
|
const res = await callUpdateDefaultPropsApi(compositionId, generatedDefaultProps, composition.schema ? extractEnumJsonPaths(composition.schema, z2, []) : []);
|
|
4430
4454
|
if (res.success) {
|
|
4431
4455
|
return Promise.resolve();
|
|
@@ -4435,11 +4459,51 @@ var saveDefaultProps = async ({
|
|
|
4435
4459
|
return Promise.reject(err);
|
|
4436
4460
|
};
|
|
4437
4461
|
|
|
4438
|
-
// src/api/
|
|
4439
|
-
import {
|
|
4462
|
+
// src/api/update-default-props.ts
|
|
4463
|
+
import {Internals as Internals2} from "remotion";
|
|
4464
|
+
var PROPS_UPDATED_EXTERNALLY = "remotion.propsUpdatedExternally";
|
|
4465
|
+
var updateDefaultProps = ({
|
|
4466
|
+
compositionId,
|
|
4467
|
+
defaultProps
|
|
4468
|
+
}) => {
|
|
4469
|
+
const { generatedDefaultProps, composition } = calcNewProps(compositionId, defaultProps);
|
|
4470
|
+
const propsStore = Internals2.editorPropsProviderRef.current;
|
|
4471
|
+
if (!propsStore) {
|
|
4472
|
+
throw new Error("No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?");
|
|
4473
|
+
}
|
|
4474
|
+
propsStore.setProps((prev) => {
|
|
4475
|
+
return {
|
|
4476
|
+
...prev,
|
|
4477
|
+
[composition.id]: generatedDefaultProps
|
|
4478
|
+
};
|
|
4479
|
+
});
|
|
4480
|
+
window.dispatchEvent(new CustomEvent(PROPS_UPDATED_EXTERNALLY));
|
|
4481
|
+
};
|
|
4482
|
+
|
|
4483
|
+
// src/api/watch-public-folder.ts
|
|
4484
|
+
import {getRemotionEnvironment as getRemotionEnvironment3} from "remotion";
|
|
4440
4485
|
var WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
|
|
4486
|
+
var watchPublicFolder = (callback) => {
|
|
4487
|
+
if (!getRemotionEnvironment3().isStudio) {
|
|
4488
|
+
console.warn("The API is only available while using the Remotion Studio.");
|
|
4489
|
+
return { cancel: () => {
|
|
4490
|
+
return;
|
|
4491
|
+
} };
|
|
4492
|
+
}
|
|
4493
|
+
const emitUpdate = () => {
|
|
4494
|
+
callback(getStaticFiles());
|
|
4495
|
+
};
|
|
4496
|
+
window.addEventListener(WATCH_REMOTION_STATIC_FILES, emitUpdate);
|
|
4497
|
+
const cancel = () => {
|
|
4498
|
+
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, emitUpdate);
|
|
4499
|
+
};
|
|
4500
|
+
return { cancel };
|
|
4501
|
+
};
|
|
4502
|
+
|
|
4503
|
+
// src/api/watch-static-file.ts
|
|
4504
|
+
import {getRemotionEnvironment as getRemotionEnvironment4} from "remotion";
|
|
4441
4505
|
var watchStaticFile = (fileName, callback) => {
|
|
4442
|
-
if (!
|
|
4506
|
+
if (!getRemotionEnvironment4().isStudio) {
|
|
4443
4507
|
console.warn("The API is only available while using the Remotion Studio.");
|
|
4444
4508
|
return { cancel: () => {
|
|
4445
4509
|
return;
|
|
@@ -4448,8 +4512,7 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
4448
4512
|
const withoutStaticBase = fileName.startsWith(window.remotion_staticBase) ? fileName.replace(window.remotion_staticBase, "") : fileName;
|
|
4449
4513
|
const withoutLeadingSlash = withoutStaticBase.startsWith("/") ? withoutStaticBase.slice(1) : withoutStaticBase;
|
|
4450
4514
|
let prevFileData = window.remotion_staticFiles.find((file) => file.name === withoutLeadingSlash);
|
|
4451
|
-
const
|
|
4452
|
-
const staticFiles = event.detail.files;
|
|
4515
|
+
const { cancel } = watchPublicFolder((staticFiles) => {
|
|
4453
4516
|
const newFileData = staticFiles.find((file) => file.name === withoutLeadingSlash);
|
|
4454
4517
|
if (!newFileData) {
|
|
4455
4518
|
if (prevFileData !== undefined) {
|
|
@@ -4462,11 +4525,7 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
4462
4525
|
callback(newFileData);
|
|
4463
4526
|
prevFileData = newFileData;
|
|
4464
4527
|
}
|
|
4465
|
-
};
|
|
4466
|
-
window.addEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
4467
|
-
const cancel = () => {
|
|
4468
|
-
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
4469
|
-
};
|
|
4528
|
+
});
|
|
4470
4529
|
return { cancel };
|
|
4471
4530
|
};
|
|
4472
4531
|
|
|
@@ -4494,6 +4553,9 @@ var writeStaticFile = async ({
|
|
|
4494
4553
|
export {
|
|
4495
4554
|
writeStaticFile,
|
|
4496
4555
|
watchStaticFile,
|
|
4556
|
+
watchPublicFolder,
|
|
4557
|
+
updateDefaultProps,
|
|
4497
4558
|
saveDefaultProps,
|
|
4498
|
-
getStaticFiles
|
|
4559
|
+
getStaticFiles,
|
|
4560
|
+
deleteStaticFile
|
|
4499
4561
|
};
|