@remotion/studio-server 4.0.485 → 4.0.487

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,6 +134,343 @@ const updateJsxTextContent = ({ jsxElement, value, }) => {
134
134
  }
135
135
  return staticTextContent.value;
136
136
  };
137
+ const collectTopLevelIdentifierNames = (ast) => {
138
+ const names = new Set();
139
+ recast.types.visit(ast, {
140
+ visitIdentifier(path) {
141
+ names.add(path.node.name);
142
+ this.traverse(path);
143
+ },
144
+ });
145
+ return names;
146
+ };
147
+ const toSafeIdentifier = (value) => {
148
+ const sanitized = value.replace(/[^a-zA-Z0-9_$]/g, '');
149
+ if (!sanitized) {
150
+ return 'loadGoogleFont';
151
+ }
152
+ return /^[a-zA-Z_$]/.test(sanitized) ? sanitized : `_${sanitized}`;
153
+ };
154
+ const getSafeLoadFontIdentifier = ({ font, usedNames, }) => {
155
+ const baseName = toSafeIdentifier(`load${font.importName}`);
156
+ if (!usedNames.has(baseName)) {
157
+ usedNames.add(baseName);
158
+ return baseName;
159
+ }
160
+ let index = 2;
161
+ while (usedNames.has(`${baseName}${index}`)) {
162
+ index++;
163
+ }
164
+ const name = `${baseName}${index}`;
165
+ usedNames.add(name);
166
+ return name;
167
+ };
168
+ const getImportedLoadFontIdentifier = ({ ast, font, }) => {
169
+ var _a;
170
+ var _b, _c;
171
+ const moduleName = `@remotion/google-fonts/${font.importName}`;
172
+ for (const statement of ast.program.body) {
173
+ if (statement.type !== 'ImportDeclaration' ||
174
+ statement.source.value !== moduleName) {
175
+ continue;
176
+ }
177
+ for (const specifier of (_b = statement.specifiers) !== null && _b !== void 0 ? _b : []) {
178
+ if (specifier.type === 'ImportSpecifier' &&
179
+ specifier.imported.type === 'Identifier' &&
180
+ specifier.imported.name === 'loadFont') {
181
+ return (_c = (_a = specifier.local) === null || _a === void 0 ? void 0 : _a.name) !== null && _c !== void 0 ? _c : 'loadFont';
182
+ }
183
+ }
184
+ }
185
+ return null;
186
+ };
187
+ const getInsertIndexAfterImportsOrDirectives = (ast) => {
188
+ const lastImportIndex = ast.program.body.reduce((lastIndex, statement, index) => {
189
+ return statement.type === 'ImportDeclaration' ? index : lastIndex;
190
+ }, -1);
191
+ if (lastImportIndex !== -1) {
192
+ return lastImportIndex + 1;
193
+ }
194
+ return ast.program.body.findIndex((statement) => {
195
+ return !(statement.type === 'ExpressionStatement' &&
196
+ 'directive' in statement &&
197
+ statement.directive);
198
+ });
199
+ };
200
+ const insertAfterImportsOrDirectives = (ast, statement) => {
201
+ const insertIndex = getInsertIndexAfterImportsOrDirectives(ast);
202
+ ast.program.body.splice(insertIndex === -1 ? ast.program.body.length : insertIndex, 0, statement);
203
+ };
204
+ const ensureLoadFontImport = ({ ast, font, usedNames, }) => {
205
+ var _a;
206
+ var _b;
207
+ const existing = getImportedLoadFontIdentifier({ ast, font });
208
+ if (existing) {
209
+ return existing;
210
+ }
211
+ const moduleName = `@remotion/google-fonts/${font.importName}`;
212
+ const localName = getSafeLoadFontIdentifier({ font, usedNames });
213
+ const specifier = b.importSpecifier(b.identifier('loadFont'), b.identifier(localName));
214
+ for (const statement of ast.program.body) {
215
+ if (statement.type === 'ImportDeclaration' &&
216
+ statement.source.value === moduleName &&
217
+ !((_a = statement.specifiers) === null || _a === void 0 ? void 0 : _a.some((existingSpecifier) => existingSpecifier.type === 'ImportNamespaceSpecifier'))) {
218
+ statement.specifiers = [
219
+ ...((_b = statement.specifiers) !== null && _b !== void 0 ? _b : []),
220
+ specifier,
221
+ ];
222
+ return localName;
223
+ }
224
+ }
225
+ const declaration = b.importDeclaration([specifier], b.stringLiteral(moduleName));
226
+ insertAfterImportsOrDirectives(ast, declaration);
227
+ return localName;
228
+ };
229
+ const getStringArrayObjectProperty = ({ node, key, }) => {
230
+ if (node.type !== 'ObjectExpression') {
231
+ return null;
232
+ }
233
+ const property = node.properties.find((prop) => {
234
+ return (prop.type === 'ObjectProperty' &&
235
+ prop.key.type === 'Identifier' &&
236
+ prop.key.name === key);
237
+ });
238
+ if (!property || property.type !== 'ObjectProperty') {
239
+ return null;
240
+ }
241
+ if (property.value.type !== 'ArrayExpression') {
242
+ return null;
243
+ }
244
+ const values = [];
245
+ for (const element of property.value.elements) {
246
+ if (!element || element.type !== 'StringLiteral') {
247
+ return null;
248
+ }
249
+ values.push(element.value);
250
+ }
251
+ return values;
252
+ };
253
+ const arraysEqual = (a, bValues) => {
254
+ return (a.length === bValues.length &&
255
+ a.every((value, index) => value === bValues[index]));
256
+ };
257
+ const isMatchingLoadFontCall = ({ statement, localName, font, }) => {
258
+ if (statement.type !== 'ExpressionStatement' ||
259
+ statement.expression.type !== 'CallExpression' ||
260
+ statement.expression.callee.type !== 'Identifier' ||
261
+ statement.expression.callee.name !== localName) {
262
+ return false;
263
+ }
264
+ const [style, options] = statement.expression.arguments;
265
+ if ((style === null || style === void 0 ? void 0 : style.type) !== 'StringLiteral' || style.value !== font.style) {
266
+ return false;
267
+ }
268
+ if (!options || options.type !== 'ObjectExpression') {
269
+ return false;
270
+ }
271
+ const weights = getStringArrayObjectProperty({ node: options, key: 'weights' });
272
+ const subsets = getStringArrayObjectProperty({ node: options, key: 'subsets' });
273
+ return (weights !== null &&
274
+ subsets !== null &&
275
+ arraysEqual(weights, font.weights) &&
276
+ arraysEqual(subsets, font.subsets));
277
+ };
278
+ const hasTopLevelLoadFontCall = ({ ast, localName, font, }) => {
279
+ return ast.program.body.some((statement) => {
280
+ return isMatchingLoadFontCall({ statement, localName, font });
281
+ });
282
+ };
283
+ const getGoogleFontImportName = (moduleName) => {
284
+ const prefix = '@remotion/google-fonts/';
285
+ return moduleName.startsWith(prefix) ? moduleName.slice(prefix.length) : null;
286
+ };
287
+ const normalizeFontFamilyName = (fontFamily) => {
288
+ return fontFamily.toLowerCase().replace(/[^a-z0-9]/g, '');
289
+ };
290
+ const getPrimaryFontFamilyName = (fontFamily) => {
291
+ const trimmed = fontFamily.trim();
292
+ if (!trimmed) {
293
+ return null;
294
+ }
295
+ const quote = trimmed[0];
296
+ if (quote === '"' || quote === "'") {
297
+ const closingQuote = trimmed.indexOf(quote, 1);
298
+ return closingQuote === -1
299
+ ? trimmed.slice(1)
300
+ : trimmed.slice(1, closingQuote);
301
+ }
302
+ return trimmed.split(',')[0].trim();
303
+ };
304
+ const collectUsedFontFamilyNames = (ast) => {
305
+ const used = new Set();
306
+ const add = (fontFamily) => {
307
+ const primary = getPrimaryFontFamilyName(fontFamily);
308
+ if (primary) {
309
+ used.add(normalizeFontFamilyName(primary));
310
+ }
311
+ };
312
+ recast.types.visit(ast, {
313
+ visitObjectProperty(path) {
314
+ var _a;
315
+ const { node } = path;
316
+ if (node.key.type === 'Identifier' && node.key.name === 'fontFamily') {
317
+ if (node.value.type === 'StringLiteral') {
318
+ add(node.value.value);
319
+ }
320
+ if (node.value.type === 'TemplateLiteral' &&
321
+ node.value.expressions.length === 0 &&
322
+ node.value.quasis.length === 1) {
323
+ add((_a = node.value.quasis[0].value.cooked) !== null && _a !== void 0 ? _a : node.value.quasis[0].value.raw);
324
+ }
325
+ }
326
+ this.traverse(path);
327
+ },
328
+ visitJSXAttribute(path) {
329
+ var _a;
330
+ const { node } = path;
331
+ if (node.name.type === 'JSXIdentifier' &&
332
+ node.name.name === 'fontFamily' &&
333
+ ((_a = node.value) === null || _a === void 0 ? void 0 : _a.type) === 'StringLiteral') {
334
+ add(node.value.value);
335
+ }
336
+ this.traverse(path);
337
+ },
338
+ });
339
+ return used;
340
+ };
341
+ const isIdentifierImportedBySpecifier = ({ parent, name, }) => {
342
+ return (parent !== null &&
343
+ typeof parent === 'object' &&
344
+ 'type' in parent &&
345
+ parent.type === 'ImportSpecifier' &&
346
+ 'local' in parent &&
347
+ parent.local !== null &&
348
+ typeof parent.local === 'object' &&
349
+ 'type' in parent.local &&
350
+ parent.local.type === 'Identifier' &&
351
+ 'name' in parent.local &&
352
+ parent.local.name === name);
353
+ };
354
+ const hasNonImportIdentifierReference = ({ ast, name, }) => {
355
+ let hasReference = false;
356
+ recast.types.visit(ast, {
357
+ visitIdentifier(path) {
358
+ if (path.node.name !== name) {
359
+ this.traverse(path);
360
+ return;
361
+ }
362
+ if (isIdentifierImportedBySpecifier({ parent: path.parent.node, name })) {
363
+ this.traverse(path);
364
+ return;
365
+ }
366
+ hasReference = true;
367
+ return false;
368
+ },
369
+ });
370
+ return hasReference;
371
+ };
372
+ const googleFontLoadingComment = 'Remotion Studio generated Google Font loading';
373
+ const hasStudioGeneratedGoogleFontLoadingComment = (statement) => {
374
+ var _a;
375
+ return ((_a = statement.leadingComments) !== null && _a !== void 0 ? _a : []).some((comment) => comment.value.includes(googleFontLoadingComment));
376
+ };
377
+ const isTopLevelCallToIdentifier = ({ statement, localName, }) => {
378
+ return (statement.type === 'ExpressionStatement' &&
379
+ statement.expression.type === 'CallExpression' &&
380
+ statement.expression.callee.type === 'Identifier' &&
381
+ statement.expression.callee.name === localName);
382
+ };
383
+ const removeUnusedGoogleFontSourceEdits = (ast) => {
384
+ var _a;
385
+ var _b, _c;
386
+ const usedFonts = collectUsedFontFamilyNames(ast);
387
+ const loadFontLocalNamesToRemove = new Set();
388
+ for (const statement of ast.program.body) {
389
+ if (statement.type !== 'ImportDeclaration' ||
390
+ typeof statement.source.value !== 'string') {
391
+ continue;
392
+ }
393
+ const importName = getGoogleFontImportName(statement.source.value);
394
+ if (!importName) {
395
+ continue;
396
+ }
397
+ if (usedFonts.has(normalizeFontFamilyName(importName))) {
398
+ continue;
399
+ }
400
+ for (const specifier of (_b = statement.specifiers) !== null && _b !== void 0 ? _b : []) {
401
+ if (specifier.type === 'ImportSpecifier' &&
402
+ specifier.imported.type === 'Identifier' &&
403
+ specifier.imported.name === 'loadFont') {
404
+ loadFontLocalNamesToRemove.add((_c = (_a = specifier.local) === null || _a === void 0 ? void 0 : _a.name) !== null && _c !== void 0 ? _c : 'loadFont');
405
+ }
406
+ }
407
+ }
408
+ if (loadFontLocalNamesToRemove.size === 0) {
409
+ return;
410
+ }
411
+ ast.program.body = ast.program.body.filter((statement) => {
412
+ for (const localName of loadFontLocalNamesToRemove) {
413
+ if (isTopLevelCallToIdentifier({ statement, localName }) &&
414
+ hasStudioGeneratedGoogleFontLoadingComment(statement)) {
415
+ return false;
416
+ }
417
+ }
418
+ return true;
419
+ });
420
+ ast.program.body = ast.program.body.filter((statement) => {
421
+ var _a;
422
+ if (statement.type !== 'ImportDeclaration') {
423
+ return true;
424
+ }
425
+ statement.specifiers = ((_a = statement.specifiers) !== null && _a !== void 0 ? _a : []).filter((specifier) => {
426
+ var _a, _b;
427
+ var _c, _d;
428
+ return !(specifier.type === 'ImportSpecifier' &&
429
+ specifier.imported.type === 'Identifier' &&
430
+ specifier.imported.name === 'loadFont' &&
431
+ loadFontLocalNamesToRemove.has((_c = (_a = specifier.local) === null || _a === void 0 ? void 0 : _a.name) !== null && _c !== void 0 ? _c : 'loadFont') &&
432
+ !hasNonImportIdentifierReference({
433
+ ast,
434
+ name: (_d = (_b = specifier.local) === null || _b === void 0 ? void 0 : _b.name) !== null && _d !== void 0 ? _d : 'loadFont',
435
+ }));
436
+ });
437
+ return statement.specifiers.length > 0;
438
+ });
439
+ };
440
+ const insertLoadFontCall = ({ ast, font, localName, }) => {
441
+ if (hasTopLevelLoadFontCall({ ast, localName, font })) {
442
+ return;
443
+ }
444
+ const call = b.expressionStatement(b.callExpression(b.identifier(localName), [
445
+ b.stringLiteral(font.style),
446
+ b.objectExpression([
447
+ b.objectProperty(b.identifier('weights'), b.arrayExpression(font.weights.map((weight) => b.stringLiteral(weight)))),
448
+ b.objectProperty(b.identifier('subsets'), b.arrayExpression(font.subsets.map((subset) => b.stringLiteral(subset)))),
449
+ ]),
450
+ ]));
451
+ call.comments = [b.commentLine(` ${googleFontLoadingComment}`)];
452
+ insertAfterImportsOrDirectives(ast, call);
453
+ };
454
+ const applyGoogleFontSourceEdits = ({ ast, updates, }) => {
455
+ const fonts = new Map();
456
+ let hasFontFamilyUpdate = false;
457
+ for (const update of updates) {
458
+ if (update.key === 'style.fontFamily') {
459
+ hasFontFamilyUpdate = true;
460
+ }
461
+ if (update.googleFont) {
462
+ fonts.set(update.googleFont.importName, update.googleFont);
463
+ }
464
+ }
465
+ const usedNames = collectTopLevelIdentifierNames(ast);
466
+ for (const font of fonts.values()) {
467
+ const localName = ensureLoadFontImport({ ast, font, usedNames });
468
+ insertLoadFontCall({ ast, font, localName });
469
+ }
470
+ if (hasFontFamilyUpdate) {
471
+ removeUnusedGoogleFontSourceEdits(ast);
472
+ }
473
+ };
137
474
  const updateSequencePropsNode = ({ jsxElement, updates, schema, }) => {
138
475
  var _a, _b, _c;
139
476
  var _d, _e;
@@ -152,8 +489,9 @@ const updateSequencePropsNode = ({ jsxElement, updates, schema, }) => {
152
489
  oldValueStrings.push(oldValueString);
153
490
  continue;
154
491
  }
155
- const isDefault = defaultValue !== null &&
156
- JSON.stringify(value) === JSON.stringify(defaultValue);
492
+ const isDefault = (defaultValue === null && value === undefined) ||
493
+ (defaultValue !== null &&
494
+ JSON.stringify(value) === JSON.stringify(defaultValue));
157
495
  const dotIndex = key.indexOf('.');
158
496
  const isNested = dotIndex !== -1;
159
497
  const parentKey = isNested ? key.slice(0, dotIndex) : key;
@@ -261,6 +599,7 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
261
599
  updates,
262
600
  schema,
263
601
  });
602
+ applyGoogleFontSourceEdits({ ast, updates });
264
603
  return {
265
604
  serialized: (0, parse_ast_1.serializeAst)(ast),
266
605
  oldValueStrings,
@@ -271,13 +610,16 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
271
610
  exports.updateSequencePropsAst = updateSequencePropsAst;
272
611
  const updateMultipleSequenceProps = async ({ input, changes, prettierConfigOverride, }) => {
273
612
  const ast = (0, parse_ast_1.parseAst)(input);
613
+ const allUpdates = [];
274
614
  const results = changes.map(({ nodePath, updates, schema }) => {
275
615
  const jsxElement = (0, can_update_sequence_props_1.findJsxElementNodeAtNodePath)(ast, nodePath);
276
616
  if (!jsxElement) {
277
617
  throw new Error('Could not find a JSX element at the specified line to update');
278
618
  }
619
+ allUpdates.push(...updates);
279
620
  return updateSequencePropsNode({ jsxElement, updates, schema });
280
621
  });
622
+ applyGoogleFontSourceEdits({ ast, updates: allUpdates });
281
623
  const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
282
624
  input: (0, parse_ast_1.serializeAst)(ast),
283
625
  prettierConfigOverride,
@@ -49,6 +49,26 @@ const getUseCurrentFrameLocalNames = (ast) => {
49
49
  }
50
50
  return names;
51
51
  };
52
+ const getGoogleFontLoadFontLocalNames = (ast) => {
53
+ var _a;
54
+ var _b;
55
+ const names = new Set();
56
+ for (const statement of ast.program.body) {
57
+ if (statement.type !== 'ImportDeclaration' ||
58
+ typeof statement.source.value !== 'string' ||
59
+ !statement.source.value.startsWith('@remotion/google-fonts/')) {
60
+ continue;
61
+ }
62
+ for (const specifier of statement.specifiers) {
63
+ if (specifier.type === 'ImportSpecifier' &&
64
+ specifier.imported.type === 'Identifier' &&
65
+ specifier.imported.name === 'loadFont') {
66
+ names.add((_b = (_a = specifier.local) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'loadFont');
67
+ }
68
+ }
69
+ }
70
+ return names;
71
+ };
52
72
  const isUseCurrentFrameCall = (node, useCurrentFrameLocalNames) => {
53
73
  return ((node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' &&
54
74
  node.callee.type === 'Identifier' &&
@@ -63,13 +83,19 @@ const isUseCurrentFrameStatement = (node, useCurrentFrameLocalNames) => {
63
83
  }
64
84
  return isUseCurrentFrameCall(node.declarations[0].init, useCurrentFrameLocalNames);
65
85
  };
86
+ const isGoogleFontLoadFontStatement = (node, googleFontLoadFontLocalNames) => {
87
+ return (node.type === 'ExpressionStatement' &&
88
+ node.expression.type === 'CallExpression' &&
89
+ node.expression.callee.type === 'Identifier' &&
90
+ googleFontLoadFontLocalNames.has(node.expression.callee.name));
91
+ };
66
92
  const getIgnoredNodePredicate = (ast) => {
67
93
  const useCurrentFrameLocalNames = getUseCurrentFrameLocalNames(ast);
94
+ const googleFontLoadFontLocalNames = getGoogleFontLoadFontLocalNames(ast);
68
95
  return (node, { parent, property }) => {
69
- if (parent.type === 'Program' &&
70
- property === 'body' &&
71
- node.type === 'ImportDeclaration') {
72
- return true;
96
+ if (parent.type === 'Program' && property === 'body') {
97
+ return (node.type === 'ImportDeclaration' ||
98
+ isGoogleFontLoadFontStatement(node, googleFontLoadFontLocalNames));
73
99
  }
74
100
  if (parent.type === 'BlockStatement' && property === 'body') {
75
101
  return isUseCurrentFrameStatement(node, useCurrentFrameLocalNames);
@@ -0,0 +1,3 @@
1
+ import type { Expression } from '@babel/types';
2
+ import type { CanUpdateSequencePropStatusEasing } from 'remotion';
3
+ export declare const parseKeyframeEasingExpression: (node: Expression) => CanUpdateSequencePropStatusEasing | null;
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseKeyframeEasingExpression = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ const getNumericValue = (node) => {
6
+ if (node.type === 'NumericLiteral') {
7
+ return node.value;
8
+ }
9
+ if (node.type === 'UnaryExpression' &&
10
+ (node.operator === '-' || node.operator === '+') &&
11
+ node.argument.type === 'NumericLiteral') {
12
+ return node.operator === '-' ? -node.argument.value : node.argument.value;
13
+ }
14
+ if (node.type === 'TSAsExpression') {
15
+ return getNumericValue(node.expression);
16
+ }
17
+ return null;
18
+ };
19
+ const getExpressionArgument = (arg) => {
20
+ if (arg === undefined ||
21
+ arg.type === 'ArgumentPlaceholder' ||
22
+ arg.type === 'JSXNamespacedName' ||
23
+ arg.type === 'SpreadElement') {
24
+ return null;
25
+ }
26
+ return arg;
27
+ };
28
+ const getMemberExpressionKeyframeEasing = (name) => {
29
+ if (name === 'linear') {
30
+ return studio_shared_1.LINEAR_KEYFRAME_EASING;
31
+ }
32
+ if (name === 'ease') {
33
+ return studio_shared_1.EASE_KEYFRAME_EASING;
34
+ }
35
+ if (name === 'quad') {
36
+ return studio_shared_1.QUAD_KEYFRAME_EASING;
37
+ }
38
+ if (name === 'cubic') {
39
+ return studio_shared_1.CUBIC_KEYFRAME_EASING;
40
+ }
41
+ return null;
42
+ };
43
+ const parseKeyframeEasingExpression = (node) => {
44
+ if (node.type === 'TSAsExpression') {
45
+ return (0, exports.parseKeyframeEasingExpression)(node.expression);
46
+ }
47
+ if (node.type === 'MemberExpression' &&
48
+ node.object.type === 'Identifier' &&
49
+ node.object.name === 'Easing' &&
50
+ node.property.type === 'Identifier' &&
51
+ node.computed === false) {
52
+ return getMemberExpressionKeyframeEasing(node.property.name);
53
+ }
54
+ if (node.type !== 'CallExpression' ||
55
+ node.callee.type !== 'MemberExpression' ||
56
+ node.callee.object.type !== 'Identifier' ||
57
+ node.callee.object.name !== 'Easing' ||
58
+ node.callee.property.type !== 'Identifier' ||
59
+ node.callee.computed) {
60
+ return null;
61
+ }
62
+ const propertyName = node.callee.property.name;
63
+ if (propertyName === 'spring') {
64
+ if (node.arguments.length > 1) {
65
+ return null;
66
+ }
67
+ if (node.arguments.length === 0) {
68
+ return (0, studio_shared_1.parseSpringEasingConfig)(undefined);
69
+ }
70
+ const springConfig = getExpressionArgument(node.arguments[0]);
71
+ return springConfig ? (0, studio_shared_1.parseSpringEasingConfig)(springConfig) : null;
72
+ }
73
+ if (propertyName === 'bezier') {
74
+ if (node.arguments.length !== 4) {
75
+ return null;
76
+ }
77
+ const values = node.arguments.map((arg) => {
78
+ const expression = getExpressionArgument(arg);
79
+ return expression ? getNumericValue(expression) : null;
80
+ });
81
+ if (values.some((value) => value === null)) {
82
+ return null;
83
+ }
84
+ const [x1, y1, x2, y2] = values;
85
+ return { type: 'bezier', x1, y1, x2, y2 };
86
+ }
87
+ if (propertyName === 'back') {
88
+ if (node.arguments.length > 1) {
89
+ return null;
90
+ }
91
+ if (node.arguments.length === 0) {
92
+ return (0, studio_shared_1.getBackKeyframeEasing)();
93
+ }
94
+ const expression = getExpressionArgument(node.arguments[0]);
95
+ if (!expression) {
96
+ return null;
97
+ }
98
+ const s = getNumericValue(expression);
99
+ if (s === null) {
100
+ return null;
101
+ }
102
+ return (0, studio_shared_1.getBackKeyframeEasing)(s);
103
+ }
104
+ if (propertyName === 'poly') {
105
+ if (node.arguments.length !== 1) {
106
+ return null;
107
+ }
108
+ const expression = getExpressionArgument(node.arguments[0]);
109
+ const n = expression ? getNumericValue(expression) : null;
110
+ return n === null ? null : (0, studio_shared_1.getPolyKeyframeEasing)(n);
111
+ }
112
+ if (propertyName === 'in') {
113
+ if (node.arguments.length !== 1) {
114
+ return null;
115
+ }
116
+ const expression = getExpressionArgument(node.arguments[0]);
117
+ return expression ? (0, exports.parseKeyframeEasingExpression)(expression) : null;
118
+ }
119
+ if (propertyName === 'out') {
120
+ if (node.arguments.length !== 1) {
121
+ return null;
122
+ }
123
+ const expression = getExpressionArgument(node.arguments[0]);
124
+ const easing = expression
125
+ ? (0, exports.parseKeyframeEasingExpression)(expression)
126
+ : null;
127
+ return easing ? (0, studio_shared_1.getOutKeyframeEasing)(easing) : null;
128
+ }
129
+ if (propertyName === 'inOut') {
130
+ if (node.arguments.length !== 1) {
131
+ return null;
132
+ }
133
+ const expression = getExpressionArgument(node.arguments[0]);
134
+ const easing = expression
135
+ ? (0, exports.parseKeyframeEasingExpression)(expression)
136
+ : null;
137
+ return (easing === null || easing === void 0 ? void 0 : easing.type) === 'linear' ? easing : null;
138
+ }
139
+ return null;
140
+ };
141
+ exports.parseKeyframeEasingExpression = parseKeyframeEasingExpression;
@@ -29,7 +29,8 @@ export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositi
29
29
  dimensions: {
30
30
  width: number;
31
31
  height: number;
32
- };
32
+ } | null;
33
+ durationInFrames?: number | null | undefined;
33
34
  name: string | null;
34
35
  position: InsertableCompositionElementPosition | null;
35
36
  } | null | undefined;