@remotion/studio 4.0.520 → 4.0.521
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.
- package/dist/api/shut-down-studio.d.ts +6 -0
- package/dist/api/shut-down-studio.js +23 -0
- package/dist/components/AudioWaveform.js +10 -6
- package/dist/components/Canvas.js +84 -12
- package/dist/components/CaptionInspector.d.ts +1 -0
- package/dist/components/CaptionInspector.js +43 -2
- package/dist/components/CaptionTextEditor.js +1 -1
- package/dist/components/CompositionSelector.js +41 -30
- package/dist/components/CompositionSelectorItem.d.ts +7 -0
- package/dist/components/CompositionSelectorItem.js +343 -67
- package/dist/components/ElementInstallConfirmation.js +74 -64
- package/dist/components/ElementLibraryModal.js +3 -1
- package/dist/components/InlineCaptionInspector.js +37 -1
- package/dist/components/InspectorPanel/ElementLibraryButton.js +3 -18
- package/dist/components/InspectorSequenceSection.js +1 -4
- package/dist/components/Menu/MenuSubItem.js +1 -1
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/ModalHeader.js +5 -1
- package/dist/components/QuickSwitcher/asset-search.d.ts +0 -1
- package/dist/components/QuickSwitcher/asset-search.js +1 -16
- package/dist/components/RenderButton.js +2 -2
- package/dist/components/RenderModal/RenderStatusModal.js +7 -1
- package/dist/components/RenderModal/ServerRenderModal.js +1 -1
- package/dist/components/RenderModal/WebRenderModal.js +1 -1
- package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +1 -1
- package/dist/components/SettingsModal.js +8 -5
- package/dist/components/TimeValue.js +36 -7
- package/dist/components/Timeline/Timeline.d.ts +1 -1
- package/dist/components/Timeline/Timeline.js +31 -19
- package/dist/components/Timeline/TimelineAssetField.d.ts +0 -1
- package/dist/components/Timeline/TimelineAssetField.js +16 -9
- package/dist/components/Timeline/TimelineCollapseToggle.js +1 -1
- package/dist/components/Timeline/TimelineFontWeightField.d.ts +11 -0
- package/dist/components/Timeline/TimelineFontWeightField.js +65 -0
- package/dist/components/Timeline/TimelineLayerChildren.d.ts +21 -0
- package/dist/components/Timeline/TimelineLayerChildren.js +129 -0
- package/dist/components/Timeline/TimelineNumberField.js +13 -5
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +4 -0
- package/dist/components/Timeline/TimelineSequence.js +38 -32
- package/dist/components/Timeline/TimelineSequenceItem.js +2 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +19 -7
- package/dist/components/Timeline/TimelineTickFormatProvider.d.ts +8 -0
- package/dist/components/Timeline/TimelineTickFormatProvider.js +16 -0
- package/dist/components/Timeline/TimelineTimeIndicators.js +7 -3
- package/dist/components/Timeline/TimelineVideoInfo.js +7 -3
- package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
- package/dist/components/UpdateStatusContext.d.ts +5 -0
- package/dist/components/UpdateStatusContext.js +53 -2
- package/dist/components/UpdatesSettings.js +25 -4
- package/dist/components/WebMcp.js +26 -0
- package/dist/components/composition-selector-drag-data.d.ts +27 -0
- package/dist/components/composition-selector-drag-data.js +80 -0
- package/dist/components/import-assets.d.ts +2 -1
- package/dist/components/import-assets.js +11 -1
- package/dist/components/parse-caption-file.d.ts +5 -0
- package/dist/components/parse-caption-file.js +63 -0
- package/dist/esm/chunk-emw4k5b0.js +99527 -0
- package/dist/esm/{chunk-np6q13k5.js → chunk-vkrvnx2h.js} +5913 -4699
- package/dist/esm/index.mjs +23 -8
- package/dist/esm/internals.mjs +6729 -5366
- package/dist/esm/previewEntry.mjs +6779 -5416
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-preview-file-type.js +22 -3
- package/dist/helpers/inserted-element-selection.d.ts +2 -1
- package/dist/helpers/use-menu-structure.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/state/modals.d.ts +0 -2
- package/package.json +16 -16
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compositionSelectorDragDataToSymbolicatedStack = exports.parseCompositionSelectorDragData = exports.hasCompositionSelectorDragData = exports.makeCompositionSelectorDragData = void 0;
|
|
4
|
+
const MIME_TYPE = 'application/remotion-composition-selector-reorder';
|
|
5
|
+
const isSafeString = (value, maxLength) => {
|
|
6
|
+
return (typeof value === 'string' &&
|
|
7
|
+
value.length > 0 &&
|
|
8
|
+
value.length <= maxLength &&
|
|
9
|
+
!value.includes('\0'));
|
|
10
|
+
};
|
|
11
|
+
const isCompositionOrFolder = (value) => {
|
|
12
|
+
if (typeof value !== 'object' || value === null) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const item = value;
|
|
16
|
+
if (item.type === 'composition') {
|
|
17
|
+
return isSafeString(item.compositionId, 500);
|
|
18
|
+
}
|
|
19
|
+
return (item.type === 'folder' &&
|
|
20
|
+
isSafeString(item.folderName, 500) &&
|
|
21
|
+
(item.parentName === null || isSafeString(item.parentName, 2000)));
|
|
22
|
+
};
|
|
23
|
+
const isSafeSourceFile = (value) => {
|
|
24
|
+
return (value === null ||
|
|
25
|
+
(isSafeString(value, 2000) &&
|
|
26
|
+
!value.includes('\\') &&
|
|
27
|
+
!value.startsWith('/') &&
|
|
28
|
+
!value.split('/').includes('..')));
|
|
29
|
+
};
|
|
30
|
+
const makeCompositionSelectorDragData = ({ item, sourceFile, }) => {
|
|
31
|
+
const data = {
|
|
32
|
+
type: 'remotion-composition-selector',
|
|
33
|
+
version: 1,
|
|
34
|
+
item,
|
|
35
|
+
sourceFile,
|
|
36
|
+
};
|
|
37
|
+
return { mimeType: MIME_TYPE, payload: JSON.stringify(data), data };
|
|
38
|
+
};
|
|
39
|
+
exports.makeCompositionSelectorDragData = makeCompositionSelectorDragData;
|
|
40
|
+
const hasCompositionSelectorDragData = (mimeTypes) => {
|
|
41
|
+
return Array.from(mimeTypes).includes(MIME_TYPE);
|
|
42
|
+
};
|
|
43
|
+
exports.hasCompositionSelectorDragData = hasCompositionSelectorDragData;
|
|
44
|
+
const parseCompositionSelectorDragData = (dataTransfer) => {
|
|
45
|
+
if (!(0, exports.hasCompositionSelectorDragData)(dataTransfer.types)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(dataTransfer.getData(MIME_TYPE));
|
|
50
|
+
if (parsed.type !== 'remotion-composition-selector' ||
|
|
51
|
+
parsed.version !== 1 ||
|
|
52
|
+
!isCompositionOrFolder(parsed.item) ||
|
|
53
|
+
!isSafeSourceFile(parsed.sourceFile)) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
type: 'remotion-composition-selector',
|
|
58
|
+
version: 1,
|
|
59
|
+
item: parsed.item,
|
|
60
|
+
sourceFile: parsed.sourceFile,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (_a) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.parseCompositionSelectorDragData = parseCompositionSelectorDragData;
|
|
68
|
+
const compositionSelectorDragDataToSymbolicatedStack = (dragData) => {
|
|
69
|
+
if (dragData.sourceFile === null) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
originalColumnNumber: null,
|
|
74
|
+
originalFileName: dragData.sourceFile,
|
|
75
|
+
originalFunctionName: null,
|
|
76
|
+
originalLineNumber: null,
|
|
77
|
+
originalScriptCode: null,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
exports.compositionSelectorDragDataToSymbolicatedStack = compositionSelectorDragDataToSymbolicatedStack;
|
|
@@ -77,8 +77,9 @@ export declare const getDurationInFrames: ({ durationInSeconds, fps, }: {
|
|
|
77
77
|
durationInSeconds: number | null;
|
|
78
78
|
fps: number;
|
|
79
79
|
}) => number | null;
|
|
80
|
-
export declare const pickFilesToImport: ({ multiple, }?: {
|
|
80
|
+
export declare const pickFilesToImport: ({ multiple, accept, }?: {
|
|
81
81
|
readonly multiple?: boolean | undefined;
|
|
82
|
+
readonly accept: string | null;
|
|
82
83
|
}) => Promise<File[]>;
|
|
83
84
|
export declare const importAssets: ({ compositionFile, compositionId, destinationDimensions, dropPosition, files, fps, from, preferCompositionStart, svgImportMode, }: {
|
|
84
85
|
compositionFile: string;
|
|
@@ -425,11 +425,14 @@ const getAssetElementFromStaticAsset = async (assetPath) => {
|
|
|
425
425
|
}
|
|
426
426
|
return (0, exports.getAssetElementFromPath)(assetPath);
|
|
427
427
|
};
|
|
428
|
-
const pickFilesToImport = ({ multiple = true, } = {}) => {
|
|
428
|
+
const pickFilesToImport = ({ multiple = true, accept, } = { accept: null }) => {
|
|
429
429
|
return new Promise((resolve) => {
|
|
430
430
|
const input = document.createElement('input');
|
|
431
431
|
input.type = 'file';
|
|
432
432
|
input.multiple = multiple;
|
|
433
|
+
if (accept !== null) {
|
|
434
|
+
input.accept = accept;
|
|
435
|
+
}
|
|
433
436
|
input.style.display = 'none';
|
|
434
437
|
let didResolve = false;
|
|
435
438
|
const resolveOnce = (files) => {
|
|
@@ -480,6 +483,7 @@ const insertCompositionElement = async ({ compositionFile, compositionId, elemen
|
|
|
480
483
|
(0, inserted_element_selection_1.requestInsertedElementSelection)({
|
|
481
484
|
compositionId,
|
|
482
485
|
nodePath: result.insertedNodePath,
|
|
486
|
+
notification: null,
|
|
483
487
|
});
|
|
484
488
|
}
|
|
485
489
|
return true;
|
|
@@ -897,7 +901,13 @@ const insertElement = async ({ compositionFile, compositionId, element, expected
|
|
|
897
901
|
? response.reason
|
|
898
902
|
: `Element file changed: ${response.conflict.filePath}`;
|
|
899
903
|
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${reason}`, 4000);
|
|
904
|
+
return;
|
|
900
905
|
}
|
|
906
|
+
(0, inserted_element_selection_1.requestInsertedElementSelection)({
|
|
907
|
+
compositionId,
|
|
908
|
+
nodePath: null,
|
|
909
|
+
notification: `Installed ${element.displayName}`,
|
|
910
|
+
});
|
|
901
911
|
}
|
|
902
912
|
catch (error) {
|
|
903
913
|
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${error instanceof Error ? error.message : String(error)}`, 4000);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseCaptionFile = void 0;
|
|
4
|
+
const isObject = (value) => {
|
|
5
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6
|
+
};
|
|
7
|
+
const isFiniteNumber = (value) => {
|
|
8
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
9
|
+
};
|
|
10
|
+
const parseCaptionFile = ({ fileName, contents, }) => {
|
|
11
|
+
if (!fileName.toLowerCase().endsWith('.json')) {
|
|
12
|
+
throw new Error('Unsupported caption file. Choose a .json file.');
|
|
13
|
+
}
|
|
14
|
+
let parsed;
|
|
15
|
+
try {
|
|
16
|
+
parsed = JSON.parse(contents);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw new Error(`Invalid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
20
|
+
}
|
|
21
|
+
if (!Array.isArray(parsed)) {
|
|
22
|
+
throw new Error('Expected a Remotion Caption[] JSON array.');
|
|
23
|
+
}
|
|
24
|
+
let previousStart = null;
|
|
25
|
+
for (const [index, caption] of parsed.entries()) {
|
|
26
|
+
const path = `captions[${index}]`;
|
|
27
|
+
if (!isObject(caption)) {
|
|
28
|
+
throw new Error(`${path} must be an object.`);
|
|
29
|
+
}
|
|
30
|
+
if (typeof caption.text !== 'string') {
|
|
31
|
+
throw new Error(`${path}.text must be a string.`);
|
|
32
|
+
}
|
|
33
|
+
if (!isFiniteNumber(caption.startMs) || caption.startMs < 0) {
|
|
34
|
+
throw new Error(`${path}.startMs must be a finite, non-negative number.`);
|
|
35
|
+
}
|
|
36
|
+
if (!isFiniteNumber(caption.endMs) || caption.endMs < 0) {
|
|
37
|
+
throw new Error(`${path}.endMs must be a finite, non-negative number.`);
|
|
38
|
+
}
|
|
39
|
+
if (caption.endMs < caption.startMs) {
|
|
40
|
+
throw new Error(`${path}.endMs must not be earlier than startMs.`);
|
|
41
|
+
}
|
|
42
|
+
if (caption.timestampMs !== null && !isFiniteNumber(caption.timestampMs)) {
|
|
43
|
+
throw new Error(`${path}.timestampMs must be a finite number or null.`);
|
|
44
|
+
}
|
|
45
|
+
if (caption.confidence !== null && !isFiniteNumber(caption.confidence)) {
|
|
46
|
+
throw new Error(`${path}.confidence must be a finite number or null.`);
|
|
47
|
+
}
|
|
48
|
+
if (typeof caption.confidence === 'number' &&
|
|
49
|
+
(caption.confidence < 0 || caption.confidence > 1)) {
|
|
50
|
+
throw new Error(`${path}.confidence must be between 0 and 1.`);
|
|
51
|
+
}
|
|
52
|
+
if (caption.pageBreakAfter !== undefined &&
|
|
53
|
+
typeof caption.pageBreakAfter !== 'boolean') {
|
|
54
|
+
throw new Error(`${path}.pageBreakAfter must be a boolean when provided.`);
|
|
55
|
+
}
|
|
56
|
+
if (previousStart !== null && caption.startMs < previousStart) {
|
|
57
|
+
throw new Error(`${path}.startMs is out of timestamp order.`);
|
|
58
|
+
}
|
|
59
|
+
previousStart = caption.startMs;
|
|
60
|
+
}
|
|
61
|
+
return parsed;
|
|
62
|
+
};
|
|
63
|
+
exports.parseCaptionFile = parseCaptionFile;
|