remotion 4.0.535 → 4.0.537
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/AbsoluteFill.d.ts +1 -1
- package/dist/cjs/CompositionManagerContext.d.ts +3 -0
- package/dist/cjs/CompositionManagerContext.js +5 -3
- package/dist/cjs/CompositionManagerProvider.js +3 -1
- package/dist/cjs/HtmlInCanvas.d.ts +4 -2
- package/dist/cjs/HtmlInCanvas.js +70 -19
- package/dist/cjs/Img.d.ts +4 -2
- package/dist/cjs/Img.js +2 -2
- package/dist/cjs/Interactive.d.ts +21 -7
- package/dist/cjs/Interactive.js +22 -1
- package/dist/cjs/Sequence.js +47 -3
- package/dist/cjs/SequenceActivityBoundary.js +14 -1
- package/dist/cjs/SequenceActivityBudget.js +26 -11
- package/dist/cjs/SequenceActivitySuspensionProvider.d.ts +4 -0
- package/dist/cjs/SequenceActivitySuspensionProvider.js +45 -0
- package/dist/cjs/SequenceManager.d.ts +5 -0
- package/dist/cjs/SequenceManager.js +22 -4
- package/dist/cjs/Track.js +1 -2
- package/dist/cjs/animated-image/AnimatedImage.d.ts +3 -2
- package/dist/cjs/animated-image/AnimatedImage.js +17 -10
- 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/shared-audio-tags.d.ts +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +1 -1
- package/dist/cjs/canvas-image/CanvasImage.d.ts +3 -2
- package/dist/cjs/canvas-image/CanvasImage.js +4 -4
- package/dist/cjs/canvas-image/props.d.ts +2 -1
- package/dist/cjs/effects/Solid.d.ts +3 -2
- package/dist/cjs/effects/Solid.js +4 -4
- 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 +86 -44
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/interactivity-schema.d.ts +5 -5
- package/dist/cjs/interactivity-schema.js +2 -1
- package/dist/cjs/internals.d.ts +11 -10
- package/dist/cjs/internals.js +1 -1
- package/dist/cjs/interpolate.js +8 -1
- package/dist/cjs/no-react.d.ts +1 -1
- package/dist/cjs/sequence-activity-context.d.ts +1 -1
- package/dist/cjs/sequence-activity-context.js +4 -3
- package/dist/cjs/sequence-activity-defaults.d.ts +1 -1
- package/dist/cjs/sequence-activity-defaults.js +1 -1
- package/dist/cjs/timeline-position-state.d.ts +1 -0
- package/dist/cjs/timeline-position-state.js +21 -1
- package/dist/cjs/timeline-track-context.d.ts +0 -1
- package/dist/cjs/timeline-track-context.js +1 -2
- package/dist/cjs/use-current-frame.d.ts +1 -0
- package/dist/cjs/use-current-frame.js +14 -7
- package/dist/cjs/use-schema.js +3 -1
- package/dist/cjs/use-timeline-seek.d.ts +1 -0
- package/dist/cjs/use-timeline-seek.js +10 -0
- package/dist/cjs/validation/validate-duration-in-frames.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/seek-until-right.js +11 -7
- package/dist/cjs/with-interactivity-schema.js +18 -16
- package/dist/cjs/wrap-remotion-context.d.ts +0 -1
- package/dist/cjs/wrap-remotion-context.js +1 -4
- package/dist/esm/index.mjs +951 -720
- package/dist/esm/no-react.mjs +7 -6
- 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
|
@@ -184,7 +184,7 @@ export declare const absoluteFillSchema: {
|
|
|
184
184
|
readonly children: import("./interactivity-schema.js").InteractivitySchemaField;
|
|
185
185
|
readonly premountFor: {
|
|
186
186
|
readonly type: "number";
|
|
187
|
-
readonly default:
|
|
187
|
+
readonly default: undefined;
|
|
188
188
|
readonly description: "Premount For";
|
|
189
189
|
readonly min: 0;
|
|
190
190
|
readonly step: 1;
|
|
@@ -38,4 +38,7 @@ export type CompositionManagerContext = {
|
|
|
38
38
|
canvasContent: CanvasContent | null;
|
|
39
39
|
};
|
|
40
40
|
export declare const CompositionManager: React.Context<CompositionManagerContext>;
|
|
41
|
+
export declare const CompositionManagerRefContext: React.Context<{
|
|
42
|
+
readonly current: CompositionManagerContext;
|
|
43
|
+
}>;
|
|
41
44
|
export declare const CompositionSetters: React.Context<CompositionManagerSetters>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompositionSetters = exports.CompositionManager = exports.getAssetPreviewCompositionId = void 0;
|
|
3
|
+
exports.CompositionSetters = exports.CompositionManagerRefContext = exports.CompositionManager = exports.getAssetPreviewCompositionId = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const getAssetPreviewCompositionId = (asset) => `asset:${asset}`;
|
|
6
6
|
exports.getAssetPreviewCompositionId = getAssetPreviewCompositionId;
|
|
7
|
-
|
|
7
|
+
const defaultCompositionManagerContext = {
|
|
8
8
|
compositions: [],
|
|
9
9
|
folders: [],
|
|
10
10
|
currentCompositionMetadata: null,
|
|
11
11
|
currentAssetMetadata: null,
|
|
12
12
|
canvasContent: null,
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
exports.CompositionManager = (0, react_1.createContext)(defaultCompositionManagerContext);
|
|
15
|
+
exports.CompositionManagerRefContext = (0, react_1.createContext)({ current: defaultCompositionManagerContext });
|
|
14
16
|
exports.CompositionSetters = (0, react_1.createContext)({
|
|
15
17
|
setCanvasContent: () => undefined,
|
|
16
18
|
setCurrentAssetMetadata: () => undefined,
|
|
@@ -103,9 +103,11 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
|
|
|
103
103
|
currentAssetMetadata,
|
|
104
104
|
canvasContent,
|
|
105
105
|
]);
|
|
106
|
+
const compositionManagerRef = (0, react_1.useRef)(compositionManagerContextValue);
|
|
107
|
+
compositionManagerRef.current = compositionManagerContextValue;
|
|
106
108
|
if (registrationError !== null) {
|
|
107
109
|
throw registrationError;
|
|
108
110
|
}
|
|
109
|
-
return (jsx_runtime_1.jsx(CompositionRegistryProvider_js_1.CompositionRegistryProvider, { ref: flushSnapshotRef, onSnapshot: onCommitRegistrations, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionManager.Provider, { value: compositionManagerContextValue, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionSetters.Provider, { value: compositionManagerSetters, children: children }) }) }));
|
|
111
|
+
return (jsx_runtime_1.jsx(CompositionRegistryProvider_js_1.CompositionRegistryProvider, { ref: flushSnapshotRef, onSnapshot: onCommitRegistrations, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionManager.Provider, { value: compositionManagerContextValue, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionManagerRefContext.Provider, { value: compositionManagerRef, children: jsx_runtime_1.jsx(CompositionManagerContext_1.CompositionSetters.Provider, { value: compositionManagerSetters, children: children }) }) }) }));
|
|
110
112
|
};
|
|
111
113
|
exports.CompositionManagerProvider = CompositionManagerProvider;
|
|
@@ -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 {
|
|
@@ -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
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HtmlInCanvas = exports.htmlInCanvasSchema = exports.getHtmlInCanvasUnsupportedMessage = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasNestingSupported = exports.isHtmlInCanvasSupported = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const DefaultPremountContext_js_1 = require("./DefaultPremountContext.js");
|
|
6
7
|
const run_effect_chain_js_1 = require("./effects/run-effect-chain.js");
|
|
7
8
|
const use_effect_chain_state_js_1 = require("./effects/use-effect-chain-state.js");
|
|
8
9
|
const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
|
|
@@ -146,7 +147,7 @@ const defaultOnPaint = ({ canvas, elementImage, }) => {
|
|
|
146
147
|
ctx.drawElementImage(elementImage, 0, 0);
|
|
147
148
|
};
|
|
148
149
|
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
|
+
const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, effectsOutputSize, children, canvasSiblings, onPaint, onInit, pixelDensity, controls, style, renderFrame, }, ref) => {
|
|
150
151
|
var _a, _b;
|
|
151
152
|
const ancestorPaintState = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
|
|
152
153
|
assertHtmlInCanvasDimensions(width, height);
|
|
@@ -160,11 +161,15 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
160
161
|
const { isClientSideRendering, isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
161
162
|
const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
|
|
162
163
|
const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
// Keep a nested drawable canvas separate from the bitmap captured by its
|
|
165
|
+
// parent. Reusing it for both can crash Chromium during raster invalidation.
|
|
166
|
+
const paintTargetMode = ancestorPaintState
|
|
167
|
+
? 'copied'
|
|
168
|
+
: usesDirectLayoutCanvas
|
|
169
|
+
? 'direct'
|
|
170
|
+
: isRendering
|
|
171
|
+
? 'copied'
|
|
172
|
+
: 'transferred';
|
|
168
173
|
if (!(0, exports.isHtmlInCanvasSupported)()) {
|
|
169
174
|
cancelRender(new Error((0, exports.getHtmlInCanvasUnsupportedMessage)()));
|
|
170
175
|
}
|
|
@@ -221,7 +226,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
221
226
|
ref.current = node;
|
|
222
227
|
}
|
|
223
228
|
}, [ref, paintTargetMode]);
|
|
224
|
-
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
|
|
229
|
+
const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
|
|
225
230
|
const memoizedEffects = (0, use_memoized_effects_js_1.useMemoizedEffects)({
|
|
226
231
|
effects,
|
|
227
232
|
overrideId: (_a = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _a !== void 0 ? _a : null,
|
|
@@ -237,9 +242,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
237
242
|
const initializedRef = (0, react_1.useRef)(false);
|
|
238
243
|
const onInitCleanupRef = (0, react_1.useRef)(null);
|
|
239
244
|
const unmountedRef = (0, react_1.useRef)(false);
|
|
245
|
+
const effectScratchCanvasesRef = (0, react_1.useRef)(null);
|
|
240
246
|
const paintingTargets = (0, react_1.useRef)(new WeakMap());
|
|
241
247
|
const onPaintCb = (0, react_1.useCallback)(async () => {
|
|
242
248
|
var _a, _b;
|
|
249
|
+
var _c;
|
|
243
250
|
if (isRendering && paintState.pendingChildren > 0) {
|
|
244
251
|
return;
|
|
245
252
|
}
|
|
@@ -351,6 +358,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
351
358
|
}
|
|
352
359
|
throw error;
|
|
353
360
|
}
|
|
361
|
+
let effectSourceCanvas = null;
|
|
354
362
|
try {
|
|
355
363
|
const currentOnPaint = onPaintRef.current;
|
|
356
364
|
if (currentOnPaint) {
|
|
@@ -367,6 +375,48 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
367
375
|
await paintResult;
|
|
368
376
|
}
|
|
369
377
|
}
|
|
378
|
+
else if (paintTarget instanceof HTMLCanvasElement &&
|
|
379
|
+
effectsRef.current.some((effect) => !effect.params.disabled)) {
|
|
380
|
+
// The element image can only be drawn into the visible layout
|
|
381
|
+
// canvas, but effects finish asynchronously (e.g. while the
|
|
382
|
+
// WebGPU device initializes). Move the unprocessed pixels to a
|
|
383
|
+
// scratch canvas and restore the previous output within this task,
|
|
384
|
+
// so the browser never presents the HTML without its effects.
|
|
385
|
+
(_c = effectScratchCanvasesRef.current) !== null && _c !== void 0 ? _c : (effectScratchCanvasesRef.current = {
|
|
386
|
+
source: document.createElement('canvas'),
|
|
387
|
+
previousOutput: document.createElement('canvas'),
|
|
388
|
+
});
|
|
389
|
+
const { source: effectSource, previousOutput } = effectScratchCanvasesRef.current;
|
|
390
|
+
resizePaintTarget({
|
|
391
|
+
target: effectSource,
|
|
392
|
+
width: canvasWidth,
|
|
393
|
+
height: canvasHeight,
|
|
394
|
+
});
|
|
395
|
+
resizePaintTarget({
|
|
396
|
+
target: previousOutput,
|
|
397
|
+
width: canvasWidth,
|
|
398
|
+
height: canvasHeight,
|
|
399
|
+
});
|
|
400
|
+
const effectSourceCtx = effectSource.getContext('2d');
|
|
401
|
+
const previousOutputCtx = previousOutput.getContext('2d');
|
|
402
|
+
const paintTargetCtx = paintTarget.getContext('2d');
|
|
403
|
+
if (!effectSourceCtx || !previousOutputCtx || !paintTargetCtx) {
|
|
404
|
+
throw new Error('Failed to acquire 2D context for <HtmlInCanvas> canvas');
|
|
405
|
+
}
|
|
406
|
+
previousOutputCtx.reset();
|
|
407
|
+
previousOutputCtx.drawImage(paintTarget, 0, 0);
|
|
408
|
+
defaultOnPaint({
|
|
409
|
+
canvas: paintTarget,
|
|
410
|
+
element,
|
|
411
|
+
elementImage: elImage,
|
|
412
|
+
pixelDensity: resolvedPixelDensity,
|
|
413
|
+
});
|
|
414
|
+
effectSourceCtx.reset();
|
|
415
|
+
effectSourceCtx.drawImage(paintTarget, 0, 0);
|
|
416
|
+
paintTargetCtx.reset();
|
|
417
|
+
paintTargetCtx.drawImage(previousOutput, 0, 0);
|
|
418
|
+
effectSourceCanvas = effectSource;
|
|
419
|
+
}
|
|
370
420
|
else {
|
|
371
421
|
defaultOnPaint({
|
|
372
422
|
canvas: paintTarget,
|
|
@@ -380,7 +430,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
380
430
|
if (state) {
|
|
381
431
|
await (0, run_effect_chain_js_1.runEffectChain)({
|
|
382
432
|
state,
|
|
383
|
-
source: paintTarget,
|
|
433
|
+
source: effectSourceCanvas !== null && effectSourceCanvas !== void 0 ? effectSourceCanvas : paintTarget,
|
|
384
434
|
effects: effectsRef.current,
|
|
385
435
|
output: paintTarget,
|
|
386
436
|
width: canvasWidth,
|
|
@@ -445,10 +495,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
445
495
|
paintState.release = null;
|
|
446
496
|
};
|
|
447
497
|
}, [paintState]);
|
|
448
|
-
//
|
|
449
|
-
//
|
|
450
|
-
//
|
|
451
|
-
//
|
|
498
|
+
// Non-nested default handlers paint directly on the layout canvas. Nested
|
|
499
|
+
// canvases and custom handlers retain a transferred target because an
|
|
500
|
+
// ElementImage can only be drawn into its associated canvas. Nested canvases
|
|
501
|
+
// and rendering copy it to a separate visible canvas without waiting for
|
|
502
|
+
// the transferred canvas to present.
|
|
452
503
|
(0, react_1.useLayoutEffect)(() => {
|
|
453
504
|
var _a;
|
|
454
505
|
const placeholder = canvas2dRef.current;
|
|
@@ -539,7 +590,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
539
590
|
};
|
|
540
591
|
}, [height, style, width]);
|
|
541
592
|
return (jsx_runtime_1.jsxs(HtmlInCanvasAncestorContext.Provider, { value: paintState, children: [
|
|
542
|
-
jsx_runtime_1.
|
|
593
|
+
jsx_runtime_1.jsx("canvas", { ref: paintTargetMode === 'copied' ? canvas2dRef : setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: paintTargetMode === 'copied'
|
|
543
594
|
? {
|
|
544
595
|
...canvasStyle,
|
|
545
596
|
position: 'absolute',
|
|
@@ -548,10 +599,10 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
548
599
|
visibility: 'hidden',
|
|
549
600
|
pointerEvents: 'none',
|
|
550
601
|
}
|
|
551
|
-
: canvasStyle, children: [
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
602
|
+
: canvasStyle, children: jsx_runtime_1.jsxs(DefaultPremountContext_js_1.DefaultPremountContext.Provider, { value: 0, children: [
|
|
603
|
+
jsx_runtime_1.jsx("div", { ref: divRef, style: paintTargetMode === 'copied'
|
|
604
|
+
? { ...innerStyle, visibility: 'visible' }
|
|
605
|
+
: innerStyle, children: children }), canvasSiblings] }) }, canvasSizeKey), paintTargetMode === 'copied' ? (jsx_runtime_1.jsx("canvas", { ref: setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle }, `output-${canvasSizeKey}`)) : null] }));
|
|
555
606
|
});
|
|
556
607
|
HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
|
|
557
608
|
// Subscribe to frame changes only while rendering. Preview keeps relying on
|
|
@@ -561,7 +612,7 @@ const HtmlInCanvasContentForRendering = (0, react_1.forwardRef)((props, ref) =>
|
|
|
561
612
|
return jsx_runtime_1.jsx(HtmlInCanvasContent, { ...props, ref: ref, renderFrame: frame });
|
|
562
613
|
});
|
|
563
614
|
HtmlInCanvasContentForRendering.displayName = 'HtmlInCanvasContentForRendering';
|
|
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) => {
|
|
615
|
+
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) => {
|
|
565
616
|
var _a;
|
|
566
617
|
const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
567
618
|
const Content = isRendering
|
|
@@ -600,7 +651,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
|
|
|
600
651
|
style: premountingStyle,
|
|
601
652
|
componentName: '<HtmlInCanvas />',
|
|
602
653
|
});
|
|
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 }) }) }));
|
|
654
|
+
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 }) }) }));
|
|
604
655
|
});
|
|
605
656
|
HtmlInCanvasInner.displayName = 'HtmlInCanvas';
|
|
606
657
|
exports.htmlInCanvasSchema = {
|
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
|
@@ -286,7 +286,7 @@ const getFitFromObjectFit = (style) => {
|
|
|
286
286
|
}
|
|
287
287
|
return undefined;
|
|
288
288
|
};
|
|
289
|
-
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 }) => {
|
|
290
290
|
var _a;
|
|
291
291
|
const shouldPauseWhenLoading = (0, v5_flag_js_1.resolveV5Default)(pauseWhenLoading);
|
|
292
292
|
if (effects.length === 0) {
|
|
@@ -305,7 +305,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, showInTimeline, src, from,
|
|
|
305
305
|
const canvasHeight = typeof height === 'number' ? height : undefined;
|
|
306
306
|
const canvasProps = props;
|
|
307
307
|
const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
|
|
308
|
-
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 }));
|
|
309
309
|
};
|
|
310
310
|
/*
|
|
311
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.
|
|
@@ -24,19 +24,25 @@ type StyleAcceptsCssProperties<Style> = true extends StyleMemberAcceptsCssProper
|
|
|
24
24
|
type PropsBranchAcceptsStyle<Props> = Props extends unknown ? 'style' extends keyof Props ? StyleAcceptsCssProperties<Props[Extract<'style', keyof Props>]> : false : never;
|
|
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
|
-
type
|
|
28
|
-
|
|
27
|
+
type WithSchemaOptions<Options extends {
|
|
28
|
+
schema: InteractivitySchema;
|
|
29
|
+
componentName: string;
|
|
30
|
+
}, WithDefaults extends boolean> = WithDefaults extends true ? Omit<Options, 'schema' | 'componentName' | 'wrapInSequence'> & Partial<Pick<Options, 'schema' | 'componentName'>> : Options;
|
|
31
|
+
type WithSequence<WithDefaults extends boolean> = {
|
|
32
|
+
<S extends InteractivitySchema, Component extends React.ElementType>(options: WithSchemaOptions<Omit<WithInteractivitySchemaOptions<S, React.ComponentPropsWithoutRef<Component>>, 'Component' | 'supportsEffects'> & {
|
|
29
33
|
readonly Component: ComponentWithoutReservedProps<Component, WithSchemaReservedKey | 'style' | 'width' | 'height'>;
|
|
30
34
|
readonly wrapInSequence: true;
|
|
31
35
|
readonly layout: 'absolute-fill';
|
|
32
|
-
}): React.FC<React.ComponentPropsWithoutRef<Component> & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps & InteractiveTransformProps & Pick<SequenceProps, 'width' | 'height'> & {
|
|
36
|
+
}, WithDefaults>): React.FC<React.ComponentPropsWithoutRef<Component> & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps & InteractiveTransformProps & Pick<SequenceProps, 'width' | 'height'> & {
|
|
33
37
|
readonly ref?: React.Ref<HTMLDivElement>;
|
|
34
38
|
}>;
|
|
35
|
-
<S extends InteractivitySchema, Component extends React.ElementType>(options: Omit<WithInteractivitySchemaOptions<S, React.ComponentPropsWithoutRef<Component>>, 'Component' | 'supportsEffects'> & {
|
|
39
|
+
<S extends InteractivitySchema, Component extends React.ElementType>(options: WithSchemaOptions<Omit<WithInteractivitySchemaOptions<S, React.ComponentPropsWithoutRef<Component>>, 'Component' | 'supportsEffects'> & {
|
|
36
40
|
readonly Component: ComponentAcceptingStyle<Component, WithSchemaReservedKey>;
|
|
37
41
|
readonly wrapInSequence: true;
|
|
38
42
|
readonly layout?: 'none';
|
|
39
|
-
}): React.FC<React.ComponentPropsWithRef<Component> & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps>;
|
|
43
|
+
}, WithDefaults>): React.FC<React.ComponentPropsWithRef<Component> & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps>;
|
|
44
|
+
};
|
|
45
|
+
type WithSchema = WithSequence<false> & {
|
|
40
46
|
<S extends InteractivitySchema, Props extends object>(options: WithInteractivitySchemaOptions<S, Props> & {
|
|
41
47
|
readonly wrapInSequence?: false;
|
|
42
48
|
readonly layout?: never;
|
|
@@ -370,7 +376,7 @@ export declare const Interactive: {
|
|
|
370
376
|
premountSchema: {
|
|
371
377
|
readonly premountFor: {
|
|
372
378
|
readonly type: "number";
|
|
373
|
-
readonly default:
|
|
379
|
+
readonly default: undefined;
|
|
374
380
|
readonly description: "Premount For";
|
|
375
381
|
readonly min: 0;
|
|
376
382
|
readonly step: 1;
|
|
@@ -544,7 +550,7 @@ export declare const Interactive: {
|
|
|
544
550
|
};
|
|
545
551
|
readonly premountFor: {
|
|
546
552
|
readonly type: "number";
|
|
547
|
-
readonly default:
|
|
553
|
+
readonly default: undefined;
|
|
548
554
|
readonly description: "Premount For";
|
|
549
555
|
readonly min: 0;
|
|
550
556
|
readonly step: 1;
|
|
@@ -604,7 +610,15 @@ export declare const Interactive: {
|
|
|
604
610
|
};
|
|
605
611
|
};
|
|
606
612
|
};
|
|
613
|
+
/**
|
|
614
|
+
* @deprecated Use `Interactive.create()` instead: https://www.remotion.dev/docs/interactive-create
|
|
615
|
+
*/
|
|
607
616
|
withSchema: WithSchema;
|
|
617
|
+
/**
|
|
618
|
+
* @description Creates a component with timing props and editable Studio controls.
|
|
619
|
+
* @see [Documentation](https://www.remotion.dev/docs/interactive-create)
|
|
620
|
+
*/
|
|
621
|
+
create: WithSequence<true>;
|
|
608
622
|
_internalMakeRemotionComponentIdentity: ({ packageName, componentName, }: {
|
|
609
623
|
readonly packageName: RemotionComponentIdentityPackage;
|
|
610
624
|
readonly componentName: string;
|
package/dist/cjs/Interactive.js
CHANGED
|
@@ -164,7 +164,7 @@ const withSchema = (untypedOptions) => {
|
|
|
164
164
|
style: { overflow: 'hidden', ...croppedStyle },
|
|
165
165
|
ref: ref,
|
|
166
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-
|
|
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-create", showInTimeline: isCurrentComposition ? false : showInTimeline, controls: controls, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: react_1.default.createElement(Component, {
|
|
168
168
|
...componentPropsWithoutCropping,
|
|
169
169
|
...(layout === 'none'
|
|
170
170
|
? { style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, ref }
|
|
@@ -187,6 +187,19 @@ const withSchema = (untypedOptions) => {
|
|
|
187
187
|
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Wrapped);
|
|
188
188
|
return Wrapped;
|
|
189
189
|
};
|
|
190
|
+
const create = (untypedOptions) => {
|
|
191
|
+
var _a;
|
|
192
|
+
var _b, _c;
|
|
193
|
+
const options = untypedOptions;
|
|
194
|
+
return withSchema({
|
|
195
|
+
...options,
|
|
196
|
+
wrapInSequence: true,
|
|
197
|
+
schema: (_b = options.schema) !== null && _b !== void 0 ? _b : {},
|
|
198
|
+
componentName: (_c = options.componentName) !== null && _c !== void 0 ? _c : (options.Component.displayName ||
|
|
199
|
+
((_a = options.Component.name) === null || _a === void 0 ? void 0 : _a.replace(/(.+)Inner$/, '$1')) ||
|
|
200
|
+
'Component'),
|
|
201
|
+
});
|
|
202
|
+
};
|
|
190
203
|
const makeInteractiveElement = (tag, displayName, schema) => {
|
|
191
204
|
const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
|
|
192
205
|
const { durationInFrames, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, hidden, name, showInTimeline, controls, cropLeft, cropRight, cropTop, cropBottom, style, ...props } = propsWithControls;
|
|
@@ -261,7 +274,15 @@ exports.Interactive = {
|
|
|
261
274
|
svgStrokeSchema: interactivity_schema_js_1.svgStrokeSchema,
|
|
262
275
|
premountSchema: interactivity_schema_js_1.premountSchema,
|
|
263
276
|
sequenceSchema: interactivity_schema_js_1.sequenceSchema,
|
|
277
|
+
/**
|
|
278
|
+
* @deprecated Use `Interactive.create()` instead: https://www.remotion.dev/docs/interactive-create
|
|
279
|
+
*/
|
|
264
280
|
withSchema,
|
|
281
|
+
/**
|
|
282
|
+
* @description Creates a component with timing props and editable Studio controls.
|
|
283
|
+
* @see [Documentation](https://www.remotion.dev/docs/interactive-create)
|
|
284
|
+
*/
|
|
285
|
+
create,
|
|
265
286
|
_internalMakeRemotionComponentIdentity: makeRemotionComponentIdentity,
|
|
266
287
|
A: makeInteractiveTextElement('a', '<Interactive.A>'),
|
|
267
288
|
Article: makeInteractiveTextElement('article', '<Interactive.Article>'),
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.SequenceWithoutFrom = exports.Sequence = exports.SequenceWithoutSchema = void 0;
|
|
4
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
6
39
|
const AbsoluteFillElement_js_1 = require("./AbsoluteFillElement.js");
|
|
7
40
|
const committed_metadata_js_1 = require("./committed-metadata.js");
|
|
8
41
|
const component_identity_js_1 = require("./component-identity.js");
|
|
@@ -32,12 +65,14 @@ const SeriesContentVisibilityContext = (0, react_1.createContext)(true);
|
|
|
32
65
|
const SequenceContextProvider = (0, committed_metadata_js_1.withCommittedMetadata)(SequenceContext_js_1.SequenceContext.Provider);
|
|
33
66
|
const EMPTY_EFFECTS = [];
|
|
34
67
|
const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playbackRate = 1, loop = false, freeze, durationInFrames, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalTimelineTrack: timelineTrackItem, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalSingleChildComponent: childComponentOverride, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, cropLeft, cropRight, cropTop, cropBottom, ...other }, ref) => {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
69
|
const { layout = 'absolute-fill' } = other;
|
|
37
70
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
38
71
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
39
72
|
const activityRequested = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityContext);
|
|
40
73
|
const parentDormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
|
|
74
|
+
const activitySuspended = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySuspensionContext);
|
|
75
|
+
const hadActivity = (0, react_1.useRef)(false);
|
|
41
76
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
42
77
|
const activityEnabled = activityRequested && env.isStudio && !env.isRendering;
|
|
43
78
|
const timelineTrack = (0, react_1.useContext)(timeline_track_context_js_1.TimelineTrackContext);
|
|
@@ -521,7 +556,16 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, playba
|
|
|
521
556
|
(from + actualDurationInFrames) / parentPlaybackRate,
|
|
522
557
|
}
|
|
523
558
|
: null);
|
|
524
|
-
const renderActivity = activityEnabled &&
|
|
559
|
+
const renderActivity = activityEnabled &&
|
|
560
|
+
(!activityDormant ||
|
|
561
|
+
admitted ||
|
|
562
|
+
(activitySuspended && hadActivity.current));
|
|
563
|
+
// A scene visited during playback must keep its children and registrations
|
|
564
|
+
// when it leaves the viewport, even if it was outside the discovery budget.
|
|
565
|
+
const useCommitEffect = (_j = react_1.default.useInsertionEffect) !== null && _j !== void 0 ? _j : react_1.useLayoutEffect;
|
|
566
|
+
useCommitEffect(() => {
|
|
567
|
+
hadActivity.current = renderActivity;
|
|
568
|
+
}, [renderActivity]);
|
|
525
569
|
const content = (activityEnabled ? renderActivity : contentVisible)
|
|
526
570
|
? children
|
|
527
571
|
: null;
|
|
@@ -39,6 +39,19 @@ const react_1 = __importStar(require("react"));
|
|
|
39
39
|
const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
|
|
40
40
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
41
41
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
42
|
+
// Resume through the context update, never through a wakeable callback. React
|
|
43
|
+
// 19.2 can retry an already unmounted Activity with a null Offscreen stateNode.
|
|
44
|
+
// Do not retain retry callbacks either: this token is shared by all activities.
|
|
45
|
+
const suspendedActivity = { then: () => undefined };
|
|
46
|
+
const SuspendSequenceActivity = ({ children, dormant }) => {
|
|
47
|
+
const suspended = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivitySuspensionContext);
|
|
48
|
+
if (dormant && suspended) {
|
|
49
|
+
// The hidden Activity retains its last committed children when suspended,
|
|
50
|
+
// including the metadata used by Studio's timeline registry.
|
|
51
|
+
throw suspendedActivity;
|
|
52
|
+
}
|
|
53
|
+
return children;
|
|
54
|
+
};
|
|
42
55
|
const areActivityChildrenEqual = (previous, next) => {
|
|
43
56
|
if (Object.is(previous, next)) {
|
|
44
57
|
return true;
|
|
@@ -83,6 +96,6 @@ const SequenceActivityBoundary = ({ children, dormant, frame }) => {
|
|
|
83
96
|
// Keep the providers and Activity at the same position when activating a
|
|
84
97
|
// scene. Unlike Freeze, discovery does not reset SequenceContext origins or
|
|
85
98
|
// disable Series duration inference.
|
|
86
|
-
return (jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityDormantContext.Provider, { value: dormant, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityTimelineContext.Provider, { value: dormant ? dormantTimeline : null, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityAbsoluteTimeContext.Provider, { value: dormant ? dormantTimeline : null, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: dormant ? dormantTimeline : timeline, children: jsx_runtime_1.jsx(TimelineContext_js_1.AbsoluteTimeContext.Provider, { value: dormant ? dormantTimeline : absoluteTime, children: jsx_runtime_1.jsx(react_1.default.Activity, { mode: dormant && !parentDormant ? 'hidden' : 'visible', children: children }) }) }) }) }) }));
|
|
99
|
+
return (jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityDormantContext.Provider, { value: dormant, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityTimelineContext.Provider, { value: dormant ? dormantTimeline : null, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityAbsoluteTimeContext.Provider, { value: dormant ? dormantTimeline : null, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: dormant ? dormantTimeline : timeline, children: jsx_runtime_1.jsx(TimelineContext_js_1.AbsoluteTimeContext.Provider, { value: dormant ? dormantTimeline : absoluteTime, children: jsx_runtime_1.jsx(react_1.default.Activity, { mode: dormant && !parentDormant ? 'hidden' : 'visible', children: jsx_runtime_1.jsx(SuspendSequenceActivity, { dormant: dormant, children: children }) }) }) }) }) }) }));
|
|
87
100
|
};
|
|
88
101
|
exports.SequenceActivityBoundary = SequenceActivityBoundary;
|