remotion 4.0.534 → 4.0.536

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AbsoluteFill.d.ts +2 -7
  3. package/dist/cjs/AbsoluteFill.js +1 -1
  4. package/dist/cjs/Composition.js +15 -20
  5. package/dist/cjs/CompositionManager.d.ts +0 -4
  6. package/dist/cjs/CompositionManagerContext.d.ts +1 -6
  7. package/dist/cjs/CompositionManagerContext.js +0 -4
  8. package/dist/cjs/CompositionManagerProvider.js +77 -169
  9. package/dist/cjs/CompositionRegistryProvider.d.ts +5 -0
  10. package/dist/cjs/CompositionRegistryProvider.js +142 -0
  11. package/dist/cjs/DefaultPremountContext.d.ts +1 -0
  12. package/dist/cjs/DefaultPremountContext.js +6 -0
  13. package/dist/cjs/Folder.js +11 -20
  14. package/dist/cjs/HtmlInCanvas.d.ts +6 -4
  15. package/dist/cjs/HtmlInCanvas.js +179 -32
  16. package/dist/cjs/IFrame.js +40 -8
  17. package/dist/cjs/Img.d.ts +4 -2
  18. package/dist/cjs/Img.js +4 -3
  19. package/dist/cjs/Interactive.d.ts +31 -5
  20. package/dist/cjs/Interactive.js +40 -8
  21. package/dist/cjs/RemotionRoot.js +2 -1
  22. package/dist/cjs/Sequence.d.ts +2 -3
  23. package/dist/cjs/Sequence.js +117 -39
  24. package/dist/cjs/SequenceActivityBoundary.d.ts +10 -0
  25. package/dist/cjs/SequenceActivityBoundary.js +101 -0
  26. package/dist/cjs/SequenceActivityBudget.d.ts +13 -0
  27. package/dist/cjs/SequenceActivityBudget.js +196 -0
  28. package/dist/cjs/SequenceActivitySuspensionProvider.d.ts +4 -0
  29. package/dist/cjs/SequenceActivitySuspensionProvider.js +45 -0
  30. package/dist/cjs/SequenceManager.d.ts +9 -22
  31. package/dist/cjs/SequenceManager.js +54 -196
  32. package/dist/cjs/SequenceRegistryProvider.d.ts +4 -0
  33. package/dist/cjs/SequenceRegistryProvider.js +292 -0
  34. package/dist/cjs/Track.d.ts +10 -3
  35. package/dist/cjs/Track.js +8 -8
  36. package/dist/cjs/animated-image/AnimatedImage.d.ts +3 -2
  37. package/dist/cjs/animated-image/AnimatedImage.js +47 -34
  38. package/dist/cjs/animated-image/canvas.d.ts +2 -1
  39. package/dist/cjs/animated-image/canvas.js +2 -2
  40. package/dist/cjs/animated-image/props.d.ts +2 -1
  41. package/dist/cjs/asset-types.d.ts +4 -0
  42. package/dist/cjs/audio/AudioForPreview.js +54 -41
  43. package/dist/cjs/audio/get-audio-sync-anchor-tolerance.d.ts +1 -0
  44. package/dist/cjs/audio/get-audio-sync-anchor-tolerance.js +11 -0
  45. package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
  46. package/dist/cjs/audio/shared-audio-tags.js +1 -1
  47. package/dist/cjs/audio/use-audio-context.js +26 -7
  48. package/dist/cjs/canvas-image/CanvasImage.d.ts +3 -2
  49. package/dist/cjs/canvas-image/CanvasImage.js +5 -4
  50. package/dist/cjs/canvas-image/props.d.ts +2 -1
  51. package/dist/cjs/committed-metadata.d.ts +68 -0
  52. package/dist/cjs/committed-metadata.js +39 -0
  53. package/dist/cjs/component-identity.d.ts +6 -0
  54. package/dist/cjs/component-identity.js +39 -0
  55. package/dist/cjs/composition-registry-fallback.d.ts +14 -0
  56. package/dist/cjs/composition-registry-fallback.js +35 -0
  57. package/dist/cjs/create-element-source-proxy.d.ts +4 -0
  58. package/dist/cjs/create-element-source-proxy.js +46 -0
  59. package/dist/cjs/default-premount-in-seconds.d.ts +3 -0
  60. package/dist/cjs/default-premount-in-seconds.js +12 -0
  61. package/dist/cjs/effects/Solid.d.ts +3 -2
  62. package/dist/cjs/effects/Solid.js +5 -4
  63. package/dist/cjs/effects/canvas-pool.d.ts +1 -0
  64. package/dist/cjs/effects/canvas-pool.js +15 -10
  65. package/dist/cjs/effects/effect-types.d.ts +4 -0
  66. package/dist/cjs/effects/index.d.ts +1 -1
  67. package/dist/cjs/effects/run-effect-chain.d.ts +3 -1
  68. package/dist/cjs/effects/run-effect-chain.js +94 -56
  69. package/dist/cjs/effects/use-effect-chain-state.d.ts +2 -1
  70. package/dist/cjs/effects/use-effect-chain-state.js +11 -2
  71. package/dist/cjs/effects/use-memoized-effects.js +96 -17
  72. package/dist/cjs/enable-sequence-stack-traces.d.ts +2 -8
  73. package/dist/cjs/enable-sequence-stack-traces.js +7 -38
  74. package/dist/cjs/freeze.js +4 -1
  75. package/dist/cjs/index.d.ts +1 -3
  76. package/dist/cjs/index.js +0 -2
  77. package/dist/cjs/interactivity-schema.d.ts +50 -14
  78. package/dist/cjs/interactivity-schema.js +32 -4
  79. package/dist/cjs/internals.d.ts +110 -33
  80. package/dist/cjs/internals.js +29 -8
  81. package/dist/cjs/interpolate-keyframed-status.d.ts +4 -0
  82. package/dist/cjs/interpolate-keyframed-status.js +38 -1
  83. package/dist/cjs/interpolate.d.ts +12 -0
  84. package/dist/cjs/interpolate.js +15 -1
  85. package/dist/cjs/no-react.d.ts +5 -1
  86. package/dist/cjs/no-react.js +6 -0
  87. package/dist/cjs/optimistic-sequence-deletion.d.ts +17 -0
  88. package/dist/cjs/optimistic-sequence-deletion.js +114 -0
  89. package/dist/cjs/registry-store.d.ts +17 -0
  90. package/dist/cjs/registry-store.js +68 -0
  91. package/dist/cjs/sequence-activity-context.d.ts +13 -0
  92. package/dist/cjs/sequence-activity-context.js +21 -0
  93. package/dist/cjs/sequence-activity-defaults.d.ts +1 -0
  94. package/dist/cjs/sequence-activity-defaults.js +4 -0
  95. package/dist/cjs/sequence-outline.js +1 -2
  96. package/dist/cjs/sequence-registry-context.d.ts +26 -0
  97. package/dist/cjs/sequence-registry-context.js +71 -0
  98. package/dist/cjs/series/index.d.ts +2 -1
  99. package/dist/cjs/series/index.js +12 -4
  100. package/dist/cjs/timeline-position-state.js +11 -3
  101. package/dist/cjs/timeline-track-context.d.ts +1 -1
  102. package/dist/cjs/timeline-track-context.js +1 -2
  103. package/dist/cjs/use-lazy-component.js +29 -15
  104. package/dist/cjs/use-media-in-timeline.d.ts +7 -14
  105. package/dist/cjs/use-media-in-timeline.js +15 -117
  106. package/dist/cjs/use-premounting.js +3 -4
  107. package/dist/cjs/use-schema.js +3 -1
  108. package/dist/cjs/use-sequence-registration.d.ts +1 -1
  109. package/dist/cjs/use-sequence-registration.js +22 -6
  110. package/dist/cjs/use-timeline-seek.d.ts +1 -0
  111. package/dist/cjs/use-timeline-seek.js +10 -0
  112. package/dist/cjs/use-video.d.ts +7 -2
  113. package/dist/cjs/use-video.js +11 -3
  114. package/dist/cjs/version.d.ts +1 -1
  115. package/dist/cjs/version.js +1 -1
  116. package/dist/cjs/video/VideoForPreview.js +55 -42
  117. package/dist/cjs/video/seek-until-right.js +11 -7
  118. package/dist/cjs/with-interactivity-schema.js +40 -14
  119. package/dist/cjs/wrap-remotion-context.d.ts +15 -3
  120. package/dist/cjs/wrap-remotion-context.js +101 -7
  121. package/dist/esm/index.mjs +3562 -2347
  122. package/dist/esm/no-react.mjs +74 -37
  123. package/dist/esm/version.mjs +1 -1
  124. package/package.json +2 -2
  125. package/dist/cjs/nonce.d.ts +0 -11
  126. package/dist/cjs/nonce.js +0 -42
  127. package/dist/cjs/sequence-order-marker.d.ts +0 -58
  128. package/dist/cjs/sequence-order-marker.js +0 -44
@@ -6,6 +6,8 @@ const effect_internals_js_1 = require("./effect-internals.js");
6
6
  const gpu_device_js_1 = require("./gpu-device.js");
7
7
  const createEffectChainState = (width, height) => {
8
8
  const state = {
9
+ width,
10
+ height,
9
11
  pool: new canvas_pool_js_1.CanvasPool(width, height, (canvas) => {
10
12
  var _a;
11
13
  // The GL objects these setups hold died with the context and stay
@@ -62,9 +64,8 @@ const ensureSetup = (state, def, target) => {
62
64
  // Runs the effect pipeline imperatively. Returns `true` if the pipeline
63
65
  // completed and wrote to `output`, `false` if it was superseded by a newer
64
66
  // run (caller should not act on a stale result).
65
- const runEffectChain = async ({ state, source, effects, output, width, height, }) => {
67
+ const runEffectChainWithoutResize = async ({ state, source, effects, output, width, height }, initialFlipSourceY, runId) => {
66
68
  var _a;
67
- const runId = ++state.currentRunId;
68
69
  const isCancelled = () => state.currentRunId !== runId;
69
70
  // Bypass any effect with `disabled: true` before grouping by backend, so
70
71
  // disabled effects don't create empty runs or force unnecessary backend
@@ -102,66 +103,77 @@ const runEffectChain = async ({ state, source, effects, output, width, height, }
102
103
  // Canvas sources are DOM-oriented. Flip them when uploading into WebGL so
103
104
  // texture coordinates match clip-space output. `ImageBitmap` bridges below
104
105
  // opt out because they are already oriented for upload.
105
- let flipWebGLSourceY = true;
106
- for (let runIndex = 0; runIndex < runs.length; runIndex++) {
107
- const run = runs[runIndex];
108
- const [a, b] = state.pool.getPair(run.backend);
109
- let dst = a;
110
- for (const eff of run.effects) {
111
- const def = eff.definition;
112
- if (run.backend === 'webgl2') {
113
- // Checked before `setup()`: a lost context cannot compile shaders,
114
- // and this surfaces the dedicated error instead of an effect's own.
115
- state.pool.assertContextNotLost(dst);
116
- }
117
- const setupState = ensureSetup(state, def, dst);
118
- def.apply({
119
- source: currentImage,
120
- target: dst,
121
- state: setupState,
122
- params: eff.params,
123
- width,
124
- height,
125
- gpuDevice,
126
- flipSourceY: run.backend === 'webgl2' ? flipWebGLSourceY : false,
127
- });
128
- if (run.backend === 'webgl2') {
129
- // Same-backend ping-pong passes feed the previous WebGL canvas back
130
- // through `texImage2D()`. That source is still a DOM canvas, so the
131
- // next upload also needs to be flipped.
132
- flipWebGLSourceY = true;
133
- }
134
- currentImage = dst;
135
- dst = dst === a ? b : a;
136
- }
137
- lastTarget = (_a = currentImage) !== null && _a !== void 0 ? _a : lastTarget;
138
- const nextRun = runs[runIndex + 1];
139
- if (nextRun && nextRun.backend !== run.backend && lastTarget) {
140
- // 2D → WebGL: pass the 2D canvas directly so `texImage2D` + `UNPACK_FLIP_Y`
141
- // matches blur-only on a raw frame canvas. `createImageBitmap` here changes
142
- // upload orientation and produced upside-down stacks (wave + blur).
143
- if (run.backend === '2d' && nextRun.backend === 'webgl2') {
144
- currentImage = lastTarget;
145
- flipWebGLSourceY = true;
106
+ let flipWebGLSourceY = initialFlipSourceY;
107
+ // Only bridge bitmaps are owned here; the original source belongs to the caller.
108
+ let bridgeBitmap = null;
109
+ try {
110
+ for (let runIndex = 0; runIndex < runs.length; runIndex++) {
111
+ const run = runs[runIndex];
112
+ let canvasIndex = 0;
113
+ for (const eff of run.effects) {
114
+ const dst = state.pool.getCanvas(run.backend, canvasIndex);
115
+ const def = eff.definition;
116
+ if (run.backend === 'webgl2') {
117
+ // Checked before `setup()`: a lost context cannot compile shaders,
118
+ // and this surfaces the dedicated error instead of an effect's own.
119
+ state.pool.assertContextNotLost(dst);
120
+ }
121
+ const setupState = ensureSetup(state, def, dst);
122
+ def.apply({
123
+ source: currentImage,
124
+ target: dst,
125
+ state: setupState,
126
+ params: eff.params,
127
+ width: state.width,
128
+ height: state.height,
129
+ gpuDevice,
130
+ flipSourceY: run.backend === 'webgl2' ? flipWebGLSourceY : false,
131
+ });
132
+ // Effects consume their source synchronously. Release it before the
133
+ // next bridge so a run never retains multiple temporary bitmaps.
134
+ bridgeBitmap === null || bridgeBitmap === void 0 ? void 0 : bridgeBitmap.close();
135
+ bridgeBitmap = null;
136
+ if (run.backend === 'webgl2') {
137
+ // Same-backend ping-pong passes feed the previous WebGL canvas back
138
+ // through `texImage2D()`. That source is still a DOM canvas, so the
139
+ // next upload also needs to be flipped.
140
+ flipWebGLSourceY = true;
141
+ }
142
+ currentImage = dst;
143
+ canvasIndex = canvasIndex === 0 ? 1 : 0;
146
144
  }
147
- else {
148
- // Other bridges use `createImageBitmap` rather than passing the canvas
149
- // straight through. A direct `drawImage(webglCanvas)` in the next
150
- // backend's first effect forces an implicit GPU readback / finish on the
151
- // consuming context, which empirically blows the per-frame vsync budget and
152
- // halves the paint rate. `createImageBitmap` pipelines the GPU work.
153
- const bitmap = await createImageBitmap(lastTarget);
154
- if (isCancelled()) {
155
- bitmap.close();
156
- return false;
145
+ lastTarget = (_a = currentImage) !== null && _a !== void 0 ? _a : lastTarget;
146
+ const nextRun = runs[runIndex + 1];
147
+ if (nextRun && nextRun.backend !== run.backend && lastTarget) {
148
+ // 2D → WebGL: pass the 2D canvas directly so `texImage2D` + `UNPACK_FLIP_Y`
149
+ // matches blur-only on a raw frame canvas. `createImageBitmap` here changes
150
+ // upload orientation and produced upside-down stacks (wave + blur).
151
+ if (run.backend === '2d' && nextRun.backend === 'webgl2') {
152
+ currentImage = lastTarget;
153
+ flipWebGLSourceY = true;
157
154
  }
158
- currentImage = bitmap;
159
- if (nextRun.backend === 'webgl2') {
160
- flipWebGLSourceY = false;
155
+ else {
156
+ // Other bridges use `createImageBitmap` rather than passing the canvas
157
+ // straight through. A direct `drawImage(webglCanvas)` in the next
158
+ // backend's first effect forces an implicit GPU readback / finish on the
159
+ // consuming context, which empirically blows the per-frame vsync budget and
160
+ // halves the paint rate. `createImageBitmap` pipelines the GPU work.
161
+ bridgeBitmap = await createImageBitmap(lastTarget);
162
+ if (isCancelled()) {
163
+ return false;
164
+ }
165
+ currentImage = bridgeBitmap;
166
+ if (nextRun.backend === 'webgl2') {
167
+ flipWebGLSourceY = false;
168
+ }
161
169
  }
162
170
  }
163
171
  }
164
172
  }
173
+ finally {
174
+ // Also release a bridge if setup/apply throws or the run is cancelled.
175
+ bridgeBitmap === null || bridgeBitmap === void 0 ? void 0 : bridgeBitmap.close();
176
+ }
165
177
  if (!lastTarget) {
166
178
  return true;
167
179
  }
@@ -173,4 +185,30 @@ const runEffectChain = async ({ state, source, effects, output, width, height, }
173
185
  outCtx.drawImage(lastTarget, 0, 0, width, height);
174
186
  return true;
175
187
  };
188
+ // Keep ownership of the optional resized source until the existing chain settles.
189
+ const runEffectChain = async (options) => {
190
+ const { state, source, width, height, effects } = options;
191
+ // Keep one ID across resizing and effect passes so callers can cancel the run.
192
+ const runId = ++state.currentRunId;
193
+ if ((state.width === width && state.height === height) ||
194
+ !effects.some((effect) => !effect.params.disabled)) {
195
+ return runEffectChainWithoutResize(options, true, runId);
196
+ }
197
+ const firstEnabledEffect = effects.find((effect) => !effect.params.disabled);
198
+ const resized = await createImageBitmap(source, {
199
+ resizeWidth: state.width,
200
+ resizeHeight: state.height,
201
+ // WebGL ignores UNPACK_FLIP_Y_WEBGL for ImageBitmap uploads.
202
+ imageOrientation: firstEnabledEffect.definition.backend === 'webgl2' ? 'flipY' : 'none',
203
+ });
204
+ try {
205
+ if (state.currentRunId !== runId) {
206
+ return false;
207
+ }
208
+ return await runEffectChainWithoutResize({ ...options, source: resized }, false, runId);
209
+ }
210
+ finally {
211
+ resized.close();
212
+ }
213
+ };
176
214
  exports.runEffectChain = runEffectChain;
@@ -1,4 +1,5 @@
1
+ import type { EffectsOutputSize } from './effect-types.js';
1
2
  import type { EffectChainState } from './run-effect-chain.js';
2
- export declare const useEffectChainState: () => {
3
+ export declare const useEffectChainState: (effectsOutputSize?: EffectsOutputSize | null) => {
3
4
  get: (width: number, height: number) => EffectChainState | null;
4
5
  };
@@ -2,8 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useEffectChainState = void 0;
4
4
  const react_1 = require("react");
5
+ const validate_dimensions_js_1 = require("../validation/validate-dimensions.js");
5
6
  const run_effect_chain_js_1 = require("./run-effect-chain.js");
6
- const useEffectChainState = () => {
7
+ const useEffectChainState = (effectsOutputSize = null) => {
8
+ const effectWidth = effectsOutputSize === null || effectsOutputSize === void 0 ? void 0 : effectsOutputSize.width;
9
+ const effectHeight = effectsOutputSize === null || effectsOutputSize === void 0 ? void 0 : effectsOutputSize.height;
10
+ if (effectsOutputSize) {
11
+ (0, validate_dimensions_js_1.validateDimension)(effectWidth, 'effectsOutputSize.width', 'on an effect-capable component');
12
+ (0, validate_dimensions_js_1.validateDimension)(effectHeight, 'effectsOutputSize.height', 'on an effect-capable component');
13
+ }
7
14
  const chainStateRef = (0, react_1.useRef)(null);
8
15
  const sizeRef = (0, react_1.useRef)(null);
9
16
  const unmountedRef = (0, react_1.useRef)(false);
@@ -22,6 +29,8 @@ const useEffectChainState = () => {
22
29
  }, []);
23
30
  return (0, react_1.useMemo)(() => ({
24
31
  get: (width, height) => {
32
+ width = effectWidth !== null && effectWidth !== void 0 ? effectWidth : width;
33
+ height = effectHeight !== null && effectHeight !== void 0 ? effectHeight : height;
25
34
  // Async work such as a late decoded video frame can still get here
26
35
  // after unmount. Nothing would release a pool created at this point.
27
36
  if (unmountedRef.current) {
@@ -38,6 +47,6 @@ const useEffectChainState = () => {
38
47
  }
39
48
  return chainStateRef.current;
40
49
  },
41
- }), []);
50
+ }), [effectWidth, effectHeight]);
42
51
  };
43
52
  exports.useEffectChainState = useEffectChainState;
@@ -1,15 +1,51 @@
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
+ })();
35
+ var _a;
2
36
  Object.defineProperty(exports, "__esModule", { value: true });
3
37
  exports.useMemoizedEffects = exports.getPropStatusesCtx = exports.getEffectPropStatusesCtx = exports.useMemoizedEffectDefinitions = void 0;
4
- const react_1 = require("react");
38
+ const react_1 = __importStar(require("react"));
5
39
  const evaluate_source_expressions_js_1 = require("../evaluate-source-expressions.js");
6
40
  const get_effective_visual_mode_value_js_1 = require("../get-effective-visual-mode-value.js");
7
41
  const interpolate_keyframed_status_js_1 = require("../interpolate-keyframed-status.js");
8
42
  const runtime_value_store_js_1 = require("../runtime-value-store.js");
43
+ const sequence_activity_context_js_1 = require("../sequence-activity-context.js");
9
44
  const sequence_node_path_js_1 = require("../sequence-node-path.js");
10
45
  const SequenceManager_js_1 = require("../SequenceManager.js");
11
46
  const use_current_frame_js_1 = require("../use-current-frame.js");
12
47
  const emptyDragOverrides = {};
48
+ const useCacheCommitEffect = (_a = react_1.default.useInsertionEffect) !== null && _a !== void 0 ? _a : react_1.useLayoutEffect;
13
49
  const mergeOverrides = ({ descriptor, propStatusOverrides, dragOverrides, frame, }) => {
14
50
  if (!propStatusOverrides && !dragOverrides) {
15
51
  return { params: descriptor.params, effectKey: descriptor.effectKey };
@@ -67,6 +103,7 @@ const resolvePropStatusOverrides = (propStatus, frame) => {
67
103
  return hasAny ? out : null;
68
104
  };
69
105
  const useMemoizedEffectDefinitions = (effects) => {
106
+ const activityDormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
70
107
  const previousRef = (0, react_1.useRef)(null);
71
108
  const definitions = effects.map((descriptor) => descriptor.definition);
72
109
  const previous = previousRef.current;
@@ -76,7 +113,51 @@ const useMemoizedEffectDefinitions = (effects) => {
76
113
  const controllers = isSame
77
114
  ? previous.controllers
78
115
  : effects.map((effect) => (0, runtime_value_store_js_1.createRuntimeValueStore)(effect.params));
79
- const stableDefinitions = isSame ? previous.definitions : definitions;
116
+ const stableDefinitions = isSame
117
+ ? previous.definitions
118
+ : Object.assign(definitions, {
119
+ runtimeValues: controllers.map((controller) => controller.store),
120
+ });
121
+ useCacheCommitEffect(() => {
122
+ // Insertion effects also run for hidden Activity commits. Store listeners
123
+ // must run after React finishes committing, never inside an insertion effect.
124
+ previousRef.current = { definitions: stableDefinitions, controllers };
125
+ if (!activityDormant || controllers.length === 0) {
126
+ return;
127
+ }
128
+ let cancelled = false;
129
+ queueMicrotask(() => {
130
+ if (cancelled) {
131
+ return;
132
+ }
133
+ controllers.forEach((controller, index) => {
134
+ var _a;
135
+ const snapshot = (_a = effects[index]) === null || _a === void 0 ? void 0 : _a.params;
136
+ const currentSnapshot = controller.store.getSnapshot();
137
+ if (Object.is(snapshot, currentSnapshot)) {
138
+ return;
139
+ }
140
+ // Equivalent inline params should not notify inspector subscribers on
141
+ // every dormant render. Preserve changes to keys and leaf references.
142
+ if (snapshot !== null &&
143
+ currentSnapshot !== null &&
144
+ typeof snapshot === 'object' &&
145
+ typeof currentSnapshot === 'object') {
146
+ const keys = Object.keys(snapshot);
147
+ if (keys.length === Object.keys(currentSnapshot).length &&
148
+ keys.every((key) => Object.prototype.hasOwnProperty.call(currentSnapshot, key) &&
149
+ Object.is(snapshot[key], currentSnapshot[key]))) {
150
+ return;
151
+ }
152
+ }
153
+ controller.setSnapshot(snapshot);
154
+ });
155
+ });
156
+ return () => {
157
+ // A newer commit or unmount supersedes this pending publication.
158
+ cancelled = true;
159
+ };
160
+ }, [activityDormant, controllers, effects, stableDefinitions]);
80
161
  (0, react_1.useLayoutEffect)(() => {
81
162
  // Stores are intentionally updated without changing the registered effect
82
163
  // array, so frame-dependent parameters don't re-register the Sequence.
@@ -86,10 +167,7 @@ const useMemoizedEffectDefinitions = (effects) => {
86
167
  controllers[index].setSnapshot(snapshot);
87
168
  });
88
169
  }, [controllers, effects, stableDefinitions]);
89
- previousRef.current = { definitions: stableDefinitions, controllers };
90
- return Object.assign(stableDefinitions, {
91
- runtimeValues: controllers.map((controller) => controller.store),
92
- });
170
+ return stableDefinitions;
93
171
  };
94
172
  exports.useMemoizedEffectDefinitions = useMemoizedEffectDefinitions;
95
173
  const getEffectPropStatusesCtx = ({ propStatuses, nodePath, effectIndex, }) => {
@@ -134,7 +212,7 @@ const useMemoizedEffects = ({ effects, overrideId, videoConfigValues, }) => {
134
212
  const nodePath = overrideId
135
213
  ? ((_a = overrideIdToNodePathMappings[overrideId]) !== null && _a !== void 0 ? _a : null)
136
214
  : null;
137
- const effectDragOverrides = (0, SequenceManager_js_1.useEffectDragOverridesForNodePath)(nodePath, effects.length);
215
+ const effectDragOverrides = (0, SequenceManager_js_1.useEffectDragOverridesForNodePath)(nodePath);
138
216
  const resolved = effects.map((descriptor, index) => {
139
217
  var _a;
140
218
  if (nodePath === null) {
@@ -166,16 +244,17 @@ const useMemoizedEffects = ({ effects, overrideId, videoConfigValues, }) => {
166
244
  previous.length === resolved.length &&
167
245
  previous.every((p, i) => p.definition === resolved[i].descriptor.definition &&
168
246
  p.effectKey === resolved[i].effectKey);
169
- if (isSame) {
170
- return previous;
171
- }
172
- const next = resolved.map(({ descriptor, params, effectKey }) => ({
173
- definition: descriptor.definition,
174
- effectKey,
175
- params,
176
- memoized: true,
177
- }));
178
- previousRef.current = next;
247
+ const next = isSame
248
+ ? previous
249
+ : resolved.map(({ descriptor, params, effectKey }) => ({
250
+ definition: descriptor.definition,
251
+ effectKey,
252
+ params,
253
+ memoized: true,
254
+ }));
255
+ useCacheCommitEffect(() => {
256
+ previousRef.current = next;
257
+ }, [next]);
179
258
  return next;
180
259
  };
181
260
  exports.useMemoizedEffects = useMemoizedEffects;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
1
  import type { SequenceControls } from './CompositionManager.js';
3
- type ComponentIdentityResolver = (component: unknown) => unknown;
2
+ export declare const setSequenceComponent: (component: unknown) => void;
3
+ export declare const getSequenceComponent: () => unknown;
4
4
  export declare const REMOTION_INTERNAL_STACK_PROP = "_remotionInternalStack";
5
5
  export type OriginalSourceLocation = {
6
6
  fileName: string;
@@ -15,11 +15,5 @@ export declare const makeOriginalSourceStack: ({ fileName, lineNumber, columnNum
15
15
  export declare const parseOriginalSourceStack: (stack: string | null) => OriginalSourceLocation | null;
16
16
  export declare const getComponentsToAddStacksTo: () => unknown[];
17
17
  export declare const addSequenceStackTraces: (component: unknown) => void;
18
- export declare const setSequenceComponent: (component: unknown) => void;
19
- export declare const getSequenceComponent: () => unknown;
20
- export declare const setComponentIdentityResolver: (resolver: ComponentIdentityResolver | null) => void;
21
- export declare const resolveComponentIdentity: (component: unknown) => unknown;
22
18
  export declare const setStackForControls: (controls: SequenceControls, stack: string | undefined) => void;
23
19
  export declare const getStackForControls: (controls: SequenceControls) => string | null;
24
- export declare const getSingleChildComponent: (children: React.ReactNode) => unknown;
25
- export {};
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSingleChildComponent = exports.getStackForControls = exports.setStackForControls = exports.resolveComponentIdentity = exports.setComponentIdentityResolver = exports.getSequenceComponent = exports.setSequenceComponent = exports.addSequenceStackTraces = exports.getComponentsToAddStacksTo = exports.parseOriginalSourceStack = exports.makeOriginalSourceStack = exports.REMOTION_INTERNAL_STACK_PROP = void 0;
7
- const react_1 = __importDefault(require("react"));
3
+ exports.getStackForControls = exports.setStackForControls = exports.addSequenceStackTraces = exports.getComponentsToAddStacksTo = exports.parseOriginalSourceStack = exports.makeOriginalSourceStack = exports.REMOTION_INTERNAL_STACK_PROP = exports.getSequenceComponent = exports.setSequenceComponent = void 0;
8
4
  const componentsToAddStacksTo = [];
9
5
  let sequenceComponent = null;
6
+ const setSequenceComponent = (component) => {
7
+ sequenceComponent = component;
8
+ };
9
+ exports.setSequenceComponent = setSequenceComponent;
10
+ const getSequenceComponent = () => sequenceComponent;
11
+ exports.getSequenceComponent = getSequenceComponent;
10
12
  const stacksByControls = new WeakMap();
11
- // Studio installs a resolver that maps refreshed component implementations to
12
- // the stable family object maintained by React Refresh.
13
- let componentIdentityResolver = null;
14
13
  exports.REMOTION_INTERNAL_STACK_PROP = '_remotionInternalStack';
15
14
  // Bundlers that know where a JSX element was written encode its source
16
15
  // location as a synthetic stack frame, so consumers can skip symbolication.
@@ -41,21 +40,6 @@ const addSequenceStackTraces = (component) => {
41
40
  componentsToAddStacksTo.push(component);
42
41
  };
43
42
  exports.addSequenceStackTraces = addSequenceStackTraces;
44
- const setSequenceComponent = (component) => {
45
- sequenceComponent = component;
46
- };
47
- exports.setSequenceComponent = setSequenceComponent;
48
- const getSequenceComponent = () => sequenceComponent;
49
- exports.getSequenceComponent = getSequenceComponent;
50
- const setComponentIdentityResolver = (resolver) => {
51
- componentIdentityResolver = resolver;
52
- };
53
- exports.setComponentIdentityResolver = setComponentIdentityResolver;
54
- const resolveComponentIdentity = (component) => {
55
- var _a;
56
- return (_a = componentIdentityResolver === null || componentIdentityResolver === void 0 ? void 0 : componentIdentityResolver(component)) !== null && _a !== void 0 ? _a : component;
57
- };
58
- exports.resolveComponentIdentity = resolveComponentIdentity;
59
43
  const setStackForControls = (controls, stack) => {
60
44
  if (stack === undefined) {
61
45
  stacksByControls.delete(controls);
@@ -69,18 +53,3 @@ const getStackForControls = (controls) => {
69
53
  return (_a = stacksByControls.get(controls)) !== null && _a !== void 0 ? _a : null;
70
54
  };
71
55
  exports.getStackForControls = getStackForControls;
72
- const getSingleChildComponent = (children) => {
73
- const mountedChildren = react_1.default.Children.toArray(children);
74
- if (mountedChildren.length !== 1) {
75
- return null;
76
- }
77
- const child = mountedChildren[0];
78
- if (!react_1.default.isValidElement(child)) {
79
- return null;
80
- }
81
- if (typeof child.type !== 'function' && typeof child.type !== 'object') {
82
- return null;
83
- }
84
- return (0, exports.resolveComponentIdentity)(child.type);
85
- };
86
- exports.getSingleChildComponent = getSingleChildComponent;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Freeze = exports.useIsInsideNonPremountFreeze = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const sequence_activity_context_js_1 = require("./sequence-activity-context.js");
6
7
  const SequenceContext_js_1 = require("./SequenceContext.js");
7
8
  const timeline_position_state_js_1 = require("./timeline-position-state.js");
8
9
  const TimelineContext_js_1 = require("./TimelineContext.js");
@@ -40,6 +41,7 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, _remotionIntern
40
41
  }
41
42
  }, [active, frame]);
42
43
  const timelineContext = (0, timeline_position_state_js_1.useTimelineContext)();
44
+ const activityDormant = (0, react_1.useContext)(sequence_activity_context_js_1.SequenceActivityDormantContext);
43
45
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
44
46
  const isInsideNonPremountFreeze = (0, exports.useIsInsideNonPremountFreeze)();
45
47
  const relativeFrom = (_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0;
@@ -74,7 +76,8 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, _remotionIntern
74
76
  cumulatedFrom: 0,
75
77
  };
76
78
  }, [sequenceContext, isActive]);
79
+ const providedTimeline = isActive ? frozenTimelineValue : timelineContext;
77
80
  return (jsx_runtime_1.jsx(NonPremountFreezeContext.Provider, { value: isInsideNonPremountFreeze ||
78
- (Boolean(isActive) && !_remotionInternalIsPremounting), children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: isActive ? frozenTimelineValue : timelineContext, children: jsx_runtime_1.jsx(SequenceContext_js_1.SequenceContext.Provider, { value: newSequenceContext, children: children }) }) }));
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 }) }) }) }));
79
82
  };
80
83
  exports.Freeze = Freeze;
@@ -98,7 +98,7 @@ export type BundleEvaluationState = {
98
98
  export type BundleState = BundleIndexState | BundleEvaluationState | BundleCompositionState;
99
99
  export * from './AbsoluteFill.js';
100
100
  export * from './animated-image/index.js';
101
- export { createEffect, type Backend, type EffectApplyParams, type EffectDefinition, type EffectDefinitionAndStack, type EffectDescriptor, type EffectFactory, type EffectsProp, } from './effects/index.js';
101
+ export { createEffect, type Backend, type EffectApplyParams, type EffectDefinition, type EffectDefinitionAndStack, type EffectDescriptor, type EffectFactory, type EffectsProp, type EffectsOutputSize, } from './effects/index.js';
102
102
  /**
103
103
  * @description Renders a solid-color rectangle on a `<canvas>`.
104
104
  * @see [Documentation](https://www.remotion.dev/docs/solid)
@@ -164,12 +164,10 @@ export { watchStaticFile } from './watch-static-file.js';
164
164
  export declare const Experimental: {
165
165
  /**
166
166
  * @description This is a special component that will cause Remotion to only partially capture the frame of the video.
167
- * @see [Documentation](https://www.remotion.dev/docs/clipper)
168
167
  */
169
168
  Clipper: import("react").FC<{}>;
170
169
  /**
171
170
  * @description This is a special component, that, when rendered, will skip rendering the frame altogether.
172
- * @see [Documentation](https://www.remotion.dev/docs/null)
173
171
  */
174
172
  Null: import("react").FC<{}>;
175
173
  useIsPlayer: () => boolean;
package/dist/cjs/index.js CHANGED
@@ -119,12 +119,10 @@ Object.defineProperty(exports, "watchStaticFile", { enumerable: true, get: funct
119
119
  exports.Experimental = {
120
120
  /**
121
121
  * @description This is a special component that will cause Remotion to only partially capture the frame of the video.
122
- * @see [Documentation](https://www.remotion.dev/docs/clipper)
123
122
  */
124
123
  Clipper: Clipper_js_1.Clipper,
125
124
  /**
126
125
  * @description This is a special component, that, when rendered, will skip rendering the frame altogether.
127
- * @see [Documentation](https://www.remotion.dev/docs/null)
128
126
  */
129
127
  Null: Null_js_1.Null,
130
128
  useIsPlayer: is_player_js_1.useIsPlayer,