remotion 4.0.59 → 4.0.61
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/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/internals.d.ts +3 -1
- package/dist/cjs/internals.js +2 -0
- package/dist/cjs/spring/index.js +10 -5
- package/dist/cjs/spring/measure-spring.js +15 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/watch-static-file.d.ts +17 -0
- package/dist/cjs/watch-static-file.js +45 -0
- package/dist/esm/index.mjs +69 -7
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export * from './use-video-config.js';
|
|
|
98
98
|
export * from './version.js';
|
|
99
99
|
export * from './video-config.js';
|
|
100
100
|
export * from './video/index.js';
|
|
101
|
+
export { watchStaticFile } from './watch-static-file.js';
|
|
101
102
|
export declare const Experimental: {
|
|
102
103
|
/**
|
|
103
104
|
* @description This is a special component that will cause Remotion to only partially capture the frame of the video.
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Config = exports.Experimental = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.cancelRender = void 0;
|
|
17
|
+
exports.Config = exports.Experimental = exports.watchStaticFile = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.cancelRender = void 0;
|
|
18
18
|
require("./asset-types.js");
|
|
19
19
|
const Clipper_js_1 = require("./Clipper.js");
|
|
20
20
|
const is_player_js_1 = require("./is-player.js");
|
|
@@ -69,6 +69,8 @@ __exportStar(require("./use-video-config.js"), exports);
|
|
|
69
69
|
__exportStar(require("./version.js"), exports);
|
|
70
70
|
__exportStar(require("./video-config.js"), exports);
|
|
71
71
|
__exportStar(require("./video/index.js"), exports);
|
|
72
|
+
var watch_static_file_js_1 = require("./watch-static-file.js");
|
|
73
|
+
Object.defineProperty(exports, "watchStaticFile", { enumerable: true, get: function () { return watch_static_file_js_1.watchStaticFile; } });
|
|
72
74
|
exports.Experimental = {
|
|
73
75
|
/**
|
|
74
76
|
* @description This is a special component that will cause Remotion to only partially capture the frame of the video.
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { validateDimension } from './validation/validate-dimensions.js';
|
|
|
13
13
|
import { validateDurationInFrames } from './validation/validate-duration-in-frames.js';
|
|
14
14
|
import { validateFps } from './validation/validate-fps.js';
|
|
15
15
|
import type { MediaVolumeContextValue, SetMediaVolumeContextValue } from './volume-position-state.js';
|
|
16
|
+
import type { WatchRemotionStaticFilesPayload } from './watch-static-file.js';
|
|
16
17
|
import { useRemotionContexts } from './wrap-remotion-context.js';
|
|
17
18
|
export declare const Internals: {
|
|
18
19
|
readonly useUnsafeVideoConfig: () => import("./video-config.js").VideoConfig | null;
|
|
@@ -144,5 +145,6 @@ export declare const Internals: {
|
|
|
144
145
|
children?: import("react").ReactNode;
|
|
145
146
|
}>;
|
|
146
147
|
readonly isIosSafari: () => boolean;
|
|
148
|
+
readonly WATCH_REMOTION_STATIC_FILES: "remotion_staticFilesChanged";
|
|
147
149
|
};
|
|
148
|
-
export type { TComposition, TimelinePosition as Timeline, TCompMetadata, TSequence, TRenderAsset as TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, };
|
|
150
|
+
export type { TComposition, TimelinePosition as Timeline, TCompMetadata, TSequence, TRenderAsset as TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, WatchRemotionStaticFilesPayload, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -65,6 +65,7 @@ const validate_fps_js_1 = require("./validation/validate-fps.js");
|
|
|
65
65
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
66
66
|
const video_fragment_js_1 = require("./video/video-fragment.js");
|
|
67
67
|
const volume_position_state_js_1 = require("./volume-position-state.js");
|
|
68
|
+
const watch_static_file_js_1 = require("./watch-static-file.js");
|
|
68
69
|
const wrap_remotion_context_js_1 = require("./wrap-remotion-context.js");
|
|
69
70
|
// Mark them as Internals so use don't assume this is public
|
|
70
71
|
// API and are less likely to use it
|
|
@@ -130,4 +131,5 @@ exports.Internals = {
|
|
|
130
131
|
NativeLayersProvider: NativeLayers_js_1.NativeLayersProvider,
|
|
131
132
|
ClipComposition: Composition_js_1.ClipComposition,
|
|
132
133
|
isIosSafari: video_fragment_js_1.isIosSafari,
|
|
134
|
+
WATCH_REMOTION_STATIC_FILES: watch_static_file_js_1.WATCH_REMOTION_STATIC_FILES,
|
|
133
135
|
};
|
package/dist/cjs/spring/index.js
CHANGED
|
@@ -50,14 +50,19 @@ function spring({ frame: passedFrame, fps, config = {}, from = 0, to = 1, durati
|
|
|
50
50
|
throw new Error('did not calculate natural duration, this is an error with Remotion. Please report');
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
|
-
const
|
|
53
|
+
const reverseProcessed = reverse
|
|
54
54
|
? (passedDurationInFrames !== null && passedDurationInFrames !== void 0 ? passedDurationInFrames : naturalDurationGetter.get()) - passedFrame
|
|
55
|
-
: passedFrame
|
|
55
|
+
: passedFrame;
|
|
56
|
+
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
57
|
+
const durationProcessed = passedDurationInFrames === undefined
|
|
58
|
+
? delayProcessed
|
|
59
|
+
: delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
60
|
+
if (passedDurationInFrames && durationProcessed > passedDurationInFrames) {
|
|
61
|
+
return to;
|
|
62
|
+
}
|
|
56
63
|
const spr = (0, spring_utils_js_1.springCalculation)({
|
|
57
64
|
fps,
|
|
58
|
-
frame:
|
|
59
|
-
? frame
|
|
60
|
-
: frame / (passedDurationInFrames / naturalDurationGetter.get()),
|
|
65
|
+
frame: durationProcessed,
|
|
61
66
|
config,
|
|
62
67
|
from,
|
|
63
68
|
to,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.measureSpring = void 0;
|
|
4
4
|
const validate_fps_js_1 = require("../validation/validate-fps.js");
|
|
5
5
|
const spring_utils_js_1 = require("./spring-utils.js");
|
|
6
|
+
const cache = new Map();
|
|
6
7
|
/**
|
|
7
8
|
* @description The function returns how long it takes for a spring animation to settle
|
|
8
9
|
* @see [Documentation](https://www.remotion.dev/docs/measure-spring)
|
|
@@ -26,6 +27,19 @@ function measureSpring({ fps, config = {}, threshold = 0.005, from = 0, to = 1,
|
|
|
26
27
|
if (threshold < 0) {
|
|
27
28
|
throw new TypeError('Threshold is below 0');
|
|
28
29
|
}
|
|
30
|
+
const cacheKey = [
|
|
31
|
+
fps,
|
|
32
|
+
config.damping,
|
|
33
|
+
config.mass,
|
|
34
|
+
config.overshootClamping,
|
|
35
|
+
config.stiffness,
|
|
36
|
+
from,
|
|
37
|
+
to,
|
|
38
|
+
threshold,
|
|
39
|
+
].join('-');
|
|
40
|
+
if (cache.has(cacheKey)) {
|
|
41
|
+
return cache.get(cacheKey);
|
|
42
|
+
}
|
|
29
43
|
(0, validate_fps_js_1.validateFps)(fps, 'to the measureSpring() function', false);
|
|
30
44
|
const range = Math.abs(from - to);
|
|
31
45
|
let frame = 0;
|
|
@@ -63,6 +77,7 @@ function measureSpring({ fps, config = {}, threshold = 0.005, from = 0, to = 1,
|
|
|
63
77
|
finishedFrame = frame + 1;
|
|
64
78
|
}
|
|
65
79
|
}
|
|
80
|
+
cache.set(cacheKey, finishedFrame);
|
|
66
81
|
return finishedFrame;
|
|
67
82
|
}
|
|
68
83
|
exports.measureSpring = measureSpring;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.61";
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StaticFile } from './get-static-files';
|
|
2
|
+
type WatcherCallback = (newData: StaticFile | null) => void;
|
|
3
|
+
export declare const WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
|
|
4
|
+
export type WatchRemotionStaticFilesPayload = {
|
|
5
|
+
files: StaticFile[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @description Watch for changes in a specific static file.
|
|
9
|
+
* @param {string} fileName - The name of the static file to watch for changes.
|
|
10
|
+
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
11
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
12
|
+
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
13
|
+
*/
|
|
14
|
+
export declare const watchStaticFile: (fileName: string, callback: WatcherCallback) => {
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.watchStaticFile = exports.WATCH_REMOTION_STATIC_FILES = void 0;
|
|
4
|
+
const get_remotion_environment_1 = require("./get-remotion-environment");
|
|
5
|
+
exports.WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
6
|
+
/**
|
|
7
|
+
* @description Watch for changes in a specific static file.
|
|
8
|
+
* @param {string} fileName - The name of the static file to watch for changes.
|
|
9
|
+
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
10
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
11
|
+
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
12
|
+
*/
|
|
13
|
+
const watchStaticFile = (fileName, callback) => {
|
|
14
|
+
// Check if function is called in Remotion Studio
|
|
15
|
+
if (!(0, get_remotion_environment_1.getRemotionEnvironment)().isStudio) {
|
|
16
|
+
console.warn('The API is only available while using the Remotion Studio.');
|
|
17
|
+
return { cancel: () => undefined };
|
|
18
|
+
}
|
|
19
|
+
let prevFileData = window.remotion_staticFiles.find((file) => file.name === fileName);
|
|
20
|
+
// Check if the specified static file has updated or deleted
|
|
21
|
+
const checkFile = (event) => {
|
|
22
|
+
const staticFiles = event.detail.files;
|
|
23
|
+
// Check for user specified file
|
|
24
|
+
const newFileData = staticFiles.find((file) => file.name === fileName);
|
|
25
|
+
if (!newFileData) {
|
|
26
|
+
// File is deleted
|
|
27
|
+
if (prevFileData !== undefined) {
|
|
28
|
+
callback(null);
|
|
29
|
+
}
|
|
30
|
+
prevFileData = undefined;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (prevFileData === undefined ||
|
|
34
|
+
prevFileData.lastModified !== newFileData.lastModified) {
|
|
35
|
+
callback(newFileData); // File is added or modified
|
|
36
|
+
prevFileData = newFileData;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
window.addEventListener(exports.WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
40
|
+
const cancel = () => {
|
|
41
|
+
return window.removeEventListener(exports.WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
42
|
+
};
|
|
43
|
+
return { cancel };
|
|
44
|
+
};
|
|
45
|
+
exports.watchStaticFile = watchStaticFile;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function truthy(value) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Automatically generated on publish
|
|
62
|
-
const VERSION = '4.0.
|
|
62
|
+
const VERSION = '4.0.61';
|
|
63
63
|
|
|
64
64
|
const checkMultipleRemotionVersions = () => {
|
|
65
65
|
if (typeof globalThis === 'undefined') {
|
|
@@ -3916,6 +3916,47 @@ const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
|
|
|
3916
3916
|
}
|
|
3917
3917
|
};
|
|
3918
3918
|
|
|
3919
|
+
const WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
3920
|
+
/**
|
|
3921
|
+
* @description Watch for changes in a specific static file.
|
|
3922
|
+
* @param {string} fileName - The name of the static file to watch for changes.
|
|
3923
|
+
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
3924
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
3925
|
+
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
3926
|
+
*/
|
|
3927
|
+
const watchStaticFile = (fileName, callback) => {
|
|
3928
|
+
// Check if function is called in Remotion Studio
|
|
3929
|
+
if (!getRemotionEnvironment().isStudio) {
|
|
3930
|
+
console.warn('The API is only available while using the Remotion Studio.');
|
|
3931
|
+
return { cancel: () => undefined };
|
|
3932
|
+
}
|
|
3933
|
+
let prevFileData = window.remotion_staticFiles.find((file) => file.name === fileName);
|
|
3934
|
+
// Check if the specified static file has updated or deleted
|
|
3935
|
+
const checkFile = (event) => {
|
|
3936
|
+
const staticFiles = event.detail.files;
|
|
3937
|
+
// Check for user specified file
|
|
3938
|
+
const newFileData = staticFiles.find((file) => file.name === fileName);
|
|
3939
|
+
if (!newFileData) {
|
|
3940
|
+
// File is deleted
|
|
3941
|
+
if (prevFileData !== undefined) {
|
|
3942
|
+
callback(null);
|
|
3943
|
+
}
|
|
3944
|
+
prevFileData = undefined;
|
|
3945
|
+
return;
|
|
3946
|
+
}
|
|
3947
|
+
if (prevFileData === undefined ||
|
|
3948
|
+
prevFileData.lastModified !== newFileData.lastModified) {
|
|
3949
|
+
callback(newFileData); // File is added or modified
|
|
3950
|
+
prevFileData = newFileData;
|
|
3951
|
+
}
|
|
3952
|
+
};
|
|
3953
|
+
window.addEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3954
|
+
const cancel = () => {
|
|
3955
|
+
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3956
|
+
};
|
|
3957
|
+
return { cancel };
|
|
3958
|
+
};
|
|
3959
|
+
|
|
3919
3960
|
function useRemotionContexts() {
|
|
3920
3961
|
const compositionManagerCtx = React.useContext(CompositionManager);
|
|
3921
3962
|
const timelineContext = React.useContext(TimelineContext);
|
|
@@ -4023,6 +4064,7 @@ const Internals = {
|
|
|
4023
4064
|
NativeLayersProvider,
|
|
4024
4065
|
ClipComposition,
|
|
4025
4066
|
isIosSafari,
|
|
4067
|
+
WATCH_REMOTION_STATIC_FILES,
|
|
4026
4068
|
};
|
|
4027
4069
|
|
|
4028
4070
|
const flattenChildren = (children) => {
|
|
@@ -4215,6 +4257,7 @@ function springCalculation({ from = 0, to = 1, frame, fps, config = {}, }) {
|
|
|
4215
4257
|
return animation;
|
|
4216
4258
|
}
|
|
4217
4259
|
|
|
4260
|
+
const cache = new Map();
|
|
4218
4261
|
/**
|
|
4219
4262
|
* @description The function returns how long it takes for a spring animation to settle
|
|
4220
4263
|
* @see [Documentation](https://www.remotion.dev/docs/measure-spring)
|
|
@@ -4238,6 +4281,19 @@ function measureSpring({ fps, config = {}, threshold = 0.005, from = 0, to = 1,
|
|
|
4238
4281
|
if (threshold < 0) {
|
|
4239
4282
|
throw new TypeError('Threshold is below 0');
|
|
4240
4283
|
}
|
|
4284
|
+
const cacheKey = [
|
|
4285
|
+
fps,
|
|
4286
|
+
config.damping,
|
|
4287
|
+
config.mass,
|
|
4288
|
+
config.overshootClamping,
|
|
4289
|
+
config.stiffness,
|
|
4290
|
+
from,
|
|
4291
|
+
to,
|
|
4292
|
+
threshold,
|
|
4293
|
+
].join('-');
|
|
4294
|
+
if (cache.has(cacheKey)) {
|
|
4295
|
+
return cache.get(cacheKey);
|
|
4296
|
+
}
|
|
4241
4297
|
validateFps(fps, 'to the measureSpring() function', false);
|
|
4242
4298
|
const range = Math.abs(from - to);
|
|
4243
4299
|
let frame = 0;
|
|
@@ -4275,6 +4331,7 @@ function measureSpring({ fps, config = {}, threshold = 0.005, from = 0, to = 1,
|
|
|
4275
4331
|
finishedFrame = frame + 1;
|
|
4276
4332
|
}
|
|
4277
4333
|
}
|
|
4334
|
+
cache.set(cacheKey, finishedFrame);
|
|
4278
4335
|
return finishedFrame;
|
|
4279
4336
|
}
|
|
4280
4337
|
|
|
@@ -4322,14 +4379,19 @@ function spring({ frame: passedFrame, fps, config = {}, from = 0, to = 1, durati
|
|
|
4322
4379
|
throw new Error('did not calculate natural duration, this is an error with Remotion. Please report');
|
|
4323
4380
|
},
|
|
4324
4381
|
};
|
|
4325
|
-
const
|
|
4382
|
+
const reverseProcessed = reverse
|
|
4326
4383
|
? (passedDurationInFrames !== null && passedDurationInFrames !== void 0 ? passedDurationInFrames : naturalDurationGetter.get()) - passedFrame
|
|
4327
|
-
: passedFrame
|
|
4384
|
+
: passedFrame;
|
|
4385
|
+
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
4386
|
+
const durationProcessed = passedDurationInFrames === undefined
|
|
4387
|
+
? delayProcessed
|
|
4388
|
+
: delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
4389
|
+
if (passedDurationInFrames && durationProcessed > passedDurationInFrames) {
|
|
4390
|
+
return to;
|
|
4391
|
+
}
|
|
4328
4392
|
const spr = springCalculation({
|
|
4329
4393
|
fps,
|
|
4330
|
-
frame:
|
|
4331
|
-
? frame
|
|
4332
|
-
: frame / (passedDurationInFrames / naturalDurationGetter.get()),
|
|
4394
|
+
frame: durationProcessed,
|
|
4333
4395
|
config,
|
|
4334
4396
|
from,
|
|
4335
4397
|
to,
|
|
@@ -4861,4 +4923,4 @@ const Config = new Proxy(proxyObj, {
|
|
|
4861
4923
|
},
|
|
4862
4924
|
});
|
|
4863
4925
|
|
|
4864
|
-
export { AbsoluteFill, Audio, Composition, Config, Easing, Experimental, Folder, FolderContext, Freeze, IFrame, Img, Internals, Loop, OffthreadVideo, Sequence, Series, Still, VERSION, Video, cancelRender, continueRender, delayRender, getInputProps, getRemotionEnvironment, getStaticFiles, interpolate, interpolateColors, measureSpring, prefetch, random, registerRoot, spring, staticFile, useCurrentFrame, useVideoConfig };
|
|
4926
|
+
export { AbsoluteFill, Audio, Composition, Config, Easing, Experimental, Folder, FolderContext, Freeze, IFrame, Img, Internals, Loop, OffthreadVideo, Sequence, Series, Still, VERSION, Video, cancelRender, continueRender, delayRender, getInputProps, getRemotionEnvironment, getStaticFiles, interpolate, interpolateColors, measureSpring, prefetch, random, registerRoot, spring, staticFile, useCurrentFrame, useVideoConfig, watchStaticFile };
|
package/dist/esm/version.mjs
CHANGED