@remotion/studio 4.0.508 → 4.0.509

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 (86) hide show
  1. package/dist/Studio.d.ts +5 -0
  2. package/dist/Studio.js +2 -2
  3. package/dist/components/Canvas.js +35 -5
  4. package/dist/components/ColorPicker/AlphaSlider.js +2 -2
  5. package/dist/components/ColorPicker/HueSlider.js +2 -2
  6. package/dist/components/ColorPicker/SaturationValueArea.js +2 -2
  7. package/dist/components/EditorGuides/Guide.js +2 -2
  8. package/dist/components/EditorRuler/index.js +2 -2
  9. package/dist/components/ExplorerPanel.js +19 -1
  10. package/dist/components/InspectorOpenInEditor.js +8 -5
  11. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +3 -3
  12. package/dist/components/Menu/MenuItem.js +2 -2
  13. package/dist/components/ModalContainer.js +1 -1
  14. package/dist/components/Modals.js +2 -9
  15. package/dist/components/NewComposition/InputDragger.js +2 -2
  16. package/dist/components/NewComposition/NewComposition.d.ts +2 -0
  17. package/dist/components/NewComposition/NewComposition.js +38 -6
  18. package/dist/components/NewComposition/get-new-composition-defaults.d.ts +1 -1
  19. package/dist/components/NewComposition/get-new-composition-defaults.js +9 -1
  20. package/dist/components/SelectedOutlineCanvasRotation.js +6 -4
  21. package/dist/components/SelectedOutlineCropControls.js +2 -2
  22. package/dist/components/SelectedOutlineElement.js +6 -2
  23. package/dist/components/SelectedOutlinePolygon.js +2 -2
  24. package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +5 -0
  25. package/dist/components/SelectedOutlineRotationCornerHandle.js +4 -4
  26. package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +1 -0
  27. package/dist/components/SelectedOutlineScaleEdgeLine.js +4 -4
  28. package/dist/components/SelectedOutlineTransformOriginHandle.js +2 -2
  29. package/dist/components/SelectedOutlineUvControls.js +8 -8
  30. package/dist/components/Splitter/SplitterHandle.js +2 -2
  31. package/dist/components/Tabs/index.d.ts +2 -0
  32. package/dist/components/Tabs/index.js +2 -2
  33. package/dist/components/Timeline/EasingEditorModal.js +2 -2
  34. package/dist/components/Timeline/SubscribeToNodePaths.js +1 -1
  35. package/dist/components/Timeline/Timeline.js +55 -1
  36. package/dist/components/Timeline/TimelineClipboardKeybindings.js +99 -35
  37. package/dist/components/Timeline/TimelineDragHandler.js +2 -2
  38. package/dist/components/Timeline/TimelineEffectPropItem.js +7 -0
  39. package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -2
  40. package/dist/components/Timeline/TimelineLayerEye.js +2 -2
  41. package/dist/components/Timeline/TimelineSelection.js +2 -2
  42. package/dist/components/Timeline/TimelineSequenceItem.js +1 -24
  43. package/dist/components/Timeline/TimelineSequencePropItem.js +7 -1
  44. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +6 -6
  45. package/dist/components/Timeline/get-sequence-context-menu-items.js +1 -0
  46. package/dist/components/Timeline/keyframe-clipboard.d.ts +5 -1
  47. package/dist/components/Timeline/keyframe-clipboard.js +3 -2
  48. package/dist/components/Timeline/save-sequence-prop.js +16 -7
  49. package/dist/components/Timeline/sequence-prop-clipboard.d.ts +31 -0
  50. package/dist/components/Timeline/sequence-prop-clipboard.js +142 -0
  51. package/dist/components/Timeline/update-selected-easing.js +8 -0
  52. package/dist/components/Timeline/use-open-sequence-in-apps.js +3 -1
  53. package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +1 -1
  54. package/dist/components/Timeline/use-resolved-stack-react-to-change.js +24 -3
  55. package/dist/components/Timeline/use-timeline-keyframe-drag.js +4 -4
  56. package/dist/components/folder-menu-items.js +1 -0
  57. package/dist/components/get-open-in-menu-items.d.ts +3 -1
  58. package/dist/components/get-open-in-menu-items.js +73 -49
  59. package/dist/components/import-assets.js +7 -0
  60. package/dist/components/root-composition-menu-items.js +1 -0
  61. package/dist/components/selected-outline-control-layout.d.ts +14 -0
  62. package/dist/components/selected-outline-control-layout.js +94 -0
  63. package/dist/components/use-default-editor-info.js +28 -3
  64. package/dist/esm/{chunk-zpn4m49r.js → chunk-jdn6nkbk.js} +5181 -4560
  65. package/dist/esm/{chunk-fgedsvhb.js → chunk-r46yxrjr.js} +1 -2
  66. package/dist/esm/internals.mjs +5180 -4559
  67. package/dist/esm/previewEntry.mjs +5072 -4451
  68. package/dist/esm/renderEntry.mjs +4 -2
  69. package/dist/helpers/get-canvas-capture-import.d.ts +7 -0
  70. package/dist/helpers/get-canvas-capture-import.js +43 -0
  71. package/dist/helpers/get-git-menu-item.d.ts +1 -1
  72. package/dist/helpers/get-git-menu-item.js +33 -3
  73. package/dist/helpers/inserted-element-selection.d.ts +12 -0
  74. package/dist/helpers/inserted-element-selection.js +29 -0
  75. package/dist/helpers/pointer-session.d.ts +6 -2
  76. package/dist/helpers/pointer-session.js +29 -12
  77. package/dist/helpers/use-create-composition.d.ts +15 -2
  78. package/dist/helpers/use-create-composition.js +11 -17
  79. package/dist/helpers/use-menu-structure.js +1 -0
  80. package/dist/icons/github.d.ts +4 -0
  81. package/dist/icons/github.js +11 -0
  82. package/dist/renderEntry.js +2 -2
  83. package/dist/state/modals.d.ts +9 -1
  84. package/dist/state/z-index.d.ts +0 -1
  85. package/dist/state/z-index.js +27 -33
  86. package/package.json +12 -12
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOpenInMenuItems = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const no_react_1 = require("remotion/no-react");
5
6
  const get_file_manager_name_1 = require("../helpers/get-file-manager-name");
7
+ const get_git_menu_item_1 = require("../helpers/get-git-menu-item");
6
8
  const editor_1 = require("../icons/editor");
7
9
  const finder_1 = require("../icons/finder");
10
+ const github_1 = require("../icons/github");
8
11
  const terminal_1 = require("../icons/terminal");
9
12
  const CodingAgentIcon_1 = require("./CodingAgentIcon");
10
13
  const menuLabel = {
@@ -13,7 +16,7 @@ const menuLabel = {
13
16
  fontSize: 13,
14
17
  lineHeight: '16px',
15
18
  };
16
- const getOpenInMenuItems = ({ codingAgentInfo, editorDisabled, editorInfo, excludeCodingAgentId, excludeEditorId, fileManagerDisabled, folder, onConfigureApps, onOpenInCodingAgent, onOpenInEditor, onOpenInFileExplorer, onOpenInTerminal, }) => {
19
+ const getOpenInMenuItems = ({ codingAgentInfo, editorDisabled, editorInfo, excludeCodingAgentId, excludeEditorId, fileManagerDisabled, folder, location, onConfigureApps, onOpenInCodingAgent, onOpenInEditor, onOpenInFileExplorer, onOpenInTerminal, }) => {
17
20
  var _a, _b, _c;
18
21
  const showFinder = window.remotion_fileSystemPlatform === 'darwin';
19
22
  const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
@@ -49,7 +52,49 @@ const getOpenInMenuItems = ({ codingAgentInfo, editorDisabled, editorInfo, exclu
49
52
  value: `coding-agent-${codingAgent.id}`,
50
53
  }));
51
54
  const terminals = folder ? ((_c = codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedTerminals) !== null && _c !== void 0 ? _c : []) : [];
52
- const showSystemApps = showFinder || terminals.length > 0;
55
+ const gitHubItem = window.remotion_gitSource
56
+ ? {
57
+ id: 'open-in-github',
58
+ keyHint: null,
59
+ label: jsx_runtime_1.jsx("span", { style: menuLabel, children: "GitHub.com" }),
60
+ leftItem: jsx_runtime_1.jsx(github_1.GitHubIcon, { size: 18 }),
61
+ onClick: () => {
62
+ const gitSource = window.remotion_gitSource;
63
+ if (!gitSource) {
64
+ return;
65
+ }
66
+ window.open(folder || !location
67
+ ? (0, get_git_menu_item_1.getGitSourceBranchUrl)(gitSource)
68
+ : (0, get_git_menu_item_1.getGitRefUrl)(gitSource, location, window.remotion_cwd), '_blank');
69
+ },
70
+ quickSwitcherLabel: null,
71
+ subMenu: null,
72
+ type: 'item',
73
+ value: 'github',
74
+ }
75
+ : null;
76
+ const systemApps = [
77
+ gitHubItem,
78
+ showFinder
79
+ ? {
80
+ disabled: fileManagerDisabled,
81
+ id: 'open-in-file-explorer',
82
+ keyHint: null,
83
+ label: jsx_runtime_1.jsx("span", { style: menuLabel, children: fileManagerName }),
84
+ leftItem: jsx_runtime_1.jsx(finder_1.FinderIcon, { size: 18 }),
85
+ onClick: () => {
86
+ if (!fileManagerDisabled) {
87
+ onOpenInFileExplorer();
88
+ }
89
+ },
90
+ quickSwitcherLabel: null,
91
+ subMenu: null,
92
+ type: 'item',
93
+ value: 'file-explorer',
94
+ }
95
+ : null,
96
+ ].filter(no_react_1.NoReactInternals.truthy);
97
+ const hasCategorizedApps = editors.length > 0 || codingAgents.length > 0 || terminals.length > 0;
53
98
  return [
54
99
  ...(editors.length > 0
55
100
  ? [
@@ -71,61 +116,40 @@ const getOpenInMenuItems = ({ codingAgentInfo, editorDisabled, editorInfo, exclu
71
116
  ...codingAgents,
72
117
  ]
73
118
  : []),
74
- ...(showSystemApps
119
+ ...(terminals.length > 0
75
120
  ? [
76
- ...(terminals.length > 0
77
- ? [
78
- {
79
- type: 'section-header',
80
- id: 'terminal-header',
81
- label: 'Terminal',
82
- },
83
- ...terminals.map((terminal) => ({
84
- id: `open-in-terminal-${terminal.id}`,
85
- keyHint: null,
86
- label: jsx_runtime_1.jsx("span", { style: menuLabel, children: terminal.name }),
87
- leftItem: jsx_runtime_1.jsx(terminal_1.TerminalIcon, { terminalId: terminal.id, size: 18 }),
88
- onClick: () => onOpenInTerminal === null || onOpenInTerminal === void 0 ? void 0 : onOpenInTerminal(terminal.id),
89
- quickSwitcherLabel: null,
90
- subMenu: null,
91
- type: 'item',
92
- value: `terminal-${terminal.id}`,
93
- })),
94
- ]
95
- : []),
96
- ...(showFinder
121
+ {
122
+ type: 'section-header',
123
+ id: 'terminal-header',
124
+ label: 'Terminal',
125
+ },
126
+ ...terminals.map((terminal) => ({
127
+ id: `open-in-terminal-${terminal.id}`,
128
+ keyHint: null,
129
+ label: jsx_runtime_1.jsx("span", { style: menuLabel, children: terminal.name }),
130
+ leftItem: jsx_runtime_1.jsx(terminal_1.TerminalIcon, { terminalId: terminal.id, size: 18 }),
131
+ onClick: () => onOpenInTerminal === null || onOpenInTerminal === void 0 ? void 0 : onOpenInTerminal(terminal.id),
132
+ quickSwitcherLabel: null,
133
+ subMenu: null,
134
+ type: 'item',
135
+ value: `terminal-${terminal.id}`,
136
+ })),
137
+ ]
138
+ : []),
139
+ ...(systemApps.length > 0
140
+ ? [
141
+ ...(hasCategorizedApps
97
142
  ? [
98
- ...(editors.length > 0 ||
99
- codingAgents.length > 0 ||
100
- terminals.length > 0
101
- ? [
102
- {
103
- type: 'divider',
104
- id: 'open-in-file-explorer-divider',
105
- },
106
- ]
107
- : []),
108
143
  {
109
- disabled: fileManagerDisabled,
110
- id: 'open-in-file-explorer',
111
- keyHint: null,
112
- label: jsx_runtime_1.jsx("span", { style: menuLabel, children: fileManagerName }),
113
- leftItem: jsx_runtime_1.jsx(finder_1.FinderIcon, { size: 18 }),
114
- onClick: () => {
115
- if (!fileManagerDisabled) {
116
- onOpenInFileExplorer();
117
- }
118
- },
119
- quickSwitcherLabel: null,
120
- subMenu: null,
121
- type: 'item',
122
- value: 'file-explorer',
144
+ type: 'divider',
145
+ id: 'open-in-system-apps-divider',
123
146
  },
124
147
  ]
125
148
  : []),
149
+ ...systemApps,
126
150
  ]
127
151
  : []),
128
- ...(editors.length > 0 || codingAgents.length > 0 || showSystemApps
152
+ ...(hasCategorizedApps || systemApps.length > 0
129
153
  ? [{ type: 'divider', id: 'open-in-settings-divider' }]
130
154
  : []),
131
155
  {
@@ -7,6 +7,7 @@ const no_react_1 = require("remotion/no-react");
7
7
  const get_static_files_1 = require("../api/get-static-files");
8
8
  const write_static_file_1 = require("../api/write-static-file");
9
9
  const clipboard_figma_1 = require("../helpers/clipboard-figma");
10
+ const inserted_element_selection_1 = require("../helpers/inserted-element-selection");
10
11
  const install_required_package_1 = require("../helpers/install-required-package");
11
12
  const use_media_metadata_1 = require("../helpers/use-media-metadata");
12
13
  const call_api_1 = require("./call-api");
@@ -504,6 +505,12 @@ const insertCompositionElement = async ({ compositionFile, compositionId, elemen
504
505
  (0, NotificationCenter_1.showNotification)(result.reason, 4000);
505
506
  return false;
506
507
  }
508
+ if (result.insertedNodePath !== null) {
509
+ (0, inserted_element_selection_1.requestInsertedElementSelection)({
510
+ compositionId,
511
+ nodePath: result.insertedNodePath,
512
+ });
513
+ }
507
514
  return true;
508
515
  };
509
516
  const downloadRemoteAsset = (url) => {
@@ -14,6 +14,7 @@ const getRootCompositionMenuItems = ({ connectionStatus, readOnlyStudio, setSele
14
14
  folderName: null,
15
15
  parentName: null,
16
16
  stack: null,
17
+ canvasCapture: null,
17
18
  });
18
19
  },
19
20
  quickSwitcherLabel: 'New composition...',
@@ -0,0 +1,14 @@
1
+ import type { OutlinePoint } from './selected-outline-geometry';
2
+ export type SelectedOutlineControlCorner = 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
3
+ export declare const getSelectedOutlineControlLayout: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint]) => {
4
+ rotationCorners: {
5
+ corner: "bottom-left" | "bottom-right" | "top-left" | "top-right";
6
+ point: OutlinePoint;
7
+ }[];
8
+ rotationHandleRadius: number;
9
+ scaleEdges: ("bottom" | "left" | "right" | "top")[];
10
+ scaleHitWidth: {
11
+ horizontal: number;
12
+ vertical: number;
13
+ };
14
+ };
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSelectedOutlineControlLayout = void 0;
4
+ // Outline points are measured in overlay pixels, keeping these sizes independent of canvas zoom.
5
+ const handleSize = 8;
6
+ const targetHalfSize = 4.5;
7
+ const smallOutlineSize = handleSize * 4;
8
+ const tinyOutlineSize = handleSize * 2;
9
+ const distance = (from, to) => Math.hypot(to.x - from.x, to.y - from.y);
10
+ const normalize = (point) => {
11
+ const length = Math.hypot(point.x, point.y);
12
+ if (length < 0.001) {
13
+ return null;
14
+ }
15
+ return { x: point.x / length, y: point.y / length };
16
+ };
17
+ const getRotationHandlePoint = ({ corner, points, radius, }) => {
18
+ const [topLeft, topRight, bottomRight, bottomLeft] = points;
19
+ const { point, adjacent } = {
20
+ 'top-left': { point: topLeft, adjacent: [topRight, bottomLeft] },
21
+ 'top-right': { point: topRight, adjacent: [topLeft, bottomRight] },
22
+ 'bottom-right': { point: bottomRight, adjacent: [topRight, bottomLeft] },
23
+ 'bottom-left': { point: bottomLeft, adjacent: [topLeft, bottomRight] },
24
+ }[corner];
25
+ const firstDirection = normalize({
26
+ x: point.x - adjacent[0].x,
27
+ y: point.y - adjacent[0].y,
28
+ });
29
+ const secondDirection = normalize({
30
+ x: point.x - adjacent[1].x,
31
+ y: point.y - adjacent[1].y,
32
+ });
33
+ const outlineCenter = {
34
+ x: (topLeft.x + topRight.x + bottomRight.x + bottomLeft.x) / 4,
35
+ y: (topLeft.y + topRight.y + bottomRight.y + bottomLeft.y) / 4,
36
+ };
37
+ const fallbackDirection = normalize({
38
+ x: point.x - outlineCenter.x,
39
+ y: point.y - outlineCenter.y,
40
+ });
41
+ const direction = firstDirection === null || secondDirection === null
42
+ ? fallbackDirection
43
+ : normalize({
44
+ x: firstDirection.x + secondDirection.x,
45
+ y: firstDirection.y + secondDirection.y,
46
+ });
47
+ if (direction === null) {
48
+ return point;
49
+ }
50
+ return {
51
+ x: point.x + direction.x * radius,
52
+ y: point.y + direction.y * radius,
53
+ };
54
+ };
55
+ const getSelectedOutlineControlLayout = (points) => {
56
+ const [topLeft, topRight, bottomRight, bottomLeft] = points;
57
+ const horizontalExtent = (distance(topLeft, topRight) + distance(bottomLeft, bottomRight)) / 2;
58
+ const verticalExtent = (distance(topLeft, bottomLeft) + distance(topRight, bottomRight)) / 2;
59
+ const isSmallX = horizontalExtent < smallOutlineSize;
60
+ const isSmallY = verticalExtent < smallOutlineSize;
61
+ const isTinyX = horizontalExtent < tinyOutlineSize;
62
+ const isTinyY = verticalExtent < tinyOutlineSize;
63
+ const targetHalfSizeX = isSmallX ? targetHalfSize / 2 : targetHalfSize;
64
+ const targetHalfSizeY = isSmallY ? targetHalfSize / 2 : targetHalfSize;
65
+ const rotationHandleRadius = Math.max(targetHalfSizeX, targetHalfSizeY) * 1.5;
66
+ const scaleEdges = ['top', 'right', 'bottom', 'left'].filter((edge) => {
67
+ // Preserve one scale control per axis when opposite edge targets would overlap.
68
+ if (edge === 'top') {
69
+ return !isTinyY;
70
+ }
71
+ if (edge === 'left') {
72
+ return !isTinyX;
73
+ }
74
+ return true;
75
+ });
76
+ const rotationCorners = ['top-left', 'top-right', 'bottom-right', 'bottom-left'].map((corner) => ({
77
+ corner,
78
+ point: getRotationHandlePoint({
79
+ corner,
80
+ points,
81
+ radius: rotationHandleRadius,
82
+ }),
83
+ }));
84
+ return {
85
+ rotationCorners: isTinyX || isTinyY ? [] : rotationCorners,
86
+ rotationHandleRadius,
87
+ scaleEdges,
88
+ scaleHitWidth: {
89
+ horizontal: targetHalfSizeY * 2,
90
+ vertical: targetHalfSizeX * 2,
91
+ },
92
+ };
93
+ };
94
+ exports.getSelectedOutlineControlLayout = getSelectedOutlineControlLayout;
@@ -9,10 +9,35 @@ const canUseEditorPicker = (previewServerConnected) => {
9
9
  (0, browser_studio_operations_1.getBrowserStudioOperations)() === null);
10
10
  };
11
11
  exports.canUseEditorPicker = canUseEditorPicker;
12
+ const preferredFallbackEditorIds = [
13
+ 'zed',
14
+ 'vscode',
15
+ 'cursor',
16
+ ];
12
17
  const getPreferredEditorId = (editorInfo) => {
13
- var _a;
14
- var _b;
15
- return ((_b = (_a = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.find((editor) => editor.nameWithType === window.remotion_editorName)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null);
18
+ var _a, _b, _c;
19
+ var _d;
20
+ const runningEditorId = (_a = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.find((editor) => editor.nameWithType === window.remotion_editorName)) === null || _a === void 0 ? void 0 : _a.id;
21
+ if (runningEditorId) {
22
+ return runningEditorId;
23
+ }
24
+ if (window.remotion_editorName !== null) {
25
+ return null;
26
+ }
27
+ const configuredEditorId = (_b = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.find((editor) => editor.id === editorInfo.defaultEditor)) === null || _b === void 0 ? void 0 : _b.id;
28
+ if (configuredEditorId) {
29
+ return configuredEditorId;
30
+ }
31
+ return ((_d = (_c = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.slice().sort((a, b) => {
32
+ const aPriority = preferredFallbackEditorIds.indexOf(a.id);
33
+ const bPriority = preferredFallbackEditorIds.indexOf(b.id);
34
+ const normalizedAPriority = aPriority === -1 ? Number.POSITIVE_INFINITY : aPriority;
35
+ const normalizedBPriority = bPriority === -1 ? Number.POSITIVE_INFINITY : bPriority;
36
+ if (normalizedAPriority !== normalizedBPriority) {
37
+ return normalizedAPriority - normalizedBPriority;
38
+ }
39
+ return a.nameWithType.localeCompare(b.nameWithType);
40
+ }).at(0)) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null);
16
41
  };
17
42
  exports.getPreferredEditorId = getPreferredEditorId;
18
43
  const useDefaultEditorInfo = (enabled) => {