@remotion/studio 4.0.522 → 4.0.524

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/api/install-package.js +4 -2
  2. package/dist/components/ActionTooltip.d.ts +9 -0
  3. package/dist/components/ActionTooltip.js +143 -0
  4. package/dist/components/AssetAudioVolume.d.ts +5 -0
  5. package/dist/components/AssetAudioVolume.js +33 -0
  6. package/dist/components/Canvas.js +8 -8
  7. package/dist/components/CaptionInspector.js +74 -20
  8. package/dist/components/CheckboardToggle.js +9 -10
  9. package/dist/components/Checkbox.d.ts +1 -0
  10. package/dist/components/Checkbox.js +2 -2
  11. package/dist/components/CompositionContextButton.js +4 -1
  12. package/dist/components/CompositionSelectorItem.js +2 -2
  13. package/dist/components/ConfigureLicenseModal.js +1 -1
  14. package/dist/components/CurrentAsset.js +40 -6
  15. package/dist/components/EditorContexts.js +3 -1
  16. package/dist/components/ElementInstallConfirmation.js +254 -137
  17. package/dist/components/FixComputedValueModal.js +38 -8
  18. package/dist/components/FullscreenToggle.js +8 -10
  19. package/dist/components/GlobalKeybindings.js +107 -49
  20. package/dist/components/InspectorPanel/MultiSequenceField.d.ts +12 -0
  21. package/dist/components/InspectorPanel/MultiSequenceField.js +131 -0
  22. package/dist/components/InspectorPanel/MultiSequenceInspector.d.ts +8 -0
  23. package/dist/components/InspectorPanel/MultiSequenceInspector.js +102 -0
  24. package/dist/components/InspectorPanel/MultiSequenceNumberField.d.ts +9 -0
  25. package/dist/components/InspectorPanel/MultiSequenceNumberField.js +88 -0
  26. package/dist/components/InspectorPanel.js +4 -0
  27. package/dist/components/InspectorSequenceSection.js +69 -6
  28. package/dist/components/InstallPackage.js +4 -5
  29. package/dist/components/KeyboardShortcutsSettings.js +212 -33
  30. package/dist/components/LazySyntaxHighlightedSource.d.ts +4 -0
  31. package/dist/components/LazySyntaxHighlightedSource.js +43 -0
  32. package/dist/components/LoopToggle.js +8 -2
  33. package/dist/components/MenuToolbar.js +11 -7
  34. package/dist/components/ModalContainer.d.ts +1 -0
  35. package/dist/components/ModalContainer.js +2 -2
  36. package/dist/components/Modals.js +3 -1
  37. package/dist/components/ModelManager.d.ts +16 -0
  38. package/dist/components/ModelManager.js +200 -0
  39. package/dist/components/ModelsSettings.d.ts +2 -0
  40. package/dist/components/ModelsSettings.js +133 -0
  41. package/dist/components/MuteToggle.d.ts +1 -0
  42. package/dist/components/MuteToggle.js +16 -6
  43. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  44. package/dist/components/NewComposition/DismissableModal.js +2 -2
  45. package/dist/components/NewComposition/InputDragger.d.ts +2 -2
  46. package/dist/components/NewComposition/InputDragger.js +6 -6
  47. package/dist/components/NewComposition/NewComposition.d.ts +1 -0
  48. package/dist/components/NewComposition/NewComposition.js +5 -4
  49. package/dist/components/NewComposition/NewFolder.js +9 -8
  50. package/dist/components/NewComposition/RenameComposition.js +3 -2
  51. package/dist/components/NewComposition/RenameFolder.js +15 -10
  52. package/dist/components/NewComposition/SlugPreview.d.ts +7 -0
  53. package/dist/components/NewComposition/SlugPreview.js +18 -0
  54. package/dist/components/OptionalPackageModal.d.ts +11 -0
  55. package/dist/components/OptionalPackageModal.js +155 -0
  56. package/dist/components/OutlineToggle.js +16 -10
  57. package/dist/components/PlayPause.js +11 -9
  58. package/dist/components/PlaybackKeyboardShortcutsManager.d.ts +2 -0
  59. package/dist/components/PlaybackKeyboardShortcutsManager.js +39 -7
  60. package/dist/components/PlaybackRateSelector.js +2 -2
  61. package/dist/components/PreviewToolbar.js +1 -1
  62. package/dist/components/PreviewToolbarOverflowButton.js +19 -4
  63. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +5 -2
  64. package/dist/components/RadioButton.d.ts +1 -0
  65. package/dist/components/RadioButton.js +2 -2
  66. package/dist/components/RenderButton.js +5 -1
  67. package/dist/components/RenderModal/NumberSetting.d.ts +6 -1
  68. package/dist/components/RenderModal/NumberSetting.js +2 -2
  69. package/dist/components/RenderModal/RenderModalBasic.js +1 -1
  70. package/dist/components/RenderModal/RenderModalOutputName.d.ts +3 -1
  71. package/dist/components/RenderModal/RenderModalOutputName.js +4 -4
  72. package/dist/components/RenderModal/SeparateAudioOption.js +1 -1
  73. package/dist/components/RenderModal/WebRenderModalBasic.js +1 -1
  74. package/dist/components/RenderQueue/CaptionQueueItem.d.ts +6 -0
  75. package/dist/components/RenderQueue/CaptionQueueItem.js +130 -0
  76. package/dist/components/RenderQueue/CaptionQueueProcessor.d.ts +1 -0
  77. package/dist/components/RenderQueue/CaptionQueueProcessor.js +110 -0
  78. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.d.ts +2 -0
  79. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.js +54 -0
  80. package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +2 -1
  81. package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -1
  82. package/dist/components/RenderQueue/RenderQueueItem.js +3 -3
  83. package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +2 -1
  84. package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +2 -1
  85. package/dist/components/RenderQueue/RenderQueueRemoveItem.js +2 -1
  86. package/dist/components/RenderQueue/RenderQueueRepeat.js +2 -1
  87. package/dist/components/RenderQueue/VideoMattingQueueItem.d.ts +6 -0
  88. package/dist/components/RenderQueue/VideoMattingQueueItem.js +130 -0
  89. package/dist/components/RenderQueue/VideoMattingQueueProcessor.d.ts +1 -0
  90. package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +105 -0
  91. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.d.ts +2 -0
  92. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.js +54 -0
  93. package/dist/components/RenderQueue/caption-job-types.d.ts +47 -0
  94. package/dist/components/RenderQueue/caption-job-types.js +7 -0
  95. package/dist/components/RenderQueue/context.d.ts +16 -0
  96. package/dist/components/RenderQueue/context.js +224 -11
  97. package/dist/components/RenderQueue/index.js +34 -10
  98. package/dist/components/RenderQueue/item-style.d.ts +1 -0
  99. package/dist/components/RenderQueue/item-style.js +2 -1
  100. package/dist/components/RenderQueue/load-model-for-job.d.ts +11 -0
  101. package/dist/components/RenderQueue/load-model-for-job.js +14 -0
  102. package/dist/components/RenderQueue/video-matting-job-types.d.ts +38 -0
  103. package/dist/components/RenderQueue/video-matting-job-types.js +5 -0
  104. package/dist/components/RendersTab.js +4 -4
  105. package/dist/components/RulersAndGuidesToggle.js +7 -1
  106. package/dist/components/SegmentedControl.d.ts +2 -2
  107. package/dist/components/SegmentedControl.js +38 -13
  108. package/dist/components/SelectedOutlinePolygon.js +8 -2
  109. package/dist/components/SettingsButton.d.ts +4 -0
  110. package/dist/components/SettingsButton.js +51 -0
  111. package/dist/components/SettingsModal.d.ts +1 -1
  112. package/dist/components/SettingsModal.js +3 -1
  113. package/dist/components/ShowOutlinesProvider.js +12 -0
  114. package/dist/components/SidebarCollapserControls.js +17 -21
  115. package/dist/components/SizeSelector.js +12 -4
  116. package/dist/components/SkillsSettings.js +2 -3
  117. package/dist/components/SnappingToggle.js +9 -8
  118. package/dist/components/StudioSettings.js +32 -18
  119. package/dist/components/SyntaxHighlightedSource.d.ts +5 -0
  120. package/dist/components/SyntaxHighlightedSource.js +78 -0
  121. package/dist/components/Tabs/vertical.d.ts +1 -0
  122. package/dist/components/Tabs/vertical.js +2 -2
  123. package/dist/components/TimeValue.js +2 -3
  124. package/dist/components/Timeline/SequencePropsObserver.js +4 -0
  125. package/dist/components/Timeline/Timeline.js +49 -81
  126. package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
  127. package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
  128. package/dist/components/Timeline/TimelineDragHandler.js +2 -2
  129. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  130. package/dist/components/Timeline/TimelineLayerChildren.js +12 -9
  131. package/dist/components/Timeline/TimelineRowChrome.js +11 -3
  132. package/dist/components/Timeline/TimelineSchemaField.js +8 -4
  133. package/dist/components/Timeline/TimelineSelection.d.ts +2 -0
  134. package/dist/components/Timeline/TimelineSelection.js +55 -2
  135. package/dist/components/Timeline/TimelineSequence.js +75 -17
  136. package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
  137. package/dist/components/Timeline/TimelineSequenceItem.js +208 -111
  138. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +23 -3
  139. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +73 -25
  140. package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
  141. package/dist/components/Timeline/TimelineZoomControls.js +2 -1
  142. package/dist/components/Timeline/timeline-field-display-utils.js +8 -5
  143. package/dist/components/Timeline/use-asset-timeline-context-menu.d.ts +2 -0
  144. package/dist/components/Timeline/use-asset-timeline-context-menu.js +52 -0
  145. package/dist/components/TimelineCombobox.d.ts +1 -0
  146. package/dist/components/TimelineCombobox.js +8 -4
  147. package/dist/components/TimelineInOutToggle.js +14 -18
  148. package/dist/components/Transcription/LazyModels.d.ts +1 -0
  149. package/dist/components/Transcription/LazyModels.js +5 -0
  150. package/dist/components/Transcription/Models.d.ts +6 -0
  151. package/dist/components/Transcription/Models.js +18 -0
  152. package/dist/components/Transcription/TranscriptionModal.d.ts +3 -0
  153. package/dist/components/Transcription/TranscriptionModal.js +428 -0
  154. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.d.ts +5 -0
  155. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +48 -0
  156. package/dist/components/Transcription/caption-output-name.d.ts +2 -0
  157. package/dist/components/Transcription/caption-output-name.js +10 -0
  158. package/dist/components/Transcription/resample-media-to-16-khz.d.ts +6 -0
  159. package/dist/components/Transcription/resample-media-to-16-khz.js +82 -0
  160. package/dist/components/Transcription/whisper-languages.d.ts +2 -0
  161. package/dist/components/Transcription/whisper-languages.js +104 -0
  162. package/dist/components/Transcription/whisper-webgpu-capability.d.ts +2 -0
  163. package/dist/components/Transcription/whisper-webgpu-capability.js +7 -0
  164. package/dist/components/UndoRedoButtons.js +13 -38
  165. package/dist/components/UpdatesSettings.js +8 -12
  166. package/dist/components/VideoMatting/LazyModels.d.ts +1 -0
  167. package/dist/components/VideoMatting/LazyModels.js +5 -0
  168. package/dist/components/VideoMatting/Models.d.ts +6 -0
  169. package/dist/components/VideoMatting/Models.js +18 -0
  170. package/dist/components/VideoMatting/VideoMattingModal.d.ts +3 -0
  171. package/dist/components/VideoMatting/VideoMattingModal.js +207 -0
  172. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.d.ts +5 -0
  173. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +46 -0
  174. package/dist/components/VideoMatting/video-matting-capability.d.ts +2 -0
  175. package/dist/components/VideoMatting/video-matting-capability.js +7 -0
  176. package/dist/components/WebMcp.js +439 -22
  177. package/dist/components/handle-drop.js +3 -2
  178. package/dist/components/import-assets.d.ts +3 -2
  179. package/dist/components/import-assets.js +5 -9
  180. package/dist/components/keyboard-shortcuts.d.ts +17 -1
  181. package/dist/components/keyboard-shortcuts.js +191 -89
  182. package/dist/components/public-output-name.d.ts +5 -0
  183. package/dist/components/public-output-name.js +60 -0
  184. package/dist/components/use-model-cache-status.d.ts +7 -0
  185. package/dist/components/use-model-cache-status.js +35 -0
  186. package/dist/error-overlay/remotion-overlay/CodeFrame.js +29 -18
  187. package/dist/esm/CaptionQueueProcessor-k0yrm3dj.mjs +211 -0
  188. package/dist/esm/LazyModels-hc33szyn.mjs +11 -0
  189. package/dist/esm/LazyModels-sg40rjw6.mjs +11 -0
  190. package/dist/esm/SyntaxHighlightedSource-3xks91rz.mjs +1236 -0
  191. package/dist/esm/TranscriptionModal-3ctnxpt6.mjs +1011 -0
  192. package/dist/esm/VideoMattingModal-b0r7e60n.mjs +374 -0
  193. package/dist/esm/VideoMattingQueueProcessor-t1hgm2rm.mjs +109 -0
  194. package/dist/esm/index-1b9skrrd.mjs +142 -0
  195. package/dist/esm/index-2j3d1g81.mjs +261 -0
  196. package/dist/esm/index-5zrb1ft4.mjs +39 -0
  197. package/dist/esm/index-7tt71e8n.mjs +36 -0
  198. package/dist/esm/index-9qtvmwtx.mjs +1366 -0
  199. package/dist/esm/index-9x6e1dq0.mjs +428 -0
  200. package/dist/esm/index-c37kme2v.mjs +46209 -0
  201. package/dist/esm/index-cw0pnpg5.mjs +50 -0
  202. package/dist/esm/index-e3zwf3e7.mjs +36 -0
  203. package/dist/esm/index-er3mh6em.mjs +54688 -0
  204. package/dist/esm/{chunk-je0h1bgt.js → index-k426ye99.mjs} +4 -1
  205. package/dist/esm/index-q2epbw93.mjs +423 -0
  206. package/dist/esm/index-q5xv20xx.mjs +41 -0
  207. package/dist/esm/{chunk-6jf1natv.js → index-rcv7qkt5.mjs} +18 -1
  208. package/dist/esm/index-v4tr1bft.mjs +20 -0
  209. package/dist/esm/index-wbmp5srk.mjs +35 -0
  210. package/dist/esm/index-yfrysr5f.mjs +1154 -0
  211. package/dist/esm/index.mjs +45 -933
  212. package/dist/esm/internals.mjs +13 -114393
  213. package/dist/esm/previewEntry.mjs +387 -115050
  214. package/dist/esm/renderEntry.mjs +5 -5
  215. package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-bt2d6qxq.mjs} +1 -1
  216. package/dist/helpers/colors.d.ts +1 -0
  217. package/dist/helpers/colors.js +4 -3
  218. package/dist/helpers/drag-aware-double-click.d.ts +2 -1
  219. package/dist/helpers/drag-aware-double-click.js +12 -1
  220. package/dist/helpers/get-asset-metadata.d.ts +1 -0
  221. package/dist/helpers/get-asset-metadata.js +4 -0
  222. package/dist/helpers/hoverable.js +8 -0
  223. package/dist/helpers/inject-css.js +2 -0
  224. package/dist/helpers/optional-package-dependencies.d.ts +3 -0
  225. package/dist/helpers/optional-package-dependencies.js +24 -0
  226. package/dist/helpers/pointer-session.d.ts +6 -0
  227. package/dist/helpers/pointer-session.js +36 -14
  228. package/dist/helpers/prism-vsc-dark-plus.d.ts +1 -0
  229. package/dist/helpers/prism-vsc-dark-plus.js +305 -0
  230. package/dist/helpers/sequence-node-path-mutations.js +11 -0
  231. package/dist/helpers/slugify-name.d.ts +1 -0
  232. package/dist/helpers/slugify-name.js +14 -0
  233. package/dist/helpers/studio-runtime-config.d.ts +1 -0
  234. package/dist/helpers/studio-runtime-config.js +6 -1
  235. package/dist/helpers/use-create-composition.d.ts +1 -0
  236. package/dist/helpers/use-create-composition.js +12 -7
  237. package/dist/helpers/use-keybinding.d.ts +9 -3
  238. package/dist/helpers/use-keybinding.js +8 -9
  239. package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -0
  240. package/dist/helpers/use-keyboard-shortcut-label.js +15 -0
  241. package/dist/helpers/use-menu-structure.js +59 -14
  242. package/dist/helpers/use-rename-composition.d.ts +1 -0
  243. package/dist/helpers/use-rename-composition.js +11 -5
  244. package/dist/icons/input-props.d.ts +1 -1
  245. package/dist/icons/input-props.js +2 -2
  246. package/dist/icons/models.d.ts +4 -0
  247. package/dist/icons/models.js +7 -0
  248. package/dist/icons/separation.d.ts +4 -0
  249. package/dist/icons/separation.js +7 -0
  250. package/dist/icons/skills.js +1 -1
  251. package/dist/icons/transcription.d.ts +4 -0
  252. package/dist/icons/transcription.js +7 -0
  253. package/dist/icons/upload.js +1 -1
  254. package/dist/renderEntry.js +2 -2
  255. package/dist/state/modals.d.ts +14 -2
  256. package/package.json +35 -21
  257. package/dist/components/UpdateCheck.d.ts +0 -1
  258. package/dist/components/UpdateCheck.js +0 -79
  259. package/dist/esm/chunk-3netyjd9.js +0 -99793
@@ -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,2 @@
1
+ import React from 'react';
2
+ export declare const ModelsSettings: React.FC;
@@ -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;
@@ -1,3 +1,4 @@
1
+ export declare const toggleMute: (setMuted: import("react").Dispatch<import("react").SetStateAction<boolean>>) => void;
1
2
  export declare const MuteToggle: React.FC<{
2
3
  muted: boolean;
3
4
  setMuted: React.Dispatch<React.SetStateAction<boolean>>;
@@ -1,20 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MuteToggle = void 0;
3
+ exports.MuteToggle = exports.toggleMute = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../helpers/colors");
7
+ const use_keybinding_1 = require("../helpers/use-keybinding");
8
+ const use_keyboard_shortcut_label_1 = require("../helpers/use-keyboard-shortcut-label");
7
9
  const media_volume_1 = require("../icons/media-volume");
8
10
  const mute_1 = require("../state/mute");
11
+ const ActionTooltip_1 = require("./ActionTooltip");
9
12
  const ControlButton_1 = require("./ControlButton");
13
+ const toggleMute = (setMuted) => {
14
+ setMuted((muted) => {
15
+ (0, mute_1.persistMuteOption)(!muted);
16
+ return !muted;
17
+ });
18
+ };
19
+ exports.toggleMute = toggleMute;
10
20
  const MuteToggle = ({ muted, setMuted }) => {
21
+ const shortcut = (0, use_keyboard_shortcut_label_1.useKeyboardShortcutLabel)('toggleMute');
22
+ const ariaShortcut = (0, use_keyboard_shortcut_label_1.useKeyboardShortcutAriaKeyShortcuts)('toggleMute');
23
+ const shortcutsDisabled = (0, use_keybinding_1.areKeyboardShortcutsDisabled)();
11
24
  const onClick = (0, react_1.useCallback)(() => {
12
- setMuted((m) => {
13
- (0, mute_1.persistMuteOption)(!m);
14
- return !m;
15
- });
25
+ (0, exports.toggleMute)(setMuted);
16
26
  }, [setMuted]);
17
27
  const accessibilityLabel = muted ? 'Unmute video' : 'Mute video';
18
- return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (color) => muted ? jsx_runtime_1.jsx(media_volume_1.VolumeOffIcon, { color: colors_1.BLUE }) : jsx_runtime_1.jsx(media_volume_1.VolumeOnIcon, { color: color }) }));
28
+ return (jsx_runtime_1.jsx(ActionTooltip_1.ActionTooltip, { label: accessibilityLabel, shortcut: shortcutsDisabled ? null : shortcut, delay: 800, dismissOnClick: false, children: jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: "", "aria-label": accessibilityLabel, "aria-keyshortcuts": shortcutsDisabled ? undefined : ariaShortcut || undefined, onClick: onClick, children: (color) => muted ? (jsx_runtime_1.jsx(media_volume_1.VolumeOffIcon, { color: colors_1.BLUE })) : (jsx_runtime_1.jsx(media_volume_1.VolumeOnIcon, { color: color })) }) }));
19
29
  };
20
30
  exports.MuteToggle = MuteToggle;
@@ -2,4 +2,5 @@ import React from 'react';
2
2
  export declare const DismissableModal: React.FC<{
3
3
  readonly children: React.ReactNode;
4
4
  readonly panelStyle?: React.CSSProperties;
5
+ readonly ariaLabel?: string;
5
6
  }>;
@@ -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
@@ -16,6 +16,7 @@ export type NewCompositionFormValues = {
16
16
  };
17
17
  };
18
18
  export declare const NewCompositionFields: React.FC<{
19
+ readonly compositionId: string;
19
20
  readonly heightValidationMessage: string | null;
20
21
  readonly inputRef: RefObject<HTMLInputElement | null>;
21
22
  readonly nameValidationMessage: string | null;
@@ -26,6 +26,7 @@ const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
26
26
  const InputDragger_1 = require("./InputDragger");
27
27
  const NewCompDuration_1 = require("./NewCompDuration");
28
28
  const RemInput_1 = require("./RemInput");
29
+ const SlugPreview_1 = require("./SlugPreview");
29
30
  const ValidationMessage_1 = require("./ValidationMessage");
30
31
  const content = {
31
32
  padding: 12,
@@ -68,7 +69,7 @@ const FolderDropdownLabel = ({ folderPath, indentation }) => {
68
69
  };
69
70
  const rootFolderId = 'new-composition-root-folder';
70
71
  const folderSelectIdPrefix = 'new-composition-folder-';
71
- const NewCompositionFields = ({ heightValidationMessage, inputRef, nameValidationMessage, setValues, values, widthValidationMessage, }) => {
72
+ const NewCompositionFields = ({ compositionId, heightValidationMessage, inputRef, nameValidationMessage, setValues, values, widthValidationMessage, }) => {
72
73
  const { folders } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
73
74
  const { compositionSortOrder } = (0, react_1.useContext)(folders_1.FolderContext);
74
75
  const selectedFolderId = values.folder.folderName
@@ -207,7 +208,7 @@ const NewCompositionFields = ({ heightValidationMessage, inputRef, nameValidatio
207
208
  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(ComboBox_1.Combobox, { values: folderValues, selectedId: selectedFolderId, style: folderSelectStyle, title: "Folder" }) })
208
209
  ] }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
209
210
  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: [
210
- jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: values.id, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Composition ID", status: "ok", rightAlign: true }), nameValidationMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
211
+ jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: values.id, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Composition ID", status: "ok", rightAlign: true }), jsx_runtime_1.jsx(SlugPreview_1.SlugPreview, { action: "create", currentName: null, input: values.id, slug: compositionId }), nameValidationMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
211
212
  jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: nameValidationMessage, type: "error" })
212
213
  ] })) : null] }) })
213
214
  ] }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
@@ -252,7 +253,7 @@ const NewCompositionLoaded = ({ canvasCapture, folderName, parentName, stack })
252
253
  return;
253
254
  input.select();
254
255
  }, []);
255
- const { codemod, createComposition, heightValidationMessage, nameValidationMessage, valid, widthValidationMessage, } = (0, use_create_composition_1.useCreateComposition)({
256
+ const { codemod, compositionId, createComposition, heightValidationMessage, nameValidationMessage, valid, widthValidationMessage, } = (0, use_create_composition_1.useCreateComposition)({
256
257
  compositions,
257
258
  durationInFrames: values.durationInFrames,
258
259
  folderName: values.folder.folderName,
@@ -294,7 +295,7 @@ const NewCompositionLoaded = ({ canvasCapture, folderName, parentName, stack })
294
295
  }, []);
295
296
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
296
297
  jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: canvasCapture === null ? 'New composition' : 'Import Canvas Capture' }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
297
- jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsx(exports.NewCompositionFields, { heightValidationMessage: heightValidationMessage, inputRef: inputRef, nameValidationMessage: nameValidationMessage, setValues: setValues, values: values, widthValidationMessage: widthValidationMessage }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: null, errorNotification: "Could not create composition", genericSubmitLabel: "Add to root file", submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, stack: values.folder.stack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => createCanvasCaptureComposition({
298
+ jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsx(exports.NewCompositionFields, { compositionId: compositionId, heightValidationMessage: heightValidationMessage, inputRef: inputRef, nameValidationMessage: nameValidationMessage, setValues: setValues, values: values, widthValidationMessage: widthValidationMessage }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: null, errorNotification: "Could not create composition", genericSubmitLabel: "Add to root file", submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, stack: values.folder.stack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => createCanvasCaptureComposition({
298
299
  signal,
299
300
  symbolicatedStack,
300
301
  }), applyCodemodForPreview: null, fallbackToRootFile: true }) })
@@ -4,6 +4,7 @@ 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 slugify_name_1 = require("../../helpers/slugify-name");
7
8
  const validate_new_folder_name_1 = require("../../helpers/validate-new-folder-name");
8
9
  const layout_1 = require("../layout");
9
10
  const ModalFooter_1 = require("../ModalFooter");
@@ -14,6 +15,7 @@ const CodemodFooter_1 = require("./CodemodFooter");
14
15
  const DismissableModal_1 = require("./DismissableModal");
15
16
  const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
16
17
  const RemInput_1 = require("./RemInput");
18
+ const SlugPreview_1 = require("./SlugPreview");
17
19
  const ValidationMessage_1 = require("./ValidationMessage");
18
20
  const content = {
19
21
  padding: 12,
@@ -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 folderNameErrMessage = (0, validate_new_folder_name_1.validateNewFolderName)({
50
- folders,
51
- newName,
52
- parentName,
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: newName,
59
+ folderName,
59
60
  parentName,
60
61
  };
61
- }, [newName, parentName]);
62
+ }, [folderName, parentName]);
62
63
  const onSubmit = (0, react_1.useCallback)((e) => {
63
64
  e.preventDefault();
64
65
  }, []);
@@ -68,7 +69,7 @@ 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 }), folderNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
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 }), jsx_runtime_1.jsx(SlugPreview_1.SlugPreview, { action: "create", currentName: null, input: newName, slug: folderName }), folderNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
72
73
  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
74
  ] })) : null] }) })
74
75
  ] })
@@ -14,6 +14,7 @@ const CodemodFooter_1 = require("./CodemodFooter");
14
14
  const DismissableModal_1 = require("./DismissableModal");
15
15
  const InputAndValidationContainer_1 = require("./InputAndValidationContainer");
16
16
  const RemInput_1 = require("./RemInput");
17
+ const SlugPreview_1 = require("./SlugPreview");
17
18
  const ValidationMessage_1 = require("./ValidationMessage");
18
19
  const content = {
19
20
  padding: 12,
@@ -44,7 +45,7 @@ const RenameCompositionLoaded = () => {
44
45
  const onNameChange = (0, react_1.useCallback)((e) => {
45
46
  setName(e.target.value);
46
47
  }, []);
47
- const { codemod, renameComposition, valid, validationMessage: compNameErrMessage, } = (0, use_rename_composition_1.useRenameComposition)({
48
+ const { codemod, compositionId, renameComposition, valid, validationMessage: compNameErrMessage, } = (0, use_rename_composition_1.useRenameComposition)({
48
49
  compositions,
49
50
  currentId: resolved.result.id,
50
51
  newId,
@@ -56,7 +57,7 @@ const RenameCompositionLoaded = () => {
56
57
  jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Rename ${resolved.result.id}` }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
57
58
  jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
58
59
  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: [
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: [
60
+ jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, value: newId, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Composition ID", status: "ok", rightAlign: true }), jsx_runtime_1.jsx(SlugPreview_1.SlugPreview, { action: "rename", currentName: resolved.result.id, input: newId, slug: compositionId }), compNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
60
61
  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" })
61
62
  ] })) : null] }) })
62
63
  ] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming...', errorNotification: 'Could not rename composition', genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, stack: compositionStack, valid: valid, onSuccess: null, applyCodemod: ({ signal, symbolicatedStack }) => renameComposition({