@remotion/studio 4.0.526 → 4.0.527

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 (98) hide show
  1. package/dist/components/Canvas.js +88 -26
  2. package/dist/components/CanvasCaptureDropHandler.js +63 -0
  3. package/dist/components/CanvasOrLoading.js +10 -2
  4. package/dist/components/CompositionSelectorItem.js +1 -0
  5. package/dist/components/CurrentAsset.js +2 -1
  6. package/dist/components/InitialCompositionLoader.js +1 -1
  7. package/dist/components/InlineDropdown.js +26 -2
  8. package/dist/components/InlineEditableTitle.js +1 -0
  9. package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.js +1 -0
  10. package/dist/components/InspectorPanel/CompositionInspector.js +3 -3
  11. package/dist/components/InspectorPanel/CompositionMetadata.js +4 -0
  12. package/dist/components/InspectorPanel/ElementLibraryButton.js +1 -0
  13. package/dist/components/InspectorPanel/MultiSequenceInspector.js +32 -1
  14. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +41 -1
  15. package/dist/components/InspectorPanel/common.js +1 -0
  16. package/dist/components/InspectorPanel/styles.js +2 -0
  17. package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
  18. package/dist/components/InspectorSourceLocation.js +3 -0
  19. package/dist/components/MenuBuildIndicator.js +1 -0
  20. package/dist/components/NewComposition/CancelButton.js +1 -1
  21. package/dist/components/Preview.js +3 -0
  22. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -0
  23. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -0
  24. package/dist/components/RadioButton.js +1 -0
  25. package/dist/components/RenderModal/DataEditor.js +4 -1
  26. package/dist/components/RenderQueue/CaptionQueueItem.js +5 -2
  27. package/dist/components/RenderQueue/CaptionQueueProcessor.js +35 -8
  28. package/dist/components/RenderQueue/VideoMattingQueueItem.js +1 -0
  29. package/dist/components/RenderQueue/caption-job-types.d.ts +6 -0
  30. package/dist/components/RenderQueue/index.js +1 -0
  31. package/dist/components/RendersTab.js +2 -0
  32. package/dist/components/SelectedOutlineSnapIndicators.d.ts +6 -0
  33. package/dist/components/SelectedOutlineSnapIndicators.js +16 -12
  34. package/dist/components/SequencePropsSubscriptionProvider.d.ts +3 -0
  35. package/dist/components/SequencePropsSubscriptionProvider.js +8 -6
  36. package/dist/components/Timeline/TimelineDeleteKeybindings.js +6 -9
  37. package/dist/components/Timeline/TimelineEffectItem.js +1 -0
  38. package/dist/components/Timeline/TimelineExpandArrowButton.js +1 -0
  39. package/dist/components/Timeline/TimelineExpandedRow.js +1 -0
  40. package/dist/components/Timeline/TimelineFieldLabel.js +1 -0
  41. package/dist/components/Timeline/TimelineKeyframeControls.js +1 -0
  42. package/dist/components/Timeline/TimelineSequence.js +26 -0
  43. package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
  44. package/dist/components/Timeline/TimelineSequenceItem.js +28 -0
  45. package/dist/components/Timeline/TimelineViewport.d.ts +1 -0
  46. package/dist/components/Timeline/TimelineViewport.js +10 -1
  47. package/dist/components/Timeline/delete-selected-timeline-item.js +2 -2
  48. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +3 -1
  49. package/dist/components/Timeline/get-sequence-context-menu-items.js +13 -1
  50. package/dist/components/Timeline/split-selected-timeline-item.d.ts +13 -10
  51. package/dist/components/Timeline/split-selected-timeline-item.js +58 -35
  52. package/dist/components/TimelineCombobox.js +1 -0
  53. package/dist/components/Transcription/TranscriptionModal.js +16 -11
  54. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +1 -1
  55. package/dist/components/WebMcp.js +1 -0
  56. package/dist/components/composition-drop-preview.d.ts +9 -2
  57. package/dist/components/composition-drop-preview.js +7 -4
  58. package/dist/components/composition-menu-items.js +4 -4
  59. package/dist/components/delete-jsx-nodes-api.d.ts +2 -0
  60. package/dist/components/{delete-jsx-node-api.js → delete-jsx-nodes-api.js} +5 -5
  61. package/dist/components/get-open-in-menu-items.js +7 -7
  62. package/dist/components/keyboard-shortcuts.d.ts +4 -4
  63. package/dist/components/keyboard-shortcuts.js +3 -1
  64. package/dist/components/public-output-name.d.ts +1 -0
  65. package/dist/components/public-output-name.js +7 -3
  66. package/dist/esm/{CaptionQueueProcessor-k0yrm3dj.mjs → CaptionQueueProcessor-npa6szn1.mjs} +39 -8
  67. package/dist/esm/{LazyModels-nk7py0zt.mjs → LazyModels-nh3c8h9p.mjs} +4 -3
  68. package/dist/esm/{LazyModels-mtggyjye.mjs → LazyModels-rr5v8h5y.mjs} +4 -3
  69. package/dist/esm/{TranscriptionModal-ymnx1c7m.mjs → TranscriptionModal-79m5wgcj.mjs} +25 -17
  70. package/dist/esm/{VideoMattingModal-05vpczks.mjs → VideoMattingModal-31pew0xj.mjs} +9 -6
  71. package/dist/esm/index-21hxsfaa.mjs +239 -0
  72. package/dist/esm/{index-0gewwxse.mjs → index-4zen9prq.mjs} +2293 -2203
  73. package/dist/esm/index-5t2dwxsk.mjs +530 -0
  74. package/dist/esm/{index-5gd8k9yv.mjs → index-614tdz2q.mjs} +1 -1
  75. package/dist/esm/{index-cdy8v54v.mjs → index-9xxg6218.mjs} +20 -541
  76. package/dist/esm/{index-5bfxbpca.mjs → index-ac5550e7.mjs} +1 -1
  77. package/dist/esm/{index-eb5txqp6.mjs → index-e855w59j.mjs} +8 -86
  78. package/dist/esm/{index-4dsz9035.mjs → index-n5gmcvhz.mjs} +1 -1
  79. package/dist/esm/{index-bs39wngg.mjs → index-ppspzgn9.mjs} +3134 -2994
  80. package/dist/esm/{index-g7k2dvar.mjs → index-r0ejh5sy.mjs} +1 -1
  81. package/dist/esm/index-r1gr3j3a.mjs +80 -0
  82. package/dist/esm/{index-x40wwfmt.mjs → index-s7qa3xbw.mjs} +6 -4
  83. package/dist/esm/{index-f97r9e2g.mjs → index-vxwg66ar.mjs} +5 -3
  84. package/dist/esm/index.mjs +3 -2
  85. package/dist/esm/internals.mjs +10 -7
  86. package/dist/esm/previewEntry.mjs +10 -7
  87. package/dist/esm/{resolve-composition-component-location-bt2d6qxq.mjs → resolve-composition-component-location-qrp05g62.mjs} +1 -1
  88. package/dist/helpers/copy-text.js +1 -16
  89. package/dist/helpers/hoverable.js +2 -1
  90. package/dist/helpers/open-in-editor.js +1 -1
  91. package/dist/helpers/studio-runtime-config.d.ts +1 -1
  92. package/dist/helpers/use-keybinding.d.ts +1 -1
  93. package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -2
  94. package/dist/helpers/use-menu-structure.js +15 -9
  95. package/dist/state/modals.d.ts +5 -0
  96. package/dist/state/timeline-zoom.js +4 -0
  97. package/package.json +19 -19
  98. package/dist/components/delete-jsx-node-api.d.ts +0 -2
@@ -0,0 +1,239 @@
1
+ import {
2
+ callApi
3
+ } from "./index-r1gr3j3a.mjs";
4
+ import {
5
+ getBrowserStudioOperations
6
+ } from "./index-cw0pnpg5.mjs";
7
+ import {
8
+ useZIndex
9
+ } from "./index-9xxg6218.mjs";
10
+ import {
11
+ NOTIFICATION_BACKGROUND,
12
+ NOTIFICATION_BORDER,
13
+ NOTIFICATION_SHADOW,
14
+ TRANSPARENT,
15
+ WHITE_HEX
16
+ } from "./index-k426ye99.mjs";
17
+
18
+ // src/components/Notifications/NotificationCenter.tsx
19
+ import {
20
+ createRef,
21
+ useCallback,
22
+ useImperativeHandle,
23
+ useState
24
+ } from "react";
25
+ import ReactDOM from "react-dom";
26
+
27
+ // src/components/Menu/portals.ts
28
+ var portalIds = [
29
+ "menuportal-0",
30
+ "menuportal-1",
31
+ "menuportal-2",
32
+ "menuportal-3",
33
+ "menuportal-4",
34
+ "menuportal-5"
35
+ ];
36
+ var portals = typeof document === "undefined" ? [] : portalIds.map((id) => document.getElementById(id));
37
+ var getPortal = (i) => {
38
+ const portal = portals[i];
39
+ if (!portal) {
40
+ throw new Error(`Expected menu portal ${i} to exist`);
41
+ }
42
+ return portal;
43
+ };
44
+
45
+ // src/components/Notifications/Notification.tsx
46
+ import { useEffect } from "react";
47
+ import { jsx } from "react/jsx-runtime";
48
+ var notification = {
49
+ backgroundColor: NOTIFICATION_BACKGROUND,
50
+ color: WHITE_HEX,
51
+ fontFamily: "Arial, Helvetica, sans-serif",
52
+ display: "inline-flex",
53
+ padding: "6px 14px",
54
+ borderRadius: 6,
55
+ fontSize: 13,
56
+ border: NOTIFICATION_BORDER,
57
+ boxShadow: NOTIFICATION_SHADOW,
58
+ marginTop: 3,
59
+ marginBottom: 3,
60
+ alignItems: "center"
61
+ };
62
+ var Notification = ({ children, id, duration, created, onRemove }) => {
63
+ useEffect(() => {
64
+ if (duration === null) {
65
+ return;
66
+ }
67
+ const timeout = setTimeout(() => {
68
+ onRemove(id);
69
+ }, duration - (Date.now() - created));
70
+ return () => {
71
+ clearTimeout(timeout);
72
+ };
73
+ }, [created, duration, id, onRemove]);
74
+ return /* @__PURE__ */ jsx("div", {
75
+ className: "css-reset",
76
+ style: notification,
77
+ children
78
+ });
79
+ };
80
+
81
+ // src/components/Notifications/NotificationCenter.tsx
82
+ import { jsx as jsx2 } from "react/jsx-runtime";
83
+ var container = {
84
+ position: "absolute",
85
+ justifyContent: "center",
86
+ alignItems: "center",
87
+ display: "flex",
88
+ width: "100%",
89
+ flexDirection: "column",
90
+ paddingTop: 40,
91
+ pointerEvents: "none",
92
+ backgroundColor: TRANSPARENT
93
+ };
94
+ var notificationCenter = createRef();
95
+ var showNotification = (content, durationInMs) => {
96
+ return notificationCenter.current.addNotification({
97
+ content,
98
+ duration: durationInMs,
99
+ created: Date.now(),
100
+ id: String(Math.random()).replace("0.", "")
101
+ });
102
+ };
103
+ var NotificationCenter = () => {
104
+ const [notifications, setNotifications] = useState([]);
105
+ const { currentZIndex } = useZIndex();
106
+ const onRemove = useCallback((id) => {
107
+ setNotifications((not) => {
108
+ return not.filter((n) => n.id !== id);
109
+ });
110
+ }, []);
111
+ const addNotification = useCallback((notification2) => {
112
+ setNotifications((previousNotifications) => {
113
+ return [...previousNotifications, notification2];
114
+ });
115
+ return {
116
+ dismiss: () => {
117
+ setNotifications((oldNotifications) => {
118
+ return oldNotifications.filter((notificationToFilter) => notificationToFilter.id !== notification2.id);
119
+ });
120
+ },
121
+ replaceContent: (newContent, durationInMs) => {
122
+ setNotifications((oldNotifications) => {
123
+ return oldNotifications.map((notificationToMap) => {
124
+ if (notificationToMap.id === notification2.id) {
125
+ return {
126
+ ...notificationToMap,
127
+ duration: durationInMs,
128
+ content: newContent,
129
+ created: Date.now()
130
+ };
131
+ }
132
+ return notificationToMap;
133
+ });
134
+ });
135
+ }
136
+ };
137
+ }, []);
138
+ useImperativeHandle(notificationCenter, () => {
139
+ return {
140
+ addNotification
141
+ };
142
+ }, [addNotification]);
143
+ return ReactDOM.createPortal(/* @__PURE__ */ jsx2("div", {
144
+ style: container,
145
+ children: notifications.map((n) => {
146
+ return /* @__PURE__ */ jsx2(Notification, {
147
+ created: n.created,
148
+ duration: n.duration,
149
+ id: n.id,
150
+ onRemove,
151
+ children: n.content
152
+ }, n.id);
153
+ })
154
+ }), getPortal(currentZIndex + 1));
155
+ };
156
+
157
+ // src/api/install-package.ts
158
+ import { getRemotionEnvironment } from "remotion";
159
+
160
+ // src/helpers/optional-package-dependencies.ts
161
+ import { extraPackages } from "@remotion/studio-shared";
162
+ var TRANSFORMERS_PACKAGE = "@huggingface/transformers";
163
+ var packagesRequiringTransformers = new Set([
164
+ "@remotion/whisper-webgpu",
165
+ "@remotion/video-matting"
166
+ ]);
167
+ var withRequiredAuxiliaryPackages = (dependencies) => {
168
+ if (!dependencies.some((dependency) => packagesRequiringTransformers.has(dependency.name)) || dependencies.some((dependency) => dependency.name === TRANSFORMERS_PACKAGE)) {
169
+ return [...dependencies];
170
+ }
171
+ const transformers = extraPackages.find((pkg) => pkg.name === TRANSFORMERS_PACKAGE);
172
+ if (!transformers) {
173
+ throw new Error(`No recommended version found for ${TRANSFORMERS_PACKAGE}`);
174
+ }
175
+ return [
176
+ ...dependencies,
177
+ { name: transformers.name, version: transformers.version }
178
+ ];
179
+ };
180
+
181
+ // src/api/install-package.ts
182
+ var installPackages = async (dependencies) => {
183
+ if (!getRemotionEnvironment().isStudio) {
184
+ throw new Error("installPackages() is only available in the Studio");
185
+ }
186
+ const dependenciesWithAuxiliaryPackages = withRequiredAuxiliaryPackages(dependencies);
187
+ const browserStudioOperations = getBrowserStudioOperations();
188
+ if (browserStudioOperations !== null) {
189
+ const response = await browserStudioOperations.packageInstallation.installPackages({
190
+ dependencies: dependenciesWithAuxiliaryPackages
191
+ });
192
+ if (!response.success) {
193
+ const error = new Error(response.reason);
194
+ error.stack = response.stack;
195
+ throw error;
196
+ }
197
+ return {};
198
+ }
199
+ if (window.remotion_isReadOnlyStudio) {
200
+ throw new Error("installPackages() is not available in Read-Only Studio");
201
+ }
202
+ return callApi("/api/install-package", {
203
+ dependencies: dependenciesWithAuxiliaryPackages
204
+ });
205
+ };
206
+
207
+ // src/helpers/install-required-package.ts
208
+ var installQueue = Promise.resolve();
209
+ var uniqueDependencies = (dependencies) => Array.from(new Map(dependencies.map((dependency) => [dependency.name, dependency])).values());
210
+ var getMissingPackages = (dependencies) => {
211
+ const installedPackages = window.remotion_installedPackages ?? [];
212
+ return uniqueDependencies(dependencies).filter((dependency) => dependency.version !== null || !installedPackages.includes(dependency.name));
213
+ };
214
+ var addInstalledPackages = (dependencies) => {
215
+ const installedPackages = window.remotion_installedPackages ?? [];
216
+ window.remotion_installedPackages = Array.from(new Set([
217
+ ...installedPackages,
218
+ ...uniqueDependencies(dependencies).map((dependency) => dependency.name)
219
+ ]));
220
+ };
221
+ var formatPackageList = (dependencies) => dependencies.length === 1 ? dependencies[0].name : `${dependencies.length} packages`;
222
+ var installRequiredPackages = async (dependencies) => {
223
+ const runInstall = async () => {
224
+ const missingPackages = getMissingPackages(dependencies);
225
+ if (missingPackages.length === 0)
226
+ return;
227
+ showNotification(`Installing ${formatPackageList(missingPackages)}...`, 3000);
228
+ await installPackages(missingPackages);
229
+ addInstalledPackages(missingPackages);
230
+ showNotification(`Installed ${formatPackageList(missingPackages)}`, 3000);
231
+ };
232
+ const queuedInstall = installQueue.then(runInstall, runInstall);
233
+ installQueue = queuedInstall.catch(() => {
234
+ return;
235
+ });
236
+ await queuedInstall;
237
+ };
238
+
239
+ export { portals, getPortal, showNotification, NotificationCenter, TRANSFORMERS_PACKAGE, withRequiredAuxiliaryPackages, installPackages, getMissingPackages, installRequiredPackages };