@remotion/studio 4.0.484 → 4.0.486
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/ResolveCompositionConfigInStudio.js +42 -0
- package/dist/components/AssetSelector.js +1 -1
- package/dist/components/AssetSelectorItem.js +9 -9
- package/dist/components/AudioWaveform.js +3 -3
- package/dist/components/Button.js +2 -2
- package/dist/components/Canvas.js +28 -0
- package/dist/components/CanvasOrLoading.js +1 -1
- package/dist/components/CheckboardToggle.js +1 -1
- package/dist/components/Checkbox.js +3 -3
- package/dist/components/ColorPicker/AlphaSlider.js +4 -3
- package/dist/components/ColorPicker/ColorPicker.js +4 -4
- package/dist/components/ColorPicker/ColorPickerPopup.js +10 -10
- package/dist/components/ColorPicker/HueSlider.js +4 -3
- package/dist/components/ColorPicker/SaturationValueArea.js +5 -4
- package/dist/components/ColorPicker/checker.d.ts +1 -1
- package/dist/components/ColorPicker/checker.js +3 -3
- package/dist/components/CompactExplanation.js +3 -3
- package/dist/components/CompositionSelector.js +141 -5
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +103 -11
- package/dist/components/ContextMenu.js +75 -1
- package/dist/components/CopyButton.js +3 -2
- package/dist/components/CurrentAsset.d.ts +3 -1
- package/dist/components/CurrentAsset.js +15 -2
- package/dist/components/CurrentComposition.js +3 -2
- package/dist/components/EffectPickerModal.js +1 -1
- package/dist/components/FilePreview.js +2 -1
- package/dist/components/FpsCounter.js +3 -2
- package/dist/components/FullscreenToggle.js +2 -1
- package/dist/components/GlobalKeybindings.js +0 -12
- package/dist/components/InlineAction.js +2 -2
- package/dist/components/InlineCompositionName.d.ts +7 -0
- package/dist/components/InlineCompositionName.js +58 -0
- package/dist/components/InlineEditableTitle.d.ts +8 -0
- package/dist/components/InlineEditableTitle.js +134 -0
- package/dist/components/InspectorInfoHeader.js +2 -2
- package/dist/components/InspectorPanel/DefaultInspector.d.ts +1 -0
- package/dist/components/InspectorPanel/DefaultInspector.js +2 -2
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +1 -1
- package/dist/components/InspectorPanel/KeyframeInspector.js +1 -0
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +17 -30
- package/dist/components/InspectorPanel/common.js +2 -2
- package/dist/components/InspectorPanel/styles.js +5 -5
- package/dist/components/InspectorPanel.d.ts +1 -0
- package/dist/components/InspectorPanel.js +2 -2
- package/dist/components/InspectorSequenceSection.js +35 -2
- package/dist/components/InstallablePackage.js +1 -1
- package/dist/components/KeyboardShortcutsExplainer.js +5 -5
- package/dist/components/LoopToggle.js +1 -1
- package/dist/components/Menu/MenuDivider.js +1 -1
- package/dist/components/Menu/MenuItem.js +1 -1
- package/dist/components/Menu/MenuSubItem.js +1 -1
- package/dist/components/Menu/styles.js +3 -3
- package/dist/components/MenuToolbar.js +2 -2
- package/dist/components/ModalButton.js +1 -1
- package/dist/components/ModalContainer.js +3 -3
- package/dist/components/ModalFooter.js +2 -1
- package/dist/components/ModalHeader.js +3 -2
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/CancelButton.js +4 -3
- package/dist/components/NewComposition/CodemodFooter.d.ts +7 -1
- package/dist/components/NewComposition/CodemodFooter.js +17 -12
- package/dist/components/NewComposition/ComboBox.js +3 -3
- package/dist/components/NewComposition/DeleteComposition.js +7 -1
- package/dist/components/NewComposition/DeleteFolder.js +7 -1
- package/dist/components/NewComposition/DuplicateComposition.js +17 -10
- package/dist/components/NewComposition/InputAndValidationContainer.d.ts +3 -0
- package/dist/components/NewComposition/InputAndValidationContainer.js +15 -0
- package/dist/components/NewComposition/InputDragger.js +11 -3
- package/dist/components/NewComposition/MenuContent.js +1 -1
- package/dist/components/NewComposition/NewCompDuration.js +7 -6
- package/dist/components/NewComposition/NewComposition.d.ts +5 -1
- package/dist/components/NewComposition/NewComposition.js +31 -85
- package/dist/components/NewComposition/NewFolder.d.ts +5 -0
- package/dist/components/NewComposition/NewFolder.js +86 -0
- package/dist/components/NewComposition/RemInput.js +3 -3
- package/dist/components/NewComposition/RemTextarea.js +1 -1
- package/dist/components/NewComposition/RenameComposition.js +13 -14
- package/dist/components/NewComposition/RenameFolder.js +9 -2
- package/dist/components/NewComposition/RenameStaticFile.js +22 -60
- package/dist/components/NewComposition/ValidationMessage.js +10 -2
- package/dist/components/NewComposition/use-rename-static-file.d.ts +18 -0
- package/dist/components/NewComposition/use-rename-static-file.js +90 -0
- package/dist/components/NoRegisterRoot.js +3 -2
- package/dist/components/Notifications/ColorDot.js +3 -2
- package/dist/components/Notifications/Notification.js +4 -4
- package/dist/components/Notifications/NotificationCenter.js +2 -1
- package/dist/components/Notifications/ServerDisconnected.js +5 -4
- package/dist/components/OptionsPanel.d.ts +0 -3
- package/dist/components/OptionsPanel.js +8 -4
- package/dist/components/OutlineToggle.js +1 -1
- package/dist/components/PlayPause.js +4 -3
- package/dist/components/PreviewToolbar.js +1 -1
- package/dist/components/QuickSwitcher/AlgoliaCredit.js +2 -1
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -1
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +2 -2
- package/dist/components/RefreshCompositionOverlay.js +2 -1
- package/dist/components/RenderButton.js +9 -9
- package/dist/components/RenderModal/CliCopyButton.js +1 -1
- package/dist/components/RenderModal/ClientRenderProgress.js +1 -1
- package/dist/components/RenderModal/DataEditor.js +1 -1
- package/dist/components/RenderModal/GuiRenderStatus.js +1 -1
- package/dist/components/RenderModal/InfoBubble.js +2 -2
- package/dist/components/RenderModal/InfoTooltip.js +3 -3
- package/dist/components/RenderModal/InlineEyeIcon.js +2 -1
- package/dist/components/RenderModal/InlineRemoveButton.js +2 -1
- package/dist/components/RenderModal/MultiRangeSlider.js +1 -1
- package/dist/components/RenderModal/OptionExplainer.js +2 -2
- package/dist/components/RenderModal/RenderModalHr.js +2 -1
- package/dist/components/RenderModal/RenderStatusModal.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaResetButton.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaVerticalGuide.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +2 -1
- package/dist/components/RenderModal/ServerRenderModal.js +5 -4
- package/dist/components/RenderModal/WarningIndicatorButton.js +4 -6
- package/dist/components/RenderModal/WebRenderModal.js +2 -1
- package/dist/components/RenderModal/WebRenderModalAudio.js +4 -3
- package/dist/components/RenderModal/WebRenderModalLicense.js +2 -2
- package/dist/components/RenderModal/WebRenderModalPicture.js +2 -1
- package/dist/components/RenderModal/render-modals.js +3 -3
- package/dist/components/RenderPreview.js +1 -1
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +2 -1
- package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -1
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +2 -1
- package/dist/components/RenderQueue/RenderQueueItemStatus.js +1 -1
- package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +2 -1
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +2 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +2 -1
- package/dist/components/RenderQueue/index.js +1 -1
- package/dist/components/RendersTab.js +2 -2
- package/dist/components/SegmentedControl.js +3 -3
- package/dist/components/SelectedOutlineElement.d.ts +5 -0
- package/dist/components/SelectedOutlineElement.js +52 -10
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +16 -4
- package/dist/components/SelectedOutlineUvControls.js +5 -5
- package/dist/components/SidebarCollapserControls.js +5 -4
- package/dist/components/Splitter/SplitterElement.js +2 -1
- package/dist/components/StaticFilePreview.js +1 -1
- package/dist/components/Tabs/index.js +3 -3
- package/dist/components/Tabs/vertical.js +3 -3
- package/dist/components/TextViewer.js +2 -1
- package/dist/components/TimeValue.js +1 -1
- package/dist/components/Timeline/EasingEditorModal.js +8 -8
- package/dist/components/Timeline/KeyframeSettingsModal.js +1 -1
- package/dist/components/Timeline/LoopedIndicator.js +2 -2
- package/dist/components/Timeline/MaxTimelineTracks.js +3 -2
- package/dist/components/Timeline/TimelineArrayField.js +6 -5
- package/dist/components/Timeline/TimelineColorField.js +2 -1
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +34 -1
- package/dist/components/Timeline/TimelineEffectItem.js +3 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +2 -2
- package/dist/components/Timeline/TimelineExpandArrowButton.js +3 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +2 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +2 -1
- package/dist/components/Timeline/TimelineFieldLabel.js +2 -1
- package/dist/components/Timeline/TimelineFontFamilyField.d.ts +11 -0
- package/dist/components/Timeline/TimelineFontFamilyField.js +545 -0
- package/dist/components/Timeline/TimelineImageInfo.js +2 -1
- package/dist/components/Timeline/TimelineInOutPointer.js +2 -1
- package/dist/components/Timeline/TimelineInOutPointerHandle.js +4 -5
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +1 -1
- package/dist/components/Timeline/TimelineKeyframeControls.js +3 -2
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +1 -1
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +1 -1
- package/dist/components/Timeline/TimelineLayerEye.js +3 -3
- package/dist/components/Timeline/TimelineMediaInfo.js +2 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +8 -0
- package/dist/components/Timeline/TimelineRotationField.js +4 -3
- package/dist/components/Timeline/TimelineScaleField.js +1 -1
- package/dist/components/Timeline/TimelineSchemaField.d.ts +2 -0
- package/dist/components/Timeline/TimelineSchemaField.js +47 -7
- package/dist/components/Timeline/TimelineScrollable.js +3 -2
- package/dist/components/Timeline/TimelineSelection.js +7 -6
- package/dist/components/Timeline/TimelineSequence.js +17 -20
- package/dist/components/Timeline/TimelineSequenceFrame.js +3 -2
- package/dist/components/Timeline/TimelineSequenceItem.js +27 -108
- package/dist/components/Timeline/TimelineSequenceName.js +3 -2
- package/dist/components/Timeline/TimelineSequencePropItem.js +8 -4
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +20 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +128 -11
- package/dist/components/Timeline/TimelineSlider.js +2 -1
- package/dist/components/Timeline/TimelineSliderHandle.js +2 -1
- package/dist/components/Timeline/TimelineTextContentField.d.ts +12 -0
- package/dist/components/Timeline/TimelineTextContentField.js +100 -0
- package/dist/components/Timeline/TimelineTimeIndicators.js +1 -1
- package/dist/components/Timeline/TimelineVideoInfo.js +2 -1
- package/dist/components/Timeline/TimelineWidthProvider.js +18 -3
- package/dist/components/Timeline/TimelineZoomControls.js +4 -3
- package/dist/components/Timeline/call-move-keyframe.d.ts +5 -0
- package/dist/components/Timeline/call-move-keyframe.js +14 -3
- package/dist/components/Timeline/focus-inspector-field.d.ts +16 -0
- package/dist/components/Timeline/focus-inspector-field.js +49 -0
- package/dist/components/Timeline/google-fonts-list.d.ts +6 -0
- package/dist/components/Timeline/google-fonts-list.js +1512 -0
- package/dist/components/Timeline/save-sequence-prop.d.ts +8 -1
- package/dist/components/Timeline/save-sequence-prop.js +63 -19
- package/dist/components/Timeline/split-selected-timeline-item.d.ts +38 -0
- package/dist/components/Timeline/split-selected-timeline-item.js +156 -0
- package/dist/components/Timeline/timeline-field-display-utils.js +2 -0
- package/dist/components/Timeline/timeline-rotation-field-utils.d.ts +5 -0
- package/dist/components/Timeline/timeline-rotation-field-utils.js +16 -0
- package/dist/components/Timeline/timeline-scroll-logic.js +5 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +1 -0
- package/dist/components/Timeline/use-rename-sequence.d.ts +30 -0
- package/dist/components/Timeline/use-rename-sequence.js +115 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +2 -1
- package/dist/components/Timeline/use-timeline-expanded-tree.js +3 -1
- package/dist/components/Timeline/use-timeline-height.js +1 -0
- package/dist/components/TimelineInOutToggle.js +1 -1
- package/dist/components/UpdateCheck.js +2 -2
- package/dist/components/UpdateModal/OpenIssueButton.js +1 -1
- package/dist/components/VisualControls/ClickableFileName.js +2 -2
- package/dist/components/composition-menu-items.js +3 -0
- package/dist/components/effect-drag-and-drop.js +1 -0
- package/dist/components/folder-menu-items.js +20 -0
- package/dist/components/import-assets.d.ts +7 -1
- package/dist/components/import-assets.js +55 -1
- package/dist/components/options-sidebar-tabs.d.ts +4 -0
- package/dist/components/options-sidebar-tabs.js +5 -0
- package/dist/components/selected-outline-measurement.js +2 -1
- package/dist/components/selected-outline-types.d.ts +6 -1
- package/dist/error-overlay/remotion-overlay/CalculateMetadataErrorExplainer.js +2 -2
- package/dist/error-overlay/remotion-overlay/CodeFrame.js +7 -5
- package/dist/error-overlay/remotion-overlay/CompositionIdListItem.js +2 -2
- package/dist/error-overlay/remotion-overlay/DismissButton.js +3 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +3 -2
- package/dist/error-overlay/remotion-overlay/ErrorMessage.js +4 -4
- package/dist/error-overlay/remotion-overlay/HelpLink.js +1 -1
- package/dist/error-overlay/remotion-overlay/MediaPlaybackErrorExplainer.js +4 -4
- package/dist/error-overlay/remotion-overlay/Overlay.js +3 -2
- package/dist/error-overlay/remotion-overlay/StackFrame.js +4 -3
- package/dist/error-overlay/remotion-overlay/Symbolicating.js +2 -1
- package/dist/error-overlay/remotion-overlay/carets.js +3 -2
- package/dist/esm/{chunk-9erwh79m.js → chunk-975rp13y.js} +11165 -7032
- package/dist/esm/chunk-jefhcs5z.js +164 -0
- package/dist/esm/internals.mjs +11166 -6999
- package/dist/esm/previewEntry.mjs +10697 -6526
- package/dist/esm/renderEntry.mjs +8 -5
- package/dist/helpers/checkerboard-background.js +4 -12
- package/dist/helpers/colors.d.ts +99 -7
- package/dist/helpers/colors.js +118 -10
- package/dist/helpers/inject-css.js +85 -83
- package/dist/helpers/render-codec-label.d.ts +1 -1
- package/dist/helpers/timeline-layout.d.ts +7 -4
- package/dist/helpers/timeline-layout.js +3 -1
- package/dist/helpers/use-create-composition.d.ts +35 -0
- package/dist/helpers/use-create-composition.js +111 -0
- package/dist/helpers/use-menu-structure.js +31 -3
- package/dist/helpers/use-rename-composition.d.ts +16 -0
- package/dist/helpers/use-rename-composition.js +49 -0
- package/dist/helpers/validate-folder-rename.js +2 -10
- package/dist/helpers/validate-new-folder-name.d.ts +5 -0
- package/dist/helpers/validate-new-folder-name.js +16 -0
- package/dist/hot-middleware-client/client.js +3 -2
- package/dist/icons/Checkmark.js +2 -1
- package/dist/icons/audio.js +2 -1
- package/dist/icons/caret.js +2 -2
- package/dist/icons/certificate.js +2 -1
- package/dist/icons/data.js +2 -1
- package/dist/icons/eyedropper.js +2 -1
- package/dist/icons/file.js +2 -1
- package/dist/icons/frame.js +2 -1
- package/dist/icons/gear.js +2 -1
- package/dist/icons/gif.js +2 -1
- package/dist/icons/jump-to-start.js +2 -1
- package/dist/icons/keys.js +4 -3
- package/dist/icons/media-volume.js +1 -1
- package/dist/icons/minus.js +2 -1
- package/dist/icons/pause.js +2 -1
- package/dist/icons/play.js +2 -1
- package/dist/icons/redo.js +2 -1
- package/dist/icons/step-back.js +2 -1
- package/dist/icons/step-forward.js +2 -1
- package/dist/icons/undo.js +2 -1
- package/dist/previewEntry.js +2 -1
- package/dist/renderEntry.js +4 -3
- package/dist/state/modals.d.ts +7 -0
- package/dist/state/timeline-zoom.js +17 -14
- package/dist/state/z-index.d.ts +1 -0
- package/dist/state/z-index.js +11 -2
- package/package.json +12 -12
- package/dist/esm/chunk-6jf1natv.js +0 -25
|
@@ -4,14 +4,14 @@ exports.NewComposition = 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
|
|
8
|
-
const validate_new_comp_data_1 = require("../../helpers/validate-new-comp-data");
|
|
7
|
+
const use_create_composition_1 = require("../../helpers/use-create-composition");
|
|
9
8
|
const layout_1 = require("../layout");
|
|
10
9
|
const ModalFooter_1 = require("../ModalFooter");
|
|
11
10
|
const ModalHeader_1 = require("../ModalHeader");
|
|
12
11
|
const layout_2 = require("../RenderModal/layout");
|
|
13
12
|
const CodemodFooter_1 = require("./CodemodFooter");
|
|
14
13
|
const DismissableModal_1 = require("./DismissableModal");
|
|
14
|
+
const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
|
|
15
15
|
const InputDragger_1 = require("./InputDragger");
|
|
16
16
|
const NewCompDuration_1 = require("./NewCompDuration");
|
|
17
17
|
const RemInput_1 = require("./RemInput");
|
|
@@ -23,49 +23,12 @@ const content = {
|
|
|
23
23
|
fontSize: 13,
|
|
24
24
|
minWidth: 500,
|
|
25
25
|
};
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const words = (_a = value.match(/[a-zA-Z0-9]+/g)) !== null && _a !== void 0 ? _a : [];
|
|
29
|
-
const candidate = words
|
|
30
|
-
.map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`)
|
|
31
|
-
.join('');
|
|
32
|
-
if (!candidate) {
|
|
33
|
-
return 'NewComposition';
|
|
34
|
-
}
|
|
35
|
-
if (/^[0-9]/.test(candidate)) {
|
|
36
|
-
return `Composition${candidate}`;
|
|
37
|
-
}
|
|
38
|
-
return candidate;
|
|
26
|
+
const folderPathStyle = {
|
|
27
|
+
fontSize: 14,
|
|
39
28
|
};
|
|
40
|
-
const
|
|
41
|
-
return new Promise((resolve) => {
|
|
42
|
-
const started = Date.now();
|
|
43
|
-
const interval = window.setInterval(() => {
|
|
44
|
-
var _a;
|
|
45
|
-
var _b;
|
|
46
|
-
const compositionNames = (_b = (_a = window.remotion_getCompositionNames) === null || _a === void 0 ? void 0 : _a.call(window)) !== null && _b !== void 0 ? _b : [];
|
|
47
|
-
if (compositionNames.includes(compositionId) ||
|
|
48
|
-
Date.now() - started > 10000) {
|
|
49
|
-
window.clearInterval(interval);
|
|
50
|
-
resolve();
|
|
51
|
-
}
|
|
52
|
-
}, 100);
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const getUniqueCompositionName = (compositions) => {
|
|
56
|
-
let counter = 1;
|
|
57
|
-
while (true) {
|
|
58
|
-
const name = counter === 1 ? 'NewComposition' : `NewComposition${counter}`;
|
|
59
|
-
const err = (0, validate_new_comp_data_1.validateCompositionName)(name, compositions);
|
|
60
|
-
if (!err) {
|
|
61
|
-
return name;
|
|
62
|
-
}
|
|
63
|
-
counter++;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const NewCompositionLoaded = () => {
|
|
29
|
+
const NewCompositionLoaded = ({ folderName, parentName, stack }) => {
|
|
67
30
|
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
68
|
-
const [newId, setName] = (0, react_1.useState)(() => getUniqueCompositionName(compositions));
|
|
31
|
+
const [newId, setName] = (0, react_1.useState)(() => (0, use_create_composition_1.getUniqueCompositionName)(compositions));
|
|
69
32
|
const [selectedFrameRate, setFrameRate] = (0, react_1.useState)(30);
|
|
70
33
|
const [size, setSize] = (0, react_1.useState)(() => ({
|
|
71
34
|
width: 1920,
|
|
@@ -113,66 +76,49 @@ const NewCompositionLoaded = () => {
|
|
|
113
76
|
const onFpsChange = (0, react_1.useCallback)((newFps) => {
|
|
114
77
|
setFrameRate(newFps);
|
|
115
78
|
}, []);
|
|
116
|
-
const compNameErrMessage = (0,
|
|
117
|
-
|
|
118
|
-
const compHeightErrMessage = (0, validate_new_comp_data_1.validateCompositionDimension)('Height', size.height);
|
|
119
|
-
const componentName = toPascalCase(newId);
|
|
120
|
-
const valid = compNameErrMessage === null &&
|
|
121
|
-
compWidthErrMessage === null &&
|
|
122
|
-
compHeightErrMessage === null;
|
|
123
|
-
const codemod = (0, react_1.useMemo)(() => {
|
|
124
|
-
return {
|
|
125
|
-
type: 'new-composition',
|
|
126
|
-
newDurationInFrames: Number(durationInFrames),
|
|
127
|
-
newFps: Number(selectedFrameRate),
|
|
128
|
-
newHeight: Number(size.height),
|
|
129
|
-
newWidth: Number(size.width),
|
|
130
|
-
newId,
|
|
131
|
-
componentName,
|
|
132
|
-
componentImportPath: `./${componentName}`,
|
|
133
|
-
};
|
|
134
|
-
}, [
|
|
135
|
-
componentName,
|
|
79
|
+
const { codemod, createComposition, heightValidationMessage: compHeightErrMessage, nameValidationMessage: compNameErrMessage, valid, widthValidationMessage: compWidthErrMessage, } = (0, use_create_composition_1.useCreateComposition)({
|
|
80
|
+
compositions,
|
|
136
81
|
durationInFrames,
|
|
82
|
+
folderName,
|
|
137
83
|
newId,
|
|
84
|
+
parentName,
|
|
138
85
|
selectedFrameRate,
|
|
139
|
-
size
|
|
140
|
-
|
|
141
|
-
]);
|
|
142
|
-
const onSuccess = (0, react_1.useCallback)(() => {
|
|
143
|
-
waitForComposition(newId).then(() => {
|
|
144
|
-
(0, url_state_1.pushUrl)(`/${newId}`);
|
|
145
|
-
});
|
|
146
|
-
}, [newId]);
|
|
86
|
+
size,
|
|
87
|
+
});
|
|
147
88
|
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
148
89
|
e.preventDefault();
|
|
149
90
|
}, []);
|
|
91
|
+
const folderPath = [parentName, folderName].filter(Boolean).join('/');
|
|
150
92
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
151
93
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "New composition" }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
152
|
-
jsx_runtime_1.jsxs("div", { style: content, children: [
|
|
153
|
-
|
|
154
|
-
|
|
94
|
+
jsx_runtime_1.jsxs("div", { style: content, children: [folderPath ? (jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
95
|
+
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Folder" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx("span", { style: folderPathStyle, children: folderPath }) })
|
|
96
|
+
] })) : null, jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
97
|
+
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "ID" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(InputAndValidationContainer_1.InputAndValidationContainer, { children: [
|
|
155
98
|
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: newId, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Composition ID", status: "ok", rightAlign: true }), compNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
156
99
|
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: compNameErrMessage, type: "error" })
|
|
157
100
|
] })) : null] }) })
|
|
158
101
|
] }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
159
|
-
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Width" }), jsx_runtime_1.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
102
|
+
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Width" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(InputAndValidationContainer_1.InputAndValidationContainer, { children: [
|
|
103
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: size.width, placeholder: "Width", onTextChange: onWidthChanged, name: "width", step: 2, min: 2, required: true, status: "ok", formatter: (w) => `${w}px`, max: 100000000, onValueChange: onWidthDirectlyChanged, rightAlign: false }), compWidthErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
104
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: compWidthErrMessage, type: "error" })
|
|
105
|
+
] })) : null] }) })
|
|
163
106
|
] }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
164
|
-
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Height" }), jsx_runtime_1.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
107
|
+
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Height" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(InputAndValidationContainer_1.InputAndValidationContainer, { children: [
|
|
108
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: size.height, onTextChange: onHeightChanged, placeholder: "Height", name: "height", step: 2, required: true, formatter: (h) => `${h}px`, min: 2, status: "ok", max: 100000000, onValueChange: onHeightDirectlyChanged, rightAlign: false }), compHeightErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
109
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: compHeightErrMessage, type: "error" })
|
|
110
|
+
] })) : null] }) })
|
|
168
111
|
] }), jsx_runtime_1.jsx(NewCompDuration_1.NewCompDuration, { durationInFrames: durationInFrames, setDurationInFrames: setDurationInFrames }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
169
112
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "FPS" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: selectedFrameRate, onTextChange: onTextFpsChange, placeholder: "Frame rate (fps)", name: "fps", min: 1, required: true, status: "ok", max: 240, step: 0.01, onValueChange: onFpsChange, rightAlign: false }) })
|
|
170
113
|
] })
|
|
171
|
-
] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: "Creating composition...", errorNotification: "Could not create composition", successNotification: `Created ${newId}`, genericSubmitLabel: "Add to root file", submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, stack:
|
|
114
|
+
] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: "Creating composition...", errorNotification: "Could not create composition", successNotification: `Created ${newId}`, genericSubmitLabel: "Add to root file", submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, stack: stack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => createComposition({
|
|
115
|
+
signal,
|
|
116
|
+
symbolicatedStack,
|
|
117
|
+
}), fallbackToRootFile: true }) })
|
|
172
118
|
] })
|
|
173
119
|
] }));
|
|
174
120
|
};
|
|
175
|
-
const NewComposition = () => {
|
|
176
|
-
return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { children: jsx_runtime_1.jsx(NewCompositionLoaded, {}) }));
|
|
121
|
+
const NewComposition = ({ folderName, parentName, stack }) => {
|
|
122
|
+
return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { children: jsx_runtime_1.jsx(NewCompositionLoaded, { folderName: folderName, parentName: parentName, stack: stack }) }));
|
|
177
123
|
};
|
|
178
124
|
exports.NewComposition = NewComposition;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewFolder = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const get_folder_id_1 = require("../../helpers/get-folder-id");
|
|
8
|
+
const validate_new_folder_name_1 = require("../../helpers/validate-new-folder-name");
|
|
9
|
+
const layout_1 = require("../layout");
|
|
10
|
+
const ModalFooter_1 = require("../ModalFooter");
|
|
11
|
+
const ModalHeader_1 = require("../ModalHeader");
|
|
12
|
+
const layout_2 = require("../RenderModal/layout");
|
|
13
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
14
|
+
const CodemodFooter_1 = require("./CodemodFooter");
|
|
15
|
+
const DismissableModal_1 = require("./DismissableModal");
|
|
16
|
+
const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
|
|
17
|
+
const RemInput_1 = require("./RemInput");
|
|
18
|
+
const ValidationMessage_1 = require("./ValidationMessage");
|
|
19
|
+
const content = {
|
|
20
|
+
padding: 12,
|
|
21
|
+
paddingRight: 12,
|
|
22
|
+
flex: 1,
|
|
23
|
+
fontSize: 13,
|
|
24
|
+
minWidth: 500,
|
|
25
|
+
};
|
|
26
|
+
const getUniqueFolderName = ({ folders, parentName, }) => {
|
|
27
|
+
let counter = 1;
|
|
28
|
+
while (true) {
|
|
29
|
+
const name = counter === 1 ? 'NewFolder' : `NewFolder${counter}`;
|
|
30
|
+
const err = (0, validate_new_folder_name_1.validateNewFolderName)({ folders, newName: name, parentName });
|
|
31
|
+
if (!err) {
|
|
32
|
+
return name;
|
|
33
|
+
}
|
|
34
|
+
counter++;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const NewFolder = ({ parentName, stack }) => {
|
|
38
|
+
const { folders } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
39
|
+
const [newName, setName] = (0, react_1.useState)(() => getUniqueFolderName({ folders, parentName }));
|
|
40
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
42
|
+
const input = inputRef.current;
|
|
43
|
+
if (!input)
|
|
44
|
+
return;
|
|
45
|
+
input.select();
|
|
46
|
+
}, []);
|
|
47
|
+
const onNameChange = (0, react_1.useCallback)((e) => {
|
|
48
|
+
setName(e.target.value);
|
|
49
|
+
}, []);
|
|
50
|
+
const folderNameErrMessage = (0, validate_new_folder_name_1.validateNewFolderName)({
|
|
51
|
+
folders,
|
|
52
|
+
newName,
|
|
53
|
+
parentName,
|
|
54
|
+
});
|
|
55
|
+
const valid = folderNameErrMessage === null;
|
|
56
|
+
const codemod = (0, react_1.useMemo)(() => {
|
|
57
|
+
return {
|
|
58
|
+
type: 'new-folder',
|
|
59
|
+
folderName: newName,
|
|
60
|
+
parentName,
|
|
61
|
+
};
|
|
62
|
+
}, [newName, parentName]);
|
|
63
|
+
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
}, []);
|
|
66
|
+
const folderId = (0, get_folder_id_1.getFolderId)({ folderName: newName, parentName });
|
|
67
|
+
return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
|
|
68
|
+
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "New folder" }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
69
|
+
jsx_runtime_1.jsxs("div", { style: content, children: [parentName ? (jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
70
|
+
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Parent" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: parentName })
|
|
71
|
+
] })) : null, jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
72
|
+
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: [
|
|
73
|
+
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newName, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Folder name", status: "ok", rightAlign: true }), folderNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
74
|
+
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" })
|
|
75
|
+
] })) : null] }) })
|
|
76
|
+
] })
|
|
77
|
+
] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Creating folder...', errorNotification: 'Could not create folder', successNotification: `Created folder ${folderId}`, genericSubmitLabel: 'Add to root file', submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, stack: stack, valid: valid, onSuccess: null, fallbackToRootFile: true, applyCodemod: ({ signal, symbolicatedStack }) => (0, actions_1.applyCodemod)({
|
|
78
|
+
codemod,
|
|
79
|
+
dryRun: false,
|
|
80
|
+
signal,
|
|
81
|
+
symbolicatedStack,
|
|
82
|
+
}) }) })
|
|
83
|
+
] })
|
|
84
|
+
] }));
|
|
85
|
+
};
|
|
86
|
+
exports.NewFolder = NewFolder;
|
|
@@ -15,7 +15,7 @@ const RightAlignInput = ({ children }) => {
|
|
|
15
15
|
exports.RightAlignInput = RightAlignInput;
|
|
16
16
|
exports.inputBaseStyle = {
|
|
17
17
|
padding: `${exports.INPUT_HORIZONTAL_PADDING}px 10px`,
|
|
18
|
-
color:
|
|
18
|
+
color: colors_1.WHITE,
|
|
19
19
|
borderStyle: 'solid',
|
|
20
20
|
borderWidth: 1,
|
|
21
21
|
fontSize: 14,
|
|
@@ -32,8 +32,8 @@ const getInputBorderColor = ({ status, isFocused, isHovered, }) => status === 'w
|
|
|
32
32
|
: isFocused
|
|
33
33
|
? colors_1.SELECTED_BACKGROUND
|
|
34
34
|
: isHovered
|
|
35
|
-
? colors_1.
|
|
36
|
-
: colors_1.
|
|
35
|
+
? colors_1.WHITE_ALPHA_05
|
|
36
|
+
: colors_1.BLACK_ALPHA_60;
|
|
37
37
|
exports.getInputBorderColor = getInputBorderColor;
|
|
38
38
|
const RemInputForwardRef = ({ status, rightAlign, small = false, ...props }, ref) => {
|
|
39
39
|
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
@@ -9,7 +9,7 @@ const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
|
9
9
|
const RemInput_1 = require("../NewComposition/RemInput");
|
|
10
10
|
const inputBaseStyle = {
|
|
11
11
|
padding: `${RemInput_1.INPUT_HORIZONTAL_PADDING}px 10px`,
|
|
12
|
-
color:
|
|
12
|
+
color: colors_1.WHITE,
|
|
13
13
|
borderStyle: 'solid',
|
|
14
14
|
borderWidth: 1,
|
|
15
15
|
fontSize: 14,
|
|
@@ -4,7 +4,7 @@ exports.RenameComposition = 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
|
|
7
|
+
const use_rename_composition_1 = require("../../helpers/use-rename-composition");
|
|
8
8
|
const layout_1 = require("../layout");
|
|
9
9
|
const ModalFooter_1 = require("../ModalFooter");
|
|
10
10
|
const ModalHeader_1 = require("../ModalHeader");
|
|
@@ -12,6 +12,7 @@ const layout_2 = require("../RenderModal/layout");
|
|
|
12
12
|
const ResolveCompositionBeforeModal_1 = require("../RenderModal/ResolveCompositionBeforeModal");
|
|
13
13
|
const CodemodFooter_1 = require("./CodemodFooter");
|
|
14
14
|
const DismissableModal_1 = require("./DismissableModal");
|
|
15
|
+
const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
|
|
15
16
|
const RemInput_1 = require("./RemInput");
|
|
16
17
|
const ValidationMessage_1 = require("./ValidationMessage");
|
|
17
18
|
const content = {
|
|
@@ -43,28 +44,26 @@ const RenameCompositionLoaded = () => {
|
|
|
43
44
|
const onNameChange = (0, react_1.useCallback)((e) => {
|
|
44
45
|
setName(e.target.value);
|
|
45
46
|
}, []);
|
|
46
|
-
const compNameErrMessage =
|
|
47
|
-
|
|
48
|
-
:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
type: 'rename-composition',
|
|
53
|
-
idToRename: resolved.result.id,
|
|
54
|
-
newId,
|
|
55
|
-
};
|
|
56
|
-
}, [newId, resolved.result.id]);
|
|
47
|
+
const { codemod, renameComposition, valid, validationMessage: compNameErrMessage, } = (0, use_rename_composition_1.useRenameComposition)({
|
|
48
|
+
compositions,
|
|
49
|
+
currentId: resolved.result.id,
|
|
50
|
+
newId,
|
|
51
|
+
});
|
|
57
52
|
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
58
53
|
e.preventDefault();
|
|
59
54
|
}, []);
|
|
60
55
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
61
56
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Rename ${resolved.result.id}` }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
62
57
|
jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
63
|
-
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "ID" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(
|
|
58
|
+
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "ID" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsxs(InputAndValidationContainer_1.InputAndValidationContainer, { children: [
|
|
64
59
|
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newId, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Composition ID", status: "ok", rightAlign: true }), compNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
65
60
|
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: compNameErrMessage, type: "error" })
|
|
66
61
|
] })) : null] }) })
|
|
67
|
-
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming...', errorNotification: 'Could not rename composition', successNotification: `Renamed to ${newId}`, genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, stack: compositionStack, valid: valid, onSuccess: null })
|
|
62
|
+
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming...', errorNotification: 'Could not rename composition', successNotification: `Renamed to ${newId}`, genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, stack: compositionStack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => renameComposition({
|
|
63
|
+
newCompositionId: newId,
|
|
64
|
+
signal,
|
|
65
|
+
symbolicatedStack,
|
|
66
|
+
}) }) })
|
|
68
67
|
] })
|
|
69
68
|
] }));
|
|
70
69
|
};
|
|
@@ -10,8 +10,10 @@ const layout_1 = require("../layout");
|
|
|
10
10
|
const ModalFooter_1 = require("../ModalFooter");
|
|
11
11
|
const ModalHeader_1 = require("../ModalHeader");
|
|
12
12
|
const layout_2 = require("../RenderModal/layout");
|
|
13
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
13
14
|
const CodemodFooter_1 = require("./CodemodFooter");
|
|
14
15
|
const DismissableModal_1 = require("./DismissableModal");
|
|
16
|
+
const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
|
|
15
17
|
const RemInput_1 = require("./RemInput");
|
|
16
18
|
const ValidationMessage_1 = require("./ValidationMessage");
|
|
17
19
|
const content = {
|
|
@@ -56,11 +58,16 @@ const RenameFolder = ({ folderName, parentName, stack }) => {
|
|
|
56
58
|
return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
|
|
57
59
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Rename ${folderId}` }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
58
60
|
jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
59
|
-
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(
|
|
61
|
+
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: [
|
|
60
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 }), folderNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
61
63
|
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" })
|
|
62
64
|
] })) : null] }) })
|
|
63
|
-
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming folder...', errorNotification: 'Could not rename folder', successNotification: `Renamed folder to ${newName}`, genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, stack: stack, valid: valid, onSuccess: null })
|
|
65
|
+
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming folder...', errorNotification: 'Could not rename folder', successNotification: `Renamed folder to ${newName}`, genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, stack: stack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => (0, actions_1.applyCodemod)({
|
|
66
|
+
codemod,
|
|
67
|
+
dryRun: false,
|
|
68
|
+
signal,
|
|
69
|
+
symbolicatedStack,
|
|
70
|
+
}) }) })
|
|
64
71
|
] })
|
|
65
72
|
] }));
|
|
66
73
|
};
|
|
@@ -3,19 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RenameStaticFileModal = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const remotion_1 = require("remotion");
|
|
7
|
-
const rename_static_file_1 = require("../../api/rename-static-file");
|
|
8
|
-
const url_state_1 = require("../../helpers/url-state");
|
|
9
6
|
const modals_1 = require("../../state/modals");
|
|
10
7
|
const Button_1 = require("../Button");
|
|
11
8
|
const layout_1 = require("../layout");
|
|
12
9
|
const ModalFooter_1 = require("../ModalFooter");
|
|
13
10
|
const ModalHeader_1 = require("../ModalHeader");
|
|
14
|
-
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
15
11
|
const layout_2 = require("../RenderModal/layout");
|
|
16
12
|
const use_static_files_1 = require("../use-static-files");
|
|
17
13
|
const DismissableModal_1 = require("./DismissableModal");
|
|
14
|
+
const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
|
|
18
15
|
const RemInput_1 = require("./RemInput");
|
|
16
|
+
const use_rename_static_file_1 = require("./use-rename-static-file");
|
|
19
17
|
const ValidationMessage_1 = require("./ValidationMessage");
|
|
20
18
|
const content = {
|
|
21
19
|
padding: 12,
|
|
@@ -24,54 +22,32 @@ const content = {
|
|
|
24
22
|
fontSize: 13,
|
|
25
23
|
minWidth: 500,
|
|
26
24
|
};
|
|
27
|
-
const getParent = (relativePath) => {
|
|
28
|
-
const slashIndex = relativePath.lastIndexOf('/');
|
|
29
|
-
return slashIndex === -1 ? '' : relativePath.slice(0, slashIndex);
|
|
30
|
-
};
|
|
31
|
-
const getBaseName = (relativePath) => {
|
|
32
|
-
const slashIndex = relativePath.lastIndexOf('/');
|
|
33
|
-
return slashIndex === -1 ? relativePath : relativePath.slice(slashIndex + 1);
|
|
34
|
-
};
|
|
35
25
|
const RenameStaticFileModal = ({ relativePath }) => {
|
|
36
26
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
37
|
-
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
38
|
-
const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
|
|
39
27
|
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
40
|
-
const [newName, setNewName] = (0, react_1.useState)(() =>
|
|
28
|
+
const [newName, setNewName] = (0, react_1.useState)(() => (0, use_rename_static_file_1.getStaticFileBaseName)(relativePath));
|
|
41
29
|
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
42
30
|
const inputRef = (0, react_1.useRef)(null);
|
|
31
|
+
const renameFile = (0, use_rename_static_file_1.useRenameStaticFile)({ relativePath, staticFiles });
|
|
43
32
|
(0, react_1.useEffect)(() => {
|
|
44
33
|
const input = inputRef.current;
|
|
45
34
|
if (!input)
|
|
46
35
|
return;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
input.setSelectionRange(0, stemEnd);
|
|
36
|
+
const [start, end] = (0, use_rename_static_file_1.getStaticFileRenameSelection)(newName);
|
|
37
|
+
input.setSelectionRange(start, end);
|
|
50
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
39
|
}, []);
|
|
52
|
-
const parent = (0, react_1.useMemo)(() => getParent(relativePath), [relativePath]);
|
|
53
40
|
const newRelativePath = (0, react_1.useMemo)(() => {
|
|
54
|
-
return
|
|
55
|
-
}, [newName,
|
|
41
|
+
return (0, use_rename_static_file_1.getRenamedStaticFilePath)({ newName, relativePath });
|
|
42
|
+
}, [newName, relativePath]);
|
|
56
43
|
const changed = newRelativePath !== relativePath;
|
|
57
44
|
const validationMessage = (0, react_1.useMemo)(() => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return 'Name cannot start or end with whitespace';
|
|
64
|
-
}
|
|
65
|
-
if (newName.includes('/') || newName.includes('\\')) {
|
|
66
|
-
return 'Name cannot include slashes';
|
|
67
|
-
}
|
|
68
|
-
const existingFile = staticFiles.find((file) => {
|
|
69
|
-
return file.name === newRelativePath && file.name !== relativePath;
|
|
45
|
+
return (0, use_rename_static_file_1.validateStaticFileRename)({
|
|
46
|
+
newName,
|
|
47
|
+
newRelativePath,
|
|
48
|
+
relativePath,
|
|
49
|
+
staticFiles,
|
|
70
50
|
});
|
|
71
|
-
if (existingFile) {
|
|
72
|
-
return 'An asset with this name already exists';
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
51
|
}, [newName, newRelativePath, relativePath, staticFiles]);
|
|
76
52
|
const valid = changed && validationMessage === null;
|
|
77
53
|
const onNameChange = (0, react_1.useCallback)((e) => {
|
|
@@ -82,32 +58,18 @@ const RenameStaticFileModal = ({ relativePath }) => {
|
|
|
82
58
|
return;
|
|
83
59
|
}
|
|
84
60
|
setSubmitting(true);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.then(() => {
|
|
91
|
-
setSelectedModal(null);
|
|
92
|
-
if ((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset' &&
|
|
93
|
-
canvasContent.asset === relativePath) {
|
|
94
|
-
setCanvasContent({ type: 'asset', asset: newRelativePath });
|
|
95
|
-
(0, url_state_1.pushUrl)(`/assets/${newRelativePath}`);
|
|
61
|
+
renameFile(newName)
|
|
62
|
+
.then((renamed) => {
|
|
63
|
+
if (!renamed) {
|
|
64
|
+
setSubmitting(false);
|
|
65
|
+
return;
|
|
96
66
|
}
|
|
97
|
-
|
|
67
|
+
setSelectedModal(null);
|
|
98
68
|
})
|
|
99
|
-
.catch((
|
|
69
|
+
.catch(() => {
|
|
100
70
|
setSubmitting(false);
|
|
101
|
-
notification.replaceContent(`Could not rename ${relativePath}: ${err.message}`, 3000);
|
|
102
71
|
});
|
|
103
|
-
}, [
|
|
104
|
-
canvasContent,
|
|
105
|
-
newRelativePath,
|
|
106
|
-
relativePath,
|
|
107
|
-
setCanvasContent,
|
|
108
|
-
setSelectedModal,
|
|
109
|
-
valid,
|
|
110
|
-
]);
|
|
72
|
+
}, [newName, renameFile, setSelectedModal, valid]);
|
|
111
73
|
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
112
74
|
e.preventDefault();
|
|
113
75
|
onRename();
|
|
@@ -115,7 +77,7 @@ const RenameStaticFileModal = ({ relativePath }) => {
|
|
|
115
77
|
return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
|
|
116
78
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Rename ${relativePath}` }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
117
79
|
jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
118
|
-
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(
|
|
80
|
+
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: [
|
|
119
81
|
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newName, onChange: onNameChange, type: "text", autoFocus: true, autoComplete: "off", "data-1p-ignore": true, placeholder: "Asset name", status: validationMessage ? 'error' : 'ok', rightAlign: true }), validationMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
120
82
|
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: validationMessage, type: "error" })
|
|
121
83
|
] })) : null] }) })
|
|
@@ -20,12 +20,20 @@ const compactStyle = {
|
|
|
20
20
|
height: 10,
|
|
21
21
|
};
|
|
22
22
|
const container = {
|
|
23
|
+
width: '100%',
|
|
23
24
|
maxWidth: 500,
|
|
25
|
+
minWidth: 0,
|
|
26
|
+
};
|
|
27
|
+
const row = {
|
|
28
|
+
minWidth: 0,
|
|
24
29
|
};
|
|
25
30
|
const label = {
|
|
26
31
|
fontSize: 13,
|
|
27
|
-
color:
|
|
32
|
+
color: colors_1.WHITE,
|
|
28
33
|
fontFamily: 'sans-serif',
|
|
34
|
+
minWidth: 0,
|
|
35
|
+
whiteSpace: 'normal',
|
|
36
|
+
overflowWrap: 'anywhere',
|
|
29
37
|
};
|
|
30
38
|
const compactLabel = {
|
|
31
39
|
...label,
|
|
@@ -40,7 +48,7 @@ const ValidationMessage = ({ message, align, type, action, size = 'default' }) =
|
|
|
40
48
|
fill: type === 'warning' ? colors_1.WARNING_COLOR : colors_1.FAIL_COLOR,
|
|
41
49
|
};
|
|
42
50
|
}, [iconStyle, type]);
|
|
43
|
-
return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", justify: align, children: [
|
|
51
|
+
return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", justify: align, style: row, children: [
|
|
44
52
|
jsx_runtime_1.jsx(exports.WarningTriangle, { style: finalStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: size === 'compact' ? 0.75 : 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: message }), action ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
45
53
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: size === 'compact' ? 0.75 : 1 }), action] })) : null] }) }));
|
|
46
54
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type StaticFile } from 'remotion';
|
|
2
|
+
export declare const getStaticFileParent: (relativePath: string) => string;
|
|
3
|
+
export declare const getStaticFileBaseName: (relativePath: string) => string;
|
|
4
|
+
export declare const getStaticFileRenameSelection: (fileName: string) => [number, number];
|
|
5
|
+
export declare const getRenamedStaticFilePath: ({ newName, relativePath, }: {
|
|
6
|
+
readonly newName: string;
|
|
7
|
+
readonly relativePath: string;
|
|
8
|
+
}) => string;
|
|
9
|
+
export declare const validateStaticFileRename: ({ newName, newRelativePath, relativePath, staticFiles, }: {
|
|
10
|
+
readonly newName: string;
|
|
11
|
+
readonly newRelativePath: string;
|
|
12
|
+
readonly relativePath: string;
|
|
13
|
+
readonly staticFiles: StaticFile[];
|
|
14
|
+
}) => "An asset with this name already exists" | "Name cannot be empty" | "Name cannot include slashes" | "Name cannot start or end with whitespace" | null;
|
|
15
|
+
export declare const useRenameStaticFile: ({ relativePath, staticFiles, }: {
|
|
16
|
+
readonly relativePath: string;
|
|
17
|
+
readonly staticFiles: StaticFile[];
|
|
18
|
+
}) => (newName: string) => Promise<boolean>;
|