@remotion/studio 4.0.462 → 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/AssetSelector.js +2 -6
- 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/CompSelectorRef.js +2 -6
- package/dist/components/ExpandedTracksProvider.d.ts +2 -0
- package/dist/components/ExpandedTracksProvider.js +23 -21
- 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 +3 -3
- 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 +38 -57
- package/dist/components/Timeline/TimelineEffectGroupRow.d.ts +16 -0
- package/dist/components/Timeline/TimelineEffectGroupRow.js +76 -0
- package/dist/components/Timeline/TimelineExpandedRow.js +18 -29
- package/dist/components/Timeline/TimelineFieldRow.d.ts +1 -2
- package/dist/components/Timeline/TimelineFieldRow.js +24 -55
- package/dist/components/Timeline/TimelineImageInfo.js +5 -17
- package/dist/components/Timeline/TimelineLayerEye.d.ts +5 -3
- package/dist/components/Timeline/TimelineLayerEye.js +18 -1
- package/dist/components/Timeline/TimelineListItem.d.ts +0 -1
- package/dist/components/Timeline/TimelineListItem.js +64 -23
- 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 +13 -0
- package/dist/components/Timeline/save-effect-prop.js +31 -0
- package/dist/components/Timeline/save-prop-queue.d.ts +11 -0
- package/dist/components/Timeline/save-prop-queue.js +54 -0
- package/dist/components/Timeline/save-sequence-prop.d.ts +12 -0
- package/dist/components/Timeline/save-sequence-prop.js +29 -0
- 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-yvg1f56k.js → chunk-mawnnpzg.js} +5147 -4012
- package/dist/esm/internals.mjs +5147 -4012
- package/dist/esm/previewEntry.mjs +5159 -4025
- package/dist/esm/renderEntry.mjs +1 -1
- 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/persist-boolean-map.d.ts +5 -0
- package/dist/helpers/persist-boolean-map.js +56 -0
- package/dist/helpers/persist-open-folders.d.ts +4 -3
- package/dist/helpers/persist-open-folders.js +4 -7
- 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 +6 -2
- package/dist/helpers/timeline-layout.js +31 -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/helpers/color-math.d.ts +0 -1
- package/dist/helpers/color-math.js +0 -13
|
@@ -3,179 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelineColorField = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
const colors_1 = require("../../helpers/colors");
|
|
8
|
-
const eyedropper_1 = require("../../icons/eyedropper");
|
|
9
|
-
const z_index_1 = require("../../state/z-index");
|
|
10
|
-
const SWATCH_WIDTH = 20;
|
|
11
|
-
const SWATCH_HEIGHT = 15;
|
|
6
|
+
const ColorPicker_1 = require("../ColorPicker/ColorPicker");
|
|
12
7
|
const containerStyle = {
|
|
13
8
|
display: 'flex',
|
|
14
9
|
alignItems: 'center',
|
|
15
10
|
gap: 3,
|
|
16
11
|
};
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
width: SWATCH_WIDTH,
|
|
20
|
-
height: SWATCH_HEIGHT,
|
|
21
|
-
display: 'inline-block',
|
|
22
|
-
borderRadius: 3,
|
|
23
|
-
overflow: 'hidden',
|
|
24
|
-
cursor: 'pointer',
|
|
25
|
-
borderStyle: 'solid',
|
|
26
|
-
borderWidth: 1,
|
|
27
|
-
};
|
|
28
|
-
const hiddenInputStyle = {
|
|
29
|
-
position: 'absolute',
|
|
30
|
-
inset: 0,
|
|
31
|
-
width: '100%',
|
|
32
|
-
height: '100%',
|
|
33
|
-
opacity: 0,
|
|
34
|
-
cursor: 'pointer',
|
|
35
|
-
border: 'none',
|
|
36
|
-
padding: 0,
|
|
37
|
-
margin: 0,
|
|
38
|
-
};
|
|
39
|
-
const swatchFillStyle = {
|
|
40
|
-
width: '100%',
|
|
41
|
-
height: '100%',
|
|
42
|
-
};
|
|
43
|
-
const eyedropperButtonBase = {
|
|
44
|
-
background: 'transparent',
|
|
45
|
-
border: 'none',
|
|
46
|
-
padding: 0,
|
|
47
|
-
margin: 0,
|
|
48
|
-
cursor: 'pointer',
|
|
49
|
-
display: 'inline-flex',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
justifyContent: 'center',
|
|
52
|
-
width: 20,
|
|
53
|
-
height: 20,
|
|
54
|
-
color: 'rgba(255, 255, 255, 0.7)',
|
|
55
|
-
};
|
|
56
|
-
const eyedropperIconStyle = {
|
|
57
|
-
width: 16,
|
|
58
|
-
height: 16,
|
|
59
|
-
};
|
|
60
|
-
// Normalizes any color string the user provided (e.g. `red`, `rgb(...)`, `#fff`)
|
|
61
|
-
// into a `#rrggbb` string that `<input type="color">` accepts.
|
|
62
|
-
const toHex = (value) => {
|
|
63
|
-
try {
|
|
64
|
-
const argb = no_react_1.NoReactInternals.processColor(value);
|
|
65
|
-
const r = (argb >>> 16) & 0xff;
|
|
66
|
-
const g = (argb >>> 8) & 0xff;
|
|
67
|
-
const b = argb & 0xff;
|
|
68
|
-
return `#${r.toString(16).padStart(2, '0')}${g
|
|
69
|
-
.toString(16)
|
|
70
|
-
.padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
71
|
-
}
|
|
72
|
-
catch (_a) {
|
|
73
|
-
return '#000000';
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const hasEyeDropper = () => typeof window !== 'undefined' && 'EyeDropper' in window;
|
|
12
|
+
const SWATCH_WIDTH = 20;
|
|
13
|
+
const SWATCH_HEIGHT = 15;
|
|
77
14
|
const TimelineColorField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
|
|
78
|
-
|
|
79
|
-
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
80
|
-
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
81
|
-
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
82
|
-
const commitTimeoutRef = (0, react_1.useRef)(null);
|
|
83
|
-
const pendingCommitRef = (0, react_1.useRef)(null);
|
|
84
|
-
// `<input type="color">` doesn't fire an event when dismissed; debounce
|
|
85
|
-
// commits and flush any pending commit on unmount so we never lose the
|
|
86
|
-
// final value.
|
|
87
|
-
(0, react_1.useEffect)(() => {
|
|
88
|
-
return () => {
|
|
89
|
-
if (commitTimeoutRef.current) {
|
|
90
|
-
clearTimeout(commitTimeoutRef.current);
|
|
91
|
-
}
|
|
92
|
-
if (pendingCommitRef.current) {
|
|
93
|
-
pendingCommitRef.current();
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}, []);
|
|
15
|
+
var _a;
|
|
97
16
|
const currentValue = typeof effectiveValue === 'string'
|
|
98
17
|
? effectiveValue
|
|
99
18
|
: field.fieldSchema.type === 'color'
|
|
100
|
-
? field.fieldSchema.default
|
|
19
|
+
? ((_a = field.fieldSchema.default) !== null && _a !== void 0 ? _a : '#000')
|
|
101
20
|
: '';
|
|
102
|
-
const
|
|
103
|
-
const onColorChange = (0, react_1.useCallback)((e) => {
|
|
104
|
-
const newValue = e.target.value;
|
|
21
|
+
const onChange = (0, react_1.useCallback)((next) => {
|
|
105
22
|
if (!propStatus.canUpdate) {
|
|
106
23
|
return;
|
|
107
24
|
}
|
|
108
|
-
onDragValueChange(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const commit = () => {
|
|
113
|
-
pendingCommitRef.current = null;
|
|
114
|
-
if (propStatus.canUpdate && newValue !== propStatus.codeValue) {
|
|
115
|
-
onSave(newValue);
|
|
116
|
-
}
|
|
117
|
-
onDragEnd();
|
|
118
|
-
};
|
|
119
|
-
pendingCommitRef.current = commit;
|
|
120
|
-
commitTimeoutRef.current = setTimeout(() => {
|
|
121
|
-
commitTimeoutRef.current = null;
|
|
122
|
-
commit();
|
|
123
|
-
}, 500);
|
|
124
|
-
}, [onSave, onDragValueChange, onDragEnd, propStatus]);
|
|
125
|
-
const onPickColor = (0, react_1.useCallback)(() => {
|
|
126
|
-
// `EyeDropper` is a Chromium-only API; it's feature-detected at render
|
|
127
|
-
// time so this only runs in supported browsers.
|
|
128
|
-
const EyeDropperCtor = typeof window !== 'undefined'
|
|
129
|
-
? window.EyeDropper
|
|
130
|
-
: undefined;
|
|
131
|
-
if (!EyeDropperCtor) {
|
|
25
|
+
onDragValueChange(next);
|
|
26
|
+
}, [onDragValueChange, propStatus.canUpdate]);
|
|
27
|
+
const onChangeComplete = (0, react_1.useCallback)((next) => {
|
|
28
|
+
if (!propStatus.canUpdate) {
|
|
132
29
|
return;
|
|
133
30
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
.catch(() => {
|
|
143
|
-
// User aborted or picker failed; safe to ignore.
|
|
144
|
-
});
|
|
145
|
-
}, [onSave, propStatus]);
|
|
146
|
-
const swatchWrapperStyle = (0, react_1.useMemo)(() => {
|
|
31
|
+
if (next !== propStatus.codeValue) {
|
|
32
|
+
onSave(next);
|
|
33
|
+
}
|
|
34
|
+
onDragEnd();
|
|
35
|
+
}, [onSave, onDragEnd, propStatus]);
|
|
36
|
+
const swatchStyle = (0, react_1.useMemo)(() => {
|
|
147
37
|
return {
|
|
148
|
-
...swatchWrapperBase,
|
|
149
|
-
borderColor: isHovered || isFocused
|
|
150
|
-
? colors_1.INPUT_BORDER_COLOR_HOVERED
|
|
151
|
-
: colors_1.INPUT_BORDER_COLOR_UNHOVERED,
|
|
152
|
-
cursor: propStatus.canUpdate ? 'pointer' : 'not-allowed',
|
|
153
38
|
marginLeft: 5,
|
|
154
39
|
};
|
|
155
|
-
}, [
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
...swatchFillStyle,
|
|
159
|
-
backgroundColor: currentValue || hexValue,
|
|
160
|
-
position: 'absolute',
|
|
161
|
-
display: 'block',
|
|
162
|
-
};
|
|
163
|
-
}, [currentValue, hexValue]);
|
|
164
|
-
const onMouseEnter = (0, react_1.useCallback)(() => setIsHovered(true), []);
|
|
165
|
-
const onMouseLeave = (0, react_1.useCallback)(() => setIsHovered(false), []);
|
|
166
|
-
const onFocus = (0, react_1.useCallback)(() => setIsFocused(true), []);
|
|
167
|
-
const onBlur = (0, react_1.useCallback)(() => setIsFocused(false), []);
|
|
168
|
-
const onSwatchClick = (0, react_1.useCallback)(() => {
|
|
169
|
-
var _a;
|
|
170
|
-
if (!propStatus.canUpdate) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
174
|
-
}, [propStatus.canUpdate]);
|
|
175
|
-
const showEyeDropper = hasEyeDropper();
|
|
176
|
-
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
177
|
-
jsx_runtime_1.jsxs("span", { style: swatchWrapperStyle, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onSwatchClick, title: currentValue, children: [
|
|
178
|
-
jsx_runtime_1.jsx("span", { style: swatchFill }), jsx_runtime_1.jsx("input", { ref: inputRef, type: "color", value: hexValue, onChange: onColorChange, onFocus: onFocus, onBlur: onBlur, disabled: !propStatus.canUpdate, name: field.key, tabIndex: tabIndex, style: hiddenInputStyle })
|
|
179
|
-
] }), showEyeDropper ? (jsx_runtime_1.jsx("button", { type: "button", onClick: onPickColor, disabled: !propStatus.canUpdate, style: eyedropperButtonBase, tabIndex: tabIndex, title: "Pick color from screen", "aria-label": "Pick color from screen", children: jsx_runtime_1.jsx(eyedropper_1.EyedropperIcon, { style: eyedropperIconStyle }) })) : null] }));
|
|
40
|
+
}, []);
|
|
41
|
+
return (jsx_runtime_1.jsx("span", { style: containerStyle, children: jsx_runtime_1.jsx(ColorPicker_1.ColorPicker, { value: currentValue, status: "ok", onChange: onChange, onChangeComplete: onChangeComplete, width: SWATCH_WIDTH, height: SWATCH_HEIGHT, disabled: !propStatus.canUpdate, name: field.key, title: currentValue, style: swatchStyle }) }));
|
|
180
42
|
};
|
|
181
43
|
exports.TimelineColorField = TimelineColorField;
|
|
@@ -5,7 +5,6 @@ import type { EffectSchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
|
5
5
|
export declare const TimelineEffectFieldRow: React.FC<{
|
|
6
6
|
readonly field: EffectSchemaFieldInfo;
|
|
7
7
|
readonly validatedLocation: CodePosition;
|
|
8
|
-
readonly
|
|
9
|
-
readonly nestedDepth: number;
|
|
8
|
+
readonly rowDepth: number;
|
|
10
9
|
readonly nodePath: SequencePropsSubscriptionKey;
|
|
11
10
|
}>;
|
|
@@ -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
|
|
11
|
-
const
|
|
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;
|
|
@@ -73,53 +74,30 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
73
74
|
propStatus.codeValue === undefined) {
|
|
74
75
|
return Promise.resolve();
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
return (0, save_prop_queue_1.enqueueSavePropChange)({
|
|
78
|
+
nodePath,
|
|
79
|
+
setCodeValues,
|
|
80
|
+
applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForEffectCodeValues)({
|
|
80
81
|
previous: prev,
|
|
81
82
|
effectIndex: field.effectIndex,
|
|
82
83
|
fieldKey: field.key,
|
|
83
84
|
value,
|
|
84
85
|
schema: field.effectSchema,
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
setCodeValues(nodePath, (prev) => {
|
|
98
|
-
if (!prev.canUpdate) {
|
|
99
|
-
return prev;
|
|
100
|
-
}
|
|
101
|
-
const idx = prev.effects.findIndex((e) => e.effectIndex === field.effectIndex);
|
|
102
|
-
if (idx === -1) {
|
|
103
|
-
return {
|
|
104
|
-
...prev,
|
|
105
|
-
effects: [...prev.effects, data],
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
const next = [...prev.effects];
|
|
109
|
-
next[idx] = data;
|
|
110
|
-
return { ...prev, effects: next };
|
|
111
|
-
});
|
|
112
|
-
})
|
|
113
|
-
.catch((err) => {
|
|
114
|
-
setCodeValues(nodePath, (current) => {
|
|
115
|
-
if (previousUpdate) {
|
|
116
|
-
return previousUpdate;
|
|
117
|
-
}
|
|
118
|
-
return current;
|
|
119
|
-
});
|
|
120
|
-
(0, NotificationCenter_1.showNotification)(`Could not save effect prop: ${err instanceof Error ? err.message : String(err)}`, 4000);
|
|
86
|
+
}),
|
|
87
|
+
apiCall: () => (0, call_api_1.callApi)('/api/save-effect-props', {
|
|
88
|
+
fileName: validatedLocation.source,
|
|
89
|
+
sequenceNodePath: nodePath,
|
|
90
|
+
effectIndex: field.effectIndex,
|
|
91
|
+
key: field.key,
|
|
92
|
+
value: stringifiedValue,
|
|
93
|
+
defaultValue,
|
|
94
|
+
schema: field.effectSchema,
|
|
95
|
+
clientId,
|
|
96
|
+
}),
|
|
97
|
+
errorLabel: 'Could not save effect prop',
|
|
121
98
|
});
|
|
122
99
|
}, [
|
|
100
|
+
clientId,
|
|
123
101
|
field.effectIndex,
|
|
124
102
|
field.effectSchema,
|
|
125
103
|
field.fieldSchema.default,
|
|
@@ -151,6 +129,9 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
151
129
|
throw new Error(`Unsupported effect status: ${effectStatus.reason}`);
|
|
152
130
|
}
|
|
153
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
|
+
}
|
|
154
135
|
return null;
|
|
155
136
|
}
|
|
156
137
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
@@ -161,17 +142,17 @@ const Value = ({ field, nodePath, validatedLocation }) => {
|
|
|
161
142
|
});
|
|
162
143
|
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
163
144
|
};
|
|
164
|
-
const TimelineEffectFieldRow = ({ field, validatedLocation,
|
|
145
|
+
const TimelineEffectFieldRow = ({ field, validatedLocation, rowDepth, nodePath }) => {
|
|
165
146
|
var _a;
|
|
166
147
|
const style = (0, react_1.useMemo)(() => {
|
|
167
148
|
return {
|
|
168
149
|
...fieldRowBase,
|
|
169
150
|
height: field.rowHeight,
|
|
170
|
-
paddingLeft,
|
|
171
151
|
};
|
|
172
|
-
}, [field.rowHeight
|
|
173
|
-
|
|
174
|
-
|
|
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 })
|
|
175
156
|
] }));
|
|
176
157
|
};
|
|
177
158
|
exports.TimelineEffectFieldRow = TimelineEffectFieldRow;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
|
|
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
|
+
import type { GetIsExpanded } from '../ExpandedTracksProvider';
|
|
6
|
+
export declare const TimelineEffectGroupRow: React.FC<{
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
9
|
+
readonly effectIndex: number;
|
|
10
|
+
readonly effectSchema: SequenceSchema;
|
|
11
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
12
|
+
readonly validatedLocation: CodePosition;
|
|
13
|
+
readonly rowDepth: number;
|
|
14
|
+
readonly getIsExpanded: GetIsExpanded;
|
|
15
|
+
readonly toggleTrack: (nodePathInfo: SequenceNodePathInfo) => void;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineEffectGroupRow = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
8
|
+
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
9
|
+
const save_effect_prop_1 = require("./save-effect-prop");
|
|
10
|
+
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
11
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
12
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
13
|
+
const rowLabel = {
|
|
14
|
+
fontSize: 12,
|
|
15
|
+
color: 'rgba(255, 255, 255, 0.8)',
|
|
16
|
+
userSelect: 'none',
|
|
17
|
+
};
|
|
18
|
+
const TimelineEffectGroupRow = ({ label, nodePathInfo, effectIndex, effectSchema, nodePath, validatedLocation, rowDepth, getIsExpanded, toggleTrack, }) => {
|
|
19
|
+
var _a;
|
|
20
|
+
var _b;
|
|
21
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
22
|
+
const previewConnected = previewServerState.type === 'connected';
|
|
23
|
+
const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
24
|
+
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
25
|
+
const effectStatus = (0, react_1.useMemo)(() => remotion_1.Internals.getEffectCodeValuesCtx({
|
|
26
|
+
codeValues,
|
|
27
|
+
nodePath,
|
|
28
|
+
effectIndex,
|
|
29
|
+
}), [codeValues, nodePath, effectIndex]);
|
|
30
|
+
const disabledStatus = effectStatus.type === 'can-update-effect'
|
|
31
|
+
? ((_b = (_a = effectStatus.props) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : null)
|
|
32
|
+
: null;
|
|
33
|
+
const isDisabled = (0, react_1.useMemo)(() => {
|
|
34
|
+
if (disabledStatus && disabledStatus.canUpdate) {
|
|
35
|
+
return Boolean(disabledStatus.codeValue);
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}, [disabledStatus]);
|
|
39
|
+
const canToggle = previewConnected && disabledStatus !== null && disabledStatus.canUpdate;
|
|
40
|
+
const onToggle = (0, react_1.useCallback)((type) => {
|
|
41
|
+
if (!canToggle || previewServerState.type !== 'connected') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const newValue = type !== 'enable';
|
|
45
|
+
const fieldSchema = effectSchema.disabled;
|
|
46
|
+
const defaultValue = fieldSchema && fieldSchema.type === 'boolean'
|
|
47
|
+
? JSON.stringify(fieldSchema.default)
|
|
48
|
+
: null;
|
|
49
|
+
(0, save_effect_prop_1.saveEffectProp)({
|
|
50
|
+
fileName: validatedLocation.source,
|
|
51
|
+
nodePath,
|
|
52
|
+
effectIndex,
|
|
53
|
+
fieldKey: 'disabled',
|
|
54
|
+
value: newValue,
|
|
55
|
+
defaultValue,
|
|
56
|
+
schema: effectSchema,
|
|
57
|
+
setCodeValues,
|
|
58
|
+
clientId: previewServerState.clientId,
|
|
59
|
+
});
|
|
60
|
+
}, [
|
|
61
|
+
canToggle,
|
|
62
|
+
effectIndex,
|
|
63
|
+
effectSchema,
|
|
64
|
+
nodePath,
|
|
65
|
+
previewServerState,
|
|
66
|
+
setCodeValues,
|
|
67
|
+
validatedLocation.source,
|
|
68
|
+
]);
|
|
69
|
+
const isExpanded = getIsExpanded(nodePathInfo);
|
|
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 }) }));
|
|
75
|
+
};
|
|
76
|
+
exports.TimelineEffectGroupRow = TimelineEffectGroupRow;
|
|
@@ -2,54 +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");
|
|
8
|
+
const TimelineEffectGroupRow_1 = require("./TimelineEffectGroupRow");
|
|
9
9
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
10
10
|
const TimelineFieldRow_1 = require("./TimelineFieldRow");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
height: timeline_layout_1.TREE_GROUP_ROW_HEIGHT,
|
|
14
|
-
display: 'flex',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
17
|
-
};
|
|
11
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
12
|
+
const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
18
13
|
const rowLabel = {
|
|
19
14
|
fontSize: 12,
|
|
20
15
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
21
16
|
userSelect: 'none',
|
|
22
17
|
};
|
|
23
|
-
const labelOnlyRowBase = {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
27
|
-
};
|
|
28
18
|
const TimelineExpandedRow = ({ node, depth, nestedDepth, getIsExpanded, toggleTrack, validatedLocation, nodePath, schema, }) => {
|
|
29
|
-
const
|
|
30
|
-
const groupStyle = (0, react_1.useMemo)(() => ({ ...groupRowBase, paddingLeft }), [paddingLeft]);
|
|
31
|
-
const labelOnlyStyle = (0, react_1.useMemo)(() => ({
|
|
32
|
-
...labelOnlyRowBase,
|
|
33
|
-
height: (0, timeline_layout_1.getTreeRowHeight)(node),
|
|
34
|
-
paddingLeft,
|
|
35
|
-
}), [node, paddingLeft]);
|
|
19
|
+
const rowDepth = (0, timeline_row_layout_1.getExpandedRowDepth)({ nestedDepth, treeDepth: depth });
|
|
36
20
|
if (node.kind === 'group') {
|
|
21
|
+
if (node.effectInfo) {
|
|
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 }));
|
|
23
|
+
}
|
|
37
24
|
const isExpanded = getIsExpanded(node.nodePathInfo);
|
|
38
|
-
return (jsx_runtime_1.
|
|
39
|
-
|
|
40
|
-
|
|
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 }) }));
|
|
41
29
|
}
|
|
42
30
|
if (node.field) {
|
|
43
31
|
if (node.field.kind === 'effect-field') {
|
|
44
|
-
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 }));
|
|
45
33
|
}
|
|
46
34
|
if (node.field.kind === 'sequence-field') {
|
|
47
|
-
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 }));
|
|
48
36
|
}
|
|
49
37
|
throw new Error('Unexpected field kind: ' + JSON.stringify(node.field));
|
|
50
38
|
}
|
|
51
|
-
return (jsx_runtime_1.
|
|
52
|
-
|
|
53
|
-
|
|
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 }) }));
|
|
54
43
|
};
|
|
55
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
|
}>;
|