@remotion/studio 4.0.499 → 4.0.500

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 (132) hide show
  1. package/dist/components/AssetSelector.js +8 -6
  2. package/dist/components/AssetSelectorItem.d.ts +24 -0
  3. package/dist/components/AssetSelectorItem.js +113 -80
  4. package/dist/components/CompositionSelector.js +2 -32
  5. package/dist/components/ControlButton.js +1 -0
  6. package/dist/components/ExplorerPanel.js +2 -1
  7. package/dist/components/ExplorerPanelRef.d.ts +2 -0
  8. package/dist/components/GlobalKeybindings.js +7 -1
  9. package/dist/components/InlineAction.d.ts +2 -1
  10. package/dist/components/InlineAction.js +2 -2
  11. package/dist/components/InlineDropdown.d.ts +1 -1
  12. package/dist/components/InlineDropdown.js +3 -2
  13. package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
  14. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  15. package/dist/components/InspectorPanel/CompositionInspector.js +8 -7
  16. package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
  17. package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
  18. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
  19. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +7 -7
  20. package/dist/components/InspectorPanel/common.d.ts +17 -4
  21. package/dist/components/InspectorPanel/common.js +60 -6
  22. package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
  23. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
  24. package/dist/components/InspectorSequenceSection.js +43 -19
  25. package/dist/components/KeyboardShortcutsExplainer.js +4 -2
  26. package/dist/components/Menu/MenuItem.js +2 -1
  27. package/dist/components/MenuCompositionName.js +30 -7
  28. package/dist/components/MenuToolbar.d.ts +0 -1
  29. package/dist/components/MenuToolbar.js +8 -7
  30. package/dist/components/MobilePanel.d.ts +2 -1
  31. package/dist/components/MobilePanel.js +29 -25
  32. package/dist/components/ModalContainer.d.ts +1 -0
  33. package/dist/components/ModalContainer.js +2 -2
  34. package/dist/components/Modals.js +1 -1
  35. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  36. package/dist/components/NewComposition/DismissableModal.js +2 -2
  37. package/dist/components/NewComposition/InputDragger.d.ts +7 -0
  38. package/dist/components/NewComposition/InputDragger.js +119 -8
  39. package/dist/components/OutlineToggle.d.ts +1 -3
  40. package/dist/components/OutlineToggle.js +2 -2
  41. package/dist/components/PreviewToolbar.js +10 -4
  42. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
  43. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +44 -0
  44. package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
  45. package/dist/components/QuickSwitcher/NoResults.js +1 -0
  46. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +5 -0
  47. package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
  48. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +5 -0
  49. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +76 -12
  50. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
  51. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
  52. package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
  53. package/dist/components/QuickSwitcher/asset-search.js +42 -0
  54. package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
  55. package/dist/components/SelectedOutlineCropControls.js +299 -0
  56. package/dist/components/SelectedOutlineElement.js +83 -43
  57. package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
  58. package/dist/components/SelectedOutlineOverlay.js +130 -8
  59. package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
  60. package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
  61. package/dist/components/SidebarCollapserControls.d.ts +3 -1
  62. package/dist/components/SidebarCollapserControls.js +34 -29
  63. package/dist/components/SnappingToggle.d.ts +1 -3
  64. package/dist/components/SnappingToggle.js +2 -2
  65. package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
  66. package/dist/components/Timeline/TimelineAssetField.js +52 -100
  67. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
  68. package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
  69. package/dist/components/Timeline/TimelineColorField.js +20 -1
  70. package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
  71. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  72. package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
  73. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
  74. package/dist/components/Timeline/TimelineList.d.ts +2 -2
  75. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +7 -1
  76. package/dist/components/Timeline/TimelineSelection.d.ts +5 -5
  77. package/dist/components/Timeline/TimelineSelection.js +8 -6
  78. package/dist/components/Timeline/TimelineSequence.js +1 -5
  79. package/dist/components/Timeline/TimelineSequenceItem.js +57 -10
  80. package/dist/components/Timeline/TimelineSequencePropItem.js +27 -75
  81. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +0 -1
  82. package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
  83. package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
  84. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
  85. package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
  86. package/dist/components/Timeline/reset-selected-timeline-props.js +18 -10
  87. package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
  88. package/dist/components/Timeline/save-effect-prop.js +52 -1
  89. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
  90. package/dist/components/Timeline/timeline-asset-link.js +17 -1
  91. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
  92. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
  93. package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
  94. package/dist/components/TopPanel.js +2 -2
  95. package/dist/components/UndoRedoButtons.js +27 -5
  96. package/dist/components/composition-drop-preview.js +1 -0
  97. package/dist/components/menu-toolbar-height.d.ts +1 -0
  98. package/dist/components/menu-toolbar-height.js +4 -0
  99. package/dist/components/selected-outline-drag.d.ts +41 -4
  100. package/dist/components/selected-outline-drag.js +179 -2
  101. package/dist/components/selected-outline-geometry.d.ts +1 -0
  102. package/dist/components/selected-outline-measurement.d.ts +11 -0
  103. package/dist/components/selected-outline-measurement.js +64 -3
  104. package/dist/components/selected-outline-types.d.ts +44 -1
  105. package/dist/components/selected-outline-types.js +21 -1
  106. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
  107. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
  108. package/dist/esm/{chunk-pk1zwsn1.js → chunk-dr1y1vm3.js} +8417 -7127
  109. package/dist/esm/internals.mjs +8417 -7127
  110. package/dist/esm/previewEntry.mjs +51241 -49953
  111. package/dist/esm/renderEntry.mjs +1 -1
  112. package/dist/helpers/calculate-timeline.d.ts +2 -2
  113. package/dist/helpers/calculate-timeline.js +8 -28
  114. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
  115. package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
  116. package/dist/helpers/interactivity-enabled.d.ts +1 -0
  117. package/dist/helpers/interactivity-enabled.js +7 -2
  118. package/dist/helpers/is-mac.d.ts +1 -0
  119. package/dist/helpers/is-mac.js +4 -0
  120. package/dist/helpers/open-in-editor.d.ts +5 -1
  121. package/dist/helpers/open-in-editor.js +15 -1
  122. package/dist/helpers/sort-by-nonce-history.js +97 -19
  123. package/dist/helpers/use-keybinding.js +2 -3
  124. package/dist/helpers/use-menu-structure.js +10 -1
  125. package/dist/icons/caret.d.ts +1 -0
  126. package/dist/icons/caret.js +2 -2
  127. package/dist/icons/pen.d.ts +5 -0
  128. package/dist/icons/pen.js +8 -0
  129. package/dist/state/modals.d.ts +5 -0
  130. package/package.json +12 -12
  131. package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
  132. package/dist/helpers/get-timeline-sequence-hash.js +0 -33
@@ -212,7 +212,7 @@ var renderContent = (Root) => {
212
212
  renderToDOM(/* @__PURE__ */ jsx("div", {
213
213
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
214
214
  }));
215
- import("./chunk-pk1zwsn1.js").then(({ StudioInternals }) => {
215
+ import("./chunk-dr1y1vm3.js").then(({ StudioInternals }) => {
216
216
  window.remotion_isStudio = true;
217
217
  window.remotion_isReadOnlyStudio = true;
218
218
  window.remotion_inputProps = "{}";
@@ -1,7 +1,7 @@
1
1
  import type { OverrideIdToNodePaths, TSequence } from 'remotion';
2
- import type { TrackWithHash } from './get-timeline-sequence-sort-key';
2
+ import type { TimelineTrackData } from './get-timeline-sequence-sort-key';
3
3
  export declare const calculateTimeline: ({ sequences, overrideIdsToNodePaths, compositions, }: {
4
4
  sequences: TSequence[];
5
5
  overrideIdsToNodePaths: OverrideIdToNodePaths;
6
6
  compositions?: readonly import("remotion").AnyComposition[] | undefined;
7
- }) => TrackWithHash[];
7
+ }) => TimelineTrackData[];
@@ -5,7 +5,6 @@ const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const get_connected_compositions_1 = require("./get-connected-compositions");
6
6
  const get_sequence_visible_range_1 = require("./get-sequence-visible-range");
7
7
  const get_timeline_nestedness_1 = require("./get-timeline-nestedness");
8
- const get_timeline_sequence_hash_1 = require("./get-timeline-sequence-hash");
9
8
  const get_timeline_sequence_sort_key_1 = require("./get-timeline-sequence-sort-key");
10
9
  const sort_by_nonce_history_1 = require("./sort-by-nonce-history");
11
10
  const getInheritedLoopDisplay = (sequence, sequences) => {
@@ -52,19 +51,8 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, compositions = [
52
51
  }
53
52
  return true;
54
53
  });
55
- const sameHashes = {};
56
- const hashesUsedInRoot = {};
57
- const cache = {};
58
54
  for (let i = 0; i < timelineSequences.length; i++) {
59
55
  const sequence = timelineSequences[i];
60
- if (!hashesUsedInRoot[sequence.rootId]) {
61
- hashesUsedInRoot[sequence.rootId] = [];
62
- }
63
- const actualHash = (0, get_timeline_sequence_hash_1.getTimelineSequenceHash)(sequence, sortedSequences, hashesUsedInRoot, cache);
64
- if (!sameHashes[actualHash]) {
65
- sameHashes[actualHash] = [];
66
- }
67
- sameHashes[actualHash].push(sequence.id);
68
56
  const cascadedStart = (0, get_sequence_visible_range_1.getCascadedStart)(sequence, sortedSequences);
69
57
  const cascadedStartWithTrim = (0, get_sequence_visible_range_1.getCascadedStartWithTrim)(sequence, sortedSequences);
70
58
  const effectiveFrom = sequence.trimBefore === null
@@ -87,7 +75,6 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, compositions = [
87
75
  : sequence.loopDisplay,
88
76
  },
89
77
  depth: (0, get_timeline_nestedness_1.getTimelineNestedLevel)(sequence, sortedSequences, 0),
90
- hash: actualHash,
91
78
  cascadedStart,
92
79
  cascadedDuration: sequence.duration,
93
80
  keyframeDisplayOffset: hasKeyframeRows
@@ -105,26 +92,19 @@ const calculateTimeline = ({ sequences, overrideIdsToNodePaths, compositions = [
105
92
  : null,
106
93
  });
107
94
  }
108
- const uniqueTracks = [];
109
- for (const track of tracks) {
110
- const existingTrack = uniqueTracks.find((t) => t.hash === track.hash);
111
- if (!existingTrack) {
112
- const { cascadedDuration, cascadedStart, ...cleanTrack } = track;
113
- uniqueTracks.push(cleanTrack);
114
- }
115
- else if (existingTrack.connectedCompositions === undefined &&
116
- track.connectedCompositions !== undefined) {
117
- existingTrack.connectedCompositions = track.connectedCompositions;
118
- }
119
- }
120
95
  const nonceRanks = new Map();
121
96
  for (let i = 0; i < tracks.length; i++) {
122
97
  nonceRanks.set(tracks[i].sequence.id, i);
123
98
  }
124
- const sortedTracks = uniqueTracks.sort((a, b) => {
125
- const sortKeyA = (0, get_timeline_sequence_sort_key_1.getTimelineSequenceSequenceSortKey)(a, tracks, sameHashes, nonceRanks);
126
- const sortKeyB = (0, get_timeline_sequence_sort_key_1.getTimelineSequenceSequenceSortKey)(b, tracks, sameHashes, nonceRanks);
99
+ const sortedTracks = tracks
100
+ .sort((a, b) => {
101
+ const sortKeyA = (0, get_timeline_sequence_sort_key_1.getTimelineSequenceSortKey)(a, tracks, nonceRanks);
102
+ const sortKeyB = (0, get_timeline_sequence_sort_key_1.getTimelineSequenceSortKey)(b, tracks, nonceRanks);
127
103
  return sortKeyA.localeCompare(sortKeyB);
104
+ })
105
+ .map((track) => {
106
+ const { cascadedDuration, cascadedStart, ...cleanTrack } = track;
107
+ return cleanTrack;
128
108
  });
129
109
  const nodePathIndexCounters = new Map();
130
110
  return sortedTracks
@@ -6,7 +6,7 @@ export type SequenceNodePathInfo = {
6
6
  numberOfSequencesWithThisNodePath: number;
7
7
  supportsEffects: boolean;
8
8
  };
9
- type Track = {
9
+ export type TimelineTrackData = {
10
10
  sequence: TSequence;
11
11
  connectedCompositions?: readonly _InternalTypes['AnyComposition'][];
12
12
  depth: number;
@@ -14,15 +14,8 @@ type Track = {
14
14
  keyframeDisplayOffset: number;
15
15
  sequenceFrameOffset: number;
16
16
  };
17
- export type TrackWithHash = Track & {
18
- hash: string;
19
- };
20
- export type TrackWithHashAndOriginalTimings = TrackWithHash & {
21
- hash: string;
17
+ export type TimelineTrackWithOriginalTimings = TimelineTrackData & {
22
18
  cascadedStart: number;
23
19
  cascadedDuration: number;
24
20
  };
25
- export declare const getTimelineSequenceSequenceSortKey: (track: TrackWithHash, tracks: TrackWithHash[], sameHashes?: {
26
- [hash: string]: string[];
27
- }, nonceRanks?: Map<string, number>) => string;
28
- export {};
21
+ export declare const getTimelineSequenceSortKey: (track: TimelineTrackData, tracks: TimelineTrackData[], nonceRanks: Map<string, number>) => string;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimelineSequenceSequenceSortKey = void 0;
4
- const getTimelineSequenceSequenceSortKey = (track, tracks, sameHashes = {}, nonceRanks = new Map()) => {
3
+ exports.getTimelineSequenceSortKey = void 0;
4
+ const getTimelineSequenceSortKey = (track, tracks, nonceRanks) => {
5
5
  var _a;
6
- const firstSequenceWithSameHash = tracks.find((t) => sameHashes[track.hash].includes(t.sequence.id));
7
- const sequenceId = firstSequenceWithSameHash.sequence.id;
8
- const rank = (_a = nonceRanks.get(sequenceId)) !== null && _a !== void 0 ? _a : 0;
6
+ const rank = (_a = nonceRanks.get(track.sequence.id)) !== null && _a !== void 0 ? _a : 0;
9
7
  const id = String(rank).padStart(6, '0');
10
8
  if (!track.sequence.parent) {
11
9
  return id;
@@ -16,12 +14,6 @@ const getTimelineSequenceSequenceSortKey = (track, tracks, sameHashes = {}, nonc
16
14
  // may not exist in the `allTracks` array.
17
15
  return id;
18
16
  }
19
- const firstParentWithSameHash = tracks.find((a) => {
20
- return sameHashes[parent.hash].includes(a.sequence.id);
21
- });
22
- if (!firstParentWithSameHash) {
23
- throw new Error('could not find parent: ' + track.sequence.parent);
24
- }
25
- return `${(0, exports.getTimelineSequenceSequenceSortKey)(firstParentWithSameHash, tracks, sameHashes, nonceRanks)}-${id}`;
17
+ return `${(0, exports.getTimelineSequenceSortKey)(parent, tracks, nonceRanks)}-${id}`;
26
18
  };
27
- exports.getTimelineSequenceSequenceSortKey = getTimelineSequenceSequenceSortKey;
19
+ exports.getTimelineSequenceSortKey = getTimelineSequenceSortKey;
@@ -1 +1,2 @@
1
1
  export declare const isStudioInteractivityEnabled: () => boolean;
2
+ export declare const isStudioSelectionEnabled: () => boolean;
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isStudioInteractivityEnabled = void 0;
3
+ exports.isStudioSelectionEnabled = exports.isStudioInteractivityEnabled = void 0;
4
4
  const studio_runtime_config_1 = require("./studio-runtime-config");
5
- exports.isStudioInteractivityEnabled = studio_runtime_config_1.getStudioInteractivityEnabled;
5
+ const isStudioInteractivityEnabled = () => {
6
+ return ((0, studio_runtime_config_1.getStudioInteractivityEnabled)() &&
7
+ (typeof window === 'undefined' || !window.remotion_isReadOnlyStudio));
8
+ };
9
+ exports.isStudioInteractivityEnabled = isStudioInteractivityEnabled;
10
+ exports.isStudioSelectionEnabled = studio_runtime_config_1.getStudioInteractivityEnabled;
@@ -0,0 +1 @@
1
+ export declare const isMac: boolean;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isMac = void 0;
4
+ exports.isMac = typeof window !== 'undefined' && window.navigator.platform.startsWith('Mac');
@@ -1,7 +1,11 @@
1
1
  import type { CompositionComponentInfoResponse, SymbolicatedStackFrame } from '@remotion/studio-shared';
2
- import type { OriginalPosition } from '../error-overlay/react-overlay/utils/get-source-map';
2
+ import type { CodePosition, OriginalPosition } from '../error-overlay/react-overlay/utils/get-source-map';
3
3
  export declare const openInEditor: (stack: SymbolicatedStackFrame) => Promise<import("@remotion/studio-shared").OpenInEditorResponse>;
4
4
  export declare const openOriginalPositionInEditor: (originalPosition: OriginalPosition) => Promise<void>;
5
+ export declare const openOriginalPositionInEditorAtProperty: ({ originalPosition, property, }: {
6
+ originalPosition: CodePosition;
7
+ property: string;
8
+ }) => Promise<void>;
5
9
  type ResolvedCompositionComponentInfo = {
6
10
  location: CompositionComponentInfoResponse['location'];
7
11
  canAddSequence: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.openCompositionComponentInEditor = exports.preloadCompositionComponentInfo = exports.loadCompositionComponentInfo = exports.useCachedCompositionComponentInfo = exports.getCachedCompositionComponentInfo = exports.subscribeToCompositionComponentInfo = exports.openOriginalPositionInEditor = exports.openInEditor = void 0;
3
+ exports.openCompositionComponentInEditor = exports.preloadCompositionComponentInfo = exports.loadCompositionComponentInfo = exports.useCachedCompositionComponentInfo = exports.getCachedCompositionComponentInfo = exports.subscribeToCompositionComponentInfo = exports.openOriginalPositionInEditorAtProperty = exports.openOriginalPositionInEditor = exports.openInEditor = void 0;
4
4
  const react_1 = require("react");
5
5
  const call_api_1 = require("../components/call-api");
6
6
  const openInEditor = (stack) => {
@@ -26,6 +26,20 @@ const openOriginalPositionInEditor = async (originalPosition) => {
26
26
  });
27
27
  };
28
28
  exports.openOriginalPositionInEditor = openOriginalPositionInEditor;
29
+ const openOriginalPositionInEditorAtProperty = async ({ originalPosition, property, }) => {
30
+ const position = await (0, call_api_1.callApi)('/api/find-in-file', {
31
+ fileName: originalPosition.source,
32
+ lineNumber: originalPosition.line,
33
+ columnNumber: originalPosition.column,
34
+ search: property,
35
+ });
36
+ await (0, exports.openOriginalPositionInEditor)({
37
+ source: originalPosition.source,
38
+ line: position.lineNumber,
39
+ column: position.columnNumber,
40
+ });
41
+ };
42
+ exports.openOriginalPositionInEditorAtProperty = openOriginalPositionInEditorAtProperty;
29
43
  const componentResolutionCache = new Map();
30
44
  const componentResolutionResults = new Map();
31
45
  const componentResolutionListeners = new Set();
@@ -25,45 +25,123 @@ const compareNonceHistories = (a, b) => {
25
25
  return aLatestEpoch - bLatestEpoch;
26
26
  };
27
27
  exports.compareNonceHistories = compareNonceHistories;
28
+ // Compare two histories, each pre-collapsed to parallel arrays of epochs and
29
+ // nonces sorted by descending epoch, without rebuilding a Map per comparison.
30
+ // Equivalent to getSharedEpochOrder: both find the newest shared epoch and
31
+ // compare its nonces.
32
+ const sharedEpochOrderFromSorted = (aEpochs, aNonces, bEpochs, bNonces) => {
33
+ let i = 0;
34
+ let j = 0;
35
+ while (i < aEpochs.length && j < bEpochs.length) {
36
+ const ae = aEpochs[i];
37
+ const be = bEpochs[j];
38
+ if (ae === be) {
39
+ return aNonces[i] - bNonces[j];
40
+ }
41
+ if (ae > be) {
42
+ i++;
43
+ }
44
+ else {
45
+ j++;
46
+ }
47
+ }
48
+ return null;
49
+ };
28
50
  const sortItemsByNonceHistory = (items) => {
29
51
  const n = items.length;
30
52
  if (n <= 1) {
31
53
  return items.slice();
32
54
  }
33
- // Build a pairwise ordering matrix from shared epochs.
34
- // order[i][j] < 0 means i before j, > 0 means j before i, null means no direct relationship.
35
- const order = Array.from({ length: n }, () => Array(n).fill(null));
55
+ // Collapse each history once into epoch/nonce arrays sorted by descending
56
+ // epoch. `new Map(nonce)` keeps the last value per duplicated epoch, matching
57
+ // getSharedEpochOrder. This removes the per-pair Map/Set construction the
58
+ // pairwise loop below would otherwise repeat O(n^2) times.
59
+ const epochsOf = new Array(n);
60
+ const noncesOf = new Array(n);
61
+ for (let i = 0; i < n; i++) {
62
+ const map = new Map(items[i].nonce);
63
+ const epochs = [...map.keys()].sort((x, y) => y - x);
64
+ epochsOf[i] = epochs;
65
+ noncesOf[i] = epochs.map((e) => map.get(e));
66
+ }
67
+ // Pairwise "strictly before" relation, stored as bitsets: `before[i]` has
68
+ // bit j set when i must come before j, `known[i]` has bit j set when the
69
+ // pair (i, j) is directly determined by a shared epoch. Bitsets let the
70
+ // transitive closure below combine 32 relationships per word.
71
+ const words = (n + 31) >> 5;
72
+ const before = new Uint32Array(n * words);
73
+ const known = new Uint32Array(n * words);
74
+ // Direct comparison sign per ordered pair; only read where `known` is set.
75
+ const sign = new Int8Array(n * n);
36
76
  for (let i = 0; i < n; i++) {
37
77
  for (let j = i + 1; j < n; j++) {
38
- const cmp = getSharedEpochOrder(items[i].nonce, items[j].nonce);
39
- order[i][j] = cmp;
40
- order[j][i] = cmp !== null ? -cmp : null;
78
+ const cmp = sharedEpochOrderFromSorted(epochsOf[i], noncesOf[i], epochsOf[j], noncesOf[j]);
79
+ if (cmp === null) {
80
+ continue;
81
+ }
82
+ known[i * words + (j >> 5)] |= 1 << (j & 31);
83
+ known[j * words + (i >> 5)] |= 1 << (i & 31);
84
+ sign[i * n + j] = cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
85
+ sign[j * n + i] = cmp < 0 ? 1 : cmp > 0 ? -1 : 0;
86
+ if (cmp < 0) {
87
+ before[i * words + (j >> 5)] |= 1 << (j & 31);
88
+ }
89
+ else if (cmp > 0) {
90
+ before[j * words + (i >> 5)] |= 1 << (i & 31);
91
+ }
41
92
  }
42
93
  }
43
- // Compute transitive closure: if i < j and j < k, then i < k.
94
+ // Transitive closure: if i < k and k < j, then i < j. This is the same
95
+ // Floyd-Warshall relation as before, but the inner sweep is bitwise
96
+ // (`before[k] & ~known[i]` finds all reachable j at once). A newly derived
97
+ // edge is marked known immediately so the first path decides an otherwise
98
+ // undetermined pair — preserving behavior on the inputs where the pairwise
99
+ // comparison is intentionally non-transitive.
44
100
  for (let k = 0; k < n; k++) {
101
+ const kBase = k * words;
102
+ const kWord = k >> 5;
103
+ const kBit = 1 << (k & 31);
45
104
  for (let i = 0; i < n; i++) {
46
- for (let j = 0; j < n; j++) {
47
- if (order[i][j] === null &&
48
- order[i][k] !== null &&
49
- order[k][j] !== null &&
50
- order[i][k] < 0 &&
51
- order[k][j] < 0) {
52
- order[i][j] = -1;
53
- order[j][i] = 1;
105
+ if (i === k) {
106
+ continue;
107
+ }
108
+ const iBase = i * words;
109
+ if ((before[iBase + kWord] & kBit) === 0) {
110
+ continue; // i is not before k, so k adds nothing for i
111
+ }
112
+ for (let w = 0; w < words; w++) {
113
+ const add = before[kBase + w] & ~known[iBase + w];
114
+ if (add === 0) {
115
+ continue;
116
+ }
117
+ before[iBase + w] |= add;
118
+ known[iBase + w] |= add;
119
+ // Set the mirror relationship (j after i) for each newly known pair.
120
+ let bits = add;
121
+ while (bits !== 0) {
122
+ const lowest = bits & -bits;
123
+ const j = (w << 5) + (31 - Math.clz32(lowest));
124
+ sign[i * n + j] = -1;
125
+ known[j * words + (i >> 5)] |= 1 << (i & 31);
126
+ sign[j * n + i] = 1;
127
+ bits ^= lowest;
54
128
  }
55
129
  }
56
130
  }
57
131
  }
58
- // Sort using transitive order, falling back to lower latest epoch first.
59
132
  const indexMap = new Map(items.map((item, i) => [item, i]));
60
133
  const result = items.slice();
61
134
  result.sort((a, b) => {
62
135
  const ai = indexMap.get(a);
63
136
  const bi = indexMap.get(b);
64
- const transitiveOrder = order[ai][bi];
65
- if (transitiveOrder !== null) {
66
- return transitiveOrder;
137
+ if ((known[ai * words + (bi >> 5)] >> (bi & 31)) & 1) {
138
+ return sign[ai * n + bi];
139
+ }
140
+ if ((before[ai * words + (bi >> 5)] >> (bi & 31)) & 1) {
141
+ return -1;
142
+ }
143
+ if ((before[bi * words + (ai >> 5)] >> (ai & 31)) & 1) {
144
+ return 1;
67
145
  }
68
146
  // No transitive relationship — lower latest epoch first
69
147
  return a.nonce[a.nonce.length - 1][0] - b.nonce[b.nonce.length - 1][0];
@@ -4,6 +4,7 @@ exports.useKeybinding = exports.areKeyboardShortcutsDisabled = void 0;
4
4
  const react_1 = require("react");
5
5
  const keybindings_1 = require("../state/keybindings");
6
6
  const z_index_1 = require("../state/z-index");
7
+ const is_mac_1 = require("./is-mac");
7
8
  const studio_runtime_config_1 = require("./studio-runtime-config");
8
9
  if (!(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
9
10
  // eslint-disable-next-line no-console
@@ -29,9 +30,7 @@ const useKeybinding = () => {
29
30
  };
30
31
  }
31
32
  const listener = (e) => {
32
- const commandKey = window.navigator.platform.startsWith('Mac')
33
- ? e.metaKey
34
- : e.ctrlKey;
33
+ const commandKey = is_mac_1.isMac ? e.metaKey : e.ctrlKey;
35
34
  // Apparently, e.key can be undefined in Edge:
36
35
  // https://github.com/remotion-dev/remotion/issues/5637
37
36
  if (!e.key) {
@@ -39,6 +39,13 @@ const openExternal = (link) => {
39
39
  };
40
40
  const rotate = {
41
41
  transform: `rotate(90deg)`,
42
+ color: 'inherit',
43
+ };
44
+ const iconContainer = {
45
+ color: 'inherit',
46
+ };
47
+ const iconPath = {
48
+ color: 'inherit',
42
49
  };
43
50
  const ICON_SIZE = 16;
44
51
  const getFileMenu = ({ readOnlyStudio, closeMenu, previewServerState, setSelectedModal, }) => {
@@ -235,7 +242,7 @@ const useMenuStructure = (closeMenu, readOnlyStudio) => {
235
242
  let struct = [
236
243
  {
237
244
  id: 'remotion',
238
- label: (jsx_runtime_1.jsx(layout_1.Row, { align: "center", justify: "center", children: jsx_runtime_1.jsx("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: jsx_runtime_1.jsx("path", { fill: colors_1.WHITE_HEX, stroke: colors_1.WHITE_HEX, strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }) })),
245
+ label: (jsx_runtime_1.jsx(layout_1.Row, { align: "center", justify: "center", style: iconContainer, children: jsx_runtime_1.jsx("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: jsx_runtime_1.jsx("path", { fill: colors_1.CURRENT_COLOR, stroke: colors_1.CURRENT_COLOR, style: iconPath, strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }) })),
239
246
  leaveLeftPadding: false,
240
247
  items: [
241
248
  {
@@ -574,6 +581,7 @@ const useMenuStructure = (closeMenu, readOnlyStudio) => {
574
581
  type: 'quick-switcher',
575
582
  mode: 'compositions',
576
583
  invocationTimestamp: Date.now(),
584
+ assetSelection: null,
577
585
  });
578
586
  },
579
587
  type: 'item',
@@ -762,6 +770,7 @@ const useMenuStructure = (closeMenu, readOnlyStudio) => {
762
770
  type: 'quick-switcher',
763
771
  mode: 'docs',
764
772
  invocationTimestamp: Date.now(),
773
+ assetSelection: null,
765
774
  });
766
775
  },
767
776
  keyHint: '?',
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  export declare const CaretRight: () => import("react/jsx-runtime").JSX.Element;
3
3
  export declare const CaretDown: React.FC<{
4
+ readonly color?: string;
4
5
  readonly small?: boolean;
5
6
  }>;
6
7
  export declare const AngleDown: React.FC<{
@@ -18,8 +18,8 @@ const angleDown = {
18
18
  };
19
19
  const CaretRight = () => (jsx_runtime_1.jsx("svg", { viewBox: "0 0 192 512", style: caret, children: jsx_runtime_1.jsx("path", { fill: colors_1.CURRENT_COLOR, d: "M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z" }) }));
20
20
  exports.CaretRight = CaretRight;
21
- const CaretDown = ({ small = false, }) => {
22
- return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 320 512", style: small ? caretDownSmall : caretDown, children: jsx_runtime_1.jsx("path", { fill: colors_1.CURRENT_COLOR, d: "M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z" }) }));
21
+ const CaretDown = ({ color = colors_1.CURRENT_COLOR, small = false }) => {
22
+ return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 320 512", style: small ? caretDownSmall : caretDown, children: jsx_runtime_1.jsx("path", { fill: color, d: "M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z" }) }));
23
23
  };
24
24
  exports.CaretDown = CaretDown;
25
25
  const AngleDown = ({ down }) => {
@@ -0,0 +1,5 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const PenIcon: React.FC<SVGProps<SVGSVGElement> & {
4
+ readonly color: string;
5
+ }>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PenIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const PenIcon = ({ color, ...props }) => {
6
+ return (jsx_runtime_1.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...props, children: jsx_runtime_1.jsx("path", { fill: color, d: "M18.7 2.3a1 1 0 0 0-1.4 0L5.2 14.4a1 1 0 0 0-.26.46l-1.4 4.95a.5.5 0 0 0 .62.62l4.95-1.4a1 1 0 0 0 .46-.26L21.7 6.7a1 1 0 0 0 0-1.4l-3-3Zm-10.33 14.9-2.4.68.68-2.4L15.5 6.62l1.73 1.73-8.86 8.85Zm10.28-10.27L16.92 5.2 18 4.12l1.73 1.73-1.08 1.08Z" }) }));
7
+ };
8
+ exports.PenIcon = PenIcon;
@@ -4,6 +4,7 @@ import type { PackageManager, RenderDefaults } from '@remotion/studio-shared';
4
4
  import type { RenderStillOnWebImageFormat, WebRendererAudioCodec, WebRendererContainer, WebRendererHardwareAcceleration, WebRendererPageResponsiveness, WebRendererQuality, WebRendererVideoCodec } from '@remotion/web-renderer';
5
5
  import type React from 'react';
6
6
  import type { SequencePropsSubscriptionKey, _InternalTypes } from 'remotion';
7
+ import type { StaticFile } from '../api/get-static-files';
7
8
  import type { CompType } from '../components/NewComposition/DuplicateComposition';
8
9
  import type { QuickSwitcherMode } from '../components/QuickSwitcher/NoResults';
9
10
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
@@ -159,6 +160,10 @@ export type ModalState = {
159
160
  type: 'quick-switcher';
160
161
  mode: QuickSwitcherMode;
161
162
  invocationTimestamp: number;
163
+ assetSelection: {
164
+ initialQuery: string;
165
+ onSelected: (asset: StaticFile) => void;
166
+ } | null;
162
167
  } | AddEffectModalState | ConfirmationDialogState | SvgImportDialogState;
163
168
  export type ModalContextType = {
164
169
  selectedModal: ModalState | null;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
4
4
  },
5
5
  "name": "@remotion/studio",
6
- "version": "4.0.499",
6
+ "version": "4.0.500",
7
7
  "description": "APIs for interacting with the Remotion Studio",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -24,17 +24,17 @@
24
24
  "react-dom": ">=16.8.0"
25
25
  },
26
26
  "dependencies": {
27
- "@remotion/drag-and-drop": "4.0.499",
27
+ "@remotion/drag-and-drop": "4.0.500",
28
28
  "semver": "7.5.3",
29
- "remotion": "4.0.499",
30
- "@remotion/canvas-capture": "4.0.499",
31
- "@remotion/player": "4.0.499",
32
- "@remotion/media-utils": "4.0.499",
33
- "@remotion/renderer": "4.0.499",
34
- "@remotion/web-renderer": "4.0.499",
35
- "@remotion/studio-shared": "4.0.499",
36
- "@remotion/timeline-utils": "4.0.499",
37
- "@remotion/zod-types": "4.0.499",
29
+ "remotion": "4.0.500",
30
+ "@remotion/canvas-capture": "4.0.500",
31
+ "@remotion/player": "4.0.500",
32
+ "@remotion/media-utils": "4.0.500",
33
+ "@remotion/renderer": "4.0.500",
34
+ "@remotion/web-renderer": "4.0.500",
35
+ "@remotion/studio-shared": "4.0.500",
36
+ "@remotion/timeline-utils": "4.0.500",
37
+ "@remotion/zod-types": "4.0.500",
38
38
  "@jridgewell/trace-mapping": "0.3.31",
39
39
  "mediabunny": "1.50.8",
40
40
  "memfs": "3.4.3",
@@ -45,7 +45,7 @@
45
45
  "react": "19.2.3",
46
46
  "react-dom": "19.2.3",
47
47
  "@types/semver": "7.5.3",
48
- "@remotion/eslint-config-internal": "4.0.499",
48
+ "@remotion/eslint-config-internal": "4.0.500",
49
49
  "eslint": "9.19.0",
50
50
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
51
51
  },
@@ -1,6 +0,0 @@
1
- import type { TSequence } from 'remotion';
2
- export declare const getTimelineSequenceHash: (sequence: TSequence, allSequences: TSequence[], hashesUsedInRoot: {
3
- [rootId: string]: string[];
4
- }, cache: {
5
- [sequenceId: string]: string;
6
- }) => string;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimelineSequenceHash = void 0;
4
- // The goal for this function is to calculate an as unique as possible identifier
5
- // for a sequence based on it's properties. A sequence can be registered multiple times
6
- // from main preview and from thumbnails and we use this to deduplicate it.
7
- // This is why we don't use `id` properties as they will
8
- // differ as a hash.
9
- const getTimelineSequenceHash = (sequence, allSequences, hashesUsedInRoot, cache) => {
10
- if (cache[sequence.id]) {
11
- return cache[sequence.id];
12
- }
13
- const parent = allSequences.find((a) => a.id === sequence.parent);
14
- const baseHash = [
15
- parent
16
- ? (0, exports.getTimelineSequenceHash)(parent, allSequences, hashesUsedInRoot, cache)
17
- : null,
18
- sequence.displayName,
19
- sequence.duration,
20
- sequence.from,
21
- sequence.type,
22
- sequence.type === 'audio' ? sequence.src : null,
23
- sequence.type === 'audio' ? sequence.volume : null,
24
- sequence.type === 'video' ? sequence.src : null,
25
- sequence.type === 'video' ? sequence.volume : null,
26
- ].join('-');
27
- const actualHash = baseHash +
28
- hashesUsedInRoot[sequence.rootId].filter((h) => h === baseHash).length;
29
- hashesUsedInRoot[sequence.rootId].push(baseHash);
30
- cache[sequence.id] = actualHash;
31
- return actualHash;
32
- };
33
- exports.getTimelineSequenceHash = getTimelineSequenceHash;