remotion 4.0.498 → 4.0.500
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/CompositionManager.d.ts +0 -1
- package/dist/cjs/HtmlInCanvas.d.ts +43 -3
- package/dist/cjs/HtmlInCanvas.js +29 -2
- package/dist/cjs/Img.d.ts +43 -3
- package/dist/cjs/Img.js +15 -5
- package/dist/cjs/Interactive.d.ts +118 -0
- package/dist/cjs/Interactive.js +28 -9
- package/dist/cjs/Sequence.d.ts +4 -0
- package/dist/cjs/Sequence.js +22 -7
- package/dist/cjs/TimelineContext.d.ts +0 -1
- package/dist/cjs/TimelineContext.js +1 -4
- package/dist/cjs/animated-image/AnimatedImage.d.ts +41 -1
- package/dist/cjs/animated-image/AnimatedImage.js +12 -2
- package/dist/cjs/animated-image/props.d.ts +2 -2
- package/dist/cjs/canvas-image/CanvasImage.d.ts +42 -1
- package/dist/cjs/canvas-image/CanvasImage.js +12 -2
- package/dist/cjs/canvas-image/props.d.ts +6 -2
- package/dist/cjs/effects/Solid.d.ts +43 -3
- package/dist/cjs/effects/Solid.js +12 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/interactivity-schema.d.ts +239 -0
- package/dist/cjs/interactivity-schema.js +70 -1
- package/dist/cjs/internals.d.ts +127 -1
- package/dist/cjs/internals.js +5 -0
- package/dist/cjs/no-react.d.ts +40 -0
- package/dist/cjs/sequence-crop.d.ts +19 -0
- package/dist/cjs/sequence-crop.js +45 -0
- package/dist/cjs/use-crop-style.d.ts +6 -0
- package/dist/cjs/use-crop-style.js +19 -0
- package/dist/cjs/use-media-in-timeline.d.ts +0 -1
- package/dist/cjs/use-media-in-timeline.js +1 -7
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/with-interactivity-schema.js +4 -2
- package/dist/esm/index.mjs +408 -140
- package/dist/esm/no-react.mjs +67 -0
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelineContextProvider = exports.AbsoluteTimeContext = exports.PlaybackRateContext = exports.TimelineContext = exports.SetTimelineContext = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const random_1 = require("./random");
|
|
7
6
|
const timeline_position_state_1 = require("./timeline-position-state");
|
|
8
7
|
const use_delay_render_1 = require("./use-delay-render");
|
|
9
8
|
exports.SetTimelineContext = (0, react_1.createContext)({
|
|
@@ -22,7 +21,6 @@ const TimelineContextProvider = ({ children, frameState }) => {
|
|
|
22
21
|
const imperativePlaying = (0, react_1.useRef)(false);
|
|
23
22
|
const [playbackRate, setPlaybackRate] = (0, react_1.useState)(1);
|
|
24
23
|
const audioAndVideoTags = (0, react_1.useRef)([]);
|
|
25
|
-
const [remotionRootId] = (0, react_1.useState)(() => String((0, random_1.random)(null)));
|
|
26
24
|
const [_frame, setFrame] = (0, react_1.useState)(() => (0, timeline_position_state_1.getInitialFrameState)());
|
|
27
25
|
const frame = frameState !== null && frameState !== void 0 ? frameState : _frame;
|
|
28
26
|
const { delayRender, continueRender } = (0, use_delay_render_1.useDelayRender)();
|
|
@@ -62,10 +60,9 @@ const TimelineContextProvider = ({ children, frameState }) => {
|
|
|
62
60
|
frame,
|
|
63
61
|
playing,
|
|
64
62
|
imperativePlaying,
|
|
65
|
-
rootId: remotionRootId,
|
|
66
63
|
audioAndVideoTags,
|
|
67
64
|
};
|
|
68
|
-
}, [frame, playing
|
|
65
|
+
}, [frame, playing]);
|
|
69
66
|
const playbackRateContextValue = (0, react_1.useMemo)(() => {
|
|
70
67
|
return {
|
|
71
68
|
playbackRate,
|
|
@@ -89,6 +89,46 @@ export declare const animatedImageSchema: {
|
|
|
89
89
|
readonly hiddenFromList: true;
|
|
90
90
|
readonly keyframable: false;
|
|
91
91
|
};
|
|
92
|
+
readonly cropLeft: {
|
|
93
|
+
readonly type: "number";
|
|
94
|
+
readonly default: 0;
|
|
95
|
+
readonly description: "Crop left";
|
|
96
|
+
readonly min: 0;
|
|
97
|
+
readonly max: 1;
|
|
98
|
+
readonly step: 0.01;
|
|
99
|
+
readonly hiddenFromList: false;
|
|
100
|
+
readonly keyframable: true;
|
|
101
|
+
};
|
|
102
|
+
readonly cropRight: {
|
|
103
|
+
readonly type: "number";
|
|
104
|
+
readonly default: 0;
|
|
105
|
+
readonly description: "Crop right";
|
|
106
|
+
readonly min: 0;
|
|
107
|
+
readonly max: 1;
|
|
108
|
+
readonly step: 0.01;
|
|
109
|
+
readonly hiddenFromList: false;
|
|
110
|
+
readonly keyframable: true;
|
|
111
|
+
};
|
|
112
|
+
readonly cropTop: {
|
|
113
|
+
readonly type: "number";
|
|
114
|
+
readonly default: 0;
|
|
115
|
+
readonly description: "Crop top";
|
|
116
|
+
readonly min: 0;
|
|
117
|
+
readonly max: 1;
|
|
118
|
+
readonly step: 0.01;
|
|
119
|
+
readonly hiddenFromList: false;
|
|
120
|
+
readonly keyframable: true;
|
|
121
|
+
};
|
|
122
|
+
readonly cropBottom: {
|
|
123
|
+
readonly type: "number";
|
|
124
|
+
readonly default: 0;
|
|
125
|
+
readonly description: "Crop bottom";
|
|
126
|
+
readonly min: 0;
|
|
127
|
+
readonly max: 1;
|
|
128
|
+
readonly step: 0.01;
|
|
129
|
+
readonly hiddenFromList: false;
|
|
130
|
+
readonly keyframable: true;
|
|
131
|
+
};
|
|
92
132
|
readonly durationInFrames: {
|
|
93
133
|
readonly type: "number";
|
|
94
134
|
readonly default: undefined;
|
|
@@ -135,7 +175,7 @@ export declare const animatedImageSchema: {
|
|
|
135
175
|
readonly keyframable: false;
|
|
136
176
|
};
|
|
137
177
|
};
|
|
138
|
-
export declare const AnimatedImage: React.ComponentType<import("../Interactive.js").InteractiveBaseProps & import("../Interactive.js").InteractivePremountProps & {
|
|
178
|
+
export declare const AnimatedImage: React.ComponentType<import("../Interactive.js").InteractiveBaseProps & import("../Interactive.js").InteractiveCropProps & import("../Interactive.js").InteractivePremountProps & {
|
|
139
179
|
src: string;
|
|
140
180
|
width?: number | undefined;
|
|
141
181
|
height?: number | undefined;
|
|
@@ -9,6 +9,7 @@ const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-trac
|
|
|
9
9
|
const freeze_js_1 = require("../freeze.js");
|
|
10
10
|
const interactivity_schema_js_1 = require("../interactivity-schema.js");
|
|
11
11
|
const Sequence_js_1 = require("../Sequence.js");
|
|
12
|
+
const use_crop_style_js_1 = require("../use-crop-style.js");
|
|
12
13
|
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
13
14
|
const use_delay_render_js_1 = require("../use-delay-render.js");
|
|
14
15
|
const use_premounting_js_1 = require("../use-premounting.js");
|
|
@@ -27,6 +28,7 @@ exports.animatedImageSchema = {
|
|
|
27
28
|
keyframable: false,
|
|
28
29
|
},
|
|
29
30
|
...interactivity_schema_js_1.baseSchema,
|
|
31
|
+
...interactivity_schema_js_1.cropSchema,
|
|
30
32
|
...interactivity_schema_js_1.premountSchema,
|
|
31
33
|
playbackRate: {
|
|
32
34
|
type: 'number',
|
|
@@ -196,7 +198,7 @@ const AnimatedImageContent = (0, react_1.forwardRef)(({ src, width, height, onEr
|
|
|
196
198
|
return (jsx_runtime_1.jsx(canvas_1.Canvas, { ref: ref, width: width, height: height, fit: fit, effects: memoizedEffects, ...props }));
|
|
197
199
|
});
|
|
198
200
|
AnimatedImageContent.displayName = 'AnimatedImageContent';
|
|
199
|
-
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, requestInit, effects = [], controls, ref, ...sequenceProps }) => {
|
|
201
|
+
const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, loopBehavior, id, className, style, durationInFrames, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, cropLeft, cropRight, cropTop, cropBottom, requestInit, effects = [], controls, ref, ...sequenceProps }) => {
|
|
200
202
|
const actualRef = (0, react_1.useRef)(null);
|
|
201
203
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
202
204
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
@@ -212,6 +214,14 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
|
|
|
212
214
|
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
213
215
|
hideWhilePremounted: 'display-none',
|
|
214
216
|
});
|
|
217
|
+
const croppedStyle = (0, use_crop_style_js_1.useCropStyle)({
|
|
218
|
+
cropLeft,
|
|
219
|
+
cropRight,
|
|
220
|
+
cropTop,
|
|
221
|
+
cropBottom,
|
|
222
|
+
style: premountingStyle,
|
|
223
|
+
componentName: '<AnimatedImage />',
|
|
224
|
+
});
|
|
215
225
|
const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
|
|
216
226
|
const animatedImageProps = {
|
|
217
227
|
src,
|
|
@@ -223,7 +233,7 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
|
|
|
223
233
|
loopBehavior,
|
|
224
234
|
id,
|
|
225
235
|
className,
|
|
226
|
-
style:
|
|
236
|
+
style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined,
|
|
227
237
|
requestInit,
|
|
228
238
|
...canvasProps,
|
|
229
239
|
};
|
|
@@ -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, InteractivePremountProps } from '../Interactive.js';
|
|
3
|
+
import type { InteractiveBaseProps, InteractiveCropProps, 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 & InteractivePremountProps & RemotionAnimatedImageProps & {
|
|
19
|
+
export type AnimatedImageProps = InteractiveBaseProps & InteractiveCropProps & InteractivePremountProps & RemotionAnimatedImageProps & {
|
|
20
20
|
readonly effects?: EffectsProp;
|
|
21
21
|
};
|
|
22
22
|
export type AnimatedImageFillMode = ImageFit;
|
|
@@ -89,6 +89,46 @@ export declare const canvasImageSchema: {
|
|
|
89
89
|
readonly hiddenFromList: true;
|
|
90
90
|
readonly keyframable: false;
|
|
91
91
|
};
|
|
92
|
+
readonly cropLeft: {
|
|
93
|
+
readonly type: "number";
|
|
94
|
+
readonly default: 0;
|
|
95
|
+
readonly description: "Crop left";
|
|
96
|
+
readonly min: 0;
|
|
97
|
+
readonly max: 1;
|
|
98
|
+
readonly step: 0.01;
|
|
99
|
+
readonly hiddenFromList: false;
|
|
100
|
+
readonly keyframable: true;
|
|
101
|
+
};
|
|
102
|
+
readonly cropRight: {
|
|
103
|
+
readonly type: "number";
|
|
104
|
+
readonly default: 0;
|
|
105
|
+
readonly description: "Crop right";
|
|
106
|
+
readonly min: 0;
|
|
107
|
+
readonly max: 1;
|
|
108
|
+
readonly step: 0.01;
|
|
109
|
+
readonly hiddenFromList: false;
|
|
110
|
+
readonly keyframable: true;
|
|
111
|
+
};
|
|
112
|
+
readonly cropTop: {
|
|
113
|
+
readonly type: "number";
|
|
114
|
+
readonly default: 0;
|
|
115
|
+
readonly description: "Crop top";
|
|
116
|
+
readonly min: 0;
|
|
117
|
+
readonly max: 1;
|
|
118
|
+
readonly step: 0.01;
|
|
119
|
+
readonly hiddenFromList: false;
|
|
120
|
+
readonly keyframable: true;
|
|
121
|
+
};
|
|
122
|
+
readonly cropBottom: {
|
|
123
|
+
readonly type: "number";
|
|
124
|
+
readonly default: 0;
|
|
125
|
+
readonly description: "Crop bottom";
|
|
126
|
+
readonly min: 0;
|
|
127
|
+
readonly max: 1;
|
|
128
|
+
readonly step: 0.01;
|
|
129
|
+
readonly hiddenFromList: false;
|
|
130
|
+
readonly keyframable: true;
|
|
131
|
+
};
|
|
92
132
|
readonly durationInFrames: {
|
|
93
133
|
readonly type: "number";
|
|
94
134
|
readonly default: undefined;
|
|
@@ -129,7 +169,7 @@ export declare const canvasImageSchema: {
|
|
|
129
169
|
};
|
|
130
170
|
};
|
|
131
171
|
};
|
|
132
|
-
export declare const CanvasImage: import("react").ComponentType<import("../Interactive.js").InteractiveBaseProps & import("../Interactive.js").InteractivePremountProps & {
|
|
172
|
+
export declare const CanvasImage: import("react").ComponentType<import("../Interactive.js").InteractiveBaseProps & import("../Interactive.js").InteractiveCropProps & import("../Interactive.js").InteractivePremountProps & {
|
|
133
173
|
readonly stack?: string | undefined;
|
|
134
174
|
} & CanvasImageCanvasProps & {
|
|
135
175
|
readonly src: string;
|
|
@@ -146,5 +186,6 @@ export declare const CanvasImage: import("react").ComponentType<import("../Inter
|
|
|
146
186
|
readonly delayRenderRetries?: number | undefined;
|
|
147
187
|
readonly delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
148
188
|
readonly _remotionInternalDocumentationLink?: string | undefined;
|
|
189
|
+
readonly _remotionInternalCropComponentName?: string | undefined;
|
|
149
190
|
readonly outlineRef?: RefObject<HTMLElement | null> | null | undefined;
|
|
150
191
|
} & import("react").RefAttributes<HTMLCanvasElement>>;
|
|
@@ -15,11 +15,13 @@ const Sequence_js_1 = require("../Sequence.js");
|
|
|
15
15
|
const SequenceContext_js_1 = require("../SequenceContext.js");
|
|
16
16
|
const truncate_src_for_label_js_1 = require("../truncate-src-for-label.js");
|
|
17
17
|
const use_buffer_state_js_1 = require("../use-buffer-state.js");
|
|
18
|
+
const use_crop_style_js_1 = require("../use-crop-style.js");
|
|
18
19
|
const use_delay_render_js_1 = require("../use-delay-render.js");
|
|
19
20
|
const use_premounting_js_1 = require("../use-premounting.js");
|
|
20
21
|
const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js");
|
|
21
22
|
exports.canvasImageSchema = {
|
|
22
23
|
...interactivity_schema_js_1.baseSchema,
|
|
24
|
+
...interactivity_schema_js_1.cropSchema,
|
|
23
25
|
...interactivity_schema_js_1.premountSchema,
|
|
24
26
|
fit: {
|
|
25
27
|
type: 'enum',
|
|
@@ -319,7 +321,7 @@ const CanvasImageContent = (0, react_1.forwardRef)(({ src, width, height, fit =
|
|
|
319
321
|
return (jsx_runtime_1.jsx("canvas", { ...canvasProps, ref: canvasRef, width: width, height: height, className: className, style: style, id: id }));
|
|
320
322
|
});
|
|
321
323
|
CanvasImageContent.displayName = 'CanvasImageContent';
|
|
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) => {
|
|
324
|
+
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, cropLeft, cropRight, cropTop, cropBottom, stack, controls, _remotionInternalDocumentationLink, _remotionInternalCropComponentName, outlineRef, ...canvasProps }, ref) => {
|
|
323
325
|
if (!src) {
|
|
324
326
|
throw new Error('No "src" prop was passed to <CanvasImage>.');
|
|
325
327
|
}
|
|
@@ -338,7 +340,15 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, eff
|
|
|
338
340
|
styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
|
|
339
341
|
hideWhilePremounted: 'display-none',
|
|
340
342
|
});
|
|
341
|
-
|
|
343
|
+
const croppedStyle = (0, use_crop_style_js_1.useCropStyle)({
|
|
344
|
+
cropLeft,
|
|
345
|
+
cropRight,
|
|
346
|
+
cropTop,
|
|
347
|
+
cropBottom,
|
|
348
|
+
style: premountingStyle,
|
|
349
|
+
componentName: _remotionInternalCropComponentName !== null && _remotionInternalCropComponentName !== void 0 ? _remotionInternalCropComponentName : '<CanvasImage />',
|
|
350
|
+
});
|
|
351
|
+
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: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, refForOutline: outlineRef !== null && outlineRef !== void 0 ? outlineRef : null, ...canvasProps }) }) }));
|
|
342
352
|
});
|
|
343
353
|
/*
|
|
344
354
|
* @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, InteractivePremountProps } from '../Interactive.js';
|
|
5
|
-
type CanvasImageSequenceProps = InteractiveBaseProps & InteractivePremountProps & {
|
|
4
|
+
import type { InteractiveBaseProps, InteractiveCropProps, InteractivePremountProps } from '../Interactive.js';
|
|
5
|
+
type CanvasImageSequenceProps = InteractiveBaseProps & InteractiveCropProps & InteractivePremountProps & {
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated For internal use only.
|
|
8
8
|
*/
|
|
@@ -27,6 +27,10 @@ export type CanvasImageProps = CanvasImageSequenceProps & CanvasImageCanvasProps
|
|
|
27
27
|
* @deprecated For internal use only.
|
|
28
28
|
*/
|
|
29
29
|
readonly _remotionInternalDocumentationLink?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated For internal use only.
|
|
32
|
+
*/
|
|
33
|
+
readonly _remotionInternalCropComponentName?: string;
|
|
30
34
|
/**
|
|
31
35
|
* A React ref pointing to the element that Remotion Studio should use for
|
|
32
36
|
* drawing the selection outline in the preview.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { InteractiveBaseProps } from '../Interactive.js';
|
|
2
|
+
import type { InteractiveBaseProps, InteractiveCropProps } from '../Interactive.js';
|
|
3
3
|
import type { EffectsProp } from './effect-types.js';
|
|
4
4
|
type MandatoryProps = {
|
|
5
5
|
readonly width: number;
|
|
@@ -12,7 +12,7 @@ type OptionalProps = {
|
|
|
12
12
|
readonly style: React.CSSProperties | undefined;
|
|
13
13
|
readonly pixelDensity: number | undefined;
|
|
14
14
|
};
|
|
15
|
-
export type SolidProps = MandatoryProps & Partial<OptionalProps
|
|
15
|
+
export type SolidProps = MandatoryProps & Partial<OptionalProps> & InteractiveCropProps;
|
|
16
16
|
export declare const solidSchema: {
|
|
17
17
|
readonly 'style.transformOrigin': {
|
|
18
18
|
readonly type: "transform-origin";
|
|
@@ -84,6 +84,46 @@ export declare const solidSchema: {
|
|
|
84
84
|
readonly default: "transparent";
|
|
85
85
|
readonly description: "Color";
|
|
86
86
|
};
|
|
87
|
+
readonly cropLeft: {
|
|
88
|
+
readonly type: "number";
|
|
89
|
+
readonly default: 0;
|
|
90
|
+
readonly description: "Crop left";
|
|
91
|
+
readonly min: 0;
|
|
92
|
+
readonly max: 1;
|
|
93
|
+
readonly step: 0.01;
|
|
94
|
+
readonly hiddenFromList: false;
|
|
95
|
+
readonly keyframable: true;
|
|
96
|
+
};
|
|
97
|
+
readonly cropRight: {
|
|
98
|
+
readonly type: "number";
|
|
99
|
+
readonly default: 0;
|
|
100
|
+
readonly description: "Crop right";
|
|
101
|
+
readonly min: 0;
|
|
102
|
+
readonly max: 1;
|
|
103
|
+
readonly step: 0.01;
|
|
104
|
+
readonly hiddenFromList: false;
|
|
105
|
+
readonly keyframable: true;
|
|
106
|
+
};
|
|
107
|
+
readonly cropTop: {
|
|
108
|
+
readonly type: "number";
|
|
109
|
+
readonly default: 0;
|
|
110
|
+
readonly description: "Crop top";
|
|
111
|
+
readonly min: 0;
|
|
112
|
+
readonly max: 1;
|
|
113
|
+
readonly step: 0.01;
|
|
114
|
+
readonly hiddenFromList: false;
|
|
115
|
+
readonly keyframable: true;
|
|
116
|
+
};
|
|
117
|
+
readonly cropBottom: {
|
|
118
|
+
readonly type: "number";
|
|
119
|
+
readonly default: 0;
|
|
120
|
+
readonly description: "Crop bottom";
|
|
121
|
+
readonly min: 0;
|
|
122
|
+
readonly max: 1;
|
|
123
|
+
readonly step: 0.01;
|
|
124
|
+
readonly hiddenFromList: false;
|
|
125
|
+
readonly keyframable: true;
|
|
126
|
+
};
|
|
87
127
|
readonly durationInFrames: {
|
|
88
128
|
readonly type: "number";
|
|
89
129
|
readonly default: undefined;
|
|
@@ -144,5 +184,5 @@ export declare const solidSchema: {
|
|
|
144
184
|
readonly hiddenFromList: false;
|
|
145
185
|
};
|
|
146
186
|
};
|
|
147
|
-
export declare const Solid: React.ComponentType<MandatoryProps & Partial<OptionalProps> & InteractiveBaseProps & React.RefAttributes<HTMLCanvasElement>>;
|
|
187
|
+
export declare const Solid: React.ComponentType<MandatoryProps & Partial<OptionalProps> & InteractiveCropProps & InteractiveBaseProps & React.RefAttributes<HTMLCanvasElement>>;
|
|
148
188
|
export {};
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
|
|
7
7
|
const interactivity_schema_js_1 = require("../interactivity-schema.js");
|
|
8
8
|
const Sequence_js_1 = require("../Sequence.js");
|
|
9
|
+
const use_crop_style_js_1 = require("../use-crop-style.js");
|
|
9
10
|
const use_delay_render_js_1 = require("../use-delay-render.js");
|
|
10
11
|
const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js");
|
|
11
12
|
const run_effect_chain_js_1 = require("./run-effect-chain.js");
|
|
@@ -57,6 +58,7 @@ exports.solidSchema = {
|
|
|
57
58
|
...interactivity_schema_js_1.transformSchema,
|
|
58
59
|
...interactivity_schema_js_1.backgroundSchema,
|
|
59
60
|
...interactivity_schema_js_1.borderSchema,
|
|
61
|
+
...interactivity_schema_js_1.cropSchema,
|
|
60
62
|
};
|
|
61
63
|
const SolidInner = ({ color, width, height, effects = [], className, style, pixelDensity, overrideId, reference, }) => {
|
|
62
64
|
const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
@@ -149,7 +151,7 @@ const SolidInner = ({ color, width, height, effects = [], className, style, pixe
|
|
|
149
151
|
}, [height, style, width]);
|
|
150
152
|
return (jsx_runtime_1.jsx("canvas", { ref: canvasRef, width: canvasWidth, height: canvasHeight, className: className, style: canvasStyle }));
|
|
151
153
|
};
|
|
152
|
-
const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, height, width, className, durationInFrames, style, name, from, trimBefore, freeze, hidden, showInTimeline, pixelDensity, ...props }, ref) => {
|
|
154
|
+
const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, height, width, className, durationInFrames, style, name, from, trimBefore, freeze, hidden, showInTimeline, pixelDensity, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
|
|
153
155
|
var _a;
|
|
154
156
|
props;
|
|
155
157
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
@@ -157,7 +159,15 @@ const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, hei
|
|
|
157
159
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
158
160
|
return actualRef.current;
|
|
159
161
|
}, []);
|
|
160
|
-
|
|
162
|
+
const croppedStyle = (0, use_crop_style_js_1.useCropStyle)({
|
|
163
|
+
cropLeft,
|
|
164
|
+
cropRight,
|
|
165
|
+
cropTop,
|
|
166
|
+
cropBottom,
|
|
167
|
+
style: style !== null && style !== void 0 ? style : null,
|
|
168
|
+
componentName: '<Solid />',
|
|
169
|
+
});
|
|
170
|
+
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<Solid>', outlineRef: actualRef, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/solid", ...props, children: jsx_runtime_1.jsx(SolidInner, { reference: actualRef, overrideId: (_a = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _a !== void 0 ? _a : null, color: color, height: height, width: width, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, pixelDensity: pixelDensity }) }));
|
|
161
171
|
});
|
|
162
172
|
exports.Solid = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
|
|
163
173
|
Component: SolidOuter,
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ export { getRemotionEnvironment } from './get-remotion-environment.js';
|
|
|
128
128
|
export { getStaticFiles, StaticFile } from './get-static-files.js';
|
|
129
129
|
export * from './IFrame.js';
|
|
130
130
|
export { Img, ImgProps } from './Img.js';
|
|
131
|
-
export { Interactive, type InteractiveBaseProps, type InteractivePremountProps, type InteractiveProps, type InteractiveTransformProps, } from './Interactive.js';
|
|
131
|
+
export { Interactive, type InteractiveBaseProps, type InteractiveCropProps, type InteractivePremountProps, type InteractiveProps, type InteractiveTransformProps, } from './Interactive.js';
|
|
132
132
|
export * from './internals.js';
|
|
133
133
|
export { interpolateColors, type InterpolateColorsOptions, } from './interpolate-colors.js';
|
|
134
134
|
export { LogLevel } from './log.js';
|