@remotion/studio 4.0.463 → 4.0.464
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/CanvasOrLoading.js +1 -1
- package/dist/components/ColorPicker/AlphaSlider.d.ts +9 -0
- package/dist/components/ColorPicker/AlphaSlider.js +88 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +18 -0
- package/dist/components/ColorPicker/ColorPicker.js +176 -0
- package/dist/components/ColorPicker/ColorPickerPopup.d.ts +8 -0
- package/dist/components/ColorPicker/ColorPickerPopup.js +276 -0
- package/dist/components/ColorPicker/HueSlider.d.ts +6 -0
- package/dist/components/ColorPicker/HueSlider.js +68 -0
- package/dist/components/ColorPicker/SaturationValueArea.d.ts +14 -0
- package/dist/components/ColorPicker/SaturationValueArea.js +93 -0
- package/dist/components/ColorPicker/checker.d.ts +4 -0
- package/dist/components/ColorPicker/checker.js +9 -0
- package/dist/components/ExpandedTracksProvider.d.ts +2 -0
- package/dist/components/ExpandedTracksProvider.js +18 -1
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -47
- package/dist/components/Timeline/Padder.js +2 -2
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +1 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +9 -4
- package/dist/components/Timeline/Timeline.js +4 -7
- package/dist/components/Timeline/TimelineColorField.js +18 -156
- package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +1 -2
- package/dist/components/Timeline/TimelineEffectFieldRow.js +22 -31
- package/dist/components/Timeline/TimelineEffectGroupRow.d.ts +1 -2
- package/dist/components/Timeline/TimelineEffectGroupRow.js +15 -12
- package/dist/components/Timeline/TimelineExpandedRow.js +15 -30
- package/dist/components/Timeline/TimelineFieldRow.d.ts +1 -2
- package/dist/components/Timeline/TimelineFieldRow.js +19 -16
- package/dist/components/Timeline/TimelineImageInfo.js +5 -17
- package/dist/components/Timeline/TimelineListItem.d.ts +0 -1
- package/dist/components/Timeline/TimelineListItem.js +12 -14
- package/dist/components/Timeline/TimelineRowChrome.d.ts +8 -0
- package/dist/components/Timeline/TimelineRowChrome.js +21 -0
- package/dist/components/Timeline/TimelineTracks.js +0 -4
- package/dist/components/Timeline/save-effect-prop.d.ts +2 -1
- package/dist/components/Timeline/save-effect-prop.js +2 -13
- package/dist/components/Timeline/save-prop-queue.d.ts +1 -2
- package/dist/components/Timeline/save-prop-queue.js +3 -12
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -1
- package/dist/components/Timeline/save-sequence-prop.js +2 -11
- package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -0
- package/dist/components/Timeline/should-show-track-in-timeline.js +23 -0
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +2 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +14 -0
- package/dist/components/Timeline/timeline-indent.d.ts +1 -0
- package/dist/components/Timeline/timeline-indent.js +4 -0
- package/dist/components/Timeline/timeline-row-layout.d.ts +11 -0
- package/dist/components/Timeline/timeline-row-layout.js +27 -0
- package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +2 -0
- package/dist/components/Timeline/use-resolved-stack-react-to-change.js +59 -0
- package/dist/components/Timeline/use-sequence-props-subscription.js +27 -1
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +5 -3
- package/dist/esm/chunk-6jf1natv.js +25 -0
- package/dist/esm/{chunk-b0m62frw.js → chunk-mawnnpzg.js} +4811 -3975
- package/dist/esm/index.mjs +16 -0
- package/dist/esm/internals.mjs +4824 -3973
- package/dist/esm/previewEntry.mjs +4835 -3985
- package/dist/esm/renderEntry.mjs +4 -3
- package/dist/helpers/client-id.d.ts +2 -9
- package/dist/helpers/client-id.js +15 -40
- package/dist/helpers/color-conversion.d.ts +36 -0
- package/dist/helpers/color-conversion.js +121 -0
- package/dist/helpers/inject-css.js +4 -7
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.d.ts +3 -0
- package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +26 -0
- package/dist/helpers/preview-server-events.d.ts +15 -0
- package/dist/helpers/preview-server-events.js +81 -0
- package/dist/helpers/timeline-layout.d.ts +0 -1
- package/dist/helpers/timeline-layout.js +29 -25
- package/dist/hot-middleware-client/client.js +10 -16
- package/package.json +10 -10
- package/dist/components/NewComposition/RemInputTypeColor.d.ts +0 -8
- package/dist/components/NewComposition/RemInputTypeColor.js +0 -53
- package/dist/components/Timeline/is-collapsed.d.ts +0 -2
- package/dist/components/Timeline/is-collapsed.js +0 -10
- package/dist/esm/chunk-5gtx3pza.js +0 -9
- package/dist/helpers/color-math.d.ts +0 -1
- package/dist/helpers/color-math.js +0 -13
|
@@ -5,15 +5,16 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
8
9
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
9
10
|
const call_api_1 = require("../call-api");
|
|
10
|
-
const Padder_1 = require("./Padder");
|
|
11
11
|
const save_prop_queue_1 = require("./save-prop-queue");
|
|
12
|
+
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
13
|
+
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
14
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
15
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
12
16
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
13
17
|
const fieldRowBase = {
|
|
14
|
-
display: 'flex',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
gap: 8,
|
|
17
18
|
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
18
19
|
};
|
|
19
20
|
const fieldName = {
|
|
@@ -21,19 +22,16 @@ const fieldName = {
|
|
|
21
22
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
22
23
|
userSelect: 'none',
|
|
23
24
|
};
|
|
24
|
-
const fieldLabelRow = {
|
|
25
|
-
flex: '0 0 50%',
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'row',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
gap: 6,
|
|
30
|
-
};
|
|
31
25
|
const Value = ({ field, nodePath, validatedLocation }) => {
|
|
32
26
|
var _a;
|
|
33
27
|
var _b;
|
|
34
28
|
const { setEffectDragOverrides, clearEffectDragOverrides, setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
35
29
|
const { getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
36
30
|
const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
31
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
32
|
+
const clientId = previewServerState.type === 'connected'
|
|
33
|
+
? previewServerState.clientId
|
|
34
|
+
: null;
|
|
37
35
|
const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
|
|
38
36
|
codeValues: visualModeCodeValues,
|
|
39
37
|
nodePath,
|
|
@@ -62,6 +60,9 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
62
60
|
if (!propStatus.canUpdate) {
|
|
63
61
|
return Promise.reject(new Error('Cannot save'));
|
|
64
62
|
}
|
|
63
|
+
if (!clientId) {
|
|
64
|
+
return Promise.reject(new Error('Not connected to studio server'));
|
|
65
|
+
}
|
|
65
66
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
66
67
|
? JSON.stringify(field.fieldSchema.default)
|
|
67
68
|
: null;
|
|
@@ -91,25 +92,12 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
91
92
|
value: stringifiedValue,
|
|
92
93
|
defaultValue,
|
|
93
94
|
schema: field.effectSchema,
|
|
95
|
+
clientId,
|
|
94
96
|
}),
|
|
95
|
-
mergeServerResponse: (prev, data) => {
|
|
96
|
-
if (!prev.canUpdate) {
|
|
97
|
-
return prev;
|
|
98
|
-
}
|
|
99
|
-
const idx = prev.effects.findIndex((e) => e.effectIndex === field.effectIndex);
|
|
100
|
-
if (idx === -1) {
|
|
101
|
-
return {
|
|
102
|
-
...prev,
|
|
103
|
-
effects: [...prev.effects, data],
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
const nextEffects = [...prev.effects];
|
|
107
|
-
nextEffects[idx] = data;
|
|
108
|
-
return { ...prev, effects: nextEffects };
|
|
109
|
-
},
|
|
110
97
|
errorLabel: 'Could not save effect prop',
|
|
111
98
|
});
|
|
112
99
|
}, [
|
|
100
|
+
clientId,
|
|
113
101
|
field.effectIndex,
|
|
114
102
|
field.effectSchema,
|
|
115
103
|
field.fieldSchema.default,
|
|
@@ -141,6 +129,9 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
141
129
|
throw new Error(`Unsupported effect status: ${effectStatus.reason}`);
|
|
142
130
|
}
|
|
143
131
|
if (propStatus === null || !propStatus.canUpdate) {
|
|
132
|
+
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.reason) === 'computed') {
|
|
133
|
+
return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "computed" });
|
|
134
|
+
}
|
|
144
135
|
return null;
|
|
145
136
|
}
|
|
146
137
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
@@ -151,17 +142,17 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
151
142
|
});
|
|
152
143
|
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
153
144
|
};
|
|
154
|
-
const TimelineEffectFieldRow = ({ field, validatedLocation,
|
|
145
|
+
const TimelineEffectFieldRow = ({ field, validatedLocation, rowDepth, nodePath }) => {
|
|
155
146
|
var _a;
|
|
156
147
|
const style = (0, react_1.useMemo)(() => {
|
|
157
148
|
return {
|
|
158
149
|
...fieldRowBase,
|
|
159
150
|
height: field.rowHeight,
|
|
160
|
-
paddingLeft,
|
|
161
151
|
};
|
|
162
|
-
}, [field.rowHeight
|
|
163
|
-
|
|
164
|
-
|
|
152
|
+
}, [field.rowHeight]);
|
|
153
|
+
const labelRowStyle = (0, react_1.useMemo)(() => (0, timeline_field_row_layout_1.getTimelineFieldLabelRowStyle)(rowDepth), [rowDepth]);
|
|
154
|
+
return (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, children: [
|
|
155
|
+
jsx_runtime_1.jsx("div", { style: labelRowStyle, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_a = field.description) !== null && _a !== void 0 ? _a : field.key }) }), jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation })
|
|
165
156
|
] }));
|
|
166
157
|
};
|
|
167
158
|
exports.TimelineEffectFieldRow = TimelineEffectFieldRow;
|
|
@@ -10,8 +10,7 @@ export declare const TimelineEffectGroupRow: React.FC<{
|
|
|
10
10
|
readonly effectSchema: SequenceSchema;
|
|
11
11
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
12
12
|
readonly validatedLocation: CodePosition;
|
|
13
|
-
readonly
|
|
14
|
-
readonly style: React.CSSProperties;
|
|
13
|
+
readonly rowDepth: number;
|
|
15
14
|
readonly getIsExpanded: GetIsExpanded;
|
|
16
15
|
readonly toggleTrack: (nodePathInfo: SequenceNodePathInfo) => void;
|
|
17
16
|
}>;
|
|
@@ -4,22 +4,22 @@ exports.TimelineEffectGroupRow = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
7
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
8
|
+
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
8
9
|
const save_effect_prop_1 = require("./save-effect-prop");
|
|
9
10
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
10
11
|
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
11
|
-
const
|
|
12
|
-
display: 'flex',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
};
|
|
12
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
15
13
|
const rowLabel = {
|
|
16
14
|
fontSize: 12,
|
|
17
15
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
18
16
|
userSelect: 'none',
|
|
19
17
|
};
|
|
20
|
-
const TimelineEffectGroupRow = ({ label, nodePathInfo, effectIndex, effectSchema, nodePath, validatedLocation,
|
|
18
|
+
const TimelineEffectGroupRow = ({ label, nodePathInfo, effectIndex, effectSchema, nodePath, validatedLocation, rowDepth, getIsExpanded, toggleTrack, }) => {
|
|
21
19
|
var _a;
|
|
22
20
|
var _b;
|
|
21
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
22
|
+
const previewConnected = previewServerState.type === 'connected';
|
|
23
23
|
const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
24
24
|
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
25
25
|
const effectStatus = (0, react_1.useMemo)(() => remotion_1.Internals.getEffectCodeValuesCtx({
|
|
@@ -36,9 +36,9 @@ const TimelineEffectGroupRow = ({ label, nodePathInfo, effectIndex, effectSchema
|
|
|
36
36
|
}
|
|
37
37
|
return false;
|
|
38
38
|
}, [disabledStatus]);
|
|
39
|
-
const canToggle = disabledStatus !== null && disabledStatus.canUpdate;
|
|
39
|
+
const canToggle = previewConnected && disabledStatus !== null && disabledStatus.canUpdate;
|
|
40
40
|
const onToggle = (0, react_1.useCallback)((type) => {
|
|
41
|
-
if (!canToggle) {
|
|
41
|
+
if (!canToggle || previewServerState.type !== 'connected') {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
const newValue = type !== 'enable';
|
|
@@ -55,19 +55,22 @@ const TimelineEffectGroupRow = ({ label, nodePathInfo, effectIndex, effectSchema
|
|
|
55
55
|
defaultValue,
|
|
56
56
|
schema: effectSchema,
|
|
57
57
|
setCodeValues,
|
|
58
|
+
clientId: previewServerState.clientId,
|
|
58
59
|
});
|
|
59
60
|
}, [
|
|
60
61
|
canToggle,
|
|
61
62
|
effectIndex,
|
|
62
63
|
effectSchema,
|
|
63
64
|
nodePath,
|
|
65
|
+
previewServerState,
|
|
64
66
|
setCodeValues,
|
|
65
67
|
validatedLocation.source,
|
|
66
68
|
]);
|
|
67
69
|
const isExpanded = getIsExpanded(nodePathInfo);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const rowStyle = (0, react_1.useMemo)(() => ({
|
|
71
|
+
height: timeline_layout_1.TREE_GROUP_ROW_HEIGHT,
|
|
72
|
+
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
73
|
+
}), []);
|
|
74
|
+
return (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: canToggle ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: "effect", hidden: isDisabled, onInvoked: onToggle })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(nodePathInfo), label: `${label} section`, disabled: false }), style: rowStyle, children: jsx_runtime_1.jsx("span", { style: rowLabel, children: label }) }));
|
|
72
75
|
};
|
|
73
76
|
exports.TimelineEffectGroupRow = TimelineEffectGroupRow;
|
|
@@ -2,58 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineExpandedRow = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
5
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
7
|
-
const
|
|
6
|
+
const timeline_row_layout_1 = require("./timeline-row-layout");
|
|
8
7
|
const TimelineEffectFieldRow_1 = require("./TimelineEffectFieldRow");
|
|
9
8
|
const TimelineEffectGroupRow_1 = require("./TimelineEffectGroupRow");
|
|
10
9
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
11
10
|
const TimelineFieldRow_1 = require("./TimelineFieldRow");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
height: timeline_layout_1.TREE_GROUP_ROW_HEIGHT,
|
|
15
|
-
display: 'flex',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
18
|
-
};
|
|
11
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
12
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
19
13
|
const rowLabel = {
|
|
20
14
|
fontSize: 12,
|
|
21
15
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
22
16
|
userSelect: 'none',
|
|
23
17
|
};
|
|
24
|
-
const labelOnlyRowBase = {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
28
|
-
};
|
|
29
18
|
const TimelineExpandedRow = ({ node, depth, nestedDepth, getIsExpanded, toggleTrack, validatedLocation, nodePath, schema, }) => {
|
|
30
|
-
const
|
|
31
|
-
const groupStyle = (0, react_1.useMemo)(() => ({ ...groupRowBase, paddingLeft }), [paddingLeft]);
|
|
32
|
-
const labelOnlyStyle = (0, react_1.useMemo)(() => ({
|
|
33
|
-
...labelOnlyRowBase,
|
|
34
|
-
height: (0, timeline_layout_1.getTreeRowHeight)(node),
|
|
35
|
-
paddingLeft,
|
|
36
|
-
}), [node, paddingLeft]);
|
|
19
|
+
const rowDepth = (0, timeline_row_layout_1.getExpandedRowDepth)({ nestedDepth, treeDepth: depth });
|
|
37
20
|
if (node.kind === 'group') {
|
|
38
21
|
if (node.effectInfo) {
|
|
39
|
-
return (jsx_runtime_1.jsx(TimelineEffectGroupRow_1.TimelineEffectGroupRow, { label: node.label, nodePathInfo: node.nodePathInfo, effectIndex: node.effectInfo.effectIndex, effectSchema: node.effectInfo.effectSchema, nodePath: nodePath, validatedLocation: validatedLocation,
|
|
22
|
+
return (jsx_runtime_1.jsx(TimelineEffectGroupRow_1.TimelineEffectGroupRow, { label: node.label, nodePathInfo: node.nodePathInfo, effectIndex: node.effectInfo.effectIndex, effectSchema: node.effectInfo.effectSchema, nodePath: nodePath, validatedLocation: validatedLocation, rowDepth: rowDepth, getIsExpanded: getIsExpanded, toggleTrack: toggleTrack }));
|
|
40
23
|
}
|
|
41
24
|
const isExpanded = getIsExpanded(node.nodePathInfo);
|
|
42
|
-
return (jsx_runtime_1.
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
return (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(node.nodePathInfo), label: `${node.label} section`, disabled: false }), style: {
|
|
26
|
+
height: timeline_layout_1.TREE_GROUP_ROW_HEIGHT,
|
|
27
|
+
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
28
|
+
}, children: jsx_runtime_1.jsx("span", { style: rowLabel, children: node.label }) }));
|
|
45
29
|
}
|
|
46
30
|
if (node.field) {
|
|
47
31
|
if (node.field.kind === 'effect-field') {
|
|
48
|
-
return (jsx_runtime_1.jsx(TimelineEffectFieldRow_1.TimelineEffectFieldRow, { field: node.field, validatedLocation: validatedLocation,
|
|
32
|
+
return (jsx_runtime_1.jsx(TimelineEffectFieldRow_1.TimelineEffectFieldRow, { field: node.field, validatedLocation: validatedLocation, rowDepth: rowDepth, nodePath: nodePath }));
|
|
49
33
|
}
|
|
50
34
|
if (node.field.kind === 'sequence-field') {
|
|
51
|
-
return (jsx_runtime_1.jsx(TimelineFieldRow_1.TimelineFieldRow, { field: node.field, validatedLocation: validatedLocation,
|
|
35
|
+
return (jsx_runtime_1.jsx(TimelineFieldRow_1.TimelineFieldRow, { field: node.field, validatedLocation: validatedLocation, rowDepth: rowDepth, nodePath: nodePath, schema: schema }));
|
|
52
36
|
}
|
|
53
37
|
throw new Error('Unexpected field kind: ' + JSON.stringify(node.field));
|
|
54
38
|
}
|
|
55
|
-
return (jsx_runtime_1.
|
|
56
|
-
|
|
57
|
-
|
|
39
|
+
return (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: {
|
|
40
|
+
height: (0, timeline_layout_1.getTreeRowHeight)(node),
|
|
41
|
+
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
42
|
+
}, children: jsx_runtime_1.jsx("span", { style: rowLabel, children: node.label }) }));
|
|
58
43
|
};
|
|
59
44
|
exports.TimelineExpandedRow = TimelineExpandedRow;
|
|
@@ -6,8 +6,7 @@ import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
|
6
6
|
export declare const TimelineFieldRow: React.FC<{
|
|
7
7
|
readonly field: SchemaFieldInfo;
|
|
8
8
|
readonly validatedLocation: CodePosition;
|
|
9
|
-
readonly
|
|
10
|
-
readonly nestedDepth: number;
|
|
9
|
+
readonly rowDepth: number;
|
|
11
10
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
12
11
|
readonly schema: SequenceSchema;
|
|
13
12
|
}>;
|
|
@@ -4,14 +4,15 @@ exports.TimelineFieldRow = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
7
8
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
8
|
-
const Padder_1 = require("./Padder");
|
|
9
9
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
10
|
+
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
11
|
+
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
12
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
13
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
10
14
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
11
15
|
const fieldRowBase = {
|
|
12
|
-
display: 'flex',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
gap: 8,
|
|
15
16
|
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
16
17
|
};
|
|
17
18
|
const fieldName = {
|
|
@@ -19,13 +20,6 @@ const fieldName = {
|
|
|
19
20
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
20
21
|
userSelect: 'none',
|
|
21
22
|
};
|
|
22
|
-
const fieldLabelRow = {
|
|
23
|
-
flex: '0 0 50%',
|
|
24
|
-
display: 'flex',
|
|
25
|
-
flexDirection: 'row',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
gap: 6,
|
|
28
|
-
};
|
|
29
23
|
const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
30
24
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
31
25
|
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
@@ -42,10 +36,17 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
42
36
|
shouldResortToDefaultValueIfUndefined: true,
|
|
43
37
|
});
|
|
44
38
|
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
39
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
40
|
+
const clientId = previewServerState.type === 'connected'
|
|
41
|
+
? previewServerState.clientId
|
|
42
|
+
: null;
|
|
45
43
|
const onSave = (0, react_1.useCallback)((value) => {
|
|
46
44
|
if (!codeValue || !codeValue.canUpdate) {
|
|
47
45
|
return Promise.reject(new Error('Cannot save'));
|
|
48
46
|
}
|
|
47
|
+
if (!clientId) {
|
|
48
|
+
return Promise.reject(new Error('Not connected to studio server'));
|
|
49
|
+
}
|
|
49
50
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
50
51
|
? JSON.stringify(field.fieldSchema.default)
|
|
51
52
|
: null;
|
|
@@ -65,9 +66,11 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
65
66
|
defaultValue,
|
|
66
67
|
schema,
|
|
67
68
|
setCodeValues,
|
|
69
|
+
clientId,
|
|
68
70
|
});
|
|
69
71
|
}, [
|
|
70
72
|
codeValue,
|
|
73
|
+
clientId,
|
|
71
74
|
field.fieldSchema.default,
|
|
72
75
|
field.key,
|
|
73
76
|
nodePath,
|
|
@@ -89,7 +92,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
89
92
|
}, [clearDragOverrides, nodePath]);
|
|
90
93
|
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
91
94
|
};
|
|
92
|
-
const TimelineFieldRow = ({ field, validatedLocation,
|
|
95
|
+
const TimelineFieldRow = ({ field, validatedLocation, rowDepth, nodePath, schema }) => {
|
|
93
96
|
var _a, _b;
|
|
94
97
|
const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
95
98
|
const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
|
|
@@ -98,13 +101,13 @@ const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth,
|
|
|
98
101
|
return {
|
|
99
102
|
...fieldRowBase,
|
|
100
103
|
height: field.rowHeight,
|
|
101
|
-
paddingLeft,
|
|
102
104
|
};
|
|
103
|
-
}, [field.rowHeight
|
|
105
|
+
}, [field.rowHeight]);
|
|
106
|
+
const labelRowStyle = (0, react_1.useMemo)(() => (0, timeline_field_row_layout_1.getTimelineFieldLabelRowStyle)(rowDepth), [rowDepth]);
|
|
104
107
|
if (codeValue === null) {
|
|
105
108
|
return null;
|
|
106
109
|
}
|
|
107
|
-
return (jsx_runtime_1.jsxs(
|
|
108
|
-
jsx_runtime_1.jsx(
|
|
110
|
+
return (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, children: [
|
|
111
|
+
jsx_runtime_1.jsx("div", { style: labelRowStyle, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }) }), codeValue.canUpdate ? (jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue })) : (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }))] }));
|
|
109
112
|
};
|
|
110
113
|
exports.TimelineFieldRow = TimelineFieldRow;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineImageInfo = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const timeline_utils_1 = require("@remotion/timeline-utils");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
7
8
|
const HEIGHT = (0, timeline_layout_1.getTimelineLayerHeight)('image') - 2;
|
|
@@ -33,23 +34,10 @@ const TimelineImageInfo = ({ src, visualizationWidth }) => {
|
|
|
33
34
|
const img = new Image();
|
|
34
35
|
img.crossOrigin = 'anonymous';
|
|
35
36
|
img.onload = () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
offscreen.width = scaledWidth;
|
|
41
|
-
offscreen.height = scaledHeight;
|
|
42
|
-
const offCtx = offscreen.getContext('2d');
|
|
43
|
-
if (!offCtx) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
offCtx.drawImage(img, 0, 0, scaledWidth, scaledHeight);
|
|
47
|
-
const pattern = ctx.createPattern(offscreen, 'repeat-x');
|
|
48
|
-
if (!pattern) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
ctx.fillStyle = pattern;
|
|
52
|
-
ctx.fillRect(0, 0, visualizationWidth * window.devicePixelRatio, HEIGHT * window.devicePixelRatio);
|
|
37
|
+
(0, timeline_utils_1.drawRepeatingImageThumbnail)({
|
|
38
|
+
canvas,
|
|
39
|
+
image: img,
|
|
40
|
+
});
|
|
53
41
|
};
|
|
54
42
|
img.src = src;
|
|
55
43
|
return () => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TSequence } from 'remotion';
|
|
3
3
|
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
4
|
-
export declare const INDENT = 10;
|
|
5
4
|
export declare const TimelineListItem: React.FC<{
|
|
6
5
|
readonly sequence: TSequence;
|
|
7
6
|
readonly nestedDepth: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimelineListItem =
|
|
3
|
+
exports.TimelineListItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
@@ -11,17 +11,16 @@ const call_api_1 = require("../call-api");
|
|
|
11
11
|
const ContextMenu_1 = require("../ContextMenu");
|
|
12
12
|
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
13
13
|
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
14
|
-
const Padder_1 = require("./Padder");
|
|
15
14
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
16
15
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
17
16
|
const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
|
|
18
17
|
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
18
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
19
19
|
const TimelineStack_1 = require("./TimelineStack");
|
|
20
|
-
const
|
|
21
|
-
exports.INDENT = 10;
|
|
20
|
+
const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
|
|
22
21
|
const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) => {
|
|
23
22
|
var _a;
|
|
24
|
-
var _b
|
|
23
|
+
var _b;
|
|
25
24
|
const nodePath = (_b = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _b !== void 0 ? _b : null;
|
|
26
25
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
27
26
|
const previewConnected = previewServerState.type === 'connected';
|
|
@@ -29,7 +28,7 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
29
28
|
const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
30
29
|
const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
31
30
|
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
32
|
-
const originalLocation = (0,
|
|
31
|
+
const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(sequence.getStack);
|
|
33
32
|
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
34
33
|
var _a;
|
|
35
34
|
if (!originalLocation ||
|
|
@@ -179,7 +178,8 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
179
178
|
!validatedLocation ||
|
|
180
179
|
!codeValuesForOverride ||
|
|
181
180
|
!codeHiddenStatus ||
|
|
182
|
-
!codeHiddenStatus.canUpdate
|
|
181
|
+
!codeHiddenStatus.canUpdate ||
|
|
182
|
+
previewServerState.type !== 'connected') {
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
const newValue = type !== 'enable';
|
|
@@ -196,11 +196,13 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
196
196
|
defaultValue,
|
|
197
197
|
schema,
|
|
198
198
|
setCodeValues,
|
|
199
|
+
clientId: previewServerState.clientId,
|
|
199
200
|
});
|
|
200
201
|
}, [
|
|
201
202
|
codeHiddenStatus,
|
|
202
203
|
codeValuesForOverride,
|
|
203
204
|
nodePath,
|
|
205
|
+
previewServerState,
|
|
204
206
|
sequence.controls,
|
|
205
207
|
setCodeValues,
|
|
206
208
|
validatedLocation,
|
|
@@ -217,23 +219,19 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
217
219
|
height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO,
|
|
218
220
|
color: 'white',
|
|
219
221
|
fontFamily: 'Arial, Helvetica, sans-serif',
|
|
220
|
-
display: 'flex',
|
|
221
|
-
flexDirection: 'row',
|
|
222
|
-
alignItems: 'center',
|
|
223
222
|
wordBreak: 'break-all',
|
|
224
223
|
textAlign: 'left',
|
|
225
|
-
paddingLeft: 5,
|
|
226
224
|
};
|
|
227
225
|
}, []);
|
|
228
226
|
const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
|
|
229
|
-
const canToggleVisibility =
|
|
227
|
+
const canToggleVisibility = previewConnected &&
|
|
228
|
+
Boolean(sequence.controls) &&
|
|
230
229
|
nodePath !== null &&
|
|
231
230
|
validatedLocation !== null &&
|
|
232
231
|
codeHiddenStatus !== undefined &&
|
|
233
232
|
codeHiddenStatus !== null &&
|
|
234
233
|
codeHiddenStatus.canUpdate;
|
|
235
|
-
const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.
|
|
236
|
-
] }) }));
|
|
234
|
+
const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: !previewConnected || nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: inner, children: jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation }) }) }));
|
|
237
235
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), previewConnected &&
|
|
238
236
|
isExpanded &&
|
|
239
237
|
hasExpandableContent &&
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineRowChrome = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const Padder_1 = require("./Padder");
|
|
7
|
+
const timeline_row_layout_1 = require("./timeline-row-layout");
|
|
8
|
+
const rowBase = {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
};
|
|
12
|
+
const TimelineRowChrome = ({ depth, eye, arrow, children, style }) => {
|
|
13
|
+
const rowStyle = (0, react_1.useMemo)(() => ({
|
|
14
|
+
...rowBase,
|
|
15
|
+
paddingLeft: timeline_row_layout_1.TIMELINE_ROW_BASE_PADDING,
|
|
16
|
+
...style,
|
|
17
|
+
}), [style]);
|
|
18
|
+
const indentWidth = (0, timeline_row_layout_1.getTimelineRowIndentWidth)(depth);
|
|
19
|
+
return (jsx_runtime_1.jsxs("div", { style: rowStyle, children: [eye, indentWidth > 0 ? jsx_runtime_1.jsx(Padder_1.Padder, { depth: depth }) : null, arrow, children] }));
|
|
20
|
+
};
|
|
21
|
+
exports.TimelineRowChrome = TimelineRowChrome;
|
|
@@ -40,7 +40,6 @@ const remotion_1 = require("remotion");
|
|
|
40
40
|
const client_id_1 = require("../../helpers/client-id");
|
|
41
41
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
42
42
|
const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
43
|
-
const is_collapsed_1 = require("./is-collapsed");
|
|
44
43
|
const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
|
|
45
44
|
const TimelineSequence_1 = require("./TimelineSequence");
|
|
46
45
|
const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
|
|
@@ -74,9 +73,6 @@ const TimelineTracksInner = ({ timeline, hasBeenCut }) => {
|
|
|
74
73
|
return (jsx_runtime_1.jsxs("div", { style: timelineStyle, children: [
|
|
75
74
|
jsx_runtime_1.jsxs("div", { style: content, children: [
|
|
76
75
|
jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => {
|
|
77
|
-
if ((0, is_collapsed_1.isTrackHidden)(track)) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
76
|
const isExpanded = track.nodePathInfo !== null && getIsExpanded(track.nodePathInfo);
|
|
81
77
|
return (jsx_runtime_1.jsxs("div", { children: [
|
|
82
78
|
jsx_runtime_1.jsx("div", { style: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
|
|
2
2
|
import type { SetCodeValues } from './save-sequence-prop';
|
|
3
|
-
export declare const saveEffectProp: ({ fileName, nodePath, effectIndex, fieldKey, value, defaultValue, schema, setCodeValues, }: {
|
|
3
|
+
export declare const saveEffectProp: ({ fileName, nodePath, effectIndex, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }: {
|
|
4
4
|
fileName: string;
|
|
5
5
|
nodePath: SequencePropsSubscriptionKey;
|
|
6
6
|
effectIndex: number;
|
|
@@ -9,4 +9,5 @@ export declare const saveEffectProp: ({ fileName, nodePath, effectIndex, fieldKe
|
|
|
9
9
|
defaultValue: string | null;
|
|
10
10
|
schema: SequenceSchema;
|
|
11
11
|
setCodeValues: SetCodeValues;
|
|
12
|
+
clientId: string;
|
|
12
13
|
}) => Promise<void>;
|
|
@@ -4,7 +4,7 @@ exports.saveEffectProp = void 0;
|
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const call_api_1 = require("../call-api");
|
|
6
6
|
const save_prop_queue_1 = require("./save-prop-queue");
|
|
7
|
-
const saveEffectProp = ({ fileName, nodePath, effectIndex, fieldKey, value, defaultValue, schema, setCodeValues, }) => {
|
|
7
|
+
const saveEffectProp = ({ fileName, nodePath, effectIndex, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }) => {
|
|
8
8
|
return (0, save_prop_queue_1.enqueueSavePropChange)({
|
|
9
9
|
nodePath,
|
|
10
10
|
setCodeValues,
|
|
@@ -23,19 +23,8 @@ const saveEffectProp = ({ fileName, nodePath, effectIndex, fieldKey, value, defa
|
|
|
23
23
|
value: JSON.stringify(value),
|
|
24
24
|
defaultValue,
|
|
25
25
|
schema,
|
|
26
|
+
clientId,
|
|
26
27
|
}),
|
|
27
|
-
mergeServerResponse: (prev, data) => {
|
|
28
|
-
if (!prev.canUpdate) {
|
|
29
|
-
return prev;
|
|
30
|
-
}
|
|
31
|
-
const idx = prev.effects.findIndex((e) => e.effectIndex === effectIndex);
|
|
32
|
-
if (idx === -1) {
|
|
33
|
-
return { ...prev, effects: [...prev.effects, data] };
|
|
34
|
-
}
|
|
35
|
-
const nextEffects = [...prev.effects];
|
|
36
|
-
nextEffects[idx] = data;
|
|
37
|
-
return { ...prev, effects: nextEffects };
|
|
38
|
-
},
|
|
39
28
|
errorLabel: 'Could not save effect prop',
|
|
40
29
|
});
|
|
41
30
|
};
|
|
@@ -5,8 +5,7 @@ export type EnqueueSaveOptions<TResponse> = {
|
|
|
5
5
|
setCodeValues: SetCodeValues;
|
|
6
6
|
applyOptimistic: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse;
|
|
7
7
|
apiCall: () => Promise<TResponse>;
|
|
8
|
-
mergeServerResponse: (prev: CanUpdateSequencePropsResponse, response: TResponse) => CanUpdateSequencePropsResponse;
|
|
9
8
|
errorLabel: string;
|
|
10
9
|
};
|
|
11
|
-
export declare const enqueueSavePropChange: <TResponse>({ nodePath, setCodeValues, applyOptimistic, apiCall,
|
|
10
|
+
export declare const enqueueSavePropChange: <TResponse>({ nodePath, setCodeValues, applyOptimistic, apiCall, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
|
|
12
11
|
export {};
|