@remotion/studio-shared 4.0.472 → 4.0.473

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,8 @@
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 { EffectClipboardParam, EffectClipboardPasteType, EffectClipboardSnapshot } from './effect-clipboard-data';
6
6
  import type { PackageManager } from './package-manager';
7
7
  import type { ProjectInfo } from './project-info';
8
8
  import type { CompletedClientRender, RequiredChromiumOptions } from './render-job';
@@ -164,6 +164,13 @@ export type DeleteStaticFileResponse = {
164
164
  success: boolean;
165
165
  existed: boolean;
166
166
  };
167
+ export type RenameStaticFileRequest = {
168
+ oldRelativePath: string;
169
+ newRelativePath: string;
170
+ };
171
+ export type RenameStaticFileResponse = {
172
+ success: boolean;
173
+ };
167
174
  export type CanUpdateDefaultPropsResponse = {
168
175
  canUpdate: true;
169
176
  currentDefaultProps: Record<string, unknown>;
@@ -220,8 +227,8 @@ export type SaveSequencePropEdit = {
220
227
  export type SaveSequencePropsRequest = {
221
228
  edits: SaveSequencePropEdit[];
222
229
  clientId: string;
223
- undoLabel: string | null;
224
- redoLabel: string | null;
230
+ undoLabel: string;
231
+ redoLabel: string;
225
232
  };
226
233
  export type SaveSequencePropsResult = {
227
234
  fileName: string;
@@ -236,16 +243,22 @@ export type SaveSequencePropsResponse = {
236
243
  canUpdate: false;
237
244
  reason: CannotUpdateSequenceReason;
238
245
  };
239
- export type SaveEffectPropsRequest = {
246
+ type SaveEffectPropsRequestBase = {
240
247
  fileName: string;
241
248
  sequenceNodePath: SequencePropsSubscriptionKey;
242
249
  effectIndex: number;
243
250
  key: string;
244
- value: string;
245
251
  defaultValue: string | null;
246
252
  schema: SequenceSchema;
247
253
  clientId: string;
248
254
  };
255
+ export type SaveEffectPropsRequest = (SaveEffectPropsRequestBase & {
256
+ type: 'value';
257
+ value: string;
258
+ }) | (SaveEffectPropsRequestBase & {
259
+ type: 'effect-param';
260
+ effectParam: EffectClipboardParam;
261
+ });
249
262
  export type SaveEffectPropsResponse = CanUpdateEffectPropsResponse;
250
263
  export type AddEffectRequest = {
251
264
  fileName: string;
@@ -276,6 +289,21 @@ export type ReorderEffectResponse = {
276
289
  reason: string;
277
290
  stack: string;
278
291
  };
292
+ export type ReorderSequencePosition = 'before' | 'after';
293
+ export type ReorderSequenceRequest = {
294
+ fileName: string;
295
+ sourceNodePath: SequencePropsSubscriptionKey;
296
+ targetNodePath: SequencePropsSubscriptionKey;
297
+ position: ReorderSequencePosition;
298
+ clientId: string;
299
+ };
300
+ export type ReorderSequenceResponse = {
301
+ success: true;
302
+ } | {
303
+ success: false;
304
+ reason: string;
305
+ stack: string;
306
+ };
279
307
  export type DeleteSequenceKeyframe = {
280
308
  fileName: string;
281
309
  nodePath: SequencePropsSubscriptionKey;
@@ -283,6 +311,14 @@ export type DeleteSequenceKeyframe = {
283
311
  frame: number;
284
312
  schema: SequenceSchema;
285
313
  };
314
+ export type MoveSequenceKeyframe = {
315
+ fileName: string;
316
+ nodePath: SequencePropsSubscriptionKey;
317
+ key: string;
318
+ fromFrame: number;
319
+ toFrame: number;
320
+ schema: SequenceSchema;
321
+ };
286
322
  export type AddSequenceKeyframeRequest = {
287
323
  fileName: string;
288
324
  nodePath: SequencePropsSubscriptionKey;
@@ -301,6 +337,15 @@ export type DeleteEffectKeyframe = {
301
337
  frame: number;
302
338
  schema: SequenceSchema;
303
339
  };
340
+ export type MoveEffectKeyframe = {
341
+ fileName: string;
342
+ sequenceNodePath: SequencePropsSubscriptionKey;
343
+ effectIndex: number;
344
+ key: string;
345
+ fromFrame: number;
346
+ toFrame: number;
347
+ schema: SequenceSchema;
348
+ };
304
349
  export type DeleteKeyframesRequest = {
305
350
  sequenceKeyframes: DeleteSequenceKeyframe[];
306
351
  effectKeyframes: DeleteEffectKeyframe[];
@@ -309,6 +354,14 @@ export type DeleteKeyframesRequest = {
309
354
  export type DeleteKeyframesResponse = {
310
355
  success: true;
311
356
  };
357
+ export type MoveKeyframesRequest = {
358
+ sequenceKeyframes: MoveSequenceKeyframe[];
359
+ effectKeyframes: MoveEffectKeyframe[];
360
+ clientId: string;
361
+ };
362
+ export type MoveKeyframesResponse = {
363
+ success: true;
364
+ };
312
365
  export type AddEffectKeyframeRequest = {
313
366
  fileName: string;
314
367
  sequenceNodePath: SequencePropsSubscriptionKey;
@@ -320,6 +373,32 @@ export type AddEffectKeyframeRequest = {
320
373
  clientId: string;
321
374
  };
322
375
  export type AddEffectKeyframeResponse = SaveEffectPropsResponse;
376
+ export type KeyframeSettings = {
377
+ clamping: {
378
+ left: ExtrapolateType;
379
+ right: ExtrapolateType;
380
+ } | undefined;
381
+ posterize: number | undefined;
382
+ };
383
+ export type UpdateSequenceKeyframeSettingsRequest = {
384
+ fileName: string;
385
+ nodePath: SequencePropsSubscriptionKey;
386
+ key: string;
387
+ settings: KeyframeSettings;
388
+ schema: SequenceSchema;
389
+ clientId: string;
390
+ };
391
+ export type UpdateSequenceKeyframeSettingsResponse = SaveSequencePropsResponse;
392
+ export type UpdateEffectKeyframeSettingsRequest = {
393
+ fileName: string;
394
+ sequenceNodePath: SequencePropsSubscriptionKey;
395
+ effectIndex: number;
396
+ key: string;
397
+ settings: KeyframeSettings;
398
+ schema: SequenceSchema;
399
+ clientId: string;
400
+ };
401
+ export type UpdateEffectKeyframeSettingsResponse = SaveEffectPropsResponse;
323
402
  type BaseDeleteEffectRequestItem = {
324
403
  fileName: string;
325
404
  sequenceNodePath: SequencePropsSubscriptionKey;
@@ -383,7 +462,7 @@ export type InsertableCompositionElement = {
383
462
  height: number;
384
463
  } | {
385
464
  type: 'asset';
386
- assetType: 'image' | 'video' | 'gif';
465
+ assetType: 'image' | 'video' | 'gif' | 'audio';
387
466
  src: string;
388
467
  dimensions: {
389
468
  width: number;
@@ -402,6 +481,15 @@ export type InsertJsxElementResponse = {
402
481
  reason: string;
403
482
  stack: string;
404
483
  };
484
+ export type DownloadRemoteAssetRequest = {
485
+ url: string;
486
+ };
487
+ export type DownloadRemoteAssetResponse = {
488
+ assetPath: string;
489
+ sizeInBytes: number;
490
+ created: boolean;
491
+ element: InsertableCompositionElement;
492
+ };
405
493
  export type UpdateAvailableRequest = {};
406
494
  export type UpdateAvailableResponse = {
407
495
  currentVersion: string;
@@ -434,6 +522,13 @@ export type RedoResponse = {
434
522
  success: false;
435
523
  reason: string;
436
524
  };
525
+ export type LogStudioErrorRequest = {
526
+ name: string | null;
527
+ message: string;
528
+ stack: string | null;
529
+ symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
530
+ };
531
+ export type LogStudioErrorResponse = {};
437
532
  export type ApiRoutes = {
438
533
  '/api/composition-component-info': ReqAndRes<CompositionComponentInfoRequest, CompositionComponentInfoResponse>;
439
534
  '/api/cancel': ReqAndRes<CancelRenderRequest, CancelRenderResponse>;
@@ -457,21 +552,28 @@ export type ApiRoutes = {
457
552
  '/api/save-effect-props': ReqAndRes<SaveEffectPropsRequest, SaveEffectPropsResponse>;
458
553
  '/api/add-effect': ReqAndRes<AddEffectRequest, AddEffectResponse>;
459
554
  '/api/reorder-effect': ReqAndRes<ReorderEffectRequest, ReorderEffectResponse>;
555
+ '/api/reorder-sequence': ReqAndRes<ReorderSequenceRequest, ReorderSequenceResponse>;
460
556
  '/api/delete-keyframes': ReqAndRes<DeleteKeyframesRequest, DeleteKeyframesResponse>;
557
+ '/api/move-keyframes': ReqAndRes<MoveKeyframesRequest, MoveKeyframesResponse>;
461
558
  '/api/add-sequence-keyframe': ReqAndRes<AddSequenceKeyframeRequest, AddSequenceKeyframeResponse>;
462
559
  '/api/add-effect-keyframe': ReqAndRes<AddEffectKeyframeRequest, AddEffectKeyframeResponse>;
560
+ '/api/update-sequence-keyframe-settings': ReqAndRes<UpdateSequenceKeyframeSettingsRequest, UpdateSequenceKeyframeSettingsResponse>;
561
+ '/api/update-effect-keyframe-settings': ReqAndRes<UpdateEffectKeyframeSettingsRequest, UpdateEffectKeyframeSettingsResponse>;
463
562
  '/api/delete-effect': ReqAndRes<DeleteEffectRequest, DeleteEffectResponse>;
464
563
  '/api/paste-effects': ReqAndRes<PasteEffectsRequest, PasteEffectsResponse>;
465
564
  '/api/delete-jsx-node': ReqAndRes<DeleteJsxNodeRequest, DeleteJsxNodeResponse>;
466
565
  '/api/duplicate-jsx-node': ReqAndRes<DuplicateJsxNodeRequest, DuplicateJsxNodeResponse>;
467
566
  '/api/insert-jsx-element': ReqAndRes<InsertJsxElementRequest, InsertJsxElementResponse>;
567
+ '/api/download-remote-asset': ReqAndRes<DownloadRemoteAssetRequest, DownloadRemoteAssetResponse>;
468
568
  '/api/update-available': ReqAndRes<UpdateAvailableRequest, UpdateAvailableResponse>;
469
569
  '/api/apply-codemod': ReqAndRes<ApplyCodemodRequest, ApplyCodemodResponse>;
470
570
  '/api/project-info': ReqAndRes<ProjectInfoRequest, ProjectInfoResponse>;
471
571
  '/api/delete-static-file': ReqAndRes<DeleteStaticFileRequest, DeleteStaticFileResponse>;
572
+ '/api/rename-static-file': ReqAndRes<RenameStaticFileRequest, RenameStaticFileResponse>;
472
573
  '/api/restart-studio': ReqAndRes<RestartStudioRequest, RestartStudioResponse>;
473
574
  '/api/install-package': ReqAndRes<InstallPackageRequest, InstallPackageResponse>;
474
575
  '/api/undo': ReqAndRes<UndoRequest, UndoResponse>;
475
576
  '/api/redo': ReqAndRes<RedoRequest, RedoResponse>;
577
+ '/api/log-studio-error': ReqAndRes<LogStudioErrorRequest, LogStudioErrorResponse>;
476
578
  };
477
579
  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,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;
@@ -0,0 +1,295 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectFileType = exports.isImageFileType = exports.isM3u = exports.isFlac = exports.isAac = exports.isMp3 = exports.isTransportStream = exports.isIsoBaseMedia = exports.isWebm = exports.isRiffWave = exports.isRiffAvi = exports.matchesPattern = void 0;
4
+ const webmPattern = new Uint8Array([0x1a, 0x45, 0xdf, 0xa3]);
5
+ const matchesPattern = (pattern) => {
6
+ return (data) => {
7
+ return pattern.every((value, index) => data[index] === value);
8
+ };
9
+ };
10
+ exports.matchesPattern = matchesPattern;
11
+ const isRiffAvi = (data) => {
12
+ const riffPattern = new Uint8Array([0x52, 0x49, 0x46, 0x46]);
13
+ if (!(0, exports.matchesPattern)(riffPattern)(data.subarray(0, 4))) {
14
+ return false;
15
+ }
16
+ const fileType = data.subarray(8, 12);
17
+ const aviPattern = new Uint8Array([0x41, 0x56, 0x49, 0x20]);
18
+ return (0, exports.matchesPattern)(aviPattern)(fileType);
19
+ };
20
+ exports.isRiffAvi = isRiffAvi;
21
+ const isRiffWave = (data) => {
22
+ const riffPattern = new Uint8Array([0x52, 0x49, 0x46, 0x46]);
23
+ if (!(0, exports.matchesPattern)(riffPattern)(data.subarray(0, 4))) {
24
+ return false;
25
+ }
26
+ const fileType = data.subarray(8, 12);
27
+ const wavePattern = new Uint8Array([0x57, 0x41, 0x56, 0x45]);
28
+ return (0, exports.matchesPattern)(wavePattern)(fileType);
29
+ };
30
+ exports.isRiffWave = isRiffWave;
31
+ const isWebm = (data) => {
32
+ return (0, exports.matchesPattern)(webmPattern)(data.subarray(0, 4));
33
+ };
34
+ exports.isWebm = isWebm;
35
+ const isIsoBaseMedia = (data) => {
36
+ const isoBaseMediaMp4Pattern = new TextEncoder().encode('ftyp');
37
+ return (0, exports.matchesPattern)(isoBaseMediaMp4Pattern)(data.subarray(4, 8));
38
+ };
39
+ exports.isIsoBaseMedia = isIsoBaseMedia;
40
+ const isTransportStream = (data) => {
41
+ return data[0] === 0x47 && data[188] === 0x47;
42
+ };
43
+ exports.isTransportStream = isTransportStream;
44
+ const isMp3 = (data) => {
45
+ const mpegPattern = new Uint8Array([0xff, 0xf3]);
46
+ const mpegPattern2 = new Uint8Array([0xff, 0xfb]);
47
+ const id3v4Pattern = new Uint8Array([0x49, 0x44, 0x33, 4]);
48
+ const id3v3Pattern = new Uint8Array([0x49, 0x44, 0x33, 3]);
49
+ const id3v2Pattern = new Uint8Array([0x49, 0x44, 0x33, 2]);
50
+ const subarray = data.subarray(0, 4);
51
+ return ((0, exports.matchesPattern)(mpegPattern)(subarray) ||
52
+ (0, exports.matchesPattern)(mpegPattern2)(subarray) ||
53
+ (0, exports.matchesPattern)(id3v4Pattern)(subarray) ||
54
+ (0, exports.matchesPattern)(id3v3Pattern)(subarray) ||
55
+ (0, exports.matchesPattern)(id3v2Pattern)(subarray));
56
+ };
57
+ exports.isMp3 = isMp3;
58
+ const isAac = (data) => {
59
+ const aacPattern = new Uint8Array([0xff, 0xf1]);
60
+ return (0, exports.matchesPattern)(aacPattern)(data.subarray(0, 2));
61
+ };
62
+ exports.isAac = isAac;
63
+ const isFlac = (data) => {
64
+ const flacPattern = new Uint8Array([0x66, 0x4c, 0x61, 0x43]);
65
+ return (0, exports.matchesPattern)(flacPattern)(data.subarray(0, 4));
66
+ };
67
+ exports.isFlac = isFlac;
68
+ const isM3u = (data) => {
69
+ return new TextDecoder('utf-8').decode(data.slice(0, 7)) === '#EXTM3U';
70
+ };
71
+ exports.isM3u = isM3u;
72
+ const getPngDimensions = (pngData) => {
73
+ if (pngData.length < 24) {
74
+ return null;
75
+ }
76
+ const view = new DataView(pngData.buffer, pngData.byteOffset);
77
+ const pngSignature = [137, 80, 78, 71, 13, 10, 26, 10];
78
+ for (let i = 0; i < 8; i++) {
79
+ if (pngData[i] !== pngSignature[i]) {
80
+ return null;
81
+ }
82
+ }
83
+ return {
84
+ width: view.getUint32(16, false),
85
+ height: view.getUint32(20, false),
86
+ };
87
+ };
88
+ const isPng = (data) => {
89
+ const pngPattern = new Uint8Array([0x89, 0x50, 0x4e, 0x47]);
90
+ if ((0, exports.matchesPattern)(pngPattern)(data.subarray(0, 4))) {
91
+ const png = getPngDimensions(data);
92
+ return { dimensions: png, type: 'png' };
93
+ }
94
+ return null;
95
+ };
96
+ const getJpegDimensions = (data) => {
97
+ let offset = 0;
98
+ const readUint16BE = (o) => {
99
+ return (data[o] << 8) | data[o + 1];
100
+ };
101
+ if (data.length < 4 || readUint16BE(offset) !== 0xffd8) {
102
+ return null;
103
+ }
104
+ offset += 2;
105
+ while (offset + 3 < data.length) {
106
+ if (data[offset] === 0xff) {
107
+ const marker = data[offset + 1];
108
+ if (marker === 0xc0 || marker === 0xc2) {
109
+ if (offset + 8 >= data.length) {
110
+ return null;
111
+ }
112
+ const height = readUint16BE(offset + 5);
113
+ const width = readUint16BE(offset + 7);
114
+ return { width, height };
115
+ }
116
+ const length = readUint16BE(offset + 2);
117
+ if (length <= 0) {
118
+ return null;
119
+ }
120
+ offset += length + 2;
121
+ }
122
+ else {
123
+ offset++;
124
+ }
125
+ }
126
+ return null;
127
+ };
128
+ const isJpeg = (data) => {
129
+ const jpegPattern = new Uint8Array([0xff, 0xd8]);
130
+ const jpeg = (0, exports.matchesPattern)(jpegPattern)(data.subarray(0, 2));
131
+ if (!jpeg) {
132
+ return null;
133
+ }
134
+ const dim = getJpegDimensions(data);
135
+ return { dimensions: dim, type: 'jpeg' };
136
+ };
137
+ const getGifDimensions = (data) => {
138
+ if (data.length < 10) {
139
+ return null;
140
+ }
141
+ const view = new DataView(data.buffer, data.byteOffset);
142
+ const width = view.getUint16(6, true);
143
+ const height = view.getUint16(8, true);
144
+ return { width, height };
145
+ };
146
+ const isGif = (data) => {
147
+ const gifPattern = new Uint8Array([0x47, 0x49, 0x46, 0x38]);
148
+ if ((0, exports.matchesPattern)(gifPattern)(data.subarray(0, 4))) {
149
+ return { type: 'gif', dimensions: getGifDimensions(data) };
150
+ }
151
+ return null;
152
+ };
153
+ const getWebPDimensions = (bytes) => {
154
+ if (bytes.length < 30) {
155
+ return null;
156
+ }
157
+ if (bytes[0] !== 0x52 ||
158
+ bytes[1] !== 0x49 ||
159
+ bytes[2] !== 0x46 ||
160
+ bytes[3] !== 0x46 ||
161
+ bytes[8] !== 0x57 ||
162
+ bytes[9] !== 0x45 ||
163
+ bytes[10] !== 0x42 ||
164
+ bytes[11] !== 0x50) {
165
+ return null;
166
+ }
167
+ if (bytes[12] === 0x56 && bytes[13] === 0x50 && bytes[14] === 0x38) {
168
+ if (bytes[15] === 0x20) {
169
+ return {
170
+ width: bytes[26] | ((bytes[27] << 8) & 0x3fff),
171
+ height: bytes[28] | ((bytes[29] << 8) & 0x3fff),
172
+ };
173
+ }
174
+ }
175
+ if (bytes[12] === 0x56 &&
176
+ bytes[13] === 0x50 &&
177
+ bytes[14] === 0x38 &&
178
+ bytes[15] === 0x4c) {
179
+ return {
180
+ width: 1 + (bytes[21] | ((bytes[22] & 0x3f) << 8)),
181
+ height: 1 +
182
+ (((bytes[22] & 0xc0) >> 6) |
183
+ (bytes[23] << 2) |
184
+ ((bytes[24] & 0x0f) << 10)),
185
+ };
186
+ }
187
+ if (bytes[12] === 0x56 &&
188
+ bytes[13] === 0x50 &&
189
+ bytes[14] === 0x38 &&
190
+ bytes[15] === 0x58) {
191
+ return {
192
+ width: 1 + (bytes[24] | (bytes[25] << 8) | (bytes[26] << 16)),
193
+ height: 1 + (bytes[27] | (bytes[28] << 8) | (bytes[29] << 16)),
194
+ };
195
+ }
196
+ return null;
197
+ };
198
+ const isWebp = (data) => {
199
+ const webpPattern = new Uint8Array([0x52, 0x49, 0x46, 0x46]);
200
+ if ((0, exports.matchesPattern)(webpPattern)(data.subarray(0, 4))) {
201
+ return {
202
+ type: 'webp',
203
+ dimensions: getWebPDimensions(data),
204
+ };
205
+ }
206
+ return null;
207
+ };
208
+ const getBmpDimensions = (bmpData) => {
209
+ if (bmpData.length < 26) {
210
+ return null;
211
+ }
212
+ const view = new DataView(bmpData.buffer, bmpData.byteOffset);
213
+ return {
214
+ width: view.getUint32(18, true),
215
+ height: Math.abs(view.getInt32(22, true)),
216
+ };
217
+ };
218
+ const isBmp = (data) => {
219
+ const bmpPattern = new Uint8Array([0x42, 0x4d]);
220
+ if ((0, exports.matchesPattern)(bmpPattern)(data.subarray(0, 2))) {
221
+ const bmp = getBmpDimensions(data);
222
+ return { dimensions: bmp, type: 'bmp' };
223
+ }
224
+ return null;
225
+ };
226
+ const isPdf = (data) => {
227
+ if (data.length < 4) {
228
+ return null;
229
+ }
230
+ const pdfPattern = new Uint8Array([0x25, 0x50, 0x44, 0x46]);
231
+ return (0, exports.matchesPattern)(pdfPattern)(data.subarray(0, 4)) ? { type: 'pdf' } : null;
232
+ };
233
+ const isImageFileType = (fileType) => {
234
+ return (fileType.type === 'jpeg' ||
235
+ fileType.type === 'webp' ||
236
+ fileType.type === 'gif' ||
237
+ fileType.type === 'png' ||
238
+ fileType.type === 'bmp');
239
+ };
240
+ exports.isImageFileType = isImageFileType;
241
+ const detectFileType = (data) => {
242
+ if ((0, exports.isRiffWave)(data)) {
243
+ return { type: 'wav' };
244
+ }
245
+ if ((0, exports.isRiffAvi)(data)) {
246
+ return { type: 'riff' };
247
+ }
248
+ if ((0, exports.isAac)(data)) {
249
+ return { type: 'aac' };
250
+ }
251
+ if ((0, exports.isFlac)(data)) {
252
+ return { type: 'flac' };
253
+ }
254
+ if ((0, exports.isM3u)(data)) {
255
+ return { type: 'm3u' };
256
+ }
257
+ const webp = isWebp(data);
258
+ if (webp) {
259
+ return webp;
260
+ }
261
+ if ((0, exports.isWebm)(data)) {
262
+ return { type: 'webm' };
263
+ }
264
+ if ((0, exports.isIsoBaseMedia)(data)) {
265
+ return { type: 'iso-base-media' };
266
+ }
267
+ if ((0, exports.isTransportStream)(data)) {
268
+ return { type: 'transport-stream' };
269
+ }
270
+ if ((0, exports.isMp3)(data)) {
271
+ return { type: 'mp3' };
272
+ }
273
+ const gif = isGif(data);
274
+ if (gif) {
275
+ return gif;
276
+ }
277
+ const png = isPng(data);
278
+ if (png) {
279
+ return png;
280
+ }
281
+ const pdf = isPdf(data);
282
+ if (pdf) {
283
+ return pdf;
284
+ }
285
+ const bmp = isBmp(data);
286
+ if (bmp) {
287
+ return bmp;
288
+ }
289
+ const jpeg = isJpeg(data);
290
+ if (jpeg) {
291
+ return jpeg;
292
+ }
293
+ return { type: 'unknown' };
294
+ };
295
+ exports.detectFileType = detectFileType;
@@ -35,6 +35,17 @@ export type EffectClipboardData = {
35
35
  readonly remotionClipboard: 'effects';
36
36
  readonly effects: EffectClipboardSnapshot[];
37
37
  };
38
+ export type EffectPropClipboardData = {
39
+ readonly type: 'effect-prop';
40
+ readonly version: 1;
41
+ readonly remotionClipboard: 'effect-prop';
42
+ readonly effect: {
43
+ readonly callee: string;
44
+ readonly importPath: string;
45
+ };
46
+ readonly key: string;
47
+ readonly param: EffectClipboardParam;
48
+ };
38
49
  export type EffectClipboardDataParseResult = {
39
50
  readonly status: 'valid';
40
51
  readonly data: EffectClipboardData;
@@ -44,5 +55,16 @@ export type EffectClipboardDataParseResult = {
44
55
  } | {
45
56
  readonly status: 'invalid';
46
57
  };
58
+ export type EffectPropClipboardDataParseResult = {
59
+ readonly status: 'valid';
60
+ readonly data: EffectPropClipboardData;
61
+ } | {
62
+ readonly status: 'unsupported-version';
63
+ readonly version: unknown;
64
+ } | {
65
+ readonly status: 'invalid';
66
+ };
47
67
  export declare const parseEffectClipboardDataResult: (value: string) => EffectClipboardDataParseResult;
48
68
  export declare const parseEffectClipboardData: (value: string) => EffectClipboardData | null;
69
+ export declare const parseEffectPropClipboardDataResult: (value: string) => EffectPropClipboardDataParseResult;
70
+ export declare const parseEffectPropClipboardData: (value: string) => EffectPropClipboardData | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseEffectClipboardData = exports.parseEffectClipboardDataResult = void 0;
3
+ exports.parseEffectPropClipboardData = exports.parseEffectPropClipboardDataResult = exports.parseEffectClipboardData = exports.parseEffectClipboardDataResult = void 0;
4
4
  const keyframe_interpolation_function_1 = require("./keyframe-interpolation-function");
5
5
  const isRecord = (value) => {
6
6
  return typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -111,3 +111,62 @@ const parseEffectClipboardData = (value) => {
111
111
  return result.data;
112
112
  };
113
113
  exports.parseEffectClipboardData = parseEffectClipboardData;
114
+ const parseEffectPropClipboardDataResult = (value) => {
115
+ try {
116
+ const parsed = JSON.parse(value);
117
+ if (!isRecord(parsed)) {
118
+ return { status: 'invalid' };
119
+ }
120
+ if (parsed.remotionClipboard !== 'effect-prop') {
121
+ return { status: 'invalid' };
122
+ }
123
+ if (parsed.version !== 1) {
124
+ return {
125
+ status: 'unsupported-version',
126
+ version: parsed.version,
127
+ };
128
+ }
129
+ if (parsed.type !== 'effect-prop') {
130
+ return { status: 'invalid' };
131
+ }
132
+ if (!isRecord(parsed.effect)) {
133
+ return { status: 'invalid' };
134
+ }
135
+ if (typeof parsed.effect.callee !== 'string' ||
136
+ typeof parsed.effect.importPath !== 'string') {
137
+ return { status: 'invalid' };
138
+ }
139
+ if (typeof parsed.key !== 'string') {
140
+ return { status: 'invalid' };
141
+ }
142
+ if (!isEffectClipboardParam(parsed.param)) {
143
+ return { status: 'invalid' };
144
+ }
145
+ return {
146
+ status: 'valid',
147
+ data: {
148
+ type: 'effect-prop',
149
+ version: 1,
150
+ remotionClipboard: 'effect-prop',
151
+ effect: {
152
+ callee: parsed.effect.callee,
153
+ importPath: parsed.effect.importPath,
154
+ },
155
+ key: parsed.key,
156
+ param: parsed.param,
157
+ },
158
+ };
159
+ }
160
+ catch (_a) {
161
+ return { status: 'invalid' };
162
+ }
163
+ };
164
+ exports.parseEffectPropClipboardDataResult = parseEffectPropClipboardDataResult;
165
+ const parseEffectPropClipboardData = (value) => {
166
+ const result = (0, exports.parseEffectPropClipboardDataResult)(value);
167
+ if (result.status !== 'valid') {
168
+ return null;
169
+ }
170
+ return result.data;
171
+ };
172
+ exports.parseEffectPropClipboardData = parseEffectPropClipboardData;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  export { splitAnsi, stripAnsi } from './ansi';
2
- export { AddEffectKeyframeRequest, AddEffectKeyframeResponse, AddEffectRequest, AddEffectResponse, AddRenderRequest, AddSequenceKeyframeRequest, AddSequenceKeyframeResponse, ApiRoutes, ApplyCodemodRequest, ApplyCodemodResponse, ApplyVisualControlRequest, ApplyVisualControlResponse, CanUpdateDefaultPropsResponse, CanUpdateSequencePropsRequest, CancelRenderRequest, CancelRenderResponse, CompositionComponentInfoRequest, CompositionComponentInfoResponse, CopyStillToClipboardRequest, DeleteEffectKeyframe, DeleteEffectRequest, DeleteEffectRequestItem, DeleteEffectResponse, DeleteJsxNodeRequest, DeleteJsxNodeRequestItem, DeleteJsxNodeResponse, DeleteKeyframesRequest, DeleteKeyframesResponse, DeleteSequenceKeyframe, DeleteStaticFileRequest, DeleteStaticFileResponse, DuplicateJsxNodeRequest, DuplicateJsxNodeResponse, InsertJsxElementRequest, InsertJsxElementResponse, InsertableCompositionElement, InstallPackageRequest, InstallPackageResponse, OpenInEditorRequest, OpenInEditorResponse, OpenInFileExplorerRequest, PasteEffectsRequest, PasteEffectsResponse, ProjectInfoRequest, ProjectInfoResponse, RedoRequest, RedoResponse, RemoveRenderRequest, ReorderEffectRequest, ReorderEffectResponse, RestartStudioRequest, RestartStudioResponse, SaveEffectPropsRequest, SaveEffectPropsResponse, SaveSequencePropEdit, SaveSequencePropsRequest, SaveSequencePropsResponse, SaveSequencePropsResult, SimpleDiff, SubscribeToDefaultPropsRequest, SubscribeToDefaultPropsResponse, SubscribeToFileExistenceRequest, SubscribeToFileExistenceResponse, SubscribeToSequencePropsRequest, SubscribeToSequencePropsResponse, UndoRequest, UndoResponse, UnsubscribeFromDefaultPropsRequest, UnsubscribeFromFileExistenceRequest, UnsubscribeFromSequencePropsRequest, UpdateAvailableRequest, UpdateAvailableResponse, UpdateDefaultPropsRequest, UpdateDefaultPropsResponse, } from './api-requests';
2
+ export { AddEffectKeyframeRequest, AddEffectKeyframeResponse, AddEffectRequest, AddEffectResponse, AddRenderRequest, AddSequenceKeyframeRequest, AddSequenceKeyframeResponse, ApiRoutes, ApplyCodemodRequest, ApplyCodemodResponse, ApplyVisualControlRequest, ApplyVisualControlResponse, CanUpdateDefaultPropsResponse, CanUpdateSequencePropsRequest, CancelRenderRequest, CancelRenderResponse, CompositionComponentInfoRequest, CompositionComponentInfoResponse, CopyStillToClipboardRequest, DeleteEffectKeyframe, DeleteEffectRequest, DeleteEffectRequestItem, DeleteEffectResponse, DeleteJsxNodeRequest, DeleteJsxNodeRequestItem, DeleteJsxNodeResponse, DeleteKeyframesRequest, DeleteKeyframesResponse, DeleteSequenceKeyframe, DeleteStaticFileRequest, DeleteStaticFileResponse, DownloadRemoteAssetRequest, DownloadRemoteAssetResponse, DuplicateJsxNodeRequest, DuplicateJsxNodeResponse, InsertJsxElementRequest, InsertJsxElementResponse, InsertableCompositionElement, InstallPackageRequest, InstallPackageResponse, LogStudioErrorRequest, LogStudioErrorResponse, MoveEffectKeyframe, MoveKeyframesRequest, MoveKeyframesResponse, MoveSequenceKeyframe, OpenInEditorRequest, OpenInEditorResponse, OpenInFileExplorerRequest, PasteEffectsRequest, PasteEffectsResponse, ProjectInfoRequest, ProjectInfoResponse, RedoRequest, RedoResponse, RemoveRenderRequest, ReorderEffectRequest, ReorderEffectResponse, ReorderSequencePosition, ReorderSequenceRequest, ReorderSequenceResponse, RenameStaticFileRequest, RenameStaticFileResponse, RestartStudioRequest, RestartStudioResponse, SaveEffectPropsRequest, SaveEffectPropsResponse, SaveSequencePropEdit, SaveSequencePropsRequest, SaveSequencePropsResponse, SaveSequencePropsResult, SimpleDiff, SubscribeToDefaultPropsRequest, SubscribeToDefaultPropsResponse, SubscribeToFileExistenceRequest, SubscribeToFileExistenceResponse, SubscribeToSequencePropsRequest, SubscribeToSequencePropsResponse, UndoRequest, UndoResponse, UnsubscribeFromDefaultPropsRequest, UnsubscribeFromFileExistenceRequest, UnsubscribeFromSequencePropsRequest, UpdateAvailableRequest, UpdateAvailableResponse, UpdateDefaultPropsRequest, UpdateDefaultPropsResponse, UpdateEffectKeyframeSettingsRequest, UpdateEffectKeyframeSettingsResponse, UpdateSequenceKeyframeSettingsRequest, UpdateSequenceKeyframeSettingsResponse, type KeyframeSettings, } from './api-requests';
3
+ export { ASSET_DRAG_MIME_TYPE, makeAssetDragData, parseAssetDragData, type AssetDragData, } from './asset-drag-data';
3
4
  export type { ApplyVisualControlCodemod, RecastCodemod } from './codemods';
4
5
  export { DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS } from './default-buffer-state-delay-in-milliseconds';
5
- export { parseEffectClipboardData, parseEffectClipboardDataResult, type EffectClipboardClamping, type EffectClipboardData, type EffectClipboardDataParseResult, type EffectClipboardEasing, type EffectClipboardExtrapolateType, type EffectClipboardInterpolationFunction, type EffectClipboardKeyframe, type EffectClipboardKeyframedParam, type EffectClipboardParam, type EffectClipboardPasteType, type EffectClipboardSnapshot, type EffectClipboardStaticParam, } from './effect-clipboard-data';
6
+ export { detectFileType, isImageFileType, type FileDimensions, type FileType, type ImageFileType, } from './detect-file-type';
7
+ export { parseEffectClipboardData, parseEffectClipboardDataResult, parseEffectPropClipboardData, parseEffectPropClipboardDataResult, type EffectClipboardClamping, type EffectClipboardData, type EffectClipboardDataParseResult, type EffectClipboardEasing, type EffectClipboardExtrapolateType, type EffectClipboardInterpolationFunction, type EffectClipboardKeyframe, type EffectClipboardKeyframedParam, type EffectClipboardParam, type EffectClipboardPasteType, type EffectClipboardSnapshot, type EffectClipboardStaticParam, type EffectPropClipboardData, type EffectPropClipboardDataParseResult, } from './effect-clipboard-data';
6
8
  export { EFFECT_DRAG_MIME_TYPE, parseEffectDragData, type EffectDragData, } from './effect-drag-data';
7
9
  export { EventSourceEvent } from './event-source-event';
8
10
  export { formatBytes } from './format-bytes';
@@ -20,6 +22,7 @@ export { ProjectInfo } from './project-info';
20
22
  export type { RenderDefaults } from './render-defaults';
21
23
  export { AggregateRenderProgress, ArtifactProgress, BrowserDownloadState, BrowserProgressLog, BundlingState, CopyingState, DownloadProgress, JobProgressCallback, RenderJob, RenderJobWithCleanup, RenderingProgressInput, RequiredChromiumOptions, StitchingProgressInput, UiOpenGlOptions, } from './render-job';
22
24
  export type { CompletedClientRender } from './render-job';
25
+ export { getRequiredPackageForEffectImportPath, getRequiredPackageForInsertableElement, } from './required-package';
23
26
  export { SCHEMA_FIELD_ROW_HEIGHT, getEffectFieldsToShow, getFieldsToShow, } from './schema-field-info';
24
27
  export type { AnySchemaFieldInfo, CodeValues, DragOverrides, EffectSchemaFieldInfo, SchemaFieldInfo, SequenceControls, SequenceSchemaFieldInfo, } from './schema-field-info';
25
28
  export { ScriptLine, SomeStackFrame, StackFrame, SymbolicatedStackFrame, } from './stack-types';
@@ -27,6 +30,8 @@ export { EnumPath, stringifyDefaultProps } from './stringify-default-props';
27
30
  export type { VisualControlChange } from './codemods';
28
31
  export { optimisticAddEffectKeyframe, optimisticAddSequenceKeyframe, } from './optimistic-add-keyframe';
29
32
  export { optimisticDeleteEffectKeyframe, optimisticDeleteEffectKeyframes, optimisticDeleteSequenceKeyframe, optimisticDeleteSequenceKeyframes, } from './optimistic-delete-keyframe';
33
+ export { canMoveKeyframesWithoutCollisions, optimisticMoveEffectKeyframes, optimisticMoveSequenceKeyframes, type OptimisticKeyframeMove, } from './optimistic-move-keyframe';
30
34
  export { optimisticUpdateForCodeValues } from './optimistic-update-for-code-values';
31
35
  export { optimisticUpdateForEffectCodeValues } from './optimistic-update-for-effect-code-values';
36
+ export { optimisticUpdateEffectKeyframeSettings, optimisticUpdateSequenceKeyframeSettings, } from './optimistic-update-keyframe-settings';
32
37
  export { stringifySequenceExpandedRowKey, stringifySequenceSubscriptionKey, } from './stringify-sequence-subscription-key';
package/dist/index.js CHANGED
@@ -1,14 +1,39 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifySequenceSubscriptionKey = exports.stringifySequenceExpandedRowKey = exports.optimisticUpdateForEffectCodeValues = exports.optimisticUpdateForCodeValues = exports.optimisticDeleteSequenceKeyframes = exports.optimisticDeleteSequenceKeyframe = exports.optimisticDeleteEffectKeyframes = exports.optimisticDeleteEffectKeyframe = exports.optimisticAddSequenceKeyframe = exports.optimisticAddEffectKeyframe = exports.stringifyDefaultProps = exports.getFieldsToShow = exports.getEffectFieldsToShow = exports.SCHEMA_FIELD_ROW_HEIGHT = exports.packages = exports.installableMap = exports.extraPackages = exports.descriptions = exports.apiDocs = exports.DEFAULT_TIMELINE_TRACKS = exports.keyframeInterpolationFunctions = exports.isSequenceFieldSchemaKeyframable = exports.isSchemaFieldKeyframable = exports.isKeyframeInterpolationFunction = exports.getKeyframeInterpolationFunctionForSchemaField = exports.getKeyframeInterpolationFunction = exports.hotMiddlewareOptions = exports.getProjectName = exports.getLocationFromBuildError = exports.getDefaultOutLocation = exports.getAllSchemaKeys = exports.formatBytes = exports.parseEffectDragData = exports.EFFECT_DRAG_MIME_TYPE = exports.parseEffectClipboardDataResult = exports.parseEffectClipboardData = exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = exports.stripAnsi = exports.splitAnsi = void 0;
17
+ exports.optimisticUpdateEffectKeyframeSettings = exports.optimisticUpdateForEffectCodeValues = exports.optimisticUpdateForCodeValues = exports.optimisticMoveSequenceKeyframes = exports.optimisticMoveEffectKeyframes = exports.canMoveKeyframesWithoutCollisions = exports.optimisticDeleteSequenceKeyframes = exports.optimisticDeleteSequenceKeyframe = exports.optimisticDeleteEffectKeyframes = exports.optimisticDeleteEffectKeyframe = exports.optimisticAddSequenceKeyframe = exports.optimisticAddEffectKeyframe = exports.stringifyDefaultProps = exports.getFieldsToShow = exports.getEffectFieldsToShow = exports.SCHEMA_FIELD_ROW_HEIGHT = exports.getRequiredPackageForInsertableElement = exports.getRequiredPackageForEffectImportPath = exports.packages = exports.installableMap = exports.extraPackages = exports.descriptions = exports.apiDocs = exports.DEFAULT_TIMELINE_TRACKS = exports.keyframeInterpolationFunctions = exports.isSequenceFieldSchemaKeyframable = exports.isSchemaFieldKeyframable = exports.isKeyframeInterpolationFunction = exports.getKeyframeInterpolationFunctionForSchemaField = exports.getKeyframeInterpolationFunction = exports.hotMiddlewareOptions = exports.getProjectName = exports.getLocationFromBuildError = exports.getDefaultOutLocation = exports.getAllSchemaKeys = exports.formatBytes = exports.parseEffectDragData = exports.EFFECT_DRAG_MIME_TYPE = exports.parseEffectPropClipboardDataResult = exports.parseEffectPropClipboardData = exports.parseEffectClipboardDataResult = exports.parseEffectClipboardData = exports.isImageFileType = exports.detectFileType = exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = exports.parseAssetDragData = exports.makeAssetDragData = exports.ASSET_DRAG_MIME_TYPE = exports.stripAnsi = exports.splitAnsi = void 0;
18
+ exports.stringifySequenceSubscriptionKey = exports.stringifySequenceExpandedRowKey = exports.optimisticUpdateSequenceKeyframeSettings = void 0;
4
19
  const ansi_1 = require("./ansi");
5
20
  Object.defineProperty(exports, "splitAnsi", { enumerable: true, get: function () { return ansi_1.splitAnsi; } });
6
21
  Object.defineProperty(exports, "stripAnsi", { enumerable: true, get: function () { return ansi_1.stripAnsi; } });
22
+ __exportStar(require("./api-requests"), exports);
23
+ const asset_drag_data_1 = require("./asset-drag-data");
24
+ Object.defineProperty(exports, "ASSET_DRAG_MIME_TYPE", { enumerable: true, get: function () { return asset_drag_data_1.ASSET_DRAG_MIME_TYPE; } });
25
+ Object.defineProperty(exports, "makeAssetDragData", { enumerable: true, get: function () { return asset_drag_data_1.makeAssetDragData; } });
26
+ Object.defineProperty(exports, "parseAssetDragData", { enumerable: true, get: function () { return asset_drag_data_1.parseAssetDragData; } });
7
27
  const default_buffer_state_delay_in_milliseconds_1 = require("./default-buffer-state-delay-in-milliseconds");
8
28
  Object.defineProperty(exports, "DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS", { enumerable: true, get: function () { return default_buffer_state_delay_in_milliseconds_1.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS; } });
29
+ const detect_file_type_1 = require("./detect-file-type");
30
+ Object.defineProperty(exports, "detectFileType", { enumerable: true, get: function () { return detect_file_type_1.detectFileType; } });
31
+ Object.defineProperty(exports, "isImageFileType", { enumerable: true, get: function () { return detect_file_type_1.isImageFileType; } });
9
32
  const effect_clipboard_data_1 = require("./effect-clipboard-data");
10
33
  Object.defineProperty(exports, "parseEffectClipboardData", { enumerable: true, get: function () { return effect_clipboard_data_1.parseEffectClipboardData; } });
11
34
  Object.defineProperty(exports, "parseEffectClipboardDataResult", { enumerable: true, get: function () { return effect_clipboard_data_1.parseEffectClipboardDataResult; } });
35
+ Object.defineProperty(exports, "parseEffectPropClipboardData", { enumerable: true, get: function () { return effect_clipboard_data_1.parseEffectPropClipboardData; } });
36
+ Object.defineProperty(exports, "parseEffectPropClipboardDataResult", { enumerable: true, get: function () { return effect_clipboard_data_1.parseEffectPropClipboardDataResult; } });
12
37
  const effect_drag_data_1 = require("./effect-drag-data");
13
38
  Object.defineProperty(exports, "EFFECT_DRAG_MIME_TYPE", { enumerable: true, get: function () { return effect_drag_data_1.EFFECT_DRAG_MIME_TYPE; } });
14
39
  Object.defineProperty(exports, "parseEffectDragData", { enumerable: true, get: function () { return effect_drag_data_1.parseEffectDragData; } });
@@ -39,6 +64,9 @@ Object.defineProperty(exports, "descriptions", { enumerable: true, get: function
39
64
  Object.defineProperty(exports, "extraPackages", { enumerable: true, get: function () { return package_info_1.extraPackages; } });
40
65
  Object.defineProperty(exports, "installableMap", { enumerable: true, get: function () { return package_info_1.installableMap; } });
41
66
  Object.defineProperty(exports, "packages", { enumerable: true, get: function () { return package_info_1.packages; } });
67
+ const required_package_1 = require("./required-package");
68
+ Object.defineProperty(exports, "getRequiredPackageForEffectImportPath", { enumerable: true, get: function () { return required_package_1.getRequiredPackageForEffectImportPath; } });
69
+ Object.defineProperty(exports, "getRequiredPackageForInsertableElement", { enumerable: true, get: function () { return required_package_1.getRequiredPackageForInsertableElement; } });
42
70
  const schema_field_info_1 = require("./schema-field-info");
43
71
  Object.defineProperty(exports, "SCHEMA_FIELD_ROW_HEIGHT", { enumerable: true, get: function () { return schema_field_info_1.SCHEMA_FIELD_ROW_HEIGHT; } });
44
72
  Object.defineProperty(exports, "getEffectFieldsToShow", { enumerable: true, get: function () { return schema_field_info_1.getEffectFieldsToShow; } });
@@ -53,10 +81,17 @@ Object.defineProperty(exports, "optimisticDeleteEffectKeyframe", { enumerable: t
53
81
  Object.defineProperty(exports, "optimisticDeleteEffectKeyframes", { enumerable: true, get: function () { return optimistic_delete_keyframe_1.optimisticDeleteEffectKeyframes; } });
54
82
  Object.defineProperty(exports, "optimisticDeleteSequenceKeyframe", { enumerable: true, get: function () { return optimistic_delete_keyframe_1.optimisticDeleteSequenceKeyframe; } });
55
83
  Object.defineProperty(exports, "optimisticDeleteSequenceKeyframes", { enumerable: true, get: function () { return optimistic_delete_keyframe_1.optimisticDeleteSequenceKeyframes; } });
84
+ const optimistic_move_keyframe_1 = require("./optimistic-move-keyframe");
85
+ Object.defineProperty(exports, "canMoveKeyframesWithoutCollisions", { enumerable: true, get: function () { return optimistic_move_keyframe_1.canMoveKeyframesWithoutCollisions; } });
86
+ Object.defineProperty(exports, "optimisticMoveEffectKeyframes", { enumerable: true, get: function () { return optimistic_move_keyframe_1.optimisticMoveEffectKeyframes; } });
87
+ Object.defineProperty(exports, "optimisticMoveSequenceKeyframes", { enumerable: true, get: function () { return optimistic_move_keyframe_1.optimisticMoveSequenceKeyframes; } });
56
88
  const optimistic_update_for_code_values_1 = require("./optimistic-update-for-code-values");
57
89
  Object.defineProperty(exports, "optimisticUpdateForCodeValues", { enumerable: true, get: function () { return optimistic_update_for_code_values_1.optimisticUpdateForCodeValues; } });
58
90
  const optimistic_update_for_effect_code_values_1 = require("./optimistic-update-for-effect-code-values");
59
91
  Object.defineProperty(exports, "optimisticUpdateForEffectCodeValues", { enumerable: true, get: function () { return optimistic_update_for_effect_code_values_1.optimisticUpdateForEffectCodeValues; } });
92
+ const optimistic_update_keyframe_settings_1 = require("./optimistic-update-keyframe-settings");
93
+ Object.defineProperty(exports, "optimisticUpdateEffectKeyframeSettings", { enumerable: true, get: function () { return optimistic_update_keyframe_settings_1.optimisticUpdateEffectKeyframeSettings; } });
94
+ Object.defineProperty(exports, "optimisticUpdateSequenceKeyframeSettings", { enumerable: true, get: function () { return optimistic_update_keyframe_settings_1.optimisticUpdateSequenceKeyframeSettings; } });
60
95
  const stringify_sequence_subscription_key_1 = require("./stringify-sequence-subscription-key");
61
96
  Object.defineProperty(exports, "stringifySequenceExpandedRowKey", { enumerable: true, get: function () { return stringify_sequence_subscription_key_1.stringifySequenceExpandedRowKey; } });
62
97
  Object.defineProperty(exports, "stringifySequenceSubscriptionKey", { enumerable: true, get: function () { return stringify_sequence_subscription_key_1.stringifySequenceSubscriptionKey; } });
@@ -0,0 +1,23 @@
1
+ import type { CanUpdateSequencePropsResponse, CanUpdateSequencePropStatus } from 'remotion';
2
+ export type OptimisticKeyframeMove = {
3
+ readonly fieldKey: string;
4
+ readonly fromFrame: number;
5
+ readonly toFrame: number;
6
+ };
7
+ export declare const canMoveKeyframesWithoutCollisions: ({ status, moves, }: {
8
+ status: CanUpdateSequencePropStatus;
9
+ moves: readonly {
10
+ fromFrame: number;
11
+ toFrame: number;
12
+ }[];
13
+ }) => boolean;
14
+ export declare const optimisticMoveSequenceKeyframes: ({ previous, keyframes, }: {
15
+ previous: CanUpdateSequencePropsResponse;
16
+ keyframes: readonly OptimisticKeyframeMove[];
17
+ }) => CanUpdateSequencePropsResponse;
18
+ export declare const optimisticMoveEffectKeyframes: ({ previous, keyframes, }: {
19
+ previous: CanUpdateSequencePropsResponse;
20
+ keyframes: readonly (OptimisticKeyframeMove & {
21
+ effectIndex: number;
22
+ })[];
23
+ }) => CanUpdateSequencePropsResponse;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimisticMoveEffectKeyframes = exports.optimisticMoveSequenceKeyframes = exports.canMoveKeyframesWithoutCollisions = void 0;
4
+ const getMoveMap = (moves) => {
5
+ const moveMap = new Map();
6
+ for (const move of moves) {
7
+ if (move.fromFrame === move.toFrame) {
8
+ continue;
9
+ }
10
+ if (moveMap.has(move.fromFrame)) {
11
+ return null;
12
+ }
13
+ moveMap.set(move.fromFrame, move.toFrame);
14
+ }
15
+ return moveMap;
16
+ };
17
+ const canMoveKeyframesWithoutCollisions = ({ status, moves, }) => {
18
+ var _a;
19
+ if (status.status !== 'keyframed') {
20
+ return false;
21
+ }
22
+ const moveMap = getMoveMap(moves);
23
+ if (moveMap === null) {
24
+ return false;
25
+ }
26
+ if (moveMap.size === 0) {
27
+ return true;
28
+ }
29
+ const frames = new Set(status.keyframes.map((keyframe) => keyframe.frame));
30
+ for (const fromFrame of moveMap.keys()) {
31
+ if (!frames.has(fromFrame)) {
32
+ return false;
33
+ }
34
+ }
35
+ const nextFrames = new Set();
36
+ for (const keyframe of status.keyframes) {
37
+ const frame = (_a = moveMap.get(keyframe.frame)) !== null && _a !== void 0 ? _a : keyframe.frame;
38
+ if (nextFrames.has(frame)) {
39
+ return false;
40
+ }
41
+ nextFrames.add(frame);
42
+ }
43
+ return true;
44
+ };
45
+ exports.canMoveKeyframesWithoutCollisions = canMoveKeyframesWithoutCollisions;
46
+ const moveKeyframesInPropStatus = ({ status, moves, }) => {
47
+ if (status.status !== 'keyframed') {
48
+ return status;
49
+ }
50
+ if (!(0, exports.canMoveKeyframesWithoutCollisions)({ status, moves })) {
51
+ return status;
52
+ }
53
+ const moveMap = getMoveMap(moves);
54
+ if (moveMap === null) {
55
+ return status;
56
+ }
57
+ if (moveMap.size === 0) {
58
+ return status;
59
+ }
60
+ return {
61
+ ...status,
62
+ keyframes: status.keyframes
63
+ .map((keyframe) => {
64
+ var _a;
65
+ return ({
66
+ ...keyframe,
67
+ frame: (_a = moveMap.get(keyframe.frame)) !== null && _a !== void 0 ? _a : keyframe.frame,
68
+ });
69
+ })
70
+ .sort((a, b) => a.frame - b.frame),
71
+ };
72
+ };
73
+ const optimisticMoveSequenceKeyframes = ({ previous, keyframes, }) => {
74
+ var _a;
75
+ if (!previous.canUpdate) {
76
+ return previous;
77
+ }
78
+ const movesByField = new Map();
79
+ for (const keyframe of keyframes) {
80
+ const moves = (_a = movesByField.get(keyframe.fieldKey)) !== null && _a !== void 0 ? _a : [];
81
+ moves.push(keyframe);
82
+ movesByField.set(keyframe.fieldKey, moves);
83
+ }
84
+ const props = { ...previous.props };
85
+ for (const [fieldKey, moves] of movesByField) {
86
+ const status = props[fieldKey];
87
+ if (!status) {
88
+ continue;
89
+ }
90
+ props[fieldKey] = moveKeyframesInPropStatus({ status, moves });
91
+ }
92
+ return {
93
+ ...previous,
94
+ props,
95
+ };
96
+ };
97
+ exports.optimisticMoveSequenceKeyframes = optimisticMoveSequenceKeyframes;
98
+ const optimisticMoveEffectKeyframes = ({ previous, keyframes, }) => {
99
+ var _a;
100
+ if (!previous.canUpdate) {
101
+ return previous;
102
+ }
103
+ const movesByEffect = new Map();
104
+ for (const keyframe of keyframes) {
105
+ const moves = (_a = movesByEffect.get(keyframe.effectIndex)) !== null && _a !== void 0 ? _a : [];
106
+ moves.push(keyframe);
107
+ movesByEffect.set(keyframe.effectIndex, moves);
108
+ }
109
+ const effects = previous.effects.map((effect) => {
110
+ var _a;
111
+ if (!effect.canUpdate) {
112
+ return effect;
113
+ }
114
+ const movesForEffect = movesByEffect.get(effect.effectIndex);
115
+ if (!movesForEffect) {
116
+ return effect;
117
+ }
118
+ const props = { ...effect.props };
119
+ const movesByField = new Map();
120
+ for (const move of movesForEffect) {
121
+ const moves = (_a = movesByField.get(move.fieldKey)) !== null && _a !== void 0 ? _a : [];
122
+ moves.push(move);
123
+ movesByField.set(move.fieldKey, moves);
124
+ }
125
+ for (const [fieldKey, moves] of movesByField) {
126
+ const status = props[fieldKey];
127
+ if (!status) {
128
+ continue;
129
+ }
130
+ props[fieldKey] = moveKeyframesInPropStatus({ status, moves });
131
+ }
132
+ return {
133
+ ...effect,
134
+ props,
135
+ };
136
+ });
137
+ return {
138
+ ...previous,
139
+ effects,
140
+ };
141
+ };
142
+ exports.optimisticMoveEffectKeyframes = optimisticMoveEffectKeyframes;
@@ -0,0 +1,13 @@
1
+ import type { CanUpdateSequencePropsResponse } from 'remotion';
2
+ import type { KeyframeSettings } from './api-requests';
3
+ export declare const optimisticUpdateSequenceKeyframeSettings: ({ previous, fieldKey, settings, }: {
4
+ previous: CanUpdateSequencePropsResponse;
5
+ fieldKey: string;
6
+ settings: KeyframeSettings;
7
+ }) => CanUpdateSequencePropsResponse;
8
+ export declare const optimisticUpdateEffectKeyframeSettings: ({ previous, effectIndex, fieldKey, settings, }: {
9
+ previous: CanUpdateSequencePropsResponse;
10
+ effectIndex: number;
11
+ fieldKey: string;
12
+ settings: KeyframeSettings;
13
+ }) => CanUpdateSequencePropsResponse;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimisticUpdateEffectKeyframeSettings = exports.optimisticUpdateSequenceKeyframeSettings = void 0;
4
+ const applySettingsToStatus = (status, settings) => {
5
+ if (!status || status.status !== 'keyframed') {
6
+ throw new Error('Expected keyframed status');
7
+ }
8
+ return {
9
+ ...status,
10
+ ...(settings.clamping ? { clamping: settings.clamping } : {}),
11
+ posterize: settings.posterize,
12
+ };
13
+ };
14
+ const optimisticUpdateSequenceKeyframeSettings = ({ previous, fieldKey, settings, }) => {
15
+ if (!previous.canUpdate) {
16
+ return previous;
17
+ }
18
+ const status = previous.props[fieldKey];
19
+ if (!status || status.status !== 'keyframed') {
20
+ return previous;
21
+ }
22
+ return {
23
+ ...previous,
24
+ props: {
25
+ ...previous.props,
26
+ [fieldKey]: applySettingsToStatus(status, settings),
27
+ },
28
+ };
29
+ };
30
+ exports.optimisticUpdateSequenceKeyframeSettings = optimisticUpdateSequenceKeyframeSettings;
31
+ const optimisticUpdateEffectKeyframeSettings = ({ previous, effectIndex, fieldKey, settings, }) => {
32
+ if (!previous.canUpdate) {
33
+ return previous;
34
+ }
35
+ const targetIndex = previous.effects.findIndex((effect) => effect.effectIndex === effectIndex);
36
+ if (targetIndex === -1) {
37
+ return previous;
38
+ }
39
+ const target = previous.effects[targetIndex];
40
+ if (!target.canUpdate) {
41
+ return previous;
42
+ }
43
+ const status = target.props[fieldKey];
44
+ if (!status || status.status !== 'keyframed') {
45
+ return previous;
46
+ }
47
+ const effects = [...previous.effects];
48
+ effects[targetIndex] = {
49
+ ...target,
50
+ props: {
51
+ ...target.props,
52
+ [fieldKey]: applySettingsToStatus(status, settings),
53
+ },
54
+ };
55
+ return {
56
+ ...previous,
57
+ effects,
58
+ };
59
+ };
60
+ exports.optimisticUpdateEffectKeyframeSettings = optimisticUpdateEffectKeyframeSettings;
@@ -0,0 +1,3 @@
1
+ import type { InsertableCompositionElement } from './api-requests';
2
+ export declare const getRequiredPackageForInsertableElement: (element: InsertableCompositionElement) => string | null;
3
+ export declare const getRequiredPackageForEffectImportPath: (importPath: string) => string | null;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRequiredPackageForEffectImportPath = exports.getRequiredPackageForInsertableElement = void 0;
4
+ const getRequiredPackageForInsertableElement = (element) => {
5
+ if (element.type === 'solid') {
6
+ return null;
7
+ }
8
+ if (element.assetType === 'video' || element.assetType === 'audio') {
9
+ return '@remotion/media';
10
+ }
11
+ if (element.assetType === 'gif') {
12
+ return '@remotion/gif';
13
+ }
14
+ return null;
15
+ };
16
+ exports.getRequiredPackageForInsertableElement = getRequiredPackageForInsertableElement;
17
+ const getRequiredPackageForEffectImportPath = (importPath) => {
18
+ if (importPath.startsWith('@remotion/effects/')) {
19
+ return '@remotion/effects';
20
+ }
21
+ if (importPath === '@remotion/light-leaks' ||
22
+ importPath === '@remotion/starburst') {
23
+ return importPath;
24
+ }
25
+ return null;
26
+ };
27
+ exports.getRequiredPackageForEffectImportPath = getRequiredPackageForEffectImportPath;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-shared"
4
4
  },
5
5
  "name": "@remotion/studio-shared",
6
- "version": "4.0.472",
6
+ "version": "4.0.473",
7
7
  "description": "Internal package for shared objects between the Studio backend and frontend",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -20,11 +20,11 @@
20
20
  "url": "https://github.com/remotion-dev/remotion/issues"
21
21
  },
22
22
  "dependencies": {
23
- "remotion": "4.0.472"
23
+ "remotion": "4.0.473"
24
24
  },
25
25
  "devDependencies": {
26
- "@remotion/renderer": "4.0.472",
27
- "@remotion/eslint-config-internal": "4.0.472",
26
+ "@remotion/renderer": "4.0.473",
27
+ "@remotion/eslint-config-internal": "4.0.473",
28
28
  "eslint": "9.19.0",
29
29
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
30
30
  },