remotion 4.0.471 → 4.0.473

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 (62) hide show
  1. package/dist/cjs/CompositionManager.d.ts +2 -0
  2. package/dist/cjs/CompositionManagerContext.d.ts +1 -1
  3. package/dist/cjs/CompositionManagerProvider.js +2 -1
  4. package/dist/cjs/Folder.d.ts +1 -0
  5. package/dist/cjs/Folder.js +6 -2
  6. package/dist/cjs/HtmlInCanvas.d.ts +4 -0
  7. package/dist/cjs/HtmlInCanvas.js +65 -15
  8. package/dist/cjs/Img.d.ts +16 -3
  9. package/dist/cjs/Img.js +7 -1
  10. package/dist/cjs/Sequence.d.ts +2 -0
  11. package/dist/cjs/Sequence.js +22 -5
  12. package/dist/cjs/SequenceManager.d.ts +4 -3
  13. package/dist/cjs/animated-image/AnimatedImage.js +9 -1
  14. package/dist/cjs/canvas-image/CanvasImage.d.ts +16 -3
  15. package/dist/cjs/canvas-image/CanvasImage.js +7 -1
  16. package/dist/cjs/effects/Solid.d.ts +1 -0
  17. package/dist/cjs/effects/Solid.js +39 -10
  18. package/dist/cjs/effects/use-memoized-effects.d.ts +1 -1
  19. package/dist/cjs/effects/use-memoized-effects.js +13 -3
  20. package/dist/cjs/get-effective-visual-mode-value.d.ts +15 -4
  21. package/dist/cjs/get-effective-visual-mode-value.js +35 -4
  22. package/dist/cjs/index.d.ts +6 -3
  23. package/dist/cjs/index.js +5 -1
  24. package/dist/cjs/internals.d.ts +85 -41
  25. package/dist/cjs/internals.js +13 -0
  26. package/dist/cjs/interpolate-keyframed-status.d.ts +3 -1
  27. package/dist/cjs/interpolate-keyframed-status.js +3 -8
  28. package/dist/cjs/interpolate.d.ts +9 -0
  29. package/dist/cjs/interpolate.js +251 -37
  30. package/dist/cjs/no-react.d.ts +24 -4
  31. package/dist/cjs/no-react.js +3 -0
  32. package/dist/cjs/normalize-number.d.ts +1 -0
  33. package/dist/cjs/normalize-number.js +7 -0
  34. package/dist/cjs/scale-value.d.ts +4 -0
  35. package/dist/cjs/scale-value.js +48 -0
  36. package/dist/cjs/sequence-field-schema.d.ts +174 -14
  37. package/dist/cjs/sequence-field-schema.js +30 -5
  38. package/dist/cjs/series/index.d.ts +1 -2
  39. package/dist/cjs/series/index.js +7 -3
  40. package/dist/cjs/timeline-position-state.d.ts +1 -0
  41. package/dist/cjs/timeline-position-state.js +6 -2
  42. package/dist/cjs/use-media-in-timeline.js +1 -0
  43. package/dist/cjs/use-pixel-density.d.ts +7 -0
  44. package/dist/cjs/use-pixel-density.js +66 -0
  45. package/dist/cjs/use-schema.d.ts +26 -12
  46. package/dist/cjs/use-schema.js +62 -9
  47. package/dist/cjs/version.d.ts +1 -1
  48. package/dist/cjs/version.js +1 -1
  49. package/dist/cjs/video/OffthreadVideo.js +2 -2
  50. package/dist/cjs/video/VideoForPreview.d.ts +1 -1
  51. package/dist/cjs/video/VideoForRendering.d.ts +2 -19
  52. package/dist/cjs/video/VideoForRendering.js +2 -0
  53. package/dist/cjs/video/emit-video-frame.js +10 -4
  54. package/dist/cjs/video/html5-video.d.ts +2 -0
  55. package/dist/cjs/video/html5-video.js +3 -4
  56. package/dist/cjs/video/props.d.ts +5 -5
  57. package/dist/cjs/wrap-in-schema.d.ts +7 -3
  58. package/dist/cjs/wrap-in-schema.js +2 -1
  59. package/dist/esm/index.mjs +1270 -732
  60. package/dist/esm/no-react.mjs +335 -36
  61. package/dist/esm/version.mjs +1 -1
  62. package/package.json +2 -2
@@ -54,6 +54,7 @@ export type SequenceControls = {
54
54
  schema: SequenceSchema;
55
55
  currentRuntimeValueDotNotation: Record<string, unknown>;
56
56
  overrideId: string;
57
+ supportsEffects: boolean;
57
58
  };
58
59
  export type TSequence = {
59
60
  from: number;
@@ -72,6 +73,7 @@ export type TSequence = {
72
73
  controls: SequenceControls | null;
73
74
  refForOutline: React.RefObject<HTMLElement | null> | null;
74
75
  effects: readonly EffectDefinition<unknown>[];
76
+ isInsideSeries: boolean;
75
77
  } & EnhancedTSequenceData;
76
78
  export type AudioOrVideoAsset = {
77
79
  type: 'audio' | 'video';
@@ -25,7 +25,7 @@ export type CanvasContent = {
25
25
  export type CompositionManagerSetters = {
26
26
  registerComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(comp: TComposition<Schema, Props>) => void;
27
27
  unregisterComposition: (name: string) => void;
28
- registerFolder: (name: string, parent: string | null, nonce: NonceHistory) => void;
28
+ registerFolder: (name: string, parent: string | null, nonce: NonceHistory, stack: string | null) => void;
29
29
  unregisterFolder: (name: string, parent: string | null) => void;
30
30
  setCanvasContent: React.Dispatch<React.SetStateAction<CanvasContent | null>>;
31
31
  onlyRenderComposition: string | null;
@@ -31,7 +31,7 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
31
31
  return comps.filter((c) => c.id !== id);
32
32
  });
33
33
  }, []);
34
- const registerFolder = (0, react_1.useCallback)((name, parent, nonce) => {
34
+ const registerFolder = (0, react_1.useCallback)((name, parent, nonce, stack) => {
35
35
  setFolders((prevFolders) => {
36
36
  return [
37
37
  ...prevFolders,
@@ -39,6 +39,7 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
39
39
  name,
40
40
  parent,
41
41
  nonce,
42
+ stack,
42
43
  },
43
44
  ];
44
45
  });
@@ -4,6 +4,7 @@ export type TFolder = {
4
4
  name: string;
5
5
  parent: string | null;
6
6
  nonce: NonceHistory;
7
+ stack: string | null;
7
8
  };
8
9
  type FolderContextType = {
9
10
  folderName: string | null;
@@ -15,10 +15,13 @@ exports.FolderContext = (0, react_1.createContext)({
15
15
  * @description By wrapping a <Composition /> inside a <Folder />, you can visually categorize it in your sidebar, should you have many compositions.
16
16
  * @see [Documentation](https://remotion.dev/docs/folder)
17
17
  */
18
- const Folder = ({ name, children }) => {
18
+ const Folder = (props) => {
19
+ var _a;
20
+ const { name, children } = props;
19
21
  const parent = (0, react_1.useContext)(exports.FolderContext);
20
22
  const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
21
23
  const nonce = (0, nonce_js_1.useNonce)();
24
+ const stack = (_a = props.stack) !== null && _a !== void 0 ? _a : null;
22
25
  (0, validate_folder_name_js_1.validateFolderName)(name);
23
26
  const parentNameArr = [parent.parentName, parent.folderName].filter(truthy_js_1.truthy);
24
27
  const parentName = parentNameArr.length === 0 ? null : parentNameArr.join('/');
@@ -29,7 +32,7 @@ const Folder = ({ name, children }) => {
29
32
  };
30
33
  }, [name, parentName]);
31
34
  (0, react_1.useEffect)(() => {
32
- registerFolder(name, parentName, nonce.get());
35
+ registerFolder(name, parentName, nonce.get(), stack);
33
36
  return () => {
34
37
  unregisterFolder(name, parentName);
35
38
  };
@@ -40,6 +43,7 @@ const Folder = ({ name, children }) => {
40
43
  registerFolder,
41
44
  unregisterFolder,
42
45
  nonce,
46
+ stack,
43
47
  ]);
44
48
  return (jsx_runtime_1.jsx(exports.FolderContext.Provider, { value: value, children: children }));
45
49
  };
@@ -44,6 +44,7 @@ export type HtmlInCanvasOnPaintParams = {
44
44
  readonly canvas: OffscreenCanvas;
45
45
  readonly element: HTMLDivElement;
46
46
  readonly elementImage: ElementImage;
47
+ readonly pixelDensity: number;
47
48
  };
48
49
  export declare const isHtmlInCanvasSupported: () => boolean;
49
50
  /** Shown when {@link isHtmlInCanvasSupported} is false: APIs are absent (old Chrome and/or flag off). */
@@ -51,6 +52,7 @@ export declare const HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = "HTML in Canvas is not
51
52
  export type HtmlInCanvasOnPaint = (params: HtmlInCanvasOnPaintParams) => void | Promise<void>;
52
53
  export type HtmlInCanvasOnInitCleanup = () => void;
53
54
  export type HtmlInCanvasOnInit = (params: HtmlInCanvasOnPaintParams) => HtmlInCanvasOnInitCleanup | Promise<HtmlInCanvasOnInitCleanup>;
55
+ export type HtmlInCanvasPixelDensity = number;
54
56
  export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFrames' | keyof LayoutAndStyle | '_remotionInternalEffects' | '_remotionInternalRefForOutline'> & Omit<AbsoluteFillLayout, 'layout' | 'styleWhilePostmounted' | 'postmountFor' | 'premountFor' | 'styleWhilePremounted'> & {
55
57
  readonly durationInFrames?: number;
56
58
  readonly width: number;
@@ -59,6 +61,7 @@ export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFram
59
61
  readonly children: React.ReactNode;
60
62
  readonly onPaint?: HtmlInCanvasOnPaint;
61
63
  readonly onInit?: HtmlInCanvasOnInit;
64
+ readonly pixelDensity?: HtmlInCanvasPixelDensity;
62
65
  };
63
66
  export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<SequenceProps, "_remotionInternalEffects" | "_remotionInternalRefForOutline" | "children" | "durationInFrames" | "layout"> & Omit<AbsoluteFillLayout, "layout" | "postmountFor" | "premountFor" | "styleWhilePostmounted" | "styleWhilePremounted"> & {
64
67
  readonly durationInFrames?: number | undefined;
@@ -68,6 +71,7 @@ export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<Sequence
68
71
  readonly children: React.ReactNode;
69
72
  readonly onPaint?: HtmlInCanvasOnPaint | undefined;
70
73
  readonly onInit?: HtmlInCanvasOnInit | undefined;
74
+ readonly pixelDensity?: number | undefined;
71
75
  } & React.RefAttributes<HTMLCanvasElement>> & {
72
76
  readonly isSupported: () => boolean;
73
77
  };
@@ -47,6 +47,25 @@ function assertHtmlInCanvasDimensions(width, height) {
47
47
  throw new Error(`HtmlInCanvas: \`height\` must be a positive integer. Received: ${String(height)}.`);
48
48
  }
49
49
  }
50
+ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
51
+ if (pixelDensity === undefined) {
52
+ return 1;
53
+ }
54
+ if (typeof pixelDensity !== 'number' ||
55
+ !Number.isFinite(pixelDensity) ||
56
+ pixelDensity <= 0) {
57
+ throw new Error(`HtmlInCanvas: \`pixelDensity\` must be a positive finite number. Received: ${String(pixelDensity)}.`);
58
+ }
59
+ return pixelDensity;
60
+ }
61
+ const resizeOffscreenCanvas = ({ offscreen, width, height, }) => {
62
+ if (offscreen.width !== width) {
63
+ offscreen.width = width;
64
+ }
65
+ if (offscreen.height !== height) {
66
+ offscreen.height = height;
67
+ }
68
+ };
50
69
  const defaultOnPaint = ({ canvas, element, elementImage, }) => {
51
70
  const ctx = canvas.getContext('2d');
52
71
  if (!ctx) {
@@ -58,10 +77,13 @@ const defaultOnPaint = ({ canvas, element, elementImage, }) => {
58
77
  };
59
78
  /* eslint-enable react/require-default-props */
60
79
  const HtmlInCanvasAncestorContext = (0, react_1.createContext)(false);
61
- const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, children, onPaint, onInit, controls, style }, ref) => {
80
+ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, children, onPaint, onInit, pixelDensity, controls, style, }, ref) => {
62
81
  var _a;
63
82
  const isInsideAncestorHtmlInCanvas = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
64
83
  assertHtmlInCanvasDimensions(width, height);
84
+ const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
85
+ const canvasWidth = Math.ceil(width * resolvedPixelDensity);
86
+ const canvasHeight = Math.ceil(height * resolvedPixelDensity);
65
87
  const { continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
66
88
  if (!(0, exports.isHtmlInCanvasSupported)()) {
67
89
  cancelRender(new Error(exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
@@ -69,7 +91,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
69
91
  const canvas2dRef = (0, react_1.useRef)(null);
70
92
  const offscreenRef = (0, react_1.useRef)(null);
71
93
  const divRef = (0, react_1.useRef)(null);
72
- const canvasSizeKey = `${width}x${height}`;
94
+ const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}`;
73
95
  const setLayoutCanvasRef = (0, react_1.useCallback)((node) => {
74
96
  canvas2dRef.current = node;
75
97
  if (typeof ref === 'function') {
@@ -105,8 +127,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
105
127
  if (!offscreen) {
106
128
  throw new Error('HtmlInCanvas: offscreen canvas not ready (transferControlToOffscreen failed or canvas is remounting)');
107
129
  }
108
- offscreen.width = width;
109
- offscreen.height = height;
130
+ resizeOffscreenCanvas({
131
+ offscreen,
132
+ width: canvasWidth,
133
+ height: canvasHeight,
134
+ });
110
135
  try {
111
136
  const placeholderCanvas = canvas2dRef.current;
112
137
  if (!placeholderCanvas) {
@@ -135,6 +160,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
135
160
  canvas: offscreen,
136
161
  element,
137
162
  elementImage: initImage,
163
+ pixelDensity: resolvedPixelDensity,
138
164
  });
139
165
  if (typeof cleanup !== 'function') {
140
166
  throw new Error('HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.');
@@ -153,21 +179,29 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
153
179
  canvas: offscreen,
154
180
  element,
155
181
  elementImage: elImage,
182
+ pixelDensity: resolvedPixelDensity,
156
183
  });
157
184
  await (0, run_effect_chain_js_1.runEffectChain)({
158
- state: chainState.get(width, height),
185
+ state: chainState.get(canvasWidth, canvasHeight),
159
186
  source: offscreen,
160
187
  effects: effectsRef.current,
161
188
  output: offscreen,
162
- width,
163
- height,
189
+ width: canvasWidth,
190
+ height: canvasHeight,
164
191
  });
165
192
  continueRender(handle);
166
193
  }
167
194
  catch (error) {
168
195
  cancelRender(error);
169
196
  }
170
- }, [chainState, continueRender, cancelRender, width, height]);
197
+ }, [
198
+ canvasHeight,
199
+ canvasWidth,
200
+ chainState,
201
+ continueRender,
202
+ cancelRender,
203
+ resolvedPixelDensity,
204
+ ]);
171
205
  // Transfer control once per layout canvas instance, then listen for paint on
172
206
  // the placeholder (capture) while drawing on the linked offscreen surface.
173
207
  (0, react_1.useLayoutEffect)(() => {
@@ -178,8 +212,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
178
212
  placeholder.layoutSubtree = true;
179
213
  const offscreen = placeholder.transferControlToOffscreen();
180
214
  offscreenRef.current = offscreen;
181
- offscreen.width = width;
182
- offscreen.height = height;
215
+ resizeOffscreenCanvas({
216
+ offscreen,
217
+ width: canvasWidth,
218
+ height: canvasHeight,
219
+ });
183
220
  initializedRef.current = false;
184
221
  unmountedRef.current = false;
185
222
  placeholder.addEventListener('paint', onPaintCb);
@@ -192,7 +229,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
192
229
  (_a = onInitCleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(onInitCleanupRef);
193
230
  onInitCleanupRef.current = null;
194
231
  };
195
- }, [onPaintCb, cancelRender, width, height]);
232
+ }, [onPaintCb, cancelRender, canvasWidth, canvasHeight]);
196
233
  const onPaintChangedRef = (0, react_1.useRef)(false);
197
234
  (0, react_1.useLayoutEffect)(() => {
198
235
  var _a;
@@ -225,13 +262,20 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
225
262
  height,
226
263
  };
227
264
  }, [width, height]);
265
+ const canvasStyle = (0, react_1.useMemo)(() => {
266
+ return {
267
+ width,
268
+ height,
269
+ ...(style !== null && style !== void 0 ? style : {}),
270
+ };
271
+ }, [height, style, width]);
228
272
  if (isInsideAncestorHtmlInCanvas) {
229
273
  throw new Error('<HtmlInCanvas> effects cannot be nested together. Chrome will only display the outer effect. Consider merging the effects into one if you can.');
230
274
  }
231
- return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: true, children: jsx_runtime_1.jsx("canvas", { ref: setLayoutCanvasRef, width: width, height: height, style: style, children: jsx_runtime_1.jsx("div", { ref: divRef, style: innerStyle, children: children }) }, canvasSizeKey) }));
275
+ return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: true, children: jsx_runtime_1.jsx("canvas", { ref: setLayoutCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle, children: jsx_runtime_1.jsx("div", { ref: divRef, style: innerStyle, children: children }) }, canvasSizeKey) }));
232
276
  });
233
277
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
234
- const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, _experimentalControls: controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
278
+ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, _experimentalControls: controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
235
279
  const { durationInFrames: videoDuration } = (0, use_video_config_js_1.useVideoConfig)();
236
280
  const resolvedDuration = durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : videoDuration;
237
281
  const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
@@ -248,14 +292,20 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
248
292
  }, [ref]);
249
293
  return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: name === undefined
250
294
  ? 'https://www.remotion.dev/docs/remotion/html-in-canvas'
251
- : undefined, _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalRefForOutline: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, controls: controls, style: style, children: children }) }));
295
+ : undefined, _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalRefForOutline: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, controls: controls, style: style, children: children }) }));
252
296
  });
253
297
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
254
298
  const htmlInCanvasSchema = {
299
+ durationInFrames: sequence_field_schema_js_1.durationInFramesField,
300
+ from: sequence_field_schema_js_1.fromField,
255
301
  ...sequence_field_schema_js_1.sequenceVisualStyleSchema,
256
302
  hidden: sequence_field_schema_js_1.hiddenField,
257
303
  };
258
- const HtmlInCanvasWrapped = (0, wrap_in_schema_js_1.wrapInSchema)(HtmlInCanvasInner, htmlInCanvasSchema);
304
+ const HtmlInCanvasWrapped = (0, wrap_in_schema_js_1.wrapInSchema)({
305
+ Component: HtmlInCanvasInner,
306
+ schema: htmlInCanvasSchema,
307
+ supportsEffects: true,
308
+ });
259
309
  exports.HtmlInCanvas = Object.assign(HtmlInCanvasWrapped, {
260
310
  isSupported: exports.isHtmlInCanvasSupported,
261
311
  });
package/dist/cjs/Img.d.ts CHANGED
@@ -25,15 +25,14 @@ export declare const imgSchema: {
25
25
  readonly description: "Offset";
26
26
  };
27
27
  readonly 'style.scale': {
28
- readonly type: "number";
29
- readonly min: 0.05;
28
+ readonly type: "scale";
30
29
  readonly max: 100;
31
30
  readonly step: 0.01;
32
31
  readonly default: 1;
33
32
  readonly description: "Scale";
34
33
  };
35
34
  readonly 'style.rotate': {
36
- readonly type: "rotation";
35
+ readonly type: "rotation-css";
37
36
  readonly step: 1;
38
37
  readonly default: "0deg";
39
38
  readonly description: "Rotation";
@@ -45,6 +44,20 @@ export declare const imgSchema: {
45
44
  readonly step: 0.01;
46
45
  readonly default: 1;
47
46
  readonly description: "Opacity";
47
+ readonly hiddenFromList: false;
48
+ };
49
+ readonly durationInFrames: {
50
+ readonly type: "number";
51
+ readonly default: undefined;
52
+ readonly min: 1;
53
+ readonly step: 1;
54
+ readonly hiddenFromList: true;
55
+ };
56
+ readonly from: {
57
+ readonly type: "number";
58
+ readonly default: 0;
59
+ readonly step: 1;
60
+ readonly hiddenFromList: true;
48
61
  };
49
62
  readonly hidden: import("./sequence-field-schema.js").SequenceFieldSchema;
50
63
  };
package/dist/cjs/Img.js CHANGED
@@ -191,6 +191,8 @@ const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, durati
191
191
  };
192
192
  const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
193
193
  exports.imgSchema = {
194
+ durationInFrames: sequence_field_schema_js_1.durationInFramesField,
195
+ from: sequence_field_schema_js_1.fromField,
194
196
  ...sequence_field_schema_js_1.sequenceVisualStyleSchema,
195
197
  hidden: sequence_field_schema_js_1.hiddenField,
196
198
  };
@@ -258,5 +260,9 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
258
260
  * @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.
259
261
  * @see [Documentation](https://remotion.dev/docs/img)
260
262
  */
261
- exports.Img = (0, wrap_in_schema_js_1.wrapInSchema)(ImgInner, exports.imgSchema);
263
+ exports.Img = (0, wrap_in_schema_js_1.wrapInSchema)({
264
+ Component: ImgInner,
265
+ schema: exports.imgSchema,
266
+ supportsEffects: true,
267
+ });
262
268
  (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.Img);
@@ -70,4 +70,6 @@ export type SequencePropsWithoutDuration = {
70
70
  export type SequenceProps = {
71
71
  readonly durationInFrames?: number;
72
72
  } & SequencePropsWithoutDuration;
73
+ export declare const SequenceWithoutSchema: React.ForwardRefExoticComponent<SequenceProps & React.RefAttributes<HTMLDivElement>>;
73
74
  export declare const Sequence: React.ComponentType<SequenceProps & React.RefAttributes<HTMLDivElement>>;
75
+ export declare const SequenceWithoutFrom: React.ComponentType<SequenceProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Sequence = void 0;
3
+ exports.SequenceWithoutFrom = exports.Sequence = exports.SequenceWithoutSchema = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  /* eslint-disable @typescript-eslint/no-use-before-define */
6
6
  const react_1 = require("react");
@@ -11,12 +11,14 @@ const PremountContext_js_1 = require("./PremountContext.js");
11
11
  const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
12
12
  const SequenceContext_js_1 = require("./SequenceContext.js");
13
13
  const SequenceManager_js_1 = require("./SequenceManager.js");
14
+ const is_inside_series_js_1 = require("./series/is-inside-series.js");
14
15
  const timeline_position_state_js_1 = require("./timeline-position-state.js");
15
16
  const use_current_frame_1 = require("./use-current-frame");
16
17
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
17
18
  const use_video_config_js_1 = require("./use-video-config.js");
18
19
  const v5_flag_js_1 = require("./v5-flag.js");
19
20
  const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
21
+ const EMPTY_EFFECTS = [];
20
22
  const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, _experimentalControls: controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, _remotionInternalRefForOutline: refForOutline, ...other }, ref) => {
21
23
  var _a;
22
24
  const { layout = 'absolute-fill' } = other;
@@ -122,6 +124,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
122
124
  }, [name]);
123
125
  const resolvedDocumentationLink = documentationLink !== null && documentationLink !== void 0 ? documentationLink : (name === undefined ? 'https://www.remotion.dev/docs/sequence' : null);
124
126
  const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
127
+ const isInsideSeries = (0, react_1.useContext)(is_inside_series_js_1.IsInsideSeriesContext);
125
128
  const inheritedStack = (_a = other === null || other === void 0 ? void 0 : other.stack) !== null && _a !== void 0 ? _a : null;
126
129
  // Our assumption: Stack doesnt' change. After we symbolicate we assign it a nodePath
127
130
  // and if it changes, it would lead to-remounting of the sequence.
@@ -137,7 +140,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
137
140
  registerSequence({
138
141
  type: 'image',
139
142
  controls: controls !== null && controls !== void 0 ? controls : null,
140
- effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : [],
143
+ effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
141
144
  displayName: timelineClipName,
142
145
  documentationLink: resolvedDocumentationLink,
143
146
  duration: actualDurationInFrames,
@@ -153,13 +156,14 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
153
156
  src: isMedia.src,
154
157
  getStack: () => stackRef.current,
155
158
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
159
+ isInsideSeries,
156
160
  });
157
161
  }
158
162
  else {
159
163
  registerSequence({
160
164
  type: isMedia.type,
161
165
  controls: controls !== null && controls !== void 0 ? controls : null,
162
- effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : [],
166
+ effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
163
167
  displayName: timelineClipName,
164
168
  documentationLink: resolvedDocumentationLink,
165
169
  doesVolumeChange: isMedia.data.doesVolumeChange,
@@ -179,6 +183,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
179
183
  startMediaFrom: isMedia.data.startMediaFrom,
180
184
  volume: isMedia.data.volumes,
181
185
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
186
+ isInsideSeries,
182
187
  });
183
188
  }
184
189
  return () => {
@@ -201,8 +206,9 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
201
206
  premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
202
207
  postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
203
208
  controls: controls !== null && controls !== void 0 ? controls : null,
204
- effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : [],
209
+ effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
205
210
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
211
+ isInsideSeries,
206
212
  });
207
213
  return () => {
208
214
  unregisterSequence(id);
@@ -229,6 +235,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
229
235
  isMedia,
230
236
  resolvedDocumentationLink,
231
237
  refForOutline,
238
+ isInsideSeries,
232
239
  ]);
233
240
  // Ceil to support floats
234
241
  // https://github.com/remotion-dev/remotion/issues/2958
@@ -309,8 +316,18 @@ const SequenceRefForwardingFunction = (props, ref) => {
309
316
  return jsx_runtime_1.jsx(RegularSequence, { ...props, ref: ref });
310
317
  };
311
318
  const SequenceInner = (0, react_1.forwardRef)(SequenceRefForwardingFunction);
319
+ exports.SequenceWithoutSchema = SequenceInner;
312
320
  /*
313
321
  * @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
314
322
  * @see [Documentation](https://www.remotion.dev/docs/sequence)
315
323
  */
316
- exports.Sequence = (0, wrap_in_schema_js_1.wrapInSchema)(SequenceInner, sequence_field_schema_js_1.sequenceSchema);
324
+ exports.Sequence = (0, wrap_in_schema_js_1.wrapInSchema)({
325
+ Component: SequenceInner,
326
+ schema: sequence_field_schema_js_1.sequenceSchema,
327
+ supportsEffects: false,
328
+ });
329
+ exports.SequenceWithoutFrom = (0, wrap_in_schema_js_1.wrapInSchema)({
330
+ Component: SequenceInner,
331
+ schema: sequence_field_schema_js_1.sequenceSchemaWithoutFrom,
332
+ supportsEffects: false,
333
+ });
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { TSequence } from './CompositionManager.js';
3
- import type { CanUpdateSequencePropStatus, CodeValues, GetDragOverrides, GetEffectDragOverrides } from './use-schema.js';
3
+ import type { CanUpdateSequencePropStatus, CodeValues, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides } from './use-schema.js';
4
4
  export type SequenceManagerContext = {
5
5
  registerSequence: (seq: TSequence) => void;
6
6
  unregisterSequence: (id: string) => void;
@@ -16,15 +16,16 @@ export type VisualModeDragOverrides = {
16
16
  getEffectDragOverrides: GetEffectDragOverrides;
17
17
  };
18
18
  export type VisualModeSetters = {
19
- setDragOverrides: (nodePath: SequencePropsSubscriptionKey, key: string, value: unknown) => void;
19
+ setDragOverrides: (nodePath: SequencePropsSubscriptionKey, key: string, value: DragOverrideValue) => void;
20
20
  clearDragOverrides: (nodePath: SequencePropsSubscriptionKey) => void;
21
- setEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number, key: string, value: unknown) => void;
21
+ setEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number, key: string, value: DragOverrideValue) => void;
22
22
  clearEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number) => void;
23
23
  setCodeValues: (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
24
24
  };
25
25
  export type CanUpdateEffectPropsResponseTrue = {
26
26
  canUpdate: true;
27
27
  callee: string;
28
+ importPath: string | null;
28
29
  effectIndex: number;
29
30
  props: Record<string, CanUpdateSequencePropStatus>;
30
31
  };
@@ -17,6 +17,8 @@ const decode_image_js_1 = require("./decode-image.js");
17
17
  const request_init_1 = require("./request-init");
18
18
  const resolve_image_source_1 = require("./resolve-image-source");
19
19
  const animatedImageSchema = {
20
+ durationInFrames: sequence_field_schema_js_1.durationInFramesField,
21
+ from: sequence_field_schema_js_1.fromField,
20
22
  playbackRate: {
21
23
  type: 'number',
22
24
  min: 0,
@@ -24,6 +26,8 @@ const animatedImageSchema = {
24
26
  step: 0.1,
25
27
  default: 1,
26
28
  description: 'Playback Rate',
29
+ hiddenFromList: false,
30
+ keyframable: false,
27
31
  },
28
32
  ...sequence_field_schema_js_1.sequenceVisualStyleSchema,
29
33
  hidden: sequence_field_schema_js_1.hiddenField,
@@ -171,6 +175,10 @@ const AnimatedImageInner = ({ src, width, height, onError, fit, playbackRate, lo
171
175
  };
172
176
  return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: resolvedDuration, name: "<AnimatedImage>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage", _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, _remotionInternalRefForOutline: actualRef, children: jsx_runtime_1.jsx(AnimatedImageContent, { ...animatedImageProps, ref: actualRef, effects: effects, controls: controls }) }));
173
177
  };
174
- exports.AnimatedImage = (0, wrap_in_schema_js_1.wrapInSchema)(AnimatedImageInner, animatedImageSchema);
178
+ exports.AnimatedImage = (0, wrap_in_schema_js_1.wrapInSchema)({
179
+ Component: AnimatedImageInner,
180
+ schema: animatedImageSchema,
181
+ supportsEffects: true,
182
+ });
175
183
  exports.AnimatedImage.displayName = 'AnimatedImage';
176
184
  (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.AnimatedImage);
@@ -9,15 +9,14 @@ export declare const canvasImageSchema: {
9
9
  readonly description: "Offset";
10
10
  };
11
11
  readonly 'style.scale': {
12
- readonly type: "number";
13
- readonly min: 0.05;
12
+ readonly type: "scale";
14
13
  readonly max: 100;
15
14
  readonly step: 0.01;
16
15
  readonly default: 1;
17
16
  readonly description: "Scale";
18
17
  };
19
18
  readonly 'style.rotate': {
20
- readonly type: "rotation";
19
+ readonly type: "rotation-css";
21
20
  readonly step: 1;
22
21
  readonly default: "0deg";
23
22
  readonly description: "Rotation";
@@ -29,6 +28,20 @@ export declare const canvasImageSchema: {
29
28
  readonly step: 0.01;
30
29
  readonly default: 1;
31
30
  readonly description: "Opacity";
31
+ readonly hiddenFromList: false;
32
+ };
33
+ readonly durationInFrames: {
34
+ readonly type: "number";
35
+ readonly default: undefined;
36
+ readonly min: 1;
37
+ readonly step: 1;
38
+ readonly hiddenFromList: true;
39
+ };
40
+ readonly from: {
41
+ readonly type: "number";
42
+ readonly default: 0;
43
+ readonly step: 1;
44
+ readonly hiddenFromList: true;
32
45
  };
33
46
  readonly fit: {
34
47
  readonly type: "enum";
@@ -17,6 +17,8 @@ const use_buffer_state_js_1 = require("../use-buffer-state.js");
17
17
  const use_delay_render_js_1 = require("../use-delay-render.js");
18
18
  const wrap_in_schema_js_1 = require("../wrap-in-schema.js");
19
19
  exports.canvasImageSchema = {
20
+ durationInFrames: sequence_field_schema_js_1.durationInFramesField,
21
+ from: sequence_field_schema_js_1.fromField,
20
22
  fit: {
21
23
  type: 'enum',
22
24
  default: 'fill',
@@ -249,6 +251,10 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, width, height, fit, eff
249
251
  * @description Renders a static image to a `<canvas>` and applies Remotion effects.
250
252
  * @see [Documentation](https://www.remotion.dev/docs/canvasimage)
251
253
  */
252
- exports.CanvasImage = (0, wrap_in_schema_js_1.wrapInSchema)(CanvasImageInner, exports.canvasImageSchema);
254
+ exports.CanvasImage = (0, wrap_in_schema_js_1.wrapInSchema)({
255
+ Component: CanvasImageInner,
256
+ schema: exports.canvasImageSchema,
257
+ supportsEffects: true,
258
+ });
253
259
  exports.CanvasImage.displayName = 'CanvasImage';
254
260
  (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(exports.CanvasImage);
@@ -10,6 +10,7 @@ type OptionalProps = {
10
10
  readonly effects: EffectsProp;
11
11
  readonly className: string | undefined;
12
12
  readonly style: React.CSSProperties | undefined;
13
+ readonly pixelDensity: number | undefined;
13
14
  };
14
15
  export type SolidProps = MandatoryProps & Partial<OptionalProps>;
15
16
  export declare const Solid: React.ComponentType<MandatoryProps & Partial<OptionalProps> & Pick<SequenceProps, "durationInFrames" | "from" | "hidden" | "name" | "showInTimeline"> & React.RefAttributes<HTMLCanvasElement>>;