remotion 4.0.514 → 4.0.516
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/get-asset-file-name.js +8 -1
- package/dist/cjs/input-props-serialization.d.ts +1 -0
- package/dist/cjs/input-props-serialization.js +20 -2
- package/dist/cjs/internals.d.ts +9 -0
- package/dist/cjs/internals.js +5 -0
- package/dist/cjs/interpolate-translate.d.ts +8 -0
- package/dist/cjs/interpolate-translate.js +70 -0
- package/dist/cjs/media-resource-manager.d.ts +25 -0
- package/dist/cjs/media-resource-manager.js +112 -0
- package/dist/cjs/sequence-field-schema.d.ts +425 -0
- package/dist/cjs/sequence-field-schema.js +133 -0
- package/dist/cjs/use-schema.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-in-schema.d.ts +20 -0
- package/dist/cjs/wrap-in-schema.js +203 -0
- package/dist/esm/index.mjs +140 -5
- package/dist/esm/no-react.mjs +14 -2
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAssetDisplayName = void 0;
|
|
4
4
|
const getAssetDisplayName = (filename) => {
|
|
5
|
-
|
|
5
|
+
var _a;
|
|
6
|
+
if (filename.startsWith('data:')) {
|
|
6
7
|
return 'Data URL';
|
|
7
8
|
}
|
|
9
|
+
if (filename.startsWith('blob:')) {
|
|
10
|
+
const staticFile = typeof window === 'undefined'
|
|
11
|
+
? undefined
|
|
12
|
+
: (_a = window.remotion_staticFiles) === null || _a === void 0 ? void 0 : _a.find((file) => file.src === filename);
|
|
13
|
+
return staticFile ? (0, exports.getAssetDisplayName)(staticFile.name) : 'Blob URL';
|
|
14
|
+
}
|
|
8
15
|
const splitted = filename
|
|
9
16
|
.split('/')
|
|
10
17
|
.map((s) => s.split('\\'))
|
|
@@ -12,6 +12,7 @@ export declare const serializeJSONWithSpecialTypes: ({ data, indent, staticBase,
|
|
|
12
12
|
indent: number | undefined;
|
|
13
13
|
staticBase: string | null;
|
|
14
14
|
}) => SerializedJSONWithCustomFields;
|
|
15
|
+
export declare const resolveFileTokenToUrl: (value: string) => string;
|
|
15
16
|
export declare const deserializeJSONWithSpecialTypes: <T = Record<string, unknown>>(data: string) => T;
|
|
16
17
|
export declare const serializeThenDeserialize: (props: Record<string, unknown>) => Record<string, unknown>;
|
|
17
18
|
export declare const serializeThenDeserializeInStudio: (props: Record<string, unknown>) => Record<string, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Must keep this file in sync with the one in packages/lambda/src/shared/serialize-props.ts!
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.serializeThenDeserializeInStudio = exports.serializeThenDeserialize = exports.deserializeJSONWithSpecialTypes = exports.serializeJSONWithSpecialTypes = exports.FILE_TOKEN = exports.DATE_TOKEN = void 0;
|
|
4
|
+
exports.serializeThenDeserializeInStudio = exports.serializeThenDeserialize = exports.deserializeJSONWithSpecialTypes = exports.resolveFileTokenToUrl = exports.serializeJSONWithSpecialTypes = exports.FILE_TOKEN = exports.DATE_TOKEN = void 0;
|
|
5
5
|
const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
|
|
6
6
|
exports.DATE_TOKEN = 'remotion-date:';
|
|
7
7
|
exports.FILE_TOKEN = 'remotion-file:';
|
|
@@ -27,6 +27,7 @@ const serializeJSONWithSpecialTypes = ({ data, indent, staticBase, }) => {
|
|
|
27
27
|
}
|
|
28
28
|
if (typeof item === 'string' &&
|
|
29
29
|
staticBase !== null &&
|
|
30
|
+
staticBase !== '' &&
|
|
30
31
|
item.startsWith(staticBase)) {
|
|
31
32
|
customFileUsed = true;
|
|
32
33
|
return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
|
|
@@ -41,13 +42,30 @@ const serializeJSONWithSpecialTypes = ({ data, indent, staticBase, }) => {
|
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
exports.serializeJSONWithSpecialTypes = serializeJSONWithSpecialTypes;
|
|
45
|
+
const resolveFileTokenToUrl = (value) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const encodedName = value.replace(exports.FILE_TOKEN, '');
|
|
48
|
+
let name = encodedName;
|
|
49
|
+
try {
|
|
50
|
+
name = encodedName.split('/').map(decodeURIComponent).join('/');
|
|
51
|
+
}
|
|
52
|
+
catch (_b) {
|
|
53
|
+
// Keep the encoded name if it contains an invalid escape sequence.
|
|
54
|
+
}
|
|
55
|
+
const matchingStaticFile = (_a = window.remotion_staticFiles) === null || _a === void 0 ? void 0 : _a.find((file) => file.name === name);
|
|
56
|
+
if (matchingStaticFile) {
|
|
57
|
+
return matchingStaticFile.src;
|
|
58
|
+
}
|
|
59
|
+
return `${window.remotion_staticBase}/${encodedName}`;
|
|
60
|
+
};
|
|
61
|
+
exports.resolveFileTokenToUrl = resolveFileTokenToUrl;
|
|
44
62
|
const deserializeJSONWithSpecialTypes = (data) => {
|
|
45
63
|
return JSON.parse(data, (_, value) => {
|
|
46
64
|
if (typeof value === 'string' && value.startsWith(exports.DATE_TOKEN)) {
|
|
47
65
|
return new Date(value.replace(exports.DATE_TOKEN, ''));
|
|
48
66
|
}
|
|
49
67
|
if (typeof value === 'string' && value.startsWith(exports.FILE_TOKEN)) {
|
|
50
|
-
return
|
|
68
|
+
return (0, exports.resolveFileTokenToUrl)(value);
|
|
51
69
|
}
|
|
52
70
|
return value;
|
|
53
71
|
});
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -27,6 +27,15 @@ export type { EffectChainState } from './effects/run-effect-chain.js';
|
|
|
27
27
|
export declare const Internals: {
|
|
28
28
|
readonly AbsoluteFillElement: import("react").ForwardRefExoticComponent<Omit<import("./AbsoluteFillElement.js").AbsoluteFillElementProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
29
|
readonly MaxMediaCacheSizeContext: import("react").Context<number | null>;
|
|
30
|
+
readonly getMediabunnyInputResourceKey: ({ src, credentials, requestInitFingerprint, revision, }: {
|
|
31
|
+
src: string;
|
|
32
|
+
credentials: RequestCredentials | null;
|
|
33
|
+
requestInitFingerprint: unknown;
|
|
34
|
+
revision: string | null;
|
|
35
|
+
}) => string;
|
|
36
|
+
readonly globalMediaResourceManager: import("./media-resource-manager.js").MediaResourceManager;
|
|
37
|
+
readonly makeMediaResourceManager: () => import("./media-resource-manager.js").MediaResourceManager;
|
|
38
|
+
readonly MEDIABUNNY_DURATION_VALUE_KEY: "mediabunny-duration";
|
|
30
39
|
readonly makeRenderResourceManager: () => import("./render-resource-manager.js").RenderResourceManager;
|
|
31
40
|
readonly RenderResourceManagerContext: import("react").Context<import("./render-resource-manager.js").RenderResourceManager | null>;
|
|
32
41
|
readonly useUnsafeVideoConfig: () => import("./video-config.js").VideoConfig | null;
|
package/dist/cjs/internals.js
CHANGED
|
@@ -70,6 +70,7 @@ const is_player_js_1 = require("./is-player.js");
|
|
|
70
70
|
const log_level_context_js_1 = require("./log-level-context.js");
|
|
71
71
|
const log_js_1 = require("./log.js");
|
|
72
72
|
const max_video_cache_size_js_1 = require("./max-video-cache-size.js");
|
|
73
|
+
const media_resource_manager_js_1 = require("./media-resource-manager.js");
|
|
73
74
|
const nonce_js_1 = require("./nonce.js");
|
|
74
75
|
const playback_logging_js_1 = require("./playback-logging.js");
|
|
75
76
|
const portal_node_js_1 = require("./portal-node.js");
|
|
@@ -126,6 +127,10 @@ const compositionSelectorRef = (0, react_1.createRef)();
|
|
|
126
127
|
exports.Internals = {
|
|
127
128
|
AbsoluteFillElement: AbsoluteFillElement_js_1.AbsoluteFillElement,
|
|
128
129
|
MaxMediaCacheSizeContext: max_video_cache_size_js_1.MaxMediaCacheSizeContext,
|
|
130
|
+
getMediabunnyInputResourceKey: media_resource_manager_js_1.getMediabunnyInputResourceKey,
|
|
131
|
+
globalMediaResourceManager: media_resource_manager_js_1.globalMediaResourceManager,
|
|
132
|
+
makeMediaResourceManager: media_resource_manager_js_1.makeMediaResourceManager,
|
|
133
|
+
MEDIABUNNY_DURATION_VALUE_KEY: media_resource_manager_js_1.MEDIABUNNY_DURATION_VALUE_KEY,
|
|
129
134
|
makeRenderResourceManager: render_resource_manager_js_1.makeRenderResourceManager,
|
|
130
135
|
RenderResourceManagerContext: render_resource_manager_js_1.RenderResourceManagerContext,
|
|
131
136
|
useUnsafeVideoConfig: use_unsafe_video_config_js_1.useUnsafeVideoConfig,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type InterpolateOptions } from './interpolate.js';
|
|
2
|
+
export type InterpolateTranslateOptions = InterpolateOptions;
|
|
3
|
+
export declare const interpolateTranslate: (input: number, inputRange: readonly number[], outputRange: readonly string[], options?: Partial<{
|
|
4
|
+
easing: import("./interpolate.js").EasingFunction | readonly import("./interpolate.js").EasingFunction[];
|
|
5
|
+
extrapolateLeft: import("./interpolate.js").ExtrapolateType;
|
|
6
|
+
extrapolateRight: import("./interpolate.js").ExtrapolateType;
|
|
7
|
+
posterize: number;
|
|
8
|
+
}> | undefined) => string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interpolateTranslate = void 0;
|
|
4
|
+
const interpolate_js_1 = require("./interpolate.js");
|
|
5
|
+
const pixelValueRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))px$/;
|
|
6
|
+
const parseTranslate = (value) => {
|
|
7
|
+
if (typeof value !== 'string') {
|
|
8
|
+
throw new TypeError(`outputRange must contain only strings, but got ${typeof value}`);
|
|
9
|
+
}
|
|
10
|
+
const parts = value.trim().split(/\s+/);
|
|
11
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === '') {
|
|
12
|
+
throw new TypeError(`translate values must contain 1 to 3 pixel values, but got "${value}"`);
|
|
13
|
+
}
|
|
14
|
+
return parts.map((part) => {
|
|
15
|
+
const match = pixelValueRegex.exec(part);
|
|
16
|
+
if (match === null) {
|
|
17
|
+
throw new TypeError(`interpolateTranslate() only supports px values, but got "${part}" in "${value}"`);
|
|
18
|
+
}
|
|
19
|
+
return Number(match[1]);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/*
|
|
23
|
+
* @description Allows you to map a range of values to CSS translate values using pixel units.
|
|
24
|
+
* @see [Documentation](https://remotion.dev/docs/interpolate-translate)
|
|
25
|
+
*/
|
|
26
|
+
const interpolateTranslate = (input, inputRange, outputRange, options) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (typeof input === 'undefined') {
|
|
29
|
+
throw new TypeError('input can not be undefined');
|
|
30
|
+
}
|
|
31
|
+
if (typeof inputRange === 'undefined') {
|
|
32
|
+
throw new TypeError('inputRange can not be undefined');
|
|
33
|
+
}
|
|
34
|
+
if (typeof outputRange === 'undefined') {
|
|
35
|
+
throw new TypeError('outputRange can not be undefined');
|
|
36
|
+
}
|
|
37
|
+
if (inputRange.length !== outputRange.length) {
|
|
38
|
+
throw new TypeError('inputRange (' +
|
|
39
|
+
inputRange.length +
|
|
40
|
+
' values provided) and outputRange (' +
|
|
41
|
+
outputRange.length +
|
|
42
|
+
' values provided) must have the same length');
|
|
43
|
+
}
|
|
44
|
+
const parsedOutputRange = outputRange.map((translateValue) => parseTranslate(translateValue));
|
|
45
|
+
const firstValueLength = (_a = parsedOutputRange[0]) === null || _a === void 0 ? void 0 : _a.length;
|
|
46
|
+
if (firstValueLength === undefined) {
|
|
47
|
+
throw new TypeError('outputRange must have at least 1 element');
|
|
48
|
+
}
|
|
49
|
+
for (const parsedTranslate of parsedOutputRange) {
|
|
50
|
+
if (parsedTranslate.length !== firstValueLength) {
|
|
51
|
+
throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${parsedTranslate.length}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return new Array(firstValueLength)
|
|
55
|
+
.fill(true)
|
|
56
|
+
.map((_, index) => {
|
|
57
|
+
const outputValues = [];
|
|
58
|
+
for (const translateValue of parsedOutputRange) {
|
|
59
|
+
const value = translateValue[index];
|
|
60
|
+
if (value === undefined) {
|
|
61
|
+
throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${translateValue.length}`);
|
|
62
|
+
}
|
|
63
|
+
outputValues.push(value);
|
|
64
|
+
}
|
|
65
|
+
const interpolatedValue = (0, interpolate_js_1.interpolate)(input, inputRange, outputValues, options);
|
|
66
|
+
return `${interpolatedValue}px`;
|
|
67
|
+
})
|
|
68
|
+
.join(' ');
|
|
69
|
+
};
|
|
70
|
+
exports.interpolateTranslate = interpolateTranslate;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type MediaResourceLease<T> = {
|
|
2
|
+
resource: T;
|
|
3
|
+
getOrCreateValue: <Value>(key: string, create: () => Value) => Value;
|
|
4
|
+
release: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type MediaResourceManager = {
|
|
7
|
+
acquire: <T>({ key, create }: {
|
|
8
|
+
key: string;
|
|
9
|
+
create: () => {
|
|
10
|
+
resource: T;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
};
|
|
13
|
+
}) => MediaResourceLease<T>;
|
|
14
|
+
invalidate: (key: string) => void;
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const makeMediaResourceManager: () => MediaResourceManager;
|
|
18
|
+
export declare const getMediabunnyInputResourceKey: ({ src, credentials, requestInitFingerprint, revision, }: {
|
|
19
|
+
src: string;
|
|
20
|
+
credentials: RequestCredentials | null;
|
|
21
|
+
requestInitFingerprint: unknown;
|
|
22
|
+
revision: string | null;
|
|
23
|
+
}) => string;
|
|
24
|
+
export declare const MEDIABUNNY_DURATION_VALUE_KEY = "mediabunny-duration";
|
|
25
|
+
export declare const globalMediaResourceManager: MediaResourceManager;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.globalMediaResourceManager = exports.MEDIABUNNY_DURATION_VALUE_KEY = exports.getMediabunnyInputResourceKey = exports.makeMediaResourceManager = void 0;
|
|
4
|
+
const disposeResource = (resource) => {
|
|
5
|
+
if (resource.disposed) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
resource.disposed = true;
|
|
9
|
+
resource.values.clear();
|
|
10
|
+
resource.dispose();
|
|
11
|
+
};
|
|
12
|
+
const makeMediaResourceManager = () => {
|
|
13
|
+
const resources = new Map();
|
|
14
|
+
let disposed = false;
|
|
15
|
+
return {
|
|
16
|
+
acquire: ({ key, create, }) => {
|
|
17
|
+
if (disposed) {
|
|
18
|
+
throw new Error('Media resource manager has already been disposed');
|
|
19
|
+
}
|
|
20
|
+
let entry = resources.get(key);
|
|
21
|
+
if (!entry) {
|
|
22
|
+
const created = create();
|
|
23
|
+
entry = {
|
|
24
|
+
resource: created.resource,
|
|
25
|
+
dispose: created.dispose,
|
|
26
|
+
refCount: 0,
|
|
27
|
+
disposeGeneration: 0,
|
|
28
|
+
disposed: false,
|
|
29
|
+
values: new Map(),
|
|
30
|
+
};
|
|
31
|
+
resources.set(key, entry);
|
|
32
|
+
}
|
|
33
|
+
entry.refCount++;
|
|
34
|
+
entry.disposeGeneration++;
|
|
35
|
+
let released = false;
|
|
36
|
+
return {
|
|
37
|
+
resource: entry.resource,
|
|
38
|
+
getOrCreateValue: (valueKey, createValue) => {
|
|
39
|
+
if (entry.values.has(valueKey)) {
|
|
40
|
+
return entry.values.get(valueKey);
|
|
41
|
+
}
|
|
42
|
+
const value = createValue();
|
|
43
|
+
entry.values.set(valueKey, value);
|
|
44
|
+
return value;
|
|
45
|
+
},
|
|
46
|
+
release: () => {
|
|
47
|
+
if (released) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
released = true;
|
|
51
|
+
entry.refCount--;
|
|
52
|
+
if (entry.refCount !== 0) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const disposeGeneration = ++entry.disposeGeneration;
|
|
56
|
+
queueMicrotask(() => {
|
|
57
|
+
if (entry.refCount !== 0 ||
|
|
58
|
+
entry.disposeGeneration !== disposeGeneration) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (resources.get(key) === entry) {
|
|
62
|
+
resources.delete(key);
|
|
63
|
+
}
|
|
64
|
+
disposeResource(entry);
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
invalidate: (key) => {
|
|
70
|
+
const entry = resources.get(key);
|
|
71
|
+
if (!entry) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
resources.delete(key);
|
|
75
|
+
entry.disposeGeneration++;
|
|
76
|
+
if (entry.refCount === 0) {
|
|
77
|
+
disposeResource(entry);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
dispose: () => {
|
|
81
|
+
if (disposed) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
disposed = true;
|
|
85
|
+
const entries = Array.from(resources.values());
|
|
86
|
+
resources.clear();
|
|
87
|
+
let firstError = null;
|
|
88
|
+
for (const entry of entries) {
|
|
89
|
+
try {
|
|
90
|
+
disposeResource(entry);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
firstError !== null && firstError !== void 0 ? firstError : (firstError = error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (firstError !== null) {
|
|
97
|
+
throw firstError;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
exports.makeMediaResourceManager = makeMediaResourceManager;
|
|
103
|
+
const getMediabunnyInputResourceKey = ({ src, credentials, requestInitFingerprint, revision, }) => JSON.stringify([
|
|
104
|
+
'mediabunny-input',
|
|
105
|
+
src,
|
|
106
|
+
credentials,
|
|
107
|
+
requestInitFingerprint,
|
|
108
|
+
revision,
|
|
109
|
+
]);
|
|
110
|
+
exports.getMediabunnyInputResourceKey = getMediabunnyInputResourceKey;
|
|
111
|
+
exports.MEDIABUNNY_DURATION_VALUE_KEY = 'mediabunny-duration';
|
|
112
|
+
exports.globalMediaResourceManager = (0, exports.makeMediaResourceManager)();
|