remotion 4.0.373 → 4.0.374
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/cjs/cancel-render.d.ts +7 -0
- package/dist/cjs/cancel-render.js +16 -5
- package/dist/cjs/delay-render.d.ts +14 -2
- package/dist/cjs/delay-render.js +20 -9
- package/dist/cjs/use-delay-render.d.ts +2 -0
- package/dist/cjs/use-delay-render.js +20 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +113 -74
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -1 +1,8 @@
|
|
|
1
|
+
import type { DelayRenderScope } from './delay-render.js';
|
|
2
|
+
/**
|
|
3
|
+
* Internal function that accepts scope as parameter.
|
|
4
|
+
* This allows useDelayRender to control its own scope source.
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare function cancelRenderInternal(scope: DelayRenderScope | undefined, err: unknown): never;
|
|
1
8
|
export declare function cancelRender(err: unknown): never;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cancelRenderInternal = cancelRenderInternal;
|
|
3
4
|
exports.cancelRender = cancelRender;
|
|
4
5
|
const isErrorLike = (err) => {
|
|
5
6
|
if (err instanceof Error) {
|
|
@@ -29,11 +30,12 @@ const isErrorLike = (err) => {
|
|
|
29
30
|
}
|
|
30
31
|
return true;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
/**
|
|
34
|
+
* Internal function that accepts scope as parameter.
|
|
35
|
+
* This allows useDelayRender to control its own scope source.
|
|
36
|
+
* @private
|
|
35
37
|
*/
|
|
36
|
-
function
|
|
38
|
+
function cancelRenderInternal(scope, err) {
|
|
37
39
|
let error;
|
|
38
40
|
if (isErrorLike(err)) {
|
|
39
41
|
error = err;
|
|
@@ -47,6 +49,15 @@ function cancelRender(err) {
|
|
|
47
49
|
else {
|
|
48
50
|
error = Error('Rendering was cancelled');
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
if (scope) {
|
|
53
|
+
scope.remotion_cancelledError = error.stack;
|
|
54
|
+
}
|
|
51
55
|
throw error;
|
|
52
56
|
}
|
|
57
|
+
/*
|
|
58
|
+
* @description When you invoke this function, Remotion will stop rendering all the frames without any retries.
|
|
59
|
+
* @see [Documentation](https://remotion.dev/docs/cancel-render)
|
|
60
|
+
*/
|
|
61
|
+
function cancelRender(err) {
|
|
62
|
+
return cancelRenderInternal(typeof window !== 'undefined' ? window : undefined, err);
|
|
63
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LogLevel } from './log.js';
|
|
1
2
|
import type { RemotionEnvironment } from './remotion-environment-context.js';
|
|
2
3
|
export type DelayRenderScope = {
|
|
3
4
|
remotion_renderReady: boolean;
|
|
@@ -10,6 +11,7 @@ export type DelayRenderScope = {
|
|
|
10
11
|
};
|
|
11
12
|
remotion_puppeteerTimeout: number;
|
|
12
13
|
remotion_attempt: number;
|
|
14
|
+
remotion_cancelledError?: string;
|
|
13
15
|
};
|
|
14
16
|
export declare const DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
15
17
|
export declare const DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
@@ -24,11 +26,21 @@ export type DelayRenderOptions = {
|
|
|
24
26
|
* This allows useDelayRender to control its own environment source.
|
|
25
27
|
* @private
|
|
26
28
|
*/
|
|
27
|
-
export declare const delayRenderInternal: (scope
|
|
29
|
+
export declare const delayRenderInternal: ({ scope, environment, label, options, }: {
|
|
30
|
+
scope: DelayRenderScope | undefined;
|
|
31
|
+
environment: RemotionEnvironment;
|
|
32
|
+
label: string | null;
|
|
33
|
+
options: DelayRenderOptions;
|
|
34
|
+
}) => number;
|
|
28
35
|
export declare const delayRender: (label?: string, options?: DelayRenderOptions) => number;
|
|
29
36
|
/**
|
|
30
37
|
* Internal function that accepts environment as parameter.
|
|
31
38
|
* @private
|
|
32
39
|
*/
|
|
33
|
-
export declare const continueRenderInternal: (scope
|
|
40
|
+
export declare const continueRenderInternal: ({ scope, handle, environment, logLevel, }: {
|
|
41
|
+
scope: DelayRenderScope | undefined;
|
|
42
|
+
handle: number;
|
|
43
|
+
environment: RemotionEnvironment;
|
|
44
|
+
logLevel: LogLevel;
|
|
45
|
+
}) => void;
|
|
34
46
|
export declare const continueRender: (handle: number) => void;
|
package/dist/cjs/delay-render.js
CHANGED
|
@@ -22,9 +22,9 @@ const defaultTimeout = 30000;
|
|
|
22
22
|
* This allows useDelayRender to control its own environment source.
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
|
-
const delayRenderInternal = (scope, environment, label, options) => {
|
|
25
|
+
const delayRenderInternal = ({ scope, environment, label, options, }) => {
|
|
26
26
|
var _a, _b, _c, _d, _e;
|
|
27
|
-
if (typeof label !== 'string' &&
|
|
27
|
+
if (typeof label !== 'string' && label !== null) {
|
|
28
28
|
throw new Error('The label parameter of delayRender() must be a string or undefined, got: ' +
|
|
29
29
|
JSON.stringify(label));
|
|
30
30
|
}
|
|
@@ -52,7 +52,7 @@ const delayRenderInternal = (scope, environment, label, options) => {
|
|
|
52
52
|
]
|
|
53
53
|
.filter(truthy_js_1.truthy)
|
|
54
54
|
.join(' ');
|
|
55
|
-
(0, cancel_render_js_1.
|
|
55
|
+
(0, cancel_render_js_1.cancelRenderInternal)(scope, Error(message));
|
|
56
56
|
}, timeoutToUse),
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -68,14 +68,19 @@ exports.delayRenderInternal = delayRenderInternal;
|
|
|
68
68
|
* @see [Documentation](https://remotion.dev/docs/delay-render)
|
|
69
69
|
*/
|
|
70
70
|
const delayRender = (label, options) => {
|
|
71
|
-
return (0, exports.delayRenderInternal)(
|
|
71
|
+
return (0, exports.delayRenderInternal)({
|
|
72
|
+
scope: typeof window !== 'undefined' ? window : undefined,
|
|
73
|
+
environment: (0, get_remotion_environment_js_1.getRemotionEnvironment)(),
|
|
74
|
+
label: label !== null && label !== void 0 ? label : null,
|
|
75
|
+
options: options !== null && options !== void 0 ? options : {},
|
|
76
|
+
});
|
|
72
77
|
};
|
|
73
78
|
exports.delayRender = delayRender;
|
|
74
79
|
/**
|
|
75
80
|
* Internal function that accepts environment as parameter.
|
|
76
81
|
* @private
|
|
77
82
|
*/
|
|
78
|
-
const continueRenderInternal = (scope, handle, environment) => {
|
|
83
|
+
const continueRenderInternal = ({ scope, handle, environment, logLevel, }) => {
|
|
79
84
|
if (typeof handle === 'undefined') {
|
|
80
85
|
throw new TypeError('The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.');
|
|
81
86
|
}
|
|
@@ -98,9 +103,7 @@ const continueRenderInternal = (scope, handle, environment) => {
|
|
|
98
103
|
]
|
|
99
104
|
.filter(truthy_js_1.truthy)
|
|
100
105
|
.join(' ');
|
|
101
|
-
log_js_1.Log.verbose(
|
|
102
|
-
// TODO: Scope logLevel
|
|
103
|
-
{ logLevel: window.remotion_logLevel, tag: 'delayRender()' }, message);
|
|
106
|
+
log_js_1.Log.verbose({ logLevel, tag: 'delayRender()' }, message);
|
|
104
107
|
delete scope.remotion_delayRenderTimeouts[handle];
|
|
105
108
|
}
|
|
106
109
|
return false;
|
|
@@ -117,6 +120,14 @@ exports.continueRenderInternal = continueRenderInternal;
|
|
|
117
120
|
* @see [Documentation](https://remotion.dev/docs/continue-render)
|
|
118
121
|
*/
|
|
119
122
|
const continueRender = (handle) => {
|
|
120
|
-
|
|
123
|
+
var _a;
|
|
124
|
+
(0, exports.continueRenderInternal)({
|
|
125
|
+
scope: typeof window !== 'undefined' ? window : undefined,
|
|
126
|
+
handle,
|
|
127
|
+
environment: (0, get_remotion_environment_js_1.getRemotionEnvironment)(),
|
|
128
|
+
logLevel: typeof window !== 'undefined'
|
|
129
|
+
? ((_a = window.remotion_logLevel) !== null && _a !== void 0 ? _a : 'info')
|
|
130
|
+
: 'info',
|
|
131
|
+
});
|
|
121
132
|
};
|
|
122
133
|
exports.continueRender = continueRender;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { DelayRenderOptions, DelayRenderScope } from './delay-render.js';
|
|
2
2
|
type DelayRenderFn = (label?: string, options?: DelayRenderOptions) => number;
|
|
3
3
|
type ContinueRenderFn = (handle: number) => void;
|
|
4
|
+
type CancelRenderFn = (err: unknown) => never;
|
|
4
5
|
export declare const DelayRenderContextType: import("react").Context<DelayRenderScope | null>;
|
|
5
6
|
export declare const useDelayRender: () => {
|
|
6
7
|
delayRender: DelayRenderFn;
|
|
7
8
|
continueRender: ContinueRenderFn;
|
|
9
|
+
cancelRender: CancelRenderFn;
|
|
8
10
|
};
|
|
9
11
|
export {};
|
|
@@ -2,18 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useDelayRender = exports.DelayRenderContextType = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const cancel_render_js_1 = require("./cancel-render.js");
|
|
5
6
|
const delay_render_js_1 = require("./delay-render.js");
|
|
7
|
+
const log_level_context_js_1 = require("./log-level-context.js");
|
|
6
8
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
7
9
|
exports.DelayRenderContextType = (0, react_1.createContext)(null);
|
|
8
10
|
const useDelayRender = () => {
|
|
9
11
|
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
10
12
|
const scope = (0, react_1.useContext)(exports.DelayRenderContextType);
|
|
13
|
+
const logLevel = (0, log_level_context_js_1.useLogLevel)();
|
|
11
14
|
const delayRender = (0, react_1.useCallback)((label, options) => {
|
|
12
|
-
return (0, delay_render_js_1.delayRenderInternal)(
|
|
15
|
+
return (0, delay_render_js_1.delayRenderInternal)({
|
|
16
|
+
scope: scope !== null && scope !== void 0 ? scope : (typeof window !== 'undefined' ? window : undefined),
|
|
17
|
+
environment,
|
|
18
|
+
label: label !== null && label !== void 0 ? label : null,
|
|
19
|
+
options: options !== null && options !== void 0 ? options : {},
|
|
20
|
+
});
|
|
13
21
|
}, [environment, scope]);
|
|
14
22
|
const continueRender = (0, react_1.useCallback)((handle) => {
|
|
15
|
-
(0, delay_render_js_1.continueRenderInternal)(
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
(0, delay_render_js_1.continueRenderInternal)({
|
|
24
|
+
scope: scope !== null && scope !== void 0 ? scope : (typeof window !== 'undefined' ? window : undefined),
|
|
25
|
+
handle,
|
|
26
|
+
environment,
|
|
27
|
+
logLevel,
|
|
28
|
+
});
|
|
29
|
+
}, [environment, logLevel, scope]);
|
|
30
|
+
const cancelRender = (0, react_1.useCallback)((err) => {
|
|
31
|
+
return (0, cancel_render_js_1.cancelRenderInternal)(scope !== null && scope !== void 0 ? scope : (typeof window !== 'undefined' ? window : undefined), err);
|
|
32
|
+
}, [scope]);
|
|
33
|
+
return { delayRender, continueRender, cancelRender };
|
|
18
34
|
};
|
|
19
35
|
exports.useDelayRender = useDelayRender;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -110,7 +110,7 @@ function truthy(value) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// src/version.ts
|
|
113
|
-
var VERSION = "4.0.
|
|
113
|
+
var VERSION = "4.0.374";
|
|
114
114
|
|
|
115
115
|
// src/multiple-versions-warning.ts
|
|
116
116
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -149,7 +149,7 @@ var Null = () => {
|
|
|
149
149
|
// src/Sequence.tsx
|
|
150
150
|
import {
|
|
151
151
|
forwardRef as forwardRef2,
|
|
152
|
-
useContext as
|
|
152
|
+
useContext as useContext13,
|
|
153
153
|
useEffect as useEffect3,
|
|
154
154
|
useMemo as useMemo10,
|
|
155
155
|
useState as useState6
|
|
@@ -308,7 +308,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
308
308
|
|
|
309
309
|
// src/TimelineContext.tsx
|
|
310
310
|
import {
|
|
311
|
-
createContext as
|
|
311
|
+
createContext as createContext10,
|
|
312
312
|
useLayoutEffect,
|
|
313
313
|
useMemo as useMemo7,
|
|
314
314
|
useRef as useRef2,
|
|
@@ -1248,7 +1248,7 @@ var usePlayingState = () => {
|
|
|
1248
1248
|
};
|
|
1249
1249
|
|
|
1250
1250
|
// src/use-delay-render.tsx
|
|
1251
|
-
import { createContext as
|
|
1251
|
+
import { createContext as createContext9, useCallback as useCallback4, useContext as useContext8 } from "react";
|
|
1252
1252
|
|
|
1253
1253
|
// src/cancel-render.ts
|
|
1254
1254
|
var isErrorLike = (err) => {
|
|
@@ -1275,7 +1275,7 @@ var isErrorLike = (err) => {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
return true;
|
|
1277
1277
|
};
|
|
1278
|
-
function
|
|
1278
|
+
function cancelRenderInternal(scope, err) {
|
|
1279
1279
|
let error;
|
|
1280
1280
|
if (isErrorLike(err)) {
|
|
1281
1281
|
error = err;
|
|
@@ -1287,9 +1287,14 @@ function cancelRender(err) {
|
|
|
1287
1287
|
} else {
|
|
1288
1288
|
error = Error("Rendering was cancelled");
|
|
1289
1289
|
}
|
|
1290
|
-
|
|
1290
|
+
if (scope) {
|
|
1291
|
+
scope.remotion_cancelledError = error.stack;
|
|
1292
|
+
}
|
|
1291
1293
|
throw error;
|
|
1292
1294
|
}
|
|
1295
|
+
function cancelRender(err) {
|
|
1296
|
+
return cancelRenderInternal(typeof window !== "undefined" ? window : undefined, err);
|
|
1297
|
+
}
|
|
1293
1298
|
|
|
1294
1299
|
// src/log.ts
|
|
1295
1300
|
var logLevels = ["trace", "verbose", "info", "warn", "error"];
|
|
@@ -1357,8 +1362,13 @@ var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
|
1357
1362
|
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
1358
1363
|
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
1359
1364
|
var defaultTimeout = 30000;
|
|
1360
|
-
var delayRenderInternal = (
|
|
1361
|
-
|
|
1365
|
+
var delayRenderInternal = ({
|
|
1366
|
+
scope,
|
|
1367
|
+
environment,
|
|
1368
|
+
label,
|
|
1369
|
+
options
|
|
1370
|
+
}) => {
|
|
1371
|
+
if (typeof label !== "string" && label !== null) {
|
|
1362
1372
|
throw new Error("The label parameter of delayRender() must be a string or undefined, got: " + JSON.stringify(label));
|
|
1363
1373
|
}
|
|
1364
1374
|
const handle = Math.random();
|
|
@@ -1381,7 +1391,7 @@ var delayRenderInternal = (scope, environment, label, options) => {
|
|
|
1381
1391
|
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
1382
1392
|
called
|
|
1383
1393
|
].filter(truthy).join(" ");
|
|
1384
|
-
|
|
1394
|
+
cancelRenderInternal(scope, Error(message));
|
|
1385
1395
|
}, timeoutToUse)
|
|
1386
1396
|
};
|
|
1387
1397
|
}
|
|
@@ -1392,9 +1402,19 @@ var delayRenderInternal = (scope, environment, label, options) => {
|
|
|
1392
1402
|
return handle;
|
|
1393
1403
|
};
|
|
1394
1404
|
var delayRender = (label, options) => {
|
|
1395
|
-
return delayRenderInternal(
|
|
1405
|
+
return delayRenderInternal({
|
|
1406
|
+
scope: typeof window !== "undefined" ? window : undefined,
|
|
1407
|
+
environment: getRemotionEnvironment(),
|
|
1408
|
+
label: label ?? null,
|
|
1409
|
+
options: options ?? {}
|
|
1410
|
+
});
|
|
1396
1411
|
};
|
|
1397
|
-
var continueRenderInternal = (
|
|
1412
|
+
var continueRenderInternal = ({
|
|
1413
|
+
scope,
|
|
1414
|
+
handle,
|
|
1415
|
+
environment,
|
|
1416
|
+
logLevel
|
|
1417
|
+
}) => {
|
|
1398
1418
|
if (typeof handle === "undefined") {
|
|
1399
1419
|
throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");
|
|
1400
1420
|
}
|
|
@@ -1414,7 +1434,7 @@ var continueRenderInternal = (scope, handle, environment) => {
|
|
|
1414
1434
|
DELAY_RENDER_CLEAR_TOKEN,
|
|
1415
1435
|
`${Date.now() - startTime}ms`
|
|
1416
1436
|
].filter(truthy).join(" ");
|
|
1417
|
-
Log.verbose({ logLevel
|
|
1437
|
+
Log.verbose({ logLevel, tag: "delayRender()" }, message);
|
|
1418
1438
|
delete scope.remotion_delayRenderTimeouts[handle];
|
|
1419
1439
|
}
|
|
1420
1440
|
return false;
|
|
@@ -1426,26 +1446,67 @@ var continueRenderInternal = (scope, handle, environment) => {
|
|
|
1426
1446
|
}
|
|
1427
1447
|
};
|
|
1428
1448
|
var continueRender = (handle) => {
|
|
1429
|
-
continueRenderInternal(
|
|
1449
|
+
continueRenderInternal({
|
|
1450
|
+
scope: typeof window !== "undefined" ? window : undefined,
|
|
1451
|
+
handle,
|
|
1452
|
+
environment: getRemotionEnvironment(),
|
|
1453
|
+
logLevel: typeof window !== "undefined" ? window.remotion_logLevel ?? "info" : "info"
|
|
1454
|
+
});
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
// src/log-level-context.tsx
|
|
1458
|
+
import { createContext as createContext8 } from "react";
|
|
1459
|
+
import * as React6 from "react";
|
|
1460
|
+
var LogLevelContext = createContext8({
|
|
1461
|
+
logLevel: "info",
|
|
1462
|
+
mountTime: 0
|
|
1463
|
+
});
|
|
1464
|
+
var useLogLevel = () => {
|
|
1465
|
+
const { logLevel } = React6.useContext(LogLevelContext);
|
|
1466
|
+
if (logLevel === null) {
|
|
1467
|
+
throw new Error("useLogLevel must be used within a LogLevelProvider");
|
|
1468
|
+
}
|
|
1469
|
+
return logLevel;
|
|
1470
|
+
};
|
|
1471
|
+
var useMountTime = () => {
|
|
1472
|
+
const { mountTime } = React6.useContext(LogLevelContext);
|
|
1473
|
+
if (mountTime === null) {
|
|
1474
|
+
throw new Error("useMountTime must be used within a LogLevelProvider");
|
|
1475
|
+
}
|
|
1476
|
+
return mountTime;
|
|
1430
1477
|
};
|
|
1431
1478
|
|
|
1432
1479
|
// src/use-delay-render.tsx
|
|
1433
|
-
var DelayRenderContextType =
|
|
1480
|
+
var DelayRenderContextType = createContext9(null);
|
|
1434
1481
|
var useDelayRender = () => {
|
|
1435
1482
|
const environment = useRemotionEnvironment();
|
|
1436
|
-
const scope =
|
|
1483
|
+
const scope = useContext8(DelayRenderContextType);
|
|
1484
|
+
const logLevel = useLogLevel();
|
|
1437
1485
|
const delayRender2 = useCallback4((label, options) => {
|
|
1438
|
-
return delayRenderInternal(
|
|
1486
|
+
return delayRenderInternal({
|
|
1487
|
+
scope: scope ?? (typeof window !== "undefined" ? window : undefined),
|
|
1488
|
+
environment,
|
|
1489
|
+
label: label ?? null,
|
|
1490
|
+
options: options ?? {}
|
|
1491
|
+
});
|
|
1439
1492
|
}, [environment, scope]);
|
|
1440
1493
|
const continueRender2 = useCallback4((handle) => {
|
|
1441
|
-
continueRenderInternal(
|
|
1442
|
-
|
|
1443
|
-
|
|
1494
|
+
continueRenderInternal({
|
|
1495
|
+
scope: scope ?? (typeof window !== "undefined" ? window : undefined),
|
|
1496
|
+
handle,
|
|
1497
|
+
environment,
|
|
1498
|
+
logLevel
|
|
1499
|
+
});
|
|
1500
|
+
}, [environment, logLevel, scope]);
|
|
1501
|
+
const cancelRender2 = useCallback4((err) => {
|
|
1502
|
+
return cancelRenderInternal(scope ?? (typeof window !== "undefined" ? window : undefined), err);
|
|
1503
|
+
}, [scope]);
|
|
1504
|
+
return { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 };
|
|
1444
1505
|
};
|
|
1445
1506
|
|
|
1446
1507
|
// src/TimelineContext.tsx
|
|
1447
1508
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1448
|
-
var SetTimelineContext =
|
|
1509
|
+
var SetTimelineContext = createContext10({
|
|
1449
1510
|
setFrame: () => {
|
|
1450
1511
|
throw new Error("default");
|
|
1451
1512
|
},
|
|
@@ -1453,7 +1514,7 @@ var SetTimelineContext = createContext9({
|
|
|
1453
1514
|
throw new Error("default");
|
|
1454
1515
|
}
|
|
1455
1516
|
});
|
|
1456
|
-
var TimelineContext =
|
|
1517
|
+
var TimelineContext = createContext10({
|
|
1457
1518
|
frame: {},
|
|
1458
1519
|
playing: false,
|
|
1459
1520
|
playbackRate: 1,
|
|
@@ -1528,12 +1589,12 @@ var TimelineContextProvider = ({ children, frameState }) => {
|
|
|
1528
1589
|
};
|
|
1529
1590
|
|
|
1530
1591
|
// src/use-video-config.ts
|
|
1531
|
-
import { useContext as
|
|
1592
|
+
import { useContext as useContext10 } from "react";
|
|
1532
1593
|
|
|
1533
1594
|
// src/CanUseRemotionHooks.tsx
|
|
1534
|
-
import { createContext as
|
|
1595
|
+
import { createContext as createContext11 } from "react";
|
|
1535
1596
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1536
|
-
var CanUseRemotionHooks =
|
|
1597
|
+
var CanUseRemotionHooks = createContext11(false);
|
|
1537
1598
|
var CanUseRemotionHooksProvider = ({ children }) => {
|
|
1538
1599
|
return /* @__PURE__ */ jsx7(CanUseRemotionHooks.Provider, {
|
|
1539
1600
|
value: true,
|
|
@@ -1542,9 +1603,9 @@ var CanUseRemotionHooksProvider = ({ children }) => {
|
|
|
1542
1603
|
};
|
|
1543
1604
|
|
|
1544
1605
|
// src/use-unsafe-video-config.ts
|
|
1545
|
-
import { useContext as
|
|
1606
|
+
import { useContext as useContext9, useMemo as useMemo8 } from "react";
|
|
1546
1607
|
var useUnsafeVideoConfig = () => {
|
|
1547
|
-
const context =
|
|
1608
|
+
const context = useContext9(SequenceContext);
|
|
1548
1609
|
const ctxWidth = context?.width ?? null;
|
|
1549
1610
|
const ctxHeight = context?.height ?? null;
|
|
1550
1611
|
const ctxDuration = context?.durationInFrames ?? null;
|
|
@@ -1587,7 +1648,7 @@ var useUnsafeVideoConfig = () => {
|
|
|
1587
1648
|
// src/use-video-config.ts
|
|
1588
1649
|
var useVideoConfig = () => {
|
|
1589
1650
|
const videoConfig = useUnsafeVideoConfig();
|
|
1590
|
-
const context =
|
|
1651
|
+
const context = useContext10(CanUseRemotionHooks);
|
|
1591
1652
|
const isPlayer = useIsPlayer();
|
|
1592
1653
|
if (!videoConfig) {
|
|
1593
1654
|
if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
|
|
@@ -1606,12 +1667,12 @@ var useVideoConfig = () => {
|
|
|
1606
1667
|
};
|
|
1607
1668
|
|
|
1608
1669
|
// src/freeze.tsx
|
|
1609
|
-
import { useContext as
|
|
1670
|
+
import { useContext as useContext12, useMemo as useMemo9 } from "react";
|
|
1610
1671
|
|
|
1611
1672
|
// src/use-current-frame.ts
|
|
1612
|
-
import { useContext as
|
|
1673
|
+
import { useContext as useContext11 } from "react";
|
|
1613
1674
|
var useCurrentFrame = () => {
|
|
1614
|
-
const canUseRemotionHooks =
|
|
1675
|
+
const canUseRemotionHooks = useContext11(CanUseRemotionHooks);
|
|
1615
1676
|
const env = useRemotionEnvironment();
|
|
1616
1677
|
if (!canUseRemotionHooks) {
|
|
1617
1678
|
if (env.isPlayer) {
|
|
@@ -1620,7 +1681,7 @@ var useCurrentFrame = () => {
|
|
|
1620
1681
|
throw new Error(`useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`);
|
|
1621
1682
|
}
|
|
1622
1683
|
const frame = useTimelinePosition();
|
|
1623
|
-
const context =
|
|
1684
|
+
const context = useContext11(SequenceContext);
|
|
1624
1685
|
const contextOffset = context ? context.cumulatedFrom + context.relativeFrom : 0;
|
|
1625
1686
|
return frame - contextOffset;
|
|
1626
1687
|
};
|
|
@@ -1654,8 +1715,8 @@ var Freeze = ({
|
|
|
1654
1715
|
return active(frame);
|
|
1655
1716
|
}
|
|
1656
1717
|
}, [active, frame]);
|
|
1657
|
-
const timelineContext =
|
|
1658
|
-
const sequenceContext =
|
|
1718
|
+
const timelineContext = useContext12(TimelineContext);
|
|
1719
|
+
const sequenceContext = useContext12(SequenceContext);
|
|
1659
1720
|
const relativeFrom = sequenceContext?.relativeFrom ?? 0;
|
|
1660
1721
|
const timelineValue = useMemo9(() => {
|
|
1661
1722
|
if (!isActive) {
|
|
@@ -1712,8 +1773,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1712
1773
|
}, ref) => {
|
|
1713
1774
|
const { layout = "absolute-fill" } = other;
|
|
1714
1775
|
const [id] = useState6(() => String(Math.random()));
|
|
1715
|
-
const parentSequence =
|
|
1716
|
-
const { rootId } =
|
|
1776
|
+
const parentSequence = useContext13(SequenceContext);
|
|
1777
|
+
const { rootId } = useContext13(TimelineContext);
|
|
1717
1778
|
const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
|
|
1718
1779
|
const nonce = useNonce();
|
|
1719
1780
|
if (layout !== "absolute-fill" && layout !== "none") {
|
|
@@ -1738,8 +1799,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1738
1799
|
const videoConfig = useVideoConfig();
|
|
1739
1800
|
const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
|
|
1740
1801
|
const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
|
|
1741
|
-
const { registerSequence, unregisterSequence } =
|
|
1742
|
-
const { hidden } =
|
|
1802
|
+
const { registerSequence, unregisterSequence } = useContext13(SequenceManager);
|
|
1803
|
+
const { hidden } = useContext13(SequenceVisibilityToggleContext);
|
|
1743
1804
|
const premounting = useMemo10(() => {
|
|
1744
1805
|
return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
|
|
1745
1806
|
}, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
|
|
@@ -1926,7 +1987,7 @@ import {
|
|
|
1926
1987
|
} from "react";
|
|
1927
1988
|
|
|
1928
1989
|
// src/animated-image/canvas.tsx
|
|
1929
|
-
import
|
|
1990
|
+
import React11, { useCallback as useCallback5, useImperativeHandle as useImperativeHandle3, useRef as useRef3 } from "react";
|
|
1930
1991
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1931
1992
|
var calcArgs = (fit, frameSize, canvasSize) => {
|
|
1932
1993
|
switch (fit) {
|
|
@@ -2023,7 +2084,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref
|
|
|
2023
2084
|
style
|
|
2024
2085
|
});
|
|
2025
2086
|
};
|
|
2026
|
-
var Canvas =
|
|
2087
|
+
var Canvas = React11.forwardRef(CanvasRefForwardingFunction);
|
|
2027
2088
|
|
|
2028
2089
|
// src/animated-image/decode-image.ts
|
|
2029
2090
|
var CACHE_SIZE = 5;
|
|
@@ -2285,11 +2346,11 @@ var AnimatedImage = forwardRef3(({
|
|
|
2285
2346
|
});
|
|
2286
2347
|
});
|
|
2287
2348
|
// src/Artifact.tsx
|
|
2288
|
-
import { useContext as
|
|
2349
|
+
import { useContext as useContext14, useEffect as useEffect5, useState as useState9 } from "react";
|
|
2289
2350
|
|
|
2290
2351
|
// src/RenderAssetManager.tsx
|
|
2291
2352
|
import {
|
|
2292
|
-
createContext as
|
|
2353
|
+
createContext as createContext12,
|
|
2293
2354
|
useCallback as useCallback6,
|
|
2294
2355
|
useLayoutEffect as useLayoutEffect3,
|
|
2295
2356
|
useMemo as useMemo11,
|
|
@@ -2329,7 +2390,7 @@ var validateRenderAsset = (artifact) => {
|
|
|
2329
2390
|
|
|
2330
2391
|
// src/RenderAssetManager.tsx
|
|
2331
2392
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2332
|
-
var RenderAssetManager =
|
|
2393
|
+
var RenderAssetManager = createContext12({
|
|
2333
2394
|
registerRenderAsset: () => {
|
|
2334
2395
|
return;
|
|
2335
2396
|
},
|
|
@@ -2375,7 +2436,7 @@ var RenderAssetManagerProvider = ({ children }) => {
|
|
|
2375
2436
|
// src/Artifact.tsx
|
|
2376
2437
|
var ArtifactThumbnail = Symbol("Thumbnail");
|
|
2377
2438
|
var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
2378
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
2439
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext14(RenderAssetManager);
|
|
2379
2440
|
const env = useRemotionEnvironment();
|
|
2380
2441
|
const frame = useCurrentFrame();
|
|
2381
2442
|
const [id] = useState9(() => {
|
|
@@ -2464,11 +2525,11 @@ var calculateMediaDuration = ({
|
|
|
2464
2525
|
};
|
|
2465
2526
|
|
|
2466
2527
|
// src/loop/index.tsx
|
|
2467
|
-
import
|
|
2528
|
+
import React12, { createContext as createContext13, useMemo as useMemo12 } from "react";
|
|
2468
2529
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2469
|
-
var LoopContext =
|
|
2530
|
+
var LoopContext = createContext13(null);
|
|
2470
2531
|
var useLoop = () => {
|
|
2471
|
-
return
|
|
2532
|
+
return React12.useContext(LoopContext);
|
|
2472
2533
|
};
|
|
2473
2534
|
var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) => {
|
|
2474
2535
|
const currentFrame = useCurrentFrame();
|
|
@@ -2522,7 +2583,7 @@ var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) =>
|
|
|
2522
2583
|
Loop.useLoop = useLoop;
|
|
2523
2584
|
|
|
2524
2585
|
// src/prefetch.ts
|
|
2525
|
-
import { useContext as
|
|
2586
|
+
import { useContext as useContext15 } from "react";
|
|
2526
2587
|
|
|
2527
2588
|
// src/playback-logging.ts
|
|
2528
2589
|
var playbackLogging = ({
|
|
@@ -2536,9 +2597,9 @@ var playbackLogging = ({
|
|
|
2536
2597
|
};
|
|
2537
2598
|
|
|
2538
2599
|
// src/prefetch-state.tsx
|
|
2539
|
-
import { createContext as
|
|
2600
|
+
import { createContext as createContext14, useEffect as useEffect6, useState as useState10 } from "react";
|
|
2540
2601
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2541
|
-
var PreloadContext =
|
|
2602
|
+
var PreloadContext = createContext14({});
|
|
2542
2603
|
var preloads = {};
|
|
2543
2604
|
var updaters = [];
|
|
2544
2605
|
var setPreloads = (updater) => {
|
|
@@ -2578,7 +2639,7 @@ var getSrcWithoutHash = (src) => {
|
|
|
2578
2639
|
return src.slice(0, hashIndex);
|
|
2579
2640
|
};
|
|
2580
2641
|
var usePreload = (src) => {
|
|
2581
|
-
const preloads2 =
|
|
2642
|
+
const preloads2 = useContext15(PreloadContext);
|
|
2582
2643
|
const hashFragmentIndex = removeAndGetHashFragment(src);
|
|
2583
2644
|
const withoutHashFragment = getSrcWithoutHash(src);
|
|
2584
2645
|
if (!preloads2[withoutHashFragment]) {
|
|
@@ -2851,7 +2912,7 @@ var resolveTrimProps = ({
|
|
|
2851
2912
|
};
|
|
2852
2913
|
|
|
2853
2914
|
// src/video/duration-state.tsx
|
|
2854
|
-
import { createContext as
|
|
2915
|
+
import { createContext as createContext15, useMemo as useMemo13, useReducer } from "react";
|
|
2855
2916
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2856
2917
|
var durationReducer = (state, action) => {
|
|
2857
2918
|
switch (action.type) {
|
|
@@ -2869,7 +2930,7 @@ var durationReducer = (state, action) => {
|
|
|
2869
2930
|
return state;
|
|
2870
2931
|
}
|
|
2871
2932
|
};
|
|
2872
|
-
var DurationsContext =
|
|
2933
|
+
var DurationsContext = createContext15({
|
|
2873
2934
|
durations: {},
|
|
2874
2935
|
setDurations: () => {
|
|
2875
2936
|
throw new Error("context missing");
|
|
@@ -2914,28 +2975,6 @@ var getCrossOriginValue = ({
|
|
|
2914
2975
|
return;
|
|
2915
2976
|
};
|
|
2916
2977
|
|
|
2917
|
-
// src/log-level-context.tsx
|
|
2918
|
-
import { createContext as createContext15 } from "react";
|
|
2919
|
-
import * as React14 from "react";
|
|
2920
|
-
var LogLevelContext = createContext15({
|
|
2921
|
-
logLevel: "info",
|
|
2922
|
-
mountTime: 0
|
|
2923
|
-
});
|
|
2924
|
-
var useLogLevel = () => {
|
|
2925
|
-
const { logLevel } = React14.useContext(LogLevelContext);
|
|
2926
|
-
if (logLevel === null) {
|
|
2927
|
-
throw new Error("useLogLevel must be used within a LogLevelProvider");
|
|
2928
|
-
}
|
|
2929
|
-
return logLevel;
|
|
2930
|
-
};
|
|
2931
|
-
var useMountTime = () => {
|
|
2932
|
-
const { mountTime } = React14.useContext(LogLevelContext);
|
|
2933
|
-
if (mountTime === null) {
|
|
2934
|
-
throw new Error("useMountTime must be used within a LogLevelProvider");
|
|
2935
|
-
}
|
|
2936
|
-
return mountTime;
|
|
2937
|
-
};
|
|
2938
|
-
|
|
2939
2978
|
// src/use-amplification.ts
|
|
2940
2979
|
import { useContext as useContext17, useLayoutEffect as useLayoutEffect4, useRef as useRef7 } from "react";
|
|
2941
2980
|
|
package/dist/esm/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
|
|
4
4
|
},
|
|
5
5
|
"name": "remotion",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.374",
|
|
7
7
|
"description": "Make videos programmatically",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react-dom": "19.0.0",
|
|
35
35
|
"webpack": "5.96.1",
|
|
36
36
|
"zod": "3.22.3",
|
|
37
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
37
|
+
"@remotion/eslint-config-internal": "4.0.374",
|
|
38
38
|
"eslint": "9.19.0"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|