@remotion/studio 4.0.100 → 4.0.103

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.
@@ -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,
@@ -0,0 +1,7 @@
1
+ import type { GitSource } from '@remotion/studio-shared';
2
+ import type { ComboboxValue } from '../components/NewComposition/ComboBox';
3
+ import type { OriginalPosition } from '../error-overlay/react-overlay/utils/get-source-map';
4
+ export declare const getGitSourceName: (gitSource: GitSource) => string;
5
+ export declare const getGitSourceBranchUrl: (gitSource: GitSource) => string;
6
+ export declare const getGitRefUrl: (gitSource: GitSource, originalLocation: OriginalPosition) => string;
7
+ export declare const getGitMenuItem: () => ComboboxValue | null;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGitMenuItem = exports.getGitRefUrl = exports.getGitSourceBranchUrl = exports.getGitSourceName = void 0;
4
+ const getGitSourceName = (gitSource) => {
5
+ if (gitSource.type === 'github') {
6
+ return 'GitHub';
7
+ }
8
+ throw new Error('Unknown git source type');
9
+ };
10
+ exports.getGitSourceName = getGitSourceName;
11
+ const getGitSourceBranchUrl = (gitSource) => {
12
+ if (gitSource.type === 'github') {
13
+ return `https://github.com/${gitSource.org}/${gitSource.name}/tree/${gitSource.ref}${gitSource.relativeFromGitRoot ? `/${gitSource.relativeFromGitRoot}` : ''}`;
14
+ }
15
+ throw new Error('Unknown git source type');
16
+ };
17
+ exports.getGitSourceBranchUrl = getGitSourceBranchUrl;
18
+ const getGitRefUrl = (gitSource, originalLocation) => {
19
+ if (gitSource.type === 'github') {
20
+ return `https://github.com/${gitSource.org}/${gitSource.name}/tree/${gitSource.ref}/${gitSource.relativeFromGitRoot ? `${gitSource.relativeFromGitRoot}/` : ''}${originalLocation.source}#L${originalLocation.line}`;
21
+ }
22
+ throw new Error('Unknown git source type');
23
+ };
24
+ exports.getGitRefUrl = getGitRefUrl;
25
+ const getGitMenuItem = () => {
26
+ if (!window.remotion_gitSource) {
27
+ return null;
28
+ }
29
+ return {
30
+ id: 'open-git-source',
31
+ value: 'open-git-source',
32
+ label: `Open ${(0, exports.getGitSourceName)(window.remotion_gitSource)} Repo`,
33
+ onClick: () => {
34
+ window.open((0, exports.getGitSourceBranchUrl)(window.remotion_gitSource), '_blank');
35
+ },
36
+ type: 'item',
37
+ keyHint: null,
38
+ leftItem: null,
39
+ subMenu: null,
40
+ quickSwitcherLabel: `Open ${(0, exports.getGitSourceName)(window.remotion_gitSource)} repo`,
41
+ };
42
+ };
43
+ exports.getGitMenuItem = getGitMenuItem;
@@ -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';
@@ -21,6 +21,7 @@ const modals_1 = require("../state/modals");
21
21
  const preview_size_1 = require("../state/preview-size");
22
22
  const sidebar_1 = require("../state/sidebar");
23
23
  const client_id_1 = require("./client-id");
24
+ const get_git_menu_item_1 = require("./get-git-menu-item");
24
25
  const open_in_editor_1 = require("./open-in-editor");
25
26
  const pick_color_1 = require("./pick-color");
26
27
  const use_keybinding_1 = require("./use-keybinding");
@@ -136,6 +137,7 @@ const getFileMenu = ({ readOnlyStudio, closeMenu, setSelectedModal, previewServe
136
137
  quickSwitcherLabel: 'Open in editor...',
137
138
  }
138
139
  : null,
140
+ (0, get_git_menu_item_1.getGitMenuItem)(),
139
141
  ].filter(no_react_1.NoReactInternals.truthy);
140
142
  if (items.length === 0) {
141
143
  return null;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export type { RenderDefaults } from '@remotion/studio-shared';
1
+ export type { GitSource, RenderDefaults } from '@remotion/studio-shared';
2
2
  export { Studio } from './Studio';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/studio",
3
- "version": "4.0.100",
3
+ "version": "4.0.103",
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.103",
22
+ "@remotion/player": "4.0.103",
23
+ "@remotion/media-utils": "4.0.103",
24
+ "@remotion/renderer": "4.0.103",
25
+ "@remotion/studio-shared": "4.0.103"
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.103"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"