π₯ Make videos programmatically with React
`@remotion/studio`: Support `2 * fps` in Interactivity (#9139)
Jonny Burgerce90bc7bd515
diff --git a/packages/core/src/SequenceManager.tsx b/packages/core/src/SequenceManager.tsxindex fb6b968c33..b95b17c32c 100644--- a/packages/core/src/SequenceManager.tsx+++ b/packages/core/src/SequenceManager.tsx@@ -164,6 +164,14 @@ export type SequencePropsSubscriptionKey = {nodePath: SequenceNodePath;sequenceKeys: string[];effectKeys: string[][];+ videoConfigValues: VideoConfigValues | null;+};++export type VideoConfigValues = {+ durationInFrames: number;+ fps: number;+ height: number;+ width: number;};const effectDragOverridesKey = (diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.tsindex 8525a9f5a5..4755902d62 100644--- a/packages/core/src/internals.ts+++ b/packages/core/src/internals.ts@@ -167,6 +167,7 @@ import {type CanUpdateSequencePropsResponseTrue,type SequenceNodePath,type SequencePropsSubscriptionKey,+ type VideoConfigValues,} from './SequenceManager.js';import {setupEnvVariables} from './setup-env-variables.js';import * as TimelinePosition from './timeline-position-state.js';@@ -209,6 +210,7 @@ import type {GetEffectDragOverrides,GetEffectPropStatuses,GetPropStatuses,+ VideoConfigNumericExpression,} from './use-schema.js';import {computeEffectiveSchemaValuesDotNotation,@@ -435,6 +437,7 @@ export type {CanUpdateSequencePropStatusFalse,CanUpdateSequencePropStatusKeyframed,CanUpdateSequencePropStatusStatic,+ VideoConfigNumericExpression,CompositionManagerContext,CompProps,DragOverrides,@@ -463,6 +466,7 @@ export type {InteractivitySchemaField,SequenceNodePath,SequencePropsSubscriptionKey,+ VideoConfigValues,InteractivitySchema,SerializedJSONWithCustomFields,SetMediaVolumeContextValue,diff --git a/packages/core/src/test/sequence-register-once.test.tsx b/packages/core/src/test/sequence-register-once.test.tsxindex 52c41a338f..544e20b1b3 100644--- a/packages/core/src/test/sequence-register-once.test.tsx+++ b/packages/core/src/test/sequence-register-once.test.tsx@@ -377,6 +377,7 @@ test('Series.Sequence duration overrides cascade to later sequences', async () =nodePath: ['body', 0],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,};const subscriptionKey = Internals.makeSequencePropsSubscriptionKey(nodePath);const makeDurationOverride = (durationInFrames: number) => ({@@ -776,6 +777,7 @@ test('Imperative sequence refs update without rerendering ref-only consumers', anodePath: ['root'],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,};let renders = 0;let sequencesRef: React.ContextType<typeof SequenceManagerRefContext> | null =diff --git a/packages/core/src/use-schema.ts b/packages/core/src/use-schema.tsindex 74204c21d5..d51ba8e2bb 100644--- a/packages/core/src/use-schema.ts+++ b/packages/core/src/use-schema.ts@@ -17,13 +17,34 @@ import type {export type CanUpdateSequencePropStatusStatic = {status: 'static';codeValue: unknown;+ numericExpression?: VideoConfigNumericExpression;};export type CanUpdateSequencePropStatusKeyframe = {frame: number;value: unknown;+ frameExpression?: VideoConfigNumericExpression;};+export type VideoConfigNumericExpression =+ | {+ type: 'literal';+ value: number;+ }+ | {+ type: 'video-config-value';+ identifier: string;+ value: number;+ }+ | {+ type: 'video-config-multiplication';+ identifier: string;+ multiplier: number;+ multiplicand: number;+ factorPosition: 'left' | 'right';+ value: number;+ };+export type CanUpdateSequencePropStatusLinearEasing = {type: 'linear';};diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsxindex 6169bed821..23b8f71b79 100644--- a/packages/example/src/Root.tsx+++ b/packages/example/src/Root.tsx@@ -279,6 +279,7 @@ import {InteractiveHtmlElements,InteractiveSvgElements,} from './VisualModeTests/InteractiveComponents';+import {VideoConfigExpressions} from './VisualModeTests/VideoConfigExpressions';import {VoiceVisualization} from './voice-visualization';import {WhisperWeb} from './WhisperWeb';@@ -2738,6 +2739,14 @@ export const Index: React.FC = () => {fps={30}durationInFrames={90}/>+ <Composition+ id="video-config-expressions"+ component={VideoConfigExpressions}+ width={1200}+ height={800}+ fps={30}+ durationInFrames={300}+ /></Folder><ChangingTrimBeforeValue /><Compositiondiff --git a/packages/example/src/VisualModeTests/VideoConfigExpressions.tsx b/packages/example/src/VisualModeTests/VideoConfigExpressions.tsxnew file mode 100644index 0000000000..702be11685--- /dev/null+++ b/packages/example/src/VisualModeTests/VideoConfigExpressions.tsx@@ -0,0 +1,136 @@+import React from 'react';+import {+ AbsoluteFill,+ interpolate,+ Sequence,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';++const expressionStyle: React.CSSProperties = {+ fontFamily: 'monospace',+ fontSize: 20,+ lineHeight: 1.45,+ margin: 0,+ whiteSpace: 'pre-wrap',+};++const cardTitleStyle: React.CSSProperties = {+ fontFamily: 'sans-serif',+ fontSize: 28,+ fontWeight: 700,+ margin: '0 0 18px',+};++export const VideoConfigExpressions: React.FC = () => {+ const frame = useCurrentFrame();+ const {durationInFrames, fps, height, width} = useVideoConfig();++ return (+ <AbsoluteFill+ style={{+ backgroundColor: '#08111f',+ color: '#e8eef8',+ fontFamily: 'sans-serif',+ }}+ >+ <div+ style={{+ left: 0,+ padding: '52px 70px',+ position: 'absolute',+ top: 0,+ zIndex: 1,+ }}+ >+ <h1 style={{fontSize: 48, margin: 0}}>Video config expressions</h1>+ <p style={{color: '#9fb0c8', fontSize: 24, margin: '14px 0 0'}}>+ Select the named sequences and edit their values in Visual Mode.+ </p>+ </div>+ <Sequence+ name="Static multiplications β appears at frame 60"+ from={(2 * fps) as number}+ durationInFrames={fps * 2.5}+ premountFor={0.5 * fps}+ postmountFor={fps * 0.5}+ width={width * 0.42}+ height={0.36 * height}+ style={{+ backgroundColor: '#12335b',+ border: '2px solid #4ea1ff',+ borderRadius: 28,+ flexDirection: 'column',+ padding: 30,+ translate: '70px 205px',+ }}+ >+ <h2 style={cardTitleStyle}>Static props</h2>+ <pre style={{...expressionStyle, color: '#a9d2ff'}}>+ {'from={(2 * fps) as number}\n'}+ {'durationInFrames={fps * 2.5}\n'}+ {'width={width * 0.42}\n'}+ {'height={0.3 * height}'}+ </pre>+ </Sequence>+ <Sequence+ name="Keyframes β 3.33 * fps and fps * 6"+ durationInFrames={durationInFrames}+ width={width * 0.42}+ height={height * 0.36}+ style={{+ backgroundColor: '#3a1c62',+ border: '2px solid #b37aff',+ borderRadius: 28,+ flexDirection: 'column',+ opacity: interpolate(frame, [1, 139], [0.35, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ padding: 30,+ scale: interpolate(+ frame,+ [0, 170.9, durationInFrames],+ [0.86, 1.08, 0.92],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ ),+ translate: '625px 205px',+ }}+ >+ <h2 style={cardTitleStyle}>Expression keyframes</h2>+ <pre style={{...expressionStyle, color: '#d3b7ff'}}>+ {'scale: [0, 3.33 * fps, durationInFrames]\n'}+ {'opacity: [0, fps * 6]\n'}+ {'Expected middle scale keyframe: 99.9'}+ </pre>+ </Sequence>+ <Sequence+ name="Control β division stays computed"+ from={fps / 2}+ durationInFrames={durationInFrames * 0.8}+ width={width * 0.88}+ height={height * 0.18}+ style={{+ alignItems: 'center',+ backgroundColor: '#39222b',+ border: '2px solid #e47a9a',+ borderRadius: 28,+ flexDirection: 'row',+ justifyContent: 'space-between',+ padding: 28,+ translate: '70px 520px',+ }}+ >+ <h2 style={{...cardTitleStyle, margin: 0, width: 420}}>+ Unsupported-expression control+ </h2>+ <pre style={{...expressionStyle, color: '#ffadc5'}}>+ {'from={fps / 2} should remain computed'}+ </pre>+ </Sequence>+ </AbsoluteFill>+ );+};diff --git a/packages/studio-server/src/codemods/update-keyframes/update-keyframes.ts b/packages/studio-server/src/codemods/update-keyframes/update-keyframes.tsindex 3394162b23..4163f4b91e 100644--- a/packages/studio-server/src/codemods/update-keyframes/update-keyframes.ts+++ b/packages/studio-server/src/codemods/update-keyframes/update-keyframes.ts@@ -27,9 +27,19 @@ import type {InteractivitySchemaField,InterpolateOutputOption,SequenceNodePath,+ VideoConfigNumericExpression,+ VideoConfigValues,} from 'remotion';import {getAstNodePath} from '../../helpers/get-ast-node-path';import {parseKeyframeEasingExpression} from '../../helpers/parse-keyframe-easing-expression';+import {+ parseVideoConfigNumericExpression,+ updateVideoConfigNumericExpression,+} from '../../helpers/video-config-numeric-expression';+import {+ getVideoConfigIdentifierValues,+ type VideoConfigIdentifierValues,+} from '../../helpers/video-config-values';import {extractStaticValue,findJsxElementAtNodePath,@@ -194,6 +204,9 @@ type MissingPropInitialValue = {type InterpolateKeyframe = {frame: number;+ frameExpression: ExpressionKind;+ frameNumericExpression: VideoConfigNumericExpression;+ originalFrame: number;output: ExpressionKind;value: unknown;};@@ -219,31 +232,15 @@ const getSupportedCallArgument = (return arg as unknown as ExpressionKind | SpreadElementKind;};-const getNumericValue = (node: Expression): number | null => {- if (node.type === 'NumericLiteral') {- return node.value;- }-- if (- node.type === 'UnaryExpression' &&- (node.operator === '-' || node.operator === '+') &&- node.argument.type === 'NumericLiteral'- ) {- return node.operator === '-' ? -node.argument.value : node.argument.value;- }-- if (node.type === 'TSAsExpression') {- return getNumericValue(node.expression as Expression);- }-- return null;-};-const getInterpolationExpression = (node: Expression,+ videoConfigValues: VideoConfigIdentifierValues,): InterpolateExpression | null => {if (node.type === 'TSAsExpression') {- return getInterpolationExpression(node.expression as Expression);+ return getInterpolationExpression(+ node.expression as Expression,+ videoConfigValues,+ );}if (@@ -281,13 +278,19 @@ const getInterpolationExpression = (return null;}- const frame = getNumericValue(inputElement);- if (frame === null || !isStaticValue(outputElement)) {+ const frameExpression = parseVideoConfigNumericExpression({+ node: inputElement,+ videoConfigValues,+ });+ if (frameExpression === null || !isStaticValue(outputElement)) {return null;}keyframes.push({- frame,+ frame: frameExpression.value,+ frameExpression: inputElement as ExpressionKind,+ frameNumericExpression: frameExpression,+ originalFrame: frameExpression.value,output: outputElement as ExpressionKind,value: extractStaticValue(outputElement),});@@ -829,6 +832,7 @@ const updateKeyframeSettings = ({clamping,posterize,output,+ videoConfigValues,}: {expression: Expression;clamping:@@ -839,11 +843,12 @@ const updateKeyframeSettings = ({| undefined;posterize: number | undefined;output: InterpolateOutputOption | undefined;+ videoConfigValues: VideoConfigIdentifierValues;}): ExpressionKind => {validatePosterize(posterize);validateOutput(output);- const existing = getInterpolationExpression(expression);+ const existing = getInterpolationExpression(expression, videoConfigValues);if (!existing) {throw new Error('Cannot update keyframe settings on non-keyframed value');}@@ -914,12 +919,14 @@ const updateKeyframeEasing = ({expression,segmentIndex,easing,+ videoConfigValues,}: {expression: Expression;segmentIndex: number;easing: KeyframeEasing;+ videoConfigValues: VideoConfigIdentifierValues;}): {expression: ExpressionKind; needsEasingImport: boolean} => {- const existing = getInterpolationExpression(expression);+ const existing = getInterpolationExpression(expression, videoConfigValues);if (!existing) {throw new Error('Cannot update easing on non-keyframed value');}@@ -988,7 +995,14 @@ const createInterpolateExpression = ({return b.callExpression(callee, [input,b.arrayExpression(- sortedKeyframes.map((keyframe) => createFrameExpression(keyframe.frame)),+ sortedKeyframes.map((keyframe) =>+ keyframe.frame === keyframe.originalFrame+ ? keyframe.frameExpression+ : updateVideoConfigNumericExpression({+ expression: keyframe.frameNumericExpression,+ value: keyframe.frame,+ }),+ ),),b.arrayExpression(sortedKeyframes.map((keyframe) => keyframe.output)),...extraArgs,@@ -1013,18 +1027,20 @@ const addKeyframe = ({frame,value,schema,+ videoConfigValues,}: {expression: Expression;key: string;frame: number;value: unknown;schema: InteractivitySchema | null;+ videoConfigValues: VideoConfigIdentifierValues;}): {expression: ExpressionKind; introduced: IntroducedKeyframeIdentifiers} => {if (!isSchemaFieldKeyframable({schema, key})) {throw new Error(`Cannot add keyframe: "${key}" is not keyframable`);}- const existing = getInterpolationExpression(expression);+ const existing = getInterpolationExpression(expression, videoConfigValues);const newOutput = parseValueExpression(value);if (existing) {@@ -1040,12 +1056,22 @@ const addKeyframe = ({const existingIndex = existing.keyframes.findIndex((keyframe) => keyframe.frame === frame,);- const nextKeyframes =+ const nextKeyframes: InterpolateKeyframe[] =existingIndex === -1- ? [...existing.keyframes, {frame, output: newOutput, value}]+ ? [+ ...existing.keyframes,+ {+ frame,+ frameExpression: createFrameExpression(frame),+ frameNumericExpression: {type: 'literal', value: frame},+ originalFrame: frame,+ output: newOutput,+ value,+ },+ ]: existing.keyframes.map((keyframe, index) =>index === existingIndex- ? {frame, output: newOutput, value}+ ? {...keyframe, output: newOutput, value}: keyframe,);const normalizedEasing =@@ -1079,12 +1105,26 @@ const addKeyframe = ({};}- if (!isStaticValue(expression)) {+ const staticNumericExpression = parseVideoConfigNumericExpression({+ node: expression,+ videoConfigValues,+ });+ if (!isStaticValue(expression) && staticNumericExpression === null) {throw new Error('Cannot add keyframe to computed expression');}- const staticValue = extractStaticValue(expression);- const keyframes: InterpolateKeyframe[] = [{frame, output: newOutput, value}];+ const staticValue =+ staticNumericExpression?.value ?? extractStaticValue(expression);+ const keyframes: InterpolateKeyframe[] = [+ {+ frame,+ frameExpression: createFrameExpression(frame),+ frameNumericExpression: {type: 'literal', value: frame},+ originalFrame: frame,+ output: newOutput,+ value,+ },+ ];const callee = getInterpolationCalleeForValues({schema,@@ -1122,11 +1162,13 @@ const addKeyframe = ({const removeKeyframe = ({expression,frame,+ videoConfigValues,}: {expression: Expression;frame: number;+ videoConfigValues: VideoConfigIdentifierValues;}): {expression: ExpressionKind; introduced: IntroducedKeyframeIdentifiers} => {- const existing = getInterpolationExpression(expression);+ const existing = getInterpolationExpression(expression, videoConfigValues);if (!existing) {throw new Error('Cannot remove keyframe from non-interpolated expression');}@@ -1173,14 +1215,16 @@ const removeKeyframe = ({const moveKeyframes = ({expression,moves,+ videoConfigValues,}: {expression: Expression;moves: {fromFrame: number;toFrame: number;}[];+ videoConfigValues: VideoConfigIdentifierValues;}): ExpressionKind => {- const existing = getInterpolationExpression(expression);+ const existing = getInterpolationExpression(expression, videoConfigValues);if (!existing) {throw new Error('Cannot move keyframe in non-interpolated expression');}@@ -1260,11 +1304,13 @@ const applyKeyframeOperation = ({key,operation,schema,+ videoConfigValues,}: {expression: Expression;key: string;operation: KeyframeOperation;schema: InteractivitySchema | null;+ videoConfigValues: VideoConfigIdentifierValues;}): {expression: ExpressionKind; introduced: IntroducedKeyframeIdentifiers} => {if (operation.type === 'add') {return addKeyframe({@@ -1273,6 +1319,7 @@ const applyKeyframeOperation = ({frame: operation.frame,value: operation.value,schema,+ videoConfigValues,});}@@ -1283,6 +1330,7 @@ const applyKeyframeOperation = ({clamping: operation.clamping,posterize: operation.posterize,output: operation.output,+ videoConfigValues,}),introduced: noIntroducedIdentifiers,};@@ -1293,6 +1341,7 @@ const applyKeyframeOperation = ({expression,segmentIndex: operation.segmentIndex,easing: operation.easing,+ videoConfigValues,});return {expression: updated.expression,@@ -1305,12 +1354,20 @@ const applyKeyframeOperation = ({if (operation.type === 'move') {return {- expression: moveKeyframes({expression, moves: operation.moves}),+ expression: moveKeyframes({+ expression,+ moves: operation.moves,+ videoConfigValues,+ }),introduced: noIntroducedIdentifiers,};}- return removeKeyframe({expression, frame: operation.frame});+ return removeKeyframe({+ expression,+ frame: operation.frame,+ videoConfigValues,+ });};const getExpressionFromJsxAttribute = (@@ -1638,11 +1695,13 @@ export const updateSequenceKeyframesAst = ({nodePath,updates,schema,+ videoConfigValues,}: {input: string;nodePath: SequenceNodePath;updates: SequenceKeyframeUpdate[];schema?: InteractivitySchema;+ videoConfigValues: VideoConfigValues | null;}): {serialized: string;oldValueStrings: string[];@@ -1651,6 +1710,10 @@ export const updateSequenceKeyframesAst = ({updatedNodePath: SequenceNodePath;} => {const ast = parseAst(input);+ const videoConfigIdentifierValues = getVideoConfigIdentifierValues({+ ast,+ videoConfigValues,+ });const jsxPath = getAstNodePath(ast, nodePath);const node = findJsxElementAtNodePath(ast, nodePath);if (!node || !jsxPath) {@@ -1689,6 +1752,7 @@ export const updateSequenceKeyframesAst = ({key: update.key,operation: update.operation,schema: schema ?? null,+ videoConfigValues: videoConfigIdentifierValues,});newValueStrings.push(recast.print(nextExpression).code);prop.setExpression(nextExpression);@@ -1738,12 +1802,14 @@ export const updateSequenceKeyframes = async ({updates,schema,prettierConfigOverride,+ videoConfigValues,}: {input: string;nodePath: SequenceNodePath;updates: SequenceKeyframeUpdate[];schema?: InteractivitySchema;prettierConfigOverride?: Record<string, unknown> | null;+ videoConfigValues: VideoConfigValues | null;}): Promise<{output: string;formatted: boolean;@@ -1763,6 +1829,7 @@ export const updateSequenceKeyframes = async ({nodePath,updates,schema,+ videoConfigValues,});const {output, formatted} = await formatFileContent({input: serialized,@@ -1792,12 +1859,14 @@ export const updateEffectKeyframesAst = ({effectIndex,updates,schema,+ videoConfigValues,}: {input: string;sequenceNodePath: SequenceNodePath;effectIndex: number;updates: EffectKeyframeUpdate[];schema?: InteractivitySchema;+ videoConfigValues: VideoConfigValues | null;}): {serialized: string;oldValueStrings: string[];@@ -1807,6 +1876,10 @@ export const updateEffectKeyframesAst = ({updatedSequenceNodePath: SequenceNodePath;} => {const ast = parseAst(input);+ const videoConfigIdentifierValues = getVideoConfigIdentifierValues({+ ast,+ videoConfigValues,+ });const jsxPath = getAstNodePath(ast, sequenceNodePath);const jsx = findJsxElementAtNodePath(ast, sequenceNodePath);if (!jsx || !jsxPath) {@@ -1852,6 +1925,7 @@ export const updateEffectKeyframesAst = ({key: update.key,operation: update.operation,schema: schema ?? null,+ videoConfigValues: videoConfigIdentifierValues,});newValueStrings.push(recast.print(nextExpression).code);prop.setExpression(nextExpression);@@ -1903,6 +1977,7 @@ export const updateEffectKeyframes = async ({updates,schema,prettierConfigOverride,+ videoConfigValues,}: {input: string;sequenceNodePath: SequenceNodePath;@@ -1910,6 +1985,7 @@ export const updateEffectKeyframes = async ({updates: EffectKeyframeUpdate[];schema?: InteractivitySchema;prettierConfigOverride?: Record<string, unknown> | null;+ videoConfigValues: VideoConfigValues | null;}): Promise<{output: string;formatted: boolean;@@ -1932,6 +2008,7 @@ export const updateEffectKeyframes = async ({effectIndex,updates,schema,+ videoConfigValues,});const {output, formatted} = await formatFileContent({input: serialized,diff --git a/packages/studio-server/src/codemods/update-nested-prop.ts b/packages/studio-server/src/codemods/update-nested-prop.tsindex 6dcfdccc22..f85d4a61ee 100644--- a/packages/studio-server/src/codemods/update-nested-prop.ts+++ b/packages/studio-server/src/codemods/update-nested-prop.ts@@ -10,6 +10,7 @@ import type {ObjectExpression,ObjectProperty,StringLiteral,+ Expression,} from '@babel/types';import {stringifyDefaultProps} from '@remotion/studio-shared';import type {ExpressionKind} from 'ast-types/lib/gen/kinds';@@ -152,19 +153,24 @@ const setNestedProp = ({parentKey,childKey,value,+ createValueExpression,}: {attr: JSXAttribute | undefined;attributes: (JSXAttribute | JSXSpreadAttribute)[];parentKey: string;childKey: string;value: unknown;+ createValueExpression:+ | ((existing: Expression | null) => ExpressionKind)+ | null;}) => {- const parsedValue = parseValueExpression(value);-if (attr) {const objExpr = getObjectExpression(attr);if (objExpr) {const {prop} = findObjectProperty(objExpr, childKey);+ const parsedValue = createValueExpression+ ? createValueExpression((prop?.value as Expression | undefined) ?? null)+ : parseValueExpression(value);if (prop) {prop.value = parsedValue as ObjectExpression | ArrayExpression;} else {@@ -177,6 +183,9 @@ const setNestedProp = ({}}} else {+ const parsedValue = createValueExpression+ ? createValueExpression(null)+ : parseValueExpression(value);const objExpr = b.objectExpression([b.objectProperty(b.identifier(childKey), parsedValue),]);@@ -196,6 +205,7 @@ export const updateNestedProp = ({value,defaultValue,isDefault,+ createValueExpression,}: {node: JSXOpeningElement;parentKey: string;@@ -203,6 +213,9 @@ export const updateNestedProp = ({value: unknown;defaultValue: unknown | null;isDefault: boolean;+ createValueExpression:+ | ((existing: Expression | null) => ExpressionKind)+ | null;}): string => {if (!node.attributes) {node.attributes = [];@@ -216,7 +229,14 @@ export const updateNestedProp = ({if (isDefault) {removeNestedProp({attr, attrIndex, attributes, childKey});} else {- setNestedProp({attr, attributes, parentKey, childKey, value});+ setNestedProp({+ attr,+ attributes,+ parentKey,+ childKey,+ value,+ createValueExpression,+ });}return oldValueString;diff --git a/packages/studio-server/src/codemods/update-sequence-props/update-sequence-props.ts b/packages/studio-server/src/codemods/update-sequence-props/update-sequence-props.tsindex 9b18ab722b..b6d9390668 100644--- a/packages/studio-server/src/codemods/update-sequence-props/update-sequence-props.ts+++ b/packages/studio-server/src/codemods/update-sequence-props/update-sequence-props.ts@@ -10,9 +10,22 @@ import type {Statement,} from '@babel/types';import type {GoogleFontSourceEdit} from '@remotion/studio-shared';+import type {ExpressionKind} from 'ast-types/lib/gen/kinds';import * as recast from 'recast';-import type {InteractivitySchema, SequenceNodePath} from 'remotion';+import type {+ InteractivitySchema,+ SequenceNodePath,+ VideoConfigValues,+} from 'remotion';import {NoReactInternals} from 'remotion/no-react';+import {+ parseVideoConfigNumericExpression,+ updateVideoConfigNumericExpression,+} from '../../helpers/video-config-numeric-expression';+import {+ getVideoConfigIdentifierValues,+ type VideoConfigIdentifierValues,+} from '../../helpers/video-config-values';import {findJsxElementNodeAtNodePath,getStaticJsxChildrenAttribute,@@ -41,6 +54,7 @@ export type SequencePropsNodeUpdate = {nodePath: SequenceNodePath;updates: SequencePropUpdate[];schema: InteractivitySchema;+ videoConfigValues: VideoConfigValues | null;};export type SequencePropsNodeUpdateResult = {@@ -94,6 +108,7 @@ const removeVariantKey = ({value: undefined,defaultValue: null,isDefault: true,+ createValueExpression: null,});};@@ -737,10 +752,12 @@ const updateSequencePropsNode = ({jsxElement,updates,schema,+ videoConfigValues,}: {jsxElement: JSXElementLike;updates: SequencePropUpdate[];schema: InteractivitySchema;+ videoConfigValues: VideoConfigIdentifierValues;}): {oldValueStrings: string[];logLine: number;@@ -757,6 +774,29 @@ const updateSequencePropsNode = ({return dot === -1 ? key : key.slice(0, dot);}),);+ const createValueExpression = ({+ existing,+ value,+ }: {+ existing: Expression | null;+ value: unknown;+ }) => {+ if (existing === null || typeof value !== 'number') {+ return parseValueExpression(value);+ }++ const expression = parseVideoConfigNumericExpression({+ node: existing,+ videoConfigValues,+ });+ if (expression === null) {+ return parseValueExpression(value);+ }++ return expression.value === value+ ? (existing as ExpressionKind)+ : updateVideoConfigNumericExpression({expression, value});+ };for (const {key, value, defaultValue} of updates) {let oldValueString = '';@@ -785,6 +825,8 @@ const updateSequencePropsNode = ({value,defaultValue,isDefault,+ createValueExpression: (existing) =>+ createValueExpression({existing, value}),});} else {const attrIndex = node.attributes?.findIndex((a) => {@@ -823,7 +865,16 @@ const updateSequencePropsNode = ({node.attributes.splice(attrIndex!, 1);}} else {- const parsed = parseValueExpression(value);+ const existingExpression =+ attr?.type === 'JSXAttribute' &&+ attr.value?.type === 'JSXExpressionContainer' &&+ attr.value.expression.type !== 'JSXEmptyExpression'+ ? (attr.value.expression as Expression)+ : null;+ const parsed = createValueExpression({+ existing: existingExpression,+ value,+ });const newValue =value === true ? null : b.jsxExpressionContainer(parsed);@@ -893,11 +944,13 @@ export const updateSequencePropsAst = ({nodePath,updates,schema,+ videoConfigValues,}: {input: string;nodePath: SequenceNodePath;updates: SequencePropUpdate[];schema: InteractivitySchema;+ videoConfigValues: VideoConfigValues | null;}): {serialized: string;oldValueStrings: string[];@@ -905,6 +958,10 @@ export const updateSequencePropsAst = ({removedProps: RemovedProp[];} => {const ast = parseAst(input);+ const videoConfigIdentifierValues = getVideoConfigIdentifierValues({+ ast,+ videoConfigValues,+ });const jsxElement = findJsxElementNodeAtNodePath(ast, nodePath);if (!jsxElement) {@@ -917,6 +974,7 @@ export const updateSequencePropsAst = ({jsxElement,updates,schema,+ videoConfigValues: videoConfigIdentifierValues,});applyGoogleFontSourceEdits({ast, updates});@@ -939,17 +997,27 @@ export const updateMultipleSequenceProps = async ({}): Promise<UpdateMultipleSequencePropsResult> => {const ast = parseAst(input);const allUpdates: SequencePropUpdate[] = [];- const results = changes.map(({nodePath, updates, schema}) => {- const jsxElement = findJsxElementNodeAtNodePath(ast, nodePath);- if (!jsxElement) {- throw new Error(- 'Could not find a JSX element at the specified line to update',- );- }+ const results = changes.map(+ ({nodePath, updates, schema, videoConfigValues}) => {+ const jsxElement = findJsxElementNodeAtNodePath(ast, nodePath);+ if (!jsxElement) {+ throw new Error(+ 'Could not find a JSX element at the specified line to update',+ );+ }- allUpdates.push(...updates);- return updateSequencePropsNode({jsxElement, updates, schema});- });+ allUpdates.push(...updates);+ return updateSequencePropsNode({+ jsxElement,+ updates,+ schema,+ videoConfigValues: getVideoConfigIdentifierValues({+ ast,+ videoConfigValues,+ }),+ });+ },+ );applyGoogleFontSourceEdits({ast, updates: allUpdates});const {output, formatted} = await formatFileContent({@@ -970,12 +1038,14 @@ export const updateSequenceProps = async ({updates,schema,prettierConfigOverride,+ videoConfigValues,}: {input: string;nodePath: SequenceNodePath;updates: SequencePropUpdate[];schema: InteractivitySchema;prettierConfigOverride: PrettierConfigOverride;+ videoConfigValues: VideoConfigValues | null;}): Promise<UpdateSequencePropsResult> => {const {serialized, oldValueStrings, logLine, removedProps} =updateSequencePropsAst({@@ -983,6 +1053,7 @@ export const updateSequenceProps = async ({nodePath,updates,schema,+ videoConfigValues,});const {output, formatted} = await formatFileContent({diff --git a/packages/studio-server/src/helpers/video-config-numeric-expression.ts b/packages/studio-server/src/helpers/video-config-numeric-expression.tsnew file mode 100644index 0000000000..e12eb255ad--- /dev/null+++ b/packages/studio-server/src/helpers/video-config-numeric-expression.ts@@ -0,0 +1,165 @@+import type {Expression} from '@babel/types';+import type {ExpressionKind} from 'ast-types/lib/gen/kinds';+import * as recast from 'recast';+import type {VideoConfigNumericExpression} from 'remotion';+import type {VideoConfigIdentifierValues} from './video-config-values';++const b = recast.types.builders;++const getNumericLiteral = (node: Expression): number | null => {+ if (node.type === 'NumericLiteral') {+ return Number.isFinite(node.value) ? node.value : null;+ }++ if (+ node.type === 'UnaryExpression' &&+ (node.operator === '-' || node.operator === '+') &&+ node.argument.type === 'NumericLiteral'+ ) {+ const value =+ node.operator === '-' ? -node.argument.value : node.argument.value;+ return Number.isFinite(value) ? value : null;+ }++ if (node.type === 'TSAsExpression') {+ return getNumericLiteral(node.expression as Expression);+ }++ return null;+};++const getVideoConfigValue = ({+ node,+ videoConfigValues,+}: {+ node: Expression;+ videoConfigValues: VideoConfigIdentifierValues;+}): {identifier: string; value: number} | null => {+ if (node.type === 'TSAsExpression') {+ return getVideoConfigValue({+ node: node.expression as Expression,+ videoConfigValues,+ });+ }++ if (node.type !== 'Identifier') {+ return null;+ }++ const value = videoConfigValues[node.name];+ if (value === undefined || !Number.isFinite(value)) {+ return null;+ }++ return {identifier: node.name, value};+};++export const parseVideoConfigNumericExpression = ({+ node,+ videoConfigValues,+}: {+ node: Expression;+ videoConfigValues: VideoConfigIdentifierValues;+}): VideoConfigNumericExpression | null => {+ if (node.type === 'TSAsExpression') {+ return parseVideoConfigNumericExpression({+ node: node.expression as Expression,+ videoConfigValues,+ });+ }++ const literal = getNumericLiteral(node);+ if (literal !== null) {+ return {type: 'literal', value: literal};+ }++ const videoConfigValue = getVideoConfigValue({node, videoConfigValues});+ if (videoConfigValue !== null) {+ return {type: 'video-config-value', ...videoConfigValue};+ }++ if (node.type !== 'BinaryExpression' || node.operator !== '*') {+ return null;+ }++ const left = node.left as Expression;+ const right = node.right as Expression;+ const leftNumber = getNumericLiteral(left);+ const rightNumber = getNumericLiteral(right);+ const leftVideoConfig = getVideoConfigValue({+ node: left,+ videoConfigValues,+ });+ const rightVideoConfig = getVideoConfigValue({+ node: right,+ videoConfigValues,+ });++ const factorPosition =+ leftNumber !== null && rightVideoConfig !== null+ ? 'left'+ : rightNumber !== null && leftVideoConfig !== null+ ? 'right'+ : null;+ if (factorPosition === null) {+ return null;+ }++ const multiplier = factorPosition === 'left' ? leftNumber! : rightNumber!;+ const configValue =+ factorPosition === 'left' ? rightVideoConfig! : leftVideoConfig!;+ const value = multiplier * configValue.value;+ if (!Number.isFinite(value)) {+ return null;+ }++ return {+ type: 'video-config-multiplication',+ identifier: configValue.identifier,+ multiplier,+ multiplicand: configValue.value,+ factorPosition,+ value,+ };+};++const numericExpression = (value: number): ExpressionKind => {+ if (value < 0) {+ return b.unaryExpression('-', b.numericLiteral(-value), true);+ }++ return b.numericLiteral(value);+};++export const updateVideoConfigNumericExpression = ({+ expression,+ value,+}: {+ expression: VideoConfigNumericExpression;+ value: number;+}): ExpressionKind => {+ if (!Number.isFinite(value)) {+ return numericExpression(value);+ }++ if (expression.type === 'video-config-value') {+ return value === expression.value+ ? b.identifier(expression.identifier)+ : numericExpression(value);+ }++ if (expression.type !== 'video-config-multiplication' || value === 0) {+ return numericExpression(value);+ }++ const multiplier = value / expression.multiplicand;+ if (!Number.isFinite(multiplier) || multiplier === 0) {+ return numericExpression(value);+ }++ const factor = numericExpression(multiplier);+ const identifier = b.identifier(expression.identifier);+ return expression.factorPosition === 'left'+ ? b.binaryExpression('*', factor, identifier)+ : b.binaryExpression('*', identifier, factor);+};diff --git a/packages/studio-server/src/helpers/video-config-values.ts b/packages/studio-server/src/helpers/video-config-values.tsnew file mode 100644index 0000000000..b956051351--- /dev/null+++ b/packages/studio-server/src/helpers/video-config-values.ts@@ -0,0 +1,69 @@+import type {File} from '@babel/types';+import * as recast from 'recast';+import type {VideoConfigValues} from 'remotion';++export type VideoConfigIdentifierValues = Record<string, number>;++export const getVideoConfigIdentifierValues = ({+ ast,+ videoConfigValues,+}: {+ ast: File;+ videoConfigValues: VideoConfigValues | null;+}): VideoConfigIdentifierValues => {+ if (videoConfigValues === null) {+ return {};+ }++ const candidates = new Map<string, number>();+ const otherDeclarations = new Set<string>();++ recast.types.visit(ast, {+ visitVariableDeclarator(path) {+ const {id, init} = path.node;+ const isVideoConfigDeclaration =+ id.type === 'ObjectPattern' &&+ init?.type === 'CallExpression' &&+ init.callee.type === 'Identifier' &&+ init.callee.name === 'useVideoConfig' &&+ init.arguments.length === 0;++ if (isVideoConfigDeclaration) {+ for (const property of id.properties) {+ if (+ property.type !== 'ObjectProperty' ||+ property.computed ||+ property.value.type !== 'Identifier'+ ) {+ continue;+ }++ const configKey =+ property.key.type === 'Identifier'+ ? property.key.name+ : property.key.type === 'StringLiteral'+ ? property.key.value+ : null;+ if (configKey === null || !(configKey in videoConfigValues)) {+ continue;+ }++ const value = videoConfigValues[configKey as keyof VideoConfigValues];+ if (Number.isFinite(value)) {+ candidates.set(property.value.name, value);+ }+ }+ } else if (id.type === 'Identifier') {+ otherDeclarations.add(id.name);+ }++ this.traverse(path);+ },+ });++ for (const identifier of otherDeclarations) {+ candidates.delete(identifier);+ }++ return Object.fromEntries(candidates);+};diff --git a/packages/studio-server/src/preview-server/routes/add-effect-keyframe.ts b/packages/studio-server/src/preview-server/routes/add-effect-keyframe.tsindex 99e64eb202..a97804b889 100644--- a/packages/studio-server/src/preview-server/routes/add-effect-keyframe.ts+++ b/packages/studio-server/src/preview-server/routes/add-effect-keyframe.ts@@ -9,6 +9,7 @@ import {parseAst} from '../../codemods/parse-ast';import {updateEffectKeyframes} from '../../codemods/update-keyframes/update-keyframes';import {writeFileAndNotifyFileWatchers} from '../../file-watcher';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {getVideoConfigIdentifierValues} from '../../helpers/video-config-values';import type {ApiHandler} from '../api-types';import {printUndoHint,@@ -65,6 +66,7 @@ export const addEffectKeyframeHandler: ApiHandler<sequenceNodePath: sequenceNodePath.nodePath,effectIndex,schema,+ videoConfigValues: sequenceNodePath.videoConfigValues,updates: [{key,@@ -132,5 +134,9 @@ export const addEffectKeyframeHandler: ApiHandler<jsx,effectIndex,keys: getAllSchemaKeys(schema),+ videoConfigValues: getVideoConfigIdentifierValues({+ ast,+ videoConfigValues: sequenceNodePath.videoConfigValues,+ }),});});diff --git a/packages/studio-server/src/preview-server/routes/add-keyframes.ts b/packages/studio-server/src/preview-server/routes/add-keyframes.tsindex 71796513d8..7dd562c16f 100644--- a/packages/studio-server/src/preview-server/routes/add-keyframes.ts+++ b/packages/studio-server/src/preview-server/routes/add-keyframes.ts@@ -178,6 +178,7 @@ export const addKeyframes = async ({input: output,nodePath: firstSequenceKeyframe.nodePath.nodePath,schema: firstSequenceKeyframe.schema,+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,updates: keyframeGroup.map((keyframe) => ({key: keyframe.key,operation: {@@ -219,6 +220,8 @@ export const addKeyframes = async ({sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,effectIndex: firstEffectKeyframe.effectIndex,schema: firstEffectKeyframe.schema,+ videoConfigValues:+ firstEffectKeyframe.sequenceNodePath.videoConfigValues,updates: keyframeGroup.map((keyframe) => ({key: keyframe.key,operation: {diff --git a/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.ts b/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.tsindex cfad7a4927..422efc42c4 100644--- a/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.ts+++ b/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.ts@@ -52,6 +52,7 @@ export const addSequenceKeyframeHandler: ApiHandler<input: fileContents,nodePath: nodePath.nodePath,schema,+ videoConfigValues: nodePath.videoConfigValues,updates: [{key,@@ -109,6 +110,7 @@ export const addSequenceKeyframeHandler: ApiHandler<nodePath: updatedNodePath,componentIdentity: null,effects: [],+ videoConfigValues: nodePath.videoConfigValues,});const updatedSubscriptionKey = {...nodePath, nodePath: updatedNodePath};diff --git a/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts b/packages/studio-server/src/preview-server/routes/can-update-effect-props.tsindex c91146b167..2903bbf580 100644--- a/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts+++ b/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts@@ -13,6 +13,7 @@ import type {CanUpdateSequencePropStatus,SequenceNodePath,InteractivitySchema,+ VideoConfigValues,} from 'remotion';import {parseAst} from '../../codemods/parse-ast';import {@@ -20,6 +21,11 @@ import {type EffectArrayElement,} from '../../codemods/update-effect-props/update-effect-props';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {parseVideoConfigNumericExpression} from '../../helpers/video-config-numeric-expression';+import {+ getVideoConfigIdentifierValues,+ type VideoConfigIdentifierValues,+} from '../../helpers/video-config-values';import {extractStaticValue,findJsxElementAtNodePath,@@ -148,10 +154,12 @@ const getPropsFromObjectExpression = ({ast,objExpr,keys,+ videoConfigValues,}: {ast: File;objExpr: ObjectExpression;keys: string[];+ videoConfigValues: VideoConfigIdentifierValues;}): Record<string, CanUpdateSequencePropStatus> => {const out: Record<string, CanUpdateSequencePropStatus> = {};@@ -171,7 +179,19 @@ const getPropsFromObjectExpression = ({const valueExpr = prop.value as Expression;if (!isStaticValue(valueExpr)) {- out[key] = getComputedStatus(valueExpr, ast);+ const numericExpression = parseVideoConfigNumericExpression({+ node: valueExpr,+ videoConfigValues,+ });+ out[key] = numericExpression+ ? {+ status: 'static',+ codeValue: numericExpression.value,+ ...(numericExpression.type === 'literal'+ ? {}+ : {numericExpression}),+ }+ : getComputedStatus(valueExpr, ast, videoConfigValues);continue;}@@ -189,11 +209,13 @@ export const computeEffectPropStatus = ({jsx,effectIndex,keys,+ videoConfigValues,}: {ast: File;jsx: JSXOpeningElement;effectIndex: number;keys: string[];+ videoConfigValues: VideoConfigIdentifierValues;}): CanUpdateEffectPropsResponse => {const attr = findEffectsAttr(jsx);const elements = getEffectsArrayElements(attr);@@ -257,6 +279,7 @@ export const computeEffectPropStatus = ({ast,objExpr: firstArg as ObjectExpression,keys,+ videoConfigValues,});return {@@ -273,13 +296,19 @@ export const computeEffectPropsStatusesFromContent = ({sequenceNodePath,effects,keysFor,+ videoConfigValues,}: {fileContents: string;sequenceNodePath: SequenceNodePath;effects: InteractivitySchema[];keysFor: (effect: InteractivitySchema) => string[];+ videoConfigValues: VideoConfigValues | null;}): CanUpdateEffectPropsResponse[] => {const ast = parseAst(fileContents);+ const videoConfigIdentifierValues = getVideoConfigIdentifierValues({+ ast,+ videoConfigValues,+ });const jsx = findJsxElementAtNodePath(ast, sequenceNodePath);if (!jsx) {return effects.map((_effect, effectIndex) => ({@@ -295,6 +324,7 @@ export const computeEffectPropsStatusesFromContent = ({jsx,effectIndex,keys: keysFor(effect),+ videoConfigValues: videoConfigIdentifierValues,}),);};@@ -305,12 +335,14 @@ export const computeEffectPropsStatusesFromFile = ({effects,keysFor,remotionRoot,+ videoConfigValues,}: {fileName: string;sequenceNodePath: SequenceNodePath;effects: InteractivitySchema[];keysFor: (effect: InteractivitySchema) => string[];remotionRoot: string;+ videoConfigValues: VideoConfigValues | null;}): CanUpdateEffectPropsResponse[] => {const {absolutePath} = resolveFileInsideProject({remotionRoot,@@ -324,5 +356,6 @@ export const computeEffectPropsStatusesFromFile = ({sequenceNodePath,effects,keysFor,+ videoConfigValues,});};diff --git a/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts b/packages/studio-server/src/preview-server/routes/can-update-sequence-props.tsindex 99f159a58b..7be2c800e4 100644--- a/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts@@ -27,6 +27,8 @@ import type {JsxComponentIdentity,LogLevel,SequenceNodePath,+ VideoConfigNumericExpression,+ VideoConfigValues,} from 'remotion';import {NoReactInternals} from 'remotion/no-react';import {parseAst} from '../../codemods/parse-ast';@@ -34,6 +36,11 @@ import {getAstNodePath} from '../../helpers/get-ast-node-path';import {toImportAgnosticNodePath} from '../../helpers/import-agnostic-node-path';import {parseKeyframeEasingExpression} from '../../helpers/parse-keyframe-easing-expression';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {parseVideoConfigNumericExpression} from '../../helpers/video-config-numeric-expression';+import {+ getVideoConfigIdentifierValues,+ type VideoConfigIdentifierValues,+} from '../../helpers/video-config-values';import {getJsxComponentIdentity,jsxComponentIdentitiesMatch,@@ -51,9 +58,15 @@ type PropPosterize = KeyframedPropStatus['posterize'];type PropOutput = KeyframedPropStatus['output'];type PropInterpolationFunction = KeyframedPropStatus['interpolationFunction'];-const staticStatus = (codeValue: unknown): CanUpdatePropStatus => ({+const staticStatus = (+ codeValue: unknown,+ numericExpression: VideoConfigNumericExpression | null,+): CanUpdatePropStatus => ({status: 'static',codeValue,+ ...(numericExpression === null || numericExpression.type === 'literal'+ ? {}+ : {numericExpression}),});const computedStatus = (): CanUpdatePropStatus => ({@@ -470,6 +483,7 @@ const getInterpolationMetadata = (const getInterpolationKeyframes = (node: Expression,ast: File,+ videoConfigValues: VideoConfigIdentifierValues,):| {keyframes: PropKeyframes;@@ -481,7 +495,11 @@ const getInterpolationKeyframes = (}| undefined => {if (node.type === 'TSAsExpression') {- return getInterpolationKeyframes(node.expression as Expression, ast);+ return getInterpolationKeyframes(+ node.expression as Expression,+ ast,+ videoConfigValues,+ );}if (@@ -496,6 +514,7 @@ const getInterpolationKeyframes = (const interpolation = getInterpolationKeyframes(node.arguments[0] as Expression,ast,+ videoConfigValues,);if (!interpolation) {return undefined;@@ -556,14 +575,18 @@ const getInterpolationKeyframes = (return undefined;}- const frame = getNumericValue(inputElement);- if (frame === null || !isStaticValue(outputElement)) {+ const frameExpression = parseVideoConfigNumericExpression({+ node: inputElement,+ videoConfigValues,+ });+ if (frameExpression === null || !isStaticValue(outputElement)) {return undefined;}keyframes.push({- frame,+ frame: frameExpression.value,value: extractStaticValue(outputElement),+ ...(frameExpression.type === 'literal' ? {} : {frameExpression}),});}@@ -634,8 +657,9 @@ const isCurrentFrameIdentifier = (node: Expression, ast: File): boolean => {export const getComputedStatus = (node: Expression,ast: File,+ videoConfigValues: VideoConfigIdentifierValues,): CanUpdatePropStatus => {- const interpolation = getInterpolationKeyframes(node, ast);+ const interpolation = getInterpolationKeyframes(node, ast, videoConfigValues);if (!interpolation) {return computedStatus();}@@ -654,6 +678,7 @@ export const getComputedStatus = (const getPropsStatus = (jsxElement: JSXOpeningElement,ast: File,+ videoConfigValues: VideoConfigIdentifierValues,): Record<string, CanUpdatePropStatus> => {const props: Record<string, CanUpdatePropStatus> = {};@@ -674,12 +699,12 @@ const getPropsStatus = (const {value} = attr as JSXAttribute;if (!value) {- props[name] = staticStatus(true);+ props[name] = staticStatus(true, null);continue;}if (value.type === 'StringLiteral') {- props[name] = staticStatus((value as {value: string}).value);+ props[name] = staticStatus((value as {value: string}).value, null);continue;}@@ -691,11 +716,17 @@ const getPropsStatus = (}if (!isStaticValue(expression)) {- props[name] = getComputedStatus(expression, ast);+ const numericExpression = parseVideoConfigNumericExpression({+ node: expression,+ videoConfigValues,+ });+ props[name] = numericExpression+ ? staticStatus(numericExpression.value, numericExpression)+ : getComputedStatus(expression, ast, videoConfigValues);continue;}- props[name] = staticStatus(extractStaticValue(expression));+ props[name] = staticStatus(extractStaticValue(expression), null);continue;}@@ -908,12 +939,19 @@ const validateStyleValue = (childKey: string, value: unknown): boolean => {return true;};-const getNestedPropStatus = (- jsxElement: JSXOpeningElement,- ast: File,- parentKey: string,- childKey: string,-): CanUpdatePropStatus => {+const getNestedPropStatus = ({+ jsxElement,+ ast,+ parentKey,+ childKey,+ videoConfigValues,+}: {+ jsxElement: JSXOpeningElement;+ ast: File;+ parentKey: string;+ childKey: string;+ videoConfigValues: VideoConfigIdentifierValues;+}): CanUpdatePropStatus => {const attr = jsxElement.attributes.find((a) =>a.type !== 'JSXSpreadAttribute' &&@@ -923,7 +961,7 @@ const getNestedPropStatus = (if (!attr || !attr.value) {// Parent attribute doesn't exist, nested prop can be added- return staticStatus(undefined);+ return staticStatus(undefined, null);}if (attr.value.type !== 'JSXExpressionContainer') {@@ -949,12 +987,18 @@ const getNestedPropStatus = (if (!prop) {// Property not set in the object, can be added- return staticStatus(undefined);+ return staticStatus(undefined, null);}const propValue = prop.value as Expression;if (!isStaticValue(propValue)) {- return getComputedStatus(propValue, ast);+ const numericExpression = parseVideoConfigNumericExpression({+ node: propValue,+ videoConfigValues,+ });+ return numericExpression+ ? staticStatus(numericExpression.value, numericExpression)+ : getComputedStatus(propValue, ast, videoConfigValues);}const propStatus = extractStaticValue(propValue);@@ -962,17 +1006,19 @@ const getNestedPropStatus = (return computedStatus();}- return staticStatus(propStatus);+ return staticStatus(propStatus, null);};const computeEffectsForJsx = ({ast,jsxElement,effects,+ videoConfigValues,}: {ast: File;jsxElement: JSXOpeningElement;effects: string[][];+ videoConfigValues: VideoConfigIdentifierValues;}) => {return effects.map((effect, effectIndex) =>computeEffectPropStatus({@@ -980,6 +1026,7 @@ const computeEffectsForJsx = ({jsx: jsxElement,effectIndex,keys: effect,+ videoConfigValues,}),);};@@ -989,19 +1036,21 @@ const computeSequenceOnlyPropsRecord = ({jsxElementNode,ast,keys,+ videoConfigValues,}: {jsxElement: JSXOpeningElement;jsxElementNode: JSXElement;ast: File;keys: string[];+ videoConfigValues: VideoConfigIdentifierValues;}): Record<string, CanUpdatePropStatus> => {- const allProps = getPropsStatus(jsxElement, ast);+ const allProps = getPropsStatus(jsxElement, ast, videoConfigValues);const filteredProps: Record<string, CanUpdatePropStatus> = {};for (const key of keys) {if (key === 'children') {const staticChildrenAttribute = getStaticJsxChildrenAttribute(jsxElement);if (staticChildrenAttribute) {- filteredProps[key] = staticStatus(staticChildrenAttribute.value);+ filteredProps[key] = staticStatus(staticChildrenAttribute.value, null);continue;}@@ -1012,23 +1061,24 @@ const computeSequenceOnlyPropsRecord = ({const staticTextContent = getStaticJsxTextContent(jsxElementNode);filteredProps[key] = staticTextContent- ? staticStatus(staticTextContent.value)+ ? staticStatus(staticTextContent.value, null): computedStatus();continue;}const dotIndex = key.indexOf('.');if (dotIndex !== -1) {- filteredProps[key] = getNestedPropStatus(+ filteredProps[key] = getNestedPropStatus({jsxElement,ast,- key.slice(0, dotIndex),- key.slice(dotIndex + 1),- );+ parentKey: key.slice(0, dotIndex),+ childKey: key.slice(dotIndex + 1),+ videoConfigValues,+ });} else if (key in allProps) {filteredProps[key] = allProps[key];} else {- filteredProps[key] = staticStatus(undefined);+ filteredProps[key] = staticStatus(undefined, null);}}@@ -1041,14 +1091,20 @@ export const computeSequencePropsStatusFromContent = ({componentIdentity,keys,effects,+ videoConfigValues,}: {fileContents: string;nodePath: SequenceNodePath;componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];+ videoConfigValues: VideoConfigValues | null;}): CanUpdateSequencePropsResponseTrue => {const ast = parseAst(fileContents);+ const videoConfigIdentifierValues = getVideoConfigIdentifierValues({+ ast,+ videoConfigValues,+ });const jsxElementNode = findJsxElementNodeAtNodePath(ast, nodePath);const jsxElement = jsxElementNode?.openingElement ?? null;@@ -1071,8 +1127,14 @@ export const computeSequencePropsStatusFromContent = ({jsxElementNode,ast,keys,+ videoConfigValues: videoConfigIdentifierValues,+ });+ const effectsStatuses = computeEffectsForJsx({+ ast,+ jsxElement,+ effects,+ videoConfigValues: videoConfigIdentifierValues,});- const effectsStatuses = computeEffectsForJsx({ast, jsxElement, effects});return {canUpdate: true as const,@@ -1088,6 +1150,7 @@ export const computeSequencePropsStatus = ({keys,effects,remotionRoot,+ videoConfigValues,}: {fileName: string;nodePath: SequenceNodePath;@@ -1095,6 +1158,7 @@ export const computeSequencePropsStatus = ({keys: string[];effects: string[][];remotionRoot: string;+ videoConfigValues: VideoConfigValues | null;}): CanUpdateSequencePropsResponseTrue => {const {absolutePath} = resolveFileInsideProject({remotionRoot,@@ -1109,6 +1173,7 @@ export const computeSequencePropsStatus = ({componentIdentity,keys,effects,+ videoConfigValues,});};@@ -1120,6 +1185,7 @@ export const computeSequencePropsStatusFromFilenameByLine = ({effects,remotionRoot,logLevel,+ videoConfigValues,}: {fileName: string;line: number;@@ -1128,6 +1194,7 @@ export const computeSequencePropsStatusFromFilenameByLine = ({effects: string[][];remotionRoot: string;logLevel: LogLevel;+ videoConfigValues: VideoConfigValues;}): SubscribeToSequencePropsResponse => {try {const {absolutePath} = resolveFileInsideProject({@@ -1158,12 +1225,14 @@ export const computeSequencePropsStatusFromFilenameByLine = ({keys,effects,remotionRoot,+ videoConfigValues,}),nodePath: {absolutePath,nodePath: resolvedNodePath,sequenceKeys: keys,effectKeys: effects,+ videoConfigValues,},success: true,};diff --git a/packages/studio-server/src/preview-server/routes/delete-keyframes.ts b/packages/studio-server/src/preview-server/routes/delete-keyframes.tsindex 490fe18047..4e39c1090f 100644--- a/packages/studio-server/src/preview-server/routes/delete-keyframes.ts+++ b/packages/studio-server/src/preview-server/routes/delete-keyframes.ts@@ -17,6 +17,7 @@ import {} from '../../codemods/update-keyframes/update-keyframes';import {writeFileAndNotifyFileWatchers} from '../../file-watcher';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {getVideoConfigIdentifierValues} from '../../helpers/video-config-values';import type {ApiHandler} from '../api-types';import {printUndoHint,@@ -189,6 +190,7 @@ export const deleteKeyframes = async ({const result = await updateSequenceKeyframes({input: output,nodePath: firstSequenceKeyframe.nodePath.nodePath,+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,updates: keyframeGroup.map((keyframe) => ({key: keyframe.key,operation: {@@ -226,6 +228,8 @@ export const deleteKeyframes = async ({input: output,sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,effectIndex: firstEffectKeyframe.effectIndex,+ videoConfigValues:+ firstEffectKeyframe.sequenceNodePath.videoConfigValues,updates: keyframeGroup.map((keyframe) => ({key: keyframe.key,operation: {@@ -334,6 +338,7 @@ export const deleteKeyframes = async ({nodePath: keyframe.nodePath.nodePath,componentIdentity: null,effects: [],+ videoConfigValues: keyframe.nodePath.videoConfigValues,});return {@@ -369,6 +374,10 @@ export const deleteKeyframes = async ({jsx,effectIndex: keyframe.effectIndex,keys: getAllSchemaKeys(keyframe.schema),+ videoConfigValues: getVideoConfigIdentifierValues({+ ast,+ videoConfigValues: keyframe.sequenceNodePath.videoConfigValues,+ }),});});diff --git a/packages/studio-server/src/preview-server/routes/move-keyframes.ts b/packages/studio-server/src/preview-server/routes/move-keyframes.tsindex 0b44c68c77..1698d692e4 100644--- a/packages/studio-server/src/preview-server/routes/move-keyframes.ts+++ b/packages/studio-server/src/preview-server/routes/move-keyframes.ts@@ -198,6 +198,7 @@ export const moveKeyframes = async ({input: output,nodePath: firstSequenceKeyframe.nodePath.nodePath,schema: firstSequenceKeyframe.schema,+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,updates,});output = result.output;@@ -252,6 +253,8 @@ export const moveKeyframes = async ({sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,effectIndex: firstEffectKeyframe.effectIndex,schema: firstEffectKeyframe.schema,+ videoConfigValues:+ firstEffectKeyframe.sequenceNodePath.videoConfigValues,updates,});output = result.output;diff --git a/packages/studio-server/src/preview-server/routes/save-effect-props.ts b/packages/studio-server/src/preview-server/routes/save-effect-props.tsindex 12bb2dc3c1..d9f7fec27a 100644--- a/packages/studio-server/src/preview-server/routes/save-effect-props.ts+++ b/packages/studio-server/src/preview-server/routes/save-effect-props.ts@@ -9,6 +9,7 @@ import {parseAst} from '../../codemods/parse-ast';import {updateEffectProps} from '../../codemods/update-effect-props/update-effect-props';import {writeFileAndNotifyFileWatchers} from '../../file-watcher';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {getVideoConfigIdentifierValues} from '../../helpers/video-config-values';import type {ApiHandler} from '../api-types';import {printUndoHint,@@ -171,5 +172,9 @@ export const saveEffectPropsHandler: ApiHandler<jsx,effectIndex,keys: getAllSchemaKeys(schema),+ videoConfigValues: getVideoConfigIdentifierValues({+ ast,+ videoConfigValues: sequenceNodePath.videoConfigValues,+ }),});});diff --git a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts b/packages/studio-server/src/preview-server/routes/save-sequence-props.tsindex b14142be8a..b7dc4f1331 100644--- a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/save-sequence-props.ts@@ -141,6 +141,7 @@ export const convertSequencePropEditToCodemodChange = (},],schema: edit.schema,+ videoConfigValues: edit.nodePath.videoConfigValues,};};@@ -325,6 +326,7 @@ export const saveSequencePropsHandler: ApiHandler<input: output,nodePath: firstSequenceKeyframe.nodePath.nodePath,schema: firstSequenceKeyframe.schema,+ videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,updates,});output = result.output;@@ -379,6 +381,8 @@ export const saveSequencePropsHandler: ApiHandler<sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,effectIndex: firstEffectKeyframe.effectIndex,schema: firstEffectKeyframe.schema,+ videoConfigValues:+ firstEffectKeyframe.sequenceNodePath.videoConfigValues,updates,});output = result.output;@@ -500,6 +504,7 @@ export const saveSequencePropsHandler: ApiHandler<nodePath: edit.nodePath.nodePath,componentIdentity: null,effects: [],+ videoConfigValues: edit.nodePath.videoConfigValues,});return {diff --git a/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.ts b/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.tsindex 0558f9da5f..1ddf9dff6f 100644--- a/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.ts@@ -18,6 +18,7 @@ export const subscribeToSequenceProps: ApiHandler<keys,effects,clientId,+ videoConfigValues,},remotionRoot,logLevel,@@ -32,6 +33,7 @@ export const subscribeToSequenceProps: ApiHandler<effects,remotionRoot,clientId,+ videoConfigValues,logLevel,});diff --git a/packages/studio-server/src/preview-server/routes/unsubscribe-from-sequence-props.ts b/packages/studio-server/src/preview-server/routes/unsubscribe-from-sequence-props.tsindex 2bacfd65f0..55e1462e60 100644--- a/packages/studio-server/src/preview-server/routes/unsubscribe-from-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/unsubscribe-from-sequence-props.ts@@ -16,6 +16,7 @@ export const unsubscribeFromSequenceProps: ApiHandler<clientId,sequenceKeys,effectKeys,+ videoConfigValues: nodePath.videoConfigValues,});return Promise.resolve(undefined);};diff --git a/packages/studio-server/src/preview-server/routes/update-effect-keyframe-settings.ts b/packages/studio-server/src/preview-server/routes/update-effect-keyframe-settings.tsindex 57817cb204..d376bf634a 100644--- a/packages/studio-server/src/preview-server/routes/update-effect-keyframe-settings.ts+++ b/packages/studio-server/src/preview-server/routes/update-effect-keyframe-settings.ts@@ -9,6 +9,7 @@ import {parseAst} from '../../codemods/parse-ast';import {updateEffectKeyframes} from '../../codemods/update-keyframes/update-keyframes';import {writeFileAndNotifyFileWatchers} from '../../file-watcher';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {getVideoConfigIdentifierValues} from '../../helpers/video-config-values';import type {ApiHandler} from '../api-types';import {printUndoHint,@@ -62,6 +63,7 @@ export const updateEffectKeyframeSettingsHandler: ApiHandler<sequenceNodePath: sequenceNodePath.nodePath,effectIndex,schema,+ videoConfigValues: sequenceNodePath.videoConfigValues,updates: [{key,@@ -134,5 +136,9 @@ export const updateEffectKeyframeSettingsHandler: ApiHandler<jsx,effectIndex,keys: getAllSchemaKeys(schema),+ videoConfigValues: getVideoConfigIdentifierValues({+ ast,+ videoConfigValues: sequenceNodePath.videoConfigValues,+ }),});});diff --git a/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.ts b/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.tsindex 55de1132cc..72c39752af 100644--- a/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.ts+++ b/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.ts@@ -50,6 +50,7 @@ export const updateSequenceKeyframeSettingsHandler: ApiHandler<input: fileContents,nodePath: nodePath.nodePath,schema,+ videoConfigValues: nodePath.videoConfigValues,updates: [{key,@@ -112,6 +113,7 @@ export const updateSequenceKeyframeSettingsHandler: ApiHandler<nodePath: updatedNodePath,componentIdentity: null,effects: [],+ videoConfigValues: nodePath.videoConfigValues,});const updatedSubscriptionKey = {...nodePath, nodePath: updatedNodePath};diff --git a/packages/studio-server/src/preview-server/sequence-props-watchers.ts b/packages/studio-server/src/preview-server/sequence-props-watchers.tsindex 23a0cd5ebc..be8e7bf111 100644--- a/packages/studio-server/src/preview-server/sequence-props-watchers.ts+++ b/packages/studio-server/src/preview-server/sequence-props-watchers.ts@@ -5,7 +5,11 @@ import {stringifySequenceSubscriptionKey,type SubscribeToSequencePropsResponse,} from '@remotion/studio-shared';-import type {JsxComponentIdentity, SequenceNodePath} from 'remotion';+import type {+ JsxComponentIdentity,+ SequenceNodePath,+ VideoConfigValues,+} from 'remotion';import {installFileWatcher} from '../file-watcher';import {JsxElementIdentityMismatchError} from './jsx-component-identity';import {JsxElementNotFoundAtLocationError} from './jsx-element-not-found-at-location-error';@@ -24,6 +28,15 @@ type WatcherInfo = {const sequencePropsWatchers: Record<string, Record<string, WatcherInfo>> = {};+const getWatcherKey = (nodePath: {+ absolutePath: string;+ nodePath: SequenceNodePath;+ sequenceKeys: string[];+ effectKeys: string[][];+ videoConfigValues: VideoConfigValues | null;+}) =>+ `${stringifySequenceSubscriptionKey(nodePath)}:${JSON.stringify(nodePath.videoConfigValues)}`;+const getSequencePropsStatus = ({fileName,line,@@ -34,6 +47,7 @@ const getSequencePropsStatus = ({effects,remotionRoot,logLevel,+ videoConfigValues,}: {fileName: string;line: number;@@ -44,6 +58,7 @@ const getSequencePropsStatus = ({effects: string[][];remotionRoot: string;logLevel: LogLevel;+ videoConfigValues: VideoConfigValues;}): SubscribeToSequencePropsResponse => {if (preferredNodePath) {try {@@ -54,6 +69,7 @@ const getSequencePropsStatus = ({keys,effects,remotionRoot,+ videoConfigValues,});return {status: fromNodePath,@@ -62,6 +78,7 @@ const getSequencePropsStatus = ({nodePath: preferredNodePath,sequenceKeys: keys,effectKeys: effects,+ videoConfigValues,},success: true,};@@ -90,6 +107,7 @@ const getSequencePropsStatus = ({keys,effects,remotionRoot,+ videoConfigValues,});} catch (error) {if (@@ -111,6 +129,7 @@ const getSequencePropsStatus = ({nodePath: cachedNodePath,sequenceKeys: keys,effectKeys: effects,+ videoConfigValues,},success: true,};@@ -125,6 +144,7 @@ const getSequencePropsStatus = ({effects,remotionRoot,logLevel,+ videoConfigValues,});return status;@@ -141,6 +161,7 @@ export const subscribeToSequencePropsWatchers = ({remotionRoot,clientId,logLevel,+ videoConfigValues,}: {fileName: string;line: number;@@ -152,6 +173,7 @@ export const subscribeToSequencePropsWatchers = ({remotionRoot: string;clientId: string;logLevel: LogLevel;+ videoConfigValues: VideoConfigValues;}): SubscribeToSequencePropsResponse => {const initialResult = getSequencePropsStatus({fileName,@@ -163,6 +185,7 @@ export const subscribeToSequencePropsWatchers = ({effects,remotionRoot,logLevel,+ videoConfigValues,});if (!initialResult.success) {@@ -175,7 +198,7 @@ export const subscribeToSequencePropsWatchers = ({setCachedNodePath(fileName, line, column, initialResult.nodePath.nodePath);const {nodePath} = initialResult;- const watcherKey = stringifySequenceSubscriptionKey(nodePath);+ const watcherKey = getWatcherKey(nodePath);// If a watcher already exists for this key, just bump the ref countif (sequencePropsWatchers[clientId]?.[watcherKey]) {@@ -202,6 +225,7 @@ export const subscribeToSequencePropsWatchers = ({componentIdentity,keys,effects,+ videoConfigValues,});const previousEffectChain = result.effects.map((effect) => effect.canUpdate && effect.callee,@@ -264,6 +288,7 @@ export const unsubscribeFromSequencePropsWatchers = ({clientId,sequenceKeys,effectKeys,+ videoConfigValues,}: {fileName: string;nodePath: SequenceNodePath;@@ -271,13 +296,15 @@ export const unsubscribeFromSequencePropsWatchers = ({clientId: string;sequenceKeys: string[];effectKeys: string[][];+ videoConfigValues: VideoConfigValues | null;}) => {const absolutePath = path.resolve(remotionRoot, fileName);- const watcherKey = stringifySequenceSubscriptionKey({+ const watcherKey = getWatcherKey({absolutePath,nodePath,sequenceKeys,effectKeys,+ videoConfigValues,});if (diff --git a/packages/studio-server/src/test/add-keyframes.test.ts b/packages/studio-server/src/test/add-keyframes.test.tsindex f1d12c9047..a7effe66c0 100644--- a/packages/studio-server/src/test/add-keyframes.test.ts+++ b/packages/studio-server/src/test/add-keyframes.test.ts@@ -103,6 +103,7 @@ test('addKeyframes batches sequence and effect adds into one undo entry', asyncnodePath: lineColumnToNodePath(input, 7),sequenceKeys: ['style.opacity'],effectKeys: [['amount']],+ videoConfigValues: null,};try {@@ -177,6 +178,7 @@ test('addKeyframes adds a missing effect prop before keyframing it', async () =>nodePath: lineColumnToNodePath(linearProgressiveBlurInput, 7),sequenceKeys: [],effectKeys: [['start', 'end', 'startBlur', 'endBlur']],+ videoConfigValues: null,};try {diff --git a/packages/studio-server/src/test/code-shift.test.ts b/packages/studio-server/src/test/code-shift.test.tsindex b135af8c56..91517fe8ce 100644--- a/packages/studio-server/src/test/code-shift.test.ts+++ b/packages/studio-server/src/test/code-shift.test.ts@@ -14,6 +14,7 @@ export const Component = () => {test('Should add style.scale to a Video component and format with prettier', async () => {const {output, oldValueStrings, formatted} = await updateSequenceProps({+ videoConfigValues: null,input: componentInput,nodePath: lineColumnToNodePath(componentInput, 6),updates: [{key: 'style.scale', value: 2, defaultValue: null}],@@ -47,6 +48,7 @@ export const Component = () => {test('Should resolve prettier config if override is null', async () => {const {output, formatted} = await updateSequenceProps({+ videoConfigValues: null,input: componentInput,nodePath: lineColumnToNodePath(componentInput, 6),updates: [{key: 'style.scale', value: 2, defaultValue: null}],diff --git a/packages/studio-server/src/test/compute-effect-props-status.test.ts b/packages/studio-server/src/test/compute-effect-props-status.test.tsindex 681b385827..2e726e5d23 100644--- a/packages/studio-server/src/test/compute-effect-props-status.test.ts+++ b/packages/studio-server/src/test/compute-effect-props-status.test.ts@@ -46,6 +46,7 @@ test('computeEffectPropStatus reports static props as canUpdate=true with codeVaconst input = buildInput('[tint({color: "red", opacity: 0.5})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -72,6 +73,7 @@ test('computeEffectPropStatus reports computed props', () => {const input = buildInput('[tint({color: getColor(), opacity: 0.5})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -96,6 +98,7 @@ test('computeEffectPropStatus reports keyframes for inline interpolated effect p);const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -127,6 +130,7 @@ test('computeEffectPropStatus reports output for inline interpolated effect prop);const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -169,6 +173,7 @@ export const Comp = () => {`;const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -187,6 +192,7 @@ test('computeEffectPropStatus reports unset props as undefined codeValue', () =>const input = buildInput('[tint({color: "red"})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -212,6 +218,7 @@ test('computeEffectPropStatus reports static array props', () => {const input = buildInput('[tint({colors: ["red", "blue"]})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -233,6 +240,7 @@ test('computeEffectPropStatus reports arrays with computed items as computed', (const input = buildInput('[tint({colors: ["red", getColor()]})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -251,6 +259,7 @@ test('computeEffectPropStatus flags non-call expressions', () => {const input = buildInput('[someEffect, tint({color: "red"})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -269,6 +278,7 @@ test('computeEffectPropStatus flags out-of-range effect indices', () => {const input = buildInput('[tint({color: "red"})]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 5,@@ -287,6 +297,7 @@ test('computeEffectPropStatus treats non-object first arg as computed', () => {const input = buildInput('[tint(getParams())]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,@@ -305,6 +316,7 @@ test('computeEffectPropStatus treats zero-arg effect as editable with undefinedconst input = buildInput('[tint()]');const {ast, jsx} = findJsx(input);const result = computeEffectPropStatus({+ videoConfigValues: {},ast,jsx,effectIndex: 0,diff --git a/packages/studio-server/src/test/compute-sequence-props-status.test.ts b/packages/studio-server/src/test/compute-sequence-props-status.test.tsindex fe3ecf88c7..27b6bba34d 100644--- a/packages/studio-server/src/test/compute-sequence-props-status.test.ts+++ b/packages/studio-server/src/test/compute-sequence-props-status.test.ts@@ -30,9 +30,94 @@ const getNodePathFromContent = (content: string, line: number) => {return result;};+const videoConfigValues = {+ durationInFrames: 120,+ fps: 30,+ height: 1080,+ width: 1920,+};++test('computeSequencePropsStatus should parse video config numeric expressions', () => {+ const input = `import React from 'react';+import {Sequence, interpolate, useCurrentFrame, useVideoConfig} from 'remotion';++export const Example: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps, durationInFrames} = useVideoConfig();+ return (+ <Sequence+ premountFor={(2 * fps) as number}+ postmountFor={fps * 2.5}+ offset={-1 * fps}+ from={fps / 2}+ style={{scale: interpolate(frame, [0, 3.33 * fps, durationInFrames], [2, 3, 4])}}+ />+ );+};+`;+ const result = computeSequencePropsStatusFromContent({+ fileContents: input,+ nodePath: getNodePathFromContent(input, 8),+ componentIdentity: null,+ keys: ['premountFor', 'postmountFor', 'offset', 'from', 'style.scale'],+ effects: [],+ videoConfigValues,+ });++ expect(result.props.premountFor).toEqual({+ status: 'static',+ codeValue: 60,+ numericExpression: {+ type: 'video-config-multiplication',+ identifier: 'fps',+ multiplier: 2,+ multiplicand: 30,+ factorPosition: 'left',+ value: 60,+ },+ });+ expect(result.props.postmountFor).toMatchObject({+ status: 'static',+ codeValue: 75,+ numericExpression: {+ type: 'video-config-multiplication',+ factorPosition: 'right',+ },+ });+ expect(result.props.from).toEqual({status: 'computed'});+ expect(result.props.offset).toMatchObject({+ status: 'static',+ codeValue: -30,+ numericExpression: {multiplier: -1},+ });+ expect(result.props['style.scale']).toMatchObject({+ status: 'keyframed',+ keyframes: [+ {frame: 0, value: 2},+ {+ frame: 99.9,+ value: 3,+ frameExpression: {+ type: 'video-config-multiplication',+ identifier: 'fps',+ },+ },+ {+ frame: 120,+ value: 4,+ frameExpression: {+ type: 'video-config-value',+ identifier: 'durationInFrames',+ },+ },+ ],+ });+});+test('canUpdateSequenceProps should flag computed props', () => {const filePath = path.join(__dirname, 'snapshots', 'light-leak-computed.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 8),componentIdentity: null,@@ -73,6 +158,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -113,6 +199,7 @@ export const Example: React.FC = () => {expect(() =>computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: 'dev.remotion.shapes.Star',@@ -135,6 +222,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 6),componentIdentity: 'dev.remotion.roughNotation.Highlight',@@ -166,6 +254,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 6),componentIdentity: 'dev.remotion.remotion.Sequence',@@ -194,6 +283,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -231,6 +321,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -277,6 +368,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -320,6 +412,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -361,6 +454,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 8),componentIdentity: null,@@ -388,6 +482,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -419,6 +514,7 @@ test('computeSequencePropsStatus should explain why outside-project file reads wexpect(() =>computeSequencePropsStatus({+ videoConfigValues: null,fileName,nodePath: [],componentIdentity: null,@@ -434,6 +530,7 @@ test('computeSequencePropsStatus should explain why outside-project file reads wtest('computeSequencePropsStatus should detect static nested props', () => {const filePath = path.join(__dirname, 'snapshots', 'nested-props.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 7),componentIdentity: null,@@ -458,6 +555,7 @@ test('computeSequencePropsStatus should detect static nested props', () => {test('computeSequencePropsStatus should flag computed nested props', () => {const filePath = path.join(__dirname, 'snapshots', 'nested-props.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 8),componentIdentity: null,@@ -483,6 +581,7 @@ test('computeSequencePropsStatus should flag computed nested props', () => {test('computeSequencePropsStatus should flag computed when parent is not an object', () => {const filePath = path.join(__dirname, 'snapshots', 'nested-props.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 9),componentIdentity: null,@@ -503,6 +602,7 @@ test('computeSequencePropsStatus should flag computed when parent is not an objetest('computeSequencePropsStatus should report unset nested props as undefined', () => {const filePath = path.join(__dirname, 'snapshots', 'nested-props.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 7),componentIdentity: null,@@ -523,6 +623,7 @@ test('computeSequencePropsStatus should report unset nested props as undefined',test('computeSequencePropsStatus should report unset when parent attribute missing', () => {const filePath = path.join(__dirname, 'snapshots', 'nested-props.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 10),componentIdentity: null,@@ -543,6 +644,7 @@ test('computeSequencePropsStatus should report unset when parent attribute missitest('computeSequencePropsStatus should return keyframes for interpolated style props', () => {const filePath = path.join(__dirname, 'snapshots', 'keyframed-props.tsx');const result = computeSequencePropsStatus({+ videoConfigValues: null,fileName: filePath,nodePath: getNodePath(filePath, 8),componentIdentity: null,@@ -595,6 +697,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -640,6 +743,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -684,6 +788,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -721,6 +826,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -758,6 +864,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -795,6 +902,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -824,6 +932,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 8),componentIdentity: null,@@ -852,6 +961,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -881,6 +991,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 8),componentIdentity: null,@@ -911,6 +1022,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -950,6 +1062,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -996,6 +1109,7 @@ export const Example: React.FC = () => {`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 7),componentIdentity: null,@@ -1020,6 +1134,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 5),componentIdentity: null,@@ -1039,6 +1154,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 5),componentIdentity: null,@@ -1058,6 +1174,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 5),componentIdentity: null,@@ -1077,6 +1194,7 @@ export const Example: React.FC = () => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 5),componentIdentity: null,@@ -1096,6 +1214,7 @@ export const Example: React.FC<{text: string}> = ({text}) => {};`;const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: getNodePathFromContent(input, 5),componentIdentity: null,diff --git a/packages/studio-server/src/test/delete-keyframes.test.ts b/packages/studio-server/src/test/delete-keyframes.test.tsindex b2524c9692..356bb70fe2 100644--- a/packages/studio-server/src/test/delete-keyframes.test.ts+++ b/packages/studio-server/src/test/delete-keyframes.test.ts@@ -50,6 +50,7 @@ test('deleteKeyframes batches sequence and effect deletes into one undo entry',nodePath: lineColumnToNodePath(input, 7),sequenceKeys: ['style.opacity'],effectKeys: [['amount']],+ videoConfigValues: null,};try {diff --git a/packages/studio-server/src/test/discriminated-union-update.test.ts b/packages/studio-server/src/test/discriminated-union-update.test.tsindex 990952bf48..aa2593e1eb 100644--- a/packages/studio-server/src/test/discriminated-union-update.test.ts+++ b/packages/studio-server/src/test/discriminated-union-update.test.ts@@ -20,6 +20,7 @@ test('Should correctly separate discriminated union for layout', () => {nodePath: [],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,},propStatuses: {},getDragOverrides: () => ({}),@@ -38,6 +39,7 @@ test('Should expose absolute-fill variant fields when active', () => {nodePath: [],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,},propStatuses: {},getDragOverrides: () => ({}),@@ -65,6 +67,7 @@ test('Should be able to update a discriminated union', async () => {assert(nodePath, 'No node path found');const update = updateSequencePropsAst({+ videoConfigValues: null,input: file,nodePath,updates: [@@ -97,6 +100,7 @@ test('Should remove variant-specific props when switching enum value', async ()assert(nodePath, 'No node path found');const update = updateSequencePropsAst({+ videoConfigValues: null,input: file,nodePath,updates: [@@ -133,6 +137,7 @@ test('Should remove premountFor and styleWhile* when switching to layout="none"'assert(nodePath, 'No node path found');const update = updateSequencePropsAst({+ videoConfigValues: null,input: file,nodePath,updates: [diff --git a/packages/studio-server/src/test/log-update.test.ts b/packages/studio-server/src/test/log-update.test.tsindex 4cf6f67601..df47c48125 100644--- a/packages/studio-server/src/test/log-update.test.ts+++ b/packages/studio-server/src/test/log-update.test.ts@@ -53,6 +53,7 @@ export const LightLeakExample: React.FC = () => {test('logUpdate emits Monokai-colored output after an AST update', async () => {const {output, oldValueStrings, formatted, logLine} =await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 8),updates: [{key: 'hueShift', value: 90, defaultValue: null}],@@ -196,6 +197,7 @@ test('logUpdate emits change-from-default output for discriminated union enum chconst {oldValueStrings, formatted, logLine, removedProps} =await updateSequenceProps({+ videoConfigValues: null,input: fixture,nodePath: lineColumnToNodePath(fixture, 3),updates: [@@ -264,6 +266,7 @@ test('Undo prop change should not nest key={key={value}} for re-added props', as);const {removedProps} = await updateSequenceProps({+ videoConfigValues: null,input: fixture,nodePath: lineColumnToNodePath(fixture, 3),updates: [diff --git a/packages/studio-server/src/test/save-sequence-props.test.ts b/packages/studio-server/src/test/save-sequence-props.test.tsindex f53352688d..e0ced99c49 100644--- a/packages/studio-server/src/test/save-sequence-props.test.ts+++ b/packages/studio-server/src/test/save-sequence-props.test.ts@@ -75,6 +75,7 @@ test('saveSequenceProps forwards element schemas to the codemod', () => {nodePath: ['program', 'body', 0],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,},key: 'points',value: 7,@@ -94,6 +95,7 @@ test('saveSequenceProps forwards element schemas to the codemod', () => {},],schema: starSchema,+ videoConfigValues: null,});});@@ -129,6 +131,7 @@ export const Comp = () => {nodePath: lineColumnToNodePath(input, 6),sequenceKeys: ['from', 'style.opacity'],effectKeys: [],+ videoConfigValues: null,};try {diff --git a/packages/studio-server/src/test/unsupported-translate.test.ts b/packages/studio-server/src/test/unsupported-translate.test.tsindex dddb2e34e9..85392debd3 100644--- a/packages/studio-server/src/test/unsupported-translate.test.ts+++ b/packages/studio-server/src/test/unsupported-translate.test.ts@@ -27,6 +27,7 @@ export const Component = () => {const getTranslateStatus = (translateValue: string) => {const input = makeComponent(translateValue);const result = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: input,nodePath: lineColumnToNodePath(input, 7),componentIdentity: null,diff --git a/packages/studio-server/src/test/update-keyframes-imports.test.ts b/packages/studio-server/src/test/update-keyframes-imports.test.tsindex 6e9989d351..ebab198b5b 100644--- a/packages/studio-server/src/test/update-keyframes-imports.test.ts+++ b/packages/studio-server/src/test/update-keyframes-imports.test.ts@@ -48,6 +48,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -73,6 +74,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<Solid')),updates: [@@ -95,6 +97,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<AbsoluteFill')),schema: translateSchema,@@ -121,6 +124,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<AbsoluteFill')),schema: rotateSchema,@@ -148,6 +152,7 @@ export const Example = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<div')),updates: [@@ -175,6 +180,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -204,6 +210,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -230,6 +237,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [{key: 'style.opacity', operation: {type: 'remove', frame: 50}}],@@ -253,6 +261,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -283,6 +292,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -310,6 +320,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -334,6 +345,7 @@ export function Example() {}`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -364,6 +376,7 @@ export const Outer: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -391,6 +404,7 @@ export const Example: React.FC = () => ();`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -420,6 +434,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [@@ -448,6 +463,7 @@ export const Comp = () => {};`;const {serialized} = updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input,@@ -484,6 +500,7 @@ export const Comp = () => {`;const before = (input.match(/const frame = useCurrentFrame/g) ?? []).length;const {serialized} = updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input,@@ -516,6 +533,7 @@ export const Comp = () => {};`;const {serialized} = updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input,@@ -542,6 +560,7 @@ export const Example: React.FC = () => {};`;const {serialized} = updateSequenceKeyframesAst({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),updates: [diff --git a/packages/studio-server/src/test/update-keyframes.test.ts b/packages/studio-server/src/test/update-keyframes.test.tsindex 3b4f55033e..c0fa731e00 100644--- a/packages/studio-server/src/test/update-keyframes.test.ts+++ b/packages/studio-server/src/test/update-keyframes.test.ts@@ -22,6 +22,123 @@ export const Example: React.FC = () => {};`;+const videoConfigValues = {+ durationInFrames: 120,+ fps: 30,+ height: 1080,+ width: 1920,+};++test('updateSequenceKeyframes preserves representable video config frame expressions', async () => {+ const input = `import React from 'react';+import {Sequence, interpolate, useCurrentFrame, useVideoConfig} from 'remotion';++export const Example: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps, durationInFrames} = useVideoConfig();+ return (+ <Sequence style={{scale: interpolate(frame, [0, 3.33 * fps, durationInFrames], [2, 3, 4])}} />+ );+};+`;+ const added = await updateSequenceKeyframes({+ input,+ nodePath: lineColumnToNodePath(input, 8),+ updates: [+ {+ key: 'style.scale',+ operation: {type: 'add', frame: 50, value: 2.5},+ },+ ],+ videoConfigValues,+ });+ expect(added.output).toContain('[0, 50, 3.33 * fps, durationInFrames]');++ const {output, updatedNodePath} = await updateSequenceKeyframes({+ input: added.output,+ nodePath: added.updatedNodePath,+ updates: [+ {+ key: 'style.scale',+ operation: {+ type: 'move',+ moves: [{fromFrame: 99.9, toFrame: 100}],+ },+ },+ ],+ videoConfigValues,+ });++ expect(output).toContain(+ '[0, 50, 3.3333333333333335 * fps, durationInFrames]',+ );+ const status = computeSequencePropsStatusFromContent({+ fileContents: output,+ nodePath: updatedNodePath,+ componentIdentity: null,+ keys: ['style.scale'],+ effects: [],+ videoConfigValues,+ });+ expect(status.props['style.scale']).toMatchObject({+ status: 'keyframed',+ keyframes: [+ {frame: 0, value: 2},+ {frame: 50, value: 2.5},+ {frame: 100, value: 3},+ {frame: 120, value: 4},+ ],+ });+});++test('updateSequenceKeyframes updates an fps multiplier when moving a keyframe', async () => {+ const input = `import React from 'react';+import {Sequence, interpolate, useCurrentFrame, useVideoConfig} from 'remotion';++export const Example: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ return (+ <Sequence style={{opacity: interpolate(frame, [0, fps * 6], [0.35, 1])}} />+ );+};+`;+ const {output, updatedNodePath} = await updateSequenceKeyframes({+ input,+ nodePath: lineColumnToNodePath(input, 8),+ updates: [+ {+ key: 'style.opacity',+ operation: {+ type: 'move',+ moves: [+ {fromFrame: 0, toFrame: 1},+ {fromFrame: 180, toFrame: 160},+ ],+ },+ },+ ],+ videoConfigValues,+ });++ expect(output).toContain('[1, fps * 5.333333333333333]');+ const status = computeSequencePropsStatusFromContent({+ fileContents: output,+ nodePath: updatedNodePath,+ componentIdentity: null,+ keys: ['style.opacity'],+ effects: [],+ videoConfigValues,+ });+ expect(status.props['style.opacity']).toMatchObject({+ status: 'keyframed',+ keyframes: [+ {frame: 1, value: 0.35},+ {frame: 160, value: 1},+ ],+ });+});+const colorInput = `import React from 'react';import {Solid, interpolateColors, useCurrentFrame} from 'remotion';@@ -144,6 +261,7 @@ const getLine = (input: string, needle: string): number => {test('updateSequenceKeyframes adds a keyframe to an existing interpolation', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -177,6 +295,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -206,6 +325,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -235,6 +355,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -267,6 +388,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -285,6 +407,7 @@ export const Example: React.FC = () => {test('updateSequenceKeyframes updates a keyframe at the same frame', async () => {const {output, oldValueStrings, newValueStrings} =await updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -317,6 +440,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -352,6 +476,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -384,6 +509,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -416,6 +542,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -450,6 +577,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -497,6 +625,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -530,6 +659,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -563,6 +693,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -583,6 +714,7 @@ export const Example: React.FC = () => {test('updateSequenceKeyframes sets easing for color keyframes', async () => {const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input: colorInput,nodePath: lineColumnToNodePath(colorInput, getLine(colorInput, '<Solid')),updates: [@@ -606,6 +738,7 @@ test('updateSequenceKeyframes sets easing for color keyframes', async () => {test('updateSequenceKeyframes only updates posterize for color keyframes', async () => {const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input: colorInput,nodePath: lineColumnToNodePath(colorInput, getLine(colorInput, '<Solid')),updates: [@@ -631,6 +764,7 @@ test('updateSequenceKeyframes only updates posterize for color keyframes', asynctest('updateSequenceKeyframes converts a static value to an interpolation', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -685,6 +819,7 @@ export const Example: React.FC = () => {},} satisfies InteractivitySchema;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<div')),schema,@@ -723,6 +858,7 @@ test('updateSequenceKeyframes rejects non-keyframable fields', async () => {await expect(updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -742,6 +878,7 @@ test('updateSequenceKeyframes rejects non-keyframable fields', async () => {test('updateSequenceKeyframes rejects enum fields', async () => {await expect(updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -760,6 +897,7 @@ test('updateSequenceKeyframes rejects enum fields', async () => {test('updateSequenceKeyframes converts a static value to a single-keyframe interpolation at frame 0', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -793,6 +931,7 @@ export const Example: React.FC = () => {};`;const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'opacity')),schema: NoReactInternals.sequenceSchema,@@ -814,6 +953,7 @@ export const Example: React.FC = () => {test('updateSequenceKeyframes adds a keyframe to an existing color interpolation', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: colorInput,nodePath: lineColumnToNodePath(colorInput, getLine(colorInput, '<Solid')),updates: [@@ -838,6 +978,7 @@ test('updateSequenceKeyframes converts a static string value to a color interpol"'red'",);const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<Solid')),updates: [@@ -854,6 +995,7 @@ test('updateSequenceKeyframes converts a static string value to a color interpoltest('updateSequenceKeyframes converts static translate to interpolate', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: translateInput,nodePath: lineColumnToNodePath(translateInput,@@ -891,6 +1033,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings, updatedNodePath} =await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<div')),schema: translateSchema,@@ -911,6 +1054,7 @@ export const Example: React.FC = () => {expect(output).toContain('useCurrentFrame');expect(output).toContain('interpolate');const status = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: output,nodePath: updatedNodePath,componentIdentity: null,@@ -940,6 +1084,7 @@ test('updateSequenceKeyframes migrates translate away from interpolateColors', a"translate: interpolateColors(frame, [44], ['0px 59px'])",);const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'translate')),schema: translateSchema,@@ -961,6 +1106,7 @@ test('updateSequenceKeyframes migrates translate away from interpolateColors', atest('updateSequenceKeyframes converts static rotate to interpolate', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: rotateInput,nodePath: lineColumnToNodePath(rotateInput, getLine(rotateInput, 'rotate')),schema: rotateSchema,@@ -991,6 +1137,7 @@ test('updateSequenceKeyframes migrates rotate away from interpolateColors', asyn"rotate: interpolateColors(frame, [55], ['19deg'])",);const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'rotate')),schema: rotateSchema,@@ -1041,6 +1188,7 @@ export default CenteredSolid;`;const nodePath = lineColumnToNodePath(input, getLine(input, '<Solid'));const {output, updatedNodePath} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath,updates: [@@ -1056,6 +1204,7 @@ export default CenteredSolid;expect(output).toContain("extrapolateLeft: 'clamp'");expect(output).toContain("extrapolateRight: 'clamp'");const status = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: output,nodePath: updatedNodePath,componentIdentity: null,@@ -1075,6 +1224,7 @@ export default CenteredSolid;test('updateSequenceKeyframes keeps an interpolation when one keyframe remains', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: sequenceInput,nodePath: lineColumnToNodePath(sequenceInput,@@ -1106,6 +1256,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1134,6 +1285,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1157,6 +1309,7 @@ test('updateSequenceKeyframes moves overlapping selected keyframes together', as);const {output, oldValueStrings, newValueStrings} =await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1191,6 +1344,7 @@ test('updateSequenceKeyframes resorts keyframes when moving past an adjacent key);const {output, oldValueStrings, newValueStrings} =await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1227,6 +1381,7 @@ test('updateSequenceKeyframes replaces an existing keyframe when moving onto it');const {output, oldValueStrings, newValueStrings} =await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1255,6 +1410,7 @@ test('updateSequenceKeyframes allows moving keyframes outside the sequence range'interpolate(frame, [0, 50, 100], [2, 3, 4])',);const {output, newValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1286,6 +1442,7 @@ test('updateSequenceKeyframes converts the last keyframe to a static value', asy);const {output, oldValueStrings, newValueStrings, updatedNodePath} =await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, 'scale')),updates: [@@ -1300,6 +1457,7 @@ test('updateSequenceKeyframes converts the last keyframe to a static value', asyexpect(newValueStrings).toEqual(['320']);expect(output).toContain('style={{scale: 320}}');const status = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: output,nodePath: updatedNodePath,componentIdentity: null,@@ -1314,6 +1472,7 @@ test('updateSequenceKeyframes converts the last keyframe to a static value', asytest('updateSequenceKeyframes keeps a color interpolation when one keyframe remains', async () => {const {output, oldValueStrings} = await updateSequenceKeyframes({+ videoConfigValues: null,input: colorInput,nodePath: lineColumnToNodePath(colorInput, getLine(colorInput, '<Solid')),updates: [@@ -1336,6 +1495,7 @@ test('updateEffectKeyframes converts a static value to a clamped interpolation','0.2',);const {serialized, oldValueStrings} = updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input,@@ -1359,6 +1519,7 @@ test('updateEffectKeyframes converts a static value to a clamped interpolation',test('updateEffectKeyframes uses the schema keyframe output default', () => {const {serialized} = updateEffectKeyframesAst({+ videoConfigValues: null,input: scaleEffectInput,sequenceNodePath: lineColumnToNodePath(scaleEffectInput,@@ -1380,6 +1541,7 @@ test('updateEffectKeyframes uses the schema keyframe output default', () => {test('updateEffectKeyframes adds a missing prop before keyframing it', () => {const {serialized, oldValueStrings} = updateEffectKeyframesAst({+ videoConfigValues: null,input: waveEffectInput,sequenceNodePath: lineColumnToNodePath(waveEffectInput,@@ -1406,6 +1568,7 @@ test('updateEffectKeyframes adds a missing prop before keyframing it', () => {test('updateEffectKeyframes adds props to a zero-argument effect', () => {const input = waveEffectInput.replace('wave({})', 'wave()');const {serialized, oldValueStrings} = updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input, getLine(input, '<Solid')),effectIndex: 0,@@ -1425,6 +1588,7 @@ test('updateEffectKeyframes adds props to a zero-argument effect', () => {test('updateEffectKeyframes sets one easing segment and fills linear segments', () => {const {serialized} = updateEffectKeyframesAst({+ videoConfigValues: null,input: effectInput,sequenceNodePath: lineColumnToNodePath(effectInput,@@ -1456,6 +1620,7 @@ test('updateSequenceKeyframes converts the last color keyframe to a static value);const {output, oldValueStrings, newValueStrings, updatedNodePath} =await updateSequenceKeyframes({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, getLine(input, '<Solid')),updates: [@@ -1470,6 +1635,7 @@ test('updateSequenceKeyframes converts the last color keyframe to a static valueexpect(newValueStrings).toEqual(["'blue'"]);expect(output).toContain("color={'blue'}");const status = computeSequencePropsStatusFromContent({+ videoConfigValues: null,fileContents: output,nodePath: updatedNodePath,componentIdentity: null,@@ -1484,6 +1650,7 @@ test('updateSequenceKeyframes converts the last color keyframe to a static valuetest('updateEffectKeyframes removes a keyframe from an effect prop interpolation', () => {const {serialized, oldValueStrings, effectCallee} = updateEffectKeyframesAst({+ videoConfigValues: null,input: effectInput,sequenceNodePath: lineColumnToNodePath(effectInput,@@ -1509,6 +1676,7 @@ test('updateEffectKeyframes removes a keyframe from an effect prop interpolationtest('updateEffectKeyframes allows moving keyframes outside the sequence range', () => {const {serialized, newValueStrings} = updateEffectKeyframesAst({+ videoConfigValues: null,input: effectInput,sequenceNodePath: lineColumnToNodePath(effectInput,@@ -1539,6 +1707,7 @@ test('updateEffectKeyframes allows moving keyframes outside the sequence range',test('updateEffectKeyframes replaces an existing keyframe when moving onto it', () => {const {serialized, newValueStrings} = updateEffectKeyframesAst({+ videoConfigValues: null,input: effectInput,sequenceNodePath: lineColumnToNodePath(effectInput,@@ -1570,6 +1739,7 @@ test('updateEffectKeyframes keeps an effect prop interpolation with one keyframe'interpolate(frame, [0, 100], [0.2, 0.8])',);const {serialized} = updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input,@@ -1594,6 +1764,7 @@ test('updateEffectKeyframes converts the last effect keyframe to a static value');const {serialized, oldValueStrings, newValueStrings, effectCallee} =updateEffectKeyframesAst({+ videoConfigValues: null,input,sequenceNodePath: lineColumnToNodePath(input,diff --git a/packages/studio-server/src/test/update-nested-sequence-props.test.ts b/packages/studio-server/src/test/update-nested-sequence-props.test.tsindex 024a7ea2a5..fa0f9963d4 100644--- a/packages/studio-server/src/test/update-nested-sequence-props.test.ts+++ b/packages/studio-server/src/test/update-nested-sequence-props.test.ts@@ -18,6 +18,7 @@ export const Example: React.FC = () => {test('updateSequenceProps should update a nested style property', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath: lineColumnToNodePath(nestedInput, 7),updates: [{key: 'style.opacity', value: 0.8, defaultValue: null}],@@ -33,6 +34,7 @@ test('updateSequenceProps should update a nested style property', async () => {test('updateSequenceProps should add a nested property to existing object', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath: lineColumnToNodePath(nestedInput, 7),updates: [{key: 'style.rotate', value: 45, defaultValue: null}],@@ -50,6 +52,7 @@ test('updateSequenceProps should add a nested property to existing object', asyntest('updateSequenceProps should create style attribute when it does not exist', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath: lineColumnToNodePath(nestedInput, 8),updates: [{key: 'style.opacity', value: 0.3, defaultValue: null}],@@ -65,6 +68,7 @@ test('updateSequenceProps should create style attribute when it does not exist',test('updateSequenceProps should remove nested property when value equals default', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath: lineColumnToNodePath(nestedInput, 7),updates: [{key: 'style.opacity', value: 1, defaultValue: 1}],@@ -89,6 +93,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: singlePropInput,nodePath: lineColumnToNodePath(singlePropInput, 4),updates: [{key: 'style.opacity', value: 1, defaultValue: 1}],@@ -103,6 +108,7 @@ export const Example: React.FC = () => {test('updateSequenceProps should report default as oldValueString for missing nested property', async () => {const {oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath: lineColumnToNodePath(nestedInput, 8),updates: [{key: 'style.opacity', value: 0.5, defaultValue: 1}],@@ -116,6 +122,7 @@ test('updateSequenceProps should report default as oldValueString for missing netest('updateSequenceProps should insert Google Font source loading code', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath: lineColumnToNodePath(nestedInput, 7),updates: [@@ -160,6 +167,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 8),updates: [@@ -208,6 +216,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 12),updates: [@@ -254,6 +263,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 13),updates: [@@ -283,6 +293,7 @@ export const Example: React.FC = () => {test('updateSequenceProps should keep node paths stable after inserting Google Font loading code', async () => {const nodePath = lineColumnToNodePath(nestedInput, 7);const first = await updateSequenceProps({+ videoConfigValues: null,input: nestedInput,nodePath,updates: [@@ -304,6 +315,7 @@ test('updateSequenceProps should keep node paths stable after inserting Google F});const second = await updateSequenceProps({+ videoConfigValues: null,input: first.output,nodePath,updates: [@@ -347,6 +359,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 7),updates: [@@ -391,6 +404,7 @@ export const Example: React.FC = () => {`;const {output} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 18),updates: [@@ -439,6 +453,7 @@ export const Example: React.FC = () => {`;const {output} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 14),updates: [@@ -480,6 +495,7 @@ export const Example: React.FC = () => {};`;const {output} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 9),updates: [diff --git a/packages/studio-server/src/test/update-sequence-props.test.ts b/packages/studio-server/src/test/update-sequence-props.test.tsindex 7fb49abc53..90628925b3 100644--- a/packages/studio-server/src/test/update-sequence-props.test.ts+++ b/packages/studio-server/src/test/update-sequence-props.test.ts@@ -20,8 +20,55 @@ export const LightLeakExample: React.FC = () => {};`;+const videoConfigValues = {+ durationInFrames: 120,+ fps: 30,+ height: 1080,+ width: 1920,+};++test('updateSequenceProps preserves video config multiplication expressions', async () => {+ const input = `import {Sequence, useVideoConfig} from 'remotion';++export const Example: React.FC = () => {+ const {fps} = useVideoConfig();+ return (+ <Sequence+ premountFor={(2 * fps) as number}+ postmountFor={fps * 2}+ durationInFrames={(2 * fps) as number}+ from={2 * fps}+ style={{opacity: 2 * fps}}+ />+ );+};+`;+ const {output} = await updateSequenceProps({+ input,+ nodePath: lineColumnToNodePath(input, 6),+ updates: [+ {key: 'premountFor', value: 75, defaultValue: null},+ {key: 'postmountFor', value: 90, defaultValue: null},+ {key: 'durationInFrames', value: 60, defaultValue: null},+ {key: 'from', value: 0, defaultValue: null},+ {key: 'style.opacity', value: 120, defaultValue: null},+ ],+ schema: NoReactInternals.sequenceSchema,+ prettierConfigOverride: null,+ videoConfigValues,+ });++ expect(output).toContain('premountFor={2.5 * fps}');+ expect(output).toContain('postmountFor={fps * 3}');+ expect(output).toContain('durationInFrames={(2 * fps) as number}');+ expect(output).toContain('from={0}');+ expect(output).not.toContain('0 * fps');+ expect(output).toContain('opacity: 4 * fps');+});+test('updateSequenceProps should update a number value', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 8),updates: [{key: 'hueShift', value: 90, defaultValue: null}],@@ -38,6 +85,7 @@ test('updateSequenceProps should update a number value', async () => {test('updateSequenceProps should update durationInFrames', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 9),updates: [{key: 'durationInFrames', value: 120, defaultValue: null}],@@ -54,6 +102,7 @@ test('updateSequenceProps should update durationInFrames', async () => {test('updateSequenceProps should add a new attribute', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 9),updates: [{key: 'speed', value: 2, defaultValue: null}],@@ -68,6 +117,7 @@ test('updateSequenceProps should add a new attribute', async () => {test('updateSequenceProps should remove attribute when value equals default', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 9),updates: [{key: 'hueShift', value: 0, defaultValue: 0}],@@ -95,6 +145,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'name', value: '', defaultValue: ''}],@@ -119,6 +170,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'freeze', value: null, defaultValue: null}],@@ -132,6 +184,7 @@ export const Example: React.FC = () => {test('updateSequenceProps should set boolean true as shorthand', async () => {const {output} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 8),updates: [{key: 'loop', value: true, defaultValue: false}],@@ -146,6 +199,7 @@ test('updateSequenceProps should set boolean true as shorthand', async () => {test('updateSequenceProps should add showInTimeline false', async () => {const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 8),updates: [{key: 'showInTimeline', value: false, defaultValue: true}],@@ -159,6 +213,7 @@ test('updateSequenceProps should add showInTimeline false', async () => {test('updateSequenceProps should report oldValueString for computed expressions', async () => {const {oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 8),updates: [{key: 'seed', value: 5, defaultValue: null}],@@ -172,6 +227,7 @@ test('updateSequenceProps should report oldValueString for computed expressions'test('updateSequenceProps should report default as oldValueString for missing attribute', async () => {const {oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: lineColumnToNodePath(lightLeakInput, 8),updates: [{key: 'speed', value: 2, defaultValue: 1}],@@ -186,6 +242,7 @@ test('updateSequenceProps should report default as oldValueString for missing attest('updateSequenceProps should throw for non-existent nodePath', async () => {await expect(updateSequenceProps({+ videoConfigValues: null,input: lightLeakInput,nodePath: ['program', 'body', 999],updates: [{key: 'hueShift', value: 90, defaultValue: null}],@@ -205,11 +262,13 @@ test('updateMultipleSequenceProps should update multiple nodes in one format pasnodePath: lineColumnToNodePath(lightLeakInput, 8),updates: [{key: 'hueShift', value: 90, defaultValue: null}],schema: NoReactInternals.sequenceSchema,+ videoConfigValues: null,},{nodePath: lineColumnToNodePath(lightLeakInput, 9),updates: [{key: 'durationInFrames', value: 120, defaultValue: null}],schema: NoReactInternals.sequenceSchema,+ videoConfigValues: null,},],prettierConfigOverride: null,@@ -231,6 +290,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'children', value: 'Goodbye', defaultValue: ''}],@@ -252,6 +312,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'children', value: 'Cool! I ', defaultValue: ''}],@@ -273,6 +334,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'children', value: 'Goodbye', defaultValue: ''}],@@ -295,6 +357,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'children', value: 'Goodbye', defaultValue: ''}],@@ -318,6 +381,7 @@ export const Example: React.FC = () => {`;const {output, oldValueStrings} = await updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 5),updates: [{key: 'children', value: 'Hello again', defaultValue: ''}],@@ -344,6 +408,7 @@ export const Example: React.FC = () => {await expect(updateSequenceProps({+ videoConfigValues: null,input,nodePath: lineColumnToNodePath(input, 6),updates: [{key: 'children', value: 'Goodbye', defaultValue: ''}],diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.tsindex d51ace828c..933fee1d32 100644--- a/packages/studio-shared/src/api-requests.ts+++ b/packages/studio-shared/src/api-requests.ts@@ -23,6 +23,7 @@ import type {JsxComponentIdentity,SequenceNodePath,SequencePropsSubscriptionKey,+ VideoConfigValues,} from 'remotion';import type {RecastCodemod, VisualControlChange} from './codemods';import type {ComponentProp} from './component-drag-data';@@ -278,6 +279,7 @@ export type SubscribeToSequencePropsRequest = {keys: string[];effects: string[][];clientId: string;+ videoConfigValues: VideoConfigValues;};export type SubscribeToSequencePropsResponse =diff --git a/packages/studio-shared/src/test/schema-field-info.test.ts b/packages/studio-shared/src/test/schema-field-info.test.tsindex 090c0b1756..5fbf0a64d8 100644--- a/packages/studio-shared/src/test/schema-field-info.test.ts+++ b/packages/studio-shared/src/test/schema-field-info.test.ts@@ -58,6 +58,7 @@ const nodePath: SequencePropsSubscriptionKey = {nodePath: [],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,};test('getEffectFieldsToShow uses the active enum variant', () => {diff --git a/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts b/packages/studio/src/components/Timeline/sequence-props-subscription-store.tsindex 2827f71a24..cd986faf43 100644--- a/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts+++ b/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts@@ -3,6 +3,7 @@ import type {JsxComponentIdentity,SequenceNodePath,InteractivitySchema,+ VideoConfigValues,} from 'remotion';import {Internals} from 'remotion';import {callApi} from '../call-api';@@ -16,6 +17,7 @@ const makeKey = ({componentIdentity,sequenceKeys,effectKeys,+ videoConfigValues,}: {fileName: string;line: number;@@ -23,8 +25,9 @@ const makeKey = ({componentIdentity: JsxComponentIdentity | null;sequenceKeys: string[];effectKeys: string[][];+ videoConfigValues: VideoConfigValues;}): Key =>- `${fileName}\0${line}\0${column}\0${componentIdentity ?? ''}\0${sequenceKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}`;+ `${fileName}\0${line}\0${column}\0${componentIdentity ?? ''}\0${sequenceKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}\0${JSON.stringify(videoConfigValues)}`;type SubscribeResult = Awaited<ReturnType<typeof callApi<'/api/subscribe-to-sequence-props'>>@@ -53,6 +56,7 @@ export const acquireSequencePropsSubscription = ({clientId,applyOnce,applyEach,+ videoConfigValues,}: {fileName: string;line: number;@@ -64,6 +68,7 @@ export const acquireSequencePropsSubscription = ({clientId: string;applyOnce: ApplyResult;applyEach: ApplyResult;+ videoConfigValues: VideoConfigValues;}): {release: () => void} => {const sequenceKeys = getAllSchemaKeys(schema);const effectKeys = effects.map((effect) => getAllSchemaKeys(effect));@@ -74,6 +79,7 @@ export const acquireSequencePropsSubscription = ({componentIdentity,sequenceKeys,effectKeys,+ videoConfigValues,});let entry = entries.get(key);@@ -87,6 +93,7 @@ export const acquireSequencePropsSubscription = ({keys: getAllSchemaKeys(schema),effects: effectKeys,clientId,+ videoConfigValues,});const created: Entry = {refCount: 0,diff --git a/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts b/packages/studio/src/components/Timeline/use-sequence-props-subscription.tsindex 055c5d4092..5f75572ff0 100644--- a/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts+++ b/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts@@ -43,6 +43,7 @@ export const useSequencePropsSubscription = ({const overrideIdToNodePathMappingsRef = useRef(overrideIdToNodePathMappings);overrideIdToNodePathMappingsRef.current = overrideIdToNodePathMappings;const clientId = state.type === 'connected' ? state.clientId : undefined;+ const videoConfig = Internals.useUnsafeVideoConfig();const effectsSignature = useMemo(() =>@@ -76,7 +77,8 @@ export const useSequencePropsSubscription = ({!locationSource ||!locationLine ||locationColumn === null ||- !schema+ !schema ||+ videoConfig === null) {return;}@@ -93,6 +95,12 @@ export const useSequencePropsSubscription = ({effects,nodePath: nodePathAtResubscribe?.nodePath ?? null,clientId,+ videoConfigValues: {+ durationInFrames: videoConfig.durationInFrames,+ fps: videoConfig.fps,+ height: videoConfig.height,+ width: videoConfig.width,+ },applyOnce: (result) => {if (!result.success) {return;@@ -145,5 +153,6 @@ export const useSequencePropsSubscription = ({schema,setPropStatuses,setOverrideIdToNodePath,+ videoConfig,]);};diff --git a/packages/studio/src/test/easing-inspector-selection.test.ts b/packages/studio/src/test/easing-inspector-selection.test.tsindex 82b970def6..490ba44b61 100644--- a/packages/studio/src/test/easing-inspector-selection.test.ts+++ b/packages/studio/src/test/easing-inspector-selection.test.ts@@ -16,6 +16,7 @@ const makeNodePathInfo = (nodePath,sequenceKeys: ['from', 'durationInFrames'],effectKeys: [],+ videoConfigValues: null,} satisfies SequencePropsSubscriptionKey,auxiliaryKeys,index: 0,diff --git a/packages/studio/src/test/easing-selection-after-keyframe-delete.test.ts b/packages/studio/src/test/easing-selection-after-keyframe-delete.test.tsindex bc9c753fcb..8f94836394 100644--- a/packages/studio/src/test/easing-selection-after-keyframe-delete.test.ts+++ b/packages/studio/src/test/easing-selection-after-keyframe-delete.test.ts@@ -16,6 +16,7 @@ const makeNodePathInfo = (nodePath,sequenceKeys: ['from', 'durationInFrames'],effectKeys: [],+ videoConfigValues: null,} satisfies SequencePropsSubscriptionKey,auxiliaryKeys,index: 0,diff --git a/packages/studio/src/test/inspector-selection.test.ts b/packages/studio/src/test/inspector-selection.test.tsindex 58aed70548..87eebace27 100644--- a/packages/studio/src/test/inspector-selection.test.ts+++ b/packages/studio/src/test/inspector-selection.test.ts@@ -9,6 +9,7 @@ const makeKey = (nodePath: SequenceNodePath): SequencePropsSubscriptionKey => ({effectKeys: [],nodePath,sequenceKeys: ['from', 'durationInFrames'],+ videoConfigValues: null,});const makeNodePathInfo = (diff --git a/packages/studio/src/test/migrate-expanded-tracks-for-subscription-key.test.ts b/packages/studio/src/test/migrate-expanded-tracks-for-subscription-key.test.tsindex 7d70c66b97..df2f2a101f 100644--- a/packages/studio/src/test/migrate-expanded-tracks-for-subscription-key.test.ts+++ b/packages/studio/src/test/migrate-expanded-tracks-for-subscription-key.test.ts@@ -8,6 +8,7 @@ const makeKey = (nodePath: SequenceNodePath): SequencePropsSubscriptionKey => ({nodePath,sequenceKeys: ['from', 'durationInFrames'],effectKeys: [],+ videoConfigValues: null,});const expandedKey = (diff --git a/packages/studio/src/test/split-selected-timeline-item.test.ts b/packages/studio/src/test/split-selected-timeline-item.test.tsindex 28cf5fa7ce..6590edd022 100644--- a/packages/studio/src/test/split-selected-timeline-item.test.ts+++ b/packages/studio/src/test/split-selected-timeline-item.test.ts@@ -20,6 +20,7 @@ const makeKey = (nodePath: SequenceNodePath): SequencePropsSubscriptionKey => ({nodePath,sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,});const makeNodePathInfo = (diff --git a/packages/studio/src/test/timeline-keyframes.test.ts b/packages/studio/src/test/timeline-keyframes.test.tsindex 75ea7bed63..087b9655f3 100644--- a/packages/studio/src/test/timeline-keyframes.test.ts+++ b/packages/studio/src/test/timeline-keyframes.test.ts@@ -24,6 +24,7 @@ const makeNodePath = (id: string): SequencePropsSubscriptionKey => ({nodePath: [id],sequenceKeys: ['style.scale'],effectKeys: [],+ videoConfigValues: null,});const makeNodePathWithEffectKeys = (diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.tsindex 5b1f5ff236..a1f5e512bf 100644--- a/packages/studio/src/test/timeline-selection.test.ts+++ b/packages/studio/src/test/timeline-selection.test.ts@@ -134,6 +134,7 @@ const makeKey = (nodePath,sequenceKeys: ['from', 'durationInFrames'],effectKeys,+ videoConfigValues: null,});const withMockLocalStorage = (callback: () => void) => {diff --git a/packages/transitions/src/test/transition-series-stack.test.tsx b/packages/transitions/src/test/transition-series-stack.test.tsxindex 4f023f6e2f..2b76bbbc95 100644--- a/packages/transitions/src/test/transition-series-stack.test.tsx+++ b/packages/transitions/src/test/transition-series-stack.test.tsx@@ -260,6 +260,7 @@ test('TransitionSeries.Sequence duration overrides cascade to later sequences',nodePath: ['body', 0],sequenceKeys: [],effectKeys: [],+ videoConfigValues: null,};const subscriptionKey = Internals.makeSequencePropsSubscriptionKey(nodePath);const makeDurationOverride = (durationInFrames: number) => ({