@remotion/studio 4.0.460 → 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 (86) hide show
  1. package/dist/Studio.d.ts +0 -1
  2. package/dist/Studio.js +4 -4
  3. package/dist/components/AudioWaveform.js +17 -9
  4. package/dist/components/ExpandedTracksProvider.js +8 -3
  5. package/dist/components/MenuBuildIndicator.js +1 -1
  6. package/dist/components/MenuCompositionName.js +1 -0
  7. package/dist/components/RenderButton.js +1 -1
  8. package/dist/components/Timeline/SequencePropsObserver.js +1 -1
  9. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +4 -3
  10. package/dist/components/Timeline/SubscribeToNodePaths.js +11 -1
  11. package/dist/components/Timeline/Timeline.js +11 -10
  12. package/dist/components/Timeline/TimelineBooleanField.d.ts +4 -4
  13. package/dist/components/Timeline/TimelineBooleanField.js +5 -5
  14. package/dist/components/Timeline/TimelineColorField.d.ts +11 -0
  15. package/dist/components/Timeline/TimelineColorField.js +181 -0
  16. package/dist/components/Timeline/TimelineDragHandler.js +37 -3
  17. package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +11 -0
  18. package/dist/components/Timeline/TimelineEffectFieldRow.js +177 -0
  19. package/dist/components/Timeline/TimelineEnumField.d.ts +5 -5
  20. package/dist/components/Timeline/TimelineEnumField.js +7 -7
  21. package/dist/components/Timeline/TimelineExpandArrowButton.js +1 -1
  22. package/dist/components/Timeline/TimelineExpandedRow.d.ts +3 -3
  23. package/dist/components/Timeline/TimelineExpandedRow.js +8 -1
  24. package/dist/components/Timeline/TimelineExpandedSection.d.ts +2 -2
  25. package/dist/components/Timeline/TimelineExpandedSection.js +8 -21
  26. package/dist/components/Timeline/TimelineFieldRow.d.ts +3 -3
  27. package/dist/components/Timeline/TimelineFieldRow.js +65 -26
  28. package/dist/components/Timeline/TimelineHeightContainer.d.ts +1 -1
  29. package/dist/components/Timeline/TimelineHeightContainer.js +36 -3
  30. package/dist/components/Timeline/TimelineListItem.js +20 -18
  31. package/dist/components/Timeline/TimelineNumberField.d.ts +5 -5
  32. package/dist/components/Timeline/TimelineNumberField.js +12 -10
  33. package/dist/components/Timeline/TimelineRotationField.d.ts +5 -5
  34. package/dist/components/Timeline/TimelineRotationField.js +10 -10
  35. package/dist/components/Timeline/TimelineSchemaField.d.ts +11 -7
  36. package/dist/components/Timeline/TimelineSchemaField.js +27 -21
  37. package/dist/components/Timeline/TimelineSequence.js +2 -2
  38. package/dist/components/Timeline/TimelineSlider.js +2 -2
  39. package/dist/components/Timeline/TimelineStack/get-stack.js +17 -31
  40. package/dist/components/Timeline/TimelineStack/index.js +0 -10
  41. package/dist/components/Timeline/TimelineTimeIndicators.js +2 -2
  42. package/dist/components/Timeline/TimelineTracks.d.ts +1 -1
  43. package/dist/components/Timeline/TimelineTracks.js +42 -12
  44. package/dist/components/Timeline/TimelineTranslateField.d.ts +5 -5
  45. package/dist/components/Timeline/TimelineTranslateField.js +21 -37
  46. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
  47. package/dist/components/Timeline/sequence-props-subscription-store.js +11 -5
  48. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +2 -1
  49. package/dist/components/Timeline/use-sequence-props-subscription.js +6 -4
  50. package/dist/components/Timeline/use-timeline-height.js +5 -14
  51. package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +3 -3
  52. package/dist/error-overlay/react-overlay/utils/get-source-map.js +5 -5
  53. package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -6
  54. package/dist/error-overlay/react-overlay/utils/unmapper.js +8 -1
  55. package/dist/esm/{chunk-nrgs0ad5.js → chunk-yvg1f56k.js} +4168 -3948
  56. package/dist/esm/index.mjs +20 -8
  57. package/dist/esm/internals.mjs +4168 -3948
  58. package/dist/esm/previewEntry.mjs +2913 -2705
  59. package/dist/esm/renderEntry.mjs +2 -5
  60. package/dist/helpers/calculate-timeline.js +34 -4
  61. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +4 -2
  62. package/dist/helpers/timeline-layout.d.ts +11 -15
  63. package/dist/helpers/timeline-layout.js +36 -28
  64. package/dist/icons/eyedropper.d.ts +4 -0
  65. package/dist/icons/eyedropper.js +6 -0
  66. package/dist/internals.d.ts +0 -1
  67. package/dist/previewEntry.js +1 -1
  68. package/dist/renderEntry.js +3 -3
  69. package/package.json +14 -24
  70. package/dist/audio-waveform-worker.d.ts +0 -1
  71. package/dist/audio-waveform-worker.js +0 -102
  72. package/dist/components/audio-waveform-worker-types.d.ts +0 -28
  73. package/dist/components/audio-waveform-worker-types.js +0 -2
  74. package/dist/components/draw-peaks.d.ts +0 -1
  75. package/dist/components/draw-peaks.js +0 -68
  76. package/dist/components/load-waveform-peaks.d.ts +0 -13
  77. package/dist/components/load-waveform-peaks.js +0 -76
  78. package/dist/components/parse-color.d.ts +0 -1
  79. package/dist/components/parse-color.js +0 -17
  80. package/dist/components/slice-waveform-peaks.d.ts +0 -7
  81. package/dist/components/slice-waveform-peaks.js +0 -15
  82. package/dist/components/waveform-peak-processor.d.ts +0 -23
  83. package/dist/components/waveform-peak-processor.js +0 -77
  84. package/dist/esm/audio-waveform-worker.mjs +0 -346
  85. package/dist/make-audio-waveform-worker.d.ts +0 -1
  86. package/dist/make-audio-waveform-worker.js +0 -10
@@ -20,15 +20,12 @@ const use_resolved_stack_1 = require("./use-resolved-stack");
20
20
  exports.INDENT = 10;
21
21
  const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) => {
22
22
  var _a, _b;
23
- const nodePath = (_a = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.nodePath) !== null && _a !== void 0 ? _a : null;
23
+ const nodePath = (_a = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _a !== void 0 ? _a : null;
24
24
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
25
- const visualModeEnvEnabled = Boolean(process.env.EXPERIMENTAL_VISUAL_MODE_ENABLED);
26
25
  const previewConnected = previewServerState.type === 'connected';
27
- const visualModeActive = visualModeEnvEnabled && previewConnected;
28
26
  const { hidden, setHidden } = (0, react_1.useContext)(remotion_1.Internals.SequenceVisibilityToggleContext);
29
27
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
30
28
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
31
- const { getIsJsxInMapCallback } = (0, react_1.useContext)(remotion_1.Internals.VisualModeGettersContext);
32
29
  const originalLocation = (0, use_resolved_stack_1.useResolvedStack)((_b = sequence.stack) !== null && _b !== void 0 ? _b : null);
33
30
  const validatedLocation = (0, react_1.useMemo)(() => {
34
31
  var _a;
@@ -50,8 +47,10 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
50
47
  if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
51
48
  return;
52
49
  }
53
- if (getIsJsxInMapCallback(nodePath)) {
54
- const message = 'This sequence is rendered inside a .map() callback. Duplicating inserts another copy in that callback (affecting each list item). Continue?';
50
+ if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
51
+ const message = 'This sequence is programmatically duplicated ' +
52
+ nodePathInfo.numberOfSequencesWithThisNodePath +
53
+ ' times in the code. Duplicating inserts another copy. Continue?';
55
54
  // eslint-disable-next-line no-alert -- native confirm before applying duplicate codemod in .map callbacks
56
55
  if (!window.confirm(message)) {
57
56
  return;
@@ -60,7 +59,7 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
60
59
  try {
61
60
  const result = await (0, call_api_1.callApi)('/api/duplicate-jsx-node', {
62
61
  fileName: validatedLocation.source,
63
- nodePath,
62
+ nodePath: nodePath.nodePath,
64
63
  });
65
64
  if (result.success) {
66
65
  (0, NotificationCenter_1.showNotification)('Duplicated sequence in source file', 2000);
@@ -72,13 +71,15 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
72
71
  catch (err) {
73
72
  (0, NotificationCenter_1.showNotification)(err.message, 4000);
74
73
  }
75
- }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, getIsJsxInMapCallback]);
74
+ }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
76
75
  const onDeleteSequenceFromSource = (0, react_1.useCallback)(async () => {
77
76
  if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
78
77
  return;
79
78
  }
80
- if (getIsJsxInMapCallback(nodePath)) {
81
- const message = 'This sequence is rendered inside a .map() callback. Deleting removes all sequences in that callback. Continue?';
79
+ if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
80
+ const message = 'This sequence is programmatically duplicated ' +
81
+ nodePathInfo.numberOfSequencesWithThisNodePath +
82
+ ' times in the code. Deleting removes all instances. Continue?';
82
83
  // eslint-disable-next-line no-alert -- native confirm before applying duplicate codemod in .map callbacks
83
84
  if (!window.confirm(message)) {
84
85
  return;
@@ -87,7 +88,7 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
87
88
  try {
88
89
  const result = await (0, call_api_1.callApi)('/api/delete-jsx-node', {
89
90
  fileName: validatedLocation.source,
90
- nodePath,
91
+ nodePath: nodePath.nodePath,
91
92
  });
92
93
  if (result.success) {
93
94
  (0, NotificationCenter_1.showNotification)('Removed sequence from source file', 2000);
@@ -99,9 +100,9 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
99
100
  catch (err) {
100
101
  (0, NotificationCenter_1.showNotification)(err.message, 4000);
101
102
  }
102
- }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, getIsJsxInMapCallback]);
103
+ }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
103
104
  const contextMenuValues = (0, react_1.useMemo)(() => {
104
- if (!visualModeEnvEnabled) {
105
+ if (!previewConnected) {
105
106
  return [];
106
107
  }
107
108
  return [
@@ -145,9 +146,9 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
145
146
  duplicateDisabled,
146
147
  onDeleteSequenceFromSource,
147
148
  onDuplicateSequenceFromSource,
148
- visualModeEnvEnabled,
149
+ previewConnected,
149
150
  ]);
150
- const isExpanded = visualModeActive && nodePathInfo !== null && getIsExpanded(nodePathInfo);
151
+ const isExpanded = previewConnected && nodePathInfo !== null && getIsExpanded(nodePathInfo);
151
152
  const onToggleExpand = (0, react_1.useCallback)(() => {
152
153
  if (nodePathInfo === null) {
153
154
  return;
@@ -188,11 +189,12 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
188
189
  }, []);
189
190
  const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
190
191
  const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsxs("div", { style: inner, children: [
191
- 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 }), visualModeActive ? (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 })
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 })
192
193
  ] }) }));
193
- return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [visualModeEnvEnabled ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), visualModeActive &&
194
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), previewConnected &&
194
195
  isExpanded &&
195
196
  hasExpandableContent &&
196
- nodePathInfo ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, originalLocation: originalLocation, nodePathInfo: nodePathInfo, nestedDepth: nestedDepth })) : null] }));
197
+ nodePathInfo &&
198
+ validatedLocation ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, validatedLocation: validatedLocation, nodePathInfo: nodePathInfo, nestedDepth: nestedDepth })) : null] }));
197
199
  };
198
200
  exports.TimelineListItem = TimelineListItem;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
2
+ import type { CanUpdateSequencePropStatus } from 'remotion';
3
+ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
3
4
  export declare const TimelineNumberField: React.FC<{
4
5
  readonly field: SchemaFieldInfo;
5
6
  readonly effectiveValue: unknown;
6
- readonly codeValue: unknown;
7
- readonly canUpdate: boolean;
8
- readonly onSave: (key: string, value: unknown) => Promise<void>;
9
- readonly onDragValueChange: (key: string, value: unknown) => void;
7
+ readonly propStatus: CanUpdateSequencePropStatus;
8
+ readonly onSave: TimelineFieldOnSave;
9
+ readonly onDragValueChange: TimelineFieldOnDragValueChange;
10
10
  readonly onDragEnd: () => void;
11
11
  }>;
@@ -5,16 +5,16 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const InputDragger_1 = require("../NewComposition/InputDragger");
7
7
  const timeline_field_utils_1 = require("./timeline-field-utils");
8
- const TimelineNumberField = ({ field, effectiveValue, canUpdate, onSave, onDragValueChange, onDragEnd, codeValue, }) => {
8
+ const TimelineNumberField = ({ field, effectiveValue, onSave, onDragValueChange, onDragEnd, propStatus, }) => {
9
9
  var _a, _b, _c;
10
10
  const [dragValue, setDragValue] = (0, react_1.useState)(null);
11
11
  const onValueChange = (0, react_1.useCallback)((newVal) => {
12
12
  setDragValue(newVal);
13
- onDragValueChange(field.key, newVal);
14
- }, [onDragValueChange, field.key]);
13
+ onDragValueChange(newVal);
14
+ }, [onDragValueChange]);
15
15
  const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
16
- if (canUpdate && newVal !== codeValue) {
17
- onSave(field.key, newVal).finally(() => {
16
+ if (propStatus.canUpdate && newVal !== propStatus.codeValue) {
17
+ onSave(newVal).finally(() => {
18
18
  setDragValue(null);
19
19
  onDragEnd();
20
20
  });
@@ -23,18 +23,20 @@ const TimelineNumberField = ({ field, effectiveValue, canUpdate, onSave, onDragV
23
23
  setDragValue(null);
24
24
  onDragEnd();
25
25
  }
26
- }, [canUpdate, onSave, field.key, codeValue, onDragEnd]);
26
+ }, [onSave, propStatus, onDragEnd]);
27
27
  const onTextChange = (0, react_1.useCallback)((newVal) => {
28
- if (canUpdate) {
28
+ if (propStatus.canUpdate) {
29
29
  const parsed = Number(newVal);
30
- if (!Number.isNaN(parsed) && parsed !== codeValue) {
30
+ if (!Number.isNaN(parsed) &&
31
+ propStatus.canUpdate &&
32
+ parsed !== propStatus.codeValue) {
31
33
  setDragValue(parsed);
32
- onSave(field.key, parsed).catch(() => {
34
+ onSave(parsed).finally(() => {
33
35
  setDragValue(null);
34
36
  });
35
37
  }
36
38
  }
37
- }, [canUpdate, onSave, field.key, codeValue]);
39
+ }, [onSave, propStatus]);
38
40
  const step = field.fieldSchema.type === 'number' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
39
41
  const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
40
42
  const formatter = (0, react_1.useCallback)((v) => {
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
2
+ import type { CanUpdateSequencePropStatus } from 'remotion';
3
+ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
3
4
  export declare const TimelineRotationField: React.FC<{
4
5
  readonly field: SchemaFieldInfo;
5
6
  readonly effectiveValue: unknown;
6
- readonly codeValue: unknown;
7
- readonly canUpdate: boolean;
8
- readonly onSave: (key: string, value: unknown) => Promise<void>;
9
- readonly onDragValueChange: (key: string, value: unknown) => void;
7
+ readonly propStatus: CanUpdateSequencePropStatus;
8
+ readonly onSave: TimelineFieldOnSave;
9
+ readonly onDragValueChange: TimelineFieldOnDragValueChange;
10
10
  readonly onDragEnd: () => void;
11
11
  }>;
@@ -25,18 +25,18 @@ const parseCssRotationToDegrees = (value) => {
25
25
  return 0;
26
26
  }
27
27
  };
28
- const TimelineRotationField = ({ field, effectiveValue, codeValue, canUpdate, onSave, onDragValueChange, onDragEnd, }) => {
28
+ const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
29
29
  var _a;
30
30
  const [dragValue, setDragValue] = (0, react_1.useState)(null);
31
31
  const degrees = (0, react_1.useMemo)(() => parseCssRotationToDegrees(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0deg')), [effectiveValue]);
32
32
  const onValueChange = (0, react_1.useCallback)((newVal) => {
33
33
  setDragValue(newVal);
34
- onDragValueChange(field.key, `${newVal}deg`);
35
- }, [onDragValueChange, field.key]);
34
+ onDragValueChange(`${newVal}deg`);
35
+ }, [onDragValueChange]);
36
36
  const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
37
37
  const newStr = `${newVal}deg`;
38
- if (canUpdate && newStr !== codeValue) {
39
- onSave(field.key, newStr).finally(() => {
38
+ if (propStatus.canUpdate && newStr !== propStatus.codeValue) {
39
+ onSave(newStr).finally(() => {
40
40
  setDragValue(null);
41
41
  onDragEnd();
42
42
  });
@@ -45,21 +45,21 @@ const TimelineRotationField = ({ field, effectiveValue, codeValue, canUpdate, on
45
45
  setDragValue(null);
46
46
  onDragEnd();
47
47
  }
48
- }, [canUpdate, onSave, field.key, codeValue, onDragEnd]);
48
+ }, [propStatus, onSave, onDragEnd]);
49
49
  const onTextChange = (0, react_1.useCallback)((newVal) => {
50
- if (canUpdate) {
50
+ if (propStatus.canUpdate) {
51
51
  const parsed = Number(newVal);
52
52
  if (!Number.isNaN(parsed)) {
53
53
  const newStr = `${parsed}deg`;
54
- if (newStr !== codeValue) {
54
+ if (newStr !== propStatus.codeValue) {
55
55
  setDragValue(parsed);
56
- onSave(field.key, newStr).catch(() => {
56
+ onSave(newStr).finally(() => {
57
57
  setDragValue(null);
58
58
  });
59
59
  }
60
60
  }
61
61
  }
62
- }, [canUpdate, onSave, field.key, codeValue]);
62
+ }, [propStatus, onSave]);
63
63
  const step = field.fieldSchema.type === 'rotation' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
64
64
  const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
65
65
  const formatter = (0, react_1.useCallback)((v) => {
@@ -1,13 +1,17 @@
1
1
  import React from 'react';
2
- import type { CanUpdateSequencePropStatus } from 'remotion';
3
- import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
2
+ import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusTrue } from 'remotion';
3
+ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
4
+ export declare const UnsupportedStatus: React.FC<{
5
+ readonly label: string;
6
+ }>;
7
+ export declare const TimelineNonEditableStatus: React.FC<{
8
+ readonly propStatus: CanUpdateSequencePropStatusFalse;
9
+ }>;
4
10
  export declare const TimelineFieldValue: React.FC<{
5
11
  readonly field: SchemaFieldInfo;
6
- readonly onSave: (key: string, value: unknown) => Promise<void>;
7
- readonly onDragValueChange: (key: string, value: unknown) => void;
12
+ readonly onSave: TimelineFieldOnSave;
13
+ readonly onDragValueChange: TimelineFieldOnDragValueChange;
8
14
  readonly onDragEnd: () => void;
9
- readonly canUpdate: boolean;
10
- readonly propStatus: CanUpdateSequencePropStatus | null;
11
- readonly codeValue: unknown;
15
+ readonly propStatus: CanUpdateSequencePropStatusTrue;
12
16
  readonly effectiveValue: unknown;
13
17
  }>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineFieldValue = void 0;
3
+ exports.TimelineFieldValue = exports.TimelineNonEditableStatus = exports.UnsupportedStatus = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const TimelineBooleanField_1 = require("./TimelineBooleanField");
6
+ const TimelineColorField_1 = require("./TimelineColorField");
6
7
  const TimelineEnumField_1 = require("./TimelineEnumField");
7
8
  const TimelineNumberField_1 = require("./TimelineNumberField");
8
9
  const TimelineRotationField_1 = require("./TimelineRotationField");
@@ -20,37 +21,42 @@ const notEditableBackground = {
20
21
  const inlineWrapper = {
21
22
  fontSize: 12,
22
23
  };
23
- const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, canUpdate, effectiveValue, codeValue, }) => {
24
- const wrapperStyle = canUpdate === null || canUpdate === false
25
- ? notEditableBackground
26
- : undefined;
27
- if (!field.supported) {
28
- return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "unsupported" });
29
- }
30
- if (propStatus !== null && !propStatus.canUpdate) {
31
- if (propStatus.reason === 'computed') {
32
- return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "computed" });
33
- }
34
- throw new Error(`Unsupported prop status: ${propStatus.reason}`);
24
+ const UnsupportedStatus = ({ label }) => {
25
+ return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: label });
26
+ };
27
+ exports.UnsupportedStatus = UnsupportedStatus;
28
+ const TimelineNonEditableStatus = ({ propStatus }) => {
29
+ if (propStatus.canUpdate) {
30
+ return null;
35
31
  }
36
- if (propStatus === null) {
37
- return (jsx_runtime_1.jsx("span", { style: notEditableBackground, children: jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "error" }) }));
32
+ if (propStatus.reason === 'computed') {
33
+ return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "computed" });
38
34
  }
35
+ throw new Error(`Unsupported prop status: ${propStatus.reason}`);
36
+ };
37
+ exports.TimelineNonEditableStatus = TimelineNonEditableStatus;
38
+ const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, effectiveValue, }) => {
39
+ const wrapperStyle = !propStatus.canUpdate
40
+ ? notEditableBackground
41
+ : undefined;
39
42
  if (field.typeName === 'number') {
40
- return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { field: field, effectiveValue: effectiveValue, canUpdate: canUpdate, onSave: onSave, codeValue: codeValue, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
43
+ return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { field: field, effectiveValue: effectiveValue, onSave: onSave, propStatus: propStatus, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
41
44
  }
42
45
  if (field.typeName === 'rotation') {
43
- return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineRotationField_1.TimelineRotationField, { field: field, effectiveValue: effectiveValue, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
46
+ return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineRotationField_1.TimelineRotationField, { field: field, effectiveValue: effectiveValue, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
44
47
  }
45
48
  if (field.typeName === 'translate') {
46
- return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineTranslateField_1.TimelineTranslateField, { field: field, effectiveValue: effectiveValue, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
49
+ return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineTranslateField_1.TimelineTranslateField, { field: field, effectiveValue: effectiveValue, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
47
50
  }
48
51
  if (field.typeName === 'boolean') {
49
- return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { field: field, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, effectiveValue: effectiveValue }) }));
52
+ return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { field: field, propStatus: propStatus, onSave: onSave, effectiveValue: effectiveValue }) }));
53
+ }
54
+ if (field.typeName === 'color') {
55
+ return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineColorField_1.TimelineColorField, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }) }));
50
56
  }
51
57
  if (field.typeName === 'enum') {
52
- return (jsx_runtime_1.jsx("span", { style: inlineWrapper, children: jsx_runtime_1.jsx(TimelineEnumField_1.TimelineEnumField, { field: field, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, effectiveValue: effectiveValue, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
58
+ return (jsx_runtime_1.jsx("span", { style: inlineWrapper, children: jsx_runtime_1.jsx(TimelineEnumField_1.TimelineEnumField, { field: field, propStatus: propStatus, onSave: onSave, effectiveValue: effectiveValue, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
53
59
  }
54
- return (jsx_runtime_1.jsx("span", { style: { ...unsupportedLabel, fontStyle: 'normal' }, children: String(effectiveValue) }));
60
+ throw new Error(`Unsupported field type: ${field.typeName}`);
55
61
  };
56
62
  exports.TimelineFieldValue = TimelineFieldValue;
@@ -55,7 +55,7 @@ const TimelineSequenceFn = ({ s }) => {
55
55
  if (windowWidth === null) {
56
56
  return null;
57
57
  }
58
- return jsx_runtime_1.jsx(Inner, { windowWidth: windowWidth, s: s });
58
+ return jsx_runtime_1.jsx(TimelineSequenceInner, { windowWidth: windowWidth, s: s });
59
59
  };
60
60
  const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidth, postmountWidth, style, children, }) => {
61
61
  var _a, _b;
@@ -111,7 +111,7 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidt
111
111
  alignItems: 'center',
112
112
  }, children: jsx_runtime_1.jsx(TimelineSequenceFrame_1.TimelineSequenceFrame, { premounted: isPremounting, postmounted: isPostmounting ? s.duration - 1 : null, roundedFrame: roundedFrame }) })) : null] }));
113
113
  };
114
- const Inner = ({ s, windowWidth }) => {
114
+ const TimelineSequenceInner = ({ s, windowWidth }) => {
115
115
  // If a duration is 1, it is essentially a still and it should have width 0
116
116
  // Some compositions may not be longer than their media duration,
117
117
  // if that is the case, it needs to be asynchronously determined
@@ -29,10 +29,10 @@ const TimelineSlider = () => {
29
29
  if (videoConfig === null || timelineWidth === null) {
30
30
  return null;
31
31
  }
32
- return jsx_runtime_1.jsx(Inner, {});
32
+ return jsx_runtime_1.jsx(TimelineSliderInner, {});
33
33
  };
34
34
  exports.TimelineSlider = TimelineSlider;
35
- const Inner = () => {
35
+ const TimelineSliderInner = () => {
36
36
  var _a;
37
37
  const videoConfig = (0, remotion_1.useVideoConfig)();
38
38
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
@@ -1,43 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOriginalLocationFromStack = void 0;
4
- const source_map_1 = require("source-map");
4
+ const trace_mapping_1 = require("@jridgewell/trace-mapping");
5
5
  const get_source_map_1 = require("../../../error-overlay/react-overlay/utils/get-source-map");
6
6
  const get_location_of_sequence_1 = require("../../../helpers/get-location-of-sequence");
7
- const waiters = [];
8
- const sourceMapConsumerCache = {};
9
- const isCreating = {};
7
+ const traceMapCache = {};
8
+ const traceMapPromises = {};
10
9
  const getSourceMapCache = async (fileName) => {
11
- if (sourceMapConsumerCache[fileName]) {
12
- return sourceMapConsumerCache[fileName];
10
+ if (traceMapCache[fileName]) {
11
+ return traceMapCache[fileName];
13
12
  }
14
- if (isCreating[fileName]) {
15
- return new Promise((resolve) => {
16
- waiters.push({
17
- id: String(Math.random()),
18
- forFileName: fileName,
19
- resolve,
20
- });
21
- });
13
+ if (traceMapPromises[fileName]) {
14
+ return traceMapPromises[fileName];
22
15
  }
23
- isCreating[fileName] = true;
24
- const res = await fetch(`${fileName}.map`);
25
- const json = await res.json();
26
- const map = await new Promise((resolve) => {
27
- source_map_1.SourceMapConsumer.with(json, null, (consumer) => {
28
- resolve(consumer);
29
- });
16
+ traceMapPromises[fileName] = fetch(`${fileName}.map`)
17
+ .then((res) => res.json())
18
+ .then((json) => {
19
+ const map = new trace_mapping_1.TraceMap(json);
20
+ traceMapCache[fileName] = map;
21
+ return map;
22
+ })
23
+ .finally(() => {
24
+ delete traceMapPromises[fileName];
30
25
  });
31
- waiters.filter((w) => {
32
- if (w.forFileName === fileName) {
33
- w.resolve(map);
34
- return false;
35
- }
36
- return true;
37
- });
38
- sourceMapConsumerCache[fileName] = map;
39
- isCreating[fileName] = false;
40
- return map;
26
+ return traceMapPromises[fileName];
41
27
  };
42
28
  const getOriginalLocationFromStack = async (stack, type) => {
43
29
  const location = type === 'sequence'
@@ -2,9 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineStack = 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
- const source_map_1 = require("source-map");
8
6
  const client_id_1 = require("../../../helpers/client-id");
9
7
  const colors_1 = require("../../../helpers/colors");
10
8
  const get_git_menu_item_1 = require("../../../helpers/get-git-menu-item");
@@ -15,14 +13,6 @@ const layout_1 = require("../../layout");
15
13
  const NotificationCenter_1 = require("../../Notifications/NotificationCenter");
16
14
  const Spinner_1 = require("../../Spinner");
17
15
  const source_attribution_1 = require("./source-attribution");
18
- const publicPath = window.remotion_publicPath === '/' ? '' : window.remotion_publicPath;
19
- const withoutSlashInTheEnd = publicPath.endsWith('/')
20
- ? publicPath.slice(0, -1)
21
- : publicPath;
22
- // @ts-expect-error
23
- source_map_1.SourceMapConsumer.initialize({
24
- 'lib/mappings.wasm': withoutSlashInTheEnd + studio_shared_1.SOURCE_MAP_ENDPOINT,
25
- });
26
16
  const TimelineStack = ({ isCompact, sequence, originalLocation }) => {
27
17
  const [stackHovered, setStackHovered] = (0, react_1.useState)(false);
28
18
  const [titleHovered, setTitleHovered] = (0, react_1.useState)(false);
@@ -69,10 +69,10 @@ const TimelineTimeIndicators = () => {
69
69
  if (video === null) {
70
70
  return null;
71
71
  }
72
- return (jsx_runtime_1.jsx(Inner, { durationInFrames: video.durationInFrames, fps: video.fps, windowWidth: sliderTrack }));
72
+ return (jsx_runtime_1.jsx(TimelineTimeIndicatorsInner, { durationInFrames: video.durationInFrames, fps: video.fps, windowWidth: sliderTrack }));
73
73
  };
74
74
  exports.TimelineTimeIndicators = TimelineTimeIndicators;
75
- const Inner = ({ windowWidth, durationInFrames, fps }) => {
75
+ const TimelineTimeIndicatorsInner = ({ windowWidth, durationInFrames, fps }) => {
76
76
  const ref = (0, react_1.useRef)(null);
77
77
  (0, react_1.useEffect)(() => {
78
78
  const currentRef = ref.current;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { TrackWithHash } from '../../helpers/get-timeline-sequence-sort-key';
3
- export declare const TimelineTracks: React.FC<{
3
+ export declare const TimelineTracks: React.NamedExoticComponent<{
4
4
  readonly timeline: TrackWithHash[];
5
5
  readonly hasBeenCut: boolean;
6
6
  }>;
@@ -1,8 +1,41 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.TimelineTracks = void 0;
4
37
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
38
+ const react_1 = __importStar(require("react"));
6
39
  const remotion_1 = require("remotion");
7
40
  const client_id_1 = require("../../helpers/client-id");
8
41
  const timeline_layout_1 = require("../../helpers/timeline-layout");
@@ -19,21 +52,19 @@ const content = {
19
52
  const timelineContent = {
20
53
  minHeight: '100%',
21
54
  };
22
- const getExpandedPlaceholderStyle = ({ sequence, nodePathInfo, getIsExpanded, getDragOverrides, getCodeValues, }) => ({
55
+ const getExpandedPlaceholderStyle = ({ sequence, nodePathInfo, getIsExpanded, codeValues, }) => ({
23
56
  height: (0, timeline_layout_1.getExpandedTrackHeight)({
24
57
  sequence,
25
58
  nodePathInfo,
26
59
  getIsExpanded,
27
- getDragOverrides,
28
- getCodeValues,
60
+ codeValues,
29
61
  }) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
30
62
  });
31
- const TimelineTracks = ({ timeline, hasBeenCut }) => {
63
+ const TimelineTracksInner = ({ timeline, hasBeenCut }) => {
32
64
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
33
65
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
34
- const { getDragOverrides, getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeGettersContext);
35
- const visualModeEnabled = Boolean(process.env.EXPERIMENTAL_VISUAL_MODE_ENABLED) &&
36
- previewServerState.type === 'connected';
66
+ const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
67
+ const previewServerConnected = previewServerState.type === 'connected';
37
68
  const timelineStyle = (0, react_1.useMemo)(() => {
38
69
  return {
39
70
  ...timelineContent,
@@ -51,13 +82,12 @@ const TimelineTracks = ({ timeline, hasBeenCut }) => {
51
82
  jsx_runtime_1.jsx("div", { style: {
52
83
  height: (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type),
53
84
  marginBottom: timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
54
- }, children: jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence }) }), visualModeEnabled && isExpanded && track.nodePathInfo ? (jsx_runtime_1.jsx("div", { style: getExpandedPlaceholderStyle({
85
+ }, children: jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence }) }), isExpanded && track.nodePathInfo && previewServerConnected ? (jsx_runtime_1.jsx("div", { style: getExpandedPlaceholderStyle({
55
86
  sequence: track.sequence,
56
87
  nodePathInfo: track.nodePathInfo,
57
88
  getIsExpanded,
58
- getDragOverrides,
59
- getCodeValues,
89
+ codeValues,
60
90
  }) })) : null] }, track.sequence.id));
61
91
  })] }), hasBeenCut ? jsx_runtime_1.jsx(MaxTimelineTracks_1.MaxTimelineTracksReached, {}) : null] }));
62
92
  };
63
- exports.TimelineTracks = TimelineTracks;
93
+ exports.TimelineTracks = react_1.default.memo(TimelineTracksInner);
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
2
+ import type { CanUpdateSequencePropStatus } from 'remotion';
3
+ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
3
4
  export declare const TimelineTranslateField: React.FC<{
4
5
  readonly field: SchemaFieldInfo;
5
- readonly codeValue: unknown;
6
+ readonly propStatus: CanUpdateSequencePropStatus;
6
7
  readonly effectiveValue: unknown;
7
- readonly canUpdate: boolean;
8
- readonly onSave: (key: string, value: unknown) => Promise<void>;
9
- readonly onDragValueChange: (key: string, value: unknown) => void;
8
+ readonly onSave: TimelineFieldOnSave;
9
+ readonly onDragValueChange: TimelineFieldOnDragValueChange;
10
10
  readonly onDragEnd: () => void;
11
11
  }>;