@remotion/studio 4.0.519 → 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 (79) hide show
  1. package/dist/api/visual-control.js +2 -2
  2. package/dist/components/AudioWaveform.js +6 -1
  3. package/dist/components/Canvas.js +30 -36
  4. package/dist/components/CompositionSelector.js +6 -10
  5. package/dist/components/CompositionSelectorItem.js +7 -12
  6. package/dist/components/CurrentCompositionSideEffects.js +5 -0
  7. package/dist/components/ElementInstallConfirmation.d.ts +2 -23
  8. package/dist/components/ElementInstallConfirmation.js +16 -2
  9. package/dist/components/FpsCounter.js +1 -1
  10. package/dist/components/FramePersistor.js +1 -1
  11. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -3
  12. package/dist/components/InspectorPanel/use-composition-actions.js +5 -8
  13. package/dist/components/Modals.js +1 -1
  14. package/dist/components/NewComposition/NewComposition.js +2 -2
  15. package/dist/components/PlayPause.js +2 -13
  16. package/dist/components/PreviewToolbar.js +1 -1
  17. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +29 -15
  18. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +14 -1
  19. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +64 -9
  20. package/dist/components/QuickSwitcher/composition-search.d.ts +16 -0
  21. package/dist/components/QuickSwitcher/composition-search.js +136 -0
  22. package/dist/components/ResetZoomButton.js +17 -2
  23. package/dist/components/SelectedOutlineElement.js +10 -30
  24. package/dist/components/Timeline/Timeline.js +2 -1
  25. package/dist/components/Timeline/TimelineAssetField.js +1 -0
  26. package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -90
  27. package/dist/components/Timeline/TimelineDragHandler.js +18 -8
  28. package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -3
  29. package/dist/components/Timeline/TimelinePinchZoom.js +14 -4
  30. package/dist/components/Timeline/TimelinePlayCursorSyncer.js +8 -4
  31. package/dist/components/Timeline/TimelineSequence.js +16 -41
  32. package/dist/components/Timeline/TimelineSequenceItem.js +14 -35
  33. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +3 -3
  34. package/dist/components/Timeline/TimelineSlider.js +2 -2
  35. package/dist/components/Timeline/TimelineWidthProvider.js +15 -8
  36. package/dist/components/Timeline/TimelineZoomControls.js +25 -8
  37. package/dist/components/Timeline/delete-selected-timeline-item.js +2 -2
  38. package/dist/components/Timeline/timeline-scroll-logic.d.ts +1 -0
  39. package/dist/components/Timeline/timeline-scroll-logic.js +21 -17
  40. package/dist/components/Timeline/use-delete-timeline-items.d.ts +1 -0
  41. package/dist/components/Timeline/use-delete-timeline-items.js +118 -0
  42. package/dist/components/Timeline/use-timeline-asset-drop.js +8 -14
  43. package/dist/components/WebMcp.js +61 -8
  44. package/dist/components/ZoomPersistor.js +2 -2
  45. package/dist/components/composition-drag-data.d.ts +36 -0
  46. package/dist/components/composition-drag-data.js +232 -0
  47. package/dist/components/drop-handler-data.d.ts +2 -1
  48. package/dist/components/drop-handler-data.js +6 -4
  49. package/dist/components/effect-drag-and-drop.d.ts +2 -5
  50. package/dist/components/handle-drop.js +6 -2
  51. package/dist/components/import-assets.d.ts +5 -13
  52. package/dist/error-overlay/current-error.d.ts +13 -0
  53. package/dist/error-overlay/current-error.js +21 -0
  54. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +5 -1
  55. package/dist/esm/{chunk-1fkq5bfq.js → chunk-np6q13k5.js} +21571 -18952
  56. package/dist/esm/index.mjs +4 -1
  57. package/dist/esm/internals.mjs +17206 -14587
  58. package/dist/esm/previewEntry.mjs +19510 -16804
  59. package/dist/esm/renderEntry.mjs +1 -1
  60. package/dist/helpers/create-folder-tree.js +2 -5
  61. package/dist/helpers/document-title.d.ts +2 -0
  62. package/dist/helpers/document-title.js +14 -3
  63. package/dist/helpers/get-timeline-max-zoom.d.ts +34 -28
  64. package/dist/helpers/get-timeline-max-zoom.js +46 -29
  65. package/dist/helpers/install-fiber-sequence-order-observer.d.ts +37 -0
  66. package/dist/helpers/install-fiber-sequence-order-observer.js +109 -0
  67. package/dist/helpers/open-in-editor.js +2 -1
  68. package/dist/helpers/use-runtime-values.d.ts +1 -1
  69. package/dist/helpers/use-runtime-values.js +5 -4
  70. package/dist/helpers/use-sync-external-store.d.ts +3 -0
  71. package/dist/helpers/use-sync-external-store.js +5 -0
  72. package/dist/previewEntry.js +2 -0
  73. package/dist/state/modals.d.ts +18 -2
  74. package/dist/state/timeline-sequence-hover.js +3 -2
  75. package/dist/state/timeline-zoom.d.ts +0 -1
  76. package/dist/state/timeline-zoom.js +13 -6
  77. package/package.json +16 -16
  78. package/dist/helpers/sort-by-nonce-history.d.ts +0 -1
  79. 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-np6q13k5.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
  ]
@@ -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;
@@ -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
  }
@@ -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);
@@ -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,22 @@ 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 filePath: string;
122
+ readonly expectedFileState: ElementInstallExpectedFileState;
123
+ };
124
+ export type ElementInstallModalState = {
125
+ readonly type: 'element-install';
126
+ readonly currentPlan: ElementInstallPlan | null;
127
+ readonly dependenciesToReview: string[];
128
+ readonly missingPackages: string[];
129
+ readonly newPlan: ElementInstallPlan;
130
+ readonly onClose: () => void;
131
+ readonly request: ElementInstallRequest;
132
+ readonly sourceIsUnverified: boolean;
133
+ readonly sourceLabel: string;
134
+ };
119
135
  export type ModalState = {
120
136
  type: 'new-comp';
121
137
  folderName: string | null;
@@ -180,7 +196,7 @@ export type ModalState = {
180
196
  type: 'element-library';
181
197
  name: string;
182
198
  url: string;
183
- } | AddEffectModalState | ConfirmationDialogState | SvgImportDialogState;
199
+ } | ElementInstallModalState | AddEffectModalState | ConfirmationDialogState | SvgImportDialogState;
184
200
  export type SetSelectedModalContextType = {
185
201
  setSelectedModal: React.Dispatch<React.SetStateAction<ModalState | null>>;
186
202
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useTimelineSequenceHover = exports.useIsTimelineSequenceHovered = exports.useSetTimelineSequenceHover = exports.useTimelineSequenceHoverState = exports.TimelineSequenceHoverContext = exports.createTimelineSequenceHoverStore = void 0;
4
4
  const react_1 = require("react");
5
5
  const timeline_node_path_key_1 = require("../helpers/timeline-node-path-key");
6
+ const use_sync_external_store_1 = require("../helpers/use-sync-external-store");
6
7
  const createTimelineSequenceHoverStore = () => {
7
8
  let hoveredSequence = null;
8
9
  const listeners = new Set();
@@ -28,7 +29,7 @@ exports.createTimelineSequenceHoverStore = createTimelineSequenceHoverStore;
28
29
  exports.TimelineSequenceHoverContext = (0, react_1.createContext)((0, exports.createTimelineSequenceHoverStore)());
29
30
  const useTimelineSequenceHoverState = () => {
30
31
  const store = (0, react_1.useContext)(exports.TimelineSequenceHoverContext);
31
- return (0, react_1.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
32
+ return (0, use_sync_external_store_1.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
32
33
  };
33
34
  exports.useTimelineSequenceHoverState = useTimelineSequenceHoverState;
34
35
  const useSetTimelineSequenceHover = () => {
@@ -41,7 +42,7 @@ const useIsTimelineSequenceHovered = (nodePathKey) => {
41
42
  var _a;
42
43
  return nodePathKey !== null && ((_a = store.getSnapshot()) === null || _a === void 0 ? void 0 : _a.nodePathKey) === nodePathKey;
43
44
  }, [nodePathKey, store]);
44
- return (0, react_1.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
45
+ return (0, use_sync_external_store_1.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
45
46
  };
46
47
  exports.useIsTimelineSequenceHovered = useIsTimelineSequenceHovered;
47
48
  const useTimelineSequenceHover = (nodePathInfo) => {
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- export { getTimelineMaxZoom, TIMELINE_MIN_ZOOM, } from '../helpers/get-timeline-max-zoom';
3
2
  export type TimelineSetZoomOptions = {
4
3
  anchorFrame: number | null;
5
4
  anchorContentX: number | null;
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineZoomContext = exports.TimelineZoomCtx = exports.TIMELINE_MIN_ZOOM = exports.getTimelineMaxZoom = void 0;
3
+ exports.TimelineZoomContext = exports.TimelineZoomCtx = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_dom_1 = require("react-dom");
7
7
  const imperative_state_1 = require("../components/Timeline/imperative-state");
8
+ const timeline_refs_1 = require("../components/Timeline/timeline-refs");
8
9
  const timeline_scroll_logic_1 = require("../components/Timeline/timeline-scroll-logic");
9
10
  const ZoomPersistor_1 = require("../components/ZoomPersistor");
10
11
  const get_timeline_max_zoom_1 = require("../helpers/get-timeline-max-zoom");
11
- const get_timeline_max_zoom_2 = require("../helpers/get-timeline-max-zoom");
12
- Object.defineProperty(exports, "getTimelineMaxZoom", { enumerable: true, get: function () { return get_timeline_max_zoom_2.getTimelineMaxZoom; } });
13
- Object.defineProperty(exports, "TIMELINE_MIN_ZOOM", { enumerable: true, get: function () { return get_timeline_max_zoom_2.TIMELINE_MIN_ZOOM; } });
14
12
  exports.TimelineZoomCtx = (0, react_1.createContext)({
15
13
  zoom: {},
16
14
  setZoom: () => {
@@ -31,9 +29,18 @@ const TimelineZoomContext = ({ children }) => {
31
29
  (0, react_dom_1.flushSync)(() => {
32
30
  setZoomState((prevZoomMap) => {
33
31
  var _a;
32
+ var _b, _c;
33
+ const durationInFrames = (0, imperative_state_1.getCurrentDuration)();
34
+ const timelineViewportWidth = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0;
35
+ const previousZoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
36
+ durationInFrames,
37
+ timelineViewportWidth,
38
+ zoom: (_c = prevZoomMap[compositionId]) !== null && _c !== void 0 ? _c : null,
39
+ });
34
40
  const newZoom = (0, get_timeline_max_zoom_1.clampTimelineZoom)({
35
- zoom: callback((_a = prevZoomMap[compositionId]) !== null && _a !== void 0 ? _a : get_timeline_max_zoom_1.TIMELINE_MIN_ZOOM),
36
- durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
41
+ zoom: callback(previousZoom),
42
+ durationInFrames,
43
+ timelineViewportWidth,
37
44
  });
38
45
  return { ...prevZoomMap, [compositionId]: newZoom };
39
46
  });