remotion 4.0.533 → 4.0.535
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 +1 -6
- package/dist/cjs/AbsoluteFill.js +1 -1
- package/dist/cjs/Composition.js +15 -20
- package/dist/cjs/CompositionManager.d.ts +4 -4
- package/dist/cjs/CompositionManagerContext.d.ts +1 -6
- package/dist/cjs/CompositionManagerContext.js +0 -4
- package/dist/cjs/CompositionManagerProvider.js +77 -172
- 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 +2 -2
- package/dist/cjs/HtmlInCanvas.js +179 -31
- package/dist/cjs/IFrame.js +40 -8
- package/dist/cjs/Img.js +2 -1
- package/dist/cjs/Interactive.d.ts +12 -0
- package/dist/cjs/Interactive.js +19 -8
- package/dist/cjs/RemotionRoot.js +2 -1
- package/dist/cjs/Sequence.d.ts +6 -2
- package/dist/cjs/Sequence.js +107 -40
- package/dist/cjs/SequenceActivityBoundary.d.ts +10 -0
- package/dist/cjs/SequenceActivityBoundary.js +88 -0
- package/dist/cjs/SequenceActivityBudget.d.ts +13 -0
- package/dist/cjs/SequenceActivityBudget.js +181 -0
- package/dist/cjs/SequenceManager.d.ts +13 -29
- package/dist/cjs/SequenceManager.js +36 -176
- package/dist/cjs/SequenceRegistryProvider.d.ts +4 -0
- package/dist/cjs/SequenceRegistryProvider.js +292 -0
- package/dist/cjs/Track.d.ts +13 -0
- package/dist/cjs/Track.js +33 -0
- package/dist/cjs/animated-image/AnimatedImage.js +42 -30
- 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/use-audio-context.js +26 -7
- package/dist/cjs/canvas-image/CanvasImage.js +4 -2
- 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.js +5 -3
- package/dist/cjs/effects/canvas-pool.d.ts +1 -0
- package/dist/cjs/effects/canvas-pool.js +15 -10
- package/dist/cjs/effects/run-effect-chain.js +3 -3
- package/dist/cjs/effects/use-memoized-effects.d.ts +3 -1
- package/dist/cjs/effects/use-memoized-effects.js +104 -21
- package/dist/cjs/enable-sequence-stack-traces.d.ts +2 -8
- package/dist/cjs/enable-sequence-stack-traces.js +7 -38
- package/dist/cjs/evaluate-source-expressions.d.ts +5 -0
- package/dist/cjs/evaluate-source-expressions.js +98 -0
- package/dist/cjs/freeze.js +9 -8
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/interactivity-schema.d.ts +45 -9
- package/dist/cjs/interactivity-schema.js +30 -3
- package/dist/cjs/internals.d.ts +113 -27
- package/dist/cjs/internals.js +37 -7
- 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 +7 -0
- package/dist/cjs/no-react.d.ts +6 -0
- package/dist/cjs/no-react.js +9 -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 +20 -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 +15 -5
- package/dist/cjs/timeline-position-state.js +11 -3
- package/dist/cjs/timeline-track-context.d.ts +10 -0
- package/dist/cjs/timeline-track-context.js +6 -0
- 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 +29 -119
- package/dist/cjs/use-premounting.js +3 -4
- package/dist/cjs/use-schema.d.ts +32 -18
- package/dist/cjs/use-sequence-registration.d.ts +1 -1
- package/dist/cjs/use-sequence-registration.js +22 -6
- 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/html5-video.js +1 -1
- package/dist/cjs/with-interactivity-schema.js +48 -16
- package/dist/cjs/wrap-remotion-context.d.ts +17 -2
- package/dist/cjs/wrap-remotion-context.js +108 -4
- package/dist/esm/index.mjs +3526 -2259
- package/dist/esm/no-react.mjs +149 -35
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DefaultPremountContext: import("react").Context<number>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultPremountContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const default_premount_in_seconds_js_1 = require("./default-premount-in-seconds.js");
|
|
6
|
+
exports.DefaultPremountContext = (0, react_1.createContext)(default_premount_in_seconds_js_1.DEFAULT_PREMOUNT_IN_SECONDS);
|
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;
|
|
@@ -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;
|
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
|
-
|
|
150
|
-
|
|
151
|
-
const isInsideAncestorHtmlInCanvas = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
|
|
148
|
+
const HtmlInCanvasAncestorContext = (0, react_1.createContext)(null);
|
|
149
|
+
const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, children, canvasSiblings, onPaint, onInit, pixelDensity, controls, style, renderFrame, }, ref) => {
|
|
150
|
+
var _a, _b;
|
|
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,26 +160,72 @@ 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]);
|
|
223
|
+
}, [ref, paintTargetMode]);
|
|
179
224
|
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
|
|
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,
|
|
228
|
+
videoConfigValues: (_b = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues) !== null && _b !== void 0 ? _b : null,
|
|
183
229
|
});
|
|
184
230
|
// Refs so the paint handler always reads fresh values.
|
|
185
231
|
const effectsRef = (0, react_1.useRef)(memoizedEffects);
|
|
@@ -191,7 +237,13 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
191
237
|
const initializedRef = (0, react_1.useRef)(false);
|
|
192
238
|
const onInitCleanupRef = (0, react_1.useRef)(null);
|
|
193
239
|
const unmountedRef = (0, react_1.useRef)(false);
|
|
240
|
+
const paintingTargets = (0, react_1.useRef)(new WeakMap());
|
|
194
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;
|
|
195
247
|
const element = divRef.current;
|
|
196
248
|
if (!element) {
|
|
197
249
|
throw new Error('Canvas or scene element not found');
|
|
@@ -200,16 +252,32 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
200
252
|
if (!paintTarget) {
|
|
201
253
|
throw new Error('HtmlInCanvas: paint target is not ready because the canvas is remounting');
|
|
202
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
|
+
}
|
|
203
266
|
resizePaintTarget({
|
|
204
267
|
target: paintTarget,
|
|
205
268
|
width: canvasWidth,
|
|
206
269
|
height: canvasHeight,
|
|
207
270
|
});
|
|
271
|
+
const releaseAncestor = isRendering
|
|
272
|
+
? ancestorPaintState === null || ancestorPaintState === void 0 ? void 0 : ancestorPaintState.blockPaint()
|
|
273
|
+
: null;
|
|
274
|
+
let canReleasePaint = false;
|
|
208
275
|
try {
|
|
209
276
|
const placeholderCanvas = canvas2dRef.current;
|
|
210
277
|
if (!placeholderCanvas) {
|
|
211
278
|
throw new Error('Canvas not found');
|
|
212
279
|
}
|
|
280
|
+
const outputCanvas = outputCanvasRef.current;
|
|
213
281
|
const handle = delayRender('onPaint');
|
|
214
282
|
if (!initializedRef.current) {
|
|
215
283
|
const currentOnInit = onInitRef.current;
|
|
@@ -229,6 +297,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
229
297
|
canRetryMissingPaintRecord) {
|
|
230
298
|
// The web renderer explicitly drives additional paint cycles, so a
|
|
231
299
|
// transient missing record can be retried without failing the render.
|
|
300
|
+
canReleasePaint = true;
|
|
232
301
|
continueRender(handle);
|
|
233
302
|
return;
|
|
234
303
|
}
|
|
@@ -251,12 +320,13 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
251
320
|
if (typeof cleanup !== 'function') {
|
|
252
321
|
throw new Error('HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.');
|
|
253
322
|
}
|
|
254
|
-
if (unmountedRef.current
|
|
323
|
+
if (unmountedRef.current ||
|
|
324
|
+
paintTargetRef.current !== paintTarget) {
|
|
255
325
|
cleanup();
|
|
326
|
+
continueRender(handle);
|
|
327
|
+
return;
|
|
256
328
|
}
|
|
257
|
-
|
|
258
|
-
onInitCleanupRef.current = cleanup;
|
|
259
|
-
}
|
|
329
|
+
onInitCleanupRef.current = cleanup;
|
|
260
330
|
}
|
|
261
331
|
finally {
|
|
262
332
|
initImage.close();
|
|
@@ -272,6 +342,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
272
342
|
// element is outside the viewport (no cached paint record).
|
|
273
343
|
// Skip this paint cycle — the canvas retains its last state.
|
|
274
344
|
if (isMissingPaintRecordError(error) && canRetryMissingPaintRecord) {
|
|
345
|
+
canReleasePaint = true;
|
|
275
346
|
continueRender(handle);
|
|
276
347
|
return;
|
|
277
348
|
}
|
|
@@ -320,11 +391,39 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
320
391
|
finally {
|
|
321
392
|
elImage.close();
|
|
322
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;
|
|
323
408
|
continueRender(handle);
|
|
324
409
|
}
|
|
325
410
|
catch (error) {
|
|
326
411
|
cancelRender(error);
|
|
327
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
|
+
}
|
|
328
427
|
}, [
|
|
329
428
|
canvasHeight,
|
|
330
429
|
canvasWidth,
|
|
@@ -334,9 +433,22 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
334
433
|
delayRender,
|
|
335
434
|
resolvedPixelDensity,
|
|
336
435
|
canRetryMissingPaintRecord,
|
|
436
|
+
paintTargetMode,
|
|
437
|
+
isRendering,
|
|
438
|
+
paintState,
|
|
439
|
+
ancestorPaintState,
|
|
337
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]);
|
|
338
448
|
// Default paint handlers draw synchronously on the layout canvas itself.
|
|
339
|
-
//
|
|
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.
|
|
340
452
|
(0, react_1.useLayoutEffect)(() => {
|
|
341
453
|
var _a;
|
|
342
454
|
const placeholder = canvas2dRef.current;
|
|
@@ -346,7 +458,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
346
458
|
placeholder.setAttribute('content', 'drawable');
|
|
347
459
|
placeholder.layoutSubtree = true;
|
|
348
460
|
(_a = divRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute('drawable', '');
|
|
349
|
-
const paintTarget =
|
|
461
|
+
const paintTarget = paintTargetMode === 'direct'
|
|
350
462
|
? placeholder
|
|
351
463
|
: getTransferredOffscreenCanvas(placeholder);
|
|
352
464
|
paintTargetRef.current = paintTarget;
|
|
@@ -367,13 +479,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
367
479
|
(_a = onInitCleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(onInitCleanupRef);
|
|
368
480
|
onInitCleanupRef.current = null;
|
|
369
481
|
};
|
|
370
|
-
}, [
|
|
371
|
-
onPaintCb,
|
|
372
|
-
cancelRender,
|
|
373
|
-
canvasWidth,
|
|
374
|
-
canvasHeight,
|
|
375
|
-
usesDirectLayoutCanvas,
|
|
376
|
-
]);
|
|
482
|
+
}, [onPaintCb, cancelRender, canvasWidth, canvasHeight, paintTargetMode]);
|
|
377
483
|
const onPaintChangedRef = (0, react_1.useRef)(false);
|
|
378
484
|
(0, react_1.useLayoutEffect)(() => {
|
|
379
485
|
var _a;
|
|
@@ -388,18 +494,37 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
388
494
|
(_a = canvas.requestPaint) === null || _a === void 0 ? void 0 : _a.call(canvas);
|
|
389
495
|
}, [onPaint, memoizedEffects]);
|
|
390
496
|
(0, react_1.useLayoutEffect)(() => {
|
|
497
|
+
var _a;
|
|
391
498
|
const canvas = canvas2dRef.current;
|
|
392
499
|
if (!canvas) {
|
|
393
500
|
return;
|
|
394
501
|
}
|
|
395
|
-
|
|
396
|
-
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 = () => {
|
|
397
509
|
continueRender(handle);
|
|
398
|
-
|
|
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);
|
|
399
514
|
return () => {
|
|
400
|
-
|
|
515
|
+
canvas.removeEventListener('paint', onPainted);
|
|
516
|
+
onPainted();
|
|
401
517
|
};
|
|
402
|
-
}, [
|
|
518
|
+
}, [
|
|
519
|
+
width,
|
|
520
|
+
height,
|
|
521
|
+
continueRender,
|
|
522
|
+
delayRender,
|
|
523
|
+
canvasSizeKey,
|
|
524
|
+
renderFrame,
|
|
525
|
+
isRendering,
|
|
526
|
+
ancestorPaintState,
|
|
527
|
+
]);
|
|
403
528
|
const innerStyle = (0, react_1.useMemo)(() => {
|
|
404
529
|
return {
|
|
405
530
|
width,
|
|
@@ -413,12 +538,35 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
413
538
|
...(style !== null && style !== void 0 ? style : {}),
|
|
414
539
|
};
|
|
415
540
|
}, [height, style, width]);
|
|
416
|
-
return (jsx_runtime_1.
|
|
417
|
-
|
|
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] }));
|
|
418
555
|
});
|
|
419
556
|
HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
|
|
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';
|
|
420
564
|
const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, _remotionInternalCanvasSiblings, controls, style, cropLeft, cropRight, cropTop, cropBottom, durationInFrames, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, name, ...sequenceProps }, ref) => {
|
|
421
565
|
var _a;
|
|
566
|
+
const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
567
|
+
const Content = isRendering
|
|
568
|
+
? HtmlInCanvasContentForRendering
|
|
569
|
+
: HtmlInCanvasContent;
|
|
422
570
|
const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
|
|
423
571
|
const actualRef = (0, react_1.useRef)(null);
|
|
424
572
|
const setCanvasRef = (0, react_1.useCallback)((node) => {
|
|
@@ -452,7 +600,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
|
|
|
452
600
|
style: premountingStyle,
|
|
453
601
|
componentName: '<HtmlInCanvas />',
|
|
454
602
|
});
|
|
455
|
-
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, 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 }) }) }));
|
|
456
604
|
});
|
|
457
605
|
HtmlInCanvasInner.displayName = 'HtmlInCanvas';
|
|
458
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.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 = {
|
|
@@ -25,12 +25,21 @@ type PropsBranchAcceptsStyle<Props> = Props extends unknown ? 'style' extends ke
|
|
|
25
25
|
type EveryPropsBranchAcceptsStyle<Props> = [Props] extends [never] ? false : false extends PropsBranchAcceptsStyle<Props> ? false : true;
|
|
26
26
|
type ComponentAcceptingStyle<Component extends React.ElementType, ReservedKey extends PropertyKey> = ComponentWithoutReservedProps<Component, ReservedKey> & (EveryPropsBranchAcceptsStyle<React.ComponentPropsWithoutRef<Component>> extends true ? unknown : never);
|
|
27
27
|
type WithSchema = {
|
|
28
|
+
<S extends InteractivitySchema, Component extends React.ElementType>(options: Omit<WithInteractivitySchemaOptions<S, React.ComponentPropsWithoutRef<Component>>, 'Component' | 'supportsEffects'> & {
|
|
29
|
+
readonly Component: ComponentWithoutReservedProps<Component, WithSchemaReservedKey | 'style' | 'width' | 'height'>;
|
|
30
|
+
readonly wrapInSequence: true;
|
|
31
|
+
readonly layout: 'absolute-fill';
|
|
32
|
+
}): React.FC<React.ComponentPropsWithoutRef<Component> & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps & InteractiveTransformProps & Pick<SequenceProps, 'width' | 'height'> & {
|
|
33
|
+
readonly ref?: React.Ref<HTMLDivElement>;
|
|
34
|
+
}>;
|
|
28
35
|
<S extends InteractivitySchema, Component extends React.ElementType>(options: Omit<WithInteractivitySchemaOptions<S, React.ComponentPropsWithoutRef<Component>>, 'Component' | 'supportsEffects'> & {
|
|
29
36
|
readonly Component: ComponentAcceptingStyle<Component, WithSchemaReservedKey>;
|
|
30
37
|
readonly wrapInSequence: true;
|
|
38
|
+
readonly layout?: 'none';
|
|
31
39
|
}): React.FC<React.ComponentPropsWithRef<Component> & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps>;
|
|
32
40
|
<S extends InteractivitySchema, Props extends object>(options: WithInteractivitySchemaOptions<S, Props> & {
|
|
33
41
|
readonly wrapInSequence?: false;
|
|
42
|
+
readonly layout?: never;
|
|
34
43
|
}): React.ComponentType<Props>;
|
|
35
44
|
};
|
|
36
45
|
/**
|
|
@@ -85,6 +94,9 @@ export declare const Interactive: {
|
|
|
85
94
|
readonly keyframable: false;
|
|
86
95
|
};
|
|
87
96
|
};
|
|
97
|
+
childrenSchema: {
|
|
98
|
+
children: import("./interactivity-schema.js").InteractivitySchemaField;
|
|
99
|
+
};
|
|
88
100
|
transformSchema: {
|
|
89
101
|
readonly 'style.transformOrigin': {
|
|
90
102
|
readonly type: "transform-origin";
|
package/dist/cjs/Interactive.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.Interactive = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
+
const component_identity_js_1 = require("./component-identity.js");
|
|
39
40
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
40
41
|
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
41
42
|
const freeze_js_1 = require("./freeze.js");
|
|
@@ -78,13 +79,13 @@ const interactiveBorderElementSchema = {
|
|
|
78
79
|
const interactiveTextElementSchema = {
|
|
79
80
|
...interactiveBorderElementSchema,
|
|
80
81
|
...interactivity_schema_js_1.textSchema,
|
|
81
|
-
...interactivity_schema_js_1.
|
|
82
|
+
...interactivity_schema_js_1.childrenSchema,
|
|
82
83
|
};
|
|
83
84
|
const interactiveSvgTextElementSchema = {
|
|
84
85
|
...interactiveElementSchema,
|
|
85
86
|
...interactivity_schema_js_1.svgPaintSchema,
|
|
86
87
|
...interactivity_schema_js_1.textSchema,
|
|
87
|
-
...interactivity_schema_js_1.
|
|
88
|
+
...interactivity_schema_js_1.childrenSchema,
|
|
88
89
|
};
|
|
89
90
|
const interactiveSvgElementSchema = {
|
|
90
91
|
...interactiveElementSchema,
|
|
@@ -122,16 +123,17 @@ const withSchema = (untypedOptions) => {
|
|
|
122
123
|
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(LegacyWrapped);
|
|
123
124
|
return LegacyWrapped;
|
|
124
125
|
}
|
|
125
|
-
const { Component, componentName, schema, wrapInSequence: _, ...rest } = options;
|
|
126
|
+
const { Component, componentName, schema, wrapInSequence: _, layout = 'none', ...rest } = options;
|
|
126
127
|
const ComponentWrappedInSequence = (0, react_1.forwardRef)((props, ref) => {
|
|
127
128
|
const { canvasContent, compositions } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
128
129
|
// The render callback runs after the exported wrapper has been initialized.
|
|
129
130
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
130
|
-
const componentIdentity = (0,
|
|
131
|
+
const componentIdentity = (0, component_identity_js_1.resolveComponentIdentity)(Wrapped);
|
|
131
132
|
const isCurrentComposition = compositions.some((composition) => (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' &&
|
|
132
133
|
composition.id === canvasContent.compositionId &&
|
|
133
134
|
composition.componentFromProps === componentIdentity);
|
|
134
|
-
const {
|
|
135
|
+
const { width, height, ...propsWithoutDimensions } = props;
|
|
136
|
+
const { durationInFrames, from, trimBefore, playbackRate, loop, freeze, hidden, name, showInTimeline, controls, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, ...componentProps } = layout === 'absolute-fill' ? propsWithoutDimensions : props;
|
|
135
137
|
const { cropLeft, cropRight, cropTop, cropBottom, style, ...componentPropsWithoutCropping } = componentProps;
|
|
136
138
|
const { effectivePremountFor, effectivePostmountFor, freezeFrame, isPremountingOrPostmounting, premountingActive, postmountingActive, premountingStyle, } = (0, use_premounting_js_1.usePremounting)({
|
|
137
139
|
from: from !== null && from !== void 0 ? from : 0,
|
|
@@ -155,10 +157,18 @@ const withSchema = (untypedOptions) => {
|
|
|
155
157
|
style: premountingStyle,
|
|
156
158
|
componentName,
|
|
157
159
|
});
|
|
158
|
-
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(Sequence_js_1.SequenceWithoutSchema, { _remotionInternalSingleChildComponent: isCurrentComposition ? null : componentIdentity, layout:
|
|
160
|
+
return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(Sequence_js_1.SequenceWithoutSchema, { _remotionInternalSingleChildComponent: isCurrentComposition ? null : componentIdentity, layout: layout, ...(layout === 'absolute-fill'
|
|
161
|
+
? {
|
|
162
|
+
width,
|
|
163
|
+
height,
|
|
164
|
+
style: { overflow: 'hidden', ...croppedStyle },
|
|
165
|
+
ref: ref,
|
|
166
|
+
}
|
|
167
|
+
: {}), durationInFrames: durationInFrames, from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : componentName, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive-with-schema", showInTimeline: isCurrentComposition ? false : showInTimeline, controls: controls, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: react_1.default.createElement(Component, {
|
|
159
168
|
...componentPropsWithoutCropping,
|
|
160
|
-
|
|
161
|
-
|
|
169
|
+
...(layout === 'none'
|
|
170
|
+
? { style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, ref }
|
|
171
|
+
: {}),
|
|
162
172
|
}) }) }));
|
|
163
173
|
});
|
|
164
174
|
const Wrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
|
|
@@ -240,6 +250,7 @@ const makeInteractiveSvgStrokeElement = (tag, displayName) => {
|
|
|
240
250
|
exports.Interactive = {
|
|
241
251
|
baseSchema: interactivity_schema_js_1.baseSchema,
|
|
242
252
|
captionsSchema: interactivity_schema_js_1.captionsSchema,
|
|
253
|
+
childrenSchema: interactivity_schema_js_1.childrenSchema,
|
|
243
254
|
transformSchema: interactivity_schema_js_1.transformSchema,
|
|
244
255
|
textSchema: interactivity_schema_js_1.textSchema,
|
|
245
256
|
backgroundSchema: interactivity_schema_js_1.backgroundSchema,
|