remotion 4.0.534 → 4.0.536
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/README.md +1 -1
- package/dist/cjs/AbsoluteFill.d.ts +2 -7
- package/dist/cjs/AbsoluteFill.js +1 -1
- package/dist/cjs/Composition.js +15 -20
- package/dist/cjs/CompositionManager.d.ts +0 -4
- package/dist/cjs/CompositionManagerContext.d.ts +1 -6
- package/dist/cjs/CompositionManagerContext.js +0 -4
- package/dist/cjs/CompositionManagerProvider.js +77 -169
- package/dist/cjs/CompositionRegistryProvider.d.ts +5 -0
- package/dist/cjs/CompositionRegistryProvider.js +142 -0
- package/dist/cjs/DefaultPremountContext.d.ts +1 -0
- package/dist/cjs/DefaultPremountContext.js +6 -0
- package/dist/cjs/Folder.js +11 -20
- package/dist/cjs/HtmlInCanvas.d.ts +6 -4
- package/dist/cjs/HtmlInCanvas.js +179 -32
- package/dist/cjs/IFrame.js +40 -8
- package/dist/cjs/Img.d.ts +4 -2
- package/dist/cjs/Img.js +4 -3
- package/dist/cjs/Interactive.d.ts +31 -5
- package/dist/cjs/Interactive.js +40 -8
- package/dist/cjs/RemotionRoot.js +2 -1
- package/dist/cjs/Sequence.d.ts +2 -3
- package/dist/cjs/Sequence.js +117 -39
- package/dist/cjs/SequenceActivityBoundary.d.ts +10 -0
- package/dist/cjs/SequenceActivityBoundary.js +101 -0
- package/dist/cjs/SequenceActivityBudget.d.ts +13 -0
- package/dist/cjs/SequenceActivityBudget.js +196 -0
- package/dist/cjs/SequenceActivitySuspensionProvider.d.ts +4 -0
- package/dist/cjs/SequenceActivitySuspensionProvider.js +45 -0
- package/dist/cjs/SequenceManager.d.ts +9 -22
- package/dist/cjs/SequenceManager.js +54 -196
- package/dist/cjs/SequenceRegistryProvider.d.ts +4 -0
- package/dist/cjs/SequenceRegistryProvider.js +292 -0
- package/dist/cjs/Track.d.ts +10 -3
- package/dist/cjs/Track.js +8 -8
- package/dist/cjs/animated-image/AnimatedImage.d.ts +3 -2
- package/dist/cjs/animated-image/AnimatedImage.js +47 -34
- package/dist/cjs/animated-image/canvas.d.ts +2 -1
- package/dist/cjs/animated-image/canvas.js +2 -2
- package/dist/cjs/animated-image/props.d.ts +2 -1
- package/dist/cjs/asset-types.d.ts +4 -0
- package/dist/cjs/audio/AudioForPreview.js +54 -41
- package/dist/cjs/audio/get-audio-sync-anchor-tolerance.d.ts +1 -0
- package/dist/cjs/audio/get-audio-sync-anchor-tolerance.js +11 -0
- package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +1 -1
- package/dist/cjs/audio/use-audio-context.js +26 -7
- package/dist/cjs/canvas-image/CanvasImage.d.ts +3 -2
- package/dist/cjs/canvas-image/CanvasImage.js +5 -4
- package/dist/cjs/canvas-image/props.d.ts +2 -1
- package/dist/cjs/committed-metadata.d.ts +68 -0
- package/dist/cjs/committed-metadata.js +39 -0
- package/dist/cjs/component-identity.d.ts +6 -0
- package/dist/cjs/component-identity.js +39 -0
- package/dist/cjs/composition-registry-fallback.d.ts +14 -0
- package/dist/cjs/composition-registry-fallback.js +35 -0
- package/dist/cjs/create-element-source-proxy.d.ts +4 -0
- package/dist/cjs/create-element-source-proxy.js +46 -0
- package/dist/cjs/default-premount-in-seconds.d.ts +3 -0
- package/dist/cjs/default-premount-in-seconds.js +12 -0
- package/dist/cjs/effects/Solid.d.ts +3 -2
- package/dist/cjs/effects/Solid.js +5 -4
- package/dist/cjs/effects/canvas-pool.d.ts +1 -0
- package/dist/cjs/effects/canvas-pool.js +15 -10
- package/dist/cjs/effects/effect-types.d.ts +4 -0
- package/dist/cjs/effects/index.d.ts +1 -1
- package/dist/cjs/effects/run-effect-chain.d.ts +3 -1
- package/dist/cjs/effects/run-effect-chain.js +94 -56
- package/dist/cjs/effects/use-effect-chain-state.d.ts +2 -1
- package/dist/cjs/effects/use-effect-chain-state.js +11 -2
- package/dist/cjs/effects/use-memoized-effects.js +96 -17
- package/dist/cjs/enable-sequence-stack-traces.d.ts +2 -8
- package/dist/cjs/enable-sequence-stack-traces.js +7 -38
- package/dist/cjs/freeze.js +4 -1
- package/dist/cjs/index.d.ts +1 -3
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/interactivity-schema.d.ts +50 -14
- package/dist/cjs/interactivity-schema.js +32 -4
- package/dist/cjs/internals.d.ts +110 -33
- package/dist/cjs/internals.js +29 -8
- package/dist/cjs/interpolate-keyframed-status.d.ts +4 -0
- package/dist/cjs/interpolate-keyframed-status.js +38 -1
- package/dist/cjs/interpolate.d.ts +12 -0
- package/dist/cjs/interpolate.js +15 -1
- package/dist/cjs/no-react.d.ts +5 -1
- package/dist/cjs/no-react.js +6 -0
- package/dist/cjs/optimistic-sequence-deletion.d.ts +17 -0
- package/dist/cjs/optimistic-sequence-deletion.js +114 -0
- package/dist/cjs/registry-store.d.ts +17 -0
- package/dist/cjs/registry-store.js +68 -0
- package/dist/cjs/sequence-activity-context.d.ts +13 -0
- package/dist/cjs/sequence-activity-context.js +21 -0
- package/dist/cjs/sequence-activity-defaults.d.ts +1 -0
- package/dist/cjs/sequence-activity-defaults.js +4 -0
- package/dist/cjs/sequence-outline.js +1 -2
- package/dist/cjs/sequence-registry-context.d.ts +26 -0
- package/dist/cjs/sequence-registry-context.js +71 -0
- package/dist/cjs/series/index.d.ts +2 -1
- package/dist/cjs/series/index.js +12 -4
- package/dist/cjs/timeline-position-state.js +11 -3
- package/dist/cjs/timeline-track-context.d.ts +1 -1
- package/dist/cjs/timeline-track-context.js +1 -2
- package/dist/cjs/use-lazy-component.js +29 -15
- package/dist/cjs/use-media-in-timeline.d.ts +7 -14
- package/dist/cjs/use-media-in-timeline.js +15 -117
- package/dist/cjs/use-premounting.js +3 -4
- package/dist/cjs/use-schema.js +3 -1
- package/dist/cjs/use-sequence-registration.d.ts +1 -1
- package/dist/cjs/use-sequence-registration.js +22 -6
- package/dist/cjs/use-timeline-seek.d.ts +1 -0
- package/dist/cjs/use-timeline-seek.js +10 -0
- package/dist/cjs/use-video.d.ts +7 -2
- package/dist/cjs/use-video.js +11 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +55 -42
- package/dist/cjs/video/seek-until-right.js +11 -7
- package/dist/cjs/with-interactivity-schema.js +40 -14
- package/dist/cjs/wrap-remotion-context.d.ts +15 -3
- package/dist/cjs/wrap-remotion-context.js +101 -7
- package/dist/esm/index.mjs +3562 -2347
- package/dist/esm/no-react.mjs +74 -37
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/dist/cjs/nonce.d.ts +0 -11
- package/dist/cjs/nonce.js +0 -42
- package/dist/cjs/sequence-order-marker.d.ts +0 -58
- package/dist/cjs/sequence-order-marker.js +0 -44
package/dist/cjs/Folder.js
CHANGED
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Folder = exports.FolderContext = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const committed_metadata_js_1 = require("./committed-metadata.js");
|
|
7
|
+
const composition_registry_fallback_js_1 = require("./composition-registry-fallback.js");
|
|
8
8
|
const truthy_js_1 = require("./truthy.js");
|
|
9
|
-
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
10
9
|
const validate_folder_name_js_1 = require("./validation/validate-folder-name.js");
|
|
11
10
|
exports.FolderContext = (0, react_1.createContext)({
|
|
12
11
|
folderName: null,
|
|
13
12
|
parentName: null,
|
|
14
13
|
});
|
|
14
|
+
const FolderContextProvider = (0, committed_metadata_js_1.withCommittedMetadata)(exports.FolderContext.Provider);
|
|
15
15
|
/*
|
|
16
16
|
* @description By wrapping a <Composition /> inside a <Folder />, you can visually categorize it in your sidebar, should you have many compositions.
|
|
17
17
|
* @see [Documentation](https://remotion.dev/docs/folder)
|
|
@@ -20,8 +20,6 @@ const Folder = (props) => {
|
|
|
20
20
|
var _a;
|
|
21
21
|
const { name, children } = props;
|
|
22
22
|
const parent = (0, react_1.useContext)(exports.FolderContext);
|
|
23
|
-
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
|
|
24
|
-
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
25
23
|
const stack = (_a = props
|
|
26
24
|
._remotionInternalStack) !== null && _a !== void 0 ? _a : null;
|
|
27
25
|
(0, validate_folder_name_js_1.validateFolderName)(name);
|
|
@@ -33,20 +31,13 @@ const Folder = (props) => {
|
|
|
33
31
|
parentName,
|
|
34
32
|
};
|
|
35
33
|
}, [name, parentName]);
|
|
36
|
-
(0, react_1.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
parentName,
|
|
45
|
-
registerFolder,
|
|
46
|
-
unregisterFolder,
|
|
47
|
-
stack,
|
|
48
|
-
]);
|
|
49
|
-
const folder = (jsx_runtime_1.jsx(exports.FolderContext.Provider, { value: value, children: children }));
|
|
50
|
-
return environment.isStudio ? (jsx_runtime_1.jsx(sequence_order_marker_js_1.FolderOrderMarker, { folderId: (0, sequence_order_marker_js_1.getFolderOrderId)({ name, parent: parentName }), children: folder })) : (folder);
|
|
34
|
+
const registration = (0, react_1.useMemo)(() => ({ name, parent: parentName, order: null, stack }), [name, parentName, stack]);
|
|
35
|
+
const metadata = (0, react_1.useMemo)(() => ({
|
|
36
|
+
type: 'folder',
|
|
37
|
+
id: (0, committed_metadata_js_1.getFolderOrderId)({ name, parent: parentName }),
|
|
38
|
+
value: registration,
|
|
39
|
+
}), [name, parentName, registration]);
|
|
40
|
+
(0, composition_registry_fallback_js_1.useCommittedCompositionEntry)(metadata);
|
|
41
|
+
return (jsx_runtime_1.jsx(FolderContextProvider, { value: value, _remotionCommitMetadata: metadata, children: children }));
|
|
51
42
|
};
|
|
52
43
|
exports.Folder = Folder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { EffectsProp } from './effects/effect-types.js';
|
|
2
|
+
import type { EffectsProp, EffectsOutputSize } from './effects/effect-types.js';
|
|
3
3
|
import type { InteractiveBaseProps, InteractiveCropProps } from './Interactive.js';
|
|
4
4
|
import type { AbsoluteFillLayout } from './Sequence.js';
|
|
5
5
|
declare global {
|
|
@@ -63,8 +63,8 @@ declare global {
|
|
|
63
63
|
}
|
|
64
64
|
export type HtmlInCanvasOnPaintParams = {
|
|
65
65
|
/**
|
|
66
|
-
* The
|
|
67
|
-
*
|
|
66
|
+
* The paint target. During rendering, its pixels are copied to the layout
|
|
67
|
+
* `<canvas>` after painting; during preview, it controls that canvas directly.
|
|
68
68
|
*/
|
|
69
69
|
readonly canvas: OffscreenCanvas;
|
|
70
70
|
readonly element: HTMLDivElement;
|
|
@@ -85,6 +85,7 @@ export type HtmlInCanvasProps = Omit<InteractiveBaseProps, 'children'> & Interac
|
|
|
85
85
|
readonly width: number;
|
|
86
86
|
readonly height: number;
|
|
87
87
|
readonly effects?: EffectsProp;
|
|
88
|
+
readonly effectsOutputSize?: EffectsOutputSize;
|
|
88
89
|
readonly children: React.ReactNode;
|
|
89
90
|
readonly onPaint?: HtmlInCanvasOnPaint;
|
|
90
91
|
readonly onInit?: HtmlInCanvasOnInit;
|
|
@@ -205,7 +206,7 @@ export declare const htmlInCanvasSchema: {
|
|
|
205
206
|
};
|
|
206
207
|
readonly premountFor: {
|
|
207
208
|
readonly type: "number";
|
|
208
|
-
readonly default:
|
|
209
|
+
readonly default: undefined;
|
|
209
210
|
readonly description: "Premount For";
|
|
210
211
|
readonly min: 0;
|
|
211
212
|
readonly step: 1;
|
|
@@ -313,6 +314,7 @@ export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<Interact
|
|
|
313
314
|
readonly width: number;
|
|
314
315
|
readonly height: number;
|
|
315
316
|
readonly effects?: EffectsProp | undefined;
|
|
317
|
+
readonly effectsOutputSize?: EffectsOutputSize | undefined;
|
|
316
318
|
readonly children: React.ReactNode;
|
|
317
319
|
readonly onPaint?: HtmlInCanvasOnPaint | undefined;
|
|
318
320
|
readonly onInit?: HtmlInCanvasOnInit | undefined;
|
package/dist/cjs/HtmlInCanvas.js
CHANGED
|
@@ -12,6 +12,7 @@ const interactivity_schema_js_1 = require("./interactivity-schema.js");
|
|
|
12
12
|
const resolve_sequence_duration_js_1 = require("./resolve-sequence-duration.js");
|
|
13
13
|
const Sequence_js_1 = require("./Sequence.js");
|
|
14
14
|
const use_crop_style_js_1 = require("./use-crop-style.js");
|
|
15
|
+
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
15
16
|
const use_delay_render_js_1 = require("./use-delay-render.js");
|
|
16
17
|
const use_premounting_js_1 = require("./use-premounting.js");
|
|
17
18
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
@@ -144,13 +145,12 @@ const defaultOnPaint = ({ canvas, elementImage, }) => {
|
|
|
144
145
|
ctx.reset();
|
|
145
146
|
ctx.drawElementImage(elementImage, 0, 0);
|
|
146
147
|
};
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, children, canvasSiblings, onPaint, onInit, pixelDensity, controls, style, }, ref) => {
|
|
148
|
+
const HtmlInCanvasAncestorContext = (0, react_1.createContext)(null);
|
|
149
|
+
const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, effectsOutputSize, children, canvasSiblings, onPaint, onInit, pixelDensity, controls, style, renderFrame, }, ref) => {
|
|
150
150
|
var _a, _b;
|
|
151
|
-
const
|
|
151
|
+
const ancestorPaintState = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
|
|
152
152
|
assertHtmlInCanvasDimensions(width, height);
|
|
153
|
-
if (
|
|
153
|
+
if (ancestorPaintState && !(0, exports.isHtmlInCanvasNestingSupported)()) {
|
|
154
154
|
throw new Error(`Nested <HtmlInCanvas> components require Chrome ${MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS} or newer with HTML-in-canvas enabled.`);
|
|
155
155
|
}
|
|
156
156
|
const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
|
|
@@ -160,23 +160,68 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
160
160
|
const { isClientSideRendering, isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
161
161
|
const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
|
|
162
162
|
const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
|
|
163
|
+
const paintTargetMode = usesDirectLayoutCanvas
|
|
164
|
+
? 'direct'
|
|
165
|
+
: isRendering
|
|
166
|
+
? 'copied'
|
|
167
|
+
: 'transferred';
|
|
163
168
|
if (!(0, exports.isHtmlInCanvasSupported)()) {
|
|
164
169
|
cancelRender(new Error((0, exports.getHtmlInCanvasUnsupportedMessage)()));
|
|
165
170
|
}
|
|
166
171
|
const canvas2dRef = (0, react_1.useRef)(null);
|
|
172
|
+
const outputCanvasRef = (0, react_1.useRef)(null);
|
|
167
173
|
const paintTargetRef = (0, react_1.useRef)(null);
|
|
168
174
|
const divRef = (0, react_1.useRef)(null);
|
|
169
|
-
const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}-${
|
|
170
|
-
const
|
|
171
|
-
|
|
175
|
+
const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}-${paintTargetMode}`;
|
|
176
|
+
const paintState = (0, react_1.useMemo)(() => {
|
|
177
|
+
const state = {
|
|
178
|
+
pendingChildren: 0,
|
|
179
|
+
generation: 0,
|
|
180
|
+
release: null,
|
|
181
|
+
blockPaint: () => {
|
|
182
|
+
state.pendingChildren++;
|
|
183
|
+
state.generation++;
|
|
184
|
+
if (state.release === null) {
|
|
185
|
+
const handle = delayRender('waiting for nested HtmlInCanvas paint');
|
|
186
|
+
const releaseAncestor = ancestorPaintState === null || ancestorPaintState === void 0 ? void 0 : ancestorPaintState.blockPaint();
|
|
187
|
+
state.release = () => {
|
|
188
|
+
continueRender(handle);
|
|
189
|
+
releaseAncestor === null || releaseAncestor === void 0 ? void 0 : releaseAncestor();
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
let released = false;
|
|
193
|
+
return () => {
|
|
194
|
+
var _a, _b;
|
|
195
|
+
if (released) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
released = true;
|
|
199
|
+
state.pendingChildren--;
|
|
200
|
+
if (state.pendingChildren === 0) {
|
|
201
|
+
// A child can finish asynchronously after our paint record was
|
|
202
|
+
// taken. Keep capture blocked until we paint its finished pixels.
|
|
203
|
+
(_b = (_a = canvas2dRef.current) === null || _a === void 0 ? void 0 : _a.requestPaint) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
return state;
|
|
209
|
+
}, [continueRender, delayRender, ancestorPaintState]);
|
|
210
|
+
const setVisibleCanvasRef = (0, react_1.useCallback)((node) => {
|
|
211
|
+
if (paintTargetMode === 'copied') {
|
|
212
|
+
outputCanvasRef.current = node;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
canvas2dRef.current = node;
|
|
216
|
+
}
|
|
172
217
|
if (typeof ref === 'function') {
|
|
173
218
|
ref(node);
|
|
174
219
|
}
|
|
175
220
|
else if (ref) {
|
|
176
221
|
ref.current = node;
|
|
177
222
|
}
|
|
178
|
-
}, [ref]);
|
|
179
|
-
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
|
|
223
|
+
}, [ref, paintTargetMode]);
|
|
224
|
+
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
|
|
180
225
|
const memoizedEffects = (0, use_memoized_effects_js_1.useMemoizedEffects)({
|
|
181
226
|
effects,
|
|
182
227
|
overrideId: (_a = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _a !== void 0 ? _a : null,
|
|
@@ -192,7 +237,13 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
192
237
|
const initializedRef = (0, react_1.useRef)(false);
|
|
193
238
|
const onInitCleanupRef = (0, react_1.useRef)(null);
|
|
194
239
|
const unmountedRef = (0, react_1.useRef)(false);
|
|
240
|
+
const paintingTargets = (0, react_1.useRef)(new WeakMap());
|
|
195
241
|
const onPaintCb = (0, react_1.useCallback)(async () => {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
if (isRendering && paintState.pendingChildren > 0) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const childrenGeneration = paintState.generation;
|
|
196
247
|
const element = divRef.current;
|
|
197
248
|
if (!element) {
|
|
198
249
|
throw new Error('Canvas or scene element not found');
|
|
@@ -201,16 +252,32 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
201
252
|
if (!paintTarget) {
|
|
202
253
|
throw new Error('HtmlInCanvas: paint target is not ready because the canvas is remounting');
|
|
203
254
|
}
|
|
255
|
+
const inProgress = paintingTargets.current.get(paintTarget);
|
|
256
|
+
if (isRendering && inProgress) {
|
|
257
|
+
// In particular, do not run onPaint while an earlier event is still
|
|
258
|
+
// awaiting onInit (e.g. a WebGPU device).
|
|
259
|
+
inProgress.repaint = true;
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const painting = { repaint: false };
|
|
263
|
+
if (isRendering) {
|
|
264
|
+
paintingTargets.current.set(paintTarget, painting);
|
|
265
|
+
}
|
|
204
266
|
resizePaintTarget({
|
|
205
267
|
target: paintTarget,
|
|
206
268
|
width: canvasWidth,
|
|
207
269
|
height: canvasHeight,
|
|
208
270
|
});
|
|
271
|
+
const releaseAncestor = isRendering
|
|
272
|
+
? ancestorPaintState === null || ancestorPaintState === void 0 ? void 0 : ancestorPaintState.blockPaint()
|
|
273
|
+
: null;
|
|
274
|
+
let canReleasePaint = false;
|
|
209
275
|
try {
|
|
210
276
|
const placeholderCanvas = canvas2dRef.current;
|
|
211
277
|
if (!placeholderCanvas) {
|
|
212
278
|
throw new Error('Canvas not found');
|
|
213
279
|
}
|
|
280
|
+
const outputCanvas = outputCanvasRef.current;
|
|
214
281
|
const handle = delayRender('onPaint');
|
|
215
282
|
if (!initializedRef.current) {
|
|
216
283
|
const currentOnInit = onInitRef.current;
|
|
@@ -230,6 +297,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
230
297
|
canRetryMissingPaintRecord) {
|
|
231
298
|
// The web renderer explicitly drives additional paint cycles, so a
|
|
232
299
|
// transient missing record can be retried without failing the render.
|
|
300
|
+
canReleasePaint = true;
|
|
233
301
|
continueRender(handle);
|
|
234
302
|
return;
|
|
235
303
|
}
|
|
@@ -252,12 +320,13 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
252
320
|
if (typeof cleanup !== 'function') {
|
|
253
321
|
throw new Error('HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.');
|
|
254
322
|
}
|
|
255
|
-
if (unmountedRef.current
|
|
323
|
+
if (unmountedRef.current ||
|
|
324
|
+
paintTargetRef.current !== paintTarget) {
|
|
256
325
|
cleanup();
|
|
326
|
+
continueRender(handle);
|
|
327
|
+
return;
|
|
257
328
|
}
|
|
258
|
-
|
|
259
|
-
onInitCleanupRef.current = cleanup;
|
|
260
|
-
}
|
|
329
|
+
onInitCleanupRef.current = cleanup;
|
|
261
330
|
}
|
|
262
331
|
finally {
|
|
263
332
|
initImage.close();
|
|
@@ -273,6 +342,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
273
342
|
// element is outside the viewport (no cached paint record).
|
|
274
343
|
// Skip this paint cycle — the canvas retains its last state.
|
|
275
344
|
if (isMissingPaintRecordError(error) && canRetryMissingPaintRecord) {
|
|
345
|
+
canReleasePaint = true;
|
|
276
346
|
continueRender(handle);
|
|
277
347
|
return;
|
|
278
348
|
}
|
|
@@ -321,11 +391,39 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
321
391
|
finally {
|
|
322
392
|
elImage.close();
|
|
323
393
|
}
|
|
394
|
+
if (paintTargetMode === 'copied' &&
|
|
395
|
+
paintTargetRef.current === paintTarget &&
|
|
396
|
+
outputCanvas) {
|
|
397
|
+
const ctx = outputCanvas.getContext('2d');
|
|
398
|
+
if (!ctx) {
|
|
399
|
+
throw new Error('HtmlInCanvas: could not get layout canvas context');
|
|
400
|
+
}
|
|
401
|
+
// A transferred OffscreenCanvas submits its pixels asynchronously.
|
|
402
|
+
// Copy before releasing the render handle so capture sees this paint.
|
|
403
|
+
// drawImage preserves the source for handlers that paint incrementally.
|
|
404
|
+
ctx.reset();
|
|
405
|
+
ctx.drawImage(paintTarget, 0, 0);
|
|
406
|
+
}
|
|
407
|
+
canReleasePaint = true;
|
|
324
408
|
continueRender(handle);
|
|
325
409
|
}
|
|
326
410
|
catch (error) {
|
|
327
411
|
cancelRender(error);
|
|
328
412
|
}
|
|
413
|
+
finally {
|
|
414
|
+
if (canReleasePaint &&
|
|
415
|
+
paintState.pendingChildren === 0 &&
|
|
416
|
+
paintState.generation === childrenGeneration) {
|
|
417
|
+
const { release } = paintState;
|
|
418
|
+
paintState.release = null;
|
|
419
|
+
release === null || release === void 0 ? void 0 : release();
|
|
420
|
+
}
|
|
421
|
+
releaseAncestor === null || releaseAncestor === void 0 ? void 0 : releaseAncestor();
|
|
422
|
+
paintingTargets.current.delete(paintTarget);
|
|
423
|
+
if (painting.repaint && paintTargetRef.current === paintTarget) {
|
|
424
|
+
(_b = (_a = canvas2dRef.current) === null || _a === void 0 ? void 0 : _a.requestPaint) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
329
427
|
}, [
|
|
330
428
|
canvasHeight,
|
|
331
429
|
canvasWidth,
|
|
@@ -335,9 +433,22 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
335
433
|
delayRender,
|
|
336
434
|
resolvedPixelDensity,
|
|
337
435
|
canRetryMissingPaintRecord,
|
|
436
|
+
paintTargetMode,
|
|
437
|
+
isRendering,
|
|
438
|
+
paintState,
|
|
439
|
+
ancestorPaintState,
|
|
338
440
|
]);
|
|
441
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
442
|
+
return () => {
|
|
443
|
+
var _a;
|
|
444
|
+
(_a = paintState.release) === null || _a === void 0 ? void 0 : _a.call(paintState);
|
|
445
|
+
paintState.release = null;
|
|
446
|
+
};
|
|
447
|
+
}, [paintState]);
|
|
339
448
|
// Default paint handlers draw synchronously on the layout canvas itself.
|
|
340
|
-
//
|
|
449
|
+
// ElementImage can only be drawn into its associated canvas, so custom
|
|
450
|
+
// handlers retain a transferred target. Rendering copies it to a separate
|
|
451
|
+
// visible canvas without waiting for the transferred canvas to present.
|
|
341
452
|
(0, react_1.useLayoutEffect)(() => {
|
|
342
453
|
var _a;
|
|
343
454
|
const placeholder = canvas2dRef.current;
|
|
@@ -347,7 +458,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
347
458
|
placeholder.setAttribute('content', 'drawable');
|
|
348
459
|
placeholder.layoutSubtree = true;
|
|
349
460
|
(_a = divRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute('drawable', '');
|
|
350
|
-
const paintTarget =
|
|
461
|
+
const paintTarget = paintTargetMode === 'direct'
|
|
351
462
|
? placeholder
|
|
352
463
|
: getTransferredOffscreenCanvas(placeholder);
|
|
353
464
|
paintTargetRef.current = paintTarget;
|
|
@@ -368,13 +479,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
368
479
|
(_a = onInitCleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(onInitCleanupRef);
|
|
369
480
|
onInitCleanupRef.current = null;
|
|
370
481
|
};
|
|
371
|
-
}, [
|
|
372
|
-
onPaintCb,
|
|
373
|
-
cancelRender,
|
|
374
|
-
canvasWidth,
|
|
375
|
-
canvasHeight,
|
|
376
|
-
usesDirectLayoutCanvas,
|
|
377
|
-
]);
|
|
482
|
+
}, [onPaintCb, cancelRender, canvasWidth, canvasHeight, paintTargetMode]);
|
|
378
483
|
const onPaintChangedRef = (0, react_1.useRef)(false);
|
|
379
484
|
(0, react_1.useLayoutEffect)(() => {
|
|
380
485
|
var _a;
|
|
@@ -389,18 +494,37 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
389
494
|
(_a = canvas.requestPaint) === null || _a === void 0 ? void 0 : _a.call(canvas);
|
|
390
495
|
}, [onPaint, memoizedEffects]);
|
|
391
496
|
(0, react_1.useLayoutEffect)(() => {
|
|
497
|
+
var _a;
|
|
392
498
|
const canvas = canvas2dRef.current;
|
|
393
499
|
if (!canvas) {
|
|
394
500
|
return;
|
|
395
501
|
}
|
|
396
|
-
|
|
397
|
-
canvas.
|
|
502
|
+
// Block capture before the paint event begins, including updates that
|
|
503
|
+
// keep the same canvas. onPaintCb holds its own handle through async work.
|
|
504
|
+
const handle = delayRender('waiting for HtmlInCanvas paint');
|
|
505
|
+
const releaseAncestor = isRendering
|
|
506
|
+
? ancestorPaintState === null || ancestorPaintState === void 0 ? void 0 : ancestorPaintState.blockPaint()
|
|
507
|
+
: null;
|
|
508
|
+
const onPainted = () => {
|
|
398
509
|
continueRender(handle);
|
|
399
|
-
|
|
510
|
+
releaseAncestor === null || releaseAncestor === void 0 ? void 0 : releaseAncestor();
|
|
511
|
+
};
|
|
512
|
+
canvas.addEventListener('paint', onPainted, { once: true });
|
|
513
|
+
(_a = canvas.requestPaint) === null || _a === void 0 ? void 0 : _a.call(canvas);
|
|
400
514
|
return () => {
|
|
401
|
-
|
|
515
|
+
canvas.removeEventListener('paint', onPainted);
|
|
516
|
+
onPainted();
|
|
402
517
|
};
|
|
403
|
-
}, [
|
|
518
|
+
}, [
|
|
519
|
+
width,
|
|
520
|
+
height,
|
|
521
|
+
continueRender,
|
|
522
|
+
delayRender,
|
|
523
|
+
canvasSizeKey,
|
|
524
|
+
renderFrame,
|
|
525
|
+
isRendering,
|
|
526
|
+
ancestorPaintState,
|
|
527
|
+
]);
|
|
404
528
|
const innerStyle = (0, react_1.useMemo)(() => {
|
|
405
529
|
return {
|
|
406
530
|
width,
|
|
@@ -414,12 +538,35 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
414
538
|
...(style !== null && style !== void 0 ? style : {}),
|
|
415
539
|
};
|
|
416
540
|
}, [height, style, width]);
|
|
417
|
-
return (jsx_runtime_1.
|
|
418
|
-
|
|
541
|
+
return (jsx_runtime_1.jsxs(HtmlInCanvasAncestorContext.Provider, { value: paintState, children: [
|
|
542
|
+
jsx_runtime_1.jsxs("canvas", { ref: paintTargetMode === 'copied' ? canvas2dRef : setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: paintTargetMode === 'copied'
|
|
543
|
+
? {
|
|
544
|
+
...canvasStyle,
|
|
545
|
+
position: 'absolute',
|
|
546
|
+
// Hide the source canvas while keeping its drawable children
|
|
547
|
+
// visible to captureElementImage. opacity: 0 drops paint records.
|
|
548
|
+
visibility: 'hidden',
|
|
549
|
+
pointerEvents: 'none',
|
|
550
|
+
}
|
|
551
|
+
: canvasStyle, children: [
|
|
552
|
+
jsx_runtime_1.jsx("div", { ref: divRef, style: paintTargetMode === 'copied'
|
|
553
|
+
? { ...innerStyle, visibility: 'visible' }
|
|
554
|
+
: innerStyle, children: children }), canvasSiblings] }, canvasSizeKey), paintTargetMode === 'copied' ? (jsx_runtime_1.jsx("canvas", { ref: setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle }, `output-${canvasSizeKey}`)) : null] }));
|
|
419
555
|
});
|
|
420
556
|
HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
|
|
421
|
-
|
|
557
|
+
// Subscribe to frame changes only while rendering. Preview keeps relying on
|
|
558
|
+
// the browser's paints and does not need a capture barrier on every frame.
|
|
559
|
+
const HtmlInCanvasContentForRendering = (0, react_1.forwardRef)((props, ref) => {
|
|
560
|
+
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
561
|
+
return jsx_runtime_1.jsx(HtmlInCanvasContent, { ...props, ref: ref, renderFrame: frame });
|
|
562
|
+
});
|
|
563
|
+
HtmlInCanvasContentForRendering.displayName = 'HtmlInCanvasContentForRendering';
|
|
564
|
+
const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], effectsOutputSize, children, onPaint, onInit, pixelDensity, _remotionInternalCanvasSiblings, controls, style, cropLeft, cropRight, cropTop, cropBottom, durationInFrames, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, name, ...sequenceProps }, ref) => {
|
|
422
565
|
var _a;
|
|
566
|
+
const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
567
|
+
const Content = isRendering
|
|
568
|
+
? HtmlInCanvasContentForRendering
|
|
569
|
+
: HtmlInCanvasContent;
|
|
423
570
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
424
571
|
const actualRef = (0, react_1.useRef)(null);
|
|
425
572
|
const setCanvasRef = (0, react_1.useCallback)((node) => {
|
|
@@ -453,7 +600,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
|
|
|
453
600
|
style: premountingStyle,
|
|
454
601
|
componentName: '<HtmlInCanvas />',
|
|
455
602
|
});
|
|
456
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(
|
|
603
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(Content, { ref: setCanvasRef, renderFrame: null, width: width, height: height, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, canvasSiblings: _remotionInternalCanvasSiblings !== null && _remotionInternalCanvasSiblings !== void 0 ? _remotionInternalCanvasSiblings : null, controls: controls, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, children: children }) }) }));
|
|
457
604
|
});
|
|
458
605
|
HtmlInCanvasInner.displayName = 'HtmlInCanvas';
|
|
459
606
|
exports.htmlInCanvasSchema = {
|
package/dist/cjs/IFrame.js
CHANGED
|
@@ -6,16 +6,48 @@ const react_1 = require("react");
|
|
|
6
6
|
const use_delay_render_js_1 = require("./use-delay-render.js");
|
|
7
7
|
const IFrameRefForwarding = ({ onLoad, onError, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }, ref) => {
|
|
8
8
|
const { delayRender, continueRender } = (0, use_delay_render_js_1.useDelayRender)();
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const handle = (0, react_1.useRef)(null);
|
|
10
|
+
const loadedSource = (0, react_1.useRef)(null);
|
|
11
|
+
const { src, srcDoc } = props;
|
|
12
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
if (((_a = loadedSource.current) === null || _a === void 0 ? void 0 : _a.src) === src &&
|
|
15
|
+
((_b = loadedSource.current) === null || _b === void 0 ? void 0 : _b.srcDoc) === srcDoc &&
|
|
16
|
+
loadedSource.current !== null) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const newHandle = delayRender(`Loading <IFrame> with source ${src}`, {
|
|
20
|
+
retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
|
|
21
|
+
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
|
|
22
|
+
});
|
|
23
|
+
loadedSource.current = null;
|
|
24
|
+
handle.current = newHandle;
|
|
25
|
+
return () => {
|
|
26
|
+
continueRender(newHandle);
|
|
27
|
+
handle.current = null;
|
|
28
|
+
};
|
|
29
|
+
}, [
|
|
30
|
+
continueRender,
|
|
31
|
+
delayRender,
|
|
32
|
+
delayRenderRetries,
|
|
33
|
+
delayRenderTimeoutInMilliseconds,
|
|
34
|
+
src,
|
|
35
|
+
srcDoc,
|
|
36
|
+
]);
|
|
13
37
|
const didLoad = (0, react_1.useCallback)((e) => {
|
|
14
|
-
|
|
38
|
+
loadedSource.current = { src, srcDoc };
|
|
39
|
+
if (handle.current !== null) {
|
|
40
|
+
continueRender(handle.current);
|
|
41
|
+
handle.current = null;
|
|
42
|
+
}
|
|
15
43
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
|
|
16
|
-
}, [
|
|
44
|
+
}, [onLoad, continueRender, src, srcDoc]);
|
|
17
45
|
const didGetError = (0, react_1.useCallback)((e) => {
|
|
18
|
-
|
|
46
|
+
loadedSource.current = { src, srcDoc };
|
|
47
|
+
if (handle.current !== null) {
|
|
48
|
+
continueRender(handle.current);
|
|
49
|
+
handle.current = null;
|
|
50
|
+
}
|
|
19
51
|
if (onError) {
|
|
20
52
|
onError(e);
|
|
21
53
|
}
|
|
@@ -23,7 +55,7 @@ const IFrameRefForwarding = ({ onLoad, onError, delayRenderRetries, delayRenderT
|
|
|
23
55
|
// eslint-disable-next-line no-console
|
|
24
56
|
console.error('Error loading iframe:', e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
25
57
|
}
|
|
26
|
-
}, [
|
|
58
|
+
}, [onError, continueRender, src, srcDoc]);
|
|
27
59
|
return (jsx_runtime_1.jsx("iframe", { referrerPolicy: "strict-origin-when-cross-origin", ...props, ref: ref, onError: didGetError, onLoad: didLoad }));
|
|
28
60
|
};
|
|
29
61
|
/*
|
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { EffectsProp } from './effects/effect-types.js';
|
|
2
|
+
import type { EffectsProp, EffectsOutputSize } from './effects/effect-types.js';
|
|
3
3
|
import type { InteractiveBaseProps, InteractiveCropProps, InteractivePremountProps } from './Interactive.js';
|
|
4
4
|
type NativeImgProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'>;
|
|
5
5
|
export type ImgProps = NativeImgProps & {
|
|
@@ -11,6 +11,7 @@ export type ImgProps = NativeImgProps & {
|
|
|
11
11
|
readonly onImageError?: (error: Error) => void;
|
|
12
12
|
readonly src: string;
|
|
13
13
|
readonly effects?: EffectsProp;
|
|
14
|
+
readonly effectsOutputSize?: EffectsOutputSize;
|
|
14
15
|
readonly showInTimeline?: boolean;
|
|
15
16
|
readonly name?: string;
|
|
16
17
|
} & Omit<InteractiveBaseProps, 'playbackRate'> & InteractiveCropProps & InteractivePremountProps;
|
|
@@ -128,7 +129,7 @@ export declare const imgSchema: {
|
|
|
128
129
|
};
|
|
129
130
|
readonly premountFor: {
|
|
130
131
|
readonly type: "number";
|
|
131
|
-
readonly default:
|
|
132
|
+
readonly default: undefined;
|
|
132
133
|
readonly description: "Premount For";
|
|
133
134
|
readonly min: 0;
|
|
134
135
|
readonly step: 1;
|
|
@@ -229,6 +230,7 @@ export declare const Img: React.ComponentType<NativeImgProps & {
|
|
|
229
230
|
readonly onImageError?: ((error: Error) => void) | undefined;
|
|
230
231
|
readonly src: string;
|
|
231
232
|
readonly effects?: EffectsProp | undefined;
|
|
233
|
+
readonly effectsOutputSize?: EffectsOutputSize | undefined;
|
|
232
234
|
readonly showInTimeline?: boolean | undefined;
|
|
233
235
|
readonly name?: string | undefined;
|
|
234
236
|
} & Omit<InteractiveBaseProps, "playbackRate"> & InteractiveCropProps & InteractivePremountProps>;
|
package/dist/cjs/Img.js
CHANGED
|
@@ -10,6 +10,7 @@ const get_cross_origin_value_js_1 = require("./get-cross-origin-value.js");
|
|
|
10
10
|
const interactivity_schema_js_1 = require("./interactivity-schema.js");
|
|
11
11
|
const prefetch_js_1 = require("./prefetch.js");
|
|
12
12
|
const resolve_sequence_duration_js_1 = require("./resolve-sequence-duration.js");
|
|
13
|
+
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
13
14
|
const Sequence_js_1 = require("./Sequence.js");
|
|
14
15
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
15
16
|
const truncate_src_for_label_js_1 = require("./truncate-src-for-label.js");
|
|
@@ -228,7 +229,7 @@ const NativeImgInner = ({ hidden, name, showInTimeline, src, from, trimBefore, l
|
|
|
228
229
|
style: premountingStyle,
|
|
229
230
|
componentName: '<Img />',
|
|
230
231
|
});
|
|
231
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, loop: loop, durationInFrames: durationInFrames, freeze: freeze, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: isMedia, _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, children: jsx_runtime_1.jsx(ImgContent, { src: src, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, ...props }) }) }));
|
|
232
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, loop: loop, durationInFrames: durationInFrames, freeze: freeze, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: isMedia, _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, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(ImgContent, { src: src, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, ...props }) }) }) }));
|
|
232
233
|
};
|
|
233
234
|
const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
|
|
234
235
|
exports.imgSchema = {
|
|
@@ -285,7 +286,7 @@ const getFitFromObjectFit = (style) => {
|
|
|
285
286
|
}
|
|
286
287
|
return undefined;
|
|
287
288
|
};
|
|
288
|
-
const ImgInner = ({ effects = [], ref, hidden, name, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, controls, width, height, className, style, cropLeft, cropRight, cropTop, cropBottom, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageError, ...props }) => {
|
|
289
|
+
const ImgInner = ({ effects = [], effectsOutputSize, ref, hidden, name, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, controls, width, height, className, style, cropLeft, cropRight, cropTop, cropBottom, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, onImageError, ...props }) => {
|
|
289
290
|
var _a;
|
|
290
291
|
const shouldPauseWhenLoading = (0, v5_flag_js_1.resolveV5Default)(pauseWhenLoading);
|
|
291
292
|
if (effects.length === 0) {
|
|
@@ -304,7 +305,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, showInTimeline, src, from,
|
|
|
304
305
|
const canvasHeight = typeof height === 'number' ? height : undefined;
|
|
305
306
|
const canvasProps = props;
|
|
306
307
|
const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
|
|
307
|
-
return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, cropLeft: cropLeft, cropRight: cropRight, cropTop: cropTop, cropBottom: cropBottom, id: id, onError: onImageError, pauseWhenLoading: shouldPauseWhenLoading, 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, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalCropComponentName: "<Img />", controls: controls, ...canvasProps }));
|
|
308
|
+
return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, effectsOutputSize: effectsOutputSize, className: className, style: style, cropLeft: cropLeft, cropRight: cropRight, cropTop: cropTop, cropBottom: cropBottom, id: id, onError: onImageError, pauseWhenLoading: shouldPauseWhenLoading, 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, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalCropComponentName: "<Img />", controls: controls, ...canvasProps }));
|
|
308
309
|
};
|
|
309
310
|
/*
|
|
310
311
|
* @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.
|