@hyperframes/studio 0.8.229 → 0.8.230
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.
- package/dist/assets/{hyperframes-player-CtwXT8nW.js → hyperframes-player-Dv5Ew1Dr.js} +1 -1
- package/dist/assets/{index-CrRO-B3w.js → index-BvqtI0ko.js} +160 -160
- package/dist/assets/{index-CNO8BPjF.js → index-hiL49K7x.js} +1 -1
- package/dist/index.d.ts +33 -2
- package/dist/index.html +1 -1
- package/dist/index.js +2140 -1991
- package/package.json +8 -8
- package/src/components/TimelineToolPicker.tsx +6 -4
- package/src/components/TimelineToolbar.tsx +22 -17
- package/src/components/editor/GestureRecordControl.tsx +8 -3
- package/src/components/editor/PropertyPanelFlatFooter.tsx +3 -1
- package/src/components/editor/SnapToolbar.tsx +11 -5
- package/src/hooks/appHotkeysDispatch.ts +25 -26
- package/src/hooks/useAppHotkeys.test.ts +58 -0
- package/src/hooks/useKeyframeKeyboard.ts +2 -2
- package/src/index.ts +9 -1
- package/src/player/components/ClipContextMenu.tsx +6 -3
- package/src/player/components/PlayerControls.tsx +3 -2
- package/src/player/components/ShortcutsPanel.tsx +3 -2
- package/src/player/components/studioShortcuts.test.tsx +109 -0
- package/src/player/components/studioShortcuts.ts +187 -94
- package/src/player/hooks/usePlaybackKeyboard.test.ts +78 -1
- package/src/player/hooks/usePlaybackKeyboard.ts +36 -40
- package/src/player/hooks/useShadowPreviewReload.ts +11 -4
- package/src/player/hooks/useShadowReloadRetry.ts +68 -0
- package/src/player/hooks/useTimelinePlayer.shadowRetry.test.ts +85 -0
- package/src/player/lib/playbackShortcuts.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.230",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"dockview-react": "8.3.1",
|
|
61
61
|
"gsap": "^3.13.0",
|
|
62
62
|
"mediabunny": "^1.45.3",
|
|
63
|
-
"@hyperframes/
|
|
64
|
-
"@hyperframes/
|
|
65
|
-
"@hyperframes/
|
|
66
|
-
"@hyperframes/shader-transitions": "0.8.
|
|
67
|
-
"@hyperframes/
|
|
68
|
-
"@hyperframes/
|
|
63
|
+
"@hyperframes/parsers": "0.8.230",
|
|
64
|
+
"@hyperframes/sdk": "0.8.230",
|
|
65
|
+
"@hyperframes/player": "0.8.230",
|
|
66
|
+
"@hyperframes/shader-transitions": "0.8.230",
|
|
67
|
+
"@hyperframes/core": "0.8.230",
|
|
68
|
+
"@hyperframes/studio-server": "0.8.230"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vite": "^6.4.2",
|
|
83
83
|
"vitest": "^4.1.11",
|
|
84
84
|
"zustand": "^5.0.0",
|
|
85
|
-
"@hyperframes/producer": "0.8.
|
|
85
|
+
"@hyperframes/producer": "0.8.230"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": "19",
|
|
@@ -5,6 +5,7 @@ import { Scissors } from "../icons/SystemIcons";
|
|
|
5
5
|
import { Menu, MenuItem } from "./ui";
|
|
6
6
|
import { cn } from "./ui/cn";
|
|
7
7
|
import { flatIdle } from "./timelineToolbarStyles";
|
|
8
|
+
import { keyHint, useStudioKeys } from "../player/components/studioShortcuts";
|
|
8
9
|
|
|
9
10
|
function SelectIcon() {
|
|
10
11
|
return (
|
|
@@ -25,18 +26,19 @@ interface ToolRow {
|
|
|
25
26
|
/** One button for the active timeline tool; its menu switches tools or selects clips around the playhead. */
|
|
26
27
|
export function TimelineToolPicker({ showSelectAroundPlayhead = true }) {
|
|
27
28
|
const activeTool = usePlayerStore((s) => s.activeTool);
|
|
29
|
+
const keys = useStudioKeys();
|
|
28
30
|
const store = () => usePlayerStore.getState();
|
|
29
31
|
const rows: ToolRow[] = [
|
|
30
32
|
{
|
|
31
33
|
label: "Select",
|
|
32
|
-
shortcut: "
|
|
34
|
+
shortcut: keyHint("selectTool", keys),
|
|
33
35
|
icon: <SelectIcon />,
|
|
34
36
|
active: activeTool === "select",
|
|
35
37
|
run: () => store().setActiveTool("select"),
|
|
36
38
|
},
|
|
37
39
|
{
|
|
38
40
|
label: "Split",
|
|
39
|
-
shortcut: "
|
|
41
|
+
shortcut: keyHint("razorTool", keys),
|
|
40
42
|
icon: <Scissors size={16} />,
|
|
41
43
|
active: activeTool === "razor",
|
|
42
44
|
run: () => store().setActiveTool("razor"),
|
|
@@ -46,14 +48,14 @@ export function TimelineToolPicker({ showSelectAroundPlayhead = true }) {
|
|
|
46
48
|
rows.push(
|
|
47
49
|
{
|
|
48
50
|
label: "Select leftward",
|
|
49
|
-
shortcut: "
|
|
51
|
+
shortcut: keyHint("selectLeftward", keys),
|
|
50
52
|
icon: <ArrowLineLeft size={16} aria-hidden="true" />,
|
|
51
53
|
active: false,
|
|
52
54
|
run: () => store().selectLeftward(),
|
|
53
55
|
},
|
|
54
56
|
{
|
|
55
57
|
label: "Select rightward",
|
|
56
|
-
shortcut: "
|
|
58
|
+
shortcut: keyHint("selectRightward", keys),
|
|
57
59
|
icon: <ArrowLineRight size={16} aria-hidden="true" />,
|
|
58
60
|
active: false,
|
|
59
61
|
run: () => store().selectRightward(),
|
|
@@ -40,10 +40,7 @@ import { LinkedSelectionToggle } from "./LinkedSelectionToggle";
|
|
|
40
40
|
import { useProjectHasAudio } from "../utils/audioMeterMath";
|
|
41
41
|
import { canAddBeatAt, addBeatAtCompositionTime } from "../utils/beatEditActions";
|
|
42
42
|
import { isTypingTarget } from "../utils/typingTarget";
|
|
43
|
-
import {
|
|
44
|
-
SPLIT_SHORTCUT_HINT,
|
|
45
|
-
ZOOM_SELECTION_SHORTCUT_HINT,
|
|
46
|
-
} from "../player/components/studioShortcuts";
|
|
43
|
+
import { getStudioKey, keyHint, useStudioKeys } from "../player/components/studioShortcuts";
|
|
47
44
|
import type { TimelineProps } from "../player/components/TimelineTypes";
|
|
48
45
|
|
|
49
46
|
interface DomEditSessionSlice extends EnableKeyframesSession {
|
|
@@ -155,7 +152,7 @@ function useKeyframeToggle(session?: DomEditSessionSlice) {
|
|
|
155
152
|
export const TimelineToolbar = memo(function TimelineToolbar({
|
|
156
153
|
domEditSession,
|
|
157
154
|
onSplitElement,
|
|
158
|
-
splitShortcut
|
|
155
|
+
splitShortcut,
|
|
159
156
|
history,
|
|
160
157
|
showHistory = true,
|
|
161
158
|
showSelectAroundPlayhead = true,
|
|
@@ -163,6 +160,8 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
163
160
|
showKeyframes = true,
|
|
164
161
|
rightActions,
|
|
165
162
|
}: TimelineToolbarProps) {
|
|
163
|
+
const keys = useStudioKeys();
|
|
164
|
+
const kf = keyHint("addKeyframe", keys);
|
|
166
165
|
const timelineSnapEnabled = usePlayerStore((s) => s.timelineSnapEnabled);
|
|
167
166
|
const setTimelineSnapEnabled = usePlayerStore((s) => s.setTimelineSnapEnabled);
|
|
168
167
|
const rippleEditEnabled = usePlayerStore((s) => s.rippleEditEnabled);
|
|
@@ -199,7 +198,7 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
199
198
|
onToggle: onToggleKeyframe,
|
|
200
199
|
} = useKeyframeToggle(domEditSession);
|
|
201
200
|
|
|
202
|
-
// Wire the
|
|
201
|
+
// Wire the Add keyframe shortcut the toolbar advertises. Active only when
|
|
203
202
|
// there's a keyframeable selection; otherwise K stays JKL-pause in playback.
|
|
204
203
|
useKeyframeKeyboard({
|
|
205
204
|
enabled: showKeyframes && Boolean(onToggleKeyframe),
|
|
@@ -214,7 +213,7 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
214
213
|
// Skip when typing in an input/contenteditable.
|
|
215
214
|
useEffect(() => {
|
|
216
215
|
const onKeyDown = (e: KeyboardEvent) => {
|
|
217
|
-
if (e.key
|
|
216
|
+
if (e.key.toLowerCase() !== getStudioKey("timelineSnap")) return;
|
|
218
217
|
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
219
218
|
if (isTypingTarget(e.target)) return;
|
|
220
219
|
const store = usePlayerStore.getState();
|
|
@@ -233,7 +232,13 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
233
232
|
{/* Divider: tool-mode | editing-actions */}
|
|
234
233
|
<div aria-hidden="true" className="mx-1 h-4 w-px bg-neutral-800" />
|
|
235
234
|
<LinkedSelectionToggle />
|
|
236
|
-
<Tooltip
|
|
235
|
+
<Tooltip
|
|
236
|
+
label={
|
|
237
|
+
timelineSnapEnabled
|
|
238
|
+
? `Snapping on (${keyHint("timelineSnap", keys)})`
|
|
239
|
+
: `Snapping off (${keyHint("timelineSnap", keys)})`
|
|
240
|
+
}
|
|
241
|
+
>
|
|
237
242
|
<button
|
|
238
243
|
type="button"
|
|
239
244
|
onClick={() => setTimelineSnapEnabled(!timelineSnapEnabled)}
|
|
@@ -286,17 +291,17 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
286
291
|
? "Select an animated element to add keyframes"
|
|
287
292
|
: keyframeIsMotionPath
|
|
288
293
|
? keyframeWillExtend
|
|
289
|
-
?
|
|
294
|
+
? `Extend motion path to playhead (${kf})`
|
|
290
295
|
: keyframeState === "active"
|
|
291
|
-
?
|
|
292
|
-
:
|
|
296
|
+
? `Remove waypoint from motion path (${kf})`
|
|
297
|
+
: `Add waypoint to motion path (${kf})`
|
|
293
298
|
: keyframeState === "active"
|
|
294
|
-
?
|
|
299
|
+
? `Remove keyframe at playhead (${kf})`
|
|
295
300
|
: keyframeState === "inactive"
|
|
296
301
|
? keyframeWillExtend
|
|
297
|
-
?
|
|
298
|
-
:
|
|
299
|
-
:
|
|
302
|
+
? `Add keyframe at playhead, extends animation (${kf})`
|
|
303
|
+
: `Add keyframe at playhead (${kf})`
|
|
304
|
+
: `Add keyframe (${kf})`
|
|
300
305
|
}
|
|
301
306
|
>
|
|
302
307
|
<button
|
|
@@ -393,7 +398,7 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
393
398
|
<Tooltip
|
|
394
399
|
label={
|
|
395
400
|
canSplit
|
|
396
|
-
? `Split at playhead (${splitShortcut})`
|
|
401
|
+
? `Split at playhead (${splitShortcut ?? keyHint("split", keys)})`
|
|
397
402
|
: splittable
|
|
398
403
|
? "Move the playhead inside the clip to split"
|
|
399
404
|
: "Select a clip to split"
|
|
@@ -502,7 +507,7 @@ export const TimelineToolbar = memo(function TimelineToolbar({
|
|
|
502
507
|
<Tooltip
|
|
503
508
|
label={
|
|
504
509
|
canZoomSelection
|
|
505
|
-
? `Zoom to selected clips (${
|
|
510
|
+
? `Zoom to selected clips (${keyHint("zoomSelection", keys)})`
|
|
506
511
|
: "Select a clip to zoom the timeline"
|
|
507
512
|
}
|
|
508
513
|
>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useTrackDesignInput } from "../../contexts/DesignPanelInputContext";
|
|
2
|
+
import { keyHint, useStudioKeys } from "../../player/components/studioShortcuts";
|
|
2
3
|
|
|
3
4
|
export type GestureRecordingState = "idle" | "recording" | "preview";
|
|
4
5
|
|
|
@@ -29,6 +30,7 @@ export function GestureRecordPanelButton({
|
|
|
29
30
|
recordingDuration,
|
|
30
31
|
onToggleRecording,
|
|
31
32
|
}: GestureRecordPanelButtonProps) {
|
|
33
|
+
const recordKey = keyHint("record", useStudioKeys());
|
|
32
34
|
const recording = recordingState === "recording";
|
|
33
35
|
const track = useTrackDesignInput();
|
|
34
36
|
|
|
@@ -49,8 +51,8 @@ export function GestureRecordPanelButton({
|
|
|
49
51
|
>
|
|
50
52
|
<GestureRecordIcon recording={recording} />
|
|
51
53
|
{recording
|
|
52
|
-
? `Stop recording ${(recordingDuration ?? 0).toFixed(1)}s -- press
|
|
53
|
-
:
|
|
54
|
+
? `Stop recording ${(recordingDuration ?? 0).toFixed(1)}s -- press ${recordKey}`
|
|
55
|
+
: `Record gesture (${recordKey}) -- move pointer to capture motion`}
|
|
54
56
|
</button>
|
|
55
57
|
</div>
|
|
56
58
|
);
|
|
@@ -67,8 +69,11 @@ export function GestureRecordBadge({
|
|
|
67
69
|
recordingState,
|
|
68
70
|
onToggleRecording,
|
|
69
71
|
}: GestureRecordBadgeProps) {
|
|
72
|
+
const recordKey = keyHint("record", useStudioKeys());
|
|
70
73
|
const recording = recordingState === "recording";
|
|
71
|
-
const label = recording
|
|
74
|
+
const label = recording
|
|
75
|
+
? `Stop gesture recording (${recordKey})`
|
|
76
|
+
: `Record gesture (${recordKey})`;
|
|
72
77
|
|
|
73
78
|
return (
|
|
74
79
|
<button
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useTrackDesignInput } from "../../contexts/DesignPanelInputContext";
|
|
2
|
+
import { keyHint, useStudioKeys } from "../../player/components/studioShortcuts";
|
|
2
3
|
|
|
3
4
|
export function PropertyPanelFlatFooter({
|
|
4
5
|
onAskAgent,
|
|
@@ -13,9 +14,10 @@ export function PropertyPanelFlatFooter({
|
|
|
13
14
|
}) {
|
|
14
15
|
const track = useTrackDesignInput();
|
|
15
16
|
const recording = recordingState === "recording";
|
|
17
|
+
const recordKey = keyHint("record", useStudioKeys());
|
|
16
18
|
const recordTitle = recording
|
|
17
19
|
? `Stop recording ${(recordingDuration ?? 0).toFixed(1)}s`
|
|
18
|
-
:
|
|
20
|
+
: `Record gesture (${recordKey})`;
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
23
|
// No border-t here: every possible element immediately above this footer
|
|
@@ -4,9 +4,11 @@ import { MagnetStraight, GridFour, Path, Ruler, FrameCorners } from "@phosphor-i
|
|
|
4
4
|
import { usePlayerStore } from "../../player/store/playerStore";
|
|
5
5
|
import { usePreviewOverlayContext } from "./PreviewOverlayProvider";
|
|
6
6
|
import { ownsPlainKeys } from "../../utils/typingTarget";
|
|
7
|
+
import { getStudioKey, keyHint, useStudioKeys } from "../../player/components/studioShortcuts";
|
|
7
8
|
|
|
8
9
|
// fallow-ignore-next-line complexity
|
|
9
10
|
export const SnapToolbar = memo(function SnapToolbar() {
|
|
11
|
+
const keys = useStudioKeys();
|
|
10
12
|
const [gridPopoverOpen, setGridPopoverOpen] = useState(false);
|
|
11
13
|
const { state, actions } = usePreviewOverlayContext();
|
|
12
14
|
const { snapPrefs: prefs, rulerVisible, safeMarginsVisible } = state;
|
|
@@ -51,12 +53,12 @@ export const SnapToolbar = memo(function SnapToolbar() {
|
|
|
51
53
|
if (e.defaultPrevented) return;
|
|
52
54
|
if (ownsPlainKeys(e.target)) return;
|
|
53
55
|
if (e.target instanceof HTMLIFrameElement) return;
|
|
54
|
-
if (e.key === "
|
|
56
|
+
if (e.key === getStudioKey("snap") && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
55
57
|
e.preventDefault();
|
|
56
58
|
updatePrefs({ snapEnabled: !prefs.snapEnabled });
|
|
57
59
|
if (!e.repeat) trackPreviewFeatureUsed("snapping", "keyboard");
|
|
58
60
|
}
|
|
59
|
-
if (e.key === "
|
|
61
|
+
if (e.key === getStudioKey("grid") && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
60
62
|
e.preventDefault();
|
|
61
63
|
updatePrefs({ gridVisible: !prefs.gridVisible });
|
|
62
64
|
if (!e.repeat) trackPreviewFeatureUsed("grid", "keyboard");
|
|
@@ -137,7 +139,11 @@ export const SnapToolbar = memo(function SnapToolbar() {
|
|
|
137
139
|
: "bg-black/40 text-white/60 hover:bg-black/60 hover:text-white/80"
|
|
138
140
|
}`}
|
|
139
141
|
onClick={toggleSnap}
|
|
140
|
-
title={
|
|
142
|
+
title={
|
|
143
|
+
prefs.snapEnabled
|
|
144
|
+
? `Snap enabled (${keyHint("snap", keys)})`
|
|
145
|
+
: `Snap disabled (${keyHint("snap", keys)})`
|
|
146
|
+
}
|
|
141
147
|
aria-label="Toggle snap"
|
|
142
148
|
>
|
|
143
149
|
<MagnetStraight size={16} weight={prefs.snapEnabled ? "fill" : "regular"} />
|
|
@@ -160,8 +166,8 @@ export const SnapToolbar = memo(function SnapToolbar() {
|
|
|
160
166
|
}}
|
|
161
167
|
title={
|
|
162
168
|
prefs.gridVisible
|
|
163
|
-
?
|
|
164
|
-
:
|
|
169
|
+
? `Grid visible (${keyHint("grid", keys)}). Right-click for spacing options`
|
|
170
|
+
: `Grid hidden (${keyHint("grid", keys)}). Right-click for spacing options`
|
|
165
171
|
}
|
|
166
172
|
aria-label="Toggle grid"
|
|
167
173
|
>
|
|
@@ -8,7 +8,8 @@ import { isEditableTarget } from "../utils/timelineDiscovery";
|
|
|
8
8
|
import { shouldIgnoreHistoryShortcut } from "../utils/studioHelpers";
|
|
9
9
|
import { canSplitElement } from "../utils/timelineElementSplit";
|
|
10
10
|
import { trackStudioEvent } from "../utils/studioTelemetry";
|
|
11
|
-
import {
|
|
11
|
+
import { razorClaimsKey } from "../player/lib/playbackShortcuts";
|
|
12
|
+
import { getStudioKeys, keyHint } from "../player/components/studioShortcuts";
|
|
12
13
|
import { zoomTimelineToSelectedClips } from "../player/components/timelineZoomInput";
|
|
13
14
|
import { openAudioGainDialog } from "../player/components/audioGainDialogStore";
|
|
14
15
|
import type { LinkShortcutCallbacks } from "./linkShortcuts";
|
|
@@ -157,13 +158,14 @@ export function dispatchModifierKey(
|
|
|
157
158
|
* be asserted without standing up the whole hook. */
|
|
158
159
|
export function dispatchPlainKey(event: KeyboardEvent, key: string, cb: HotkeyCallbacks): void {
|
|
159
160
|
if (ownsPlainKeys(event.target)) return;
|
|
160
|
-
|
|
161
|
+
const keys = getStudioKeys();
|
|
162
|
+
if (key === keys.zoomSelection && !event.shiftKey && !event.altKey) {
|
|
161
163
|
if (!zoomTimelineToSelectedClips()) return;
|
|
162
164
|
event.preventDefault();
|
|
163
165
|
return;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
|
-
if (key ===
|
|
168
|
+
if (key === keys.fullscreen && !event.shiftKey && !event.altKey) {
|
|
167
169
|
event.preventDefault();
|
|
168
170
|
if (document.fullscreenElement) void document.exitFullscreen();
|
|
169
171
|
else
|
|
@@ -171,7 +173,7 @@ export function dispatchPlainKey(event: KeyboardEvent, key: string, cb: HotkeyCa
|
|
|
171
173
|
return;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
if (event.key ===
|
|
176
|
+
if (event.key === keys.split && !event.altKey) {
|
|
175
177
|
// Reserve bare `s` for Split even when the current selection cannot split,
|
|
176
178
|
// so secondary listeners do not reinterpret the same key as Snap toggle.
|
|
177
179
|
event.preventDefault();
|
|
@@ -192,51 +194,53 @@ export function dispatchPlainKey(event: KeyboardEvent, key: string, cb: HotkeyCa
|
|
|
192
194
|
// that isn't in the raw `elements` list, so the s-key can't resolve them.
|
|
193
195
|
// Nudge toward the razor tool instead of failing silently.
|
|
194
196
|
if (!el && selectedElementId.includes("#")) {
|
|
195
|
-
cb.showToast(
|
|
197
|
+
cb.showToast(
|
|
198
|
+
`Use the razor tool (${keyHint("razorTool", keys)}) to split clips inside a sub-composition`,
|
|
199
|
+
"info",
|
|
200
|
+
);
|
|
196
201
|
return;
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
// Only with a sound clip selected, so bare G still reaches the canvas grid toggle otherwise.
|
|
202
|
-
if (key ===
|
|
207
|
+
if (key === keys.audioGain && !event.shiftKey && !event.altKey) {
|
|
203
208
|
if (!cb.readOnlyPreview && openAudioGainDialog()) {
|
|
204
209
|
event.preventDefault();
|
|
205
210
|
return;
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
213
|
|
|
209
|
-
if (key ===
|
|
214
|
+
if (key === keys.razorTool && !event.shiftKey && !event.altKey) {
|
|
210
215
|
event.preventDefault();
|
|
211
216
|
const { activeTool, setActiveTool } = usePlayerStore.getState();
|
|
212
217
|
setActiveTool(activeTool === "razor" ? "select" : "razor");
|
|
213
218
|
return;
|
|
214
219
|
}
|
|
215
220
|
|
|
216
|
-
if (key ===
|
|
221
|
+
if (key === keys.selectTool && !event.shiftKey && !event.altKey) {
|
|
217
222
|
event.preventDefault();
|
|
218
223
|
usePlayerStore.getState().setActiveTool("select");
|
|
219
224
|
return;
|
|
220
225
|
}
|
|
221
226
|
|
|
222
|
-
if (
|
|
227
|
+
if (
|
|
228
|
+
(key === keys.selectLeftward || key === keys.selectRightward) &&
|
|
229
|
+
!event.shiftKey &&
|
|
230
|
+
!event.altKey
|
|
231
|
+
) {
|
|
223
232
|
event.preventDefault();
|
|
224
233
|
const store = usePlayerStore.getState();
|
|
225
|
-
if (key ===
|
|
234
|
+
if (key === keys.selectLeftward) store.selectLeftward();
|
|
226
235
|
else store.selectRightward();
|
|
227
236
|
return;
|
|
228
237
|
}
|
|
229
238
|
|
|
230
|
-
// CapCut returns to the select tool with "A"
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (activeTool === "razor") {
|
|
236
|
-
event.preventDefault();
|
|
237
|
-
setActiveTool("select");
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
239
|
+
// CapCut returns to the select tool with "A"; playback's seek-to-in asks the same razorClaimsKey.
|
|
240
|
+
if (razorClaimsKey(event, key)) {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
usePlayerStore.getState().setActiveTool("select");
|
|
243
|
+
return;
|
|
240
244
|
}
|
|
241
245
|
|
|
242
246
|
if (event.key === "Escape") {
|
|
@@ -295,12 +299,7 @@ export function dispatchPlainKey(event: KeyboardEvent, key: string, cb: HotkeyCa
|
|
|
295
299
|
return;
|
|
296
300
|
}
|
|
297
301
|
|
|
298
|
-
if (
|
|
299
|
-
event.key === STUDIO_PLAIN_KEYS.record &&
|
|
300
|
-
!event.shiftKey &&
|
|
301
|
-
!event.altKey &&
|
|
302
|
-
cb.onToggleRecording
|
|
303
|
-
) {
|
|
302
|
+
if (event.key === keys.record && !event.shiftKey && !event.altKey && cb.onToggleRecording) {
|
|
304
303
|
event.preventDefault();
|
|
305
304
|
cb.onToggleRecording();
|
|
306
305
|
}
|
|
@@ -6,6 +6,7 @@ import type { DomEditSelection } from "../components/editor/domEditing";
|
|
|
6
6
|
import { clearAutomationClipboard, copyRange } from "../player/components/automationClipboard";
|
|
7
7
|
import { VOLUME_RANGE } from "@hyperframes/core/audio-automation";
|
|
8
8
|
import type { TimelineElement } from "../player/store/timelineElement";
|
|
9
|
+
import { setStudioKeys } from "../player/components/studioShortcuts";
|
|
9
10
|
import { useAudioGainDialogStore } from "../player/components/audioGainDialogStore";
|
|
10
11
|
import {
|
|
11
12
|
cancelTimelineZoom,
|
|
@@ -55,6 +56,8 @@ const chord = (key: string) =>
|
|
|
55
56
|
new KeyboardEvent("keydown", { key, metaKey: true, bubbles: true, cancelable: true });
|
|
56
57
|
|
|
57
58
|
afterEach(() => {
|
|
59
|
+
setStudioKeys(null);
|
|
60
|
+
usePlayerStore.getState().setActiveTool("select");
|
|
58
61
|
clearAutomationClipboard();
|
|
59
62
|
usePlayerStore.getState().clearAutomationSelection();
|
|
60
63
|
usePlayerStore.setState({
|
|
@@ -583,3 +586,58 @@ describe("dispatchPlainKey — G opens Audio Gain", () => {
|
|
|
583
586
|
expect(event.defaultPrevented).toBe(false);
|
|
584
587
|
});
|
|
585
588
|
});
|
|
589
|
+
|
|
590
|
+
describe("editor keys the host can remap", () => {
|
|
591
|
+
const dispatch = (key: string) => {
|
|
592
|
+
const event = press(key);
|
|
593
|
+
dispatchPlainKey(event, key.toLowerCase(), callbacks());
|
|
594
|
+
return event;
|
|
595
|
+
};
|
|
596
|
+
const tool = () => usePlayerStore.getState().activeTool;
|
|
597
|
+
|
|
598
|
+
it("answers every default key", () => {
|
|
599
|
+
dispatch("b");
|
|
600
|
+
expect(tool()).toBe("razor");
|
|
601
|
+
dispatch("a");
|
|
602
|
+
expect(tool()).toBe("select");
|
|
603
|
+
dispatch("b");
|
|
604
|
+
dispatch("v");
|
|
605
|
+
expect(tool()).toBe("select");
|
|
606
|
+
const original = usePlayerStore.getState().selectLeftward;
|
|
607
|
+
const left = vi.fn();
|
|
608
|
+
usePlayerStore.setState({ selectLeftward: left });
|
|
609
|
+
dispatch("[");
|
|
610
|
+
usePlayerStore.setState({ selectLeftward: original });
|
|
611
|
+
expect(left).toHaveBeenCalledTimes(1);
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it("a remapped key answers and the old one does not", () => {
|
|
615
|
+
setStudioKeys({ razorTool: "y", selectTool: "u", exitRazor: "q" });
|
|
616
|
+
dispatch("b");
|
|
617
|
+
expect(tool()).toBe("select");
|
|
618
|
+
expect(dispatch("y").defaultPrevented).toBe(true);
|
|
619
|
+
expect(tool()).toBe("razor");
|
|
620
|
+
dispatch("a");
|
|
621
|
+
expect(tool()).toBe("razor");
|
|
622
|
+
dispatch("q");
|
|
623
|
+
expect(tool()).toBe("select");
|
|
624
|
+
dispatch("y");
|
|
625
|
+
dispatch("v");
|
|
626
|
+
expect(tool()).toBe("razor");
|
|
627
|
+
dispatch("u");
|
|
628
|
+
expect(tool()).toBe("select");
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
it("split, fullscreen and record follow the map", () => {
|
|
632
|
+
setStudioKeys({ split: "t", record: "w" });
|
|
633
|
+
const cb = callbacks({ onToggleRecording: vi.fn() });
|
|
634
|
+
dispatchPlainKey(press("r"), "r", cb);
|
|
635
|
+
expect(cb.onToggleRecording).not.toHaveBeenCalled();
|
|
636
|
+
dispatchPlainKey(press("w"), "w", cb);
|
|
637
|
+
expect(cb.onToggleRecording).toHaveBeenCalledTimes(1);
|
|
638
|
+
expect(press("s").defaultPrevented).toBe(false);
|
|
639
|
+
const split = press("t");
|
|
640
|
+
dispatchPlainKey(split, "t", cb);
|
|
641
|
+
expect(split.defaultPrevented).toBe(true);
|
|
642
|
+
});
|
|
643
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useCallback } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { getStudioKey } from "../player/components/studioShortcuts";
|
|
3
3
|
import { isTypingTarget } from "../utils/typingTarget";
|
|
4
4
|
|
|
5
5
|
interface KeyframeKeyboardOptions {
|
|
@@ -13,7 +13,7 @@ export function useKeyframeKeyboard({ enabled, onAddKeyframe }: KeyframeKeyboard
|
|
|
13
13
|
if (!enabled || !onAddKeyframe) return;
|
|
14
14
|
if (isTypingTarget(document.activeElement)) return;
|
|
15
15
|
if (e.metaKey || e.ctrlKey) return; // never shadow browser/system combos
|
|
16
|
-
if (e.key.toLowerCase() !==
|
|
16
|
+
if (e.key.toLowerCase() !== getStudioKey("addKeyframe")) return;
|
|
17
17
|
// K is also playback's stop key: claiming it here keeps playback from also pausing.
|
|
18
18
|
e.preventDefault();
|
|
19
19
|
e.stopImmediatePropagation();
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,15 @@ export * from "./ui";
|
|
|
5
5
|
export { EditorShell } from "./components/EditorShell";
|
|
6
6
|
export type { EditorShellProps } from "./components/EditorShell";
|
|
7
7
|
export { NLEPreview } from "./components/nle/NLEPreview";
|
|
8
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
DEFAULT_SHORTCUT_SECTIONS,
|
|
10
|
+
DEFAULT_STUDIO_KEYS,
|
|
11
|
+
buildShortcutSections,
|
|
12
|
+
getStudioKeys,
|
|
13
|
+
setStudioKeys,
|
|
14
|
+
useStudioKeys,
|
|
15
|
+
} from "./player/components/studioShortcuts";
|
|
16
|
+
export type { StudioKeyAction, StudioKeys } from "./player/components/studioShortcuts";
|
|
9
17
|
export { ShortcutsButton } from "./player/components/ShortcutsPanel";
|
|
10
18
|
export { dispatchLinkShortcut } from "./hooks/linkShortcuts";
|
|
11
19
|
export type { LinkShortcutCallbacks } from "./hooks/linkShortcuts";
|
|
@@ -10,7 +10,7 @@ import { ClipMenuAudioItems } from "./clipMenuAudioItems";
|
|
|
10
10
|
import { ClipMenuLinkItems } from "./clipMenuLinkItems";
|
|
11
11
|
import { menuClasses } from "../../components/ui/menuStyle";
|
|
12
12
|
import { useTimelineEditContextOptional } from "../../contexts/TimelineEditContext";
|
|
13
|
-
import {
|
|
13
|
+
import { keyHint, useStudioKeys } from "./studioShortcuts";
|
|
14
14
|
|
|
15
15
|
const MENU_MARGIN = 8;
|
|
16
16
|
|
|
@@ -97,8 +97,9 @@ export const ClipContextMenu = memo(function ClipContextMenu({
|
|
|
97
97
|
onDuplicate,
|
|
98
98
|
canPaste,
|
|
99
99
|
hostItems = [],
|
|
100
|
-
splitShortcut
|
|
100
|
+
splitShortcut,
|
|
101
101
|
}: ClipContextMenuProps) {
|
|
102
|
+
const keys = useStudioKeys();
|
|
102
103
|
const menuRef = useContextMenuDismiss(onClose);
|
|
103
104
|
useMenuKeyboardNav(menuRef);
|
|
104
105
|
const tools = useTimelineEditContextOptional().clipMenuTools !== false;
|
|
@@ -160,7 +161,9 @@ export const ClipContextMenu = memo(function ClipContextMenu({
|
|
|
160
161
|
}}
|
|
161
162
|
>
|
|
162
163
|
<span>{splitLabel}</span>
|
|
163
|
-
<span className="text-neutral-500 text-[10px] ml-3">
|
|
164
|
+
<span className="text-neutral-500 text-[10px] ml-3">
|
|
165
|
+
{splitShortcut ?? keyHint("split", keys)}
|
|
166
|
+
</span>
|
|
164
167
|
</button>
|
|
165
168
|
)}
|
|
166
169
|
{tools && splitLabel && (
|
|
@@ -8,7 +8,7 @@ import { Tooltip } from "../../components/ui";
|
|
|
8
8
|
import { useMountEffect } from "../../hooks/useMountEffect";
|
|
9
9
|
import { useLinkedClipPreferences } from "../../utils/linkedClipPreferences";
|
|
10
10
|
import { ShortcutsButton } from "./ShortcutsPanel";
|
|
11
|
-
import type
|
|
11
|
+
import { keyHint, useStudioKeys, type ShortcutSection } from "./studioShortcuts";
|
|
12
12
|
import { SpeedMenu } from "./SpeedMenu";
|
|
13
13
|
import { VolumeControl } from "./VolumeControl";
|
|
14
14
|
import { PreviewSeekBar } from "./PreviewSeekBar";
|
|
@@ -111,8 +111,9 @@ const FullscreenButton = memo(function FullscreenButton({
|
|
|
111
111
|
isFullscreen: boolean;
|
|
112
112
|
onToggleFullscreen: () => void;
|
|
113
113
|
}) {
|
|
114
|
+
const fsKey = keyHint("fullscreen", useStudioKeys());
|
|
114
115
|
return (
|
|
115
|
-
<Tooltip label={isFullscreen ?
|
|
116
|
+
<Tooltip label={isFullscreen ? `Exit fullscreen (${fsKey})` : `Enter fullscreen (${fsKey})`}>
|
|
116
117
|
<button
|
|
117
118
|
type="button"
|
|
118
119
|
onClick={() => {
|
|
@@ -4,7 +4,7 @@ import { Popover, Tooltip } from "../../components/ui";
|
|
|
4
4
|
import { flatActive, flatIdle } from "../../components/timelineToolbarStyles";
|
|
5
5
|
import { usePlayerStore } from "../store/playerStore";
|
|
6
6
|
import { useCompositionFps } from "../../utils/linkedClipPreferences";
|
|
7
|
-
import {
|
|
7
|
+
import { useShortcutSections, type ShortcutSection } from "./studioShortcuts";
|
|
8
8
|
|
|
9
9
|
interface ShortcutsPanelProps {
|
|
10
10
|
disabled: boolean;
|
|
@@ -28,8 +28,9 @@ export const ShortcutsPanel = memo(function ShortcutsPanel({
|
|
|
28
28
|
setInPoint,
|
|
29
29
|
setOutPoint,
|
|
30
30
|
onSeek,
|
|
31
|
-
sections
|
|
31
|
+
sections: hostSections,
|
|
32
32
|
}: ShortcutsPanelProps) {
|
|
33
|
+
const sections = useShortcutSections(hostSections);
|
|
33
34
|
const [showShortcuts, setShowShortcuts] = useState(false);
|
|
34
35
|
const [jumpFrame, setJumpFrame] = useState("");
|
|
35
36
|
const compositionFps = useCompositionFps();
|