@remotion/studio 4.0.498 → 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 (167) 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 +144 -83
  4. package/dist/components/Canvas.js +162 -7
  5. package/dist/components/CompositionSelector.js +15 -42
  6. package/dist/components/CompositionSelectorItem.js +21 -13
  7. package/dist/components/ControlButton.js +1 -0
  8. package/dist/components/EditorContent.js +1 -1
  9. package/dist/components/EditorRuler/Ruler.js +5 -3
  10. package/dist/components/ExplorerPanel.js +2 -1
  11. package/dist/components/ExplorerPanelRef.d.ts +2 -0
  12. package/dist/components/ForceSpecificCursor.js +13 -1
  13. package/dist/components/GlobalKeybindings.js +7 -1
  14. package/dist/components/InlineAction.d.ts +2 -1
  15. package/dist/components/InlineAction.js +2 -2
  16. package/dist/components/InlineDropdown.d.ts +1 -1
  17. package/dist/components/InlineDropdown.js +3 -2
  18. package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
  19. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  20. package/dist/components/InspectorPanel/CompositionInspector.js +8 -7
  21. package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
  22. package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
  23. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
  24. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +7 -7
  25. package/dist/components/InspectorPanel/common.d.ts +17 -4
  26. package/dist/components/InspectorPanel/common.js +60 -6
  27. package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
  28. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
  29. package/dist/components/InspectorSequenceSection.js +43 -19
  30. package/dist/components/KeyboardShortcutsExplainer.js +4 -2
  31. package/dist/components/Menu/MenuItem.js +2 -1
  32. package/dist/components/MenuCompositionName.js +30 -7
  33. package/dist/components/MenuToolbar.d.ts +0 -1
  34. package/dist/components/MenuToolbar.js +8 -7
  35. package/dist/components/MobilePanel.d.ts +2 -1
  36. package/dist/components/MobilePanel.js +29 -25
  37. package/dist/components/ModalContainer.d.ts +1 -0
  38. package/dist/components/ModalContainer.js +2 -2
  39. package/dist/components/Modals.js +1 -1
  40. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  41. package/dist/components/NewComposition/DismissableModal.js +2 -2
  42. package/dist/components/NewComposition/InputDragger.d.ts +34 -0
  43. package/dist/components/NewComposition/InputDragger.js +262 -23
  44. package/dist/components/OutlineToggle.d.ts +1 -3
  45. package/dist/components/OutlineToggle.js +2 -2
  46. package/dist/components/PreviewToolbar.js +10 -4
  47. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
  48. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +44 -0
  49. package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
  50. package/dist/components/QuickSwitcher/NoResults.js +1 -0
  51. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +5 -0
  52. package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
  53. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +5 -0
  54. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +76 -12
  55. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
  56. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
  57. package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
  58. package/dist/components/QuickSwitcher/asset-search.js +42 -0
  59. package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
  60. package/dist/components/SelectedOutlineCropControls.js +299 -0
  61. package/dist/components/SelectedOutlineElement.js +83 -43
  62. package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
  63. package/dist/components/SelectedOutlineOverlay.js +130 -8
  64. package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
  65. package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
  66. package/dist/components/SidebarCollapserControls.d.ts +3 -1
  67. package/dist/components/SidebarCollapserControls.js +34 -29
  68. package/dist/components/SnappingToggle.d.ts +1 -3
  69. package/dist/components/SnappingToggle.js +2 -2
  70. package/dist/components/Splitter/SplitterContainer.d.ts +2 -0
  71. package/dist/components/Splitter/SplitterContainer.js +5 -1
  72. package/dist/components/Splitter/SplitterContext.d.ts +2 -0
  73. package/dist/components/Splitter/SplitterContext.js +2 -0
  74. package/dist/components/Splitter/SplitterElement.js +6 -1
  75. package/dist/components/Splitter/SplitterHandle.js +27 -2
  76. package/dist/components/Timeline/Timeline.js +1 -1
  77. package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
  78. package/dist/components/Timeline/TimelineAssetField.js +52 -100
  79. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
  80. package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
  81. package/dist/components/Timeline/TimelineColorField.js +20 -1
  82. package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
  83. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  84. package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
  85. package/dist/components/Timeline/TimelineInOutDragHandler.js +25 -1
  86. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
  87. package/dist/components/Timeline/TimelineLayerEye.js +4 -1
  88. package/dist/components/Timeline/TimelineList.d.ts +2 -2
  89. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +7 -1
  90. package/dist/components/Timeline/TimelineSelection.d.ts +5 -5
  91. package/dist/components/Timeline/TimelineSelection.js +8 -6
  92. package/dist/components/Timeline/TimelineSequence.js +7 -6
  93. package/dist/components/Timeline/TimelineSequenceItem.js +57 -10
  94. package/dist/components/Timeline/TimelineSequenceName.js +1 -0
  95. package/dist/components/Timeline/TimelineSequencePropItem.js +27 -75
  96. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -1
  97. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +29 -12
  98. package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
  99. package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
  100. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
  101. package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
  102. package/dist/components/Timeline/reset-selected-timeline-props.js +18 -10
  103. package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
  104. package/dist/components/Timeline/save-effect-prop.js +52 -1
  105. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
  106. package/dist/components/Timeline/timeline-asset-link.js +17 -1
  107. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
  108. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
  109. package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
  110. package/dist/components/Timeline/use-timeline-keyframe-drag.js +6 -4
  111. package/dist/components/TopPanel.js +3 -2
  112. package/dist/components/UndoRedoButtons.js +27 -5
  113. package/dist/components/composition-drop-preview.d.ts +33 -0
  114. package/dist/components/composition-drop-preview.js +68 -0
  115. package/dist/components/drop-handler-data.d.ts +1 -1
  116. package/dist/components/drop-handler-data.js +27 -60
  117. package/dist/components/effect-drag-and-drop.d.ts +1 -1
  118. package/dist/components/effect-drag-and-drop.js +7 -55
  119. package/dist/components/element-drag-and-drop.d.ts +1 -1
  120. package/dist/components/element-drag-and-drop.js +5 -17
  121. package/dist/components/handle-drop.js +0 -1
  122. package/dist/components/import-assets.d.ts +7 -8
  123. package/dist/components/import-assets.js +2 -9
  124. package/dist/components/menu-toolbar-height.d.ts +1 -0
  125. package/dist/components/menu-toolbar-height.js +4 -0
  126. package/dist/components/selected-outline-drag.d.ts +41 -4
  127. package/dist/components/selected-outline-drag.js +179 -2
  128. package/dist/components/selected-outline-geometry.d.ts +1 -0
  129. package/dist/components/selected-outline-measurement.d.ts +11 -0
  130. package/dist/components/selected-outline-measurement.js +64 -3
  131. package/dist/components/selected-outline-types.d.ts +44 -1
  132. package/dist/components/selected-outline-types.js +21 -1
  133. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
  134. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
  135. package/dist/esm/{chunk-7a6q9hk2.js → chunk-dr1y1vm3.js} +11851 -9494
  136. package/dist/esm/internals.mjs +11851 -9494
  137. package/dist/esm/previewEntry.mjs +55150 -52795
  138. package/dist/esm/renderEntry.mjs +1 -1
  139. package/dist/helpers/calculate-timeline.d.ts +2 -2
  140. package/dist/helpers/calculate-timeline.js +8 -28
  141. package/dist/helpers/get-effective-translation.d.ts +13 -1
  142. package/dist/helpers/get-effective-translation.js +12 -6
  143. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
  144. package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
  145. package/dist/helpers/interactivity-enabled.d.ts +1 -0
  146. package/dist/helpers/interactivity-enabled.js +7 -2
  147. package/dist/helpers/is-mac.d.ts +1 -0
  148. package/dist/helpers/is-mac.js +4 -0
  149. package/dist/helpers/open-in-editor.d.ts +5 -1
  150. package/dist/helpers/open-in-editor.js +15 -1
  151. package/dist/helpers/ruler-canvas-size.d.ts +7 -0
  152. package/dist/helpers/ruler-canvas-size.js +14 -1
  153. package/dist/helpers/sort-by-nonce-history.js +97 -19
  154. package/dist/helpers/use-image-metadata.d.ts +1 -0
  155. package/dist/helpers/use-image-metadata.js +8 -5
  156. package/dist/helpers/use-keybinding.js +2 -3
  157. package/dist/helpers/use-media-metadata.d.ts +1 -0
  158. package/dist/helpers/use-media-metadata.js +8 -5
  159. package/dist/helpers/use-menu-structure.js +10 -1
  160. package/dist/icons/caret.d.ts +1 -0
  161. package/dist/icons/caret.js +2 -2
  162. package/dist/icons/pen.d.ts +5 -0
  163. package/dist/icons/pen.js +8 -0
  164. package/dist/state/modals.d.ts +5 -0
  165. package/package.json +13 -12
  166. package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
  167. package/dist/helpers/get-timeline-sequence-hash.js +0 -33
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.InputDragger = exports.deriveInputDraggerValueDiff = exports.isInputDraggerValueInRange = exports.deriveInputDraggerDragStartValue = exports.deriveInputDraggerStep = exports.inputDraggerContainerStyle = void 0;
36
+ exports.InputDragger = exports.deriveInputDraggerValueDiff = exports.isInputDraggerValueInRange = exports.deriveInputDraggerDragStartValue = exports.deriveInputDraggerStep = exports.deriveInputDraggerArrowValue = exports.validateInputDraggerValue = exports.isInputDraggerValueAlignedToStep = exports.parseInputDraggerNumber = exports.parseInputDraggerExpression = exports.inputDraggerContainerStyle = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = __importStar(require("react"));
39
39
  const remotion_1 = require("remotion");
@@ -60,6 +60,204 @@ const roundToDecimalPlaces = (val, decimalPlaces) => {
60
60
  const rounded = Math.round(val * factor) / factor;
61
61
  return Object.is(rounded, -0) ? 0 : rounded;
62
62
  };
63
+ const numberAtStartPattern = /^(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[+-]?\d+)?/i;
64
+ const parseInputDraggerExpression = (input) => {
65
+ let index = 0;
66
+ const invalid = () => ({ status: 'invalid' });
67
+ const incomplete = () => ({
68
+ status: 'incomplete',
69
+ });
70
+ const skipWhitespace = () => {
71
+ while (index < input.length && /\s/.test(input[index])) {
72
+ index++;
73
+ }
74
+ };
75
+ const parsePrimary = () => {
76
+ skipWhitespace();
77
+ if (index === input.length) {
78
+ return incomplete();
79
+ }
80
+ if (input[index] === '(') {
81
+ index++;
82
+ const expression = parseExpression();
83
+ if (expression.status !== 'valid') {
84
+ return expression;
85
+ }
86
+ skipWhitespace();
87
+ if (index === input.length) {
88
+ return incomplete();
89
+ }
90
+ if (input[index] !== ')') {
91
+ return invalid();
92
+ }
93
+ index++;
94
+ return expression;
95
+ }
96
+ const match = input.slice(index).match(numberAtStartPattern);
97
+ if (!match) {
98
+ return invalid();
99
+ }
100
+ index += match[0].length;
101
+ const rest = input.slice(index);
102
+ if (/^e[+-]?\s*$/i.test(rest)) {
103
+ return incomplete();
104
+ }
105
+ const value = Number(match[0]);
106
+ return Number.isFinite(value) ? { status: 'valid', value } : invalid();
107
+ };
108
+ const parseUnary = () => {
109
+ skipWhitespace();
110
+ if (input[index] !== '+' && input[index] !== '-') {
111
+ return parsePrimary();
112
+ }
113
+ const operator = input[index];
114
+ index++;
115
+ const operand = parseUnary();
116
+ if (operand.status !== 'valid') {
117
+ return operand;
118
+ }
119
+ const value = operator === '-' ? -operand.value : operand.value;
120
+ return Number.isFinite(value) ? { status: 'valid', value } : invalid();
121
+ };
122
+ const parseTerm = () => {
123
+ let left = parseUnary();
124
+ if (left.status !== 'valid') {
125
+ return left;
126
+ }
127
+ while (true) {
128
+ skipWhitespace();
129
+ const operator = input[index];
130
+ if (operator !== '*' && operator !== '/') {
131
+ return left;
132
+ }
133
+ index++;
134
+ const right = parseUnary();
135
+ if (right.status !== 'valid') {
136
+ return right;
137
+ }
138
+ if (operator === '/' && right.value === 0) {
139
+ return invalid();
140
+ }
141
+ const value = operator === '*' ? left.value * right.value : left.value / right.value;
142
+ if (!Number.isFinite(value)) {
143
+ return invalid();
144
+ }
145
+ left = { status: 'valid', value };
146
+ }
147
+ };
148
+ const parseExpression = () => {
149
+ let left = parseTerm();
150
+ if (left.status !== 'valid') {
151
+ return left;
152
+ }
153
+ while (true) {
154
+ skipWhitespace();
155
+ const operator = input[index];
156
+ if (operator !== '+' && operator !== '-') {
157
+ return left;
158
+ }
159
+ index++;
160
+ const right = parseTerm();
161
+ if (right.status !== 'valid') {
162
+ return right;
163
+ }
164
+ const value = operator === '+' ? left.value + right.value : left.value - right.value;
165
+ if (!Number.isFinite(value)) {
166
+ return invalid();
167
+ }
168
+ left = { status: 'valid', value };
169
+ }
170
+ };
171
+ const result = parseExpression();
172
+ if (result.status !== 'valid') {
173
+ return result;
174
+ }
175
+ skipWhitespace();
176
+ return index === input.length ? result : invalid();
177
+ };
178
+ exports.parseInputDraggerExpression = parseInputDraggerExpression;
179
+ const parseInputDraggerNumber = (value) => {
180
+ const result = (0, exports.parseInputDraggerExpression)(value);
181
+ return result.status === 'valid' ? result.value : null;
182
+ };
183
+ exports.parseInputDraggerNumber = parseInputDraggerNumber;
184
+ const getFiniteAttribute = (value) => {
185
+ const parsed = Number(value);
186
+ return Number.isFinite(parsed) ? parsed : null;
187
+ };
188
+ const getPositiveStep = (step) => {
189
+ if (step === 'any') {
190
+ return null;
191
+ }
192
+ const parsed = Number(step);
193
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 1;
194
+ };
195
+ const isInputDraggerValueAlignedToStep = ({ min, step, value, }) => {
196
+ var _a;
197
+ const numericStep = getPositiveStep(step);
198
+ if (numericStep === null) {
199
+ return true;
200
+ }
201
+ const stepBase = (_a = getFiniteAttribute(min)) !== null && _a !== void 0 ? _a : 0;
202
+ const stepsFromBase = (value - stepBase) / numericStep;
203
+ const tolerance = Number.EPSILON *
204
+ 10 *
205
+ Math.max(1, Math.abs(value / numericStep), Math.abs(stepBase / numericStep));
206
+ return Math.abs(stepsFromBase - Math.round(stepsFromBase)) <= tolerance;
207
+ };
208
+ exports.isInputDraggerValueAlignedToStep = isInputDraggerValueAlignedToStep;
209
+ const validateInputDraggerValue = ({ max, min, step, value, }) => {
210
+ const parsed = (0, exports.parseInputDraggerNumber)(value);
211
+ if (parsed === null) {
212
+ return {
213
+ valid: false,
214
+ message: 'Enter a valid number.',
215
+ };
216
+ }
217
+ const numericMin = getFiniteAttribute(min);
218
+ if (numericMin !== null && parsed < numericMin) {
219
+ return {
220
+ valid: false,
221
+ message: `Value must be greater than or equal to ${numericMin}.`,
222
+ };
223
+ }
224
+ const numericMax = getFiniteAttribute(max);
225
+ if (numericMax !== null && parsed > numericMax) {
226
+ return {
227
+ valid: false,
228
+ message: `Value must be less than or equal to ${numericMax}.`,
229
+ };
230
+ }
231
+ if (!(0, exports.isInputDraggerValueAlignedToStep)({ min, step, value: parsed })) {
232
+ return {
233
+ valid: false,
234
+ message: `Value must align to a step of ${step}.`,
235
+ };
236
+ }
237
+ return { valid: true, value: parsed };
238
+ };
239
+ exports.validateInputDraggerValue = validateInputDraggerValue;
240
+ const getDecimalPlaces = (value) => {
241
+ var _a;
242
+ var _b;
243
+ const [mantissa, exponentString] = String(value).toLowerCase().split('e');
244
+ const exponent = Number(exponentString !== null && exponentString !== void 0 ? exponentString : 0);
245
+ const fractionLength = (_b = (_a = mantissa.split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
246
+ return Math.max(0, fractionLength - exponent);
247
+ };
248
+ const deriveInputDraggerArrowValue = ({ direction, max, min, step, value, }) => {
249
+ var _a, _b, _c;
250
+ const numericStep = (_a = getPositiveStep(step)) !== null && _a !== void 0 ? _a : 1;
251
+ const decimalPlaces = Math.max(getDecimalPlaces(value), getDecimalPlaces(numericStep));
252
+ const unroundedValue = value + direction * numericStep;
253
+ const steppedValue = decimalPlaces <= 15
254
+ ? roundToDecimalPlaces(unroundedValue, decimalPlaces)
255
+ : Number(unroundedValue.toPrecision(15));
256
+ const numericMin = (_b = getFiniteAttribute(min)) !== null && _b !== void 0 ? _b : -Infinity;
257
+ const numericMax = (_c = getFiniteAttribute(max)) !== null && _c !== void 0 ? _c : Infinity;
258
+ return Math.min(numericMax, Math.max(numericMin, steppedValue));
259
+ };
260
+ exports.deriveInputDraggerArrowValue = deriveInputDraggerArrowValue;
63
261
  const deriveInputDraggerStep = ({ min, snapToStep, step, }) => {
64
262
  if (!snapToStep) {
65
263
  return 'any';
@@ -96,11 +294,18 @@ const deriveInputDraggerValueDiff = ({ dragSensitivity, step, xDistance, }) => {
96
294
  return (0, remotion_1.interpolate)(xDistance, [-5, -4, 0, 4, 5], [-step * dragSensitivity, 0, 0, 0, step * dragSensitivity]);
97
295
  };
98
296
  exports.deriveInputDraggerValueDiff = deriveInputDraggerValueDiff;
99
- const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min, max: _max, step: _step, value, onTextChange, formatter = (q) => String(q), status, rightAlign, small, snapToStep = true, dragDecimalPlaces, dragSensitivity = 1, ...props }, ref) => {
297
+ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min, max: _max, step: _step, value, onTextChange, formatter = (q) => String(q), status, rightAlign, small, snapToStep = true, dragDecimalPlaces, dragSensitivity = 1, type: _type, ...props }, ref) => {
100
298
  const [inputFallback, setInputFallback] = (0, react_1.useState)(false);
101
299
  const [dragging, setDragging] = (0, react_1.useState)(false);
102
300
  const fallbackRef = (0, react_1.useRef)(null);
103
301
  const pointerDownRef = (0, react_1.useRef)(false);
302
+ const deriveStep = (0, react_1.useMemo)(() => {
303
+ return (0, exports.deriveInputDraggerStep)({
304
+ min: _min,
305
+ snapToStep,
306
+ step: _step,
307
+ });
308
+ }, [_min, _step, snapToStep]);
104
309
  const span = (0, react_1.useMemo)(() => ({
105
310
  color: dragging ? 'var(--remotion-cli-internals-blue-hovered)' : colors_1.BLUE,
106
311
  cursor: 'ew-resize',
@@ -136,9 +341,9 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
136
341
  setInputFallback(false);
137
342
  }, []);
138
343
  const onInputChange = (0, react_1.useCallback)((e) => {
139
- const parsed = Number(e.target.value);
140
- if (e.target.value !== '' &&
141
- !Number.isNaN(parsed) &&
344
+ e.target.setCustomValidity('');
345
+ const parsed = (0, exports.parseInputDraggerNumber)(e.target.value);
346
+ if (parsed !== null &&
142
347
  (0, exports.isInputDraggerValueInRange)({
143
348
  max: _max,
144
349
  min: _min,
@@ -156,20 +361,48 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
156
361
  onEscape();
157
362
  return;
158
363
  }
159
- if (fallbackRef.current.checkValidity()) {
160
- onValueChangeEnd === null || onValueChangeEnd === void 0 ? void 0 : onValueChangeEnd(Number(newValue));
364
+ const validation = (0, exports.validateInputDraggerValue)({
365
+ max: _max,
366
+ min: _min,
367
+ step: deriveStep,
368
+ value: newValue,
369
+ });
370
+ if (validation.valid) {
371
+ fallbackRef.current.setCustomValidity('');
372
+ onValueChangeEnd === null || onValueChangeEnd === void 0 ? void 0 : onValueChangeEnd(validation.value);
161
373
  setInputFallback(false);
162
374
  }
163
375
  else {
376
+ fallbackRef.current.setCustomValidity(validation.message);
164
377
  fallbackRef.current.reportValidity();
165
378
  }
166
- }, [onEscape, onValueChangeEnd]);
167
- const onKeyPress = (0, react_1.useCallback)((e) => {
379
+ }, [_max, _min, deriveStep, onEscape, onValueChangeEnd]);
380
+ const onInputKeyDown = (0, react_1.useCallback)((e) => {
168
381
  var _a;
169
382
  if (e.key === 'Enter') {
170
383
  (_a = fallbackRef.current) === null || _a === void 0 ? void 0 : _a.blur();
384
+ return;
171
385
  }
172
- }, []);
386
+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') {
387
+ return;
388
+ }
389
+ e.preventDefault();
390
+ const parsedInputValue = (0, exports.parseInputDraggerNumber)(e.currentTarget.value);
391
+ const currentValue = parsedInputValue !== null && parsedInputValue !== void 0 ? parsedInputValue : (0, exports.deriveInputDraggerDragStartValue)({
392
+ min: _min,
393
+ value,
394
+ });
395
+ const nextValue = (0, exports.deriveInputDraggerArrowValue)({
396
+ direction: e.key === 'ArrowUp' ? 1 : -1,
397
+ max: _max,
398
+ min: _min,
399
+ step: deriveStep,
400
+ value: currentValue,
401
+ });
402
+ e.currentTarget.value = String(nextValue);
403
+ e.currentTarget.setCustomValidity('');
404
+ onValueChange(nextValue);
405
+ }, [_max, _min, deriveStep, onValueChange, value]);
173
406
  const roundToStep = (val, stepSize) => {
174
407
  const factor = 1 / stepSize;
175
408
  return Math.ceil(val * factor) / factor;
@@ -214,20 +447,33 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
214
447
  onValueChange(nextValue);
215
448
  };
216
449
  window.addEventListener('mousemove', moveListener);
217
- window.addEventListener('pointerup', () => {
450
+ const endDrag = (commit) => {
218
451
  window.removeEventListener('mousemove', moveListener);
452
+ window.removeEventListener('pointerup', onPointerUp);
453
+ window.removeEventListener('pointercancel', onPointerCancel);
454
+ window.removeEventListener('blur', onWindowBlur);
219
455
  pointerDownRef.current = false;
220
456
  setDragging(false);
221
457
  (0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
222
- if (lastDragValue !== null && onValueChangeEnd) {
458
+ if (commit && lastDragValue !== null && onValueChangeEnd) {
223
459
  onValueChangeEnd(lastDragValue);
224
460
  }
225
461
  setTimeout(() => {
226
462
  (0, input_dragger_click_lock_1.setClickLock)(false);
227
463
  }, 2);
228
- }, {
229
- once: true,
230
- });
464
+ };
465
+ const onPointerUp = () => {
466
+ endDrag(true);
467
+ };
468
+ const onPointerCancel = () => {
469
+ endDrag(false);
470
+ };
471
+ const onWindowBlur = () => {
472
+ endDrag(false);
473
+ };
474
+ window.addEventListener('pointerup', onPointerUp);
475
+ window.addEventListener('pointercancel', onPointerCancel);
476
+ window.addEventListener('blur', onWindowBlur);
231
477
  }, [
232
478
  _step,
233
479
  _min,
@@ -245,15 +491,8 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
245
491
  (_a = fallbackRef.current) === null || _a === void 0 ? void 0 : _a.select();
246
492
  }
247
493
  }, [inputFallback]);
248
- const deriveStep = (0, react_1.useMemo)(() => {
249
- return (0, exports.deriveInputDraggerStep)({
250
- min: _min,
251
- snapToStep,
252
- step: _step,
253
- });
254
- }, [_min, _step, snapToStep]);
255
494
  if (inputFallback) {
256
- return (jsx_runtime_1.jsx(z_index_1.HigherZIndex, { onEscape: onEscape, onOutsideClick: noop_1.noop, children: jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: fallbackRef, autoFocus: true, onKeyPress: onKeyPress, onBlur: onBlur, onChange: onInputChange, min: _min, max: _max, step: deriveStep, defaultValue: value, status: status, pattern: '[0-9]*[.]?[0-9]*', rightAlign: rightAlign, small: small, ...props }) }));
495
+ return (jsx_runtime_1.jsx(z_index_1.HigherZIndex, { onEscape: onEscape, onOutsideClick: noop_1.noop, children: jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: fallbackRef, autoFocus: true, onKeyDown: onInputKeyDown, onBlur: onBlur, onChange: onInputChange, min: _min, max: _max, step: deriveStep, defaultValue: value, status: status, rightAlign: rightAlign, small: small, ...props, type: "text" }) }));
257
496
  }
258
497
  return (jsx_runtime_1.jsx("button", { ref: ref, type: "button", className: '__remotion_input_dragger', style: exports.inputDraggerContainerStyle, onClick: onClick, onFocus: onFocus, onKeyDown: onKeyDown, onPointerDown: onPointerDown, children: jsx_runtime_1.jsx("span", { style: span, children: formatter(value) }) }));
259
498
  };
@@ -1,4 +1,2 @@
1
1
  import React from 'react';
2
- export declare const OutlineToggle: React.FC<{
3
- readonly disabled: boolean;
4
- }>;
2
+ export declare const OutlineToggle: React.FC;
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const colors_1 = require("../helpers/colors");
7
7
  const editor_outlines_1 = require("../state/editor-outlines");
8
8
  const ControlButton_1 = require("./ControlButton");
9
- const OutlineToggle = ({ disabled }) => {
9
+ const OutlineToggle = () => {
10
10
  const { editorShowOutlines, setEditorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
11
11
  const onClick = (0, react_1.useCallback)(() => {
12
12
  setEditorShowOutlines((current) => !current);
@@ -15,6 +15,6 @@ const OutlineToggle = ({ disabled }) => {
15
15
  const accessibilityLabel = editorShowOutlines
16
16
  ? 'Hide outlines'
17
17
  : 'Show outlines';
18
- return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, disabled: disabled, onClick: onClick, children: jsx_runtime_1.jsx("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 512 512", fill: color, "aria-hidden": "true", focusable: "false", children: jsx_runtime_1.jsx("path", { d: "M32 119.4C12.9 108.4 0 87.7 0 64 0 28.7 28.7 0 64 0 87.7 0 108.4 12.9 119.4 32l273.1 0c11.1-19.1 31.7-32 55.4-32 35.3 0 64 28.7 64 64 0 23.7-12.9 44.4-32 55.4l0 273.1c19.1 11.1 32 31.7 32 55.4 0 35.3-28.7 64-64 64-23.7 0-44.4-12.9-55.4-32l-273.1 0c-11.1 19.1-31.7 32-55.4 32-35.3 0-64-28.7-64-64 0-23.7 12.9-44.4 32-55.4l0-273.1zm64 0l0 273.1c9.7 5.6 17.8 13.7 23.4 23.4l273.1 0c5.6-9.7 13.7-17.8 23.4-23.4l0-273.1c-9.7-5.6-17.8-13.7-23.4-23.4L119.4 96c-5.6 9.7-13.7 17.8-23.4 23.4z" }) }) }));
18
+ return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: jsx_runtime_1.jsx("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 512 512", fill: color, "aria-hidden": "true", focusable: "false", children: jsx_runtime_1.jsx("path", { d: "M32 119.4C12.9 108.4 0 87.7 0 64 0 28.7 28.7 0 64 0 87.7 0 108.4 12.9 119.4 32l273.1 0c11.1-19.1 31.7-32 55.4-32 35.3 0 64 28.7 64 64 0 23.7-12.9 44.4-32 55.4l0 273.1c19.1 11.1 32 31.7 32 55.4 0 35.3-28.7 64-64 64-23.7 0-44.4-12.9-55.4-32l-273.1 0c-11.1 19.1-31.7 32-55.4 32-35.3 0-64-28.7-64-64 0-23.7 12.9-44.4 32-55.4l0-273.1zm64 0l0 273.1c9.7 5.6 17.8 13.7 23.4 23.4l273.1 0c5.6-9.7 13.7-17.8 23.4-23.4l0-273.1c-9.7-5.6-17.8-13.7-23.4-23.4L119.4 96c-5.6 9.7-13.7 17.8-23.4 23.4z" }) }) }));
19
19
  };
20
20
  exports.OutlineToggle = OutlineToggle;
@@ -39,7 +39,7 @@ const container = {
39
39
  const mobileContainer = {
40
40
  ...container,
41
41
  position: 'relative',
42
- overflowY: 'auto',
42
+ overflowX: 'auto',
43
43
  justifyContent: 'flex-start',
44
44
  };
45
45
  const scrollIndicatorLeft = {
@@ -69,6 +69,13 @@ const sideContainer = {
69
69
  flexDirection: 'row',
70
70
  alignItems: 'center',
71
71
  };
72
+ const mobileSideContainer = {
73
+ height: 30,
74
+ display: 'flex',
75
+ flexDirection: 'row',
76
+ alignItems: 'center',
77
+ flexShrink: 0,
78
+ };
72
79
  const padding = {
73
80
  width: timeline_layout_1.TIMELINE_PADDING,
74
81
  };
@@ -166,9 +173,8 @@ const PreviewToolbar = ({ readOnlyStudio, bufferStateDelayInMilliseconds }) => {
166
173
  ] }), jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SizeSelector_1.SizeSelector, {}) }), isStill || isVideoComposition ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }) })) : null] })), isVideoComposition ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
167
174
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PlayPause_1.PlayPause, { bufferStateDelayInMilliseconds: bufferStateDelayInMilliseconds, loop: loop, playbackRate: playbackRate, muted: playerMuted }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(LoopToggle_1.LoopToggle, { loop: loop, setLoop: setLoop }) }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(MuteToggle_1.MuteToggle, { muted: playerMuted, setMuted: setPlayerMuted }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(TimelineInOutToggle_1.TimelineInOutPointToggle, {}) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 })
168
175
  ] })) : null, (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
169
- jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(CheckboardToggle_1.CheckboardToggle, {}) }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(OutlineToggle_1.OutlineToggle, { disabled: readOnlyStudio }) }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SnappingToggle_1.SnappingToggle, { disabled: readOnlyStudio }) })
170
- ] })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), canvasContent && isFullscreenSupported ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(FullscreenToggle_1.FullScreenToggle, {}) })) : null, jsx_runtime_1.jsx(layout_1.Flex, {}), isMobileLayout && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
171
- jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SizeSelector_1.SizeSelector, {}) }), isStill || isVideoComposition ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }) })) : null] })), jsx_runtime_1.jsxs("div", { style: sideContainer, children: [
176
+ jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(CheckboardToggle_1.CheckboardToggle, {}) }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(OutlineToggle_1.OutlineToggle, {}) }), readOnlyStudio ? null : (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SnappingToggle_1.SnappingToggle, {}) }))] })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), canvasContent && isFullscreenSupported ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(FullscreenToggle_1.FullScreenToggle, {}) })) : null, jsx_runtime_1.jsx(layout_1.Flex, {}), isMobileLayout && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
177
+ jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(SizeSelector_1.SizeSelector, {}) }), isStill || isVideoComposition ? (jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(PlaybackRateSelector_1.PlaybackRateSelector, { setPlaybackRate: setPlaybackRate, playbackRate: playbackRate }) })) : null] })), jsx_runtime_1.jsxs("div", { style: isMobileLayout ? mobileSideContainer : sideContainer, children: [
172
178
  jsx_runtime_1.jsx(layout_1.Flex, {}), !isMobileLayout && jsx_runtime_1.jsx(FpsCounter_1.FpsCounter, { playbackSpeed: playbackRate }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(PreviewToolbarControl, { children: jsx_runtime_1.jsx(RenderButton_1.RenderButton, { readOnlyStudio: readOnlyStudio, size: "compact" }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1.5 })
173
179
  ] }), jsx_runtime_1.jsx(PlaybackKeyboardShortcutsManager_1.PlaybackKeyboardShortcutsManager, { setPlaybackRate: setPlaybackRate }), jsx_runtime_1.jsx(PlaybackRatePersistor_1.PlaybackRatePersistor, {}), jsx_runtime_1.jsx("div", { ref: rightScrollIndicatorRef, style: scrollIndicatorRight })
174
180
  ] }));
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { QuickSwitcherMode } from './NoResults';
3
+ export declare const ExplorerQuickSwitcherTrigger: React.FC<{
4
+ readonly mode: QuickSwitcherMode;
5
+ readonly showShortcut: boolean;
6
+ readonly tabIndex: number;
7
+ }>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExplorerQuickSwitcherTrigger = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const ShortcutHint_1 = require("../../error-overlay/remotion-overlay/ShortcutHint");
7
+ const colors_1 = require("../../helpers/colors");
8
+ const use_keybinding_1 = require("../../helpers/use-keybinding");
9
+ const modals_1 = require("../../state/modals");
10
+ const quickSwitcherArea = {
11
+ padding: '4px 12px',
12
+ borderBottom: `1px solid ${colors_1.BLACK_HEX}`,
13
+ };
14
+ const quickSwitcherTrigger = {
15
+ backgroundColor: colors_1.WHITE_ALPHA_06,
16
+ borderRadius: 5,
17
+ padding: '4px 10px',
18
+ color: colors_1.LIGHT_TEXT,
19
+ fontSize: 12,
20
+ cursor: 'pointer',
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ justifyContent: 'space-between',
24
+ border: 'none',
25
+ width: '100%',
26
+ appearance: 'none',
27
+ };
28
+ const shortcutLabel = {
29
+ fontSize: 11,
30
+ opacity: 0.6,
31
+ };
32
+ const ExplorerQuickSwitcherTrigger = ({ mode, showShortcut, tabIndex }) => {
33
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
34
+ const openQuickSwitcher = (0, react_1.useCallback)(() => {
35
+ setSelectedModal({
36
+ type: 'quick-switcher',
37
+ mode,
38
+ invocationTimestamp: Date.now(),
39
+ assetSelection: null,
40
+ });
41
+ }, [mode, setSelectedModal]);
42
+ return (jsx_runtime_1.jsx("div", { style: quickSwitcherArea, children: jsx_runtime_1.jsxs("button", { type: "button", style: quickSwitcherTrigger, onClick: openQuickSwitcher, tabIndex: tabIndex, children: ["Search...", showShortcut && !(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? (jsx_runtime_1.jsxs("span", { style: shortcutLabel, children: [ShortcutHint_1.cmdOrCtrlCharacter, "+K"] })) : null] }) }));
43
+ };
44
+ exports.ExplorerQuickSwitcherTrigger = ExplorerQuickSwitcherTrigger;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export type QuickSwitcherMode = 'commands' | 'compositions' | 'docs';
2
+ export type QuickSwitcherMode = 'assets' | 'commands' | 'compositions' | 'docs';
3
3
  export declare const QuickSwitcherNoResults: React.FC<{
4
4
  readonly query: string;
5
5
  readonly mode: QuickSwitcherMode;
@@ -10,6 +10,7 @@ const container = {
10
10
  fontSize: 14,
11
11
  };
12
12
  const MODE_TO_STRING = {
13
+ assets: 'assets',
13
14
  commands: 'commands',
14
15
  compositions: 'compositions',
15
16
  docs: 'documentation',
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
+ import type { StaticFile } from '../../api/get-static-files';
2
3
  import type { QuickSwitcherMode } from './NoResults';
3
4
  declare const QuickSwitcher: React.FC<{
4
5
  readonly initialMode: QuickSwitcherMode;
5
6
  readonly invocationTimestamp: number;
6
7
  readonly readOnlyStudio: boolean;
8
+ readonly assetSelection: {
9
+ readonly initialQuery: string;
10
+ readonly onSelected: (asset: StaticFile) => void;
11
+ } | null;
7
12
  }>;
8
13
  export default QuickSwitcher;
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const DismissableModal_1 = require("../NewComposition/DismissableModal");
5
5
  const QuickSwitcherContent_1 = require("./QuickSwitcherContent");
6
- const QuickSwitcher = ({ initialMode, invocationTimestamp, readOnlyStudio }) => {
7
- return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { children: jsx_runtime_1.jsx(QuickSwitcherContent_1.QuickSwitcherContent, { readOnlyStudio: readOnlyStudio, invocationTimestamp: invocationTimestamp, initialMode: initialMode }) }));
6
+ const panelStyle = {
7
+ borderRadius: 6,
8
+ overflow: 'hidden',
9
+ };
10
+ const QuickSwitcher = ({ initialMode, invocationTimestamp, readOnlyStudio, assetSelection }) => {
11
+ return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { panelStyle: panelStyle, children: jsx_runtime_1.jsx(QuickSwitcherContent_1.QuickSwitcherContent, { readOnlyStudio: readOnlyStudio, invocationTimestamp: invocationTimestamp, initialMode: initialMode, assetSelection: assetSelection }) }));
8
12
  };
9
13
  exports.default = QuickSwitcher;
@@ -1,7 +1,12 @@
1
1
  import React from 'react';
2
+ import type { StaticFile } from '../../api/get-static-files';
2
3
  import type { QuickSwitcherMode } from './NoResults';
3
4
  export declare const QuickSwitcherContent: React.FC<{
4
5
  readonly initialMode: QuickSwitcherMode;
5
6
  readonly invocationTimestamp: number;
6
7
  readonly readOnlyStudio: boolean;
8
+ readonly assetSelection: {
9
+ readonly initialQuery: string;
10
+ readonly onSelected: (asset: StaticFile) => void;
11
+ } | null;
7
12
  }>;