@remotion/studio 4.0.100 → 4.0.102

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @remotion/studio@4.0.99 build /Users/jonathanburger/remotion/packages/studio
2
+ > @remotion/studio@4.0.101 build /Users/jonathanburger/remotion/packages/studio
3
3
  > tsc -d
4
4
 
@@ -1,5 +1,7 @@
1
+ import type { Size } from '@remotion/player';
1
2
  import React from 'react';
2
3
  import type { CanvasContent } from 'remotion';
3
4
  export declare const Canvas: React.FC<{
4
5
  canvasContent: CanvasContent;
6
+ size: Size;
5
7
  }>;
@@ -36,7 +36,7 @@ const resetZoom = {
36
36
  right: layout_1.SPACING_UNIT * 2,
37
37
  };
38
38
  const ZOOM_PX_FACTOR = 0.003;
39
- const Canvas = ({ canvasContent }) => {
39
+ const Canvas = ({ canvasContent, size }) => {
40
40
  const { setSize, size: previewSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
41
41
  const { editorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
42
42
  const keybindings = (0, use_keybinding_1.useKeybinding)();
@@ -55,10 +55,6 @@ const Canvas = ({ canvasContent }) => {
55
55
  }
56
56
  return null;
57
57
  }, [assetResolution, config, canvasContent]);
58
- const size = player_1.PlayerInternals.useElementSize(canvas_ref_1.canvasRef, {
59
- triggerOnWindowResize: false,
60
- shouldApplyCssTransforms: true,
61
- });
62
58
  const isFit = previewSize.size === 'auto';
63
59
  const onWheel = (0, react_1.useCallback)((e) => {
64
60
  if (!editorZoomGestures) {
@@ -1,2 +1,5 @@
1
+ import type { Size } from '@remotion/player';
1
2
  import React from 'react';
2
- export declare const CanvasOrLoading: React.FC;
3
+ export declare const CanvasOrLoading: React.FC<{
4
+ size: Size;
5
+ }>;
@@ -24,7 +24,7 @@ const container = {
24
24
  backgroundColor: colors_1.BACKGROUND,
25
25
  flexDirection: 'column',
26
26
  };
27
- const CanvasOrLoading = () => {
27
+ const CanvasOrLoading = ({ size }) => {
28
28
  const resolved = remotion_1.Internals.useResolvedVideoConfig(null);
29
29
  const [takesALongTime, setTakesALongTime] = (0, react_1.useState)(false);
30
30
  const { setZoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
@@ -60,7 +60,7 @@ const CanvasOrLoading = () => {
60
60
  if (!canvasContent) {
61
61
  return null;
62
62
  }
63
- const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ZoomPersistor_1.ZoomPersistor, {}), (0, jsx_runtime_1.jsx)(Canvas_1.Canvas, { canvasContent: canvasContent })] }));
63
+ const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ZoomPersistor_1.ZoomPersistor, {}), (0, jsx_runtime_1.jsx)(Canvas_1.Canvas, { size: size, canvasContent: canvasContent })] }));
64
64
  if (canvasContent.type === 'asset' || canvasContent.type === 'output') {
65
65
  return content;
66
66
  }
@@ -1,8 +1,31 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.Editor = void 0;
4
27
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
28
+ const react_1 = __importStar(require("react"));
6
29
  const remotion_1 = require("remotion");
7
30
  const colors_1 = require("../helpers/colors");
8
31
  const noop_1 = require("../helpers/noop");
@@ -35,6 +58,10 @@ const Editor = ({ Root, readOnlyStudio, }) => {
35
58
  window.removeEventListener('beforeunload', listenToChanges);
36
59
  };
37
60
  }, [readOnlyStudio]);
38
- return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: noop_1.noop, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsxs)(timeline_zoom_1.TimelineZoomContext, { children: [(0, jsx_runtime_1.jsxs)("div", { style: background, children: [(0, jsx_runtime_1.jsx)(Root, {}), (0, jsx_runtime_1.jsxs)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: [(0, jsx_runtime_1.jsx)(EditorContent_1.EditorContent, { readOnlyStudio: readOnlyStudio }), (0, jsx_runtime_1.jsx)(GlobalKeybindings_1.GlobalKeybindings, {})] }), (0, jsx_runtime_1.jsx)(NotificationCenter_1.NotificationCenter, {})] }), (0, jsx_runtime_1.jsx)(Modals_1.Modals, { readOnlyStudio: readOnlyStudio })] }) }));
61
+ const [canvasMounted, setCanvasMounted] = react_1.default.useState(false);
62
+ const onMounted = (0, react_1.useCallback)(() => {
63
+ setCanvasMounted(true);
64
+ }, []);
65
+ return ((0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onEscape: noop_1.noop, onOutsideClick: noop_1.noop, children: (0, jsx_runtime_1.jsxs)(timeline_zoom_1.TimelineZoomContext, { children: [(0, jsx_runtime_1.jsxs)("div", { style: background, children: [canvasMounted ? (0, jsx_runtime_1.jsx)(Root, {}) : null, (0, jsx_runtime_1.jsxs)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: [(0, jsx_runtime_1.jsx)(EditorContent_1.EditorContent, { onMounted: onMounted, readOnlyStudio: readOnlyStudio }), (0, jsx_runtime_1.jsx)(GlobalKeybindings_1.GlobalKeybindings, {})] }), (0, jsx_runtime_1.jsx)(NotificationCenter_1.NotificationCenter, {})] }), (0, jsx_runtime_1.jsx)(Modals_1.Modals, { readOnlyStudio: readOnlyStudio })] }) }));
39
66
  };
40
67
  exports.Editor = Editor;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  export declare const EditorContent: React.FC<{
3
3
  readOnlyStudio: boolean;
4
+ onMounted: () => void;
4
5
  }>;
@@ -19,11 +19,11 @@ const container = {
19
19
  flex: 1,
20
20
  height: 0,
21
21
  };
22
- const EditorContent = ({ readOnlyStudio }) => {
22
+ const EditorContent = ({ readOnlyStudio, onMounted }) => {
23
23
  const isStill = (0, is_current_selected_still_1.useIsStill)();
24
24
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
25
25
  // Preventing multiple renders so the update check doesn't get rendered twice and needs to be aborted
26
26
  const onlyTopPanel = canvasContent === null || isStill || canvasContent.type !== 'composition';
27
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(InitialCompositionLoader_1.InitialCompositionLoader, {}), (0, jsx_runtime_1.jsx)(MenuToolbar_1.MenuToolbar, { readOnlyStudio: readOnlyStudio }), onlyTopPanel ? ((0, jsx_runtime_1.jsx)(TopPanel_1.TopPanel, { readOnlyStudio: readOnlyStudio })) : ((0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { orientation: "horizontal", id: "top-to-bottom", maxFlex: 0.9, minFlex: 0.2, defaultFlex: 0.75, children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: (0, jsx_runtime_1.jsx)(TopPanel_1.TopPanel, { readOnlyStudio: readOnlyStudio }) }), (0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "none", onCollapse: noop }), (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: (0, jsx_runtime_1.jsx)(Timeline_1.Timeline, {}) })] }))] }));
27
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(InitialCompositionLoader_1.InitialCompositionLoader, {}), (0, jsx_runtime_1.jsx)(MenuToolbar_1.MenuToolbar, { readOnlyStudio: readOnlyStudio }), onlyTopPanel ? ((0, jsx_runtime_1.jsx)(TopPanel_1.TopPanel, { onMounted: onMounted, readOnlyStudio: readOnlyStudio })) : ((0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { orientation: "horizontal", id: "top-to-bottom", maxFlex: 0.9, minFlex: 0.2, defaultFlex: 0.75, children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: (0, jsx_runtime_1.jsx)(TopPanel_1.TopPanel, { onMounted: onMounted, readOnlyStudio: readOnlyStudio }) }), (0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "none", onCollapse: noop }), (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: (0, jsx_runtime_1.jsx)(Timeline_1.Timeline, {}) })] }))] }));
28
28
  };
29
29
  exports.EditorContent = EditorContent;
@@ -1,3 +1,4 @@
1
+ import type { Size } from '@remotion/player';
1
2
  import React from 'react';
2
3
  interface Point {
3
4
  value: number;
@@ -8,9 +9,9 @@ interface RulerProps {
8
9
  points: Point[];
9
10
  originOffset: number;
10
11
  startMarking: number;
11
- containerRef: React.RefObject<HTMLDivElement>;
12
12
  markingGaps: number;
13
13
  orientation: 'horizontal' | 'vertical';
14
+ size: Size;
14
15
  }
15
16
  declare const Ruler: React.FC<RulerProps>;
16
17
  export default Ruler;
@@ -10,8 +10,7 @@ const editor_rulers_1 = require("../../state/editor-rulers");
10
10
  const makeGuideId = () => {
11
11
  return Math.random().toString(36).substring(7);
12
12
  };
13
- const Ruler = ({ scale, points, originOffset, startMarking, containerRef, markingGaps, orientation, }) => {
14
- var _a;
13
+ const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, orientation, }) => {
15
14
  const rulerCanvasRef = (0, react_1.useRef)(null);
16
15
  const isVerticalRuler = orientation === 'vertical';
17
16
  const { shouldCreateGuideRef, setGuidesList, selectedGuideId, hoveredGuideId, setSelectedGuideId, guidesList, setEditorShowGuides, } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
@@ -24,6 +23,8 @@ const Ruler = ({ scale, points, originOffset, startMarking, containerRef, markin
24
23
  var _a, _b;
25
24
  return ((_b = (_a = guidesList.find((guide) => guide.id === selectedGuideId)) !== null && _a !== void 0 ? _a : guidesList.find((guide) => guide.id === hoveredGuideId)) !== null && _b !== void 0 ? _b : null);
26
25
  }, [guidesList, hoveredGuideId, selectedGuideId]);
26
+ const rulerWidth = isVerticalRuler ? editor_rulers_1.RULER_WIDTH : size.width - editor_rulers_1.RULER_WIDTH;
27
+ const rulerHeight = isVerticalRuler ? size.height - editor_rulers_1.RULER_WIDTH : editor_rulers_1.RULER_WIDTH;
27
28
  (0, react_1.useEffect)(() => {
28
29
  (0, editor_ruler_1.drawMarkingOnRulerCanvas)({
29
30
  scale,
@@ -34,6 +35,8 @@ const Ruler = ({ scale, points, originOffset, startMarking, containerRef, markin
34
35
  orientation,
35
36
  rulerCanvasRef,
36
37
  selectedGuide: selectedOrHoveredGuide,
38
+ canvasHeight: rulerHeight * window.devicePixelRatio,
39
+ canvasWidth: rulerWidth * window.devicePixelRatio,
37
40
  });
38
41
  }, [
39
42
  scale,
@@ -43,15 +46,15 @@ const Ruler = ({ scale, points, originOffset, startMarking, containerRef, markin
43
46
  markingGaps,
44
47
  orientation,
45
48
  selectedOrHoveredGuide,
49
+ size,
50
+ rulerHeight,
51
+ rulerWidth,
46
52
  ]);
47
- const { width: canvasContainerWidth, height: canvasContainerHeight } = ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || { width: 0, height: 0 };
48
- const rulerWidth = isVerticalRuler ? editor_rulers_1.RULER_WIDTH : canvasContainerWidth;
49
- const rulerHeight = isVerticalRuler ? canvasContainerHeight : editor_rulers_1.RULER_WIDTH;
50
53
  const rulerStyle = (0, react_1.useMemo)(() => ({
51
54
  position: 'absolute',
52
55
  background: colors_1.BACKGROUND,
53
- width: `${rulerWidth}px`,
54
- height: `${rulerHeight}px`,
56
+ width: rulerWidth,
57
+ height: rulerHeight,
55
58
  left: isVerticalRuler ? 0 : 'unset',
56
59
  top: isVerticalRuler ? 'unset' : 0,
57
60
  borderBottom: isVerticalRuler ? undefined : '1px solid ' + colors_1.RULER_COLOR,
@@ -100,6 +103,6 @@ const Ruler = ({ scale, points, originOffset, startMarking, containerRef, markin
100
103
  setCursor(isVerticalRuler ? 'ew-resize' : 'ns-resize');
101
104
  }
102
105
  }, [selectedGuideId, isVerticalRuler]);
103
- return ((0, jsx_runtime_1.jsx)("canvas", { ref: rulerCanvasRef, width: rulerWidth * devicePixelRatio, height: rulerHeight * devicePixelRatio, style: rulerStyle, onPointerDown: onMouseDown, onPointerEnter: changeCursor, onPointerLeave: changeCursor }));
106
+ return ((0, jsx_runtime_1.jsx)("canvas", { ref: rulerCanvasRef, width: rulerWidth * window.devicePixelRatio, height: rulerHeight * window.devicePixelRatio, style: rulerStyle, onPointerDown: onMouseDown, onPointerEnter: changeCursor, onPointerLeave: changeCursor }));
104
107
  };
105
108
  exports.default = Ruler;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import type { AssetMetadata } from '../../helpers/get-asset-metadata';
4
4
  import type { Dimensions } from '../../helpers/is-current-selected-still';
5
5
  export declare const EditorRulers: React.FC<{
6
- canvasSize: Size | null;
6
+ canvasSize: Size;
7
7
  contentDimensions: Dimensions | 'none' | null;
8
8
  assetMetadata: AssetMetadata | null;
9
9
  containerRef: React.RefObject<HTMLDivElement>;
@@ -23,7 +23,7 @@ const originBlockStyles = {
23
23
  background: colors_1.BACKGROUND,
24
24
  };
25
25
  const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerRef }) => {
26
- const { scale, canvasDimensions } = (0, use_studio_canvas_dimensions_1.useStudioCanvasDimensions)({
26
+ const { scale } = (0, use_studio_canvas_dimensions_1.useStudioCanvasDimensions)({
27
27
  canvasSize,
28
28
  contentDimensions,
29
29
  assetMetadata,
@@ -35,15 +35,15 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
35
35
  return predefinedGap || editor_rulers_1.MAXIMUM_PREDEFINED_RULER_SCALE_GAP;
36
36
  }, [scale]);
37
37
  const horizontalRulerScaleRange = (0, react_1.useMemo)(() => (0, editor_ruler_1.getRulerScaleRange)({
38
- canvasLength: canvasDimensions.width,
39
- containerRef,
38
+ canvasLength: canvasSize.width,
40
39
  scale,
41
- }), [canvasDimensions.width, containerRef, scale]);
40
+ canvasSize,
41
+ }), [canvasSize, scale]);
42
42
  const verticalRulerScaleRange = (0, react_1.useMemo)(() => (0, editor_ruler_1.getRulerScaleRange)({
43
- canvasLength: canvasDimensions.height,
44
- containerRef,
43
+ canvasLength: canvasSize.height,
45
44
  scale,
46
- }), [canvasDimensions.height, containerRef, scale]);
45
+ canvasSize,
46
+ }), [canvasSize, scale]);
47
47
  const { points: horizontalRulerPoints, startMarking: horizontalRulerStartMarking, } = (0, react_1.useMemo)(() => (0, editor_ruler_1.getRulerPoints)({
48
48
  rulerScaleRange: horizontalRulerScaleRange,
49
49
  rulerMarkingGaps,
@@ -98,10 +98,8 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
98
98
  return guide;
99
99
  }
100
100
  const position = guide.orientation === 'vertical'
101
- ? (mouseX - containerLeft) / scale -
102
- canvasDimensions.left / scale
103
- : (mouseY - containerTop) / scale -
104
- canvasDimensions.top / scale;
101
+ ? (mouseX - containerLeft) / scale - canvasSize.left / scale
102
+ : (mouseY - containerTop) / scale - canvasSize.top / scale;
105
103
  const desiredCursor = guide.orientation === 'vertical' ? 'ew-resize' : 'ns-resize';
106
104
  if (document.body.style.cursor !== desiredCursor) {
107
105
  document.body.style.cursor = desiredCursor;
@@ -118,11 +116,11 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
118
116
  }, [
119
117
  containerRef,
120
118
  shouldDeleteGuideRef,
119
+ setGuidesList,
121
120
  selectedGuideId,
122
121
  scale,
123
- setGuidesList,
124
- canvasDimensions.left,
125
- canvasDimensions.top,
122
+ canvasSize.left,
123
+ canvasSize.top,
126
124
  ]);
127
125
  const onMouseUp = (0, react_1.useCallback)(() => {
128
126
  setGuidesList((prevState) => {
@@ -162,6 +160,6 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
162
160
  }
163
161
  };
164
162
  }, [selectedGuideId, onMouseMove, onMouseUp]);
165
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: originBlockStyles }), (0, jsx_runtime_1.jsx)(Ruler_1.default, { orientation: "horizontal", scale: scale, points: horizontalRulerPoints, startMarking: horizontalRulerStartMarking, containerRef: containerRef, markingGaps: rulerMarkingGaps, originOffset: canvasDimensions.left }), (0, jsx_runtime_1.jsx)(Ruler_1.default, { orientation: "vertical", scale: scale, points: verticalRulerPoints, startMarking: verticalRulerStartMarking, containerRef: containerRef, markingGaps: rulerMarkingGaps, originOffset: canvasDimensions.top })] }));
163
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: originBlockStyles }), (0, jsx_runtime_1.jsx)(Ruler_1.default, { orientation: "horizontal", scale: scale, points: horizontalRulerPoints, startMarking: horizontalRulerStartMarking, markingGaps: rulerMarkingGaps, originOffset: canvasSize.left, size: canvasSize }), (0, jsx_runtime_1.jsx)(Ruler_1.default, { orientation: "vertical", scale: scale, points: verticalRulerPoints, startMarking: verticalRulerStartMarking, markingGaps: rulerMarkingGaps, originOffset: canvasSize.top, size: canvasSize })] }));
166
164
  };
167
165
  exports.EditorRulers = EditorRulers;
@@ -12,6 +12,6 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
12
12
  status: 'error' | 'warning' | 'ok';
13
13
  isFocused: boolean;
14
14
  isHovered: boolean;
15
- }) => "#ff3232" | "hsla(0, 0%, 100%, 0.15)" | "#f1c40f" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)";
15
+ }) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#ff3232" | "#f1c40f";
16
16
  export declare const RemotionInput: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
17
17
  export {};
@@ -2,4 +2,5 @@ import React from 'react';
2
2
  export declare const useResponsiveSidebarStatus: () => 'collapsed' | 'expanded';
3
3
  export declare const TopPanel: React.FC<{
4
4
  readOnlyStudio: boolean;
5
+ onMounted: () => void;
5
6
  }>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TopPanel = exports.useResponsiveSidebarStatus = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const player_1 = require("@remotion/player");
5
6
  const react_1 = require("react");
6
7
  const use_breakpoint_1 = require("../helpers/use-breakpoint");
7
8
  const editor_rulers_1 = require("../state/editor-rulers");
@@ -43,9 +44,10 @@ const useResponsiveSidebarStatus = () => {
43
44
  return actualStateLeft;
44
45
  };
45
46
  exports.useResponsiveSidebarStatus = useResponsiveSidebarStatus;
46
- const TopPanel = ({ readOnlyStudio }) => {
47
+ const TopPanel = ({ readOnlyStudio, onMounted }) => {
47
48
  const { setSidebarCollapsedState, sidebarCollapsedStateRight } = (0, react_1.useContext)(sidebar_1.SidebarContext);
48
49
  const rulersAreVisible = (0, use_is_ruler_visible_1.useIsRulerVisible)();
50
+ const ref = (0, react_1.useRef)(null);
49
51
  const actualStateLeft = (0, exports.useResponsiveSidebarStatus)();
50
52
  const actualStateRight = (0, react_1.useMemo)(() => {
51
53
  if (sidebarCollapsedStateRight === 'collapsed') {
@@ -53,6 +55,14 @@ const TopPanel = ({ readOnlyStudio }) => {
53
55
  }
54
56
  return 'expanded';
55
57
  }, [sidebarCollapsedStateRight]);
58
+ const size = player_1.PlayerInternals.useElementSize(ref, {
59
+ triggerOnWindowResize: false,
60
+ shouldApplyCssTransforms: true,
61
+ });
62
+ const hasSize = size !== null;
63
+ (0, react_1.useEffect)(() => {
64
+ onMounted();
65
+ }, [hasSize, onMounted]);
56
66
  const canvasContainerStyle = (0, react_1.useMemo)(() => ({
57
67
  flex: 1,
58
68
  display: 'flex',
@@ -65,6 +75,6 @@ const TopPanel = ({ readOnlyStudio }) => {
65
75
  const onCollapseRight = (0, react_1.useCallback)(() => {
66
76
  setSidebarCollapsedState({ left: null, right: 'collapsed' });
67
77
  }, [setSidebarCollapsedState]);
68
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("div", { style: row, children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: (0, jsx_runtime_1.jsx)(ExplorerPanel_1.ExplorerPanel, {}) })) : null, actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, id: "canvas-to-right-sidebar", orientation: "vertical", children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: (0, jsx_runtime_1.jsx)("div", { style: canvasContainerStyle, children: (0, jsx_runtime_1.jsx)(CanvasOrLoading_1.CanvasOrLoading, {}) }) }), actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: (0, jsx_runtime_1.jsx)(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) })) : null] }) })] }) }), (0, jsx_runtime_1.jsx)(PreviewToolbar_1.PreviewToolbar, { readOnlyStudio: readOnlyStudio }), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.CurrentCompositionKeybindings, { readOnlyStudio: readOnlyStudio }), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.TitleUpdater, {})] }));
78
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("div", { style: row, children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: (0, jsx_runtime_1.jsx)(ExplorerPanel_1.ExplorerPanel, {}) })) : null, actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, id: "canvas-to-right-sidebar", orientation: "vertical", children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: (0, jsx_runtime_1.jsx)("div", { ref: ref, style: canvasContainerStyle, children: size ? (0, jsx_runtime_1.jsx)(CanvasOrLoading_1.CanvasOrLoading, { size: size }) : null }) }), actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: (0, jsx_runtime_1.jsx)(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) })) : null] }) })] }) }), (0, jsx_runtime_1.jsx)(PreviewToolbar_1.PreviewToolbar, { readOnlyStudio: readOnlyStudio }), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.CurrentCompositionKeybindings, { readOnlyStudio: readOnlyStudio }), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.TitleUpdater, {})] }));
69
79
  };
70
80
  exports.TopPanel = TopPanel;
@@ -1,4 +1,4 @@
1
1
  export declare const getCheckerboardBackgroundSize: (size: number) => string;
2
2
  export declare const getCheckerboardBackgroundPos: (size: number) => string;
3
- export declare const checkerboardBackgroundColor: (checkerboard: boolean) => "white" | "black";
3
+ export declare const checkerboardBackgroundColor: (checkerboard: boolean) => "black" | "white";
4
4
  export declare const checkerboardBackgroundImage: (checkerboard: boolean) => "\n linear-gradient(\n 45deg,\n rgba(0, 0, 0, 0.1) 25%,\n transparent 25%\n ),\n linear-gradient(135deg, rgba(0, 0, 0, 0.1) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.1) 75%),\n linear-gradient(135deg, transparent 75%, rgba(0, 0, 0, 0.1) 75%)\n " | undefined;
@@ -23,4 +23,4 @@ export declare const TIMELINE_TRACK_SEPARATOR = "rgba(0, 0, 0, 0.3)";
23
23
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
24
24
  selected: boolean;
25
25
  hovered: boolean;
26
- }) => "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)" | "transparent";
26
+ }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
@@ -1,5 +1,6 @@
1
+ import type { Size } from '@remotion/player';
1
2
  import type { Guide } from '../state/editor-guides';
2
- export declare const drawMarkingOnRulerCanvas: ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, selectedGuide, }: {
3
+ export declare const drawMarkingOnRulerCanvas: ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, selectedGuide, canvasHeight, canvasWidth, }: {
3
4
  scale: number;
4
5
  points: Array<{
5
6
  position: number;
@@ -11,6 +12,8 @@ export declare const drawMarkingOnRulerCanvas: ({ scale, points, startMarking, o
11
12
  orientation: 'horizontal' | 'vertical';
12
13
  rulerCanvasRef: React.RefObject<HTMLCanvasElement>;
13
14
  selectedGuide: Guide | null;
15
+ canvasWidth: number;
16
+ canvasHeight: number;
14
17
  }) => void;
15
18
  export declare const getRulerPoints: ({ rulerScaleRange, rulerMarkingGaps, scale, }: {
16
19
  rulerScaleRange: {
@@ -26,10 +29,10 @@ export declare const getRulerPoints: ({ rulerScaleRange, rulerMarkingGaps, scale
26
29
  }[];
27
30
  startMarking: number;
28
31
  };
29
- export declare const getRulerScaleRange: ({ canvasLength, containerRef, scale, }: {
32
+ export declare const getRulerScaleRange: ({ canvasLength, scale, canvasSize, }: {
30
33
  canvasLength: number;
31
- containerRef: React.RefObject<HTMLDivElement>;
32
34
  scale: number;
35
+ canvasSize: Size;
33
36
  }) => {
34
37
  start: number;
35
38
  end: number;
@@ -79,15 +79,13 @@ const drawGuide = ({ selectedGuide, scale, startMarking, context, canvasHeight,
79
79
  }
80
80
  context.stroke();
81
81
  };
82
- const drawMarkingOnRulerCanvas = ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, selectedGuide, }) => {
82
+ const drawMarkingOnRulerCanvas = ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, selectedGuide, canvasHeight, canvasWidth, }) => {
83
83
  const canvas = rulerCanvasRef.current;
84
84
  if (!canvas)
85
85
  return;
86
86
  const context = canvas.getContext('2d');
87
87
  if (!context)
88
88
  return;
89
- const canvasWidth = canvas.clientWidth * window.devicePixelRatio;
90
- const canvasHeight = canvas.clientHeight * window.devicePixelRatio;
91
89
  canvas.width = canvasWidth;
92
90
  canvas.height = canvasHeight;
93
91
  context.scale(window.devicePixelRatio, window.devicePixelRatio);
@@ -169,9 +167,8 @@ exports.getRulerPoints = getRulerPoints;
169
167
  const rulerValueToPosition = ({ value, startMarking, scale, }) => {
170
168
  return (value + startMarking) * scale;
171
169
  };
172
- const getRulerScaleRange = ({ canvasLength, containerRef, scale, }) => {
173
- var _a, _b;
174
- const scaleRangeBeyondCanvas = (((_b = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) ||
170
+ const getRulerScaleRange = ({ canvasLength, scale, canvasSize, }) => {
171
+ const scaleRangeBeyondCanvas = (canvasSize.width ||
175
172
  editor_rulers_1.MINIMUM_VISIBLE_CANVAS_SIZE - editor_rulers_1.MINIMUM_VISIBLE_CANVAS_SIZE) / scale;
176
173
  return {
177
174
  start: -scaleRangeBeyondCanvas,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { Codec } from '@remotion/renderer';
2
3
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
3
4
  type Section = 'general' | 'picture' | 'advanced' | 'data' | 'gif' | 'audio';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/studio",
3
- "version": "4.0.100",
3
+ "version": "4.0.102",
4
4
  "description": "Remotion Editor",
5
5
  "main": "dist",
6
6
  "sideEffects": false,
@@ -18,11 +18,11 @@
18
18
  "memfs": "3.4.3",
19
19
  "source-map": "0.7.3",
20
20
  "open": "^8.4.2",
21
- "remotion": "4.0.100",
22
- "@remotion/player": "4.0.100",
23
- "@remotion/media-utils": "4.0.100",
24
- "@remotion/renderer": "4.0.100",
25
- "@remotion/studio-shared": "4.0.100"
21
+ "remotion": "4.0.102",
22
+ "@remotion/player": "4.0.102",
23
+ "@remotion/renderer": "4.0.102",
24
+ "@remotion/media-utils": "4.0.102",
25
+ "@remotion/studio-shared": "4.0.102"
26
26
  },
27
27
  "devDependencies": {
28
28
  "react": "18.2.0",
@@ -40,7 +40,7 @@
40
40
  "prettier-plugin-organize-imports": "3.2.4",
41
41
  "vitest": "0.31.1",
42
42
  "zod": "^3.22.3",
43
- "@remotion/zod-types": "4.0.100"
43
+ "@remotion/zod-types": "4.0.102"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"