@remotion/studio 4.0.475 → 4.0.477

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 (88) hide show
  1. package/dist/components/Canvas.js +40 -1
  2. package/dist/components/ColorPicker/ColorPickerPopup.d.ts +6 -0
  3. package/dist/components/ColorPicker/ColorPickerPopup.js +11 -6
  4. package/dist/components/ControlButton.d.ts +1 -0
  5. package/dist/components/ControlButton.js +7 -2
  6. package/dist/components/EditorGuides/Guide.js +122 -20
  7. package/dist/components/EditorRuler/Ruler.js +21 -15
  8. package/dist/components/EditorRuler/index.js +18 -10
  9. package/dist/components/GlobalKeybindings.js +12 -0
  10. package/dist/components/KeyboardShortcutsExplainer.js +24 -0
  11. package/dist/components/NewComposition/InputDragger.d.ts +6 -0
  12. package/dist/components/NewComposition/InputDragger.js +40 -14
  13. package/dist/components/NewComposition/RenameComposition.js +8 -1
  14. package/dist/components/NewComposition/RenameFolder.js +8 -1
  15. package/dist/components/NewComposition/RenameStaticFile.js +11 -1
  16. package/dist/components/Notifications/Notification.js +5 -4
  17. package/dist/components/Notifications/NotificationCenter.js +1 -1
  18. package/dist/components/ObserveDefaultPropsContext.js +6 -2
  19. package/dist/components/OutlineToggle.js +1 -1
  20. package/dist/components/PlayPause.js +22 -66
  21. package/dist/components/PreviewToolbar.js +15 -1
  22. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +2 -1
  23. package/dist/components/SelectedOutlineElement.d.ts +17 -0
  24. package/dist/components/SelectedOutlineElement.js +938 -0
  25. package/dist/components/SelectedOutlineOverlay.d.ts +4 -174
  26. package/dist/components/SelectedOutlineOverlay.js +310 -1392
  27. package/dist/components/SelectedOutlineUvControls.js +1 -1
  28. package/dist/components/ShowGuidesProvider.js +4 -4
  29. package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -1
  30. package/dist/components/Timeline/SubscribeToNodePaths.js +2 -1
  31. package/dist/components/Timeline/Timeline.js +3 -1
  32. package/dist/components/Timeline/TimelineClipboardKeybindings.js +9 -10
  33. package/dist/components/Timeline/TimelineDeleteKeybindings.js +15 -4
  34. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +7 -11
  35. package/dist/components/Timeline/TimelineList.js +1 -1
  36. package/dist/components/Timeline/TimelineRotationField.js +17 -17
  37. package/dist/components/Timeline/TimelineScaleField.js +1 -1
  38. package/dist/components/Timeline/TimelineSelection.d.ts +27 -13
  39. package/dist/components/Timeline/TimelineSelection.js +47 -28
  40. package/dist/components/Timeline/TimelineSequence.js +169 -8
  41. package/dist/components/Timeline/TimelineSequenceFrame.d.ts +1 -0
  42. package/dist/components/Timeline/TimelineSequenceFrame.js +17 -6
  43. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
  44. package/dist/components/Timeline/TimelineSequenceItem.js +294 -142
  45. package/dist/components/Timeline/TimelineSequenceName.d.ts +4 -2
  46. package/dist/components/Timeline/TimelineSequenceName.js +67 -2
  47. package/dist/components/Timeline/TimelineTransformOriginField.js +1 -1
  48. package/dist/components/Timeline/TimelineTranslateField.js +1 -1
  49. package/dist/components/Timeline/TimelineUvCoordinateField.js +1 -1
  50. package/dist/components/Timeline/delete-selected-timeline-item.js +4 -0
  51. package/dist/components/Timeline/disable-sequence-interactivity.d.ts +8 -0
  52. package/dist/components/Timeline/disable-sequence-interactivity.js +24 -0
  53. package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +1 -2
  54. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +20 -0
  55. package/dist/components/Timeline/get-sequence-context-menu-items.js +160 -0
  56. package/dist/components/Timeline/reset-selected-timeline-props.js +2 -2
  57. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
  58. package/dist/components/Timeline/sequence-props-subscription-store.js +11 -3
  59. package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +2 -0
  60. package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +16 -2
  61. package/dist/components/Timeline/timeline-rotation-utils.d.ts +1 -1
  62. package/dist/components/Timeline/timeline-rotation-utils.js +4 -2
  63. package/dist/components/Timeline/update-selected-easing.d.ts +4 -6
  64. package/dist/components/Timeline/use-sequence-props-subscription.d.ts +2 -1
  65. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -1
  66. package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +37 -1
  67. package/dist/components/Timeline/use-timeline-keyframe-drag.js +290 -14
  68. package/dist/components/import-assets.d.ts +36 -8
  69. package/dist/components/import-assets.js +170 -10
  70. package/dist/components/selected-outline-drag.d.ts +117 -0
  71. package/dist/components/selected-outline-drag.js +427 -0
  72. package/dist/components/selected-outline-measurement.d.ts +67 -0
  73. package/dist/components/selected-outline-measurement.js +355 -0
  74. package/dist/components/selected-outline-types.d.ts +121 -0
  75. package/dist/components/selected-outline-types.js +15 -0
  76. package/dist/components/selected-outline-uv.d.ts +1 -0
  77. package/dist/components/selected-outline-uv.js +12 -0
  78. package/dist/esm/{chunk-qaqqvw4q.js → chunk-t8fjnw2d.js} +14059 -12029
  79. package/dist/esm/internals.mjs +14059 -12029
  80. package/dist/esm/previewEntry.mjs +14066 -12036
  81. package/dist/esm/renderEntry.mjs +1 -1
  82. package/dist/helpers/editor-guide-selection.d.ts +31 -0
  83. package/dist/helpers/editor-guide-selection.js +58 -0
  84. package/dist/helpers/editor-ruler.d.ts +3 -3
  85. package/dist/helpers/editor-ruler.js +16 -18
  86. package/dist/state/editor-guides.d.ts +2 -2
  87. package/dist/state/editor-guides.js +2 -2
  88. package/package.json +11 -11
@@ -75,7 +75,7 @@ const SelectedUvHandleCircle = ({ handle, onDraggingChange, outline }) => {
75
75
  event: pointerEvent,
76
76
  rect: svgRect,
77
77
  });
78
- const nextValue = (0, selected_outline_uv_1.constrainUv)((0, selected_outline_uv_1.getUvCoordinateForPoint)(outline.points, point), handle.fieldSchema);
78
+ const nextValue = (0, selected_outline_uv_1.roundUvCoordinate)((0, selected_outline_uv_1.constrainUv)((0, selected_outline_uv_1.getUvCoordinateForPoint)(outline.points, point), handle.fieldSchema), handle.fieldSchema);
79
79
  lastValue = nextValue;
80
80
  setEffectDragOverrides(handle.nodePath, handle.effectIndex, handle.fieldKey, handle.propStatus.status === 'keyframed'
81
81
  ? remotion_1.Internals.makeKeyframedDragOverride({
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const editor_guides_1 = require("../state/editor-guides");
7
7
  const ShowGuidesProvider = ({ children }) => {
8
8
  const [guidesList, setGuidesList] = (0, react_1.useState)(() => (0, editor_guides_1.loadGuidesList)());
9
- const [selectedGuideId, setSelectedGuideId] = (0, react_1.useState)(null);
9
+ const [draggingGuideId, setDraggingGuideId] = (0, react_1.useState)(null);
10
10
  const [hoveredGuideId, setHoveredGuideId] = (0, react_1.useState)(null);
11
11
  const [editorShowGuides, setEditorShowGuidesState] = (0, react_1.useState)(() => (0, editor_guides_1.loadEditorShowGuidesOption)());
12
12
  const shouldCreateGuideRef = (0, react_1.useRef)(false);
@@ -24,8 +24,8 @@ const ShowGuidesProvider = ({ children }) => {
24
24
  setEditorShowGuides,
25
25
  guidesList,
26
26
  setGuidesList,
27
- selectedGuideId,
28
- setSelectedGuideId,
27
+ draggingGuideId,
28
+ setDraggingGuideId,
29
29
  shouldCreateGuideRef,
30
30
  shouldDeleteGuideRef,
31
31
  hoveredGuideId,
@@ -35,7 +35,7 @@ const ShowGuidesProvider = ({ children }) => {
35
35
  editorShowGuides,
36
36
  setEditorShowGuides,
37
37
  guidesList,
38
- selectedGuideId,
38
+ draggingGuideId,
39
39
  hoveredGuideId,
40
40
  ]);
41
41
  return (jsx_runtime_1.jsx(editor_guides_1.EditorShowGuidesContext.Provider, { value: editorShowGuidesCtx, children: children }));
@@ -1,7 +1,8 @@
1
1
  import { type FC } from 'react';
2
- import type { EffectDefinition, SequenceSchema } from 'remotion';
2
+ import type { EffectDefinition, JsxComponentIdentity, SequenceSchema } from 'remotion';
3
3
  export declare const SubscribeToNodePaths: FC<{
4
4
  readonly overrideId: string;
5
+ readonly componentIdentity: JsxComponentIdentity | null;
5
6
  readonly schema: SequenceSchema;
6
7
  readonly getStack: () => string | null;
7
8
  readonly effects: readonly EffectDefinition<unknown>[];
@@ -5,7 +5,7 @@ const react_1 = require("react");
5
5
  const no_react_1 = require("remotion/no-react");
6
6
  const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
7
7
  const use_sequence_props_subscription_1 = require("./use-sequence-props-subscription");
8
- const SubscribeToNodePaths = ({ overrideId, schema, getStack, effects }) => {
8
+ const SubscribeToNodePaths = ({ overrideId, componentIdentity, schema, getStack, effects }) => {
9
9
  const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(getStack);
10
10
  const effectSubscriptions = (0, react_1.useMemo)(() => {
11
11
  return effects
@@ -16,6 +16,7 @@ const SubscribeToNodePaths = ({ overrideId, schema, getStack, effects }) => {
16
16
  }, [effects]);
17
17
  (0, use_sequence_props_subscription_1.useSequencePropsSubscription)({
18
18
  overrideId,
19
+ componentIdentity,
19
20
  schema,
20
21
  effects: effectSubscriptions,
21
22
  originalLocation,
@@ -129,6 +129,7 @@ const TimelineContextMenuArea = ({ children }) => {
129
129
  type: 'solid',
130
130
  width: videoConfig.width,
131
131
  height: videoConfig.height,
132
+ position: null,
132
133
  },
133
134
  });
134
135
  if (result.success) {
@@ -160,6 +161,7 @@ const TimelineContextMenuArea = ({ children }) => {
160
161
  files,
161
162
  compositionFile,
162
163
  compositionId: currentCompositionId,
164
+ dropPosition: null,
163
165
  });
164
166
  }
165
167
  finally {
@@ -228,7 +230,7 @@ const TimelineInner = () => {
228
230
  if (!sequence.controls || !previewConnected || !sequence.getStack()) {
229
231
  return null;
230
232
  }
231
- return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, schema: sequence.controls.schema, getStack: sequence.getStack, effects: sequence.effects }, sequence.id));
233
+ return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, componentIdentity: sequence.controls.componentIdentity, schema: sequence.controls.schema, getStack: sequence.getStack, effects: sequence.effects }, sequence.id));
232
234
  }), jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}), jsx_runtime_1.jsxs(TimelineKeyframeTracksContext_1.TimelineKeyframeTracksProvider, { tracks: filtered, children: [
233
235
  jsx_runtime_1.jsx(TimelineSelection_1.TimelineSelectAllKeybindings, { timeline: shown }), jsx_runtime_1.jsx(TimelineHeightContainer_1.TimelineHeightContainer, { shown: shown, hasBeenCut: hasBeenCut, children: isStill ? (jsx_runtime_1.jsx(TimelineList_1.TimelineList, { timeline: shown })) : (jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
234
236
  jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [
@@ -188,22 +188,21 @@ const getPasteEffectPropTarget = ({ selectedItems, payload, propStatuses, sequen
188
188
  if (!selection) {
189
189
  return { type: 'none' };
190
190
  }
191
- if (!selection.nodePathInfo.supportsEffects) {
192
- return { type: 'unsupported' };
191
+ if (selection.type !== 'sequence-effect-prop' &&
192
+ selection.type !== 'sequence-effect') {
193
+ return { type: 'none' };
193
194
  }
194
195
  const target = selection.type === 'sequence-effect-prop'
195
196
  ? {
196
197
  effectIndex: selection.i,
197
198
  fieldKey: selection.key,
198
199
  }
199
- : selection.type === 'sequence-effect'
200
- ? {
201
- effectIndex: selection.i,
202
- fieldKey: payload.key,
203
- }
204
- : null;
205
- if (target === null) {
206
- return { type: 'none' };
200
+ : {
201
+ effectIndex: selection.i,
202
+ fieldKey: payload.key,
203
+ };
204
+ if (!selection.nodePathInfo.supportsEffects) {
205
+ return { type: 'unsupported' };
207
206
  }
208
207
  if (selection.type === 'sequence-effect-prop' &&
209
208
  selection.key !== payload.key) {
@@ -5,6 +5,7 @@ const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const client_id_1 = require("../../helpers/client-id");
7
7
  const use_keybinding_1 = require("../../helpers/use-keybinding");
8
+ const editor_guides_1 = require("../../state/editor-guides");
8
9
  const ConfirmationDialog_1 = require("../ConfirmationDialog");
9
10
  const delete_selected_timeline_item_1 = require("./delete-selected-timeline-item");
10
11
  const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
@@ -18,12 +19,12 @@ const TimelineDeleteKeybindings = () => {
18
19
  const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
19
20
  const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
20
21
  const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
21
- const { canSelect, canSelectEasing } = (0, TimelineSelection_1.useTimelineSelection)();
22
+ const { setGuidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
23
+ const { canSelect } = (0, TimelineSelection_1.useTimelineSelection)();
22
24
  const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
23
25
  const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
24
26
  (0, react_1.useEffect)(() => {
25
- if ((!canSelect && !canSelectEasing) ||
26
- previewServerState.type !== 'connected') {
27
+ if (!canSelect || previewServerState.type !== 'connected') {
27
28
  return;
28
29
  }
29
30
  const { clientId } = previewServerState;
@@ -34,6 +35,16 @@ const TimelineDeleteKeybindings = () => {
34
35
  if (selectedItems.length === 0) {
35
36
  return;
36
37
  }
38
+ const selectedGuide = selectedItems.find((item) => item.type === 'guide');
39
+ if (selectedGuide) {
40
+ setGuidesList((prevGuides) => {
41
+ const newGuides = prevGuides.filter((guide) => guide.id !== selectedGuide.guideId);
42
+ (0, editor_guides_1.persistGuidesList)(newGuides);
43
+ return newGuides;
44
+ });
45
+ clearSelection();
46
+ return;
47
+ }
37
48
  const deletePromise = (0, delete_selected_timeline_item_1.deleteSelectedTimelineItems)({
38
49
  selections: selectedItems,
39
50
  sequences,
@@ -127,7 +138,6 @@ const TimelineDeleteKeybindings = () => {
127
138
  };
128
139
  }, [
129
140
  canSelect,
130
- canSelectEasing,
131
141
  confirm,
132
142
  currentSelection,
133
143
  keybindings,
@@ -135,6 +145,7 @@ const TimelineDeleteKeybindings = () => {
135
145
  propStatusesRef,
136
146
  previewServerState,
137
147
  sequencesRef,
148
+ setGuidesList,
138
149
  setPropStatuses,
139
150
  ]);
140
151
  return null;
@@ -47,6 +47,7 @@ const ContextMenu_1 = require("../ContextMenu");
47
47
  const TimelineSelection_1 = require("./TimelineSelection");
48
48
  const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
49
49
  const update_selected_easing_1 = require("./update-selected-easing");
50
+ const use_timeline_keyframe_drag_1 = require("./use-timeline-keyframe-drag");
50
51
  const hitTargetHeight = 12;
51
52
  const lineHeight = 2;
52
53
  const easingLineButton = {
@@ -224,17 +225,12 @@ const TimelineKeyframeEasingLineUnmemoized = ({ fromFrame, toFrame, rowHeight, n
224
225
  ...easingLine,
225
226
  outline: selected ? `1px solid ${colors_1.BLUE}` : undefined,
226
227
  }), [selected]);
227
- const onPointerDown = (0, react_1.useCallback)((event) => {
228
- if (!selectable || event.button !== 0) {
229
- return;
230
- }
231
- event.preventDefault();
232
- event.stopPropagation();
233
- onSelect({
234
- shiftKey: event.shiftKey,
235
- toggleKey: event.metaKey || event.ctrlKey,
236
- });
237
- }, [onSelect, selectable]);
228
+ const onPointerDown = (0, use_timeline_keyframe_drag_1.useTimelineEasingKeyframeDrag)({
229
+ onSelect,
230
+ selectable,
231
+ selected,
232
+ selectionItem,
233
+ });
238
234
  if (style === null) {
239
235
  return null;
240
236
  }
@@ -12,7 +12,7 @@ const container = {
12
12
  const TimelineList = ({ timeline }) => {
13
13
  return (jsx_runtime_1.jsxs("div", { style: container, children: [
14
14
  jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track, trackIndex) => {
15
- return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(TimelineSequenceItem_1.TimelineSequenceItem, { trackIndex: trackIndex, nestedDepth: track.depth, sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset }, track.sequence.id) }, track.sequence.id));
15
+ return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(TimelineSequenceItem_1.TimelineSequenceItem, { trackIndex: trackIndex, nestedDepth: track.depth, sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset, sequenceFrameOffset: track.sequenceFrameOffset }, track.sequence.id) }, track.sequence.id));
16
16
  })] }));
17
17
  };
18
18
  exports.TimelineList = TimelineList;
@@ -16,11 +16,26 @@ const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDr
16
16
  }
17
17
  return typeof effectiveValue === 'number' ? effectiveValue : 0;
18
18
  }, [effectiveValue, isCssRotation]);
19
+ const configuredStep = field.fieldSchema.type === 'rotation-css' ||
20
+ field.fieldSchema.type === 'rotation-degrees'
21
+ ? field.fieldSchema.step
22
+ : undefined;
23
+ const step = configuredStep !== null && configuredStep !== void 0 ? configuredStep : 1;
24
+ const min = field.fieldSchema.type === 'rotation-degrees'
25
+ ? ((_a = field.fieldSchema.min) !== null && _a !== void 0 ? _a : -Infinity)
26
+ : -Infinity;
27
+ const max = field.fieldSchema.type === 'rotation-degrees'
28
+ ? ((_b = field.fieldSchema.max) !== null && _b !== void 0 ? _b : Infinity)
29
+ : Infinity;
30
+ const decimalPlaces = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
31
+ defaultDecimalPlaces: 1,
32
+ step: configuredStep,
33
+ }), [configuredStep]);
19
34
  const serializeValue = (0, react_1.useCallback)((value) => {
20
35
  return isCssRotation
21
- ? (0, timeline_rotation_utils_1.serializeCssRotation)(value)
36
+ ? (0, timeline_rotation_utils_1.serializeCssRotation)(value, decimalPlaces)
22
37
  : (0, timeline_field_utils_1.normalizeTimelineNumber)(value);
23
- }, [isCssRotation]);
38
+ }, [decimalPlaces, isCssRotation]);
24
39
  const onValueChange = (0, react_1.useCallback)((newVal) => {
25
40
  setDragValue(newVal);
26
41
  onDragValueChange(serializeValue(newVal));
@@ -50,21 +65,6 @@ const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDr
50
65
  }
51
66
  }
52
67
  }, [propStatus, onSave, serializeValue]);
53
- const configuredStep = field.fieldSchema.type === 'rotation-css' ||
54
- field.fieldSchema.type === 'rotation-degrees'
55
- ? field.fieldSchema.step
56
- : undefined;
57
- const step = configuredStep !== null && configuredStep !== void 0 ? configuredStep : 1;
58
- const min = field.fieldSchema.type === 'rotation-degrees'
59
- ? ((_a = field.fieldSchema.min) !== null && _a !== void 0 ? _a : -Infinity)
60
- : -Infinity;
61
- const max = field.fieldSchema.type === 'rotation-degrees'
62
- ? ((_b = field.fieldSchema.max) !== null && _b !== void 0 ? _b : Infinity)
63
- : Infinity;
64
- const decimalPlaces = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
65
- defaultDecimalPlaces: 1,
66
- step: configuredStep,
67
- }), [configuredStep]);
68
68
  const formatter = (0, react_1.useCallback)((v) => {
69
69
  const formatted = (0, timeline_field_utils_1.formatTimelineNumber)({
70
70
  decimalPlaces,
@@ -99,7 +99,7 @@ const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragV
99
99
  ? ((_b = field.fieldSchema.max) !== null && _b !== void 0 ? _b : Infinity)
100
100
  : Infinity;
101
101
  const decimalPlaces = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
102
- defaultDecimalPlaces: 2,
102
+ defaultDecimalPlaces: 3,
103
103
  step: configuredStep,
104
104
  }), [configuredStep]);
105
105
  const formatter = (0, react_1.useCallback)((v) => {
@@ -9,32 +9,39 @@ export declare const getTimelineColor: (selected: boolean, subcategory: boolean)
9
9
  export declare const getTimelineSelectedTrackHighlightStyle: (timelineWidth: number) => CSSProperties;
10
10
  export declare const TIMELINE_BACKGROUND = "#0F1113";
11
11
  export declare const TIMELINE_TICKS_BACKGROUND = "rgb(31,36,40)";
12
- type TimelineSelectionBase = {
13
- readonly nodePathInfo: SequenceNodePathInfo;
14
- };
15
- export type TimelineSelection = (TimelineSelectionBase & {
12
+ export type TimelineSelection = {
13
+ readonly type: 'guide';
14
+ readonly guideId: string;
15
+ } | {
16
16
  readonly type: 'sequence';
17
- }) | (TimelineSelectionBase & {
17
+ readonly nodePathInfo: SequenceNodePathInfo;
18
+ } | {
18
19
  readonly type: 'sequence-prop';
20
+ readonly nodePathInfo: SequenceNodePathInfo;
19
21
  readonly key: string;
20
- }) | (TimelineSelectionBase & {
22
+ } | {
21
23
  readonly type: 'sequence-all-effects';
22
- }) | (TimelineSelectionBase & {
24
+ readonly nodePathInfo: SequenceNodePathInfo;
25
+ } | {
23
26
  readonly type: 'sequence-effect';
27
+ readonly nodePathInfo: SequenceNodePathInfo;
24
28
  readonly i: number;
25
- }) | (TimelineSelectionBase & {
29
+ } | {
26
30
  readonly type: 'sequence-effect-prop';
31
+ readonly nodePathInfo: SequenceNodePathInfo;
27
32
  readonly i: number;
28
33
  readonly key: string;
29
- }) | (TimelineSelectionBase & {
34
+ } | {
30
35
  readonly type: 'keyframe';
36
+ readonly nodePathInfo: SequenceNodePathInfo;
31
37
  readonly frame: number;
32
- }) | (TimelineSelectionBase & {
38
+ } | {
33
39
  readonly type: 'easing';
40
+ readonly nodePathInfo: SequenceNodePathInfo;
34
41
  readonly fromFrame: number;
35
42
  readonly toFrame: number;
36
43
  readonly segmentIndex: number;
37
- });
44
+ };
38
45
  export type TimelineEasingSelection = Extract<TimelineSelection, {
39
46
  type: 'easing';
40
47
  }>;
@@ -99,7 +106,6 @@ export declare const getTimelineMarqueeSelection: ({ candidates, lockedSelection
99
106
  };
100
107
  type TimelineSelectionContextValue = {
101
108
  readonly canSelect: boolean;
102
- readonly canSelectEasing: boolean;
103
109
  readonly selectedItems: readonly TimelineSelection[];
104
110
  readonly isSelected: (item: TimelineSelection) => boolean;
105
111
  readonly selectItem: (item: TimelineSelection, interaction?: TimelineSelectionInteraction) => void;
@@ -153,12 +159,20 @@ export declare const useTimelineEasingSelection: ({ nodePathInfo, fromFrame, toF
153
159
  onSelect: (interaction?: TimelineSelectionInteraction | undefined) => void;
154
160
  selectable: boolean;
155
161
  selected: boolean;
156
- selectionItem: TimelineSelectionBase & {
162
+ selectionItem: {
157
163
  readonly type: "easing";
164
+ readonly nodePathInfo: SequenceNodePathInfo;
158
165
  readonly fromFrame: number;
159
166
  readonly toFrame: number;
160
167
  readonly segmentIndex: number;
161
168
  };
162
169
  };
170
+ export declare const useTimelineGuideSelection: (guideId: string) => {
171
+ clearSelection: () => void;
172
+ onSelect: () => void;
173
+ selectable: boolean;
174
+ selected: boolean;
175
+ selectionItem: TimelineSelection;
176
+ };
163
177
  export declare const useTimelineRowContainsSelection: (nodePathInfo: SequenceNodePathInfo | null) => boolean;
164
178
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTimelineRowContainsSelection = exports.useTimelineEasingSelection = exports.useTimelineKeyframeSelection = exports.useTimelineRowSelection = exports.useTimelineMarqueeSelectableItem = exports.useTimelineMarqueeSelection = exports.useCurrentTimelineSelectionStateAsRef = exports.TIMELINE_SCRUBBER_ATTR = exports.TIMELINE_MARQUEE_ITEM_ATTR = exports.useTimelineSelection = exports.TimelineSelectionProvider = exports.TimelineSelectAllKeybindings = exports.getTimelineSequenceSelectionKey = exports.getSelectableTimelineSequenceSelections = exports.getTimelineSelectionKey = exports.getTimelineSelectionFromNodePathInfo = exports.getTimelineMarqueeSelection = exports.timelineMarqueeRectsIntersect = exports.getClampedTimelineMarqueePoint = exports.getNormalizedTimelineMarqueeRect = exports.getTimelineSelectionAfterInteraction = exports.shouldSelectTimelineRowOnPointerDown = exports.isTimelineSelectionModifierEvent = exports.TIMELINE_TICKS_BACKGROUND = exports.TIMELINE_BACKGROUND = exports.getTimelineSelectedTrackHighlightStyle = exports.getTimelineColor = exports.getTimelineSelectedLabelStyle = exports.TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = exports.TIMELINE_SELECTED_LABEL_TEXT = exports.TIMELINE_SELECTED_LABEL_BACKGROUND = exports.TIMELINE_SELECTED_BACKGROUND = void 0;
3
+ exports.useTimelineRowContainsSelection = exports.useTimelineGuideSelection = exports.useTimelineEasingSelection = exports.useTimelineKeyframeSelection = exports.useTimelineRowSelection = exports.useTimelineMarqueeSelectableItem = exports.useTimelineMarqueeSelection = exports.useCurrentTimelineSelectionStateAsRef = exports.TIMELINE_SCRUBBER_ATTR = exports.TIMELINE_MARQUEE_ITEM_ATTR = exports.useTimelineSelection = exports.TimelineSelectionProvider = exports.TimelineSelectAllKeybindings = exports.getTimelineSequenceSelectionKey = exports.getSelectableTimelineSequenceSelections = exports.getTimelineSelectionKey = exports.getTimelineSelectionFromNodePathInfo = exports.getTimelineMarqueeSelection = exports.timelineMarqueeRectsIntersect = exports.getClampedTimelineMarqueePoint = exports.getNormalizedTimelineMarqueeRect = exports.getTimelineSelectionAfterInteraction = exports.shouldSelectTimelineRowOnPointerDown = exports.isTimelineSelectionModifierEvent = exports.TIMELINE_TICKS_BACKGROUND = exports.TIMELINE_BACKGROUND = exports.getTimelineSelectedTrackHighlightStyle = exports.getTimelineColor = exports.getTimelineSelectedLabelStyle = exports.TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = exports.TIMELINE_SELECTED_LABEL_TEXT = exports.TIMELINE_SELECTED_LABEL_BACKGROUND = exports.TIMELINE_SELECTED_BACKGROUND = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const studio_shared_1 = require("@remotion/studio-shared");
6
6
  const react_1 = require("react");
@@ -97,6 +97,12 @@ const getRangeSelection = ({ anchor, clickedItem, allSelectableItems, }) => {
97
97
  const getTimelineSelectionAfterInteraction = ({ currentState, clickedItem, interaction, allSelectableItems, }) => {
98
98
  const { selectedItems, anchor: previousAnchor } = currentState;
99
99
  const clickedType = getTimelineSelectionType(clickedItem);
100
+ if (clickedType === 'guide') {
101
+ return {
102
+ selectedItems: [clickedItem],
103
+ anchor: clickedItem,
104
+ };
105
+ }
100
106
  const nextAnchor = getTimelineSelectionAnchor(selectedItems, previousAnchor, clickedType);
101
107
  const clickedKey = (0, exports.getTimelineSelectionKey)(clickedItem);
102
108
  if (interaction.shiftKey && nextAnchor) {
@@ -201,7 +207,6 @@ const getTimelineMarqueeSelection = ({ candidates, lockedSelectionKind, marqueeR
201
207
  exports.getTimelineMarqueeSelection = getTimelineMarqueeSelection;
202
208
  const defaultTimelineSelectionContextValue = {
203
209
  canSelect: false,
204
- canSelectEasing: false,
205
210
  selectedItems: [],
206
211
  isSelected: () => false,
207
212
  selectItem: () => undefined,
@@ -259,22 +264,23 @@ const getTimelineSelectionFromNodePathInfo = (nodePathInfo) => {
259
264
  };
260
265
  exports.getTimelineSelectionFromNodePathInfo = getTimelineSelectionFromNodePathInfo;
261
266
  const getTimelineSelectionKey = (item) => {
262
- const sequenceKey = (0, exports.getTimelineSequenceSelectionKey)(item.nodePathInfo);
263
267
  switch (item.type) {
268
+ case 'guide':
269
+ return `guide.${item.guideId}`;
264
270
  case 'sequence':
265
- return `${sequenceKey}.sequence`;
271
+ return `${(0, exports.getTimelineSequenceSelectionKey)(item.nodePathInfo)}.sequence`;
266
272
  case 'sequence-prop':
267
- return `${sequenceKey}.sequence-prop.${item.key}`;
273
+ return `${(0, exports.getTimelineSequenceSelectionKey)(item.nodePathInfo)}.sequence-prop.${item.key}`;
268
274
  case 'sequence-all-effects':
269
- return `${sequenceKey}.sequence-all-effects`;
275
+ return `${(0, exports.getTimelineSequenceSelectionKey)(item.nodePathInfo)}.sequence-all-effects`;
270
276
  case 'sequence-effect':
271
- return `${sequenceKey}.sequence-effect.${item.i}`;
277
+ return `${(0, exports.getTimelineSequenceSelectionKey)(item.nodePathInfo)}.sequence-effect.${item.i}`;
272
278
  case 'sequence-effect-prop':
273
- return `${sequenceKey}.sequence-effect-prop.${item.i}.${item.key}`;
279
+ return `${(0, exports.getTimelineSequenceSelectionKey)(item.nodePathInfo)}.sequence-effect-prop.${item.i}.${item.key}`;
274
280
  case 'keyframe':
275
281
  return `${(0, timeline_node_path_key_1.timelineNodePathInfoToKey)(item.nodePathInfo)}.keyframe.${item.frame}`;
276
282
  case 'easing':
277
- return `${(0, timeline_node_path_key_1.timelineNodePathInfoToKey)(item.nodePathInfo)}.easing.${item.segmentIndex}.${item.fromFrame}.${item.toFrame}`;
283
+ return `${(0, timeline_node_path_key_1.timelineNodePathInfoToKey)(item.nodePathInfo)}.easing.${item.segmentIndex}`;
278
284
  default:
279
285
  throw new Error(`Unexpected timeline selection type: ${item}`);
280
286
  }
@@ -343,8 +349,6 @@ const TimelineSelectionProvider = ({ children }) => {
343
349
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
344
350
  const canSelect = previewServerState.type === 'connected' &&
345
351
  !window.remotion_isReadOnlyStudio;
346
- const canSelectEasing = previewServerState.type === 'connected' &&
347
- !window.remotion_isReadOnlyStudio;
348
352
  const [selectedItems, setSelectedItems] = (0, react_1.useState)([]);
349
353
  const selectionAnchor = (0, react_1.useRef)(null);
350
354
  const selectableItemsOrder = (0, react_1.useRef)(new Map());
@@ -353,11 +357,11 @@ const TimelineSelectionProvider = ({ children }) => {
353
357
  const registrationCounter = (0, react_1.useRef)(0);
354
358
  const marqueeRegistrationCounter = (0, react_1.useRef)(0);
355
359
  (0, react_1.useEffect)(() => {
356
- if (!canSelect && !canSelectEasing) {
360
+ if (!canSelect) {
357
361
  setSelectedItems([]);
358
362
  }
359
- }, [canSelect, canSelectEasing]);
360
- const canSelectItem = (0, react_1.useCallback)((item) => canSelect || (canSelectEasing && item.type === 'easing'), [canSelect, canSelectEasing]);
363
+ }, [canSelect]);
364
+ const canSelectItem = (0, react_1.useCallback)((_item) => canSelect, [canSelect]);
361
365
  const selectedKeys = (0, react_1.useMemo)(() => new Set(selectedItems.map(exports.getTimelineSelectionKey)), [selectedItems]);
362
366
  const isSelected = (0, react_1.useCallback)((item) => {
363
367
  return selectedKeys.has((0, exports.getTimelineSelectionKey)(item));
@@ -456,11 +460,11 @@ const TimelineSelectionProvider = ({ children }) => {
456
460
  setSelectedItems([]);
457
461
  }, []);
458
462
  const containsSelection = (0, react_1.useCallback)((nodePathInfo) => {
459
- return selectedItems.some((selected) => nodePathDescendsFrom(selected.nodePathInfo, nodePathInfo));
463
+ return selectedItems.some((selected) => selected.type !== 'guide' &&
464
+ nodePathDescendsFrom(selected.nodePathInfo, nodePathInfo));
460
465
  }, [selectedItems]);
461
466
  const value = (0, react_1.useMemo)(() => ({
462
467
  canSelect,
463
- canSelectEasing,
464
468
  selectedItems,
465
469
  isSelected,
466
470
  selectItem,
@@ -472,7 +476,6 @@ const TimelineSelectionProvider = ({ children }) => {
472
476
  clearSelection,
473
477
  }), [
474
478
  canSelect,
475
- canSelectEasing,
476
479
  selectedItems,
477
480
  isSelected,
478
481
  selectItem,
@@ -504,14 +507,14 @@ const useCurrentTimelineSelectionStateAsRef = () => {
504
507
  };
505
508
  exports.useCurrentTimelineSelectionStateAsRef = useCurrentTimelineSelectionStateAsRef;
506
509
  const useTimelineMarqueeSelection = () => {
507
- const { canSelect, canSelectEasing, getMarqueeSelection, selectItems } = (0, exports.useTimelineSelection)();
510
+ const { canSelect, getMarqueeSelection, selectItems } = (0, exports.useTimelineSelection)();
508
511
  const { isHighestContext } = (0, z_index_1.useZIndex)();
509
512
  const [marqueeRect, setMarqueeRect] = (0, react_1.useState)(null);
510
513
  const onPointerDownCapture = (0, react_1.useCallback)((event) => {
511
514
  if (!isHighestContext) {
512
515
  return;
513
516
  }
514
- if (event.button !== 0 || (!canSelect && !canSelectEasing)) {
517
+ if (event.button !== 0 || !canSelect) {
515
518
  return;
516
519
  }
517
520
  if (event.shiftKey || event.metaKey || event.ctrlKey) {
@@ -596,13 +599,7 @@ const useTimelineMarqueeSelection = () => {
596
599
  window.addEventListener('pointermove', onPointerMove);
597
600
  window.addEventListener('pointerup', onPointerUp);
598
601
  window.addEventListener('pointercancel', onPointerCancel);
599
- }, [
600
- canSelect,
601
- canSelectEasing,
602
- getMarqueeSelection,
603
- isHighestContext,
604
- selectItems,
605
- ]);
602
+ }, [canSelect, getMarqueeSelection, isHighestContext, selectItems]);
606
603
  return { marqueeRect, onPointerDownCapture };
607
604
  };
608
605
  exports.useTimelineMarqueeSelection = useTimelineMarqueeSelection;
@@ -667,7 +664,7 @@ const useTimelineKeyframeSelection = (nodePathInfo, frame) => {
667
664
  };
668
665
  exports.useTimelineKeyframeSelection = useTimelineKeyframeSelection;
669
666
  const useTimelineEasingSelection = ({ nodePathInfo, fromFrame, toFrame, segmentIndex, }) => {
670
- const { canSelectEasing, isSelected, selectItem, registerSelectableItem } = (0, exports.useTimelineSelection)();
667
+ const { canSelect, isSelected, selectItem, registerSelectableItem } = (0, exports.useTimelineSelection)();
671
668
  const selectionItem = (0, react_1.useMemo)(() => ({
672
669
  type: 'easing',
673
670
  nodePathInfo,
@@ -684,12 +681,34 @@ const useTimelineEasingSelection = ({ nodePathInfo, fromFrame, toFrame, segmentI
684
681
  }, [selectItem, selectionItem]);
685
682
  return {
686
683
  onSelect,
687
- selectable: canSelectEasing,
684
+ selectable: canSelect,
688
685
  selected,
689
686
  selectionItem,
690
687
  };
691
688
  };
692
689
  exports.useTimelineEasingSelection = useTimelineEasingSelection;
690
+ const useTimelineGuideSelection = (guideId) => {
691
+ const { canSelect, clearSelection, isSelected, selectItem, registerSelectableItem, } = (0, exports.useTimelineSelection)();
692
+ const selectionItem = (0, react_1.useMemo)(() => ({
693
+ type: 'guide',
694
+ guideId,
695
+ }), [guideId]);
696
+ (0, react_1.useEffect)(() => {
697
+ return registerSelectableItem(selectionItem);
698
+ }, [registerSelectableItem, selectionItem]);
699
+ const selected = isSelected(selectionItem);
700
+ const onSelect = (0, react_1.useCallback)(() => {
701
+ selectItem(selectionItem);
702
+ }, [selectItem, selectionItem]);
703
+ return {
704
+ clearSelection,
705
+ onSelect,
706
+ selectable: canSelect,
707
+ selected,
708
+ selectionItem,
709
+ };
710
+ };
711
+ exports.useTimelineGuideSelection = useTimelineGuideSelection;
693
712
  const useTimelineRowContainsSelection = (nodePathInfo) => {
694
713
  const { containsSelection } = (0, exports.useTimelineSelection)();
695
714
  if (nodePathInfo === null) {