@remotion/cli 4.1.0-alpha1 → 4.1.0-alpha10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/benchmark.js +16 -7
- package/dist/chalk/index.d.ts +2 -1
- package/dist/codemods/stringify-with-path.js +24 -19
- package/dist/compositions.js +9 -4
- package/dist/config/index.d.ts +24 -0
- package/dist/config/index.js +19 -1
- package/dist/editor/components/AssetSelector.d.ts +2 -0
- package/dist/editor/components/AssetSelector.js +30 -0
- package/dist/editor/components/AssetSelectorItem.d.ts +6 -0
- package/dist/editor/components/AssetSelectorItem.js +109 -0
- package/dist/editor/components/Canvas.js +4 -4
- package/dist/editor/components/CanvasOrLoading.js +20 -1
- package/dist/editor/components/CopyButton.js +5 -2
- package/dist/editor/components/Editor.js +1 -3
- package/dist/editor/components/ExplorerPanel.d.ts +8 -0
- package/dist/editor/components/ExplorerPanel.js +67 -0
- package/dist/editor/components/FramePersistor.d.ts +0 -2
- package/dist/editor/components/FramePersistor.js +4 -24
- package/dist/editor/components/FullscreenToggle.d.ts +2 -0
- package/dist/editor/components/FullscreenToggle.js +25 -0
- package/dist/editor/components/GlobalKeybindings.js +1 -1
- package/dist/editor/components/InitialCompositionLoader.js +1 -22
- package/dist/editor/components/KeyboardShortcutsExplainer.js +1 -1
- package/dist/editor/components/NewComposition/InputDragger.js +13 -1
- package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
- package/dist/editor/components/OpenEditorButton.js +5 -2
- package/dist/editor/components/OptionsPanel.d.ts +8 -0
- package/dist/editor/components/OptionsPanel.js +79 -0
- package/dist/editor/components/PlayPause.js +4 -4
- package/dist/editor/components/PlaybackRateSelector.js +1 -1
- package/dist/editor/components/PreviewToolbar.js +3 -1
- package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.js +3 -3
- package/dist/editor/components/RenderModal/DataEditor.d.ts +2 -0
- package/dist/editor/components/RenderModal/DataEditor.js +13 -10
- package/dist/editor/components/RenderModal/FrameRangeSetting.js +9 -25
- package/dist/editor/components/RenderModal/MultiRangeSlider.d.ts +12 -0
- package/dist/editor/components/RenderModal/MultiRangeSlider.js +50 -0
- package/dist/editor/components/RenderModal/RenderModal.js +7 -3
- package/dist/editor/components/RenderModal/RenderModalBasic.d.ts +2 -3
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -2
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +10 -11
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +26 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -3
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -2
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +7 -7
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodFieldValidation.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +29 -10
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +0 -1
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +9 -3
- package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
- package/dist/editor/components/RenderQueue/actions.d.ts +1 -1
- package/dist/editor/components/RenderQueue/actions.js +12 -4
- package/dist/editor/components/RightPanel.js +45 -12
- package/dist/editor/components/SetTimelineInOutProvider.js +5 -4
- package/dist/editor/components/SidebarRenderButton.js +3 -1
- package/dist/editor/components/Timeline/TimelineDragHandler.js +45 -19
- package/dist/editor/components/TimelineInOutToggle.d.ts +2 -1
- package/dist/editor/components/TimelineInOutToggle.js +82 -67
- package/dist/editor/helpers/is-composition-still.d.ts +1 -1
- package/dist/editor/helpers/is-current-selected-still.js +5 -6
- package/dist/editor/helpers/use-menu-structure.js +25 -1
- package/dist/editor/icons/keys.js +1 -0
- package/dist/editor/state/canvas-ref.d.ts +2 -0
- package/dist/editor/state/canvas-ref.js +5 -0
- package/dist/editor/state/in-out.d.ts +3 -2
- package/dist/editor/state/in-out.js +22 -5
- package/dist/editor/state/marks.d.ts +3 -2
- package/dist/editor/state/marks.js +6 -6
- package/dist/error-with-stack-frame.d.ts +19 -0
- package/dist/error-with-stack-frame.js +81 -0
- package/dist/get-composition-id.d.ts +6 -6
- package/dist/get-composition-id.js +13 -6
- package/dist/get-composition-with-dimension-override.d.ts +6 -6
- package/dist/get-composition-with-dimension-override.js +3 -3
- package/dist/handle-common-errors.js +8 -0
- package/dist/handle-javascript-error.d.ts +20 -0
- package/dist/handle-javascript-error.js +81 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.js +5 -2
- package/dist/log.d.ts +6 -1
- package/dist/parse-command-line.js +1 -1
- package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
- package/dist/preview-server/dev-middleware/setup-hooks.js +1 -1
- package/dist/preview-server/render-queue/job.d.ts +2 -2
- package/dist/preview-server/render-queue/make-retry-payload.js +3 -2
- package/dist/preview-server/render-queue/open-directory-in-finder.js +11 -5
- package/dist/preview-server/render-queue/process-still.js +1 -1
- package/dist/preview-server/render-queue/process-video.js +1 -1
- package/dist/preview-server/routes/add-render.js +2 -2
- package/dist/preview-server/routes/update-default-props.js +1 -2
- package/dist/print-compositions.d.ts +2 -2
- package/dist/print-error.js +6 -3
- package/dist/progress-bar.js +2 -5
- package/dist/render-flows/render.d.ts +2 -2
- package/dist/render-flows/render.js +31 -22
- package/dist/render-flows/still.d.ts +2 -2
- package/dist/render-flows/still.js +20 -14
- package/dist/render.js +6 -1
- package/dist/setup-cache.js +1 -1
- package/dist/still.js +6 -1
- package/dist/symbolicate-error.d.ts +3 -0
- package/dist/symbolicate-error.js +24 -0
- package/dist/symbolicate-errors.d.ts +7 -0
- package/dist/symbolicate-errors.js +90 -0
- package/dist/symbolicate-stacktrace.d.ts +28 -0
- package/dist/symbolicate-stacktrace.js +135 -0
- package/dist/symbolicateable-error.d.ts +16 -0
- package/dist/symbolicateable-error.js +18 -0
- package/package.json +11 -11
- package/styles/styles.css +53 -0
package/dist/benchmark.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.benchmarkCommand = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
5
6
|
const chalk_1 = require("./chalk");
|
|
6
7
|
const cleanup_before_quit_1 = require("./cleanup-before-quit");
|
|
7
8
|
const config_1 = require("./config");
|
|
@@ -103,11 +104,11 @@ const benchmarkCommand = async (remotionRoot, args) => {
|
|
|
103
104
|
const browserInstance = renderer_1.RenderInternals.internalOpenBrowser({
|
|
104
105
|
browser,
|
|
105
106
|
browserExecutable,
|
|
106
|
-
shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
|
|
107
107
|
chromiumOptions,
|
|
108
108
|
forceDeviceScaleFactor: scale,
|
|
109
109
|
indent: false,
|
|
110
110
|
viewport: null,
|
|
111
|
+
logLevel,
|
|
111
112
|
});
|
|
112
113
|
const { urlOrBundle: bundleLocation, cleanup: cleanupBundle } = await (0, setup_cache_1.bundleOnCliOrTakeServeUrl)({
|
|
113
114
|
fullPath: fullEntryPoint,
|
|
@@ -125,10 +126,14 @@ const benchmarkCommand = async (remotionRoot, args) => {
|
|
|
125
126
|
});
|
|
126
127
|
(0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
|
|
127
128
|
const puppeteerInstance = await browserInstance;
|
|
128
|
-
const
|
|
129
|
+
const serializedInputPropsWithCustomSchema = remotion_1.Internals.serializeJSONWithDate({
|
|
130
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
131
|
+
indent: undefined,
|
|
132
|
+
staticBase: null,
|
|
133
|
+
}).serializedString;
|
|
129
134
|
const comps = await renderer_1.RenderInternals.internalGetCompositions({
|
|
130
135
|
serveUrlOrWebpackUrl: bundleLocation,
|
|
131
|
-
|
|
136
|
+
serializedInputPropsWithCustomSchema,
|
|
132
137
|
envVariables,
|
|
133
138
|
chromiumOptions,
|
|
134
139
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
@@ -139,7 +144,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
|
|
|
139
144
|
onBrowserLog: null,
|
|
140
145
|
// Intentionally disabling server to not cache results
|
|
141
146
|
server: undefined,
|
|
142
|
-
|
|
147
|
+
logLevel,
|
|
143
148
|
});
|
|
144
149
|
const ids = (remainingArgs[0]
|
|
145
150
|
? remainingArgs[0]
|
|
@@ -192,19 +197,18 @@ const benchmarkCommand = async (remotionRoot, args) => {
|
|
|
192
197
|
codec,
|
|
193
198
|
uiImageFormat: null,
|
|
194
199
|
}),
|
|
195
|
-
|
|
200
|
+
serializedInputPropsWithCustomSchema,
|
|
196
201
|
overwrite,
|
|
197
202
|
pixelFormat,
|
|
198
203
|
proResProfile,
|
|
199
204
|
jpegQuality,
|
|
200
|
-
dumpBrowserLogs: verbose,
|
|
201
205
|
chromiumOptions,
|
|
202
206
|
timeoutInMilliseconds: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
|
|
203
207
|
scale: configFileScale,
|
|
204
208
|
port,
|
|
205
209
|
numberOfGifLoops,
|
|
206
210
|
everyNthFrame,
|
|
207
|
-
|
|
211
|
+
logLevel,
|
|
208
212
|
muted,
|
|
209
213
|
enforceAudioTrack,
|
|
210
214
|
browserExecutable,
|
|
@@ -225,6 +229,11 @@ const benchmarkCommand = async (remotionRoot, args) => {
|
|
|
225
229
|
onStart: () => undefined,
|
|
226
230
|
preferLossless: false,
|
|
227
231
|
server: undefined,
|
|
232
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
233
|
+
data: composition.props,
|
|
234
|
+
indent: undefined,
|
|
235
|
+
staticBase: null,
|
|
236
|
+
}).serializedString,
|
|
228
237
|
}, (run, progress) => {
|
|
229
238
|
benchmarkProgress.update(makeBenchmarkProgressBar({
|
|
230
239
|
totalRuns: runs,
|
package/dist/chalk/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const chalk: {
|
|
2
|
-
enabled: boolean;
|
|
2
|
+
enabled: () => boolean;
|
|
3
3
|
visible: boolean;
|
|
4
4
|
styles: Record<string, {
|
|
5
5
|
codes: [number, number];
|
|
@@ -23,6 +23,7 @@ export declare const chalk: {
|
|
|
23
23
|
yellow: (str: string) => string;
|
|
24
24
|
blue: (str: string) => string;
|
|
25
25
|
magenta: (str: string) => string;
|
|
26
|
+
cyan: (str: string) => string;
|
|
26
27
|
white: (str: string) => string;
|
|
27
28
|
gray: (str: string) => string;
|
|
28
29
|
bgBlack: (str: string) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringifyDefaultProps = void 0;
|
|
4
|
-
const
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
5
|
const doesMatchPath = (path1, enumPaths) => {
|
|
6
6
|
return enumPaths.some((p) => path1.every((item, index) => {
|
|
7
7
|
if (p[index] === '[]' && !Number.isNaN(Number(item))) {
|
|
@@ -13,24 +13,29 @@ const doesMatchPath = (path1, enumPaths) => {
|
|
|
13
13
|
return item === p[index];
|
|
14
14
|
}));
|
|
15
15
|
};
|
|
16
|
-
const stringifyDefaultProps = ({ props, enumPaths, }) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
const stringifyDefaultProps = ({ props, enumPaths, }) => {
|
|
17
|
+
return JSON.stringify(props, replacerWithPath(function (key, value, path) {
|
|
18
|
+
/* Don't replace with arrow function! This function uses `this` */
|
|
19
|
+
const item = this[key];
|
|
20
|
+
if (typeof item === 'string' && doesMatchPath(path, enumPaths)) {
|
|
21
|
+
return `${item}__ADD_AS_CONST__`;
|
|
22
|
+
}
|
|
23
|
+
if (typeof item === 'string' && item.startsWith(remotion_1.Internals.FILE_TOKEN)) {
|
|
24
|
+
return `__REMOVEQUOTE____WRAP_IN_STATIC_FILE_START__${decodeURIComponent(item.replace(remotion_1.Internals.FILE_TOKEN, ''))}__WRAP_IN_STATIC_FILE_END____REMOVEQUOTE__`;
|
|
25
|
+
}
|
|
26
|
+
if (typeof item === 'string' && item.startsWith(remotion_1.Internals.DATE_TOKEN)) {
|
|
27
|
+
return `__REMOVEQUOTE____WRAP_IN_DATE_START__${decodeURIComponent(item.replace(remotion_1.Internals.DATE_TOKEN, ''))}__WRAP_IN_DATE_END____REMOVEQUOTE__`;
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}))
|
|
31
|
+
.replace(/"__REMOVEQUOTE__/g, '')
|
|
32
|
+
.replace(/__REMOVEQUOTE__"/g, '')
|
|
33
|
+
.replace(/__ADD_AS_CONST__"/g, '" as const')
|
|
34
|
+
.replace(/__WRAP_IN_STATIC_FILE_START__/g, 'staticFile("')
|
|
35
|
+
.replace(/__WRAP_IN_STATIC_FILE_END__/g, '")')
|
|
36
|
+
.replace(/__WRAP_IN_DATE_START__/g, 'new Date("')
|
|
37
|
+
.replace(/__WRAP_IN_DATE_END__/g, '")');
|
|
38
|
+
};
|
|
34
39
|
exports.stringifyDefaultProps = stringifyDefaultProps;
|
|
35
40
|
function replacerWithPath(replacer) {
|
|
36
41
|
const m = new Map();
|
package/dist/compositions.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listCompositionsCommand = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
5
6
|
const cleanup_before_quit_1 = require("./cleanup-before-quit");
|
|
6
7
|
const config_1 = require("./config");
|
|
7
8
|
const entry_point_1 = require("./entry-point");
|
|
@@ -17,7 +18,7 @@ const listCompositionsCommand = async (remotionRoot, args) => {
|
|
|
17
18
|
log_1.Log.error('See https://www.remotion.dev/docs/register-root for more information.');
|
|
18
19
|
process.exit(1);
|
|
19
20
|
}
|
|
20
|
-
const
|
|
21
|
+
const logLevel = config_1.ConfigInternals.Logging.getLogLevel();
|
|
21
22
|
log_1.Log.verbose('Entry point:', file, 'reason:', reason);
|
|
22
23
|
const { browserExecutable, chromiumOptions, envVariables, inputProps, puppeteerTimeout, port, publicDir, } = await (0, get_cli_options_1.getCliOptions)({
|
|
23
24
|
isLambda: false,
|
|
@@ -30,7 +31,7 @@ const listCompositionsCommand = async (remotionRoot, args) => {
|
|
|
30
31
|
publicDir,
|
|
31
32
|
onProgress: () => undefined,
|
|
32
33
|
indentOutput: false,
|
|
33
|
-
logLevel
|
|
34
|
+
logLevel,
|
|
34
35
|
bundlingStep: 0,
|
|
35
36
|
steps: 1,
|
|
36
37
|
onDirectoryCreated: (dir) => {
|
|
@@ -44,13 +45,17 @@ const listCompositionsCommand = async (remotionRoot, args) => {
|
|
|
44
45
|
browserExecutable,
|
|
45
46
|
chromiumOptions,
|
|
46
47
|
envVariables,
|
|
47
|
-
|
|
48
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
49
|
+
data: inputProps,
|
|
50
|
+
staticBase: null,
|
|
51
|
+
indent: undefined,
|
|
52
|
+
}).serializedString,
|
|
48
53
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
49
54
|
port,
|
|
50
55
|
indent: false,
|
|
51
56
|
onBrowserLog: null,
|
|
52
57
|
puppeteerInstance: undefined,
|
|
53
|
-
|
|
58
|
+
logLevel,
|
|
54
59
|
server: undefined,
|
|
55
60
|
});
|
|
56
61
|
(0, print_compositions_1.printCompositions)(compositions);
|
package/dist/config/index.d.ts
CHANGED
|
@@ -245,6 +245,30 @@ type FlatConfig = RemotionConfigObject & RemotionBundlingOptions & {
|
|
|
245
245
|
* See the Encoding guide in the docs for defaults and available options.
|
|
246
246
|
*/
|
|
247
247
|
setAudioCodec: (codec: 'pcm-16' | 'aac' | 'mp3' | 'opus') => void;
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated 'The config format has changed. Change `Config.Bundling.*()` calls to `Config.*()` in your config file.'
|
|
250
|
+
*/
|
|
251
|
+
Bundling: void;
|
|
252
|
+
/**
|
|
253
|
+
* @deprecated 'The config format has changed. Change `Config.Preview.*()` calls to `Config.*()` in your config file.'
|
|
254
|
+
*/
|
|
255
|
+
Preview: void;
|
|
256
|
+
/**
|
|
257
|
+
* @deprecated 'The config format has changed. Change `Config.Log.*()` calls to `Config.*()` in your config file.'
|
|
258
|
+
*/
|
|
259
|
+
Log: void;
|
|
260
|
+
/**
|
|
261
|
+
* @deprecated 'The config format has changed. Change `Config.Puppeteer.*()` calls to `Config.*()` in your config file.'
|
|
262
|
+
*/
|
|
263
|
+
Puppeteer: void;
|
|
264
|
+
/**
|
|
265
|
+
* @deprecated 'The config format has changed. Change `Config.Rendering.*()` calls to `Config.*()` in your config file.'
|
|
266
|
+
*/
|
|
267
|
+
Rendering: void;
|
|
268
|
+
/**
|
|
269
|
+
* @deprecated 'The config format has changed. Change `Config.Output.*()` calls to `Config.*()` in your config file.'
|
|
270
|
+
*/
|
|
271
|
+
Output: void;
|
|
248
272
|
};
|
|
249
273
|
export declare const Config: FlatConfig;
|
|
250
274
|
export type { Concurrency, WebpackConfiguration, WebpackOverrideFn };
|
package/dist/config/index.js
CHANGED
|
@@ -83,6 +83,24 @@ const webpack_caching_2 = require("./webpack-caching");
|
|
|
83
83
|
const webpack_poll_1 = require("./webpack-poll");
|
|
84
84
|
const width_1 = require("./width");
|
|
85
85
|
exports.Config = {
|
|
86
|
+
get Bundling() {
|
|
87
|
+
throw new Error('The config format has changed. Change `Config.Bundling.*()` calls to `Config.*()` in your config file.');
|
|
88
|
+
},
|
|
89
|
+
get Rendering() {
|
|
90
|
+
throw new Error('The config format has changed. Change `Config.Rendering.*()` calls to `Config.*()` in your config file.');
|
|
91
|
+
},
|
|
92
|
+
get Output() {
|
|
93
|
+
throw new Error('The config format has changed. Change `Config.Output.*()` calls to `Config.*()` in your config file.');
|
|
94
|
+
},
|
|
95
|
+
get Log() {
|
|
96
|
+
throw new Error('The config format has changed. Change `Config.Log.*()` calls to `Config.*()` in your config file.');
|
|
97
|
+
},
|
|
98
|
+
get Preview() {
|
|
99
|
+
throw new Error('The config format has changed. Change `Config.Preview.*()` calls to `Config.*()` in your config file.');
|
|
100
|
+
},
|
|
101
|
+
get Puppeteer() {
|
|
102
|
+
throw new Error('The config format has changed. Change `Config.Puppeteer.*()` calls to `Config.*()` in your config file.');
|
|
103
|
+
},
|
|
86
104
|
setMaxTimelineTracks: max_timeline_tracks_2.setMaxTimelineTracks,
|
|
87
105
|
setKeyboardShortcutsEnabled: keyboard_shortcuts_1.setKeyboardShortcutsEnabled,
|
|
88
106
|
setNumberOfSharedAudioTags: number_of_shared_audio_tags_1.setNumberOfSharedAudioTags,
|
|
@@ -108,7 +126,7 @@ exports.Config = {
|
|
|
108
126
|
throw new Error('setQuality() has been renamed - use setJpegQuality() instead.');
|
|
109
127
|
},
|
|
110
128
|
setImageFormat: () => {
|
|
111
|
-
throw new Error('setImageFormat() has been renamed - use setVideoImageFormat()
|
|
129
|
+
throw new Error('Config.setImageFormat() has been renamed - use Config.setVideoImageFormat() instead (default "jpeg"). For rendering stills, use Config.setStillImageFormat() (default "png")');
|
|
112
130
|
},
|
|
113
131
|
setJpegQuality: jpeg_quality_2.setJpegQuality,
|
|
114
132
|
setStillImageFormat: image_format_1.setStillImageFormat,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AssetSelector = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const remotion_1 = require("remotion");
|
|
10
|
+
const colors_1 = require("../helpers/colors");
|
|
11
|
+
const z_index_1 = require("../state/z-index");
|
|
12
|
+
const AssetSelectorItem_1 = require("./AssetSelectorItem");
|
|
13
|
+
const container = {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
flex: 1,
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
19
|
+
};
|
|
20
|
+
const list = {
|
|
21
|
+
overflowY: 'auto',
|
|
22
|
+
};
|
|
23
|
+
const AssetSelector = () => {
|
|
24
|
+
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
25
|
+
const staticFiles = react_1.default.useMemo(() => (0, remotion_1.getStaticFiles)(), []);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)("div", { className: "__remotion-vertical-scrollbar", style: list, children: staticFiles.map((file) => {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(AssetSelectorItem_1.AssetSelectorItem, { item: file, tabIndex: tabIndex }, `${file.src}`));
|
|
28
|
+
}) }) }));
|
|
29
|
+
};
|
|
30
|
+
exports.AssetSelector = AssetSelector;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AssetSelectorItem = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const colors_1 = require("../helpers/colors");
|
|
30
|
+
const file_1 = require("../icons/file");
|
|
31
|
+
const folder_1 = require("../icons/folder");
|
|
32
|
+
const InlineAction_1 = require("./InlineAction");
|
|
33
|
+
const layout_1 = require("./layout");
|
|
34
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
35
|
+
const actions_1 = require("./RenderQueue/actions");
|
|
36
|
+
const ASSET_ITEM_HEIGHT = 32;
|
|
37
|
+
const itemStyle = {
|
|
38
|
+
paddingRight: 10,
|
|
39
|
+
paddingTop: 6,
|
|
40
|
+
paddingBottom: 6,
|
|
41
|
+
fontSize: 13,
|
|
42
|
+
display: 'flex',
|
|
43
|
+
textDecoration: 'none',
|
|
44
|
+
cursor: 'default',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
marginBottom: 1,
|
|
47
|
+
appearance: 'none',
|
|
48
|
+
border: 'none',
|
|
49
|
+
width: '100%',
|
|
50
|
+
textAlign: 'left',
|
|
51
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
52
|
+
height: ASSET_ITEM_HEIGHT,
|
|
53
|
+
};
|
|
54
|
+
const labelStyle = {
|
|
55
|
+
textAlign: 'left',
|
|
56
|
+
textDecoration: 'none',
|
|
57
|
+
fontSize: 13,
|
|
58
|
+
flex: '1 1 0%',
|
|
59
|
+
whiteSpace: 'nowrap',
|
|
60
|
+
overflow: 'hidden',
|
|
61
|
+
textOverflow: 'ellipsis',
|
|
62
|
+
};
|
|
63
|
+
const iconStyle = {
|
|
64
|
+
width: 18,
|
|
65
|
+
height: 18,
|
|
66
|
+
flexShrink: 0,
|
|
67
|
+
};
|
|
68
|
+
const revealIconStyle = {
|
|
69
|
+
height: 12,
|
|
70
|
+
color: 'currentColor',
|
|
71
|
+
};
|
|
72
|
+
const AssetSelectorItem = ({ item, tabIndex }) => {
|
|
73
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
74
|
+
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
75
|
+
setHovered(true);
|
|
76
|
+
}, []);
|
|
77
|
+
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
78
|
+
setHovered(false);
|
|
79
|
+
}, []);
|
|
80
|
+
const style = (0, react_1.useMemo)(() => {
|
|
81
|
+
return {
|
|
82
|
+
...itemStyle,
|
|
83
|
+
backgroundColor: hovered ? colors_1.CLEAR_HOVER : 'transparent',
|
|
84
|
+
paddingLeft: 12,
|
|
85
|
+
color: hovered ? 'white' : colors_1.LIGHT_TEXT,
|
|
86
|
+
};
|
|
87
|
+
}, [hovered]);
|
|
88
|
+
const label = (0, react_1.useMemo)(() => {
|
|
89
|
+
return {
|
|
90
|
+
...labelStyle,
|
|
91
|
+
color: hovered ? 'white' : colors_1.LIGHT_TEXT,
|
|
92
|
+
};
|
|
93
|
+
}, [hovered]);
|
|
94
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
95
|
+
console.log('Clicked', item);
|
|
96
|
+
}, [item]);
|
|
97
|
+
const renderAction = (0, react_1.useCallback)((color) => {
|
|
98
|
+
return (0, jsx_runtime_1.jsx)(folder_1.ExpandedFolderIconSolid, { style: revealIconStyle, color: color });
|
|
99
|
+
}, []);
|
|
100
|
+
const revealInExplorer = react_1.default.useCallback(() => {
|
|
101
|
+
(0, actions_1.openInFileExplorer)({
|
|
102
|
+
directory: 'public/' + item.name,
|
|
103
|
+
}).catch((err) => {
|
|
104
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Could not open file: ${err.message}`);
|
|
105
|
+
});
|
|
106
|
+
}, [item.name]);
|
|
107
|
+
return ((0, jsx_runtime_1.jsx)(layout_1.Row, { align: "center", children: (0, jsx_runtime_1.jsxs)("button", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, type: "button", title: item.name, children: [(0, jsx_runtime_1.jsx)(file_1.FileIcon, { style: iconStyle, color: hovered ? 'white' : colors_1.LIGHT_TEXT }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: label, children: item.name }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: revealInExplorer })] }) }));
|
|
108
|
+
};
|
|
109
|
+
exports.AssetSelectorItem = AssetSelectorItem;
|
|
@@ -9,6 +9,7 @@ const colors_1 = require("../helpers/colors");
|
|
|
9
9
|
const get_effective_translation_1 = require("../helpers/get-effective-translation");
|
|
10
10
|
const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
|
|
11
11
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
12
|
+
const canvas_ref_1 = require("../state/canvas-ref");
|
|
12
13
|
const editor_zoom_gestures_1 = require("../state/editor-zoom-gestures");
|
|
13
14
|
const preview_size_1 = require("../state/preview-size");
|
|
14
15
|
const layout_1 = require("./layout");
|
|
@@ -29,11 +30,10 @@ const resetZoom = {
|
|
|
29
30
|
const ZOOM_PX_FACTOR = 0.003;
|
|
30
31
|
const Canvas = () => {
|
|
31
32
|
const dimensions = (0, is_current_selected_still_1.useDimensions)();
|
|
32
|
-
const ref = (0, react_1.useRef)(null);
|
|
33
33
|
const { setSize, size: previewSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
|
|
34
34
|
const { editorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
|
|
35
35
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
36
|
-
const size = player_1.PlayerInternals.useElementSize(
|
|
36
|
+
const size = player_1.PlayerInternals.useElementSize(canvas_ref_1.canvasRef, {
|
|
37
37
|
triggerOnWindowResize: false,
|
|
38
38
|
shouldApplyCssTransforms: true,
|
|
39
39
|
});
|
|
@@ -120,7 +120,7 @@ const Canvas = () => {
|
|
|
120
120
|
});
|
|
121
121
|
}, [editorZoomGestures, dimensions, isFit, setSize, size]);
|
|
122
122
|
(0, react_1.useEffect)(() => {
|
|
123
|
-
const { current } =
|
|
123
|
+
const { current } = canvas_ref_1.canvasRef;
|
|
124
124
|
if (!current) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
@@ -219,6 +219,6 @@ const Canvas = () => {
|
|
|
219
219
|
zoomOut.unregister();
|
|
220
220
|
};
|
|
221
221
|
}, [keybindings, onReset, onZoomIn, onZoomOut]);
|
|
222
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref:
|
|
222
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: canvas_ref_1.canvasRef, style: container, children: [size ? (0, jsx_runtime_1.jsx)(Preview_1.VideoPreview, { canvasSize: size }) : null, isFit ? null : ((0, jsx_runtime_1.jsx)("div", { style: resetZoom, className: "css-reset", children: (0, jsx_runtime_1.jsx)(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) }))] }));
|
|
223
223
|
};
|
|
224
224
|
exports.Canvas = Canvas;
|
|
@@ -6,10 +6,15 @@ const react_1 = require("react");
|
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const ErrorLoader_1 = require("../../preview-server/error-overlay/remotion-overlay/ErrorLoader");
|
|
8
8
|
const colors_1 = require("../helpers/colors");
|
|
9
|
+
const timeline_zoom_1 = require("../state/timeline-zoom");
|
|
9
10
|
const Canvas_1 = require("./Canvas");
|
|
11
|
+
const FramePersistor_1 = require("./FramePersistor");
|
|
10
12
|
const layout_1 = require("./layout");
|
|
11
13
|
const styles_1 = require("./Menu/styles");
|
|
12
14
|
const Spinner_1 = require("./Spinner");
|
|
15
|
+
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
16
|
+
const timeline_scroll_logic_1 = require("./Timeline/timeline-scroll-logic");
|
|
17
|
+
const ZoomPersistor_1 = require("./ZoomPersistor");
|
|
13
18
|
const container = {
|
|
14
19
|
color: 'white',
|
|
15
20
|
flex: 1,
|
|
@@ -22,6 +27,7 @@ const container = {
|
|
|
22
27
|
const CanvasOrLoading = () => {
|
|
23
28
|
const resolved = remotion_1.Internals.useResolvedVideoConfig(null);
|
|
24
29
|
const [takesALongTime, setTakesALongTime] = (0, react_1.useState)(false);
|
|
30
|
+
const { setZoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
25
31
|
(0, react_1.useEffect)(() => {
|
|
26
32
|
const timeout = setTimeout(() => {
|
|
27
33
|
setTakesALongTime(true);
|
|
@@ -30,6 +36,19 @@ const CanvasOrLoading = () => {
|
|
|
30
36
|
clearTimeout(timeout);
|
|
31
37
|
};
|
|
32
38
|
}, []);
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
if ((resolved === null || resolved === void 0 ? void 0 : resolved.type) !== 'success') {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const c = resolved.result;
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
(0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
|
|
46
|
+
direction: 'center',
|
|
47
|
+
frame: (0, imperative_state_1.getCurrentFrame)(),
|
|
48
|
+
durationInFrames: c.durationInFrames,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}, [resolved, setZoom]);
|
|
33
52
|
const style = (0, react_1.useMemo)(() => {
|
|
34
53
|
return {
|
|
35
54
|
...loaderLabel,
|
|
@@ -46,7 +65,7 @@ const CanvasOrLoading = () => {
|
|
|
46
65
|
if (resolved.type === 'error') {
|
|
47
66
|
return (0, jsx_runtime_1.jsx)(exports.ErrorLoading, { error: resolved.error });
|
|
48
67
|
}
|
|
49
|
-
return (0, jsx_runtime_1.jsx)(Canvas_1.Canvas, {});
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FramePersistor_1.FramePersistor, {}), (0, jsx_runtime_1.jsx)(ZoomPersistor_1.ZoomPersistor, {}), (0, jsx_runtime_1.jsx)(Canvas_1.Canvas, {})] }));
|
|
50
69
|
};
|
|
51
70
|
exports.CanvasOrLoading = CanvasOrLoading;
|
|
52
71
|
const loaderLabel = {
|
|
@@ -10,7 +10,10 @@ const iconStyle = {
|
|
|
10
10
|
width: 16,
|
|
11
11
|
height: 16,
|
|
12
12
|
color: 'white',
|
|
13
|
-
|
|
13
|
+
};
|
|
14
|
+
const buttonContainerStyle = {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
minWidth: '114px',
|
|
14
17
|
};
|
|
15
18
|
const copyIcon = ((0, jsx_runtime_1.jsx)("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "far", "data-icon": "clipboard", className: "svg-inline--fa fa-clipboard fa-w-12", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", style: iconStyle, children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm144 418c0 3.3-2.7 6-6 6H54c-3.3 0-6-2.7-6-6V118c0-3.3 2.7-6 6-6h42v36c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-36h42c3.3 0 6 2.7 6 6z" }) }));
|
|
16
19
|
const labelStyle = {
|
|
@@ -29,6 +32,6 @@ const CopyButton = ({ textToCopy, label, labelWhenCopied }) => {
|
|
|
29
32
|
const to = setTimeout(() => setCopied(false), 2000);
|
|
30
33
|
return () => clearTimeout(to);
|
|
31
34
|
}, [copied]);
|
|
32
|
-
return ((0, jsx_runtime_1.jsxs)(Button_1.Button, { onClick: onClick, children: [copyIcon, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1.5 }), ' ', (0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: copied ? labelWhenCopied : label })] }));
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(Button_1.Button, { onClick: onClick, style: {}, buttonContainerStyle: buttonContainerStyle, children: [copyIcon, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1.5 }), ' ', (0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: copied ? labelWhenCopied : label })] }));
|
|
33
36
|
};
|
|
34
37
|
exports.CopyButton = CopyButton;
|
|
@@ -9,12 +9,10 @@ const noop_1 = require("../helpers/noop");
|
|
|
9
9
|
const timeline_zoom_1 = require("../state/timeline-zoom");
|
|
10
10
|
const z_index_1 = require("../state/z-index");
|
|
11
11
|
const EditorContent_1 = require("./EditorContent");
|
|
12
|
-
const FramePersistor_1 = require("./FramePersistor");
|
|
13
12
|
const GlobalKeybindings_1 = require("./GlobalKeybindings");
|
|
14
13
|
const Modals_1 = require("./Modals");
|
|
15
14
|
const NoRegisterRoot_1 = require("./NoRegisterRoot");
|
|
16
15
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
17
|
-
const ZoomPersistor_1 = require("./ZoomPersistor");
|
|
18
16
|
const background = {
|
|
19
17
|
backgroundColor: colors_1.BACKGROUND,
|
|
20
18
|
display: 'flex',
|
|
@@ -41,6 +39,6 @@ const Editor = () => {
|
|
|
41
39
|
});
|
|
42
40
|
return () => cleanup();
|
|
43
41
|
}, [Root, waitForRoot]);
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: noop_1.noop, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsxs)(timeline_zoom_1.TimelineZoomContext, { children: [(0, jsx_runtime_1.jsxs)("div", { style: background, children: [Root === null ? null : (0, jsx_runtime_1.jsx)(Root, {}), (0, jsx_runtime_1.jsxs)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: [
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: noop_1.noop, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsxs)(timeline_zoom_1.TimelineZoomContext, { children: [(0, jsx_runtime_1.jsxs)("div", { style: background, children: [Root === null ? null : (0, jsx_runtime_1.jsx)(Root, {}), (0, jsx_runtime_1.jsxs)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: [Root === null ? (0, jsx_runtime_1.jsx)(NoRegisterRoot_1.NoRegisterRoot, {}) : (0, jsx_runtime_1.jsx)(EditorContent_1.EditorContent, {}), (0, jsx_runtime_1.jsx)(GlobalKeybindings_1.GlobalKeybindings, {})] }), (0, jsx_runtime_1.jsx)(NotificationCenter_1.NotificationCenter, {})] }), (0, jsx_runtime_1.jsx)(Modals_1.Modals, {})] }) }));
|
|
45
43
|
};
|
|
46
44
|
exports.Editor = Editor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type OptionsSidebarPanel = 'compositions' | 'assets';
|
|
3
|
+
export declare const persistSelectedOptionsSidebarPanel: (panel: OptionsSidebarPanel) => void;
|
|
4
|
+
export declare const optionsSidebarTabs: import("react").RefObject<{
|
|
5
|
+
selectRendersPanel: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const ExplorerPanel: React.FC<{}>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExplorerPanel = exports.optionsSidebarTabs = exports.persistSelectedOptionsSidebarPanel = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const colors_1 = require("../helpers/colors");
|
|
8
|
+
const AssetSelector_1 = require("./AssetSelector");
|
|
9
|
+
const CompositionSelector_1 = require("./CompositionSelector");
|
|
10
|
+
const Tabs_1 = require("./Tabs");
|
|
11
|
+
const container = {
|
|
12
|
+
height: '100%',
|
|
13
|
+
width: '100%',
|
|
14
|
+
maxWidth: '100%',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
flex: 1,
|
|
18
|
+
};
|
|
19
|
+
const localStorageKey = 'remotion.sidebarPanel';
|
|
20
|
+
const getSelectedPanel = () => {
|
|
21
|
+
const panel = localStorage.getItem(localStorageKey);
|
|
22
|
+
if (panel === 'assets') {
|
|
23
|
+
return 'assets';
|
|
24
|
+
}
|
|
25
|
+
return 'compositions';
|
|
26
|
+
};
|
|
27
|
+
const tabsContainer = {
|
|
28
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
29
|
+
};
|
|
30
|
+
const persistSelectedOptionsSidebarPanel = (panel) => {
|
|
31
|
+
localStorage.setItem(localStorageKey, panel);
|
|
32
|
+
};
|
|
33
|
+
exports.persistSelectedOptionsSidebarPanel = persistSelectedOptionsSidebarPanel;
|
|
34
|
+
exports.optionsSidebarTabs = (0, react_1.createRef)();
|
|
35
|
+
const ExplorerPanel = () => {
|
|
36
|
+
const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel());
|
|
37
|
+
const onCompositionsSelected = (0, react_1.useCallback)(() => {
|
|
38
|
+
setPanel('compositions');
|
|
39
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('compositions');
|
|
40
|
+
}, []);
|
|
41
|
+
const onAssetsSelected = (0, react_1.useCallback)(() => {
|
|
42
|
+
setPanel('assets');
|
|
43
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('assets');
|
|
44
|
+
}, []);
|
|
45
|
+
(0, react_1.useImperativeHandle)(exports.optionsSidebarTabs, () => {
|
|
46
|
+
return {
|
|
47
|
+
selectRendersPanel: () => {
|
|
48
|
+
setPanel('assets');
|
|
49
|
+
(0, exports.persistSelectedOptionsSidebarPanel)('assets');
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
const { compositions, currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
54
|
+
const composition = (0, react_1.useMemo)(() => {
|
|
55
|
+
for (const comp of compositions) {
|
|
56
|
+
if (comp.id === currentComposition) {
|
|
57
|
+
return comp;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}, [compositions, currentComposition]);
|
|
62
|
+
if (composition === null) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
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 === 'compositions', onClick: onCompositionsSelected, children: "Compositions" }), (0, jsx_runtime_1.jsx)(Tabs_1.Tab, { selected: panel === 'assets', onClick: onAssetsSelected, children: "Assets" })] }) }), panel === 'compositions' ? (0, jsx_runtime_1.jsx)(CompositionSelector_1.CompositionSelector, {}) : (0, jsx_runtime_1.jsx)(AssetSelector_1.AssetSelector, {})] }));
|
|
66
|
+
};
|
|
67
|
+
exports.ExplorerPanel = ExplorerPanel;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
export declare const getCurrentCompositionFromUrl: () => string;
|
|
3
|
-
export declare const persistCurrentFrame: (frame: number) => void;
|
|
4
|
-
export declare const getFrameForComposition: (composition: string) => number;
|
|
5
3
|
export declare const FramePersistor: React.FC;
|