remotion 4.0.496 → 4.0.497
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/HtmlInCanvas.d.ts +35 -0
- package/dist/cjs/HtmlInCanvas.js +2 -0
- package/dist/cjs/Img.d.ts +55 -3
- package/dist/cjs/Img.js +20 -5
- package/dist/cjs/Interactive.d.ts +74 -6
- package/dist/cjs/Interactive.js +17 -2
- package/dist/cjs/animated-image/AnimatedImage.d.ts +135 -1
- package/dist/cjs/animated-image/AnimatedImage.js +47 -9
- package/dist/cjs/animated-image/create-image-decoder.d.ts +9 -0
- package/dist/cjs/animated-image/create-image-decoder.js +26 -0
- package/dist/cjs/animated-image/decode-image.d.ts +1 -0
- package/dist/cjs/animated-image/decode-image.js +14 -16
- package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +6 -0
- package/dist/cjs/animated-image/get-duration-in-seconds.js +31 -0
- package/dist/cjs/animated-image/props.d.ts +2 -2
- package/dist/cjs/audio/shared-audio-tags.js +18 -16
- package/dist/cjs/audio/shared-element-source-node.d.ts +2 -1
- package/dist/cjs/audio/shared-element-source-node.js +6 -2
- package/dist/cjs/canvas-image/CanvasImage.d.ts +53 -1
- package/dist/cjs/canvas-image/CanvasImage.js +17 -2
- package/dist/cjs/canvas-image/props.d.ts +2 -2
- package/dist/cjs/effects/Solid.d.ts +35 -0
- package/dist/cjs/effects/Solid.js +2 -0
- package/dist/cjs/interactivity-schema.d.ts +144 -32
- package/dist/cjs/interactivity-schema.js +44 -10
- package/dist/cjs/internals.d.ts +77 -26
- package/dist/cjs/internals.js +2 -1
- package/dist/cjs/no-react.d.ts +35 -6
- package/dist/cjs/series/index.d.ts +1 -1
- package/dist/cjs/series/index.js +1 -0
- package/dist/cjs/use-amplification.d.ts +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +362 -109
- package/dist/esm/no-react.mjs +42 -10
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/dist/cjs/interpolate-translate.d.ts +0 -8
- package/dist/cjs/interpolate-translate.js +0 -70
- package/dist/cjs/sequence-field-schema.d.ts +0 -425
- package/dist/cjs/sequence-field-schema.js +0 -133
- package/dist/cjs/wrap-in-schema.d.ts +0 -20
- package/dist/cjs/wrap-in-schema.js +0 -203
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createImageDecoder = void 0;
|
|
4
|
+
const createImageDecoder = async ({ resolvedSrc, signal, requestInit, contentType, }) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if (typeof ImageDecoder === 'undefined') {
|
|
7
|
+
throw new Error('Your browser does not support the WebCodecs ImageDecoder API.');
|
|
8
|
+
}
|
|
9
|
+
const response = await fetch(resolvedSrc, { ...requestInit, signal });
|
|
10
|
+
const { body } = response;
|
|
11
|
+
if (!body) {
|
|
12
|
+
throw new Error('Got no body');
|
|
13
|
+
}
|
|
14
|
+
const decoder = new ImageDecoder({
|
|
15
|
+
data: body,
|
|
16
|
+
type: (_a = contentType !== null && contentType !== void 0 ? contentType : response.headers.get('Content-Type')) !== null && _a !== void 0 ? _a : 'image/gif',
|
|
17
|
+
});
|
|
18
|
+
await Promise.all([decoder.completed, decoder.tracks.ready]);
|
|
19
|
+
const { selectedTrack } = decoder.tracks;
|
|
20
|
+
if (!selectedTrack) {
|
|
21
|
+
decoder.close();
|
|
22
|
+
throw new Error('No selected track');
|
|
23
|
+
}
|
|
24
|
+
return { decoder, selectedTrack };
|
|
25
|
+
};
|
|
26
|
+
exports.createImageDecoder = createImageDecoder;
|
|
@@ -5,6 +5,7 @@ export type AnimatedImageCacheItem = {
|
|
|
5
5
|
frame: VideoFrame | null;
|
|
6
6
|
};
|
|
7
7
|
export type RemotionImageDecoder = {
|
|
8
|
+
close: () => void;
|
|
8
9
|
getFrame: (i: number, loopBehavior: RemotionAnimatedImageLoopBehavior) => Promise<AnimatedImageCacheItem | null>;
|
|
9
10
|
frameCount: number;
|
|
10
11
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decodeImage = void 0;
|
|
4
|
+
const create_image_decoder_1 = require("./create-image-decoder");
|
|
4
5
|
const CACHE_SIZE = 5;
|
|
5
6
|
const getActualTime = ({ loopBehavior, durationFound, timeInSec, }) => {
|
|
6
7
|
return loopBehavior === 'loop'
|
|
@@ -10,23 +11,12 @@ const getActualTime = ({ loopBehavior, durationFound, timeInSec, }) => {
|
|
|
10
11
|
: Math.min(timeInSec, durationFound || Infinity);
|
|
11
12
|
};
|
|
12
13
|
const decodeImage = async ({ resolvedSrc, signal, requestInit, currentTime, initialLoopBehavior, }) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!body) {
|
|
19
|
-
throw new Error('Got no body');
|
|
20
|
-
}
|
|
21
|
-
const decoder = new ImageDecoder({
|
|
22
|
-
data: body,
|
|
23
|
-
type: res.headers.get('Content-Type') || 'image/gif',
|
|
14
|
+
const { decoder, selectedTrack } = await (0, create_image_decoder_1.createImageDecoder)({
|
|
15
|
+
resolvedSrc,
|
|
16
|
+
signal,
|
|
17
|
+
requestInit,
|
|
18
|
+
contentType: null,
|
|
24
19
|
});
|
|
25
|
-
await decoder.completed;
|
|
26
|
-
const { selectedTrack } = decoder.tracks;
|
|
27
|
-
if (!selectedTrack) {
|
|
28
|
-
throw new Error('No selected track');
|
|
29
|
-
}
|
|
30
20
|
const cache = [];
|
|
31
21
|
let durationFound = null;
|
|
32
22
|
const getFrameByIndex = async (frameIndex) => {
|
|
@@ -138,6 +128,14 @@ const decodeImage = async ({ resolvedSrc, signal, requestInit, currentTime, init
|
|
|
138
128
|
return closest;
|
|
139
129
|
};
|
|
140
130
|
return {
|
|
131
|
+
close: () => {
|
|
132
|
+
var _a;
|
|
133
|
+
for (const item of cache) {
|
|
134
|
+
(_a = item.frame) === null || _a === void 0 ? void 0 : _a.close();
|
|
135
|
+
item.frame = null;
|
|
136
|
+
}
|
|
137
|
+
decoder.close();
|
|
138
|
+
},
|
|
141
139
|
getFrame,
|
|
142
140
|
frameCount: selectedTrack.frameCount,
|
|
143
141
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAnimatedImageDurationInSeconds = void 0;
|
|
4
|
+
const create_image_decoder_1 = require("./create-image-decoder");
|
|
5
|
+
const getAnimatedImageDurationInSeconds = async ({ resolvedSrc, signal, requestInit, contentType, }) => {
|
|
6
|
+
const { decoder, selectedTrack } = await (0, create_image_decoder_1.createImageDecoder)({
|
|
7
|
+
resolvedSrc,
|
|
8
|
+
signal,
|
|
9
|
+
requestInit,
|
|
10
|
+
contentType,
|
|
11
|
+
});
|
|
12
|
+
try {
|
|
13
|
+
const { image } = await decoder.decode({
|
|
14
|
+
frameIndex: selectedTrack.frameCount - 1,
|
|
15
|
+
completeFramesOnly: true,
|
|
16
|
+
});
|
|
17
|
+
try {
|
|
18
|
+
if (image.duration === null) {
|
|
19
|
+
throw new Error('Could not determine animated image duration');
|
|
20
|
+
}
|
|
21
|
+
return (image.timestamp + image.duration) / 1000000;
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
image.close();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
decoder.close();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.getAnimatedImageDurationInSeconds = getAnimatedImageDurationInSeconds;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageFit } from '../calculate-image-fit.js';
|
|
2
2
|
import type { EffectsProp } from '../effects/effect-types.js';
|
|
3
|
-
import type { InteractiveBaseProps } from '../Interactive.js';
|
|
3
|
+
import type { InteractiveBaseProps, InteractivePremountProps } from '../Interactive.js';
|
|
4
4
|
export type RemotionAnimatedImageLoopBehavior = 'loop' | 'pause-after-finish' | 'clear-after-finish';
|
|
5
5
|
export type AnimatedImageCanvasProps = React.AriaAttributes & Record<`data-${string}`, string | undefined>;
|
|
6
6
|
export type RemotionAnimatedImageProps = {
|
|
@@ -16,7 +16,7 @@ export type RemotionAnimatedImageProps = {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
requestInit?: RequestInit;
|
|
18
18
|
} & AnimatedImageCanvasProps;
|
|
19
|
-
export type AnimatedImageProps = InteractiveBaseProps & RemotionAnimatedImageProps & {
|
|
19
|
+
export type AnimatedImageProps = InteractiveBaseProps & InteractivePremountProps & RemotionAnimatedImageProps & {
|
|
20
20
|
readonly effects?: EffectsProp;
|
|
21
21
|
};
|
|
22
22
|
export type AnimatedImageFillMode = ImageFit;
|
|
@@ -273,21 +273,22 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
273
273
|
const audioCtx = (0, react_1.useContext)(exports.SharedAudioContext);
|
|
274
274
|
const audioContext = (_a = audioCtx === null || audioCtx === void 0 ? void 0 : audioCtx.audioContext) !== null && _a !== void 0 ? _a : null;
|
|
275
275
|
const resume = audioCtx === null || audioCtx === void 0 ? void 0 : audioCtx.resume;
|
|
276
|
-
const refs = (0, react_1.
|
|
276
|
+
const [refs] = (0, react_1.useState)(() => {
|
|
277
277
|
return new Array(numberOfAudioTags).fill(true).map(() => {
|
|
278
278
|
const ref = (0, react_1.createRef)();
|
|
279
279
|
return {
|
|
280
280
|
id: Math.random(),
|
|
281
281
|
ref,
|
|
282
|
-
mediaElementSourceNode:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
})
|
|
287
|
-
: null,
|
|
282
|
+
mediaElementSourceNode: (0, shared_element_source_node_js_1.makeSharedElementSourceNode)({
|
|
283
|
+
audioContext,
|
|
284
|
+
ref,
|
|
285
|
+
}),
|
|
288
286
|
};
|
|
289
287
|
});
|
|
290
|
-
}
|
|
288
|
+
});
|
|
289
|
+
for (const { mediaElementSourceNode } of refs) {
|
|
290
|
+
mediaElementSourceNode === null || mediaElementSourceNode === void 0 ? void 0 : mediaElementSourceNode.setAudioContext(audioContext);
|
|
291
|
+
}
|
|
291
292
|
/**
|
|
292
293
|
* Effects in React 18 fire twice, and we are looking for a way to only fire it once.
|
|
293
294
|
* - useInsertionEffect only fires once. If it's available we are in React 18.
|
|
@@ -375,7 +376,7 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
375
376
|
const cloned = [...takenAudios.current];
|
|
376
377
|
const index = refs.findIndex((r) => r.id === id);
|
|
377
378
|
if (index === -1) {
|
|
378
|
-
throw new TypeError(
|
|
379
|
+
throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r) => r.id).join(', ')}`);
|
|
379
380
|
}
|
|
380
381
|
cloned[index] = false;
|
|
381
382
|
takenAudios.current = cloned;
|
|
@@ -464,23 +465,23 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
464
465
|
exports.SharedAudioTagsContextProvider = SharedAudioTagsContextProvider;
|
|
465
466
|
const useSharedAudio = ({ aud, audioId, premounting, postmounting, }) => {
|
|
466
467
|
var _a;
|
|
468
|
+
var _b, _c;
|
|
467
469
|
const audioCtx = (0, react_1.useContext)(exports.SharedAudioContext);
|
|
468
470
|
const tagsCtx = (0, react_1.useContext)(exports.SharedAudioTagsContext);
|
|
469
471
|
/**
|
|
470
472
|
* We work around this in React 18 so an audio tag will only register itself once
|
|
471
473
|
*/
|
|
472
474
|
const [elem] = (0, react_1.useState)(() => {
|
|
475
|
+
var _a;
|
|
473
476
|
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
474
477
|
return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
|
|
475
478
|
}
|
|
476
479
|
// numberOfSharedAudioTags is 0
|
|
477
480
|
const el = react_1.default.createRef();
|
|
478
|
-
const mediaElementSourceNode = (
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
})
|
|
483
|
-
: null;
|
|
481
|
+
const mediaElementSourceNode = (0, shared_element_source_node_js_1.makeSharedElementSourceNode)({
|
|
482
|
+
audioContext: (_a = audioCtx === null || audioCtx === void 0 ? void 0 : audioCtx.audioContext) !== null && _a !== void 0 ? _a : null,
|
|
483
|
+
ref: el,
|
|
484
|
+
});
|
|
484
485
|
return {
|
|
485
486
|
el,
|
|
486
487
|
id: Math.random(),
|
|
@@ -495,6 +496,7 @@ const useSharedAudio = ({ aud, audioId, premounting, postmounting, }) => {
|
|
|
495
496
|
},
|
|
496
497
|
};
|
|
497
498
|
});
|
|
499
|
+
(_a = elem.mediaElementSourceNode) === null || _a === void 0 ? void 0 : _a.setAudioContext((_b = audioCtx === null || audioCtx === void 0 ? void 0 : audioCtx.audioContext) !== null && _b !== void 0 ? _b : null);
|
|
498
500
|
/**
|
|
499
501
|
* Effects in React 18 fire twice, and we are looking for a way to only fire it once.
|
|
500
502
|
* - useInsertionEffect only fires once. If it's available we are in React 18.
|
|
@@ -502,7 +504,7 @@ const useSharedAudio = ({ aud, audioId, premounting, postmounting, }) => {
|
|
|
502
504
|
*
|
|
503
505
|
* Need to import it from React to fix React 17 ESM support.
|
|
504
506
|
*/
|
|
505
|
-
const effectToUse = (
|
|
507
|
+
const effectToUse = (_c = react_1.default.useInsertionEffect) !== null && _c !== void 0 ? _c : react_1.default.useLayoutEffect;
|
|
506
508
|
if (typeof document !== 'undefined') {
|
|
507
509
|
effectToUse(() => {
|
|
508
510
|
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const makeSharedElementSourceNode: ({ audioContext, ref, }: {
|
|
2
|
-
audioContext: AudioContext;
|
|
2
|
+
audioContext: AudioContext | null;
|
|
3
3
|
ref: import("react").RefObject<HTMLAudioElement | null>;
|
|
4
4
|
}) => {
|
|
5
|
+
setAudioContext: (newAudioContext: AudioContext | null) => void;
|
|
5
6
|
attemptToConnect: () => void;
|
|
6
7
|
get: () => MediaElementAudioSourceNode;
|
|
7
8
|
cleanup: () => void;
|
|
@@ -4,14 +4,18 @@ exports.makeSharedElementSourceNode = void 0;
|
|
|
4
4
|
const makeSharedElementSourceNode = ({ audioContext, ref, }) => {
|
|
5
5
|
let connected = null;
|
|
6
6
|
let disposed = false;
|
|
7
|
+
let currentAudioContext = audioContext;
|
|
7
8
|
// We must allow this to cleanup and create a new one due to strict mode.
|
|
8
9
|
return {
|
|
10
|
+
setAudioContext: (newAudioContext) => {
|
|
11
|
+
currentAudioContext = newAudioContext;
|
|
12
|
+
},
|
|
9
13
|
attemptToConnect: () => {
|
|
10
14
|
if (disposed) {
|
|
11
15
|
throw new Error('SharedElementSourceNode has been disposed');
|
|
12
16
|
}
|
|
13
|
-
if (!connected && ref.current) {
|
|
14
|
-
const mediaElementSourceNode =
|
|
17
|
+
if (!connected && ref.current && currentAudioContext) {
|
|
18
|
+
const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
|
|
15
19
|
connected = mediaElementSourceNode;
|
|
16
20
|
}
|
|
17
21
|
},
|
|
@@ -37,6 +37,58 @@ export declare const canvasImageSchema: {
|
|
|
37
37
|
readonly description: "Opacity";
|
|
38
38
|
readonly hiddenFromList: false;
|
|
39
39
|
};
|
|
40
|
+
readonly 'style.borderWidth': {
|
|
41
|
+
readonly type: "number";
|
|
42
|
+
readonly default: undefined;
|
|
43
|
+
readonly min: 0;
|
|
44
|
+
readonly step: 1;
|
|
45
|
+
readonly description: "Border width";
|
|
46
|
+
readonly hiddenFromList: false;
|
|
47
|
+
};
|
|
48
|
+
readonly 'style.borderStyle': {
|
|
49
|
+
readonly type: "enum";
|
|
50
|
+
readonly default: "none";
|
|
51
|
+
readonly description: "Border style";
|
|
52
|
+
readonly variants: {
|
|
53
|
+
readonly none: {};
|
|
54
|
+
readonly hidden: {};
|
|
55
|
+
readonly solid: {};
|
|
56
|
+
readonly dashed: {};
|
|
57
|
+
readonly dotted: {};
|
|
58
|
+
readonly double: {};
|
|
59
|
+
readonly groove: {};
|
|
60
|
+
readonly ridge: {};
|
|
61
|
+
readonly inset: {};
|
|
62
|
+
readonly outset: {};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly 'style.borderColor': {
|
|
66
|
+
readonly type: "color";
|
|
67
|
+
readonly default: undefined;
|
|
68
|
+
readonly description: "Border color";
|
|
69
|
+
};
|
|
70
|
+
readonly 'style.backgroundColor': {
|
|
71
|
+
readonly type: "color";
|
|
72
|
+
readonly default: "transparent";
|
|
73
|
+
readonly description: "Color";
|
|
74
|
+
};
|
|
75
|
+
readonly premountFor: {
|
|
76
|
+
readonly type: "number";
|
|
77
|
+
readonly default: 0;
|
|
78
|
+
readonly description: "Premount For";
|
|
79
|
+
readonly min: 0;
|
|
80
|
+
readonly step: 1;
|
|
81
|
+
readonly hiddenFromList: false;
|
|
82
|
+
readonly keyframable: false;
|
|
83
|
+
};
|
|
84
|
+
readonly postmountFor: {
|
|
85
|
+
readonly type: "number";
|
|
86
|
+
readonly default: 0;
|
|
87
|
+
readonly min: 0;
|
|
88
|
+
readonly step: 1;
|
|
89
|
+
readonly hiddenFromList: true;
|
|
90
|
+
readonly keyframable: false;
|
|
91
|
+
};
|
|
40
92
|
readonly durationInFrames: {
|
|
41
93
|
readonly type: "number";
|
|
42
94
|
readonly default: undefined;
|
|
@@ -77,7 +129,7 @@ export declare const canvasImageSchema: {
|
|
|
77
129
|
};
|
|
78
130
|
};
|
|
79
131
|
};
|
|
80
|
-
export declare const CanvasImage: import("react").ComponentType<import("../Interactive.js").InteractiveBaseProps & {
|
|
132
|
+
export declare const CanvasImage: import("react").ComponentType<import("../Interactive.js").InteractiveBaseProps & import("../Interactive.js").InteractivePremountProps & {
|
|
81
133
|
readonly stack?: string | undefined;
|
|
82
134
|
} & CanvasImageCanvasProps & {
|
|
83
135
|
readonly src: string;
|
|
@@ -8,6 +8,7 @@ const run_effect_chain_js_1 = require("../effects/run-effect-chain.js");
|
|
|
8
8
|
const use_effect_chain_state_js_1 = require("../effects/use-effect-chain-state.js");
|
|
9
9
|
const use_memoized_effects_js_1 = require("../effects/use-memoized-effects.js");
|
|
10
10
|
const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
|
|
11
|
+
const freeze_js_1 = require("../freeze.js");
|
|
11
12
|
const interactivity_schema_js_1 = require("../interactivity-schema.js");
|
|
12
13
|
const prefetch_js_1 = require("../prefetch.js");
|
|
13
14
|
const Sequence_js_1 = require("../Sequence.js");
|
|
@@ -15,9 +16,11 @@ const SequenceContext_js_1 = require("../SequenceContext.js");
|
|
|
15
16
|
const truncate_src_for_label_js_1 = require("../truncate-src-for-label.js");
|
|
16
17
|
const use_buffer_state_js_1 = require("../use-buffer-state.js");
|
|
17
18
|
const use_delay_render_js_1 = require("../use-delay-render.js");
|
|
19
|
+
const use_premounting_js_1 = require("../use-premounting.js");
|
|
18
20
|
const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js");
|
|
19
21
|
exports.canvasImageSchema = {
|
|
20
22
|
...interactivity_schema_js_1.baseSchema,
|
|
23
|
+
...interactivity_schema_js_1.premountSchema,
|
|
21
24
|
fit: {
|
|
22
25
|
type: 'enum',
|
|
23
26
|
default: 'fill',
|
|
@@ -29,6 +32,8 @@ exports.canvasImageSchema = {
|
|
|
29
32
|
},
|
|
30
33
|
},
|
|
31
34
|
...interactivity_schema_js_1.transformSchema,
|
|
35
|
+
...interactivity_schema_js_1.backgroundSchema,
|
|
36
|
+
...interactivity_schema_js_1.borderSchema,
|
|
32
37
|
};
|
|
33
38
|
const makeAbortError = () => {
|
|
34
39
|
if (typeof DOMException !== 'undefined') {
|
|
@@ -314,7 +319,7 @@ const CanvasImageContent = (0, react_1.forwardRef)(({ src, width, height, fit =
|
|
|
314
319
|
return (jsx_runtime_1.jsx("canvas", { ...canvasProps, ref: canvasRef, width: width, height: height, className: className, style: style, id: id }));
|
|
315
320
|
});
|
|
316
321
|
CanvasImageContent.displayName = 'CanvasImageContent';
|
|
317
|
-
const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, effects = [], className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, stack, controls, _remotionInternalDocumentationLink, outlineRef, ...canvasProps }, ref) => {
|
|
322
|
+
const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, effects = [], className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, hidden, name, showInTimeline, stack, controls, _remotionInternalDocumentationLink, outlineRef, ...canvasProps }, ref) => {
|
|
318
323
|
if (!src) {
|
|
319
324
|
throw new Error('No "src" prop was passed to <CanvasImage>.');
|
|
320
325
|
}
|
|
@@ -323,7 +328,17 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, eff
|
|
|
323
328
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
324
329
|
return actualRef.current;
|
|
325
330
|
}, []);
|
|
326
|
-
|
|
331
|
+
const { effectivePostmountFor, effectivePremountFor, freezeFrame, isPremountingOrPostmounting, postmountingActive, premountingActive, premountingStyle, } = (0, use_premounting_js_1.usePremounting)({
|
|
332
|
+
from: from !== null && from !== void 0 ? from : 0,
|
|
333
|
+
durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity,
|
|
334
|
+
premountFor: premountFor !== null && premountFor !== void 0 ? premountFor : null,
|
|
335
|
+
postmountFor: postmountFor !== null && postmountFor !== void 0 ? postmountFor : null,
|
|
336
|
+
style: style !== null && style !== void 0 ? style : null,
|
|
337
|
+
styleWhilePremounted: styleWhilePremounted !== null && styleWhilePremounted !== void 0 ? styleWhilePremounted : null,
|
|
338
|
+
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
339
|
+
hideWhilePremounted: 'display-none',
|
|
340
|
+
});
|
|
341
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: { type: 'image', src }, _remotionInternalStack: stack, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, outlineRef: outlineRef !== null && outlineRef !== void 0 ? outlineRef : actualRef, children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, width: width, height: height, fit: fit, effects: effects, controls: controls, className: className, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, refForOutline: outlineRef !== null && outlineRef !== void 0 ? outlineRef : null, ...canvasProps }) }) }));
|
|
327
342
|
});
|
|
328
343
|
/*
|
|
329
344
|
* @description Renders a static image to a `<canvas>` and applies Remotion effects.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ImageFit } from '../calculate-image-fit.js';
|
|
3
3
|
import type { EffectsProp } from '../effects/effect-types.js';
|
|
4
|
-
import type { InteractiveBaseProps } from '../Interactive.js';
|
|
5
|
-
type CanvasImageSequenceProps = InteractiveBaseProps & {
|
|
4
|
+
import type { InteractiveBaseProps, InteractivePremountProps } from '../Interactive.js';
|
|
5
|
+
type CanvasImageSequenceProps = InteractiveBaseProps & InteractivePremountProps & {
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated For internal use only.
|
|
8
8
|
*/
|
|
@@ -49,6 +49,41 @@ export declare const solidSchema: {
|
|
|
49
49
|
readonly description: "Opacity";
|
|
50
50
|
readonly hiddenFromList: false;
|
|
51
51
|
};
|
|
52
|
+
readonly 'style.borderWidth': {
|
|
53
|
+
readonly type: "number";
|
|
54
|
+
readonly default: undefined;
|
|
55
|
+
readonly min: 0;
|
|
56
|
+
readonly step: 1;
|
|
57
|
+
readonly description: "Border width";
|
|
58
|
+
readonly hiddenFromList: false;
|
|
59
|
+
};
|
|
60
|
+
readonly 'style.borderStyle': {
|
|
61
|
+
readonly type: "enum";
|
|
62
|
+
readonly default: "none";
|
|
63
|
+
readonly description: "Border style";
|
|
64
|
+
readonly variants: {
|
|
65
|
+
readonly none: {};
|
|
66
|
+
readonly hidden: {};
|
|
67
|
+
readonly solid: {};
|
|
68
|
+
readonly dashed: {};
|
|
69
|
+
readonly dotted: {};
|
|
70
|
+
readonly double: {};
|
|
71
|
+
readonly groove: {};
|
|
72
|
+
readonly ridge: {};
|
|
73
|
+
readonly inset: {};
|
|
74
|
+
readonly outset: {};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly 'style.borderColor': {
|
|
78
|
+
readonly type: "color";
|
|
79
|
+
readonly default: undefined;
|
|
80
|
+
readonly description: "Border color";
|
|
81
|
+
};
|
|
82
|
+
readonly 'style.backgroundColor': {
|
|
83
|
+
readonly type: "color";
|
|
84
|
+
readonly default: "transparent";
|
|
85
|
+
readonly description: "Color";
|
|
86
|
+
};
|
|
52
87
|
readonly durationInFrames: {
|
|
53
88
|
readonly type: "number";
|
|
54
89
|
readonly default: undefined;
|
|
@@ -55,6 +55,8 @@ exports.solidSchema = {
|
|
|
55
55
|
hiddenFromList: false,
|
|
56
56
|
},
|
|
57
57
|
...interactivity_schema_js_1.transformSchema,
|
|
58
|
+
...interactivity_schema_js_1.backgroundSchema,
|
|
59
|
+
...interactivity_schema_js_1.borderSchema,
|
|
58
60
|
};
|
|
59
61
|
const SolidInner = ({ color, width, height, effects = [], className, style, pixelDensity, overrideId, reference, }) => {
|
|
60
62
|
const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|