@remotion/studio 4.0.519 → 4.0.521

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 (130) hide show
  1. package/dist/api/shut-down-studio.d.ts +6 -0
  2. package/dist/api/shut-down-studio.js +23 -0
  3. package/dist/api/visual-control.js +2 -2
  4. package/dist/components/AudioWaveform.js +16 -7
  5. package/dist/components/Canvas.js +114 -48
  6. package/dist/components/CaptionInspector.d.ts +1 -0
  7. package/dist/components/CaptionInspector.js +43 -2
  8. package/dist/components/CaptionTextEditor.js +1 -1
  9. package/dist/components/CompositionSelector.js +41 -34
  10. package/dist/components/CompositionSelectorItem.d.ts +7 -0
  11. package/dist/components/CompositionSelectorItem.js +344 -73
  12. package/dist/components/CurrentCompositionSideEffects.js +5 -0
  13. package/dist/components/ElementInstallConfirmation.d.ts +2 -23
  14. package/dist/components/ElementInstallConfirmation.js +89 -65
  15. package/dist/components/ElementLibraryModal.js +3 -1
  16. package/dist/components/FpsCounter.js +1 -1
  17. package/dist/components/FramePersistor.js +1 -1
  18. package/dist/components/InlineCaptionInspector.js +37 -1
  19. package/dist/components/InspectorPanel/ElementLibraryButton.js +3 -18
  20. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -3
  21. package/dist/components/InspectorPanel/use-composition-actions.js +5 -8
  22. package/dist/components/InspectorSequenceSection.js +1 -4
  23. package/dist/components/Menu/MenuSubItem.js +1 -1
  24. package/dist/components/ModalContainer.d.ts +1 -0
  25. package/dist/components/ModalContainer.js +2 -2
  26. package/dist/components/ModalHeader.js +5 -1
  27. package/dist/components/Modals.js +1 -1
  28. package/dist/components/NewComposition/NewComposition.js +2 -2
  29. package/dist/components/PlayPause.js +2 -13
  30. package/dist/components/PreviewToolbar.js +1 -1
  31. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +29 -15
  32. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +14 -1
  33. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +64 -9
  34. package/dist/components/QuickSwitcher/asset-search.d.ts +0 -1
  35. package/dist/components/QuickSwitcher/asset-search.js +1 -16
  36. package/dist/components/QuickSwitcher/composition-search.d.ts +16 -0
  37. package/dist/components/QuickSwitcher/composition-search.js +136 -0
  38. package/dist/components/RenderButton.js +2 -2
  39. package/dist/components/RenderModal/RenderStatusModal.js +7 -1
  40. package/dist/components/RenderModal/ServerRenderModal.js +1 -1
  41. package/dist/components/RenderModal/WebRenderModal.js +1 -1
  42. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +1 -1
  43. package/dist/components/ResetZoomButton.js +17 -2
  44. package/dist/components/SelectedOutlineElement.js +10 -30
  45. package/dist/components/SettingsModal.js +8 -5
  46. package/dist/components/TimeValue.js +36 -7
  47. package/dist/components/Timeline/Timeline.d.ts +1 -1
  48. package/dist/components/Timeline/Timeline.js +33 -20
  49. package/dist/components/Timeline/TimelineAssetField.d.ts +0 -1
  50. package/dist/components/Timeline/TimelineAssetField.js +17 -9
  51. package/dist/components/Timeline/TimelineCollapseToggle.js +1 -1
  52. package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -90
  53. package/dist/components/Timeline/TimelineDragHandler.js +18 -8
  54. package/dist/components/Timeline/TimelineFontWeightField.d.ts +11 -0
  55. package/dist/components/Timeline/TimelineFontWeightField.js +65 -0
  56. package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -3
  57. package/dist/components/Timeline/TimelineLayerChildren.d.ts +21 -0
  58. package/dist/components/Timeline/TimelineLayerChildren.js +129 -0
  59. package/dist/components/Timeline/TimelineNumberField.js +13 -5
  60. package/dist/components/Timeline/TimelinePinchZoom.js +14 -4
  61. package/dist/components/Timeline/TimelinePlayCursorSyncer.js +8 -4
  62. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +4 -0
  63. package/dist/components/Timeline/TimelineSequence.js +54 -73
  64. package/dist/components/Timeline/TimelineSequenceItem.js +16 -36
  65. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +22 -10
  66. package/dist/components/Timeline/TimelineSlider.js +2 -2
  67. package/dist/components/Timeline/TimelineTickFormatProvider.d.ts +8 -0
  68. package/dist/components/Timeline/TimelineTickFormatProvider.js +16 -0
  69. package/dist/components/Timeline/TimelineTimeIndicators.js +7 -3
  70. package/dist/components/Timeline/TimelineVideoInfo.js +7 -3
  71. package/dist/components/Timeline/TimelineWidthProvider.js +15 -8
  72. package/dist/components/Timeline/TimelineZoomControls.js +25 -8
  73. package/dist/components/Timeline/delete-selected-timeline-item.js +2 -2
  74. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  75. package/dist/components/Timeline/timeline-scroll-logic.d.ts +1 -0
  76. package/dist/components/Timeline/timeline-scroll-logic.js +21 -17
  77. package/dist/components/Timeline/use-delete-timeline-items.d.ts +1 -0
  78. package/dist/components/Timeline/use-delete-timeline-items.js +118 -0
  79. package/dist/components/Timeline/use-timeline-asset-drop.js +8 -14
  80. package/dist/components/UpdateStatusContext.d.ts +5 -0
  81. package/dist/components/UpdateStatusContext.js +53 -2
  82. package/dist/components/UpdatesSettings.js +25 -4
  83. package/dist/components/WebMcp.js +87 -8
  84. package/dist/components/ZoomPersistor.js +2 -2
  85. package/dist/components/composition-drag-data.d.ts +36 -0
  86. package/dist/components/composition-drag-data.js +232 -0
  87. package/dist/components/composition-selector-drag-data.d.ts +27 -0
  88. package/dist/components/composition-selector-drag-data.js +80 -0
  89. package/dist/components/drop-handler-data.d.ts +2 -1
  90. package/dist/components/drop-handler-data.js +6 -4
  91. package/dist/components/effect-drag-and-drop.d.ts +2 -5
  92. package/dist/components/handle-drop.js +6 -2
  93. package/dist/components/import-assets.d.ts +7 -14
  94. package/dist/components/import-assets.js +11 -1
  95. package/dist/components/parse-caption-file.d.ts +5 -0
  96. package/dist/components/parse-caption-file.js +63 -0
  97. package/dist/error-overlay/current-error.d.ts +13 -0
  98. package/dist/error-overlay/current-error.js +21 -0
  99. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +5 -1
  100. package/dist/esm/chunk-emw4k5b0.js +99527 -0
  101. package/dist/esm/{chunk-1fkq5bfq.js → chunk-vkrvnx2h.js} +20116 -16283
  102. package/dist/esm/index.mjs +27 -9
  103. package/dist/esm/internals.mjs +17408 -13426
  104. package/dist/esm/previewEntry.mjs +17285 -13216
  105. package/dist/esm/renderEntry.mjs +1 -1
  106. package/dist/helpers/create-folder-tree.js +2 -5
  107. package/dist/helpers/document-title.d.ts +2 -0
  108. package/dist/helpers/document-title.js +14 -3
  109. package/dist/helpers/get-preview-file-type.js +22 -3
  110. package/dist/helpers/get-timeline-max-zoom.d.ts +34 -28
  111. package/dist/helpers/get-timeline-max-zoom.js +46 -29
  112. package/dist/helpers/inserted-element-selection.d.ts +2 -1
  113. package/dist/helpers/install-fiber-sequence-order-observer.d.ts +37 -0
  114. package/dist/helpers/install-fiber-sequence-order-observer.js +109 -0
  115. package/dist/helpers/open-in-editor.js +2 -1
  116. package/dist/helpers/use-menu-structure.js +2 -2
  117. package/dist/helpers/use-runtime-values.d.ts +1 -1
  118. package/dist/helpers/use-runtime-values.js +5 -4
  119. package/dist/helpers/use-sync-external-store.d.ts +3 -0
  120. package/dist/helpers/use-sync-external-store.js +5 -0
  121. package/dist/index.d.ts +1 -0
  122. package/dist/index.js +3 -1
  123. package/dist/previewEntry.js +2 -0
  124. package/dist/state/modals.d.ts +16 -2
  125. package/dist/state/timeline-sequence-hover.js +3 -2
  126. package/dist/state/timeline-zoom.d.ts +0 -1
  127. package/dist/state/timeline-zoom.js +13 -6
  128. package/package.json +17 -17
  129. package/dist/helpers/sort-by-nonce-history.d.ts +0 -1
  130. package/dist/helpers/sort-by-nonce-history.js +0 -6
@@ -215,7 +215,7 @@ var renderContent = (Root) => {
215
215
  renderToDOM(/* @__PURE__ */ jsx("div", {
216
216
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
217
217
  }));
218
- import("./chunk-1fkq5bfq.js").then(({ StudioInternals }) => {
218
+ import("./chunk-emw4k5b0.js").then(({ StudioInternals }) => {
219
219
  window.remotion_isStudio = true;
220
220
  window.remotion_isReadOnlyStudio = true;
221
221
  window.remotion_inputProps = "{}";
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sortFolderTreeAlphabetically = exports.createFolderTree = exports.getKeysToExpand = exports.splitParentIntoNameAndParent = exports.buildAssetFolderStructure = void 0;
4
+ const canvas_1 = require("@remotion/canvas");
4
5
  const persist_open_folders_1 = require("./persist-open-folders");
5
- const sort_by_nonce_history_1 = require("./sort-by-nonce-history");
6
6
  const buildAssetFolderStructure = (files, parentFolderName, foldersExpanded) => {
7
7
  const notInFolder = files.filter((f) => !f.name.includes('/'));
8
8
  const inFolder = files.filter((f) => f.name.includes('/'));
@@ -154,10 +154,7 @@ const createFolderTree = (comps, folders, foldersExpanded) => {
154
154
  list.push(toPush);
155
155
  }
156
156
  const sortTreeItems = (treeItems) => {
157
- return (0, sort_by_nonce_history_1.sortItemsByNonceHistory)(treeItems.map((item) => ({
158
- item,
159
- nonce: item.type === 'folder' ? item.folder.nonce : item.composition.nonce,
160
- }))).map(({ item }) => {
157
+ return (0, canvas_1.sortItemsByCommitOrder)(treeItems, (item) => item.type === 'folder' ? item.folder.order : item.composition.order).map((item) => {
161
158
  if (item.type === 'composition') {
162
159
  return item;
163
160
  }
@@ -1,3 +1,5 @@
1
1
  import type { AnyRenderJob } from '../components/RenderQueue/context';
2
+ import type { ModalState } from '../state/modals';
2
3
  export declare const setCurrentCanvasContentId: (id: string | null) => void;
3
4
  export declare const setRenderJobs: (jobs: AnyRenderJob[]) => void;
5
+ export declare const setCurrentModal: (modal: ModalState | null) => void;
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setRenderJobs = exports.setCurrentCanvasContentId = void 0;
3
+ exports.setCurrentModal = exports.setRenderJobs = exports.setCurrentCanvasContentId = void 0;
4
4
  const no_react_1 = require("remotion/no-react");
5
5
  const context_1 = require("../components/RenderQueue/context");
6
+ const url_state_1 = require("./url-state");
6
7
  let currentItemName = null;
8
+ let currentModal = null;
7
9
  let renderJobs = [];
8
10
  const setCurrentCanvasContentId = (id) => {
9
11
  if (!id) {
@@ -21,15 +23,24 @@ const setRenderJobs = (jobs) => {
21
23
  updateTitle();
22
24
  };
23
25
  exports.setRenderJobs = setRenderJobs;
26
+ const setCurrentModal = (modal) => {
27
+ currentModal = modal;
28
+ updateTitle();
29
+ };
30
+ exports.setCurrentModal = setCurrentModal;
24
31
  const productName = 'Remotion Studio';
25
32
  const suffix = `- ${productName}`;
26
33
  const updateTitle = () => {
34
+ if ((currentModal === null || currentModal === void 0 ? void 0 : currentModal.type) === 'element-install') {
35
+ (0, url_state_1.getNavigationWindow)().document.title = `📦 Install ${currentModal.request.element.displayName} - ${productName}`;
36
+ return;
37
+ }
27
38
  if (!currentItemName) {
28
- document.title = productName;
39
+ (0, url_state_1.getNavigationWindow)().document.title = productName;
29
40
  return;
30
41
  }
31
42
  const currentCompTitle = `${currentItemName} / ${window.remotion_projectName}`;
32
- document.title = [
43
+ (0, url_state_1.getNavigationWindow)().document.title = [
33
44
  getProgressInBrackets(currentItemName, renderJobs),
34
45
  `${currentCompTitle} ${suffix}`,
35
46
  ]
@@ -6,9 +6,28 @@ const getPreviewFileType = (fileName) => {
6
6
  if (!fileName) {
7
7
  return 'other';
8
8
  }
9
- const audioExtensions = ['mp3', 'wav', 'ogg', 'aac'];
10
- const videoExtensions = ['mp4', 'avi', 'mkv', 'mov', 'webm'];
11
- const imageExtensions = ['jpg', 'jpeg', 'png', 'apng', 'gif', 'bmp', 'webp'];
9
+ const audioExtensions = ['mp3', 'wav', 'ogg', 'aac', 'm4a', 'flac'];
10
+ const videoExtensions = [
11
+ 'mp4',
12
+ 'avi',
13
+ 'mkv',
14
+ 'mov',
15
+ 'webm',
16
+ 'm4v',
17
+ 'ts',
18
+ 'm2ts',
19
+ 'm3u8',
20
+ ];
21
+ const imageExtensions = [
22
+ 'jpg',
23
+ 'jpeg',
24
+ 'png',
25
+ 'apng',
26
+ 'gif',
27
+ 'bmp',
28
+ 'webp',
29
+ 'svg',
30
+ ];
12
31
  const fontExtensions = ['woff', 'woff2', 'ttf', 'otf', 'eot'];
13
32
  const fileExtension = (_a = fileName.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
14
33
  if (fileExtension === undefined) {
@@ -1,31 +1,37 @@
1
- export declare const TIMELINE_MIN_ZOOM = 1;
2
- export declare const TIMELINE_MAX_ZOOM_FLOOR = 5;
3
- /**
4
- * How many frames fill the timeline viewport at max zoom.
5
- * 30 frames matches the previous 5x cap on a 150-frame composition
6
- * (5 seconds at 30fps) and keeps a single frame wide enough to trim.
7
- */
8
- export declare const TIMELINE_FRAMES_VISIBLE_AT_MAX_ZOOM = 30;
9
- export declare const getTimelineMaxZoom: (durationInFrames: number) => number;
10
- export declare const clampTimelineZoom: ({ zoom, durationInFrames, }: {
11
- zoom: number;
12
- durationInFrames: number;
13
- }) => number;
14
- export declare const timelineZoomToNormalized: ({ zoom, maxZoom, }: {
15
- zoom: number;
16
- maxZoom: number;
17
- }) => number;
18
- export declare const timelineZoomToSliderValue: ({ zoom, maxZoom, }: {
19
- zoom: number;
20
- maxZoom: number;
21
- }) => number;
22
- export declare const normalizedToTimelineZoom: ({ normalized, maxZoom, }: {
23
- normalized: number;
24
- maxZoom: number;
25
- }) => number;
26
- export declare const sliderValueToTimelineZoom: ({ sliderValue, maxZoom, }: {
27
- sliderValue: number;
28
- maxZoom: number;
1
+ export declare const TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM = 30;
2
+ export declare const getTimelineMinZoom: ({ durationInFrames, timelineViewportWidth, }: {
3
+ readonly durationInFrames: number;
4
+ readonly timelineViewportWidth: number;
5
+ }) => number;
6
+ export declare const clampTimelineZoom: ({ zoom, durationInFrames, timelineViewportWidth, }: {
7
+ readonly zoom: number;
8
+ readonly durationInFrames: number;
9
+ readonly timelineViewportWidth: number;
10
+ }) => number;
11
+ export declare const getTimelineZoom: ({ durationInFrames, timelineViewportWidth, zoom, }: {
12
+ readonly durationInFrames: number;
13
+ readonly timelineViewportWidth: number;
14
+ readonly zoom: number | null;
15
+ }) => number;
16
+ export declare const getTimelineWidth: ({ durationInFrames, zoom, }: {
17
+ readonly durationInFrames: number;
18
+ readonly zoom: number;
19
+ }) => number;
20
+ export declare const timelineZoomToNormalized: ({ zoom, minZoom, }: {
21
+ readonly zoom: number;
22
+ readonly minZoom: number;
23
+ }) => number;
24
+ export declare const timelineZoomToSliderValue: ({ zoom, minZoom, }: {
25
+ readonly zoom: number;
26
+ readonly minZoom: number;
27
+ }) => number;
28
+ export declare const normalizedToTimelineZoom: ({ normalized, minZoom, }: {
29
+ readonly normalized: number;
30
+ readonly minZoom: number;
31
+ }) => number;
32
+ export declare const sliderValueToTimelineZoom: ({ sliderValue, minZoom, }: {
33
+ readonly sliderValue: number;
34
+ readonly minZoom: number;
29
35
  }) => number;
30
36
  export declare const TIMELINE_ZOOM_SLIDER_PROPS: {
31
37
  readonly min: 0;
@@ -1,51 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TIMELINE_ZOOM_SLIDER_PROPS = exports.sliderValueToTimelineZoom = exports.normalizedToTimelineZoom = exports.timelineZoomToSliderValue = exports.timelineZoomToNormalized = exports.clampTimelineZoom = exports.getTimelineMaxZoom = exports.TIMELINE_FRAMES_VISIBLE_AT_MAX_ZOOM = exports.TIMELINE_MAX_ZOOM_FLOOR = exports.TIMELINE_MIN_ZOOM = void 0;
4
- exports.TIMELINE_MIN_ZOOM = 1;
5
- exports.TIMELINE_MAX_ZOOM_FLOOR = 5;
6
- /**
7
- * How many frames fill the timeline viewport at max zoom.
8
- * 30 frames matches the previous 5x cap on a 150-frame composition
9
- * (5 seconds at 30fps) and keeps a single frame wide enough to trim.
10
- */
11
- exports.TIMELINE_FRAMES_VISIBLE_AT_MAX_ZOOM = 30;
3
+ exports.TIMELINE_ZOOM_SLIDER_PROPS = exports.sliderValueToTimelineZoom = exports.normalizedToTimelineZoom = exports.timelineZoomToSliderValue = exports.timelineZoomToNormalized = exports.getTimelineWidth = exports.getTimelineZoom = exports.clampTimelineZoom = exports.getTimelineMinZoom = exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM = void 0;
4
+ const timeline_layout_1 = require("./timeline-layout");
5
+ const TIMELINE_ZOOM_FALLBACK = 1;
6
+ exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM = 30;
12
7
  const TIMELINE_ZOOM_SLIDER_MAX = 1000;
13
- const getTimelineMaxZoom = (durationInFrames) => {
14
- const frameLevelZoom = durationInFrames / exports.TIMELINE_FRAMES_VISIBLE_AT_MAX_ZOOM;
15
- return Math.max(exports.TIMELINE_MAX_ZOOM_FLOOR, Math.ceil(frameLevelZoom * 10) / 10);
8
+ const getTimelineMinZoom = ({ durationInFrames, timelineViewportWidth, }) => {
9
+ if (durationInFrames <= 0 || timelineViewportWidth <= 0) {
10
+ return TIMELINE_ZOOM_FALLBACK;
11
+ }
12
+ return Math.min(exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM, Math.max(1, timelineViewportWidth - timeline_layout_1.TIMELINE_PADDING * 2) /
13
+ durationInFrames);
16
14
  };
17
- exports.getTimelineMaxZoom = getTimelineMaxZoom;
18
- const clampTimelineZoom = ({ zoom, durationInFrames, }) => {
19
- const clamped = Math.min((0, exports.getTimelineMaxZoom)(durationInFrames), Math.max(exports.TIMELINE_MIN_ZOOM, zoom));
20
- return Math.round(clamped * 10) / 10;
15
+ exports.getTimelineMinZoom = getTimelineMinZoom;
16
+ const clampTimelineZoom = ({ zoom, durationInFrames, timelineViewportWidth, }) => {
17
+ const minZoom = (0, exports.getTimelineMinZoom)({
18
+ durationInFrames,
19
+ timelineViewportWidth,
20
+ });
21
+ const clamped = Math.min(exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM, Math.max(minZoom, zoom));
22
+ if (clamped === minZoom || clamped === exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM) {
23
+ return clamped;
24
+ }
25
+ return Math.min(exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM, Math.max(minZoom, Math.round(clamped * 1000) / 1000));
21
26
  };
22
27
  exports.clampTimelineZoom = clampTimelineZoom;
23
- const timelineZoomToNormalized = ({ zoom, maxZoom, }) => {
24
- if (maxZoom <= exports.TIMELINE_MIN_ZOOM) {
28
+ const getTimelineZoom = ({ durationInFrames, timelineViewportWidth, zoom, }) => {
29
+ return (0, exports.clampTimelineZoom)({
30
+ durationInFrames,
31
+ timelineViewportWidth,
32
+ zoom: zoom !== null && zoom !== void 0 ? zoom : (0, exports.getTimelineMinZoom)({ durationInFrames, timelineViewportWidth }),
33
+ });
34
+ };
35
+ exports.getTimelineZoom = getTimelineZoom;
36
+ const getTimelineWidth = ({ durationInFrames, zoom, }) => {
37
+ return durationInFrames * zoom + timeline_layout_1.TIMELINE_PADDING * 2;
38
+ };
39
+ exports.getTimelineWidth = getTimelineWidth;
40
+ const timelineZoomToNormalized = ({ zoom, minZoom, }) => {
41
+ if (minZoom >= exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM) {
25
42
  return 0;
26
43
  }
27
- const clampedZoom = Math.min(maxZoom, Math.max(exports.TIMELINE_MIN_ZOOM, zoom));
28
- const normalized = Math.log(clampedZoom / exports.TIMELINE_MIN_ZOOM) /
29
- Math.log(maxZoom / exports.TIMELINE_MIN_ZOOM);
44
+ const clampedZoom = Math.min(exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM, Math.max(minZoom, zoom));
45
+ const normalized = Math.log(clampedZoom / minZoom) /
46
+ Math.log(exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM / minZoom);
30
47
  return (Math.round(normalized * TIMELINE_ZOOM_SLIDER_MAX) / TIMELINE_ZOOM_SLIDER_MAX);
31
48
  };
32
49
  exports.timelineZoomToNormalized = timelineZoomToNormalized;
33
- const timelineZoomToSliderValue = ({ zoom, maxZoom, }) => {
34
- return Math.round((0, exports.timelineZoomToNormalized)({ zoom, maxZoom }) * TIMELINE_ZOOM_SLIDER_MAX);
50
+ const timelineZoomToSliderValue = ({ zoom, minZoom, }) => {
51
+ return Math.round((0, exports.timelineZoomToNormalized)({ zoom, minZoom }) * TIMELINE_ZOOM_SLIDER_MAX);
35
52
  };
36
53
  exports.timelineZoomToSliderValue = timelineZoomToSliderValue;
37
- const normalizedToTimelineZoom = ({ normalized, maxZoom, }) => {
38
- if (maxZoom <= exports.TIMELINE_MIN_ZOOM) {
39
- return exports.TIMELINE_MIN_ZOOM;
54
+ const normalizedToTimelineZoom = ({ normalized, minZoom, }) => {
55
+ if (minZoom >= exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM) {
56
+ return exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM;
40
57
  }
41
58
  const t = Math.min(1, Math.max(0, normalized));
42
- return exports.TIMELINE_MIN_ZOOM * (maxZoom / exports.TIMELINE_MIN_ZOOM) ** t;
59
+ return minZoom * (exports.TIMELINE_FRAME_WIDTH_AT_MAX_ZOOM / minZoom) ** t;
43
60
  };
44
61
  exports.normalizedToTimelineZoom = normalizedToTimelineZoom;
45
- const sliderValueToTimelineZoom = ({ sliderValue, maxZoom, }) => {
62
+ const sliderValueToTimelineZoom = ({ sliderValue, minZoom, }) => {
46
63
  return (0, exports.normalizedToTimelineZoom)({
47
64
  normalized: sliderValue / TIMELINE_ZOOM_SLIDER_MAX,
48
- maxZoom,
65
+ minZoom,
49
66
  });
50
67
  };
51
68
  exports.sliderValueToTimelineZoom = sliderValueToTimelineZoom;
@@ -1,10 +1,11 @@
1
1
  import type { SequenceNodePath } from 'remotion';
2
2
  export type PendingInsertedElementSelection = {
3
3
  compositionId: string;
4
+ notification: string | null;
4
5
  nodePath: {
5
6
  absolutePath: string;
6
7
  nodePath: SequenceNodePath;
7
- };
8
+ } | null;
8
9
  };
9
10
  export declare const requestInsertedElementSelection: (selection: PendingInsertedElementSelection) => void;
10
11
  export declare const clearInsertedElementSelection: (selection: PendingInsertedElementSelection) => void;
@@ -0,0 +1,37 @@
1
+ type Fiber = {
2
+ readonly child: Fiber | null;
3
+ readonly elementType: unknown;
4
+ readonly memoizedProps: unknown;
5
+ readonly sibling: Fiber | null;
6
+ readonly type: unknown;
7
+ };
8
+ type FiberRoot = {
9
+ readonly current: Fiber;
10
+ };
11
+ type DevToolsHook = {
12
+ readonly supportsFiber?: boolean;
13
+ onCommitFiberRoot?: (this: DevToolsHook, rendererId: number, root: FiberRoot, priorityLevel: unknown, didError: boolean) => unknown;
14
+ [key: symbol]: unknown;
15
+ };
16
+ type HookTarget = Window & typeof globalThis & {
17
+ __REACT_DEVTOOLS_GLOBAL_HOOK__?: DevToolsHook;
18
+ };
19
+ type CompositionAndFolderOrderItem = {
20
+ readonly type: 'composition';
21
+ readonly id: string;
22
+ } | {
23
+ readonly type: 'folder';
24
+ readonly id: string;
25
+ };
26
+ export declare const collectCommitOrderFromFiber: (root: FiberRoot) => {
27
+ sequenceManagers: {
28
+ managerId: string;
29
+ sequenceIds: string[];
30
+ }[];
31
+ compositionManagers: {
32
+ managerId: string;
33
+ compositionAndFolderOrder: CompositionAndFolderOrderItem[];
34
+ }[];
35
+ };
36
+ export declare const installFiberCommitOrderObserver: (target: HookTarget) => boolean;
37
+ export {};
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installFiberCommitOrderObserver = exports.collectCommitOrderFromFiber = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const installationMarker = Symbol.for('remotion.commit-order-observer-installed');
6
+ const hasMarker = (candidate, marker) => {
7
+ return ((typeof candidate === 'function' ||
8
+ (typeof candidate === 'object' && candidate !== null)) &&
9
+ Reflect.get(candidate, marker) === true);
10
+ };
11
+ const getStringProp = (props, key) => {
12
+ if (typeof props !== 'object' || props === null) {
13
+ return null;
14
+ }
15
+ const value = Reflect.get(props, key);
16
+ return typeof value === 'string' ? value : null;
17
+ };
18
+ const hasFiberMarker = (fiber, marker) => hasMarker(fiber.type, marker) || hasMarker(fiber.elementType, marker);
19
+ const collectCommitOrderFromFiber = (root) => {
20
+ const sequencesByManager = new Map();
21
+ const compositionsAndFoldersByManager = new Map();
22
+ const visit = (fiber, currentSequenceManagerId, currentCompositionManagerId) => {
23
+ var _a, _b, _c;
24
+ const isSequenceManagerMarker = hasFiberMarker(fiber, remotion_1.Internals.CommitOrderInternals.sequenceManagerMarker);
25
+ const sequenceManagerId = isSequenceManagerMarker
26
+ ? getStringProp(fiber.memoizedProps, 'managerId')
27
+ : currentSequenceManagerId;
28
+ if (isSequenceManagerMarker &&
29
+ sequenceManagerId !== null &&
30
+ !sequencesByManager.has(sequenceManagerId)) {
31
+ sequencesByManager.set(sequenceManagerId, []);
32
+ }
33
+ const isCompositionManagerMarker = hasFiberMarker(fiber, remotion_1.Internals.CommitOrderInternals.compositionManagerMarker);
34
+ const compositionManagerId = isCompositionManagerMarker
35
+ ? getStringProp(fiber.memoizedProps, 'managerId')
36
+ : currentCompositionManagerId;
37
+ if (isCompositionManagerMarker &&
38
+ compositionManagerId !== null &&
39
+ !compositionsAndFoldersByManager.has(compositionManagerId)) {
40
+ compositionsAndFoldersByManager.set(compositionManagerId, []);
41
+ }
42
+ if (hasFiberMarker(fiber, remotion_1.Internals.CommitOrderInternals.sequenceMarker) &&
43
+ sequenceManagerId !== null) {
44
+ const sequenceId = getStringProp(fiber.memoizedProps, 'sequenceId');
45
+ if (sequenceId !== null) {
46
+ (_a = sequencesByManager.get(sequenceManagerId)) === null || _a === void 0 ? void 0 : _a.push(sequenceId);
47
+ }
48
+ }
49
+ if (hasFiberMarker(fiber, remotion_1.Internals.CommitOrderInternals.compositionMarker) &&
50
+ compositionManagerId !== null) {
51
+ const id = getStringProp(fiber.memoizedProps, 'compositionId');
52
+ if (id !== null) {
53
+ (_b = compositionsAndFoldersByManager
54
+ .get(compositionManagerId)) === null || _b === void 0 ? void 0 : _b.push({ type: 'composition', id });
55
+ }
56
+ }
57
+ if (hasFiberMarker(fiber, remotion_1.Internals.CommitOrderInternals.folderMarker) &&
58
+ compositionManagerId !== null) {
59
+ const id = getStringProp(fiber.memoizedProps, 'folderId');
60
+ if (id !== null) {
61
+ (_c = compositionsAndFoldersByManager
62
+ .get(compositionManagerId)) === null || _c === void 0 ? void 0 : _c.push({ type: 'folder', id });
63
+ }
64
+ }
65
+ let { child } = fiber;
66
+ while (child !== null) {
67
+ visit(child, sequenceManagerId, compositionManagerId);
68
+ child = child.sibling;
69
+ }
70
+ };
71
+ visit(root.current, null, null);
72
+ return {
73
+ sequenceManagers: [...sequencesByManager].map(([managerId, sequenceIds]) => ({ managerId, sequenceIds })),
74
+ compositionManagers: [...compositionsAndFoldersByManager].map(([managerId, compositionAndFolderOrder]) => ({
75
+ managerId,
76
+ compositionAndFolderOrder,
77
+ })),
78
+ };
79
+ };
80
+ exports.collectCommitOrderFromFiber = collectCommitOrderFromFiber;
81
+ const installFiberCommitOrderObserver = (target) => {
82
+ const hook = target.__REACT_DEVTOOLS_GLOBAL_HOOK__;
83
+ if (!(hook === null || hook === void 0 ? void 0 : hook.supportsFiber)) {
84
+ return false;
85
+ }
86
+ if (hook[installationMarker] === true) {
87
+ return true;
88
+ }
89
+ const previousOnCommitFiberRoot = hook.onCommitFiberRoot;
90
+ hook.onCommitFiberRoot = function (...args) {
91
+ try {
92
+ const [, root] = args;
93
+ const order = (0, exports.collectCommitOrderFromFiber)(root);
94
+ if (order.sequenceManagers.length > 0 ||
95
+ order.compositionManagers.length > 0) {
96
+ target.dispatchEvent(new CustomEvent(remotion_1.Internals.CommitOrderInternals.eventName, {
97
+ detail: order,
98
+ }));
99
+ }
100
+ }
101
+ catch (_a) {
102
+ // Fiber is private React API. An unsupported shape must not break Studio.
103
+ }
104
+ return previousOnCommitFiberRoot === null || previousOnCommitFiberRoot === void 0 ? void 0 : previousOnCommitFiberRoot.apply(this, args);
105
+ };
106
+ hook[installationMarker] = true;
107
+ return true;
108
+ };
109
+ exports.installFiberCommitOrderObserver = installFiberCommitOrderObserver;
@@ -38,6 +38,7 @@ const react_1 = require("react");
38
38
  const call_api_1 = require("../components/call-api");
39
39
  const get_stack_1 = require("../components/Timeline/TimelineStack/get-stack");
40
40
  const browser_studio_operations_1 = require("./browser-studio-operations");
41
+ const use_sync_external_store_1 = require("./use-sync-external-store");
41
42
  const openInEditor = (stack, editorId) => {
42
43
  const { originalFileName, originalLineNumber, originalColumnNumber, originalFunctionName, originalScriptCode, } = stack;
43
44
  return (0, call_api_1.callApi)('/api/open-in-editor', {
@@ -119,7 +120,7 @@ const getCachedCompositionComponentInfo = ({ compositionFile, compositionId, })
119
120
  };
120
121
  exports.getCachedCompositionComponentInfo = getCachedCompositionComponentInfo;
121
122
  const useCachedCompositionComponentInfo = ({ compositionFile, compositionId, }) => {
122
- const result = (0, react_1.useSyncExternalStore)(exports.subscribeToCompositionComponentInfo, () => {
123
+ const result = (0, use_sync_external_store_1.useSyncExternalStore)(exports.subscribeToCompositionComponentInfo, () => {
123
124
  if (compositionFile === null || compositionId === null) {
124
125
  return null;
125
126
  }
@@ -212,7 +212,7 @@ const getRenderMenuItems = ({ closeMenu, previewServerState, readOnlyStudio, })
212
212
  {
213
213
  id: 'render-on-web',
214
214
  value: 'render-on-web',
215
- label: 'Render on web...',
215
+ label: 'Render in browser...',
216
216
  onClick: () => {
217
217
  closeMenu();
218
218
  const renderButton = document.getElementById('render-modal-button-client');
@@ -222,7 +222,7 @@ const getRenderMenuItems = ({ closeMenu, previewServerState, readOnlyStudio, })
222
222
  keyHint: null,
223
223
  leftItem: null,
224
224
  subMenu: null,
225
- quickSwitcherLabel: 'Render on web...',
225
+ quickSwitcherLabel: 'Render in browser...',
226
226
  },
227
227
  {
228
228
  type: 'divider',
@@ -1,4 +1,4 @@
1
- import type { RuntimeValueStore, SequenceRegistrationControls } from 'remotion';
1
+ import { type RuntimeValueStore, type SequenceRegistrationControls } from 'remotion';
2
2
  export declare const useRuntimeValues: (controls: SequenceRegistrationControls | null) => Readonly<Record<string, unknown>>;
3
3
  export declare const useRuntimeValue: (controls: SequenceRegistrationControls | null, key: string) => unknown;
4
4
  export declare const useRuntimeStoreValue: (storeOrNull: RuntimeValueStore | null, key: string) => unknown;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useRuntimeValueSnapshots = exports.useRuntimeValueSelector = exports.useRuntimeStoreValue = exports.useRuntimeValue = exports.useRuntimeValues = void 0;
4
4
  const react_1 = require("react");
5
+ const use_sync_external_store_1 = require("./use-sync-external-store");
5
6
  const EMPTY_RUNTIME_VALUES = {};
6
7
  const EMPTY_RUNTIME_VALUE_STORE = {
7
8
  getSnapshot: () => EMPTY_RUNTIME_VALUES,
@@ -10,7 +11,7 @@ const EMPTY_RUNTIME_VALUE_STORE = {
10
11
  const useRuntimeValues = (controls) => {
11
12
  var _a;
12
13
  const store = (_a = controls === null || controls === void 0 ? void 0 : controls.runtimeValues) !== null && _a !== void 0 ? _a : EMPTY_RUNTIME_VALUE_STORE;
13
- return (0, react_1.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
14
+ return (0, use_sync_external_store_1.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
14
15
  };
15
16
  exports.useRuntimeValues = useRuntimeValues;
16
17
  const useRuntimeValue = (controls, key) => {
@@ -21,7 +22,7 @@ exports.useRuntimeValue = useRuntimeValue;
21
22
  const useRuntimeStoreValue = (storeOrNull, key) => {
22
23
  const store = storeOrNull !== null && storeOrNull !== void 0 ? storeOrNull : EMPTY_RUNTIME_VALUE_STORE;
23
24
  const getSnapshot = (0, react_1.useCallback)(() => store.getSnapshot()[key], [key, store]);
24
- return (0, react_1.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
25
+ return (0, use_sync_external_store_1.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
25
26
  };
26
27
  exports.useRuntimeStoreValue = useRuntimeStoreValue;
27
28
  const useRuntimeValueSelector = ({ controls, selector, isEqual = Object.is, }) => {
@@ -47,7 +48,7 @@ const useRuntimeValueSelector = ({ controls, selector, isEqual = Object.is, }) =
47
48
  subscribe: store.subscribe,
48
49
  };
49
50
  }, [isEqual, selector, store]);
50
- return (0, react_1.useSyncExternalStore)(selectedStore.subscribe, selectedStore.getSnapshot, selectedStore.getSnapshot);
51
+ return (0, use_sync_external_store_1.useSyncExternalStore)(selectedStore.subscribe, selectedStore.getSnapshot, selectedStore.getSnapshot);
51
52
  };
52
53
  exports.useRuntimeValueSelector = useRuntimeValueSelector;
53
54
  const useRuntimeValueSnapshots = (controls) => {
@@ -75,6 +76,6 @@ const useRuntimeValueSnapshots = (controls) => {
75
76
  },
76
77
  };
77
78
  }, [stores]);
78
- return (0, react_1.useSyncExternalStore)(aggregateStore.subscribe, aggregateStore.getSnapshot, aggregateStore.getSnapshot);
79
+ return (0, use_sync_external_store_1.useSyncExternalStore)(aggregateStore.subscribe, aggregateStore.getSnapshot, aggregateStore.getSnapshot);
79
80
  };
80
81
  exports.useRuntimeValueSnapshots = useRuntimeValueSnapshots;
@@ -0,0 +1,3 @@
1
+ type UseSyncExternalStore = <TSnapshot>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => TSnapshot, getServerSnapshot?: () => TSnapshot) => TSnapshot;
2
+ export declare const useSyncExternalStore: UseSyncExternalStore;
3
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSyncExternalStore = void 0;
4
+ const remotion_1 = require("remotion");
5
+ ({ useSyncExternalStore: exports.useSyncExternalStore } = remotion_1.Internals);
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { pause } from './api/pause';
7
7
  export { play } from './api/play';
8
8
  export { reevaluateComposition } from './api/reevaluate-composition';
9
9
  export { restartStudio } from './api/restart-studio';
10
+ export { shutDownStudio } from './api/shut-down-studio';
10
11
  export { saveDefaultProps } from './api/save-default-props';
11
12
  export { seek } from './api/seek';
12
13
  export { toggle } from './api/toggle';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StudioInternals = exports.writeStaticFile = exports.watchStaticFile = exports.watchPublicFolder = exports.visualControl = exports.updateDefaultProps = exports.toggle = exports.seek = exports.saveDefaultProps = exports.restartStudio = exports.reevaluateComposition = exports.play = exports.pause = exports.goToComposition = exports.getStaticFiles = exports.focusDefaultPropsPath = exports.deleteStaticFile = void 0;
3
+ exports.StudioInternals = exports.writeStaticFile = exports.watchStaticFile = exports.watchPublicFolder = exports.visualControl = exports.updateDefaultProps = exports.toggle = exports.seek = exports.saveDefaultProps = exports.shutDownStudio = exports.restartStudio = exports.reevaluateComposition = exports.play = exports.pause = exports.goToComposition = exports.getStaticFiles = exports.focusDefaultPropsPath = exports.deleteStaticFile = void 0;
4
4
  const create_composition_1 = require("./api/create-composition");
5
5
  const CodingAgentIcon_1 = require("./components/CodingAgentIcon");
6
6
  const editor_1 = require("./icons/editor");
@@ -22,6 +22,8 @@ const reevaluate_composition_1 = require("./api/reevaluate-composition");
22
22
  Object.defineProperty(exports, "reevaluateComposition", { enumerable: true, get: function () { return reevaluate_composition_1.reevaluateComposition; } });
23
23
  const restart_studio_1 = require("./api/restart-studio");
24
24
  Object.defineProperty(exports, "restartStudio", { enumerable: true, get: function () { return restart_studio_1.restartStudio; } });
25
+ const shut_down_studio_1 = require("./api/shut-down-studio");
26
+ Object.defineProperty(exports, "shutDownStudio", { enumerable: true, get: function () { return shut_down_studio_1.shutDownStudio; } });
25
27
  const save_default_props_1 = require("./api/save-default-props");
26
28
  Object.defineProperty(exports, "saveDefaultProps", { enumerable: true, get: function () { return save_default_props_1.saveDefaultProps; } });
27
29
  const seek_1 = require("./api/seek");
@@ -10,8 +10,10 @@ const no_react_1 = require("remotion/no-react");
10
10
  const NoRegisterRoot_1 = require("./components/NoRegisterRoot");
11
11
  const entry_basic_1 = require("./error-overlay/entry-basic");
12
12
  const colors_1 = require("./helpers/colors");
13
+ const install_fiber_sequence_order_observer_1 = require("./helpers/install-fiber-sequence-order-observer");
13
14
  const client_2 = require("./hot-middleware-client/client");
14
15
  const Studio_1 = require("./Studio");
16
+ (0, install_fiber_sequence_order_observer_1.installFiberCommitOrderObserver)(window);
15
17
  remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultPreviewCSS(null, colors_1.BACKGROUND_HEX));
16
18
  if (!window.__remotionOverlayStarted) {
17
19
  window.__remotionOverlayStarted = true;
@@ -1,6 +1,6 @@
1
1
  import type { AudioCodec, ChromeMode, Codec, ColorSpace, LogLevel, OpenGlRenderer, PixelFormat, StillImageFormat, VideoImageFormat, X264Preset } from '@remotion/renderer';
2
2
  import type { HardwareAccelerationOption } from '@remotion/renderer/client';
3
- import type { CanvasCaptureData, RenderDefaults } from '@remotion/studio-shared';
3
+ import type { CanvasCaptureData, ElementInstallExpectedFileState, ElementInstallRequest, RenderDefaults } from '@remotion/studio-shared';
4
4
  import type { RenderStillOnWebImageFormat, WebRendererAudioCodec, WebRendererContainer, WebRendererHardwareAcceleration, WebRendererPageResponsiveness, WebRendererQuality, WebRendererVideoCodec } from '@remotion/web-renderer';
5
5
  import type React from 'react';
6
6
  import type { SequencePropsSubscriptionKey, _InternalTypes } from 'remotion';
@@ -116,6 +116,20 @@ export type CanvasCaptureImport = {
116
116
  readonly height: number;
117
117
  readonly width: number;
118
118
  };
119
+ export type ElementInstallPlan = {
120
+ readonly compositionFile: string;
121
+ readonly expectedFileState: ElementInstallExpectedFileState;
122
+ };
123
+ export type ElementInstallModalState = {
124
+ readonly type: 'element-install';
125
+ readonly currentPlan: ElementInstallPlan | null;
126
+ readonly missingPackages: string[];
127
+ readonly newPlan: ElementInstallPlan;
128
+ readonly onClose: () => void;
129
+ readonly request: ElementInstallRequest;
130
+ readonly sourceIsUnverified: boolean;
131
+ readonly sourceLabel: string;
132
+ };
119
133
  export type ModalState = {
120
134
  type: 'new-comp';
121
135
  folderName: string | null;
@@ -180,7 +194,7 @@ export type ModalState = {
180
194
  type: 'element-library';
181
195
  name: string;
182
196
  url: string;
183
- } | AddEffectModalState | ConfirmationDialogState | SvgImportDialogState;
197
+ } | ElementInstallModalState | AddEffectModalState | ConfirmationDialogState | SvgImportDialogState;
184
198
  export type SetSelectedModalContextType = {
185
199
  setSelectedModal: React.Dispatch<React.SetStateAction<ModalState | null>>;
186
200
  };