@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.
Files changed (83) hide show
  1. package/dist/components/AssetSelector.js +2 -6
  2. package/dist/components/CanvasOrLoading.js +1 -1
  3. package/dist/components/ColorPicker/AlphaSlider.d.ts +9 -0
  4. package/dist/components/ColorPicker/AlphaSlider.js +88 -0
  5. package/dist/components/ColorPicker/ColorPicker.d.ts +18 -0
  6. package/dist/components/ColorPicker/ColorPicker.js +176 -0
  7. package/dist/components/ColorPicker/ColorPickerPopup.d.ts +8 -0
  8. package/dist/components/ColorPicker/ColorPickerPopup.js +276 -0
  9. package/dist/components/ColorPicker/HueSlider.d.ts +6 -0
  10. package/dist/components/ColorPicker/HueSlider.js +68 -0
  11. package/dist/components/ColorPicker/SaturationValueArea.d.ts +14 -0
  12. package/dist/components/ColorPicker/SaturationValueArea.js +93 -0
  13. package/dist/components/ColorPicker/checker.d.ts +4 -0
  14. package/dist/components/ColorPicker/checker.js +9 -0
  15. package/dist/components/CompSelectorRef.js +2 -6
  16. package/dist/components/ExpandedTracksProvider.d.ts +2 -0
  17. package/dist/components/ExpandedTracksProvider.js +23 -21
  18. package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -47
  19. package/dist/components/Timeline/Padder.js +2 -2
  20. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +1 -1
  21. package/dist/components/Timeline/SubscribeToNodePaths.js +3 -3
  22. package/dist/components/Timeline/Timeline.js +4 -7
  23. package/dist/components/Timeline/TimelineColorField.js +18 -156
  24. package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +1 -2
  25. package/dist/components/Timeline/TimelineEffectFieldRow.js +38 -57
  26. package/dist/components/Timeline/TimelineEffectGroupRow.d.ts +16 -0
  27. package/dist/components/Timeline/TimelineEffectGroupRow.js +76 -0
  28. package/dist/components/Timeline/TimelineExpandedRow.js +18 -29
  29. package/dist/components/Timeline/TimelineFieldRow.d.ts +1 -2
  30. package/dist/components/Timeline/TimelineFieldRow.js +24 -55
  31. package/dist/components/Timeline/TimelineImageInfo.js +5 -17
  32. package/dist/components/Timeline/TimelineLayerEye.d.ts +5 -3
  33. package/dist/components/Timeline/TimelineLayerEye.js +18 -1
  34. package/dist/components/Timeline/TimelineListItem.d.ts +0 -1
  35. package/dist/components/Timeline/TimelineListItem.js +64 -23
  36. package/dist/components/Timeline/TimelineRowChrome.d.ts +8 -0
  37. package/dist/components/Timeline/TimelineRowChrome.js +21 -0
  38. package/dist/components/Timeline/TimelineTracks.js +0 -4
  39. package/dist/components/Timeline/save-effect-prop.d.ts +13 -0
  40. package/dist/components/Timeline/save-effect-prop.js +31 -0
  41. package/dist/components/Timeline/save-prop-queue.d.ts +11 -0
  42. package/dist/components/Timeline/save-prop-queue.js +54 -0
  43. package/dist/components/Timeline/save-sequence-prop.d.ts +12 -0
  44. package/dist/components/Timeline/save-sequence-prop.js +29 -0
  45. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -0
  46. package/dist/components/Timeline/should-show-track-in-timeline.js +23 -0
  47. package/dist/components/Timeline/timeline-field-row-layout.d.ts +2 -0
  48. package/dist/components/Timeline/timeline-field-row-layout.js +14 -0
  49. package/dist/components/Timeline/timeline-indent.d.ts +1 -0
  50. package/dist/components/Timeline/timeline-indent.js +4 -0
  51. package/dist/components/Timeline/timeline-row-layout.d.ts +11 -0
  52. package/dist/components/Timeline/timeline-row-layout.js +27 -0
  53. package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +2 -0
  54. package/dist/components/Timeline/use-resolved-stack-react-to-change.js +59 -0
  55. package/dist/components/Timeline/use-sequence-props-subscription.js +27 -1
  56. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +5 -3
  57. package/dist/esm/{chunk-yvg1f56k.js → chunk-mawnnpzg.js} +5147 -4012
  58. package/dist/esm/internals.mjs +5147 -4012
  59. package/dist/esm/previewEntry.mjs +5159 -4025
  60. package/dist/esm/renderEntry.mjs +1 -1
  61. package/dist/helpers/client-id.d.ts +2 -9
  62. package/dist/helpers/client-id.js +15 -40
  63. package/dist/helpers/color-conversion.d.ts +36 -0
  64. package/dist/helpers/color-conversion.js +121 -0
  65. package/dist/helpers/inject-css.js +4 -7
  66. package/dist/helpers/migrate-expanded-tracks-for-subscription-key.d.ts +3 -0
  67. package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +26 -0
  68. package/dist/helpers/persist-boolean-map.d.ts +5 -0
  69. package/dist/helpers/persist-boolean-map.js +56 -0
  70. package/dist/helpers/persist-open-folders.d.ts +4 -3
  71. package/dist/helpers/persist-open-folders.js +4 -7
  72. package/dist/helpers/preview-server-events.d.ts +15 -0
  73. package/dist/helpers/preview-server-events.js +81 -0
  74. package/dist/helpers/timeline-layout.d.ts +6 -2
  75. package/dist/helpers/timeline-layout.js +31 -25
  76. package/dist/hot-middleware-client/client.js +10 -16
  77. package/package.json +10 -10
  78. package/dist/components/NewComposition/RemInputTypeColor.d.ts +0 -8
  79. package/dist/components/NewComposition/RemInputTypeColor.js +0 -53
  80. package/dist/components/Timeline/is-collapsed.d.ts +0 -2
  81. package/dist/components/Timeline/is-collapsed.js +0 -10
  82. package/dist/helpers/color-math.d.ts +0 -1
  83. package/dist/helpers/color-math.js +0 -13
@@ -2,18 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineFieldRow = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const studio_shared_1 = require("@remotion/studio-shared");
6
5
  const react_1 = require("react");
7
6
  const remotion_1 = require("remotion");
7
+ const client_id_1 = require("../../helpers/client-id");
8
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");
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");
12
14
  const TimelineSchemaField_1 = require("./TimelineSchemaField");
13
15
  const fieldRowBase = {
14
- display: 'flex',
15
- alignItems: 'center',
16
- gap: 8,
17
16
  paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
18
17
  };
19
18
  const fieldName = {
@@ -21,13 +20,6 @@ const fieldName = {
21
20
  color: 'rgba(255, 255, 255, 0.8)',
22
21
  userSelect: 'none',
23
22
  };
24
- const fieldLabelRow = {
25
- flex: '0 0 50%',
26
- display: 'flex',
27
- flexDirection: 'row',
28
- alignItems: 'center',
29
- gap: 6,
30
- };
31
23
  const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
32
24
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
33
25
  const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
@@ -44,10 +36,17 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
44
36
  shouldResortToDefaultValueIfUndefined: true,
45
37
  });
46
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;
47
43
  const onSave = (0, react_1.useCallback)((value) => {
48
44
  if (!codeValue || !codeValue.canUpdate) {
49
45
  return Promise.reject(new Error('Cannot save'));
50
46
  }
47
+ if (!clientId) {
48
+ return Promise.reject(new Error('Not connected to studio server'));
49
+ }
51
50
  const defaultValue = field.fieldSchema.default !== undefined
52
51
  ? JSON.stringify(field.fieldSchema.default)
53
52
  : null;
@@ -59,49 +58,19 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
59
58
  codeValue.codeValue === undefined) {
60
59
  return Promise.resolve();
61
60
  }
62
- let previousUpdate;
63
- // Optimistic update to prevent flicker
64
- setCodeValues(nodePath, (prev) => {
65
- previousUpdate = prev;
66
- return (0, studio_shared_1.optimisticUpdateForCodeValues)({
67
- previous: prev,
68
- fieldKey: field.key,
69
- value,
70
- schema,
71
- });
72
- });
73
- return (0, call_api_1.callApi)('/api/save-sequence-props', {
61
+ return (0, save_sequence_prop_1.saveSequenceProp)({
74
62
  fileName: validatedLocation.source,
75
63
  nodePath,
76
- key: field.key,
77
- value: stringifiedValue,
64
+ fieldKey: field.key,
65
+ value,
78
66
  defaultValue,
79
67
  schema,
80
- })
81
- .then((data) => {
82
- setCodeValues(nodePath, (prev) => {
83
- if (!data.canUpdate) {
84
- return data;
85
- }
86
- return {
87
- canUpdate: true,
88
- props: data.props,
89
- effects: prev.canUpdate ? prev.effects : [],
90
- };
91
- });
92
- })
93
- .catch((err) => {
94
- // In case something went wrong, undo optimistic update
95
- setCodeValues(nodePath, (current) => {
96
- if (previousUpdate) {
97
- return previousUpdate;
98
- }
99
- return current;
100
- });
101
- (0, NotificationCenter_1.showNotification)(`Could not save sequence prop: ${err instanceof Error ? err.message : String(err)}`, 4000);
68
+ setCodeValues,
69
+ clientId,
102
70
  });
103
71
  }, [
104
72
  codeValue,
73
+ clientId,
105
74
  field.fieldSchema.default,
106
75
  field.key,
107
76
  nodePath,
@@ -123,7 +92,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
123
92
  }, [clearDragOverrides, nodePath]);
124
93
  return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
125
94
  };
126
- const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth, nodePath, schema, }) => {
95
+ const TimelineFieldRow = ({ field, validatedLocation, rowDepth, nodePath, schema }) => {
127
96
  var _a, _b;
128
97
  const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
129
98
  const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
@@ -132,13 +101,13 @@ const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth,
132
101
  return {
133
102
  ...fieldRowBase,
134
103
  height: field.rowHeight,
135
- paddingLeft,
136
104
  };
137
- }, [field.rowHeight, paddingLeft]);
105
+ }, [field.rowHeight]);
106
+ const labelRowStyle = (0, react_1.useMemo)(() => (0, timeline_field_row_layout_1.getTimelineFieldLabelRowStyle)(rowDepth), [rowDepth]);
138
107
  if (codeValue === null) {
139
108
  return null;
140
109
  }
141
- return (jsx_runtime_1.jsxs("div", { style: style, children: [
142
- jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx("div", { style: fieldLabelRow, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }) }), 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 }))] }));
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 }))] }));
143
112
  };
144
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
- const scale = (HEIGHT * window.devicePixelRatio) / img.naturalHeight;
37
- const scaledWidth = img.naturalWidth * scale;
38
- const scaledHeight = HEIGHT * window.devicePixelRatio;
39
- const offscreen = document.createElement('canvas');
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,5 +1,7 @@
1
+ import React from 'react';
1
2
  export declare const TimelineLayerEye: React.FC<{
2
- onInvoked: (type: 'enable' | 'disable') => void;
3
- hidden: boolean;
4
- type: 'eye' | 'speaker';
3
+ readonly onInvoked: (type: 'enable' | 'disable') => void;
4
+ readonly hidden: boolean;
5
+ readonly type: 'eye' | 'speaker' | 'effect';
5
6
  }>;
7
+ export declare const TimelineLayerEyeSpacer: React.FC;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineLayerEye = void 0;
3
+ exports.TimelineLayerEyeSpacer = exports.TimelineLayerEye = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
@@ -9,6 +9,10 @@ const eyeIcon = {
9
9
  color: 'currentColor',
10
10
  pointerEvents: 'none',
11
11
  };
12
+ const effectIcon = {
13
+ ...eyeIcon,
14
+ width: 15,
15
+ };
12
16
  const speakerIcon = {
13
17
  ...eyeIcon,
14
18
  height: 10,
@@ -34,6 +38,9 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
34
38
  if (type === 'speaker') {
35
39
  return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 10 14", fill: "none", style: speakerIcon, children: jsx_runtime_1.jsx("path", { d: "M9.40938 0.0869018C9.76875 0.249402 10 0.605652 10 0.999402V12.9994C10 13.3932 9.76875 13.7494 9.40938 13.9119C9.05 14.0744 8.62813 14.0088 8.33438 13.7463L4.11875 9.9994H2C0.896875 9.9994 0 9.10253 0 7.9994V5.9994C0 4.89628 0.896875 3.9994 2 3.9994H4.11875L8.33438 0.252527C8.62813 -0.0099732 9.05 -0.0724732 9.40938 0.0869018Z", fill: color }) }));
36
40
  }
41
+ if (type === 'effect') {
42
+ return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 16 16", fill: "none", style: effectIcon, children: jsx_runtime_1.jsx("path", { d: "M4.405 4.48C4.575 3.82 4.865 3.325 5.275 2.995C5.695 2.665 6.25 2.5 6.94 2.5H9.235V4.06H7.045C6.555 4.06 6.235 4.3 6.085 4.78L5.83 5.68H7.975V7.255H5.395L3.805 13H2.02L3.625 7.255H1.96V5.68H4.075L4.405 4.48ZM8.57102 9.085L6.87602 5.68H8.79602L9.86102 7.99L11.991 5.68H14.331L10.686 9.415L12.426 13H10.491L9.35102 10.585L7.02602 13H4.68602L8.57102 9.085Z", fill: "white" }) }));
43
+ }
37
44
  return (jsx_runtime_1.jsx("svg", { style: eyeIcon, viewBox: "0 0 24 16", fill: "none", children: jsx_runtime_1.jsx("path", { d: "M24 7.551C24 7.551 19.748 16 12.015 16C4.835 16 0 7.551 0 7.551C0 7.551 4.446 0 12.015 0C19.709 0 24 7.551 24 7.551ZM17 8C17 5.243 14.757 3 12 3C9.243 3 7 5.243 7 8C7 10.757 9.243 13 12 13C14.757 13 17 10.757 17 8Z", fill: color }) }));
38
45
  }, [hidden, type]);
39
46
  const onPointerDown = (0, react_1.useCallback)((e) => {
@@ -54,3 +61,13 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
54
61
  return (jsx_runtime_1.jsx("div", { style: container, onPointerEnter: onPointerEnter, onPointerDown: onPointerDown, children: renderAction(colors_1.LIGHT_COLOR) }));
55
62
  };
56
63
  exports.TimelineLayerEye = TimelineLayerEye;
64
+ const spacerStyle = {
65
+ width: 16,
66
+ height: 16,
67
+ marginRight: 6,
68
+ flexShrink: 0,
69
+ };
70
+ const TimelineLayerEyeSpacer = () => {
71
+ return jsx_runtime_1.jsx("div", { style: spacerStyle });
72
+ };
73
+ exports.TimelineLayerEyeSpacer = TimelineLayerEyeSpacer;
@@ -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 = exports.INDENT = void 0;
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,22 +11,24 @@ 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");
14
+ const save_sequence_prop_1 = require("./save-sequence-prop");
15
15
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
16
16
  const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
17
17
  const TimelineLayerEye_1 = require("./TimelineLayerEye");
18
+ const TimelineRowChrome_1 = require("./TimelineRowChrome");
18
19
  const TimelineStack_1 = require("./TimelineStack");
19
- const use_resolved_stack_1 = require("./use-resolved-stack");
20
- exports.INDENT = 10;
20
+ const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
21
21
  const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) => {
22
- var _a, _b;
23
- const nodePath = (_a = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _a !== void 0 ? _a : null;
22
+ var _a;
23
+ var _b;
24
+ const nodePath = (_b = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _b !== void 0 ? _b : null;
24
25
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
25
26
  const previewConnected = previewServerState.type === 'connected';
26
- const { hidden, setHidden } = (0, react_1.useContext)(remotion_1.Internals.SequenceVisibilityToggleContext);
27
27
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
28
28
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
29
- const originalLocation = (0, use_resolved_stack_1.useResolvedStack)((_b = sequence.stack) !== null && _b !== void 0 ? _b : null);
29
+ const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
30
+ const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
31
+ const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(sequence.getStack);
30
32
  const validatedLocation = (0, react_1.useMemo)(() => {
31
33
  var _a;
32
34
  if (!originalLocation ||
@@ -155,18 +157,56 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
155
157
  }
156
158
  toggleTrack(nodePathInfo);
157
159
  }, [nodePathInfo, toggleTrack]);
160
+ const codeValuesForOverride = (0, react_1.useMemo)(() => {
161
+ return nodePath
162
+ ? remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)
163
+ : undefined;
164
+ }, [codeValues, nodePath]);
165
+ const codeHiddenStatus = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride.hidden;
158
166
  const isItemHidden = (0, react_1.useMemo)(() => {
159
167
  var _a;
160
- return (_a = hidden[sequence.id]) !== null && _a !== void 0 ? _a : false;
161
- }, [hidden, sequence.id]);
168
+ const codeValue = codeHiddenStatus && codeHiddenStatus.canUpdate
169
+ ? codeHiddenStatus.codeValue
170
+ : undefined;
171
+ const runtimeValue = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.currentRuntimeValueDotNotation.hidden;
172
+ const effective = (codeValue !== null && codeValue !== void 0 ? codeValue : runtimeValue);
173
+ return effective !== null && effective !== void 0 ? effective : false;
174
+ }, [codeHiddenStatus, (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.currentRuntimeValueDotNotation]);
162
175
  const onToggleVisibility = (0, react_1.useCallback)((type) => {
163
- setHidden((prev) => {
164
- return {
165
- ...prev,
166
- [sequence.id]: type !== 'enable',
167
- };
176
+ if (!sequence.controls ||
177
+ !nodePath ||
178
+ !validatedLocation ||
179
+ !codeValuesForOverride ||
180
+ !codeHiddenStatus ||
181
+ !codeHiddenStatus.canUpdate ||
182
+ previewServerState.type !== 'connected') {
183
+ return;
184
+ }
185
+ const newValue = type !== 'enable';
186
+ const { schema } = sequence.controls;
187
+ const fieldSchema = schema.hidden;
188
+ const defaultValue = fieldSchema && fieldSchema.type === 'boolean'
189
+ ? JSON.stringify(fieldSchema.default)
190
+ : null;
191
+ (0, save_sequence_prop_1.saveSequenceProp)({
192
+ fileName: validatedLocation.source,
193
+ nodePath,
194
+ fieldKey: 'hidden',
195
+ value: newValue,
196
+ defaultValue,
197
+ schema,
198
+ setCodeValues,
199
+ clientId: previewServerState.clientId,
168
200
  });
169
- }, [sequence.id, setHidden]);
201
+ }, [
202
+ codeHiddenStatus,
203
+ codeValuesForOverride,
204
+ nodePath,
205
+ previewServerState,
206
+ sequence.controls,
207
+ setCodeValues,
208
+ validatedLocation,
209
+ ]);
170
210
  const outer = (0, react_1.useMemo)(() => {
171
211
  return {
172
212
  height: (0, timeline_layout_1.getTimelineLayerHeight)(sequence.type) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
@@ -179,18 +219,19 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
179
219
  height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO,
180
220
  color: 'white',
181
221
  fontFamily: 'Arial, Helvetica, sans-serif',
182
- display: 'flex',
183
- flexDirection: 'row',
184
- alignItems: 'center',
185
222
  wordBreak: 'break-all',
186
223
  textAlign: 'left',
187
- paddingLeft: 5,
188
224
  };
189
225
  }, []);
190
226
  const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
191
- const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsxs("div", { style: inner, children: [
192
- jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility }), jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth }), previewConnected ? (hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}))) : null, jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation })
193
- ] }) }));
227
+ const canToggleVisibility = previewConnected &&
228
+ Boolean(sequence.controls) &&
229
+ nodePath !== null &&
230
+ validatedLocation !== null &&
231
+ codeHiddenStatus !== undefined &&
232
+ codeHiddenStatus !== null &&
233
+ codeHiddenStatus.canUpdate;
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 }) }) }));
194
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 &&
195
236
  isExpanded &&
196
237
  hasExpandableContent &&
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare const TimelineRowChrome: React.FC<{
3
+ readonly depth: number;
4
+ readonly eye: React.ReactNode;
5
+ readonly arrow: React.ReactNode;
6
+ readonly children: React.ReactNode;
7
+ readonly style?: React.CSSProperties;
8
+ }>;
@@ -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: {
@@ -0,0 +1,13 @@
1
+ import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
2
+ import type { SetCodeValues } from './save-sequence-prop';
3
+ export declare const saveEffectProp: ({ fileName, nodePath, effectIndex, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }: {
4
+ fileName: string;
5
+ nodePath: SequencePropsSubscriptionKey;
6
+ effectIndex: number;
7
+ fieldKey: string;
8
+ value: unknown;
9
+ defaultValue: string | null;
10
+ schema: SequenceSchema;
11
+ setCodeValues: SetCodeValues;
12
+ clientId: string;
13
+ }) => Promise<void>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveEffectProp = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ const call_api_1 = require("../call-api");
6
+ const save_prop_queue_1 = require("./save-prop-queue");
7
+ const saveEffectProp = ({ fileName, nodePath, effectIndex, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }) => {
8
+ return (0, save_prop_queue_1.enqueueSavePropChange)({
9
+ nodePath,
10
+ setCodeValues,
11
+ applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForEffectCodeValues)({
12
+ previous: prev,
13
+ effectIndex,
14
+ fieldKey,
15
+ value,
16
+ schema,
17
+ }),
18
+ apiCall: () => (0, call_api_1.callApi)('/api/save-effect-props', {
19
+ fileName,
20
+ sequenceNodePath: nodePath,
21
+ effectIndex,
22
+ key: fieldKey,
23
+ value: JSON.stringify(value),
24
+ defaultValue,
25
+ schema,
26
+ clientId,
27
+ }),
28
+ errorLabel: 'Could not save effect prop',
29
+ });
30
+ };
31
+ exports.saveEffectProp = saveEffectProp;
@@ -0,0 +1,11 @@
1
+ import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey } from 'remotion';
2
+ type SetCodeValues = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
3
+ export type EnqueueSaveOptions<TResponse> = {
4
+ nodePath: SequencePropsSubscriptionKey;
5
+ setCodeValues: SetCodeValues;
6
+ applyOptimistic: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse;
7
+ apiCall: () => Promise<TResponse>;
8
+ errorLabel: string;
9
+ };
10
+ export declare const enqueueSavePropChange: <TResponse>({ nodePath, setCodeValues, applyOptimistic, apiCall, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
11
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enqueueSavePropChange = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
6
+ const queues = new Map();
7
+ const getQueue = (nodePath) => {
8
+ const key = remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath);
9
+ let q = queues.get(key);
10
+ if (!q) {
11
+ q = { chain: Promise.resolve(), cancelled: false };
12
+ queues.set(key, q);
13
+ }
14
+ return q;
15
+ };
16
+ const dropQueue = (nodePath, q) => {
17
+ const key = remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath);
18
+ if (queues.get(key) === q) {
19
+ queues.delete(key);
20
+ }
21
+ };
22
+ const enqueueSavePropChange = ({ nodePath, setCodeValues, applyOptimistic, apiCall, errorLabel, }) => {
23
+ const q = getQueue(nodePath);
24
+ if (q.cancelled) {
25
+ return Promise.resolve();
26
+ }
27
+ setCodeValues(nodePath, (prev) => {
28
+ return applyOptimistic(prev);
29
+ });
30
+ const myQueue = q;
31
+ const next = myQueue.chain.then(async () => {
32
+ if (myQueue.cancelled) {
33
+ return;
34
+ }
35
+ try {
36
+ await apiCall();
37
+ if (myQueue.cancelled) {
38
+ return;
39
+ }
40
+ // If nothing more is queued, reset baseline so the next round starts fresh.
41
+ if (myQueue.chain === next) {
42
+ dropQueue(nodePath, myQueue);
43
+ }
44
+ }
45
+ catch (err) {
46
+ myQueue.cancelled = true;
47
+ dropQueue(nodePath, myQueue);
48
+ (0, NotificationCenter_1.showNotification)(`${errorLabel}: ${err instanceof Error ? err.message : String(err)}`, 4000);
49
+ }
50
+ });
51
+ myQueue.chain = next;
52
+ return next;
53
+ };
54
+ exports.enqueueSavePropChange = enqueueSavePropChange;
@@ -0,0 +1,12 @@
1
+ import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
2
+ export type SetCodeValues = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
3
+ export declare const saveSequenceProp: ({ fileName, nodePath, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }: {
4
+ fileName: string;
5
+ nodePath: SequencePropsSubscriptionKey;
6
+ fieldKey: string;
7
+ value: unknown;
8
+ defaultValue: string | null;
9
+ schema: SequenceSchema;
10
+ setCodeValues: SetCodeValues;
11
+ clientId: string;
12
+ }) => Promise<void>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveSequenceProp = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ const call_api_1 = require("../call-api");
6
+ const save_prop_queue_1 = require("./save-prop-queue");
7
+ const saveSequenceProp = ({ fileName, nodePath, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }) => {
8
+ return (0, save_prop_queue_1.enqueueSavePropChange)({
9
+ nodePath,
10
+ setCodeValues,
11
+ applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForCodeValues)({
12
+ previous: prev,
13
+ fieldKey,
14
+ value,
15
+ schema,
16
+ }),
17
+ apiCall: () => (0, call_api_1.callApi)('/api/save-sequence-props', {
18
+ fileName,
19
+ nodePath,
20
+ key: fieldKey,
21
+ value: JSON.stringify(value),
22
+ defaultValue,
23
+ schema,
24
+ clientId,
25
+ }),
26
+ errorLabel: 'Could not save sequence prop',
27
+ });
28
+ };
29
+ exports.saveSequenceProp = saveSequenceProp;
@@ -0,0 +1,2 @@
1
+ import type { TrackWithHash } from '../../helpers/get-timeline-sequence-sort-key';
2
+ export declare const shouldShowTrackInTimeline: (track: TrackWithHash, durationInFrames: number) => boolean;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldShowTrackInTimeline = void 0;
4
+ // A track is shown in the timeline list when:
5
+ // - The sequence opted-in via `showInTimeline` (the default).
6
+ // Children of a sequence with `showInTimeline: false` keep being listed
7
+ // on their own; their depth is independently flattened by
8
+ // `getTimelineNestedLevel` so the parent does not contribute an indent.
9
+ // - The sequence has a positive duration.
10
+ // - The sequence starts before the composition ends.
11
+ const shouldShowTrackInTimeline = (track, durationInFrames) => {
12
+ if (!track.sequence.showInTimeline) {
13
+ return false;
14
+ }
15
+ if (track.sequence.duration <= 0) {
16
+ return false;
17
+ }
18
+ if (track.sequence.from > durationInFrames) {
19
+ return false;
20
+ }
21
+ return true;
22
+ };
23
+ exports.shouldShowTrackInTimeline = shouldShowTrackInTimeline;
@@ -0,0 +1,2 @@
1
+ import type React from 'react';
2
+ export declare const getTimelineFieldLabelRowStyle: (depth: number) => React.CSSProperties;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimelineFieldLabelRowStyle = void 0;
4
+ const timeline_row_layout_1 = require("./timeline-row-layout");
5
+ const getTimelineFieldLabelRowStyle = (depth) => {
6
+ return {
7
+ flex: `0 0 ${(0, timeline_row_layout_1.getTimelineFieldLabelFlexBasis)(depth)}`,
8
+ display: 'flex',
9
+ flexDirection: 'row',
10
+ alignItems: 'center',
11
+ gap: 6,
12
+ };
13
+ };
14
+ exports.getTimelineFieldLabelRowStyle = getTimelineFieldLabelRowStyle;
@@ -0,0 +1 @@
1
+ export declare const TIMELINE_INDENT = 10;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TIMELINE_INDENT = void 0;
4
+ exports.TIMELINE_INDENT = 10;