@remotion/studio 4.0.471 → 4.0.473
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/rename-static-file.d.ts +6 -0
- package/dist/api/rename-static-file.js +18 -0
- package/dist/components/AssetSelector.js +55 -5
- package/dist/components/AssetSelectorItem.js +153 -27
- package/dist/components/Canvas.js +147 -0
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +12 -4
- package/dist/components/ConfirmationDialog-types.d.ts +8 -0
- package/dist/components/ConfirmationDialog-types.js +2 -0
- package/dist/components/ConfirmationDialog.d.ts +7 -0
- package/dist/components/ConfirmationDialog.js +103 -0
- package/dist/components/ContextMenu.d.ts +9 -1
- package/dist/components/ContextMenu.js +99 -47
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/Editor.js +14 -6
- package/dist/components/EditorContent.js +15 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.js +2 -0
- package/dist/components/ExplorerPanel.d.ts +0 -4
- package/dist/components/ExplorerPanel.js +8 -4
- package/dist/components/ExplorerPanelRef.d.ts +4 -0
- package/dist/components/ExplorerPanelRef.js +5 -0
- package/dist/components/FilePreview.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.d.ts +0 -1
- package/dist/components/InitialCompositionLoader.js +5 -27
- package/dist/components/Menu/MenuItem.js +7 -1
- package/dist/components/Menu/SubMenu.js +5 -1
- package/dist/components/Menu/portals.js +17 -8
- package/dist/components/MenuToolbar.js +5 -1
- package/dist/components/ModalContainer.js +6 -1
- package/dist/components/Modals.js +8 -2
- package/dist/components/NewComposition/CodemodFooter.js +2 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
- package/dist/components/NewComposition/DeleteFolder.js +39 -0
- package/dist/components/NewComposition/DeleteStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/DeleteStaticFile.js +44 -0
- package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
- package/dist/components/NewComposition/RenameFolder.js +60 -0
- package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/RenameStaticFile.js +118 -0
- package/dist/components/OptionsPanel.js +5 -1
- package/dist/components/OutlineToggle.d.ts +2 -0
- package/dist/components/OutlineToggle.js +20 -0
- package/dist/components/Preview.d.ts +0 -2
- package/dist/components/Preview.js +23 -33
- package/dist/components/PreviewToolbar.js +19 -6
- package/dist/components/RenderButton.js +8 -2
- package/dist/components/RenderPreview.js +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +105 -4
- package/dist/components/SelectedOutlineOverlay.js +578 -59
- package/dist/components/ShowOutlinesProvider.d.ts +4 -0
- package/dist/components/ShowOutlinesProvider.js +24 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/Splitter/SplitterContainer.js +9 -0
- package/dist/components/Splitter/SplitterHandle.js +65 -70
- package/dist/components/StaticFilePreview.js +2 -2
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
- package/dist/components/Timeline/Timeline.js +50 -15
- package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
- package/dist/components/Timeline/TimelineArrayField.js +210 -0
- package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
- package/dist/components/Timeline/TimelineBooleanField.js +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +43 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +479 -0
- package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
- package/dist/components/Timeline/TimelineColorField.js +2 -8
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +12 -2
- package/dist/components/Timeline/TimelineEffectItem.js +3 -2
- package/dist/components/Timeline/TimelineEffectPropItem.js +146 -26
- package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
- package/dist/components/Timeline/TimelineEnumField.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +41 -37
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -21
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
- package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
- package/dist/components/Timeline/TimelineLayerEye.js +8 -3
- package/dist/components/Timeline/TimelineList.js +2 -2
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
- package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
- package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
- package/dist/components/Timeline/TimelineNumberField.js +7 -11
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
- package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +41 -24
- package/dist/components/Timeline/TimelineRowChrome.js +8 -7
- package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
- package/dist/components/Timeline/TimelineScaleField.js +314 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
- package/dist/components/Timeline/TimelineSchemaField.js +8 -42
- package/dist/components/Timeline/TimelineSelection.js +3 -2
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +51 -10
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +282 -28
- package/dist/components/Timeline/TimelineSequencePropItem.js +161 -35
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +525 -0
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineTranslateField.js +21 -25
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
- package/dist/components/Timeline/apply-effect-response-to-code-values.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-code-values.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.js +4 -0
- package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
- package/dist/components/Timeline/call-move-keyframe.js +71 -0
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
- package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +7 -4
- package/dist/components/Timeline/delete-selected-timeline-item.js +33 -21
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
- package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
- package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
- package/dist/components/Timeline/get-node-keyframes.js +38 -5
- package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
- package/dist/components/Timeline/reset-selected-timeline-props.js +22 -8
- package/dist/components/Timeline/save-effect-prop.d.ts +14 -3
- package/dist/components/Timeline/save-effect-prop.js +36 -18
- package/dist/components/Timeline/save-prop-queue.d.ts +2 -1
- package/dist/components/Timeline/save-prop-queue.js +5 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -7
- package/dist/components/Timeline/save-sequence-prop.js +33 -30
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
- package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
- package/dist/components/Timeline/timeline-asset-link.js +37 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
- package/dist/components/Timeline/timeline-field-utils.js +5 -1
- package/dist/components/Timeline/timeline-translate-utils.js +9 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +378 -0
- package/dist/components/TopPanel.d.ts +1 -1
- package/dist/components/folder-menu-items.d.ts +12 -0
- package/dist/components/folder-menu-items.js +147 -0
- package/dist/components/import-assets.d.ts +22 -0
- package/dist/components/import-assets.js +294 -0
- package/dist/components/load-canvas-content-from-url.d.ts +1 -0
- package/dist/components/load-canvas-content-from-url.js +9 -3
- package/dist/components/use-select-asset.d.ts +1 -0
- package/dist/components/use-select-asset.js +30 -0
- package/dist/error-overlay/error-origin.d.ts +3 -0
- package/dist/error-overlay/error-origin.js +42 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
- package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
- package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
- package/dist/esm/{chunk-z0z9d4r0.js → chunk-q0jkt0zq.js} +23062 -17350
- package/dist/esm/internals.mjs +23062 -17350
- package/dist/esm/previewEntry.mjs +22351 -16615
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +7 -3
- package/dist/helpers/create-folder-tree.js +1 -0
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-folder-id.d.ts +4 -0
- package/dist/helpers/get-folder-id.js +7 -0
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
- package/dist/helpers/install-required-package.d.ts +1 -0
- package/dist/helpers/install-required-package.js +39 -0
- package/dist/helpers/remote-asset-drag.d.ts +4 -0
- package/dist/helpers/remote-asset-drag.js +73 -0
- package/dist/helpers/timeline-layout.js +5 -1
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/helpers/validate-folder-rename.d.ts +6 -0
- package/dist/helpers/validate-folder-rename.js +19 -0
- package/dist/hot-middleware-client/client.js +6 -0
- package/dist/state/editor-outlines.d.ts +8 -0
- package/dist/state/editor-outlines.js +18 -0
- package/dist/state/modals.d.ts +29 -2
- package/dist/state/scale-lock.d.ts +18 -0
- package/dist/state/scale-lock.js +59 -0
- package/package.json +10 -10
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineSequencePropItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const remotion_1 = require("remotion");
|
|
7
8
|
const client_id_1 = require("../../helpers/client-id");
|
|
9
|
+
const modals_1 = require("../../state/modals");
|
|
8
10
|
const ContextMenu_1 = require("../ContextMenu");
|
|
11
|
+
const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
9
12
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
10
13
|
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
11
14
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
@@ -17,6 +20,23 @@ const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
|
17
20
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
18
21
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
19
22
|
const fieldRowBase = {};
|
|
23
|
+
const isKeyframedStatus = (status) => {
|
|
24
|
+
return status.status === 'keyframed';
|
|
25
|
+
};
|
|
26
|
+
const isResettableStatus = ({ status, defaultValue, }) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (defaultValue === undefined) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (status.status === 'keyframed') {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (status.status === 'computed') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const effectiveCodeValue = (_a = status.codeValue) !== null && _a !== void 0 ? _a : defaultValue;
|
|
38
|
+
return JSON.stringify(effectiveCodeValue) !== JSON.stringify(defaultValue);
|
|
39
|
+
};
|
|
20
40
|
const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
21
41
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
22
42
|
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
@@ -38,9 +58,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
38
58
|
? previewServerState.clientId
|
|
39
59
|
: null;
|
|
40
60
|
const onSave = (0, react_1.useCallback)((value) => {
|
|
41
|
-
|
|
42
|
-
return Promise.reject(new Error('Cannot save'));
|
|
43
|
-
}
|
|
61
|
+
var _a;
|
|
44
62
|
if (!clientId) {
|
|
45
63
|
return Promise.reject(new Error('Not connected to studio server'));
|
|
46
64
|
}
|
|
@@ -48,6 +66,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
48
66
|
? JSON.stringify(field.fieldSchema.default)
|
|
49
67
|
: null;
|
|
50
68
|
const stringifiedValue = JSON.stringify(value);
|
|
69
|
+
const fieldLabel = (_a = field.description) !== null && _a !== void 0 ? _a : field.key;
|
|
51
70
|
if (value === codeValue.codeValue) {
|
|
52
71
|
return Promise.resolve();
|
|
53
72
|
}
|
|
@@ -55,19 +74,26 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
55
74
|
codeValue.codeValue === undefined) {
|
|
56
75
|
return Promise.resolve();
|
|
57
76
|
}
|
|
58
|
-
return (0, save_sequence_prop_1.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
return (0, save_sequence_prop_1.saveSequenceProps)({
|
|
78
|
+
changes: [
|
|
79
|
+
{
|
|
80
|
+
fileName: validatedLocation.source,
|
|
81
|
+
nodePath,
|
|
82
|
+
fieldKey: field.key,
|
|
83
|
+
value,
|
|
84
|
+
defaultValue,
|
|
85
|
+
schema,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
65
88
|
setCodeValues,
|
|
66
89
|
clientId,
|
|
90
|
+
undoLabel: `Update ${fieldLabel}`,
|
|
91
|
+
redoLabel: `Update ${fieldLabel} again`,
|
|
67
92
|
});
|
|
68
93
|
}, [
|
|
69
94
|
codeValue,
|
|
70
95
|
clientId,
|
|
96
|
+
field.description,
|
|
71
97
|
field.fieldSchema.default,
|
|
72
98
|
field.key,
|
|
73
99
|
nodePath,
|
|
@@ -79,7 +105,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
79
105
|
if (nodePath === null) {
|
|
80
106
|
throw new Error('Cannot drag value');
|
|
81
107
|
}
|
|
82
|
-
setDragOverrides(nodePath, field.key, value);
|
|
108
|
+
setDragOverrides(nodePath, field.key, remotion_1.Internals.makeStaticDragOverride(value));
|
|
83
109
|
}, [setDragOverrides, nodePath, field.key]);
|
|
84
110
|
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
85
111
|
if (nodePath === null) {
|
|
@@ -87,17 +113,23 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
87
113
|
}
|
|
88
114
|
clearDragOverrides(nodePath);
|
|
89
115
|
}, [clearDragOverrides, nodePath]);
|
|
90
|
-
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
116
|
+
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue, scaleLockNodePath: nodePath }));
|
|
91
117
|
};
|
|
92
118
|
const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, schema, keyframeDisplayOffset, }) => {
|
|
93
119
|
var _a, _b;
|
|
94
120
|
const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
95
121
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
96
|
-
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
122
|
+
const { setCodeValues, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
97
123
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
124
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
98
125
|
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
126
|
+
const clientId = previewServerState.type === 'connected'
|
|
127
|
+
? previewServerState.clientId
|
|
128
|
+
: null;
|
|
99
129
|
const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
|
|
100
130
|
const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
131
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
132
|
+
const jsxFrame = timelinePosition - keyframeDisplayOffset;
|
|
101
133
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
102
134
|
var _a;
|
|
103
135
|
return ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
@@ -106,6 +138,10 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
106
138
|
(0, TimelineKeyframeControls_1.shouldShowTimelineKeyframeControls)({
|
|
107
139
|
propStatus: codeValue,
|
|
108
140
|
selected: selection.selected,
|
|
141
|
+
keyframable: (0, studio_shared_1.isSchemaFieldKeyframable)({
|
|
142
|
+
schema,
|
|
143
|
+
key: field.key,
|
|
144
|
+
}),
|
|
109
145
|
}) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus: codeValue, nodePath: nodePath, fileName: validatedLocation.source, keyframeDisplayOffset: keyframeDisplayOffset, defaultValue: field.fieldSchema.default, dragOverrideValue: dragOverrideValue, schema: schema, effectIndex: null })) : null;
|
|
110
146
|
const style = (0, react_1.useMemo)(() => {
|
|
111
147
|
return {
|
|
@@ -113,71 +149,161 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
113
149
|
height: field.rowHeight,
|
|
114
150
|
};
|
|
115
151
|
}, [field.rowHeight]);
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
if (!codeValue || !codeValue.canUpdate) {
|
|
152
|
+
const canResetToDefault = (0, react_1.useMemo)(() => {
|
|
153
|
+
if (!codeValue || codeValue.status === 'computed') {
|
|
119
154
|
return false;
|
|
120
155
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
156
|
+
return isResettableStatus({
|
|
157
|
+
status: codeValue,
|
|
158
|
+
defaultValue: field.fieldSchema.default,
|
|
159
|
+
});
|
|
124
160
|
}, [codeValue, field.fieldSchema.default]);
|
|
125
161
|
const canPerformReset = previewServerState.type === 'connected' &&
|
|
126
162
|
codeValue !== null &&
|
|
127
|
-
codeValue.
|
|
163
|
+
codeValue.status !== 'computed';
|
|
164
|
+
const canShowReset = canPerformReset && field.fieldSchema.default !== undefined;
|
|
128
165
|
const onReset = (0, react_1.useCallback)(() => {
|
|
129
|
-
|
|
166
|
+
var _a;
|
|
167
|
+
if (!canShowReset ||
|
|
168
|
+
!canResetToDefault ||
|
|
130
169
|
previewServerState.type !== 'connected' ||
|
|
131
|
-
codeValue === null
|
|
132
|
-
!isNonDefault) {
|
|
170
|
+
codeValue === null) {
|
|
133
171
|
return;
|
|
134
172
|
}
|
|
135
173
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
136
174
|
? JSON.stringify(field.fieldSchema.default)
|
|
137
175
|
: null;
|
|
138
|
-
(0
|
|
176
|
+
const fieldLabel = (_a = field.description) !== null && _a !== void 0 ? _a : field.key;
|
|
177
|
+
(0, save_sequence_prop_1.saveSequenceProps)({
|
|
178
|
+
changes: [
|
|
179
|
+
{
|
|
180
|
+
fileName: validatedLocation.source,
|
|
181
|
+
nodePath,
|
|
182
|
+
fieldKey: field.key,
|
|
183
|
+
value: field.fieldSchema.default,
|
|
184
|
+
defaultValue,
|
|
185
|
+
schema,
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
setCodeValues,
|
|
189
|
+
clientId: previewServerState.clientId,
|
|
190
|
+
undoLabel: `Reset ${fieldLabel}`,
|
|
191
|
+
redoLabel: `Reapply ${fieldLabel}`,
|
|
192
|
+
});
|
|
193
|
+
}, [
|
|
194
|
+
canResetToDefault,
|
|
195
|
+
canShowReset,
|
|
196
|
+
field.description,
|
|
197
|
+
field.fieldSchema.default,
|
|
198
|
+
field.key,
|
|
199
|
+
nodePath,
|
|
200
|
+
previewServerState,
|
|
201
|
+
schema,
|
|
202
|
+
setCodeValues,
|
|
203
|
+
validatedLocation.source,
|
|
204
|
+
codeValue,
|
|
205
|
+
]);
|
|
206
|
+
const onSaveKeyframed = (0, react_1.useCallback)((value, sourceFrame) => {
|
|
207
|
+
if (!clientId) {
|
|
208
|
+
return Promise.reject(new Error('Not connected to studio server'));
|
|
209
|
+
}
|
|
210
|
+
return (0, call_add_keyframe_1.callAddSequenceKeyframe)({
|
|
139
211
|
fileName: validatedLocation.source,
|
|
140
212
|
nodePath,
|
|
141
213
|
fieldKey: field.key,
|
|
142
|
-
|
|
143
|
-
|
|
214
|
+
sourceFrame,
|
|
215
|
+
value,
|
|
144
216
|
schema,
|
|
145
217
|
setCodeValues,
|
|
146
|
-
clientId
|
|
218
|
+
clientId,
|
|
147
219
|
});
|
|
148
220
|
}, [
|
|
149
|
-
|
|
150
|
-
field.fieldSchema.default,
|
|
221
|
+
clientId,
|
|
151
222
|
field.key,
|
|
152
|
-
isNonDefault,
|
|
153
223
|
nodePath,
|
|
154
|
-
previewServerState,
|
|
155
224
|
schema,
|
|
156
225
|
setCodeValues,
|
|
157
226
|
validatedLocation.source,
|
|
227
|
+
]);
|
|
228
|
+
const onKeyframedDragValueChange = (0, react_1.useCallback)((value) => {
|
|
229
|
+
if (codeValue === null || !isKeyframedStatus(codeValue)) {
|
|
230
|
+
throw new Error('Expected keyframed status');
|
|
231
|
+
}
|
|
232
|
+
setDragOverrides(nodePath, field.key, remotion_1.Internals.makeKeyframedDragOverride({
|
|
233
|
+
status: codeValue,
|
|
234
|
+
frame: jsxFrame,
|
|
235
|
+
value,
|
|
236
|
+
}));
|
|
237
|
+
}, [codeValue, field.key, jsxFrame, nodePath, setDragOverrides]);
|
|
238
|
+
const onKeyframedDragEnd = (0, react_1.useCallback)(() => {
|
|
239
|
+
clearDragOverrides(nodePath);
|
|
240
|
+
}, [clearDragOverrides, nodePath]);
|
|
241
|
+
const onOpenKeyframeSettings = (0, react_1.useCallback)(() => {
|
|
242
|
+
var _a;
|
|
243
|
+
if (codeValue === null || !isKeyframedStatus(codeValue)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
setSelectedModal({
|
|
247
|
+
type: 'keyframe-settings',
|
|
248
|
+
fileName: validatedLocation.source,
|
|
249
|
+
nodePath,
|
|
250
|
+
fieldKey: field.key,
|
|
251
|
+
fieldLabel: (_a = field.description) !== null && _a !== void 0 ? _a : field.key,
|
|
252
|
+
status: codeValue,
|
|
253
|
+
schema,
|
|
254
|
+
effectIndex: null,
|
|
255
|
+
});
|
|
256
|
+
}, [
|
|
158
257
|
codeValue,
|
|
258
|
+
field.description,
|
|
259
|
+
field.key,
|
|
260
|
+
nodePath,
|
|
261
|
+
schema,
|
|
262
|
+
setSelectedModal,
|
|
263
|
+
validatedLocation.source,
|
|
159
264
|
]);
|
|
160
265
|
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
161
|
-
|
|
266
|
+
const values = [
|
|
162
267
|
{
|
|
163
268
|
type: 'item',
|
|
164
269
|
id: 'reset-sequence-field',
|
|
165
270
|
keyHint: null,
|
|
166
271
|
label: 'Reset',
|
|
167
272
|
leftItem: null,
|
|
168
|
-
disabled: !
|
|
273
|
+
disabled: !canShowReset,
|
|
169
274
|
onClick: onReset,
|
|
170
275
|
quickSwitcherLabel: null,
|
|
171
276
|
subMenu: null,
|
|
172
277
|
value: 'reset-sequence-field',
|
|
173
278
|
},
|
|
174
279
|
];
|
|
175
|
-
|
|
280
|
+
if (codeValue !== null && isKeyframedStatus(codeValue)) {
|
|
281
|
+
values.push({
|
|
282
|
+
type: 'item',
|
|
283
|
+
id: 'keyframe-settings-sequence-field',
|
|
284
|
+
keyHint: null,
|
|
285
|
+
label: 'Keyframe settings...',
|
|
286
|
+
leftItem: null,
|
|
287
|
+
disabled: previewServerState.type !== 'connected',
|
|
288
|
+
onClick: onOpenKeyframeSettings,
|
|
289
|
+
quickSwitcherLabel: null,
|
|
290
|
+
subMenu: null,
|
|
291
|
+
value: 'keyframe-settings-sequence-field',
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return values;
|
|
295
|
+
}, [
|
|
296
|
+
canShowReset,
|
|
297
|
+
codeValue,
|
|
298
|
+
onOpenKeyframeSettings,
|
|
299
|
+
onReset,
|
|
300
|
+
previewServerState,
|
|
301
|
+
]);
|
|
176
302
|
if (codeValue === null) {
|
|
177
303
|
return null;
|
|
178
304
|
}
|
|
179
305
|
const row = (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), keyframeControls: keyframeControls, arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, selected: selection.selected, selectable: selection.selectable, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection: false, outerHeight: null, children: [
|
|
180
|
-
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), codeValue
|
|
306
|
+
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), isKeyframedStatus(codeValue) ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: codeValue, keyframeDisplayOffset: keyframeDisplayOffset, dragOverrideValue: dragOverrideValue, onSave: onSaveKeyframed, onDragValueChange: onKeyframedDragValueChange, onDragEnd: onKeyframedDragEnd, scaleLockNodePath: nodePath }) })) : codeValue.status === 'static' ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }) }))] }));
|
|
181
307
|
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selection.selectable ? selection.onSelect : null, children: row }));
|
|
182
308
|
};
|
|
183
309
|
exports.TimelineSequencePropItem = TimelineSequencePropItem;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CodeValues, OverrideIdToNodePaths, SequencePropsSubscriptionKey, TSequence } from 'remotion';
|
|
3
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
4
|
+
import { type SaveSequencePropChange } from './save-sequence-prop';
|
|
5
|
+
import { type TimelineSelection } from './TimelineSelection';
|
|
6
|
+
export type TimelineSequenceDurationDragTarget = {
|
|
7
|
+
readonly fileName: string;
|
|
8
|
+
readonly initialDuration: number;
|
|
9
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
10
|
+
};
|
|
11
|
+
export type TimelineSequenceFromDragTarget = {
|
|
12
|
+
readonly fileName: string;
|
|
13
|
+
readonly initialFrom: number;
|
|
14
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
15
|
+
};
|
|
16
|
+
export declare const getTimelineSequenceDurationDragValue: ({ initialDuration, deltaFrames, }: {
|
|
17
|
+
readonly initialDuration: number;
|
|
18
|
+
readonly deltaFrames: number;
|
|
19
|
+
}) => number;
|
|
20
|
+
export declare const getTimelineSequenceDurationDragChanges: ({ targets, deltaFrames, }: {
|
|
21
|
+
readonly targets: readonly TimelineSequenceDurationDragTarget[];
|
|
22
|
+
readonly deltaFrames: number;
|
|
23
|
+
}) => SaveSequencePropChange[];
|
|
24
|
+
export declare const getTimelineSequenceFromDragValue: ({ initialFrom, deltaFrames, }: {
|
|
25
|
+
readonly initialFrom: number;
|
|
26
|
+
readonly deltaFrames: number;
|
|
27
|
+
}) => number;
|
|
28
|
+
export declare const getTimelineSequenceFromDragChanges: ({ targets, deltaFrames, }: {
|
|
29
|
+
readonly targets: readonly TimelineSequenceFromDragTarget[];
|
|
30
|
+
readonly deltaFrames: number;
|
|
31
|
+
}) => SaveSequencePropChange[];
|
|
32
|
+
export declare const getTimelineSequenceDurationDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, codeValues, }: {
|
|
33
|
+
readonly draggedNodePathInfo: SequenceNodePathInfo;
|
|
34
|
+
readonly selectedItems: readonly TimelineSelection[];
|
|
35
|
+
readonly sequences: TSequence[];
|
|
36
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
37
|
+
readonly codeValues: CodeValues;
|
|
38
|
+
}) => TimelineSequenceDurationDragTarget[] | null;
|
|
39
|
+
export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, codeValues, }: {
|
|
40
|
+
readonly draggedNodePathInfo: SequenceNodePathInfo;
|
|
41
|
+
readonly selectedItems: readonly TimelineSelection[];
|
|
42
|
+
readonly sequences: TSequence[];
|
|
43
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
44
|
+
readonly codeValues: CodeValues;
|
|
45
|
+
}) => TimelineSequenceFromDragTarget[] | null;
|
|
46
|
+
export declare const useTimelineSequenceFromDrag: ({ nodePathInfo, windowWidth, timelineDurationInFrames, }: {
|
|
47
|
+
readonly nodePathInfo: SequenceNodePathInfo | null;
|
|
48
|
+
readonly windowWidth: number;
|
|
49
|
+
readonly timelineDurationInFrames: number;
|
|
50
|
+
}) => {
|
|
51
|
+
dragging: boolean;
|
|
52
|
+
onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
|
|
53
|
+
};
|
|
54
|
+
export declare const TimelineSequenceRightEdgeDragHandle: React.FC<{
|
|
55
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
56
|
+
readonly windowWidth: number;
|
|
57
|
+
readonly timelineDurationInFrames: number;
|
|
58
|
+
}>;
|