@remotion/studio 4.0.515 → 4.0.517
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/restart-studio.js +4 -0
- package/dist/components/AssetSelector.js +4 -10
- package/dist/components/AssetSelectorItem.d.ts +2 -1
- package/dist/components/AssetSelectorItem.js +24 -29
- package/dist/components/Canvas.js +21 -15
- package/dist/components/CanvasCaptureDropHandler.d.ts +4 -0
- package/dist/components/CanvasCaptureDropHandler.js +42 -0
- package/dist/components/CanvasOrLoading.js +4 -3
- package/dist/components/CaptionInspector.d.ts +2 -0
- package/dist/components/CaptionInspector.js +3 -5
- package/dist/components/CheckboardToggle.js +1 -1
- package/dist/components/Checkbox.d.ts +0 -1
- package/dist/components/Checkbox.js +2 -19
- package/dist/components/CompositionSelector.js +6 -3
- package/dist/components/CompositionSelectorItem.js +9 -10
- package/dist/components/ConfigSelect.d.ts +17 -0
- package/dist/components/ConfigSelect.js +50 -0
- package/dist/components/ConfigureLicenseModal.js +79 -46
- package/dist/components/CurrentAsset.d.ts +10 -2
- package/dist/components/CurrentAsset.js +143 -45
- package/dist/components/Editor.js +2 -1
- package/dist/components/EditorContent.js +5 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.d.ts +1 -0
- package/dist/components/EditorRuler/Ruler.js +9 -8
- package/dist/components/EditorRuler/index.d.ts +1 -0
- package/dist/components/EditorRuler/index.js +3 -4
- package/dist/components/EditorRuler/use-is-ruler-visible.d.ts +1 -1
- package/dist/components/EditorRuler/use-is-ruler-visible.js +8 -2
- package/dist/components/ElementLibraryModal.d.ts +5 -0
- package/dist/components/ElementLibraryModal.js +38 -0
- package/dist/components/FilePreview.js +71 -0
- package/dist/components/FixComputedValueModal.js +54 -51
- package/dist/components/GlobalKeybindings.js +5 -5
- package/dist/components/InlineAction.d.ts +1 -1
- package/dist/components/InlineAction.js +12 -2
- package/dist/components/InlineCaptionInspector.d.ts +2 -0
- package/dist/components/InlineCaptionInspector.js +2 -2
- package/dist/components/InlineCompositionName.js +1 -1
- package/dist/components/InlineEditableTitle.js +5 -4
- package/dist/components/InspectorInfoHeader.js +1 -1
- package/dist/components/InspectorOpenInEditor.js +48 -72
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -3
- package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.d.ts +7 -0
- package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.js +39 -0
- package/dist/components/InspectorPanel/CompositionInspector.js +25 -45
- package/dist/components/InspectorPanel/CompositionInspectorHeader.js +2 -2
- package/dist/components/InspectorPanel/CompositionMetadata.js +11 -4
- package/dist/components/InspectorPanel/EasingInspector.js +2 -2
- package/dist/components/InspectorPanel/ElementLibraryButton.d.ts +2 -0
- package/dist/components/InspectorPanel/ElementLibraryButton.js +139 -0
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +10 -4
- package/dist/components/InspectorPanel/KeyframeInspector.js +1 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +14 -6
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +2 -7
- package/dist/components/InspectorPanel/common.d.ts +0 -13
- package/dist/components/InspectorPanel/common.js +6 -59
- package/dist/components/InspectorPanel/inspector-selection.d.ts +2 -2
- package/dist/components/InspectorPanel/styles.d.ts +0 -1
- package/dist/components/InspectorPanel/styles.js +3 -4
- package/dist/components/InspectorPanel/use-composition-actions.js +0 -1
- package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -2
- package/dist/components/InspectorPanelLayout.d.ts +1 -1
- package/dist/components/InspectorPanelLayout.js +1 -1
- package/dist/components/InspectorSequenceSection.d.ts +1 -2
- package/dist/components/InspectorSequenceSection.js +40 -54
- package/dist/components/InspectorSourceLocation.js +1 -1
- package/dist/components/InstallPackage.d.ts +2 -1
- package/dist/components/InstallPackage.js +60 -30
- package/dist/components/InstallablePackage.js +37 -11
- package/dist/components/KeyboardShortcutsSettings.d.ts +2 -0
- package/dist/components/KeyboardShortcutsSettings.js +177 -0
- package/dist/components/Menu/MenuItem.js +15 -6
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/MenuToolbar.js +7 -3
- package/dist/components/Modals.js +7 -5
- package/dist/components/NewComposition/CodemodFooter.d.ts +0 -1
- package/dist/components/NewComposition/CodemodFooter.js +2 -8
- package/dist/components/NewComposition/DeleteComposition.js +1 -1
- package/dist/components/NewComposition/DeleteFolder.js +1 -1
- package/dist/components/NewComposition/DuplicateComposition.js +1 -1
- package/dist/components/NewComposition/InputDragger.js +27 -4
- package/dist/components/NewComposition/NewComposition.js +1 -1
- package/dist/components/NewComposition/NewFolder.js +1 -3
- package/dist/components/NewComposition/RenameComposition.js +1 -1
- package/dist/components/NewComposition/RenameFolder.js +1 -1
- package/dist/components/NewComposition/use-rename-static-file.js +1 -1
- package/dist/components/Notifications/NotificationCenter.d.ts +1 -0
- package/dist/components/Notifications/NotificationCenter.js +5 -0
- package/dist/components/OptionsPanel.js +9 -12
- package/dist/components/PlaybackRateSelector.js +1 -1
- package/dist/components/Preview.js +83 -5
- package/dist/components/PreviewToolbar.js +12 -3
- package/dist/components/PreviewToolbarOverflowButton.d.ts +1 -0
- package/dist/components/PreviewToolbarOverflowButton.js +39 -2
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +2 -2
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +14 -30
- package/dist/components/RadioButton.d.ts +6 -0
- package/dist/components/RadioButton.js +62 -0
- package/dist/components/RenderButton.js +68 -184
- package/dist/components/RenderModal/DataEditor.js +15 -12
- package/dist/components/RenderModal/RenderStatusModal.js +0 -1
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +3 -1
- package/dist/components/RenderModal/SchemaEditor/infer-zod-schema-from-value.d.ts +15 -0
- package/dist/components/RenderModal/SchemaEditor/infer-zod-schema-from-value.js +95 -0
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +1 -6
- package/dist/components/RenderingSettings.js +7 -4
- package/dist/components/RulersAndGuidesToggle.d.ts +4 -0
- package/dist/components/RulersAndGuidesToggle.js +34 -0
- package/dist/components/SegmentedButton.d.ts +29 -0
- package/dist/components/SegmentedButton.js +226 -0
- package/dist/components/SelectedOutlineEditingHandles.d.ts +16 -0
- package/dist/components/SelectedOutlineEditingHandles.js +66 -0
- package/dist/components/SelectedOutlineElement.d.ts +2 -4
- package/dist/components/SelectedOutlineElement.js +15 -54
- package/dist/components/SelectedOutlineOverlay.js +32 -6
- package/dist/components/SelectedOutlinePolygon.d.ts +4 -6
- package/dist/components/SelectedOutlinePolygon.js +18 -16
- package/dist/components/SelectedOutlineRenderer.d.ts +1 -2
- package/dist/components/SelectedOutlineRenderer.js +66 -14
- package/dist/components/SelectedOutlineUvControls.d.ts +1 -1
- package/dist/components/SettingsModal.d.ts +1 -1
- package/dist/components/SettingsModal.js +30 -7
- package/dist/components/SettingsModalFooter.d.ts +3 -1
- package/dist/components/SettingsModalFooter.js +20 -4
- package/dist/components/ShowPixelGridProvider.d.ts +4 -0
- package/dist/components/ShowPixelGridProvider.js +24 -0
- package/dist/components/SidebarCollapserControls.js +2 -2
- package/dist/components/SkillsSettings.d.ts +2 -0
- package/dist/components/SkillsSettings.js +129 -0
- package/dist/components/StaticFilePreview.js +7 -1
- package/dist/components/StudioSettings.js +7 -48
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Timeline/Timeline.js +41 -1
- package/dist/components/Timeline/TimelineAssetField.d.ts +1 -1
- package/dist/components/Timeline/TimelineAssetField.js +15 -9
- package/dist/components/Timeline/TimelineBooleanField.js +1 -4
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +6 -7
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +7 -10
- package/dist/components/Timeline/TimelineDragHandler.js +11 -4
- package/dist/components/Timeline/TimelineEffectItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineEffectItem.js +23 -10
- package/dist/components/Timeline/TimelineEffectPropItem.js +15 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +5 -4
- package/dist/components/Timeline/TimelineFieldLabel.js +4 -2
- package/dist/components/Timeline/TimelineFieldRowContent.d.ts +1 -2
- package/dist/components/Timeline/TimelineFieldRowContent.js +8 -21
- package/dist/components/Timeline/TimelineImageInfo.d.ts +0 -1
- package/dist/components/Timeline/TimelineImageInfo.js +13 -32
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +1 -2
- package/dist/components/Timeline/TimelineKeyframeControls.js +10 -4
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +4 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +1 -1
- package/dist/components/Timeline/TimelineRotationField.js +0 -2
- package/dist/components/Timeline/TimelineRowChrome.d.ts +0 -1
- package/dist/components/Timeline/TimelineRowChrome.js +3 -4
- package/dist/components/Timeline/TimelineRowLayoutContext.d.ts +0 -1
- package/dist/components/Timeline/TimelineRowLayoutContext.js +1 -4
- package/dist/components/Timeline/TimelineScaleField.js +2 -6
- package/dist/components/Timeline/TimelineSchemaField.js +9 -3
- package/dist/components/Timeline/TimelineSelection.d.ts +29 -66
- package/dist/components/Timeline/TimelineSelection.js +31 -171
- package/dist/components/Timeline/TimelineSequence.d.ts +2 -0
- package/dist/components/Timeline/TimelineSequence.js +110 -19
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +13 -11
- package/dist/components/Timeline/TimelineSequencePropItem.js +15 -2
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +7 -6
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +85 -91
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTransformOriginField.js +0 -4
- package/dist/components/Timeline/TimelineTranslateField.js +0 -4
- package/dist/components/Timeline/TimelineVirtualization.js +3 -1
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +3 -4
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +3 -4
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +3 -12
- package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
- package/dist/components/Timeline/get-copy-context-for-agents-menu-item.d.ts +4 -0
- package/dist/components/Timeline/get-copy-context-for-agents-menu-item.js +26 -0
- package/dist/components/Timeline/get-sequence-context-menu-items.js +2 -19
- package/dist/components/Timeline/get-timeline-sequence-visible-layout.d.ts +6 -1
- package/dist/components/Timeline/get-timeline-sequence-visible-layout.js +11 -4
- package/dist/components/Timeline/keyframe-clipboard.d.ts +2 -3
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +2 -3
- package/dist/components/Timeline/sequence-prop-clipboard.d.ts +2 -3
- package/dist/components/Timeline/split-selected-timeline-item.d.ts +2 -3
- package/dist/components/Timeline/split-selected-timeline-item.js +0 -1
- package/dist/components/Timeline/timeline-expanded-filter.d.ts +1 -2
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +1 -1
- package/dist/components/Timeline/timeline-field-row-layout.js +4 -7
- package/dist/components/Timeline/timeline-field-utils.js +0 -2
- package/dist/components/Timeline/timeline-scroll-logic.d.ts +7 -5
- package/dist/components/Timeline/timeline-scroll-logic.js +12 -7
- package/dist/components/Timeline/update-selected-easing.d.ts +7 -7
- package/dist/components/Timeline/use-timeline-asset-drop.js +24 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +6 -7
- package/dist/components/TimelineCombobox.js +25 -160
- package/dist/components/TimelineInOutToggle.js +4 -1
- package/dist/components/canvas-capture-drop.d.ts +4 -0
- package/dist/components/canvas-capture-drop.js +22 -0
- package/dist/components/duplicate-jsx-node-api.d.ts +2 -0
- package/dist/components/duplicate-jsx-node-api.js +12 -0
- package/dist/components/effect-drag-and-drop.js +1 -4
- package/dist/components/handle-drop.d.ts +2 -1
- package/dist/components/handle-drop.js +3 -3
- package/dist/components/import-assets.js +9 -65
- package/dist/components/keyboard-shortcuts.d.ts +10 -0
- package/dist/components/keyboard-shortcuts.js +135 -0
- package/dist/components/selected-outline-control-layout.js +2 -6
- package/dist/components/selected-outline-measurement.d.ts +8 -9
- package/dist/components/selected-outline-measurement.js +16 -3
- package/dist/components/use-delete-asset.d.ts +1 -0
- package/dist/components/use-delete-asset.js +40 -0
- package/dist/components/use-selected-outline-control-target.d.ts +11 -0
- package/dist/components/use-selected-outline-control-target.js +79 -0
- package/dist/esm/{chunk-s6k99gh2.js → chunk-4bxz1d3g.js} +3 -2
- package/dist/esm/{chunk-v5a8vpv4.js → chunk-gzqm3g2m.js} +47432 -40444
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/internals.mjs +47431 -40443
- package/dist/esm/previewEntry.mjs +47169 -40181
- package/dist/esm/renderEntry.mjs +2 -2
- package/dist/helpers/add-asset-cache-bust.d.ts +4 -0
- package/dist/helpers/add-asset-cache-bust.js +10 -0
- package/dist/helpers/calculate-timeline.d.ts +1 -7
- package/dist/helpers/calculate-timeline.js +2 -145
- package/dist/helpers/colors.d.ts +2 -0
- package/dist/helpers/colors.js +6 -2
- package/dist/helpers/drag-aware-double-click.d.ts +6 -0
- package/dist/helpers/drag-aware-double-click.js +20 -0
- package/dist/helpers/editor-ruler.js +6 -5
- package/dist/helpers/get-asset-metadata.d.ts +19 -0
- package/dist/helpers/get-asset-metadata.js +75 -21
- package/dist/helpers/get-connected-compositions.d.ts +1 -6
- package/dist/helpers/get-connected-compositions.js +2 -8
- package/dist/helpers/get-sequence-double-click-action.d.ts +2 -1
- package/dist/helpers/get-sequence-double-click-action.js +7 -1
- package/dist/helpers/get-sequence-visible-range.d.ts +1 -5
- package/dist/helpers/get-sequence-visible-range.js +6 -51
- package/dist/helpers/get-timeline-nestedness.d.ts +1 -2
- package/dist/helpers/get-timeline-nestedness.js +2 -12
- package/dist/helpers/get-timeline-sequence-layout.d.ts +4 -1
- package/dist/helpers/get-timeline-sequence-layout.js +15 -6
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -21
- package/dist/helpers/get-timeline-sequence-sort-key.js +2 -16
- package/dist/helpers/hoverable.d.ts +1 -0
- package/dist/helpers/hoverable.js +2 -1
- package/dist/helpers/inject-css.js +3 -1
- package/dist/helpers/is-current-selected-still.js +4 -2
- package/dist/helpers/open-in-remotion-convert.d.ts +7 -0
- package/dist/helpers/open-in-remotion-convert.js +18 -0
- package/dist/helpers/sort-by-nonce-history.d.ts +1 -5
- package/dist/helpers/sort-by-nonce-history.js +3 -148
- package/dist/helpers/timeline-node-path-key.d.ts +1 -2
- package/dist/helpers/timeline-node-path-key.js +2 -2
- package/dist/helpers/use-media-metadata.d.ts +2 -1
- package/dist/helpers/use-media-metadata.js +12 -5
- package/dist/helpers/use-menu-structure.js +52 -32
- package/dist/icons/align-center-horizontal.js +1 -1
- package/dist/icons/align-left.js +1 -1
- package/dist/icons/align-right.js +1 -1
- package/dist/icons/keyboard.d.ts +4 -0
- package/dist/icons/keyboard.js +10 -0
- package/dist/icons/license.d.ts +4 -0
- package/dist/icons/license.js +8 -0
- package/dist/icons/package.d.ts +4 -0
- package/dist/icons/package.js +8 -0
- package/dist/icons/react.js +1 -1
- package/dist/icons/remotion-convert.d.ts +4 -0
- package/dist/icons/remotion-convert.js +10 -0
- package/dist/icons/skills.d.ts +4 -0
- package/dist/icons/skills.js +10 -0
- package/dist/state/editor-pixel-grid.d.ts +8 -0
- package/dist/state/editor-pixel-grid.js +18 -0
- package/dist/state/modals.d.ts +6 -5
- package/package.json +14 -12
- package/dist/components/KeyboardShortcutsExplainer.d.ts +0 -2
- package/dist/components/KeyboardShortcutsExplainer.js +0 -194
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VideoPreview = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const media_1 = require("@remotion/media");
|
|
5
6
|
const player_1 = require("@remotion/player");
|
|
6
7
|
const react_1 = require("react");
|
|
8
|
+
const react_dom_1 = require("react-dom");
|
|
7
9
|
const remotion_1 = require("remotion");
|
|
8
10
|
const ErrorLoader_1 = require("../error-overlay/remotion-overlay/ErrorLoader");
|
|
11
|
+
const add_asset_cache_bust_1 = require("../helpers/add-asset-cache-bust");
|
|
9
12
|
const checkerboard_background_1 = require("../helpers/checkerboard-background");
|
|
10
13
|
const colors_1 = require("../helpers/colors");
|
|
11
14
|
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
12
15
|
const studio_fit_padding_1 = require("../helpers/studio-fit-padding");
|
|
16
|
+
const audio_1 = require("../icons/audio");
|
|
13
17
|
const checkerboard_1 = require("../state/checkerboard");
|
|
18
|
+
const editor_pixel_grid_1 = require("../state/editor-pixel-grid");
|
|
14
19
|
const is_menu_item_1 = require("./Menu/is-menu-item");
|
|
15
20
|
const RenderPreview_1 = require("./RenderPreview");
|
|
16
21
|
const SelectedOutlineOverlay_1 = require("./SelectedOutlineOverlay");
|
|
@@ -38,9 +43,13 @@ const assetMetadataErrorContainer = {
|
|
|
38
43
|
overflowY: 'auto',
|
|
39
44
|
};
|
|
40
45
|
const checkerboardSize = 49;
|
|
46
|
+
const PIXEL_GRID_MIN_SCALE = 4;
|
|
41
47
|
const containerStyle = (options) => {
|
|
42
48
|
return {
|
|
43
49
|
transform: `scale(${options.scale})`,
|
|
50
|
+
// Avoid the background bleeding through opaque compositions at fractional
|
|
51
|
+
// scales due to Chromium compositing the child and background together.
|
|
52
|
+
willChange: 'transform',
|
|
44
53
|
marginLeft: options.xCorrection,
|
|
45
54
|
marginTop: options.yCorrection,
|
|
46
55
|
width: options.width,
|
|
@@ -54,6 +63,20 @@ const containerStyle = (options) => {
|
|
|
54
63
|
backgroundPosition: (0, checkerboard_background_1.getCheckerboardBackgroundPos)(checkerboardSize) /* Must be half of one side of the square */,
|
|
55
64
|
};
|
|
56
65
|
};
|
|
66
|
+
const PixelGrid = ({ scale }) => {
|
|
67
|
+
const { editorShowPixelGrid } = (0, react_1.useContext)(editor_pixel_grid_1.EditorShowPixelGridContext);
|
|
68
|
+
if (!editorShowPixelGrid || scale < PIXEL_GRID_MIN_SCALE) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return (jsx_runtime_1.jsx("div", { "aria-hidden": "true", className: "css-reset", "data-testid": "pixel-grid", style: {
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
inset: 0,
|
|
74
|
+
pointerEvents: 'none',
|
|
75
|
+
opacity: 0.35,
|
|
76
|
+
backgroundImage: `linear-gradient(to right, ${colors_1.RULER_COLOR} 1px, transparent 1px), linear-gradient(to bottom, ${colors_1.RULER_COLOR} 1px, transparent 1px)`,
|
|
77
|
+
backgroundSize: `${scale}px ${scale}px`,
|
|
78
|
+
} }));
|
|
79
|
+
};
|
|
57
80
|
const VideoPreview = ({ canvasSize, contentDimensions, canvasContent, assetMetadata, onRetryAssetMetadata, }) => {
|
|
58
81
|
if (assetMetadata && assetMetadata.type === 'not-found') {
|
|
59
82
|
return (jsx_runtime_1.jsx("div", { style: centeredContainer, children: jsx_runtime_1.jsx("div", { style: label, children: "File does not exist" }) }));
|
|
@@ -61,7 +84,8 @@ const VideoPreview = ({ canvasSize, contentDimensions, canvasContent, assetMetad
|
|
|
61
84
|
if (assetMetadata && assetMetadata.type === 'metadata-error') {
|
|
62
85
|
return (jsx_runtime_1.jsx("div", { style: assetMetadataErrorContainer, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx(ErrorLoader_1.ErrorLoader, { canHaveDismissButton: false, keyboardShortcuts: false, error: assetMetadata.error, onRetry: onRetryAssetMetadata !== null && onRetryAssetMetadata !== void 0 ? onRetryAssetMetadata : null, calculateMetadata: false }, assetMetadata.error.stack) }));
|
|
63
86
|
}
|
|
64
|
-
if (contentDimensions === null
|
|
87
|
+
if (contentDimensions === null ||
|
|
88
|
+
(canvasContent.type !== 'composition' && assetMetadata === null)) {
|
|
65
89
|
return (jsx_runtime_1.jsx("div", { style: centeredContainer, children: jsx_runtime_1.jsx(Spinner_1.Spinner, { duration: 0.5, size: 24 }) }));
|
|
66
90
|
}
|
|
67
91
|
return (jsx_runtime_1.jsx(CompWhenItHasDimensions, { contentDimensions: contentDimensions, canvasSize: canvasSize, canvasContent: canvasContent, assetMetadata: assetMetadata }));
|
|
@@ -69,6 +93,7 @@ const VideoPreview = ({ canvasSize, contentDimensions, canvasContent, assetMetad
|
|
|
69
93
|
exports.VideoPreview = VideoPreview;
|
|
70
94
|
const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent, assetMetadata }) => {
|
|
71
95
|
const { size: previewSize } = (0, react_1.useContext)(remotion_1.Internals.PreviewSizeContext);
|
|
96
|
+
const { currentAssetMetadata } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
72
97
|
const [canvasHovered, setCanvasHovered] = (0, react_1.useState)(false);
|
|
73
98
|
const compositionContainerRef = (0, react_1.useRef)(null);
|
|
74
99
|
(0, react_1.useEffect)(() => {
|
|
@@ -111,6 +136,17 @@ const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent,
|
|
|
111
136
|
previewSize: previewSize.size,
|
|
112
137
|
});
|
|
113
138
|
}, [canvasContent.type, canvasSize, contentDimensions, previewSize.size]);
|
|
139
|
+
const assetFileType = canvasContent.type === 'asset'
|
|
140
|
+
? (0, get_preview_file_type_1.getPreviewFileType)(canvasContent.asset)
|
|
141
|
+
: null;
|
|
142
|
+
const mediaCompositionFileType = (assetFileType === 'audio' || assetFileType === 'video') &&
|
|
143
|
+
(assetMetadata === null || assetMetadata === void 0 ? void 0 : assetMetadata.type) === 'found' &&
|
|
144
|
+
assetMetadata.mediaMetadata !== null &&
|
|
145
|
+
canvasContent.type === 'asset' &&
|
|
146
|
+
(currentAssetMetadata === null || currentAssetMetadata === void 0 ? void 0 : currentAssetMetadata.asset) === canvasContent.asset &&
|
|
147
|
+
contentDimensions !== 'none'
|
|
148
|
+
? assetFileType
|
|
149
|
+
: null;
|
|
114
150
|
const outer = (0, react_1.useMemo)(() => {
|
|
115
151
|
return {
|
|
116
152
|
width: contentDimensions === 'none' ? '100%' : contentDimensions.width * scale,
|
|
@@ -123,9 +159,12 @@ const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent,
|
|
|
123
159
|
left: centerX - previewSize.translation.x,
|
|
124
160
|
top: centerY - previewSize.translation.y,
|
|
125
161
|
overflow: canvasContent.type === 'composition' ? 'visible' : 'hidden',
|
|
126
|
-
justifyContent: canvasContent.type === 'asset'
|
|
162
|
+
justifyContent: canvasContent.type === 'asset' && mediaCompositionFileType === null
|
|
163
|
+
? 'center'
|
|
164
|
+
: 'flex-start',
|
|
127
165
|
alignItems: canvasContent.type === 'asset' &&
|
|
128
|
-
|
|
166
|
+
mediaCompositionFileType === null &&
|
|
167
|
+
assetFileType === 'audio'
|
|
129
168
|
? 'center'
|
|
130
169
|
: 'normal',
|
|
131
170
|
};
|
|
@@ -137,8 +176,25 @@ const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent,
|
|
|
137
176
|
previewSize.translation.y,
|
|
138
177
|
centerY,
|
|
139
178
|
canvasContent,
|
|
179
|
+
mediaCompositionFileType,
|
|
180
|
+
assetFileType,
|
|
140
181
|
]);
|
|
141
182
|
if (canvasContent.type === 'asset') {
|
|
183
|
+
if (mediaCompositionFileType !== null &&
|
|
184
|
+
(assetMetadata === null || assetMetadata === void 0 ? void 0 : assetMetadata.type) === 'found' &&
|
|
185
|
+
contentDimensions !== 'none') {
|
|
186
|
+
return (jsx_runtime_1.jsxs("div", { ref: compositionContainerRef, className: "remotion-studio-composition-container", style: outer, children: [mediaCompositionFileType === 'audio' ? (jsx_runtime_1.jsx(audio_1.AudioFileIcon, { "aria-label": "Audio asset", color: colors_1.LIGHT_TEXT, role: "img", style: {
|
|
187
|
+
height: 64,
|
|
188
|
+
left: '50%',
|
|
189
|
+
opacity: 0.25,
|
|
190
|
+
pointerEvents: 'none',
|
|
191
|
+
position: 'absolute',
|
|
192
|
+
top: '50%',
|
|
193
|
+
transform: 'translate(-50%, -50%)',
|
|
194
|
+
width: 64,
|
|
195
|
+
} })) : null, jsx_runtime_1.jsx(PortalContainer, { contentDimensions: contentDimensions, offscreen: mediaCompositionFileType === 'audio', scale: scale, xCorrection: xCorrection, yCorrection: yCorrection }), jsx_runtime_1.jsx(AssetMediaComposition, { asset: canvasContent.asset, fetchedAt: assetMetadata.fetchedAt, fileType: mediaCompositionFileType })
|
|
196
|
+
] }));
|
|
197
|
+
}
|
|
142
198
|
return (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsx(StaticFilePreview_1.StaticFilePreview, { assetMetadata: assetMetadata, currentAsset: canvasContent.asset }) }));
|
|
143
199
|
}
|
|
144
200
|
if (canvasContent.type === 'output') {
|
|
@@ -148,14 +204,35 @@ const CompWhenItHasDimensions = ({ contentDimensions, canvasSize, canvasContent,
|
|
|
148
204
|
return (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsx(RenderPreview_1.RenderPreview, { path: canvasContent.displayName, assetMetadata: assetMetadata, getBlob: canvasContent.getBlob }) }));
|
|
149
205
|
}
|
|
150
206
|
return (jsx_runtime_1.jsxs("div", { ref: compositionContainerRef, className: "remotion-studio-composition-container", style: outer, children: [
|
|
151
|
-
jsx_runtime_1.jsx(PortalContainer, { contentDimensions: contentDimensions, scale: scale, xCorrection: xCorrection, yCorrection: yCorrection }), jsx_runtime_1.jsx(SelectedOutlineOverlay_1.SelectedOutlineOverlay, { canvasHovered: canvasHovered, compositionHeight: contentDimensions.height, compositionWidth: contentDimensions.width, scale: scale, translationX: previewSize.translation.x, translationY: previewSize.translation.y })
|
|
207
|
+
jsx_runtime_1.jsx(PortalContainer, { contentDimensions: contentDimensions, offscreen: false, scale: scale, xCorrection: xCorrection, yCorrection: yCorrection }), jsx_runtime_1.jsx(PixelGrid, { scale: scale }), jsx_runtime_1.jsx(SelectedOutlineOverlay_1.SelectedOutlineOverlay, { canvasHovered: canvasHovered, compositionHeight: contentDimensions.height, compositionWidth: contentDimensions.width, scale: scale, translationX: previewSize.translation.x, translationY: previewSize.translation.y })
|
|
152
208
|
] }));
|
|
153
209
|
};
|
|
154
|
-
const
|
|
210
|
+
const AssetMediaComposition = ({ asset, fetchedAt, fileType }) => {
|
|
211
|
+
const src = (0, add_asset_cache_bust_1.addAssetCacheBust)({
|
|
212
|
+
fetchedAt,
|
|
213
|
+
src: (0, remotion_1.staticFile)(asset),
|
|
214
|
+
});
|
|
215
|
+
const style = {
|
|
216
|
+
width: '100%',
|
|
217
|
+
height: '100%',
|
|
218
|
+
};
|
|
219
|
+
return (0, react_dom_1.createPortal)(jsx_runtime_1.jsx(remotion_1.Internals.CanUseRemotionHooksProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.DisableInteractivityProvider, { children: jsx_runtime_1.jsx("div", { "data-testid": "asset-media-preview", style: style, children: fileType === 'video' ? (jsx_runtime_1.jsx(media_1.Video, { name: asset, src: src, style: style })) : (jsx_runtime_1.jsx(media_1.Audio, { name: asset, src: src })) }) }) }), remotion_1.Internals.portalNode());
|
|
220
|
+
};
|
|
221
|
+
const PortalContainer = ({ offscreen, scale, xCorrection, yCorrection, contentDimensions }) => {
|
|
155
222
|
const { checkerboard } = (0, react_1.useContext)(checkerboard_1.CheckerboardContext);
|
|
156
223
|
const { clearSelection } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
157
224
|
const portalContainer = (0, react_1.useRef)(null);
|
|
158
225
|
const style = (0, react_1.useMemo)(() => {
|
|
226
|
+
if (offscreen) {
|
|
227
|
+
return {
|
|
228
|
+
height: contentDimensions.height,
|
|
229
|
+
left: -999999,
|
|
230
|
+
overflow: 'hidden',
|
|
231
|
+
position: 'fixed',
|
|
232
|
+
top: 0,
|
|
233
|
+
width: contentDimensions.width,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
159
236
|
return containerStyle({
|
|
160
237
|
checkerboard,
|
|
161
238
|
scale,
|
|
@@ -168,6 +245,7 @@ const PortalContainer = ({ scale, xCorrection, yCorrection, contentDimensions })
|
|
|
168
245
|
checkerboard,
|
|
169
246
|
contentDimensions.height,
|
|
170
247
|
contentDimensions.width,
|
|
248
|
+
offscreen,
|
|
171
249
|
scale,
|
|
172
250
|
xCorrection,
|
|
173
251
|
yCorrection,
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const check_fullscreen_support_1 = require("../helpers/check-fullscreen-support");
|
|
8
8
|
const colors_1 = require("../helpers/colors");
|
|
9
|
+
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
9
10
|
const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
|
|
10
11
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
11
12
|
const timeline_layout_1 = require("../helpers/timeline-layout");
|
|
@@ -23,6 +24,7 @@ const PlaybackRateSelector_1 = require("./PlaybackRateSelector");
|
|
|
23
24
|
const PlayPause_1 = require("./PlayPause");
|
|
24
25
|
const PreviewToolbarOverflowButton_1 = require("./PreviewToolbarOverflowButton");
|
|
25
26
|
const RenderButton_1 = require("./RenderButton");
|
|
27
|
+
const RulersAndGuidesToggle_1 = require("./RulersAndGuidesToggle");
|
|
26
28
|
const SizeSelector_1 = require("./SizeSelector");
|
|
27
29
|
const SnappingToggle_1 = require("./SnappingToggle");
|
|
28
30
|
const TimelineInOutToggle_1 = require("./TimelineInOutToggle");
|
|
@@ -73,6 +75,10 @@ const PreviewToolbar = ({ readOnlyStudio, bufferStateDelayInMilliseconds }) => {
|
|
|
73
75
|
const { setPlayerMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
|
|
74
76
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
75
77
|
const isVideoComposition = (0, is_current_selected_still_1.useIsVideoComposition)();
|
|
78
|
+
const showCompositionControls = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition';
|
|
79
|
+
const showCanvasViewControls = showCompositionControls ||
|
|
80
|
+
((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset' &&
|
|
81
|
+
(0, get_preview_file_type_1.getPreviewFileType)(canvasContent.asset) === 'video');
|
|
76
82
|
const isStill = (0, is_current_selected_still_1.useIsStill)();
|
|
77
83
|
const [loop, setLoop] = (0, react_1.useState)((0, loop_1.loadLoopOption)());
|
|
78
84
|
const isFullscreenSupported = (0, check_fullscreen_support_1.checkFullscreenSupport)();
|
|
@@ -83,12 +89,15 @@ const PreviewToolbar = ({ readOnlyStudio, bufferStateDelayInMilliseconds }) => {
|
|
|
83
89
|
jsx_runtime_1.jsx("div", { style: padding }), isMobileLayout ? null : (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SizeSelector_1.SizeSelector, {}) })), !isMobileLayout && (isStill || isVideoComposition) ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
84
90
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }) })
|
|
85
91
|
] })) : null, isMobileLayout ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
86
|
-
jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PreviewToolbarOverflowButton_1.PreviewToolbarOverflowButton, { showFullscreen: Boolean(canvasContent && isFullscreenSupported), showPlaybackRate: isVideoComposition, showLoop: isVideoComposition,
|
|
92
|
+
jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PreviewToolbarOverflowButton_1.PreviewToolbarOverflowButton, { showFullscreen: Boolean(canvasContent && isFullscreenSupported), showPlaybackRate: isVideoComposition, showLoop: isVideoComposition, showCanvasViewControls: showCanvasViewControls, showCompositionControls: showCompositionControls, playbackRate: playbackRate, setPlaybackRate: setPlaybackRate, loop: loop, setLoop: setLoop }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1.5 })
|
|
87
93
|
] })) : null, isVideoComposition && isMobileLayout ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(MuteToggle_1.MuteToggle, { muted: playerMuted, setMuted: setPlayerMuted }) })) : null] }), jsx_runtime_1.jsx(layout_1.Flex, {}), isVideoComposition && isMobileLayout ? (jsx_runtime_1.jsx("div", { style: centeredPlayButton, children: playPause })) : null, isVideoComposition && !isMobileLayout ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
88
94
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), playPause, jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(LoopToggle_1.LoopToggle, { loop: loop, setLoop: setLoop }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.75 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(MuteToggle_1.MuteToggle, { muted: playerMuted, setMuted: setPlayerMuted }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(TimelineInOutToggle_1.TimelineInOutPointToggle, {}) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 })
|
|
89
|
-
] })) : null,
|
|
95
|
+
] })) : null, showCanvasViewControls ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [isMobileLayout ? null : (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(CheckboardToggle_1.CheckboardToggle, {}) })), isMobileLayout ? null : jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.25 }), isMobileLayout || !showCompositionControls ? null : (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(OutlineToggle_1.OutlineToggle, {}) })), isMobileLayout ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [showCompositionControls ? jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.25 }) : null, jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(RulersAndGuidesToggle_1.RulersAndGuidesToggle, { showGuides: showCompositionControls }) })
|
|
96
|
+
] })), readOnlyStudio ||
|
|
97
|
+
isMobileLayout ||
|
|
98
|
+
!showCompositionControls ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
90
99
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.25 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SnappingToggle_1.SnappingToggle, {}) })
|
|
91
|
-
] }))] })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x:
|
|
100
|
+
] }))] })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), canvasContent && isFullscreenSupported ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(FullscreenToggle_1.FullScreenToggle, { hidden: isMobileLayout }) })) : null, jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsxs("div", { style: sideContainer, children: [
|
|
92
101
|
jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(FpsCounter_1.FpsCounter, { playbackSpeed: playbackRate }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(RenderButton_1.RenderButton, { readOnlyStudio: readOnlyStudio, size: "compact", narrow: isMobileLayout }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1.5 })
|
|
93
102
|
] }), jsx_runtime_1.jsx(PlaybackKeyboardShortcutsManager_1.PlaybackKeyboardShortcutsManager, { setPlaybackRate: setPlaybackRate }), jsx_runtime_1.jsx(PlaybackRatePersistor_1.PlaybackRatePersistor, {})
|
|
94
103
|
] }));
|
|
@@ -3,6 +3,7 @@ export declare const PreviewToolbarOverflowButton: React.FC<{
|
|
|
3
3
|
readonly showFullscreen: boolean;
|
|
4
4
|
readonly showPlaybackRate: boolean;
|
|
5
5
|
readonly showLoop: boolean;
|
|
6
|
+
readonly showCanvasViewControls: boolean;
|
|
6
7
|
readonly showCompositionControls: boolean;
|
|
7
8
|
readonly playbackRate: number;
|
|
8
9
|
readonly setPlaybackRate: React.Dispatch<React.SetStateAction<number>>;
|
|
@@ -8,7 +8,9 @@ const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
|
8
8
|
const Checkmark_1 = require("../icons/Checkmark");
|
|
9
9
|
const ellipsis_1 = require("../icons/ellipsis");
|
|
10
10
|
const checkerboard_1 = require("../state/checkerboard");
|
|
11
|
+
const editor_guides_1 = require("../state/editor-guides");
|
|
11
12
|
const editor_outlines_1 = require("../state/editor-outlines");
|
|
13
|
+
const editor_rulers_1 = require("../state/editor-rulers");
|
|
12
14
|
const InlineDropdown_1 = require("./InlineDropdown");
|
|
13
15
|
const LoopToggle_1 = require("./LoopToggle");
|
|
14
16
|
const PlaybackRateSelector_1 = require("./PlaybackRateSelector");
|
|
@@ -17,10 +19,12 @@ const clickButton = (id) => {
|
|
|
17
19
|
var _a;
|
|
18
20
|
(_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.click();
|
|
19
21
|
};
|
|
20
|
-
const PreviewToolbarOverflowButton = ({ showFullscreen, showPlaybackRate, showLoop, showCompositionControls, playbackRate, setPlaybackRate, loop, setLoop, }) => {
|
|
22
|
+
const PreviewToolbarOverflowButton = ({ showFullscreen, showPlaybackRate, showLoop, showCanvasViewControls, showCompositionControls, playbackRate, setPlaybackRate, loop, setLoop, }) => {
|
|
21
23
|
const keyboardShortcutsDisabled = (0, use_keybinding_1.areKeyboardShortcutsDisabled)();
|
|
22
24
|
const { checkerboard, setCheckerboard } = (0, react_1.useContext)(checkerboard_1.CheckerboardContext);
|
|
23
25
|
const { editorShowOutlines, setEditorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
|
|
26
|
+
const { editorShowGuides, setEditorShowGuides } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
27
|
+
const { editorShowRulers, setEditorShowRulers } = (0, react_1.useContext)(editor_rulers_1.EditorShowRulersContext);
|
|
24
28
|
const { items: previewSizeItems, selectedId: selectedPreviewSize, zoomable, } = (0, SizeSelector_1.usePreviewSizeMenuItems)();
|
|
25
29
|
const { items: playbackRateItems, selectedId: selectedPlaybackRate } = (0, PlaybackRateSelector_1.usePlaybackRateMenuItems)({ playbackRate, setPlaybackRate });
|
|
26
30
|
const iconStyle = (0, react_1.useMemo)(() => {
|
|
@@ -82,7 +86,7 @@ const PreviewToolbarOverflowButton = ({ showFullscreen, showPlaybackRate, showLo
|
|
|
82
86
|
quickSwitcherLabel: null,
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
|
-
if (
|
|
89
|
+
if (showCanvasViewControls) {
|
|
86
90
|
items.push({
|
|
87
91
|
type: 'item',
|
|
88
92
|
id: 'checkerboard',
|
|
@@ -94,6 +98,8 @@ const PreviewToolbarOverflowButton = ({ showFullscreen, showPlaybackRate, showLo
|
|
|
94
98
|
subMenu: null,
|
|
95
99
|
quickSwitcherLabel: null,
|
|
96
100
|
});
|
|
101
|
+
}
|
|
102
|
+
if (showCompositionControls) {
|
|
97
103
|
items.push({
|
|
98
104
|
type: 'item',
|
|
99
105
|
id: 'outlines',
|
|
@@ -106,6 +112,32 @@ const PreviewToolbarOverflowButton = ({ showFullscreen, showPlaybackRate, showLo
|
|
|
106
112
|
quickSwitcherLabel: null,
|
|
107
113
|
});
|
|
108
114
|
}
|
|
115
|
+
if (showCanvasViewControls) {
|
|
116
|
+
items.push({
|
|
117
|
+
type: 'item',
|
|
118
|
+
id: 'rulers',
|
|
119
|
+
label: 'Rulers',
|
|
120
|
+
value: 'rulers',
|
|
121
|
+
onClick: () => setEditorShowRulers((current) => !current),
|
|
122
|
+
keyHint: null,
|
|
123
|
+
leftItem: editorShowRulers ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
|
|
124
|
+
subMenu: null,
|
|
125
|
+
quickSwitcherLabel: null,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (showCompositionControls) {
|
|
129
|
+
items.push({
|
|
130
|
+
type: 'item',
|
|
131
|
+
id: 'guides',
|
|
132
|
+
label: 'Guides',
|
|
133
|
+
value: 'guides',
|
|
134
|
+
onClick: () => setEditorShowGuides((current) => !current),
|
|
135
|
+
keyHint: null,
|
|
136
|
+
leftItem: editorShowGuides ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
|
|
137
|
+
subMenu: null,
|
|
138
|
+
quickSwitcherLabel: null,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
109
141
|
if (showFullscreen) {
|
|
110
142
|
items.push({
|
|
111
143
|
type: 'item',
|
|
@@ -128,12 +160,17 @@ const PreviewToolbarOverflowButton = ({ showFullscreen, showPlaybackRate, showLo
|
|
|
128
160
|
showFullscreen,
|
|
129
161
|
showLoop,
|
|
130
162
|
showPlaybackRate,
|
|
163
|
+
showCanvasViewControls,
|
|
131
164
|
showCompositionControls,
|
|
132
165
|
loop,
|
|
133
166
|
checkerboard,
|
|
167
|
+
editorShowGuides,
|
|
134
168
|
editorShowOutlines,
|
|
169
|
+
editorShowRulers,
|
|
135
170
|
setCheckerboard,
|
|
171
|
+
setEditorShowGuides,
|
|
136
172
|
setEditorShowOutlines,
|
|
173
|
+
setEditorShowRulers,
|
|
137
174
|
setLoop,
|
|
138
175
|
zoomable,
|
|
139
176
|
keyboardShortcutsDisabled,
|
|
@@ -8,14 +8,14 @@ const colors_1 = require("../../helpers/colors");
|
|
|
8
8
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
9
9
|
const modals_1 = require("../../state/modals");
|
|
10
10
|
const quickSwitcherArea = {
|
|
11
|
-
padding: '4px
|
|
11
|
+
padding: '4px 4px 4px 8px',
|
|
12
12
|
borderBottom: `1px solid ${colors_1.BLACK_HEX}`,
|
|
13
13
|
overflowY: 'auto',
|
|
14
14
|
};
|
|
15
15
|
const quickSwitcherTrigger = {
|
|
16
16
|
backgroundColor: colors_1.WHITE_ALPHA_06,
|
|
17
17
|
borderRadius: 4,
|
|
18
|
-
padding: '4px 10px',
|
|
18
|
+
padding: '4px 10px 4px 12px',
|
|
19
19
|
color: colors_1.LIGHT_TEXT,
|
|
20
20
|
fontSize: 12,
|
|
21
21
|
cursor: 'pointer',
|
|
@@ -12,14 +12,12 @@ const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
|
12
12
|
const use_menu_structure_1 = require("../../helpers/use-menu-structure");
|
|
13
13
|
const modals_1 = require("../../state/modals");
|
|
14
14
|
const InitialCompositionLoader_1 = require("../InitialCompositionLoader");
|
|
15
|
-
const KeyboardShortcutsExplainer_1 = require("../KeyboardShortcutsExplainer");
|
|
16
15
|
const layout_1 = require("../layout");
|
|
17
16
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
18
17
|
const RemInput_1 = require("../NewComposition/RemInput");
|
|
19
18
|
const use_select_asset_1 = require("../use-select-asset");
|
|
20
19
|
const use_static_files_1 = require("../use-static-files");
|
|
21
20
|
const algolia_search_1 = require("./algolia-search");
|
|
22
|
-
const AlgoliaCredit_1 = require("./AlgoliaCredit");
|
|
23
21
|
const asset_search_1 = require("./asset-search");
|
|
24
22
|
const fuzzy_search_1 = require("./fuzzy-search");
|
|
25
23
|
const NoResults_1 = require("./NoResults");
|
|
@@ -66,6 +64,14 @@ const contentWithoutModeSelector = {
|
|
|
66
64
|
...content,
|
|
67
65
|
paddingTop: 16,
|
|
68
66
|
};
|
|
67
|
+
const container = {
|
|
68
|
+
width: 400,
|
|
69
|
+
maxWidth: 'calc(100vw - 40px)',
|
|
70
|
+
};
|
|
71
|
+
const results = {
|
|
72
|
+
overflowY: 'auto',
|
|
73
|
+
height: 300,
|
|
74
|
+
};
|
|
69
75
|
const stripQuery = (query) => {
|
|
70
76
|
if (query.startsWith('$') || query.startsWith('>') || query.startsWith('?')) {
|
|
71
77
|
return query.substring(1).trim();
|
|
@@ -151,8 +157,8 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
151
157
|
if (mode === 'commands') {
|
|
152
158
|
return (0, fuzzy_search_1.fuzzySearch)(actualQuery, menuActions);
|
|
153
159
|
}
|
|
154
|
-
if (mode === 'docs'
|
|
155
|
-
return docResults.results;
|
|
160
|
+
if (mode === 'docs') {
|
|
161
|
+
return docResults.type === 'results' ? docResults.results : [];
|
|
156
162
|
}
|
|
157
163
|
if (mode === 'assets') {
|
|
158
164
|
const assetResults = (0, fuzzy_search_1.fuzzySearch)(assetSearch.query, assetSearch.assets.map((asset) => {
|
|
@@ -341,8 +347,8 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
341
347
|
setDocResults({ type: 'initial' });
|
|
342
348
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
343
349
|
}, []);
|
|
344
|
-
const showKeyboardShortcuts = mode === 'docs' && actualQuery.trim() === '';
|
|
345
350
|
const showSearchLoadingState = mode === 'docs' && docResults.type === 'loading';
|
|
351
|
+
const showEmptyDocSearch = mode === 'docs' && actualQuery.trim() === '';
|
|
346
352
|
const placeholder = mode === 'assets'
|
|
347
353
|
? 'Search assets...'
|
|
348
354
|
: mode === 'commands'
|
|
@@ -350,34 +356,12 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
350
356
|
: mode === 'docs'
|
|
351
357
|
? 'Search documentation...'
|
|
352
358
|
: 'Search compositions...';
|
|
353
|
-
const container = (0, react_1.useMemo)(() => {
|
|
354
|
-
return {
|
|
355
|
-
width: showKeyboardShortcuts ? 800 : 400,
|
|
356
|
-
maxWidth: 'calc(100vw - 40px)',
|
|
357
|
-
};
|
|
358
|
-
}, [showKeyboardShortcuts]);
|
|
359
|
-
const results = (0, react_1.useMemo)(() => {
|
|
360
|
-
if (showKeyboardShortcuts) {
|
|
361
|
-
return {
|
|
362
|
-
maxHeight: 600,
|
|
363
|
-
overflowY: 'auto',
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
return {
|
|
367
|
-
overflowY: 'auto',
|
|
368
|
-
height: 300,
|
|
369
|
-
};
|
|
370
|
-
}, [showKeyboardShortcuts]);
|
|
371
359
|
return (jsx_runtime_1.jsxs("div", { style: container, children: [assetSelection === null && compositionSelection === null && (jsx_runtime_1.jsxs("div", { style: modeSelector, children: [
|
|
372
360
|
jsx_runtime_1.jsx("button", { onClick: onCompositionsSelected, style: mode === 'compositions' ? modeActive : modeInactive, type: "button", children: "Compositions" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("button", { onClick: onAssetsSelected, style: mode === 'assets' ? modeActive : modeInactive, type: "button", children: "Assets" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("button", { onClick: onActionsSelected, style: mode === 'commands' ? modeActive : modeInactive, type: "button", children: "Actions" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("button", { onClick: onDocSearchSelected, style: mode === 'docs' ? modeActive : modeInactive, type: "button", children: "Documentation" })
|
|
373
|
-
] })), jsx_runtime_1.
|
|
361
|
+
] })), jsx_runtime_1.jsx("div", { style: assetSelection === null && compositionSelection === null
|
|
374
362
|
? content
|
|
375
|
-
: contentWithoutModeSelector, children:
|
|
376
|
-
|
|
377
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }),
|
|
378
|
-
" ",
|
|
379
|
-
jsx_runtime_1.jsx(AlgoliaCredit_1.AlgoliaCredit, {})
|
|
380
|
-
] })) : null] }), jsx_runtime_1.jsx("div", { style: results, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: showKeyboardShortcuts ? (jsx_runtime_1.jsx(KeyboardShortcutsExplainer_1.KeyboardShortcutsExplainer, {})) : showSearchLoadingState ? null : resultsArray.length === 0 ? (jsx_runtime_1.jsx(NoResults_1.QuickSwitcherNoResults, { mode: mode, query: actualQuery })) : (resultsArray.map((result, i) => {
|
|
363
|
+
: contentWithoutModeSelector, children: jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, type: "text", style: input, autoFocus: true, status: "ok", value: state.query, onChange: onTextChange, placeholder: placeholder, rightAlign: false }) }), jsx_runtime_1.jsx("div", { style: results, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: showEmptyDocSearch ||
|
|
364
|
+
showSearchLoadingState ? null : resultsArray.length === 0 ? (jsx_runtime_1.jsx(NoResults_1.QuickSwitcherNoResults, { mode: mode, query: actualQuery })) : (resultsArray.map((result, i) => {
|
|
381
365
|
return (jsx_runtime_1.jsx(QuickSwitcherResult_1.QuickSwitcherResult, { selected: selectedIndexRounded === i, result: result }, result.id));
|
|
382
366
|
})) })
|
|
383
367
|
] }));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RadioButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../helpers/colors");
|
|
6
|
+
const hoverable_1 = require("../helpers/hoverable");
|
|
7
|
+
const row = {
|
|
8
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
9
|
+
idleBackground: colors_1.TRANSPARENT,
|
|
10
|
+
hoverBackground: (0, colors_1.getBackgroundFromHoverState)({
|
|
11
|
+
hovered: true,
|
|
12
|
+
selected: false,
|
|
13
|
+
}),
|
|
14
|
+
idleColor: colors_1.LIGHT_TEXT,
|
|
15
|
+
hoverColor: colors_1.WHITE,
|
|
16
|
+
}),
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
appearance: 'none',
|
|
19
|
+
border: 'none',
|
|
20
|
+
borderRadius: 4,
|
|
21
|
+
boxSizing: 'border-box',
|
|
22
|
+
cursor: 'default',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
fontFamily: 'sans-serif',
|
|
25
|
+
fontSize: 14,
|
|
26
|
+
gap: 8,
|
|
27
|
+
lineHeight: '20px',
|
|
28
|
+
margin: '5px -8px',
|
|
29
|
+
padding: '4px 8px',
|
|
30
|
+
textAlign: 'left',
|
|
31
|
+
userSelect: 'none',
|
|
32
|
+
width: 'calc(100% + 16px)',
|
|
33
|
+
};
|
|
34
|
+
const circle = {
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
border: `1px solid ${colors_1.CURRENT_COLOR}`,
|
|
37
|
+
borderRadius: '50%',
|
|
38
|
+
boxSizing: 'border-box',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
height: 20,
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
width: 20,
|
|
44
|
+
};
|
|
45
|
+
const bullet = {
|
|
46
|
+
backgroundColor: colors_1.CURRENT_COLOR,
|
|
47
|
+
borderRadius: '50%',
|
|
48
|
+
height: 8,
|
|
49
|
+
width: 8,
|
|
50
|
+
};
|
|
51
|
+
const label = {
|
|
52
|
+
color: 'inherit',
|
|
53
|
+
fontFamily: 'sans-serif',
|
|
54
|
+
fontSize: 14,
|
|
55
|
+
lineHeight: '20px',
|
|
56
|
+
};
|
|
57
|
+
const RadioButton = ({ checked, children, onClick }) => {
|
|
58
|
+
return (jsx_runtime_1.jsxs("button", { "aria-checked": checked, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, onClick: onClick, role: "radio", style: row, type: "button", children: [
|
|
59
|
+
jsx_runtime_1.jsx("span", { style: circle, children: checked ? jsx_runtime_1.jsx("span", { style: bullet }) : null }), jsx_runtime_1.jsx("span", { style: label, children: children })
|
|
60
|
+
] }));
|
|
61
|
+
};
|
|
62
|
+
exports.RadioButton = RadioButton;
|