@remotion/studio 4.0.487 → 4.0.489

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.
@@ -40,6 +40,8 @@ const remotion_1 = require("remotion");
40
40
  const client_id_1 = require("../../helpers/client-id");
41
41
  const colors_1 = require("../../helpers/colors");
42
42
  const format_file_location_1 = require("../../helpers/format-file-location");
43
+ const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
44
+ const studio_runtime_config_1 = require("../../helpers/studio-runtime-config");
43
45
  const timeline_layout_1 = require("../../helpers/timeline-layout");
44
46
  const use_keybinding_1 = require("../../helpers/use-keybinding");
45
47
  const modals_1 = require("../../state/modals");
@@ -158,6 +160,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
158
160
  const nodePath = (_d = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _d !== void 0 ? _d : null;
159
161
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
160
162
  const previewConnected = previewServerState.type === 'connected';
163
+ const previewInteractive = previewConnected && interactivity_enabled_1.studioInteractivityEnabled;
161
164
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
162
165
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
163
166
  const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
@@ -191,7 +194,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
191
194
  };
192
195
  }, [originalLocation]);
193
196
  const { canRename: canRenameThisSequence, displayName, fallbackDisplayName, propStatusesForOverride, saveName, } = (0, use_rename_sequence_1.useRenameSequence)({
194
- clientId: previewServerState.type === 'connected'
197
+ clientId: previewInteractive && previewServerState.type === 'connected'
195
198
  ? previewServerState.clientId
196
199
  : null,
197
200
  nodePathInfo,
@@ -201,25 +204,25 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
201
204
  const canDeleteFromSource = Boolean(nodePath && (validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source));
202
205
  const nodePathKey = (0, react_1.useMemo)(() => nodePath ? remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath) : null, [nodePath]);
203
206
  const parentId = (_e = sequence.parent) !== null && _e !== void 0 ? _e : null;
204
- const canReorderSequence = previewConnected &&
207
+ const canReorderSequence = previewInteractive &&
205
208
  Boolean(nodePath && nodePathKey && (validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source)) &&
206
209
  (nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.numberOfSequencesWithThisNodePath) === 1;
207
- const canHandleSequenceDrag = previewConnected;
210
+ const canHandleSequenceDrag = previewInteractive;
208
211
  const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
209
- const deleteDisabled = (0, react_1.useMemo)(() => !previewConnected || !sequence.controls || !canDeleteFromSource, [previewConnected, sequence.controls, canDeleteFromSource]);
212
+ const deleteDisabled = (0, react_1.useMemo)(() => !previewInteractive || !sequence.controls || !canDeleteFromSource, [previewInteractive, sequence.controls, canDeleteFromSource]);
210
213
  const duplicateDisabled = deleteDisabled;
211
- const disableInteractivityDisabled = !previewConnected ||
214
+ const disableInteractivityDisabled = !previewInteractive ||
212
215
  !sequence.showInTimeline ||
213
216
  !nodePath ||
214
217
  !(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source);
215
218
  const onDuplicateSequenceFromSource = (0, react_1.useCallback)(() => {
216
- if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePathInfo) {
219
+ if (duplicateDisabled || !(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePathInfo) {
217
220
  return;
218
221
  }
219
222
  (0, duplicate_selected_timeline_item_1.duplicateSequencesFromSource)([nodePathInfo], confirm).catch(() => undefined);
220
- }, [confirm, nodePathInfo, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source]);
223
+ }, [confirm, duplicateDisabled, nodePathInfo, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source]);
221
224
  const onDeleteSequenceFromSource = (0, react_1.useCallback)(async () => {
222
- if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
225
+ if (deleteDisabled || !(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
223
226
  return;
224
227
  }
225
228
  if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
@@ -253,7 +256,13 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
253
256
  catch (err) {
254
257
  (0, NotificationCenter_1.showNotification)(err.message, 4000);
255
258
  }
256
- }, [confirm, nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
259
+ }, [
260
+ confirm,
261
+ deleteDisabled,
262
+ nodePath,
263
+ validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
264
+ nodePathInfo,
265
+ ]);
257
266
  const onDisableSequenceInteractivity = (0, react_1.useCallback)(() => {
258
267
  if (disableInteractivityDisabled ||
259
268
  !nodePath ||
@@ -517,8 +526,9 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
517
526
  }
518
527
  : inner;
519
528
  }, [effectDropHovered, inner]);
520
- const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
521
- const canToggleVisibility = previewConnected &&
529
+ const hasExpandableContent = interactivity_enabled_1.studioInteractivityEnabled &&
530
+ (Boolean(sequence.controls) || sequence.effects.length > 0);
531
+ const canToggleVisibility = previewInteractive &&
522
532
  Boolean(sequence.controls) &&
523
533
  nodePath !== null &&
524
534
  validatedLocation !== null &&
@@ -549,7 +559,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
549
559
  await saveName(name);
550
560
  }, [saveName]);
551
561
  react_1.default.useEffect(() => {
552
- if (!canRenameSelectedSequence || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
562
+ if (!canRenameSelectedSequence || !(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
553
563
  setIsRenaming(false);
554
564
  return;
555
565
  }
@@ -583,7 +593,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
583
593
  setIsRenaming(true);
584
594
  }, [canRenameThisSequence]);
585
595
  const freezeFrameMenuItem = (0, use_sequence_freeze_frame_menu_item_1.useSequenceFreezeFrameMenuItem)({
586
- clientId: previewServerState.type === 'connected'
596
+ clientId: previewInteractive && previewServerState.type === 'connected'
587
597
  ? previewServerState.clientId
588
598
  : null,
589
599
  nodePath,
@@ -595,7 +605,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
595
605
  validatedSource: (_f = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) !== null && _f !== void 0 ? _f : null,
596
606
  });
597
607
  const canAddEffect = (nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.supportsEffects) === true &&
598
- previewServerState.type === 'connected' &&
608
+ previewInteractive &&
599
609
  Boolean(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source);
600
610
  const onAddEffect = (0, react_1.useCallback)(() => {
601
611
  if (!canAddEffect ||
@@ -628,7 +638,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
628
638
  disableInteractivityDisabled,
629
639
  duplicateDisabled,
630
640
  fileLocation,
631
- includeSourceEditItems: true,
641
+ includeSourceEditItems: interactivity_enabled_1.studioInteractivityEnabled,
632
642
  onDeleteSequenceFromSource,
633
643
  onDisableSequenceInteractivity,
634
644
  onDuplicateSequenceFromSource,
@@ -636,43 +646,45 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
636
646
  originalLocation,
637
647
  selectAsset,
638
648
  sequence,
639
- sourceActions: [
640
- ...((nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.supportsEffects)
641
- ? [
642
- {
643
- type: 'item',
644
- id: 'add-effect',
645
- keyHint: null,
646
- label: 'Add effect...',
647
- leftItem: null,
648
- disabled: !canAddEffect,
649
- onClick: onAddEffect,
650
- quickSwitcherLabel: null,
651
- subMenu: null,
652
- value: 'add-effect',
653
- },
654
- {
655
- type: 'divider',
656
- id: 'add-effect-divider',
649
+ sourceActions: interactivity_enabled_1.studioInteractivityEnabled
650
+ ? [
651
+ ...((nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.supportsEffects)
652
+ ? [
653
+ {
654
+ type: 'item',
655
+ id: 'add-effect',
656
+ keyHint: null,
657
+ label: 'Add effect...',
658
+ leftItem: null,
659
+ disabled: !canAddEffect,
660
+ onClick: onAddEffect,
661
+ quickSwitcherLabel: null,
662
+ subMenu: null,
663
+ value: 'add-effect',
664
+ },
665
+ {
666
+ type: 'divider',
667
+ id: 'add-effect-divider',
668
+ },
669
+ ]
670
+ : []),
671
+ {
672
+ type: 'item',
673
+ id: 'rename-sequence',
674
+ keyHint: null,
675
+ label: 'Rename...',
676
+ leftItem: null,
677
+ disabled: !canRenameThisSequence,
678
+ onClick: () => {
679
+ onRenameSequence();
657
680
  },
658
- ]
659
- : []),
660
- {
661
- type: 'item',
662
- id: 'rename-sequence',
663
- keyHint: null,
664
- label: 'Rename...',
665
- leftItem: null,
666
- disabled: !canRenameThisSequence,
667
- onClick: () => {
668
- onRenameSequence();
681
+ quickSwitcherLabel: null,
682
+ subMenu: null,
683
+ value: 'rename-sequence',
669
684
  },
670
- quickSwitcherLabel: null,
671
- subMenu: null,
672
- value: 'rename-sequence',
673
- },
674
- ...(freezeFrameMenuItem ? [freezeFrameMenuItem] : []),
675
- ],
685
+ ...(freezeFrameMenuItem ? [freezeFrameMenuItem] : []),
686
+ ]
687
+ : [],
676
688
  });
677
689
  }, [
678
690
  assetLinkInfo,
@@ -696,7 +708,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
696
708
  selectAsset,
697
709
  sequence,
698
710
  ]);
699
- const canDropEffect = previewServerState.type === 'connected' &&
711
+ const canDropEffect = previewInteractive &&
700
712
  nodePath !== null &&
701
713
  validatedLocation !== null &&
702
714
  ((_c = sequence.controls) === null || _c === void 0 ? void 0 : _c.supportsEffects) === true;
@@ -754,7 +766,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
754
766
  clientId: previewServerState.clientId,
755
767
  });
756
768
  }, [canDropEffect, nodePath, previewServerState, validatedLocation]);
757
- const trackRow = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent && nodePathInfo !== null ? (jsx_runtime_1.jsx(TimelineSequenceExpandArrow, { disabled: !previewConnected, isExpanded: isExpanded, nodePathInfo: nodePathInfo, onToggleExpand: onToggleExpand, sequence: sequence })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: rowStyle, selected: selected, selectable: selectable, selectionItem: selectionItem, onSelect: onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: outerHeight, onDragLeave: canDropEffect ? onEffectDragLeave : undefined, onDragOver: canDropEffect ? onEffectDragOver : undefined, onDrop: canDropEffect ? onEffectDrop : undefined, onDoubleClick: canRenameThisSequence || canOpenInEditor
769
+ const trackRow = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent && nodePathInfo !== null ? (jsx_runtime_1.jsx(TimelineSequenceExpandArrow, { disabled: !previewInteractive, isExpanded: isExpanded, nodePathInfo: nodePathInfo, onToggleExpand: onToggleExpand, sequence: sequence })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: rowStyle, selected: selected, selectable: selectable, selectionItem: selectionItem, onSelect: onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: outerHeight, onDragLeave: canDropEffect ? onEffectDragLeave : undefined, onDragOver: canDropEffect ? onEffectDragOver : undefined, onDrop: canDropEffect ? onEffectDrop : undefined, onDoubleClick: canRenameThisSequence || canOpenInEditor
758
770
  ? onSequenceDoubleClick
759
771
  : undefined, children: jsx_runtime_1.jsxs("div", { style: labelContainerStyle, children: [
760
772
  jsx_runtime_1.jsx(TimelineSequenceName_1.TimelineSequenceName, { displayName: displayName, fallbackDisplayName: fallbackDisplayName, selected: selected, containsSelection: containsSelection, editing: isRenaming, onCancelEditing: onCancelRenaming, onSaveName: onSaveName }), mediaSrc ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
@@ -764,6 +776,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
764
776
  ] })) : null] }) }));
765
777
  const draggableTrackRow = canHandleSequenceDrag ? (jsx_runtime_1.jsxs("div", { draggable: canReorderSequence, onDragStart: onSequenceDragStart, onDragEnd: onSequenceDragEnd, onDragOver: onSequenceDragOver, onDragLeave: onSequenceDragLeave, onDrop: onSequenceDrop, style: sequenceReorderWrapper, children: [sequenceReorderLineStyle ? (jsx_runtime_1.jsx("div", { style: sequenceReorderLineStyle })) : null, sequenceDropRejection ? (jsx_runtime_1.jsx("div", { style: sequenceReorderRejectionStyle, children: sequenceDropRejection })) : null, trackRow] })) : (trackRow);
766
778
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selectable ? onSelect : null, children: draggableTrackRow })) : (draggableTrackRow), previewConnected &&
779
+ interactivity_enabled_1.studioInteractivityEnabled &&
767
780
  isExpanded &&
768
781
  hasExpandableContent &&
769
782
  nodePathInfo &&