@remotion/studio 4.0.460 → 4.0.461

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 (70) 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/MenuBuildIndicator.js +1 -1
  5. package/dist/components/MenuCompositionName.js +1 -0
  6. package/dist/components/RenderButton.js +1 -1
  7. package/dist/components/Timeline/SequencePropsObserver.js +1 -1
  8. package/dist/components/Timeline/Timeline.js +11 -10
  9. package/dist/components/Timeline/TimelineBooleanField.d.ts +4 -4
  10. package/dist/components/Timeline/TimelineBooleanField.js +5 -5
  11. package/dist/components/Timeline/TimelineDragHandler.js +37 -3
  12. package/dist/components/Timeline/TimelineEnumField.d.ts +5 -5
  13. package/dist/components/Timeline/TimelineEnumField.js +7 -7
  14. package/dist/components/Timeline/TimelineExpandArrowButton.js +1 -1
  15. package/dist/components/Timeline/TimelineExpandedSection.js +3 -3
  16. package/dist/components/Timeline/TimelineFieldRow.js +49 -16
  17. package/dist/components/Timeline/TimelineHeightContainer.d.ts +1 -1
  18. package/dist/components/Timeline/TimelineHeightContainer.js +36 -3
  19. package/dist/components/Timeline/TimelineListItem.js +15 -14
  20. package/dist/components/Timeline/TimelineNumberField.d.ts +5 -5
  21. package/dist/components/Timeline/TimelineNumberField.js +12 -10
  22. package/dist/components/Timeline/TimelineRotationField.d.ts +5 -5
  23. package/dist/components/Timeline/TimelineRotationField.js +10 -10
  24. package/dist/components/Timeline/TimelineSchemaField.d.ts +4 -6
  25. package/dist/components/Timeline/TimelineSchemaField.js +8 -11
  26. package/dist/components/Timeline/TimelineSequence.js +2 -2
  27. package/dist/components/Timeline/TimelineSlider.js +2 -2
  28. package/dist/components/Timeline/TimelineStack/get-stack.js +17 -31
  29. package/dist/components/Timeline/TimelineStack/index.js +0 -10
  30. package/dist/components/Timeline/TimelineTimeIndicators.js +2 -2
  31. package/dist/components/Timeline/TimelineTracks.d.ts +1 -1
  32. package/dist/components/Timeline/TimelineTracks.js +40 -10
  33. package/dist/components/Timeline/TimelineTranslateField.d.ts +5 -5
  34. package/dist/components/Timeline/TimelineTranslateField.js +19 -37
  35. package/dist/components/Timeline/sequence-props-subscription-store.js +1 -1
  36. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
  37. package/dist/components/Timeline/use-timeline-height.js +4 -13
  38. package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +3 -3
  39. package/dist/error-overlay/react-overlay/utils/get-source-map.js +5 -5
  40. package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -6
  41. package/dist/error-overlay/react-overlay/utils/unmapper.js +8 -1
  42. package/dist/esm/{chunk-nrgs0ad5.js → chunk-yzh34sp0.js} +286 -538
  43. package/dist/esm/internals.mjs +286 -538
  44. package/dist/esm/previewEntry.mjs +289 -542
  45. package/dist/esm/renderEntry.mjs +2 -5
  46. package/dist/helpers/calculate-timeline.js +26 -4
  47. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -0
  48. package/dist/helpers/timeline-layout.d.ts +3 -2
  49. package/dist/helpers/timeline-layout.js +31 -9
  50. package/dist/internals.d.ts +0 -1
  51. package/dist/previewEntry.js +1 -1
  52. package/dist/renderEntry.js +3 -3
  53. package/package.json +13 -22
  54. package/dist/audio-waveform-worker.d.ts +0 -1
  55. package/dist/audio-waveform-worker.js +0 -102
  56. package/dist/components/audio-waveform-worker-types.d.ts +0 -28
  57. package/dist/components/audio-waveform-worker-types.js +0 -2
  58. package/dist/components/draw-peaks.d.ts +0 -1
  59. package/dist/components/draw-peaks.js +0 -68
  60. package/dist/components/load-waveform-peaks.d.ts +0 -13
  61. package/dist/components/load-waveform-peaks.js +0 -76
  62. package/dist/components/parse-color.d.ts +0 -1
  63. package/dist/components/parse-color.js +0 -17
  64. package/dist/components/slice-waveform-peaks.d.ts +0 -7
  65. package/dist/components/slice-waveform-peaks.js +0 -15
  66. package/dist/components/waveform-peak-processor.d.ts +0 -23
  67. package/dist/components/waveform-peak-processor.js +0 -77
  68. package/dist/esm/audio-waveform-worker.mjs +0 -346
  69. package/dist/make-audio-waveform-worker.d.ts +0 -1
  70. package/dist/make-audio-waveform-worker.js +0 -10
@@ -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).catch(() => {
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).catch(() => {
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,11 @@
1
1
  import React from 'react';
2
2
  import type { CanUpdateSequencePropStatus } from 'remotion';
3
- import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
3
+ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
4
4
  export declare const TimelineFieldValue: React.FC<{
5
5
  readonly field: SchemaFieldInfo;
6
- readonly onSave: (key: string, value: unknown) => Promise<void>;
7
- readonly onDragValueChange: (key: string, value: unknown) => void;
6
+ readonly onSave: TimelineFieldOnSave;
7
+ readonly onDragValueChange: TimelineFieldOnDragValueChange;
8
8
  readonly onDragEnd: () => void;
9
- readonly canUpdate: boolean;
10
- readonly propStatus: CanUpdateSequencePropStatus | null;
11
- readonly codeValue: unknown;
9
+ readonly propStatus: CanUpdateSequencePropStatus;
12
10
  readonly effectiveValue: unknown;
13
11
  }>;
@@ -20,36 +20,33 @@ const notEditableBackground = {
20
20
  const inlineWrapper = {
21
21
  fontSize: 12,
22
22
  };
23
- const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, canUpdate, effectiveValue, codeValue, }) => {
24
- const wrapperStyle = canUpdate === null || canUpdate === false
23
+ const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, effectiveValue, }) => {
24
+ const wrapperStyle = !propStatus.canUpdate
25
25
  ? notEditableBackground
26
26
  : undefined;
27
27
  if (!field.supported) {
28
28
  return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "unsupported" });
29
29
  }
30
- if (propStatus !== null && !propStatus.canUpdate) {
30
+ if (!propStatus.canUpdate) {
31
31
  if (propStatus.reason === 'computed') {
32
32
  return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "computed" });
33
33
  }
34
34
  throw new Error(`Unsupported prop status: ${propStatus.reason}`);
35
35
  }
36
- if (propStatus === null) {
37
- return (jsx_runtime_1.jsx("span", { style: notEditableBackground, children: jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "error" }) }));
38
- }
39
36
  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 }) }));
37
+ 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
38
  }
42
39
  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 }) }));
40
+ 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
41
  }
45
42
  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 }) }));
43
+ 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
44
  }
48
45
  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 }) }));
46
+ return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { field: field, propStatus: propStatus, onSave: onSave, effectiveValue: effectiveValue }) }));
50
47
  }
51
48
  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 }) }));
49
+ 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
50
  }
54
51
  return (jsx_runtime_1.jsx("span", { style: { ...unsupportedLabel, fontStyle: 'normal' }, children: String(effectiveValue) }));
55
52
  };
@@ -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, getCodeValues, }) => ({
23
56
  height: (0, timeline_layout_1.getExpandedTrackHeight)({
24
57
  sequence,
25
58
  nodePathInfo,
26
59
  getIsExpanded,
27
- getDragOverrides,
28
60
  getCodeValues,
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 { getCodeValues } = (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
89
  getCodeValues,
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
  }>;
@@ -23,7 +23,7 @@ const containerStyle = {
23
23
  display: 'flex',
24
24
  gap: 4,
25
25
  };
26
- const TimelineTranslateField = ({ field, codeValue, effectiveValue, canUpdate, onSave, onDragValueChange, onDragEnd, }) => {
26
+ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
27
27
  var _a;
28
28
  const [dragX, setDragX] = (0, react_1.useState)(null);
29
29
  const [dragY, setDragY] = (0, react_1.useState)(null);
@@ -41,13 +41,13 @@ const TimelineTranslateField = ({ field, codeValue, effectiveValue, canUpdate, o
41
41
  const onXChange = (0, react_1.useCallback)((newVal) => {
42
42
  setDragX(newVal);
43
43
  const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
44
- onDragValueChange(field.key, makeString(newVal, currentY));
45
- }, [onDragValueChange, field.key, dragY, codeY, makeString]);
44
+ onDragValueChange(makeString(newVal, currentY));
45
+ }, [onDragValueChange, dragY, codeY, makeString]);
46
46
  const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
47
47
  const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
48
48
  const newStr = makeString(newVal, currentY);
49
- if (canUpdate && newStr !== codeValue) {
50
- onSave(field.key, newStr).finally(() => {
49
+ if (propStatus.canUpdate && newStr !== propStatus.codeValue) {
50
+ onSave(newStr).finally(() => {
51
51
  setDragX(null);
52
52
  onDragEnd();
53
53
  });
@@ -56,40 +56,31 @@ const TimelineTranslateField = ({ field, codeValue, effectiveValue, canUpdate, o
56
56
  setDragX(null);
57
57
  onDragEnd();
58
58
  }
59
- }, [
60
- dragY,
61
- codeY,
62
- makeString,
63
- canUpdate,
64
- codeValue,
65
- onSave,
66
- field.key,
67
- onDragEnd,
68
- ]);
59
+ }, [dragY, codeY, makeString, propStatus, onSave, onDragEnd]);
69
60
  const onXTextChange = (0, react_1.useCallback)((newVal) => {
70
- if (canUpdate) {
61
+ if (propStatus.canUpdate) {
71
62
  const parsed = Number(newVal);
72
63
  if (!Number.isNaN(parsed)) {
73
64
  const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
74
65
  const newStr = makeString(parsed, currentY);
75
- if (newStr !== codeValue) {
66
+ if (newStr !== propStatus.codeValue) {
76
67
  setDragX(parsed);
77
- onSave(field.key, newStr);
68
+ onSave(newStr);
78
69
  }
79
70
  }
80
71
  }
81
- }, [canUpdate, dragY, codeY, makeString, codeValue, onSave, field.key]);
72
+ }, [propStatus, dragY, codeY, makeString, onSave]);
82
73
  // --- Y callbacks ---
83
74
  const onYChange = (0, react_1.useCallback)((newVal) => {
84
75
  setDragY(newVal);
85
76
  const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
86
- onDragValueChange(field.key, makeString(currentX, newVal));
87
- }, [onDragValueChange, field.key, dragX, codeX, makeString]);
77
+ onDragValueChange(makeString(currentX, newVal));
78
+ }, [onDragValueChange, dragX, codeX, makeString]);
88
79
  const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
89
80
  const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
90
81
  const newStr = makeString(currentX, newVal);
91
- if (canUpdate && newStr !== codeValue) {
92
- onSave(field.key, newStr).finally(() => {
82
+ if (propStatus.canUpdate && newStr !== propStatus.codeValue) {
83
+ onSave(newStr).finally(() => {
93
84
  setDragY(null);
94
85
  onDragEnd();
95
86
  });
@@ -98,31 +89,22 @@ const TimelineTranslateField = ({ field, codeValue, effectiveValue, canUpdate, o
98
89
  setDragY(null);
99
90
  onDragEnd();
100
91
  }
101
- }, [
102
- dragX,
103
- codeX,
104
- makeString,
105
- canUpdate,
106
- codeValue,
107
- onSave,
108
- field.key,
109
- onDragEnd,
110
- ]);
92
+ }, [dragX, codeX, makeString, propStatus, onSave, onDragEnd]);
111
93
  const onYTextChange = (0, react_1.useCallback)((newVal) => {
112
- if (canUpdate) {
94
+ if (propStatus.canUpdate) {
113
95
  const parsed = Number(newVal);
114
96
  if (!Number.isNaN(parsed)) {
115
97
  const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
116
98
  const newStr = makeString(currentX, parsed);
117
- if (newStr !== codeValue) {
99
+ if (newStr !== propStatus.codeValue) {
118
100
  setDragY(parsed);
119
- onSave(field.key, newStr).catch(() => {
101
+ onSave(newStr).catch(() => {
120
102
  setDragY(null);
121
103
  });
122
104
  }
123
105
  }
124
106
  }
125
- }, [canUpdate, onSave, field.key, codeValue, dragX, codeX, makeString]);
107
+ }, [propStatus, onSave, dragX, codeX, makeString]);
126
108
  return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
127
109
  jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : codeX, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false }), jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragY !== null && dragY !== void 0 ? dragY : codeY, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false })
128
110
  ] }));
@@ -65,7 +65,7 @@ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, clie
65
65
  }
66
66
  acquired.promise
67
67
  .then((result) => {
68
- if (!result.canUpdate) {
68
+ if (!result.success) {
69
69
  return;
70
70
  }
71
71
  return (0, call_api_1.callApi)('/api/unsubscribe-from-sequence-props', {
@@ -42,13 +42,13 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, })
42
42
  schema,
43
43
  clientId,
44
44
  applyOnce: (result) => {
45
- if (!result.canUpdate) {
45
+ if (!result.success) {
46
46
  return;
47
47
  }
48
- setCodeValues(result.nodePath, result);
48
+ setCodeValues(result.nodePath, () => result.status);
49
49
  },
50
50
  applyEach: (result) => {
51
- if (!result.canUpdate) {
51
+ if (!result.success) {
52
52
  return;
53
53
  }
54
54
  setOverrideIdToNodePath(overrideId, result.nodePath);
@@ -11,12 +11,11 @@ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
11
11
  const useTimelineHeight = ({ shown, hasBeenCut, }) => {
12
12
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
13
13
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
14
- const { getDragOverrides, getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeGettersContext);
15
- const visualModeEnabled = Boolean(process.env.EXPERIMENTAL_VISUAL_MODE_ENABLED) &&
16
- previewServerState.type === 'connected';
14
+ const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
15
+ const previewServerConnected = previewServerState.type === 'connected';
17
16
  return (0, react_1.useMemo)(() => {
18
17
  const tracksHeight = shown.reduce((acc, track) => {
19
- const isExpanded = visualModeEnabled &&
18
+ const isExpanded = previewServerConnected &&
20
19
  track.nodePathInfo !== null &&
21
20
  getIsExpanded(track.nodePathInfo);
22
21
  const layerHeight = (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type) +
@@ -26,7 +25,6 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
26
25
  sequence: track.sequence,
27
26
  nodePathInfo: track.nodePathInfo,
28
27
  getIsExpanded,
29
- getDragOverrides,
30
28
  getCodeValues,
31
29
  }) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM
32
30
  : 0;
@@ -36,13 +34,6 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
36
34
  timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM +
37
35
  (hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
38
36
  TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT);
39
- }, [
40
- shown,
41
- hasBeenCut,
42
- visualModeEnabled,
43
- getIsExpanded,
44
- getDragOverrides,
45
- getCodeValues,
46
- ]);
37
+ }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, getCodeValues]);
47
38
  };
48
39
  exports.useTimelineHeight = useTimelineHeight;