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
|
@@ -100,6 +100,41 @@ export declare const htmlInCanvasSchema: {
|
|
|
100
100
|
readonly description: "Opacity";
|
|
101
101
|
readonly hiddenFromList: false;
|
|
102
102
|
};
|
|
103
|
+
readonly 'style.borderWidth': {
|
|
104
|
+
readonly type: "number";
|
|
105
|
+
readonly default: undefined;
|
|
106
|
+
readonly min: 0;
|
|
107
|
+
readonly step: 1;
|
|
108
|
+
readonly description: "Border width";
|
|
109
|
+
readonly hiddenFromList: false;
|
|
110
|
+
};
|
|
111
|
+
readonly 'style.borderStyle': {
|
|
112
|
+
readonly type: "enum";
|
|
113
|
+
readonly default: "none";
|
|
114
|
+
readonly description: "Border style";
|
|
115
|
+
readonly variants: {
|
|
116
|
+
readonly none: {};
|
|
117
|
+
readonly hidden: {};
|
|
118
|
+
readonly solid: {};
|
|
119
|
+
readonly dashed: {};
|
|
120
|
+
readonly dotted: {};
|
|
121
|
+
readonly double: {};
|
|
122
|
+
readonly groove: {};
|
|
123
|
+
readonly ridge: {};
|
|
124
|
+
readonly inset: {};
|
|
125
|
+
readonly outset: {};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly 'style.borderColor': {
|
|
129
|
+
readonly type: "color";
|
|
130
|
+
readonly default: undefined;
|
|
131
|
+
readonly description: "Border color";
|
|
132
|
+
};
|
|
133
|
+
readonly 'style.backgroundColor': {
|
|
134
|
+
readonly type: "color";
|
|
135
|
+
readonly default: "transparent";
|
|
136
|
+
readonly description: "Color";
|
|
137
|
+
};
|
|
103
138
|
readonly durationInFrames: {
|
|
104
139
|
readonly type: "number";
|
|
105
140
|
readonly default: undefined;
|
package/dist/cjs/HtmlInCanvas.js
CHANGED
|
@@ -382,6 +382,8 @@ exports.htmlInCanvasSchema = {
|
|
|
382
382
|
hiddenFromList: false,
|
|
383
383
|
},
|
|
384
384
|
...interactivity_schema_js_1.transformSchema,
|
|
385
|
+
...interactivity_schema_js_1.backgroundSchema,
|
|
386
|
+
...interactivity_schema_js_1.borderSchema,
|
|
385
387
|
};
|
|
386
388
|
const HtmlInCanvasWrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
|
|
387
389
|
Component: HtmlInCanvasInner,
|
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
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
|
type NativeImgProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'>;
|
|
5
5
|
export type ImgProps = NativeImgProps & {
|
|
6
6
|
readonly maxRetries?: number;
|
|
@@ -16,7 +16,7 @@ export type ImgProps = NativeImgProps & {
|
|
|
16
16
|
* @deprecated For internal use only
|
|
17
17
|
*/
|
|
18
18
|
readonly stack?: string;
|
|
19
|
-
} & InteractiveBaseProps;
|
|
19
|
+
} & InteractiveBaseProps & InteractivePremountProps;
|
|
20
20
|
export declare const imgSchema: {
|
|
21
21
|
readonly 'style.transformOrigin': {
|
|
22
22
|
readonly type: "transform-origin";
|
|
@@ -53,6 +53,58 @@ export declare const imgSchema: {
|
|
|
53
53
|
readonly description: "Opacity";
|
|
54
54
|
readonly hiddenFromList: false;
|
|
55
55
|
};
|
|
56
|
+
readonly 'style.borderWidth': {
|
|
57
|
+
readonly type: "number";
|
|
58
|
+
readonly default: undefined;
|
|
59
|
+
readonly min: 0;
|
|
60
|
+
readonly step: 1;
|
|
61
|
+
readonly description: "Border width";
|
|
62
|
+
readonly hiddenFromList: false;
|
|
63
|
+
};
|
|
64
|
+
readonly 'style.borderStyle': {
|
|
65
|
+
readonly type: "enum";
|
|
66
|
+
readonly default: "none";
|
|
67
|
+
readonly description: "Border style";
|
|
68
|
+
readonly variants: {
|
|
69
|
+
readonly none: {};
|
|
70
|
+
readonly hidden: {};
|
|
71
|
+
readonly solid: {};
|
|
72
|
+
readonly dashed: {};
|
|
73
|
+
readonly dotted: {};
|
|
74
|
+
readonly double: {};
|
|
75
|
+
readonly groove: {};
|
|
76
|
+
readonly ridge: {};
|
|
77
|
+
readonly inset: {};
|
|
78
|
+
readonly outset: {};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly 'style.borderColor': {
|
|
82
|
+
readonly type: "color";
|
|
83
|
+
readonly default: undefined;
|
|
84
|
+
readonly description: "Border color";
|
|
85
|
+
};
|
|
86
|
+
readonly 'style.backgroundColor': {
|
|
87
|
+
readonly type: "color";
|
|
88
|
+
readonly default: "transparent";
|
|
89
|
+
readonly description: "Color";
|
|
90
|
+
};
|
|
91
|
+
readonly premountFor: {
|
|
92
|
+
readonly type: "number";
|
|
93
|
+
readonly default: 0;
|
|
94
|
+
readonly description: "Premount For";
|
|
95
|
+
readonly min: 0;
|
|
96
|
+
readonly step: 1;
|
|
97
|
+
readonly hiddenFromList: false;
|
|
98
|
+
readonly keyframable: false;
|
|
99
|
+
};
|
|
100
|
+
readonly postmountFor: {
|
|
101
|
+
readonly type: "number";
|
|
102
|
+
readonly default: 0;
|
|
103
|
+
readonly min: 0;
|
|
104
|
+
readonly step: 1;
|
|
105
|
+
readonly hiddenFromList: true;
|
|
106
|
+
readonly keyframable: false;
|
|
107
|
+
};
|
|
56
108
|
readonly durationInFrames: {
|
|
57
109
|
readonly type: "number";
|
|
58
110
|
readonly default: undefined;
|
|
@@ -103,5 +155,5 @@ export declare const Img: React.ComponentType<NativeImgProps & {
|
|
|
103
155
|
* @deprecated For internal use only
|
|
104
156
|
*/
|
|
105
157
|
readonly stack?: string | undefined;
|
|
106
|
-
} & InteractiveBaseProps>;
|
|
158
|
+
} & InteractiveBaseProps & InteractivePremountProps>;
|
|
107
159
|
export {};
|
package/dist/cjs/Img.js
CHANGED
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const index_js_1 = require("./canvas-image/index.js");
|
|
7
7
|
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
8
|
+
const freeze_js_1 = require("./freeze.js");
|
|
8
9
|
const get_cross_origin_value_js_1 = require("./get-cross-origin-value.js");
|
|
9
10
|
const interactivity_schema_js_1 = require("./interactivity-schema.js");
|
|
10
11
|
const prefetch_js_1 = require("./prefetch.js");
|
|
@@ -13,6 +14,7 @@ const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
|
13
14
|
const truncate_src_for_label_js_1 = require("./truncate-src-for-label.js");
|
|
14
15
|
const use_buffer_state_js_1 = require("./use-buffer-state.js");
|
|
15
16
|
const use_delay_render_js_1 = require("./use-delay-render.js");
|
|
17
|
+
const use_premounting_js_1 = require("./use-premounting.js");
|
|
16
18
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
17
19
|
const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
|
|
18
20
|
function exponentialBackoff(errorCount) {
|
|
@@ -192,11 +194,21 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
|
|
|
192
194
|
// blocks frame rendering.
|
|
193
195
|
return (jsx_runtime_1.jsx("img", { ...props, ref: imageCallbackRef, crossOrigin: crossOriginValue, onError: didGetError, decoding: isRendering ? 'sync' : decoding }));
|
|
194
196
|
};
|
|
195
|
-
const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, controls, outlineRef: refForOutline, ...props }) => {
|
|
197
|
+
const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, style, styleWhilePremounted, styleWhilePostmounted, controls, outlineRef: refForOutline, ...props }) => {
|
|
196
198
|
if (!src) {
|
|
197
199
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
198
200
|
}
|
|
199
|
-
|
|
201
|
+
const { effectivePostmountFor, effectivePremountFor, freezeFrame, isPremountingOrPostmounting, postmountingActive, premountingActive, premountingStyle, } = (0, use_premounting_js_1.usePremounting)({
|
|
202
|
+
from: from !== null && from !== void 0 ? from : 0,
|
|
203
|
+
durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity,
|
|
204
|
+
premountFor: premountFor !== null && premountFor !== void 0 ? premountFor : null,
|
|
205
|
+
postmountFor: postmountFor !== null && postmountFor !== void 0 ? postmountFor : null,
|
|
206
|
+
style: style !== null && style !== void 0 ? style : null,
|
|
207
|
+
styleWhilePremounted: styleWhilePremounted !== null && styleWhilePremounted !== void 0 ? styleWhilePremounted : null,
|
|
208
|
+
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
209
|
+
hideWhilePremounted: 'display-none',
|
|
210
|
+
});
|
|
211
|
+
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, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, name: name !== null && name !== void 0 ? name : '<Img>', controls: controls, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, hidden: hidden, outlineRef: refForOutline, children: jsx_runtime_1.jsx(ImgContent, { src: src, refForOutline: refForOutline, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined, ...props }) }) }));
|
|
200
212
|
};
|
|
201
213
|
const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
|
|
202
214
|
exports.imgSchema = {
|
|
@@ -207,7 +219,10 @@ exports.imgSchema = {
|
|
|
207
219
|
keyframable: false,
|
|
208
220
|
},
|
|
209
221
|
...interactivity_schema_js_1.baseSchema,
|
|
222
|
+
...interactivity_schema_js_1.premountSchema,
|
|
210
223
|
...interactivity_schema_js_1.transformSchema,
|
|
224
|
+
...interactivity_schema_js_1.backgroundSchema,
|
|
225
|
+
...interactivity_schema_js_1.borderSchema,
|
|
211
226
|
};
|
|
212
227
|
const imgCanvasFallbackIncompatibleProps = new Set([
|
|
213
228
|
'alt',
|
|
@@ -248,11 +263,11 @@ const getFitFromObjectFit = (style) => {
|
|
|
248
263
|
}
|
|
249
264
|
return undefined;
|
|
250
265
|
};
|
|
251
|
-
const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
|
|
266
|
+
const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
|
|
252
267
|
var _a;
|
|
253
268
|
const refForOutline = (0, react_1.useRef)(null);
|
|
254
269
|
if (effects.length === 0) {
|
|
255
|
-
return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
|
|
270
|
+
return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, premountFor: premountFor, postmountFor: postmountFor, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
|
|
256
271
|
}
|
|
257
272
|
if (!src) {
|
|
258
273
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
@@ -267,7 +282,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
|
|
|
267
282
|
const canvasHeight = typeof height === 'number' ? height : undefined;
|
|
268
283
|
const canvasProps = props;
|
|
269
284
|
const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
|
|
270
|
-
return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", controls: controls, outlineRef: refForOutline, ...canvasProps }));
|
|
285
|
+
return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, premountFor: premountFor, postmountFor: postmountFor, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", controls: controls, outlineRef: refForOutline, ...canvasProps }));
|
|
271
286
|
};
|
|
272
287
|
/*
|
|
273
288
|
* @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
|
|
@@ -167,6 +167,45 @@ export declare const Interactive: {
|
|
|
167
167
|
readonly hiddenFromList: false;
|
|
168
168
|
};
|
|
169
169
|
};
|
|
170
|
+
backgroundSchema: {
|
|
171
|
+
readonly 'style.backgroundColor': {
|
|
172
|
+
readonly type: "color";
|
|
173
|
+
readonly default: "transparent";
|
|
174
|
+
readonly description: "Color";
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
borderSchema: {
|
|
178
|
+
readonly 'style.borderWidth': {
|
|
179
|
+
readonly type: "number";
|
|
180
|
+
readonly default: undefined;
|
|
181
|
+
readonly min: 0;
|
|
182
|
+
readonly step: 1;
|
|
183
|
+
readonly description: "Border width";
|
|
184
|
+
readonly hiddenFromList: false;
|
|
185
|
+
};
|
|
186
|
+
readonly 'style.borderStyle': {
|
|
187
|
+
readonly type: "enum";
|
|
188
|
+
readonly default: "none";
|
|
189
|
+
readonly description: "Border style";
|
|
190
|
+
readonly variants: {
|
|
191
|
+
readonly none: {};
|
|
192
|
+
readonly hidden: {};
|
|
193
|
+
readonly solid: {};
|
|
194
|
+
readonly dashed: {};
|
|
195
|
+
readonly dotted: {};
|
|
196
|
+
readonly double: {};
|
|
197
|
+
readonly groove: {};
|
|
198
|
+
readonly ridge: {};
|
|
199
|
+
readonly inset: {};
|
|
200
|
+
readonly outset: {};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
readonly 'style.borderColor': {
|
|
204
|
+
readonly type: "color";
|
|
205
|
+
readonly default: undefined;
|
|
206
|
+
readonly description: "Border color";
|
|
207
|
+
};
|
|
208
|
+
};
|
|
170
209
|
premountSchema: {
|
|
171
210
|
readonly premountFor: {
|
|
172
211
|
readonly type: "number";
|
|
@@ -257,6 +296,41 @@ export declare const Interactive: {
|
|
|
257
296
|
readonly description: "Opacity";
|
|
258
297
|
readonly hiddenFromList: false;
|
|
259
298
|
};
|
|
299
|
+
readonly 'style.borderWidth': {
|
|
300
|
+
readonly type: "number";
|
|
301
|
+
readonly default: undefined;
|
|
302
|
+
readonly min: 0;
|
|
303
|
+
readonly step: 1;
|
|
304
|
+
readonly description: "Border width";
|
|
305
|
+
readonly hiddenFromList: false;
|
|
306
|
+
};
|
|
307
|
+
readonly 'style.borderStyle': {
|
|
308
|
+
readonly type: "enum";
|
|
309
|
+
readonly default: "none";
|
|
310
|
+
readonly description: "Border style";
|
|
311
|
+
readonly variants: {
|
|
312
|
+
readonly none: {};
|
|
313
|
+
readonly hidden: {};
|
|
314
|
+
readonly solid: {};
|
|
315
|
+
readonly dashed: {};
|
|
316
|
+
readonly dotted: {};
|
|
317
|
+
readonly double: {};
|
|
318
|
+
readonly groove: {};
|
|
319
|
+
readonly ridge: {};
|
|
320
|
+
readonly inset: {};
|
|
321
|
+
readonly outset: {};
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
readonly 'style.borderColor': {
|
|
325
|
+
readonly type: "color";
|
|
326
|
+
readonly default: undefined;
|
|
327
|
+
readonly description: "Border color";
|
|
328
|
+
};
|
|
329
|
+
readonly 'style.backgroundColor': {
|
|
330
|
+
readonly type: "color";
|
|
331
|
+
readonly default: "transparent";
|
|
332
|
+
readonly description: "Color";
|
|
333
|
+
};
|
|
260
334
|
readonly premountFor: {
|
|
261
335
|
readonly type: "number";
|
|
262
336
|
readonly default: 0;
|
|
@@ -274,12 +348,6 @@ export declare const Interactive: {
|
|
|
274
348
|
readonly hiddenFromList: true;
|
|
275
349
|
readonly keyframable: false;
|
|
276
350
|
};
|
|
277
|
-
readonly styleWhilePremounted: {
|
|
278
|
-
readonly type: "hidden";
|
|
279
|
-
};
|
|
280
|
-
readonly styleWhilePostmounted: {
|
|
281
|
-
readonly type: "hidden";
|
|
282
|
-
};
|
|
283
351
|
};
|
|
284
352
|
readonly none: {};
|
|
285
353
|
};
|
package/dist/cjs/Interactive.js
CHANGED
|
@@ -59,7 +59,20 @@ const interactiveElementSchema = {
|
|
|
59
59
|
...interactivity_schema_js_1.baseSchema,
|
|
60
60
|
...interactivity_schema_js_1.transformSchema,
|
|
61
61
|
};
|
|
62
|
+
const interactiveBackgroundElementSchema = {
|
|
63
|
+
...interactiveElementSchema,
|
|
64
|
+
...interactivity_schema_js_1.backgroundSchema,
|
|
65
|
+
};
|
|
66
|
+
const interactiveBorderElementSchema = {
|
|
67
|
+
...interactiveBackgroundElementSchema,
|
|
68
|
+
...interactivity_schema_js_1.borderSchema,
|
|
69
|
+
};
|
|
62
70
|
const interactiveTextElementSchema = {
|
|
71
|
+
...interactiveBorderElementSchema,
|
|
72
|
+
...interactivity_schema_js_1.textSchema,
|
|
73
|
+
...interactivity_schema_js_1.textContentSchema,
|
|
74
|
+
};
|
|
75
|
+
const interactiveSvgTextElementSchema = {
|
|
63
76
|
...interactiveElementSchema,
|
|
64
77
|
...interactivity_schema_js_1.textSchema,
|
|
65
78
|
...interactivity_schema_js_1.textContentSchema,
|
|
@@ -117,6 +130,8 @@ exports.Interactive = {
|
|
|
117
130
|
baseSchema: interactivity_schema_js_1.baseSchema,
|
|
118
131
|
transformSchema: interactivity_schema_js_1.transformSchema,
|
|
119
132
|
textSchema: interactivity_schema_js_1.textSchema,
|
|
133
|
+
backgroundSchema: interactivity_schema_js_1.backgroundSchema,
|
|
134
|
+
borderSchema: interactivity_schema_js_1.borderSchema,
|
|
120
135
|
premountSchema: interactivity_schema_js_1.premountSchema,
|
|
121
136
|
sequenceSchema: interactivity_schema_js_1.sequenceSchema,
|
|
122
137
|
withSchema,
|
|
@@ -153,7 +168,7 @@ exports.Interactive = {
|
|
|
153
168
|
Small: makeInteractiveTextElement('small', '<Interactive.Small>'),
|
|
154
169
|
Span: makeInteractiveTextElement('span', '<Interactive.Span>'),
|
|
155
170
|
Strong: makeInteractiveTextElement('strong', '<Interactive.Strong>'),
|
|
156
|
-
Svg:
|
|
157
|
-
Text:
|
|
171
|
+
Svg: makeInteractiveElement('svg', '<Interactive.Svg>', interactiveBorderElementSchema),
|
|
172
|
+
Text: makeInteractiveElement('text', '<Interactive.Text>', interactiveSvgTextElementSchema),
|
|
158
173
|
Ul: makeInteractiveTextElement('ul', '<Interactive.Ul>'),
|
|
159
174
|
};
|
|
@@ -1,7 +1,141 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { SequenceControls } from '../CompositionManager.js';
|
|
3
3
|
import type { EffectsProp } from '../effects/effect-types.js';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const animatedImageSchema: {
|
|
5
|
+
readonly 'style.transformOrigin': {
|
|
6
|
+
readonly type: "transform-origin";
|
|
7
|
+
readonly step: 1;
|
|
8
|
+
readonly default: "50% 50%";
|
|
9
|
+
readonly description: "Transform origin";
|
|
10
|
+
};
|
|
11
|
+
readonly 'style.translate': {
|
|
12
|
+
readonly type: "translate";
|
|
13
|
+
readonly step: 1;
|
|
14
|
+
readonly default: "0px 0px";
|
|
15
|
+
readonly description: "Offset";
|
|
16
|
+
};
|
|
17
|
+
readonly 'style.scale': {
|
|
18
|
+
readonly type: "scale";
|
|
19
|
+
readonly max: 100;
|
|
20
|
+
readonly step: 0.01;
|
|
21
|
+
readonly default: 1;
|
|
22
|
+
readonly description: "Scale";
|
|
23
|
+
readonly defaultKeyframeOutput: "perceptual-scale";
|
|
24
|
+
};
|
|
25
|
+
readonly 'style.rotate': {
|
|
26
|
+
readonly type: "rotation-css";
|
|
27
|
+
readonly step: 1;
|
|
28
|
+
readonly default: "0deg";
|
|
29
|
+
readonly description: "Rotation";
|
|
30
|
+
};
|
|
31
|
+
readonly 'style.opacity': {
|
|
32
|
+
readonly type: "number";
|
|
33
|
+
readonly min: 0;
|
|
34
|
+
readonly max: 1;
|
|
35
|
+
readonly step: 0.01;
|
|
36
|
+
readonly default: 1;
|
|
37
|
+
readonly description: "Opacity";
|
|
38
|
+
readonly hiddenFromList: false;
|
|
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
|
+
};
|
|
92
|
+
readonly durationInFrames: {
|
|
93
|
+
readonly type: "number";
|
|
94
|
+
readonly default: undefined;
|
|
95
|
+
readonly min: 1;
|
|
96
|
+
readonly step: 1;
|
|
97
|
+
readonly hiddenFromList: true;
|
|
98
|
+
};
|
|
99
|
+
readonly from: {
|
|
100
|
+
readonly type: "number";
|
|
101
|
+
readonly default: 0;
|
|
102
|
+
readonly step: 1;
|
|
103
|
+
readonly hiddenFromList: true;
|
|
104
|
+
};
|
|
105
|
+
readonly trimBefore: {
|
|
106
|
+
readonly type: "number";
|
|
107
|
+
readonly default: 0;
|
|
108
|
+
readonly min: 0;
|
|
109
|
+
readonly step: 1;
|
|
110
|
+
readonly hiddenFromList: true;
|
|
111
|
+
};
|
|
112
|
+
readonly freeze: {
|
|
113
|
+
readonly type: "number";
|
|
114
|
+
readonly default: null;
|
|
115
|
+
readonly step: 1;
|
|
116
|
+
readonly hiddenFromList: true;
|
|
117
|
+
};
|
|
118
|
+
readonly hidden: import("../interactivity-schema.js").BooleanFieldSchema;
|
|
119
|
+
readonly name: import("../interactivity-schema.js").HiddenFieldSchema;
|
|
120
|
+
readonly showInTimeline: import("../interactivity-schema.js").HiddenFieldSchema;
|
|
121
|
+
readonly src: {
|
|
122
|
+
readonly type: "asset";
|
|
123
|
+
readonly default: undefined;
|
|
124
|
+
readonly description: "Source";
|
|
125
|
+
readonly keyframable: false;
|
|
126
|
+
};
|
|
127
|
+
readonly playbackRate: {
|
|
128
|
+
readonly type: "number";
|
|
129
|
+
readonly min: 0;
|
|
130
|
+
readonly max: 10;
|
|
131
|
+
readonly step: 0.1;
|
|
132
|
+
readonly default: 1;
|
|
133
|
+
readonly description: "Playback rate";
|
|
134
|
+
readonly hiddenFromList: false;
|
|
135
|
+
readonly keyframable: false;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export declare const AnimatedImage: React.ComponentType<import("../Interactive.js").InteractiveBaseProps & import("../Interactive.js").InteractivePremountProps & {
|
|
5
139
|
src: string;
|
|
6
140
|
width?: number | undefined;
|
|
7
141
|
height?: number | undefined;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnimatedImage = void 0;
|
|
3
|
+
exports.AnimatedImage = exports.animatedImageSchema = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const cancel_render_js_1 = require("../cancel-render.js");
|
|
7
7
|
const use_memoized_effects_js_1 = require("../effects/use-memoized-effects.js");
|
|
8
8
|
const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
|
|
9
|
+
const freeze_js_1 = require("../freeze.js");
|
|
9
10
|
const interactivity_schema_js_1 = require("../interactivity-schema.js");
|
|
10
11
|
const Sequence_js_1 = require("../Sequence.js");
|
|
11
12
|
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
12
13
|
const use_delay_render_js_1 = require("../use-delay-render.js");
|
|
14
|
+
const use_premounting_js_1 = require("../use-premounting.js");
|
|
13
15
|
const use_video_config_js_1 = require("../use-video-config.js");
|
|
14
16
|
const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js");
|
|
15
17
|
const canvas_1 = require("./canvas");
|
|
@@ -17,7 +19,7 @@ const decode_image_js_1 = require("./decode-image.js");
|
|
|
17
19
|
const get_current_time_js_1 = require("./get-current-time.js");
|
|
18
20
|
const request_init_1 = require("./request-init");
|
|
19
21
|
const resolve_image_source_1 = require("./resolve-image-source");
|
|
20
|
-
|
|
22
|
+
exports.animatedImageSchema = {
|
|
21
23
|
src: {
|
|
22
24
|
type: 'asset',
|
|
23
25
|
default: undefined,
|
|
@@ -25,6 +27,7 @@ const animatedImageSchema = {
|
|
|
25
27
|
keyframable: false,
|
|
26
28
|
},
|
|
27
29
|
...interactivity_schema_js_1.baseSchema,
|
|
30
|
+
...interactivity_schema_js_1.premountSchema,
|
|
28
31
|
playbackRate: {
|
|
29
32
|
type: 'number',
|
|
30
33
|
min: 0,
|
|
@@ -36,6 +39,8 @@ const animatedImageSchema = {
|
|
|
36
39
|
keyframable: false,
|
|
37
40
|
},
|
|
38
41
|
...interactivity_schema_js_1.transformSchema,
|
|
42
|
+
...interactivity_schema_js_1.backgroundSchema,
|
|
43
|
+
...interactivity_schema_js_1.borderSchema,
|
|
39
44
|
};
|
|
40
45
|
const getCanvasPropsFromSequenceProps = (props) => {
|
|
41
46
|
const canvasProps = {};
|
|
@@ -78,6 +83,15 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
78
83
|
const [initialLoopBehavior] = (0, react_1.useState)(() => loopBehavior);
|
|
79
84
|
(0, react_1.useEffect)(() => {
|
|
80
85
|
const controller = new AbortController();
|
|
86
|
+
let cancelled = false;
|
|
87
|
+
let continued = false;
|
|
88
|
+
const continueRenderOnce = () => {
|
|
89
|
+
if (continued) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
continued = true;
|
|
93
|
+
continueRender(decodeHandle);
|
|
94
|
+
};
|
|
81
95
|
(0, decode_image_js_1.decodeImage)({
|
|
82
96
|
resolvedSrc,
|
|
83
97
|
signal: controller.signal,
|
|
@@ -86,24 +100,33 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
86
100
|
initialLoopBehavior,
|
|
87
101
|
})
|
|
88
102
|
.then((d) => {
|
|
103
|
+
if (cancelled) {
|
|
104
|
+
d.close();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
89
107
|
setImageDecoder(d);
|
|
90
|
-
|
|
108
|
+
continueRenderOnce();
|
|
91
109
|
})
|
|
92
110
|
.catch((err) => {
|
|
111
|
+
if (cancelled) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
93
114
|
if (err.name === 'AbortError') {
|
|
94
|
-
|
|
115
|
+
continueRenderOnce();
|
|
95
116
|
return;
|
|
96
117
|
}
|
|
97
118
|
if (onError) {
|
|
98
119
|
onError === null || onError === void 0 ? void 0 : onError(err);
|
|
99
|
-
|
|
120
|
+
continueRenderOnce();
|
|
100
121
|
}
|
|
101
122
|
else {
|
|
102
123
|
(0, cancel_render_js_1.cancelRender)(err);
|
|
103
124
|
}
|
|
104
125
|
});
|
|
105
126
|
return () => {
|
|
127
|
+
cancelled = true;
|
|
106
128
|
controller.abort();
|
|
129
|
+
continueRenderOnce();
|
|
107
130
|
};
|
|
108
131
|
}, [
|
|
109
132
|
resolvedSrc,
|
|
@@ -113,6 +136,11 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
113
136
|
initialLoopBehavior,
|
|
114
137
|
continueRender,
|
|
115
138
|
]);
|
|
139
|
+
(0, react_1.useEffect)(() => {
|
|
140
|
+
return () => {
|
|
141
|
+
imageDecoder === null || imageDecoder === void 0 ? void 0 : imageDecoder.close();
|
|
142
|
+
};
|
|
143
|
+
}, [imageDecoder]);
|
|
116
144
|
(0, react_1.useLayoutEffect)(() => {
|
|
117
145
|
if (!imageDecoder) {
|
|
118
146
|
return;
|
|
@@ -168,12 +196,22 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
168
196
|
return (jsx_runtime_1.jsx(canvas_1.Canvas, { ref: ref, width: width, height: height, fit: fit, effects: memoizedEffects, ...props }));
|
|
169
197
|
});
|
|
170
198
|
AnimatedImageContent.displayName = 'AnimatedImageContent';
|
|
171
|
-
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, requestInit, effects = [], controls, ref, ...sequenceProps }) => {
|
|
199
|
+
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, requestInit, effects = [], controls, ref, ...sequenceProps }) => {
|
|
172
200
|
const actualRef = (0, react_1.useRef)(null);
|
|
173
201
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
174
202
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
175
203
|
return actualRef.current;
|
|
176
204
|
}, []);
|
|
205
|
+
const { effectivePostmountFor, effectivePremountFor, freezeFrame, isPremountingOrPostmounting, postmountingActive, premountingActive, premountingStyle, } = (0, use_premounting_js_1.usePremounting)({
|
|
206
|
+
from: from !== null && from !== void 0 ? from : 0,
|
|
207
|
+
durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity,
|
|
208
|
+
premountFor: premountFor !== null && premountFor !== void 0 ? premountFor : null,
|
|
209
|
+
postmountFor: postmountFor !== null && postmountFor !== void 0 ? postmountFor : null,
|
|
210
|
+
style: style !== null && style !== void 0 ? style : null,
|
|
211
|
+
styleWhilePremounted: styleWhilePremounted !== null && styleWhilePremounted !== void 0 ? styleWhilePremounted : null,
|
|
212
|
+
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
213
|
+
hideWhilePremounted: 'display-none',
|
|
214
|
+
});
|
|
177
215
|
const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
|
|
178
216
|
const animatedImageProps = {
|
|
179
217
|
src,
|
|
@@ -185,17 +223,17 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
|
|
|
185
223
|
loopBehavior,
|
|
186
224
|
id,
|
|
187
225
|
className,
|
|
188
|
-
style,
|
|
226
|
+
style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined,
|
|
189
227
|
requestInit,
|
|
190
228
|
...canvasProps,
|
|
191
229
|
};
|
|
192
|
-
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: durationInFrames, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, outlineRef: actualRef, children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }));
|
|
230
|
+
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, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, ...sequenceProps, outlineRef: actualRef, children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }) }));
|
|
193
231
|
};
|
|
194
232
|
exports.AnimatedImage = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
|
|
195
233
|
Component: AnimatedImageInner,
|
|
196
234
|
componentName: '<AnimatedImage>',
|
|
197
235
|
componentIdentity: 'dev.remotion.remotion.AnimatedImage',
|
|
198
|
-
schema: animatedImageSchema,
|
|
236
|
+
schema: exports.animatedImageSchema,
|
|
199
237
|
supportsEffects: true,
|
|
200
238
|
});
|
|
201
239
|
exports.AnimatedImage.displayName = 'AnimatedImage';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const createImageDecoder: ({ resolvedSrc, signal, requestInit, contentType, }: {
|
|
2
|
+
resolvedSrc: string;
|
|
3
|
+
signal: AbortSignal;
|
|
4
|
+
requestInit?: RequestInit | undefined;
|
|
5
|
+
contentType: string | null;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
decoder: ImageDecoder;
|
|
8
|
+
selectedTrack: ImageTrack;
|
|
9
|
+
}>;
|