@remotion/studio 4.0.461 → 4.0.462

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.
Files changed (38) hide show
  1. package/dist/components/ExpandedTracksProvider.js +8 -3
  2. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +4 -3
  3. package/dist/components/Timeline/SubscribeToNodePaths.js +11 -1
  4. package/dist/components/Timeline/Timeline.js +1 -1
  5. package/dist/components/Timeline/TimelineColorField.d.ts +11 -0
  6. package/dist/components/Timeline/TimelineColorField.js +181 -0
  7. package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +11 -0
  8. package/dist/components/Timeline/TimelineEffectFieldRow.js +177 -0
  9. package/dist/components/Timeline/TimelineExpandedRow.d.ts +3 -3
  10. package/dist/components/Timeline/TimelineExpandedRow.js +8 -1
  11. package/dist/components/Timeline/TimelineExpandedSection.d.ts +2 -2
  12. package/dist/components/Timeline/TimelineExpandedSection.js +7 -20
  13. package/dist/components/Timeline/TimelineFieldRow.d.ts +3 -3
  14. package/dist/components/Timeline/TimelineFieldRow.js +31 -25
  15. package/dist/components/Timeline/TimelineListItem.js +5 -4
  16. package/dist/components/Timeline/TimelineNumberField.js +1 -1
  17. package/dist/components/Timeline/TimelineRotationField.js +1 -1
  18. package/dist/components/Timeline/TimelineSchemaField.d.ts +8 -2
  19. package/dist/components/Timeline/TimelineSchemaField.js +20 -11
  20. package/dist/components/Timeline/TimelineTracks.js +4 -4
  21. package/dist/components/Timeline/TimelineTranslateField.js +4 -2
  22. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
  23. package/dist/components/Timeline/sequence-props-subscription-store.js +10 -4
  24. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +2 -1
  25. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -1
  26. package/dist/components/Timeline/use-timeline-height.js +3 -3
  27. package/dist/esm/{chunk-yzh34sp0.js → chunk-yvg1f56k.js} +4017 -3545
  28. package/dist/esm/index.mjs +20 -8
  29. package/dist/esm/internals.mjs +4017 -3545
  30. package/dist/esm/previewEntry.mjs +2755 -2294
  31. package/dist/esm/renderEntry.mjs +1 -1
  32. package/dist/helpers/calculate-timeline.js +13 -5
  33. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -2
  34. package/dist/helpers/timeline-layout.d.ts +9 -14
  35. package/dist/helpers/timeline-layout.js +21 -35
  36. package/dist/icons/eyedropper.d.ts +4 -0
  37. package/dist/icons/eyedropper.js +6 -0
  38. package/package.json +11 -12
@@ -2,8 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpandedTracksProvider = exports.ExpandedTracksSetterContext = exports.ExpandedTracksGetterContext = 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
- const nodePathInfoToKey = (info) => JSON.stringify([info.nodePath, info.index]);
7
+ const nodePathInfoToExpandedKey = (info) => [
8
+ (0, studio_shared_1.stringifySequenceExpandedRowKey)(info.sequenceSubscriptionKey),
9
+ info.auxiliaryKeys.join('.'),
10
+ info.index,
11
+ ].join('.');
7
12
  const LOCAL_STORAGE_KEY = 'remotion.editor.expandedTracks';
8
13
  const loadExpandedTracks = () => {
9
14
  if (typeof window === 'undefined') {
@@ -38,7 +43,7 @@ const ExpandedTracksProvider = ({ children }) => {
38
43
  const [expandedTracks, setExpandedTracks] = (0, react_1.useState)(loadExpandedTracks);
39
44
  const toggleTrack = (0, react_1.useCallback)((nodePathInfo) => {
40
45
  setExpandedTracks((prev) => {
41
- const key = nodePathInfoToKey(nodePathInfo);
46
+ const key = nodePathInfoToExpandedKey(nodePathInfo);
42
47
  const next = { ...prev, [key]: !prev[key] };
43
48
  window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(next));
44
49
  return next;
@@ -47,7 +52,7 @@ const ExpandedTracksProvider = ({ children }) => {
47
52
  const getterValue = (0, react_1.useMemo)(() => ({
48
53
  getIsExpanded: (nodePathInfo) => {
49
54
  var _a;
50
- return (_a = expandedTracks[nodePathInfoToKey(nodePathInfo)]) !== null && _a !== void 0 ? _a : false;
55
+ return (_a = expandedTracks[nodePathInfoToExpandedKey(nodePathInfo)]) !== null && _a !== void 0 ? _a : false;
51
56
  },
52
57
  }), [expandedTracks]);
53
58
  const setterValue = (0, react_1.useMemo)(() => ({ toggleTrack }), [toggleTrack]);
@@ -1,7 +1,8 @@
1
- import type React from 'react';
2
- import type { SequenceSchema } from 'remotion';
3
- export declare const SubscribeToNodePaths: React.FC<{
1
+ import { type FC } from 'react';
2
+ import type { EffectDefinition, SequenceSchema } from 'remotion';
3
+ export declare const SubscribeToNodePaths: FC<{
4
4
  readonly overrideId: string;
5
5
  readonly schema: SequenceSchema;
6
6
  readonly stack: string;
7
+ readonly effects: readonly EffectDefinition<unknown>[];
7
8
  }>;
@@ -1,13 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubscribeToNodePaths = void 0;
4
+ const react_1 = require("react");
5
+ const no_react_1 = require("remotion/no-react");
4
6
  const use_resolved_stack_1 = require("./use-resolved-stack");
5
7
  const use_sequence_props_subscription_1 = require("./use-sequence-props-subscription");
6
- const SubscribeToNodePaths = ({ overrideId, schema, stack }) => {
8
+ const SubscribeToNodePaths = ({ overrideId, schema, stack, effects }) => {
7
9
  const originalLocation = (0, use_resolved_stack_1.useResolvedStack)(stack);
10
+ const effectSubscriptions = (0, react_1.useMemo)(() => {
11
+ return effects
12
+ .map((effect) => {
13
+ return effect.schema;
14
+ })
15
+ .filter(no_react_1.NoReactInternals.truthy);
16
+ }, [effects]);
8
17
  (0, use_sequence_props_subscription_1.useSequencePropsSubscription)({
9
18
  overrideId,
10
19
  schema,
20
+ effects: effectSubscriptions,
11
21
  originalLocation,
12
22
  });
13
23
  return null;
@@ -103,7 +103,7 @@ const TimelineInner = () => {
103
103
  if (!sequence.controls || !previewConnected || !sequence.stack) {
104
104
  return null;
105
105
  }
106
- return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, schema: sequence.controls.schema, stack: sequence.stack }, sequence.id));
106
+ return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, schema: sequence.controls.schema, stack: sequence.stack, effects: sequence.effects }, sequence.id));
107
107
  }), jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}), jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
108
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
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: [
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { CanUpdateSequencePropStatus } from 'remotion';
3
+ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
4
+ export declare const TimelineColorField: React.FC<{
5
+ readonly field: SchemaFieldInfo;
6
+ readonly effectiveValue: unknown;
7
+ readonly propStatus: CanUpdateSequencePropStatus;
8
+ readonly onSave: TimelineFieldOnSave;
9
+ readonly onDragValueChange: TimelineFieldOnDragValueChange;
10
+ readonly onDragEnd: () => void;
11
+ }>;
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineColorField = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const no_react_1 = require("remotion/no-react");
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;
12
+ const containerStyle = {
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ gap: 3,
16
+ };
17
+ const swatchWrapperBase = {
18
+ position: 'relative',
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;
77
+ const TimelineColorField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
78
+ const inputRef = (0, react_1.useRef)(null);
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
+ }, []);
97
+ const currentValue = typeof effectiveValue === 'string'
98
+ ? effectiveValue
99
+ : field.fieldSchema.type === 'color'
100
+ ? field.fieldSchema.default
101
+ : '';
102
+ const hexValue = (0, react_1.useMemo)(() => toHex(currentValue), [currentValue]);
103
+ const onColorChange = (0, react_1.useCallback)((e) => {
104
+ const newValue = e.target.value;
105
+ if (!propStatus.canUpdate) {
106
+ return;
107
+ }
108
+ onDragValueChange(newValue);
109
+ if (commitTimeoutRef.current) {
110
+ clearTimeout(commitTimeoutRef.current);
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) {
132
+ return;
133
+ }
134
+ const eyeDropper = new EyeDropperCtor();
135
+ eyeDropper
136
+ .open()
137
+ .then((result) => {
138
+ if (propStatus.canUpdate && result.sRGBHex !== propStatus.codeValue) {
139
+ onSave(result.sRGBHex);
140
+ }
141
+ })
142
+ .catch(() => {
143
+ // User aborted or picker failed; safe to ignore.
144
+ });
145
+ }, [onSave, propStatus]);
146
+ const swatchWrapperStyle = (0, react_1.useMemo)(() => {
147
+ 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
+ marginLeft: 5,
154
+ };
155
+ }, [isFocused, isHovered, propStatus.canUpdate]);
156
+ const swatchFill = (0, react_1.useMemo)(() => {
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] }));
180
+ };
181
+ exports.TimelineColorField = TimelineColorField;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { SequencePropsSubscriptionKey } from 'remotion';
3
+ import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
4
+ import type { EffectSchemaFieldInfo } from '../../helpers/timeline-layout';
5
+ export declare const TimelineEffectFieldRow: React.FC<{
6
+ readonly field: EffectSchemaFieldInfo;
7
+ readonly validatedLocation: CodePosition;
8
+ readonly paddingLeft: number;
9
+ readonly nestedDepth: number;
10
+ readonly nodePath: SequencePropsSubscriptionKey;
11
+ }>;
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineEffectFieldRow = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const studio_shared_1 = require("@remotion/studio-shared");
6
+ const react_1 = require("react");
7
+ const remotion_1 = require("remotion");
8
+ const timeline_layout_1 = require("../../helpers/timeline-layout");
9
+ const call_api_1 = require("../call-api");
10
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
11
+ const Padder_1 = require("./Padder");
12
+ const TimelineSchemaField_1 = require("./TimelineSchemaField");
13
+ const fieldRowBase = {
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ gap: 8,
17
+ paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
18
+ };
19
+ const fieldName = {
20
+ fontSize: 12,
21
+ color: 'rgba(255, 255, 255, 0.8)',
22
+ userSelect: 'none',
23
+ };
24
+ const fieldLabelRow = {
25
+ flex: '0 0 50%',
26
+ display: 'flex',
27
+ flexDirection: 'row',
28
+ alignItems: 'center',
29
+ gap: 6,
30
+ };
31
+ const Value = ({ field, nodePath, validatedLocation }) => {
32
+ var _a;
33
+ var _b;
34
+ const { setEffectDragOverrides, clearEffectDragOverrides, setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
35
+ const { getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
36
+ const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
37
+ const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
38
+ codeValues: visualModeCodeValues,
39
+ nodePath,
40
+ effectIndex: field.effectIndex,
41
+ });
42
+ const propStatus = effectStatus.type === 'can-update-effect'
43
+ ? ((_b = (_a = effectStatus.props) === null || _a === void 0 ? void 0 : _a[field.key]) !== null && _b !== void 0 ? _b : null)
44
+ : null;
45
+ const onDragValueChange = (0, react_1.useCallback)((value) => {
46
+ setEffectDragOverrides(nodePath, field.effectIndex, field.key, value);
47
+ }, [setEffectDragOverrides, nodePath, field.effectIndex, field.key]);
48
+ const onDragEnd = (0, react_1.useCallback)(() => {
49
+ clearEffectDragOverrides(nodePath, field.effectIndex);
50
+ }, [clearEffectDragOverrides, nodePath, field.effectIndex]);
51
+ const dragOverrideValue = (0, react_1.useMemo)(() => {
52
+ const overrides = getEffectDragOverrides(nodePath, field.effectIndex);
53
+ return overrides[field.key];
54
+ }, [getEffectDragOverrides, nodePath, field.effectIndex, field.key]);
55
+ const onSave = (0, react_1.useCallback)((value) => {
56
+ if (!validatedLocation) {
57
+ return Promise.reject(new Error('Cannot save'));
58
+ }
59
+ if (!propStatus) {
60
+ return Promise.reject(new Error('Cannot save'));
61
+ }
62
+ if (!propStatus.canUpdate) {
63
+ return Promise.reject(new Error('Cannot save'));
64
+ }
65
+ const defaultValue = field.fieldSchema.default !== undefined
66
+ ? JSON.stringify(field.fieldSchema.default)
67
+ : null;
68
+ const stringifiedValue = JSON.stringify(value);
69
+ if (value === propStatus.codeValue) {
70
+ return Promise.resolve();
71
+ }
72
+ if (defaultValue === stringifiedValue &&
73
+ propStatus.codeValue === undefined) {
74
+ return Promise.resolve();
75
+ }
76
+ let previousUpdate;
77
+ setCodeValues(nodePath, (prev) => {
78
+ previousUpdate = prev;
79
+ return (0, studio_shared_1.optimisticUpdateForEffectCodeValues)({
80
+ previous: prev,
81
+ effectIndex: field.effectIndex,
82
+ fieldKey: field.key,
83
+ value,
84
+ schema: field.effectSchema,
85
+ });
86
+ });
87
+ return (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
+ })
96
+ .then((data) => {
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);
121
+ });
122
+ }, [
123
+ field.effectIndex,
124
+ field.effectSchema,
125
+ field.fieldSchema.default,
126
+ field.key,
127
+ nodePath,
128
+ propStatus,
129
+ setCodeValues,
130
+ validatedLocation,
131
+ ]);
132
+ if (effectStatus.type === 'cannot-update-effect') {
133
+ if (effectStatus.reason === 'computed') {
134
+ return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "computed" });
135
+ }
136
+ if (effectStatus.reason === 'not-call-expression') {
137
+ return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "not inline" });
138
+ }
139
+ if (effectStatus.reason === 'not-found') {
140
+ return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "not found in code" });
141
+ }
142
+ throw new Error(`Unsupported effect status: ${effectStatus.reason}`);
143
+ }
144
+ if (effectStatus.type === 'cannot-update-sequence') {
145
+ if (effectStatus.reason === 'not-found') {
146
+ return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "not found in code" });
147
+ }
148
+ if (effectStatus.reason === 'error') {
149
+ return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "error" });
150
+ }
151
+ throw new Error(`Unsupported effect status: ${effectStatus.reason}`);
152
+ }
153
+ if (propStatus === null || !propStatus.canUpdate) {
154
+ return null;
155
+ }
156
+ const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
157
+ codeValue: propStatus,
158
+ dragOverrideValue,
159
+ defaultValue: field.fieldSchema.default,
160
+ shouldResortToDefaultValueIfUndefined: true,
161
+ });
162
+ return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
163
+ };
164
+ const TimelineEffectFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth, nodePath }) => {
165
+ var _a;
166
+ const style = (0, react_1.useMemo)(() => {
167
+ return {
168
+ ...fieldRowBase,
169
+ height: field.rowHeight,
170
+ paddingLeft,
171
+ };
172
+ }, [field.rowHeight, paddingLeft]);
173
+ return (jsx_runtime_1.jsxs("div", { style: style, children: [
174
+ 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: (_a = field.description) !== null && _a !== void 0 ? _a : field.key }) }), jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation })
175
+ ] }));
176
+ };
177
+ exports.TimelineEffectFieldRow = TimelineEffectFieldRow;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { SequenceSchema, SequenceNodePath } from 'remotion';
2
+ import type { SequenceSchema, SequencePropsSubscriptionKey } from 'remotion';
3
3
  import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
4
4
  import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
5
5
  import type { TimelineTreeNode } from '../../helpers/timeline-layout';
@@ -10,7 +10,7 @@ export declare const TimelineExpandedRow: React.FC<{
10
10
  readonly nestedDepth: number;
11
11
  readonly getIsExpanded: GetIsExpanded;
12
12
  readonly toggleTrack: (nodePathInfo: SequenceNodePathInfo) => void;
13
- readonly validatedLocation: CodePosition | null;
14
- readonly nodePath: SequenceNodePath;
13
+ readonly validatedLocation: CodePosition;
14
+ readonly nodePath: SequencePropsSubscriptionKey;
15
15
  readonly schema: SequenceSchema;
16
16
  }>;
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const timeline_layout_1 = require("../../helpers/timeline-layout");
7
7
  const Padder_1 = require("./Padder");
8
+ const TimelineEffectFieldRow_1 = require("./TimelineEffectFieldRow");
8
9
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
9
10
  const TimelineFieldRow_1 = require("./TimelineFieldRow");
10
11
  const TimelineListItem_1 = require("./TimelineListItem");
@@ -39,7 +40,13 @@ const TimelineExpandedRow = ({ node, depth, nestedDepth, getIsExpanded, toggleTr
39
40
  ] }));
40
41
  }
41
42
  if (node.field) {
42
- return (jsx_runtime_1.jsx(TimelineFieldRow_1.TimelineFieldRow, { field: node.field, validatedLocation: validatedLocation, paddingLeft: paddingLeft, nestedDepth: nestedDepth, nodePath: nodePath, schema: schema }));
43
+ if (node.field.kind === 'effect-field') {
44
+ return (jsx_runtime_1.jsx(TimelineEffectFieldRow_1.TimelineEffectFieldRow, { field: node.field, validatedLocation: validatedLocation, paddingLeft: paddingLeft, nestedDepth: nestedDepth, nodePath: nodePath }));
45
+ }
46
+ if (node.field.kind === 'sequence-field') {
47
+ return (jsx_runtime_1.jsx(TimelineFieldRow_1.TimelineFieldRow, { field: node.field, validatedLocation: validatedLocation, paddingLeft: paddingLeft, nestedDepth: nestedDepth, nodePath: nodePath, schema: schema }));
48
+ }
49
+ throw new Error('Unexpected field kind: ' + JSON.stringify(node.field));
43
50
  }
44
51
  return (jsx_runtime_1.jsxs("div", { style: labelOnlyStyle, children: [
45
52
  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
1
  import React from 'react';
2
2
  import { type TSequence } from 'remotion';
3
- import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
3
+ import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
4
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
- readonly originalLocation: OriginalPosition | null;
7
+ readonly validatedLocation: CodePosition;
8
8
  readonly nodePathInfo: SequenceNodePathInfo;
9
9
  readonly nestedDepth: number;
10
10
  }>;
@@ -53,37 +53,24 @@ const separator = {
53
53
  height: 1,
54
54
  backgroundColor: colors_1.TIMELINE_TRACK_SEPARATOR,
55
55
  };
56
- const TimelineExpandedSection = ({ sequence, originalLocation, nodePathInfo, nestedDepth }) => {
56
+ const TimelineExpandedSection = ({ sequence, validatedLocation, nodePathInfo, nestedDepth }) => {
57
57
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
58
58
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
59
- const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
59
+ const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
60
60
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
61
- const validatedLocation = (0, react_1.useMemo)(() => {
62
- var _a;
63
- if (!originalLocation ||
64
- !originalLocation.source ||
65
- !originalLocation.line) {
66
- return null;
67
- }
68
- return {
69
- source: originalLocation.source,
70
- line: originalLocation.line,
71
- column: (_a = originalLocation.column) !== null && _a !== void 0 ? _a : 0,
72
- };
73
- }, [originalLocation]);
74
61
  const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
75
62
  sequence,
76
63
  nodePathInfo,
77
64
  getDragOverrides,
78
- getCodeValues,
79
- }), [sequence, nodePathInfo, getDragOverrides, getCodeValues]);
65
+ codeValues: visualModeCodeValues,
66
+ }), [sequence, nodePathInfo, getDragOverrides, visualModeCodeValues]);
80
67
  const flat = (0, react_1.useMemo)(() => (0, timeline_layout_1.flattenVisibleTreeNodes)({ nodes: tree, getIsExpanded }), [tree, getIsExpanded]);
81
68
  const expandedHeight = (0, react_1.useMemo)(() => (0, timeline_layout_1.getExpandedTrackHeight)({
82
69
  sequence,
83
70
  nodePathInfo,
84
71
  getIsExpanded,
85
- getCodeValues,
86
- }), [sequence, nodePathInfo, getIsExpanded, getCodeValues]);
72
+ codeValues: visualModeCodeValues,
73
+ }), [sequence, nodePathInfo, getIsExpanded, visualModeCodeValues]);
87
74
  const style = (0, react_1.useMemo)(() => {
88
75
  return {
89
76
  ...expandedSectionBase,
@@ -95,7 +82,7 @@ const TimelineExpandedSection = ({ sequence, originalLocation, nodePathInfo, nes
95
82
  return jsx_runtime_1.jsx("div", { style: style, children: "No schema" });
96
83
  }
97
84
  return (jsx_runtime_1.jsx("div", { style: style, children: flat.map(({ node, depth }, i) => {
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 })
85
+ 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.sequenceSubscriptionKey, schema: schema })
99
86
  ] }, JSON.stringify(node.nodePathInfo)));
100
87
  }) }));
101
88
  };
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- import type { SequenceNodePath } from 'remotion';
2
+ import type { SequencePropsSubscriptionKey } 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 validatedLocation: CodePosition | null;
8
+ readonly validatedLocation: CodePosition;
9
9
  readonly paddingLeft: number;
10
10
  readonly nestedDepth: number;
11
- readonly nodePath: SequenceNodePath;
11
+ readonly nodePath: SequencePropsSubscriptionKey;
12
12
  readonly schema: SequenceSchema;
13
13
  }>;