@remotion/studio-shared 4.0.472 → 4.0.474

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  import type { AudioCodec, ChromeMode, Codec, ColorSpace, LogLevel, PixelFormat, StillImageFormat, VideoImageFormat, X264Preset } from '@remotion/renderer';
2
2
  import type { HardwareAccelerationOption } from '@remotion/renderer/client';
3
- import type { _InternalTypes, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, SequenceNodePath, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
3
+ import type { _InternalTypes, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, ExtrapolateType, SequenceNodePath, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
4
4
  import type { RecastCodemod, VisualControlChange } from './codemods';
5
- import type { EffectClipboardPasteType, EffectClipboardSnapshot } from './effect-clipboard-data';
5
+ import type { ComponentProp } from './component-drag-data';
6
+ import type { EffectClipboardParam, EffectClipboardPasteType, EffectClipboardSnapshot } from './effect-clipboard-data';
6
7
  import type { PackageManager } from './package-manager';
7
8
  import type { ProjectInfo } from './project-info';
8
9
  import type { CompletedClientRender, RequiredChromiumOptions } from './render-job';
@@ -164,6 +165,13 @@ export type DeleteStaticFileResponse = {
164
165
  success: boolean;
165
166
  existed: boolean;
166
167
  };
168
+ export type RenameStaticFileRequest = {
169
+ oldRelativePath: string;
170
+ newRelativePath: string;
171
+ };
172
+ export type RenameStaticFileResponse = {
173
+ success: boolean;
174
+ };
167
175
  export type CanUpdateDefaultPropsResponse = {
168
176
  canUpdate: true;
169
177
  currentDefaultProps: Record<string, unknown>;
@@ -220,8 +228,8 @@ export type SaveSequencePropEdit = {
220
228
  export type SaveSequencePropsRequest = {
221
229
  edits: SaveSequencePropEdit[];
222
230
  clientId: string;
223
- undoLabel: string | null;
224
- redoLabel: string | null;
231
+ undoLabel: string;
232
+ redoLabel: string;
225
233
  };
226
234
  export type SaveSequencePropsResult = {
227
235
  fileName: string;
@@ -236,16 +244,22 @@ export type SaveSequencePropsResponse = {
236
244
  canUpdate: false;
237
245
  reason: CannotUpdateSequenceReason;
238
246
  };
239
- export type SaveEffectPropsRequest = {
247
+ type SaveEffectPropsRequestBase = {
240
248
  fileName: string;
241
249
  sequenceNodePath: SequencePropsSubscriptionKey;
242
250
  effectIndex: number;
243
251
  key: string;
244
- value: string;
245
252
  defaultValue: string | null;
246
253
  schema: SequenceSchema;
247
254
  clientId: string;
248
255
  };
256
+ export type SaveEffectPropsRequest = (SaveEffectPropsRequestBase & {
257
+ type: 'value';
258
+ value: string;
259
+ }) | (SaveEffectPropsRequestBase & {
260
+ type: 'effect-param';
261
+ effectParam: EffectClipboardParam;
262
+ });
249
263
  export type SaveEffectPropsResponse = CanUpdateEffectPropsResponse;
250
264
  export type AddEffectRequest = {
251
265
  fileName: string;
@@ -276,6 +290,21 @@ export type ReorderEffectResponse = {
276
290
  reason: string;
277
291
  stack: string;
278
292
  };
293
+ export type ReorderSequencePosition = 'before' | 'after';
294
+ export type ReorderSequenceRequest = {
295
+ fileName: string;
296
+ sourceNodePath: SequencePropsSubscriptionKey;
297
+ targetNodePath: SequencePropsSubscriptionKey;
298
+ position: ReorderSequencePosition;
299
+ clientId: string;
300
+ };
301
+ export type ReorderSequenceResponse = {
302
+ success: true;
303
+ } | {
304
+ success: false;
305
+ reason: string;
306
+ stack: string;
307
+ };
279
308
  export type DeleteSequenceKeyframe = {
280
309
  fileName: string;
281
310
  nodePath: SequencePropsSubscriptionKey;
@@ -283,6 +312,14 @@ export type DeleteSequenceKeyframe = {
283
312
  frame: number;
284
313
  schema: SequenceSchema;
285
314
  };
315
+ export type MoveSequenceKeyframe = {
316
+ fileName: string;
317
+ nodePath: SequencePropsSubscriptionKey;
318
+ key: string;
319
+ fromFrame: number;
320
+ toFrame: number;
321
+ schema: SequenceSchema;
322
+ };
286
323
  export type AddSequenceKeyframeRequest = {
287
324
  fileName: string;
288
325
  nodePath: SequencePropsSubscriptionKey;
@@ -301,6 +338,15 @@ export type DeleteEffectKeyframe = {
301
338
  frame: number;
302
339
  schema: SequenceSchema;
303
340
  };
341
+ export type MoveEffectKeyframe = {
342
+ fileName: string;
343
+ sequenceNodePath: SequencePropsSubscriptionKey;
344
+ effectIndex: number;
345
+ key: string;
346
+ fromFrame: number;
347
+ toFrame: number;
348
+ schema: SequenceSchema;
349
+ };
304
350
  export type DeleteKeyframesRequest = {
305
351
  sequenceKeyframes: DeleteSequenceKeyframe[];
306
352
  effectKeyframes: DeleteEffectKeyframe[];
@@ -309,6 +355,14 @@ export type DeleteKeyframesRequest = {
309
355
  export type DeleteKeyframesResponse = {
310
356
  success: true;
311
357
  };
358
+ export type MoveKeyframesRequest = {
359
+ sequenceKeyframes: MoveSequenceKeyframe[];
360
+ effectKeyframes: MoveEffectKeyframe[];
361
+ clientId: string;
362
+ };
363
+ export type MoveKeyframesResponse = {
364
+ success: true;
365
+ };
312
366
  export type AddEffectKeyframeRequest = {
313
367
  fileName: string;
314
368
  sequenceNodePath: SequencePropsSubscriptionKey;
@@ -320,6 +374,32 @@ export type AddEffectKeyframeRequest = {
320
374
  clientId: string;
321
375
  };
322
376
  export type AddEffectKeyframeResponse = SaveEffectPropsResponse;
377
+ export type KeyframeSettings = {
378
+ clamping: {
379
+ left: ExtrapolateType;
380
+ right: ExtrapolateType;
381
+ } | undefined;
382
+ posterize: number | undefined;
383
+ };
384
+ export type UpdateSequenceKeyframeSettingsRequest = {
385
+ fileName: string;
386
+ nodePath: SequencePropsSubscriptionKey;
387
+ key: string;
388
+ settings: KeyframeSettings;
389
+ schema: SequenceSchema;
390
+ clientId: string;
391
+ };
392
+ export type UpdateSequenceKeyframeSettingsResponse = SaveSequencePropsResponse;
393
+ export type UpdateEffectKeyframeSettingsRequest = {
394
+ fileName: string;
395
+ sequenceNodePath: SequencePropsSubscriptionKey;
396
+ effectIndex: number;
397
+ key: string;
398
+ settings: KeyframeSettings;
399
+ schema: SequenceSchema;
400
+ clientId: string;
401
+ };
402
+ export type UpdateEffectKeyframeSettingsResponse = SaveEffectPropsResponse;
323
403
  type BaseDeleteEffectRequestItem = {
324
404
  fileName: string;
325
405
  sequenceNodePath: SequencePropsSubscriptionKey;
@@ -381,10 +461,17 @@ export type InsertableCompositionElement = {
381
461
  type: 'solid';
382
462
  width: number;
383
463
  height: number;
464
+ } | {
465
+ type: 'component';
466
+ componentName: string;
467
+ importName: string;
468
+ importPath: string;
469
+ props: ComponentProp[];
384
470
  } | {
385
471
  type: 'asset';
386
- assetType: 'image' | 'video' | 'gif';
472
+ assetType: 'image' | 'video' | 'gif' | 'audio';
387
473
  src: string;
474
+ srcType: 'static' | 'remote';
388
475
  dimensions: {
389
476
  width: number;
390
477
  height: number;
@@ -402,6 +489,15 @@ export type InsertJsxElementResponse = {
402
489
  reason: string;
403
490
  stack: string;
404
491
  };
492
+ export type DownloadRemoteAssetRequest = {
493
+ url: string;
494
+ };
495
+ export type DownloadRemoteAssetResponse = {
496
+ assetPath: string;
497
+ sizeInBytes: number;
498
+ created: boolean;
499
+ element: InsertableCompositionElement;
500
+ };
405
501
  export type UpdateAvailableRequest = {};
406
502
  export type UpdateAvailableResponse = {
407
503
  currentVersion: string;
@@ -434,6 +530,13 @@ export type RedoResponse = {
434
530
  success: false;
435
531
  reason: string;
436
532
  };
533
+ export type LogStudioErrorRequest = {
534
+ name: string | null;
535
+ message: string;
536
+ stack: string | null;
537
+ symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
538
+ };
539
+ export type LogStudioErrorResponse = {};
437
540
  export type ApiRoutes = {
438
541
  '/api/composition-component-info': ReqAndRes<CompositionComponentInfoRequest, CompositionComponentInfoResponse>;
439
542
  '/api/cancel': ReqAndRes<CancelRenderRequest, CancelRenderResponse>;
@@ -457,21 +560,28 @@ export type ApiRoutes = {
457
560
  '/api/save-effect-props': ReqAndRes<SaveEffectPropsRequest, SaveEffectPropsResponse>;
458
561
  '/api/add-effect': ReqAndRes<AddEffectRequest, AddEffectResponse>;
459
562
  '/api/reorder-effect': ReqAndRes<ReorderEffectRequest, ReorderEffectResponse>;
563
+ '/api/reorder-sequence': ReqAndRes<ReorderSequenceRequest, ReorderSequenceResponse>;
460
564
  '/api/delete-keyframes': ReqAndRes<DeleteKeyframesRequest, DeleteKeyframesResponse>;
565
+ '/api/move-keyframes': ReqAndRes<MoveKeyframesRequest, MoveKeyframesResponse>;
461
566
  '/api/add-sequence-keyframe': ReqAndRes<AddSequenceKeyframeRequest, AddSequenceKeyframeResponse>;
462
567
  '/api/add-effect-keyframe': ReqAndRes<AddEffectKeyframeRequest, AddEffectKeyframeResponse>;
568
+ '/api/update-sequence-keyframe-settings': ReqAndRes<UpdateSequenceKeyframeSettingsRequest, UpdateSequenceKeyframeSettingsResponse>;
569
+ '/api/update-effect-keyframe-settings': ReqAndRes<UpdateEffectKeyframeSettingsRequest, UpdateEffectKeyframeSettingsResponse>;
463
570
  '/api/delete-effect': ReqAndRes<DeleteEffectRequest, DeleteEffectResponse>;
464
571
  '/api/paste-effects': ReqAndRes<PasteEffectsRequest, PasteEffectsResponse>;
465
572
  '/api/delete-jsx-node': ReqAndRes<DeleteJsxNodeRequest, DeleteJsxNodeResponse>;
466
573
  '/api/duplicate-jsx-node': ReqAndRes<DuplicateJsxNodeRequest, DuplicateJsxNodeResponse>;
467
574
  '/api/insert-jsx-element': ReqAndRes<InsertJsxElementRequest, InsertJsxElementResponse>;
575
+ '/api/download-remote-asset': ReqAndRes<DownloadRemoteAssetRequest, DownloadRemoteAssetResponse>;
468
576
  '/api/update-available': ReqAndRes<UpdateAvailableRequest, UpdateAvailableResponse>;
469
577
  '/api/apply-codemod': ReqAndRes<ApplyCodemodRequest, ApplyCodemodResponse>;
470
578
  '/api/project-info': ReqAndRes<ProjectInfoRequest, ProjectInfoResponse>;
471
579
  '/api/delete-static-file': ReqAndRes<DeleteStaticFileRequest, DeleteStaticFileResponse>;
580
+ '/api/rename-static-file': ReqAndRes<RenameStaticFileRequest, RenameStaticFileResponse>;
472
581
  '/api/restart-studio': ReqAndRes<RestartStudioRequest, RestartStudioResponse>;
473
582
  '/api/install-package': ReqAndRes<InstallPackageRequest, InstallPackageResponse>;
474
583
  '/api/undo': ReqAndRes<UndoRequest, UndoResponse>;
475
584
  '/api/redo': ReqAndRes<RedoRequest, RedoResponse>;
585
+ '/api/log-studio-error': ReqAndRes<LogStudioErrorRequest, LogStudioErrorResponse>;
476
586
  };
477
587
  export {};
@@ -0,0 +1,8 @@
1
+ export declare const ASSET_DRAG_MIME_TYPE = "application/vnd.remotion.asset+json";
2
+ export type AssetDragData = {
3
+ type: 'remotion-asset';
4
+ version: 1;
5
+ assetPath: string;
6
+ };
7
+ export declare const makeAssetDragData: (assetPath: string) => AssetDragData;
8
+ export declare const parseAssetDragData: (value: string) => AssetDragData | null;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAssetDragData = exports.makeAssetDragData = exports.ASSET_DRAG_MIME_TYPE = void 0;
4
+ exports.ASSET_DRAG_MIME_TYPE = 'application/vnd.remotion.asset+json';
5
+ const isRecord = (value) => {
6
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
7
+ };
8
+ const makeAssetDragData = (assetPath) => {
9
+ return {
10
+ type: 'remotion-asset',
11
+ version: 1,
12
+ assetPath,
13
+ };
14
+ };
15
+ exports.makeAssetDragData = makeAssetDragData;
16
+ const parseAssetDragData = (value) => {
17
+ try {
18
+ const parsed = JSON.parse(value);
19
+ if (!isRecord(parsed)) {
20
+ return null;
21
+ }
22
+ if (parsed.type !== 'remotion-asset' || parsed.version !== 1) {
23
+ return null;
24
+ }
25
+ if (typeof parsed.assetPath !== 'string' || parsed.assetPath.length === 0) {
26
+ return null;
27
+ }
28
+ return {
29
+ type: 'remotion-asset',
30
+ version: 1,
31
+ assetPath: parsed.assetPath,
32
+ };
33
+ }
34
+ catch (_a) {
35
+ return null;
36
+ }
37
+ };
38
+ exports.parseAssetDragData = parseAssetDragData;
@@ -0,0 +1,27 @@
1
+ export declare const COMPONENT_DRAG_MIME_TYPE = "application/vnd.remotion.component+json";
2
+ export type ComponentProp = {
3
+ name: string;
4
+ value: string | number | boolean;
5
+ };
6
+ export type ComponentDragData = {
7
+ type: 'remotion-component';
8
+ version: 1;
9
+ component: {
10
+ componentName: string;
11
+ importName: string;
12
+ importPath: string;
13
+ props: ComponentProp[];
14
+ };
15
+ };
16
+ export declare const isComponentIdentifier: (value: unknown) => value is string;
17
+ export declare const isComponentImportPath: (value: unknown) => value is string;
18
+ export declare const isComponentPropName: (value: unknown) => value is string;
19
+ export declare const isComponentProp: (value: unknown) => value is ComponentProp;
20
+ export declare const areComponentProps: (value: unknown) => value is ComponentProp[];
21
+ export declare const makeComponentDragData: ({ componentName, importName, importPath, props, }: {
22
+ componentName: string;
23
+ importName: string;
24
+ importPath: string;
25
+ props: ComponentProp[];
26
+ }) => ComponentDragData;
27
+ export declare const parseComponentDragData: (value: string) => ComponentDragData | null;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseComponentDragData = exports.makeComponentDragData = exports.areComponentProps = exports.isComponentProp = exports.isComponentPropName = exports.isComponentImportPath = exports.isComponentIdentifier = exports.COMPONENT_DRAG_MIME_TYPE = void 0;
4
+ exports.COMPONENT_DRAG_MIME_TYPE = 'application/vnd.remotion.component+json';
5
+ const isRecord = (value) => {
6
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
7
+ };
8
+ const isComponentIdentifier = (value) => {
9
+ return typeof value === 'string' && /^[A-Z_$][A-Za-z0-9_$]*$/.test(value);
10
+ };
11
+ exports.isComponentIdentifier = isComponentIdentifier;
12
+ const isComponentImportPath = (value) => {
13
+ return (typeof value === 'string' &&
14
+ value.length > 0 &&
15
+ value.length < 200 &&
16
+ !value.includes('\\') &&
17
+ !value.includes('\0') &&
18
+ !value.startsWith('/') &&
19
+ /^[A-Za-z0-9@._/-]+$/.test(value));
20
+ };
21
+ exports.isComponentImportPath = isComponentImportPath;
22
+ const isComponentPropName = (value) => {
23
+ return (typeof value === 'string' &&
24
+ value !== 'style' &&
25
+ /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value));
26
+ };
27
+ exports.isComponentPropName = isComponentPropName;
28
+ const isComponentProp = (value) => {
29
+ if (!isRecord(value)) {
30
+ return false;
31
+ }
32
+ if (!(0, exports.isComponentPropName)(value.name)) {
33
+ return false;
34
+ }
35
+ return (typeof value.value === 'string' ||
36
+ typeof value.value === 'boolean' ||
37
+ (typeof value.value === 'number' && Number.isFinite(value.value)));
38
+ };
39
+ exports.isComponentProp = isComponentProp;
40
+ const areComponentProps = (value) => {
41
+ if (!Array.isArray(value)) {
42
+ return false;
43
+ }
44
+ const seen = new Set();
45
+ for (const prop of value) {
46
+ if (!(0, exports.isComponentProp)(prop) || seen.has(prop.name)) {
47
+ return false;
48
+ }
49
+ seen.add(prop.name);
50
+ }
51
+ return true;
52
+ };
53
+ exports.areComponentProps = areComponentProps;
54
+ const makeComponentDragData = ({ componentName, importName, importPath, props, }) => {
55
+ return {
56
+ type: 'remotion-component',
57
+ version: 1,
58
+ component: {
59
+ componentName,
60
+ importName,
61
+ importPath,
62
+ props,
63
+ },
64
+ };
65
+ };
66
+ exports.makeComponentDragData = makeComponentDragData;
67
+ const parseComponentDragData = (value) => {
68
+ try {
69
+ const parsed = JSON.parse(value);
70
+ if (!isRecord(parsed)) {
71
+ return null;
72
+ }
73
+ if (parsed.type !== 'remotion-component' || parsed.version !== 1) {
74
+ return null;
75
+ }
76
+ if (!isRecord(parsed.component)) {
77
+ return null;
78
+ }
79
+ const { componentName, importName, importPath, props } = parsed.component;
80
+ if (!(0, exports.isComponentIdentifier)(componentName) ||
81
+ !(0, exports.isComponentIdentifier)(importName) ||
82
+ !(0, exports.isComponentImportPath)(importPath) ||
83
+ !(0, exports.areComponentProps)(props)) {
84
+ return null;
85
+ }
86
+ return {
87
+ type: 'remotion-component',
88
+ version: 1,
89
+ component: {
90
+ componentName,
91
+ importName,
92
+ importPath,
93
+ props,
94
+ },
95
+ };
96
+ }
97
+ catch (_a) {
98
+ return null;
99
+ }
100
+ };
101
+ exports.parseComponentDragData = parseComponentDragData;
@@ -0,0 +1,71 @@
1
+ export type FileDimensions = {
2
+ readonly width: number;
3
+ readonly height: number;
4
+ };
5
+ export declare const matchesPattern: (pattern: Uint8Array<ArrayBufferLike>) => (data: Uint8Array<ArrayBufferLike>) => boolean;
6
+ export declare const isRiffAvi: (data: Uint8Array<ArrayBufferLike>) => boolean;
7
+ export declare const isRiffWave: (data: Uint8Array<ArrayBufferLike>) => boolean;
8
+ export declare const isWebm: (data: Uint8Array<ArrayBufferLike>) => boolean;
9
+ export declare const isIsoBaseMedia: (data: Uint8Array<ArrayBufferLike>) => boolean;
10
+ export declare const isTransportStream: (data: Uint8Array<ArrayBufferLike>) => boolean;
11
+ export declare const isMp3: (data: Uint8Array<ArrayBufferLike>) => boolean;
12
+ export declare const isAac: (data: Uint8Array<ArrayBufferLike>) => boolean;
13
+ export declare const isFlac: (data: Uint8Array<ArrayBufferLike>) => boolean;
14
+ export declare const isM3u: (data: Uint8Array<ArrayBufferLike>) => boolean;
15
+ export type RiffType = {
16
+ type: 'riff';
17
+ };
18
+ export type WebmType = {
19
+ type: 'webm';
20
+ };
21
+ export type IsoBaseMediaType = {
22
+ type: 'iso-base-media';
23
+ };
24
+ export type TransportStreamType = {
25
+ type: 'transport-stream';
26
+ };
27
+ export type Mp3Type = {
28
+ type: 'mp3';
29
+ };
30
+ export type AacType = {
31
+ type: 'aac';
32
+ };
33
+ export type WavType = {
34
+ type: 'wav';
35
+ };
36
+ export type GifType = {
37
+ type: 'gif';
38
+ dimensions: FileDimensions | null;
39
+ };
40
+ export type FlacType = {
41
+ type: 'flac';
42
+ };
43
+ export type M3uType = {
44
+ type: 'm3u';
45
+ };
46
+ export type PngType = {
47
+ type: 'png';
48
+ dimensions: FileDimensions | null;
49
+ };
50
+ export type JpegType = {
51
+ type: 'jpeg';
52
+ dimensions: FileDimensions | null;
53
+ };
54
+ export type WebpType = {
55
+ type: 'webp';
56
+ dimensions: FileDimensions | null;
57
+ };
58
+ export type BmpType = {
59
+ type: 'bmp';
60
+ dimensions: FileDimensions | null;
61
+ };
62
+ export type PdfType = {
63
+ type: 'pdf';
64
+ };
65
+ export type UnknownType = {
66
+ type: 'unknown';
67
+ };
68
+ export type FileType = JpegType | WebpType | RiffType | WebmType | WavType | PdfType | AacType | IsoBaseMediaType | TransportStreamType | Mp3Type | GifType | PngType | BmpType | AacType | FlacType | M3uType | UnknownType;
69
+ export type ImageFileType = JpegType | WebpType | GifType | PngType | BmpType;
70
+ export declare const isImageFileType: (fileType: FileType) => fileType is ImageFileType;
71
+ export declare const detectFileType: (data: Uint8Array<ArrayBufferLike>) => FileType;