@remotion/studio 4.0.521 → 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/CanvasIfSizeIsAvailable.js +7 -0
- 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/CopyButton.js +7 -14
- package/dist/components/CurrentAsset.js +40 -6
- package/dist/components/Editor.js +6 -5
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorContexts.js +3 -1
- package/dist/components/ElementInstallConfirmation.js +290 -136
- package/dist/components/FixComputedValueModal.js +56 -16
- 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/InspectorLocationCopy.js +10 -5
- 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/MenuBuildIndicator.js +7 -2
- package/dist/components/MenuCompositionName.js +62 -6
- 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/CliCopyButton.js +13 -27
- 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/RenderQueueCopyToClipboard.js +7 -4
- 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 +21 -16
- package/dist/components/SizeSelector.js +10 -2
- package/dist/components/SkillsSettings.js +11 -8
- package/dist/components/SnappingToggle.js +5 -2
- package/dist/components/Splitter/SplitterContainer.js +63 -10
- package/dist/components/Splitter/SplitterContext.d.ts +3 -0
- package/dist/components/Splitter/SplitterContext.js +5 -1
- package/dist/components/Splitter/SplitterElement.js +11 -2
- package/dist/components/Splitter/SplitterHandle.d.ts +1 -0
- package/dist/components/Splitter/SplitterHandle.js +55 -25
- 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/SubscribeToNodePaths.d.ts +2 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +2 -1
- package/dist/components/Timeline/Timeline.js +17 -46
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
- package/dist/components/Timeline/TimelineDragHandler.js +11 -6
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
- package/dist/components/Timeline/TimelinePinchZoom.js +6 -30
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -7
- 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 +148 -25
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
- package/dist/components/Timeline/TimelineSequenceItem.js +220 -112
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +35 -5
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +233 -138
- package/dist/components/Timeline/TimelineSlider.js +1 -4
- package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
- package/dist/components/Timeline/TimelineWidthProvider.js +2 -5
- package/dist/components/Timeline/TimelineZoomControls.js +20 -20
- package/dist/components/Timeline/get-sequence-split-menu-item.d.ts +11 -0
- package/dist/components/Timeline/get-sequence-split-menu-item.js +55 -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/Timeline/use-sequence-props-subscription.d.ts +3 -2
- package/dist/components/Timeline/use-sequence-props-subscription.js +4 -10
- package/dist/components/TimelineInOutToggle.js +20 -17
- package/dist/components/TopPanel.js +3 -19
- 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 +17 -17
- 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/ZoomPersistor.js +6 -3
- package/dist/components/composition-menu-items.js +1 -1
- 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 -114127
- package/dist/esm/previewEntry.mjs +387 -114784
- package/dist/esm/renderEntry.mjs +3 -3
- package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-14148845.mjs} +1 -1
- package/dist/helpers/copy-text.js +1 -2
- 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-copy-feedback.d.ts +4 -0
- package/dist/helpers/use-copy-feedback.js +19 -0
- 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/copy.d.ts +5 -0
- package/dist/icons/copy.js +12 -0
- 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/canvas-ref.d.ts +1 -0
- package/dist/state/canvas-ref.js +2 -1
- package/dist/state/modals.d.ts +14 -2
- package/dist/state/sidebar.d.ts +3 -0
- package/dist/state/sidebar.js +6 -1
- package/dist/state/timeline-zoom.d.ts +1 -1
- package/dist/state/timeline-zoom.js +3 -3
- package/dist/visual-controls/VisualControls.js +4 -0
- package/package.json +34 -20
- package/dist/components/UpdateCheck.d.ts +0 -1
- package/dist/components/UpdateCheck.js +0 -79
- package/dist/esm/chunk-emw4k5b0.js +0 -99527
- package/dist/esm/chunk-vkrvnx2h.js +0 -99378
- package/dist/helpers/use-max-media-duration.d.ts +0 -2
- package/dist/helpers/use-max-media-duration.js +0 -61
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModelManager = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const colors_1 = require("../helpers/colors");
|
|
8
|
+
const check_circle_filled_1 = require("../icons/check-circle-filled");
|
|
9
|
+
const cloud_download_1 = require("../icons/cloud-download");
|
|
10
|
+
const trash_1 = require("../icons/trash");
|
|
11
|
+
const InlineAction_1 = require("./InlineAction");
|
|
12
|
+
const is_menu_item_1 = require("./Menu/is-menu-item");
|
|
13
|
+
const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
|
|
14
|
+
const render_modals_1 = require("./RenderModal/render-modals");
|
|
15
|
+
const Spinner_1 = require("./Spinner");
|
|
16
|
+
const modelPanel = {
|
|
17
|
+
...render_modals_1.optionsPanel,
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
};
|
|
20
|
+
const hiddenPanel = { display: 'none' };
|
|
21
|
+
const container = {
|
|
22
|
+
boxSizing: 'border-box',
|
|
23
|
+
flex: 1,
|
|
24
|
+
fontFamily: 'sans-serif',
|
|
25
|
+
minWidth: 0,
|
|
26
|
+
padding: '16px 16px 0',
|
|
27
|
+
width: '100%',
|
|
28
|
+
};
|
|
29
|
+
const flushContainer = {
|
|
30
|
+
...container,
|
|
31
|
+
padding: '16px 0 0',
|
|
32
|
+
};
|
|
33
|
+
const descriptionStyle = {
|
|
34
|
+
color: colors_1.LIGHT_TEXT,
|
|
35
|
+
fontSize: 13,
|
|
36
|
+
lineHeight: 1.5,
|
|
37
|
+
margin: 0,
|
|
38
|
+
whiteSpace: 'pre-line',
|
|
39
|
+
};
|
|
40
|
+
const list = { marginTop: 14 };
|
|
41
|
+
const modelRow = {
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
borderBottom: colors_1.BORDER_WHITE_ALPHA_12,
|
|
44
|
+
display: 'flex',
|
|
45
|
+
gap: 10,
|
|
46
|
+
minHeight: 38,
|
|
47
|
+
padding: '0 10px',
|
|
48
|
+
};
|
|
49
|
+
const lastModelRow = {
|
|
50
|
+
...modelRow,
|
|
51
|
+
borderBottom: 'none',
|
|
52
|
+
};
|
|
53
|
+
const statusIcon = {
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
height: 14,
|
|
56
|
+
width: 14,
|
|
57
|
+
};
|
|
58
|
+
const modelName = {
|
|
59
|
+
color: colors_1.WHITE,
|
|
60
|
+
flex: 1,
|
|
61
|
+
fontFamily: 'monospace',
|
|
62
|
+
fontSize: 13,
|
|
63
|
+
lineHeight: 1.4,
|
|
64
|
+
minWidth: 0,
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
textOverflow: 'ellipsis',
|
|
67
|
+
whiteSpace: 'nowrap',
|
|
68
|
+
};
|
|
69
|
+
const status = {
|
|
70
|
+
color: colors_1.LIGHT_TEXT,
|
|
71
|
+
fontSize: 12,
|
|
72
|
+
fontVariantNumeric: 'tabular-nums',
|
|
73
|
+
lineHeight: 1.4,
|
|
74
|
+
whiteSpace: 'nowrap',
|
|
75
|
+
};
|
|
76
|
+
const actionIcon = { height: 14, width: 14 };
|
|
77
|
+
const actionSlot = {
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
display: 'inline-flex',
|
|
80
|
+
flexShrink: 0,
|
|
81
|
+
height: 24,
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
width: 24,
|
|
84
|
+
};
|
|
85
|
+
const ModelManager = ({ ariaLabel, availableModels, description, indent, isModelCached, loadModel, prepare, removeModel, visible, }) => {
|
|
86
|
+
const mounted = (0, react_1.useRef)(true);
|
|
87
|
+
const initialized = (0, react_1.useRef)(false);
|
|
88
|
+
const [cachedModels, setCachedModels] = (0, react_1.useState)(null);
|
|
89
|
+
const [actionState, setActionState] = (0, react_1.useState)({
|
|
90
|
+
type: 'idle',
|
|
91
|
+
});
|
|
92
|
+
const [cacheCheckError, setCacheCheckError] = (0, react_1.useState)(null);
|
|
93
|
+
(0, react_1.useEffect)(() => {
|
|
94
|
+
mounted.current = true;
|
|
95
|
+
return () => {
|
|
96
|
+
mounted.current = false;
|
|
97
|
+
};
|
|
98
|
+
}, []);
|
|
99
|
+
(0, react_1.useEffect)(() => {
|
|
100
|
+
if (!visible || initialized.current) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
initialized.current = true;
|
|
104
|
+
Promise.resolve()
|
|
105
|
+
.then(() => prepare === null || prepare === void 0 ? void 0 : prepare())
|
|
106
|
+
.then(() => Promise.all(availableModels.map(async ({ name }) => (await isModelCached(name)) ? name : null)))
|
|
107
|
+
.then((models) => {
|
|
108
|
+
if (mounted.current) {
|
|
109
|
+
const cached = new Set();
|
|
110
|
+
for (const model of models) {
|
|
111
|
+
if (model !== null) {
|
|
112
|
+
cached.add(model);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
setCachedModels(cached);
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
.catch((error) => {
|
|
119
|
+
if (mounted.current) {
|
|
120
|
+
setCachedModels(new Set());
|
|
121
|
+
setCacheCheckError(error instanceof Error ? error.message : String(error));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}, [availableModels, isModelCached, prepare, visible]);
|
|
125
|
+
const downloadModel = (0, react_1.useCallback)((model) => {
|
|
126
|
+
setActionState({ type: 'downloading', model, progress: 0 });
|
|
127
|
+
loadModel(model, (progress) => {
|
|
128
|
+
if (mounted.current) {
|
|
129
|
+
setActionState({ type: 'downloading', model, progress });
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
.then(() => {
|
|
133
|
+
if (mounted.current) {
|
|
134
|
+
setCachedModels((current) => new Set([...(current !== null && current !== void 0 ? current : []), model]));
|
|
135
|
+
setActionState({ type: 'idle' });
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
.catch((error) => {
|
|
139
|
+
if (mounted.current) {
|
|
140
|
+
setActionState({
|
|
141
|
+
type: 'error',
|
|
142
|
+
model,
|
|
143
|
+
message: error instanceof Error ? error.message : String(error),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}, [loadModel]);
|
|
148
|
+
const remove = (0, react_1.useCallback)((model) => {
|
|
149
|
+
setActionState({ type: 'removing', model });
|
|
150
|
+
removeModel(model)
|
|
151
|
+
.then(() => {
|
|
152
|
+
if (mounted.current) {
|
|
153
|
+
setCachedModels((current) => {
|
|
154
|
+
const next = new Set(current !== null && current !== void 0 ? current : []);
|
|
155
|
+
next.delete(model);
|
|
156
|
+
return next;
|
|
157
|
+
});
|
|
158
|
+
setActionState({ type: 'idle' });
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
.catch((error) => {
|
|
162
|
+
if (mounted.current) {
|
|
163
|
+
setActionState({
|
|
164
|
+
type: 'error',
|
|
165
|
+
model,
|
|
166
|
+
message: error instanceof Error ? error.message : String(error),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}, [removeModel]);
|
|
171
|
+
const renderDownloadIcon = (0, react_1.useCallback)((color) => {
|
|
172
|
+
return jsx_runtime_1.jsx(cloud_download_1.CloudDownloadIcon, { color: color, style: actionIcon });
|
|
173
|
+
}, []);
|
|
174
|
+
const renderRemoveIcon = (0, react_1.useCallback)((color) => {
|
|
175
|
+
return jsx_runtime_1.jsx(trash_1.TrashIcon, { color: color, style: actionIcon });
|
|
176
|
+
}, []);
|
|
177
|
+
const actionInProgress = actionState.type === 'downloading' || actionState.type === 'removing';
|
|
178
|
+
return (jsx_runtime_1.jsx("div", { style: visible ? modelPanel : hiddenPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsxs("div", { style: indent ? container : flushContainer, children: [description === null ? null : (jsx_runtime_1.jsx("p", { style: descriptionStyle, children: description })), cacheCheckError ? (jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: cacheCheckError, type: "error" })) : null, jsx_runtime_1.jsx("div", { style: description === null ? undefined : list, role: "list", "aria-label": ariaLabel, children: availableModels.map((model, index) => {
|
|
179
|
+
var _a;
|
|
180
|
+
const cached = (_a = cachedModels === null || cachedModels === void 0 ? void 0 : cachedModels.has(model.name)) !== null && _a !== void 0 ? _a : false;
|
|
181
|
+
const processingThisModel = actionState.type !== 'idle' &&
|
|
182
|
+
actionState.type !== 'error' &&
|
|
183
|
+
actionState.model === model.name;
|
|
184
|
+
const progress = actionState.type === 'downloading' &&
|
|
185
|
+
actionState.model === model.name
|
|
186
|
+
? actionState.progress
|
|
187
|
+
: null;
|
|
188
|
+
const modelStatus = processingThisModel
|
|
189
|
+
? actionState.type === 'removing'
|
|
190
|
+
? 'Removing…'
|
|
191
|
+
: `Downloading${progress === null ? '…' : ` ${Math.round(progress * 100)}%`}`
|
|
192
|
+
: actionState.type === 'error' && actionState.model === model.name
|
|
193
|
+
? actionState.message
|
|
194
|
+
: (0, studio_shared_1.formatBytes)(model.webGpuDownloadSize);
|
|
195
|
+
return (jsx_runtime_1.jsxs("div", { role: "listitem", style: index === availableModels.length - 1 ? lastModelRow : modelRow, children: [
|
|
196
|
+
jsx_runtime_1.jsx("span", { style: modelName, children: model.name }), jsx_runtime_1.jsx("span", { style: status, title: modelStatus, children: modelStatus }), cached ? (jsx_runtime_1.jsx(check_circle_filled_1.CheckCircleFilled, { "aria-hidden": true, style: { ...statusIcon, fill: colors_1.BLUE } })) : null, processingThisModel ? (jsx_runtime_1.jsx("span", { style: actionSlot, children: jsx_runtime_1.jsx(Spinner_1.Spinner, { duration: 0.5, size: 14 }) })) : cached ? (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { disabled: actionInProgress, onClick: () => remove(model.name), renderAction: renderRemoveIcon, title: `Remove ${model.name}`, variant: null })) : (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { disabled: cachedModels === null || actionInProgress, onClick: () => downloadModel(model.name), renderAction: renderDownloadIcon, title: `Download ${model.name}`, variant: null }))] }, model.name));
|
|
197
|
+
}) })
|
|
198
|
+
] }) }));
|
|
199
|
+
};
|
|
200
|
+
exports.ModelManager = ModelManager;
|
|
@@ -0,0 +1,133 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ModelsSettings = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const colors_1 = require("../helpers/colors");
|
|
40
|
+
const optional_package_dependencies_1 = require("../helpers/optional-package-dependencies");
|
|
41
|
+
const Button_1 = require("./Button");
|
|
42
|
+
const styles_1 = require("./InspectorPanel/styles");
|
|
43
|
+
const OptionalPackageModal_1 = require("./OptionalPackageModal");
|
|
44
|
+
const whisper_webgpu_capability_1 = require("./Transcription/whisper-webgpu-capability");
|
|
45
|
+
const video_matting_capability_1 = require("./VideoMatting/video-matting-capability");
|
|
46
|
+
const LazyWhisperModels = react_1.default.lazy(() => Promise.resolve().then(() => __importStar(require('./Transcription/LazyModels'))));
|
|
47
|
+
const LazyVideoMattingModels = react_1.default.lazy(() => Promise.resolve().then(() => __importStar(require('./VideoMatting/LazyModels'))));
|
|
48
|
+
const container = {
|
|
49
|
+
alignSelf: 'flex-start',
|
|
50
|
+
boxSizing: 'border-box',
|
|
51
|
+
fontFamily: 'sans-serif',
|
|
52
|
+
minWidth: 0,
|
|
53
|
+
padding: 16,
|
|
54
|
+
width: '100%',
|
|
55
|
+
};
|
|
56
|
+
const overview = {
|
|
57
|
+
color: colors_1.LIGHT_TEXT,
|
|
58
|
+
fontSize: 13,
|
|
59
|
+
lineHeight: 1.5,
|
|
60
|
+
margin: '0 0 16px',
|
|
61
|
+
};
|
|
62
|
+
const section = {
|
|
63
|
+
paddingBottom: 16,
|
|
64
|
+
};
|
|
65
|
+
const lastSection = {
|
|
66
|
+
paddingTop: 16,
|
|
67
|
+
};
|
|
68
|
+
const title = {
|
|
69
|
+
...styles_1.sectionHeader,
|
|
70
|
+
margin: 0,
|
|
71
|
+
padding: '4px 0 0',
|
|
72
|
+
};
|
|
73
|
+
const packageNameStyle = {
|
|
74
|
+
color: colors_1.LIGHT_TEXT,
|
|
75
|
+
fontFamily: 'monospace',
|
|
76
|
+
fontSize: 12,
|
|
77
|
+
lineHeight: 1.4,
|
|
78
|
+
margin: 0,
|
|
79
|
+
};
|
|
80
|
+
const headingRow = {
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
display: 'flex',
|
|
83
|
+
gap: 12,
|
|
84
|
+
justifyContent: 'space-between',
|
|
85
|
+
};
|
|
86
|
+
const missingText = {
|
|
87
|
+
color: colors_1.LIGHT_TEXT,
|
|
88
|
+
fontSize: 13,
|
|
89
|
+
lineHeight: 1.5,
|
|
90
|
+
margin: 0,
|
|
91
|
+
};
|
|
92
|
+
const missingDescription = {
|
|
93
|
+
...missingText,
|
|
94
|
+
marginTop: 14,
|
|
95
|
+
};
|
|
96
|
+
const installButton = {
|
|
97
|
+
backgroundColor: colors_1.BLUE,
|
|
98
|
+
color: colors_1.WHITE,
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
};
|
|
101
|
+
const errorStyle = {
|
|
102
|
+
color: colors_1.WARNING_COLOR,
|
|
103
|
+
fontSize: 12,
|
|
104
|
+
lineHeight: 1.4,
|
|
105
|
+
margin: '8px 0 0',
|
|
106
|
+
};
|
|
107
|
+
const OptionalModelPackage = ({ children, label, packageName, style }) => {
|
|
108
|
+
const installed = (0, OptionalPackageModal_1.useOptionalPackageInstalled)(packageName);
|
|
109
|
+
const [installState, setInstallState] = (0, react_1.useState)({
|
|
110
|
+
type: 'idle',
|
|
111
|
+
});
|
|
112
|
+
const install = (0, react_1.useCallback)(() => {
|
|
113
|
+
setInstallState({ type: 'installing' });
|
|
114
|
+
(0, OptionalPackageModal_1.installOptionalPackage)(packageName).catch((error) => {
|
|
115
|
+
setInstallState({
|
|
116
|
+
type: 'error',
|
|
117
|
+
message: error instanceof Error ? error.message : String(error),
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}, [packageName]);
|
|
121
|
+
return (jsx_runtime_1.jsxs("section", { style: style, children: [
|
|
122
|
+
jsx_runtime_1.jsxs("div", { style: headingRow, children: [
|
|
123
|
+
jsx_runtime_1.jsxs("div", { children: [
|
|
124
|
+
jsx_runtime_1.jsx("h3", { style: title, children: label }), jsx_runtime_1.jsx("p", { style: packageNameStyle, children: packageName })
|
|
125
|
+
] }), installed ? null : (jsx_runtime_1.jsx(Button_1.Button, { disabled: installState.type === 'installing', onClick: install, size: "compact", style: installButton, children: installState.type === 'installing' ? 'Installing…' : 'Install' }))] }), installed ? (jsx_runtime_1.jsx(react_1.Suspense, { fallback: jsx_runtime_1.jsx("p", { style: missingText, children: "Loading models\u2026" }), children: children })) : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
126
|
+
jsx_runtime_1.jsxs("p", { style: missingDescription, children: ["Install the package and ", optional_package_dependencies_1.TRANSFORMERS_PACKAGE, " to download and manage its models."] }), installState.type === 'error' ? (jsx_runtime_1.jsx("p", { style: errorStyle, children: installState.message })) : null] }))] }));
|
|
127
|
+
};
|
|
128
|
+
const ModelsSettings = () => {
|
|
129
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
130
|
+
jsx_runtime_1.jsx("p", { style: overview, children: "Models are downloaded automatically when needed. You can also manage the browser cache here." }), jsx_runtime_1.jsx(OptionalModelPackage, { label: "Transcription", packageName: whisper_webgpu_capability_1.WHISPER_WEBGPU_PACKAGE, style: section, children: jsx_runtime_1.jsx(LazyWhisperModels, { description: null, indent: false, visible: true }) }), jsx_runtime_1.jsx(OptionalModelPackage, { label: "Video matting", packageName: video_matting_capability_1.VIDEO_MATTING_PACKAGE, style: lastSection, children: jsx_runtime_1.jsx(LazyVideoMattingModels, { description: null, indent: false, visible: true }) })
|
|
131
|
+
] }));
|
|
132
|
+
};
|
|
133
|
+
exports.ModelsSettings = ModelsSettings;
|
|
@@ -5,11 +5,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const modals_1 = require("../../state/modals");
|
|
7
7
|
const ModalContainer_1 = require("../ModalContainer");
|
|
8
|
-
const DismissableModal = ({ children, panelStyle }) => {
|
|
8
|
+
const DismissableModal = ({ children, panelStyle, ariaLabel }) => {
|
|
9
9
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
|
|
10
10
|
const onQuit = (0, react_1.useCallback)(() => {
|
|
11
11
|
setSelectedModal(null);
|
|
12
12
|
}, [setSelectedModal]);
|
|
13
|
-
return (jsx_runtime_1.jsx(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, panelStyle: panelStyle, children: children }));
|
|
13
|
+
return (jsx_runtime_1.jsx(ModalContainer_1.ModalContainer, { ariaLabel: ariaLabel, onOutsideClick: onQuit, onEscape: onQuit, panelStyle: panelStyle, children: children }));
|
|
14
14
|
};
|
|
15
15
|
exports.DismissableModal = DismissableModal;
|
|
@@ -55,8 +55,8 @@ export declare const deriveInputDraggerValueDiff: ({ dragSensitivity, step, xDis
|
|
|
55
55
|
readonly xDistance: number;
|
|
56
56
|
}) => number;
|
|
57
57
|
export declare const InputDragger: React.ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
|
|
58
|
-
readonly onValueChange: (newVal: number) => void;
|
|
59
|
-
readonly onValueChangeEnd?: ((newVal: number) => void) | undefined;
|
|
58
|
+
readonly onValueChange: (newVal: number, source: "drag" | "input") => void;
|
|
59
|
+
readonly onValueChangeEnd?: ((newVal: number, source: "drag" | "input") => void) | undefined;
|
|
60
60
|
readonly onTextChange: (newVal: string) => void;
|
|
61
61
|
readonly status: RemInputStatus;
|
|
62
62
|
readonly formatter?: ((str: string | number) => string) | undefined;
|
|
@@ -385,7 +385,7 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
385
385
|
min: _min,
|
|
386
386
|
value: parsed,
|
|
387
387
|
})) {
|
|
388
|
-
onValueChange(parsed);
|
|
388
|
+
onValueChange(parsed, 'input');
|
|
389
389
|
}
|
|
390
390
|
}, [_max, _min, onValueChange]);
|
|
391
391
|
const onBlur = (0, react_1.useCallback)(() => {
|
|
@@ -405,7 +405,7 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
405
405
|
});
|
|
406
406
|
if (validation.valid) {
|
|
407
407
|
fallbackRef.current.setCustomValidity('');
|
|
408
|
-
onValueChangeEnd === null || onValueChangeEnd === void 0 ? void 0 : onValueChangeEnd(validation.value);
|
|
408
|
+
onValueChangeEnd === null || onValueChangeEnd === void 0 ? void 0 : onValueChangeEnd(validation.value, 'input');
|
|
409
409
|
setInputFallback(false);
|
|
410
410
|
}
|
|
411
411
|
else {
|
|
@@ -441,7 +441,7 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
441
441
|
});
|
|
442
442
|
e.currentTarget.value = String(nextValue);
|
|
443
443
|
e.currentTarget.setCustomValidity('');
|
|
444
|
-
onValueChange(nextValue);
|
|
444
|
+
onValueChange(nextValue, 'input');
|
|
445
445
|
}, [_max, _min, deriveStep, onValueChange, value]);
|
|
446
446
|
const roundToStep = (val, stepSize) => {
|
|
447
447
|
const factor = 1 / stepSize;
|
|
@@ -484,7 +484,7 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
484
484
|
? newValue
|
|
485
485
|
: roundToDecimalPlaces(newValue, dragDecimalPlaces);
|
|
486
486
|
lastDragValue = nextValue;
|
|
487
|
-
onValueChange(nextValue);
|
|
487
|
+
onValueChange(nextValue, 'drag');
|
|
488
488
|
};
|
|
489
489
|
(0, pointer_session_1.startCapturedPointerSession)({
|
|
490
490
|
event: e.nativeEvent,
|
|
@@ -496,7 +496,7 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
496
496
|
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
497
497
|
const commit = reason === 'pointerup' || reason === 'buttons-released';
|
|
498
498
|
if (commit && lastDragValue !== null && onValueChangeEnd) {
|
|
499
|
-
onValueChangeEnd(lastDragValue);
|
|
499
|
+
onValueChangeEnd(lastDragValue, 'drag');
|
|
500
500
|
}
|
|
501
501
|
setTimeout(() => {
|
|
502
502
|
(0, input_dragger_click_lock_1.setClickLock)(false);
|
|
@@ -529,7 +529,7 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
529
529
|
}
|
|
530
530
|
: inputStyle, type: "text" }) }));
|
|
531
531
|
}
|
|
532
|
-
return (jsx_runtime_1.jsxs("button", { ref: ref, type: "button", "aria-label": props['aria-label'], className: '__remotion_input_dragger', style: buttonStyle
|
|
532
|
+
return (jsx_runtime_1.jsxs("button", { ref: ref, type: "button", "aria-label": props['aria-label'], title: props.title, className: '__remotion_input_dragger', style: buttonStyle
|
|
533
533
|
? {
|
|
534
534
|
...(small
|
|
535
535
|
? compactInputDraggerContainerStyle
|
|
@@ -4,6 +4,8 @@ exports.NewFolder = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const slugify_name_1 = require("../../helpers/slugify-name");
|
|
7
9
|
const validate_new_folder_name_1 = require("../../helpers/validate-new-folder-name");
|
|
8
10
|
const layout_1 = require("../layout");
|
|
9
11
|
const ModalFooter_1 = require("../ModalFooter");
|
|
@@ -46,19 +48,18 @@ const NewFolder = ({ parentName, stack }) => {
|
|
|
46
48
|
const onNameChange = (0, react_1.useCallback)((e) => {
|
|
47
49
|
setName(e.target.value);
|
|
48
50
|
}, []);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
newName,
|
|
52
|
-
|
|
53
|
-
});
|
|
51
|
+
const folderName = (0, slugify_name_1.slugifyName)(newName);
|
|
52
|
+
const folderNameErrMessage = folderName
|
|
53
|
+
? (0, validate_new_folder_name_1.validateNewFolderName)({ folders, newName: folderName, parentName })
|
|
54
|
+
: 'Enter a name containing letters or numbers.';
|
|
54
55
|
const valid = folderNameErrMessage === null;
|
|
55
56
|
const codemod = (0, react_1.useMemo)(() => {
|
|
56
57
|
return {
|
|
57
58
|
type: 'new-folder',
|
|
58
|
-
folderName
|
|
59
|
+
folderName,
|
|
59
60
|
parentName,
|
|
60
61
|
};
|
|
61
|
-
}, [
|
|
62
|
+
}, [folderName, parentName]);
|
|
62
63
|
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
63
64
|
e.preventDefault();
|
|
64
65
|
}, []);
|
|
@@ -68,7 +69,9 @@ const NewFolder = ({ parentName, stack }) => {
|
|
|
68
69
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Parent" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: parentName })
|
|
69
70
|
] })) : null, jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
70
71
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Name" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(InputAndValidationContainer_1.InputAndValidationContainer, { children: [
|
|
71
|
-
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newName, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Folder name", status: "ok", rightAlign: true }),
|
|
72
|
+
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newName, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Folder name", status: "ok", rightAlign: true }), folderName && folderName !== newName ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
73
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsxs("div", { "aria-live": "polite", style: { fontSize: 12, color: colors_1.LIGHT_TEXT }, children: ["Will be created as ", folderName] })
|
|
74
|
+
] })) : null, folderNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
72
75
|
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: folderNameErrMessage, type: "error" })
|
|
73
76
|
] })) : null] }) })
|
|
74
77
|
] })
|
|
@@ -4,7 +4,9 @@ exports.RenameFolder = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const colors_1 = require("../../helpers/colors");
|
|
7
8
|
const get_folder_id_1 = require("../../helpers/get-folder-id");
|
|
9
|
+
const slugify_name_1 = require("../../helpers/slugify-name");
|
|
8
10
|
const validate_folder_rename_1 = require("../../helpers/validate-folder-rename");
|
|
9
11
|
const layout_1 = require("../layout");
|
|
10
12
|
const ModalFooter_1 = require("../ModalFooter");
|
|
@@ -36,21 +38,24 @@ const RenameFolder = ({ folderName, parentName, stack }) => {
|
|
|
36
38
|
const onNameChange = (0, react_1.useCallback)((e) => {
|
|
37
39
|
setName(e.target.value);
|
|
38
40
|
}, []);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const slug = (0, slugify_name_1.slugifyName)(newName);
|
|
42
|
+
const folderNameErrMessage = slug
|
|
43
|
+
? (0, validate_folder_rename_1.validateFolderRename)({
|
|
44
|
+
folders,
|
|
45
|
+
newName: slug,
|
|
46
|
+
originalName: folderName,
|
|
47
|
+
parentName,
|
|
48
|
+
})
|
|
49
|
+
: 'Enter a name containing letters or numbers.';
|
|
50
|
+
const valid = folderNameErrMessage === null && folderName !== slug;
|
|
46
51
|
const codemod = (0, react_1.useMemo)(() => {
|
|
47
52
|
return {
|
|
48
53
|
type: 'rename-folder',
|
|
49
54
|
folderName,
|
|
50
55
|
parentName,
|
|
51
|
-
newName,
|
|
56
|
+
newName: slug,
|
|
52
57
|
};
|
|
53
|
-
}, [folderName,
|
|
58
|
+
}, [folderName, slug, parentName]);
|
|
54
59
|
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
55
60
|
e.preventDefault();
|
|
56
61
|
}, []);
|
|
@@ -59,7 +64,9 @@ const RenameFolder = ({ folderName, parentName, stack }) => {
|
|
|
59
64
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Rename ${folderId}` }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
60
65
|
jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
61
66
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Name" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(InputAndValidationContainer_1.InputAndValidationContainer, { children: [
|
|
62
|
-
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newName, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Folder name", status: "ok", rightAlign: true }),
|
|
67
|
+
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newName, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Folder name", status: "ok", rightAlign: true }), slug && slug !== newName ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
68
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsxs("div", { "aria-live": "polite", style: { fontSize: 12, color: colors_1.LIGHT_TEXT }, children: ["Will be renamed to ", slug] })
|
|
69
|
+
] })) : null, folderNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
63
70
|
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: folderNameErrMessage, type: "error" })
|
|
64
71
|
] })) : null] }) })
|
|
65
72
|
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming folder...', errorNotification: 'Could not rename folder', genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, stack: stack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => (0, actions_1.applyCodemod)({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const isOptionalPackageInstalled: (packageName: string) => boolean;
|
|
3
|
+
export declare const markOptionalPackageInstalled: (packageName: string) => void;
|
|
4
|
+
export declare const installOptionalPackage: (packageName: string) => Promise<void>;
|
|
5
|
+
export declare const useOptionalPackageInstalled: (packageName: string) => boolean;
|
|
6
|
+
export declare const OptionalPackageModal: React.FC<{
|
|
7
|
+
readonly ariaLabel: string;
|
|
8
|
+
readonly children: React.ReactNode;
|
|
9
|
+
readonly packageName: string;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
}>;
|