@remotion/studio 4.0.470 → 4.0.472

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.
Files changed (112) hide show
  1. package/dist/components/AssetSelector.js +10 -1
  2. package/dist/components/Canvas.js +98 -0
  3. package/dist/components/CompositionSelectorItem.d.ts +1 -0
  4. package/dist/components/CompositionSelectorItem.js +12 -4
  5. package/dist/components/ContextMenu.d.ts +7 -2
  6. package/dist/components/ContextMenu.js +91 -43
  7. package/dist/components/Editor.js +14 -6
  8. package/dist/components/Modals.js +3 -1
  9. package/dist/components/NewComposition/CodemodFooter.js +2 -2
  10. package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
  11. package/dist/components/NewComposition/DeleteFolder.js +39 -0
  12. package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
  13. package/dist/components/NewComposition/RenameFolder.js +60 -0
  14. package/dist/components/Preview.js +2 -1
  15. package/dist/components/SelectedOutlineOverlay.d.ts +109 -1
  16. package/dist/components/SelectedOutlineOverlay.js +489 -73
  17. package/dist/components/Splitter/SplitterContainer.js +9 -0
  18. package/dist/components/Splitter/SplitterHandle.js +63 -70
  19. package/dist/components/Timeline/Timeline.js +121 -1
  20. package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
  21. package/dist/components/Timeline/TimelineArrayField.js +210 -0
  22. package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
  23. package/dist/components/Timeline/TimelineBooleanField.js +2 -2
  24. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +20 -0
  25. package/dist/components/Timeline/TimelineClipboardKeybindings.js +265 -0
  26. package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
  27. package/dist/components/Timeline/TimelineColorField.js +2 -8
  28. package/dist/components/Timeline/TimelineDeleteKeybindings.js +15 -0
  29. package/dist/components/Timeline/TimelineDragHandler.js +1 -0
  30. package/dist/components/Timeline/TimelineEffectItem.js +159 -6
  31. package/dist/components/Timeline/TimelineEffectPropItem.js +95 -25
  32. package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
  33. package/dist/components/Timeline/TimelineEnumField.js +3 -3
  34. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
  35. package/dist/components/Timeline/TimelineKeyframeControls.js +52 -33
  36. package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
  37. package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
  38. package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
  39. package/dist/components/Timeline/TimelineLayerEye.js +8 -3
  40. package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
  41. package/dist/components/Timeline/TimelineNumberField.js +7 -11
  42. package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
  43. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
  44. package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
  45. package/dist/components/Timeline/TimelineRotationField.js +41 -24
  46. package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
  47. package/dist/components/Timeline/TimelineRowChrome.js +11 -10
  48. package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
  49. package/dist/components/Timeline/TimelineScaleField.js +314 -0
  50. package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
  51. package/dist/components/Timeline/TimelineSchemaField.js +8 -42
  52. package/dist/components/Timeline/TimelineSelection.js +3 -2
  53. package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
  54. package/dist/components/Timeline/TimelineSequence.js +51 -10
  55. package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
  56. package/dist/components/Timeline/TimelineSequenceItem.js +97 -7
  57. package/dist/components/Timeline/TimelineSequencePropItem.js +82 -21
  58. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
  59. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +528 -0
  60. package/dist/components/Timeline/TimelineTrack.js +1 -1
  61. package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
  62. package/dist/components/Timeline/TimelineTranslateField.js +21 -25
  63. package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
  64. package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
  65. package/dist/components/Timeline/call-add-keyframe.js +2 -0
  66. package/dist/components/Timeline/call-delete-keyframe.d.ts +16 -0
  67. package/dist/components/Timeline/call-delete-keyframe.js +86 -14
  68. package/dist/components/Timeline/delete-selected-keyframe.d.ts +10 -0
  69. package/dist/components/Timeline/delete-selected-keyframe.js +48 -7
  70. package/dist/components/Timeline/delete-selected-timeline-item.js +6 -11
  71. package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
  72. package/dist/components/Timeline/get-node-keyframes.js +38 -5
  73. package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
  74. package/dist/components/Timeline/reset-selected-timeline-props.d.ts +38 -0
  75. package/dist/components/Timeline/reset-selected-timeline-props.js +156 -0
  76. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -2
  77. package/dist/components/Timeline/sequence-props-subscription-store.js +2 -1
  78. package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
  79. package/dist/components/Timeline/timeline-field-utils.js +5 -1
  80. package/dist/components/Timeline/timeline-scroll-logic.js +3 -3
  81. package/dist/components/Timeline/timeline-translate-utils.js +6 -2
  82. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
  83. package/dist/components/Timeline/use-sequence-props-subscription.js +2 -1
  84. package/dist/components/TopPanel.d.ts +1 -1
  85. package/dist/components/folder-menu-items.d.ts +12 -0
  86. package/dist/components/folder-menu-items.js +147 -0
  87. package/dist/components/import-assets.d.ts +6 -0
  88. package/dist/components/import-assets.js +157 -0
  89. package/dist/esm/{chunk-dny42qnq.js → chunk-48grt472.js} +9717 -5925
  90. package/dist/esm/internals.mjs +9717 -5925
  91. package/dist/esm/previewEntry.mjs +9531 -5737
  92. package/dist/esm/renderEntry.mjs +1 -1
  93. package/dist/helpers/calculate-timeline.js +7 -3
  94. package/dist/helpers/create-folder-tree.js +1 -0
  95. package/dist/helpers/detect-file-type.d.ts +69 -0
  96. package/dist/helpers/detect-file-type.js +278 -0
  97. package/dist/helpers/get-folder-id.d.ts +4 -0
  98. package/dist/helpers/get-folder-id.js +7 -0
  99. package/dist/helpers/get-left-of-timeline-slider.js +1 -1
  100. package/dist/helpers/get-timeline-sequence-layout.js +10 -11
  101. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
  102. package/dist/helpers/open-in-editor.d.ts +19 -1
  103. package/dist/helpers/open-in-editor.js +42 -4
  104. package/dist/helpers/timeline-layout.js +5 -1
  105. package/dist/helpers/use-menu-structure.js +0 -1
  106. package/dist/helpers/validate-folder-rename.d.ts +6 -0
  107. package/dist/helpers/validate-folder-rename.js +19 -0
  108. package/dist/state/modals.d.ts +10 -0
  109. package/dist/state/scale-lock.d.ts +18 -0
  110. package/dist/state/scale-lock.js +59 -0
  111. package/dist/state/z-index.js +5 -2
  112. package/package.json +10 -10
@@ -209,7 +209,7 @@ var renderContent = (Root) => {
209
209
  renderToDOM(/* @__PURE__ */ jsx("div", {
210
210
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
211
211
  }));
212
- import("./chunk-dny42qnq.js").then(({ StudioInternals }) => {
212
+ import("./chunk-48grt472.js").then(({ StudioInternals }) => {
213
213
  window.remotion_isStudio = true;
214
214
  window.remotion_isReadOnlyStudio = true;
215
215
  window.remotion_inputProps = "{}";
@@ -21,8 +21,8 @@ const getInheritedLoopDisplay = (sequence, sequences) => {
21
21
  return getInheritedLoopDisplay(parent, sequences);
22
22
  };
23
23
  const calculateTimeline = ({ sequences, overrideIdsToNodePaths, }) => {
24
- var _a;
25
- var _b;
24
+ var _a, _b;
25
+ var _c;
26
26
  const sortedSequences = (0, sort_by_nonce_history_1.sortItemsByNonceHistory)(sequences);
27
27
  const tracks = [];
28
28
  if (sortedSequences.length === 0) {
@@ -44,7 +44,7 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, }) => {
44
44
  const cascadedStart = (0, get_sequence_visible_range_1.getCascadedStart)(sequence, sortedSequences);
45
45
  const visibleStart = (0, get_sequence_visible_range_1.getTimelineVisibleStart)(sequence, sortedSequences);
46
46
  const visibleDuration = (0, get_sequence_visible_range_1.getTimelineVisibleDuration)(sequence, sortedSequences);
47
- const overrideId = (_b = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.overrideId) !== null && _b !== void 0 ? _b : null;
47
+ const overrideId = (_c = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.overrideId) !== null && _c !== void 0 ? _c : null;
48
48
  const nodePath = overrideId ? overrideIdsToNodePaths[overrideId] : null;
49
49
  const hasKeyframeRows = sequence.controls !== null || sequence.effects.length > 0;
50
50
  tracks.push({
@@ -63,12 +63,14 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, }) => {
63
63
  keyframeDisplayOffset: hasKeyframeRows
64
64
  ? cascadedStart - sequence.from
65
65
  : 0,
66
+ sequenceFrameOffset: visibleStart - cascadedStart,
66
67
  nodePathInfo: nodePath
67
68
  ? {
68
69
  sequenceSubscriptionKey: nodePath,
69
70
  auxiliaryKeys: [],
70
71
  index: 0,
71
72
  numberOfSequencesWithThisNodePath: 0,
73
+ supportsEffects: ((_b = sequence.controls) === null || _b === void 0 ? void 0 : _b.supportsEffects) === true,
72
74
  }
73
75
  : null,
74
76
  });
@@ -106,6 +108,7 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, }) => {
106
108
  auxiliaryKeys: track.nodePathInfo.auxiliaryKeys,
107
109
  index,
108
110
  numberOfSequencesWithThisNodePath: 0,
111
+ supportsEffects: track.nodePathInfo.supportsEffects,
109
112
  },
110
113
  };
111
114
  })
@@ -122,6 +125,7 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, }) => {
122
125
  auxiliaryKeys: track.nodePathInfo.auxiliaryKeys,
123
126
  index: track.nodePathInfo.index,
124
127
  numberOfSequencesWithThisNodePath: (_a = nodePathIndexCounters.get(key)) !== null && _a !== void 0 ? _a : 0,
128
+ supportsEffects: track.nodePathInfo.supportsEffects,
125
129
  },
126
130
  };
127
131
  });
@@ -113,6 +113,7 @@ const createFolderIfDoesNotExist = (items, availableFolders, folderItem, folders
113
113
  }
114
114
  itemList.push({
115
115
  type: 'folder',
116
+ folder: folderItem,
116
117
  folderName: folderItem.name,
117
118
  items: [],
118
119
  key: folderItem.name,
@@ -0,0 +1,69 @@
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;
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 declare const detectFileType: (data: Uint8Array<ArrayBufferLike>) => FileType;
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectFileType = 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 (readUint16BE(offset) !== 0xffd8) {
102
+ return null;
103
+ }
104
+ offset += 2;
105
+ while (offset < data.length) {
106
+ if (data[offset] === 0xff) {
107
+ const marker = data[offset + 1];
108
+ if (marker === 0xc0 || marker === 0xc2) {
109
+ const height = readUint16BE(offset + 5);
110
+ const width = readUint16BE(offset + 7);
111
+ return { width, height };
112
+ }
113
+ const length = readUint16BE(offset + 2);
114
+ offset += length + 2;
115
+ }
116
+ else {
117
+ offset++;
118
+ }
119
+ }
120
+ return null;
121
+ };
122
+ const isJpeg = (data) => {
123
+ const jpegPattern = new Uint8Array([0xff, 0xd8]);
124
+ const jpeg = (0, exports.matchesPattern)(jpegPattern)(data.subarray(0, 2));
125
+ if (!jpeg) {
126
+ return null;
127
+ }
128
+ const dim = getJpegDimensions(data);
129
+ return { dimensions: dim, type: 'jpeg' };
130
+ };
131
+ const getGifDimensions = (data) => {
132
+ const view = new DataView(data.buffer, data.byteOffset);
133
+ const width = view.getUint16(6, true);
134
+ const height = view.getUint16(8, true);
135
+ return { width, height };
136
+ };
137
+ const isGif = (data) => {
138
+ const gifPattern = new Uint8Array([0x47, 0x49, 0x46, 0x38]);
139
+ if ((0, exports.matchesPattern)(gifPattern)(data.subarray(0, 4))) {
140
+ return { type: 'gif', dimensions: getGifDimensions(data) };
141
+ }
142
+ return null;
143
+ };
144
+ const getWebPDimensions = (bytes) => {
145
+ if (bytes.length < 30) {
146
+ return null;
147
+ }
148
+ if (bytes[0] !== 0x52 ||
149
+ bytes[1] !== 0x49 ||
150
+ bytes[2] !== 0x46 ||
151
+ bytes[3] !== 0x46 ||
152
+ bytes[8] !== 0x57 ||
153
+ bytes[9] !== 0x45 ||
154
+ bytes[10] !== 0x42 ||
155
+ bytes[11] !== 0x50) {
156
+ return null;
157
+ }
158
+ if (bytes[12] === 0x56 && bytes[13] === 0x50 && bytes[14] === 0x38) {
159
+ if (bytes[15] === 0x20) {
160
+ return {
161
+ width: bytes[26] | ((bytes[27] << 8) & 0x3fff),
162
+ height: bytes[28] | ((bytes[29] << 8) & 0x3fff),
163
+ };
164
+ }
165
+ }
166
+ if (bytes[12] === 0x56 &&
167
+ bytes[13] === 0x50 &&
168
+ bytes[14] === 0x38 &&
169
+ bytes[15] === 0x4c) {
170
+ return {
171
+ width: 1 + (bytes[21] | ((bytes[22] & 0x3f) << 8)),
172
+ height: 1 +
173
+ (((bytes[22] & 0xc0) >> 6) |
174
+ (bytes[23] << 2) |
175
+ ((bytes[24] & 0x0f) << 10)),
176
+ };
177
+ }
178
+ if (bytes[12] === 0x56 &&
179
+ bytes[13] === 0x50 &&
180
+ bytes[14] === 0x38 &&
181
+ bytes[15] === 0x58) {
182
+ return {
183
+ width: 1 + (bytes[24] | (bytes[25] << 8) | (bytes[26] << 16)),
184
+ height: 1 + (bytes[27] | (bytes[28] << 8) | (bytes[29] << 16)),
185
+ };
186
+ }
187
+ return null;
188
+ };
189
+ const isWebp = (data) => {
190
+ const webpPattern = new Uint8Array([0x52, 0x49, 0x46, 0x46]);
191
+ if ((0, exports.matchesPattern)(webpPattern)(data.subarray(0, 4))) {
192
+ return {
193
+ type: 'webp',
194
+ dimensions: getWebPDimensions(data),
195
+ };
196
+ }
197
+ return null;
198
+ };
199
+ const getBmpDimensions = (bmpData) => {
200
+ if (bmpData.length < 26) {
201
+ return null;
202
+ }
203
+ const view = new DataView(bmpData.buffer, bmpData.byteOffset);
204
+ return {
205
+ width: view.getUint32(18, true),
206
+ height: Math.abs(view.getInt32(22, true)),
207
+ };
208
+ };
209
+ const isBmp = (data) => {
210
+ const bmpPattern = new Uint8Array([0x42, 0x4d]);
211
+ if ((0, exports.matchesPattern)(bmpPattern)(data.subarray(0, 2))) {
212
+ const bmp = getBmpDimensions(data);
213
+ return { dimensions: bmp, type: 'bmp' };
214
+ }
215
+ return null;
216
+ };
217
+ const isPdf = (data) => {
218
+ if (data.length < 4) {
219
+ return null;
220
+ }
221
+ const pdfPattern = new Uint8Array([0x25, 0x50, 0x44, 0x46]);
222
+ return (0, exports.matchesPattern)(pdfPattern)(data.subarray(0, 4)) ? { type: 'pdf' } : null;
223
+ };
224
+ const detectFileType = (data) => {
225
+ if ((0, exports.isRiffWave)(data)) {
226
+ return { type: 'wav' };
227
+ }
228
+ if ((0, exports.isRiffAvi)(data)) {
229
+ return { type: 'riff' };
230
+ }
231
+ if ((0, exports.isAac)(data)) {
232
+ return { type: 'aac' };
233
+ }
234
+ if ((0, exports.isFlac)(data)) {
235
+ return { type: 'flac' };
236
+ }
237
+ if ((0, exports.isM3u)(data)) {
238
+ return { type: 'm3u' };
239
+ }
240
+ const webp = isWebp(data);
241
+ if (webp) {
242
+ return webp;
243
+ }
244
+ if ((0, exports.isWebm)(data)) {
245
+ return { type: 'webm' };
246
+ }
247
+ if ((0, exports.isIsoBaseMedia)(data)) {
248
+ return { type: 'iso-base-media' };
249
+ }
250
+ if ((0, exports.isTransportStream)(data)) {
251
+ return { type: 'transport-stream' };
252
+ }
253
+ if ((0, exports.isMp3)(data)) {
254
+ return { type: 'mp3' };
255
+ }
256
+ const gif = isGif(data);
257
+ if (gif) {
258
+ return gif;
259
+ }
260
+ const png = isPng(data);
261
+ if (png) {
262
+ return png;
263
+ }
264
+ const pdf = isPdf(data);
265
+ if (pdf) {
266
+ return pdf;
267
+ }
268
+ const bmp = isBmp(data);
269
+ if (bmp) {
270
+ return bmp;
271
+ }
272
+ const jpeg = isJpeg(data);
273
+ if (jpeg) {
274
+ return jpeg;
275
+ }
276
+ return { type: 'unknown' };
277
+ };
278
+ exports.detectFileType = detectFileType;
@@ -0,0 +1,4 @@
1
+ export declare const getFolderId: ({ folderName, parentName, }: {
2
+ folderName: string;
3
+ parentName: string | null;
4
+ }) => string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFolderId = void 0;
4
+ const getFolderId = ({ folderName, parentName, }) => {
5
+ return [parentName, folderName].filter(Boolean).join('/');
6
+ };
7
+ exports.getFolderId = getFolderId;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getXPositionOfItemInTimelineImperatively = void 0;
4
4
  const timeline_layout_1 = require("./timeline-layout");
5
5
  const getXPositionOfItemInTimelineImperatively = (frame, duration, width) => {
6
- const proportion = frame / (duration - 1);
6
+ const proportion = frame / duration;
7
7
  return proportion * (width - timeline_layout_1.TIMELINE_PADDING * 2) + timeline_layout_1.TIMELINE_PADDING;
8
8
  };
9
9
  exports.getXPositionOfItemInTimelineImperatively = getXPositionOfItemInTimelineImperatively;
@@ -3,35 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTimelineSequenceLayout = exports.SEQUENCE_BORDER_WIDTH = void 0;
4
4
  const timeline_layout_1 = require("./timeline-layout");
5
5
  exports.SEQUENCE_BORDER_WIDTH = 1;
6
- const getWidthOfTrack = ({ durationInFrames, lastFrame, windowWidth, spatialDuration, nonNegativeMarginLeft, }) => {
6
+ const getWidthOfTrack = ({ durationInFrames, timelineDuration, windowWidth, spatialDuration, nonNegativeMarginLeft, }) => {
7
7
  const fullWidth = windowWidth - timeline_layout_1.TIMELINE_PADDING * 2;
8
- const base = durationInFrames === Infinity || lastFrame === 0
8
+ const base = durationInFrames === Infinity || timelineDuration <= 0
9
9
  ? fullWidth
10
- : (spatialDuration / lastFrame) * fullWidth;
10
+ : (spatialDuration / timelineDuration) * fullWidth;
11
11
  return Math.max(0, base - exports.SEQUENCE_BORDER_WIDTH + nonNegativeMarginLeft);
12
12
  };
13
13
  const getTimelineSequenceLayout = ({ durationInFrames, startFrom, maxMediaDuration, startFromMedia, video, windowWidth, premountDisplay, postmountDisplay, }) => {
14
14
  var _a;
15
15
  const maxMediaSequenceDuration = (maxMediaDuration !== null && maxMediaDuration !== void 0 ? maxMediaDuration : Infinity) - startFromMedia;
16
16
  const timelineDuration = (_a = video.durationInFrames) !== null && _a !== void 0 ? _a : 1;
17
- const lastFrame = timelineDuration - 1;
18
17
  const spatialDuration = Math.max(0, Math.min(maxMediaSequenceDuration, durationInFrames, timelineDuration - startFrom));
19
- // Unclipped spatial duration: without the lastFrame - startFrom constraint
18
+ // Unclipped spatial duration: without the timeline-end constraint
20
19
  const naturalSpatialDuration = Math.max(0, Math.min(maxMediaSequenceDuration, durationInFrames));
21
- const marginLeft = lastFrame === 0
20
+ const marginLeft = timelineDuration <= 0
22
21
  ? 0
23
- : (startFrom / lastFrame) * (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2);
22
+ : (startFrom / timelineDuration) * (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2);
24
23
  const nonNegativeMarginLeft = Math.min(marginLeft, 0);
25
24
  const width = getWidthOfTrack({
26
25
  durationInFrames,
27
- lastFrame,
26
+ timelineDuration,
28
27
  nonNegativeMarginLeft,
29
28
  spatialDuration,
30
29
  windowWidth,
31
30
  });
32
31
  const naturalWidth = getWidthOfTrack({
33
32
  durationInFrames,
34
- lastFrame,
33
+ timelineDuration,
35
34
  nonNegativeMarginLeft,
36
35
  spatialDuration: naturalSpatialDuration,
37
36
  windowWidth,
@@ -39,7 +38,7 @@ const getTimelineSequenceLayout = ({ durationInFrames, startFrom, maxMediaDurati
39
38
  const premountWidth = premountDisplay
40
39
  ? getWidthOfTrack({
41
40
  durationInFrames: premountDisplay,
42
- lastFrame,
41
+ timelineDuration,
43
42
  nonNegativeMarginLeft,
44
43
  spatialDuration: premountDisplay,
45
44
  windowWidth,
@@ -48,7 +47,7 @@ const getTimelineSequenceLayout = ({ durationInFrames, startFrom, maxMediaDurati
48
47
  const postmountWidth = postmountDisplay
49
48
  ? getWidthOfTrack({
50
49
  durationInFrames: postmountDisplay,
51
- lastFrame,
50
+ timelineDuration,
52
51
  nonNegativeMarginLeft,
53
52
  spatialDuration: postmountDisplay,
54
53
  windowWidth,
@@ -4,12 +4,14 @@ export type SequenceNodePathInfo = {
4
4
  auxiliaryKeys: string[];
5
5
  index: number;
6
6
  numberOfSequencesWithThisNodePath: number;
7
+ supportsEffects: boolean;
7
8
  };
8
9
  type Track = {
9
10
  sequence: TSequence;
10
11
  depth: number;
11
12
  nodePathInfo: SequenceNodePathInfo | null;
12
13
  keyframeDisplayOffset: number;
14
+ sequenceFrameOffset: number;
13
15
  };
14
16
  export type TrackWithHash = Track & {
15
17
  hash: string;
@@ -1,7 +1,24 @@
1
- import type { SymbolicatedStackFrame } from '@remotion/studio-shared';
1
+ import type { CompositionComponentInfoResponse, SymbolicatedStackFrame } from '@remotion/studio-shared';
2
2
  import type { OriginalPosition } from '../error-overlay/react-overlay/utils/get-source-map';
3
3
  export declare const openInEditor: (stack: SymbolicatedStackFrame) => Promise<import("@remotion/studio-shared").OpenInEditorResponse>;
4
4
  export declare const openOriginalPositionInEditor: (originalPosition: OriginalPosition) => Promise<void>;
5
+ type ResolvedCompositionComponentInfo = {
6
+ location: CompositionComponentInfoResponse['location'];
7
+ canAddSequence: boolean;
8
+ };
9
+ export declare const subscribeToCompositionComponentInfo: (listener: () => void) => () => void;
10
+ export declare const getCachedCompositionComponentInfo: ({ compositionFile, compositionId, }: {
11
+ compositionFile: string;
12
+ compositionId: string;
13
+ }) => ResolvedCompositionComponentInfo | null;
14
+ export declare const useCachedCompositionComponentInfo: ({ compositionFile, compositionId, }: {
15
+ compositionFile: string | null;
16
+ compositionId: string | null;
17
+ }) => ResolvedCompositionComponentInfo | null;
18
+ export declare const loadCompositionComponentInfo: ({ compositionFile, compositionId, }: {
19
+ compositionFile: string;
20
+ compositionId: string;
21
+ }) => Promise<ResolvedCompositionComponentInfo>;
5
22
  export declare const preloadCompositionComponentInfo: ({ compositionFile, compositionId, }: {
6
23
  compositionFile: string;
7
24
  compositionId: string;
@@ -10,3 +27,4 @@ export declare const openCompositionComponentInEditor: ({ compositionFile, compo
10
27
  compositionFile: string;
11
28
  compositionId: string;
12
29
  }) => Promise<void>;
30
+ export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.openCompositionComponentInEditor = exports.preloadCompositionComponentInfo = exports.openOriginalPositionInEditor = exports.openInEditor = void 0;
3
+ exports.openCompositionComponentInEditor = exports.preloadCompositionComponentInfo = exports.loadCompositionComponentInfo = exports.useCachedCompositionComponentInfo = exports.getCachedCompositionComponentInfo = exports.subscribeToCompositionComponentInfo = exports.openOriginalPositionInEditor = exports.openInEditor = void 0;
4
+ const react_1 = require("react");
4
5
  const call_api_1 = require("../components/call-api");
5
6
  const openInEditor = (stack) => {
6
7
  const { originalFileName, originalLineNumber, originalColumnNumber, originalFunctionName, originalScriptCode, } = stack;
@@ -26,9 +27,40 @@ const openOriginalPositionInEditor = async (originalPosition) => {
26
27
  };
27
28
  exports.openOriginalPositionInEditor = openOriginalPositionInEditor;
28
29
  const componentResolutionCache = new Map();
30
+ const componentResolutionResults = new Map();
31
+ const componentResolutionListeners = new Set();
29
32
  const getComponentResolutionCacheKey = ({ compositionFile, compositionId, }) => {
30
33
  return `${compositionFile}::${compositionId}`;
31
34
  };
35
+ const notifyComponentResolutionListeners = () => {
36
+ for (const listener of componentResolutionListeners) {
37
+ listener();
38
+ }
39
+ };
40
+ const subscribeToCompositionComponentInfo = (listener) => {
41
+ componentResolutionListeners.add(listener);
42
+ return () => {
43
+ componentResolutionListeners.delete(listener);
44
+ };
45
+ };
46
+ exports.subscribeToCompositionComponentInfo = subscribeToCompositionComponentInfo;
47
+ const getCachedCompositionComponentInfo = ({ compositionFile, compositionId, }) => {
48
+ var _a;
49
+ return ((_a = componentResolutionResults.get(getComponentResolutionCacheKey({ compositionFile, compositionId }))) !== null && _a !== void 0 ? _a : null);
50
+ };
51
+ exports.getCachedCompositionComponentInfo = getCachedCompositionComponentInfo;
52
+ const useCachedCompositionComponentInfo = ({ compositionFile, compositionId, }) => {
53
+ return (0, react_1.useSyncExternalStore)(exports.subscribeToCompositionComponentInfo, () => {
54
+ if (compositionFile === null || compositionId === null) {
55
+ return null;
56
+ }
57
+ return (0, exports.getCachedCompositionComponentInfo)({
58
+ compositionFile,
59
+ compositionId,
60
+ });
61
+ }, () => null);
62
+ };
63
+ exports.useCachedCompositionComponentInfo = useCachedCompositionComponentInfo;
32
64
  const loadCompositionComponentInfo = async ({ compositionFile, compositionId, }) => {
33
65
  const cacheKey = getComponentResolutionCacheKey({
34
66
  compositionFile,
@@ -43,10 +75,13 @@ const loadCompositionComponentInfo = async ({ compositionFile, compositionId, })
43
75
  compositionFile,
44
76
  compositionId,
45
77
  });
46
- return {
78
+ const result = {
47
79
  location: body.location,
48
80
  canAddSequence: body.canAddSequence,
49
81
  };
82
+ componentResolutionResults.set(cacheKey, result);
83
+ notifyComponentResolutionListeners();
84
+ return result;
50
85
  })();
51
86
  componentResolutionCache.set(cacheKey, promise);
52
87
  try {
@@ -54,18 +89,21 @@ const loadCompositionComponentInfo = async ({ compositionFile, compositionId, })
54
89
  }
55
90
  catch (err) {
56
91
  componentResolutionCache.delete(cacheKey);
92
+ componentResolutionResults.delete(cacheKey);
93
+ notifyComponentResolutionListeners();
57
94
  throw err;
58
95
  }
59
96
  };
97
+ exports.loadCompositionComponentInfo = loadCompositionComponentInfo;
60
98
  const preloadCompositionComponentInfo = ({ compositionFile, compositionId, }) => {
61
- loadCompositionComponentInfo({
99
+ (0, exports.loadCompositionComponentInfo)({
62
100
  compositionFile,
63
101
  compositionId,
64
102
  }).catch(() => undefined);
65
103
  };
66
104
  exports.preloadCompositionComponentInfo = preloadCompositionComponentInfo;
67
105
  const openCompositionComponentInEditor = async ({ compositionFile, compositionId, }) => {
68
- const info = await loadCompositionComponentInfo({
106
+ const info = await (0, exports.loadCompositionComponentInfo)({
69
107
  compositionFile,
70
108
  compositionId,
71
109
  });
@@ -15,7 +15,7 @@ exports.EXPANDED_SECTION_PADDING_RIGHT = 10;
15
15
  const buildTimelineTree = ({ sequence, nodePathInfo, getDragOverrides, getEffectDragOverrides, codeValues, }) => {
16
16
  var _a;
17
17
  const roots = [];
18
- const { sequenceSubscriptionKey, index, auxiliaryKeys } = nodePathInfo;
18
+ const { sequenceSubscriptionKey, index, auxiliaryKeys, supportsEffects } = nodePathInfo;
19
19
  const controlFields = (0, studio_shared_1.getFieldsToShow)({
20
20
  schema: sequence.controls.schema,
21
21
  currentRuntimeValueDotNotation: sequence.controls.currentRuntimeValueDotNotation,
@@ -32,6 +32,7 @@ const buildTimelineTree = ({ sequence, nodePathInfo, getDragOverrides, getEffect
32
32
  auxiliaryKeys: [...auxiliaryKeys, 'controls', f.key],
33
33
  index,
34
34
  numberOfSequencesWithThisNodePath: 0,
35
+ supportsEffects,
35
36
  },
36
37
  label: (_a = f.description) !== null && _a !== void 0 ? _a : f.key,
37
38
  field: f,
@@ -46,6 +47,7 @@ const buildTimelineTree = ({ sequence, nodePathInfo, getDragOverrides, getEffect
46
47
  auxiliaryKeys: [...auxiliaryKeys, 'effects'],
47
48
  index,
48
49
  numberOfSequencesWithThisNodePath: 0,
50
+ supportsEffects,
49
51
  },
50
52
  label: 'Effects',
51
53
  effectInfo: null,
@@ -65,6 +67,7 @@ const buildTimelineTree = ({ sequence, nodePathInfo, getDragOverrides, getEffect
65
67
  auxiliaryKeys: [...auxiliaryKeys, 'effects', i.toString()],
66
68
  index,
67
69
  numberOfSequencesWithThisNodePath: 0,
70
+ supportsEffects,
68
71
  },
69
72
  label: effect.label,
70
73
  effectInfo: {
@@ -86,6 +89,7 @@ const buildTimelineTree = ({ sequence, nodePathInfo, getDragOverrides, getEffect
86
89
  ],
87
90
  index,
88
91
  numberOfSequencesWithThisNodePath: 0,
92
+ supportsEffects,
89
93
  },
90
94
  label: (_a = f.description) !== null && _a !== void 0 ? _a : f.key,
91
95
  field: f,