@remotion/cli 4.0.63 → 4.0.66

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 (63) hide show
  1. package/dist/better-opn/index.d.ts +2 -0
  2. package/dist/config/image-format.d.ts +1 -1
  3. package/dist/config/index.d.ts +2 -2
  4. package/dist/editor/components/AudioWaveform.js +2 -2
  5. package/dist/editor/components/Canvas.js +10 -1
  6. package/dist/editor/components/CompositionSelectorItem.js +42 -1
  7. package/dist/editor/components/ContextMenu.d.ts +6 -0
  8. package/dist/editor/components/ContextMenu.js +91 -0
  9. package/dist/editor/components/CurrentComposition.d.ts +1 -0
  10. package/dist/editor/components/EditorContexts.js +3 -1
  11. package/dist/editor/components/EditorGuides/Guide.d.ts +13 -0
  12. package/dist/editor/components/EditorGuides/Guide.js +91 -0
  13. package/dist/editor/components/EditorGuides/index.d.ts +10 -0
  14. package/dist/editor/components/EditorGuides/index.js +32 -0
  15. package/dist/editor/components/EditorRuler/Ruler.d.ts +1 -0
  16. package/dist/editor/components/EditorRuler/Ruler.js +81 -16
  17. package/dist/editor/components/EditorRuler/index.js +117 -48
  18. package/dist/editor/components/EditorRuler/use-is-ruler-visible.d.ts +1 -0
  19. package/dist/editor/components/EditorRuler/use-is-ruler-visible.js +12 -0
  20. package/dist/editor/components/Menu/MenuItem.js +6 -3
  21. package/dist/editor/components/Menu/MenuSubItem.d.ts +2 -1
  22. package/dist/editor/components/Menu/MenuSubItem.js +2 -2
  23. package/dist/editor/components/NewComposition/ComboBox.d.ts +1 -1
  24. package/dist/editor/components/NewComposition/CopyHint.js +1 -0
  25. package/dist/editor/components/NewComposition/InputDragger.js +4 -1
  26. package/dist/editor/components/NewComposition/MenuContent.js +3 -3
  27. package/dist/editor/components/NewComposition/NewCompCode.d.ts +1 -0
  28. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  29. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  30. package/dist/editor/components/OpenEditorButton.js +1 -0
  31. package/dist/editor/components/RenderModal/DataEditor.js +1 -0
  32. package/dist/editor/components/RenderModal/RenderStatusModal.js +0 -2
  33. package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
  34. package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +0 -1
  35. package/dist/editor/components/ShowGuidesProvider.js +20 -1
  36. package/dist/editor/components/Splitter/SplitterHandle.js +3 -0
  37. package/dist/editor/components/Timeline/TimelineDragHandler.js +85 -5
  38. package/dist/editor/components/Timeline/TimelineInOutPointerHandle.js +2 -1
  39. package/dist/editor/components/Timeline/TimelineVideoInfo.js +1 -0
  40. package/dist/editor/components/TopPanel.js +10 -5
  41. package/dist/editor/components/UpdateCheck.d.ts +1 -0
  42. package/dist/editor/components/UpdateCheck.js +2 -0
  43. package/dist/editor/helpers/colors.d.ts +6 -1
  44. package/dist/editor/helpers/colors.js +7 -2
  45. package/dist/editor/helpers/convert-env-variables.d.ts +2 -8
  46. package/dist/editor/helpers/create-folder-tree.js +1 -0
  47. package/dist/editor/helpers/editor-ruler.d.ts +20 -1
  48. package/dist/editor/helpers/editor-ruler.js +119 -20
  49. package/dist/editor/helpers/presets-labels.d.ts +1 -1
  50. package/dist/editor/helpers/render-modal-sections.d.ts +1 -0
  51. package/dist/editor/helpers/use-keybinding.js +1 -0
  52. package/dist/editor/helpers/use-menu-structure.js +42 -1
  53. package/dist/editor/helpers/use-studio-canvas-dimensions.d.ts +16 -0
  54. package/dist/editor/helpers/use-studio-canvas-dimensions.js +59 -0
  55. package/dist/editor/icons/Checkmark.d.ts +1 -0
  56. package/dist/editor/state/editor-guides.d.ts +19 -3
  57. package/dist/editor/state/editor-guides.js +19 -2
  58. package/dist/get-cli-options.d.ts +2 -2
  59. package/dist/index.d.ts +7 -7
  60. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  61. package/dist/preview-server/public-folder.js +1 -1
  62. package/dist/preview-server/routes.d.ts +1 -0
  63. package/package.json +8 -8
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { PackageManager } from '../../preview-server/get-package-manager';
2
3
  export type UpdateInfo = {
3
4
  currentVersion: string;
@@ -37,6 +37,7 @@ const UpdateCheck = () => {
37
37
  if (err.message.includes('aborted')) {
38
38
  return;
39
39
  }
40
+ // eslint-disable-next-line no-console
40
41
  console.log('Could not check for updates', err);
41
42
  });
42
43
  return controller;
@@ -54,6 +55,7 @@ const UpdateCheck = () => {
54
55
  if (err.message.includes('aborted')) {
55
56
  return;
56
57
  }
58
+ // eslint-disable-next-line no-console
57
59
  console.log('Could not check for bugs in this version', err);
58
60
  });
59
61
  return controller;
@@ -1,9 +1,11 @@
1
- export declare const BACKGROUND = "#1f2428";
1
+ export declare const BACKGROUND = "rgb(31,36,40)";
2
+ export declare const BACKGROUND__TRANSPARENT = "rgba(31,36,40, 0)";
2
3
  export declare const INPUT_BACKGROUND = "#2f363d";
3
4
  export declare const BORDER_COLOR = "#000";
4
5
  export declare const LIGHT_COLOR = "#ddd";
5
6
  export declare const SELECTED_BACKGROUND = "hsla(0, 0%, 100%, 0.15)";
6
7
  export declare const LIGHT_TEXT = "#A6A7A9";
8
+ export declare const RULER_COLOR = "#808080";
7
9
  export declare const VERY_LIGHT_TEXT = "rgba(255, 255, 255, 0.3)";
8
10
  export declare const CLEAR_HOVER = "rgba(255, 255, 255, 0.06)";
9
11
  export declare const INPUT_BORDER_COLOR_UNHOVERED = "rgba(0, 0, 0, 0.6)";
@@ -13,6 +15,9 @@ export declare const FAIL_COLOR = "#ff3232";
13
15
  export declare const WARNING_COLOR = "#f1c40f";
14
16
  export declare const BLUE = "#0b84f3";
15
17
  export declare const BLUE_DISABLED = "#284f73";
18
+ export declare const LIGHT_TRANSPARENT = "rgba(255, 255, 255, 0.7)";
19
+ export declare const UNSELECTED_GUIDE = "#7e1219";
20
+ export declare const SELECTED_GUIDE = "#d22d3a";
16
21
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
17
22
  selected: boolean;
18
23
  hovered: boolean;
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBackgroundFromHoverState = exports.BLUE_DISABLED = exports.BLUE = exports.WARNING_COLOR = exports.FAIL_COLOR = exports.TIMELINE_BACKGROUND = exports.INPUT_BORDER_COLOR_HOVERED = exports.INPUT_BORDER_COLOR_UNHOVERED = exports.CLEAR_HOVER = exports.VERY_LIGHT_TEXT = exports.LIGHT_TEXT = exports.SELECTED_BACKGROUND = exports.LIGHT_COLOR = exports.BORDER_COLOR = exports.INPUT_BACKGROUND = exports.BACKGROUND = void 0;
4
- exports.BACKGROUND = '#1f2428';
3
+ exports.getBackgroundFromHoverState = exports.SELECTED_GUIDE = exports.UNSELECTED_GUIDE = exports.LIGHT_TRANSPARENT = exports.BLUE_DISABLED = exports.BLUE = exports.WARNING_COLOR = exports.FAIL_COLOR = exports.TIMELINE_BACKGROUND = exports.INPUT_BORDER_COLOR_HOVERED = exports.INPUT_BORDER_COLOR_UNHOVERED = exports.CLEAR_HOVER = exports.VERY_LIGHT_TEXT = exports.RULER_COLOR = exports.LIGHT_TEXT = exports.SELECTED_BACKGROUND = exports.LIGHT_COLOR = exports.BORDER_COLOR = exports.INPUT_BACKGROUND = exports.BACKGROUND__TRANSPARENT = exports.BACKGROUND = void 0;
4
+ exports.BACKGROUND = 'rgb(31,36,40)';
5
+ exports.BACKGROUND__TRANSPARENT = 'rgba(31,36,40, 0)';
5
6
  exports.INPUT_BACKGROUND = '#2f363d';
6
7
  exports.BORDER_COLOR = '#000';
7
8
  exports.LIGHT_COLOR = '#ddd';
8
9
  exports.SELECTED_BACKGROUND = 'hsla(0, 0%, 100%, 0.15)';
9
10
  exports.LIGHT_TEXT = '#A6A7A9';
11
+ exports.RULER_COLOR = '#808080';
10
12
  exports.VERY_LIGHT_TEXT = 'rgba(255, 255, 255, 0.3)';
11
13
  const SELECTED_HOVER_BACKGROUND = 'hsla(0, 0%, 100%, 0.25)';
12
14
  exports.CLEAR_HOVER = 'rgba(255, 255, 255, 0.06)';
@@ -17,6 +19,9 @@ exports.FAIL_COLOR = '#ff3232';
17
19
  exports.WARNING_COLOR = '#f1c40f';
18
20
  exports.BLUE = '#0b84f3';
19
21
  exports.BLUE_DISABLED = '#284f73';
22
+ exports.LIGHT_TRANSPARENT = 'rgba(255, 255, 255, 0.7)';
23
+ exports.UNSELECTED_GUIDE = '#7e1219';
24
+ exports.SELECTED_GUIDE = '#d22d3a';
20
25
  const getBackgroundFromHoverState = ({ selected, hovered, }) => {
21
26
  if (selected) {
22
27
  if (hovered) {
@@ -1,8 +1,2 @@
1
- export declare const envVariablesObjectToArray: (envVariables: Record<string, string>) => [
2
- string,
3
- string
4
- ][];
5
- export declare const envVariablesArrayToObject: (envVariables: [
6
- string,
7
- string
8
- ][]) => Record<string, string>;
1
+ export declare const envVariablesObjectToArray: (envVariables: Record<string, string>) => [string, string][];
2
+ export declare const envVariablesArrayToObject: (envVariables: [string, string][]) => Record<string, string>;
@@ -72,6 +72,7 @@ const findItemListToPush = (items, folderName, parentName) => {
72
72
  }
73
73
  const folder = doesFolderExist(items, folderName, parentName);
74
74
  if (!folder) {
75
+ // eslint-disable-next-line no-console
75
76
  console.log({ items, folderName, parentName });
76
77
  throw new Error('did not find folder ' + folderName);
77
78
  }
@@ -1,4 +1,16 @@
1
- export declare const drawMarkingOnRulerCanvas: ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, }: {
1
+ import type { Guide } from '../state/editor-guides';
2
+ type Orientation = 'horizontal' | 'vertical';
3
+ export declare const drawGuide: ({ selectedGuide, scale, startMarking, context, canvasHeight, canvasWidth, orientation, originOffset, }: {
4
+ selectedGuide: Guide;
5
+ scale: number;
6
+ startMarking: number;
7
+ context: CanvasRenderingContext2D;
8
+ canvasHeight: number;
9
+ canvasWidth: number;
10
+ orientation: Orientation;
11
+ originOffset: number;
12
+ }) => void;
13
+ export declare const drawMarkingOnRulerCanvas: ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, selectedGuide, }: {
2
14
  scale: number;
3
15
  points: Array<{
4
16
  position: number;
@@ -9,6 +21,7 @@ export declare const drawMarkingOnRulerCanvas: ({ scale, points, startMarking, o
9
21
  markingGaps: number;
10
22
  orientation: 'horizontal' | 'vertical';
11
23
  rulerCanvasRef: React.RefObject<HTMLCanvasElement>;
24
+ selectedGuide: Guide | null;
12
25
  }) => void;
13
26
  export declare const getRulerPoints: ({ rulerScaleRange, rulerMarkingGaps, scale, }: {
14
27
  rulerScaleRange: {
@@ -24,6 +37,11 @@ export declare const getRulerPoints: ({ rulerScaleRange, rulerMarkingGaps, scale
24
37
  }[];
25
38
  startMarking: number;
26
39
  };
40
+ export declare const rulerValueToPosition: ({ value, startMarking, scale, }: {
41
+ value: number;
42
+ startMarking: number;
43
+ scale: number;
44
+ }) => number;
27
45
  export declare const getRulerScaleRange: ({ canvasLength, containerRef, scale, }: {
28
46
  canvasLength: number;
29
47
  containerRef: React.RefObject<HTMLDivElement>;
@@ -32,3 +50,4 @@ export declare const getRulerScaleRange: ({ canvasLength, containerRef, scale, }
32
50
  start: number;
33
51
  end: number;
34
52
  };
53
+ export {};
@@ -1,8 +1,86 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRulerScaleRange = exports.getRulerPoints = exports.drawMarkingOnRulerCanvas = void 0;
3
+ exports.getRulerScaleRange = exports.rulerValueToPosition = exports.getRulerPoints = exports.drawMarkingOnRulerCanvas = exports.drawGuide = void 0;
4
4
  const editor_rulers_1 = require("../state/editor-rulers");
5
- const drawMarkingOnRulerCanvas = ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, }) => {
5
+ const colors_1 = require("./colors");
6
+ const drawLabel = ({ orientation, context, label, originDistance, color, }) => {
7
+ context.fillStyle = color;
8
+ if (orientation === 'horizontal') {
9
+ context.fillText(label, originDistance + 4, 16);
10
+ }
11
+ else {
12
+ context.rotate(-Math.PI / 2);
13
+ context.fillText(label, -originDistance + 4, 16);
14
+ context.rotate(Math.PI / 2);
15
+ }
16
+ };
17
+ const drawGradient = ({ orientation, context, originDistance, canvasHeight, canvasWidth, }) => {
18
+ const size = 250;
19
+ const startX = orientation === 'horizontal' ? originDistance - size / 2 : 0;
20
+ const startY = orientation === 'horizontal' ? 0 : originDistance - size / 2;
21
+ const endX = orientation === 'horizontal' ? originDistance + size / 2 : canvasWidth;
22
+ const endY = orientation === 'horizontal' ? canvasHeight : originDistance + size / 2;
23
+ const grd = context.createLinearGradient(startX, startY, endX, endY);
24
+ grd.addColorStop(0, colors_1.BACKGROUND__TRANSPARENT);
25
+ grd.addColorStop(0.25, colors_1.BACKGROUND);
26
+ grd.addColorStop(0.75, colors_1.BACKGROUND);
27
+ grd.addColorStop(1, colors_1.BACKGROUND__TRANSPARENT);
28
+ context.fillStyle = grd;
29
+ context.fillRect(startX, startY, endX - startX, endY - startY);
30
+ };
31
+ const drawGuide = ({ selectedGuide, scale, startMarking, context, canvasHeight, canvasWidth, orientation, originOffset, }) => {
32
+ const originDistance = (0, exports.rulerValueToPosition)({
33
+ value: selectedGuide.position,
34
+ startMarking,
35
+ scale,
36
+ }) +
37
+ originOffset -
38
+ startMarking * scale;
39
+ drawGradient({
40
+ canvasHeight,
41
+ context,
42
+ orientation,
43
+ originDistance,
44
+ canvasWidth,
45
+ });
46
+ context.strokeStyle = colors_1.SELECTED_GUIDE;
47
+ context.lineWidth = 1;
48
+ context.beginPath();
49
+ if (orientation === 'horizontal' &&
50
+ selectedGuide.orientation === 'horizontal') {
51
+ return;
52
+ }
53
+ if (orientation === 'vertical' && selectedGuide.orientation === 'vertical') {
54
+ return;
55
+ }
56
+ if (orientation === 'vertical' &&
57
+ selectedGuide.orientation === 'horizontal') {
58
+ context.moveTo(0, originDistance);
59
+ context.lineTo(canvasWidth, originDistance);
60
+ drawLabel({
61
+ context,
62
+ label: selectedGuide.position.toString(),
63
+ originDistance,
64
+ orientation,
65
+ color: colors_1.SELECTED_GUIDE,
66
+ });
67
+ }
68
+ else if (orientation === 'horizontal' &&
69
+ selectedGuide.orientation === 'vertical') {
70
+ context.moveTo(originDistance, 0);
71
+ context.lineTo(originDistance, canvasHeight);
72
+ drawLabel({
73
+ context,
74
+ label: selectedGuide.position.toString(),
75
+ originDistance,
76
+ orientation,
77
+ color: colors_1.SELECTED_GUIDE,
78
+ });
79
+ }
80
+ context.stroke();
81
+ };
82
+ exports.drawGuide = drawGuide;
83
+ const drawMarkingOnRulerCanvas = ({ scale, points, startMarking, originOffset, markingGaps, orientation, rulerCanvasRef, selectedGuide, }) => {
6
84
  const canvas = rulerCanvasRef.current;
7
85
  if (!canvas)
8
86
  return;
@@ -15,12 +93,12 @@ const drawMarkingOnRulerCanvas = ({ scale, points, startMarking, originOffset, m
15
93
  canvas.height = canvasHeight;
16
94
  context.scale(window.devicePixelRatio, window.devicePixelRatio);
17
95
  context.clearRect(0, 0, canvasWidth, canvasHeight);
18
- context.strokeStyle = '#dbe3e8';
96
+ context.strokeStyle = colors_1.RULER_COLOR;
19
97
  context.lineWidth = 1;
20
98
  context.beginPath();
21
- context.strokeStyle = '#dbe3e8';
22
- context.lineWidth = 1;
23
99
  points.forEach((point) => {
100
+ context.strokeStyle = colors_1.RULER_COLOR;
101
+ context.lineWidth = 1;
24
102
  const originDistance = point.position + originOffset - startMarking * scale;
25
103
  context.beginPath();
26
104
  if (orientation === 'horizontal') {
@@ -32,46 +110,67 @@ const drawMarkingOnRulerCanvas = ({ scale, points, startMarking, originOffset, m
32
110
  context.lineTo(canvasWidth, originDistance);
33
111
  }
34
112
  for (let i = 1; i < 5; i++) {
113
+ const markingOffsetXY = i * markingGaps * scale;
35
114
  if (orientation === 'horizontal') {
36
- context.moveTo(originDistance + (i * markingGaps * scale) / 5, 0);
37
- context.lineTo(originDistance + (i * markingGaps * scale) / 5, 4);
115
+ context.moveTo(originDistance + markingOffsetXY / 5, 0);
116
+ context.lineTo(originDistance + markingOffsetXY / 5, 4);
38
117
  }
39
118
  else {
40
- context.moveTo(0, originDistance + (i * markingGaps * scale) / 5);
41
- context.lineTo(4, originDistance + (i * markingGaps * scale) / 5);
119
+ context.moveTo(0, originDistance + markingOffsetXY / 5);
120
+ context.lineTo(4, originDistance + markingOffsetXY / 5);
42
121
  }
43
122
  }
44
123
  context.stroke();
45
124
  context.font = '10px Arial, Helvetica, sans-serif';
46
125
  context.textAlign = 'left';
47
- context.fillStyle = '#dbe3e8';
48
- if (orientation === 'horizontal') {
49
- context.fillText(point.value.toString().split('').join(String.fromCharCode(8202)), originDistance + 4, 16);
50
- }
51
- else {
52
- context.rotate(-Math.PI / 2);
53
- context.fillText(point.value.toString().split('').join(String.fromCharCode(8202)), -originDistance + 4, 16);
54
- context.rotate(Math.PI / 2);
55
- }
126
+ context.fillStyle = colors_1.RULER_COLOR;
127
+ drawLabel({
128
+ orientation,
129
+ context,
130
+ label: point.value.toString(),
131
+ originDistance,
132
+ color: colors_1.RULER_COLOR,
133
+ });
56
134
  });
135
+ if (selectedGuide && orientation !== selectedGuide.orientation) {
136
+ (0, exports.drawGuide)({
137
+ canvasHeight,
138
+ canvasWidth,
139
+ context,
140
+ orientation,
141
+ originOffset,
142
+ scale,
143
+ selectedGuide,
144
+ startMarking,
145
+ });
146
+ }
57
147
  };
58
148
  exports.drawMarkingOnRulerCanvas = drawMarkingOnRulerCanvas;
59
149
  const getRulerPoints = ({ rulerScaleRange, rulerMarkingGaps, scale, }) => {
60
150
  const points = [];
61
151
  const startPoint = Math.ceil(rulerScaleRange.start / rulerMarkingGaps);
62
152
  const endPoint = Math.floor(rulerScaleRange.end / rulerMarkingGaps);
153
+ const startMarking = startPoint * rulerMarkingGaps;
63
154
  for (let i = startPoint; i <= endPoint; i++) {
64
155
  points.push({
65
156
  value: i * rulerMarkingGaps,
66
- position: (i * rulerMarkingGaps + startPoint * rulerMarkingGaps) * scale,
157
+ position: (0, exports.rulerValueToPosition)({
158
+ scale,
159
+ startMarking,
160
+ value: i * rulerMarkingGaps,
161
+ }),
67
162
  });
68
163
  }
69
164
  return {
70
165
  points,
71
- startMarking: startPoint * rulerMarkingGaps,
166
+ startMarking,
72
167
  };
73
168
  };
74
169
  exports.getRulerPoints = getRulerPoints;
170
+ const rulerValueToPosition = ({ value, startMarking, scale, }) => {
171
+ return (value + startMarking) * scale;
172
+ };
173
+ exports.rulerValueToPosition = rulerValueToPosition;
75
174
  const getRulerScaleRange = ({ canvasLength, containerRef, scale, }) => {
76
175
  var _a, _b;
77
176
  const scaleRangeBeyondCanvas = (((_b = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) ||
@@ -1,2 +1,2 @@
1
1
  import type { X264Preset } from '@remotion/renderer';
2
- export declare const labelx264Preset: (profile: X264Preset) => "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo";
2
+ export declare const labelx264Preset: (profile: X264Preset) => "medium" | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "slow" | "slower" | "veryslow" | "placebo";
@@ -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';
@@ -5,6 +5,7 @@ const react_1 = require("react");
5
5
  const keybindings_1 = require("../state/keybindings");
6
6
  const z_index_1 = require("../state/z-index");
7
7
  if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
8
+ // eslint-disable-next-line no-console
8
9
  console.warn('Keyboard shortcuts disabled either due to: a) --disable-keyboard-shortcuts being passed b) Config.setKeyboardShortcutsEnabled(false) being set or c) a Remotion version mismatch.');
9
10
  }
10
11
  const areKeyboardShortcutsDisabled = () => {
@@ -13,6 +13,8 @@ const TimelineInOutToggle_1 = require("../components/TimelineInOutToggle");
13
13
  const Checkmark_1 = require("../icons/Checkmark");
14
14
  const canvas_ref_1 = require("../state/canvas-ref");
15
15
  const checkerboard_1 = require("../state/checkerboard");
16
+ const editor_guides_1 = require("../state/editor-guides");
17
+ const editor_rulers_1 = require("../state/editor-rulers");
16
18
  const editor_zoom_gestures_1 = require("../state/editor-zoom-gestures");
17
19
  const modals_1 = require("../state/modals");
18
20
  const preview_size_1 = require("../state/preview-size");
@@ -33,6 +35,8 @@ const useMenuStructure = (closeMenu) => {
33
35
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
34
36
  const { checkerboard, setCheckerboard } = (0, react_1.useContext)(checkerboard_1.CheckerboardContext);
35
37
  const { editorZoomGestures, setEditorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
38
+ const { editorShowRulers, setEditorShowRulers } = (0, react_1.useContext)(editor_rulers_1.EditorShowRulersContext);
39
+ const { editorShowGuides, setEditorShowGuides } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
36
40
  const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
37
41
  const { type } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
38
42
  const { setSidebarCollapsedState, sidebarCollapsedStateLeft, sidebarCollapsedStateRight, } = (0, react_1.useContext)(sidebar_1.SidebarContext);
@@ -178,6 +182,7 @@ const useMenuStructure = (closeMenu) => {
178
182
  }
179
183
  })
180
184
  .catch((err) => {
185
+ // eslint-disable-next-line no-console
181
186
  console.error(err);
182
187
  (0, NotificationCenter_1.sendErrorNotification)(`Could not open ${window.remotion_editorName}`);
183
188
  });
@@ -242,6 +247,38 @@ const useMenuStructure = (closeMenu) => {
242
247
  ? 'Disable Zoom and Pan Gestures'
243
248
  : 'Enable Zoom and Pan Gestures',
244
249
  },
250
+ {
251
+ id: 'show-rulers',
252
+ keyHint: null,
253
+ label: 'Show Rulers',
254
+ onClick: () => {
255
+ closeMenu();
256
+ setEditorShowRulers((c) => !c);
257
+ },
258
+ type: 'item',
259
+ value: 'show-ruler',
260
+ leftItem: editorShowRulers ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
261
+ subMenu: null,
262
+ quickSwitcherLabel: editorShowRulers
263
+ ? 'Hide Rulers'
264
+ : 'Show Rulers',
265
+ },
266
+ {
267
+ id: 'show-guides',
268
+ keyHint: null,
269
+ label: 'Show Guides',
270
+ onClick: () => {
271
+ closeMenu();
272
+ setEditorShowGuides((c) => !c);
273
+ },
274
+ type: 'item',
275
+ value: 'show-guides',
276
+ leftItem: editorShowGuides ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
277
+ subMenu: null,
278
+ quickSwitcherLabel: editorShowGuides
279
+ ? 'Hide Guides'
280
+ : 'Show Guides',
281
+ },
245
282
  {
246
283
  id: 'timeline-divider-1',
247
284
  type: 'divider',
@@ -671,6 +708,10 @@ const useMenuStructure = (closeMenu) => {
671
708
  setEditorZoomGestures,
672
709
  setSidebarCollapsedState,
673
710
  setCheckerboard,
711
+ editorShowRulers,
712
+ setEditorShowRulers,
713
+ editorShowGuides,
714
+ setEditorShowGuides,
674
715
  ]);
675
716
  return structure;
676
717
  };
@@ -706,7 +747,7 @@ const itemToSearchResult = (item, setSelectedModal, prefixes) => {
706
747
  id: item.id,
707
748
  onSelected: () => {
708
749
  setSelectedModal(null);
709
- item.onClick(item.id);
750
+ item.onClick(item.id, null);
710
751
  },
711
752
  title: [...prefixes, getItemLabel(item)].join(': '),
712
753
  },
@@ -0,0 +1,16 @@
1
+ import type { Size } from '@remotion/player';
2
+ import type { AssetMetadata } from './get-asset-metadata';
3
+ import type { Dimensions } from './is-current-selected-still';
4
+ export declare const useStudioCanvasDimensions: ({ canvasSize, contentDimensions, assetMetadata, }: {
5
+ canvasSize: Size | null;
6
+ contentDimensions: Dimensions | 'none' | null;
7
+ assetMetadata: AssetMetadata | null;
8
+ }) => {
9
+ canvasDimensions: {
10
+ left: number;
11
+ top: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ scale: number;
16
+ };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useStudioCanvasDimensions = void 0;
4
+ const player_1 = require("@remotion/player");
5
+ const react_1 = require("react");
6
+ const preview_size_1 = require("../state/preview-size");
7
+ const useStudioCanvasDimensions = ({ canvasSize, contentDimensions, assetMetadata, }) => {
8
+ const { size: previewSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
9
+ const { centerX, centerY, scale } = (0, react_1.useMemo)(() => {
10
+ if (contentDimensions === 'none' ||
11
+ contentDimensions === null ||
12
+ (assetMetadata && assetMetadata.type === 'not-found') ||
13
+ !canvasSize) {
14
+ return {
15
+ centerX: previewSize.translation.x,
16
+ centerY: previewSize.translation.y,
17
+ scale: 1,
18
+ };
19
+ }
20
+ return player_1.PlayerInternals.calculateCanvasTransformation({
21
+ canvasSize,
22
+ compositionHeight: contentDimensions.height,
23
+ compositionWidth: contentDimensions.width,
24
+ previewSize: previewSize.size,
25
+ });
26
+ }, [
27
+ canvasSize,
28
+ contentDimensions,
29
+ previewSize.size,
30
+ previewSize.translation.y,
31
+ previewSize.translation.x,
32
+ assetMetadata,
33
+ ]);
34
+ const canvasDimensions = (0, react_1.useMemo)(() => {
35
+ return {
36
+ left: centerX - previewSize.translation.x,
37
+ top: centerY - previewSize.translation.y,
38
+ width: contentDimensions === 'none' || !contentDimensions
39
+ ? (canvasSize === null || canvasSize === void 0 ? void 0 : canvasSize.width) || 0
40
+ : contentDimensions.width * scale,
41
+ height: contentDimensions === 'none' || !contentDimensions
42
+ ? (canvasSize === null || canvasSize === void 0 ? void 0 : canvasSize.height) || 0
43
+ : contentDimensions.height * scale,
44
+ };
45
+ }, [
46
+ scale,
47
+ centerX,
48
+ previewSize.translation.x,
49
+ previewSize.translation.y,
50
+ centerY,
51
+ canvasSize,
52
+ contentDimensions,
53
+ ]);
54
+ return {
55
+ canvasDimensions,
56
+ scale,
57
+ };
58
+ };
59
+ exports.useStudioCanvasDimensions = useStudioCanvasDimensions;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Checkmark: () => JSX.Element;
@@ -1,9 +1,25 @@
1
1
  /// <reference types="react" />
2
- type State = {
2
+ export type Guide = {
3
+ orientation: 'horizontal' | 'vertical';
4
+ position: number;
5
+ show: boolean;
6
+ id: string;
7
+ compositionId: string;
8
+ };
9
+ export type GuideState = {
3
10
  editorShowGuides: boolean;
4
11
  setEditorShowGuides: (cb: (prevState: boolean) => boolean) => void;
12
+ guidesList: Guide[];
13
+ setGuidesList: (cb: (prevState: Guide[]) => Guide[]) => void;
14
+ selectedGuideId: string | null;
15
+ setSelectedGuideId: (cb: (prevState: string | null) => string | null) => void;
16
+ setHoveredGuideId: (cb: (prevState: string | null) => string | null) => void;
17
+ hoveredGuideId: string | null;
18
+ shouldCreateGuideRef: React.MutableRefObject<boolean>;
19
+ shouldDeleteGuideRef: React.MutableRefObject<boolean>;
5
20
  };
6
21
  export declare const persistEditorShowGuidesOption: (option: boolean) => void;
7
22
  export declare const loadEditorShowGuidesOption: () => boolean;
8
- export declare const EditorShowGuidesContext: import("react").Context<State>;
9
- export {};
23
+ export declare const persistGuidesList: (guides: Guide[]) => void;
24
+ export declare const loadGuidesList: () => Guide[];
25
+ export declare const EditorShowGuidesContext: import("react").Context<GuideState>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EditorShowGuidesContext = exports.loadEditorShowGuidesOption = exports.persistEditorShowGuidesOption = void 0;
3
+ exports.EditorShowGuidesContext = exports.loadGuidesList = exports.persistGuidesList = exports.loadEditorShowGuidesOption = exports.persistEditorShowGuidesOption = void 0;
4
4
  const react_1 = require("react");
5
5
  const persistEditorShowGuidesOption = (option) => {
6
6
  localStorage.setItem('remotion.editorShowGuides', String(option));
@@ -11,7 +11,24 @@ const loadEditorShowGuidesOption = () => {
11
11
  return item === 'true';
12
12
  };
13
13
  exports.loadEditorShowGuidesOption = loadEditorShowGuidesOption;
14
+ const persistGuidesList = (guides) => {
15
+ localStorage.setItem('remotion.guidesList', JSON.stringify(guides));
16
+ };
17
+ exports.persistGuidesList = persistGuidesList;
18
+ const loadGuidesList = () => {
19
+ const item = localStorage.getItem('remotion.guidesList');
20
+ return item ? JSON.parse(item) : [];
21
+ };
22
+ exports.loadGuidesList = loadGuidesList;
14
23
  exports.EditorShowGuidesContext = (0, react_1.createContext)({
15
- editorShowGuides: (0, exports.loadEditorShowGuidesOption)(),
24
+ editorShowGuides: false,
16
25
  setEditorShowGuides: () => undefined,
26
+ guidesList: [],
27
+ setGuidesList: () => undefined,
28
+ selectedGuideId: null,
29
+ setSelectedGuideId: () => undefined,
30
+ shouldCreateGuideRef: { current: false },
31
+ shouldDeleteGuideRef: { current: false },
32
+ hoveredGuideId: null,
33
+ setHoveredGuideId: () => undefined,
17
34
  });
@@ -17,7 +17,7 @@ export declare const getCliOptions: (options: {
17
17
  crf: import("@remotion/renderer").Crf | null;
18
18
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
19
19
  proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
20
- x264Preset: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo" | undefined;
20
+ x264Preset: "medium" | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "slow" | "slower" | "veryslow" | "placebo" | undefined;
21
21
  everyNthFrame: number;
22
22
  numberOfGifLoops: import("./config/number-of-gif-loops").Loop;
23
23
  stillFrame: number;
@@ -34,7 +34,7 @@ export declare const getCliOptions: (options: {
34
34
  videoBitrate: string | null;
35
35
  height: number | null;
36
36
  width: number | null;
37
- configFileImageFormat: "png" | "jpeg" | "none" | undefined;
37
+ configFileImageFormat: "none" | "png" | "jpeg" | undefined;
38
38
  offthreadVideoCacheSizeInBytes: number | null;
39
39
  deleteAfter: ("1-day" | "3-days" | "7-days" | "30-days") | null;
40
40
  colorSpace: "default" | "bt709";
package/dist/index.d.ts CHANGED
@@ -87,7 +87,7 @@ export declare const CliInternals: {
87
87
  crf: import("@remotion/renderer").Crf | null;
88
88
  pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
89
89
  proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
90
- x264Preset: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo" | undefined;
90
+ x264Preset: "medium" | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "slow" | "slower" | "veryslow" | "placebo" | undefined;
91
91
  everyNthFrame: number;
92
92
  numberOfGifLoops: import("./config/number-of-gif-loops").Loop;
93
93
  stillFrame: number;
@@ -104,7 +104,7 @@ export declare const CliInternals: {
104
104
  videoBitrate: string | null;
105
105
  height: number | null;
106
106
  width: number | null;
107
- configFileImageFormat: "png" | "jpeg" | "none" | undefined;
107
+ configFileImageFormat: "none" | "png" | "jpeg" | undefined;
108
108
  offthreadVideoCacheSizeInBytes: number | null;
109
109
  deleteAfter: ("1-day" | "3-days" | "7-days" | "30-days") | null;
110
110
  colorSpace: "default" | "bt709";
@@ -116,9 +116,9 @@ export declare const CliInternals: {
116
116
  parsedCli: {
117
117
  "browser-executable": import("@remotion/renderer").BrowserExecutable;
118
118
  "pixel-format": "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
119
- "image-format": "png" | "jpeg" | "pdf" | "webp" | "none";
119
+ "image-format": "none" | "png" | "jpeg" | "pdf" | "webp";
120
120
  "prores-profile": "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy";
121
- "x264-preset": "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo";
121
+ "x264-preset": "medium" | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "slow" | "slower" | "veryslow" | "placebo";
122
122
  "bundle-cache": string;
123
123
  "env-file": string;
124
124
  "ignore-certificate-errors": string;
@@ -187,7 +187,7 @@ export declare const CliInternals: {
187
187
  downloadName: string | null;
188
188
  outName: string | null;
189
189
  configImageFormat: "png" | "jpeg" | "pdf" | "webp" | null;
190
- cliFlag: "png" | "jpeg" | "pdf" | "webp" | "none" | null;
190
+ cliFlag: "none" | "png" | "jpeg" | "pdf" | "webp" | null;
191
191
  isLambda: boolean;
192
192
  fromUi: "png" | "jpeg" | "pdf" | "webp" | null;
193
193
  }) => {
@@ -202,8 +202,8 @@ export declare const CliInternals: {
202
202
  };
203
203
  getVideoImageFormat: ({ codec, uiImageFormat, }: {
204
204
  codec: import("@remotion/renderer").CodecOrUndefined;
205
- uiImageFormat: "png" | "jpeg" | "none" | null;
206
- }) => "png" | "jpeg" | "none";
205
+ uiImageFormat: "none" | "png" | "jpeg" | null;
206
+ }) => "none" | "png" | "jpeg";
207
207
  printCompositions: (compositions: import("remotion").VideoConfig[]) => void;
208
208
  getFinalOutputCodec: ({ cliFlag, configFile, downloadName, outName, uiCodec, compositionCodec, }: {
209
209
  cliFlag: import("@remotion/renderer").CodecOrUndefined;
@@ -11,5 +11,5 @@ type Range = {
11
11
  type Ranges = Range[] & {
12
12
  type?: string;
13
13
  };
14
- export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
14
+ export declare function parseRange(size: number, str: string | string[]): -1 | -2 | Ranges;
15
15
  export {};