@remotion/studio 4.0.472 → 4.0.473

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 (133) hide show
  1. package/dist/api/rename-static-file.d.ts +6 -0
  2. package/dist/api/rename-static-file.js +18 -0
  3. package/dist/components/AssetSelector.js +45 -4
  4. package/dist/components/AssetSelectorItem.js +153 -27
  5. package/dist/components/Canvas.js +60 -11
  6. package/dist/components/ConfirmationDialog-types.d.ts +8 -0
  7. package/dist/components/ConfirmationDialog-types.js +2 -0
  8. package/dist/components/ConfirmationDialog.d.ts +7 -0
  9. package/dist/components/ConfirmationDialog.js +103 -0
  10. package/dist/components/ContextMenu.d.ts +9 -1
  11. package/dist/components/ContextMenu.js +49 -5
  12. package/dist/components/CurrentAsset.d.ts +1 -0
  13. package/dist/components/CurrentAsset.js +13 -2
  14. package/dist/components/EditorContent.js +15 -2
  15. package/dist/components/EditorContexts.js +2 -1
  16. package/dist/components/EditorRuler/Ruler.js +2 -0
  17. package/dist/components/ExplorerPanel.d.ts +0 -4
  18. package/dist/components/ExplorerPanel.js +8 -4
  19. package/dist/components/ExplorerPanelRef.d.ts +4 -0
  20. package/dist/components/ExplorerPanelRef.js +5 -0
  21. package/dist/components/FilePreview.d.ts +1 -1
  22. package/dist/components/InitialCompositionLoader.d.ts +0 -1
  23. package/dist/components/InitialCompositionLoader.js +5 -27
  24. package/dist/components/Menu/MenuItem.js +7 -1
  25. package/dist/components/Menu/SubMenu.js +5 -1
  26. package/dist/components/Menu/portals.js +17 -8
  27. package/dist/components/MenuToolbar.js +5 -1
  28. package/dist/components/ModalContainer.js +6 -1
  29. package/dist/components/Modals.js +6 -2
  30. package/dist/components/NewComposition/ComboBox.js +8 -2
  31. package/dist/components/NewComposition/DeleteStaticFile.d.ts +4 -0
  32. package/dist/components/NewComposition/DeleteStaticFile.js +44 -0
  33. package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
  34. package/dist/components/NewComposition/RenameStaticFile.js +118 -0
  35. package/dist/components/OptionsPanel.js +5 -1
  36. package/dist/components/OutlineToggle.d.ts +2 -0
  37. package/dist/components/OutlineToggle.js +20 -0
  38. package/dist/components/Preview.d.ts +0 -2
  39. package/dist/components/Preview.js +23 -33
  40. package/dist/components/PreviewToolbar.js +19 -6
  41. package/dist/components/RenderButton.js +8 -2
  42. package/dist/components/RenderPreview.js +2 -2
  43. package/dist/components/SelectedOutlineOverlay.d.ts +24 -0
  44. package/dist/components/SelectedOutlineOverlay.js +190 -22
  45. package/dist/components/ShowOutlinesProvider.d.ts +4 -0
  46. package/dist/components/ShowOutlinesProvider.js +24 -0
  47. package/dist/components/SizeSelector.js +3 -3
  48. package/dist/components/Splitter/SplitterHandle.js +2 -0
  49. package/dist/components/StaticFilePreview.js +2 -2
  50. package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
  51. package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
  52. package/dist/components/Timeline/Timeline.js +3 -13
  53. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +25 -2
  54. package/dist/components/Timeline/TimelineClipboardKeybindings.js +234 -20
  55. package/dist/components/Timeline/TimelineDeleteKeybindings.js +12 -2
  56. package/dist/components/Timeline/TimelineEffectItem.js +1 -0
  57. package/dist/components/Timeline/TimelineEffectPropItem.js +52 -2
  58. package/dist/components/Timeline/TimelineKeyframeControls.js +5 -15
  59. package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -21
  60. package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
  61. package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
  62. package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
  63. package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
  64. package/dist/components/Timeline/TimelineList.js +2 -2
  65. package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
  66. package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
  67. package/dist/components/Timeline/TimelineScaleField.js +1 -1
  68. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
  69. package/dist/components/Timeline/TimelineSequenceItem.js +276 -22
  70. package/dist/components/Timeline/TimelineSequencePropItem.js +81 -16
  71. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +25 -28
  72. package/dist/components/Timeline/apply-effect-response-to-code-values.d.ts +5 -0
  73. package/dist/components/Timeline/apply-effect-response-to-code-values.js +19 -0
  74. package/dist/components/Timeline/call-add-keyframe.js +2 -0
  75. package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
  76. package/dist/components/Timeline/call-move-keyframe.js +71 -0
  77. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
  78. package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
  79. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +7 -4
  80. package/dist/components/Timeline/delete-selected-timeline-item.js +33 -21
  81. package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
  82. package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
  83. package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
  84. package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
  85. package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
  86. package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
  87. package/dist/components/Timeline/reset-selected-timeline-props.js +3 -2
  88. package/dist/components/Timeline/save-effect-prop.d.ts +14 -3
  89. package/dist/components/Timeline/save-effect-prop.js +36 -18
  90. package/dist/components/Timeline/save-prop-queue.d.ts +2 -1
  91. package/dist/components/Timeline/save-prop-queue.js +5 -2
  92. package/dist/components/Timeline/save-sequence-prop.d.ts +2 -7
  93. package/dist/components/Timeline/save-sequence-prop.js +33 -30
  94. package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
  95. package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
  96. package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
  97. package/dist/components/Timeline/timeline-asset-link.js +37 -0
  98. package/dist/components/Timeline/timeline-translate-utils.js +4 -1
  99. package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
  100. package/dist/components/Timeline/use-timeline-keyframe-drag.js +378 -0
  101. package/dist/components/import-assets.d.ts +16 -0
  102. package/dist/components/import-assets.js +155 -18
  103. package/dist/components/load-canvas-content-from-url.d.ts +1 -0
  104. package/dist/components/load-canvas-content-from-url.js +9 -3
  105. package/dist/components/use-select-asset.d.ts +1 -0
  106. package/dist/components/use-select-asset.js +30 -0
  107. package/dist/error-overlay/error-origin.d.ts +3 -0
  108. package/dist/error-overlay/error-origin.js +42 -0
  109. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
  110. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
  111. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
  112. package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
  113. package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
  114. package/dist/esm/{chunk-48grt472.js → chunk-q0jkt0zq.js} +21961 -19299
  115. package/dist/esm/internals.mjs +21961 -19299
  116. package/dist/esm/previewEntry.mjs +20600 -17914
  117. package/dist/esm/renderEntry.mjs +1 -1
  118. package/dist/helpers/get-asset-metadata.js +2 -2
  119. package/dist/helpers/get-preview-file-type.d.ts +2 -0
  120. package/dist/helpers/get-preview-file-type.js +33 -0
  121. package/dist/helpers/install-required-package.d.ts +1 -0
  122. package/dist/helpers/install-required-package.js +39 -0
  123. package/dist/helpers/remote-asset-drag.d.ts +4 -0
  124. package/dist/helpers/remote-asset-drag.js +73 -0
  125. package/dist/helpers/use-asset-drag-events.d.ts +5 -2
  126. package/dist/helpers/use-asset-drag-events.js +13 -2
  127. package/dist/hot-middleware-client/client.js +6 -0
  128. package/dist/state/editor-outlines.d.ts +8 -0
  129. package/dist/state/editor-outlines.js +18 -0
  130. package/dist/state/modals.d.ts +19 -2
  131. package/package.json +10 -10
  132. package/dist/helpers/detect-file-type.d.ts +0 -69
  133. package/dist/helpers/detect-file-type.js +0 -278
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SelectedOutlineOverlay = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineDragChanges = exports.getSelectedOutlineDragValues = exports.getSequencesWithSelectableOutlines = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getUvCoordinateForPoint = exports.getUvHandlePosition = void 0;
36
+ exports.SelectedOutlineOverlay = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineDragChanges = exports.getSelectedOutlineDragValues = exports.getSequencesWithSelectableOutlines = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getUvCoordinateForPoint = exports.getUvHandleConnectionLines = exports.getUvHandlePosition = 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");
@@ -41,8 +41,12 @@ const no_react_1 = require("remotion/no-react");
41
41
  const calculate_timeline_1 = require("../helpers/calculate-timeline");
42
42
  const client_id_1 = require("../helpers/client-id");
43
43
  const colors_1 = require("../helpers/colors");
44
+ const format_file_location_1 = require("../helpers/format-file-location");
44
45
  const get_box_quads_ponyfill_1 = require("../helpers/get-box-quads-ponyfill");
46
+ const open_in_editor_1 = require("../helpers/open-in-editor");
47
+ const editor_outlines_1 = require("../state/editor-outlines");
45
48
  const scale_lock_1 = require("../state/scale-lock");
49
+ const ContextMenu_1 = require("./ContextMenu");
46
50
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
47
51
  const call_add_keyframe_1 = require("./Timeline/call-add-keyframe");
48
52
  const save_effect_prop_1 = require("./Timeline/save-effect-prop");
@@ -51,6 +55,7 @@ const timeline_field_utils_1 = require("./Timeline/timeline-field-utils");
51
55
  const timeline_translate_utils_1 = require("./Timeline/timeline-translate-utils");
52
56
  const TimelineScaleField_1 = require("./Timeline/TimelineScaleField");
53
57
  const TimelineSelection_1 = require("./Timeline/TimelineSelection");
58
+ const get_stack_1 = require("./Timeline/TimelineStack/get-stack");
54
59
  const translateFieldKey = 'style.translate';
55
60
  const scaleFieldKey = 'style.scale';
56
61
  const outlineContainer = {
@@ -59,6 +64,7 @@ const outlineContainer = {
59
64
  pointerEvents: 'none',
60
65
  overflow: 'visible',
61
66
  };
67
+ const emptyContextMenuValues = [];
62
68
  const pointToString = (point) => `${point.x},${point.y}`;
63
69
  const parseUvCoordinate = (value) => {
64
70
  if (Array.isArray(value) &&
@@ -142,6 +148,39 @@ const getUvHandlePosition = (points, uv) => {
142
148
  : applyProjectiveTransform(transform, uv);
143
149
  };
144
150
  exports.getUvHandlePosition = getUvHandlePosition;
151
+ const getUvHandleConnectionLines = ({ handles, points, }) => {
152
+ const handlesByField = new Map(handles.map((handle) => [
153
+ `${handle.effectIndex}\u0000${handle.fieldKey}`,
154
+ handle,
155
+ ]));
156
+ const seenPairs = new Set();
157
+ const lines = [];
158
+ for (const handle of handles) {
159
+ const targetFieldKey = handle.fieldSchema.lineTo;
160
+ if (targetFieldKey === undefined || targetFieldKey === handle.fieldKey) {
161
+ continue;
162
+ }
163
+ const target = handlesByField.get(`${handle.effectIndex}\u0000${targetFieldKey}`);
164
+ if (target === undefined) {
165
+ continue;
166
+ }
167
+ const pairKey = [
168
+ handle.effectIndex,
169
+ ...[handle.fieldKey, targetFieldKey].sort(),
170
+ ].join('\u0000');
171
+ if (seenPairs.has(pairKey)) {
172
+ continue;
173
+ }
174
+ seenPairs.add(pairKey);
175
+ lines.push({
176
+ key: `${handle.effectIndex}-${handle.fieldKey}-${targetFieldKey}`,
177
+ from: (0, exports.getUvHandlePosition)(points, handle.value),
178
+ to: (0, exports.getUvHandlePosition)(points, target.value),
179
+ });
180
+ }
181
+ return lines;
182
+ };
183
+ exports.getUvHandleConnectionLines = getUvHandleConnectionLines;
145
184
  const vectorBetween = (from, to) => {
146
185
  return { x: to.x - from.x, y: to.y - from.y };
147
186
  };
@@ -603,13 +642,14 @@ const clearSelectedOutlineScaleDragOverrides = ({ clearDragOverrides, dragStates
603
642
  clearDragOverrides(dragState.target.nodePath);
604
643
  }
605
644
  };
606
- const SelectedOutlinePolygon = ({ allDragTargets, hovered, outline, onHoverChange, onSelect, scale, target, }) => {
645
+ const SelectedOutlinePolygon = ({ allDragTargets, contextMenuValues, dragging, hovered, onContextMenuOpen, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
607
646
  var _a, _b;
608
647
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
609
648
  const { setCodeValues, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
610
649
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
611
650
  const timelinePositionRef = (0, react_1.useRef)(timelinePosition);
612
651
  timelinePositionRef.current = timelinePosition;
652
+ const polygonRef = (0, react_1.useRef)(null);
613
653
  const points = (0, react_1.useMemo)(() => outline.points.map(pointToString).join(' '), [outline.points]);
614
654
  const drag = (_a = target === null || target === void 0 ? void 0 : target.drag) !== null && _a !== void 0 ? _a : null;
615
655
  const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
@@ -628,6 +668,7 @@ const SelectedOutlinePolygon = ({ allDragTargets, hovered, outline, onHoverChang
628
668
  if (drag === null || interaction.shiftKey || interaction.toggleKey) {
629
669
  return;
630
670
  }
671
+ onDraggingChange(true);
631
672
  const startPointerX = event.clientX;
632
673
  const startPointerY = event.clientY;
633
674
  const dragStates = getSelectedOutlineDragStates({
@@ -664,6 +705,7 @@ const SelectedOutlinePolygon = ({ allDragTargets, hovered, outline, onHoverChang
664
705
  window.removeEventListener('pointermove', onPointerMove);
665
706
  window.removeEventListener('pointerup', onPointerUp);
666
707
  window.removeEventListener('pointercancel', onPointerUp);
708
+ onDraggingChange(false);
667
709
  const changes = (0, exports.getSelectedOutlineDragChanges)({
668
710
  dragStates,
669
711
  lastValues,
@@ -680,8 +722,12 @@ const SelectedOutlinePolygon = ({ allDragTargets, hovered, outline, onHoverChang
680
722
  changes: staticChanges,
681
723
  setCodeValues,
682
724
  clientId: drag.clientId,
683
- undoLabel: changes.length > 1 ? 'Move selected sequences' : null,
684
- redoLabel: changes.length > 1 ? 'Move selected sequences back' : null,
725
+ undoLabel: changes.length > 1
726
+ ? 'Move selected sequences'
727
+ : 'Move sequence',
728
+ redoLabel: changes.length > 1
729
+ ? 'Move selected sequences back'
730
+ : 'Move sequence back',
685
731
  })
686
732
  : Promise.resolve(),
687
733
  ...keyframedChanges.map((change) => (0, call_add_keyframe_1.callAddSequenceKeyframe)({
@@ -710,6 +756,7 @@ const SelectedOutlinePolygon = ({ allDragTargets, hovered, outline, onHoverChang
710
756
  clearDragOverrides,
711
757
  drag,
712
758
  getDragOverrides,
759
+ onDraggingChange,
713
760
  onSelect,
714
761
  scale,
715
762
  selected,
@@ -717,14 +764,25 @@ const SelectedOutlinePolygon = ({ allDragTargets, hovered, outline, onHoverChang
717
764
  setDragOverrides,
718
765
  target,
719
766
  ]);
720
- return (jsx_runtime_1.jsx("polygon", { points: points, fill: "transparent", stroke: colors_1.BLUE, strokeOpacity: visible ? 1 : 0, strokeWidth: 2, vectorEffect: "non-scaling-stroke", pointerEvents: target === undefined ? undefined : 'all', onPointerEnter: () => onHoverChange(outline.key), onPointerLeave: () => onHoverChange(null), onPointerDown: onPointerDown }));
767
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
768
+ jsx_runtime_1.jsx("polygon", { ref: polygonRef, points: points, fill: "transparent", stroke: colors_1.BLUE, strokeOpacity: visible ? 1 : 0, strokeWidth: 2, vectorEffect: "non-scaling-stroke", pointerEvents: target === undefined ? undefined : 'all', onPointerEnter: () => {
769
+ if (!dragging) {
770
+ onHoverChange(outline.key);
771
+ }
772
+ }, onPointerLeave: () => {
773
+ if (!dragging) {
774
+ onHoverChange(null);
775
+ }
776
+ }, onPointerDown: onPointerDown }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: polygonRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
777
+ ] }));
721
778
  };
722
- const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, edge, outline, onHoverChange, onSelect, target, }) => {
779
+ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, contextMenuValues, dragging, edge, outline, onDraggingChange, onContextMenuOpen, onHoverChange, onSelect, target, }) => {
723
780
  var _a, _b;
724
781
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
725
782
  const { setCodeValues, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
726
783
  const scaleDrag = (_a = target === null || target === void 0 ? void 0 : target.scaleDrag) !== null && _a !== void 0 ? _a : null;
727
784
  const selected = (_b = target === null || target === void 0 ? void 0 : target.selected) !== null && _b !== void 0 ? _b : false;
785
+ const lineRef = (0, react_1.useRef)(null);
728
786
  const edgeInfo = (0, react_1.useMemo)(() => (0, exports.getSelectedOutlineScaleEdgeInfo)(outline.points, edge), [edge, outline.points]);
729
787
  const onPointerDown = react_1.default.useCallback((event) => {
730
788
  if (event.button !== 0 || scaleDrag === null || edgeInfo === null) {
@@ -740,6 +798,7 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, edge, outline, onHo
740
798
  if (interaction.shiftKey || interaction.toggleKey) {
741
799
  return;
742
800
  }
801
+ onDraggingChange(true);
743
802
  const startPointer = { x: event.clientX, y: event.clientY };
744
803
  const dragStates = (0, exports.getSelectedOutlineScaleDragStates)({
745
804
  dragTargets: selected ? allScaleDragTargets : [scaleDrag],
@@ -771,6 +830,7 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, edge, outline, onHo
771
830
  window.removeEventListener('pointermove', onPointerMove);
772
831
  window.removeEventListener('pointerup', onPointerUp);
773
832
  window.removeEventListener('pointercancel', onPointerUp);
833
+ onDraggingChange(false);
774
834
  const changes = (0, exports.getSelectedOutlineScaleDragChanges)({
775
835
  dragStates,
776
836
  lastValues,
@@ -786,8 +846,10 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, edge, outline, onHo
786
846
  changes,
787
847
  setCodeValues,
788
848
  clientId: scaleDrag.clientId,
789
- undoLabel: changes.length > 1 ? 'Scale selected sequences' : null,
790
- redoLabel: changes.length > 1 ? 'Scale selected sequences back' : null,
849
+ undoLabel: changes.length > 1 ? 'Scale selected sequences' : 'Scale sequence',
850
+ redoLabel: changes.length > 1
851
+ ? 'Scale selected sequences back'
852
+ : 'Scale sequence back',
791
853
  })
792
854
  .catch((err) => {
793
855
  (0, NotificationCenter_1.showNotification)(`Could not save sequence props: ${err instanceof Error ? err.message : String(err)}`, 4000);
@@ -807,6 +869,7 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, edge, outline, onHo
807
869
  clearDragOverrides,
808
870
  edgeInfo,
809
871
  getDragOverrides,
872
+ onDraggingChange,
810
873
  onSelect,
811
874
  scaleDrag,
812
875
  selected,
@@ -817,7 +880,17 @@ const SelectedOutlineScaleEdgeLine = ({ allScaleDragTargets, edge, outline, onHo
817
880
  if (scaleDrag === null || edgeInfo === null) {
818
881
  return null;
819
882
  }
820
- return (jsx_runtime_1.jsx("line", { x1: edgeInfo.start.x, y1: edgeInfo.start.y, x2: edgeInfo.end.x, y2: edgeInfo.end.y, stroke: "transparent", strokeWidth: 12, vectorEffect: "non-scaling-stroke", pointerEvents: "stroke", cursor: edgeInfo.cursor, onPointerEnter: () => onHoverChange(outline.key), onPointerLeave: () => onHoverChange(null), onPointerDown: onPointerDown }));
883
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
884
+ jsx_runtime_1.jsx("line", { ref: lineRef, x1: edgeInfo.start.x, y1: edgeInfo.start.y, x2: edgeInfo.end.x, y2: edgeInfo.end.y, stroke: "transparent", strokeWidth: 12, vectorEffect: "non-scaling-stroke", pointerEvents: "stroke", cursor: edgeInfo.cursor, onPointerEnter: () => {
885
+ if (!dragging) {
886
+ onHoverChange(outline.key);
887
+ }
888
+ }, onPointerLeave: () => {
889
+ if (!dragging) {
890
+ onHoverChange(null);
891
+ }
892
+ }, onPointerDown: onPointerDown }), jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: lineRef, values: [...contextMenuValues], onOpen: onContextMenuOpen })
893
+ ] }));
821
894
  };
822
895
  const getSvgPointFromPointerEvent = ({ event, rect, }) => {
823
896
  return {
@@ -825,7 +898,11 @@ const getSvgPointFromPointerEvent = ({ event, rect, }) => {
825
898
  y: event.clientY - rect.top,
826
899
  };
827
900
  };
828
- const SelectedUvHandleCircle = ({ handle, outline }) => {
901
+ const SelectedUvHandleConnectionLines = ({ handles, outline }) => {
902
+ const lines = (0, react_1.useMemo)(() => (0, exports.getUvHandleConnectionLines)({ handles, points: outline.points }), [handles, outline.points]);
903
+ return (jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: lines.map((line) => (jsx_runtime_1.jsx("line", { x1: line.from.x, y1: line.from.y, x2: line.to.x, y2: line.to.y, stroke: colors_1.BLUE, strokeWidth: 2, vectorEffect: "non-scaling-stroke", pointerEvents: "none" }, line.key))) }));
904
+ };
905
+ const SelectedUvHandleCircle = ({ handle, onDraggingChange, outline }) => {
829
906
  const { setEffectDragOverrides, clearEffectDragOverrides, setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
830
907
  const position = (0, react_1.useMemo)(() => (0, exports.getUvHandlePosition)(outline.points, handle.value), [handle.value, outline.points]);
831
908
  const onPointerDown = react_1.default.useCallback((event) => {
@@ -840,6 +917,7 @@ const SelectedUvHandleCircle = ({ handle, outline }) => {
840
917
  }
841
918
  const svgRect = svg.getBoundingClientRect();
842
919
  let lastValue = null;
920
+ onDraggingChange(true);
843
921
  const defaultValue = handle.fieldDefault !== undefined
844
922
  ? JSON.stringify(handle.fieldDefault)
845
923
  : null;
@@ -861,6 +939,7 @@ const SelectedUvHandleCircle = ({ handle, outline }) => {
861
939
  window.removeEventListener('pointermove', onPointerMove);
862
940
  window.removeEventListener('pointerup', onPointerUp);
863
941
  window.removeEventListener('pointercancel', onPointerUp);
942
+ onDraggingChange(false);
864
943
  const stringifiedValue = lastValue === null ? null : JSON.stringify(lastValue);
865
944
  const shouldSave = lastValue !== null &&
866
945
  !tuplesEqual(handle.codeValue.codeValue, lastValue) &&
@@ -871,6 +950,7 @@ const SelectedUvHandleCircle = ({ handle, outline }) => {
871
950
  return;
872
951
  }
873
952
  (0, save_effect_prop_1.saveEffectProp)({
953
+ type: 'value',
874
954
  fileName: handle.nodePath.absolutePath,
875
955
  nodePath: handle.nodePath,
876
956
  effectIndex: handle.effectIndex,
@@ -890,12 +970,100 @@ const SelectedUvHandleCircle = ({ handle, outline }) => {
890
970
  }, [
891
971
  clearEffectDragOverrides,
892
972
  handle,
973
+ onDraggingChange,
893
974
  outline.points,
894
975
  setCodeValues,
895
976
  setEffectDragOverrides,
896
977
  ]);
897
978
  return (jsx_runtime_1.jsx("circle", { cx: position.x, cy: position.y, r: 6, fill: "white", stroke: colors_1.BLUE, strokeWidth: 2, vectorEffect: "non-scaling-stroke", pointerEvents: "all", cursor: "move", onPointerDown: onPointerDown }));
898
979
  };
980
+ const SelectedOutlineElement = ({ allDragTargets, allScaleDragTargets, dragging, hovered, outline, onDraggingChange, onHoverChange, onSelect, scale, target, }) => {
981
+ const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
982
+ const updateResolvedStackTrace = (0, react_1.useContext)(remotion_1.Internals.SequenceStackTracesUpdateContext);
983
+ const onContextMenuOpen = react_1.default.useCallback(async () => {
984
+ if (target === undefined || previewServerState.type !== 'connected') {
985
+ return false;
986
+ }
987
+ if (!target.selected) {
988
+ onSelect(target.selection, { shiftKey: false, toggleKey: false });
989
+ }
990
+ const stack = target.sequence.getStack();
991
+ let originalLocation = null;
992
+ if (stack) {
993
+ try {
994
+ originalLocation = await (0, get_stack_1.getOriginalLocationFromStack)(stack, 'sequence');
995
+ }
996
+ catch (err) {
997
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
998
+ }
999
+ }
1000
+ if (stack) {
1001
+ updateResolvedStackTrace(stack, originalLocation);
1002
+ }
1003
+ const fileLocation = (0, format_file_location_1.formatFileLocation)({
1004
+ location: originalLocation,
1005
+ root: window.remotion_cwd,
1006
+ });
1007
+ const editorName = window.remotion_editorName;
1008
+ return [
1009
+ editorName
1010
+ ? {
1011
+ type: 'item',
1012
+ id: 'show-outline-in-editor',
1013
+ keyHint: null,
1014
+ label: `Show in ${editorName}`,
1015
+ leftItem: null,
1016
+ disabled: !originalLocation,
1017
+ onClick: () => {
1018
+ if (!originalLocation) {
1019
+ return;
1020
+ }
1021
+ (0, open_in_editor_1.openOriginalPositionInEditor)(originalLocation).catch((err) => {
1022
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
1023
+ });
1024
+ },
1025
+ quickSwitcherLabel: null,
1026
+ subMenu: null,
1027
+ value: 'show-outline-in-editor',
1028
+ }
1029
+ : null,
1030
+ {
1031
+ type: 'item',
1032
+ id: 'copy-outline-file-location',
1033
+ keyHint: null,
1034
+ label: 'Copy file location',
1035
+ leftItem: null,
1036
+ disabled: !fileLocation,
1037
+ onClick: () => {
1038
+ if (!fileLocation) {
1039
+ return;
1040
+ }
1041
+ navigator.clipboard
1042
+ .writeText(fileLocation)
1043
+ .then(() => {
1044
+ (0, NotificationCenter_1.showNotification)('Copied file location to clipboard', 1000);
1045
+ })
1046
+ .catch((err) => {
1047
+ (0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
1048
+ });
1049
+ },
1050
+ quickSwitcherLabel: null,
1051
+ subMenu: null,
1052
+ value: 'copy-outline-file-location',
1053
+ },
1054
+ ].filter(no_react_1.NoReactInternals.truthy);
1055
+ }, [onSelect, previewServerState.type, target, updateResolvedStackTrace]);
1056
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
1057
+ jsx_runtime_1.jsx(SelectedOutlinePolygon, { allDragTargets: allDragTargets, contextMenuValues: emptyContextMenuValues, dragging: dragging, hovered: hovered, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, scale: scale, target: target }), (target === null || target === void 0 ? void 0 : target.selected) || hovered
1058
+ ? ['top', 'right', 'bottom', 'left'].map((edge) => (jsx_runtime_1.jsx(SelectedOutlineScaleEdgeLine, { allScaleDragTargets: allScaleDragTargets, contextMenuValues: emptyContextMenuValues, dragging: dragging, edge: edge, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, target: target }, edge)))
1059
+ : null, (target === null || target === void 0 ? void 0 : target.selected)
1060
+ ? (() => {
1061
+ const { uvHandles } = target;
1062
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
1063
+ jsx_runtime_1.jsx(SelectedUvHandleConnectionLines, { handles: uvHandles, outline: outline }), uvHandles.map((handle) => (jsx_runtime_1.jsx(SelectedUvHandleCircle, { handle: handle, onDraggingChange: onDraggingChange, outline: outline }, `${handle.effectIndex}-${handle.fieldKey}`)))] }));
1064
+ })()
1065
+ : null] }));
1066
+ };
899
1067
  const SelectedOutlineOverlay = ({ scale }) => {
900
1068
  const { selectedItems, selectItem } = (0, TimelineSelection_1.useTimelineSelection)();
901
1069
  const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
@@ -904,11 +1072,19 @@ const SelectedOutlineOverlay = ({ scale }) => {
904
1072
  const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
905
1073
  const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
906
1074
  const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
1075
+ const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
907
1076
  const [outlines, setOutlines] = (0, react_1.useState)([]);
908
1077
  const [hoveredOutlineKey, setHoveredOutlineKey] = (0, react_1.useState)(null);
1078
+ const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
909
1079
  const overlayRef = (0, react_1.useRef)(null);
1080
+ const onDraggingChange = react_1.default.useCallback((dragging) => {
1081
+ setDraggingOutline(dragging);
1082
+ if (dragging) {
1083
+ setHoveredOutlineKey(null);
1084
+ }
1085
+ }, []);
910
1086
  const outlineTargets = (0, react_1.useMemo)(() => {
911
- if (!TimelineSelection_1.ENABLE_OUTLINES) {
1087
+ if (!TimelineSelection_1.ENABLE_OUTLINES || !editorShowOutlines) {
912
1088
  return [];
913
1089
  }
914
1090
  const selectedSequenceKeys = getSelectedSequenceKeys(selectedItems);
@@ -948,6 +1124,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
948
1124
  ref: sequence.refForOutline,
949
1125
  selected,
950
1126
  selection: { type: 'sequence', nodePathInfo },
1127
+ sequence,
951
1128
  drag: canDrag
952
1129
  ? {
953
1130
  codeValue,
@@ -1001,6 +1178,7 @@ const SelectedOutlineOverlay = ({ scale }) => {
1001
1178
  getDragOverrides,
1002
1179
  getEffectDragOverrides,
1003
1180
  getScaleLockState,
1181
+ editorShowOutlines,
1004
1182
  overrideIdToNodePathMappings,
1005
1183
  previewServerState,
1006
1184
  selectedItems,
@@ -1046,16 +1224,6 @@ const SelectedOutlineOverlay = ({ scale }) => {
1046
1224
  if (outlineTargets.length === 0) {
1047
1225
  return null;
1048
1226
  }
1049
- return (jsx_runtime_1.jsx("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: outlines.map((outline) => {
1050
- var _a, _b, _c;
1051
- return (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
1052
- jsx_runtime_1.jsx(SelectedOutlinePolygon, { allDragTargets: allDragTargets, hovered: hoveredOutlineKey === outline.key, outline: outline, onHoverChange: setHoveredOutlineKey, onSelect: selectItem, scale: scale, target: targetsByKey.get(outline.key) }), ((_a = targetsByKey.get(outline.key)) === null || _a === void 0 ? void 0 : _a.selected) ||
1053
- hoveredOutlineKey === outline.key
1054
- ? ['top', 'right', 'bottom', 'left'].map((edge) => (jsx_runtime_1.jsx(SelectedOutlineScaleEdgeLine, { allScaleDragTargets: allScaleDragTargets, edge: edge, outline: outline, onHoverChange: setHoveredOutlineKey, onSelect: selectItem, target: targetsByKey.get(outline.key) }, edge)))
1055
- : null, ((_b = targetsByKey.get(outline.key)) === null || _b === void 0 ? void 0 : _b.selected)
1056
- ? (_c = targetsByKey
1057
- .get(outline.key)) === null || _c === void 0 ? void 0 : _c.uvHandles.map((handle) => (jsx_runtime_1.jsx(SelectedUvHandleCircle, { handle: handle, outline: outline }, `${handle.effectIndex}-${handle.fieldKey}`)))
1058
- : null] }, outline.key));
1059
- }) }));
1227
+ return (jsx_runtime_1.jsx("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: outlines.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement, { allDragTargets: allDragTargets, allScaleDragTargets: allScaleDragTargets, dragging: draggingOutline, hovered: hoveredOutlineKey === outline.key, outline: outline, onDraggingChange: onDraggingChange, onHoverChange: setHoveredOutlineKey, onSelect: selectItem, scale: scale, target: targetsByKey.get(outline.key) }, outline.key))) }));
1060
1228
  };
1061
1229
  exports.SelectedOutlineOverlay = SelectedOutlineOverlay;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const ShowOutlinesProvider: React.FC<{
3
+ readonly children: React.ReactNode;
4
+ }>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShowOutlinesProvider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const editor_outlines_1 = require("../state/editor-outlines");
7
+ const ShowOutlinesProvider = ({ children }) => {
8
+ const [editorShowOutlines, setEditorShowOutlinesState] = (0, react_1.useState)(() => (0, editor_outlines_1.loadEditorShowOutlinesOption)());
9
+ const setEditorShowOutlines = (0, react_1.useCallback)((newValue) => {
10
+ setEditorShowOutlinesState((prevState) => {
11
+ const newVal = newValue(prevState);
12
+ (0, editor_outlines_1.persistEditorShowOutlinesOption)(newVal);
13
+ return newVal;
14
+ });
15
+ }, []);
16
+ const editorShowOutlinesCtx = (0, react_1.useMemo)(() => {
17
+ return {
18
+ editorShowOutlines,
19
+ setEditorShowOutlines,
20
+ };
21
+ }, [editorShowOutlines, setEditorShowOutlines]);
22
+ return (jsx_runtime_1.jsx(editor_outlines_1.EditorShowOutlinesContext.Provider, { value: editorShowOutlinesCtx, children: children }));
23
+ };
24
+ exports.ShowOutlinesProvider = ShowOutlinesProvider;
@@ -4,10 +4,10 @@ exports.SizeSelector = exports.getUniqueSizes = exports.getPreviewSizeLabel = vo
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
+ const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
7
8
  const Checkmark_1 = require("../icons/Checkmark");
8
9
  const ControlButton_1 = require("./ControlButton");
9
10
  const ComboBox_1 = require("./NewComposition/ComboBox");
10
- const Preview_1 = require("./Preview");
11
11
  const commonPreviewSizes = [
12
12
  {
13
13
  size: 'auto',
@@ -83,11 +83,11 @@ const SizeSelector = () => {
83
83
  return true;
84
84
  }
85
85
  if (canvasContent.type === 'asset' &&
86
- zoomableFileTypes.includes((0, Preview_1.getPreviewFileType)(canvasContent.asset))) {
86
+ zoomableFileTypes.includes((0, get_preview_file_type_1.getPreviewFileType)(canvasContent.asset))) {
87
87
  return true;
88
88
  }
89
89
  if (canvasContent.type === 'output' &&
90
- zoomableFileTypes.includes((0, Preview_1.getPreviewFileType)(canvasContent.path))) {
90
+ zoomableFileTypes.includes((0, get_preview_file_type_1.getPreviewFileType)(canvasContent.path))) {
91
91
  return true;
92
92
  }
93
93
  return false;
@@ -34,6 +34,8 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
34
34
  if (e.button !== 0) {
35
35
  return;
36
36
  }
37
+ // Prevent deselection of currently selected items
38
+ e.stopPropagation();
37
39
  // Capture the context and starting flex once, at drag start. The flex
38
40
  // value updates on every pointermove, so it must not be re-read live.
39
41
  const dragContext = latest.current.context;
@@ -6,8 +6,8 @@ const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
7
  const client_id_1 = require("../helpers/client-id");
8
8
  const colors_1 = require("../helpers/colors");
9
+ const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
9
10
  const FilePreview_1 = require("./FilePreview");
10
- const Preview_1 = require("./Preview");
11
11
  const use_static_files_1 = require("./use-static-files");
12
12
  const msgStyle = {
13
13
  fontSize: 13,
@@ -21,7 +21,7 @@ const errMsgStyle = {
21
21
  color: colors_1.LIGHT_TEXT,
22
22
  };
23
23
  const StaticFilePreview = ({ currentAsset, assetMetadata }) => {
24
- const fileType = (0, Preview_1.getPreviewFileType)(currentAsset);
24
+ const fileType = (0, get_preview_file_type_1.getPreviewFileType)(currentAsset);
25
25
  const staticFileSrc = (0, remotion_1.staticFile)(currentAsset);
26
26
  const staticFiles = (0, use_static_files_1.useStaticFiles)();
27
27
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { CanUpdateSequencePropStatusKeyframed, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
3
+ export type KeyframeSettingsModalState = {
4
+ type: 'keyframe-settings';
5
+ fileName: string;
6
+ nodePath: SequencePropsSubscriptionKey;
7
+ fieldKey: string;
8
+ fieldLabel: string;
9
+ status: CanUpdateSequencePropStatusKeyframed;
10
+ schema: SequenceSchema;
11
+ effectIndex: number | null;
12
+ };
13
+ export declare const KeyframeSettingsModal: React.FC<{
14
+ readonly state: KeyframeSettingsModalState;
15
+ }>;
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyframeSettingsModal = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const client_id_1 = require("../../helpers/client-id");
8
+ const colors_1 = require("../../helpers/colors");
9
+ const modals_1 = require("../../state/modals");
10
+ const Button_1 = require("../Button");
11
+ const layout_1 = require("../layout");
12
+ const ModalButton_1 = require("../ModalButton");
13
+ const ModalFooter_1 = require("../ModalFooter");
14
+ const ModalHeader_1 = require("../ModalHeader");
15
+ const ComboBox_1 = require("../NewComposition/ComboBox");
16
+ const DismissableModal_1 = require("../NewComposition/DismissableModal");
17
+ const InputDragger_1 = require("../NewComposition/InputDragger");
18
+ const call_update_keyframe_settings_1 = require("./call-update-keyframe-settings");
19
+ const container = {
20
+ padding: 16,
21
+ width: 520,
22
+ };
23
+ const row = {
24
+ alignItems: 'center',
25
+ display: 'flex',
26
+ justifyContent: 'space-between',
27
+ marginBottom: 12,
28
+ };
29
+ const label = {
30
+ fontSize: 13,
31
+ };
32
+ const helperText = {
33
+ color: 'rgba(255, 255, 255, 0.6)',
34
+ fontSize: 12,
35
+ lineHeight: 1.4,
36
+ marginTop: 4,
37
+ };
38
+ const comboStyle = {
39
+ minWidth: 150,
40
+ };
41
+ const posterizeInputStyle = {
42
+ backgroundColor: colors_1.INPUT_BACKGROUND,
43
+ borderRadius: 4,
44
+ minWidth: 64,
45
+ textAlign: 'right',
46
+ };
47
+ const extrapolateOptions = [
48
+ 'extend',
49
+ 'clamp',
50
+ 'identity',
51
+ 'wrap',
52
+ ];
53
+ const labelForExtrapolate = (value) => value[0].toUpperCase() + value.slice(1);
54
+ const getExtrapolateValues = (onSelect) => {
55
+ return extrapolateOptions.map((value) => ({
56
+ type: 'item',
57
+ id: value,
58
+ keyHint: null,
59
+ label: labelForExtrapolate(value),
60
+ leftItem: null,
61
+ disabled: false,
62
+ onClick: () => onSelect(value),
63
+ quickSwitcherLabel: null,
64
+ subMenu: null,
65
+ value,
66
+ }));
67
+ };
68
+ const KeyframeSettingsModal = ({ state }) => {
69
+ var _a;
70
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
71
+ const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
72
+ const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
73
+ const [left, setLeft] = (0, react_1.useState)(state.status.clamping.left);
74
+ const [right, setRight] = (0, react_1.useState)(state.status.clamping.right);
75
+ const [posterize, setPosterize] = (0, react_1.useState)((_a = state.status.posterize) !== null && _a !== void 0 ? _a : 0);
76
+ const [saving, setSaving] = (0, react_1.useState)(false);
77
+ const canEditClamping = state.status.interpolationFunction === 'interpolate';
78
+ const close = (0, react_1.useCallback)(() => {
79
+ setSelectedModal(null);
80
+ }, [setSelectedModal]);
81
+ const leftOptions = (0, react_1.useMemo)(() => getExtrapolateValues(setLeft), []);
82
+ const rightOptions = (0, react_1.useMemo)(() => getExtrapolateValues(setRight), []);
83
+ const onPosterizeChange = (0, react_1.useCallback)((value) => {
84
+ setPosterize(Math.max(0, Math.round(value)));
85
+ }, []);
86
+ const posterizeFormatter = (0, react_1.useCallback)((value) => {
87
+ const numericValue = Number(value);
88
+ return String(Math.round(numericValue));
89
+ }, []);
90
+ const onSave = (0, react_1.useCallback)(() => {
91
+ if (previewServerState.type !== 'connected') {
92
+ return;
93
+ }
94
+ const settings = {
95
+ clamping: canEditClamping ? { left, right } : undefined,
96
+ posterize: posterize <= 0 ? undefined : posterize,
97
+ };
98
+ setSaving(true);
99
+ const promise = state.effectIndex === null
100
+ ? (0, call_update_keyframe_settings_1.callUpdateSequenceKeyframeSettings)({
101
+ fileName: state.fileName,
102
+ nodePath: state.nodePath,
103
+ fieldKey: state.fieldKey,
104
+ settings,
105
+ schema: state.schema,
106
+ setCodeValues,
107
+ clientId: previewServerState.clientId,
108
+ })
109
+ : (0, call_update_keyframe_settings_1.callUpdateEffectKeyframeSettings)({
110
+ fileName: state.fileName,
111
+ nodePath: state.nodePath,
112
+ effectIndex: state.effectIndex,
113
+ fieldKey: state.fieldKey,
114
+ settings,
115
+ schema: state.schema,
116
+ setCodeValues,
117
+ clientId: previewServerState.clientId,
118
+ });
119
+ promise.then(close).finally(() => {
120
+ setSaving(false);
121
+ });
122
+ }, [
123
+ canEditClamping,
124
+ close,
125
+ left,
126
+ posterize,
127
+ previewServerState,
128
+ right,
129
+ setCodeValues,
130
+ state,
131
+ ]);
132
+ const saveDisabled = saving || previewServerState.type !== 'connected';
133
+ return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
134
+ jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: `Keyframe settings: ${state.fieldLabel}` }), jsx_runtime_1.jsxs("div", { style: container, children: [canEditClamping ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
135
+ jsx_runtime_1.jsxs("div", { style: row, children: [
136
+ jsx_runtime_1.jsx("div", { style: label, children: "Extrapolate left" }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: leftOptions, selectedId: left, title: "Extrapolate left", style: comboStyle })
137
+ ] }), jsx_runtime_1.jsxs("div", { style: row, children: [
138
+ jsx_runtime_1.jsx("div", { style: label, children: "Extrapolate right" }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: rightOptions, selectedId: right, title: "Extrapolate right", style: comboStyle })
139
+ ] })
140
+ ] })) : null, jsx_runtime_1.jsxs("div", { style: row, children: [
141
+ jsx_runtime_1.jsxs("div", { children: [
142
+ jsx_runtime_1.jsx("div", { style: label, children: "Posterize" }), jsx_runtime_1.jsx("div", { style: helperText, children: "Use 0 to turn posterization off." })
143
+ ] }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: posterize, status: "ok", onValueChange: onPosterizeChange, onValueChangeEnd: onPosterizeChange, onTextChange: () => undefined, min: 0, step: 1, formatter: posterizeFormatter, rightAlign: true, style: posterizeInputStyle })
144
+ ] })
145
+ ] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsxs(layout_1.Row, { justify: "flex-end", align: "center", children: [
146
+ jsx_runtime_1.jsx(Button_1.Button, { onClick: close, children: "Cancel" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx(ModalButton_1.ModalButton, { onClick: onSave, disabled: saveDisabled, children: "Save" })
147
+ ] }) })
148
+ ] }));
149
+ };
150
+ exports.KeyframeSettingsModal = KeyframeSettingsModal;