@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
@@ -0,0 +1,10 @@
1
+ export type GetBoxQuadsBox = 'margin' | 'border' | 'padding' | 'content';
2
+ export type GetBoxQuadsPonyfillOptions = {
3
+ readonly box?: GetBoxQuadsBox;
4
+ readonly relativeTo?: Element;
5
+ };
6
+ /**
7
+ * Returns border/margin/padding/content box quads for an element.
8
+ * Uses the native API when available, otherwise the getBoxQuads ponyfill.
9
+ */
10
+ export declare const getBoxQuadsPonyfill: (element: Element, options?: GetBoxQuadsPonyfillOptions | undefined) => readonly DOMQuad[] | null;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBoxQuadsPonyfill = void 0;
4
+ const get_box_quads_polyfill_internals_js_1 = require("./get-box-quads-polyfill-internals.js");
5
+ const hasNativeGetBoxQuads = (element) => {
6
+ return (typeof element.getBoxQuads === 'function');
7
+ };
8
+ /**
9
+ * Returns border/margin/padding/content box quads for an element.
10
+ * Uses the native API when available, otherwise the getBoxQuads ponyfill.
11
+ */
12
+ const getBoxQuadsPonyfill = (element, options) => {
13
+ try {
14
+ if (hasNativeGetBoxQuads(element)) {
15
+ return element.getBoxQuads(options);
16
+ }
17
+ return (0, get_box_quads_polyfill_internals_js_1.getBoxQuads)(element, options);
18
+ }
19
+ catch (_a) {
20
+ return null;
21
+ }
22
+ };
23
+ exports.getBoxQuadsPonyfill = getBoxQuadsPonyfill;
@@ -4,4 +4,9 @@ import type { OriginalPosition } from '../error-overlay/react-overlay/utils/get-
4
4
  export declare const getGitSourceName: (gitSource: GitSource) => string;
5
5
  export declare const getGitSourceBranchUrl: (gitSource: GitSource) => string;
6
6
  export declare const getGitRefUrl: (gitSource: GitSource, originalLocation: OriginalPosition, remotionRoot: string) => string;
7
+ export declare const hasReadOnlyGitSource: () => boolean;
8
+ export declare const openGitSource: ({ folder, location, }: {
9
+ folder: boolean;
10
+ location: OriginalPosition | null;
11
+ }) => void;
7
12
  export declare const getGitMenuItem: () => ComboboxValue | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGitMenuItem = exports.getGitRefUrl = exports.getGitSourceBranchUrl = exports.getGitSourceName = void 0;
3
+ exports.getGitMenuItem = exports.openGitSource = exports.hasReadOnlyGitSource = exports.getGitRefUrl = exports.getGitSourceBranchUrl = exports.getGitSourceName = void 0;
4
4
  const getGitSourceName = (gitSource) => {
5
5
  if (gitSource.type === 'github') {
6
6
  return 'GitHub';
@@ -52,6 +52,20 @@ const getGitRefUrl = (gitSource, originalLocation, remotionRoot) => {
52
52
  throw new Error('Unknown git source type');
53
53
  };
54
54
  exports.getGitRefUrl = getGitRefUrl;
55
+ const hasReadOnlyGitSource = () => {
56
+ return Boolean(window.remotion_isReadOnlyStudio && window.remotion_gitSource);
57
+ };
58
+ exports.hasReadOnlyGitSource = hasReadOnlyGitSource;
59
+ const openGitSource = ({ folder, location, }) => {
60
+ const gitSource = window.remotion_gitSource;
61
+ if (!gitSource) {
62
+ return;
63
+ }
64
+ window.open(folder || !location
65
+ ? (0, exports.getGitSourceBranchUrl)(gitSource)
66
+ : (0, exports.getGitRefUrl)(gitSource, location, window.remotion_cwd), '_blank');
67
+ };
68
+ exports.openGitSource = openGitSource;
55
69
  const getGitMenuItem = () => {
56
70
  if (!window.remotion_gitSource) {
57
71
  return null;
@@ -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;
@@ -50,18 +50,23 @@ const makeHoverableCSS = () => `
50
50
  }
51
51
 
52
52
  @media (hover: hover) {
53
- ${hoverable}:hover,
54
- ${hoverGroup}:hover ${hoverable} {
53
+ ${hoverable}:hover {
55
54
  background-color: var(${HOVER_BG_VARIABLE}, var(${BG_VARIABLE}, ${colors_1.TRANSPARENT}));
56
55
  }
57
56
 
58
57
  ${hoverable}:hover,
59
- ${hoverable}:hover *,
60
- ${hoverGroup}:hover ${hoverable},
61
- ${hoverGroup}:hover ${hoverable} * {
58
+ ${hoverable}:hover * {
62
59
  color: var(${HOVER_COLOR_VARIABLE}, var(${COLOR_VARIABLE}, inherit));
63
60
  }
64
61
 
62
+ /* An outer hoverable must not put a nested inline action into its hover
63
+ state. The nested action should only use its hover color when the
64
+ pointer is over the action itself. */
65
+ ${hoverable}:hover ${hoverable}:not(:hover),
66
+ ${hoverable}:hover ${hoverable}:not(:hover) * {
67
+ color: var(${COLOR_VARIABLE}, inherit);
68
+ }
69
+
65
70
  ${hoverGroup} ${reveal} {
66
71
  opacity: 0;
67
72
  }
@@ -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;
@@ -1,9 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.openCompositionComponentInEditor = exports.preloadCompositionComponentInfo = exports.loadCompositionComponentInfo = exports.useCachedCompositionComponentInfo = exports.getCachedCompositionComponentInfo = exports.subscribeToCompositionComponentInfo = exports.openOriginalPositionInEditorAtProperty = exports.openOriginalPositionInEditor = exports.openInGitClient = exports.openInTerminal = exports.openInCodingAgent = exports.openInEditor = void 0;
4
37
  const react_1 = require("react");
5
38
  const call_api_1 = require("../components/call-api");
39
+ const get_stack_1 = require("../components/Timeline/TimelineStack/get-stack");
6
40
  const browser_studio_operations_1 = require("./browser-studio-operations");
41
+ const use_sync_external_store_1 = require("./use-sync-external-store");
7
42
  const openInEditor = (stack, editorId) => {
8
43
  const { originalFileName, originalLineNumber, originalColumnNumber, originalFunctionName, originalScriptCode, } = stack;
9
44
  return (0, call_api_1.callApi)('/api/open-in-editor', {
@@ -85,7 +120,7 @@ const getCachedCompositionComponentInfo = ({ compositionFile, compositionId, })
85
120
  };
86
121
  exports.getCachedCompositionComponentInfo = getCachedCompositionComponentInfo;
87
122
  const useCachedCompositionComponentInfo = ({ compositionFile, compositionId, }) => {
88
- const result = (0, react_1.useSyncExternalStore)(exports.subscribeToCompositionComponentInfo, () => {
123
+ const result = (0, use_sync_external_store_1.useSyncExternalStore)(exports.subscribeToCompositionComponentInfo, () => {
89
124
  if (compositionFile === null || compositionId === null) {
90
125
  return null;
91
126
  }
@@ -125,7 +160,23 @@ const loadCompositionComponentInfo = async ({ compositionFile, compositionId, })
125
160
  const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
126
161
  const body = browserStudioOperations
127
162
  ? await browserStudioOperations.getCompositionComponentInfo(request)
128
- : await (0, call_api_1.callApi)('/api/composition-component-info', request);
163
+ : typeof window !== 'undefined' && window.remotion_isReadOnlyStudio
164
+ ? await (async () => {
165
+ const files = (0, get_stack_1.getSourceMapFilesForSource)(compositionFile);
166
+ if (files === null) {
167
+ throw new Error(`Could not find source map contents for ${compositionFile}`);
168
+ }
169
+ const { resolveCompositionComponentLocation } = await Promise.resolve().then(() => __importStar(require('@remotion/studio-codemods/resolve-composition-component-location')));
170
+ return {
171
+ canAddSequence: false,
172
+ location: resolveCompositionComponentLocation({
173
+ compositionFile,
174
+ compositionId,
175
+ project: { files, rootDir: '.' },
176
+ }),
177
+ };
178
+ })()
179
+ : await (0, call_api_1.callApi)('/api/composition-component-info', request);
129
180
  const result = {
130
181
  location: body.location,
131
182
  canAddSequence: body.canAddSequence,
@@ -90,6 +90,9 @@ const ensurePreviewServerEventSource = () => {
90
90
  if (connectToBrowserStudio()) {
91
91
  return;
92
92
  }
93
+ if (window.remotion_isReadOnlyStudio) {
94
+ return;
95
+ }
93
96
  if (typeof EventSource === 'undefined') {
94
97
  return;
95
98
  }
@@ -62,7 +62,6 @@ export declare const getExpandedTrackHeight: ({ sequence, nodePathInfo, getIsExp
62
62
  export declare const TIMELINE_LAYER_FILMSTRIP_HEIGHT = 26;
63
63
  export declare const TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT = 17;
64
64
  export declare const TIMELINE_LAYER_HEIGHT_VIDEO: number;
65
- export declare const TIMELINE_LAYER_HEIGHT_IMAGE = 26;
66
65
  export declare const TIMELINE_LAYER_HEIGHT_AUDIO = 34;
67
66
  export declare const TIMELINE_LAYER_HEIGHT_DEFAULT = 21;
68
67
  export declare const TIMELINE_LIST_ITEM_ROW_HEIGHT = 21;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimelineLayerHeight = exports.TIMELINE_LIST_ITEM_ROW_HEIGHT = exports.TIMELINE_LAYER_HEIGHT_DEFAULT = exports.TIMELINE_LAYER_HEIGHT_AUDIO = exports.TIMELINE_LAYER_HEIGHT_IMAGE = exports.TIMELINE_LAYER_HEIGHT_VIDEO = exports.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT = exports.TIMELINE_LAYER_FILMSTRIP_HEIGHT = exports.getExpandedTrackHeight = exports.getTreeRowHeight = exports.flattenVisibleTreeNodes = exports.buildTimelineTree = exports.EXPANDED_SECTION_PADDING_RIGHT = exports.TREE_GROUP_ROW_HEIGHT = exports.TIMELINE_TRACK_EXPANDED_HEIGHT = exports.TIMELINE_ITEM_BORDER_BOTTOM = exports.TIMELINE_BORDER = exports.TIMELINE_PADDING = exports.SCHEMA_FIELD_ROW_HEIGHT = exports.getSchemaFieldGroup = exports.getFieldsToShow = exports.getEffectFieldsToShow = exports.SCHEMA_FIELD_GROUPS = void 0;
3
+ exports.getTimelineLayerHeight = exports.TIMELINE_LIST_ITEM_ROW_HEIGHT = exports.TIMELINE_LAYER_HEIGHT_DEFAULT = exports.TIMELINE_LAYER_HEIGHT_AUDIO = exports.TIMELINE_LAYER_HEIGHT_VIDEO = exports.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT = exports.TIMELINE_LAYER_FILMSTRIP_HEIGHT = exports.getExpandedTrackHeight = exports.getTreeRowHeight = exports.flattenVisibleTreeNodes = exports.buildTimelineTree = exports.EXPANDED_SECTION_PADDING_RIGHT = exports.TREE_GROUP_ROW_HEIGHT = exports.TIMELINE_TRACK_EXPANDED_HEIGHT = exports.TIMELINE_ITEM_BORDER_BOTTOM = exports.TIMELINE_BORDER = exports.TIMELINE_PADDING = exports.SCHEMA_FIELD_ROW_HEIGHT = exports.getSchemaFieldGroup = exports.getFieldsToShow = exports.getEffectFieldsToShow = exports.SCHEMA_FIELD_GROUPS = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const studio_shared_2 = require("@remotion/studio-shared");
6
6
  Object.defineProperty(exports, "SCHEMA_FIELD_GROUPS", { enumerable: true, get: function () { return studio_shared_2.SCHEMA_FIELD_GROUPS; } });
@@ -162,7 +162,6 @@ exports.TIMELINE_LAYER_FILMSTRIP_HEIGHT = 26;
162
162
  // The waveform stripe rendered underneath the filmstrip in TimelineVideoInfo.
163
163
  exports.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT = 17;
164
164
  exports.TIMELINE_LAYER_HEIGHT_VIDEO = 2 + exports.TIMELINE_LAYER_FILMSTRIP_HEIGHT + exports.TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT;
165
- exports.TIMELINE_LAYER_HEIGHT_IMAGE = 26;
166
165
  exports.TIMELINE_LAYER_HEIGHT_AUDIO = 34;
167
166
  exports.TIMELINE_LAYER_HEIGHT_DEFAULT = 21;
168
167
  // The horizontal row inside a timeline list item (eye + arrow + label).
@@ -171,9 +170,6 @@ const getTimelineLayerHeight = (type) => {
171
170
  if (type === 'video') {
172
171
  return exports.TIMELINE_LAYER_HEIGHT_VIDEO;
173
172
  }
174
- if (type === 'image') {
175
- return exports.TIMELINE_LAYER_HEIGHT_IMAGE;
176
- }
177
173
  if (type === 'audio') {
178
174
  return exports.TIMELINE_LAYER_HEIGHT_AUDIO;
179
175
  }
@@ -1,3 +1,4 @@
1
+ export declare const getNavigationWindow: () => Window;
1
2
  export declare const getUrlForRoute: (route: string) => string;
2
3
  export declare const pushUrl: (url: string) => void;
3
4
  export declare const replaceUrl: (url: string) => void;
@@ -1,25 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRoute = exports.reloadUrl = exports.clearUrl = exports.replaceUrl = exports.pushUrl = exports.getUrlForRoute = void 0;
3
+ exports.getRoute = exports.reloadUrl = exports.clearUrl = exports.replaceUrl = exports.pushUrl = exports.getUrlForRoute = exports.getNavigationWindow = void 0;
4
4
  const getUrlHandlingType = () => {
5
5
  if (window.remotion_isReadOnlyStudio || window.remotion_browserStudio) {
6
6
  return 'query-string';
7
7
  }
8
8
  return 'spa';
9
9
  };
10
+ const getNavigationWindow = () => {
11
+ if (window.remotion_browserStudio && window.parent !== window) {
12
+ return window.parent;
13
+ }
14
+ return window;
15
+ };
16
+ exports.getNavigationWindow = getNavigationWindow;
10
17
  const getUrlForRoute = (route) => {
11
18
  if (getUrlHandlingType() === 'query-string') {
12
- return `${window.location.pathname}?${route}`;
19
+ return `${(0, exports.getNavigationWindow)().location.pathname}?${route}`;
13
20
  }
14
21
  return route;
15
22
  };
16
23
  exports.getUrlForRoute = getUrlForRoute;
17
24
  const pushUrl = (url) => {
18
- window.history.pushState({}, 'Studio', (0, exports.getUrlForRoute)(url));
25
+ (0, exports.getNavigationWindow)().history.pushState({}, 'Studio', (0, exports.getUrlForRoute)(url));
19
26
  };
20
27
  exports.pushUrl = pushUrl;
21
28
  const replaceUrl = (url) => {
22
- window.history.replaceState({}, 'Studio', (0, exports.getUrlForRoute)(url));
29
+ (0, exports.getNavigationWindow)().history.replaceState({}, 'Studio', (0, exports.getUrlForRoute)(url));
23
30
  };
24
31
  exports.replaceUrl = replaceUrl;
25
32
  const clearUrl = () => {
@@ -32,7 +39,7 @@ const reloadUrl = () => {
32
39
  exports.reloadUrl = reloadUrl;
33
40
  const getRoute = () => {
34
41
  if (getUrlHandlingType() === 'query-string') {
35
- const route = window.location.search.substring(1);
42
+ const route = (0, exports.getNavigationWindow)().location.search.substring(1);
36
43
  return route.startsWith('/') ? route : '';
37
44
  }
38
45
  return window.location.pathname;
@@ -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;