@remotion/studio 4.0.459 → 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 (107) hide show
  1. package/dist/Studio.d.ts +0 -1
  2. package/dist/Studio.js +4 -4
  3. package/dist/components/AudioWaveform.js +21 -13
  4. package/dist/components/Checkbox.d.ts +7 -0
  5. package/dist/components/Checkbox.js +38 -24
  6. package/dist/components/Editor.js +10 -9
  7. package/dist/components/ExpandedTracksProvider.d.ts +9 -4
  8. package/dist/components/ExpandedTracksProvider.js +45 -15
  9. package/dist/components/MenuBuildIndicator.js +1 -2
  10. package/dist/components/MenuCompositionName.js +1 -0
  11. package/dist/components/NewComposition/ComboBox.d.ts +1 -0
  12. package/dist/components/NewComposition/ComboBox.js +14 -5
  13. package/dist/components/RenderButton.js +1 -1
  14. package/dist/components/SequencePropsSubscriptionProvider.d.ts +3 -0
  15. package/dist/components/SequencePropsSubscriptionProvider.js +26 -0
  16. package/dist/components/Timeline/SequencePropsObserver.d.ts +1 -0
  17. package/dist/components/Timeline/SequencePropsObserver.js +24 -0
  18. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +7 -0
  19. package/dist/components/Timeline/SubscribeToNodePaths.js +15 -0
  20. package/dist/components/Timeline/Timeline.js +30 -49
  21. package/dist/components/Timeline/TimelineBooleanField.d.ts +4 -4
  22. package/dist/components/Timeline/TimelineBooleanField.js +5 -5
  23. package/dist/components/Timeline/TimelineDragHandler.js +37 -3
  24. package/dist/components/Timeline/TimelineEnumField.d.ts +5 -5
  25. package/dist/components/Timeline/TimelineEnumField.js +23 -15
  26. package/dist/components/Timeline/TimelineExpandArrowButton.d.ts +1 -0
  27. package/dist/components/Timeline/TimelineExpandArrowButton.js +5 -3
  28. package/dist/components/Timeline/TimelineExpandedRow.d.ts +6 -6
  29. package/dist/components/Timeline/TimelineExpandedRow.js +4 -5
  30. package/dist/components/Timeline/TimelineExpandedSection.d.ts +2 -2
  31. package/dist/components/Timeline/TimelineExpandedSection.js +20 -9
  32. package/dist/components/Timeline/TimelineFieldRow.d.ts +2 -3
  33. package/dist/components/Timeline/TimelineFieldRow.js +66 -30
  34. package/dist/components/Timeline/TimelineHeightContainer.d.ts +7 -0
  35. package/dist/components/Timeline/TimelineHeightContainer.js +51 -0
  36. package/dist/components/Timeline/TimelineList.js +1 -1
  37. package/dist/components/Timeline/TimelineListItem.d.ts +2 -0
  38. package/dist/components/Timeline/TimelineListItem.js +33 -18
  39. package/dist/components/Timeline/TimelineNumberField.d.ts +5 -5
  40. package/dist/components/Timeline/TimelineNumberField.js +12 -10
  41. package/dist/components/Timeline/TimelineRotationField.d.ts +5 -5
  42. package/dist/components/Timeline/TimelineRotationField.js +10 -10
  43. package/dist/components/Timeline/TimelineSchemaField.d.ts +4 -6
  44. package/dist/components/Timeline/TimelineSchemaField.js +11 -11
  45. package/dist/components/Timeline/TimelineSequence.js +2 -2
  46. package/dist/components/Timeline/TimelineSlider.js +2 -2
  47. package/dist/components/Timeline/TimelineStack/get-stack.js +17 -31
  48. package/dist/components/Timeline/TimelineStack/index.js +0 -10
  49. package/dist/components/Timeline/TimelineTimeIndicators.js +2 -2
  50. package/dist/components/Timeline/TimelineTracks.d.ts +1 -1
  51. package/dist/components/Timeline/TimelineTracks.js +53 -12
  52. package/dist/components/Timeline/TimelineTranslateField.d.ts +5 -5
  53. package/dist/components/Timeline/TimelineTranslateField.js +19 -37
  54. package/dist/components/Timeline/TimelineVideoInfo.js +25 -140
  55. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +10 -13
  56. package/dist/components/Timeline/sequence-props-subscription-store.js +56 -123
  57. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +6 -6
  58. package/dist/components/Timeline/use-sequence-props-subscription.js +25 -55
  59. package/dist/components/Timeline/use-timeline-height.d.ts +5 -0
  60. package/dist/components/Timeline/use-timeline-height.js +39 -0
  61. package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +3 -3
  62. package/dist/error-overlay/react-overlay/utils/get-source-map.js +5 -5
  63. package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -6
  64. package/dist/error-overlay/react-overlay/utils/unmapper.js +8 -1
  65. package/dist/esm/{chunk-0njpenna.js → chunk-yzh34sp0.js} +3026 -3446
  66. package/dist/esm/internals.mjs +3026 -3446
  67. package/dist/esm/previewEntry.mjs +3028 -3449
  68. package/dist/esm/renderEntry.mjs +2 -5
  69. package/dist/helpers/calculate-timeline.d.ts +3 -2
  70. package/dist/helpers/calculate-timeline.js +43 -2
  71. package/dist/helpers/get-timeline-sequence-layout.js +3 -3
  72. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +7 -1
  73. package/dist/helpers/timeline-layout.d.ts +19 -9
  74. package/dist/helpers/timeline-layout.js +50 -20
  75. package/dist/icons/Checkmark.d.ts +4 -1
  76. package/dist/icons/Checkmark.js +1 -5
  77. package/dist/icons/caret.d.ts +3 -1
  78. package/dist/icons/caret.js +5 -2
  79. package/dist/internals.d.ts +0 -1
  80. package/dist/previewEntry.js +1 -1
  81. package/dist/renderEntry.js +3 -3
  82. package/package.json +13 -21
  83. package/dist/audio-waveform-worker.d.ts +0 -1
  84. package/dist/audio-waveform-worker.js +0 -102
  85. package/dist/components/audio-waveform-worker-types.d.ts +0 -28
  86. package/dist/components/audio-waveform-worker-types.js +0 -2
  87. package/dist/components/draw-peaks.d.ts +0 -1
  88. package/dist/components/draw-peaks.js +0 -68
  89. package/dist/components/load-waveform-peaks.d.ts +0 -13
  90. package/dist/components/load-waveform-peaks.js +0 -76
  91. package/dist/components/looped-media-timeline.d.ts +0 -6
  92. package/dist/components/looped-media-timeline.js +0 -14
  93. package/dist/components/parse-color.d.ts +0 -1
  94. package/dist/components/parse-color.js +0 -17
  95. package/dist/components/slice-waveform-peaks.d.ts +0 -7
  96. package/dist/components/slice-waveform-peaks.js +0 -15
  97. package/dist/components/waveform-peak-processor.d.ts +0 -23
  98. package/dist/components/waveform-peak-processor.js +0 -77
  99. package/dist/esm/audio-waveform-worker.mjs +0 -354
  100. package/dist/helpers/extract-frames.d.ts +0 -18
  101. package/dist/helpers/extract-frames.js +0 -87
  102. package/dist/helpers/frame-database.d.ts +0 -16
  103. package/dist/helpers/frame-database.js +0 -65
  104. package/dist/helpers/resize-video-frame.d.ts +0 -4
  105. package/dist/helpers/resize-video-frame.js +0 -39
  106. package/dist/make-audio-waveform-worker.d.ts +0 -1
  107. package/dist/make-audio-waveform-worker.js +0 -10
@@ -5,22 +5,11 @@ const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const client_id_1 = require("../../helpers/client-id");
7
7
  const sequence_props_subscription_store_1 = require("./sequence-props-subscription-store");
8
- const EMPTY_STATE = {
9
- nodePath: null,
10
- jsxInMapCallback: false,
11
- };
12
- const useSequencePropsSubscription = (sequence, originalLocation, visualModeEnabled) => {
13
- var _a, _b;
14
- var _c, _d, _e, _f;
15
- const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeOverridesContext);
16
- const overrideId = (_c = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.overrideId) !== null && _c !== void 0 ? _c : null;
17
- const setPropStatusesForSequence = (0, react_1.useCallback)((statuses) => {
18
- if (!overrideId) {
19
- return;
20
- }
21
- setCodeValues(overrideId, statuses);
22
- }, [overrideId, setCodeValues]);
23
- const { previewServerState: state, subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
8
+ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, }) => {
9
+ var _a, _b, _c;
10
+ const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
11
+ const { setOverrideIdToNodePath } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsSettersContext);
12
+ const { previewServerState: state } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
24
13
  const clientId = state.type === 'connected' ? state.clientId : undefined;
25
14
  const validatedLocation = (0, react_1.useMemo)(() => {
26
15
  var _a;
@@ -35,67 +24,48 @@ const useSequencePropsSubscription = (sequence, originalLocation, visualModeEnab
35
24
  column: (_a = originalLocation.column) !== null && _a !== void 0 ? _a : 0,
36
25
  };
37
26
  }, [originalLocation]);
38
- const [subscriptionState, setSubscriptionState] = (0, react_1.useState)(EMPTY_STATE);
39
- const isMountedRef = (0, react_1.useRef)(true);
40
- (0, react_1.useEffect)(() => {
41
- isMountedRef.current = true;
42
- return () => {
43
- isMountedRef.current = false;
44
- };
45
- }, []);
46
- const schema = (_b = sequence.controls) === null || _b === void 0 ? void 0 : _b.schema;
47
- const locationSource = (_d = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) !== null && _d !== void 0 ? _d : null;
48
- const locationLine = (_e = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.line) !== null && _e !== void 0 ? _e : null;
49
- const locationColumn = (_f = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.column) !== null && _f !== void 0 ? _f : null;
27
+ const locationSource = (_a = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) !== null && _a !== void 0 ? _a : null;
28
+ const locationLine = (_b = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.line) !== null && _b !== void 0 ? _b : null;
29
+ const locationColumn = (_c = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.column) !== null && _c !== void 0 ? _c : null;
50
30
  (0, react_1.useEffect)(() => {
51
- if (!visualModeEnabled) {
52
- setPropStatusesForSequence(null);
53
- setSubscriptionState(EMPTY_STATE);
54
- return;
55
- }
56
31
  if (!clientId ||
57
32
  !locationSource ||
58
33
  !locationLine ||
59
34
  locationColumn === null ||
60
35
  !schema) {
61
- setPropStatusesForSequence(null);
62
- setSubscriptionState(EMPTY_STATE);
63
36
  return;
64
37
  }
65
- const onChange = (snapshot) => {
66
- setSubscriptionState({
67
- nodePath: snapshot.nodePath,
68
- jsxInMapCallback: snapshot.jsxInMapCallback,
69
- });
70
- setPropStatusesForSequence(snapshot.props);
71
- };
72
- const release = (0, sequence_props_subscription_store_1.acquireSequencePropsSubscription)({
73
- clientId,
38
+ const { release } = (0, sequence_props_subscription_store_1.acquireSequencePropsSubscription)({
74
39
  fileName: locationSource,
75
40
  line: locationLine,
76
41
  column: locationColumn,
77
42
  schema,
78
- subscribeToEvent,
79
- onChange,
43
+ clientId,
44
+ applyOnce: (result) => {
45
+ if (!result.success) {
46
+ return;
47
+ }
48
+ setCodeValues(result.nodePath, () => result.status);
49
+ },
50
+ applyEach: (result) => {
51
+ if (!result.success) {
52
+ return;
53
+ }
54
+ setOverrideIdToNodePath(overrideId, result.nodePath);
55
+ },
80
56
  });
81
57
  return () => {
82
58
  release();
83
- // Only clear props on true unmount, not on re-subscribe due to
84
- // location changes — avoids flicker while re-subscribing.
85
- if (!isMountedRef.current) {
86
- setPropStatusesForSequence(null);
87
- }
88
59
  };
89
60
  }, [
90
61
  clientId,
91
62
  locationColumn,
92
63
  locationLine,
93
64
  locationSource,
65
+ overrideId,
94
66
  schema,
95
- setPropStatusesForSequence,
96
- subscribeToEvent,
97
- visualModeEnabled,
67
+ setCodeValues,
68
+ setOverrideIdToNodePath,
98
69
  ]);
99
- return subscriptionState;
100
70
  };
101
71
  exports.useSequencePropsSubscription = useSequencePropsSubscription;
@@ -0,0 +1,5 @@
1
+ import type { TrackWithHash } from '../../helpers/get-timeline-sequence-sort-key';
2
+ export declare const useTimelineHeight: ({ shown, hasBeenCut, }: {
3
+ shown: TrackWithHash[];
4
+ hasBeenCut: boolean;
5
+ }) => number;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTimelineHeight = void 0;
4
+ const react_1 = require("react");
5
+ const remotion_1 = require("remotion");
6
+ const client_id_1 = require("../../helpers/client-id");
7
+ const timeline_layout_1 = require("../../helpers/timeline-layout");
8
+ const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
9
+ const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
10
+ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
11
+ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
12
+ const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
13
+ const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
14
+ const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
15
+ const previewServerConnected = previewServerState.type === 'connected';
16
+ return (0, react_1.useMemo)(() => {
17
+ const tracksHeight = shown.reduce((acc, track) => {
18
+ const isExpanded = previewServerConnected &&
19
+ track.nodePathInfo !== null &&
20
+ getIsExpanded(track.nodePathInfo);
21
+ const layerHeight = (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type) +
22
+ timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM;
23
+ const expandedHeight = isExpanded && track.nodePathInfo
24
+ ? (0, timeline_layout_1.getExpandedTrackHeight)({
25
+ sequence: track.sequence,
26
+ nodePathInfo: track.nodePathInfo,
27
+ getIsExpanded,
28
+ getCodeValues,
29
+ }) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM
30
+ : 0;
31
+ return acc + layerHeight + expandedHeight;
32
+ }, 0);
33
+ return (tracksHeight +
34
+ timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM +
35
+ (hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
36
+ TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT);
37
+ }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, getCodeValues]);
38
+ };
39
+ exports.useTimelineHeight = useTimelineHeight;
@@ -1,4 +1,4 @@
1
- import { SourceMapConsumer } from 'source-map';
1
+ import { TraceMap } from '@jridgewell/trace-mapping';
2
2
  export type OriginalPosition = {
3
3
  line: number | null;
4
4
  column: number | null;
@@ -9,5 +9,5 @@ export type CodePosition = {
9
9
  column: number;
10
10
  source: string;
11
11
  };
12
- export declare const getOriginalPosition: (source_map: SourceMapConsumer, line: number, column: number) => OriginalPosition;
13
- export declare function getSourceMap(fileUri: string, fileContents: string): Promise<SourceMapConsumer | null>;
12
+ export declare const getOriginalPosition: (sourceMap: TraceMap, line: number, column: number) => OriginalPosition;
13
+ export declare function getSourceMap(fileUri: string, fileContents: string): Promise<TraceMap | null>;
@@ -5,9 +5,9 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getOriginalPosition = void 0;
7
7
  exports.getSourceMap = getSourceMap;
8
- const source_map_1 = require("source-map");
9
- const getOriginalPosition = (source_map, line, column) => {
10
- const result = source_map.originalPositionFor({
8
+ const trace_mapping_1 = require("@jridgewell/trace-mapping");
9
+ const getOriginalPosition = (sourceMap, line, column) => {
10
+ const result = (0, trace_mapping_1.originalPositionFor)(sourceMap, {
11
11
  line,
12
12
  column,
13
13
  });
@@ -42,10 +42,10 @@ async function getSourceMap(fileUri, fileContents) {
42
42
  throw new Error('Sorry, non-base64 inline source-map encoding is not supported.');
43
43
  }
44
44
  const converted = window.atob(sm.substring(match2[0].length));
45
- return new source_map_1.SourceMapConsumer(JSON.parse(converted));
45
+ return new trace_mapping_1.TraceMap(JSON.parse(converted));
46
46
  }
47
47
  const index = fileUri.lastIndexOf('/');
48
48
  const url = fileUri.substring(0, index + 1) + sm;
49
49
  const obj = await fetch(url).then((res) => res.json());
50
- return new source_map_1.SourceMapConsumer(obj);
50
+ return new trace_mapping_1.TraceMap(obj);
51
51
  }
@@ -1,9 +1,3 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
1
  import type { SomeStackFrame, SymbolicatedStackFrame } from '@remotion/studio-shared';
8
2
  export declare const getFileContents: (fileName: string) => Promise<string>;
9
3
  export declare const unmap: (frames: SomeStackFrame[], contextLines: number) => Promise<SymbolicatedStackFrame[]>;
@@ -4,6 +4,13 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.unmap = exports.getFileContents = void 0;
7
+ /**
8
+ * Copyright (c) 2015-present, Facebook, Inc.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ const trace_mapping_1 = require("@jridgewell/trace-mapping");
7
14
  const remotion_1 = require("remotion");
8
15
  const get_lines_around_1 = require("./get-lines-around");
9
16
  const get_source_map_1 = require("./get-source-map");
@@ -40,7 +47,7 @@ const unmap = async (frames, contextLines) => {
40
47
  const pos = (0, get_source_map_1.getOriginalPosition)(map, frame.frame.lineNumber, frame.frame.columnNumber);
41
48
  const { functionName } = frame.frame;
42
49
  let hasSource = null;
43
- hasSource = pos.source ? map.sourceContentFor(pos.source, false) : null;
50
+ hasSource = pos.source ? (0, trace_mapping_1.sourceContentFor)(map, pos.source) : null;
44
51
  const scriptCode = hasSource && pos.line
45
52
  ? (0, get_lines_around_1.getLinesAround)(pos.line, contextLines, hasSource.split('\n'))
46
53
  : null;