@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.
- package/dist/assets/{hyperframes-player-CtwXT8nW.js → hyperframes-player-ClW2l0Vl.js} +1 -1
- package/dist/assets/{index-CNO8BPjF.js → index-CGfRmZQd.js} +1 -1
- package/dist/assets/{index-CrRO-B3w.js → index-DxWNzvQJ.js} +187 -187
- package/dist/index.d.ts +73 -2
- package/dist/index.html +1 -1
- package/dist/index.js +2475 -2228
- package/package.json +8 -8
- package/src/captions/components/CaptionOverlay.tsx +7 -14
- package/src/captions/keyboard.test.ts +12 -1
- package/src/captions/keyboard.ts +8 -8
- package/src/components/EditorShell.tsx +2 -1
- package/src/components/TimelineToolPicker.tsx +6 -4
- package/src/components/TimelineToolbar.tsx +22 -18
- package/src/components/editor/GestureRecordControl.tsx +8 -3
- package/src/components/editor/InspectorHeaderActions.tsx +3 -1
- package/src/components/editor/PropertyPanelFlatFooter.tsx +3 -1
- package/src/components/editor/PropertyPanelFlatHeader.tsx +3 -1
- package/src/components/editor/SnapToolbar.tsx +11 -5
- package/src/components/editor/domEditNudge.test.ts +17 -1
- package/src/components/editor/domEditNudge.ts +16 -13
- package/src/components/editor/marqueeCommit.ts +2 -1
- package/src/hooks/appHotkeysDispatch.ts +104 -118
- package/src/hooks/linkShortcuts.test.ts +20 -0
- package/src/hooks/linkShortcuts.ts +11 -11
- package/src/hooks/useAppHotkeys.test.ts +201 -0
- package/src/hooks/useAppHotkeys.ts +1 -4
- package/src/hooks/useAutomationSelectionKeyboard.ts +7 -18
- package/src/hooks/useKeyframeKeyboard.ts +2 -3
- package/src/hooks/useTimelineDeleteOps.ts +2 -1
- package/src/index.ts +9 -1
- package/src/player/components/BeatStrip.tsx +2 -1
- package/src/player/components/ClipContextMenu.tsx +9 -6
- package/src/player/components/PlayerControls.tsx +3 -2
- package/src/player/components/ShortcutsPanel.tsx +3 -2
- package/src/player/components/TimelineClipFades.tsx +2 -1
- package/src/player/components/clipMenuLinkItems.tsx +5 -4
- package/src/player/components/studioCombo.test.ts +99 -0
- package/src/player/components/studioCombo.ts +108 -0
- package/src/player/components/studioShortcuts.test.tsx +124 -0
- package/src/player/components/studioShortcuts.ts +245 -96
- package/src/player/components/timelineClipDragGestureLifecycle.ts +2 -1
- package/src/player/components/timelineEditing.ts +2 -2
- package/src/player/components/useTimelineClipDrag.ts +2 -1
- package/src/player/components/useTimelineKeyboardActor.ts +7 -18
- package/src/player/components/useTimelineKeyframeHandlers.ts +2 -1
- package/src/player/components/useTimelineRangeSelection.ts +3 -2
- package/src/player/hooks/usePlaybackKeyboard.test.ts +164 -4
- package/src/player/hooks/usePlaybackKeyboard.ts +94 -102
- 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/hooks/useTimelinePlayer.test.ts +19 -13
- package/src/player/lib/playbackShortcuts.ts +16 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setStudioKeys } from "../components/studioShortcuts";
|
|
1
2
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
3
|
import { Window } from "happy-dom";
|
|
3
4
|
import {
|
|
@@ -48,8 +49,10 @@ function mockTargetMatching(selectorNeedle: string): EventTarget {
|
|
|
48
49
|
function mockKeyboardEvent(
|
|
49
50
|
code: string,
|
|
50
51
|
overrides: Partial<Pick<KeyboardEvent, "altKey" | "ctrlKey" | "metaKey" | "target">> = {},
|
|
51
|
-
): Pick<KeyboardEvent, "altKey" | "ctrlKey" | "metaKey" | "code" | "target"> {
|
|
52
|
+
): Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey" | "shiftKey" | "code" | "target"> {
|
|
52
53
|
return {
|
|
54
|
+
key: code,
|
|
55
|
+
shiftKey: false,
|
|
53
56
|
altKey: false,
|
|
54
57
|
ctrlKey: false,
|
|
55
58
|
metaKey: false,
|
|
@@ -556,18 +559,6 @@ describe("shouldIgnorePlaybackShortcutTarget", () => {
|
|
|
556
559
|
});
|
|
557
560
|
|
|
558
561
|
describe("shouldIgnorePlaybackShortcutEvent", () => {
|
|
559
|
-
it("ignores modified playback shortcuts so browser and app chords can handle them", () => {
|
|
560
|
-
expect(
|
|
561
|
-
shouldIgnorePlaybackShortcutEvent(mockKeyboardEvent("ArrowLeft", { altKey: true })),
|
|
562
|
-
).toBe(true);
|
|
563
|
-
expect(shouldIgnorePlaybackShortcutEvent(mockKeyboardEvent("KeyK", { ctrlKey: true }))).toBe(
|
|
564
|
-
true,
|
|
565
|
-
);
|
|
566
|
-
expect(shouldIgnorePlaybackShortcutEvent(mockKeyboardEvent("KeyL", { metaKey: true }))).toBe(
|
|
567
|
-
true,
|
|
568
|
-
);
|
|
569
|
-
});
|
|
570
|
-
|
|
571
562
|
it("defers Arrow frame shortcuts while caption edit mode has selected words", () => {
|
|
572
563
|
const captionSelection = { isCaptionEditMode: true, selectedCaptionSegmentCount: 1 };
|
|
573
564
|
|
|
@@ -582,6 +573,21 @@ describe("shouldIgnorePlaybackShortcutEvent", () => {
|
|
|
582
573
|
);
|
|
583
574
|
});
|
|
584
575
|
|
|
576
|
+
it("defers a remapped frame key, not the arrows, while caption words are selected", () => {
|
|
577
|
+
setStudioKeys({ frameBack: "," });
|
|
578
|
+
const captionSelection = { isCaptionEditMode: true, selectedCaptionSegmentCount: 1 };
|
|
579
|
+
expect(
|
|
580
|
+
shouldIgnorePlaybackShortcutEvent(
|
|
581
|
+
{ ...mockKeyboardEvent("Comma"), key: "," },
|
|
582
|
+
captionSelection,
|
|
583
|
+
),
|
|
584
|
+
).toBe(true);
|
|
585
|
+
expect(
|
|
586
|
+
shouldIgnorePlaybackShortcutEvent(mockKeyboardEvent("ArrowLeft"), captionSelection),
|
|
587
|
+
).toBe(false);
|
|
588
|
+
setStudioKeys(null);
|
|
589
|
+
});
|
|
590
|
+
|
|
585
591
|
it("allows Arrow frame shortcuts when captions are not selected", () => {
|
|
586
592
|
expect(
|
|
587
593
|
shouldIgnorePlaybackShortcutEvent(mockKeyboardEvent("ArrowRight"), {
|
|
@@ -7,8 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { ownsPlainKeys } from "../../utils/typingTarget";
|
|
10
|
+
import type { ComboEvent } from "../components/studioCombo";
|
|
11
|
+
import { matchesKey } from "../components/studioShortcuts";
|
|
12
|
+
import { usePlayerStore } from "../store/playerStore";
|
|
10
13
|
|
|
11
|
-
const
|
|
14
|
+
const FRAME_STEP_ACTIONS = [
|
|
15
|
+
"frameBack",
|
|
16
|
+
"frameForward",
|
|
17
|
+
"frameBackTen",
|
|
18
|
+
"frameForwardTen",
|
|
19
|
+
] as const;
|
|
12
20
|
|
|
13
21
|
const PLAYBACK_SHORTCUT_IGNORED_SELECTOR = [
|
|
14
22
|
"button",
|
|
@@ -59,10 +67,7 @@ interface PlaybackShortcutCaptionState {
|
|
|
59
67
|
selectedCaptionSegmentCount: number;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
type PlaybackShortcutEvent = Pick<
|
|
63
|
-
KeyboardEvent,
|
|
64
|
-
"altKey" | "ctrlKey" | "metaKey" | "code" | "target"
|
|
65
|
-
>;
|
|
70
|
+
type PlaybackShortcutEvent = ComboEvent & Pick<KeyboardEvent, "target">;
|
|
66
71
|
|
|
67
72
|
export function shouldIgnorePlaybackShortcutEvent(
|
|
68
73
|
event: PlaybackShortcutEvent,
|
|
@@ -71,11 +76,10 @@ export function shouldIgnorePlaybackShortcutEvent(
|
|
|
71
76
|
selectedCaptionSegmentCount: 0,
|
|
72
77
|
},
|
|
73
78
|
): boolean {
|
|
74
|
-
if (event.metaKey || event.ctrlKey || event.altKey) return true;
|
|
75
79
|
if (shouldIgnorePlaybackShortcutTarget(event.target)) return true;
|
|
76
80
|
if (isModalDialogOpen()) return true;
|
|
77
81
|
return (
|
|
78
|
-
|
|
82
|
+
FRAME_STEP_ACTIONS.some((action) => matchesKey(event, action)) &&
|
|
79
83
|
captionState.isCaptionEditMode &&
|
|
80
84
|
captionState.selectedCaptionSegmentCount > 0
|
|
81
85
|
);
|
|
@@ -83,3 +87,8 @@ export function shouldIgnorePlaybackShortcutEvent(
|
|
|
83
87
|
|
|
84
88
|
/** JKL shuttle speeds (×1, ×2, ×4). */
|
|
85
89
|
export const SHUTTLE_SPEEDS = [1, 2, 4] as const;
|
|
90
|
+
|
|
91
|
+
/** The exit-razor combo while the razor is armed: the razor owns it, playback must leave it alone. */
|
|
92
|
+
export function razorClaimsKey(e: KeyboardEvent): boolean {
|
|
93
|
+
return matchesKey(e, "exitRazor") && usePlayerStore.getState().activeTool === "razor";
|
|
94
|
+
}
|