@remotion/studio 4.0.522 → 4.0.523
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/install-package.js +4 -2
- package/dist/components/AssetAudioVolume.d.ts +5 -0
- package/dist/components/AssetAudioVolume.js +33 -0
- package/dist/components/Canvas.js +5 -6
- package/dist/components/CaptionInspector.js +74 -20
- package/dist/components/CheckboardToggle.js +8 -6
- package/dist/components/Checkbox.d.ts +1 -0
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/CompositionContextButton.js +4 -1
- package/dist/components/CompositionSelectorItem.js +2 -2
- package/dist/components/ConfigureLicenseModal.js +1 -1
- package/dist/components/CurrentAsset.js +40 -6
- package/dist/components/EditorContexts.js +3 -1
- package/dist/components/ElementInstallConfirmation.js +287 -135
- package/dist/components/FixComputedValueModal.js +38 -8
- package/dist/components/FullscreenToggle.js +9 -8
- package/dist/components/GlobalKeybindings.js +50 -49
- package/dist/components/HighlightedElementSource.d.ts +5 -0
- package/dist/components/HighlightedElementSource.js +78 -0
- package/dist/components/InspectorPanel/MultiSequenceField.d.ts +12 -0
- package/dist/components/InspectorPanel/MultiSequenceField.js +131 -0
- package/dist/components/InspectorPanel/MultiSequenceInspector.d.ts +8 -0
- package/dist/components/InspectorPanel/MultiSequenceInspector.js +102 -0
- package/dist/components/InspectorPanel/MultiSequenceNumberField.d.ts +9 -0
- package/dist/components/InspectorPanel/MultiSequenceNumberField.js +88 -0
- package/dist/components/InspectorPanel.js +4 -0
- package/dist/components/InspectorSequenceSection.js +64 -1
- package/dist/components/InstallPackage.js +4 -5
- package/dist/components/KeyboardShortcutsSettings.js +212 -33
- package/dist/components/MenuToolbar.js +7 -5
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/Modals.js +3 -1
- package/dist/components/ModelManager.d.ts +16 -0
- package/dist/components/ModelManager.js +200 -0
- package/dist/components/ModelsSettings.d.ts +2 -0
- package/dist/components/ModelsSettings.js +133 -0
- package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
- package/dist/components/NewComposition/DismissableModal.js +2 -2
- package/dist/components/NewComposition/InputDragger.d.ts +2 -2
- package/dist/components/NewComposition/InputDragger.js +6 -6
- package/dist/components/NewComposition/NewFolder.js +11 -8
- package/dist/components/NewComposition/RenameFolder.js +17 -10
- package/dist/components/OptionalPackageModal.d.ts +11 -0
- package/dist/components/OptionalPackageModal.js +155 -0
- package/dist/components/PlayPause.js +4 -8
- package/dist/components/PlaybackKeyboardShortcutsManager.js +3 -6
- package/dist/components/PreviewToolbarOverflowButton.js +11 -2
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +5 -2
- package/dist/components/RadioButton.d.ts +1 -0
- package/dist/components/RadioButton.js +2 -2
- package/dist/components/RenderButton.js +5 -1
- package/dist/components/RenderModal/NumberSetting.d.ts +6 -1
- package/dist/components/RenderModal/NumberSetting.js +2 -2
- package/dist/components/RenderModal/RenderModalBasic.js +1 -1
- package/dist/components/RenderModal/RenderModalOutputName.d.ts +3 -1
- package/dist/components/RenderModal/RenderModalOutputName.js +4 -4
- package/dist/components/RenderModal/SeparateAudioOption.js +1 -1
- package/dist/components/RenderModal/WebRenderModalBasic.js +1 -1
- package/dist/components/RenderQueue/CaptionQueueItem.d.ts +6 -0
- package/dist/components/RenderQueue/CaptionQueueItem.js +129 -0
- package/dist/components/RenderQueue/CaptionQueueProcessor.d.ts +1 -0
- package/dist/components/RenderQueue/CaptionQueueProcessor.js +110 -0
- package/dist/components/RenderQueue/CaptionQueueProcessorLoader.d.ts +2 -0
- package/dist/components/RenderQueue/CaptionQueueProcessorLoader.js +54 -0
- package/dist/components/RenderQueue/RenderQueueItem.js +3 -3
- package/dist/components/RenderQueue/VideoMattingQueueItem.d.ts +6 -0
- package/dist/components/RenderQueue/VideoMattingQueueItem.js +129 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessor.d.ts +1 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +105 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.d.ts +2 -0
- package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.js +54 -0
- package/dist/components/RenderQueue/caption-job-types.d.ts +47 -0
- package/dist/components/RenderQueue/caption-job-types.js +7 -0
- package/dist/components/RenderQueue/context.d.ts +16 -0
- package/dist/components/RenderQueue/context.js +224 -11
- package/dist/components/RenderQueue/index.js +34 -10
- package/dist/components/RenderQueue/item-style.d.ts +1 -0
- package/dist/components/RenderQueue/item-style.js +2 -1
- package/dist/components/RenderQueue/load-model-for-job.d.ts +11 -0
- package/dist/components/RenderQueue/load-model-for-job.js +14 -0
- package/dist/components/RenderQueue/video-matting-job-types.d.ts +38 -0
- package/dist/components/RenderQueue/video-matting-job-types.js +5 -0
- package/dist/components/RendersTab.js +4 -4
- package/dist/components/SegmentedControl.d.ts +2 -2
- package/dist/components/SegmentedControl.js +38 -13
- package/dist/components/SelectedOutlinePolygon.js +8 -2
- package/dist/components/SettingsButton.d.ts +4 -0
- package/dist/components/SettingsButton.js +49 -0
- package/dist/components/SettingsModal.d.ts +1 -1
- package/dist/components/SettingsModal.js +3 -1
- package/dist/components/ShowOutlinesProvider.js +12 -0
- package/dist/components/SidebarCollapserControls.js +10 -11
- package/dist/components/SizeSelector.js +10 -2
- package/dist/components/SkillsSettings.js +2 -3
- package/dist/components/SnappingToggle.js +5 -2
- package/dist/components/Tabs/vertical.d.ts +1 -0
- package/dist/components/Tabs/vertical.js +2 -2
- package/dist/components/TimeValue.js +2 -3
- package/dist/components/Timeline/SequencePropsObserver.js +4 -0
- package/dist/components/Timeline/Timeline.js +2 -42
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
- package/dist/components/Timeline/TimelineDragHandler.js +2 -2
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
- package/dist/components/Timeline/TimelineRowChrome.js +11 -3
- package/dist/components/Timeline/TimelineSchemaField.js +8 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +2 -0
- package/dist/components/Timeline/TimelineSelection.js +55 -2
- package/dist/components/Timeline/TimelineSequence.js +75 -17
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
- package/dist/components/Timeline/TimelineSequenceItem.js +208 -111
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +23 -3
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +73 -25
- package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
- package/dist/components/Timeline/use-asset-timeline-context-menu.d.ts +2 -0
- package/dist/components/Timeline/use-asset-timeline-context-menu.js +52 -0
- package/dist/components/TimelineInOutToggle.js +20 -17
- package/dist/components/Transcription/LazyModels.d.ts +1 -0
- package/dist/components/Transcription/LazyModels.js +5 -0
- package/dist/components/Transcription/Models.d.ts +6 -0
- package/dist/components/Transcription/Models.js +18 -0
- package/dist/components/Transcription/TranscriptionModal.d.ts +3 -0
- package/dist/components/Transcription/TranscriptionModal.js +428 -0
- package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.d.ts +5 -0
- package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +48 -0
- package/dist/components/Transcription/caption-output-name.d.ts +2 -0
- package/dist/components/Transcription/caption-output-name.js +10 -0
- package/dist/components/Transcription/resample-media-to-16-khz.d.ts +6 -0
- package/dist/components/Transcription/resample-media-to-16-khz.js +82 -0
- package/dist/components/Transcription/whisper-languages.d.ts +2 -0
- package/dist/components/Transcription/whisper-languages.js +104 -0
- package/dist/components/Transcription/whisper-webgpu-capability.d.ts +2 -0
- package/dist/components/Transcription/whisper-webgpu-capability.js +7 -0
- package/dist/components/UndoRedoButtons.js +13 -38
- package/dist/components/UpdatesSettings.js +8 -12
- package/dist/components/VideoMatting/LazyModels.d.ts +1 -0
- package/dist/components/VideoMatting/LazyModels.js +5 -0
- package/dist/components/VideoMatting/Models.d.ts +6 -0
- package/dist/components/VideoMatting/Models.js +18 -0
- package/dist/components/VideoMatting/VideoMattingModal.d.ts +3 -0
- package/dist/components/VideoMatting/VideoMattingModal.js +207 -0
- package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.d.ts +5 -0
- package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +46 -0
- package/dist/components/VideoMatting/video-matting-capability.d.ts +2 -0
- package/dist/components/VideoMatting/video-matting-capability.js +7 -0
- package/dist/components/WebMcp.js +439 -22
- package/dist/components/import-assets.d.ts +3 -2
- package/dist/components/import-assets.js +5 -9
- package/dist/components/keyboard-shortcuts.d.ts +17 -1
- package/dist/components/keyboard-shortcuts.js +177 -89
- package/dist/components/public-output-name.d.ts +5 -0
- package/dist/components/public-output-name.js +60 -0
- package/dist/components/use-model-cache-status.d.ts +7 -0
- package/dist/components/use-model-cache-status.js +35 -0
- package/dist/esm/CaptionQueueProcessor-k0yrm3dj.mjs +211 -0
- package/dist/esm/HighlightedElementSource-jfc66k4p.mjs +1236 -0
- package/dist/esm/LazyModels-2trdm224.mjs +11 -0
- package/dist/esm/LazyModels-fjb5ckaq.mjs +11 -0
- package/dist/esm/TranscriptionModal-916jqhry.mjs +1011 -0
- package/dist/esm/VideoMattingModal-2tm79s9b.mjs +374 -0
- package/dist/esm/VideoMattingQueueProcessor-t1hgm2rm.mjs +109 -0
- package/dist/esm/index-1x7bsdh6.mjs +261 -0
- package/dist/esm/index-3hgr6gjx.mjs +41 -0
- package/dist/esm/index-5qddp5h7.mjs +36 -0
- package/dist/esm/index-5zrb1ft4.mjs +39 -0
- package/dist/esm/index-6cvm9a65.mjs +45923 -0
- package/dist/esm/index-7tt71e8n.mjs +36 -0
- package/dist/esm/index-9x6e1dq0.mjs +428 -0
- package/dist/esm/index-cw0pnpg5.mjs +50 -0
- package/dist/esm/index-czwvnn9g.mjs +35 -0
- package/dist/esm/index-hy4xcgty.mjs +1366 -0
- package/dist/esm/{chunk-je0h1bgt.js → index-jg13hf2g.mjs} +3 -1
- package/dist/esm/{chunk-6jf1natv.js → index-rcv7qkt5.mjs} +18 -1
- package/dist/esm/index-sgtmgc4h.mjs +423 -0
- package/dist/esm/index-te66vvrp.mjs +142 -0
- package/dist/esm/index-v4tr1bft.mjs +20 -0
- package/dist/esm/index-x7t2y7ws.mjs +54194 -0
- package/dist/esm/index-xhe2m2qr.mjs +1146 -0
- package/dist/esm/index.mjs +45 -933
- package/dist/esm/internals.mjs +13 -114393
- package/dist/esm/previewEntry.mjs +387 -115050
- package/dist/esm/renderEntry.mjs +3 -3
- package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-14148845.mjs} +1 -1
- package/dist/helpers/drag-aware-double-click.d.ts +2 -1
- package/dist/helpers/drag-aware-double-click.js +12 -1
- package/dist/helpers/get-asset-metadata.d.ts +1 -0
- package/dist/helpers/get-asset-metadata.js +4 -0
- package/dist/helpers/hoverable.js +8 -0
- package/dist/helpers/inject-css.js +2 -0
- package/dist/helpers/optional-package-dependencies.d.ts +3 -0
- package/dist/helpers/optional-package-dependencies.js +24 -0
- package/dist/helpers/pointer-session.d.ts +6 -0
- package/dist/helpers/pointer-session.js +36 -14
- package/dist/helpers/prism-tomorrow.d.ts +1 -0
- package/dist/helpers/prism-tomorrow.js +151 -0
- package/dist/helpers/sequence-node-path-mutations.js +11 -0
- package/dist/helpers/slugify-name.d.ts +1 -0
- package/dist/helpers/slugify-name.js +14 -0
- package/dist/helpers/studio-runtime-config.d.ts +1 -0
- package/dist/helpers/studio-runtime-config.js +6 -1
- package/dist/helpers/use-keybinding.d.ts +9 -3
- package/dist/helpers/use-keybinding.js +8 -9
- package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -0
- package/dist/helpers/use-keyboard-shortcut-label.js +15 -0
- package/dist/helpers/use-menu-structure.js +58 -13
- package/dist/icons/input-props.d.ts +1 -1
- package/dist/icons/input-props.js +2 -2
- package/dist/icons/models.d.ts +4 -0
- package/dist/icons/models.js +7 -0
- package/dist/icons/separation.d.ts +4 -0
- package/dist/icons/separation.js +7 -0
- package/dist/icons/transcription.d.ts +4 -0
- package/dist/icons/transcription.js +7 -0
- package/dist/icons/upload.js +1 -1
- package/dist/state/modals.d.ts +14 -2
- package/package.json +34 -20
- package/dist/components/UpdateCheck.d.ts +0 -1
- package/dist/components/UpdateCheck.js +0 -79
- package/dist/esm/chunk-3netyjd9.js +0 -99793
|
@@ -156,7 +156,8 @@ export declare const insertComposition: ({ composition, compositionFile, composi
|
|
|
156
156
|
from: number | null;
|
|
157
157
|
preferCompositionStart: boolean | null;
|
|
158
158
|
}) => Promise<void>;
|
|
159
|
-
export declare const insertElement: ({ compositionFile, compositionId, element, expectedFileState, position, from, overwriteExisting, }: {
|
|
159
|
+
export declare const insertElement: ({ installationName, compositionFile, compositionId, element, expectedFileState, position, from, overwriteExisting, }: {
|
|
160
|
+
installationName: string | null;
|
|
160
161
|
compositionFile: string;
|
|
161
162
|
compositionId: string;
|
|
162
163
|
element: InstallableElement;
|
|
@@ -164,4 +165,4 @@ export declare const insertElement: ({ compositionFile, compositionId, element,
|
|
|
164
165
|
position: InsertableCompositionElementPosition | null;
|
|
165
166
|
from: number | null;
|
|
166
167
|
overwriteExisting: boolean;
|
|
167
|
-
}) => Promise<
|
|
168
|
+
}) => Promise<boolean>;
|
|
@@ -479,13 +479,6 @@ const insertCompositionElement = async ({ compositionFile, compositionId, elemen
|
|
|
479
479
|
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
480
480
|
return false;
|
|
481
481
|
}
|
|
482
|
-
if (result.insertedNodePath !== null) {
|
|
483
|
-
(0, inserted_element_selection_1.requestInsertedElementSelection)({
|
|
484
|
-
compositionId,
|
|
485
|
-
nodePath: result.insertedNodePath,
|
|
486
|
-
notification: null,
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
482
|
return true;
|
|
490
483
|
};
|
|
491
484
|
const downloadRemoteAsset = (url) => {
|
|
@@ -882,12 +875,13 @@ const insertComposition = async ({ composition, compositionFile, compositionId,
|
|
|
882
875
|
}
|
|
883
876
|
};
|
|
884
877
|
exports.insertComposition = insertComposition;
|
|
885
|
-
const insertElement = async ({ compositionFile, compositionId, element, expectedFileState, position, from, overwriteExisting, }) => {
|
|
878
|
+
const insertElement = async ({ installationName, compositionFile, compositionId, element, expectedFileState, position, from, overwriteExisting, }) => {
|
|
886
879
|
try {
|
|
887
880
|
if ((0, browser_studio_operations_1.getBrowserStudioOperations)() === null) {
|
|
888
881
|
await (0, install_required_package_1.installRequiredPackages)(element.dependencies);
|
|
889
882
|
}
|
|
890
883
|
const response = await (0, element_install_api_1.installElement)({
|
|
884
|
+
installationName,
|
|
891
885
|
compositionFile,
|
|
892
886
|
compositionId,
|
|
893
887
|
element,
|
|
@@ -901,16 +895,18 @@ const insertElement = async ({ compositionFile, compositionId, element, expected
|
|
|
901
895
|
? response.reason
|
|
902
896
|
: `Element file changed: ${response.conflict.filePath}`;
|
|
903
897
|
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${reason}`, 4000);
|
|
904
|
-
return;
|
|
898
|
+
return false;
|
|
905
899
|
}
|
|
906
900
|
(0, inserted_element_selection_1.requestInsertedElementSelection)({
|
|
907
901
|
compositionId,
|
|
908
902
|
nodePath: null,
|
|
909
903
|
notification: `Installed ${element.displayName}`,
|
|
910
904
|
});
|
|
905
|
+
return true;
|
|
911
906
|
}
|
|
912
907
|
catch (error) {
|
|
913
908
|
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${error instanceof Error ? error.message : String(error)}`, 4000);
|
|
909
|
+
return false;
|
|
914
910
|
}
|
|
915
911
|
};
|
|
916
912
|
exports.insertElement = insertElement;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
import type { StudioKeyboardShortcut, StudioKeyboardShortcutAction, StudioKeyboardShortcutValue } from '@remotion/studio-shared';
|
|
1
2
|
export type KeyboardShortcut = {
|
|
2
3
|
readonly action: string;
|
|
3
|
-
readonly
|
|
4
|
+
readonly actionId: StudioKeyboardShortcutAction | null;
|
|
5
|
+
readonly fixedChords?: readonly (readonly string[])[];
|
|
6
|
+
readonly fixedReason?: string;
|
|
4
7
|
};
|
|
5
8
|
export type KeyboardShortcutGroup = {
|
|
6
9
|
readonly name: string;
|
|
7
10
|
readonly shortcuts: readonly KeyboardShortcut[];
|
|
8
11
|
};
|
|
12
|
+
export declare const defaultKeyboardShortcuts: Record<StudioKeyboardShortcutAction, readonly StudioKeyboardShortcut[]>;
|
|
9
13
|
export declare const keyboardShortcutGroups: readonly KeyboardShortcutGroup[];
|
|
10
14
|
export declare const askAIKeyboardShortcutGroup: KeyboardShortcutGroup;
|
|
15
|
+
export declare const getKeyboardShortcutsForAction: (action: "askAI" | "clearInOutPoints" | "copyEffectsAndValues" | "cutEffects" | "deleteSelection" | "duplicateSequences" | "enterFullscreen" | "goToFrame" | "jumpToBeginning" | "jumpToEnd" | "nextComposition" | "pauseAndReturnToPlaybackStart" | "pausePlayback" | "playForward" | "playPause" | "previousComposition" | "quickSwitcher" | "redo" | "render" | "resetZoom" | "reversePlayback" | "selectAllSequenceRows" | "selectOpacityProp" | "selectRotateProp" | "selectScaleProp" | "selectTranslateProp" | "setInPoint" | "setOutPoint" | "showKeyboardShortcuts" | "toggleBothSidebars" | "toggleCheckerboard" | "toggleLeftSidebar" | "toggleRightSidebar" | "toggleSnapping" | "undo" | "zoomIn" | "zoomOut", configured?: Partial<Record<"askAI" | "clearInOutPoints" | "copyEffectsAndValues" | "cutEffects" | "deleteSelection" | "duplicateSequences" | "enterFullscreen" | "goToFrame" | "jumpToBeginning" | "jumpToEnd" | "nextComposition" | "pauseAndReturnToPlaybackStart" | "pausePlayback" | "playForward" | "playPause" | "previousComposition" | "quickSwitcher" | "redo" | "render" | "resetZoom" | "reversePlayback" | "selectAllSequenceRows" | "selectOpacityProp" | "selectRotateProp" | "selectScaleProp" | "selectTranslateProp" | "setInPoint" | "setOutPoint" | "showKeyboardShortcuts" | "toggleBothSidebars" | "toggleCheckerboard" | "toggleLeftSidebar" | "toggleRightSidebar" | "toggleSnapping" | "undo" | "zoomIn" | "zoomOut", StudioKeyboardShortcutValue>> | null) => readonly StudioKeyboardShortcut[];
|
|
16
|
+
export declare const keyboardEventMatchesShortcut: ({ event, shortcut: value, }: {
|
|
17
|
+
readonly event: KeyboardEvent;
|
|
18
|
+
readonly shortcut: StudioKeyboardShortcut;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
export declare const keyboardShortcutsOverlap: (first: StudioKeyboardShortcut, second: StudioKeyboardShortcut) => boolean;
|
|
21
|
+
export declare const keyboardEventMatchesAction: (event: KeyboardEvent, action: "askAI" | "clearInOutPoints" | "copyEffectsAndValues" | "cutEffects" | "deleteSelection" | "duplicateSequences" | "enterFullscreen" | "goToFrame" | "jumpToBeginning" | "jumpToEnd" | "nextComposition" | "pauseAndReturnToPlaybackStart" | "pausePlayback" | "playForward" | "playPause" | "previousComposition" | "quickSwitcher" | "redo" | "render" | "resetZoom" | "reversePlayback" | "selectAllSequenceRows" | "selectOpacityProp" | "selectRotateProp" | "selectScaleProp" | "selectTranslateProp" | "setInPoint" | "setOutPoint" | "showKeyboardShortcuts" | "toggleBothSidebars" | "toggleCheckerboard" | "toggleLeftSidebar" | "toggleRightSidebar" | "toggleSnapping" | "undo" | "zoomIn" | "zoomOut") => boolean;
|
|
22
|
+
export declare const formatKeyboardShortcut: (value: StudioKeyboardShortcut) => readonly string[];
|
|
23
|
+
export declare const formatKeyboardShortcutForAria: (value: StudioKeyboardShortcut) => string;
|
|
24
|
+
export declare const getKeyboardShortcutLabel: (action: "askAI" | "clearInOutPoints" | "copyEffectsAndValues" | "cutEffects" | "deleteSelection" | "duplicateSequences" | "enterFullscreen" | "goToFrame" | "jumpToBeginning" | "jumpToEnd" | "nextComposition" | "pauseAndReturnToPlaybackStart" | "pausePlayback" | "playForward" | "playPause" | "previousComposition" | "quickSwitcher" | "redo" | "render" | "resetZoom" | "reversePlayback" | "selectAllSequenceRows" | "selectOpacityProp" | "selectRotateProp" | "selectScaleProp" | "selectTranslateProp" | "setInPoint" | "setOutPoint" | "showKeyboardShortcuts" | "toggleBothSidebars" | "toggleCheckerboard" | "toggleLeftSidebar" | "toggleRightSidebar" | "toggleSnapping" | "undo" | "zoomIn" | "zoomOut") => string;
|
|
25
|
+
export declare const getKeyboardShortcutAriaKeyShortcuts: (action: "askAI" | "clearInOutPoints" | "copyEffectsAndValues" | "cutEffects" | "deleteSelection" | "duplicateSequences" | "enterFullscreen" | "goToFrame" | "jumpToBeginning" | "jumpToEnd" | "nextComposition" | "pauseAndReturnToPlaybackStart" | "pausePlayback" | "playForward" | "playPause" | "previousComposition" | "quickSwitcher" | "redo" | "render" | "resetZoom" | "reversePlayback" | "selectAllSequenceRows" | "selectOpacityProp" | "selectRotateProp" | "selectScaleProp" | "selectTranslateProp" | "setInPoint" | "setOutPoint" | "showKeyboardShortcuts" | "toggleBothSidebars" | "toggleCheckerboard" | "toggleLeftSidebar" | "toggleRightSidebar" | "toggleSnapping" | "undo" | "zoomIn" | "zoomOut") => string;
|
|
26
|
+
export declare const shortcutFromKeyboardEvent: (event: KeyboardEvent) => StudioKeyboardShortcut | null;
|
|
@@ -1,135 +1,223 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.askAIKeyboardShortcutGroup = exports.keyboardShortcutGroups = void 0;
|
|
4
|
-
const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
|
|
3
|
+
exports.shortcutFromKeyboardEvent = exports.getKeyboardShortcutAriaKeyShortcuts = exports.getKeyboardShortcutLabel = exports.formatKeyboardShortcutForAria = exports.formatKeyboardShortcut = exports.keyboardEventMatchesAction = exports.keyboardShortcutsOverlap = exports.keyboardEventMatchesShortcut = exports.getKeyboardShortcutsForAction = exports.askAIKeyboardShortcutGroup = exports.keyboardShortcutGroups = exports.defaultKeyboardShortcuts = void 0;
|
|
5
4
|
const is_mac_1 = require("../helpers/is-mac");
|
|
5
|
+
const studio_runtime_config_1 = require("../helpers/studio-runtime-config");
|
|
6
|
+
const shortcut = (action, actionId) => ({ action, actionId });
|
|
7
|
+
const fixedShortcut = (action, fixedChords, fixedReason) => ({ action, actionId: null, fixedChords, fixedReason });
|
|
8
|
+
exports.defaultKeyboardShortcuts = {
|
|
9
|
+
playPause: [{ key: 'Space' }],
|
|
10
|
+
jumpToBeginning: [{ key: 'a' }],
|
|
11
|
+
jumpToEnd: [{ key: 'e' }],
|
|
12
|
+
reversePlayback: [{ key: 'j' }],
|
|
13
|
+
pausePlayback: [{ key: 'k' }],
|
|
14
|
+
playForward: [{ key: 'l' }],
|
|
15
|
+
goToFrame: [{ key: 'g' }],
|
|
16
|
+
pauseAndReturnToPlaybackStart: [{ key: 'Enter' }],
|
|
17
|
+
toggleLeftSidebar: [{ key: 'b', commandOrControl: true }],
|
|
18
|
+
toggleRightSidebar: [{ key: 'j', commandOrControl: true }],
|
|
19
|
+
toggleBothSidebars: [{ key: 'g', commandOrControl: true }],
|
|
20
|
+
enterFullscreen: [{ key: 'f' }],
|
|
21
|
+
toggleSnapping: [{ key: 'm', shift: true }],
|
|
22
|
+
previousComposition: [{ key: 'PageUp' }],
|
|
23
|
+
nextComposition: [{ key: 'PageDown' }],
|
|
24
|
+
showKeyboardShortcuts: [{ key: '?', shift: true }],
|
|
25
|
+
quickSwitcher: [{ key: 'k', commandOrControl: true }],
|
|
26
|
+
render: [{ key: 'r' }],
|
|
27
|
+
toggleCheckerboard: [{ key: 't' }],
|
|
28
|
+
setInPoint: [{ key: 'i' }],
|
|
29
|
+
setOutPoint: [{ key: 'o' }],
|
|
30
|
+
clearInOutPoints: [{ key: 'x' }],
|
|
31
|
+
zoomIn: [{ key: '+', shift: true }, { key: '+' }],
|
|
32
|
+
zoomOut: [{ key: '-' }],
|
|
33
|
+
resetZoom: [{ key: '0' }],
|
|
34
|
+
undo: [{ key: 'z', commandOrControl: true }],
|
|
35
|
+
redo: [
|
|
36
|
+
...(is_mac_1.isMac ? [] : [{ key: 'y', commandOrControl: true }]),
|
|
37
|
+
{ key: 'z', commandOrControl: true, shift: true },
|
|
38
|
+
],
|
|
39
|
+
selectAllSequenceRows: [{ key: 'a', commandOrControl: true }],
|
|
40
|
+
selectTranslateProp: [{ key: 'p' }],
|
|
41
|
+
selectOpacityProp: [{ key: 't' }],
|
|
42
|
+
selectRotateProp: [{ key: 'r' }],
|
|
43
|
+
selectScaleProp: [{ key: 's' }],
|
|
44
|
+
duplicateSequences: [{ key: 'd', commandOrControl: true }],
|
|
45
|
+
copyEffectsAndValues: [{ key: 'c', commandOrControl: true }],
|
|
46
|
+
cutEffects: [{ key: 'x', commandOrControl: true }],
|
|
47
|
+
deleteSelection: [{ key: 'Backspace' }, { key: 'Delete' }],
|
|
48
|
+
askAI: [{ key: 'i', commandOrControl: true }],
|
|
49
|
+
};
|
|
6
50
|
exports.keyboardShortcutGroups = [
|
|
7
51
|
{
|
|
8
52
|
name: 'Playback',
|
|
9
53
|
shortcuts: [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
action: 'Pause & return to playback start',
|
|
23
|
-
chords: [['Enter']],
|
|
24
|
-
},
|
|
54
|
+
fixedShortcut('1 second back', [['Shift', '←']], 'Context-sensitive timeline control'),
|
|
55
|
+
fixedShortcut('Previous frame', [['←']], 'Context-sensitive timeline control'),
|
|
56
|
+
shortcut('Play / Pause', 'playPause'),
|
|
57
|
+
fixedShortcut('Next frame', [['→']], 'Context-sensitive timeline control'),
|
|
58
|
+
fixedShortcut('1 second forward', [['Shift', '→']], 'Context-sensitive timeline control'),
|
|
59
|
+
shortcut('Jump to beginning', 'jumpToBeginning'),
|
|
60
|
+
shortcut('Jump to end', 'jumpToEnd'),
|
|
61
|
+
shortcut('Reverse playback', 'reversePlayback'),
|
|
62
|
+
shortcut('Pause', 'pausePlayback'),
|
|
63
|
+
shortcut('Play / Speed up', 'playForward'),
|
|
64
|
+
shortcut('Go to frame', 'goToFrame'),
|
|
65
|
+
shortcut('Pause & return to playback start', 'pauseAndReturnToPlaybackStart'),
|
|
25
66
|
],
|
|
26
67
|
},
|
|
27
68
|
{
|
|
28
69
|
name: 'Sidebar',
|
|
29
70
|
shortcuts: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
action: 'Toggle right sidebar',
|
|
36
|
-
chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'J']],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
action: 'Toggle both sidebars',
|
|
40
|
-
chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'G']],
|
|
41
|
-
},
|
|
71
|
+
shortcut('Toggle left sidebar', 'toggleLeftSidebar'),
|
|
72
|
+
shortcut('Toggle right sidebar', 'toggleRightSidebar'),
|
|
73
|
+
shortcut('Toggle both sidebars', 'toggleBothSidebars'),
|
|
42
74
|
],
|
|
43
75
|
},
|
|
44
76
|
{
|
|
45
77
|
name: 'View',
|
|
46
78
|
shortcuts: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
79
|
+
shortcut('Enter fullscreen', 'enterFullscreen'),
|
|
80
|
+
fixedShortcut('Exit fullscreen', [['Esc']], 'Handled by the browser'),
|
|
81
|
+
shortcut('Enable snapping', 'toggleSnapping'),
|
|
50
82
|
],
|
|
51
83
|
},
|
|
52
84
|
{
|
|
53
85
|
name: 'Navigation',
|
|
54
86
|
shortcuts: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
action: 'Checkerboard, unless a sequence or prop is selected',
|
|
63
|
-
chords: [['T']],
|
|
64
|
-
},
|
|
65
|
-
{ action: 'Show keyboard shortcuts', chords: [['?']] },
|
|
66
|
-
{
|
|
67
|
-
action: 'Quick Switcher',
|
|
68
|
-
chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'K']],
|
|
69
|
-
},
|
|
87
|
+
shortcut('Previous composition', 'previousComposition'),
|
|
88
|
+
shortcut('Next composition', 'nextComposition'),
|
|
89
|
+
shortcut('Render, unless a sequence or prop is selected', 'render'),
|
|
90
|
+
shortcut('Checkerboard, unless a sequence or prop is selected', 'toggleCheckerboard'),
|
|
91
|
+
shortcut('Show keyboard shortcuts', 'showKeyboardShortcuts'),
|
|
92
|
+
shortcut('Quick Switcher', 'quickSwitcher'),
|
|
70
93
|
],
|
|
71
94
|
},
|
|
72
95
|
{
|
|
73
96
|
name: 'Playback range',
|
|
74
97
|
shortcuts: [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
98
|
+
shortcut('Set In Point', 'setInPoint'),
|
|
99
|
+
shortcut('Set Out Point', 'setOutPoint'),
|
|
100
|
+
shortcut('Clear In/Out Points', 'clearInOutPoints'),
|
|
78
101
|
],
|
|
79
102
|
},
|
|
80
103
|
{
|
|
81
104
|
name: 'Zoom',
|
|
82
105
|
shortcuts: [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
106
|
+
shortcut('Zoom in', 'zoomIn'),
|
|
107
|
+
shortcut('Zoom out', 'zoomOut'),
|
|
108
|
+
shortcut('Reset zoom', 'resetZoom'),
|
|
86
109
|
],
|
|
87
110
|
},
|
|
88
111
|
{
|
|
89
112
|
name: 'Props Editor',
|
|
90
|
-
shortcuts: [
|
|
91
|
-
{ action: 'Undo', chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'Z']] },
|
|
92
|
-
{
|
|
93
|
-
action: 'Redo',
|
|
94
|
-
chords: [
|
|
95
|
-
is_mac_1.isMac
|
|
96
|
-
? [ShortcutHint_1.cmdOrCtrlCharacter, 'Shift', 'Z']
|
|
97
|
-
: [ShortcutHint_1.cmdOrCtrlCharacter, 'Y'],
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
],
|
|
113
|
+
shortcuts: [shortcut('Undo', 'undo'), shortcut('Redo', 'redo')],
|
|
101
114
|
},
|
|
102
115
|
{
|
|
103
116
|
name: 'Interactivity',
|
|
104
117
|
shortcuts: [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'D']],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
action: 'Copy effects / values',
|
|
121
|
-
chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'C']],
|
|
122
|
-
},
|
|
123
|
-
{ action: 'Cut effects', chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'X']] },
|
|
124
|
-
{
|
|
125
|
-
action: 'Paste effects / values',
|
|
126
|
-
chords: [[ShortcutHint_1.cmdOrCtrlCharacter, 'V']],
|
|
127
|
-
},
|
|
128
|
-
{ action: 'Delete / reset selection', chords: [['Del'], ['⌫']] },
|
|
118
|
+
fixedShortcut('Select range / axis lock drag', [['Shift']], 'Gesture modifier'),
|
|
119
|
+
fixedShortcut('Toggle selection', [[is_mac_1.isMac ? '⌘' : 'Ctrl']], 'Gesture modifier'),
|
|
120
|
+
shortcut('Select sequence rows', 'selectAllSequenceRows'),
|
|
121
|
+
shortcut('Select translate prop', 'selectTranslateProp'),
|
|
122
|
+
shortcut('Select opacity prop', 'selectOpacityProp'),
|
|
123
|
+
shortcut('Select rotate prop', 'selectRotateProp'),
|
|
124
|
+
shortcut('Select scale prop', 'selectScaleProp'),
|
|
125
|
+
shortcut('Duplicate sequences', 'duplicateSequences'),
|
|
126
|
+
shortcut('Copy effects / values', 'copyEffectsAndValues'),
|
|
127
|
+
shortcut('Cut effects', 'cutEffects'),
|
|
128
|
+
fixedShortcut('Paste effects / values', [[is_mac_1.isMac ? '⌘' : 'Ctrl', 'V']], 'Handled by the browser clipboard event'),
|
|
129
|
+
shortcut('Delete / reset selection', 'deleteSelection'),
|
|
129
130
|
],
|
|
130
131
|
},
|
|
131
132
|
];
|
|
132
133
|
exports.askAIKeyboardShortcutGroup = {
|
|
133
134
|
name: 'AI',
|
|
134
|
-
shortcuts: [
|
|
135
|
+
shortcuts: [shortcut('Ask AI', 'askAI')],
|
|
136
|
+
};
|
|
137
|
+
const getKeyboardShortcutsForAction = (action, configured = (0, studio_runtime_config_1.getStudioKeyboardShortcuts)()) => {
|
|
138
|
+
if (configured !== null &&
|
|
139
|
+
Object.prototype.hasOwnProperty.call(configured, action)) {
|
|
140
|
+
const value = configured[action];
|
|
141
|
+
if (value === null) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
return Array.isArray(value)
|
|
145
|
+
? value
|
|
146
|
+
: [
|
|
147
|
+
value,
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
return exports.defaultKeyboardShortcuts[action];
|
|
151
|
+
};
|
|
152
|
+
exports.getKeyboardShortcutsForAction = getKeyboardShortcutsForAction;
|
|
153
|
+
const normalizeKey = (key) => (key === 'Space' ? ' ' : key);
|
|
154
|
+
const keyboardEventMatchesShortcut = ({ event, shortcut: value, }) => {
|
|
155
|
+
var _a;
|
|
156
|
+
const commandOrControl = is_mac_1.isMac ? event.metaKey : event.ctrlKey;
|
|
157
|
+
return (event.key.toLowerCase() === normalizeKey(value.key).toLowerCase() &&
|
|
158
|
+
commandOrControl === ((_a = value.commandOrControl) !== null && _a !== void 0 ? _a : false) &&
|
|
159
|
+
(is_mac_1.isMac ? !event.ctrlKey : !event.metaKey) &&
|
|
160
|
+
(!value.shift || event.shiftKey) &&
|
|
161
|
+
(!value.alt || event.altKey));
|
|
162
|
+
};
|
|
163
|
+
exports.keyboardEventMatchesShortcut = keyboardEventMatchesShortcut;
|
|
164
|
+
const keyboardShortcutsOverlap = (first, second) => {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
return first.key.toLowerCase() === second.key.toLowerCase() &&
|
|
167
|
+
((_a = first.commandOrControl) !== null && _a !== void 0 ? _a : false) === ((_b = second.commandOrControl) !== null && _b !== void 0 ? _b : false);
|
|
168
|
+
};
|
|
169
|
+
exports.keyboardShortcutsOverlap = keyboardShortcutsOverlap;
|
|
170
|
+
const keyboardEventMatchesAction = (event, action) => (0, exports.getKeyboardShortcutsForAction)(action).some((value) => (0, exports.keyboardEventMatchesShortcut)({ event, shortcut: value }));
|
|
171
|
+
exports.keyboardEventMatchesAction = keyboardEventMatchesAction;
|
|
172
|
+
const displayKey = (keyboardKey) => {
|
|
173
|
+
if (keyboardKey === 'ArrowLeft')
|
|
174
|
+
return '←';
|
|
175
|
+
if (keyboardKey === 'ArrowRight')
|
|
176
|
+
return '→';
|
|
177
|
+
if (keyboardKey === 'Delete')
|
|
178
|
+
return 'Del';
|
|
179
|
+
if (keyboardKey === 'Backspace')
|
|
180
|
+
return '⌫';
|
|
181
|
+
if (keyboardKey === 'Escape')
|
|
182
|
+
return 'Esc';
|
|
183
|
+
return keyboardKey.length === 1 ? keyboardKey.toUpperCase() : keyboardKey;
|
|
184
|
+
};
|
|
185
|
+
const formatKeyboardShortcut = (value) => [
|
|
186
|
+
...(value.commandOrControl ? [is_mac_1.isMac ? '⌘' : 'Ctrl'] : []),
|
|
187
|
+
...(value.alt ? [is_mac_1.isMac ? 'Option' : 'Alt'] : []),
|
|
188
|
+
...(value.shift && !['+', '?'].includes(value.key) ? ['Shift'] : []),
|
|
189
|
+
displayKey(value.key),
|
|
190
|
+
];
|
|
191
|
+
exports.formatKeyboardShortcut = formatKeyboardShortcut;
|
|
192
|
+
const formatKeyboardShortcutForAria = (value) => [
|
|
193
|
+
...(value.commandOrControl ? [is_mac_1.isMac ? 'Meta' : 'Control'] : []),
|
|
194
|
+
...(value.alt ? ['Alt'] : []),
|
|
195
|
+
...(value.shift ? ['Shift'] : []),
|
|
196
|
+
value.key,
|
|
197
|
+
].join('+');
|
|
198
|
+
exports.formatKeyboardShortcutForAria = formatKeyboardShortcutForAria;
|
|
199
|
+
const getKeyboardShortcutLabel = (action) => (0, exports.getKeyboardShortcutsForAction)(action)
|
|
200
|
+
.map((value) => (0, exports.formatKeyboardShortcut)(value).join('+'))
|
|
201
|
+
.join(' / ');
|
|
202
|
+
exports.getKeyboardShortcutLabel = getKeyboardShortcutLabel;
|
|
203
|
+
const getKeyboardShortcutAriaKeyShortcuts = (action) => (0, exports.getKeyboardShortcutsForAction)(action)
|
|
204
|
+
.map(exports.formatKeyboardShortcutForAria)
|
|
205
|
+
.join(' ');
|
|
206
|
+
exports.getKeyboardShortcutAriaKeyShortcuts = getKeyboardShortcutAriaKeyShortcuts;
|
|
207
|
+
const shortcutFromKeyboardEvent = (event) => {
|
|
208
|
+
if (['Alt', 'Control', 'Meta', 'Shift'].includes(event.key)) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
if (is_mac_1.isMac ? event.ctrlKey : event.metaKey) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
key: event.key === ' ' ? 'Space' : event.key,
|
|
216
|
+
...((is_mac_1.isMac ? event.metaKey : event.ctrlKey)
|
|
217
|
+
? { commandOrControl: true }
|
|
218
|
+
: {}),
|
|
219
|
+
...(event.shiftKey ? { shift: true } : {}),
|
|
220
|
+
...(event.altKey ? { alt: true } : {}),
|
|
221
|
+
};
|
|
135
222
|
};
|
|
223
|
+
exports.shortcutFromKeyboardEvent = shortcutFromKeyboardEvent;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePublicOutputName = exports.getDefaultOutputBaseName = void 0;
|
|
4
|
+
const invalidCharacters = ['?', '*', '+', ':', '%'];
|
|
5
|
+
const getDefaultOutputBaseName = (src, displayName, fallbackName) => {
|
|
6
|
+
var _a;
|
|
7
|
+
let pathname = displayName;
|
|
8
|
+
if (!/^(data|blob):/i.test(src.trimStart())) {
|
|
9
|
+
pathname = (_a = src.split(/[?#]/)[0]) !== null && _a !== void 0 ? _a : src;
|
|
10
|
+
try {
|
|
11
|
+
pathname = new URL(src, typeof window === 'undefined'
|
|
12
|
+
? 'http://localhost'
|
|
13
|
+
: window.location.href).pathname;
|
|
14
|
+
}
|
|
15
|
+
catch (_b) {
|
|
16
|
+
// Fall back to the source as-is if it cannot be parsed as a URL.
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const lastPathSegment = pathname.split('/').filter(Boolean).at(-1);
|
|
20
|
+
let decoded = lastPathSegment !== null && lastPathSegment !== void 0 ? lastPathSegment : displayName;
|
|
21
|
+
try {
|
|
22
|
+
decoded = decodeURIComponent(decoded);
|
|
23
|
+
}
|
|
24
|
+
catch (_c) {
|
|
25
|
+
// Keep the encoded name if it contains an invalid escape sequence.
|
|
26
|
+
}
|
|
27
|
+
return (decoded
|
|
28
|
+
.replace(/\.[^/.]+$/, '')
|
|
29
|
+
.replace(/[^a-zA-Z0-9-_ ]/g, '-')
|
|
30
|
+
.trim()
|
|
31
|
+
.replace(/\s+/g, '-')
|
|
32
|
+
.replace(/^-+|-+$/g, '') || fallbackName);
|
|
33
|
+
};
|
|
34
|
+
exports.getDefaultOutputBaseName = getDefaultOutputBaseName;
|
|
35
|
+
const validatePublicOutputName = ({ extension, outName, }) => {
|
|
36
|
+
if (outName.trim() === '')
|
|
37
|
+
return 'Enter an output file';
|
|
38
|
+
if (outName !== outName.trim())
|
|
39
|
+
return 'The output file must not start or end with whitespace';
|
|
40
|
+
if (outName.startsWith('/') || /^[a-zA-Z]:/.test(outName))
|
|
41
|
+
return 'The output file must be relative to the public folder';
|
|
42
|
+
if (outName.includes('\\'))
|
|
43
|
+
return 'Use forward slashes in the output file';
|
|
44
|
+
if (outName.includes('\0'))
|
|
45
|
+
return 'The output file must not contain null characters';
|
|
46
|
+
const segments = outName.split('/');
|
|
47
|
+
if (segments.some((segment) => segment === ''))
|
|
48
|
+
return 'The output file must not contain empty path segments';
|
|
49
|
+
if (segments.some((segment) => segment === '.'))
|
|
50
|
+
return 'The output file must not contain "." path segments';
|
|
51
|
+
if (segments.some((segment) => segment.startsWith('..')))
|
|
52
|
+
return 'The output file must stay inside the public folder';
|
|
53
|
+
const invalidCharacter = invalidCharacters.find((character) => outName.includes(character));
|
|
54
|
+
if (invalidCharacter)
|
|
55
|
+
return `The output file must not contain "${invalidCharacter}"`;
|
|
56
|
+
if (!outName.toLowerCase().endsWith(extension))
|
|
57
|
+
return `The output file must end in ${extension}`;
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
exports.validatePublicOutputName = validatePublicOutputName;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useModelCacheStatus: <Model extends string>({ isModelCached, models, refreshKey, }: {
|
|
2
|
+
readonly isModelCached: (model: Model) => Promise<boolean>;
|
|
3
|
+
readonly models: readonly {
|
|
4
|
+
readonly name: Model;
|
|
5
|
+
}[];
|
|
6
|
+
readonly refreshKey: string;
|
|
7
|
+
}) => ReadonlySet<Model>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useModelCacheStatus = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useModelCacheStatus = ({ isModelCached, models, refreshKey, }) => {
|
|
6
|
+
const [cachedModels, setCachedModels] = (0, react_1.useState)(new Set());
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
Promise.all(models.map(async ({ name }) => ({
|
|
10
|
+
cached: await isModelCached(name),
|
|
11
|
+
name,
|
|
12
|
+
})))
|
|
13
|
+
.then((results) => {
|
|
14
|
+
if (!cancelled) {
|
|
15
|
+
const nextCachedModels = new Set();
|
|
16
|
+
for (const result of results) {
|
|
17
|
+
if (result.cached) {
|
|
18
|
+
nextCachedModels.add(result.name);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
setCachedModels(nextCachedModels);
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
.catch(() => {
|
|
25
|
+
if (!cancelled) {
|
|
26
|
+
setCachedModels(new Set());
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
cancelled = true;
|
|
31
|
+
};
|
|
32
|
+
}, [isModelCached, models, refreshKey]);
|
|
33
|
+
return cachedModels;
|
|
34
|
+
};
|
|
35
|
+
exports.useModelCacheStatus = useModelCacheStatus;
|