@hyperframes/studio 0.8.229 → 0.8.231

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 (53) hide show
  1. package/dist/assets/{hyperframes-player-CtwXT8nW.js → hyperframes-player-ClW2l0Vl.js} +1 -1
  2. package/dist/assets/{index-CNO8BPjF.js → index-CGfRmZQd.js} +1 -1
  3. package/dist/assets/{index-CrRO-B3w.js → index-DxWNzvQJ.js} +187 -187
  4. package/dist/index.d.ts +73 -2
  5. package/dist/index.html +1 -1
  6. package/dist/index.js +2475 -2228
  7. package/package.json +8 -8
  8. package/src/captions/components/CaptionOverlay.tsx +7 -14
  9. package/src/captions/keyboard.test.ts +12 -1
  10. package/src/captions/keyboard.ts +8 -8
  11. package/src/components/EditorShell.tsx +2 -1
  12. package/src/components/TimelineToolPicker.tsx +6 -4
  13. package/src/components/TimelineToolbar.tsx +22 -18
  14. package/src/components/editor/GestureRecordControl.tsx +8 -3
  15. package/src/components/editor/InspectorHeaderActions.tsx +3 -1
  16. package/src/components/editor/PropertyPanelFlatFooter.tsx +3 -1
  17. package/src/components/editor/PropertyPanelFlatHeader.tsx +3 -1
  18. package/src/components/editor/SnapToolbar.tsx +11 -5
  19. package/src/components/editor/domEditNudge.test.ts +17 -1
  20. package/src/components/editor/domEditNudge.ts +16 -13
  21. package/src/components/editor/marqueeCommit.ts +2 -1
  22. package/src/hooks/appHotkeysDispatch.ts +104 -118
  23. package/src/hooks/linkShortcuts.test.ts +20 -0
  24. package/src/hooks/linkShortcuts.ts +11 -11
  25. package/src/hooks/useAppHotkeys.test.ts +201 -0
  26. package/src/hooks/useAppHotkeys.ts +1 -4
  27. package/src/hooks/useAutomationSelectionKeyboard.ts +7 -18
  28. package/src/hooks/useKeyframeKeyboard.ts +2 -3
  29. package/src/hooks/useTimelineDeleteOps.ts +2 -1
  30. package/src/index.ts +9 -1
  31. package/src/player/components/BeatStrip.tsx +2 -1
  32. package/src/player/components/ClipContextMenu.tsx +9 -6
  33. package/src/player/components/PlayerControls.tsx +3 -2
  34. package/src/player/components/ShortcutsPanel.tsx +3 -2
  35. package/src/player/components/TimelineClipFades.tsx +2 -1
  36. package/src/player/components/clipMenuLinkItems.tsx +5 -4
  37. package/src/player/components/studioCombo.test.ts +99 -0
  38. package/src/player/components/studioCombo.ts +108 -0
  39. package/src/player/components/studioShortcuts.test.tsx +124 -0
  40. package/src/player/components/studioShortcuts.ts +245 -96
  41. package/src/player/components/timelineClipDragGestureLifecycle.ts +2 -1
  42. package/src/player/components/timelineEditing.ts +2 -2
  43. package/src/player/components/useTimelineClipDrag.ts +2 -1
  44. package/src/player/components/useTimelineKeyboardActor.ts +7 -18
  45. package/src/player/components/useTimelineKeyframeHandlers.ts +2 -1
  46. package/src/player/components/useTimelineRangeSelection.ts +3 -2
  47. package/src/player/hooks/usePlaybackKeyboard.test.ts +164 -4
  48. package/src/player/hooks/usePlaybackKeyboard.ts +94 -102
  49. package/src/player/hooks/useShadowPreviewReload.ts +11 -4
  50. package/src/player/hooks/useShadowReloadRetry.ts +68 -0
  51. package/src/player/hooks/useTimelinePlayer.shadowRetry.test.ts +85 -0
  52. package/src/player/hooks/useTimelinePlayer.test.ts +19 -13
  53. package/src/player/lib/playbackShortcuts.ts +16 -7
@@ -1,12 +1,153 @@
1
- /** Bare keys Studio's hotkeys bind; the shortcuts list names them from here. */
2
- export const STUDIO_PLAIN_KEYS = {
1
+ import { useSyncExternalStore } from "react";
2
+ import {
3
+ type ComboEvent,
4
+ comboClashKey,
5
+ comboText,
6
+ formatCombo,
7
+ matchCombo,
8
+ parseCombo,
9
+ } from "./studioCombo";
10
+
11
+ /** Every single-character bare key Studio answers, by action. */
12
+ export const DEFAULT_STUDIO_KEYS = {
3
13
  fullscreen: "f",
4
14
  split: "s",
5
15
  record: "r",
6
16
  addKeyframe: "k",
7
17
  audioGain: "g",
8
18
  zoomSelection: "z",
9
- } as const;
19
+ mute: "m",
20
+ pause: "k",
21
+ shuttleBack: "j",
22
+ shuttleForward: "l",
23
+ inPoint: "i",
24
+ outPoint: "o",
25
+ seekToIn: "a",
26
+ seekToOut: "e",
27
+ selectTool: "v",
28
+ razorTool: "b",
29
+ selectLeftward: "[",
30
+ selectRightward: "]",
31
+ exitRazor: "a",
32
+ snap: "s",
33
+ grid: "g",
34
+ timelineSnap: "n",
35
+ playPause: "Space",
36
+ frameBack: "ArrowLeft",
37
+ frameForward: "ArrowRight",
38
+ frameBackTen: "shift+ArrowLeft",
39
+ frameForwardTen: "shift+ArrowRight",
40
+ loop: "shift+l",
41
+ clearInPoint: "shift+i",
42
+ clearOutPoint: "shift+o",
43
+ undo: "mod+z",
44
+ redo: "mod+shift+z",
45
+ redoAlt: "ctrl+y",
46
+ tabCompositions: "mod+1",
47
+ tabAssets: "mod+2",
48
+ group: "mod+g",
49
+ ungroup: "mod+shift+g",
50
+ copy: "mod+c",
51
+ paste: "mod+v",
52
+ cut: "mod+x",
53
+ duplicate: "mod+d",
54
+ linkToggle: "mod+l",
55
+ detachAudio: "alt+shift+d",
56
+ deleteLinked: "alt+Backspace",
57
+ deleteLinkedAlt: "alt+Delete",
58
+ deleteSelected: "Delete",
59
+ deleteSelectedAlt: "Backspace",
60
+ resetKeyframes: "Backspace",
61
+ nudgeLeft: "ArrowLeft",
62
+ nudgeRight: "ArrowRight",
63
+ nudgeUp: "ArrowUp",
64
+ nudgeDown: "ArrowDown",
65
+ nudgeLeftTen: "shift+ArrowLeft",
66
+ nudgeRightTen: "shift+ArrowRight",
67
+ nudgeUpTen: "shift+ArrowUp",
68
+ nudgeDownTen: "shift+ArrowDown",
69
+ captionSelectAll: "mod+a",
70
+ pickupClip: "Space",
71
+ pickupUp: "ArrowUp",
72
+ pickupDown: "ArrowDown",
73
+ pickupDrop: "Enter",
74
+ cancel: "Escape",
75
+ };
76
+
77
+ export type StudioKeyAction = keyof typeof DEFAULT_STUDIO_KEYS;
78
+ export type StudioKeys = Readonly<Record<StudioKeyAction, string>>;
79
+
80
+ const SHARED_BY_DESIGN: ReadonlyArray<readonly [StudioKeyAction, StudioKeyAction]> = [
81
+ ["pause", "addKeyframe"],
82
+ ["seekToIn", "exitRazor"],
83
+ ["split", "snap"],
84
+ ["audioGain", "grid"],
85
+ ["playPause", "pickupClip"],
86
+ ["frameBack", "nudgeLeft"],
87
+ ["frameForward", "nudgeRight"],
88
+ ["frameBackTen", "nudgeLeftTen"],
89
+ ["frameForwardTen", "nudgeRightTen"],
90
+ ["nudgeUp", "pickupUp"],
91
+ ["nudgeDown", "pickupDown"],
92
+ ["deleteSelectedAlt", "resetKeyframes"],
93
+ ];
94
+
95
+ let current: StudioKeys = DEFAULT_STUDIO_KEYS;
96
+ const listeners = new Set<() => void>();
97
+
98
+ const sharedByDesign = (a: StudioKeyAction, b: StudioKeyAction) =>
99
+ SHARED_BY_DESIGN.some(([x, y]) => (x === a && y === b) || (x === b && y === a));
100
+
101
+ function findClash(keys: StudioKeys): string | null {
102
+ const actions = Object.keys(keys) as StudioKeyAction[];
103
+ const clashKey = (action: StudioKeyAction) => comboClashKey(parseCombo(keys[action])!);
104
+ for (const [i, a] of actions.entries()) {
105
+ for (const b of actions.slice(i + 1)) {
106
+ if (clashKey(a) === clashKey(b) && !sharedByDesign(a, b))
107
+ return `${a} and ${b} both on "${keys[a]}"`;
108
+ }
109
+ }
110
+ return null;
111
+ }
112
+
113
+ function resolve(overrides: Partial<Record<StudioKeyAction, string>>): StudioKeys {
114
+ const next: Record<string, string> = { ...DEFAULT_STUDIO_KEYS };
115
+ for (const [action, text] of Object.entries(overrides)) {
116
+ const combo = typeof text === "string" ? parseCombo(text) : null;
117
+ if (!Object.hasOwn(DEFAULT_STUDIO_KEYS, action) || !combo) {
118
+ console.warn(
119
+ `Studio keys: using defaults, "${action}" is not a known action with a valid combo`,
120
+ );
121
+ return DEFAULT_STUDIO_KEYS;
122
+ }
123
+ next[action] = comboText(combo);
124
+ }
125
+ const clash = findClash(next as StudioKeys);
126
+ if (!clash) return next as StudioKeys;
127
+ console.warn(`Studio keys: using defaults, ${clash}`);
128
+ return DEFAULT_STUDIO_KEYS;
129
+ }
130
+
131
+ /** Replaces the host key map; a bad map is refused whole. null restores the defaults. */
132
+ export function setStudioKeys(overrides: Partial<Record<StudioKeyAction, string>> | null) {
133
+ current = overrides ? resolve(overrides) : DEFAULT_STUDIO_KEYS;
134
+ for (const listener of listeners) listener();
135
+ }
136
+
137
+ export const getStudioKeys = (): StudioKeys => current;
138
+ export const getStudioKey = (action: StudioKeyAction): string => current[action];
139
+
140
+ function subscribe(listener: () => void) {
141
+ listeners.add(listener);
142
+ return () => listeners.delete(listener);
143
+ }
144
+
145
+ export const useStudioKeys = (): StudioKeys => useSyncExternalStore(subscribe, getStudioKeys);
146
+
147
+ export function useShortcutSections(host?: readonly ShortcutSection[]): readonly ShortcutSection[] {
148
+ const keys = useStudioKeys();
149
+ return host ?? buildShortcutSections(keys);
150
+ }
10
151
 
11
152
  export interface ShortcutHint {
12
153
  key: string;
@@ -18,96 +159,104 @@ export interface ShortcutSection {
18
159
  hints: readonly ShortcutHint[];
19
160
  }
20
161
 
21
- const hintKey = (key: string) => key.toUpperCase();
22
-
23
- export const SPLIT_SHORTCUT_HINT = hintKey(STUDIO_PLAIN_KEYS.split);
24
- export const ZOOM_SELECTION_SHORTCUT_HINT = hintKey(STUDIO_PLAIN_KEYS.zoomSelection);
25
-
26
- /** What PlayerControls' shortcuts panel lists unless an embedder passes its own sections. */
27
- export const DEFAULT_SHORTCUT_SECTIONS: readonly ShortcutSection[] = [
28
- {
29
- title: "Playback",
30
- hints: [
31
- { key: "Space", label: "Play / Pause" },
32
- { key: "J", label: "Play backward" },
33
- { key: "K", label: "Stop" },
34
- { key: "L", label: "Play forward" },
35
- { key: "M", label: "Toggle mute" },
36
- { key: "⇧L", label: "Toggle loop" },
37
- { key: "←/→", label: "Step 1 frame" },
38
- { key: "⇧←/⇧→", label: "Step 10 frames" },
39
- { key: hintKey(STUDIO_PLAIN_KEYS.fullscreen), label: "Toggle fullscreen" },
40
- ],
41
- },
42
- {
43
- title: "Keyframes (when an element is selected)",
44
- hints: [
45
- { key: hintKey(STUDIO_PLAIN_KEYS.addKeyframe), label: "Add / remove keyframe at playhead" },
46
- { key: "Del", label: "Delete selected keyframe" },
47
- { key: hintKey(STUDIO_PLAIN_KEYS.record), label: "Record gesture" },
48
- ],
49
- },
50
- {
51
- title: "Editing",
52
- hints: [
53
- { key: "⌘Z", label: "Undo" },
54
- { key: "⌘⇧Z", label: "Redo" },
55
- { key: "⌘C", label: "Copy element" },
56
- { key: "⌘V", label: "Paste element" },
57
- { key: "⌘X", label: "Cut element" },
58
- { key: SPLIT_SHORTCUT_HINT, label: "Split clip at playhead" },
59
- { key: ZOOM_SELECTION_SHORTCUT_HINT, label: "Zoom timeline to selected clips" },
60
- { key: hintKey(STUDIO_PLAIN_KEYS.audioGain), label: "Audio Gain for clips with sound" },
61
- { key: "⇧Click", label: "Razor tool: split all tracks" },
62
- { key: "[", label: "Select clips starting before the playhead" },
63
- { key: "]", label: "Select clips running at or after the playhead" },
64
- { key: "⌘G", label: "Group elements" },
65
- { key: "⌘⇧G", label: "Ungroup" },
66
- { key: "Del", label: "Delete selected element (no keyframe selected)" },
67
- ],
68
- },
69
- {
70
- title: "Gesture recording modifiers",
71
- hints: [
72
- { key: "Drag", label: "Record x / y position" },
73
- { key: "Scroll", label: "Record z depth" },
74
- { key: "⇧ Drag", label: "Record rotationX / rotationY" },
75
- { key: "⌥ Drag", label: "Record rotation" },
76
- { key: "⌘ Drag↕", label: "Record opacity" },
77
- { key: "⌘ Scroll", label: "Record scale" },
78
- ],
79
- },
80
- {
81
- title: "Canvas",
82
- hints: [
83
- { key: "Drag", label: "Move element / add keyframe" },
84
- { key: "⌥ Drag", label: "Move entire animation path" },
85
- { key: "⇧ Drag", label: "Uniform resize" },
86
- ],
87
- },
88
- {
89
- title: "Crop",
90
- hints: [
91
- { key: "Drag edge", label: "Crop a side" },
92
- { key: "Drag center", label: "Reposition the crop" },
93
- ],
94
- },
95
- {
96
- title: "Panels",
97
- hints: [
98
- { key: "⌘1", label: "Compositions tab" },
99
- { key: "⌘2", label: "Assets tab" },
100
- ],
101
- },
102
- {
103
- title: "Work area",
104
- hints: [
105
- { key: "I", label: "Set in-point" },
106
- { key: "⇧I", label: "Clear in-point" },
107
- { key: "O", label: "Set out-point" },
108
- { key: "⇧O", label: "Clear out-point" },
109
- { key: "A", label: "Jump to in-point" },
110
- { key: "E", label: "Jump to out-point" },
111
- ],
112
- },
113
- ];
162
+ export const keyHint = (action: StudioKeyAction, keys: StudioKeys = current) =>
163
+ formatCombo(parseCombo(keys[action])!);
164
+
165
+ export const matchesKey = (e: ComboEvent, action: StudioKeyAction) =>
166
+ matchCombo(e, parseCombo(current[action])!);
167
+
168
+ export function buildShortcutSections(keys: StudioKeys): readonly ShortcutSection[] {
169
+ const k = (action: StudioKeyAction) => keyHint(action, keys);
170
+ return [
171
+ {
172
+ title: "Playback",
173
+ hints: [
174
+ { key: k("playPause"), label: "Play / Pause" },
175
+ { key: k("shuttleBack"), label: "Play backward" },
176
+ { key: k("pause"), label: "Stop" },
177
+ { key: k("shuttleForward"), label: "Play forward" },
178
+ { key: k("mute"), label: "Toggle mute" },
179
+ { key: k("loop"), label: "Toggle loop" },
180
+ { key: `${k("frameBack")}/${k("frameForward")}`, label: "Step 1 frame" },
181
+ { key: `${k("frameBackTen")}/${k("frameForwardTen")}`, label: "Step 10 frames" },
182
+ { key: k("fullscreen"), label: "Toggle fullscreen" },
183
+ ],
184
+ },
185
+ {
186
+ title: "Keyframes (when an element is selected)",
187
+ hints: [
188
+ { key: k("addKeyframe"), label: "Add / remove keyframe at playhead" },
189
+ { key: k("deleteSelected"), label: "Delete selected keyframe" },
190
+ { key: k("record"), label: "Record gesture" },
191
+ ],
192
+ },
193
+ {
194
+ title: "Editing",
195
+ hints: [
196
+ { key: k("undo"), label: "Undo" },
197
+ { key: k("redo"), label: "Redo" },
198
+ { key: k("copy"), label: "Copy element" },
199
+ { key: k("paste"), label: "Paste element" },
200
+ { key: k("cut"), label: "Cut element" },
201
+ { key: k("split"), label: "Split clip at playhead" },
202
+ { key: k("zoomSelection"), label: "Zoom timeline to selected clips" },
203
+ { key: k("audioGain"), label: "Audio Gain for clips with sound" },
204
+ { key: "⇧Click", label: "Razor tool: split all tracks" },
205
+ { key: k("selectLeftward"), label: "Select clips starting before the playhead" },
206
+ { key: k("selectRightward"), label: "Select clips running at or after the playhead" },
207
+ { key: k("group"), label: "Group elements" },
208
+ { key: k("ungroup"), label: "Ungroup" },
209
+ { key: k("deleteSelected"), label: "Delete selected element (no keyframe selected)" },
210
+ ],
211
+ },
212
+ {
213
+ title: "Gesture recording modifiers",
214
+ hints: [
215
+ { key: "Drag", label: "Record x / y position" },
216
+ { key: "Scroll", label: "Record z depth" },
217
+ { key: "⇧ Drag", label: "Record rotationX / rotationY" },
218
+ { key: "⌥ Drag", label: "Record rotation" },
219
+ { key: "⌘ Drag↕", label: "Record opacity" },
220
+ { key: "⌘ Scroll", label: "Record scale" },
221
+ ],
222
+ },
223
+ {
224
+ title: "Canvas",
225
+ hints: [
226
+ { key: "Drag", label: "Move element / add keyframe" },
227
+ { key: "⌥ Drag", label: "Move entire animation path" },
228
+ { key: "⇧ Drag", label: "Uniform resize" },
229
+ ],
230
+ },
231
+ {
232
+ title: "Crop",
233
+ hints: [
234
+ { key: "Drag edge", label: "Crop a side" },
235
+ { key: "Drag center", label: "Reposition the crop" },
236
+ ],
237
+ },
238
+ {
239
+ title: "Panels",
240
+ hints: [
241
+ { key: k("tabCompositions"), label: "Compositions tab" },
242
+ { key: k("tabAssets"), label: "Assets tab" },
243
+ ],
244
+ },
245
+ {
246
+ title: "Work area",
247
+ hints: [
248
+ { key: k("inPoint"), label: "Set in-point" },
249
+ { key: k("clearInPoint"), label: "Clear in-point" },
250
+ { key: k("outPoint"), label: "Set out-point" },
251
+ { key: k("clearOutPoint"), label: "Clear out-point" },
252
+ { key: k("seekToIn"), label: "Jump to in-point" },
253
+ { key: k("seekToOut"), label: "Jump to out-point" },
254
+ ],
255
+ },
256
+ ];
257
+ }
258
+
259
+ export const getShortcutSections = () => buildShortcutSections(current);
260
+
261
+ export const DEFAULT_SHORTCUT_SECTIONS: readonly ShortcutSection[] =
262
+ buildShortcutSections(DEFAULT_STUDIO_KEYS);
@@ -1,4 +1,5 @@
1
1
  import type { TimelineTrackInsertLayout } from "./timelineTrackInsertLayout";
2
+ import { matchesKey } from "./studioShortcuts";
2
3
  import type { Dispatch, RefObject, SetStateAction } from "react";
3
4
  import { resolveTimelineDragEscape } from "./timelineEditing";
4
5
  import { commitDraggedClipMove } from "./timelineClipDragCommit";
@@ -407,7 +408,7 @@ export function mountTimelineClipDragGestureLifecycle({
407
408
 
408
409
  const handleWindowKeyDown = (event: KeyboardEvent) => {
409
410
  const decision = resolveTimelineDragEscape({
410
- key: event.key,
411
+ cancelPressed: matchesKey(event, "cancel"),
411
412
  drag: draggedClipRef.current,
412
413
  resize: resizingClipRef.current,
413
414
  blocked: blockedClipRef.current,
@@ -555,7 +555,7 @@ export function resolveTimelineDragEscape(input: TimelineDragEscapeInput): {
555
555
  cancel: boolean;
556
556
  suppressClick: boolean;
557
557
  } {
558
- if (input.key !== "Escape" || (!input.drag && !input.resize && !input.blocked)) {
558
+ if (!input.cancelPressed || (!input.drag && !input.resize && !input.blocked)) {
559
559
  return { cancel: false, suppressClick: false };
560
560
  }
561
561
  return {
@@ -565,7 +565,7 @@ export function resolveTimelineDragEscape(input: TimelineDragEscapeInput): {
565
565
  }
566
566
 
567
567
  export interface TimelineDragEscapeInput {
568
- key: string;
568
+ cancelPressed: boolean;
569
569
  drag: { started: boolean } | null;
570
570
  resize: { started: boolean } | null;
571
571
  blocked: { started: boolean } | null;
@@ -1,4 +1,5 @@
1
1
  import { useRef, useState, useCallback, useMemo, useEffect } from "react";
2
+ import { matchesKey } from "./studioShortcuts";
2
3
  import { useMountEffect } from "../../hooks/useMountEffect";
3
4
  import { markTimelineMotion } from "./timelineMotion";
4
5
  import {
@@ -546,7 +547,7 @@ export function useTimelineClipDrag({
546
547
  return;
547
548
  }
548
549
  if (resizingClipRef.current) return;
549
- if (event.key !== " " || event.repeat) return;
550
+ if (!matchesKey(event, "pickupClip") || event.repeat) return;
550
551
  if (viewport) pickup(event, viewport);
551
552
  };
552
553
  window.addEventListener("keydown", handleKeyDown, true);
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useMemo, type FocusEvent, type KeyboardEvent, type RefObject } from "react";
2
+ import { matchesKey } from "./studioShortcuts";
2
3
  import { usePlayerStore, type TimelineElement } from "../store/playerStore";
3
4
  import { RULER_H, TRACK_H, type TimelineRowGeometry } from "./timelineLayout";
4
5
  import {
@@ -24,24 +25,12 @@ type ClipPickupAction =
24
25
  | { kind: "focus" }
25
26
  | { kind: "consume" };
26
27
 
27
- function clipPickupKeyboardAction(event: {
28
- key: string;
29
- repeat: boolean;
30
- }): ClipPickupAction | null {
31
- switch (event.key) {
32
- case "ArrowUp":
33
- return { kind: "move", step: -1 };
34
- case "ArrowDown":
35
- return { kind: "move", step: 1 };
36
- case "Enter":
37
- return { kind: event.repeat ? "focus" : "commit" };
38
- case "Escape":
39
- return { kind: "cancel" };
40
- case " ":
41
- return { kind: "consume" };
42
- default:
43
- return null;
44
- }
28
+ function clipPickupKeyboardAction(event: globalThis.KeyboardEvent): ClipPickupAction | null {
29
+ if (matchesKey(event, "pickupUp")) return { kind: "move", step: -1 };
30
+ if (matchesKey(event, "pickupDown")) return { kind: "move", step: 1 };
31
+ if (matchesKey(event, "pickupDrop")) return { kind: event.repeat ? "focus" : "commit" };
32
+ if (matchesKey(event, "cancel")) return { kind: "cancel" };
33
+ return matchesKey(event, "pickupClip") ? { kind: "consume" } : null;
45
34
  }
46
35
 
47
36
  export function handleClipPickupKeyboardEvent(
@@ -3,6 +3,7 @@ import {
3
3
  type MouseEvent as ReactMouseEvent,
4
4
  type PointerEvent as ReactPointerEvent,
5
5
  } from "react";
6
+ import { matchesKey } from "./studioShortcuts";
6
7
  import { clipToTweenPercentage } from "../../components/editor/KeyframeNavigation";
7
8
  import { progressAtTime, runEaseOf, timeAtProgress } from "../../utils/gsapKeyframeEases";
8
9
  import {
@@ -451,7 +452,7 @@ export function beginTimelineKeyframeRetime(
451
452
  if (actor.phase === "active" && matchesPointer(event)) cancel(actor);
452
453
  };
453
454
  const onKeyDown = (event: KeyboardEvent) => {
454
- if (event.key === "Escape") cancel(actor);
455
+ if (matchesKey(event, "cancel")) cancel(actor);
455
456
  };
456
457
 
457
458
  window.addEventListener("pointermove", onPointerMove, true);
@@ -1,4 +1,5 @@
1
1
  import { useRef, useState, useCallback, useEffect } from "react";
2
+ import { matchesKey } from "./studioShortcuts";
2
3
  import {
3
4
  applyTimelineAutoScrollStep,
4
5
  resolveTimelineAutoScrollLoopAction,
@@ -537,13 +538,13 @@ export function useTimelineRangeSelection({
537
538
  // otherwise it clears any lingering multi-selection.
538
539
  useEffect(() => {
539
540
  const onBandEscape = (e: KeyboardEvent) => {
540
- if (e.key !== "Escape" || !(marqueeRef.current || isRangeSelecting.current)) return;
541
+ if (!matchesKey(e, "cancel") || !(marqueeRef.current || isRangeSelecting.current)) return;
541
542
  e.preventDefault();
542
543
  e.stopPropagation();
543
544
  cancelActiveGesture(true, true);
544
545
  };
545
546
  const onKeyDown = (e: KeyboardEvent) => {
546
- if (e.key !== "Escape") return;
547
+ if (!matchesKey(e, "cancel")) return;
547
548
  const store = usePlayerStore.getState();
548
549
  if (isDragging.current) {
549
550
  cancelActiveGesture(true, true);