@remotion/studio 4.0.494 → 4.0.496
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/api/get-static-files.d.ts +1 -1
- package/dist/components/AssetFileIcon.d.ts +7 -0
- package/dist/components/AssetFileIcon.js +24 -0
- package/dist/components/AssetSelectorItem.js +20 -14
- package/dist/components/Canvas.js +191 -36
- package/dist/components/CompositionSelectorItem.js +20 -31
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +21 -4
- package/dist/components/Editor.js +2 -4
- package/dist/components/InlineCompositionName.js +1 -1
- package/dist/components/InlineEditableTitle.d.ts +1 -0
- package/dist/components/InlineEditableTitle.js +56 -11
- package/dist/components/InspectorInfoHeader.d.ts +2 -0
- package/dist/components/InspectorInfoHeader.js +16 -4
- package/dist/components/InspectorLocationCopy.js +2 -2
- package/dist/components/InspectorPanel/AssetInspector.d.ts +4 -0
- package/dist/components/InspectorPanel/AssetInspector.js +11 -0
- package/dist/components/InspectorPanel/{DefaultInspector.d.ts → CompositionInspector.d.ts} +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +114 -0
- package/dist/components/InspectorPanel/CompositionInspectorHeader.d.ts +1 -0
- package/dist/components/{CurrentComposition.js → InspectorPanel/CompositionInspectorHeader.js} +26 -21
- package/dist/components/InspectorPanel/{CompositionDimensions.d.ts → CompositionMetadata.d.ts} +1 -1
- package/dist/components/InspectorPanel/{CompositionDimensions.js → CompositionMetadata.js} +17 -8
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +2 -2
- package/dist/components/InspectorPanel/EasingInspector.js +4 -6
- package/dist/components/InspectorPanel/KeyframeInspector.js +7 -8
- package/dist/components/InspectorPanel/KeyframeSettings.js +1 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +28 -3
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +34 -1
- package/dist/components/InspectorPanel/common.d.ts +12 -2
- package/dist/components/InspectorPanel/common.js +45 -22
- package/dist/components/InspectorPanel/styles.d.ts +5 -6
- package/dist/components/InspectorPanel/styles.js +13 -39
- package/dist/components/InspectorPanel/use-composition-actions.d.ts +8 -0
- package/dist/components/InspectorPanel/use-composition-actions.js +114 -0
- package/dist/components/InspectorPanel.js +11 -2
- package/dist/components/InspectorSequenceSection.d.ts +0 -1
- package/dist/components/InspectorSequenceSection.js +20 -49
- package/dist/components/InspectorSourceLocation.d.ts +1 -0
- package/dist/components/InspectorSourceLocation.js +5 -1
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/ComboBox.d.ts +2 -1
- package/dist/components/NewComposition/ComboBox.js +32 -7
- package/dist/components/NewComposition/InputDragger.d.ts +6 -0
- package/dist/components/NewComposition/InputDragger.js +26 -13
- package/dist/components/NewComposition/NewComposition.js +8 -1
- package/dist/components/NewComposition/ValidationMessage.d.ts +1 -1
- package/dist/components/PlaybackRateSelector.js +3 -3
- package/dist/components/Preview.js +15 -7
- package/dist/components/PreviewToolbar.js +3 -3
- package/dist/components/RenderButton.d.ts +1 -0
- package/dist/components/RenderButton.js +51 -7
- package/dist/components/RenderModal/RenderModalOutputName.js +34 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/SelectedOutlineOverlay.js +1 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/SvgImportDialog.d.ts +7 -0
- package/dist/components/SvgImportDialog.js +103 -0
- package/dist/components/Timeline/Timeline.js +1 -0
- package/dist/components/Timeline/TimelineAssetField.js +1 -1
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +8 -1
- package/dist/components/Timeline/TimelineEnumField.js +1 -1
- package/dist/components/Timeline/TimelineFieldLabel.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +26 -6
- package/dist/components/Timeline/TimelineList.js +9 -4
- package/dist/components/Timeline/TimelineRowChrome.js +10 -2
- package/dist/components/Timeline/TimelineRowLayoutContext.d.ts +3 -0
- package/dist/components/Timeline/TimelineRowLayoutContext.js +6 -0
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +2 -1
- package/dist/components/Timeline/TimelineSequenceItem.js +19 -11
- package/dist/components/Timeline/nest-timeline-tracks.d.ts +8 -0
- package/dist/components/Timeline/nest-timeline-tracks.js +25 -0
- package/dist/components/Timeline/timeline-scroll-logic.d.ts +8 -4
- package/dist/components/Timeline/timeline-scroll-logic.js +29 -15
- package/dist/components/import-assets.d.ts +17 -1
- package/dist/components/import-assets.js +96 -11
- package/dist/components/layout.d.ts +2 -0
- package/dist/components/layout.js +3 -1
- package/dist/components/open-in-new-window.d.ts +2 -0
- package/dist/components/open-in-new-window.js +28 -0
- package/dist/components/selected-outline-measurement.d.ts +2 -1
- package/dist/components/selected-outline-measurement.js +3 -1
- package/dist/esm/{chunk-tdncqycp.js → chunk-0v4n7nkh.js} +8463 -7092
- package/dist/esm/internals.mjs +8463 -7092
- package/dist/esm/previewEntry.mjs +8613 -7242
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/client-id.js +2 -1
- package/dist/helpers/clipboard-figma.d.ts +4 -0
- package/dist/helpers/clipboard-figma.js +41 -0
- package/dist/helpers/clipboard-images.d.ts +10 -0
- package/dist/helpers/clipboard-images.js +77 -0
- package/dist/helpers/clipboard-svg.d.ts +3 -0
- package/dist/helpers/clipboard-svg.js +47 -0
- package/dist/helpers/get-effective-translation.d.ts +2 -1
- package/dist/helpers/get-effective-translation.js +15 -7
- package/dist/helpers/get-preview-file-type.d.ts +1 -1
- package/dist/helpers/get-preview-file-type.js +5 -1
- package/dist/helpers/inject-css.js +11 -0
- package/dist/helpers/studio-fit-padding.d.ts +41 -0
- package/dist/helpers/studio-fit-padding.js +64 -0
- package/dist/helpers/use-image-metadata.d.ts +8 -0
- package/dist/helpers/use-image-metadata.js +82 -0
- package/dist/helpers/use-studio-canvas-dimensions.js +2 -2
- package/dist/icons/audio.d.ts +3 -0
- package/dist/icons/audio.js +3 -1
- package/dist/icons/font.d.ts +4 -0
- package/dist/icons/font.js +8 -0
- package/dist/icons/frame.d.ts +3 -1
- package/dist/icons/frame.js +1 -1
- package/dist/icons/json.d.ts +4 -0
- package/dist/icons/json.js +8 -0
- package/dist/icons/magnet.js +1 -1
- package/dist/icons/scissors.d.ts +5 -0
- package/dist/icons/scissors.js +8 -0
- package/dist/icons/solid.d.ts +5 -0
- package/dist/icons/solid.js +8 -0
- package/dist/icons/video.d.ts +3 -0
- package/dist/icons/video.js +5 -1
- package/dist/state/modals.d.ts +8 -1
- package/dist/state/timeline-zoom.js +12 -11
- package/package.json +11 -11
- package/dist/components/CurrentComposition.d.ts +0 -2
- package/dist/components/InspectorPanel/DefaultInspector.js +0 -97
|
@@ -9,7 +9,6 @@ const colors_1 = require("../helpers/colors");
|
|
|
9
9
|
const get_folder_id_1 = require("../helpers/get-folder-id");
|
|
10
10
|
const noop_1 = require("../helpers/noop");
|
|
11
11
|
const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
|
|
12
|
-
const url_state_1 = require("../helpers/url-state");
|
|
13
12
|
const folder_1 = require("../icons/folder");
|
|
14
13
|
const modals_1 = require("../state/modals");
|
|
15
14
|
const composition_menu_items_1 = require("./composition-menu-items");
|
|
@@ -19,26 +18,29 @@ const ContextMenu_1 = require("./ContextMenu");
|
|
|
19
18
|
const folder_menu_items_1 = require("./folder-menu-items");
|
|
20
19
|
const layout_1 = require("./layout");
|
|
21
20
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
21
|
+
const open_in_new_window_1 = require("./open-in-new-window");
|
|
22
22
|
const actions_1 = require("./RenderQueue/actions");
|
|
23
23
|
const SidebarRenderButton_1 = require("./SidebarRenderButton");
|
|
24
24
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
25
|
-
const COMPOSITION_ITEM_HEIGHT = 32;
|
|
26
25
|
const itemStyle = {
|
|
27
26
|
paddingRight: 10,
|
|
28
|
-
paddingTop:
|
|
29
|
-
paddingBottom:
|
|
27
|
+
paddingTop: 5,
|
|
28
|
+
paddingBottom: 5,
|
|
30
29
|
fontSize: 13,
|
|
31
30
|
display: 'flex',
|
|
32
31
|
textDecoration: 'none',
|
|
33
32
|
cursor: 'default',
|
|
34
33
|
alignItems: 'center',
|
|
35
34
|
marginBottom: 1,
|
|
35
|
+
marginLeft: 4,
|
|
36
|
+
marginRight: 4,
|
|
36
37
|
appearance: 'none',
|
|
37
38
|
border: 'none',
|
|
38
|
-
|
|
39
|
+
borderRadius: 4,
|
|
40
|
+
width: 'calc(100% - 8px)',
|
|
39
41
|
textAlign: 'left',
|
|
40
42
|
backgroundColor: colors_1.BACKGROUND,
|
|
41
|
-
height:
|
|
43
|
+
height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
|
|
42
44
|
userSelect: 'none',
|
|
43
45
|
};
|
|
44
46
|
const labelStyle = {
|
|
@@ -69,6 +71,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
69
71
|
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
70
72
|
setHovered(false);
|
|
71
73
|
}, []);
|
|
74
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
72
75
|
const [dragHovered, setDragHovered] = (0, react_1.useState)(false);
|
|
73
76
|
const compositionRowRef = (0, react_1.useRef)(null);
|
|
74
77
|
const compositionId = item.type === 'composition' ? item.composition.id : null;
|
|
@@ -87,7 +90,9 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
87
90
|
...itemStyle,
|
|
88
91
|
backgroundColor: dragHovered
|
|
89
92
|
? colors_1.WHITE_ALPHA_12
|
|
90
|
-
:
|
|
93
|
+
: hovered || selected
|
|
94
|
+
? colors_1.WHITE_ALPHA_06
|
|
95
|
+
: colors_1.TRANSPARENT,
|
|
91
96
|
paddingLeft: 12 + level * 8,
|
|
92
97
|
};
|
|
93
98
|
}, [dragHovered, hovered, level, selected]);
|
|
@@ -127,27 +132,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
127
132
|
readOnlyStudio: window.remotion_isReadOnlyStudio,
|
|
128
133
|
});
|
|
129
134
|
return [
|
|
130
|
-
{
|
|
131
|
-
id: 'open-in-new-window',
|
|
132
|
-
keyHint: null,
|
|
133
|
-
label: 'Open in new window',
|
|
134
|
-
leftItem: null,
|
|
135
|
-
onClick: () => {
|
|
136
|
-
var _a, _b;
|
|
137
|
-
const screen = window.screen;
|
|
138
|
-
const width = Math.min(1200, Math.floor(screen.availWidth * 0.8));
|
|
139
|
-
const height = Math.min(800, Math.floor(screen.availHeight * 0.8));
|
|
140
|
-
const displayLeft = (_a = screen.availLeft) !== null && _a !== void 0 ? _a : 0;
|
|
141
|
-
const displayTop = (_b = screen.availTop) !== null && _b !== void 0 ? _b : 0;
|
|
142
|
-
const left = Math.round(Math.min(Math.max(window.screenX + (window.outerWidth - width) / 2, displayLeft), displayLeft + screen.availWidth - width));
|
|
143
|
-
const top = Math.round(Math.min(Math.max(window.screenY + (window.outerHeight - height) / 2, displayTop), displayTop + screen.availHeight - height));
|
|
144
|
-
window.open((0, url_state_1.getUrlForRoute)(`/${item.composition.id}`), '_blank', `popup,width=${width},height=${height},left=${left},top=${top}`);
|
|
145
|
-
},
|
|
146
|
-
quickSwitcherLabel: null,
|
|
147
|
-
subMenu: null,
|
|
148
|
-
type: 'item',
|
|
149
|
-
value: 'open-in-new-window',
|
|
150
|
-
},
|
|
135
|
+
(0, open_in_new_window_1.getOpenInNewWindowMenuItem)(`/${item.composition.id}`),
|
|
151
136
|
{
|
|
152
137
|
type: 'divider',
|
|
153
138
|
id: 'open-in-new-window-divider',
|
|
@@ -170,12 +155,16 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
170
155
|
event.preventDefault();
|
|
171
156
|
return;
|
|
172
157
|
}
|
|
158
|
+
setIsDragging(true);
|
|
173
159
|
event.dataTransfer.effectAllowed = 'copyMove';
|
|
174
160
|
event.dataTransfer.setData(studio_shared_1.COMPOSITION_DRAG_MIME_TYPE, JSON.stringify((0, studio_shared_1.makeCompositionDragData)({
|
|
175
161
|
compositionFile: (_a = resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) !== null && _a !== void 0 ? _a : null,
|
|
176
162
|
compositionId: item.composition.id,
|
|
177
163
|
})));
|
|
178
164
|
}, [item, resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source]);
|
|
165
|
+
const onCompositionDragEnd = (0, react_1.useCallback)(() => {
|
|
166
|
+
setIsDragging(false);
|
|
167
|
+
}, []);
|
|
179
168
|
const onFolderDragOver = (0, react_1.useCallback)((event) => {
|
|
180
169
|
if (item.type !== 'folder' ||
|
|
181
170
|
window.remotion_isReadOnlyStudio ||
|
|
@@ -253,13 +242,13 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
253
242
|
}, [clearRootDragHover, item, toggleFolder]);
|
|
254
243
|
if (item.type === 'folder') {
|
|
255
244
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
256
|
-
jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, onDragOver: onFolderDragOver, onDragLeave: onFolderDragLeave, onDrop: onFolderDrop, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.folderName }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered })
|
|
245
|
+
jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: style, className: "__remotion-composition-selector-item", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, onDragOver: onFolderDragOver, onDragLeave: onFolderDragLeave, onDrop: onFolderDrop, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.folderName }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered })
|
|
257
246
|
] }) }) }), item.expanded ? (jsx_runtime_1.jsx("div", { onDragOver: onFolderChildListDragOver, onDrop: onFolderDrop, children: item.items.map((childItem) => {
|
|
258
247
|
return (jsx_runtime_1.jsx(exports.CompositionSelectorItem, { currentComposition: currentComposition, selectComposition: selectComposition, item: childItem, tabIndex: tabIndex, level: level + 1, toggleFolder: toggleFolder, clearRootDragHover: clearRootDragHover }, childItem.key + childItem.type));
|
|
259
248
|
}) })) : null] }));
|
|
260
249
|
}
|
|
261
|
-
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("a", { ref: compositionRowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, draggable: !window.remotion_isReadOnlyStudio, onDragStart: onCompositionDragStart, type: "button", title: item.composition.id, className: "__remotion-composition", "data-compname": item.composition.id, children: [
|
|
262
|
-
jsx_runtime_1.jsx(CompositionOrStillIcon_1.CompositionOrStillIcon, { composition: item.composition, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.composition.id }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered }), jsx_runtime_1.jsx(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered, composition: item.composition })
|
|
250
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("a", { ref: compositionRowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, draggable: !window.remotion_isReadOnlyStudio, onDragStart: onCompositionDragStart, onDragEnd: onCompositionDragEnd, type: "button", title: item.composition.id, className: "__remotion-composition __remotion-composition-selector-item", "data-compname": item.composition.id, children: [
|
|
251
|
+
jsx_runtime_1.jsx(CompositionOrStillIcon_1.CompositionOrStillIcon, { composition: item.composition, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.composition.id }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered && !isDragging }), jsx_runtime_1.jsx(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered && !isDragging, composition: item.composition })
|
|
263
252
|
] }) }) }));
|
|
264
253
|
};
|
|
265
254
|
exports.CompositionSelectorItem = CompositionSelectorItem;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { MediaMetadata } from '../helpers/use-media-metadata';
|
|
3
3
|
export declare const CURRENT_ASSET_HEIGHT = 84;
|
|
4
4
|
export declare const getCurrentAssetMetadataSource: (assetName: string | null) => string | null;
|
|
5
|
+
export declare const getCurrentAssetImageMetadataSource: (assetName: string | null) => string | null;
|
|
5
6
|
export declare const getCurrentAssetMediaDetailLines: (mediaMetadata: MediaMetadata) => string[];
|
|
6
7
|
export declare const AssetInfo: React.FC<{
|
|
7
8
|
readonly assetName: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CurrentAsset = exports.AssetInfo = exports.getCurrentAssetMediaDetailLines = exports.getCurrentAssetMetadataSource = exports.CURRENT_ASSET_HEIGHT = void 0;
|
|
3
|
+
exports.CurrentAsset = exports.AssetInfo = exports.getCurrentAssetMediaDetailLines = exports.getCurrentAssetImageMetadataSource = exports.getCurrentAssetMetadataSource = exports.CURRENT_ASSET_HEIGHT = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -9,9 +9,11 @@ const client_id_1 = require("../helpers/client-id");
|
|
|
9
9
|
const format_media_duration_1 = require("../helpers/format-media-duration");
|
|
10
10
|
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
11
11
|
const render_codec_label_1 = require("../helpers/render-codec-label");
|
|
12
|
+
const use_image_metadata_1 = require("../helpers/use-image-metadata");
|
|
12
13
|
const use_media_metadata_1 = require("../helpers/use-media-metadata");
|
|
13
14
|
const InlineEditableTitle_1 = require("./InlineEditableTitle");
|
|
14
15
|
const InspectorInfoHeader_1 = require("./InspectorInfoHeader");
|
|
16
|
+
const InspectorPanelLayout_1 = require("./InspectorPanelLayout");
|
|
15
17
|
const use_rename_static_file_1 = require("./NewComposition/use-rename-static-file");
|
|
16
18
|
const use_static_files_1 = require("./use-static-files");
|
|
17
19
|
exports.CURRENT_ASSET_HEIGHT = InspectorInfoHeader_1.INSPECTOR_INFO_HEADER_MIN_HEIGHT;
|
|
@@ -25,6 +27,15 @@ const getCurrentAssetMetadataSource = (assetName) => {
|
|
|
25
27
|
: null;
|
|
26
28
|
};
|
|
27
29
|
exports.getCurrentAssetMetadataSource = getCurrentAssetMetadataSource;
|
|
30
|
+
const getCurrentAssetImageMetadataSource = (assetName) => {
|
|
31
|
+
if (!assetName) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return (0, get_preview_file_type_1.getPreviewFileType)(assetName) === 'image'
|
|
35
|
+
? (0, remotion_1.staticFile)(assetName)
|
|
36
|
+
: null;
|
|
37
|
+
};
|
|
38
|
+
exports.getCurrentAssetImageMetadataSource = getCurrentAssetImageMetadataSource;
|
|
28
39
|
const formatFps = (fps) => `${fps.toFixed(2)} FPS`;
|
|
29
40
|
const getCurrentAssetMediaDetailLines = (mediaMetadata) => {
|
|
30
41
|
const detailLines = [];
|
|
@@ -74,6 +85,8 @@ const AssetInfo = ({ assetName, contentSized = false, onAssetClick, readOnlyStud
|
|
|
74
85
|
}, [assetName, staticFiles]);
|
|
75
86
|
const src = (0, exports.getCurrentAssetMetadataSource)(assetName);
|
|
76
87
|
const mediaMetadata = (0, use_media_metadata_1.useMediaMetadata)(src);
|
|
88
|
+
const imageSrc = (0, exports.getCurrentAssetImageMetadataSource)(assetName);
|
|
89
|
+
const imageMetadata = (0, use_image_metadata_1.useImageMetadata)(imageSrc);
|
|
77
90
|
const canRename = onAssetClick === undefined &&
|
|
78
91
|
connectionStatus === 'connected' &&
|
|
79
92
|
!readOnlyStudio;
|
|
@@ -96,12 +109,16 @@ const AssetInfo = ({ assetName, contentSized = false, onAssetClick, readOnlyStud
|
|
|
96
109
|
subtitleParts.push(`${mediaMetadata.width}x${mediaMetadata.height}`);
|
|
97
110
|
}
|
|
98
111
|
}
|
|
112
|
+
else if (imageMetadata) {
|
|
113
|
+
subtitleParts.push(imageMetadata.format);
|
|
114
|
+
subtitleParts.push(`${imageMetadata.width}x${imageMetadata.height}`);
|
|
115
|
+
}
|
|
99
116
|
const mediaDetailLines = mediaMetadata
|
|
100
117
|
? (0, exports.getCurrentAssetMediaDetailLines)(mediaMetadata)
|
|
101
118
|
: [];
|
|
102
|
-
return (jsx_runtime_1.jsxs(InspectorInfoHeader_1.InspectorInfoHeader, { contentSized: contentSized, children: [
|
|
103
|
-
jsx_runtime_1.jsx(InlineEditableTitle_1.InlineEditableTitle, { value: fileName, canRename: canRename, getInitialSelection: use_rename_static_file_1.getStaticFileRenameSelection, onClick: onAssetClick, onCommit: onRename, title: assetName }), subtitleParts.length > 0 ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: subtitleParts.join(' · ') })) : null, mediaMetadata ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: (0, format_media_duration_1.formatMediaDuration)(mediaMetadata.duration) })) : null, mediaDetailLines.map((line) => {
|
|
104
|
-
return jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: line }, line);
|
|
119
|
+
return (jsx_runtime_1.jsxs(InspectorInfoHeader_1.InspectorInfoHeader, { contentSized: contentSized, padding: contentSized ? `0 ${InspectorPanelLayout_1.INSPECTOR_PANEL_HORIZONTAL_PADDING}px 6px` : '4px 0', children: [
|
|
120
|
+
jsx_runtime_1.jsx(InlineEditableTitle_1.InlineEditableTitle, { value: fileName, canRename: canRename, getInitialSelection: use_rename_static_file_1.getStaticFileRenameSelection, onClick: onAssetClick, onCommit: onRename, size: contentSized ? 'default' : 'inspector', title: assetName }), subtitleParts.length > 0 ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { size: contentSized ? 'default' : 'inspector', children: subtitleParts.join(' · ') })) : null, mediaMetadata ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { size: contentSized ? 'default' : 'inspector', children: (0, format_media_duration_1.formatMediaDuration)(mediaMetadata.duration) })) : null, mediaDetailLines.map((line) => {
|
|
121
|
+
return (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { size: contentSized ? 'default' : 'inspector', children: line }, line));
|
|
105
122
|
})] }));
|
|
106
123
|
};
|
|
107
124
|
exports.AssetInfo = AssetInfo;
|
|
@@ -40,6 +40,7 @@ const react_1 = __importStar(require("react"));
|
|
|
40
40
|
const remotion_1 = require("remotion");
|
|
41
41
|
const colors_1 = require("../helpers/colors");
|
|
42
42
|
const noop_1 = require("../helpers/noop");
|
|
43
|
+
const studio_fit_padding_1 = require("../helpers/studio-fit-padding");
|
|
43
44
|
const studio_runtime_config_1 = require("../helpers/studio-runtime-config");
|
|
44
45
|
const canvas_ref_1 = require("../state/canvas-ref");
|
|
45
46
|
const scale_lock_1 = require("../state/scale-lock");
|
|
@@ -83,10 +84,7 @@ const Editor = ({ Root, readOnlyStudio }) => {
|
|
|
83
84
|
if (!size) {
|
|
84
85
|
return null;
|
|
85
86
|
}
|
|
86
|
-
return
|
|
87
|
-
type: 'canvas-size',
|
|
88
|
-
canvasSize: size,
|
|
89
|
-
};
|
|
87
|
+
return (0, studio_fit_padding_1.getStudioCurrentScaleContext)(size);
|
|
90
88
|
}, [size]);
|
|
91
89
|
const MemoRoot = (0, react_1.useMemo)(() => {
|
|
92
90
|
return react_1.default.memo(Root);
|
|
@@ -53,6 +53,6 @@ const InlineCompositionName = ({ compositionId, stack, compositions }) => {
|
|
|
53
53
|
stack,
|
|
54
54
|
symbolicatedStack,
|
|
55
55
|
]);
|
|
56
|
-
return (jsx_runtime_1.jsx(InlineEditableTitle_1.InlineEditableTitle, { value: compositionId, canRename: canRename, onCommit: commit }));
|
|
56
|
+
return (jsx_runtime_1.jsx(InlineEditableTitle_1.InlineEditableTitle, { value: compositionId, canRename: canRename, onCommit: commit, size: "inspector" }));
|
|
57
57
|
};
|
|
58
58
|
exports.InlineCompositionName = InlineCompositionName;
|
|
@@ -5,5 +5,6 @@ export declare const InlineEditableTitle: React.FC<{
|
|
|
5
5
|
readonly getInitialSelection?: (value: string) => [number, number];
|
|
6
6
|
readonly onClick?: () => void;
|
|
7
7
|
readonly onCommit: (newValue: string) => void;
|
|
8
|
+
readonly size?: 'default' | 'inspector';
|
|
8
9
|
readonly title?: string;
|
|
9
10
|
}>;
|
|
@@ -4,6 +4,7 @@ exports.InlineEditableTitle = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
7
|
+
const layout_1 = require("./layout");
|
|
7
8
|
const titleWrapper = {
|
|
8
9
|
boxSizing: 'border-box',
|
|
9
10
|
color: colors_1.WHITE,
|
|
@@ -53,7 +54,39 @@ const titleInput = {
|
|
|
53
54
|
WebkitAppearance: 'none',
|
|
54
55
|
width: '100%',
|
|
55
56
|
};
|
|
56
|
-
const
|
|
57
|
+
const inspectorTitleWrapper = {
|
|
58
|
+
...titleWrapper,
|
|
59
|
+
fontFamily: 'sans-serif',
|
|
60
|
+
fontSize: 13,
|
|
61
|
+
height: layout_1.COMPACT_INLINE_ROW_HEIGHT,
|
|
62
|
+
margin: '0 4px',
|
|
63
|
+
width: 'calc(100% - 8px)',
|
|
64
|
+
};
|
|
65
|
+
const inspectorTitleInner = {
|
|
66
|
+
...titleInner,
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
fontFamily: 'sans-serif',
|
|
69
|
+
fontSize: 13,
|
|
70
|
+
height: layout_1.COMPACT_INLINE_ROW_HEIGHT,
|
|
71
|
+
paddingBottom: 0,
|
|
72
|
+
paddingLeft: 8,
|
|
73
|
+
paddingRight: 8,
|
|
74
|
+
paddingTop: 0,
|
|
75
|
+
width: '100%',
|
|
76
|
+
};
|
|
77
|
+
const inspectorTitleGridItem = {
|
|
78
|
+
...titleGridItem,
|
|
79
|
+
color: 'inherit',
|
|
80
|
+
fontFamily: 'sans-serif',
|
|
81
|
+
fontSize: 13,
|
|
82
|
+
lineHeight: '18px',
|
|
83
|
+
};
|
|
84
|
+
const inspectorTitleInput = {
|
|
85
|
+
...titleInput,
|
|
86
|
+
fontFamily: 'sans-serif',
|
|
87
|
+
fontSize: 13,
|
|
88
|
+
};
|
|
89
|
+
const InlineEditableTitle = ({ value, canRename, getInitialSelection, onClick, onCommit, size = 'default', title, }) => {
|
|
57
90
|
const [isEditing, setIsEditing] = (0, react_1.useState)(false);
|
|
58
91
|
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
59
92
|
const [draftValue, setDraftValue] = (0, react_1.useState)(value);
|
|
@@ -118,22 +151,34 @@ const InlineEditableTitle = ({ value, canRename, getInitialSelection, onClick, o
|
|
|
118
151
|
const isInteractive = canRename || onClick !== undefined;
|
|
119
152
|
const backgroundColor = isEditing
|
|
120
153
|
? colors_1.INPUT_BACKGROUND
|
|
121
|
-
:
|
|
122
|
-
|
|
123
|
-
:
|
|
154
|
+
: (0, colors_1.getBackgroundFromHoverState)({
|
|
155
|
+
hovered: isHovered && isInteractive,
|
|
156
|
+
selected: false,
|
|
157
|
+
});
|
|
158
|
+
const isInspectorSize = size === 'inspector';
|
|
124
159
|
const innerStyle = (0, react_1.useMemo)(() => {
|
|
125
160
|
return {
|
|
126
|
-
...titleInner,
|
|
161
|
+
...(isInspectorSize ? inspectorTitleInner : titleInner),
|
|
127
162
|
backgroundColor,
|
|
128
|
-
cursor: isEditing
|
|
163
|
+
cursor: isEditing
|
|
164
|
+
? 'text'
|
|
165
|
+
: isInspectorSize
|
|
166
|
+
? 'text'
|
|
167
|
+
: isInteractive
|
|
168
|
+
? 'pointer'
|
|
169
|
+
: 'default',
|
|
129
170
|
userSelect: isEditing ? 'text' : 'none',
|
|
130
|
-
width: isEditing ? '100%' : undefined,
|
|
171
|
+
width: isEditing || isInspectorSize ? '100%' : undefined,
|
|
131
172
|
};
|
|
132
|
-
}, [backgroundColor, isEditing, isInteractive]);
|
|
133
|
-
|
|
173
|
+
}, [backgroundColor, isEditing, isInspectorSize, isInteractive]);
|
|
174
|
+
const gridItemStyle = isInspectorSize
|
|
175
|
+
? inspectorTitleGridItem
|
|
176
|
+
: titleGridItem;
|
|
177
|
+
const inputStyle = isInspectorSize ? inspectorTitleInput : titleInput;
|
|
178
|
+
return (jsx_runtime_1.jsx("div", { style: isInspectorSize ? inspectorTitleWrapper : titleWrapper, title: title !== null && title !== void 0 ? title : value, children: jsx_runtime_1.jsxs("span", { style: innerStyle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: isEditing || !isInteractive ? undefined : handleClick, children: [
|
|
134
179
|
jsx_runtime_1.jsx("span", { "aria-hidden": isEditing, style: {
|
|
135
|
-
...
|
|
180
|
+
...gridItemStyle,
|
|
136
181
|
visibility: isEditing ? 'hidden' : 'visible',
|
|
137
|
-
}, children: value }), isEditing ? (jsx_runtime_1.jsx("input", { ref: focusInput, style: { ...
|
|
182
|
+
}, children: value }), isEditing ? (jsx_runtime_1.jsx("input", { ref: focusInput, style: { ...gridItemStyle, ...inputStyle }, value: draftValue, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown })) : null] }) }));
|
|
138
183
|
};
|
|
139
184
|
exports.InlineEditableTitle = InlineEditableTitle;
|
|
@@ -4,10 +4,12 @@ export declare const InspectorInfoHeader: React.FC<{
|
|
|
4
4
|
readonly children?: React.ReactNode;
|
|
5
5
|
readonly contentSized?: boolean;
|
|
6
6
|
readonly minHeight?: number;
|
|
7
|
+
readonly padding?: React.CSSProperties['padding'];
|
|
7
8
|
}>;
|
|
8
9
|
export declare const InspectorInfoTitle: React.FC<{
|
|
9
10
|
readonly children: React.ReactNode;
|
|
10
11
|
}>;
|
|
11
12
|
export declare const InspectorInfoSubtitle: React.FC<{
|
|
12
13
|
readonly children: React.ReactNode;
|
|
14
|
+
readonly size?: 'default' | 'inspector';
|
|
13
15
|
}>;
|
|
@@ -44,12 +44,24 @@ const subtitle = {
|
|
|
44
44
|
textOverflow: 'ellipsis',
|
|
45
45
|
whiteSpace: 'nowrap',
|
|
46
46
|
};
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const inspectorSubtitle = {
|
|
48
|
+
...subtitle,
|
|
49
|
+
boxSizing: 'border-box',
|
|
50
|
+
fontFamily: 'sans-serif',
|
|
51
|
+
fontSize: 13,
|
|
52
|
+
height: 28,
|
|
53
|
+
lineHeight: '18px',
|
|
54
|
+
margin: '0 4px',
|
|
55
|
+
padding: '5px 8px',
|
|
56
|
+
width: 'calc(100% - 8px)',
|
|
57
|
+
};
|
|
58
|
+
const InspectorInfoHeader = ({ children, contentSized = false, minHeight, padding }) => {
|
|
59
|
+
const sizeStyle = contentSized
|
|
49
60
|
? containerBase
|
|
50
61
|
: minHeight === undefined
|
|
51
62
|
? container
|
|
52
63
|
: { ...containerBase, minHeight };
|
|
64
|
+
const style = padding === undefined ? sizeStyle : { ...sizeStyle, padding };
|
|
53
65
|
return (jsx_runtime_1.jsx("div", { style: style, children: children === undefined || children === null ? null : (jsx_runtime_1.jsx("div", { style: row, children: jsx_runtime_1.jsx("div", { style: content, children: children }) })) }));
|
|
54
66
|
};
|
|
55
67
|
exports.InspectorInfoHeader = InspectorInfoHeader;
|
|
@@ -57,7 +69,7 @@ const InspectorInfoTitle = ({ children }) => {
|
|
|
57
69
|
return jsx_runtime_1.jsx("div", { style: title, children: children });
|
|
58
70
|
};
|
|
59
71
|
exports.InspectorInfoTitle = InspectorInfoTitle;
|
|
60
|
-
const InspectorInfoSubtitle = ({ children }) => {
|
|
61
|
-
return jsx_runtime_1.jsx("div", { style: subtitle, children: children });
|
|
72
|
+
const InspectorInfoSubtitle = ({ children, size = 'default' }) => {
|
|
73
|
+
return (jsx_runtime_1.jsx("div", { style: size === 'inspector' ? inspectorSubtitle : subtitle, children: children }));
|
|
62
74
|
};
|
|
63
75
|
exports.InspectorInfoSubtitle = InspectorInfoSubtitle;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetInspector = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const CurrentAsset_1 = require("../CurrentAsset");
|
|
6
|
+
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
const AssetInspector = ({ readOnlyStudio }) => {
|
|
9
|
+
return (jsx_runtime_1.jsx("div", { style: styles_1.scrollableContainer, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx("div", { style: styles_1.inspectorOverviewSection, children: jsx_runtime_1.jsx(CurrentAsset_1.CurrentAsset, { readOnlyStudio: readOnlyStudio }) }) }));
|
|
10
|
+
};
|
|
11
|
+
exports.AssetInspector = AssetInspector;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { _InternalTypes } from 'remotion';
|
|
3
3
|
import type { UpdaterFunction } from '../RenderModal/SchemaEditor/ZodSwitch';
|
|
4
|
-
export declare const
|
|
5
|
-
readonly composition: _InternalTypes['AnyComposition']
|
|
4
|
+
export declare const CompositionInspector: React.FC<{
|
|
5
|
+
readonly composition: _InternalTypes['AnyComposition'];
|
|
6
6
|
readonly currentDefaultProps: Record<string, unknown>;
|
|
7
7
|
readonly readOnlyStudio: boolean;
|
|
8
8
|
readonly setDefaultProps: UpdaterFunction<Record<string, unknown>>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompositionInspector = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
|
|
7
|
+
const frame_1 = require("../../icons/frame");
|
|
8
|
+
const solid_1 = require("../../icons/solid");
|
|
9
|
+
const VisualControls_1 = require("../../visual-controls/VisualControls");
|
|
10
|
+
const DefaultPropsEditor_1 = require("../DefaultPropsEditor");
|
|
11
|
+
const get_zod_if_possible_1 = require("../get-zod-if-possible");
|
|
12
|
+
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
13
|
+
const ObserveDefaultPropsContext_1 = require("../ObserveDefaultPropsContext");
|
|
14
|
+
const DataEditor_1 = require("../RenderModal/DataEditor");
|
|
15
|
+
const zod_schema_type_1 = require("../RenderModal/SchemaEditor/zod-schema-type");
|
|
16
|
+
const WarningIndicatorButton_1 = require("../RenderModal/WarningIndicatorButton");
|
|
17
|
+
const SegmentedControl_1 = require("../SegmentedControl");
|
|
18
|
+
const VisualControlsContent_1 = require("../VisualControls/VisualControlsContent");
|
|
19
|
+
const common_1 = require("./common");
|
|
20
|
+
const CompositionInspectorHeader_1 = require("./CompositionInspectorHeader");
|
|
21
|
+
const CompositionMetadata_1 = require("./CompositionMetadata");
|
|
22
|
+
const styles_1 = require("./styles");
|
|
23
|
+
const use_composition_actions_1 = require("./use-composition-actions");
|
|
24
|
+
const actionIconStyle = {
|
|
25
|
+
height: 18,
|
|
26
|
+
width: 18,
|
|
27
|
+
};
|
|
28
|
+
const CompositionActions = () => {
|
|
29
|
+
const { canInsertAsset, canInsertSolid, canShowInsertAsset, canShowInsertSolid, insertAsset, insertSolid, } = (0, use_composition_actions_1.useCompositionActions)();
|
|
30
|
+
if (!canShowInsertAsset && !canShowInsertSolid) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return (jsx_runtime_1.jsxs(common_1.InspectorActionSection, { children: [canShowInsertSolid ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertSolid, onClick: insertSolid, renderIcon: (color) => (jsx_runtime_1.jsx(solid_1.SolidIcon, { color: color, style: actionIconStyle })), children: "Add Solid" })) : null, canShowInsertAsset ? (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { disabled: !canInsertAsset, onClick: insertAsset, renderIcon: (color) => (jsx_runtime_1.jsx(frame_1.PicIcon, { color: color, style: actionIconStyle })), children: "Add asset..." })) : null] }));
|
|
34
|
+
};
|
|
35
|
+
const CompositionDefaultPropsSection = ({ composition, currentDefaultProps, setDefaultProps }) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
38
|
+
const canSaveDefaultProps = (0, react_1.useContext)(ObserveDefaultPropsContext_1.ObserveDefaultPropsContext);
|
|
39
|
+
const [defaultPropsMode, setDefaultPropsMode] = (0, react_1.useState)('schema');
|
|
40
|
+
const compositionId = composition.id;
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
42
|
+
setDefaultPropsMode('schema');
|
|
43
|
+
}, [compositionId]);
|
|
44
|
+
const defaultPropsModeItems = (0, react_1.useMemo)(() => {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
key: 'schema',
|
|
48
|
+
label: 'Schema',
|
|
49
|
+
onClick: () => {
|
|
50
|
+
setDefaultPropsMode('schema');
|
|
51
|
+
},
|
|
52
|
+
selected: defaultPropsMode === 'schema',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'json',
|
|
56
|
+
label: 'JSON',
|
|
57
|
+
onClick: () => {
|
|
58
|
+
setDefaultPropsMode('json');
|
|
59
|
+
},
|
|
60
|
+
selected: defaultPropsMode === 'json',
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
}, [defaultPropsMode]);
|
|
64
|
+
const canShowDefaultPropsSection = (0, react_1.useMemo)(() => {
|
|
65
|
+
if (!z || !composition.schema || !composition.defaultProps) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (!(typeof composition.schema.safeParse ===
|
|
69
|
+
'function')) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return (0, zod_schema_type_1.getZodSchemaType)(composition.schema) !== 'any';
|
|
73
|
+
}, [composition.defaultProps, composition.schema, z]);
|
|
74
|
+
const { setShowWarning, showWarning } = (0, DataEditor_1.useDataEditorWarningVisibility)();
|
|
75
|
+
const { warnings: defaultPropsWarnings } = (0, DataEditor_1.useDataEditorWarnings)({
|
|
76
|
+
canSaveDefaultProps: (_a = canSaveDefaultProps === null || canSaveDefaultProps === void 0 ? void 0 : canSaveDefaultProps.canSaveDefaultProps) !== null && _a !== void 0 ? _a : null,
|
|
77
|
+
defaultProps: currentDefaultProps,
|
|
78
|
+
mode: defaultPropsMode,
|
|
79
|
+
propsEditType: 'default-props',
|
|
80
|
+
showCannotSaveDefaultPropsWarning: canShowDefaultPropsSection,
|
|
81
|
+
});
|
|
82
|
+
if (!canShowDefaultPropsSection) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
86
|
+
jsx_runtime_1.jsx(common_1.InspectorSectionDivider, {}), jsx_runtime_1.jsxs("div", { style: styles_1.compositionDefaultPropsSection, children: [
|
|
87
|
+
jsx_runtime_1.jsx(common_1.InspectorSectionHeader, { children: jsx_runtime_1.jsxs("div", { style: styles_1.sectionHeaderRow, children: [
|
|
88
|
+
jsx_runtime_1.jsxs("div", { style: styles_1.sectionHeaderStart, children: [
|
|
89
|
+
jsx_runtime_1.jsx("span", { style: styles_1.sectionHeaderTitle, children: "Default Props" }), jsx_runtime_1.jsx(SegmentedControl_1.SegmentedControl, { items: defaultPropsModeItems, needsWrapping: false, size: "compact" })
|
|
90
|
+
] }), jsx_runtime_1.jsx("div", { style: styles_1.sectionHeaderEnd, children: defaultPropsWarnings.length > 0 ? (jsx_runtime_1.jsx(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: defaultPropsWarnings.length, size: "compact" })) : null })
|
|
91
|
+
] }) }), defaultPropsWarnings.length > 0 && showWarning ? (jsx_runtime_1.jsx("div", { style: styles_1.defaultPropsWarningContainer, children: jsx_runtime_1.jsx(common_1.InspectorDefaultPropsWarnings, { warnings: defaultPropsWarnings }) })) : null, jsx_runtime_1.jsx(DefaultPropsEditor_1.DefaultPropsEditor, { unresolvedComposition: composition, defaultProps: currentDefaultProps, setDefaultProps: setDefaultProps, propsEditType: "default-props", schemaErrorMode: "compact", layout: "inspector", mode: defaultPropsMode, onModeChange: setDefaultPropsMode, hideModeControls: canShowDefaultPropsSection, warnings: defaultPropsWarnings, showWarning: false, setShowWarning: setShowWarning, hideWarningButton: true }, composition.id)
|
|
92
|
+
] })
|
|
93
|
+
] }));
|
|
94
|
+
};
|
|
95
|
+
const CompositionVisualControlsSection = () => {
|
|
96
|
+
const { handles: visualControlHandles } = (0, react_1.useContext)(VisualControls_1.VisualControlsContext);
|
|
97
|
+
const hasVisualControls = interactivity_enabled_1.studioInteractivityEnabled && Object.keys(visualControlHandles).length > 0;
|
|
98
|
+
if (!hasVisualControls) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
102
|
+
jsx_runtime_1.jsx(common_1.InspectorSectionDivider, {}), jsx_runtime_1.jsxs("div", { style: styles_1.compositionVisualControlsSection, children: [
|
|
103
|
+
jsx_runtime_1.jsx(common_1.InspectorSectionHeader, { children: "Visual Controls" }), jsx_runtime_1.jsx(VisualControlsContent_1.VisualControlsContent, {})
|
|
104
|
+
] })
|
|
105
|
+
] }));
|
|
106
|
+
};
|
|
107
|
+
const CompositionInspector = ({ composition, currentDefaultProps, readOnlyStudio, setDefaultProps }) => {
|
|
108
|
+
return (jsx_runtime_1.jsxs("div", { style: styles_1.scrollableContainer, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: [
|
|
109
|
+
jsx_runtime_1.jsxs("div", { style: styles_1.inspectorOverviewSection, children: [
|
|
110
|
+
jsx_runtime_1.jsx(CompositionInspectorHeader_1.CompositionInspectorHeader, {}), jsx_runtime_1.jsx(common_1.InspectorSectionDivider, {}), jsx_runtime_1.jsx(CompositionMetadata_1.CompositionMetadata, { compositionId: composition.id, disabled: readOnlyStudio, stack: composition.stack })
|
|
111
|
+
] }), jsx_runtime_1.jsx(CompositionDefaultPropsSection, { composition: composition, currentDefaultProps: currentDefaultProps, setDefaultProps: setDefaultProps }), jsx_runtime_1.jsx(CompositionVisualControlsSection, {}), jsx_runtime_1.jsx(CompositionActions, {})
|
|
112
|
+
] }));
|
|
113
|
+
};
|
|
114
|
+
exports.CompositionInspector = CompositionInspector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CompositionInspectorHeader: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/components/{CurrentComposition.js → InspectorPanel/CompositionInspectorHeader.js}
RENAMED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CompositionInspectorHeader = 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 is_composition_still_1 = require("
|
|
8
|
-
const open_in_editor_1 = require("
|
|
9
|
-
const react_2 = require("
|
|
10
|
-
const still_1 = require("
|
|
11
|
-
const video_1 = require("
|
|
12
|
-
const InlineCompositionName_1 = require("
|
|
13
|
-
const InspectorInfoHeader_1 = require("
|
|
14
|
-
const InspectorLocationCopy_1 = require("
|
|
15
|
-
const InspectorSourceLocation_1 = require("
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
7
|
+
const is_composition_still_1 = require("../../helpers/is-composition-still");
|
|
8
|
+
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
9
|
+
const react_2 = require("../../icons/react");
|
|
10
|
+
const still_1 = require("../../icons/still");
|
|
11
|
+
const video_1 = require("../../icons/video");
|
|
12
|
+
const InlineCompositionName_1 = require("../InlineCompositionName");
|
|
13
|
+
const InspectorInfoHeader_1 = require("../InspectorInfoHeader");
|
|
14
|
+
const InspectorLocationCopy_1 = require("../InspectorLocationCopy");
|
|
15
|
+
const InspectorSourceLocation_1 = require("../InspectorSourceLocation");
|
|
16
|
+
const layout_1 = require("../layout");
|
|
17
|
+
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
18
|
+
const use_resolved_stack_1 = require("../Timeline/use-resolved-stack");
|
|
19
|
+
const COMPOSITION_INSPECTOR_HEADER_HEIGHT = 66;
|
|
19
20
|
const sourceLocationIconStyle = {
|
|
20
21
|
flexShrink: 0,
|
|
21
|
-
height:
|
|
22
|
-
width:
|
|
22
|
+
height: 18,
|
|
23
|
+
width: 18,
|
|
24
|
+
};
|
|
25
|
+
const componentLocationPlaceholder = {
|
|
26
|
+
flexShrink: 0,
|
|
27
|
+
height: layout_1.COMPACT_INLINE_ROW_HEIGHT,
|
|
23
28
|
};
|
|
24
29
|
const renderReactIcon = (color) => {
|
|
25
30
|
return jsx_runtime_1.jsx(react_2.ReactIcon, { color: color, style: sourceLocationIconStyle });
|
|
26
31
|
};
|
|
27
|
-
const
|
|
32
|
+
const CompositionInspectorHeader = () => {
|
|
28
33
|
var _a, _b, _c, _d, _e;
|
|
29
34
|
const video = remotion_1.Internals.useVideo();
|
|
30
35
|
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
@@ -85,9 +90,9 @@ const CurrentComposition = () => {
|
|
|
85
90
|
}
|
|
86
91
|
return (0, is_composition_still_1.isCompositionStill)(video) ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: color, style: sourceLocationIconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { color: color, style: sourceLocationIconStyle }));
|
|
87
92
|
}, [video]);
|
|
88
|
-
return (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoHeader, { minHeight:
|
|
89
|
-
jsx_runtime_1.
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
return (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoHeader, { minHeight: COMPOSITION_INSPECTOR_HEADER_HEIGHT, padding: "4px 0", children: video ? (jsx_runtime_1.jsxs(InspectorLocationCopy_1.InspectorLocationCopy, { location: validatedLocation, name: video.id, children: [
|
|
94
|
+
jsx_runtime_1.jsx(InlineCompositionName_1.InlineCompositionName, { compositionId: video.id, stack: (_e = currentComposition === null || currentComposition === void 0 ? void 0 : currentComposition.stack) !== null && _e !== void 0 ? _e : null, compositions: compositions }, video.id), jsx_runtime_1.jsx(InspectorSourceLocation_1.InspectorSourceLocation, { location: validatedLocation, canOpen: validatedLocation !== null, onOpen: openFileLocation, renderIcon: renderCompositionIcon, size: "inline-action" }), compositionComponentInfo === null &&
|
|
95
|
+
compositionFile !== null &&
|
|
96
|
+
compositionId !== null ? (jsx_runtime_1.jsx("div", { "aria-hidden": true, style: componentLocationPlaceholder })) : (jsx_runtime_1.jsx(InspectorSourceLocation_1.InspectorSourceLocation, { location: componentLocation, canOpen: componentLocation !== null, onOpen: openComponentLocation, renderIcon: renderReactIcon, size: "inline-action" }))] })) : null }));
|
|
92
97
|
};
|
|
93
|
-
exports.
|
|
98
|
+
exports.CompositionInspectorHeader = CompositionInspectorHeader;
|