remotion 4.0.537 → 4.0.539
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 +62 -62
- package/dist/cjs/AbsoluteFill.js +3 -3
- package/dist/cjs/AbsoluteFillElement.d.ts +1 -1
- package/dist/cjs/AbsoluteFillElement.js +43 -5
- package/dist/cjs/CanUseRemotionHooks.js +1 -1
- package/dist/cjs/Composition.js +5 -11
- package/dist/cjs/CompositionErrorBoundary.js +5 -2
- package/dist/cjs/CompositionManager.d.ts +1 -0
- package/dist/cjs/CompositionManagerProvider.d.ts +1 -1
- package/dist/cjs/CompositionManagerProvider.js +1 -1
- package/dist/cjs/CompositionRegistryProvider.d.ts +1 -1
- package/dist/cjs/CompositionRegistryProvider.js +1 -1
- package/dist/cjs/EditorProps.d.ts +2 -2
- package/dist/cjs/EditorProps.js +1 -1
- package/dist/cjs/Folder.js +1 -1
- package/dist/cjs/HtmlInCanvas.d.ts +58 -67
- package/dist/cjs/HtmlInCanvas.js +22 -9
- package/dist/cjs/HtmlInCanvasFallback.d.ts +6 -0
- package/dist/cjs/HtmlInCanvasFallback.js +39 -0
- package/dist/cjs/IFrame.d.ts +2 -2
- package/dist/cjs/IFrame.js +1 -1
- package/dist/cjs/Img.d.ts +62 -62
- package/dist/cjs/Img.js +160 -132
- package/dist/cjs/Interactive.d.ts +147 -145
- package/dist/cjs/Interactive.js +2 -2
- package/dist/cjs/RemotionRoot.js +1 -1
- package/dist/cjs/RenderAssetManager.js +1 -1
- package/dist/cjs/Sequence.js +37 -27
- package/dist/cjs/SequenceActivityBoundary.js +1 -1
- package/dist/cjs/SequenceActivityBudget.js +1 -1
- package/dist/cjs/SequenceActivitySuspensionProvider.js +1 -1
- package/dist/cjs/SequenceManager.d.ts +6 -0
- package/dist/cjs/SequenceManager.js +71 -27
- package/dist/cjs/SequenceRegistryProvider.js +16 -3
- package/dist/cjs/TimelineContext.js +1 -1
- package/dist/cjs/Track.js +2 -2
- package/dist/cjs/animated-image/AnimatedImage.d.ts +69 -69
- package/dist/cjs/animated-image/AnimatedImage.js +6 -6
- package/dist/cjs/animated-image/canvas.d.ts +6 -5
- package/dist/cjs/animated-image/canvas.js +1 -1
- package/dist/cjs/animated-image/create-image-decoder.d.ts +1 -1
- package/dist/cjs/animated-image/decode-image.d.ts +1 -1
- package/dist/cjs/animated-image/decode-image.js +2 -0
- package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +1 -1
- package/dist/cjs/animated-image/index.js +1 -1
- package/dist/cjs/audio/AudioForPreview.js +5 -28
- package/dist/cjs/audio/AudioForRendering.d.ts +5 -20
- package/dist/cjs/audio/AudioForRendering.js +44 -5
- package/dist/cjs/audio/html5-audio.d.ts +36 -36
- package/dist/cjs/audio/html5-audio.js +8 -10
- package/dist/cjs/audio/index.js +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +10 -16
- package/dist/cjs/audio/shared-element-source-node.d.ts +1 -1
- package/dist/cjs/audio/use-audio-context.d.ts +2 -1
- package/dist/cjs/audio/wait-until-actually-resumed.d.ts +2 -1
- package/dist/cjs/buffer-until-first-frame.d.ts +4 -3
- package/dist/cjs/buffering.js +1 -1
- package/dist/cjs/cancel-render.js +3 -0
- package/dist/cjs/canvas-image/CanvasImage.d.ts +71 -71
- package/dist/cjs/canvas-image/CanvasImage.js +27 -24
- package/dist/cjs/canvas-image/index.js +1 -1
- package/dist/cjs/codec.d.ts +1 -1
- package/dist/cjs/committed-metadata.d.ts +4 -2
- package/dist/cjs/composition-registry-fallback.d.ts +4 -2
- package/dist/cjs/composition-registry-fallback.js +12 -10
- package/dist/cjs/create-element-source-proxy.js +46 -6
- package/dist/cjs/default-css.d.ts +1 -1
- package/dist/cjs/delay-render.d.ts +2 -1
- package/dist/cjs/delay-render.js +4 -2
- package/dist/cjs/easing.js +3 -1
- package/dist/cjs/effects/Solid.d.ts +60 -60
- package/dist/cjs/effects/Solid.js +2 -2
- package/dist/cjs/effects/canvas-pool.js +6 -9
- package/dist/cjs/effects/create-curve-sampler.d.ts +1 -0
- package/dist/cjs/effects/create-curve-sampler.js +100 -0
- package/dist/cjs/effects/effect-source-observer.d.ts +13 -0
- package/dist/cjs/effects/effect-source-observer.js +177 -0
- package/dist/cjs/effects/index.js +1 -1
- package/dist/cjs/effects/run-effect-chain.js +3 -0
- package/dist/cjs/effects/use-memoized-effects.d.ts +2 -1
- package/dist/cjs/effects/use-memoized-effects.js +29 -13
- package/dist/cjs/freeze.js +2 -2
- package/dist/cjs/get-cross-origin-value.d.ts +1 -1
- package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +32 -32
- package/dist/cjs/interactivity-schema.d.ts +286 -286
- package/dist/cjs/internals.d.ts +412 -595
- package/dist/cjs/internals.js +11 -0
- package/dist/cjs/interpolate-colors.d.ts +1 -1
- package/dist/cjs/interpolate-colors.js +28 -23
- package/dist/cjs/interpolate.d.ts +2 -9
- package/dist/cjs/interpolate.js +37 -33
- package/dist/cjs/is-player.js +1 -1
- package/dist/cjs/loading-indicator.js +2 -6
- package/dist/cjs/log-level-context.d.ts +1 -1
- package/dist/cjs/log.d.ts +12 -7
- package/dist/cjs/loop/index.js +1 -1
- package/dist/cjs/media-resource-manager.d.ts +1 -1
- package/dist/cjs/media-tag-current-time-timestamp.d.ts +1 -1
- package/dist/cjs/no-react.d.ts +85 -91
- package/dist/cjs/no-react.js +2 -2
- package/dist/cjs/nonce.d.ts +11 -0
- package/dist/cjs/nonce.js +42 -0
- package/dist/cjs/play-and-handle-not-allowed-error.d.ts +5 -4
- package/dist/cjs/playback-logging.d.ts +2 -1
- package/dist/cjs/playback-pitch-context.d.ts +1 -0
- package/dist/cjs/playback-pitch-context.js +5 -0
- package/dist/cjs/prefetch-state.js +1 -1
- package/dist/cjs/prefetch.d.ts +7 -6
- package/dist/cjs/prefetch.js +30 -5
- package/dist/cjs/props-if-has-props.d.ts +2 -1
- package/dist/cjs/prores-profile.d.ts +1 -1
- package/dist/cjs/register-root.d.ts +2 -2
- package/dist/cjs/render-resource-manager.d.ts +1 -1
- package/dist/cjs/render-types.d.ts +2 -2
- package/dist/cjs/resolve-video-config.d.ts +8 -8
- package/dist/cjs/runtime-value-store.d.ts +1 -1
- package/dist/cjs/scale-value.d.ts +1 -1
- package/dist/cjs/seek.d.ts +3 -2
- package/dist/cjs/sequence-activity-context.js +1 -1
- package/dist/cjs/sequence-crop.js +1 -4
- package/dist/cjs/sequence-order-marker.d.ts +58 -0
- package/dist/cjs/sequence-order-marker.js +44 -0
- package/dist/cjs/series/flatten-children.d.ts +3 -1
- package/dist/cjs/series/index.js +4 -5
- package/dist/cjs/series/is-inside-series.js +2 -2
- package/dist/cjs/spring/index.d.ts +1 -1
- package/dist/cjs/spring/index.js +2 -4
- package/dist/cjs/spring/measure-spring.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.js +11 -5
- package/dist/cjs/timeline-position-state.d.ts +1 -1
- package/dist/cjs/timeline-position-state.js +2 -2
- package/dist/cjs/use-amplification.d.ts +4 -7
- package/dist/cjs/use-current-scale.d.ts +2 -2
- package/dist/cjs/use-delay-render.d.ts +2 -1
- package/dist/cjs/use-lazy-component.d.ts +1 -1
- package/dist/cjs/use-lazy-component.js +20 -9
- package/dist/cjs/use-media-buffering.d.ts +3 -2
- package/dist/cjs/use-media-duration.d.ts +4 -0
- package/dist/cjs/use-media-duration.js +36 -0
- package/dist/cjs/use-media-enabled.d.ts +1 -1
- package/dist/cjs/use-media-enabled.js +1 -1
- package/dist/cjs/use-media-in-timeline.d.ts +1 -1
- package/dist/cjs/use-media-playback.d.ts +3 -3
- package/dist/cjs/use-media-tag.d.ts +2 -2
- package/dist/cjs/use-pixel-density.d.ts +1 -1
- package/dist/cjs/use-premounting.d.ts +1 -1
- package/dist/cjs/use-premounting.js +6 -2
- package/dist/cjs/use-request-video-callback-time.d.ts +3 -3
- package/dist/cjs/use-schema.d.ts +4 -4
- package/dist/cjs/use-video.js +1 -1
- package/dist/cjs/validate-media-props.d.ts +1 -1
- package/dist/cjs/validation/validate-default-props.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/MediaPlaybackError.js +0 -1
- package/dist/cjs/video/OffthreadVideo.js +5 -5
- package/dist/cjs/video/OffthreadVideoForRendering.js +9 -7
- package/dist/cjs/video/VideoForPreview.js +6 -28
- package/dist/cjs/video/VideoForRendering.d.ts +5 -3
- package/dist/cjs/video/VideoForRendering.js +4 -2
- package/dist/cjs/video/duration-state.d.ts +1 -0
- package/dist/cjs/video/duration-state.js +8 -2
- package/dist/cjs/video/emit-video-frame.d.ts +1 -1
- package/dist/cjs/video/html5-video.d.ts +36 -36
- package/dist/cjs/video/html5-video.js +8 -10
- package/dist/cjs/video/index.js +2 -2
- package/dist/cjs/video/seek-until-right.d.ts +3 -2
- package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -1
- package/dist/cjs/with-interactivity-schema.d.ts +1 -1
- package/dist/cjs/with-interactivity-schema.js +3 -8
- package/dist/cjs/wrap-remotion-context.d.ts +4 -4
- package/dist/cjs/wrap-remotion-context.js +2 -2
- package/dist/esm/index.mjs +1304 -819
- package/dist/esm/no-react.mjs +74 -52
- package/dist/esm/version.mjs +1 -1
- package/package.json +4 -4
|
@@ -16,16 +16,13 @@ const webgl2_context_error_js_1 = require("./webgl2-context-error.js");
|
|
|
16
16
|
// contexts and backing stores as soon as the chain is torn down instead of
|
|
17
17
|
// leaving that to the garbage collector.
|
|
18
18
|
class CanvasPool {
|
|
19
|
-
width;
|
|
20
|
-
height;
|
|
21
|
-
pairs = new Map();
|
|
22
|
-
// Tracked individually rather than through `pairs` so that a canvas whose
|
|
23
|
-
// sibling failed to allocate still gets released.
|
|
24
|
-
allocated = [];
|
|
25
|
-
lostContexts = new Set();
|
|
26
|
-
onContextLost;
|
|
27
|
-
disposed = false;
|
|
28
19
|
constructor(width, height, onContextLost) {
|
|
20
|
+
this.pairs = new Map();
|
|
21
|
+
// Tracked individually rather than through `pairs` so that a canvas whose
|
|
22
|
+
// sibling failed to allocate still gets released.
|
|
23
|
+
this.allocated = [];
|
|
24
|
+
this.lostContexts = new Set();
|
|
25
|
+
this.disposed = false;
|
|
29
26
|
this.width = width;
|
|
30
27
|
this.height = height;
|
|
31
28
|
this.onContextLost = onContextLost;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createCurveSampler: (points: readonly (readonly [number, number])[], interpolation: 'smooth' | 'linear') => ((input: number) => number);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCurveSampler = void 0;
|
|
4
|
+
// Shared by the Curves renderer and Studio so the graph matches the pixels.
|
|
5
|
+
// Points are validated by the effect: at least two, with increasing inputs.
|
|
6
|
+
const createCurveSampler = (points, interpolation) => {
|
|
7
|
+
// Parameterize by distance along the graph so a steep segment gets room
|
|
8
|
+
// to bend, even when its input values are close together.
|
|
9
|
+
const distances = points
|
|
10
|
+
.slice(1)
|
|
11
|
+
.map((point, index) => Math.hypot(point[0] - points[index][0], point[1] - points[index][1]));
|
|
12
|
+
const tangents = points.map(() => [0, 0]);
|
|
13
|
+
if (interpolation === 'smooth' && points.length > 2) {
|
|
14
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
15
|
+
const slopes = distances.map((distance, index) => (points[index + 1][axis] - points[index][axis]) / distance);
|
|
16
|
+
const curvatures = new Array(points.length).fill(0);
|
|
17
|
+
const upper = new Array(points.length).fill(0);
|
|
18
|
+
// Solve the natural cubic spline for each coordinate.
|
|
19
|
+
for (let index = 1; index < points.length - 1; index++) {
|
|
20
|
+
const diagonal = 2 * (distances[index - 1] + distances[index]) -
|
|
21
|
+
distances[index - 1] * upper[index - 1];
|
|
22
|
+
upper[index] = distances[index] / diagonal;
|
|
23
|
+
curvatures[index] =
|
|
24
|
+
(6 * (slopes[index] - slopes[index - 1]) -
|
|
25
|
+
distances[index - 1] * curvatures[index - 1]) /
|
|
26
|
+
diagonal;
|
|
27
|
+
}
|
|
28
|
+
for (let index = points.length - 2; index > 0; index--) {
|
|
29
|
+
curvatures[index] -= upper[index] * curvatures[index + 1];
|
|
30
|
+
}
|
|
31
|
+
for (let index = 0; index < points.length; index++) {
|
|
32
|
+
tangents[index][axis] =
|
|
33
|
+
index === 0
|
|
34
|
+
? slopes[0] - (distances[0] * curvatures[1]) / 6
|
|
35
|
+
: slopes[index - 1] +
|
|
36
|
+
(distances[index - 1] *
|
|
37
|
+
(curvatures[index - 1] + 2 * curvatures[index])) /
|
|
38
|
+
6;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (let index = 0; index < points.length; index++) {
|
|
42
|
+
// Keep both Bezier handles within their segment's input range so
|
|
43
|
+
// the curve never doubles back and every input has one output.
|
|
44
|
+
const maxTangent = 3 *
|
|
45
|
+
Math.min(index === 0
|
|
46
|
+
? Infinity
|
|
47
|
+
: (points[index][0] - points[index - 1][0]) / distances[index - 1], index === points.length - 1
|
|
48
|
+
? Infinity
|
|
49
|
+
: (points[index + 1][0] - points[index][0]) / distances[index]);
|
|
50
|
+
if (tangents[index][0] > maxTangent) {
|
|
51
|
+
tangents[index][1] *= maxTangent / tangents[index][0];
|
|
52
|
+
}
|
|
53
|
+
tangents[index][0] = Math.max(0, Math.min(maxTangent, tangents[index][0]));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return (input) => {
|
|
57
|
+
if (input <= points[0][0])
|
|
58
|
+
return points[0][1];
|
|
59
|
+
if (input >= points[points.length - 1][0]) {
|
|
60
|
+
return points[points.length - 1][1];
|
|
61
|
+
}
|
|
62
|
+
const index = points.findIndex((point) => point[0] > input) - 1;
|
|
63
|
+
const start = points[index];
|
|
64
|
+
const end = points[index + 1];
|
|
65
|
+
if (input === start[0])
|
|
66
|
+
return start[1];
|
|
67
|
+
if (interpolation === 'linear' || points.length === 2) {
|
|
68
|
+
return (start[1] +
|
|
69
|
+
(end[1] - start[1]) * ((input - start[0]) / (end[0] - start[0])));
|
|
70
|
+
}
|
|
71
|
+
const handleLength = distances[index] / 3;
|
|
72
|
+
const firstX = start[0] + handleLength * tangents[index][0];
|
|
73
|
+
const secondX = end[0] - handleLength * tangents[index + 1][0];
|
|
74
|
+
let low = 0;
|
|
75
|
+
let high = 1;
|
|
76
|
+
// Invert the monotonic Bezier input coordinate before sampling output.
|
|
77
|
+
for (let iteration = 0; iteration < 32; iteration++) {
|
|
78
|
+
const candidate = (low + high) / 2;
|
|
79
|
+
const inverse = 1 - candidate;
|
|
80
|
+
const x = inverse ** 3 * start[0] +
|
|
81
|
+
3 * inverse ** 2 * candidate * firstX +
|
|
82
|
+
3 * inverse * candidate ** 2 * secondX +
|
|
83
|
+
candidate ** 3 * end[0];
|
|
84
|
+
if (x < input)
|
|
85
|
+
low = candidate;
|
|
86
|
+
else
|
|
87
|
+
high = candidate;
|
|
88
|
+
}
|
|
89
|
+
const progress = (low + high) / 2;
|
|
90
|
+
const remaining = 1 - progress;
|
|
91
|
+
const firstY = start[1] + handleLength * tangents[index][1];
|
|
92
|
+
const secondY = end[1] - handleLength * tangents[index + 1][1];
|
|
93
|
+
const value = remaining ** 3 * start[1] +
|
|
94
|
+
3 * remaining ** 2 * progress * firstY +
|
|
95
|
+
3 * remaining * progress ** 2 * secondY +
|
|
96
|
+
progress ** 3 * end[1];
|
|
97
|
+
return Math.max(0, Math.min(1, value));
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
exports.createCurveSampler = createCurveSampler;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EffectDefinitionAndStack } from './effect-types.js';
|
|
2
|
+
import type { EffectChainState } from './run-effect-chain.js';
|
|
3
|
+
type SourceListener = (source: CanvasImageSource | null) => void;
|
|
4
|
+
/** Studio-only inspection. The source is borrowed and must be consumed synchronously. */
|
|
5
|
+
export declare const subscribeToEffectSource: ({ sequenceKey, effectIndex, onSource, }: {
|
|
6
|
+
readonly sequenceKey: string;
|
|
7
|
+
readonly effectIndex: number;
|
|
8
|
+
readonly onSource: SourceListener;
|
|
9
|
+
}) => (() => void);
|
|
10
|
+
export declare const publishEffectSource: (effect: EffectDefinitionAndStack<unknown>, source: CanvasImageSource, chain: EffectChainState) => void;
|
|
11
|
+
export declare const invalidateEffectChainSources: (chain: EffectChainState) => void;
|
|
12
|
+
export declare const useEffectSourceInspection: (effects: EffectDefinitionAndStack<unknown>[], sequenceKey: string | null) => EffectDefinitionAndStack<unknown>[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,177 @@
|
|
|
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
|
+
})();
|
|
35
|
+
var _a;
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.useEffectSourceInspection = exports.invalidateEffectChainSources = exports.publishEffectSource = exports.subscribeToEffectSource = void 0;
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const observers = new Map();
|
|
40
|
+
const redrawListeners = new Map();
|
|
41
|
+
const identities = new WeakMap();
|
|
42
|
+
const inspectedChains = new WeakMap();
|
|
43
|
+
const sourceChainOwners = new Map();
|
|
44
|
+
const useIdentityCommitEffect = (_a = react_1.default.useInsertionEffect) !== null && _a !== void 0 ? _a : react_1.useLayoutEffect;
|
|
45
|
+
/** Studio-only inspection. The source is borrowed and must be consumed synchronously. */
|
|
46
|
+
const subscribeToEffectSource = ({ sequenceKey, effectIndex, onSource, }) => {
|
|
47
|
+
var _a;
|
|
48
|
+
let sequence = observers.get(sequenceKey);
|
|
49
|
+
if (!sequence) {
|
|
50
|
+
sequence = new Map();
|
|
51
|
+
observers.set(sequenceKey, sequence);
|
|
52
|
+
}
|
|
53
|
+
let listeners = sequence.get(effectIndex);
|
|
54
|
+
if (!listeners) {
|
|
55
|
+
listeners = new Set();
|
|
56
|
+
sequence.set(effectIndex, listeners);
|
|
57
|
+
}
|
|
58
|
+
listeners.add(onSource);
|
|
59
|
+
// Repaint once when the inspector opens, including while playback is paused.
|
|
60
|
+
(_a = redrawListeners.get(sequenceKey)) === null || _a === void 0 ? void 0 : _a.forEach((redraw) => redraw());
|
|
61
|
+
return () => {
|
|
62
|
+
listeners.delete(onSource);
|
|
63
|
+
if (listeners.size === 0) {
|
|
64
|
+
sequence.delete(effectIndex);
|
|
65
|
+
}
|
|
66
|
+
if (sequence.size === 0) {
|
|
67
|
+
observers.delete(sequenceKey);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.subscribeToEffectSource = subscribeToEffectSource;
|
|
72
|
+
const publishEffectSource = (effect, source, chain) => {
|
|
73
|
+
var _a;
|
|
74
|
+
if (observers.size === 0) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const identity = identities.get(effect);
|
|
78
|
+
if (!identity) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const listeners = (_a = observers
|
|
82
|
+
.get(identity.sequenceKey)) === null || _a === void 0 ? void 0 : _a.get(identity.effectIndex);
|
|
83
|
+
if (!listeners || listeners.size === 0) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
let inspected = inspectedChains.get(chain);
|
|
87
|
+
if (!inspected) {
|
|
88
|
+
inspected = new Map();
|
|
89
|
+
inspectedChains.set(chain, inspected);
|
|
90
|
+
}
|
|
91
|
+
const key = `${identity.sequenceKey}\0${identity.effectIndex}`;
|
|
92
|
+
inspected.set(key, identity);
|
|
93
|
+
sourceChainOwners.set(key, chain);
|
|
94
|
+
listeners.forEach((listener) => {
|
|
95
|
+
try {
|
|
96
|
+
listener(source);
|
|
97
|
+
}
|
|
98
|
+
catch (_a) {
|
|
99
|
+
// Optional inspector readback must never interrupt rendering.
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
exports.publishEffectSource = publishEffectSource;
|
|
104
|
+
const invalidateEffectChainSources = (chain) => {
|
|
105
|
+
const inspected = inspectedChains.get(chain);
|
|
106
|
+
inspectedChains.delete(chain);
|
|
107
|
+
inspected === null || inspected === void 0 ? void 0 : inspected.forEach((identity, key) => {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
// A replacement canvas may already have painted before the old canvas's
|
|
110
|
+
// passive cleanup. Only the current owner can invalidate its histogram.
|
|
111
|
+
if (sourceChainOwners.get(key) !== chain) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
sourceChainOwners.delete(key);
|
|
115
|
+
(_b = (_a = observers
|
|
116
|
+
.get(identity.sequenceKey)) === null || _a === void 0 ? void 0 : _a.get(identity.effectIndex)) === null || _b === void 0 ? void 0 : _b.forEach((listener) => {
|
|
117
|
+
try {
|
|
118
|
+
listener(null);
|
|
119
|
+
}
|
|
120
|
+
catch (_a) {
|
|
121
|
+
// Optional inspection must not interfere with canvas cleanup.
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
exports.invalidateEffectChainSources = invalidateEffectChainSources;
|
|
127
|
+
const useEffectSourceInspection = (effects, sequenceKey) => {
|
|
128
|
+
const [revision, setRevision] = (0, react_1.useState)(0);
|
|
129
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
130
|
+
if (sequenceKey === null) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
let listeners = redrawListeners.get(sequenceKey);
|
|
134
|
+
if (!listeners) {
|
|
135
|
+
listeners = new Set();
|
|
136
|
+
redrawListeners.set(sequenceKey, listeners);
|
|
137
|
+
}
|
|
138
|
+
const redraw = () => setRevision((previous) => previous + 1);
|
|
139
|
+
listeners.add(redraw);
|
|
140
|
+
if (observers.has(sequenceKey)) {
|
|
141
|
+
redraw();
|
|
142
|
+
}
|
|
143
|
+
return () => {
|
|
144
|
+
var _a;
|
|
145
|
+
listeners.delete(redraw);
|
|
146
|
+
if (listeners.size === 0) {
|
|
147
|
+
redrawListeners.delete(sequenceKey);
|
|
148
|
+
(_a = observers.get(sequenceKey)) === null || _a === void 0 ? void 0 : _a.forEach((sourceListeners) => {
|
|
149
|
+
sourceListeners.forEach((listener) => {
|
|
150
|
+
try {
|
|
151
|
+
listener(null);
|
|
152
|
+
}
|
|
153
|
+
catch (_a) {
|
|
154
|
+
// An inspector must not interfere with source cleanup.
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}, [sequenceKey]);
|
|
161
|
+
useIdentityCommitEffect(() => {
|
|
162
|
+
if (sequenceKey === null) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
effects.forEach((effect, effectIndex) => {
|
|
166
|
+
identities.set(effect, { sequenceKey, effectIndex });
|
|
167
|
+
});
|
|
168
|
+
return () => {
|
|
169
|
+
effects.forEach((effect) => identities.delete(effect));
|
|
170
|
+
};
|
|
171
|
+
}, [effects, sequenceKey]);
|
|
172
|
+
// Source components already repaint when their effect array changes.
|
|
173
|
+
return (0, react_1.useMemo)(() => {
|
|
174
|
+
return sequenceKey === null || revision === 0 ? effects : effects.slice();
|
|
175
|
+
}, [effects, revision, sequenceKey]);
|
|
176
|
+
};
|
|
177
|
+
exports.useEffectSourceInspection = useEffectSourceInspection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createEffect = void 0;
|
|
4
|
-
|
|
4
|
+
var create_effect_js_1 = require("./create-effect.js");
|
|
5
5
|
Object.defineProperty(exports, "createEffect", { enumerable: true, get: function () { return create_effect_js_1.createEffect; } });
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runEffectChain = exports.cleanupEffectChainState = exports.createEffectChainState = void 0;
|
|
4
4
|
const canvas_pool_js_1 = require("./canvas-pool.js");
|
|
5
5
|
const effect_internals_js_1 = require("./effect-internals.js");
|
|
6
|
+
const effect_source_observer_js_1 = require("./effect-source-observer.js");
|
|
6
7
|
const gpu_device_js_1 = require("./gpu-device.js");
|
|
7
8
|
const createEffectChainState = (width, height) => {
|
|
8
9
|
const state = {
|
|
@@ -35,6 +36,7 @@ exports.createEffectChainState = createEffectChainState;
|
|
|
35
36
|
// canvases and contexts. The state must not be used afterwards.
|
|
36
37
|
const cleanupEffectChainState = (state) => {
|
|
37
38
|
state.currentRunId++;
|
|
39
|
+
(0, effect_source_observer_js_1.invalidateEffectChainSources)(state);
|
|
38
40
|
try {
|
|
39
41
|
for (const entry of state.cleanupRegistry) {
|
|
40
42
|
entry.definition.cleanup(entry.state);
|
|
@@ -119,6 +121,7 @@ const runEffectChainWithoutResize = async ({ state, source, effects, output, wid
|
|
|
119
121
|
state.pool.assertContextNotLost(dst);
|
|
120
122
|
}
|
|
121
123
|
const setupState = ensureSetup(state, def, dst);
|
|
124
|
+
(0, effect_source_observer_js_1.publishEffectSource)(eff, currentImage, state);
|
|
122
125
|
def.apply({
|
|
123
126
|
source: currentImage,
|
|
124
127
|
target: dst,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RuntimeValueStore } from '../runtime-value-store.js';
|
|
2
|
-
import type { CannotUpdateEffectReason, CannotUpdateSequenceReason } from '../SequenceManager.js';
|
|
2
|
+
import type { CannotUpdateEffectReason, CannotUpdateSequenceReason, CanUpdateSequencePropsResponse } from '../SequenceManager.js';
|
|
3
3
|
import { type SequencePropsSubscriptionKey } from '../SequenceManager.js';
|
|
4
4
|
import { type CanUpdateSequencePropStatus, type PropStatuses } from '../use-schema.js';
|
|
5
5
|
import type { VideoConfigValues } from '../video-config.js';
|
|
@@ -22,6 +22,7 @@ export declare const getEffectPropStatusesCtx: ({ propStatuses, nodePath, effect
|
|
|
22
22
|
nodePath: SequencePropsSubscriptionKey;
|
|
23
23
|
effectIndex: number;
|
|
24
24
|
}) => EffectStatus;
|
|
25
|
+
export declare const getPropStatusesForSequenceStatus: (status: CanUpdateSequencePropsResponse | null, videoConfigValues: VideoConfigValues | null) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
25
26
|
export declare const getPropStatusesCtx: (propStatuses: PropStatuses, nodePath: SequencePropsSubscriptionKey) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
26
27
|
export type GetPropStatusesType = typeof getPropStatusesCtx;
|
|
27
28
|
export declare const useMemoizedEffects: ({ effects, overrideId, videoConfigValues, }: {
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
var _a;
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.useMemoizedEffects = exports.getPropStatusesCtx = exports.getEffectPropStatusesCtx = exports.useMemoizedEffectDefinitions = void 0;
|
|
37
|
+
exports.useMemoizedEffects = exports.getPropStatusesCtx = exports.getPropStatusesForSequenceStatus = exports.getEffectPropStatusesCtx = exports.useMemoizedEffectDefinitions = void 0;
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const evaluate_source_expressions_js_1 = require("../evaluate-source-expressions.js");
|
|
40
40
|
const get_effective_visual_mode_value_js_1 = require("../get-effective-visual-mode-value.js");
|
|
@@ -45,6 +45,8 @@ const sequence_activity_context_js_1 = require("../sequence-activity-context.js"
|
|
|
45
45
|
const sequence_node_path_js_1 = require("../sequence-node-path.js");
|
|
46
46
|
const SequenceManager_js_1 = require("../SequenceManager.js");
|
|
47
47
|
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
48
|
+
const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
|
|
49
|
+
const effect_source_observer_js_1 = require("./effect-source-observer.js");
|
|
48
50
|
const emptyDragOverrides = {};
|
|
49
51
|
const useCacheCommitEffect = (_a = react_1.default.useInsertionEffect) !== null && _a !== void 0 ? _a : react_1.useLayoutEffect;
|
|
50
52
|
const areEffectParamsEqual = (previous, next) => {
|
|
@@ -181,8 +183,7 @@ const useMemoizedEffectDefinitions = (effects) => {
|
|
|
181
183
|
return stableDefinitions;
|
|
182
184
|
};
|
|
183
185
|
exports.useMemoizedEffectDefinitions = useMemoizedEffectDefinitions;
|
|
184
|
-
const
|
|
185
|
-
const status = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)];
|
|
186
|
+
const getEffectStatusForSequenceStatus = ({ status, effectIndex, videoConfigValues, }) => {
|
|
186
187
|
if (!status) {
|
|
187
188
|
return { type: 'cannot-update-sequence', reason: 'not-found' };
|
|
188
189
|
}
|
|
@@ -198,42 +199,55 @@ const getEffectPropStatusesCtx = ({ propStatuses, nodePath, effectIndex, }) => {
|
|
|
198
199
|
}
|
|
199
200
|
return {
|
|
200
201
|
type: 'can-update-effect',
|
|
201
|
-
props: (0, evaluate_source_expressions_js_1.evaluateSourcePropStatuses)(effect.props,
|
|
202
|
+
props: (0, evaluate_source_expressions_js_1.evaluateSourcePropStatuses)(effect.props, videoConfigValues),
|
|
202
203
|
};
|
|
203
204
|
};
|
|
205
|
+
const getEffectPropStatusesCtx = ({ propStatuses, nodePath, effectIndex, }) => {
|
|
206
|
+
var _a;
|
|
207
|
+
return getEffectStatusForSequenceStatus({
|
|
208
|
+
status: (_a = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)]) !== null && _a !== void 0 ? _a : null,
|
|
209
|
+
effectIndex,
|
|
210
|
+
videoConfigValues: nodePath.videoConfigValues,
|
|
211
|
+
});
|
|
212
|
+
};
|
|
204
213
|
exports.getEffectPropStatusesCtx = getEffectPropStatusesCtx;
|
|
205
|
-
const
|
|
206
|
-
const status = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)];
|
|
214
|
+
const getPropStatusesForSequenceStatus = (status, videoConfigValues) => {
|
|
207
215
|
if (!status) {
|
|
208
216
|
return undefined;
|
|
209
217
|
}
|
|
210
218
|
if (!status.canUpdate) {
|
|
211
219
|
return undefined;
|
|
212
220
|
}
|
|
213
|
-
return (0, evaluate_source_expressions_js_1.evaluateSourcePropStatuses)(status.props,
|
|
221
|
+
return (0, evaluate_source_expressions_js_1.evaluateSourcePropStatuses)(status.props, videoConfigValues);
|
|
222
|
+
};
|
|
223
|
+
exports.getPropStatusesForSequenceStatus = getPropStatusesForSequenceStatus;
|
|
224
|
+
const getPropStatusesCtx = (propStatuses, nodePath) => {
|
|
225
|
+
var _a;
|
|
226
|
+
return (0, exports.getPropStatusesForSequenceStatus)((_a = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)]) !== null && _a !== void 0 ? _a : null, nodePath.videoConfigValues);
|
|
214
227
|
};
|
|
215
228
|
exports.getPropStatusesCtx = getPropStatusesCtx;
|
|
216
229
|
const useMemoizedEffects = ({ effects, overrideId, videoConfigValues, }) => {
|
|
217
230
|
var _a;
|
|
218
231
|
const previousRef = (0, react_1.useRef)(null);
|
|
219
|
-
const {
|
|
232
|
+
const { isStudio } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
220
233
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
|
|
221
234
|
const previous = previousRef.current;
|
|
222
235
|
const nodePath = overrideId
|
|
223
236
|
? ((_a = overrideIdToNodePathMappings[overrideId]) !== null && _a !== void 0 ? _a : null)
|
|
224
237
|
: null;
|
|
225
238
|
const effectDragOverrides = (0, SequenceManager_js_1.useEffectDragOverridesForNodePath)(nodePath);
|
|
239
|
+
const sequenceStatus = (0, SequenceManager_js_1.usePropStatusForNodePath)(nodePath);
|
|
226
240
|
const effectPropStatuses = (0, react_1.useMemo)(() => Array.from({ length: effects.length }, (_, effectIndex) => {
|
|
227
241
|
if (nodePath === null) {
|
|
228
242
|
return null;
|
|
229
243
|
}
|
|
230
|
-
const status = (
|
|
231
|
-
|
|
232
|
-
nodePath: { ...nodePath, videoConfigValues },
|
|
244
|
+
const status = getEffectStatusForSequenceStatus({
|
|
245
|
+
status: sequenceStatus,
|
|
233
246
|
effectIndex,
|
|
247
|
+
videoConfigValues,
|
|
234
248
|
});
|
|
235
249
|
return status.type === 'can-update-effect' ? status.props : null;
|
|
236
|
-
}), [effects.length, nodePath,
|
|
250
|
+
}), [effects.length, nodePath, sequenceStatus, videoConfigValues]);
|
|
237
251
|
const animatedEffects = (0, react_1.useMemo)(() => effectPropStatuses.map((status, index) => {
|
|
238
252
|
var _a;
|
|
239
253
|
return Object.values(status !== null && status !== void 0 ? status : {}).some((prop) => prop.status === 'keyframed') ||
|
|
@@ -297,6 +311,8 @@ const useMemoizedEffects = ({ effects, overrideId, videoConfigValues, }) => {
|
|
|
297
311
|
useCacheCommitEffect(() => {
|
|
298
312
|
previousRef.current = { prepared, effects: next };
|
|
299
313
|
}, [next, prepared]);
|
|
300
|
-
return next
|
|
314
|
+
return (0, effect_source_observer_js_1.useEffectSourceInspection)(next, isStudio && nodePath !== null
|
|
315
|
+
? (0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)({ ...nodePath, videoConfigValues })
|
|
316
|
+
: null);
|
|
301
317
|
};
|
|
302
318
|
exports.useMemoizedEffects = useMemoizedEffects;
|
package/dist/cjs/freeze.js
CHANGED
|
@@ -77,7 +77,7 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, _remotionIntern
|
|
|
77
77
|
};
|
|
78
78
|
}, [sequenceContext, isActive]);
|
|
79
79
|
const providedTimeline = isActive ? frozenTimelineValue : timelineContext;
|
|
80
|
-
return (jsx_runtime_1.jsx(NonPremountFreezeContext.Provider, { value: isInsideNonPremountFreeze ||
|
|
81
|
-
(Boolean(isActive) && !_remotionInternalIsPremounting), children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: providedTimeline, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceActivityTimelineContext.Provider, { value: activityDormant ? providedTimeline : null, children: jsx_runtime_1.jsx(SequenceContext_js_1.SequenceContext.Provider, { value: newSequenceContext, children: children }) }) }) }));
|
|
80
|
+
return ((0, jsx_runtime_1.jsx)(NonPremountFreezeContext.Provider, { value: isInsideNonPremountFreeze ||
|
|
81
|
+
(Boolean(isActive) && !_remotionInternalIsPremounting), children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContext.Provider, { value: providedTimeline, children: (0, jsx_runtime_1.jsx)(sequence_activity_context_js_1.SequenceActivityTimelineContext.Provider, { value: activityDormant ? providedTimeline : null, children: (0, jsx_runtime_1.jsx)(SequenceContext_js_1.SequenceContext.Provider, { value: newSequenceContext, children: children }) }) }) }));
|
|
82
82
|
};
|
|
83
83
|
exports.Freeze = Freeze;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const getCrossOriginValue: ({ crossOrigin, requestsVideoFrame, isClientSideRendering, }: {
|
|
2
|
-
crossOrigin:
|
|
2
|
+
crossOrigin: '' | 'anonymous' | 'use-credentials' | undefined;
|
|
3
3
|
requestsVideoFrame: boolean;
|
|
4
4
|
isClientSideRendering: boolean;
|
|
5
5
|
}) => "" | "anonymous" | "use-credentials" | undefined;
|
|
@@ -14,9 +14,9 @@ export declare const resolveDragOverrideValue: ({ dragOverrideValue, frame, }: {
|
|
|
14
14
|
frame: number | null;
|
|
15
15
|
}) => ResolvedDragOverrideValue;
|
|
16
16
|
export declare const getEffectiveVisualModeValue: ({ propStatus, dragOverrideValue, defaultValue, frame, shouldResortToDefaultValueIfUndefined, }: {
|
|
17
|
-
propStatus:
|
|
17
|
+
propStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
|
|
18
18
|
dragOverrideValue: DragOverrideValue | undefined;
|
|
19
19
|
defaultValue: unknown;
|
|
20
|
-
frame?: number | null
|
|
20
|
+
frame?: number | null;
|
|
21
21
|
shouldResortToDefaultValueIfUndefined: boolean;
|
|
22
22
|
}) => unknown;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { DelayRenderScope } from './delay-render.js';
|
|
|
6
6
|
import { type TFolder } from './Folder.js';
|
|
7
7
|
import type { StaticFile } from './get-static-files.js';
|
|
8
8
|
import type { ArrayFieldSchema, ArrayItemFieldSchema, AssetFieldSchema, CaptionsFieldSchema, InteractivitySchema, InteractivitySchemaField } from './interactivity-schema.js';
|
|
9
|
+
import { useIsPlayer } from './is-player.js';
|
|
9
10
|
import type { LogLevel } from './log.js';
|
|
10
11
|
import type { ProResProfile } from './prores-profile.js';
|
|
11
12
|
import type { PixelFormat, VideoImageFormat } from './render-types.js';
|
|
@@ -28,6 +29,7 @@ declare global {
|
|
|
28
29
|
};
|
|
29
30
|
remotion_delayRenderHandles: number[];
|
|
30
31
|
remotion_cancelledError: string | undefined;
|
|
32
|
+
remotion_cancelledErrorObject: Error | undefined;
|
|
31
33
|
remotion_getCompositionNames: () => string[];
|
|
32
34
|
remotion_seenCompositionIds: string[];
|
|
33
35
|
getStaticCompositions: () => Promise<VideoConfigWithSerializedProps[]>;
|
|
@@ -170,7 +172,7 @@ export declare const Experimental: {
|
|
|
170
172
|
* @description This is a special component, that, when rendered, will skip rendering the frame altogether.
|
|
171
173
|
*/
|
|
172
174
|
Null: import("react").FC<{}>;
|
|
173
|
-
useIsPlayer:
|
|
175
|
+
useIsPlayer: typeof useIsPlayer;
|
|
174
176
|
};
|
|
175
177
|
export declare const Config: {};
|
|
176
178
|
export type _InternalTypes = {
|