@remotion/studio 4.0.455 → 4.0.456
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.
- package/dist/components/CompSelectorRef.js +21 -23
- package/dist/components/CompositionSelector.d.ts +0 -1
- package/dist/components/CompositionSelector.js +1 -13
- package/dist/components/InitialCompositionLoader.js +4 -2
- package/dist/components/Timeline/TimelineExpandArrowButton.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandArrowButton.js +4 -3
- package/dist/components/Timeline/TimelineExpandedSection.js +1 -1
- package/dist/components/Timeline/TimelineListItem.js +11 -5
- package/dist/components/Timeline/TimelineStack/index.js +2 -0
- package/dist/error-overlay/remotion-overlay/CopyStackTrace.d.ts +0 -1
- package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +2 -20
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +1 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.js +22 -1
- package/dist/esm/{chunk-t00j0160.js → chunk-0y1jhm8s.js} +3937 -3930
- package/dist/esm/internals.mjs +3937 -3930
- package/dist/esm/previewEntry.mjs +3888 -3881
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/create-folder-tree.d.ts +5 -0
- package/dist/helpers/create-folder-tree.js +17 -1
- package/package.json +9 -9
|
@@ -4,14 +4,16 @@ exports.CompSelectorRef = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const create_folder_tree_1 = require("../helpers/create-folder-tree");
|
|
7
8
|
const persist_open_folders_1 = require("../helpers/persist-open-folders");
|
|
9
|
+
const folders_1 = require("../state/folders");
|
|
8
10
|
const InitialCompositionLoader_1 = require("./InitialCompositionLoader");
|
|
9
11
|
const CompSelectorRef = ({ children }) => {
|
|
10
12
|
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
11
|
-
const
|
|
13
|
+
const { compositionFoldersExpanded, setCompositionFoldersExpanded } = (0, react_1.useContext)(folders_1.FolderContext);
|
|
12
14
|
const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
|
|
13
15
|
const toggleFolder = (0, react_1.useCallback)((folderName, parentName) => {
|
|
14
|
-
|
|
16
|
+
setCompositionFoldersExpanded((p) => {
|
|
15
17
|
var _a;
|
|
16
18
|
const key = (0, persist_open_folders_1.openFolderKey)({ folderName, parentName });
|
|
17
19
|
const prev = (_a = p[key]) !== null && _a !== void 0 ? _a : false;
|
|
@@ -22,7 +24,7 @@ const CompSelectorRef = ({ children }) => {
|
|
|
22
24
|
(0, persist_open_folders_1.persistExpandedFolders)('compositions', foldersExpandedState);
|
|
23
25
|
return foldersExpandedState;
|
|
24
26
|
});
|
|
25
|
-
}, []);
|
|
27
|
+
}, [setCompositionFoldersExpanded]);
|
|
26
28
|
(0, react_1.useImperativeHandle)(remotion_1.Internals.compositionSelectorRef, () => {
|
|
27
29
|
return {
|
|
28
30
|
expandComposition: (compName) => {
|
|
@@ -34,25 +36,13 @@ const CompSelectorRef = ({ children }) => {
|
|
|
34
36
|
if (folderName === null) {
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
setCompositionFoldersExpanded((previousState) => {
|
|
40
|
+
const keysToExpand = (0, create_folder_tree_1.getKeysToExpand)(folderName, parentFolderName);
|
|
38
41
|
const foldersExpandedState = {
|
|
39
42
|
...previousState,
|
|
40
43
|
};
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const key = (0, persist_open_folders_1.openFolderKey)({
|
|
44
|
-
folderName: currentFolder,
|
|
45
|
-
parentName: currentParentName,
|
|
46
|
-
});
|
|
47
|
-
const splitted = key.split('/');
|
|
48
|
-
for (let i = 0; i < splitted.length - 1; i++) {
|
|
49
|
-
const allExceptLast = i === 0
|
|
50
|
-
? (0, persist_open_folders_1.openFolderKey)({
|
|
51
|
-
folderName: splitted.filter((s) => s !== 'no-parent')[0],
|
|
52
|
-
parentName: null,
|
|
53
|
-
})
|
|
54
|
-
: splitted.slice(0, i + 1).join('/');
|
|
55
|
-
foldersExpandedState[allExceptLast] = true;
|
|
44
|
+
for (const key of keysToExpand) {
|
|
45
|
+
foldersExpandedState[key] = true;
|
|
56
46
|
}
|
|
57
47
|
(0, persist_open_folders_1.persistExpandedFolders)('compositions', foldersExpandedState);
|
|
58
48
|
return foldersExpandedState;
|
|
@@ -69,14 +59,22 @@ const CompSelectorRef = ({ children }) => {
|
|
|
69
59
|
toggleFolder(folderName, parentName);
|
|
70
60
|
},
|
|
71
61
|
};
|
|
72
|
-
}, [
|
|
62
|
+
}, [
|
|
63
|
+
compositions,
|
|
64
|
+
selectComposition,
|
|
65
|
+
setCompositionFoldersExpanded,
|
|
66
|
+
toggleFolder,
|
|
67
|
+
]);
|
|
73
68
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
74
69
|
return {
|
|
75
|
-
foldersExpanded,
|
|
76
|
-
setFoldersExpanded
|
|
70
|
+
foldersExpanded: compositionFoldersExpanded,
|
|
71
|
+
setFoldersExpanded: (foldersExpanded) => {
|
|
72
|
+
setCompositionFoldersExpanded(foldersExpanded);
|
|
73
|
+
(0, persist_open_folders_1.persistExpandedFolders)('compositions', foldersExpanded);
|
|
74
|
+
},
|
|
77
75
|
toggleFolder,
|
|
78
76
|
};
|
|
79
|
-
}, [
|
|
77
|
+
}, [compositionFoldersExpanded, setCompositionFoldersExpanded, toggleFolder]);
|
|
80
78
|
return (jsx_runtime_1.jsx(persist_open_folders_1.ExpandedFoldersContext.Provider, { value: contextValue, children: children }));
|
|
81
79
|
};
|
|
82
80
|
exports.CompSelectorRef = CompSelectorRef;
|
|
@@ -3,5 +3,4 @@ export declare const useCompositionNavigation: () => {
|
|
|
3
3
|
navigateToNextComposition: () => void;
|
|
4
4
|
navigateToPreviousComposition: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const getKeysToExpand: (initialFolderName: string, parentFolderName: string | null, initial?: string[]) => string[];
|
|
7
6
|
export declare const CompositionSelector: React.FC;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompositionSelector = exports.
|
|
3
|
+
exports.CompositionSelector = exports.useCompositionNavigation = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
@@ -82,18 +82,6 @@ const shortcutLabel = {
|
|
|
82
82
|
fontSize: 11,
|
|
83
83
|
opacity: 0.6,
|
|
84
84
|
};
|
|
85
|
-
const getKeysToExpand = (initialFolderName, parentFolderName, initial = []) => {
|
|
86
|
-
initial.push((0, persist_open_folders_1.openFolderKey)({
|
|
87
|
-
folderName: initialFolderName,
|
|
88
|
-
parentName: parentFolderName,
|
|
89
|
-
}));
|
|
90
|
-
const { name, parent } = (0, create_folder_tree_1.splitParentIntoNameAndParent)(parentFolderName);
|
|
91
|
-
if (!name) {
|
|
92
|
-
return initial;
|
|
93
|
-
}
|
|
94
|
-
return (0, exports.getKeysToExpand)(name, parent, initial);
|
|
95
|
-
};
|
|
96
|
-
exports.getKeysToExpand = getKeysToExpand;
|
|
97
85
|
const CompositionSelector = () => {
|
|
98
86
|
const { compositions, canvasContent, folders } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
99
87
|
const { foldersExpanded } = (0, react_1.useContext)(persist_open_folders_1.ExpandedFoldersContext);
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InitialCompositionLoader = exports.useSelectComposition = exports.useSelectAsset = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const create_folder_tree_1 = require("../helpers/create-folder-tree");
|
|
6
7
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
8
|
+
const persist_open_folders_1 = require("../helpers/persist-open-folders");
|
|
7
9
|
const url_state_1 = require("../helpers/url-state");
|
|
8
10
|
const folders_1 = require("../state/folders");
|
|
9
11
|
const sidebar_1 = require("../state/sidebar");
|
|
10
|
-
const CompositionSelector_1 = require("./CompositionSelector");
|
|
11
12
|
const ExplorerPanel_1 = require("./ExplorerPanel");
|
|
12
13
|
const load_canvas_content_from_url_1 = require("./load-canvas-content-from-url");
|
|
13
14
|
const use_static_files_1 = require("./use-static-files");
|
|
@@ -49,13 +50,14 @@ const useSelectComposition = () => {
|
|
|
49
50
|
const { folderName, parentFolderName } = c;
|
|
50
51
|
if (folderName !== null) {
|
|
51
52
|
setCompositionFoldersExpanded((ex) => {
|
|
52
|
-
const keysToExpand = (0,
|
|
53
|
+
const keysToExpand = (0, create_folder_tree_1.getKeysToExpand)(folderName, parentFolderName);
|
|
53
54
|
const newState = {
|
|
54
55
|
...ex,
|
|
55
56
|
};
|
|
56
57
|
for (const key of keysToExpand) {
|
|
57
58
|
newState[key] = true;
|
|
58
59
|
}
|
|
60
|
+
(0, persist_open_folders_1.persistExpandedFolders)('compositions', newState);
|
|
59
61
|
return newState;
|
|
60
62
|
});
|
|
61
63
|
if (isMobileLayout) {
|
|
@@ -22,14 +22,15 @@ const arrowButton = {
|
|
|
22
22
|
lineHeight: 1,
|
|
23
23
|
};
|
|
24
24
|
const svgStyle = { display: 'block' };
|
|
25
|
-
const TimelineExpandArrowButton = ({ isExpanded, onClick, label }) => {
|
|
25
|
+
const TimelineExpandArrowButton = ({ isExpanded, onClick, label, hasExpandableContent }) => {
|
|
26
26
|
const style = (0, react_1.useMemo)(() => {
|
|
27
27
|
return {
|
|
28
28
|
...arrowButton,
|
|
29
29
|
transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
30
|
+
opacity: hasExpandableContent ? 1 : 0.2,
|
|
30
31
|
};
|
|
31
|
-
}, [isExpanded]);
|
|
32
|
-
return (jsx_runtime_1.jsx("button", { type: "button", style: style, onClick: onClick, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} ${label}`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "white" }) }) }));
|
|
32
|
+
}, [isExpanded, hasExpandableContent]);
|
|
33
|
+
return (jsx_runtime_1.jsx("button", { type: "button", style: style, onClick: onClick, disabled: !hasExpandableContent, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} ${label}`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "white" }) }) }));
|
|
33
34
|
};
|
|
34
35
|
exports.TimelineExpandArrowButton = TimelineExpandArrowButton;
|
|
35
36
|
const TimelineExpandArrowSpacer = () => {
|
|
@@ -113,7 +113,7 @@ const TimelineExpandedSection = ({ sequence, originalLocation, nestedDepth, node
|
|
|
113
113
|
if (node.kind === 'group') {
|
|
114
114
|
const isExpanded = (_a = expandedTracks[node.id]) !== null && _a !== void 0 ? _a : false;
|
|
115
115
|
return (jsx_runtime_1.jsxs("div", { style: { ...groupRowBase, paddingLeft }, children: [
|
|
116
|
-
jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(node.id), label: `${node.label} section
|
|
116
|
+
jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(node.id), label: `${node.label} section`, hasExpandableContent: true }), jsx_runtime_1.jsx("span", { style: rowLabel, children: node.label })
|
|
117
117
|
] }));
|
|
118
118
|
}
|
|
119
119
|
if (node.field) {
|
|
@@ -167,6 +167,13 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact }) => {
|
|
|
167
167
|
const outer = (0, react_1.useMemo)(() => {
|
|
168
168
|
return {
|
|
169
169
|
height: (0, timeline_layout_1.getTimelineLayerHeight)(sequence.type) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
|
|
170
|
+
borderBottom: `1px solid ${colors_1.TIMELINE_TRACK_SEPARATOR}`,
|
|
171
|
+
};
|
|
172
|
+
}, [sequence.type]);
|
|
173
|
+
const inner = (0, react_1.useMemo)(() => {
|
|
174
|
+
return {
|
|
175
|
+
// TODO: Not so small
|
|
176
|
+
height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO,
|
|
170
177
|
color: 'white',
|
|
171
178
|
fontFamily: 'Arial, Helvetica, sans-serif',
|
|
172
179
|
display: 'flex',
|
|
@@ -175,13 +182,12 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact }) => {
|
|
|
175
182
|
wordBreak: 'break-all',
|
|
176
183
|
textAlign: 'left',
|
|
177
184
|
paddingLeft: exports.SPACING,
|
|
178
|
-
borderBottom: `1px solid ${colors_1.TIMELINE_TRACK_SEPARATOR}`,
|
|
179
185
|
};
|
|
180
|
-
}, [
|
|
186
|
+
}, []);
|
|
181
187
|
const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
|
|
182
|
-
const trackRow = (jsx_runtime_1.
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsxs("div", { style: inner, children: [
|
|
189
|
+
jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility }), jsx_runtime_1.jsx("div", { style: padder }), sequence.parent && nestedDepth > 0 ? jsx_runtime_1.jsx("div", { style: space }) : null, visualModeActive ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", hasExpandableContent: hasExpandableContent })) : null, jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation })
|
|
190
|
+
] }) }));
|
|
185
191
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [visualModeEnvEnabled ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), visualModeActive && isExpanded && hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, originalLocation: originalLocation, nestedDepth: nestedDepth, nodePath: nodePath })) : null] }));
|
|
186
192
|
};
|
|
187
193
|
exports.TimelineListItem = TimelineListItem;
|
|
@@ -136,6 +136,8 @@ const TimelineStack = ({ isCompact, sequence, originalLocation }) => {
|
|
|
136
136
|
textOverflow: 'ellipsis',
|
|
137
137
|
overflow: 'hidden',
|
|
138
138
|
flexShrink: 100000,
|
|
139
|
+
userSelect: 'none',
|
|
140
|
+
WebkitUserSelect: 'none',
|
|
139
141
|
};
|
|
140
142
|
}, [opening, stackHovered, stackHoverable]);
|
|
141
143
|
const titleStyle = (0, react_1.useMemo)(() => {
|
|
@@ -4,9 +4,7 @@ exports.CopyStackTrace = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Button_1 = require("../../components/Button");
|
|
7
|
-
const
|
|
8
|
-
const ShortcutHint_1 = require("./ShortcutHint");
|
|
9
|
-
const CopyStackTrace = ({ canHaveKeyboardShortcuts, errorText }) => {
|
|
7
|
+
const CopyStackTrace = ({ errorText }) => {
|
|
10
8
|
const [copyState, setCopyState] = (0, react_1.useState)('idle');
|
|
11
9
|
const handleCopyToClipboard = (0, react_1.useCallback)(() => {
|
|
12
10
|
navigator.clipboard
|
|
@@ -20,22 +18,6 @@ const CopyStackTrace = ({ canHaveKeyboardShortcuts, errorText }) => {
|
|
|
20
18
|
setTimeout(() => setCopyState('idle'), 2000);
|
|
21
19
|
});
|
|
22
20
|
}, [errorText]);
|
|
23
|
-
const { registerKeybinding } = (0, use_keybinding_1.useKeybinding)();
|
|
24
|
-
(0, react_1.useEffect)(() => {
|
|
25
|
-
if (!canHaveKeyboardShortcuts) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const { unregister } = registerKeybinding({
|
|
29
|
-
event: 'keydown',
|
|
30
|
-
key: 't',
|
|
31
|
-
callback: handleCopyToClipboard,
|
|
32
|
-
commandCtrlKey: true,
|
|
33
|
-
preventDefault: true,
|
|
34
|
-
triggerIfInputFieldFocused: false,
|
|
35
|
-
keepRegisteredWhenNotHighestContext: false,
|
|
36
|
-
});
|
|
37
|
-
return () => unregister();
|
|
38
|
-
}, [canHaveKeyboardShortcuts, handleCopyToClipboard, registerKeybinding]);
|
|
39
21
|
const label = (0, react_1.useMemo)(() => {
|
|
40
22
|
if (copyState === 'copied') {
|
|
41
23
|
return 'Copied!';
|
|
@@ -45,6 +27,6 @@ const CopyStackTrace = ({ canHaveKeyboardShortcuts, errorText }) => {
|
|
|
45
27
|
}
|
|
46
28
|
return 'Copy Stacktrace';
|
|
47
29
|
}, [copyState]);
|
|
48
|
-
return
|
|
30
|
+
return jsx_runtime_1.jsx(Button_1.Button, { onClick: handleCopyToClipboard, children: label });
|
|
49
31
|
};
|
|
50
32
|
exports.CopyStackTrace = CopyStackTrace;
|
|
@@ -64,7 +64,7 @@ const ErrorDisplay = ({ display, keyboardShortcuts, onRetry, canHaveDismissButto
|
|
|
64
64
|
jsx_runtime_1.jsx(HelpLink_1.HelpLink, { link: helpLink, canHaveKeyboardShortcuts: keyboardShortcuts }), jsx_runtime_1.jsx("div", { style: spacer })
|
|
65
65
|
] })) : null, display.stackFrames.length > 0 && window.remotion_editorName ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
66
66
|
jsx_runtime_1.jsx(OpenInEditor_1.OpenInEditor, { canHaveKeyboardShortcuts: keyboardShortcuts, stack: display.stackFrames[0] }), jsx_runtime_1.jsx("div", { style: spacer })
|
|
67
|
-
] })) : null, jsx_runtime_1.jsx(CopyStackTrace_1.CopyStackTrace, {
|
|
67
|
+
] })) : null, jsx_runtime_1.jsx(CopyStackTrace_1.CopyStackTrace, { errorText: errorTextForCopy }), jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(SearchGitHubIssues_1.SearchGithubIssues, { canHaveKeyboardShortcuts: keyboardShortcuts, message: display.error.message }), jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(AskOnDiscord_1.AskOnDiscord, { canHaveKeyboardShortcuts: keyboardShortcuts }), onRetry ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
68
68
|
jsx_runtime_1.jsx("div", { style: spacer }), jsx_runtime_1.jsx(Retry_1.RetryButton, { onClick: onRetry, label: calculateMetadata ? 'Retry calculateMetadata()' : 'Retry' })
|
|
69
69
|
] })) : null, calculateMetadata ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
70
70
|
jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx(layout_1.Spacing, { y: 0.5 }), jsx_runtime_1.jsx(CalculateMetadataErrorExplainer_1.CalculateMetadataErrorExplainer, {})
|
|
@@ -4,6 +4,7 @@ exports.StackElement = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Button_1 = require("../../components/Button");
|
|
7
|
+
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
7
8
|
const carets_1 = require("./carets");
|
|
8
9
|
const CodeFrame_1 = require("./CodeFrame");
|
|
9
10
|
const format_location_1 = require("./format-location");
|
|
@@ -40,13 +41,33 @@ const StackElement = ({ s, lineNumberWidth, isFirst, defaultFunctionName }) => {
|
|
|
40
41
|
!((_b = s.originalFileName) === null || _b === void 0 ? void 0 : _b.startsWith('webpack/'))) ||
|
|
41
42
|
isFirst;
|
|
42
43
|
});
|
|
44
|
+
const [locationHovered, setLocationHovered] = (0, react_1.useState)(false);
|
|
45
|
+
const canOpenFileLocation = Boolean(window.remotion_editorName && s.originalFileName);
|
|
46
|
+
const onOpenFileLocation = (0, react_1.useCallback)(() => {
|
|
47
|
+
if (!canOpenFileLocation) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
(0, open_in_editor_1.openInEditor)(s).catch((err) => {
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.log('Could not open in editor', err);
|
|
53
|
+
});
|
|
54
|
+
}, [canOpenFileLocation, s]);
|
|
43
55
|
const toggleCodeFrame = (0, react_1.useCallback)(() => {
|
|
44
56
|
setShowCodeFrame((f) => !f);
|
|
45
57
|
}, []);
|
|
46
58
|
return (jsx_runtime_1.jsxs("div", { className: "css-reset", children: [
|
|
47
59
|
jsx_runtime_1.jsxs("div", { style: header, children: [
|
|
48
60
|
jsx_runtime_1.jsxs("div", { style: left, children: [
|
|
49
|
-
jsx_runtime_1.jsx("div", { style: fnName, children: (_a = s.originalFunctionName) !== null && _a !== void 0 ? _a : defaultFunctionName }), s.originalFileName ? (jsx_runtime_1.
|
|
61
|
+
jsx_runtime_1.jsx("div", { style: fnName, children: (_a = s.originalFunctionName) !== null && _a !== void 0 ? _a : defaultFunctionName }), s.originalFileName ? (jsx_runtime_1.jsx("div", { style: location, children: canOpenFileLocation ? (jsx_runtime_1.jsxs("span", { onClick: onOpenFileLocation, onPointerEnter: () => {
|
|
62
|
+
setLocationHovered(true);
|
|
63
|
+
}, onPointerLeave: () => {
|
|
64
|
+
setLocationHovered(false);
|
|
65
|
+
}, style: {
|
|
66
|
+
...location,
|
|
67
|
+
cursor: 'pointer',
|
|
68
|
+
textDecoration: locationHovered ? 'underline' : 'none',
|
|
69
|
+
textUnderlineOffset: locationHovered ? 4 : undefined,
|
|
70
|
+
}, children: [(0, format_location_1.formatLocation)(s.originalFileName), ":", s.originalLineNumber] })) : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [(0, format_location_1.formatLocation)(s.originalFileName), ":", s.originalLineNumber] })) })) : null] }), s.originalScriptCode && s.originalScriptCode.length > 0 ? (jsx_runtime_1.jsx(Button_1.Button, { onClick: toggleCodeFrame, children: showCodeFrame ? jsx_runtime_1.jsx(carets_1.CaretDown, { invert: false }) : jsx_runtime_1.jsx(carets_1.CaretRight, {}) })) : null] }), jsx_runtime_1.jsx("div", { children: s.originalScriptCode &&
|
|
50
71
|
s.originalScriptCode.length > 0 &&
|
|
51
72
|
showCodeFrame ? (jsx_runtime_1.jsx(CodeFrame_1.CodeFrame, { lineNumberWidth: lineNumberWidth, source: s.originalScriptCode })) : null })
|
|
52
73
|
] }));
|