remotion 4.0.489 → 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.
@@ -17,11 +17,6 @@ exports.DELAY_RENDER_RETRIES_LEFT = 'Retries left: ';
17
17
  exports.DELAY_RENDER_RETRY_TOKEN = '- Rendering the frame will be retried.';
18
18
  exports.DELAY_RENDER_CLEAR_TOKEN = 'handle was cleared after';
19
19
  const defaultTimeout = 30000;
20
- /**
21
- * Internal function that accepts environment as parameter.
22
- * This allows useDelayRender to control its own environment source.
23
- * @private
24
- */
25
20
  const delayRenderInternal = ({ scope, environment, label, options, }) => {
26
21
  var _a;
27
22
  var _b, _c, _d, _e;
@@ -80,10 +75,6 @@ const delayRender = (label, options) => {
80
75
  });
81
76
  };
82
77
  exports.delayRender = delayRender;
83
- /**
84
- * Internal function that accepts environment as parameter.
85
- * @private
86
- */
87
78
  const continueRenderInternal = ({ scope, handle, environment, logLevel, }) => {
88
79
  if (typeof handle === 'undefined') {
89
80
  throw new TypeError('The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.');
@@ -92,28 +83,22 @@ const continueRenderInternal = ({ scope, handle, environment, logLevel, }) => {
92
83
  throw new TypeError('The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: ' +
93
84
  JSON.stringify(handle));
94
85
  }
95
- scope.remotion_delayRenderHandles = scope.remotion_delayRenderHandles.filter((h) => {
96
- if (h === handle) {
97
- if (environment.isRendering && scope !== undefined) {
98
- if (!scope.remotion_delayRenderTimeouts[handle]) {
99
- return false;
100
- }
101
- const { label, startTime, timeout } = scope.remotion_delayRenderTimeouts[handle];
102
- clearTimeout(timeout);
103
- const message = [
104
- label ? `"${label}"` : 'A handle',
105
- exports.DELAY_RENDER_CLEAR_TOKEN,
106
- `${Date.now() - startTime}ms`,
107
- ]
108
- .filter(truthy_js_1.truthy)
109
- .join(' ');
110
- log_js_1.Log.verbose({ logLevel, tag: 'delayRender()' }, message);
111
- delete scope.remotion_delayRenderTimeouts[handle];
112
- }
113
- return false;
114
- }
115
- return true;
116
- });
86
+ const handleExists = scope.remotion_delayRenderHandles.includes(handle);
87
+ const timeoutEntry = scope.remotion_delayRenderTimeouts[handle];
88
+ if (handleExists && environment.isRendering && timeoutEntry) {
89
+ const { label, startTime, timeout } = timeoutEntry;
90
+ clearTimeout(timeout);
91
+ const message = [
92
+ label ? `"${label}"` : 'A handle',
93
+ exports.DELAY_RENDER_CLEAR_TOKEN,
94
+ `${Date.now() - startTime}ms`,
95
+ ]
96
+ .filter(truthy_js_1.truthy)
97
+ .join(' ');
98
+ log_js_1.Log.verbose({ logLevel, tag: 'delayRender()' }, message);
99
+ delete scope.remotion_delayRenderTimeouts[handle];
100
+ }
101
+ scope.remotion_delayRenderHandles = scope.remotion_delayRenderHandles.filter((h) => h !== handle);
117
102
  if (scope.remotion_delayRenderHandles.length === 0) {
118
103
  scope.remotion_renderReady = true;
119
104
  }
@@ -32,6 +32,7 @@ export declare const solidSchema: {
32
32
  readonly step: 0.01;
33
33
  readonly default: 1;
34
34
  readonly description: "Scale";
35
+ readonly defaultKeyframeOutput: "perceptual-scale";
35
36
  };
36
37
  readonly 'style.rotate': {
37
38
  readonly type: "rotation-css";
@@ -28,7 +28,7 @@ const getFlatSchemaWithAllKeys = (schema) => {
28
28
  const out = {};
29
29
  const addKey = (key, field) => {
30
30
  if (key in out) {
31
- throw new Error(`Duplicate key "${key}" in schema: discriminated union variants must not share keys`);
31
+ return;
32
32
  }
33
33
  out[key] = field;
34
34
  };
@@ -132,7 +132,7 @@ export * from './internals.js';
132
132
  export { interpolateColors, type InterpolateColorsOptions, } from './interpolate-colors.js';
133
133
  export { LogLevel } from './log.js';
134
134
  export { Loop } from './loop/index.js';
135
- export { assertValidInterpolateEasingOption, assertValidInterpolatePosterizeOption, EasingFunction, ExtrapolateType, interpolate, InterpolateOptions, random, RandomSeed, } from './no-react';
135
+ export { assertValidInterpolateEasingOption, assertValidInterpolatePosterizeOption, EasingFunction, ExtrapolateType, interpolate, InterpolateOutputOption, InterpolateOptions, random, RandomSeed, } from './no-react';
136
136
  export type { NonceHistory } from './nonce.js';
137
137
  export { prefetch, PrefetchOnProgress } from './prefetch.js';
138
138
  export { registerRoot } from './register-root.js';
@@ -1,3 +1,4 @@
1
+ import type { InterpolateOutputOption } from './interpolate.js';
1
2
  export type HiddenFieldSchema = {
2
3
  type: 'hidden';
3
4
  keyframable?: boolean;
@@ -11,6 +12,7 @@ export type NumberFieldSchema = {
11
12
  description?: string;
12
13
  hiddenFromList: boolean;
13
14
  keyframable?: boolean;
15
+ defaultKeyframeOutput?: InterpolateOutputOption;
14
16
  };
15
17
  export type BooleanFieldSchema = {
16
18
  type: 'boolean';
@@ -56,6 +58,7 @@ export type ScaleFieldSchema = {
56
58
  default: number | string | undefined;
57
59
  description?: string;
58
60
  keyframable?: boolean;
61
+ defaultKeyframeOutput?: InterpolateOutputOption;
59
62
  };
60
63
  export type UvCoordinateFieldSchema = {
61
64
  type: 'uv-coordinate';
@@ -101,7 +104,7 @@ export type EnumFieldSchema = {
101
104
  variants: Record<string, InteractivitySchema>;
102
105
  keyframable?: boolean;
103
106
  };
104
- export type NumberArrayItemSchema = Omit<NumberFieldSchema, 'default' | 'description' | 'hiddenFromList' | 'keyframable'>;
107
+ export type NumberArrayItemSchema = Omit<NumberFieldSchema, 'default' | 'description' | 'hiddenFromList' | 'keyframable' | 'defaultKeyframeOutput'>;
105
108
  export type BooleanArrayItemSchema = Omit<BooleanFieldSchema, 'default' | 'description' | 'keyframable'>;
106
109
  export type RotationCssArrayItemSchema = Omit<RotationCssFieldSchema, 'default' | 'description' | 'keyframable'>;
107
110
  export type RotationDegreesArrayItemSchema = Omit<RotationDegreesFieldSchema, 'default' | 'description' | 'keyframable'>;
@@ -148,6 +151,7 @@ export declare const transformSchema: {
148
151
  readonly step: 0.01;
149
152
  readonly default: 1;
150
153
  readonly description: "Scale";
154
+ readonly defaultKeyframeOutput: "perceptual-scale";
151
155
  };
152
156
  readonly 'style.rotate': {
153
157
  readonly type: "rotation-css";
@@ -184,6 +188,7 @@ export declare const sequenceVisualStyleSchema: {
184
188
  readonly step: 0.01;
185
189
  readonly default: 1;
186
190
  readonly description: "Scale";
191
+ readonly defaultKeyframeOutput: "perceptual-scale";
187
192
  };
188
193
  readonly 'style.rotate': {
189
194
  readonly type: "rotation-css";
@@ -351,6 +356,7 @@ export declare const sequenceStyleSchema: {
351
356
  readonly step: 0.01;
352
357
  readonly default: 1;
353
358
  readonly description: "Scale";
359
+ readonly defaultKeyframeOutput: "perceptual-scale";
354
360
  };
355
361
  readonly 'style.rotate': {
356
362
  readonly type: "rotation-css";
@@ -505,6 +511,7 @@ export declare const sequenceSchema: {
505
511
  readonly step: 0.01;
506
512
  readonly default: 1;
507
513
  readonly description: "Scale";
514
+ readonly defaultKeyframeOutput: "perceptual-scale";
508
515
  };
509
516
  readonly 'style.rotate': {
510
517
  readonly type: "rotation-css";
@@ -620,6 +627,7 @@ export declare const sequenceSchemaWithoutFrom: {
620
627
  readonly step: 0.01;
621
628
  readonly default: 1;
622
629
  readonly description: "Scale";
630
+ readonly defaultKeyframeOutput: "perceptual-scale";
623
631
  };
624
632
  readonly 'style.rotate': {
625
633
  readonly type: "rotation-css";
@@ -20,6 +20,7 @@ exports.transformSchema = {
20
20
  step: 0.01,
21
21
  default: 1,
22
22
  description: 'Scale',
23
+ defaultKeyframeOutput: 'perceptual-scale',
23
24
  },
24
25
  'style.rotate': {
25
26
  type: 'rotation-css',
@@ -14,11 +14,11 @@ import type { OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSe
14
14
  import { OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext } from './sequence-node-path.js';
15
15
  import type { ResolvedStackLocation } from './sequence-stack-traces.js';
16
16
  import type { CannotUpdateSequenceReason } from './SequenceManager.js';
17
- import { type CanUpdateEffectPropsResponse, type CanUpdateEffectPropsResponseFalse, type CanUpdateEffectPropsResponseTrue, type CanUpdateSequencePropsResponse, type CanUpdateSequencePropsResponseFalse, type CanUpdateSequencePropsResponseTrue, type SequenceNodePath, type SequencePropsSubscriptionKey } from './SequenceManager.js';
17
+ import { type CanUpdateEffectPropsResponse, type CanUpdateEffectPropsResponseFalse, type CanUpdateEffectPropsResponseTrue, type CanUpdateSequencePropsResponse, type CanUpdateSequencePropsResponseFalse, type CanUpdateSequencePropsResponseTrue, type SequenceNodePath, type SequencePropsSubscriptionKey, type VideoConfigValues } from './SequenceManager.js';
18
18
  import * as TimelinePosition from './timeline-position-state.js';
19
19
  import { type PlaybackRateContextValue, type SetTimelineContextValue, type TimelineContextValue } from './TimelineContext.js';
20
20
  import { truthy } from './truthy.js';
21
- import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses } from './use-schema.js';
21
+ import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, VideoConfigNumericExpression } from './use-schema.js';
22
22
  import { type CanUpdateSequencePropStatus, type DragOverrides, type EffectDragOverrides, type PropStatuses } from './use-schema.js';
23
23
  import type { MediaVolumeContextValue, SetMediaVolumeContextValue } from './volume-position-state.js';
24
24
  import type { WatchRemotionStaticFilesPayload } from './watch-static-file.js';
@@ -162,6 +162,7 @@ export declare const Internals: {
162
162
  readonly step: 0.01;
163
163
  readonly default: 1;
164
164
  readonly description: "Scale";
165
+ readonly defaultKeyframeOutput: "perceptual-scale";
165
166
  };
166
167
  readonly 'style.rotate': {
167
168
  readonly type: "rotation-css";
@@ -224,6 +225,7 @@ export declare const Internals: {
224
225
  readonly step: 0.01;
225
226
  readonly default: 1;
226
227
  readonly description: "Scale";
228
+ readonly defaultKeyframeOutput: "perceptual-scale";
227
229
  };
228
230
  readonly 'style.rotate': {
229
231
  readonly type: "rotation-css";
@@ -281,6 +283,7 @@ export declare const Internals: {
281
283
  readonly step: 0.01;
282
284
  readonly default: 1;
283
285
  readonly description: "Scale";
286
+ readonly defaultKeyframeOutput: "perceptual-scale";
284
287
  };
285
288
  readonly 'style.rotate': {
286
289
  readonly type: "rotation-css";
@@ -417,6 +420,7 @@ export declare const Internals: {
417
420
  readonly step: 0.01;
418
421
  readonly default: 1;
419
422
  readonly description: "Scale";
423
+ readonly defaultKeyframeOutput: "perceptual-scale";
420
424
  };
421
425
  readonly 'style.rotate': {
422
426
  readonly type: "rotation-css";
@@ -926,4 +930,4 @@ export declare const Internals: {
926
930
  readonly hiddenFromList: true;
927
931
  };
928
932
  };
929
- export type { ArrayFieldSchema, ArrayItemFieldSchema, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateEffectPropsResponseFalse, CanUpdateEffectPropsResponseTrue, CanUpdateSequencePropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, CompositionManagerContext, CompProps, DragOverrides, DragOverrideValue, EffectDragOverrides, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, JsxComponentIdentity, LoggingContextValue, MediaVolumeContextValue, NonceHistory, OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext, OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSetters, PlaybackRateContextValue, PropStatuses, RemotionAudioContextState, RemotionEnvironment, ResolvedStackLocation, ScheduleAudioNodeOptions, ScheduleAudioNodeResult, InteractivitySchemaField, SequenceNodePath, SequencePropsSubscriptionKey, InteractivitySchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, VisibleFieldSchema, WatchRemotionStaticFilesPayload, };
933
+ export type { ArrayFieldSchema, ArrayItemFieldSchema, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateEffectPropsResponseFalse, CanUpdateEffectPropsResponseTrue, CanUpdateSequencePropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, VideoConfigNumericExpression, CompositionManagerContext, CompProps, DragOverrides, DragOverrideValue, EffectDragOverrides, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, JsxComponentIdentity, LoggingContextValue, MediaVolumeContextValue, NonceHistory, OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext, OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSetters, PlaybackRateContextValue, PropStatuses, RemotionAudioContextState, RemotionEnvironment, ResolvedStackLocation, ScheduleAudioNodeOptions, ScheduleAudioNodeResult, InteractivitySchemaField, SequenceNodePath, SequencePropsSubscriptionKey, VideoConfigValues, InteractivitySchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, VisibleFieldSchema, WatchRemotionStaticFilesPayload, };
@@ -58,6 +58,7 @@ const interpolateKeyframedStatus = ({ frame, forceSpringAllowTail, status, }) =>
58
58
  easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
59
59
  extrapolateLeft: clamping.left,
60
60
  extrapolateRight: clamping.right,
61
+ output: status.output,
61
62
  posterize: status.posterize,
62
63
  });
63
64
  }
@@ -1,4 +1,5 @@
1
1
  export type ExtrapolateType = 'extend' | 'identity' | 'clamp' | 'wrap';
2
+ export type InterpolateOutputOption = 'linear' | 'perceptual-scale';
2
3
  /**
3
4
  * @description This function allows you to map a range of values to another with a concise syntax
4
5
  * @see [Documentation](https://www.remotion.dev/docs/interpolate)
@@ -10,6 +11,7 @@ export type InterpolateOptions = Partial<{
10
11
  easing: EasingFunction | readonly EasingFunction[];
11
12
  extrapolateLeft: ExtrapolateType;
12
13
  extrapolateRight: ExtrapolateType;
14
+ output: InterpolateOutputOption;
13
15
  posterize: number;
14
16
  }>;
15
17
  type NumericTuple = readonly [number, ...number[]];
@@ -269,8 +269,20 @@ const serializeStringInterpolationValue = ({ kind, values, units, dimensions, })
269
269
  .map((value, index) => `${stringifyNumber(value)}${units[index]}`)
270
270
  .join(' ');
271
271
  };
272
+ const toSignedArea = (scale) => {
273
+ if (scale === 0) {
274
+ return 0;
275
+ }
276
+ return Math.sign(scale) * scale * scale;
277
+ };
278
+ const fromSignedArea = (area) => {
279
+ if (area === 0) {
280
+ return 0;
281
+ }
282
+ return Math.sign(area) * Math.sqrt(Math.abs(area));
283
+ };
272
284
  function interpolateFunction(input, inputRange, outputRange, options) {
273
- const { extrapolateLeft, extrapolateRight, easing } = options;
285
+ const { extrapolateLeft, extrapolateRight, easing, output } = options;
274
286
  let result = input;
275
287
  const [inputMin, inputMax] = inputRange;
276
288
  const [outputMin, outputMax] = outputRange;
@@ -312,7 +324,14 @@ function interpolateFunction(input, inputRange, outputRange, options) {
312
324
  // Easing
313
325
  result = easing(result);
314
326
  // Output Range
315
- result = result * (outputMax - outputMin) + outputMin;
327
+ if (output === 'perceptual-scale') {
328
+ const signedAreaMin = toSignedArea(outputMin);
329
+ const signedAreaMax = toSignedArea(outputMax);
330
+ result = fromSignedArea(result * (signedAreaMax - signedAreaMin) + signedAreaMin);
331
+ }
332
+ else {
333
+ result = result * (outputMax - outputMin) + outputMin;
334
+ }
316
335
  return result;
317
336
  }
318
337
  function findRange(input, inputRange) {
@@ -325,6 +344,9 @@ function findRange(input, inputRange) {
325
344
  return i - 1;
326
345
  }
327
346
  const defaultEasing = (num) => num;
347
+ const resolveOutputOption = (output) => {
348
+ return output !== null && output !== void 0 ? output : 'linear';
349
+ };
328
350
  const shouldExtendRightForEasing = (easing) => {
329
351
  return easing.remotionShouldExtendRight === true;
330
352
  };
@@ -338,7 +360,7 @@ const resolveEasingForSegment = ({ easing, segmentIndex, }) => {
338
360
  // `segmentIndex` is in [0, inputRange.length - 2]; array length was validated above.
339
361
  return easing[segmentIndex];
340
362
  };
341
- const interpolateSegment = ({ input, inputRange, outputRange, easing, extrapolateLeft, extrapolateRight, }) => {
363
+ const interpolateSegment = ({ input, inputRange, outputRange, easing, extrapolateLeft, extrapolateRight, output, }) => {
342
364
  return interpolateFunction(input, inputRange, outputRange, {
343
365
  easing,
344
366
  extrapolateLeft,
@@ -347,9 +369,11 @@ const interpolateSegment = ({ input, inputRange, outputRange, easing, extrapolat
347
369
  shouldExtendRightForEasing(easing)
348
370
  ? 'extend'
349
371
  : extrapolateRight,
372
+ output,
350
373
  });
351
374
  };
352
375
  const interpolateNumber = ({ input, inputRange, outputRange, options, }) => {
376
+ const output = resolveOutputOption(options === null || options === void 0 ? void 0 : options.output);
353
377
  if (inputRange.length === 1) {
354
378
  return outputRange[0];
355
379
  }
@@ -377,6 +401,7 @@ const interpolateNumber = ({ input, inputRange, outputRange, options, }) => {
377
401
  easing,
378
402
  extrapolateLeft,
379
403
  extrapolateRight,
404
+ output,
380
405
  });
381
406
  for (let segmentIndex = 0; segmentIndex < range; segmentIndex++) {
382
407
  const previousEasing = resolveEasingForSegment({
@@ -397,6 +422,7 @@ const interpolateNumber = ({ input, inputRange, outputRange, options, }) => {
397
422
  easing: previousEasing,
398
423
  extrapolateLeft,
399
424
  extrapolateRight: 'extend',
425
+ output,
400
426
  });
401
427
  result += continuedSegmentValue - outputRange[segmentIndex + 1];
402
428
  }
@@ -440,14 +466,18 @@ const interpolateString = ({ input, inputRange, outputRange, options, }) => {
440
466
  }
441
467
  }
442
468
  }
443
- return serializeStringInterpolationValue({
444
- kind,
445
- values: [0, 0, 0].map((_, axis) => interpolateNumber({
469
+ const values = [0, 0, 0];
470
+ for (let axis = 0; axis < dimensions; axis++) {
471
+ values[axis] = interpolateNumber({
446
472
  input,
447
473
  inputRange,
448
474
  outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
449
475
  options,
450
- })),
476
+ });
477
+ }
478
+ return serializeStringInterpolationValue({
479
+ kind,
480
+ values,
451
481
  units,
452
482
  dimensions,
453
483
  });
@@ -529,6 +559,14 @@ function assertValidInterpolatePosterizeOption(posterize) {
529
559
  throw new Error(`posterize must be a positive finite number, but got ${posterize}`);
530
560
  }
531
561
  }
562
+ function assertValidInterpolateOutputOption(output) {
563
+ if (output === undefined ||
564
+ output === 'linear' ||
565
+ output === 'perceptual-scale') {
566
+ return;
567
+ }
568
+ throw new Error(`output must be "linear" or "perceptual-scale", but got ${String(output)}`);
569
+ }
532
570
  function interpolate(input, inputRange, outputRange, options) {
533
571
  if (typeof input === 'undefined') {
534
572
  throw new Error('input can not be undefined');
@@ -550,6 +588,7 @@ function interpolate(input, inputRange, outputRange, options) {
550
588
  checkValidInputRange(inputRange);
551
589
  assertValidInterpolateEasingOption(options === null || options === void 0 ? void 0 : options.easing, inputRange.length);
552
590
  assertValidInterpolatePosterizeOption(options === null || options === void 0 ? void 0 : options.posterize);
591
+ assertValidInterpolateOutputOption(options === null || options === void 0 ? void 0 : options.output);
553
592
  if (typeof input !== 'number') {
554
593
  throw new TypeError('Cannot interpolate an input which is not a number');
555
594
  }
@@ -1,7 +1,7 @@
1
1
  export type { ArtifactAsset, AudioOrVideoAsset, InlineAudioAsset, TRenderAsset, } from './CompositionManager';
2
2
  export type { DownloadBehavior } from './download-behavior';
3
3
  export { assertValidInterpolateEasingOption, assertValidInterpolatePosterizeOption, interpolate, } from './interpolate';
4
- export type { EasingFunction, ExtrapolateType, InterpolateOptions, } from './interpolate';
4
+ export type { EasingFunction, ExtrapolateType, InterpolateOutputOption, InterpolateOptions, } from './interpolate';
5
5
  export { random } from './random.js';
6
6
  export type { RandomSeed } from './random.js';
7
7
  export type { VideoConfig } from './video-config';
@@ -115,6 +115,7 @@ export declare const NoReactInternals: {
115
115
  readonly step: 0.01;
116
116
  readonly default: 1;
117
117
  readonly description: "Scale";
118
+ readonly defaultKeyframeOutput: "perceptual-scale";
118
119
  };
119
120
  readonly 'style.rotate': {
120
121
  readonly type: "rotation-css";
@@ -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,
@@ -1,13 +1,30 @@
1
1
  import type { InteractivitySchema } from './interactivity-schema.js';
2
- import type { ExtrapolateType } from './interpolate.js';
2
+ import type { ExtrapolateType, InterpolateOutputOption } from './interpolate.js';
3
3
  import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey } from './SequenceManager.js';
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';
@@ -45,6 +62,7 @@ export type CanUpdateSequencePropStatusKeyframed = {
45
62
  easing: CanUpdateSequencePropStatusEasing[];
46
63
  clamping: CanUpdateSequencePropStatusClamping;
47
64
  posterize: number | undefined;
65
+ output: InterpolateOutputOption | undefined;
48
66
  };
49
67
  export type CanUpdateSequencePropStatusFalse = CanUpdateSequencePropStatusComputed;
50
68
  export type CanUpdateSequencePropStatus = CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed | CanUpdateSequencePropStatusFalse;
@@ -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.489";
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.489';
10
+ exports.VERSION = '4.0.491';