@remotion/studio 4.0.459 → 4.0.461
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/Studio.d.ts +0 -1
- package/dist/Studio.js +4 -4
- package/dist/components/AudioWaveform.js +21 -13
- package/dist/components/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox.js +38 -24
- package/dist/components/Editor.js +10 -9
- package/dist/components/ExpandedTracksProvider.d.ts +9 -4
- package/dist/components/ExpandedTracksProvider.js +45 -15
- package/dist/components/MenuBuildIndicator.js +1 -2
- package/dist/components/MenuCompositionName.js +1 -0
- package/dist/components/NewComposition/ComboBox.d.ts +1 -0
- package/dist/components/NewComposition/ComboBox.js +14 -5
- package/dist/components/RenderButton.js +1 -1
- package/dist/components/SequencePropsSubscriptionProvider.d.ts +3 -0
- package/dist/components/SequencePropsSubscriptionProvider.js +26 -0
- package/dist/components/Timeline/SequencePropsObserver.d.ts +1 -0
- package/dist/components/Timeline/SequencePropsObserver.js +24 -0
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +7 -0
- package/dist/components/Timeline/SubscribeToNodePaths.js +15 -0
- package/dist/components/Timeline/Timeline.js +30 -49
- package/dist/components/Timeline/TimelineBooleanField.d.ts +4 -4
- package/dist/components/Timeline/TimelineBooleanField.js +5 -5
- package/dist/components/Timeline/TimelineDragHandler.js +37 -3
- package/dist/components/Timeline/TimelineEnumField.d.ts +5 -5
- package/dist/components/Timeline/TimelineEnumField.js +23 -15
- package/dist/components/Timeline/TimelineExpandArrowButton.d.ts +1 -0
- package/dist/components/Timeline/TimelineExpandArrowButton.js +5 -3
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +6 -6
- package/dist/components/Timeline/TimelineExpandedRow.js +4 -5
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +2 -2
- package/dist/components/Timeline/TimelineExpandedSection.js +20 -9
- package/dist/components/Timeline/TimelineFieldRow.d.ts +2 -3
- package/dist/components/Timeline/TimelineFieldRow.js +66 -30
- package/dist/components/Timeline/TimelineHeightContainer.d.ts +7 -0
- package/dist/components/Timeline/TimelineHeightContainer.js +51 -0
- package/dist/components/Timeline/TimelineList.js +1 -1
- package/dist/components/Timeline/TimelineListItem.d.ts +2 -0
- package/dist/components/Timeline/TimelineListItem.js +33 -18
- package/dist/components/Timeline/TimelineNumberField.d.ts +5 -5
- package/dist/components/Timeline/TimelineNumberField.js +12 -10
- package/dist/components/Timeline/TimelineRotationField.d.ts +5 -5
- package/dist/components/Timeline/TimelineRotationField.js +10 -10
- package/dist/components/Timeline/TimelineSchemaField.d.ts +4 -6
- package/dist/components/Timeline/TimelineSchemaField.js +11 -11
- package/dist/components/Timeline/TimelineSequence.js +2 -2
- package/dist/components/Timeline/TimelineSlider.js +2 -2
- package/dist/components/Timeline/TimelineStack/get-stack.js +17 -31
- package/dist/components/Timeline/TimelineStack/index.js +0 -10
- package/dist/components/Timeline/TimelineTimeIndicators.js +2 -2
- package/dist/components/Timeline/TimelineTracks.d.ts +1 -1
- package/dist/components/Timeline/TimelineTracks.js +53 -12
- package/dist/components/Timeline/TimelineTranslateField.d.ts +5 -5
- package/dist/components/Timeline/TimelineTranslateField.js +19 -37
- package/dist/components/Timeline/TimelineVideoInfo.js +25 -140
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +10 -13
- package/dist/components/Timeline/sequence-props-subscription-store.js +56 -123
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +6 -6
- package/dist/components/Timeline/use-sequence-props-subscription.js +25 -55
- package/dist/components/Timeline/use-timeline-height.d.ts +5 -0
- package/dist/components/Timeline/use-timeline-height.js +39 -0
- package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +3 -3
- package/dist/error-overlay/react-overlay/utils/get-source-map.js +5 -5
- package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -6
- package/dist/error-overlay/react-overlay/utils/unmapper.js +8 -1
- package/dist/esm/{chunk-0njpenna.js → chunk-yzh34sp0.js} +3026 -3446
- package/dist/esm/internals.mjs +3026 -3446
- package/dist/esm/previewEntry.mjs +3028 -3449
- package/dist/esm/renderEntry.mjs +2 -5
- package/dist/helpers/calculate-timeline.d.ts +3 -2
- package/dist/helpers/calculate-timeline.js +43 -2
- package/dist/helpers/get-timeline-sequence-layout.js +3 -3
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +7 -1
- package/dist/helpers/timeline-layout.d.ts +19 -9
- package/dist/helpers/timeline-layout.js +50 -20
- package/dist/icons/Checkmark.d.ts +4 -1
- package/dist/icons/Checkmark.js +1 -5
- package/dist/icons/caret.d.ts +3 -1
- package/dist/icons/caret.js +5 -2
- package/dist/internals.d.ts +0 -1
- package/dist/previewEntry.js +1 -1
- package/dist/renderEntry.js +3 -3
- package/package.json +13 -21
- package/dist/audio-waveform-worker.d.ts +0 -1
- package/dist/audio-waveform-worker.js +0 -102
- package/dist/components/audio-waveform-worker-types.d.ts +0 -28
- package/dist/components/audio-waveform-worker-types.js +0 -2
- package/dist/components/draw-peaks.d.ts +0 -1
- package/dist/components/draw-peaks.js +0 -68
- package/dist/components/load-waveform-peaks.d.ts +0 -13
- package/dist/components/load-waveform-peaks.js +0 -76
- package/dist/components/looped-media-timeline.d.ts +0 -6
- package/dist/components/looped-media-timeline.js +0 -14
- package/dist/components/parse-color.d.ts +0 -1
- package/dist/components/parse-color.js +0 -17
- package/dist/components/slice-waveform-peaks.d.ts +0 -7
- package/dist/components/slice-waveform-peaks.js +0 -15
- package/dist/components/waveform-peak-processor.d.ts +0 -23
- package/dist/components/waveform-peak-processor.js +0 -77
- package/dist/esm/audio-waveform-worker.mjs +0 -354
- package/dist/helpers/extract-frames.d.ts +0 -18
- package/dist/helpers/extract-frames.js +0 -87
- package/dist/helpers/frame-database.d.ts +0 -16
- package/dist/helpers/frame-database.js +0 -65
- package/dist/helpers/resize-video-frame.d.ts +0 -4
- package/dist/helpers/resize-video-frame.js +0 -39
- package/dist/make-audio-waveform-worker.d.ts +0 -1
- package/dist/make-audio-waveform-worker.js +0 -10
|
@@ -40,16 +40,17 @@ const remotion_1 = require("remotion");
|
|
|
40
40
|
const calculate_timeline_1 = require("../../helpers/calculate-timeline");
|
|
41
41
|
const client_id_1 = require("../../helpers/client-id");
|
|
42
42
|
const colors_1 = require("../../helpers/colors");
|
|
43
|
-
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
44
|
-
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
45
43
|
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
46
44
|
const SplitterContainer_1 = require("../Splitter/SplitterContainer");
|
|
47
45
|
const SplitterElement_1 = require("../Splitter/SplitterElement");
|
|
48
46
|
const SplitterHandle_1 = require("../Splitter/SplitterHandle");
|
|
49
47
|
const is_collapsed_1 = require("./is-collapsed");
|
|
50
48
|
const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
|
|
49
|
+
const SequencePropsObserver_1 = require("./SequencePropsObserver");
|
|
50
|
+
const SubscribeToNodePaths_1 = require("./SubscribeToNodePaths");
|
|
51
51
|
const timeline_refs_1 = require("./timeline-refs");
|
|
52
52
|
const TimelineDragHandler_1 = require("./TimelineDragHandler");
|
|
53
|
+
const TimelineHeightContainer_1 = require("./TimelineHeightContainer");
|
|
53
54
|
const TimelineInOutPointer_1 = require("./TimelineInOutPointer");
|
|
54
55
|
const TimelineList_1 = require("./TimelineList");
|
|
55
56
|
const TimelinePinchZoom_1 = require("./TimelinePinchZoom");
|
|
@@ -71,12 +72,10 @@ const noop = () => undefined;
|
|
|
71
72
|
const TimelineInner = () => {
|
|
72
73
|
var _a;
|
|
73
74
|
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
74
|
-
const { expandedTracks } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksContext);
|
|
75
|
-
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
76
|
-
const { dragOverrides, codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeOverridesContext);
|
|
77
|
-
const visualModeEnabled = Boolean(process.env.EXPERIMENTAL_VISUAL_MODE_ENABLED) &&
|
|
78
|
-
previewServerState.type === 'connected';
|
|
79
75
|
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
76
|
+
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
77
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
78
|
+
const previewConnected = previewServerState.type === 'connected';
|
|
80
79
|
const videoConfigIsNull = videoConfig === null;
|
|
81
80
|
const timeline = (0, react_1.useMemo)(() => {
|
|
82
81
|
if (videoConfigIsNull) {
|
|
@@ -84,52 +83,34 @@ const TimelineInner = () => {
|
|
|
84
83
|
}
|
|
85
84
|
return (0, calculate_timeline_1.calculateTimeline)({
|
|
86
85
|
sequences,
|
|
86
|
+
overrideIdsToNodePaths: overrideIdToNodePathMappings,
|
|
87
87
|
});
|
|
88
|
-
}, [sequences, videoConfigIsNull]);
|
|
88
|
+
}, [sequences, videoConfigIsNull, overrideIdToNodePathMappings]);
|
|
89
89
|
const durationInFrames = (_a = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _a !== void 0 ? _a : 0;
|
|
90
90
|
const filtered = (0, react_1.useMemo)(() => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return withoutAfter.filter((t) => t.sequence.showInTimeline);
|
|
91
|
+
return timeline.filter((t) => !(0, is_collapsed_1.isTrackHidden)(t) &&
|
|
92
|
+
t.sequence.from <= durationInFrames &&
|
|
93
|
+
t.sequence.duration > 0 &&
|
|
94
|
+
t.sequence.showInTimeline);
|
|
96
95
|
}, [durationInFrames, timeline]);
|
|
97
|
-
const shown =
|
|
96
|
+
const shown = (0, react_1.useMemo)(() => {
|
|
97
|
+
return filtered.length > MaxTimelineTracks_1.MAX_TIMELINE_TRACKS
|
|
98
|
+
? filtered.slice(0, MaxTimelineTracks_1.MAX_TIMELINE_TRACKS)
|
|
99
|
+
: filtered;
|
|
100
|
+
}, [filtered]);
|
|
98
101
|
const hasBeenCut = filtered.length > shown.length;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
|
|
113
|
-
TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT,
|
|
114
|
-
display: 'flex',
|
|
115
|
-
flex: 1,
|
|
116
|
-
minHeight: '100%',
|
|
117
|
-
overflowX: 'hidden',
|
|
118
|
-
};
|
|
119
|
-
}, [
|
|
120
|
-
hasBeenCut,
|
|
121
|
-
shown,
|
|
122
|
-
expandedTracks,
|
|
123
|
-
visualModeEnabled,
|
|
124
|
-
codeValues,
|
|
125
|
-
dragOverrides,
|
|
126
|
-
]);
|
|
127
|
-
return (jsx_runtime_1.jsx("div", { ref: timeline_refs_1.timelineVerticalScroll, style: container, className: 'css-reset ' + is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
|
|
128
|
-
jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsx("div", { style: inner, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [
|
|
129
|
-
jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "flexer", sticky: jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePlaceholders, {}), children: jsx_runtime_1.jsx(TimelineList_1.TimelineList, { timeline: shown }) }), jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { onCollapse: noop, allowToCollapse: "none" }), jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "anti-flexer", sticky: null, children: jsx_runtime_1.jsxs(TimelineScrollable_1.TimelineScrollable, { children: [
|
|
130
|
-
jsx_runtime_1.jsx(TimelineTracks_1.TimelineTracks, { timeline: shown, hasBeenCut: hasBeenCut }), jsx_runtime_1.jsx(TimelineInOutPointer_1.TimelineInOutPointer, {}), jsx_runtime_1.jsx(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {}), jsx_runtime_1.jsx(TimelineDragHandler_1.TimelineDragHandler, {}), jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimeIndicators, {}), jsx_runtime_1.jsx(TimelineSlider_1.TimelineSlider, {})
|
|
131
|
-
] }) })
|
|
132
|
-
] }) })
|
|
133
|
-
] }) }));
|
|
102
|
+
return (jsx_runtime_1.jsxs("div", { ref: timeline_refs_1.timelineVerticalScroll, style: container, className: 'css-reset ' + is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: [sequences.map((sequence) => {
|
|
103
|
+
if (!sequence.controls || !previewConnected || !sequence.stack) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, schema: sequence.controls.schema, stack: sequence.stack }, sequence.id));
|
|
107
|
+
}), jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}), jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
|
|
108
|
+
jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsx(TimelineHeightContainer_1.TimelineHeightContainer, { shown: shown, hasBeenCut: hasBeenCut, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [
|
|
109
|
+
jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "flexer", sticky: jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePlaceholders, {}), children: jsx_runtime_1.jsx(TimelineList_1.TimelineList, { timeline: shown }) }), jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { onCollapse: noop, allowToCollapse: "none" }), jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "anti-flexer", sticky: null, children: jsx_runtime_1.jsxs(TimelineScrollable_1.TimelineScrollable, { children: [
|
|
110
|
+
jsx_runtime_1.jsx(TimelineTracks_1.TimelineTracks, { timeline: shown, hasBeenCut: hasBeenCut }), jsx_runtime_1.jsx(TimelineInOutPointer_1.TimelineInOutPointer, {}), jsx_runtime_1.jsx(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {}), jsx_runtime_1.jsx(TimelineDragHandler_1.TimelineDragHandler, {}), jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimeIndicators, {}), jsx_runtime_1.jsx(TimelineSlider_1.TimelineSlider, {})
|
|
111
|
+
] }) })
|
|
112
|
+
] }) })
|
|
113
|
+
] })
|
|
114
|
+
] }));
|
|
134
115
|
};
|
|
135
116
|
exports.Timeline = react_1.default.memo(TimelineInner);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
3
4
|
export declare const TimelineBooleanField: React.FC<{
|
|
4
5
|
readonly field: SchemaFieldInfo;
|
|
5
|
-
readonly
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatus;
|
|
6
7
|
readonly effectiveValue: unknown;
|
|
7
|
-
readonly
|
|
8
|
-
readonly onSave: (key: string, value: unknown) => Promise<void>;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
9
|
}>;
|
|
@@ -7,14 +7,14 @@ const Checkbox_1 = require("../Checkbox");
|
|
|
7
7
|
const checkboxContainer = {
|
|
8
8
|
marginLeft: 8,
|
|
9
9
|
};
|
|
10
|
-
const TimelineBooleanField = ({ field,
|
|
10
|
+
const TimelineBooleanField = ({ field, propStatus, effectiveValue, onSave }) => {
|
|
11
11
|
const checked = Boolean(effectiveValue);
|
|
12
12
|
const onChange = (0, react_1.useCallback)(() => {
|
|
13
13
|
const newValue = !checked;
|
|
14
|
-
if (canUpdate && newValue !== codeValue) {
|
|
15
|
-
onSave(
|
|
14
|
+
if (propStatus.canUpdate && newValue !== propStatus.codeValue) {
|
|
15
|
+
onSave(newValue);
|
|
16
16
|
}
|
|
17
|
-
}, [
|
|
18
|
-
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled: !canUpdate }) }));
|
|
17
|
+
}, [propStatus, onSave, checked]);
|
|
18
|
+
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled: !propStatus.canUpdate, variant: "small" }) }));
|
|
19
19
|
};
|
|
20
20
|
exports.TimelineBooleanField = TimelineBooleanField;
|
|
@@ -1,9 +1,42 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.TimelineDragHandler = void 0;
|
|
4
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
38
|
const player_1 = require("@remotion/player");
|
|
6
|
-
const react_1 = require("react");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
7
40
|
const remotion_1 = require("remotion");
|
|
8
41
|
const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
|
|
9
42
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
@@ -59,10 +92,10 @@ const TimelineDragHandler = () => {
|
|
|
59
92
|
if (!canvasContent || canvasContent.type !== 'composition') {
|
|
60
93
|
return null;
|
|
61
94
|
}
|
|
62
|
-
return (jsx_runtime_1.jsx("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, children: video ? jsx_runtime_1.jsx(
|
|
95
|
+
return (jsx_runtime_1.jsx("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, children: video ? jsx_runtime_1.jsx(TimelineDragHandlerInnerMemo, {}) : null }));
|
|
63
96
|
};
|
|
64
97
|
exports.TimelineDragHandler = TimelineDragHandler;
|
|
65
|
-
const
|
|
98
|
+
const TimelineDragHandlerInner = () => {
|
|
66
99
|
var _a;
|
|
67
100
|
var _b, _c;
|
|
68
101
|
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
@@ -470,3 +503,4 @@ const Inner = () => {
|
|
|
470
503
|
return (jsx_runtime_1.jsxs("div", { style: style, onPointerDown: onPointerDown, children: [
|
|
471
504
|
jsx_runtime_1.jsx("div", { style: inner, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME }), inFrame !== null && (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: inContextMenu, children: jsx_runtime_1.jsx(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "in", atFrame: inFrame, dragging: inOutDragging.dragging === 'in' }) })), outFrame !== null && (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: outContextMenu, children: jsx_runtime_1.jsx(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "out", dragging: inOutDragging.dragging === 'out', atFrame: outFrame }) }))] }));
|
|
472
505
|
};
|
|
506
|
+
const TimelineDragHandlerInnerMemo = react_1.default.memo(TimelineDragHandlerInner);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
3
4
|
export declare const TimelineEnumField: React.FC<{
|
|
4
5
|
readonly field: SchemaFieldInfo;
|
|
5
|
-
readonly
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatus;
|
|
6
7
|
readonly effectiveValue: unknown;
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly onDragValueChange: (key: string, value: unknown) => void;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
10
10
|
readonly onDragEnd: () => void;
|
|
11
11
|
}>;
|
|
@@ -3,32 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelineEnumField = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
7
|
+
const comboboxStyle = {
|
|
7
8
|
marginLeft: 8,
|
|
8
|
-
background: 'transparent',
|
|
9
|
-
color: 'white',
|
|
10
|
-
border: '1px solid rgba(255, 255, 255, 0.2)',
|
|
11
|
-
borderRadius: 3,
|
|
12
|
-
fontSize: 12,
|
|
13
|
-
padding: '1px 4px',
|
|
14
9
|
};
|
|
15
|
-
const TimelineEnumField = ({ field,
|
|
10
|
+
const TimelineEnumField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
|
|
16
11
|
const { fieldSchema } = field;
|
|
17
12
|
if (fieldSchema.type !== 'enum') {
|
|
18
13
|
throw new Error('TimelineEnumField rendered for non-enum field');
|
|
19
14
|
}
|
|
20
15
|
const variantKeys = Object.keys(fieldSchema.variants);
|
|
21
16
|
const current = String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : fieldSchema.default);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (!canUpdate || newValue === codeValue) {
|
|
17
|
+
const onSelect = (0, react_1.useCallback)((newValue) => {
|
|
18
|
+
if (!propStatus.canUpdate || newValue === propStatus.codeValue) {
|
|
25
19
|
return;
|
|
26
20
|
}
|
|
27
|
-
onDragValueChange(
|
|
28
|
-
onSave(
|
|
21
|
+
onDragValueChange(newValue);
|
|
22
|
+
onSave(newValue).finally(() => {
|
|
29
23
|
onDragEnd();
|
|
30
24
|
});
|
|
31
|
-
}, [
|
|
32
|
-
|
|
25
|
+
}, [propStatus, onSave, onDragValueChange, onDragEnd]);
|
|
26
|
+
const items = (0, react_1.useMemo)(() => {
|
|
27
|
+
return variantKeys.map((key) => ({
|
|
28
|
+
type: 'item',
|
|
29
|
+
id: key,
|
|
30
|
+
value: key,
|
|
31
|
+
label: key,
|
|
32
|
+
onClick: () => onSelect(key),
|
|
33
|
+
keyHint: null,
|
|
34
|
+
leftItem: null,
|
|
35
|
+
subMenu: null,
|
|
36
|
+
quickSwitcherLabel: null,
|
|
37
|
+
disabled: !propStatus.canUpdate,
|
|
38
|
+
}));
|
|
39
|
+
}, [variantKeys, onSelect, propStatus]);
|
|
40
|
+
return (jsx_runtime_1.jsx(ComboBox_1.Combobox, { small: true, title: field.key, selectedId: current, values: items, style: comboboxStyle }));
|
|
33
41
|
};
|
|
34
42
|
exports.TimelineEnumField = TimelineEnumField;
|
|
@@ -22,14 +22,16 @@ const arrowButton = {
|
|
|
22
22
|
lineHeight: 1,
|
|
23
23
|
};
|
|
24
24
|
const svgStyle = { display: 'block' };
|
|
25
|
-
const TimelineExpandArrowButton = ({ isExpanded, onClick, label }) => {
|
|
25
|
+
const TimelineExpandArrowButton = ({ isExpanded, onClick, label, disabled = false }) => {
|
|
26
26
|
const style = (0, react_1.useMemo)(() => {
|
|
27
27
|
return {
|
|
28
28
|
...arrowButton,
|
|
29
29
|
transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
30
|
+
cursor: disabled ? 'default' : 'pointer',
|
|
31
|
+
opacity: disabled ? 0.5 : 1,
|
|
30
32
|
};
|
|
31
|
-
}, [isExpanded]);
|
|
32
|
-
return (jsx_runtime_1.jsx("button", { type: "button", style: style, onClick: onClick, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} ${label}`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "
|
|
33
|
+
}, [isExpanded, disabled]);
|
|
34
|
+
return (jsx_runtime_1.jsx("button", { type: "button", style: style, onClick: onClick, disabled: disabled, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} ${label}`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "#ccc" }) }) }));
|
|
33
35
|
};
|
|
34
36
|
exports.TimelineExpandArrowButton = TimelineExpandArrowButton;
|
|
35
37
|
const TimelineExpandArrowSpacer = () => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { SequenceNodePath } from '@remotion/studio-shared';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import type { SequenceSchema } from 'remotion';
|
|
2
|
+
import type { SequenceSchema, SequenceNodePath } from 'remotion';
|
|
4
3
|
import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
|
|
4
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
5
5
|
import type { TimelineTreeNode } from '../../helpers/timeline-layout';
|
|
6
|
+
import type { GetIsExpanded } from '../ExpandedTracksProvider';
|
|
6
7
|
export declare const TimelineExpandedRow: React.FC<{
|
|
7
8
|
readonly node: TimelineTreeNode;
|
|
8
9
|
readonly depth: number;
|
|
9
10
|
readonly nestedDepth: number;
|
|
10
|
-
readonly
|
|
11
|
-
readonly toggleTrack: (
|
|
12
|
-
readonly overrideId: string;
|
|
11
|
+
readonly getIsExpanded: GetIsExpanded;
|
|
12
|
+
readonly toggleTrack: (nodePathInfo: SequenceNodePathInfo) => void;
|
|
13
13
|
readonly validatedLocation: CodePosition | null;
|
|
14
|
-
readonly nodePath: SequenceNodePath
|
|
14
|
+
readonly nodePath: SequenceNodePath;
|
|
15
15
|
readonly schema: SequenceSchema;
|
|
16
16
|
}>;
|
|
@@ -24,8 +24,7 @@ const labelOnlyRowBase = {
|
|
|
24
24
|
alignItems: 'center',
|
|
25
25
|
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
26
26
|
};
|
|
27
|
-
const TimelineExpandedRow = ({ node, depth, nestedDepth,
|
|
28
|
-
var _a;
|
|
27
|
+
const TimelineExpandedRow = ({ node, depth, nestedDepth, getIsExpanded, toggleTrack, validatedLocation, nodePath, schema, }) => {
|
|
29
28
|
const paddingLeft = timeline_layout_1.EXPANDED_SECTION_PADDING_LEFT + depth * TimelineListItem_1.INDENT;
|
|
30
29
|
const groupStyle = (0, react_1.useMemo)(() => ({ ...groupRowBase, paddingLeft }), [paddingLeft]);
|
|
31
30
|
const labelOnlyStyle = (0, react_1.useMemo)(() => ({
|
|
@@ -34,13 +33,13 @@ const TimelineExpandedRow = ({ node, depth, nestedDepth, expandedTracks, toggleT
|
|
|
34
33
|
paddingLeft,
|
|
35
34
|
}), [node, paddingLeft]);
|
|
36
35
|
if (node.kind === 'group') {
|
|
37
|
-
const isExpanded = (
|
|
36
|
+
const isExpanded = getIsExpanded(node.nodePathInfo);
|
|
38
37
|
return (jsx_runtime_1.jsxs("div", { style: groupStyle, children: [
|
|
39
|
-
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(node.
|
|
38
|
+
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(node.nodePathInfo), label: `${node.label} section`, disabled: false }), jsx_runtime_1.jsx("span", { style: rowLabel, children: node.label })
|
|
40
39
|
] }));
|
|
41
40
|
}
|
|
42
41
|
if (node.field) {
|
|
43
|
-
return (jsx_runtime_1.jsx(TimelineFieldRow_1.TimelineFieldRow, { field: node.field,
|
|
42
|
+
return (jsx_runtime_1.jsx(TimelineFieldRow_1.TimelineFieldRow, { field: node.field, validatedLocation: validatedLocation, paddingLeft: paddingLeft, nestedDepth: nestedDepth, nodePath: nodePath, schema: schema }));
|
|
44
43
|
}
|
|
45
44
|
return (jsx_runtime_1.jsxs("div", { style: labelOnlyStyle, children: [
|
|
46
45
|
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx("span", { style: rowLabel, children: node.label })
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { SequenceNodePath } from '@remotion/studio-shared';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { type TSequence } from 'remotion';
|
|
4
3
|
import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
|
|
4
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
5
5
|
export declare const TimelineExpandedSection: React.FC<{
|
|
6
6
|
readonly sequence: TSequence;
|
|
7
7
|
readonly originalLocation: OriginalPosition | null;
|
|
8
|
-
readonly
|
|
8
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
9
9
|
readonly nestedDepth: number;
|
|
10
10
|
}>;
|
|
@@ -53,10 +53,11 @@ const separator = {
|
|
|
53
53
|
height: 1,
|
|
54
54
|
backgroundColor: colors_1.TIMELINE_TRACK_SEPARATOR,
|
|
55
55
|
};
|
|
56
|
-
const TimelineExpandedSection = ({ sequence, originalLocation,
|
|
57
|
-
const {
|
|
58
|
-
const {
|
|
59
|
-
const {
|
|
56
|
+
const TimelineExpandedSection = ({ sequence, originalLocation, nodePathInfo, nestedDepth }) => {
|
|
57
|
+
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
58
|
+
const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
59
|
+
const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
60
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
60
61
|
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
61
62
|
var _a;
|
|
62
63
|
if (!originalLocation ||
|
|
@@ -70,9 +71,19 @@ const TimelineExpandedSection = ({ sequence, originalLocation, nodePath, nestedD
|
|
|
70
71
|
column: (_a = originalLocation.column) !== null && _a !== void 0 ? _a : 0,
|
|
71
72
|
};
|
|
72
73
|
}, [originalLocation]);
|
|
73
|
-
const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
|
|
75
|
+
sequence,
|
|
76
|
+
nodePathInfo,
|
|
77
|
+
getDragOverrides,
|
|
78
|
+
getCodeValues,
|
|
79
|
+
}), [sequence, nodePathInfo, getDragOverrides, getCodeValues]);
|
|
80
|
+
const flat = (0, react_1.useMemo)(() => (0, timeline_layout_1.flattenVisibleTreeNodes)({ nodes: tree, getIsExpanded }), [tree, getIsExpanded]);
|
|
81
|
+
const expandedHeight = (0, react_1.useMemo)(() => (0, timeline_layout_1.getExpandedTrackHeight)({
|
|
82
|
+
sequence,
|
|
83
|
+
nodePathInfo,
|
|
84
|
+
getIsExpanded,
|
|
85
|
+
getCodeValues,
|
|
86
|
+
}), [sequence, nodePathInfo, getIsExpanded, getCodeValues]);
|
|
76
87
|
const style = (0, react_1.useMemo)(() => {
|
|
77
88
|
return {
|
|
78
89
|
...expandedSectionBase,
|
|
@@ -84,8 +95,8 @@ const TimelineExpandedSection = ({ sequence, originalLocation, nodePath, nestedD
|
|
|
84
95
|
return jsx_runtime_1.jsx("div", { style: style, children: "No schema" });
|
|
85
96
|
}
|
|
86
97
|
return (jsx_runtime_1.jsx("div", { style: style, children: flat.map(({ node, depth }, i) => {
|
|
87
|
-
return (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [i > 0 ? jsx_runtime_1.jsx("div", { style: separator }) : null, jsx_runtime_1.jsx(TimelineExpandedRow_1.TimelineExpandedRow, { node: node, depth: depth, nestedDepth: nestedDepth,
|
|
88
|
-
] }, node.
|
|
98
|
+
return (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [i > 0 ? jsx_runtime_1.jsx("div", { style: separator }) : null, jsx_runtime_1.jsx(TimelineExpandedRow_1.TimelineExpandedRow, { node: node, depth: depth, nestedDepth: nestedDepth, getIsExpanded: getIsExpanded, toggleTrack: toggleTrack, validatedLocation: validatedLocation, nodePath: nodePathInfo.nodePath, schema: schema })
|
|
99
|
+
] }, JSON.stringify(node.nodePathInfo)));
|
|
89
100
|
}) }));
|
|
90
101
|
};
|
|
91
102
|
exports.TimelineExpandedSection = TimelineExpandedSection;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { SequenceNodePath } from '@remotion/studio-shared';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import type { SequenceNodePath } from 'remotion';
|
|
3
3
|
import type { SequenceSchema } from 'remotion';
|
|
4
4
|
import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
|
|
5
5
|
import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
6
6
|
export declare const TimelineFieldRow: React.FC<{
|
|
7
7
|
readonly field: SchemaFieldInfo;
|
|
8
|
-
readonly overrideId: string;
|
|
9
8
|
readonly validatedLocation: CodePosition | null;
|
|
10
9
|
readonly paddingLeft: number;
|
|
11
10
|
readonly nestedDepth: number;
|
|
12
|
-
readonly nodePath: SequenceNodePath
|
|
11
|
+
readonly nodePath: SequenceNodePath;
|
|
13
12
|
readonly schema: SequenceSchema;
|
|
14
13
|
}>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineFieldRow = 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 timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
@@ -26,15 +27,22 @@ const fieldLabelRow = {
|
|
|
26
27
|
alignItems: 'center',
|
|
27
28
|
gap: 6,
|
|
28
29
|
};
|
|
29
|
-
const TimelineFieldRow = ({ field,
|
|
30
|
-
var _a, _b
|
|
31
|
-
const {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
30
|
+
const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth, nodePath, schema, }) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
33
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
34
|
+
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
35
|
+
const codeValuesForOverride = getCodeValues(nodePath);
|
|
36
|
+
const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
37
|
+
if (codeValue === null) {
|
|
38
|
+
throw new Error('Unexpectedly got null code value for field' + field.key);
|
|
39
|
+
}
|
|
34
40
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
35
41
|
var _a;
|
|
36
|
-
return
|
|
37
|
-
|
|
42
|
+
return nodePath === null
|
|
43
|
+
? undefined
|
|
44
|
+
: ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
45
|
+
}, [getDragOverrides, nodePath, field.key]);
|
|
38
46
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
39
47
|
codeValue,
|
|
40
48
|
runtimeValue: field.currentRuntimeValue,
|
|
@@ -42,52 +50,80 @@ const TimelineFieldRow = ({ field, overrideId, validatedLocation, paddingLeft, n
|
|
|
42
50
|
defaultValue: field.fieldSchema.default,
|
|
43
51
|
shouldResortToDefaultValueIfUndefined: true,
|
|
44
52
|
});
|
|
45
|
-
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.
|
|
46
|
-
const onSave = (0, react_1.useCallback)((
|
|
53
|
+
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
54
|
+
const onSave = (0, react_1.useCallback)((value) => {
|
|
47
55
|
if (!codeValuesForOverride || !validatedLocation || !nodePath) {
|
|
48
56
|
return Promise.reject(new Error('Cannot save'));
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
if (!status || !status.canUpdate) {
|
|
58
|
+
if (!codeValue || !codeValue.canUpdate) {
|
|
52
59
|
return Promise.reject(new Error('Cannot save'));
|
|
53
60
|
}
|
|
54
61
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
55
62
|
? JSON.stringify(field.fieldSchema.default)
|
|
56
63
|
: null;
|
|
64
|
+
const stringifiedValue = JSON.stringify(value);
|
|
65
|
+
if (value === codeValue.codeValue) {
|
|
66
|
+
return Promise.resolve();
|
|
67
|
+
}
|
|
68
|
+
if (defaultValue === stringifiedValue &&
|
|
69
|
+
codeValue.codeValue === undefined) {
|
|
70
|
+
return Promise.resolve();
|
|
71
|
+
}
|
|
72
|
+
let previousUpdate;
|
|
73
|
+
// Optimistic update to prevent flicker
|
|
74
|
+
setCodeValues(nodePath, (prev) => {
|
|
75
|
+
previousUpdate = prev;
|
|
76
|
+
return (0, studio_shared_1.optimisticUpdateForCodeValues)({
|
|
77
|
+
previous: prev,
|
|
78
|
+
fieldKey: field.key,
|
|
79
|
+
value,
|
|
80
|
+
schema,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
57
83
|
return (0, call_api_1.callApi)('/api/save-sequence-props', {
|
|
58
84
|
fileName: validatedLocation.source,
|
|
59
85
|
nodePath,
|
|
60
|
-
key,
|
|
61
|
-
value:
|
|
86
|
+
key: field.key,
|
|
87
|
+
value: stringifiedValue,
|
|
62
88
|
defaultValue,
|
|
63
89
|
schema,
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
90
|
+
})
|
|
91
|
+
.then((data) => {
|
|
92
|
+
setCodeValues(nodePath, () => data);
|
|
93
|
+
})
|
|
94
|
+
.catch(() => {
|
|
95
|
+
// In case something went wrong, undo optimistic update
|
|
96
|
+
if (previousUpdate) {
|
|
97
|
+
setCodeValues(nodePath, (current) => {
|
|
98
|
+
if (previousUpdate) {
|
|
99
|
+
return previousUpdate;
|
|
100
|
+
}
|
|
101
|
+
return current;
|
|
102
|
+
});
|
|
73
103
|
}
|
|
74
|
-
return Promise.reject(new Error(data.reason));
|
|
75
104
|
});
|
|
76
105
|
}, [
|
|
106
|
+
codeValue,
|
|
77
107
|
codeValuesForOverride,
|
|
78
108
|
field.fieldSchema.default,
|
|
109
|
+
field.key,
|
|
79
110
|
nodePath,
|
|
80
|
-
overrideId,
|
|
81
111
|
schema,
|
|
82
112
|
setCodeValues,
|
|
83
113
|
validatedLocation,
|
|
84
114
|
]);
|
|
85
|
-
const onDragValueChange = (0, react_1.useCallback)((
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
const onDragValueChange = (0, react_1.useCallback)((value) => {
|
|
116
|
+
if (nodePath === null) {
|
|
117
|
+
throw new Error('Cannot drag value');
|
|
118
|
+
}
|
|
119
|
+
setDragOverrides(nodePath, field.key, value);
|
|
120
|
+
}, [setDragOverrides, nodePath, field.key]);
|
|
88
121
|
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
89
|
-
|
|
90
|
-
|
|
122
|
+
if (nodePath === null) {
|
|
123
|
+
throw new Error('Cannot clear drag value');
|
|
124
|
+
}
|
|
125
|
+
clearDragOverrides(nodePath);
|
|
126
|
+
}, [clearDragOverrides, nodePath]);
|
|
91
127
|
const style = (0, react_1.useMemo)(() => {
|
|
92
128
|
return {
|
|
93
129
|
...fieldRowBase,
|
|
@@ -96,7 +132,7 @@ const TimelineFieldRow = ({ field, overrideId, validatedLocation, paddingLeft, n
|
|
|
96
132
|
};
|
|
97
133
|
}, [field.rowHeight, paddingLeft]);
|
|
98
134
|
return (jsx_runtime_1.jsxs("div", { style: style, children: [
|
|
99
|
-
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx("div", { style: fieldLabelRow, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (
|
|
135
|
+
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx("div", { style: fieldLabelRow, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }) }), jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue })
|
|
100
136
|
] }));
|
|
101
137
|
};
|
|
102
138
|
exports.TimelineFieldRow = TimelineFieldRow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TrackWithHash } from '../../helpers/get-timeline-sequence-sort-key';
|
|
3
|
+
export declare const TimelineHeightContainer: React.NamedExoticComponent<{
|
|
4
|
+
readonly shown: TrackWithHash[];
|
|
5
|
+
readonly hasBeenCut: boolean;
|
|
6
|
+
readonly children: React.ReactNode;
|
|
7
|
+
}>;
|