@remotion/studio 4.0.518 → 4.0.520

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 (196) hide show
  1. package/dist/api/visual-control.js +2 -2
  2. package/dist/components/AppLaunchButton.d.ts +16 -0
  3. package/dist/components/AppLaunchButton.js +90 -0
  4. package/dist/components/AssetSelector.js +7 -6
  5. package/dist/components/AssetSelectorItem.d.ts +12 -0
  6. package/dist/components/AssetSelectorItem.js +180 -62
  7. package/dist/components/AudioWaveform.js +6 -1
  8. package/dist/components/Button.js +20 -7
  9. package/dist/components/Canvas.js +117 -92
  10. package/dist/components/CanvasOrLoading.js +7 -7
  11. package/dist/components/CodingAgentButton.d.ts +7 -0
  12. package/dist/components/CodingAgentButton.js +59 -0
  13. package/dist/components/CompositionContextButton.d.ts +1 -0
  14. package/dist/components/CompositionContextButton.js +6 -3
  15. package/dist/components/CompositionSelector.js +21 -20
  16. package/dist/components/CompositionSelectorItem.js +23 -35
  17. package/dist/components/ConfigureLicenseModal.js +4 -48
  18. package/dist/components/CurrentAsset.js +1 -1
  19. package/dist/components/CurrentCompositionSideEffects.js +5 -0
  20. package/dist/components/ElementInstallConfirmation.d.ts +2 -10
  21. package/dist/components/ElementInstallConfirmation.js +339 -32
  22. package/dist/components/FixComputedValueModal.js +5 -131
  23. package/dist/components/FpsCounter.js +1 -1
  24. package/dist/components/FramePersistor.js +1 -1
  25. package/dist/components/InitialCompositionLoader.js +3 -2
  26. package/dist/components/InspectorOpenInEditor.js +48 -33
  27. package/dist/components/InspectorPanel/CompositionInspector.js +35 -3
  28. package/dist/components/InspectorPanel/CompositionInspectorHeader.js +22 -14
  29. package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +3 -1
  30. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +1 -1
  31. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +10 -5
  32. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +5 -4
  33. package/dist/components/InspectorPanel/common.js +1 -0
  34. package/dist/components/InspectorPanel/styles.js +1 -0
  35. package/dist/components/InspectorPanel/use-composition-actions.js +5 -8
  36. package/dist/components/InspectorSequenceSection.js +8 -3
  37. package/dist/components/InspectorSourceLocation.js +5 -1
  38. package/dist/components/KnownBugs.d.ts +1 -1
  39. package/dist/components/KnownBugs.js +1 -1
  40. package/dist/components/LicenseExplanation.d.ts +2 -0
  41. package/dist/components/LicenseExplanation.js +63 -0
  42. package/dist/components/MenuToolbar.js +7 -1
  43. package/dist/components/Modals.js +1 -2
  44. package/dist/components/NewComposition/InputDragger.js +29 -2
  45. package/dist/components/NewComposition/NewCompDuration.js +1 -1
  46. package/dist/components/NewComposition/NewComposition.d.ts +23 -0
  47. package/dist/components/NewComposition/NewComposition.js +217 -80
  48. package/dist/components/{UpdateModal/OpenIssueButton.js → OpenIssueButton.js} +1 -1
  49. package/dist/components/PlayPause.js +2 -13
  50. package/dist/components/PreviewToolbar.js +1 -1
  51. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +2 -1
  52. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +50 -28
  53. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +14 -1
  54. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +64 -9
  55. package/dist/components/QuickSwitcher/composition-search.d.ts +16 -0
  56. package/dist/components/QuickSwitcher/composition-search.js +136 -0
  57. package/dist/components/RenderQueue/actions.d.ts +1 -0
  58. package/dist/components/RenderQueue/actions.js +5 -1
  59. package/dist/components/ResetZoomButton.js +17 -2
  60. package/dist/components/SelectedOutlineCanvasRotation.js +27 -1
  61. package/dist/components/SelectedOutlineElement.js +12 -31
  62. package/dist/components/SelectedOutlineKeyboardControls.d.ts +2 -2
  63. package/dist/components/SelectedOutlineOverlay.d.ts +3 -1
  64. package/dist/components/SelectedOutlineOverlay.js +21 -26
  65. package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
  66. package/dist/components/SelectedOutlinePolygon.js +12 -4
  67. package/dist/components/SelectedOutlineRenderer.js +88 -21
  68. package/dist/components/SettingsContext.js +2 -1
  69. package/dist/components/SettingsModal.d.ts +1 -1
  70. package/dist/components/SettingsModal.js +19 -3
  71. package/dist/components/SidebarRenderButton.d.ts +1 -0
  72. package/dist/components/SidebarRenderButton.js +14 -5
  73. package/dist/components/Timeline/SequencePropsObserver.js +29 -14
  74. package/dist/components/Timeline/Timeline.js +2 -1
  75. package/dist/components/Timeline/TimelineAssetField.js +1 -0
  76. package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -90
  77. package/dist/components/Timeline/TimelineDragHandler.js +18 -8
  78. package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -3
  79. package/dist/components/Timeline/TimelineKeyframeControls.js +3 -1
  80. package/dist/components/Timeline/TimelinePinchZoom.js +14 -4
  81. package/dist/components/Timeline/TimelinePlayCursorSyncer.js +8 -4
  82. package/dist/components/Timeline/TimelineRowChrome.js +4 -2
  83. package/dist/components/Timeline/TimelineSequence.js +52 -45
  84. package/dist/components/Timeline/TimelineSequenceItem.js +44 -32
  85. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +3 -3
  86. package/dist/components/Timeline/TimelineSlider.js +2 -2
  87. package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -0
  88. package/dist/components/Timeline/TimelineStack/get-stack.js +35 -3
  89. package/dist/components/Timeline/TimelineWidthProvider.js +15 -8
  90. package/dist/components/Timeline/TimelineZoomControls.js +25 -8
  91. package/dist/components/Timeline/delete-selected-timeline-item.js +2 -2
  92. package/dist/components/Timeline/duplicate-selected-timeline-item.js +23 -25
  93. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -0
  94. package/dist/components/Timeline/get-sequence-context-menu-items.js +34 -1
  95. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -0
  96. package/dist/components/Timeline/sequence-props-subscription-store.js +22 -1
  97. package/dist/components/Timeline/timeline-scroll-logic.d.ts +1 -0
  98. package/dist/components/Timeline/timeline-scroll-logic.js +21 -17
  99. package/dist/components/Timeline/use-delete-timeline-items.d.ts +1 -0
  100. package/dist/components/Timeline/use-delete-timeline-items.js +118 -0
  101. package/dist/components/Timeline/use-sequence-props-subscription.js +7 -0
  102. package/dist/components/Timeline/use-timeline-asset-drop.js +8 -14
  103. package/dist/components/TimelineCombobox.js +1 -0
  104. package/dist/components/UpdateCheck.d.ts +0 -8
  105. package/dist/components/UpdateCheck.js +7 -54
  106. package/dist/components/UpdateStatusContext.d.ts +18 -0
  107. package/dist/components/UpdateStatusContext.js +74 -0
  108. package/dist/components/UpdatesSettings.d.ts +2 -0
  109. package/dist/components/UpdatesSettings.js +251 -0
  110. package/dist/components/WebMcp.js +64 -11
  111. package/dist/components/ZoomPersistor.js +2 -2
  112. package/dist/components/composition-drag-data.d.ts +36 -0
  113. package/dist/components/composition-drag-data.js +232 -0
  114. package/dist/components/drop-handler-data.d.ts +2 -1
  115. package/dist/components/drop-handler-data.js +6 -4
  116. package/dist/components/effect-drag-and-drop.d.ts +2 -5
  117. package/dist/components/get-open-in-menu-items.d.ts +4 -0
  118. package/dist/components/get-open-in-menu-items.js +28 -24
  119. package/dist/components/handle-drop.js +6 -2
  120. package/dist/components/import-assets.d.ts +5 -13
  121. package/dist/components/root-composition-menu-items.d.ts +4 -1
  122. package/dist/components/root-composition-menu-items.js +38 -1
  123. package/dist/components/selected-outline-geometry.d.ts +21 -2
  124. package/dist/components/selected-outline-geometry.js +16 -5
  125. package/dist/components/selected-outline-measurement.d.ts +40 -1
  126. package/dist/components/selected-outline-measurement.js +239 -1
  127. package/dist/components/selected-outline-order.d.ts +12 -0
  128. package/dist/components/selected-outline-order.js +251 -0
  129. package/dist/components/selected-outline-types.d.ts +15 -2
  130. package/dist/components/selected-outline-uv.js +106 -3
  131. package/dist/components/use-configure-default-apps.d.ts +1 -0
  132. package/dist/components/use-configure-default-apps.js +24 -0
  133. package/dist/error-overlay/current-error.d.ts +13 -0
  134. package/dist/error-overlay/current-error.js +21 -0
  135. package/dist/error-overlay/remotion-overlay/CodeFrame.js +5 -6
  136. package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +1 -1
  137. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +47 -18
  138. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +6 -2
  139. package/dist/error-overlay/remotion-overlay/ErrorTitle.js +5 -4
  140. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +48 -76
  141. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +1 -1
  142. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -2
  143. package/dist/error-overlay/remotion-overlay/StackFrame.js +13 -8
  144. package/dist/error-overlay/remotion-overlay/Symbolicating.js +1 -1
  145. package/dist/esm/chunk-6jf1natv.js +25 -0
  146. package/dist/esm/{chunk-4bxz1d3g.js → chunk-je0h1bgt.js} +1 -28
  147. package/dist/esm/chunk-m0jqdbkr.js +14571 -0
  148. package/dist/esm/{chunk-7prjt5n5.js → chunk-np6q13k5.js} +18637 -12189
  149. package/dist/esm/index.mjs +4 -3
  150. package/dist/esm/internals.mjs +35826 -14822
  151. package/dist/esm/previewEntry.mjs +40028 -18935
  152. package/dist/esm/renderEntry.mjs +6 -3
  153. package/dist/helpers/can-show-updates.d.ts +5 -0
  154. package/dist/helpers/can-show-updates.js +7 -0
  155. package/dist/helpers/colors.d.ts +0 -3
  156. package/dist/helpers/colors.js +2 -5
  157. package/dist/helpers/create-folder-tree.d.ts +5 -0
  158. package/dist/helpers/create-folder-tree.js +26 -6
  159. package/dist/helpers/document-title.d.ts +2 -0
  160. package/dist/helpers/document-title.js +14 -3
  161. package/dist/helpers/get-asset-metadata.js +1 -1
  162. package/dist/helpers/get-box-quads-polyfill-internals.d.ts +82 -0
  163. package/dist/helpers/get-box-quads-polyfill-internals.js +2403 -0
  164. package/dist/helpers/get-box-quads-ponyfill.d.ts +10 -0
  165. package/dist/helpers/get-box-quads-ponyfill.js +23 -0
  166. package/dist/helpers/get-git-menu-item.d.ts +5 -0
  167. package/dist/helpers/get-git-menu-item.js +15 -1
  168. package/dist/helpers/get-timeline-max-zoom.d.ts +34 -28
  169. package/dist/helpers/get-timeline-max-zoom.js +46 -29
  170. package/dist/helpers/hoverable.js +10 -5
  171. package/dist/helpers/install-fiber-sequence-order-observer.d.ts +37 -0
  172. package/dist/helpers/install-fiber-sequence-order-observer.js +109 -0
  173. package/dist/helpers/open-in-editor.js +53 -2
  174. package/dist/helpers/preview-server-events.js +3 -0
  175. package/dist/helpers/timeline-layout.d.ts +0 -1
  176. package/dist/helpers/timeline-layout.js +1 -5
  177. package/dist/helpers/url-state.d.ts +1 -0
  178. package/dist/helpers/url-state.js +12 -5
  179. package/dist/helpers/use-runtime-values.d.ts +1 -1
  180. package/dist/helpers/use-runtime-values.js +5 -4
  181. package/dist/helpers/use-sync-external-store.d.ts +3 -0
  182. package/dist/helpers/use-sync-external-store.js +5 -0
  183. package/dist/previewEntry.js +2 -0
  184. package/dist/renderEntry.js +2 -0
  185. package/dist/state/folders.d.ts +3 -0
  186. package/dist/state/folders.js +40 -1
  187. package/dist/state/modals.d.ts +19 -8
  188. package/dist/state/timeline-sequence-hover.js +3 -2
  189. package/dist/state/timeline-zoom.d.ts +0 -1
  190. package/dist/state/timeline-zoom.js +13 -6
  191. package/package.json +18 -15
  192. package/dist/components/UpdateModal/UpdateModal.d.ts +0 -6
  193. package/dist/components/UpdateModal/UpdateModal.js +0 -104
  194. package/dist/helpers/sort-by-nonce-history.d.ts +0 -1
  195. package/dist/helpers/sort-by-nonce-history.js +0 -6
  196. /package/dist/components/{UpdateModal/OpenIssueButton.d.ts → OpenIssueButton.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.visualControl = void 0;
4
- const react_1 = require("react");
5
4
  const remotion_1 = require("remotion");
5
+ const use_sync_external_store_1 = require("../helpers/use-sync-external-store");
6
6
  const visual_control_store_1 = require("../visual-controls/visual-control-store");
7
7
  const VisualControls_1 = require("../visual-controls/VisualControls");
8
8
  /**
@@ -12,7 +12,7 @@ const visualControl = (key, value, schema) => {
12
12
  // Subscribe to store changes so the calling component
13
13
  // re-renders when a visual control value is edited in the sidebar.
14
14
  // eslint-disable-next-line react-hooks/rules-of-hooks
15
- (0, react_1.useSyncExternalStore)(visual_control_store_1.visualControlStore.subscribe, visual_control_store_1.visualControlStore.getSnapshot, visual_control_store_1.visualControlStore.getSnapshot);
15
+ (0, use_sync_external_store_1.useSyncExternalStore)(visual_control_store_1.visualControlStore.subscribe, visual_control_store_1.visualControlStore.getSnapshot, visual_control_store_1.visualControlStore.getSnapshot);
16
16
  if ((0, remotion_1.getRemotionEnvironment)().isRendering) {
17
17
  return value;
18
18
  }
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { ComboboxValue } from './NewComposition/ComboBox';
3
+ export declare const AppLaunchButton: React.FC<{
4
+ readonly actionButtonId: string | null;
5
+ readonly ariaLabel: string;
6
+ readonly children: React.ReactNode;
7
+ readonly disabled: boolean;
8
+ readonly menuAriaLabel: string;
9
+ readonly menuButtonId: string | null;
10
+ readonly menuItems: ComboboxValue[];
11
+ readonly onConfigureApps: (() => void) | null;
12
+ readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
13
+ readonly size: 'compact' | 'default';
14
+ readonly style: React.CSSProperties | null;
15
+ readonly title: string;
16
+ }>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppLaunchButton = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../helpers/colors");
7
+ const caret_1 = require("../icons/caret");
8
+ const get_open_in_menu_items_1 = require("./get-open-in-menu-items");
9
+ const SegmentedButton_1 = require("./SegmentedButton");
10
+ const compactMainSegmentStyle = {
11
+ fontFamily: 'inherit',
12
+ gap: 6,
13
+ padding: '0 9px',
14
+ };
15
+ const defaultMainSegmentStyle = {
16
+ ...compactMainSegmentStyle,
17
+ fontSize: 14,
18
+ lineHeight: '21px',
19
+ };
20
+ const dropdownSegmentStyle = {
21
+ fontFamily: 'inherit',
22
+ padding: 0,
23
+ width: 20,
24
+ };
25
+ const dropdownIconStyle = {
26
+ display: 'flex',
27
+ transform: 'translateY(-1px)',
28
+ };
29
+ const AppLaunchButton = ({ actionButtonId, ariaLabel, children, disabled, menuAriaLabel, menuButtonId, menuItems, onConfigureApps, onClick, size, style, title, }) => {
30
+ const items = (0, react_1.useMemo)(() => {
31
+ return [
32
+ ...menuItems,
33
+ ...(0, get_open_in_menu_items_1.getConfigureDefaultAppsMenuItems)({
34
+ hasPreviousItems: menuItems.length > 0,
35
+ onConfigureApps,
36
+ }),
37
+ ];
38
+ }, [menuItems, onConfigureApps]);
39
+ const segments = (0, react_1.useMemo)(() => {
40
+ return [
41
+ {
42
+ ariaLabel,
43
+ buttonId: actionButtonId,
44
+ disabled,
45
+ idleColor: colors_1.LIGHT_TEXT,
46
+ onClick,
47
+ onPointerDown: null,
48
+ renderContent: () => children,
49
+ segmentId: 'preferred-app',
50
+ style: size === 'default'
51
+ ? defaultMainSegmentStyle
52
+ : compactMainSegmentStyle,
53
+ title,
54
+ type: 'action',
55
+ },
56
+ ...(items.length > 0
57
+ ? [
58
+ {
59
+ ariaLabel: menuAriaLabel,
60
+ buttonId: menuButtonId,
61
+ disabled: false,
62
+ idleColor: colors_1.LIGHT_TEXT,
63
+ leaveLeftSpace: true,
64
+ onOpenChange: null,
65
+ renderContent: (color) => (jsx_runtime_1.jsx("span", { style: dropdownIconStyle, children: jsx_runtime_1.jsx(caret_1.CaretDown, { color: color }) })),
66
+ segmentId: 'another-app',
67
+ selectedId: null,
68
+ style: dropdownSegmentStyle,
69
+ title: menuAriaLabel,
70
+ type: 'menu',
71
+ values: items,
72
+ },
73
+ ]
74
+ : []),
75
+ ];
76
+ }, [
77
+ actionButtonId,
78
+ ariaLabel,
79
+ children,
80
+ disabled,
81
+ items,
82
+ menuAriaLabel,
83
+ menuButtonId,
84
+ onClick,
85
+ size,
86
+ title,
87
+ ]);
88
+ return (jsx_runtime_1.jsx(SegmentedButton_1.SegmentedButton, { segments: segments, style: { ...(size === 'default' ? { height: 41 } : null), ...style }, title: null }));
89
+ };
90
+ exports.AppLaunchButton = AppLaunchButton;
@@ -177,7 +177,7 @@ const AssetSelector = ({ readOnlyStudio }) => {
177
177
  setDropLocation(null);
178
178
  }
179
179
  }, [dropLocation, writeFilesToPublicFolder]);
180
- const uploadAssets = (0, react_1.useCallback)(async () => {
180
+ const uploadAssets = (0, react_1.useCallback)(async (assetPath) => {
181
181
  try {
182
182
  const files = await (0, import_assets_1.pickFilesToImport)();
183
183
  if (files.length === 0) {
@@ -185,12 +185,13 @@ const AssetSelector = ({ readOnlyStudio }) => {
185
185
  }
186
186
  const wereWritten = await writeFilesToPublicFolder({
187
187
  files,
188
- assetPath: null,
188
+ assetPath,
189
189
  });
190
190
  if (wereWritten) {
191
+ const destination = assetPath ? `'${assetPath}'` : 'public folder';
191
192
  (0, NotificationCenter_1.showNotification)(files.length === 1
192
- ? `Uploaded ${files[0].name} to public folder`
193
- : `Uploaded ${files.length} assets to public folder`, 3000);
193
+ ? `Uploaded ${files[0].name} to ${destination}`
194
+ : `Uploaded ${files.length} assets to ${destination}`, 3000);
194
195
  }
195
196
  }
196
197
  catch (error) {
@@ -204,7 +205,7 @@ const AssetSelector = ({ readOnlyStudio }) => {
204
205
  keyHint: null,
205
206
  label: 'Upload...',
206
207
  leftItem: null,
207
- onClick: uploadAssets,
208
+ onClick: () => uploadAssets(null),
208
209
  quickSwitcherLabel: 'Upload assets...',
209
210
  subMenu: null,
210
211
  type: 'item',
@@ -219,6 +220,6 @@ const AssetSelector = ({ readOnlyStudio }) => {
219
220
  " in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
220
221
  ...list,
221
222
  backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
222
- }, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }) }))] }));
223
+ }, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }) }))] }));
223
224
  };
224
225
  exports.AssetSelector = AssetSelector;
@@ -28,6 +28,17 @@ export declare const getAssetContextMenuItems: ({ relativePath, fileManagerName,
28
28
  fileExplorerDisabled: boolean;
29
29
  mutationsDisabled: boolean;
30
30
  }) => ComboboxValue[];
31
+ export declare const getAssetFolderContextMenuItems: ({ folderPath, fileManagerName, copyFolderPath, copyAbsolutePath, openFolderInExplorer, uploadAssets, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }: {
32
+ folderPath: string;
33
+ fileManagerName: string;
34
+ copyFolderPath: () => void;
35
+ copyAbsolutePath: (() => void) | null;
36
+ openFolderInExplorer: () => void;
37
+ uploadAssets: () => void;
38
+ fileExplorerAvailable: boolean;
39
+ fileExplorerDisabled: boolean;
40
+ mutationsDisabled: boolean;
41
+ }) => ComboboxValue[];
31
42
  export declare const AssetFolderTree: React.FC<{
32
43
  readonly item: AssetStructure;
33
44
  readonly name: string | null;
@@ -38,4 +49,5 @@ export declare const AssetFolderTree: React.FC<{
38
49
  readonly dropLocation: string | null;
39
50
  readonly setDropLocation: React.Dispatch<React.SetStateAction<string | null>>;
40
51
  readonly readOnlyStudio: boolean;
52
+ readonly uploadAssets: (assetPath: string | null) => void;
41
53
  }>;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.AssetFolderTree = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
36
+ exports.AssetFolderTree = exports.getAssetFolderContextMenuItems = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const studio_protocol_1 = require("@remotion/studio-protocol");
39
39
  const react_1 = require("react");
@@ -71,7 +71,6 @@ const iconStyle = {
71
71
  flexShrink: 0,
72
72
  };
73
73
  const itemStyle = {
74
- paddingRight: 10,
75
74
  paddingTop: 5,
76
75
  paddingBottom: 5,
77
76
  fontSize: 13,
@@ -86,7 +85,6 @@ const itemStyle = {
86
85
  borderRadius: 4,
87
86
  width: 'calc(100% - 4px)',
88
87
  textAlign: 'left',
89
- backgroundColor: colors_1.BACKGROUND,
90
88
  height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
91
89
  userSelect: 'none',
92
90
  WebkitUserSelect: 'none',
@@ -109,11 +107,19 @@ const ellipsisIconStyle = {
109
107
  height: 12,
110
108
  },
111
109
  };
110
+ const inlineActionsStyle = {
111
+ alignItems: 'center',
112
+ display: 'flex',
113
+ };
114
+ const renderContextMenuAction = (color) => {
115
+ return jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { svgProps: ellipsisIconStyle, fill: color });
116
+ };
112
117
  const getAssetActionAvailability = ({ browserStudioCanMutateAssets, readOnlyStudio, connectionStatus, publicFolderExists, }) => {
113
118
  return {
114
119
  mutationsDisabled: browserStudioCanMutateAssets !== true &&
115
120
  (readOnlyStudio || connectionStatus !== 'connected'),
116
- fileExplorerDisabled: publicFolderExists === null ||
121
+ fileExplorerDisabled: browserStudioCanMutateAssets !== null ||
122
+ publicFolderExists === null ||
117
123
  readOnlyStudio ||
118
124
  connectionStatus !== 'connected',
119
125
  };
@@ -226,67 +232,191 @@ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName,
226
232
  return items.filter(no_react_1.NoReactInternals.truthy);
227
233
  };
228
234
  exports.getAssetContextMenuItems = getAssetContextMenuItems;
229
- const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, }) => {
230
- const [hovered, setHovered] = (0, react_1.useState)(false);
235
+ const getAssetFolderContextMenuItems = ({ folderPath, fileManagerName, copyFolderPath, copyAbsolutePath, openFolderInExplorer, uploadAssets, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }) => {
236
+ const items = [
237
+ fileExplorerAvailable
238
+ ? {
239
+ id: 'open-asset-folder-in-explorer',
240
+ keyHint: null,
241
+ label: `Show in ${fileManagerName}`,
242
+ leftItem: null,
243
+ onClick: openFolderInExplorer,
244
+ quickSwitcherLabel: `Show asset folder in ${fileManagerName}`,
245
+ subMenu: null,
246
+ type: 'item',
247
+ value: 'open-asset-folder-in-explorer',
248
+ disabled: fileExplorerDisabled,
249
+ }
250
+ : null,
251
+ {
252
+ id: 'copy-asset-folder-path',
253
+ keyHint: null,
254
+ label: 'Copy folder path',
255
+ leftItem: null,
256
+ onClick: copyFolderPath,
257
+ quickSwitcherLabel: 'Copy asset folder path',
258
+ subMenu: null,
259
+ type: 'item',
260
+ value: 'copy-asset-folder-path',
261
+ },
262
+ copyAbsolutePath
263
+ ? {
264
+ id: 'copy-asset-folder-absolute-path',
265
+ keyHint: null,
266
+ label: 'Copy absolute path',
267
+ leftItem: null,
268
+ onClick: copyAbsolutePath,
269
+ quickSwitcherLabel: 'Copy asset folder absolute path',
270
+ subMenu: null,
271
+ type: 'item',
272
+ value: 'copy-asset-folder-absolute-path',
273
+ }
274
+ : null,
275
+ {
276
+ type: 'divider',
277
+ id: 'asset-folder-upload-divider',
278
+ },
279
+ {
280
+ id: 'upload-assets-to-folder',
281
+ keyHint: null,
282
+ label: 'Upload...',
283
+ leftItem: null,
284
+ onClick: uploadAssets,
285
+ quickSwitcherLabel: `Upload assets to ${folderPath}...`,
286
+ subMenu: null,
287
+ type: 'item',
288
+ value: 'upload-assets-to-folder',
289
+ disabled: mutationsDisabled,
290
+ },
291
+ ];
292
+ return items.filter(no_react_1.NoReactInternals.truthy);
293
+ };
294
+ exports.getAssetFolderContextMenuItems = getAssetFolderContextMenuItems;
295
+ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, uploadAssets, }) => {
231
296
  const openFolderTimerRef = (0, react_1.useRef)(null);
297
+ const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
298
+ .previewServerState.type;
299
+ const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
300
+ const folderPath = (0, react_1.useMemo)(() => {
301
+ return parentFolder ? `${parentFolder}/${item.name}` : item.name;
302
+ }, [item.name, parentFolder]);
232
303
  const { isDropDiv, onDragEnter, onDragLeave } = (0, use_asset_drag_events_1.default)({
233
304
  name: item.name,
234
305
  parentFolder,
235
306
  dropLocation,
236
307
  setDropLocation,
237
308
  });
238
- const onPointerEnter = (0, react_1.useCallback)(() => {
239
- setHovered(true);
240
- }, []);
241
- const onPointerLeave = (0, react_1.useCallback)(() => {
242
- setHovered(false);
243
- }, []);
244
309
  const folderStyle = (0, react_1.useMemo)(() => {
245
310
  return {
246
311
  ...itemStyle,
247
312
  paddingLeft: 4 + level * 8,
248
- backgroundColor: hovered ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
313
+ ...(0, hoverable_1.hoverableStyle)({
314
+ idleBackground: colors_1.TRANSPARENT,
315
+ hoverBackground: colors_1.WHITE_ALPHA_06,
316
+ idleColor: colors_1.LIGHT_TEXT,
317
+ hoverColor: colors_1.WHITE,
318
+ }),
249
319
  };
250
- }, [hovered, level]);
251
- const label = (0, react_1.useMemo)(() => {
252
- return {
253
- ...labelStyle,
254
- color: hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT,
255
- };
256
- }, [hovered]);
320
+ }, [level]);
257
321
  const onClick = (0, react_1.useCallback)(() => {
258
322
  toggleFolder(item.name, parentFolder);
259
323
  }, [item.name, parentFolder, toggleFolder]);
324
+ const copyFolderPath = (0, react_1.useCallback)(() => {
325
+ (0, copy_text_1.copyText)(folderPath)
326
+ .then(() => {
327
+ (0, NotificationCenter_1.showNotification)(`Copied '${folderPath}' to clipboard`, 1000);
328
+ })
329
+ .catch((err) => {
330
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
331
+ });
332
+ }, [folderPath]);
333
+ const copyAbsolutePath = (0, react_1.useCallback)(() => {
334
+ if (window.remotion_publicFolderExists === null) {
335
+ return;
336
+ }
337
+ const content = `${window.remotion_publicFolderExists}/${folderPath}`;
338
+ (0, copy_text_1.copyText)(content)
339
+ .then(() => {
340
+ (0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
341
+ })
342
+ .catch((err) => {
343
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
344
+ });
345
+ }, [folderPath]);
346
+ const openFolderInExplorer = (0, react_1.useCallback)(() => {
347
+ if (!window.remotion_publicFolderExists) {
348
+ (0, NotificationCenter_1.showNotification)('Could not find the public folder', 2000);
349
+ return;
350
+ }
351
+ (0, actions_1.openInFileExplorer)({
352
+ directory: `${window.remotion_publicFolderExists}/${folderPath}`,
353
+ }).catch((err) => {
354
+ (0, NotificationCenter_1.showNotification)(`Could not open folder: ${err.message}`, 2000);
355
+ });
356
+ }, [folderPath]);
357
+ const uploadAssetsToFolder = (0, react_1.useCallback)(() => {
358
+ uploadAssets(folderPath);
359
+ }, [folderPath, uploadAssets]);
360
+ const { mutationsDisabled, fileExplorerDisabled } = (0, exports.getAssetActionAvailability)({
361
+ browserStudioCanMutateAssets: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null ? null : true,
362
+ readOnlyStudio,
363
+ connectionStatus,
364
+ publicFolderExists: window.remotion_publicFolderExists,
365
+ });
366
+ const getContextMenuItems = (0, react_1.useCallback)(() => {
367
+ return (0, exports.getAssetFolderContextMenuItems)({
368
+ folderPath,
369
+ fileManagerName,
370
+ copyFolderPath,
371
+ copyAbsolutePath: window.remotion_publicFolderExists === null ? null : copyAbsolutePath,
372
+ openFolderInExplorer,
373
+ uploadAssets: uploadAssetsToFolder,
374
+ fileExplorerAvailable: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null,
375
+ fileExplorerDisabled,
376
+ mutationsDisabled,
377
+ });
378
+ }, [
379
+ copyAbsolutePath,
380
+ copyFolderPath,
381
+ fileExplorerDisabled,
382
+ fileManagerName,
383
+ folderPath,
384
+ mutationsDisabled,
385
+ openFolderInExplorer,
386
+ uploadAssetsToFolder,
387
+ ]);
260
388
  const Icon = item.expanded ? folder_1.ExpandedFolderIcon : folder_1.CollapsedFolderIcon;
261
389
  return (jsx_runtime_1.jsxs("div", { onDragEnter: onDragEnter, onDragLeave: onDragLeave, style: {
262
390
  backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
263
391
  }, children: [
264
- jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
265
- if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
266
- return;
267
- }
268
- if (!item.expanded) {
269
- openFolderTimerRef.current = window.setTimeout(() => {
270
- toggleFolder(item.name, parentFolder);
271
- }, 1000);
272
- }
273
- }, onDragLeave: (event) => {
274
- if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
275
- return;
276
- }
277
- if (openFolderTimerRef.current) {
278
- clearTimeout(openFolderTimerRef.current);
279
- }
280
- }, children: jsx_runtime_1.jsxs(layout_1.Row, { children: [
281
- jsx_runtime_1.jsx(Icon, { style: iconStyle, color: hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name })
282
- ] }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, item.name)) : null] }));
392
+ jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: folderStyle, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.HOVER_GROUP_CLASS_NAME}`, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
393
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
394
+ return;
395
+ }
396
+ if (!item.expanded) {
397
+ openFolderTimerRef.current = window.setTimeout(() => {
398
+ toggleFolder(item.name, parentFolder);
399
+ }, 1000);
400
+ }
401
+ }, onDragLeave: (event) => {
402
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
403
+ return;
404
+ }
405
+ if (openFolderTimerRef.current) {
406
+ clearTimeout(openFolderTimerRef.current);
407
+ }
408
+ }, children: [
409
+ jsx_runtime_1.jsx(Icon, { style: iconStyle, color: colors_1.CURRENT_COLOR }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: item.name }), jsx_runtime_1.jsxs("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: inlineActionsStyle, children: [
410
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { variant: null, title: "More actions", renderAction: renderContextMenuAction, getItems: getContextMenuItems, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME })
411
+ ] })
412
+ ] }) }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }, item.name)) : null] }));
283
413
  };
284
- const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, }) => {
414
+ const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, uploadAssets, }) => {
285
415
  const combinedParents = (0, react_1.useMemo)(() => {
286
416
  return [parentFolder, name].filter(no_react_1.NoReactInternals.truthy).join('/');
287
417
  }, [name, parentFolder]);
288
418
  return (jsx_runtime_1.jsxs("div", { children: [item.folders.map((folder) => {
289
- return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, folder.name));
419
+ return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }, folder.name));
290
420
  }), item.files.map((file) => {
291
421
  return (jsx_runtime_1.jsx(AssetSelectorItem, { item: file, tabIndex: tabIndex, level: level, parentFolder: combinedParents, readOnlyStudio: readOnlyStudio }, file.src));
292
422
  })] }));
@@ -294,14 +424,10 @@ const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabInd
294
424
  exports.AssetFolderTree = AssetFolderTree;
295
425
  const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
296
426
  const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
297
- const [hovered, setHovered] = (0, react_1.useState)(false);
298
427
  const [isDragging, setIsDragging] = (0, react_1.useState)(false);
299
428
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
300
429
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
301
430
  .previewServerState.type;
302
- const onPointerEnter = (0, react_1.useCallback)(() => {
303
- setHovered(true);
304
- }, []);
305
431
  const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
306
432
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
307
433
  const relativePath = (0, react_1.useMemo)(() => {
@@ -319,9 +445,6 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
319
445
  const canDragAsset = (0, react_1.useMemo)(() => {
320
446
  return (0, exports.getCanDragAsset)({ readOnlyStudio, relativePath });
321
447
  }, [readOnlyStudio, relativePath]);
322
- const onPointerLeave = (0, react_1.useCallback)(() => {
323
- setHovered(false);
324
- }, []);
325
448
  const rowRef = (0, react_1.useRef)(null);
326
449
  (0, react_1.useLayoutEffect)(() => {
327
450
  (0, sidebar_scroll_into_view_1.maybeScrollAssetSidebarRowIntoView)({
@@ -376,23 +499,18 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
376
499
  const style = (0, react_1.useMemo)(() => {
377
500
  return {
378
501
  ...itemStyle,
379
- color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
380
- backgroundColor: hovered || selected ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
502
+ ...(0, hoverable_1.hoverableStyle)({
503
+ idleBackground: selected ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
504
+ hoverBackground: colors_1.WHITE_ALPHA_06,
505
+ idleColor: selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
506
+ hoverColor: colors_1.WHITE,
507
+ }),
381
508
  paddingLeft: 12 + level * 8,
382
509
  };
383
- }, [hovered, level, selected]);
384
- const label = (0, react_1.useMemo)(() => {
385
- return {
386
- ...labelStyle,
387
- color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
388
- };
389
- }, [hovered, selected]);
510
+ }, [level, selected]);
390
511
  const renderFileExplorerAction = (0, react_1.useCallback)((color) => {
391
512
  return jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: revealIconStyle, color: color });
392
513
  }, []);
393
- const renderContextMenuAction = (0, react_1.useCallback)((color) => {
394
- return jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { svgProps: ellipsisIconStyle, fill: color });
395
- }, []);
396
514
  const copyFileName = (0, react_1.useCallback)(() => {
397
515
  (0, copy_text_1.copyText)(item.name)
398
516
  .then(() => {
@@ -484,8 +602,8 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
484
602
  e.stopPropagation();
485
603
  openAssetInExplorer();
486
604
  }, [openAssetInExplorer]);
487
- return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
488
- jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name }), hovered && !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
605
+ return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.HOVER_GROUP_CLASS_NAME}`, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
606
+ jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: colors_1.CURRENT_COLOR }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: item.name }), !isDragging ? (jsx_runtime_1.jsxs("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: inlineActionsStyle, children: [
489
607
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { variant: null, title: "More actions", renderAction: renderContextMenuAction, getItems: getContextMenuItems, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
490
608
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME })
491
609
  ] }))] })) : null] }) }) }));
@@ -39,6 +39,7 @@ const timeline_utils_1 = require("@remotion/timeline-utils");
39
39
  const react_1 = __importStar(require("react"));
40
40
  const remotion_1 = require("remotion");
41
41
  const colors_1 = require("../helpers/colors");
42
+ const get_timeline_max_zoom_1 = require("../helpers/get-timeline-max-zoom");
42
43
  const timeline_layout_1 = require("../helpers/timeline-layout");
43
44
  const EMPTY_PEAKS = new Float32Array(0);
44
45
  const getContainerStyle = (height) => {
@@ -74,6 +75,7 @@ const AudioWaveformInner = ({ src, height, startFrom, durationInFrames, displayO
74
75
  if (vidConf === null) {
75
76
  throw new Error('Expected video config');
76
77
  }
78
+ const waveformSampleRate = Math.ceil(vidConf.fps * get_timeline_max_zoom_1.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM);
77
79
  const waveformCanvas = (0, react_1.useRef)(null);
78
80
  const volumeCanvas = (0, react_1.useRef)(null);
79
81
  const shouldRenderVolumeOverlay = doesVolumeChange && typeof volume === 'string';
@@ -102,10 +104,11 @@ const AudioWaveformInner = ({ src, height, startFrom, durationInFrames, displayO
102
104
  setError(null);
103
105
  return (0, timeline_utils_1.subscribeToWaveformPeaks)({
104
106
  src,
107
+ waveformSampleRate,
105
108
  onPeaks: (p) => setPeaks(p),
106
109
  onError: (err) => setError(err),
107
110
  });
108
- }, [src]);
111
+ }, [src, waveformSampleRate]);
109
112
  const portionPeaks = (0, react_1.useMemo)(() => {
110
113
  if (!peaks) {
111
114
  return null;
@@ -119,6 +122,7 @@ const AudioWaveformInner = ({ src, height, startFrom, durationInFrames, displayO
119
122
  peaks,
120
123
  playbackRate,
121
124
  startFrom,
125
+ waveformSampleRate,
122
126
  });
123
127
  }, [
124
128
  displayDurationInFrames,
@@ -129,6 +133,7 @@ const AudioWaveformInner = ({ src, height, startFrom, durationInFrames, displayO
129
133
  playbackRate,
130
134
  startFrom,
131
135
  vidConf.fps,
136
+ waveformSampleRate,
132
137
  ]);
133
138
  // Drawing must happen in a layout effect: when the timeline zooms, the
134
139
  // canvas CSS box resizes in the same commit, and painting the bitmap
@@ -4,35 +4,48 @@ exports.Button = 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 hoverable_1 = require("../helpers/hoverable");
7
8
  const button = {
8
- border: `1px solid ${colors_1.BLACK_ALPHA_60}`,
9
- borderRadius: 4,
10
- backgroundColor: colors_1.INPUT_BACKGROUND,
11
9
  appearance: 'none',
10
+ border: 'none',
11
+ borderRadius: 6,
12
+ cursor: 'default',
12
13
  fontFamily: 'inherit',
13
14
  fontSize: 14,
14
- color: colors_1.WHITE,
15
15
  flexDirection: 'row',
16
+ margin: 0,
17
+ padding: 0,
16
18
  };
17
19
  const ButtonRefForwardFunction = ({ children, onClick, title, disabled, size = 'default', style, id, autoFocus, buttonContainerStyle, onPointerDown, }, ref) => {
18
20
  const combined = (0, react_1.useMemo)(() => {
21
+ var _a, _b;
22
+ const idleBackground = (_a = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _a !== void 0 ? _a : colors_1.TRANSPARENT;
23
+ const idleColor = (_b = style === null || style === void 0 ? void 0 : style.color) !== null && _b !== void 0 ? _b : colors_1.LIGHT_TEXT;
19
24
  return {
20
25
  ...button,
26
+ ...(0, hoverable_1.hoverableStyle)({
27
+ idleBackground,
28
+ hoverBackground: disabled || (style === null || style === void 0 ? void 0 : style.backgroundColor)
29
+ ? idleBackground
30
+ : (0, colors_1.getBackgroundFromHoverState)({ hovered: true, selected: false }),
31
+ idleColor,
32
+ hoverColor: disabled || (style === null || style === void 0 ? void 0 : style.color) ? idleColor : colors_1.WHITE,
33
+ }),
21
34
  ...(size === 'compact' ? { fontSize: 12 } : null),
22
35
  ...(size === 'condensed' ? { fontSize: 11 } : null),
23
36
  ...(style !== null && style !== void 0 ? style : {}),
24
37
  };
25
- }, [size, style]);
38
+ }, [disabled, size, style]);
26
39
  const buttonContainer = (0, react_1.useMemo)(() => {
27
40
  return {
28
41
  padding: size === 'condensed' ? '2px 7px' : size === 'compact' ? '5px 8px' : 10,
29
- cursor: disabled ? 'inherit' : 'pointer',
42
+ cursor: 'default',
30
43
  fontSize: size === 'condensed' ? 11 : size === 'compact' ? 12 : 14,
31
44
  lineHeight: size === 'condensed' ? '14px' : size === 'compact' ? '14px' : undefined,
32
45
  opacity: disabled ? 0.7 : 1,
33
46
  ...(buttonContainerStyle !== null && buttonContainerStyle !== void 0 ? buttonContainerStyle : {}),
34
47
  };
35
48
  }, [buttonContainerStyle, disabled, size]);
36
- return (jsx_runtime_1.jsx("button", { ref: ref, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
49
+ return (jsx_runtime_1.jsx("button", { ref: ref, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
37
50
  };
38
51
  exports.Button = (0, react_1.forwardRef)(ButtonRefForwardFunction);