@remotion/studio 4.0.514 → 4.0.516
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/install-package.js +14 -1
- package/dist/api/restart-studio.js +4 -0
- package/dist/components/AssetSelector.js +3 -9
- package/dist/components/AssetSelectorItem.d.ts +3 -1
- package/dist/components/AssetSelectorItem.js +41 -42
- package/dist/components/AudioWaveform.js +17 -139
- package/dist/components/Canvas.js +7 -4
- package/dist/components/CaptionInspector.d.ts +2 -0
- package/dist/components/CaptionInspector.js +3 -5
- 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/CurrentAsset.d.ts +10 -2
- package/dist/components/CurrentAsset.js +139 -46
- 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 +3 -2
- 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 +41 -12
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +10 -4
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +2 -1
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -4
- package/dist/components/InspectorPanel/common.d.ts +0 -12
- package/dist/components/InspectorPanel/common.js +3 -52
- package/dist/components/InspectorPanel/use-composition-actions.js +0 -1
- package/dist/components/InspectorPanelLayout.d.ts +1 -1
- package/dist/components/InspectorPanelLayout.js +1 -1
- package/dist/components/InspectorSequenceSection.js +40 -54
- package/dist/components/InstallPackage.d.ts +3 -2
- package/dist/components/InstallPackage.js +90 -28
- 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/MenuDivider.js +1 -1
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/Modals.js +12 -4
- 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/PreviewToolbar.js +5 -2
- package/dist/components/PreviewToolbarOverflowButton.js +30 -0
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +2 -2
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +14 -30
- package/dist/components/RenderButton.js +66 -183
- package/dist/components/RenderModal/DataEditor.js +15 -12
- package/dist/components/RenderModal/GuiRenderStatus.js +3 -1
- package/dist/components/RenderModal/RenderModalOutputName.js +3 -3
- 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/RenderModal/WebRenderModal.js +4 -2
- package/dist/components/RenderQueue/RenderQueueItem.js +3 -1
- package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +3 -1
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +2 -7
- package/dist/components/RenderingSettings.js +7 -4
- package/dist/components/RulersAndGuidesToggle.d.ts +2 -0
- package/dist/components/RulersAndGuidesToggle.js +23 -0
- package/dist/components/SegmentedButton.d.ts +29 -0
- package/dist/components/SegmentedButton.js +226 -0
- package/dist/components/SelectedOutlineCanvasRotation.d.ts +1 -0
- package/dist/components/SelectedOutlineCanvasRotation.js +11 -4
- 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 -4
- package/dist/components/SelectedOutlinePolygon.js +20 -17
- package/dist/components/SelectedOutlineRenderer.js +66 -14
- package/dist/components/SettingsModal.d.ts +1 -1
- package/dist/components/SettingsModal.js +30 -7
- package/dist/components/SettingsModalFooter.js +2 -1
- 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 +0 -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.js +13 -12
- package/dist/components/Timeline/TimelineEffectItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineEffectItem.js +45 -15
- package/dist/components/Timeline/TimelineEffectPropItem.js +21 -4
- package/dist/components/Timeline/TimelineExpandArrowButton.js +10 -7
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +4 -1
- package/dist/components/Timeline/TimelineExpandedRow.js +5 -4
- package/dist/components/Timeline/TimelineExpandedSection.js +8 -5
- 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.js +10 -4
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +1 -1
- package/dist/components/Timeline/TimelineRotationField.js +0 -2
- package/dist/components/Timeline/TimelineRowChrome.d.ts +1 -1
- package/dist/components/Timeline/TimelineRowChrome.js +41 -6
- 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 +8 -3
- package/dist/components/Timeline/TimelineSelection.js +7 -5
- package/dist/components/Timeline/TimelineSequence.d.ts +2 -0
- package/dist/components/Timeline/TimelineSequence.js +110 -19
- package/dist/components/Timeline/TimelineSequenceItem.js +11 -8
- package/dist/components/Timeline/TimelineSequenceName.js +1 -1
- package/dist/components/Timeline/TimelineSequencePropItem.js +15 -2
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +4 -2
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +85 -91
- package/dist/components/Timeline/TimelineTrack.js +5 -2
- package/dist/components/Timeline/TimelineTransformOriginField.js +0 -4
- package/dist/components/Timeline/TimelineTranslateField.js +0 -4
- package/dist/components/Timeline/TimelineVideoInfo.js +4 -2
- package/dist/components/Timeline/TimelineVirtualization.js +3 -1
- package/dist/components/Timeline/delete-selected-timeline-item.js +6 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +7 -14
- 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/save-effect-prop.js +3 -3
- package/dist/components/Timeline/split-selected-timeline-item.js +0 -1
- 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/use-timeline-asset-drop.js +1 -0
- package/dist/components/TimelineCombobox.js +25 -160
- package/dist/components/TimelineInOutToggle.js +4 -1
- 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 +7 -7
- package/dist/components/effect-operations-api.d.ts +8 -0
- package/dist/components/effect-operations-api.js +52 -0
- 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 +1 -1
- 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/error-overlay/remotion-overlay/log-studio-error.js +4 -0
- package/dist/esm/{chunk-r46yxrjr.js → chunk-4bxz1d3g.js} +4 -3
- package/dist/esm/{chunk-xn2q7eem.js → chunk-w4244j4n.js} +14747 -14549
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/internals.mjs +14747 -14549
- package/dist/esm/previewEntry.mjs +14557 -14359
- 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/browser-studio-operations.d.ts +3 -0
- package/dist/helpers/browser-studio-operations.js +18 -1
- package/dist/helpers/calculate-timeline.js +2 -1
- package/dist/helpers/colors.d.ts +3 -1
- package/dist/helpers/colors.js +7 -3
- package/dist/helpers/drag-aware-double-click.d.ts +6 -0
- package/dist/helpers/drag-aware-double-click.js +20 -0
- package/dist/helpers/get-asset-metadata.js +25 -16
- 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-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 -1
- package/dist/helpers/hoverable.d.ts +1 -0
- package/dist/helpers/hoverable.js +2 -1
- package/dist/helpers/inject-css.js +7 -3
- package/dist/helpers/open-in-remotion-convert.d.ts +7 -0
- package/dist/helpers/open-in-remotion-convert.js +18 -0
- package/dist/helpers/use-max-media-duration.js +5 -3
- package/dist/helpers/use-media-metadata.d.ts +2 -1
- package/dist/helpers/use-media-metadata.js +49 -25
- package/dist/helpers/use-menu-structure.js +54 -67
- 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/cloud-download.d.ts +4 -0
- package/dist/icons/cloud-download.js +8 -0
- 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/modals.d.ts +2 -5
- package/package.json +12 -12
- package/dist/components/KeyboardShortcutsExplainer.d.ts +0 -2
- package/dist/components/KeyboardShortcutsExplainer.js +0 -194
|
@@ -26,14 +26,9 @@ const RenderQueueRemoveItem = ({ job }) => {
|
|
|
26
26
|
}
|
|
27
27
|
removeClientJob(job.id);
|
|
28
28
|
(0, save_render_output_1.unregisterClientRender)(job.id).catch(() => { });
|
|
29
|
-
(0, NotificationCenter_1.showNotification)('Removed job', 2000);
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
|
-
(0, actions_1.removeRenderJob)(job)
|
|
33
|
-
.then(() => {
|
|
34
|
-
(0, NotificationCenter_1.showNotification)('Removed job', 2000);
|
|
35
|
-
})
|
|
36
|
-
.catch((err) => {
|
|
31
|
+
(0, actions_1.removeRenderJob)(job).catch((err) => {
|
|
37
32
|
(0, NotificationCenter_1.showNotification)(`Could not remove item: ${err.message}`, 2000);
|
|
38
33
|
});
|
|
39
34
|
}, [job, isClientJob, removeClientJob, canvasContent, setCanvasContent]);
|
|
@@ -46,6 +41,6 @@ const RenderQueueRemoveItem = ({ job }) => {
|
|
|
46
41
|
const renderAction = (0, react_1.useCallback)((color) => {
|
|
47
42
|
return (jsx_runtime_1.jsx("svg", { style: icon, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 320 512", children: jsx_runtime_1.jsx("path", { fill: color, d: "M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z" }) }));
|
|
48
43
|
}, [icon]);
|
|
49
|
-
return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, variant: null }));
|
|
44
|
+
return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, title: "Remove", variant: null }));
|
|
50
45
|
};
|
|
51
46
|
exports.RenderQueueRemoveItem = RenderQueueRemoveItem;
|
|
@@ -16,7 +16,6 @@ const CrfSetting_1 = require("./RenderModal/CrfSetting");
|
|
|
16
16
|
const human_readable_codec_1 = require("./RenderModal/human-readable-codec");
|
|
17
17
|
const layout_2 = require("./RenderModal/layout");
|
|
18
18
|
const NumberSetting_1 = require("./RenderModal/NumberSetting");
|
|
19
|
-
const RenderModalHr_1 = require("./RenderModal/RenderModalHr");
|
|
20
19
|
const SegmentedControl_1 = require("./SegmentedControl");
|
|
21
20
|
const SettingsContext_1 = require("./SettingsContext");
|
|
22
21
|
const use_auto_save_config_1 = require("./use-auto-save-config");
|
|
@@ -31,6 +30,10 @@ const dividerLabel = {
|
|
|
31
30
|
margin: 0,
|
|
32
31
|
padding: '4px 16px',
|
|
33
32
|
};
|
|
33
|
+
const sectionTitle = {
|
|
34
|
+
...dividerLabel,
|
|
35
|
+
marginTop: 8,
|
|
36
|
+
};
|
|
34
37
|
const fullWidth = {
|
|
35
38
|
boxSizing: 'border-box',
|
|
36
39
|
width: 180,
|
|
@@ -333,7 +336,7 @@ const RenderingSettings = () => {
|
|
|
333
336
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Still image format" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: stillFormatValues, selectedId: stillImageFormat !== null && stillImageFormat !== void 0 ? stillImageFormat : REMOTION_DEFAULT, title: "Still image format" }) })
|
|
334
337
|
] }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
335
338
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Video frame format" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: videoFormatValues, selectedId: videoImageFormat !== null && videoImageFormat !== void 0 ? videoImageFormat : REMOTION_DEFAULT, title: "Video frame format" }) })
|
|
336
|
-
] }), jsx_runtime_1.jsx(
|
|
339
|
+
] }), jsx_runtime_1.jsx("p", { style: sectionTitle, children: "Encoding" }), client_1.BrowserSafeApis.codecSupportsCrf(resolvedCodec) &&
|
|
337
340
|
client_1.BrowserSafeApis.codecSupportsVideoBitrate(resolvedCodec) ? (jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
338
341
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Quality control" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(SegmentedControl_1.SegmentedControl, { items: qualityModeValues, needsWrapping: true }) })
|
|
339
342
|
] })) : null, qualityMode === 'crf' &&
|
|
@@ -345,9 +348,9 @@ const RenderingSettings = () => {
|
|
|
345
348
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "ProRes profile" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: profileValues, selectedId: proResProfile !== null && proResProfile !== void 0 ? proResProfile : REMOTION_DEFAULT, title: "ProRes profile" }) })
|
|
346
349
|
] })) : null, resolvedCodec === 'h264' ? (jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
347
350
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "x264 preset" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: presetValues, selectedId: x264Preset !== null && x264Preset !== void 0 ? x264Preset : REMOTION_DEFAULT, title: "x264 preset" }) })
|
|
348
|
-
] })) : null, jsx_runtime_1.jsx(
|
|
351
|
+
] })) : null, jsx_runtime_1.jsx("p", { style: sectionTitle, children: "Audio" }), jsx_runtime_1.jsxs("div", { style: layout_2.optionRow, children: [
|
|
349
352
|
jsx_runtime_1.jsx("div", { style: layout_2.label, children: "Audio codec" }), jsx_runtime_1.jsx("div", { style: layout_2.rightRow, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: audioCodecValues, selectedId: audioCodec !== null && audioCodec !== void 0 ? audioCodec : REMOTION_DEFAULT, title: "Audio codec" }) })
|
|
350
|
-
] }), jsx_runtime_1.jsx(
|
|
353
|
+
] }), jsx_runtime_1.jsx("p", { style: sectionTitle, children: "Performance" }), jsx_runtime_1.jsx(NumberSetting_1.NumberSetting, { name: "Concurrency", value: concurrency, onValueChanged: changeConcurrency, min: renderDefaults.minConcurrency, max: renderDefaults.maxConcurrency, step: 1 }), (error !== null && error !== void 0 ? error : settingsError) ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
351
354
|
jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx("div", { style: { paddingLeft: 16, paddingRight: 16 }, children: jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: (_a = error !== null && error !== void 0 ? error : settingsError) !== null && _a !== void 0 ? _a : '', align: "flex-start", type: "error" }) })
|
|
352
355
|
] })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true })
|
|
353
356
|
] }));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RulersAndGuidesToggle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../helpers/colors");
|
|
7
|
+
const editor_guides_1 = require("../state/editor-guides");
|
|
8
|
+
const editor_rulers_1 = require("../state/editor-rulers");
|
|
9
|
+
const ControlButton_1 = require("./ControlButton");
|
|
10
|
+
const RulersAndGuidesToggle = () => {
|
|
11
|
+
const { editorShowGuides, setEditorShowGuides } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
12
|
+
const { editorShowRulers, setEditorShowRulers } = (0, react_1.useContext)(editor_rulers_1.EditorShowRulersContext);
|
|
13
|
+
const rulersOrGuidesAreVisible = editorShowRulers || editorShowGuides;
|
|
14
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
15
|
+
setEditorShowRulers(() => !rulersOrGuidesAreVisible);
|
|
16
|
+
setEditorShowGuides(() => !rulersOrGuidesAreVisible);
|
|
17
|
+
}, [rulersOrGuidesAreVisible, setEditorShowGuides, setEditorShowRulers]);
|
|
18
|
+
const accessibilityLabel = rulersOrGuidesAreVisible
|
|
19
|
+
? 'Hide rulers and guides'
|
|
20
|
+
: 'Show rulers and guides';
|
|
21
|
+
return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, "aria-pressed": rulersOrGuidesAreVisible, onClick: onClick, children: (color) => (jsx_runtime_1.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 576 512", style: { width: 18, height: 18 }, "aria-hidden": "true", focusable: "false", children: jsx_runtime_1.jsx("path", { fill: rulersOrGuidesAreVisible ? colors_1.BLUE : color, d: "M525.9 154.2L186.5 493.6c-6.2 6.2-16.4 6.2-22.6 0L50.7 380.5c-6.2-6.2-6.2-16.4 0-22.6l33.9-33.9 56.6 56.6c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-56.6-56.6 39.6-39.6 33.9 33.9c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-33.9-33.9 39.6-39.6 56.6 56.6c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-56.6-56.6 39.6-39.6 33.9 33.9c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-33.9-33.9 39.6-39.6 56.6 56.6c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-56.6-56.6 33.9-33.9c6.2-6.2 16.4-6.2 22.6 0L525.9 131.5c6.2 6.2 6.2 16.4 0 22.6zM73.3 289.9L28.1 335.2c-18.7 18.7-18.7 49.1 0 67.9L141.2 516.2c18.7 18.7 49.1 18.7 67.9 0L548.5 176.8c18.7-18.7 18.7-49.1 0-67.9L435.4-4.2C416.6-23 386.2-23 367.5-4.2 77.1 286.2 140.3 223 73.3 289.9z" }) })) }));
|
|
22
|
+
};
|
|
23
|
+
exports.RulersAndGuidesToggle = RulersAndGuidesToggle;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComboboxValue } from './NewComposition/ComboBox';
|
|
3
|
+
type SegmentedButtonSegmentCommon = {
|
|
4
|
+
readonly ariaLabel: string;
|
|
5
|
+
readonly buttonId: string | null;
|
|
6
|
+
readonly disabled: boolean;
|
|
7
|
+
readonly idleColor: string;
|
|
8
|
+
readonly renderContent: (color: string) => React.ReactNode;
|
|
9
|
+
readonly segmentId: string;
|
|
10
|
+
readonly style: React.CSSProperties | null;
|
|
11
|
+
readonly title: string | null;
|
|
12
|
+
};
|
|
13
|
+
export type SegmentedButtonSegment = SegmentedButtonSegmentCommon & ({
|
|
14
|
+
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
15
|
+
readonly onPointerDown: React.PointerEventHandler<HTMLButtonElement> | null;
|
|
16
|
+
readonly type: 'action';
|
|
17
|
+
} | {
|
|
18
|
+
readonly leaveLeftSpace: boolean;
|
|
19
|
+
readonly onOpenChange: ((open: boolean) => void) | null;
|
|
20
|
+
readonly selectedId: string | number | null;
|
|
21
|
+
readonly type: 'menu';
|
|
22
|
+
readonly values: ComboboxValue[];
|
|
23
|
+
});
|
|
24
|
+
export declare const SegmentedButton: React.FC<{
|
|
25
|
+
readonly segments: SegmentedButtonSegment[];
|
|
26
|
+
readonly style: React.CSSProperties | null;
|
|
27
|
+
readonly title: string | null;
|
|
28
|
+
}>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SegmentedButton = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const player_1 = require("@remotion/player");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_dom_1 = __importDefault(require("react-dom"));
|
|
11
|
+
const colors_1 = require("../helpers/colors");
|
|
12
|
+
const hoverable_1 = require("../helpers/hoverable");
|
|
13
|
+
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
14
|
+
const noop_1 = require("../helpers/noop");
|
|
15
|
+
const z_index_1 = require("../state/z-index");
|
|
16
|
+
const is_menu_item_1 = require("./Menu/is-menu-item");
|
|
17
|
+
const portals_1 = require("./Menu/portals");
|
|
18
|
+
const styles_1 = require("./Menu/styles");
|
|
19
|
+
const MenuContent_1 = require("./NewComposition/MenuContent");
|
|
20
|
+
const SEGMENTED_BUTTON_BORDER_RADIUS = 6;
|
|
21
|
+
const containerStyle = {
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
borderRadius: SEGMENTED_BUTTON_BORDER_RADIUS,
|
|
24
|
+
boxSizing: 'border-box',
|
|
25
|
+
display: 'inline-flex',
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
flexShrink: 0,
|
|
28
|
+
gap: 1,
|
|
29
|
+
height: 24,
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
};
|
|
32
|
+
const segmentStyle = {
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
appearance: 'none',
|
|
35
|
+
border: 'none',
|
|
36
|
+
boxSizing: 'border-box',
|
|
37
|
+
cursor: 'default',
|
|
38
|
+
display: 'inline-flex',
|
|
39
|
+
fontFamily: 'sans-serif',
|
|
40
|
+
fontSize: 12,
|
|
41
|
+
height: '100%',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
lineHeight: '16px',
|
|
44
|
+
margin: 0,
|
|
45
|
+
minWidth: 0,
|
|
46
|
+
padding: '0 6px',
|
|
47
|
+
whiteSpace: 'nowrap',
|
|
48
|
+
};
|
|
49
|
+
const getSegmentBorderRadius = ({ index, segmentCount, }) => {
|
|
50
|
+
if (segmentCount === 1) {
|
|
51
|
+
return SEGMENTED_BUTTON_BORDER_RADIUS;
|
|
52
|
+
}
|
|
53
|
+
if (index === 0) {
|
|
54
|
+
return `${SEGMENTED_BUTTON_BORDER_RADIUS}px 0 0 ${SEGMENTED_BUTTON_BORDER_RADIUS}px`;
|
|
55
|
+
}
|
|
56
|
+
if (index === segmentCount - 1) {
|
|
57
|
+
return `0 ${SEGMENTED_BUTTON_BORDER_RADIUS}px ${SEGMENTED_BUTTON_BORDER_RADIUS}px 0`;
|
|
58
|
+
}
|
|
59
|
+
return 0;
|
|
60
|
+
};
|
|
61
|
+
const preventPointerFocus = (event) => {
|
|
62
|
+
if (event.button !== 0) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
66
|
+
document.activeElement.blur();
|
|
67
|
+
}
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
};
|
|
70
|
+
const preventMouseFocus = (event) => {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
if (event.button !== 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
76
|
+
document.activeElement.blur();
|
|
77
|
+
}
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
};
|
|
80
|
+
const SegmentedButtonAction = ({ index, segment, segmentCount }) => {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
83
|
+
const style = (0, react_1.useMemo)(() => {
|
|
84
|
+
return {
|
|
85
|
+
...segmentStyle,
|
|
86
|
+
borderRadius: getSegmentBorderRadius({ index, segmentCount }),
|
|
87
|
+
opacity: segment.disabled ? 0.5 : 1,
|
|
88
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
89
|
+
idleBackground: colors_1.TRANSPARENT,
|
|
90
|
+
hoverBackground: segment.disabled
|
|
91
|
+
? colors_1.TRANSPARENT
|
|
92
|
+
: (0, colors_1.getBackgroundFromHoverState)({ hovered: true, selected: false }),
|
|
93
|
+
idleColor: segment.idleColor,
|
|
94
|
+
hoverColor: segment.disabled ? segment.idleColor : colors_1.WHITE,
|
|
95
|
+
}),
|
|
96
|
+
...segment.style,
|
|
97
|
+
};
|
|
98
|
+
}, [index, segment, segmentCount]);
|
|
99
|
+
const onClick = (0, react_1.useCallback)((event) => {
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
segment.onClick(event);
|
|
102
|
+
}, [segment]);
|
|
103
|
+
const onPointerDown = (0, react_1.useCallback)((event) => {
|
|
104
|
+
var _a;
|
|
105
|
+
event.stopPropagation();
|
|
106
|
+
(_a = segment.onPointerDown) === null || _a === void 0 ? void 0 : _a.call(segment, event);
|
|
107
|
+
preventPointerFocus(event);
|
|
108
|
+
}, [segment]);
|
|
109
|
+
return (jsx_runtime_1.jsx("button", { "aria-label": segment.ariaLabel, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, disabled: segment.disabled, id: (_a = segment.buttonId) !== null && _a !== void 0 ? _a : undefined, onClick: onClick, onMouseDown: preventMouseFocus, onPointerDown: onPointerDown, style: style, tabIndex: tabIndex, title: (_b = segment.title) !== null && _b !== void 0 ? _b : undefined, type: "button", children: segment.renderContent(colors_1.CURRENT_COLOR) }));
|
|
110
|
+
};
|
|
111
|
+
const SegmentedButtonMenu = ({ index, segment, segmentCount }) => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
const [opened, setOpened] = (0, react_1.useState)(false);
|
|
114
|
+
const ref = (0, react_1.useRef)(null);
|
|
115
|
+
const { currentZIndex, tabIndex } = (0, z_index_1.useZIndex)();
|
|
116
|
+
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
117
|
+
const size = player_1.PlayerInternals.useElementSize(ref, {
|
|
118
|
+
triggerOnWindowResize: true,
|
|
119
|
+
shouldApplyCssTransforms: true,
|
|
120
|
+
});
|
|
121
|
+
const refresh = size === null || size === void 0 ? void 0 : size.refresh;
|
|
122
|
+
const onHide = (0, react_1.useCallback)(() => {
|
|
123
|
+
var _a;
|
|
124
|
+
setOpened(false);
|
|
125
|
+
(_a = segment.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(segment, false);
|
|
126
|
+
}, [segment]);
|
|
127
|
+
const onOutsideClick = (0, react_1.useCallback)((target) => {
|
|
128
|
+
var _a;
|
|
129
|
+
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(target)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
onHide();
|
|
133
|
+
}, [onHide]);
|
|
134
|
+
const onClick = (0, react_1.useCallback)((event) => {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
event.stopPropagation();
|
|
137
|
+
if (segment.values.length === 0) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
refresh === null || refresh === void 0 ? void 0 : refresh();
|
|
141
|
+
setOpened((currentlyOpened) => {
|
|
142
|
+
var _a;
|
|
143
|
+
const next = !currentlyOpened;
|
|
144
|
+
(_a = segment.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(segment, next);
|
|
145
|
+
return next;
|
|
146
|
+
});
|
|
147
|
+
}, [refresh, segment]);
|
|
148
|
+
const onPointerDown = (0, react_1.useCallback)((event) => {
|
|
149
|
+
event.stopPropagation();
|
|
150
|
+
preventPointerFocus(event);
|
|
151
|
+
}, []);
|
|
152
|
+
const spaceToBottom = (0, react_1.useMemo)(() => {
|
|
153
|
+
if (!size || !opened) {
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
return size.windowSize.height - (size.top + size.height) - 10;
|
|
157
|
+
}, [opened, size]);
|
|
158
|
+
const spaceToTop = (0, react_1.useMemo)(() => {
|
|
159
|
+
if (!size || !opened) {
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
return size.top - 10;
|
|
163
|
+
}, [opened, size]);
|
|
164
|
+
const portalStyle = (0, react_1.useMemo)(() => {
|
|
165
|
+
if (!opened || !size) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const minSpaceRequired = isMobileLayout
|
|
169
|
+
? styles_1.MAX_MOBILE_MENU_WIDTH
|
|
170
|
+
: styles_1.MAX_MENU_WIDTH;
|
|
171
|
+
const spaceToRight = size.windowSize.width - size.left;
|
|
172
|
+
const spaceToLeft = size.left + size.width;
|
|
173
|
+
const canOpenOnLeft = spaceToLeft >= minSpaceRequired;
|
|
174
|
+
const canOpenOnRight = spaceToRight >= minSpaceRequired;
|
|
175
|
+
const openTowardsTop = spaceToTop > spaceToBottom;
|
|
176
|
+
return {
|
|
177
|
+
...(openTowardsTop
|
|
178
|
+
? {
|
|
179
|
+
...styles_1.menuContainerTowardsTop,
|
|
180
|
+
bottom: size.windowSize.height - size.top,
|
|
181
|
+
}
|
|
182
|
+
: {
|
|
183
|
+
...styles_1.menuContainerTowardsBottom,
|
|
184
|
+
top: size.top + size.height,
|
|
185
|
+
}),
|
|
186
|
+
...(canOpenOnRight
|
|
187
|
+
? { left: size.left }
|
|
188
|
+
: canOpenOnLeft
|
|
189
|
+
? { right: size.windowSize.width - size.left - size.width }
|
|
190
|
+
: { left: 0 }),
|
|
191
|
+
};
|
|
192
|
+
}, [isMobileLayout, opened, size, spaceToBottom, spaceToTop]);
|
|
193
|
+
const style = (0, react_1.useMemo)(() => {
|
|
194
|
+
return {
|
|
195
|
+
...segmentStyle,
|
|
196
|
+
borderRadius: getSegmentBorderRadius({ index, segmentCount }),
|
|
197
|
+
opacity: segment.disabled ? 0.5 : 1,
|
|
198
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
199
|
+
idleBackground: opened
|
|
200
|
+
? (0, colors_1.getBackgroundFromHoverState)({ hovered: false, selected: true })
|
|
201
|
+
: colors_1.TRANSPARENT,
|
|
202
|
+
hoverBackground: segment.disabled
|
|
203
|
+
? colors_1.TRANSPARENT
|
|
204
|
+
: (0, colors_1.getBackgroundFromHoverState)({ hovered: true, selected: opened }),
|
|
205
|
+
idleColor: opened ? colors_1.WHITE : segment.idleColor,
|
|
206
|
+
hoverColor: segment.disabled ? segment.idleColor : colors_1.WHITE,
|
|
207
|
+
}),
|
|
208
|
+
...segment.style,
|
|
209
|
+
};
|
|
210
|
+
}, [index, opened, segment, segmentCount]);
|
|
211
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
212
|
+
jsx_runtime_1.jsx("button", { ref: ref, "aria-expanded": opened, "aria-haspopup": "menu", "aria-label": segment.ariaLabel, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME} ${is_menu_item_1.MENU_INITIATOR_CLASSNAME}`, disabled: segment.disabled, id: (_a = segment.buttonId) !== null && _a !== void 0 ? _a : undefined, onClick: onClick, onMouseDown: preventMouseFocus, onPointerDown: onPointerDown, style: style, tabIndex: tabIndex, title: (_b = segment.title) !== null && _b !== void 0 ? _b : undefined, type: "button", children: segment.renderContent(colors_1.CURRENT_COLOR) }), portalStyle
|
|
213
|
+
? react_dom_1.default.createPortal(jsx_runtime_1.jsx("div", { style: styles_1.fullScreenOverlay, onPointerDown: (event) => event.stopPropagation(), children: jsx_runtime_1.jsx("div", { style: styles_1.outerPortal, className: "css-reset", children: jsx_runtime_1.jsx(z_index_1.HigherZIndex, { onOutsideClick: onOutsideClick, onEscape: onHide, children: jsx_runtime_1.jsx("div", { style: portalStyle, children: jsx_runtime_1.jsx(MenuContent_1.MenuContent, { fixedHeight: Math.max(spaceToBottom, spaceToTop), leaveLeftSpace: segment.leaveLeftSpace, onHide: onHide, onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, preselectIndex: segment.selectedId === null
|
|
214
|
+
? false
|
|
215
|
+
: segment.values.findIndex((value) => value.id === segment.selectedId), topItemCanBeUnselected: false, values: segment.values }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
|
|
216
|
+
: null] }));
|
|
217
|
+
};
|
|
218
|
+
const SegmentedButton = ({ segments, style, title }) => {
|
|
219
|
+
return (jsx_runtime_1.jsx("div", { style: { ...containerStyle, ...style }, title: title !== null && title !== void 0 ? title : undefined, children: segments.map((segment, index) => {
|
|
220
|
+
if (segment.type === 'action') {
|
|
221
|
+
return (jsx_runtime_1.jsx(SegmentedButtonAction, { index: index, segment: segment, segmentCount: segments.length }, segment.segmentId));
|
|
222
|
+
}
|
|
223
|
+
return (jsx_runtime_1.jsx(SegmentedButtonMenu, { index: index, segment: segment, segmentCount: segments.length }, segment.segmentId));
|
|
224
|
+
}) }));
|
|
225
|
+
};
|
|
226
|
+
exports.SegmentedButton = SegmentedButton;
|
|
@@ -52,10 +52,14 @@ const focus_inspector_field_1 = require("./Timeline/focus-inspector-field");
|
|
|
52
52
|
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
53
53
|
const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
|
|
54
54
|
const rotationDegreesPerPixel = 0.5;
|
|
55
|
-
const
|
|
55
|
+
const canvas2DRotationCursor = (0, selected_outline_measurement_1.getRotationCursor)(0);
|
|
56
|
+
const SelectedOutlineCanvasRotation = ({ getLatestTargetByKey, layoutTarget, onDraggingChange, outline, transform3DMode, }) => {
|
|
56
57
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
57
58
|
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
58
59
|
const { editorSnapping } = (0, react_1.useContext)(editor_snapping_1.EditorSnappingContext);
|
|
60
|
+
const cursor = transform3DMode
|
|
61
|
+
? canvas_rotation_cursor_1.canvasRotationCursor
|
|
62
|
+
: canvas2DRotationCursor;
|
|
59
63
|
const onPointerDown = react_1.default.useCallback((event) => {
|
|
60
64
|
var _a, _b;
|
|
61
65
|
if (event.button !== 0) {
|
|
@@ -76,7 +80,10 @@ const SelectedOutlineCanvasRotation = ({ getLatestTargetByKey, layoutTarget, onD
|
|
|
76
80
|
return;
|
|
77
81
|
}
|
|
78
82
|
const previousSvgCursor = svg.style.cursor;
|
|
79
|
-
|
|
83
|
+
const dragCursor = rotationDrag.transform3DMode
|
|
84
|
+
? canvas_rotation_cursor_1.canvasRotationCursor
|
|
85
|
+
: canvas2DRotationCursor;
|
|
86
|
+
svg.style.cursor = dragCursor;
|
|
80
87
|
const startPointer = { x: event.clientX, y: event.clientY };
|
|
81
88
|
const center = (0, svg_point_to_client_point_1.svgPointToClientPoint)((0, selected_outline_measurement_1.getSelectedOutlineRotationPivot)({
|
|
82
89
|
dimensions: outline.dimensions,
|
|
@@ -106,7 +113,7 @@ const SelectedOutlineCanvasRotation = ({ getLatestTargetByKey, layoutTarget, onD
|
|
|
106
113
|
return;
|
|
107
114
|
}
|
|
108
115
|
dragStarted = true;
|
|
109
|
-
(0, ForceSpecificCursor_1.forceSpecificCursor)(
|
|
116
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(dragCursor);
|
|
110
117
|
onDraggingChange(true);
|
|
111
118
|
}
|
|
112
119
|
if (rotationDrag.transform3DMode) {
|
|
@@ -234,6 +241,6 @@ const SelectedOutlineCanvasRotation = ({ getLatestTargetByKey, layoutTarget, onD
|
|
|
234
241
|
setDragOverrides,
|
|
235
242
|
setPropStatuses,
|
|
236
243
|
]);
|
|
237
|
-
return (jsx_runtime_1.jsx("polygon", { points: outline.points.map((point) => `${point.x},${point.y}`).join(' '), fill: colors_1.TRANSPARENT, pointerEvents: "all", cursor:
|
|
244
|
+
return (jsx_runtime_1.jsx("polygon", { points: outline.points.map((point) => `${point.x},${point.y}`).join(' '), fill: colors_1.TRANSPARENT, pointerEvents: "all", cursor: cursor, onPointerDown: onPointerDown, "data-remotion-studio-canvas-rotation": true }));
|
|
238
245
|
};
|
|
239
246
|
exports.SelectedOutlineCanvasRotation = SelectedOutlineCanvasRotation;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectedOutline } from './selected-outline-geometry';
|
|
3
|
+
import type { SelectedOutlineContextMenuOpenHandler, SelectedOutlineLayoutTarget, SelectedOutlineRotationDragTarget, SelectedOutlineScaleDragTarget, SelectedOutlineTarget } from './selected-outline-types';
|
|
4
|
+
import type { TimelineSelection, TimelineSelectionInteraction } from './Timeline/TimelineSelection';
|
|
5
|
+
export declare const SelectedOutlineEditingHandles: React.FC<{
|
|
6
|
+
readonly dragging: boolean;
|
|
7
|
+
readonly getAllRotationDragTargets: () => readonly SelectedOutlineRotationDragTarget[];
|
|
8
|
+
readonly getAllScaleDragTargets: () => readonly SelectedOutlineScaleDragTarget[];
|
|
9
|
+
readonly getContextMenuOpenByKey: (key: string) => SelectedOutlineContextMenuOpenHandler | undefined;
|
|
10
|
+
readonly getLatestTargetByKey: (key: string) => SelectedOutlineTarget | undefined;
|
|
11
|
+
readonly layoutTarget: SelectedOutlineLayoutTarget | undefined;
|
|
12
|
+
readonly onContextMenuOpenChange: (open: boolean) => void;
|
|
13
|
+
readonly onDraggingChange: (dragging: boolean) => void;
|
|
14
|
+
readonly onSelect: (item: TimelineSelection, interaction: TimelineSelectionInteraction) => void;
|
|
15
|
+
readonly outline: SelectedOutline;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SelectedOutlineEditingHandles = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const selected_outline_control_layout_1 = require("./selected-outline-control-layout");
|
|
40
|
+
const SelectedOutlineCropControls_1 = require("./SelectedOutlineCropControls");
|
|
41
|
+
const SelectedOutlineRotationCornerHandle_1 = require("./SelectedOutlineRotationCornerHandle");
|
|
42
|
+
const SelectedOutlineScaleEdgeLine_1 = require("./SelectedOutlineScaleEdgeLine");
|
|
43
|
+
const use_selected_outline_control_target_1 = require("./use-selected-outline-control-target");
|
|
44
|
+
const SelectedOutlineEditingHandles = ({ dragging, getAllRotationDragTargets, getAllScaleDragTargets, getContextMenuOpenByKey, getLatestTargetByKey, layoutTarget, onContextMenuOpenChange, onDraggingChange, onSelect, outline, }) => {
|
|
45
|
+
const { controlTarget, hovered, onHoverChange } = (0, use_selected_outline_control_target_1.useSelectedOutlineControlTarget)({
|
|
46
|
+
getLatestTargetByKey,
|
|
47
|
+
layoutTarget,
|
|
48
|
+
});
|
|
49
|
+
const controlLayout = (0, react_1.useMemo)(() => (0, selected_outline_control_layout_1.getSelectedOutlineControlLayout)(outline.points), [outline.points]);
|
|
50
|
+
const onContextMenuOpen = react_1.default.useCallback(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
var _b;
|
|
53
|
+
return (_b = (_a = getContextMenuOpenByKey(outline.key)) === null || _a === void 0 ? void 0 : _a()) !== null && _b !== void 0 ? _b : false;
|
|
54
|
+
}, [getContextMenuOpenByKey, outline.key]);
|
|
55
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
56
|
+
jsx_runtime_1.jsx(SelectedOutlineCropControls_1.SelectedOutlineCropControls, { outline: outline, onDraggingChange: onDraggingChange, target: controlTarget }), (controlTarget === null || controlTarget === void 0 ? void 0 : controlTarget.cropDrag) === null &&
|
|
57
|
+
((layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.containsSelection) || hovered)
|
|
58
|
+
? controlLayout.scaleEdges.map((edge) => (jsx_runtime_1.jsx(SelectedOutlineScaleEdgeLine_1.SelectedOutlineScaleEdgeLine, { getAllScaleDragTargets: getAllScaleDragTargets, dragging: dragging, edge: edge, hitWidth: edge === 'top' || edge === 'bottom'
|
|
59
|
+
? controlLayout.scaleHitWidth.horizontal
|
|
60
|
+
: controlLayout.scaleHitWidth.vertical, outline: outline, onContextMenuOpen: onContextMenuOpen, onContextMenuOpenChange: onContextMenuOpenChange, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, target: controlTarget }, edge)))
|
|
61
|
+
: null, (controlTarget === null || controlTarget === void 0 ? void 0 : controlTarget.cropDrag) === null &&
|
|
62
|
+
((layoutTarget === null || layoutTarget === void 0 ? void 0 : layoutTarget.containsSelection) || hovered)
|
|
63
|
+
? controlLayout.rotationCorners.map(({ corner, point }) => (jsx_runtime_1.jsx(SelectedOutlineRotationCornerHandle_1.SelectedOutlineRotationCornerHandle, { getAllRotationDragTargets: getAllRotationDragTargets, corner: corner, dragging: dragging, handlePoint: point, outline: outline, onContextMenuOpen: onContextMenuOpen, onContextMenuOpenChange: onContextMenuOpenChange, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, radius: controlLayout.rotationHandleRadius, target: controlTarget }, corner)))
|
|
64
|
+
: null] }));
|
|
65
|
+
};
|
|
66
|
+
exports.SelectedOutlineEditingHandles = SelectedOutlineEditingHandles;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectedOutline } from './selected-outline-geometry';
|
|
3
3
|
import { type SelectedOutlineSnapPoint } from './selected-outline-snap';
|
|
4
|
-
import { type
|
|
4
|
+
import { type SelectedOutlineContextMenuOpenHandler, type SelectedOutlineDragTarget, type SelectedOutlineLayoutTarget, type SelectedOutlineTarget } from './selected-outline-types';
|
|
5
5
|
import { type TimelineSelection, type TimelineSelectionInteraction } from './Timeline/TimelineSelection';
|
|
6
6
|
type SelectedOutlineElementProps = {
|
|
7
7
|
readonly compositionHeight: number;
|
|
@@ -9,15 +9,13 @@ type SelectedOutlineElementProps = {
|
|
|
9
9
|
readonly dragging: boolean;
|
|
10
10
|
readonly getAllDragOutlines: () => readonly SelectedOutline[];
|
|
11
11
|
readonly getAllDragTargets: () => readonly SelectedOutlineDragTarget[];
|
|
12
|
-
readonly getAllRotationDragTargets: () => readonly SelectedOutlineRotationDragTarget[];
|
|
13
|
-
readonly getAllScaleDragTargets: () => readonly SelectedOutlineScaleDragTarget[];
|
|
14
12
|
readonly getLatestTargetByKey: (key: string) => SelectedOutlineTarget | undefined;
|
|
15
13
|
readonly layoutTarget: SelectedOutlineLayoutTarget | undefined;
|
|
16
14
|
readonly outline: SelectedOutline;
|
|
17
15
|
readonly onDraggingChange: (dragging: boolean) => void;
|
|
18
|
-
readonly onContextMenuOpenChange: (open: boolean) => void;
|
|
19
16
|
readonly onSnapPointsChange: (snapPoints: readonly SelectedOutlineSnapPoint[]) => void;
|
|
20
17
|
readonly onSelect: (item: TimelineSelection, interaction: TimelineSelectionInteraction) => void;
|
|
18
|
+
readonly registerContextMenuOpen: (key: string, handler: SelectedOutlineContextMenuOpenHandler | null) => void;
|
|
21
19
|
readonly scale: number;
|
|
22
20
|
};
|
|
23
21
|
export declare const SelectedOutlineElement: React.NamedExoticComponent<SelectedOutlineElementProps>;
|