@remotion/studio 4.0.499 → 4.0.500
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AssetSelector.js +8 -6
- package/dist/components/AssetSelectorItem.d.ts +24 -0
- package/dist/components/AssetSelectorItem.js +113 -80
- package/dist/components/CompositionSelector.js +2 -32
- package/dist/components/ControlButton.js +1 -0
- package/dist/components/ExplorerPanel.js +2 -1
- package/dist/components/ExplorerPanelRef.d.ts +2 -0
- package/dist/components/GlobalKeybindings.js +7 -1
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +2 -2
- package/dist/components/InlineDropdown.d.ts +1 -1
- package/dist/components/InlineDropdown.js +3 -2
- package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
- package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +8 -7
- package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +7 -7
- package/dist/components/InspectorPanel/common.d.ts +17 -4
- package/dist/components/InspectorPanel/common.js +60 -6
- package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
- package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
- package/dist/components/InspectorSequenceSection.js +43 -19
- package/dist/components/KeyboardShortcutsExplainer.js +4 -2
- package/dist/components/Menu/MenuItem.js +2 -1
- package/dist/components/MenuCompositionName.js +30 -7
- package/dist/components/MenuToolbar.d.ts +0 -1
- package/dist/components/MenuToolbar.js +8 -7
- package/dist/components/MobilePanel.d.ts +2 -1
- package/dist/components/MobilePanel.js +29 -25
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/Modals.js +1 -1
- package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
- package/dist/components/NewComposition/DismissableModal.js +2 -2
- package/dist/components/NewComposition/InputDragger.d.ts +7 -0
- package/dist/components/NewComposition/InputDragger.js +119 -8
- package/dist/components/OutlineToggle.d.ts +1 -3
- package/dist/components/OutlineToggle.js +2 -2
- package/dist/components/PreviewToolbar.js +10 -4
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +44 -0
- package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
- package/dist/components/QuickSwitcher/NoResults.js +1 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +5 -0
- package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
- package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +5 -0
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +76 -12
- package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
- package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
- package/dist/components/QuickSwitcher/asset-search.js +42 -0
- package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
- package/dist/components/SelectedOutlineCropControls.js +299 -0
- package/dist/components/SelectedOutlineElement.js +83 -43
- package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
- package/dist/components/SelectedOutlineOverlay.js +130 -8
- package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
- package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
- package/dist/components/SidebarCollapserControls.d.ts +3 -1
- package/dist/components/SidebarCollapserControls.js +34 -29
- package/dist/components/SnappingToggle.d.ts +1 -3
- package/dist/components/SnappingToggle.js +2 -2
- package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
- package/dist/components/Timeline/TimelineAssetField.js +52 -100
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
- package/dist/components/Timeline/TimelineColorField.js +20 -1
- package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
- package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
- package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
- package/dist/components/Timeline/TimelineList.d.ts +2 -2
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +7 -1
- package/dist/components/Timeline/TimelineSelection.d.ts +5 -5
- package/dist/components/Timeline/TimelineSelection.js +8 -6
- package/dist/components/Timeline/TimelineSequence.js +1 -5
- package/dist/components/Timeline/TimelineSequenceItem.js +57 -10
- package/dist/components/Timeline/TimelineSequencePropItem.js +27 -75
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +0 -1
- package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
- package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
- package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
- package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
- package/dist/components/Timeline/reset-selected-timeline-props.js +18 -10
- package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
- package/dist/components/Timeline/save-effect-prop.js +52 -1
- package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
- package/dist/components/Timeline/timeline-asset-link.js +17 -1
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
- package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
- package/dist/components/TopPanel.js +2 -2
- package/dist/components/UndoRedoButtons.js +27 -5
- package/dist/components/composition-drop-preview.js +1 -0
- package/dist/components/menu-toolbar-height.d.ts +1 -0
- package/dist/components/menu-toolbar-height.js +4 -0
- package/dist/components/selected-outline-drag.d.ts +41 -4
- package/dist/components/selected-outline-drag.js +179 -2
- package/dist/components/selected-outline-geometry.d.ts +1 -0
- package/dist/components/selected-outline-measurement.d.ts +11 -0
- package/dist/components/selected-outline-measurement.js +64 -3
- package/dist/components/selected-outline-types.d.ts +44 -1
- package/dist/components/selected-outline-types.js +21 -1
- package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
- package/dist/esm/{chunk-pk1zwsn1.js → chunk-dr1y1vm3.js} +8417 -7127
- package/dist/esm/internals.mjs +8417 -7127
- package/dist/esm/previewEntry.mjs +51241 -49953
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.d.ts +2 -2
- package/dist/helpers/calculate-timeline.js +8 -28
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
- package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
- package/dist/helpers/interactivity-enabled.d.ts +1 -0
- package/dist/helpers/interactivity-enabled.js +7 -2
- package/dist/helpers/is-mac.d.ts +1 -0
- package/dist/helpers/is-mac.js +4 -0
- package/dist/helpers/open-in-editor.d.ts +5 -1
- package/dist/helpers/open-in-editor.js +15 -1
- package/dist/helpers/sort-by-nonce-history.js +97 -19
- package/dist/helpers/use-keybinding.js +2 -3
- package/dist/helpers/use-menu-structure.js +10 -1
- package/dist/icons/caret.d.ts +1 -0
- package/dist/icons/caret.js +2 -2
- package/dist/icons/pen.d.ts +5 -0
- package/dist/icons/pen.js +8 -0
- package/dist/state/modals.d.ts +5 -0
- package/package.json +12 -12
- package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
- package/dist/helpers/get-timeline-sequence-hash.js +0 -33
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
4
|
const DismissableModal_1 = require("../NewComposition/DismissableModal");
|
|
5
5
|
const QuickSwitcherContent_1 = require("./QuickSwitcherContent");
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const panelStyle = {
|
|
7
|
+
borderRadius: 6,
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
};
|
|
10
|
+
const QuickSwitcher = ({ initialMode, invocationTimestamp, readOnlyStudio, assetSelection }) => {
|
|
11
|
+
return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { panelStyle: panelStyle, children: jsx_runtime_1.jsx(QuickSwitcherContent_1.QuickSwitcherContent, { readOnlyStudio: readOnlyStudio, invocationTimestamp: invocationTimestamp, initialMode: initialMode, assetSelection: assetSelection }) }));
|
|
8
12
|
};
|
|
9
13
|
exports.default = QuickSwitcher;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { StaticFile } from '../../api/get-static-files';
|
|
2
3
|
import type { QuickSwitcherMode } from './NoResults';
|
|
3
4
|
export declare const QuickSwitcherContent: React.FC<{
|
|
4
5
|
readonly initialMode: QuickSwitcherMode;
|
|
5
6
|
readonly invocationTimestamp: number;
|
|
6
7
|
readonly readOnlyStudio: boolean;
|
|
8
|
+
readonly assetSelection: {
|
|
9
|
+
readonly initialQuery: string;
|
|
10
|
+
readonly onSelected: (asset: StaticFile) => void;
|
|
11
|
+
} | null;
|
|
7
12
|
}>;
|
|
@@ -5,7 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const get_preview_file_type_1 = require("../../helpers/get-preview-file-type");
|
|
8
9
|
const is_composition_still_1 = require("../../helpers/is-composition-still");
|
|
10
|
+
const url_state_1 = require("../../helpers/url-state");
|
|
9
11
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
10
12
|
const use_menu_structure_1 = require("../../helpers/use-menu-structure");
|
|
11
13
|
const modals_1 = require("../../state/modals");
|
|
@@ -14,14 +16,18 @@ const KeyboardShortcutsExplainer_1 = require("../KeyboardShortcutsExplainer");
|
|
|
14
16
|
const layout_1 = require("../layout");
|
|
15
17
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
16
18
|
const RemInput_1 = require("../NewComposition/RemInput");
|
|
19
|
+
const use_select_asset_1 = require("../use-select-asset");
|
|
20
|
+
const use_static_files_1 = require("../use-static-files");
|
|
17
21
|
const algolia_search_1 = require("./algolia-search");
|
|
18
22
|
const AlgoliaCredit_1 = require("./AlgoliaCredit");
|
|
23
|
+
const asset_search_1 = require("./asset-search");
|
|
19
24
|
const fuzzy_search_1 = require("./fuzzy-search");
|
|
20
25
|
const NoResults_1 = require("./NoResults");
|
|
21
26
|
const QuickSwitcherResult_1 = require("./QuickSwitcherResult");
|
|
22
27
|
const shared_1 = require("./shared");
|
|
23
28
|
const input = {
|
|
24
29
|
width: '100%',
|
|
30
|
+
borderRadius: 4,
|
|
25
31
|
};
|
|
26
32
|
const modeSelector = {
|
|
27
33
|
paddingLeft: 16,
|
|
@@ -57,8 +63,12 @@ const content = {
|
|
|
57
63
|
flexDirection: 'row',
|
|
58
64
|
alignItems: 'center',
|
|
59
65
|
};
|
|
66
|
+
const contentWithoutModeSelector = {
|
|
67
|
+
...content,
|
|
68
|
+
paddingTop: 16,
|
|
69
|
+
};
|
|
60
70
|
const stripQuery = (query) => {
|
|
61
|
-
if (query.startsWith('>') || query.startsWith('?')) {
|
|
71
|
+
if (query.startsWith('$') || query.startsWith('>') || query.startsWith('?')) {
|
|
62
72
|
return query.substring(1).trim();
|
|
63
73
|
}
|
|
64
74
|
return query.trim();
|
|
@@ -68,9 +78,14 @@ const mapQueryToMode = (query) => {
|
|
|
68
78
|
? 'commands'
|
|
69
79
|
: query.startsWith('?')
|
|
70
80
|
? 'docs'
|
|
71
|
-
: '
|
|
81
|
+
: query.startsWith('$')
|
|
82
|
+
? 'assets'
|
|
83
|
+
: 'compositions';
|
|
72
84
|
};
|
|
73
85
|
const mapModeToQuery = (mode) => {
|
|
86
|
+
if (mode === 'assets') {
|
|
87
|
+
return '$ ';
|
|
88
|
+
}
|
|
74
89
|
if (mode === 'commands') {
|
|
75
90
|
return '> ';
|
|
76
91
|
}
|
|
@@ -82,28 +97,34 @@ const mapModeToQuery = (mode) => {
|
|
|
82
97
|
}
|
|
83
98
|
throw new Error('no mode' + mode);
|
|
84
99
|
};
|
|
85
|
-
const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio }) => {
|
|
100
|
+
const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio, assetSelection }) => {
|
|
86
101
|
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
102
|
+
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
87
103
|
const [state, setState] = (0, react_1.useState)(() => {
|
|
88
104
|
return {
|
|
89
|
-
query:
|
|
105
|
+
query: assetSelection === null
|
|
106
|
+
? mapModeToQuery(initialMode)
|
|
107
|
+
: assetSelection.initialQuery,
|
|
90
108
|
selectedIndex: 0,
|
|
91
109
|
};
|
|
92
110
|
});
|
|
93
111
|
(0, react_1.useEffect)(() => {
|
|
94
112
|
setState({
|
|
95
|
-
query:
|
|
113
|
+
query: assetSelection === null
|
|
114
|
+
? mapModeToQuery(initialMode)
|
|
115
|
+
: assetSelection.initialQuery,
|
|
96
116
|
selectedIndex: 0,
|
|
97
117
|
});
|
|
98
|
-
}, [initialMode, invocationTimestamp]);
|
|
118
|
+
}, [assetSelection, initialMode, invocationTimestamp]);
|
|
99
119
|
const inputRef = (0, react_1.useRef)(null);
|
|
100
120
|
const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
|
|
121
|
+
const selectAsset = (0, use_select_asset_1.useSelectAsset)();
|
|
101
122
|
const closeMenu = (0, react_1.useCallback)(() => undefined, []);
|
|
102
123
|
const actions = (0, use_menu_structure_1.useMenuStructure)(closeMenu, readOnlyStudio);
|
|
103
124
|
const [docResults, setDocResults] = (0, react_1.useState)({ type: 'initial' });
|
|
104
125
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
105
126
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
106
|
-
const mode = mapQueryToMode(state.query);
|
|
127
|
+
const mode = assetSelection !== null ? 'assets' : mapQueryToMode(state.query);
|
|
107
128
|
const actualQuery = (0, react_1.useMemo)(() => {
|
|
108
129
|
return stripQuery(state.query);
|
|
109
130
|
}, [state.query]);
|
|
@@ -113,6 +134,12 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
113
134
|
}
|
|
114
135
|
return (0, use_menu_structure_1.makeSearchResults)(actions, setSelectedModal);
|
|
115
136
|
}, [actions, mode, setSelectedModal]);
|
|
137
|
+
const assetSearch = (0, react_1.useMemo)(() => {
|
|
138
|
+
return (0, asset_search_1.filterAssetsByType)({
|
|
139
|
+
assets: staticFiles,
|
|
140
|
+
query: actualQuery,
|
|
141
|
+
});
|
|
142
|
+
}, [actualQuery, staticFiles]);
|
|
116
143
|
const resultsArray = (0, react_1.useMemo)(() => {
|
|
117
144
|
if (mode === 'commands') {
|
|
118
145
|
return (0, fuzzy_search_1.fuzzySearch)(actualQuery, menuActions);
|
|
@@ -120,6 +147,26 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
120
147
|
if (mode === 'docs' && docResults.type === 'results') {
|
|
121
148
|
return docResults.results;
|
|
122
149
|
}
|
|
150
|
+
if (mode === 'assets') {
|
|
151
|
+
return (0, fuzzy_search_1.fuzzySearch)(assetSearch.query, assetSearch.assets.map((asset) => {
|
|
152
|
+
return {
|
|
153
|
+
id: 'asset-' + asset.name,
|
|
154
|
+
title: asset.name,
|
|
155
|
+
type: 'asset',
|
|
156
|
+
fileType: (0, get_preview_file_type_1.getPreviewFileType)(asset.name),
|
|
157
|
+
onSelected: () => {
|
|
158
|
+
if (assetSelection !== null) {
|
|
159
|
+
assetSelection.onSelected(asset);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
selectAsset(asset.name);
|
|
163
|
+
(0, url_state_1.pushUrl)(`/assets/${asset.name}`);
|
|
164
|
+
}
|
|
165
|
+
setSelectedModal(null);
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
123
170
|
return (0, fuzzy_search_1.fuzzySearch)(actualQuery, compositions.map((c) => {
|
|
124
171
|
return {
|
|
125
172
|
id: 'composition-' + c.id,
|
|
@@ -146,6 +193,9 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
146
193
|
compositions,
|
|
147
194
|
menuActions,
|
|
148
195
|
docResults,
|
|
196
|
+
assetSearch,
|
|
197
|
+
assetSelection,
|
|
198
|
+
selectAsset,
|
|
149
199
|
selectComposition,
|
|
150
200
|
setSelectedModal,
|
|
151
201
|
]);
|
|
@@ -244,6 +294,14 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
244
294
|
}));
|
|
245
295
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
246
296
|
}, []);
|
|
297
|
+
const onAssetsSelected = (0, react_1.useCallback)(() => {
|
|
298
|
+
var _a;
|
|
299
|
+
setState((s) => ({
|
|
300
|
+
query: `$ ${stripQuery(s.query)}`,
|
|
301
|
+
selectedIndex: 0,
|
|
302
|
+
}));
|
|
303
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
304
|
+
}, []);
|
|
247
305
|
const onDocSearchSelected = (0, react_1.useCallback)(() => {
|
|
248
306
|
var _a;
|
|
249
307
|
setState((s) => ({
|
|
@@ -255,6 +313,13 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
255
313
|
}, []);
|
|
256
314
|
const showKeyboardShortcuts = mode === 'docs' && actualQuery.trim() === '';
|
|
257
315
|
const showSearchLoadingState = mode === 'docs' && docResults.type === 'loading';
|
|
316
|
+
const placeholder = mode === 'assets'
|
|
317
|
+
? 'Search assets...'
|
|
318
|
+
: mode === 'commands'
|
|
319
|
+
? 'Search actions...'
|
|
320
|
+
: mode === 'docs'
|
|
321
|
+
? 'Search documentation...'
|
|
322
|
+
: 'Search compositions...';
|
|
258
323
|
const container = (0, react_1.useMemo)(() => {
|
|
259
324
|
return {
|
|
260
325
|
width: showKeyboardShortcuts ? 800 : 500,
|
|
@@ -272,11 +337,10 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
|
|
|
272
337
|
height: 300,
|
|
273
338
|
};
|
|
274
339
|
}, [showKeyboardShortcuts]);
|
|
275
|
-
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, type: "text", style: input, autoFocus: true, status: "ok", value: state.query, onChange: onTextChange, placeholder: "Search compositions...", rightAlign: false }), showKeyboardShortcuts ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
340
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [assetSelection === null && (jsx_runtime_1.jsxs("div", { style: modeSelector, children: [
|
|
341
|
+
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" })
|
|
342
|
+
] })), jsx_runtime_1.jsxs("div", { style: assetSelection === null ? content : contentWithoutModeSelector, children: [
|
|
343
|
+
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 }), showKeyboardShortcuts ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
280
344
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }),
|
|
281
345
|
" ",
|
|
282
346
|
jsx_runtime_1.jsx(AlgoliaCredit_1.AlgoliaCredit, {})
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { AssetFileType } from '../../helpers/get-preview-file-type';
|
|
2
3
|
type QuickSwitcherResultDetail = {
|
|
4
|
+
type: 'asset';
|
|
5
|
+
fileType: AssetFileType;
|
|
6
|
+
} | {
|
|
3
7
|
type: 'composition';
|
|
4
8
|
compositionType: 'composition' | 'still';
|
|
5
9
|
} | {
|
|
@@ -7,6 +7,7 @@ const colors_1 = require("../../helpers/colors");
|
|
|
7
7
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
8
8
|
const still_1 = require("../../icons/still");
|
|
9
9
|
const video_1 = require("../../icons/video");
|
|
10
|
+
const AssetFileIcon_1 = require("../AssetFileIcon");
|
|
10
11
|
const layout_1 = require("../layout");
|
|
11
12
|
const shared_1 = require("./shared");
|
|
12
13
|
const container = {
|
|
@@ -15,7 +16,11 @@ const container = {
|
|
|
15
16
|
display: 'flex',
|
|
16
17
|
flexDirection: 'row',
|
|
17
18
|
alignItems: 'center',
|
|
18
|
-
cursor: '
|
|
19
|
+
cursor: 'default',
|
|
20
|
+
marginBottom: 1,
|
|
21
|
+
marginLeft: 4,
|
|
22
|
+
marginRight: 4,
|
|
23
|
+
borderRadius: 4,
|
|
19
24
|
};
|
|
20
25
|
const label = {
|
|
21
26
|
whiteSpace: 'nowrap',
|
|
@@ -26,8 +31,9 @@ const searchLabel = {
|
|
|
26
31
|
lineHeight: 1.25,
|
|
27
32
|
};
|
|
28
33
|
const iconStyle = {
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
34
|
+
width: 18,
|
|
35
|
+
height: 18,
|
|
36
|
+
flexShrink: 0,
|
|
31
37
|
};
|
|
32
38
|
const labelContainer = {
|
|
33
39
|
overflow: 'hidden',
|
|
@@ -75,10 +81,7 @@ const QuickSwitcherResult = ({ result, selected }) => {
|
|
|
75
81
|
const style = (0, react_1.useMemo)(() => {
|
|
76
82
|
return {
|
|
77
83
|
...container,
|
|
78
|
-
backgroundColor:
|
|
79
|
-
hovered,
|
|
80
|
-
selected,
|
|
81
|
-
}),
|
|
84
|
+
backgroundColor: hovered || selected ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
|
|
82
85
|
};
|
|
83
86
|
}, [hovered, selected]);
|
|
84
87
|
const labelStyle = (0, react_1.useMemo)(() => {
|
|
@@ -92,7 +95,7 @@ const QuickSwitcherResult = ({ result, selected }) => {
|
|
|
92
95
|
fontSize: shared_1.QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,
|
|
93
96
|
};
|
|
94
97
|
}, [hovered, result.type, selected]);
|
|
95
|
-
return (jsx_runtime_1.jsxs("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { color: selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }))) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelContainer, children: result.type === 'search-result' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
98
|
+
return (jsx_runtime_1.jsxs("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }))) : result.type === 'asset' ? (jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: result.fileType, color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelContainer, children: result.type === 'search-result' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
96
99
|
jsx_runtime_1.jsx("div", {
|
|
97
100
|
// eslint-disable-next-line react/no-danger
|
|
98
101
|
dangerouslySetInnerHTML: {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StaticFile } from '../../api/get-static-files';
|
|
2
|
+
export declare const filterAssetsByType: ({ assets, query, }: {
|
|
3
|
+
readonly assets: StaticFile[];
|
|
4
|
+
readonly query: string;
|
|
5
|
+
}) => {
|
|
6
|
+
readonly assets: StaticFile[];
|
|
7
|
+
readonly query: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const getAssetSearchQueryForComponent: (componentIdentity: string | null) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAssetSearchQueryForComponent = exports.filterAssetsByType = void 0;
|
|
4
|
+
const get_preview_file_type_1 = require("../../helpers/get-preview-file-type");
|
|
5
|
+
const typeFilterRegex = /(^|\s)type:([^\s]+)/gi;
|
|
6
|
+
const filterAssetsByType = ({ assets, query, }) => {
|
|
7
|
+
const typeFilters = [];
|
|
8
|
+
const queryWithoutTypeFilters = query
|
|
9
|
+
.replace(typeFilterRegex, (_match, whitespace, type) => {
|
|
10
|
+
typeFilters.push(type.toLowerCase());
|
|
11
|
+
return whitespace;
|
|
12
|
+
})
|
|
13
|
+
.replace(/\s+/g, ' ')
|
|
14
|
+
.trim();
|
|
15
|
+
if (typeFilters.length === 0) {
|
|
16
|
+
return {
|
|
17
|
+
assets,
|
|
18
|
+
query: queryWithoutTypeFilters,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
assets: assets.filter((asset) => {
|
|
23
|
+
return typeFilters.includes((0, get_preview_file_type_1.getPreviewFileType)(asset.name));
|
|
24
|
+
}),
|
|
25
|
+
query: queryWithoutTypeFilters,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.filterAssetsByType = filterAssetsByType;
|
|
29
|
+
const componentAssetTypes = {
|
|
30
|
+
'dev.remotion.media.Audio': 'audio',
|
|
31
|
+
'dev.remotion.media.Video': 'video',
|
|
32
|
+
'dev.remotion.remotion.AnimatedImage': 'image',
|
|
33
|
+
'dev.remotion.remotion.Img': 'image',
|
|
34
|
+
};
|
|
35
|
+
const getAssetSearchQueryForComponent = (componentIdentity) => {
|
|
36
|
+
if (componentIdentity === null) {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
const assetType = componentAssetTypes[componentIdentity];
|
|
40
|
+
return assetType ? `type:${assetType} ` : '';
|
|
41
|
+
};
|
|
42
|
+
exports.getAssetSearchQueryForComponent = getAssetSearchQueryForComponent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectedOutline } from './selected-outline-geometry';
|
|
3
|
+
import { type SelectedOutlineTarget } from './selected-outline-types';
|
|
4
|
+
export declare const SelectedOutlineCropControls: React.FC<{
|
|
5
|
+
readonly outline: SelectedOutline;
|
|
6
|
+
readonly onDraggingChange: (dragging: boolean) => void;
|
|
7
|
+
readonly target: SelectedOutlineTarget | undefined;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,299 @@
|
|
|
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.SelectedOutlineCropControls = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const remotion_1 = require("remotion");
|
|
40
|
+
const colors_1 = require("../helpers/colors");
|
|
41
|
+
const ForceSpecificCursor_1 = require("./ForceSpecificCursor");
|
|
42
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
43
|
+
const selected_outline_drag_1 = require("./selected-outline-drag");
|
|
44
|
+
const selected_outline_measurement_1 = require("./selected-outline-measurement");
|
|
45
|
+
const selected_outline_types_1 = require("./selected-outline-types");
|
|
46
|
+
const selected_outline_uv_1 = require("./selected-outline-uv");
|
|
47
|
+
const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
|
|
48
|
+
const focus_inspector_field_1 = require("./Timeline/focus-inspector-field");
|
|
49
|
+
const save_sequence_prop_1 = require("./Timeline/save-sequence-prop");
|
|
50
|
+
const CROP_HANDLE_THICKNESS = 5;
|
|
51
|
+
const CROP_HANDLE_LENGTH = 20;
|
|
52
|
+
const CROP_HANDLE_HIT_WIDTH = 14;
|
|
53
|
+
const CROPPED_AWAY_OPACITY = 0.35;
|
|
54
|
+
const cropHandles = [
|
|
55
|
+
'top-left',
|
|
56
|
+
'top-right',
|
|
57
|
+
'bottom-left',
|
|
58
|
+
'bottom-right',
|
|
59
|
+
'top',
|
|
60
|
+
'right',
|
|
61
|
+
'bottom',
|
|
62
|
+
'left',
|
|
63
|
+
];
|
|
64
|
+
const cursorForHandle = (handle) => {
|
|
65
|
+
if (handle === 'top' || handle === 'bottom') {
|
|
66
|
+
return 'ns-resize';
|
|
67
|
+
}
|
|
68
|
+
if (handle === 'left' || handle === 'right') {
|
|
69
|
+
return 'ew-resize';
|
|
70
|
+
}
|
|
71
|
+
return handle === 'top-left' || handle === 'bottom-right'
|
|
72
|
+
? 'nwse-resize'
|
|
73
|
+
: 'nesw-resize';
|
|
74
|
+
};
|
|
75
|
+
const moveTowards = (from, to, distance) => {
|
|
76
|
+
const vector = (0, selected_outline_measurement_1.vectorBetween)(from, to);
|
|
77
|
+
const length = (0, selected_outline_measurement_1.vectorLength)(vector);
|
|
78
|
+
if (length === 0) {
|
|
79
|
+
return from;
|
|
80
|
+
}
|
|
81
|
+
const progress = Math.min(1, distance / length);
|
|
82
|
+
return {
|
|
83
|
+
x: from.x + vector.x * progress,
|
|
84
|
+
y: from.y + vector.y * progress,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const pointString = (point) => `${point.x} ${point.y}`;
|
|
88
|
+
const getCropHandlePath = ({ handle, points, }) => {
|
|
89
|
+
const [topLeft, topRight, bottomRight, bottomLeft] = points;
|
|
90
|
+
const cornerInfo = {
|
|
91
|
+
'top-left': { corner: topLeft, first: topRight, second: bottomLeft },
|
|
92
|
+
'top-right': { corner: topRight, first: topLeft, second: bottomRight },
|
|
93
|
+
'bottom-left': { corner: bottomLeft, first: topLeft, second: bottomRight },
|
|
94
|
+
'bottom-right': { corner: bottomRight, first: topRight, second: bottomLeft },
|
|
95
|
+
};
|
|
96
|
+
if (handle in cornerInfo) {
|
|
97
|
+
const info = cornerInfo[handle];
|
|
98
|
+
const length = Math.min(CROP_HANDLE_LENGTH, (0, selected_outline_measurement_1.vectorLength)((0, selected_outline_measurement_1.vectorBetween)(info.corner, info.first)) / 4, (0, selected_outline_measurement_1.vectorLength)((0, selected_outline_measurement_1.vectorBetween)(info.corner, info.second)) / 4);
|
|
99
|
+
const first = moveTowards(info.corner, info.first, length);
|
|
100
|
+
const second = moveTowards(info.corner, info.second, length);
|
|
101
|
+
return `M ${pointString(first)} L ${pointString(info.corner)} L ${pointString(second)}`;
|
|
102
|
+
}
|
|
103
|
+
const edgeInfo = {
|
|
104
|
+
top: [topLeft, topRight],
|
|
105
|
+
right: [topRight, bottomRight],
|
|
106
|
+
bottom: [bottomLeft, bottomRight],
|
|
107
|
+
left: [topLeft, bottomLeft],
|
|
108
|
+
};
|
|
109
|
+
const [start, end] = edgeInfo[handle];
|
|
110
|
+
const center = (0, selected_outline_measurement_1.midpoint)(start, end);
|
|
111
|
+
const halfLength = Math.min(CROP_HANDLE_LENGTH / 2, (0, selected_outline_measurement_1.vectorLength)((0, selected_outline_measurement_1.vectorBetween)(start, end)) / 8);
|
|
112
|
+
const pathStart = moveTowards(center, start, halfLength);
|
|
113
|
+
const pathEnd = moveTowards(center, end, halfLength);
|
|
114
|
+
return `M ${pointString(pathStart)} L ${pointString(pathEnd)}`;
|
|
115
|
+
};
|
|
116
|
+
const getCropValues = (target) => ({
|
|
117
|
+
cropLeft: target.fields.cropLeft.value,
|
|
118
|
+
cropRight: target.fields.cropRight.value,
|
|
119
|
+
cropTop: target.fields.cropTop.value,
|
|
120
|
+
cropBottom: target.fields.cropBottom.value,
|
|
121
|
+
});
|
|
122
|
+
const makeCropPreviewMask = (crop) => {
|
|
123
|
+
const x = crop.left * 100;
|
|
124
|
+
const y = crop.top * 100;
|
|
125
|
+
const width = Math.max(0, 1 - crop.left - crop.right) * 100;
|
|
126
|
+
const height = Math.max(0, 1 - crop.top - crop.bottom) * 100;
|
|
127
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1" viewBox="0 0 100 100" preserveAspectRatio="none"><rect width="100" height="100" fill="white" fill-opacity="${CROPPED_AWAY_OPACITY}"/><rect x="${x}" y="${y}" width="${width}" height="${height}" fill="white"/></svg>`;
|
|
128
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
129
|
+
};
|
|
130
|
+
const cropPreviewAttribute = 'data-remotion-studio-crop-preview';
|
|
131
|
+
let cropPreviewId = 0;
|
|
132
|
+
const useCropPreview = (target) => {
|
|
133
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
134
|
+
var _a;
|
|
135
|
+
if (target === undefined || target.cropDrag === null) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const element = target.ref.current;
|
|
139
|
+
if (!(element instanceof HTMLElement || element instanceof SVGElement)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const mask = makeCropPreviewMask(target.crop);
|
|
143
|
+
const previewId = String(++cropPreviewId);
|
|
144
|
+
const styleElement = element.ownerDocument.createElement('style');
|
|
145
|
+
styleElement.textContent = `
|
|
146
|
+
[${cropPreviewAttribute}="${previewId}"] {
|
|
147
|
+
clip-path: none !important;
|
|
148
|
+
mask-image: ${mask} !important;
|
|
149
|
+
-webkit-mask-image: ${mask} !important;
|
|
150
|
+
mask-position: 0 0 !important;
|
|
151
|
+
-webkit-mask-position: 0 0 !important;
|
|
152
|
+
mask-repeat: no-repeat !important;
|
|
153
|
+
-webkit-mask-repeat: no-repeat !important;
|
|
154
|
+
mask-size: 100% 100% !important;
|
|
155
|
+
-webkit-mask-size: 100% 100% !important;
|
|
156
|
+
}`;
|
|
157
|
+
// Do not mutate the inline crop style: React would still consider its
|
|
158
|
+
// clipPath prop applied and may not restore it when crop mode is closed.
|
|
159
|
+
element.setAttribute(cropPreviewAttribute, previewId);
|
|
160
|
+
((_a = element.ownerDocument.head) !== null && _a !== void 0 ? _a : element.ownerDocument.documentElement).append(styleElement);
|
|
161
|
+
return () => {
|
|
162
|
+
if (element.getAttribute(cropPreviewAttribute) === previewId) {
|
|
163
|
+
element.removeAttribute(cropPreviewAttribute);
|
|
164
|
+
}
|
|
165
|
+
styleElement.remove();
|
|
166
|
+
};
|
|
167
|
+
}, [target]);
|
|
168
|
+
};
|
|
169
|
+
const CropHandle = ({ handle, outline, onDraggingChange, target }) => {
|
|
170
|
+
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
171
|
+
const { cropDrag } = target;
|
|
172
|
+
const cursor = cursorForHandle(handle);
|
|
173
|
+
const path = (0, react_1.useMemo)(() => getCropHandlePath({ handle, points: outline.points }), [handle, outline.points]);
|
|
174
|
+
const onPointerDown = react_1.default.useCallback((event) => {
|
|
175
|
+
var _a;
|
|
176
|
+
if (event.button !== 0 || cropDrag === null) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
event.stopPropagation();
|
|
181
|
+
if ((0, focus_inspector_field_1.commitPendingInspectorFields)()) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const svg = event.currentTarget.ownerSVGElement;
|
|
185
|
+
if (svg === null) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const svgRect = svg.getBoundingClientRect();
|
|
189
|
+
const uncroppedPoints = (_a = outline.uncroppedPoints) !== null && _a !== void 0 ? _a : outline.points;
|
|
190
|
+
const initialValues = getCropValues(cropDrag);
|
|
191
|
+
let lastValues = initialValues;
|
|
192
|
+
let dragStarted = false;
|
|
193
|
+
const onPointerMove = (moveEvent) => {
|
|
194
|
+
moveEvent.preventDefault();
|
|
195
|
+
if (!dragStarted) {
|
|
196
|
+
dragStarted = true;
|
|
197
|
+
onDraggingChange(true);
|
|
198
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)(cursor !== null && cursor !== void 0 ? cursor : 'default');
|
|
199
|
+
}
|
|
200
|
+
const uv = (0, selected_outline_uv_1.getUvCoordinateForPoint)(uncroppedPoints, {
|
|
201
|
+
x: moveEvent.clientX - svgRect.left,
|
|
202
|
+
y: moveEvent.clientY - svgRect.top,
|
|
203
|
+
});
|
|
204
|
+
lastValues = (0, selected_outline_drag_1.getSelectedOutlineCropDragValues)({
|
|
205
|
+
crop: initialValues,
|
|
206
|
+
dimensions: outline.dimensions,
|
|
207
|
+
handle,
|
|
208
|
+
uv,
|
|
209
|
+
});
|
|
210
|
+
const transformOrigin = (0, selected_outline_drag_1.getSelectedOutlineCropFollowingTransformOrigin)({
|
|
211
|
+
dimensions: outline.dimensions,
|
|
212
|
+
initialCrop: initialValues,
|
|
213
|
+
nextCrop: lastValues,
|
|
214
|
+
transformOrigin: cropDrag.transformOrigin,
|
|
215
|
+
});
|
|
216
|
+
for (const fieldKey of Object.values(selected_outline_types_1.cropFieldKeys)) {
|
|
217
|
+
const field = cropDrag.fields[fieldKey];
|
|
218
|
+
const value = lastValues[fieldKey];
|
|
219
|
+
if (value === field.value) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
setDragOverrides(cropDrag.nodePath, fieldKey, field.propStatus.status === 'keyframed'
|
|
223
|
+
? remotion_1.Internals.makeKeyframedDragOverride({
|
|
224
|
+
status: field.propStatus,
|
|
225
|
+
frame: cropDrag.sourceFrame,
|
|
226
|
+
value,
|
|
227
|
+
})
|
|
228
|
+
: remotion_1.Internals.makeStaticDragOverride(value));
|
|
229
|
+
}
|
|
230
|
+
if (transformOrigin !== null) {
|
|
231
|
+
setDragOverrides(cropDrag.nodePath, selected_outline_types_1.transformOriginFieldKey, remotion_1.Internals.makeStaticDragOverride(transformOrigin));
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const onPointerUp = () => {
|
|
235
|
+
window.removeEventListener('pointermove', onPointerMove);
|
|
236
|
+
window.removeEventListener('pointerup', onPointerUp);
|
|
237
|
+
window.removeEventListener('pointercancel', onPointerUp);
|
|
238
|
+
if (dragStarted) {
|
|
239
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
240
|
+
onDraggingChange(false);
|
|
241
|
+
}
|
|
242
|
+
const changes = (0, selected_outline_drag_1.getSelectedOutlineCropDragChanges)({
|
|
243
|
+
dimensions: outline.dimensions,
|
|
244
|
+
target: cropDrag,
|
|
245
|
+
values: lastValues,
|
|
246
|
+
});
|
|
247
|
+
const staticChanges = changes.filter((change) => change.type === 'static');
|
|
248
|
+
const keyframedChanges = changes.filter((change) => change.type === 'keyframed');
|
|
249
|
+
const promise = staticChanges.length === 0
|
|
250
|
+
? (0, call_add_keyframe_1.callAddKeyframes)({
|
|
251
|
+
sequenceKeyframes: keyframedChanges,
|
|
252
|
+
effectKeyframes: [],
|
|
253
|
+
setPropStatuses,
|
|
254
|
+
clientId: cropDrag.clientId,
|
|
255
|
+
})
|
|
256
|
+
: (0, save_sequence_prop_1.saveSequenceProps)({
|
|
257
|
+
changes: staticChanges,
|
|
258
|
+
addedKeyframes: keyframedChanges,
|
|
259
|
+
movedKeyframes: null,
|
|
260
|
+
setPropStatuses,
|
|
261
|
+
clientId: cropDrag.clientId,
|
|
262
|
+
undoLabel: 'Crop sequence',
|
|
263
|
+
redoLabel: 'Crop sequence back',
|
|
264
|
+
});
|
|
265
|
+
promise
|
|
266
|
+
.catch((err) => {
|
|
267
|
+
(0, NotificationCenter_1.showNotification)(`Could not save crop: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
268
|
+
})
|
|
269
|
+
.finally(() => {
|
|
270
|
+
clearDragOverrides(cropDrag.nodePath);
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
window.addEventListener('pointermove', onPointerMove);
|
|
274
|
+
window.addEventListener('pointerup', onPointerUp);
|
|
275
|
+
window.addEventListener('pointercancel', onPointerUp);
|
|
276
|
+
}, [
|
|
277
|
+
clearDragOverrides,
|
|
278
|
+
cropDrag,
|
|
279
|
+
cursor,
|
|
280
|
+
handle,
|
|
281
|
+
onDraggingChange,
|
|
282
|
+
outline.dimensions,
|
|
283
|
+
outline.points,
|
|
284
|
+
outline.uncroppedPoints,
|
|
285
|
+
setDragOverrides,
|
|
286
|
+
setPropStatuses,
|
|
287
|
+
]);
|
|
288
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
289
|
+
jsx_runtime_1.jsx("path", { d: path, fill: "none", stroke: colors_1.TRANSPARENT, strokeWidth: CROP_HANDLE_HIT_WIDTH, strokeLinejoin: "miter", vectorEffect: "non-scaling-stroke", pointerEvents: "stroke", cursor: cursor, onPointerDown: onPointerDown }), jsx_runtime_1.jsx("path", { d: path, fill: "none", stroke: colors_1.BLUE, strokeWidth: CROP_HANDLE_THICKNESS, strokeLinejoin: "miter", strokeLinecap: "butt", vectorEffect: "non-scaling-stroke", pointerEvents: "none", style: { filter: colors_1.SELECTED_OUTLINE_DROP_SHADOW } })
|
|
290
|
+
] }));
|
|
291
|
+
};
|
|
292
|
+
const SelectedOutlineCropControls = ({ outline, onDraggingChange, target }) => {
|
|
293
|
+
useCropPreview(target);
|
|
294
|
+
if ((target === null || target === void 0 ? void 0 : target.cropDrag) === null || (target === null || target === void 0 ? void 0 : target.cropDrag) === undefined) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return (jsx_runtime_1.jsx("g", { "aria-hidden": "true", children: cropHandles.map((handle) => (jsx_runtime_1.jsx(CropHandle, { handle: handle, outline: outline, onDraggingChange: onDraggingChange, target: target }, handle))) }));
|
|
298
|
+
};
|
|
299
|
+
exports.SelectedOutlineCropControls = SelectedOutlineCropControls;
|