remotion 4.0.475 → 4.0.477

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 (38) hide show
  1. package/dist/cjs/CompositionManager.d.ts +2 -0
  2. package/dist/cjs/HtmlInCanvas.js +3 -3
  3. package/dist/cjs/Img.d.ts +8 -2
  4. package/dist/cjs/Img.js +7 -5
  5. package/dist/cjs/Interactive.d.ts +1 -1
  6. package/dist/cjs/Interactive.js +4 -2
  7. package/dist/cjs/Sequence.d.ts +1 -0
  8. package/dist/cjs/Sequence.js +35 -5
  9. package/dist/cjs/SequenceContext.d.ts +1 -0
  10. package/dist/cjs/animated-image/AnimatedImage.js +2 -0
  11. package/dist/cjs/audio/AudioForPreview.js +1 -1
  12. package/dist/cjs/canvas-image/CanvasImage.d.ts +7 -1
  13. package/dist/cjs/canvas-image/CanvasImage.js +4 -2
  14. package/dist/cjs/canvas-image/props.d.ts +1 -1
  15. package/dist/cjs/easing.d.ts +3 -0
  16. package/dist/cjs/easing.js +18 -0
  17. package/dist/cjs/effects/Solid.d.ts +1 -1
  18. package/dist/cjs/effects/Solid.js +4 -2
  19. package/dist/cjs/index.d.ts +2 -2
  20. package/dist/cjs/internals.d.ts +19 -3
  21. package/dist/cjs/internals.js +1 -0
  22. package/dist/cjs/interpolate-translate.d.ts +8 -0
  23. package/dist/cjs/interpolate-translate.js +70 -0
  24. package/dist/cjs/loop/index.js +1 -1
  25. package/dist/cjs/no-react.d.ts +9 -0
  26. package/dist/cjs/sequence-field-schema.d.ts +29 -1
  27. package/dist/cjs/sequence-field-schema.js +28 -5
  28. package/dist/cjs/series/index.d.ts +1 -1
  29. package/dist/cjs/series/index.js +1 -0
  30. package/dist/cjs/version.d.ts +1 -1
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/cjs/video/VideoForPreview.js +4 -6
  33. package/dist/cjs/wrap-in-schema.d.ts +3 -2
  34. package/dist/cjs/wrap-in-schema.js +8 -5
  35. package/dist/esm/index.mjs +650 -547
  36. package/dist/esm/no-react.mjs +26 -4
  37. package/dist/esm/version.mjs +1 -1
  38. package/package.json +2 -2
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.interpolateTranslate = void 0;
4
+ const interpolate_js_1 = require("./interpolate.js");
5
+ const pixelValueRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))px$/;
6
+ const parseTranslate = (value) => {
7
+ if (typeof value !== 'string') {
8
+ throw new TypeError(`outputRange must contain only strings, but got ${typeof value}`);
9
+ }
10
+ const parts = value.trim().split(/\s+/);
11
+ if (parts.length < 1 || parts.length > 3 || parts[0] === '') {
12
+ throw new TypeError(`translate values must contain 1 to 3 pixel values, but got "${value}"`);
13
+ }
14
+ return parts.map((part) => {
15
+ const match = pixelValueRegex.exec(part);
16
+ if (match === null) {
17
+ throw new TypeError(`interpolateTranslate() only supports px values, but got "${part}" in "${value}"`);
18
+ }
19
+ return Number(match[1]);
20
+ });
21
+ };
22
+ /*
23
+ * @description Allows you to map a range of values to CSS translate values using pixel units.
24
+ * @see [Documentation](https://remotion.dev/docs/interpolate-translate)
25
+ */
26
+ const interpolateTranslate = (input, inputRange, outputRange, options) => {
27
+ var _a;
28
+ if (typeof input === 'undefined') {
29
+ throw new TypeError('input can not be undefined');
30
+ }
31
+ if (typeof inputRange === 'undefined') {
32
+ throw new TypeError('inputRange can not be undefined');
33
+ }
34
+ if (typeof outputRange === 'undefined') {
35
+ throw new TypeError('outputRange can not be undefined');
36
+ }
37
+ if (inputRange.length !== outputRange.length) {
38
+ throw new TypeError('inputRange (' +
39
+ inputRange.length +
40
+ ' values provided) and outputRange (' +
41
+ outputRange.length +
42
+ ' values provided) must have the same length');
43
+ }
44
+ const parsedOutputRange = outputRange.map((translateValue) => parseTranslate(translateValue));
45
+ const firstValueLength = (_a = parsedOutputRange[0]) === null || _a === void 0 ? void 0 : _a.length;
46
+ if (firstValueLength === undefined) {
47
+ throw new TypeError('outputRange must have at least 1 element');
48
+ }
49
+ for (const parsedTranslate of parsedOutputRange) {
50
+ if (parsedTranslate.length !== firstValueLength) {
51
+ throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${parsedTranslate.length}`);
52
+ }
53
+ }
54
+ return new Array(firstValueLength)
55
+ .fill(true)
56
+ .map((_, index) => {
57
+ const outputValues = [];
58
+ for (const translateValue of parsedOutputRange) {
59
+ const value = translateValue[index];
60
+ if (value === undefined) {
61
+ throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${translateValue.length}`);
62
+ }
63
+ outputValues.push(value);
64
+ }
65
+ const interpolatedValue = (0, interpolate_js_1.interpolate)(input, inputRange, outputValues, options);
66
+ return `${interpolatedValue}px`;
67
+ })
68
+ .join(' ');
69
+ };
70
+ exports.interpolateTranslate = interpolateTranslate;
@@ -84,7 +84,7 @@ const Loop = ({ durationInFrames, times = Infinity, children, name, showInTimeli
84
84
  durationInFrames,
85
85
  };
86
86
  }, [currentFrame, durationInFrames]);
87
- return (jsx_runtime_1.jsx(LoopContext.Provider, { value: loopContext, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalDocumentationLink: name === undefined ? 'https://www.remotion.dev/docs/loop' : undefined, _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, showInTimeline: showInTimeline, children: children }) }));
87
+ return (jsx_runtime_1.jsx(LoopContext.Provider, { value: loopContext, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/loop", _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, showInTimeline: showInTimeline, children: children }) }));
88
88
  };
89
89
  exports.Loop = Loop;
90
90
  exports.Loop.useLoop = useLoop;
@@ -63,12 +63,19 @@ export declare const NoReactInternals: {
63
63
  }) => string[];
64
64
  sequenceSchema: {
65
65
  readonly hidden: import("./sequence-field-schema").BooleanFieldSchema;
66
+ readonly showInTimeline: import("./sequence-field-schema").HiddenFieldSchema;
66
67
  readonly from: {
67
68
  readonly type: "number";
68
69
  readonly default: 0;
69
70
  readonly step: 1;
70
71
  readonly hiddenFromList: true;
71
72
  };
73
+ readonly freeze: {
74
+ readonly type: "number";
75
+ readonly default: null;
76
+ readonly step: 1;
77
+ readonly hiddenFromList: true;
78
+ };
72
79
  readonly durationInFrames: {
73
80
  readonly type: "number";
74
81
  readonly default: undefined;
@@ -141,6 +148,8 @@ export declare const NoReactInternals: {
141
148
  readonly none: {};
142
149
  };
143
150
  };
151
+ } & {
152
+ name: import("./sequence-field-schema").SequenceFieldSchema;
144
153
  };
145
154
  parseScaleValue: (value: unknown) => import("./scale-value").ScaleValue;
146
155
  serializeScaleValue: ([x, y, z]: import("./scale-value").ScaleValue) => string | number;
@@ -7,7 +7,7 @@ export type NumberFieldSchema = {
7
7
  min?: number;
8
8
  max?: number;
9
9
  step?: number;
10
- default: number | undefined;
10
+ default: number | null | undefined;
11
11
  description?: string;
12
12
  hiddenFromList: boolean;
13
13
  keyframable?: boolean;
@@ -225,6 +225,10 @@ export declare const sequenceStyleSchema: {
225
225
  };
226
226
  };
227
227
  export declare const hiddenField: SequenceFieldSchema;
228
+ export declare const sequenceNameField: SequenceFieldSchema;
229
+ export declare const extendSchemaWithSequenceName: <S extends SequenceSchema>(schema: S) => S & {
230
+ name: SequenceFieldSchema;
231
+ };
228
232
  export declare const durationInFramesField: {
229
233
  readonly type: "number";
230
234
  readonly default: undefined;
@@ -238,14 +242,27 @@ export declare const fromField: {
238
242
  readonly step: 1;
239
243
  readonly hiddenFromList: true;
240
244
  };
245
+ export declare const freezeField: {
246
+ readonly type: "number";
247
+ readonly default: null;
248
+ readonly step: 1;
249
+ readonly hiddenFromList: true;
250
+ };
241
251
  export declare const sequenceSchema: {
242
252
  readonly hidden: BooleanFieldSchema;
253
+ readonly showInTimeline: HiddenFieldSchema;
243
254
  readonly from: {
244
255
  readonly type: "number";
245
256
  readonly default: 0;
246
257
  readonly step: 1;
247
258
  readonly hiddenFromList: true;
248
259
  };
260
+ readonly freeze: {
261
+ readonly type: "number";
262
+ readonly default: null;
263
+ readonly step: 1;
264
+ readonly hiddenFromList: true;
265
+ };
249
266
  readonly durationInFrames: {
250
267
  readonly type: "number";
251
268
  readonly default: undefined;
@@ -318,9 +335,18 @@ export declare const sequenceSchema: {
318
335
  readonly none: {};
319
336
  };
320
337
  };
338
+ } & {
339
+ name: SequenceFieldSchema;
321
340
  };
322
341
  export declare const sequenceSchemaWithoutFrom: {
323
342
  readonly hidden: BooleanFieldSchema;
343
+ readonly showInTimeline: HiddenFieldSchema;
344
+ readonly freeze: {
345
+ readonly type: "number";
346
+ readonly default: null;
347
+ readonly step: 1;
348
+ readonly hiddenFromList: true;
349
+ };
324
350
  readonly durationInFrames: {
325
351
  readonly type: "number";
326
352
  readonly default: undefined;
@@ -393,5 +419,7 @@ export declare const sequenceSchemaWithoutFrom: {
393
419
  readonly none: {};
394
420
  };
395
421
  };
422
+ } & {
423
+ name: SequenceFieldSchema;
396
424
  };
397
425
  export declare const sequenceSchemaDefaultLayoutNone: SequenceSchema;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sequenceSchemaDefaultLayoutNone = exports.sequenceSchemaWithoutFrom = exports.sequenceSchema = exports.fromField = exports.durationInFramesField = exports.hiddenField = exports.sequenceStyleSchema = exports.sequencePremountSchema = exports.sequenceVisualStyleSchema = void 0;
3
+ exports.sequenceSchemaDefaultLayoutNone = exports.sequenceSchemaWithoutFrom = exports.sequenceSchema = exports.freezeField = exports.fromField = exports.durationInFramesField = exports.extendSchemaWithSequenceName = exports.sequenceNameField = exports.hiddenField = exports.sequenceStyleSchema = exports.sequencePremountSchema = exports.sequenceVisualStyleSchema = void 0;
4
4
  exports.sequenceVisualStyleSchema = {
5
5
  'style.transformOrigin': {
6
6
  type: 'transform-origin',
@@ -69,6 +69,19 @@ exports.hiddenField = {
69
69
  default: false,
70
70
  description: 'Hidden',
71
71
  };
72
+ const showInTimelineField = {
73
+ type: 'hidden',
74
+ };
75
+ exports.sequenceNameField = {
76
+ type: 'hidden',
77
+ };
78
+ const extendSchemaWithSequenceName = (schema) => {
79
+ return {
80
+ name: exports.sequenceNameField,
81
+ ...schema,
82
+ };
83
+ };
84
+ exports.extendSchemaWithSequenceName = extendSchemaWithSequenceName;
72
85
  exports.durationInFramesField = {
73
86
  type: 'number',
74
87
  default: undefined,
@@ -82,9 +95,17 @@ exports.fromField = {
82
95
  step: 1,
83
96
  hiddenFromList: true,
84
97
  };
85
- exports.sequenceSchema = {
98
+ exports.freezeField = {
99
+ type: 'number',
100
+ default: null,
101
+ step: 1,
102
+ hiddenFromList: true,
103
+ };
104
+ exports.sequenceSchema = (0, exports.extendSchemaWithSequenceName)({
86
105
  hidden: exports.hiddenField,
106
+ showInTimeline: showInTimelineField,
87
107
  from: exports.fromField,
108
+ freeze: exports.freezeField,
88
109
  durationInFrames: exports.durationInFramesField,
89
110
  layout: {
90
111
  type: 'enum',
@@ -95,12 +116,14 @@ exports.sequenceSchema = {
95
116
  none: {},
96
117
  },
97
118
  },
98
- };
99
- exports.sequenceSchemaWithoutFrom = {
119
+ });
120
+ exports.sequenceSchemaWithoutFrom = (0, exports.extendSchemaWithSequenceName)({
100
121
  hidden: exports.hiddenField,
122
+ showInTimeline: showInTimelineField,
123
+ freeze: exports.freezeField,
101
124
  durationInFrames: exports.durationInFramesField,
102
125
  layout: exports.sequenceSchema.layout,
103
- };
126
+ });
104
127
  exports.sequenceSchemaDefaultLayoutNone = {
105
128
  ...exports.sequenceSchema,
106
129
  layout: {
@@ -4,7 +4,7 @@ type SeriesSequenceProps = PropsWithChildren<{
4
4
  readonly durationInFrames: number;
5
5
  readonly offset?: number;
6
6
  readonly className?: string;
7
- } & Pick<SequenceProps, 'layout' | 'name' | 'hidden'> & LayoutAndStyle>;
7
+ } & Pick<SequenceProps, 'layout' | 'name' | 'hidden' | 'showInTimeline' | 'freeze'> & LayoutAndStyle>;
8
8
  declare const SeriesSequence: React.ForwardRefExoticComponent<SeriesSequenceProps & React.RefAttributes<HTMLDivElement>>;
9
9
  type SeriesProps = SequenceProps;
10
10
  /**
@@ -67,6 +67,7 @@ const SeriesInner = (props) => {
67
67
  */
68
68
  const Series = Object.assign((0, wrap_in_schema_js_1.wrapInSchema)({
69
69
  Component: SeriesInner,
70
+ componentIdentity: 'dev.remotion.remotion.Series',
70
71
  schema: sequence_field_schema_js_1.sequenceSchemaDefaultLayoutNone,
71
72
  supportsEffects: false,
72
73
  }), {
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.475";
6
+ export declare const VERSION = "4.0.477";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.475';
10
+ exports.VERSION = '4.0.477';
@@ -131,11 +131,9 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
131
131
  premountDisplay: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premountDisplay) !== null && _c !== void 0 ? _c : null,
132
132
  postmountDisplay: (_d = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.postmountDisplay) !== null && _d !== void 0 ? _d : null,
133
133
  loopDisplay: undefined,
134
- documentationLink: name === undefined
135
- ? onlyWarnForMediaSeekingError
136
- ? 'https://www.remotion.dev/docs/offthreadvideo'
137
- : 'https://www.remotion.dev/docs/html5-video'
138
- : null,
134
+ documentationLink: onlyWarnForMediaSeekingError
135
+ ? 'https://www.remotion.dev/docs/offthreadvideo'
136
+ : 'https://www.remotion.dev/docs/html5-video',
139
137
  refForOutline: videoRef,
140
138
  });
141
139
  // putting playback before useVolume
@@ -282,6 +280,6 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
282
280
  requestsVideoFrame: Boolean(onVideoFrame),
283
281
  isClientSideRendering: false,
284
282
  });
285
- return (jsx_runtime_1.jsx("video", { ref: videoRef, muted: muted || mediaMuted || userPreferredVolume <= 0, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, disableRemotePlayback: true, crossOrigin: crossOriginValue, ...nativeProps }));
283
+ return (jsx_runtime_1.jsx("video", { ...nativeProps, ref: videoRef, muted: muted || mediaMuted || userPreferredVolume <= 0, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, disableRemotePlayback: true, crossOrigin: crossOriginValue, controls: false }));
286
284
  };
287
285
  exports.VideoForPreview = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { SequenceControls } from './CompositionManager.js';
3
- import type { SequenceSchema } from './sequence-field-schema.js';
3
+ import { type SequenceSchema } from './sequence-field-schema.js';
4
4
  export declare const getNestedValue: (obj: Record<string, unknown>, key: string) => unknown;
5
5
  export declare const readValuesFromProps: (props: Record<string, unknown>, keys: string[]) => Record<string, unknown>;
6
6
  export declare const selectActiveKeys: (schema: SequenceSchema, values: Record<string, unknown>) => string[];
@@ -10,10 +10,11 @@ export declare const mergeValues: ({ props, valuesDotNotation, schemaKeys, props
10
10
  schemaKeys: string[];
11
11
  propsToDelete: Set<string>;
12
12
  }) => Record<string, unknown>;
13
- export declare const wrapInSchema: <S extends SequenceSchema, Props extends object>({ Component, schema, supportsEffects, }: {
13
+ export declare const wrapInSchema: <S extends SequenceSchema, Props extends object>({ Component, componentIdentity, schema, supportsEffects, }: {
14
14
  Component: React.ComponentType<Props & {
15
15
  readonly _experimentalControls: SequenceControls | undefined;
16
16
  }>;
17
+ componentIdentity: string | null;
17
18
  schema: S;
18
19
  supportsEffects: boolean;
19
20
  }) => React.ComponentType<Props>;
@@ -38,6 +38,7 @@ const react_1 = __importStar(require("react"));
38
38
  const delete_nested_key_js_1 = require("./delete-nested-key.js");
39
39
  const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
40
40
  const flatten_schema_js_1 = require("./flatten-schema.js");
41
+ const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
41
42
  const sequence_node_path_js_1 = require("./sequence-node-path.js");
42
43
  const SequenceManager_js_1 = require("./SequenceManager.js");
43
44
  const use_current_frame_js_1 = require("./use-current-frame.js");
@@ -97,9 +98,10 @@ const mergeValues = ({ props, valuesDotNotation, schemaKeys, propsToDelete, }) =
97
98
  };
98
99
  exports.mergeValues = mergeValues;
99
100
  const stackToOverrideMap = {};
100
- const wrapInSchema = ({ Component, schema, supportsEffects, }) => {
101
+ const wrapInSchema = ({ Component, componentIdentity, schema, supportsEffects, }) => {
101
102
  // Schema is static for a component, so we move this outside
102
- const flatSchema = (0, flatten_schema_js_1.getFlatSchemaWithAllKeys)(schema);
103
+ const schemaWithSequenceName = (0, sequence_field_schema_js_1.extendSchemaWithSequenceName)(schema);
104
+ const flatSchema = (0, flatten_schema_js_1.getFlatSchemaWithAllKeys)(schemaWithSequenceName);
103
105
  const flatKeys = Object.keys(flatSchema);
104
106
  const Wrapped = (0, react_1.forwardRef)((props, ref) => {
105
107
  var _a;
@@ -154,17 +156,18 @@ const wrapInSchema = ({ Component, schema, supportsEffects, }) => {
154
156
  // eslint-disable-next-line react-hooks/rules-of-hooks
155
157
  const controls = (0, react_1.useMemo)(() => {
156
158
  return {
157
- schema,
159
+ schema: schemaWithSequenceName,
158
160
  currentRuntimeValueDotNotation,
159
161
  overrideId,
160
162
  supportsEffects,
163
+ componentIdentity,
161
164
  };
162
165
  }, [currentRuntimeValueDotNotation, overrideId]);
163
166
  // 3. Apply drag/code overrides on top of the runtime values.
164
167
  // eslint-disable-next-line react-hooks/rules-of-hooks
165
168
  const { merged: valuesDotNotation, propsToDelete } = (0, react_1.useMemo)(() => {
166
169
  return (0, use_schema_js_1.computeEffectiveSchemaValuesDotNotation)({
167
- schema,
170
+ schema: schemaWithSequenceName,
168
171
  currentValue: currentRuntimeValueDotNotation,
169
172
  overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
170
173
  propStatus: nodePath === null
@@ -180,7 +183,7 @@ const wrapInSchema = ({ Component, schema, supportsEffects, }) => {
180
183
  frame,
181
184
  ]);
182
185
  // 4. Eliminate values forbidden by the resolved discriminated union.
183
- const activeKeys = (0, exports.selectActiveKeys)(schema, valuesDotNotation);
186
+ const activeKeys = (0, exports.selectActiveKeys)(schemaWithSequenceName, valuesDotNotation);
184
187
  // 5. Apply the active values back onto the props.
185
188
  const mergedProps = (0, exports.mergeValues)({
186
189
  props: props,