remotion 4.0.490 → 4.0.491

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.
@@ -1,63 +1,136 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.Series = void 0;
4
37
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
38
+ const react_1 = __importStar(require("react"));
6
39
  const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
40
+ const Interactive_js_1 = require("../Interactive.js");
7
41
  const interactivity_schema_js_1 = require("../interactivity-schema.js");
8
42
  const Sequence_js_1 = require("../Sequence.js");
9
43
  const validate_duration_in_frames_js_1 = require("../validation/validate-duration-in-frames.js");
10
44
  const with_interactivity_schema_js_1 = require("../with-interactivity-schema.js");
11
45
  const flatten_children_js_1 = require("./flatten-children.js");
12
46
  const is_inside_series_js_1 = require("./is-inside-series.js");
13
- const SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
14
- (0, is_inside_series_js_1.useRequireToBeInsideSeries)();
15
- // Discard ref
16
- return jsx_runtime_1.jsx(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: children });
47
+ const seriesSequenceSchema = {
48
+ durationInFrames: Interactive_js_1.Interactive.baseSchema.durationInFrames,
49
+ name: Interactive_js_1.Interactive.sequenceSchema.name,
50
+ hidden: Interactive_js_1.Interactive.sequenceSchema.hidden,
51
+ showInTimeline: Interactive_js_1.Interactive.sequenceSchema.showInTimeline,
52
+ freeze: Interactive_js_1.Interactive.baseSchema.freeze,
53
+ layout: Interactive_js_1.Interactive.sequenceSchema.layout,
17
54
  };
18
- const SeriesSequence = (0, react_1.forwardRef)(SeriesSequenceRefForwardingFunction);
55
+ const SeriesSequenceInner = (0, react_1.forwardRef)(({ offset = 0, className = '', stack = null, _remotionInternalRender = null, ...props }, ref) => {
56
+ (0, is_inside_series_js_1.useRequireToBeInsideSeries)();
57
+ if (_remotionInternalRender) {
58
+ return _remotionInternalRender({ ...props, offset, className: className || undefined, stack }, ref);
59
+ }
60
+ return (jsx_runtime_1.jsx(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: props.children }));
61
+ });
62
+ const SeriesSequence = Interactive_js_1.Interactive.withSchema({
63
+ Component: SeriesSequenceInner,
64
+ componentName: '<Series.Sequence>',
65
+ componentIdentity: 'dev.remotion.remotion.Series.Sequence',
66
+ schema: seriesSequenceSchema,
67
+ supportsEffects: false,
68
+ });
19
69
  const SequenceWithoutSchemaWithRef = Sequence_js_1.SequenceWithoutSchema;
70
+ const validateSeriesSequenceProps = ({ durationInFrames, offset: offsetProp, index, childrenLength, }) => {
71
+ const debugInfo = `index = ${index}, duration = ${durationInFrames}`;
72
+ if (index !== childrenLength - 1 || durationInFrames !== Infinity) {
73
+ (0, validate_duration_in_frames_js_1.validateDurationInFrames)(durationInFrames, {
74
+ component: `of a <Series.Sequence /> component`,
75
+ allowFloats: true,
76
+ });
77
+ }
78
+ const offset = offsetProp !== null && offsetProp !== void 0 ? offsetProp : 0;
79
+ if (Number.isNaN(offset)) {
80
+ throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${debugInfo}).`);
81
+ }
82
+ if (!Number.isFinite(offset)) {
83
+ throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
84
+ }
85
+ if (offset % 1 !== 0) {
86
+ throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
87
+ }
88
+ return offset;
89
+ };
20
90
  const SeriesInner = (props) => {
21
91
  const childrenValue = (0, react_1.useMemo)(() => {
22
- let startFrame = 0;
23
92
  const flattenedChildren = (0, flatten_children_js_1.flattenChildren)(props.children);
24
- return react_1.Children.map(flattenedChildren, (child, i) => {
25
- var _a;
93
+ const renderChildren = (i, startFrame) => {
94
+ if (i === flattenedChildren.length) {
95
+ return null;
96
+ }
97
+ const child = flattenedChildren[i];
26
98
  const castedChild = child;
27
99
  if (typeof castedChild === 'string') {
28
100
  // Don't throw if it's just some accidential whitespace
29
101
  if (castedChild.trim() === '') {
30
- return null;
102
+ return renderChildren(i + 1, startFrame);
31
103
  }
32
104
  throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${castedChild}"`);
33
105
  }
34
106
  if (castedChild.type !== SeriesSequence) {
35
107
  throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${castedChild} instead`);
36
108
  }
37
- const debugInfo = `index = ${i}, duration = ${castedChild.props.durationInFrames}`;
38
- const durationInFramesProp = castedChild.props.durationInFrames;
39
- const { durationInFrames, children: _children, from, name, ...passedProps } = castedChild.props; // `from` is not accepted and must be filtered out if used in JS
40
- if (i !== flattenedChildren.length - 1 ||
41
- durationInFramesProp !== Infinity) {
42
- (0, validate_duration_in_frames_js_1.validateDurationInFrames)(durationInFramesProp, {
43
- component: `of a <Series.Sequence /> component`,
44
- allowFloats: true,
45
- });
46
- }
47
- const offset = (_a = castedChild.props.offset) !== null && _a !== void 0 ? _a : 0;
48
- if (Number.isNaN(offset)) {
49
- throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${debugInfo}).`);
50
- }
51
- if (!Number.isFinite(offset)) {
52
- throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
53
- }
54
- if (offset % 1 !== 0) {
55
- throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
56
- }
57
- const currentStartFrame = startFrame + offset;
58
- startFrame += durationInFramesProp + offset;
59
- return (jsx_runtime_1.jsx(SequenceWithoutSchemaWithRef, { ref: castedChild.ref, name: name || '<Series.Sequence>', _remotionInternalDocumentationLink: name ? undefined : 'https://www.remotion.dev/docs/series', from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, children: child }));
60
- });
109
+ const castedElement = castedChild;
110
+ validateSeriesSequenceProps({
111
+ durationInFrames: castedElement.props.durationInFrames,
112
+ offset: castedElement.props.offset,
113
+ index: i,
114
+ childrenLength: flattenedChildren.length,
115
+ });
116
+ return react_1.default.cloneElement(castedElement, {
117
+ _remotionInternalRender: (resolvedProps, ref) => {
118
+ const durationInFramesProp = resolvedProps.durationInFrames;
119
+ const { durationInFrames: _durationInFrames, children: sequenceChildren, offset: offsetProp, controls, stack, from: _from, name, ...passedProps } = resolvedProps; // `from` is not accepted and must be filtered out if used in JS
120
+ const offset = validateSeriesSequenceProps({
121
+ durationInFrames: durationInFramesProp,
122
+ offset: offsetProp,
123
+ index: i,
124
+ childrenLength: flattenedChildren.length,
125
+ });
126
+ const currentStartFrame = startFrame + offset;
127
+ const nextStartFrame = startFrame + durationInFramesProp + offset;
128
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
129
+ jsx_runtime_1.jsx(SequenceWithoutSchemaWithRef, { ref: ref, name: name || '<Series.Sequence>', _remotionInternalDocumentationLink: name ? undefined : 'https://www.remotion.dev/docs/series', _remotionInternalStack: stack !== null && stack !== void 0 ? stack : undefined, controls: controls !== null && controls !== void 0 ? controls : undefined, from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, children: jsx_runtime_1.jsx(is_inside_series_js_1.IsNotInsideSeriesProvider, { children: sequenceChildren }) }), renderChildren(i + 1, nextStartFrame)] }));
130
+ },
131
+ });
132
+ };
133
+ return renderChildren(0, 0);
61
134
  }, [props.children]);
62
135
  return (jsx_runtime_1.jsx(is_inside_series_js_1.IsInsideSeriesContainer, { children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", name: "<Series>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series", ...props, children: childrenValue }) }));
63
136
  };
@@ -133,6 +133,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate,
133
133
  showInTimeline: true,
134
134
  nonce: nonce.get(),
135
135
  startMediaFrom: 0 - startsAt,
136
+ mediaFrameAtSequenceZero: null,
136
137
  doesVolumeChange,
137
138
  loopDisplay,
138
139
  playbackRate,
@@ -4,10 +4,27 @@ import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey } fro
4
4
  export type CanUpdateSequencePropStatusStatic = {
5
5
  status: 'static';
6
6
  codeValue: unknown;
7
+ numericExpression?: VideoConfigNumericExpression;
7
8
  };
8
9
  export type CanUpdateSequencePropStatusKeyframe = {
9
10
  frame: number;
10
11
  value: unknown;
12
+ frameExpression?: VideoConfigNumericExpression;
13
+ };
14
+ export type VideoConfigNumericExpression = {
15
+ type: 'literal';
16
+ value: number;
17
+ } | {
18
+ type: 'video-config-value';
19
+ identifier: string;
20
+ value: number;
21
+ } | {
22
+ type: 'video-config-multiplication';
23
+ identifier: string;
24
+ multiplier: number;
25
+ multiplicand: number;
26
+ factorPosition: 'left' | 'right';
27
+ value: number;
11
28
  };
12
29
  export type CanUpdateSequencePropStatusLinearEasing = {
13
30
  type: 'linear';
@@ -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.490";
6
+ export declare const VERSION = "4.0.491";
@@ -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.490';
10
+ exports.VERSION = '4.0.491';
@@ -1,16 +1,16 @@
1
1
  import React from 'react';
2
2
  import type { SequenceControls } from './CompositionManager.js';
3
- import { type InteractivitySchema } from './interactivity-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
- export declare const selectActiveKeys: (schema: InteractivitySchema, values: Record<string, unknown>) => string[];
6
+ export declare const selectActiveKeys: (schema: SequenceSchema, values: Record<string, unknown>) => string[];
7
7
  export declare const mergeValues: ({ props, valuesDotNotation, schemaKeys, propsToDelete, }: {
8
8
  props: Record<string, unknown>;
9
9
  valuesDotNotation: Record<string, unknown>;
10
10
  schemaKeys: string[];
11
11
  propsToDelete: Set<string>;
12
12
  }) => Record<string, unknown>;
13
- export declare const wrapInSchema: <S extends InteractivitySchema, Props extends object>({ Component, componentIdentity, 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
  }>;
@@ -38,7 +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 interactivity_schema_js_1 = require("./interactivity-schema.js");
41
+ const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
42
42
  const sequence_node_path_js_1 = require("./sequence-node-path.js");
43
43
  const SequenceManager_js_1 = require("./SequenceManager.js");
44
44
  const use_current_frame_js_1 = require("./use-current-frame.js");
@@ -100,7 +100,7 @@ exports.mergeValues = mergeValues;
100
100
  const stackToOverrideMap = {};
101
101
  const wrapInSchema = ({ Component, componentIdentity, schema, supportsEffects, }) => {
102
102
  // Schema is static for a component, so we move this outside
103
- const schemaWithSequenceName = (0, interactivity_schema_js_1.extendSchemaWithSequenceName)(schema);
103
+ const schemaWithSequenceName = (0, sequence_field_schema_js_1.extendSchemaWithSequenceName)(schema);
104
104
  const flatSchema = (0, flatten_schema_js_1.getFlatSchemaWithAllKeys)(schemaWithSequenceName);
105
105
  const flatKeys = Object.keys(flatSchema);
106
106
  const Wrapped = (0, react_1.forwardRef)((props, ref) => {