@hyperframes/studio 0.8.230 → 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-Dv5Ew1Dr.js → hyperframes-player-ClW2l0Vl.js} +1 -1
- package/dist/assets/{index-hiL49K7x.js → index-CGfRmZQd.js} +1 -1
- package/dist/assets/{index-BvqtI0ko.js → index-DxWNzvQJ.js} +153 -153
- package/dist/index.d.ts +40 -0
- package/dist/index.html +1 -1
- package/dist/index.js +530 -432
- 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/TimelineToolbar.tsx +2 -3
- package/src/components/editor/InspectorHeaderActions.tsx +3 -1
- package/src/components/editor/PropertyPanelFlatHeader.tsx +3 -1
- package/src/components/editor/SnapToolbar.tsx +3 -3
- 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 +94 -107
- package/src/hooks/linkShortcuts.test.ts +20 -0
- package/src/hooks/linkShortcuts.ts +11 -11
- package/src/hooks/useAppHotkeys.test.ts +143 -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/player/components/BeatStrip.tsx +2 -1
- package/src/player/components/ClipContextMenu.tsx +3 -3
- 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 +16 -1
- package/src/player/components/studioShortcuts.ts +85 -29
- 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 +87 -4
- package/src/player/hooks/usePlaybackKeyboard.ts +78 -82
- package/src/player/hooks/useTimelinePlayer.test.ts +19 -13
- package/src/player/lib/playbackShortcuts.ts +13 -16
package/dist/index.js
CHANGED
|
@@ -186,6 +186,301 @@ import "./chunk-MLKGABMK.js";
|
|
|
186
186
|
// src/components/EditorShell.tsx
|
|
187
187
|
import { memo as memo35, useCallback as useCallback75 } from "react";
|
|
188
188
|
|
|
189
|
+
// src/player/components/studioShortcuts.ts
|
|
190
|
+
import { useSyncExternalStore } from "react";
|
|
191
|
+
|
|
192
|
+
// src/player/components/studioCombo.ts
|
|
193
|
+
var NAMED = /* @__PURE__ */ new Set([
|
|
194
|
+
"Space",
|
|
195
|
+
"ArrowLeft",
|
|
196
|
+
"ArrowRight",
|
|
197
|
+
"ArrowUp",
|
|
198
|
+
"ArrowDown",
|
|
199
|
+
"Home",
|
|
200
|
+
"End",
|
|
201
|
+
"PageUp",
|
|
202
|
+
"PageDown",
|
|
203
|
+
"Delete",
|
|
204
|
+
"Backspace",
|
|
205
|
+
"Escape",
|
|
206
|
+
"Enter",
|
|
207
|
+
"Tab"
|
|
208
|
+
]);
|
|
209
|
+
var SYMBOL = {
|
|
210
|
+
ArrowLeft: "\u2190",
|
|
211
|
+
ArrowRight: "\u2192",
|
|
212
|
+
ArrowUp: "\u2191",
|
|
213
|
+
ArrowDown: "\u2193",
|
|
214
|
+
Delete: "Del",
|
|
215
|
+
Backspace: "\u232B",
|
|
216
|
+
Escape: "Esc"
|
|
217
|
+
};
|
|
218
|
+
var MODIFIERS = /* @__PURE__ */ new Set(["mod", "cmd", "ctrl", "shift", "alt"]);
|
|
219
|
+
function parseCombo(text) {
|
|
220
|
+
const split = text.length > 1 ? text.slice(0, -1).lastIndexOf("+") : -1;
|
|
221
|
+
const tokens = split < 0 ? [] : text.slice(0, split).split("+").map((t2) => t2.toLowerCase());
|
|
222
|
+
const key2 = text.slice(split + 1);
|
|
223
|
+
const named = NAMED.has(key2);
|
|
224
|
+
const symbol = !named && !/^[A-Za-z]$/.test(key2);
|
|
225
|
+
if (tokens.some((t2) => !MODIFIERS.has(t2)) || !named && [...key2].length !== 1) return null;
|
|
226
|
+
if (symbol && tokens.includes("shift")) return null;
|
|
227
|
+
const combo = {
|
|
228
|
+
mod: tokens.includes("mod"),
|
|
229
|
+
meta: tokens.includes("cmd"),
|
|
230
|
+
ctrl: tokens.includes("ctrl"),
|
|
231
|
+
shift: tokens.includes("shift"),
|
|
232
|
+
alt: tokens.includes("alt"),
|
|
233
|
+
key: named ? key2 : key2.toLowerCase(),
|
|
234
|
+
named
|
|
235
|
+
};
|
|
236
|
+
return combo.alt && (combo.ctrl || combo.mod) ? null : combo;
|
|
237
|
+
}
|
|
238
|
+
function comboText(c) {
|
|
239
|
+
const mods = [
|
|
240
|
+
c.mod && "mod",
|
|
241
|
+
c.meta && "cmd",
|
|
242
|
+
c.ctrl && "ctrl",
|
|
243
|
+
c.alt && "alt",
|
|
244
|
+
c.shift && "shift"
|
|
245
|
+
];
|
|
246
|
+
return [...mods.filter(Boolean), c.key].join("+");
|
|
247
|
+
}
|
|
248
|
+
var namedMatches = (e, name) => e.code === name || e.key === (name === "Space" ? " " : name);
|
|
249
|
+
function charMatches(e, c) {
|
|
250
|
+
if (e.key.toLowerCase() === c.key) return true;
|
|
251
|
+
const code = /^[0-9]$/.test(c.key) ? `Digit${c.key}` : `Key${c.key.toUpperCase()}`;
|
|
252
|
+
return e.altKey && /^[a-z0-9]$/.test(c.key) && e.code === code;
|
|
253
|
+
}
|
|
254
|
+
function matchCombo(e, c) {
|
|
255
|
+
const symbol = !c.named && !/^[a-z]$/.test(c.key);
|
|
256
|
+
if (!symbol && !!e.shiftKey !== c.shift || !!e.altKey !== c.alt) return false;
|
|
257
|
+
const modsOk = c.mod ? e.metaKey || e.ctrlKey : !!e.metaKey === c.meta && !!e.ctrlKey === c.ctrl;
|
|
258
|
+
return modsOk && (c.named ? namedMatches(e, c.key) : charMatches(e, c));
|
|
259
|
+
}
|
|
260
|
+
function formatCombo(c) {
|
|
261
|
+
const mods = `${c.ctrl ? "\u2303" : ""}${c.alt ? "\u2325" : ""}${c.mod || c.meta ? "\u2318" : ""}${c.shift ? "\u21E7" : ""}`;
|
|
262
|
+
return mods + (SYMBOL[c.key] ?? (c.named ? c.key : c.key.toUpperCase()));
|
|
263
|
+
}
|
|
264
|
+
var comboClashKey = (c) => [c.mod || c.meta || c.ctrl, c.alt, c.shift, c.key].join("|");
|
|
265
|
+
|
|
266
|
+
// src/player/components/studioShortcuts.ts
|
|
267
|
+
var DEFAULT_STUDIO_KEYS = {
|
|
268
|
+
fullscreen: "f",
|
|
269
|
+
split: "s",
|
|
270
|
+
record: "r",
|
|
271
|
+
addKeyframe: "k",
|
|
272
|
+
audioGain: "g",
|
|
273
|
+
zoomSelection: "z",
|
|
274
|
+
mute: "m",
|
|
275
|
+
pause: "k",
|
|
276
|
+
shuttleBack: "j",
|
|
277
|
+
shuttleForward: "l",
|
|
278
|
+
inPoint: "i",
|
|
279
|
+
outPoint: "o",
|
|
280
|
+
seekToIn: "a",
|
|
281
|
+
seekToOut: "e",
|
|
282
|
+
selectTool: "v",
|
|
283
|
+
razorTool: "b",
|
|
284
|
+
selectLeftward: "[",
|
|
285
|
+
selectRightward: "]",
|
|
286
|
+
exitRazor: "a",
|
|
287
|
+
snap: "s",
|
|
288
|
+
grid: "g",
|
|
289
|
+
timelineSnap: "n",
|
|
290
|
+
playPause: "Space",
|
|
291
|
+
frameBack: "ArrowLeft",
|
|
292
|
+
frameForward: "ArrowRight",
|
|
293
|
+
frameBackTen: "shift+ArrowLeft",
|
|
294
|
+
frameForwardTen: "shift+ArrowRight",
|
|
295
|
+
loop: "shift+l",
|
|
296
|
+
clearInPoint: "shift+i",
|
|
297
|
+
clearOutPoint: "shift+o",
|
|
298
|
+
undo: "mod+z",
|
|
299
|
+
redo: "mod+shift+z",
|
|
300
|
+
redoAlt: "ctrl+y",
|
|
301
|
+
tabCompositions: "mod+1",
|
|
302
|
+
tabAssets: "mod+2",
|
|
303
|
+
group: "mod+g",
|
|
304
|
+
ungroup: "mod+shift+g",
|
|
305
|
+
copy: "mod+c",
|
|
306
|
+
paste: "mod+v",
|
|
307
|
+
cut: "mod+x",
|
|
308
|
+
duplicate: "mod+d",
|
|
309
|
+
linkToggle: "mod+l",
|
|
310
|
+
detachAudio: "alt+shift+d",
|
|
311
|
+
deleteLinked: "alt+Backspace",
|
|
312
|
+
deleteLinkedAlt: "alt+Delete",
|
|
313
|
+
deleteSelected: "Delete",
|
|
314
|
+
deleteSelectedAlt: "Backspace",
|
|
315
|
+
resetKeyframes: "Backspace",
|
|
316
|
+
nudgeLeft: "ArrowLeft",
|
|
317
|
+
nudgeRight: "ArrowRight",
|
|
318
|
+
nudgeUp: "ArrowUp",
|
|
319
|
+
nudgeDown: "ArrowDown",
|
|
320
|
+
nudgeLeftTen: "shift+ArrowLeft",
|
|
321
|
+
nudgeRightTen: "shift+ArrowRight",
|
|
322
|
+
nudgeUpTen: "shift+ArrowUp",
|
|
323
|
+
nudgeDownTen: "shift+ArrowDown",
|
|
324
|
+
captionSelectAll: "mod+a",
|
|
325
|
+
pickupClip: "Space",
|
|
326
|
+
pickupUp: "ArrowUp",
|
|
327
|
+
pickupDown: "ArrowDown",
|
|
328
|
+
pickupDrop: "Enter",
|
|
329
|
+
cancel: "Escape"
|
|
330
|
+
};
|
|
331
|
+
var SHARED_BY_DESIGN = [
|
|
332
|
+
["pause", "addKeyframe"],
|
|
333
|
+
["seekToIn", "exitRazor"],
|
|
334
|
+
["split", "snap"],
|
|
335
|
+
["audioGain", "grid"],
|
|
336
|
+
["playPause", "pickupClip"],
|
|
337
|
+
["frameBack", "nudgeLeft"],
|
|
338
|
+
["frameForward", "nudgeRight"],
|
|
339
|
+
["frameBackTen", "nudgeLeftTen"],
|
|
340
|
+
["frameForwardTen", "nudgeRightTen"],
|
|
341
|
+
["nudgeUp", "pickupUp"],
|
|
342
|
+
["nudgeDown", "pickupDown"],
|
|
343
|
+
["deleteSelectedAlt", "resetKeyframes"]
|
|
344
|
+
];
|
|
345
|
+
var current = DEFAULT_STUDIO_KEYS;
|
|
346
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
347
|
+
var sharedByDesign = (a, b) => SHARED_BY_DESIGN.some(([x, y]) => x === a && y === b || x === b && y === a);
|
|
348
|
+
function findClash(keys) {
|
|
349
|
+
const actions = Object.keys(keys);
|
|
350
|
+
const clashKey = (action) => comboClashKey(parseCombo(keys[action]));
|
|
351
|
+
for (const [i, a] of actions.entries()) {
|
|
352
|
+
for (const b of actions.slice(i + 1)) {
|
|
353
|
+
if (clashKey(a) === clashKey(b) && !sharedByDesign(a, b))
|
|
354
|
+
return `${a} and ${b} both on "${keys[a]}"`;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
function resolve(overrides) {
|
|
360
|
+
const next = { ...DEFAULT_STUDIO_KEYS };
|
|
361
|
+
for (const [action, text] of Object.entries(overrides)) {
|
|
362
|
+
const combo = typeof text === "string" ? parseCombo(text) : null;
|
|
363
|
+
if (!Object.hasOwn(DEFAULT_STUDIO_KEYS, action) || !combo) {
|
|
364
|
+
console.warn(
|
|
365
|
+
`Studio keys: using defaults, "${action}" is not a known action with a valid combo`
|
|
366
|
+
);
|
|
367
|
+
return DEFAULT_STUDIO_KEYS;
|
|
368
|
+
}
|
|
369
|
+
next[action] = comboText(combo);
|
|
370
|
+
}
|
|
371
|
+
const clash = findClash(next);
|
|
372
|
+
if (!clash) return next;
|
|
373
|
+
console.warn(`Studio keys: using defaults, ${clash}`);
|
|
374
|
+
return DEFAULT_STUDIO_KEYS;
|
|
375
|
+
}
|
|
376
|
+
function setStudioKeys(overrides) {
|
|
377
|
+
current = overrides ? resolve(overrides) : DEFAULT_STUDIO_KEYS;
|
|
378
|
+
for (const listener2 of listeners) listener2();
|
|
379
|
+
}
|
|
380
|
+
var getStudioKeys = () => current;
|
|
381
|
+
function subscribe(listener2) {
|
|
382
|
+
listeners.add(listener2);
|
|
383
|
+
return () => listeners.delete(listener2);
|
|
384
|
+
}
|
|
385
|
+
var useStudioKeys = () => useSyncExternalStore(subscribe, getStudioKeys);
|
|
386
|
+
function useShortcutSections(host) {
|
|
387
|
+
const keys = useStudioKeys();
|
|
388
|
+
return host ?? buildShortcutSections(keys);
|
|
389
|
+
}
|
|
390
|
+
var keyHint = (action, keys = current) => formatCombo(parseCombo(keys[action]));
|
|
391
|
+
var matchesKey = (e, action) => matchCombo(e, parseCombo(current[action]));
|
|
392
|
+
function buildShortcutSections(keys) {
|
|
393
|
+
const k = (action) => keyHint(action, keys);
|
|
394
|
+
return [
|
|
395
|
+
{
|
|
396
|
+
title: "Playback",
|
|
397
|
+
hints: [
|
|
398
|
+
{ key: k("playPause"), label: "Play / Pause" },
|
|
399
|
+
{ key: k("shuttleBack"), label: "Play backward" },
|
|
400
|
+
{ key: k("pause"), label: "Stop" },
|
|
401
|
+
{ key: k("shuttleForward"), label: "Play forward" },
|
|
402
|
+
{ key: k("mute"), label: "Toggle mute" },
|
|
403
|
+
{ key: k("loop"), label: "Toggle loop" },
|
|
404
|
+
{ key: `${k("frameBack")}/${k("frameForward")}`, label: "Step 1 frame" },
|
|
405
|
+
{ key: `${k("frameBackTen")}/${k("frameForwardTen")}`, label: "Step 10 frames" },
|
|
406
|
+
{ key: k("fullscreen"), label: "Toggle fullscreen" }
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
title: "Keyframes (when an element is selected)",
|
|
411
|
+
hints: [
|
|
412
|
+
{ key: k("addKeyframe"), label: "Add / remove keyframe at playhead" },
|
|
413
|
+
{ key: k("deleteSelected"), label: "Delete selected keyframe" },
|
|
414
|
+
{ key: k("record"), label: "Record gesture" }
|
|
415
|
+
]
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
title: "Editing",
|
|
419
|
+
hints: [
|
|
420
|
+
{ key: k("undo"), label: "Undo" },
|
|
421
|
+
{ key: k("redo"), label: "Redo" },
|
|
422
|
+
{ key: k("copy"), label: "Copy element" },
|
|
423
|
+
{ key: k("paste"), label: "Paste element" },
|
|
424
|
+
{ key: k("cut"), label: "Cut element" },
|
|
425
|
+
{ key: k("split"), label: "Split clip at playhead" },
|
|
426
|
+
{ key: k("zoomSelection"), label: "Zoom timeline to selected clips" },
|
|
427
|
+
{ key: k("audioGain"), label: "Audio Gain for clips with sound" },
|
|
428
|
+
{ key: "\u21E7Click", label: "Razor tool: split all tracks" },
|
|
429
|
+
{ key: k("selectLeftward"), label: "Select clips starting before the playhead" },
|
|
430
|
+
{ key: k("selectRightward"), label: "Select clips running at or after the playhead" },
|
|
431
|
+
{ key: k("group"), label: "Group elements" },
|
|
432
|
+
{ key: k("ungroup"), label: "Ungroup" },
|
|
433
|
+
{ key: k("deleteSelected"), label: "Delete selected element (no keyframe selected)" }
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
title: "Gesture recording modifiers",
|
|
438
|
+
hints: [
|
|
439
|
+
{ key: "Drag", label: "Record x / y position" },
|
|
440
|
+
{ key: "Scroll", label: "Record z depth" },
|
|
441
|
+
{ key: "\u21E7 Drag", label: "Record rotationX / rotationY" },
|
|
442
|
+
{ key: "\u2325 Drag", label: "Record rotation" },
|
|
443
|
+
{ key: "\u2318 Drag\u2195", label: "Record opacity" },
|
|
444
|
+
{ key: "\u2318 Scroll", label: "Record scale" }
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
title: "Canvas",
|
|
449
|
+
hints: [
|
|
450
|
+
{ key: "Drag", label: "Move element / add keyframe" },
|
|
451
|
+
{ key: "\u2325 Drag", label: "Move entire animation path" },
|
|
452
|
+
{ key: "\u21E7 Drag", label: "Uniform resize" }
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
title: "Crop",
|
|
457
|
+
hints: [
|
|
458
|
+
{ key: "Drag edge", label: "Crop a side" },
|
|
459
|
+
{ key: "Drag center", label: "Reposition the crop" }
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
title: "Panels",
|
|
464
|
+
hints: [
|
|
465
|
+
{ key: k("tabCompositions"), label: "Compositions tab" },
|
|
466
|
+
{ key: k("tabAssets"), label: "Assets tab" }
|
|
467
|
+
]
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
title: "Work area",
|
|
471
|
+
hints: [
|
|
472
|
+
{ key: k("inPoint"), label: "Set in-point" },
|
|
473
|
+
{ key: k("clearInPoint"), label: "Clear in-point" },
|
|
474
|
+
{ key: k("outPoint"), label: "Set out-point" },
|
|
475
|
+
{ key: k("clearOutPoint"), label: "Clear out-point" },
|
|
476
|
+
{ key: k("seekToIn"), label: "Jump to in-point" },
|
|
477
|
+
{ key: k("seekToOut"), label: "Jump to out-point" }
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
];
|
|
481
|
+
}
|
|
482
|
+
var DEFAULT_SHORTCUT_SECTIONS = buildShortcutSections(DEFAULT_STUDIO_KEYS);
|
|
483
|
+
|
|
189
484
|
// src/components/nle/PreviewPane.tsx
|
|
190
485
|
import { useCallback as useCallback52, useRef as useRef61, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
191
486
|
|
|
@@ -629,175 +924,6 @@ var flatIdle = `${flatBtn} text-text-2 hover:bg-hover hover:text-text-0 active:b
|
|
|
629
924
|
var flatActive = `${flatBtn} bg-on text-text-0 hover:bg-on-hover active:scale-[0.98]`;
|
|
630
925
|
var flatDisabled = `${flatBtn} text-text-off cursor-not-allowed`;
|
|
631
926
|
|
|
632
|
-
// src/player/components/studioShortcuts.ts
|
|
633
|
-
import { useSyncExternalStore } from "react";
|
|
634
|
-
var DEFAULT_STUDIO_KEYS = {
|
|
635
|
-
fullscreen: "f",
|
|
636
|
-
split: "s",
|
|
637
|
-
record: "r",
|
|
638
|
-
addKeyframe: "k",
|
|
639
|
-
audioGain: "g",
|
|
640
|
-
zoomSelection: "z",
|
|
641
|
-
mute: "m",
|
|
642
|
-
pause: "k",
|
|
643
|
-
shuttleBack: "j",
|
|
644
|
-
shuttleForward: "l",
|
|
645
|
-
inPoint: "i",
|
|
646
|
-
outPoint: "o",
|
|
647
|
-
seekToIn: "a",
|
|
648
|
-
seekToOut: "e",
|
|
649
|
-
selectTool: "v",
|
|
650
|
-
razorTool: "b",
|
|
651
|
-
selectLeftward: "[",
|
|
652
|
-
selectRightward: "]",
|
|
653
|
-
exitRazor: "a",
|
|
654
|
-
snap: "s",
|
|
655
|
-
grid: "g",
|
|
656
|
-
timelineSnap: "n"
|
|
657
|
-
};
|
|
658
|
-
var SHARED_BY_DESIGN = [
|
|
659
|
-
["pause", "addKeyframe"],
|
|
660
|
-
["seekToIn", "exitRazor"],
|
|
661
|
-
["split", "snap"],
|
|
662
|
-
["audioGain", "grid"]
|
|
663
|
-
];
|
|
664
|
-
var current = DEFAULT_STUDIO_KEYS;
|
|
665
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
666
|
-
var sharedByDesign = (a, b) => SHARED_BY_DESIGN.some(([x, y]) => x === a && y === b || x === b && y === a);
|
|
667
|
-
function findClash(keys) {
|
|
668
|
-
const actions = Object.keys(keys);
|
|
669
|
-
for (const [i, a] of actions.entries()) {
|
|
670
|
-
for (const b of actions.slice(i + 1)) {
|
|
671
|
-
if (keys[a] === keys[b] && !sharedByDesign(a, b)) return `${a} and ${b} both on "${keys[a]}"`;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
return null;
|
|
675
|
-
}
|
|
676
|
-
function resolve(overrides) {
|
|
677
|
-
const next = { ...DEFAULT_STUDIO_KEYS };
|
|
678
|
-
for (const [action, key2] of Object.entries(overrides)) {
|
|
679
|
-
if (!Object.hasOwn(DEFAULT_STUDIO_KEYS, action) || typeof key2 !== "string" || [...key2].length !== 1) {
|
|
680
|
-
console.warn(
|
|
681
|
-
`Studio keys: using defaults, "${action}" is not a known action with one character`
|
|
682
|
-
);
|
|
683
|
-
return DEFAULT_STUDIO_KEYS;
|
|
684
|
-
}
|
|
685
|
-
next[action] = key2.toLowerCase();
|
|
686
|
-
}
|
|
687
|
-
const clash = findClash(next);
|
|
688
|
-
if (!clash) return next;
|
|
689
|
-
console.warn(`Studio keys: using defaults, ${clash}`);
|
|
690
|
-
return DEFAULT_STUDIO_KEYS;
|
|
691
|
-
}
|
|
692
|
-
function setStudioKeys(overrides) {
|
|
693
|
-
current = overrides ? resolve(overrides) : DEFAULT_STUDIO_KEYS;
|
|
694
|
-
for (const listener2 of listeners) listener2();
|
|
695
|
-
}
|
|
696
|
-
var getStudioKeys = () => current;
|
|
697
|
-
var getStudioKey = (action) => current[action];
|
|
698
|
-
function subscribe(listener2) {
|
|
699
|
-
listeners.add(listener2);
|
|
700
|
-
return () => listeners.delete(listener2);
|
|
701
|
-
}
|
|
702
|
-
var useStudioKeys = () => useSyncExternalStore(subscribe, getStudioKeys);
|
|
703
|
-
function useShortcutSections(host) {
|
|
704
|
-
const keys = useStudioKeys();
|
|
705
|
-
return host ?? buildShortcutSections(keys);
|
|
706
|
-
}
|
|
707
|
-
var hintKey = (key2) => key2.toUpperCase();
|
|
708
|
-
var keyHint = (action, keys = current) => hintKey(keys[action]);
|
|
709
|
-
function buildShortcutSections(keys) {
|
|
710
|
-
const k = (action) => keyHint(action, keys);
|
|
711
|
-
return [
|
|
712
|
-
{
|
|
713
|
-
title: "Playback",
|
|
714
|
-
hints: [
|
|
715
|
-
{ key: "Space", label: "Play / Pause" },
|
|
716
|
-
{ key: k("shuttleBack"), label: "Play backward" },
|
|
717
|
-
{ key: k("pause"), label: "Stop" },
|
|
718
|
-
{ key: k("shuttleForward"), label: "Play forward" },
|
|
719
|
-
{ key: k("mute"), label: "Toggle mute" },
|
|
720
|
-
{ key: `\u21E7${k("shuttleForward")}`, label: "Toggle loop" },
|
|
721
|
-
{ key: "\u2190/\u2192", label: "Step 1 frame" },
|
|
722
|
-
{ key: "\u21E7\u2190/\u21E7\u2192", label: "Step 10 frames" },
|
|
723
|
-
{ key: k("fullscreen"), label: "Toggle fullscreen" }
|
|
724
|
-
]
|
|
725
|
-
},
|
|
726
|
-
{
|
|
727
|
-
title: "Keyframes (when an element is selected)",
|
|
728
|
-
hints: [
|
|
729
|
-
{ key: k("addKeyframe"), label: "Add / remove keyframe at playhead" },
|
|
730
|
-
{ key: "Del", label: "Delete selected keyframe" },
|
|
731
|
-
{ key: k("record"), label: "Record gesture" }
|
|
732
|
-
]
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
title: "Editing",
|
|
736
|
-
hints: [
|
|
737
|
-
{ key: "\u2318Z", label: "Undo" },
|
|
738
|
-
{ key: "\u2318\u21E7Z", label: "Redo" },
|
|
739
|
-
{ key: "\u2318C", label: "Copy element" },
|
|
740
|
-
{ key: "\u2318V", label: "Paste element" },
|
|
741
|
-
{ key: "\u2318X", label: "Cut element" },
|
|
742
|
-
{ key: k("split"), label: "Split clip at playhead" },
|
|
743
|
-
{ key: k("zoomSelection"), label: "Zoom timeline to selected clips" },
|
|
744
|
-
{ key: k("audioGain"), label: "Audio Gain for clips with sound" },
|
|
745
|
-
{ key: "\u21E7Click", label: "Razor tool: split all tracks" },
|
|
746
|
-
{ key: k("selectLeftward"), label: "Select clips starting before the playhead" },
|
|
747
|
-
{ key: k("selectRightward"), label: "Select clips running at or after the playhead" },
|
|
748
|
-
{ key: "\u2318G", label: "Group elements" },
|
|
749
|
-
{ key: "\u2318\u21E7G", label: "Ungroup" },
|
|
750
|
-
{ key: "Del", label: "Delete selected element (no keyframe selected)" }
|
|
751
|
-
]
|
|
752
|
-
},
|
|
753
|
-
{
|
|
754
|
-
title: "Gesture recording modifiers",
|
|
755
|
-
hints: [
|
|
756
|
-
{ key: "Drag", label: "Record x / y position" },
|
|
757
|
-
{ key: "Scroll", label: "Record z depth" },
|
|
758
|
-
{ key: "\u21E7 Drag", label: "Record rotationX / rotationY" },
|
|
759
|
-
{ key: "\u2325 Drag", label: "Record rotation" },
|
|
760
|
-
{ key: "\u2318 Drag\u2195", label: "Record opacity" },
|
|
761
|
-
{ key: "\u2318 Scroll", label: "Record scale" }
|
|
762
|
-
]
|
|
763
|
-
},
|
|
764
|
-
{
|
|
765
|
-
title: "Canvas",
|
|
766
|
-
hints: [
|
|
767
|
-
{ key: "Drag", label: "Move element / add keyframe" },
|
|
768
|
-
{ key: "\u2325 Drag", label: "Move entire animation path" },
|
|
769
|
-
{ key: "\u21E7 Drag", label: "Uniform resize" }
|
|
770
|
-
]
|
|
771
|
-
},
|
|
772
|
-
{
|
|
773
|
-
title: "Crop",
|
|
774
|
-
hints: [
|
|
775
|
-
{ key: "Drag edge", label: "Crop a side" },
|
|
776
|
-
{ key: "Drag center", label: "Reposition the crop" }
|
|
777
|
-
]
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
title: "Panels",
|
|
781
|
-
hints: [
|
|
782
|
-
{ key: "\u23181", label: "Compositions tab" },
|
|
783
|
-
{ key: "\u23182", label: "Assets tab" }
|
|
784
|
-
]
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
title: "Work area",
|
|
788
|
-
hints: [
|
|
789
|
-
{ key: k("inPoint"), label: "Set in-point" },
|
|
790
|
-
{ key: `\u21E7${k("inPoint")}`, label: "Clear in-point" },
|
|
791
|
-
{ key: k("outPoint"), label: "Set out-point" },
|
|
792
|
-
{ key: `\u21E7${k("outPoint")}`, label: "Clear out-point" },
|
|
793
|
-
{ key: k("seekToIn"), label: "Jump to in-point" },
|
|
794
|
-
{ key: k("seekToOut"), label: "Jump to out-point" }
|
|
795
|
-
]
|
|
796
|
-
}
|
|
797
|
-
];
|
|
798
|
-
}
|
|
799
|
-
var DEFAULT_SHORTCUT_SECTIONS = buildShortcutSections(DEFAULT_STUDIO_KEYS);
|
|
800
|
-
|
|
801
927
|
// src/player/components/ShortcutsPanel.tsx
|
|
802
928
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
803
929
|
var STAY_ABOVE = { side: "none", align: "shift", fallbackAxisSide: "none" };
|
|
@@ -3512,7 +3638,7 @@ function resolveTimelineAutoScrollLoopAction(scroll, clientX, clientY, rafActive
|
|
|
3512
3638
|
return rafActive ? "none" : "start";
|
|
3513
3639
|
}
|
|
3514
3640
|
function resolveTimelineDragEscape(input) {
|
|
3515
|
-
if (input.
|
|
3641
|
+
if (!input.cancelPressed || !input.drag && !input.resize && !input.blocked) {
|
|
3516
3642
|
return { cancel: false, suppressClick: false };
|
|
3517
3643
|
}
|
|
3518
3644
|
return {
|
|
@@ -5640,7 +5766,7 @@ function handleBeatDragPointerCancel(event) {
|
|
|
5640
5766
|
claimBeatDrag(event.pointerId);
|
|
5641
5767
|
}
|
|
5642
5768
|
function handleBeatDragKeyDown(event) {
|
|
5643
|
-
if (event
|
|
5769
|
+
if (!matchesKey(event, "cancel") || !beatDragActor) return;
|
|
5644
5770
|
event.preventDefault();
|
|
5645
5771
|
cancelBeatDrag();
|
|
5646
5772
|
}
|
|
@@ -7971,7 +8097,7 @@ function beginTimelineKeyframeRetime(input) {
|
|
|
7971
8097
|
if (actor.phase === "active" && matchesPointer(event)) cancel(actor);
|
|
7972
8098
|
};
|
|
7973
8099
|
const onKeyDown = (event) => {
|
|
7974
|
-
if (event
|
|
8100
|
+
if (matchesKey(event, "cancel")) cancel(actor);
|
|
7975
8101
|
};
|
|
7976
8102
|
window.addEventListener("pointermove", onPointerMove, true);
|
|
7977
8103
|
window.addEventListener("pointerup", onPointerUp, true);
|
|
@@ -9356,20 +9482,11 @@ function isTrackDisclosable(elements, laneCount) {
|
|
|
9356
9482
|
|
|
9357
9483
|
// src/player/components/useTimelineKeyboardActor.ts
|
|
9358
9484
|
function clipPickupKeyboardAction(event) {
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
case "Enter":
|
|
9365
|
-
return { kind: event.repeat ? "focus" : "commit" };
|
|
9366
|
-
case "Escape":
|
|
9367
|
-
return { kind: "cancel" };
|
|
9368
|
-
case " ":
|
|
9369
|
-
return { kind: "consume" };
|
|
9370
|
-
default:
|
|
9371
|
-
return null;
|
|
9372
|
-
}
|
|
9485
|
+
if (matchesKey(event, "pickupUp")) return { kind: "move", step: -1 };
|
|
9486
|
+
if (matchesKey(event, "pickupDown")) return { kind: "move", step: 1 };
|
|
9487
|
+
if (matchesKey(event, "pickupDrop")) return { kind: event.repeat ? "focus" : "commit" };
|
|
9488
|
+
if (matchesKey(event, "cancel")) return { kind: "cancel" };
|
|
9489
|
+
return matchesKey(event, "pickupClip") ? { kind: "consume" } : null;
|
|
9373
9490
|
}
|
|
9374
9491
|
function handleClipPickupKeyboardEvent(event, actions) {
|
|
9375
9492
|
const action = clipPickupKeyboardAction(event);
|
|
@@ -10911,7 +11028,7 @@ function mountTimelineClipDragGestureLifecycle({
|
|
|
10911
11028
|
};
|
|
10912
11029
|
const handleWindowKeyDown = (event) => {
|
|
10913
11030
|
const decision = resolveTimelineDragEscape({
|
|
10914
|
-
|
|
11031
|
+
cancelPressed: matchesKey(event, "cancel"),
|
|
10915
11032
|
drag: draggedClipRef.current,
|
|
10916
11033
|
resize: resizingClipRef.current,
|
|
10917
11034
|
blocked: blockedClipRef.current
|
|
@@ -11334,7 +11451,7 @@ function useTimelineClipDrag({
|
|
|
11334
11451
|
return;
|
|
11335
11452
|
}
|
|
11336
11453
|
if (resizingClipRef.current) return;
|
|
11337
|
-
if (event
|
|
11454
|
+
if (!matchesKey(event, "pickupClip") || event.repeat) return;
|
|
11338
11455
|
if (viewport2) pickup(event, viewport2);
|
|
11339
11456
|
};
|
|
11340
11457
|
window.addEventListener("keydown", handleKeyDown, true);
|
|
@@ -12222,13 +12339,13 @@ function useTimelineRangeSelection({
|
|
|
12222
12339
|
);
|
|
12223
12340
|
useEffect12(() => {
|
|
12224
12341
|
const onBandEscape = (e) => {
|
|
12225
|
-
if (e
|
|
12342
|
+
if (!matchesKey(e, "cancel") || !(marqueeRef.current || isRangeSelecting.current)) return;
|
|
12226
12343
|
e.preventDefault();
|
|
12227
12344
|
e.stopPropagation();
|
|
12228
12345
|
cancelActiveGesture(true, true);
|
|
12229
12346
|
};
|
|
12230
12347
|
const onKeyDown = (e) => {
|
|
12231
|
-
if (e
|
|
12348
|
+
if (!matchesKey(e, "cancel")) return;
|
|
12232
12349
|
const store = usePlayerStore.getState();
|
|
12233
12350
|
if (isDragging.current) {
|
|
12234
12351
|
cancelActiveGesture(true, true);
|
|
@@ -15925,7 +16042,7 @@ function TimelineClipFades({
|
|
|
15925
16042
|
if (dragging === null) return;
|
|
15926
16043
|
const cancelOnWindowEscape = (e) => {
|
|
15927
16044
|
const g = gesture.current;
|
|
15928
|
-
if (e
|
|
16045
|
+
if (!matchesKey(e, "cancel") || !g) return;
|
|
15929
16046
|
e.preventDefault();
|
|
15930
16047
|
e.stopPropagation();
|
|
15931
16048
|
gesture.current = null;
|
|
@@ -22191,9 +22308,6 @@ async function resolveAssetHasAudio(projectId, assetPath) {
|
|
|
22191
22308
|
}
|
|
22192
22309
|
|
|
22193
22310
|
// src/hooks/useAutomationSelectionKeyboard.ts
|
|
22194
|
-
function isChord(e, letter) {
|
|
22195
|
-
return (e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === letter;
|
|
22196
|
-
}
|
|
22197
22311
|
function elementKeyOf(element) {
|
|
22198
22312
|
return element.key ?? element.id;
|
|
22199
22313
|
}
|
|
@@ -22248,7 +22362,7 @@ function pasteAnchor(state, element, span, sel) {
|
|
|
22248
22362
|
}
|
|
22249
22363
|
var latestPaste = 0;
|
|
22250
22364
|
function handlePaste(e, state, lanes) {
|
|
22251
|
-
if (!
|
|
22365
|
+
if (!matchesKey(e, "paste")) return false;
|
|
22252
22366
|
const clip = readClipboard(state.timelineProjectId);
|
|
22253
22367
|
if (!clip) return false;
|
|
22254
22368
|
const sel = state.automationSelection;
|
|
@@ -22284,7 +22398,7 @@ function handlePaste(e, state, lanes) {
|
|
|
22284
22398
|
return true;
|
|
22285
22399
|
}
|
|
22286
22400
|
function handleCopy(e, state, lanes, sel) {
|
|
22287
|
-
if (!
|
|
22401
|
+
if (!matchesKey(e, "copy")) return false;
|
|
22288
22402
|
const ctx3 = resolveSelectionContext(state, lanes, sel);
|
|
22289
22403
|
if (!ctx3) return false;
|
|
22290
22404
|
if (!copyRange(state.timelineProjectId, ctx3.lane, ctx3.range, sel.t0, sel.t1)) return false;
|
|
@@ -22295,8 +22409,8 @@ function handleCopy(e, state, lanes, sel) {
|
|
|
22295
22409
|
function automationOwnsKey(e) {
|
|
22296
22410
|
if (isTypingTarget(document.activeElement)) return false;
|
|
22297
22411
|
const state = usePlayerStore.getState();
|
|
22298
|
-
if (
|
|
22299
|
-
if (!
|
|
22412
|
+
if (matchesKey(e, "copy")) return state.automationSelection !== null;
|
|
22413
|
+
if (!matchesKey(e, "paste")) return false;
|
|
22300
22414
|
const clip = readClipboard(state.timelineProjectId);
|
|
22301
22415
|
if (!clip) return false;
|
|
22302
22416
|
const element = findElement(state.elements, state.selectedElementId);
|
|
@@ -22304,8 +22418,7 @@ function automationOwnsKey(e) {
|
|
|
22304
22418
|
return pasteAnchor(state, element, clip.span, state.automationSelection) !== null;
|
|
22305
22419
|
}
|
|
22306
22420
|
function handleDelete(e, state, lanes, sel) {
|
|
22307
|
-
|
|
22308
|
-
if (!isDeleteKey2 || e.metaKey || e.ctrlKey) return false;
|
|
22421
|
+
if (!matchesKey(e, "deleteSelected") && !matchesKey(e, "deleteSelectedAlt")) return false;
|
|
22309
22422
|
const write = resolveDeleteWrite(state, lanes, sel);
|
|
22310
22423
|
if (!write) return false;
|
|
22311
22424
|
e.preventDefault();
|
|
@@ -22324,7 +22437,7 @@ function useAutomationSelectionKeyboard({
|
|
|
22324
22437
|
if (handlePaste(e, state, lanes)) return;
|
|
22325
22438
|
const sel = state.automationSelection;
|
|
22326
22439
|
if (!sel) return;
|
|
22327
|
-
if (e
|
|
22440
|
+
if (matchesKey(e, "cancel")) {
|
|
22328
22441
|
state.clearAutomationSelection();
|
|
22329
22442
|
return;
|
|
22330
22443
|
}
|
|
@@ -27467,7 +27580,7 @@ function linkItem(element, elements, selected, selectedKeys, onLinkEdit) {
|
|
|
27467
27580
|
const suffix = partnerSuffix(element, linkPair);
|
|
27468
27581
|
return {
|
|
27469
27582
|
label: `Link${suffix && ` to${suffix}`}`,
|
|
27470
|
-
...selectedPair ? { shortcut: "
|
|
27583
|
+
...selectedPair ? { shortcut: keyHint("linkToggle") } : {},
|
|
27471
27584
|
run: () => onLinkEdit({ kind: "link", elements: linkPair })
|
|
27472
27585
|
};
|
|
27473
27586
|
}
|
|
@@ -27480,7 +27593,7 @@ function resolveLinkMenuItems(input) {
|
|
|
27480
27593
|
if (canDetachAudio(element)) {
|
|
27481
27594
|
items.push({
|
|
27482
27595
|
label: "Detach audio",
|
|
27483
|
-
shortcut: "
|
|
27596
|
+
shortcut: keyHint("detachAudio"),
|
|
27484
27597
|
run: () => onLinkEdit({ kind: "detach", element })
|
|
27485
27598
|
});
|
|
27486
27599
|
}
|
|
@@ -27488,7 +27601,7 @@ function resolveLinkMenuItems(input) {
|
|
|
27488
27601
|
if (linked) {
|
|
27489
27602
|
items.push({
|
|
27490
27603
|
label: `Unlink${partnerSuffix(element, members) && ` from${partnerSuffix(element, members)}`}`,
|
|
27491
|
-
shortcut: "
|
|
27604
|
+
shortcut: keyHint("linkToggle"),
|
|
27492
27605
|
run: () => onLinkEdit({ kind: "unlink", elements: members })
|
|
27493
27606
|
});
|
|
27494
27607
|
} else {
|
|
@@ -27506,7 +27619,7 @@ function resolveLinkMenuItems(input) {
|
|
|
27506
27619
|
if (linked && onDeleteElementOnly) {
|
|
27507
27620
|
items.push({
|
|
27508
27621
|
label: "Delete this clip only",
|
|
27509
|
-
shortcut: "
|
|
27622
|
+
shortcut: keyHint("deleteLinked"),
|
|
27510
27623
|
destructive: true,
|
|
27511
27624
|
run: () => onDeleteElementOnly(element)
|
|
27512
27625
|
});
|
|
@@ -27701,7 +27814,7 @@ var ClipContextMenu = memo19(function ClipContextMenu2({
|
|
|
27701
27814
|
},
|
|
27702
27815
|
children: [
|
|
27703
27816
|
/* @__PURE__ */ jsx70("span", { children: selectionSize > 1 ? `Copy ${selectionSize} clips` : "Copy" }),
|
|
27704
|
-
/* @__PURE__ */ jsx70("span", { className: "text-neutral-500 text-[10px] ml-3", children: "
|
|
27817
|
+
/* @__PURE__ */ jsx70("span", { className: "text-neutral-500 text-[10px] ml-3", children: keyHint("copy", keys) })
|
|
27705
27818
|
]
|
|
27706
27819
|
}
|
|
27707
27820
|
),
|
|
@@ -27719,7 +27832,7 @@ var ClipContextMenu = memo19(function ClipContextMenu2({
|
|
|
27719
27832
|
},
|
|
27720
27833
|
children: [
|
|
27721
27834
|
/* @__PURE__ */ jsx70("span", { children: "Paste" }),
|
|
27722
|
-
/* @__PURE__ */ jsx70("span", { className: "text-neutral-500 text-[10px] ml-3", children: "
|
|
27835
|
+
/* @__PURE__ */ jsx70("span", { className: "text-neutral-500 text-[10px] ml-3", children: keyHint("paste", keys) })
|
|
27723
27836
|
]
|
|
27724
27837
|
}
|
|
27725
27838
|
),
|
|
@@ -27735,7 +27848,7 @@ var ClipContextMenu = memo19(function ClipContextMenu2({
|
|
|
27735
27848
|
},
|
|
27736
27849
|
children: [
|
|
27737
27850
|
/* @__PURE__ */ jsx70("span", { children: selectionSize > 1 ? `Duplicate ${selectionSize} clips` : "Duplicate" }),
|
|
27738
|
-
/* @__PURE__ */ jsx70("span", { className: "text-neutral-500 text-[10px] ml-3", children: "
|
|
27851
|
+
/* @__PURE__ */ jsx70("span", { className: "text-neutral-500 text-[10px] ml-3", children: keyHint("duplicate", keys) })
|
|
27739
27852
|
]
|
|
27740
27853
|
}
|
|
27741
27854
|
)
|
|
@@ -29606,7 +29719,12 @@ var useCaptionStore = create6((set, get) => ({
|
|
|
29606
29719
|
}));
|
|
29607
29720
|
|
|
29608
29721
|
// src/player/lib/playbackShortcuts.ts
|
|
29609
|
-
var
|
|
29722
|
+
var FRAME_STEP_ACTIONS = [
|
|
29723
|
+
"frameBack",
|
|
29724
|
+
"frameForward",
|
|
29725
|
+
"frameBackTen",
|
|
29726
|
+
"frameForwardTen"
|
|
29727
|
+
];
|
|
29610
29728
|
var PLAYBACK_SHORTCUT_IGNORED_SELECTOR = [
|
|
29611
29729
|
"button",
|
|
29612
29730
|
"a[href]",
|
|
@@ -29641,14 +29759,13 @@ function shouldIgnorePlaybackShortcutEvent(event, captionState = {
|
|
|
29641
29759
|
isCaptionEditMode: false,
|
|
29642
29760
|
selectedCaptionSegmentCount: 0
|
|
29643
29761
|
}) {
|
|
29644
|
-
if (event.metaKey || event.ctrlKey || event.altKey) return true;
|
|
29645
29762
|
if (shouldIgnorePlaybackShortcutTarget(event.target)) return true;
|
|
29646
29763
|
if (isModalDialogOpen()) return true;
|
|
29647
|
-
return
|
|
29764
|
+
return FRAME_STEP_ACTIONS.some((action) => matchesKey(event, action)) && captionState.isCaptionEditMode && captionState.selectedCaptionSegmentCount > 0;
|
|
29648
29765
|
}
|
|
29649
29766
|
var SHUTTLE_SPEEDS = [1, 2, 4];
|
|
29650
|
-
function razorClaimsKey(e
|
|
29651
|
-
return
|
|
29767
|
+
function razorClaimsKey(e) {
|
|
29768
|
+
return matchesKey(e, "exitRazor") && usePlayerStore.getState().activeTool === "razor";
|
|
29652
29769
|
}
|
|
29653
29770
|
|
|
29654
29771
|
// src/utils/canvasNudgeGate.ts
|
|
@@ -29666,22 +29783,74 @@ function canvasNudgeKeysClaimed() {
|
|
|
29666
29783
|
return claims > 0;
|
|
29667
29784
|
}
|
|
29668
29785
|
|
|
29786
|
+
// src/components/editor/domEditNudge.ts
|
|
29787
|
+
var CANVAS_NUDGE_STEP_PX = 1;
|
|
29788
|
+
var CANVAS_NUDGE_SHIFT_STEP_PX = 10;
|
|
29789
|
+
var CANVAS_NUDGE_COMMIT_DEBOUNCE_MS = 400;
|
|
29790
|
+
var NUDGES = [
|
|
29791
|
+
["nudgeLeft", -1, 0, CANVAS_NUDGE_STEP_PX],
|
|
29792
|
+
["nudgeRight", 1, 0, CANVAS_NUDGE_STEP_PX],
|
|
29793
|
+
["nudgeUp", 0, -1, CANVAS_NUDGE_STEP_PX],
|
|
29794
|
+
["nudgeDown", 0, 1, CANVAS_NUDGE_STEP_PX],
|
|
29795
|
+
["nudgeLeftTen", -1, 0, CANVAS_NUDGE_SHIFT_STEP_PX],
|
|
29796
|
+
["nudgeRightTen", 1, 0, CANVAS_NUDGE_SHIFT_STEP_PX],
|
|
29797
|
+
["nudgeUpTen", 0, -1, CANVAS_NUDGE_SHIFT_STEP_PX],
|
|
29798
|
+
["nudgeDownTen", 0, 1, CANVAS_NUDGE_SHIFT_STEP_PX]
|
|
29799
|
+
];
|
|
29800
|
+
function resolveCanvasNudgeDelta(event) {
|
|
29801
|
+
const hit = NUDGES.find(([action]) => matchesKey(event, action));
|
|
29802
|
+
return hit ? { dx: hit[1] * hit[3], dy: hit[2] * hit[3] } : null;
|
|
29803
|
+
}
|
|
29804
|
+
function canCanvasNudgeTargets(targets) {
|
|
29805
|
+
return targets.length > 0 && targets.every((t2) => t2.capabilities.canApplyManualOffset);
|
|
29806
|
+
}
|
|
29807
|
+
|
|
29669
29808
|
// src/player/hooks/usePlaybackKeyboard.ts
|
|
29670
|
-
|
|
29671
|
-
|
|
29672
|
-
|
|
29809
|
+
var FRAME_STEPS = {
|
|
29810
|
+
frameBack: -1,
|
|
29811
|
+
frameForward: 1,
|
|
29812
|
+
frameBackTen: -10,
|
|
29813
|
+
frameForwardTen: 10
|
|
29814
|
+
};
|
|
29815
|
+
var PLAYBACK_ACTIONS = [
|
|
29816
|
+
"playPause",
|
|
29817
|
+
...Object.keys(FRAME_STEPS),
|
|
29818
|
+
"mute",
|
|
29819
|
+
"loop",
|
|
29820
|
+
"pause",
|
|
29821
|
+
"shuttleBack",
|
|
29822
|
+
"shuttleForward",
|
|
29823
|
+
"inPoint",
|
|
29824
|
+
"clearInPoint",
|
|
29825
|
+
"outPoint",
|
|
29826
|
+
"clearOutPoint",
|
|
29827
|
+
"seekToIn",
|
|
29828
|
+
"seekToOut"
|
|
29829
|
+
];
|
|
29830
|
+
var playbackActionOf = (e) => PLAYBACK_ACTIONS.find((action) => matchesKey(e, action));
|
|
29831
|
+
function ignoresPlaybackKey(e) {
|
|
29832
|
+
const captionState = useCaptionStore.getState();
|
|
29833
|
+
return shouldIgnorePlaybackShortcutEvent(e, {
|
|
29834
|
+
isCaptionEditMode: captionState.isEditMode,
|
|
29835
|
+
selectedCaptionSegmentCount: captionState.selectedSegmentIds.size
|
|
29836
|
+
});
|
|
29837
|
+
}
|
|
29838
|
+
function handleWorkAreaKey(e, action, getAdapter, seek) {
|
|
29673
29839
|
const store = usePlayerStore.getState();
|
|
29674
29840
|
const time = () => getAdapter()?.getTime() ?? store.currentTime;
|
|
29675
29841
|
const end = () => store.outPoint ?? getAdapter()?.getDuration() ?? store.duration;
|
|
29676
29842
|
const actions = {
|
|
29677
|
-
|
|
29678
|
-
|
|
29679
|
-
|
|
29680
|
-
|
|
29681
|
-
|
|
29682
|
-
|
|
29843
|
+
inPoint: () => store.setInPoint(time()),
|
|
29844
|
+
clearInPoint: () => store.setInPoint(null),
|
|
29845
|
+
outPoint: () => store.setOutPoint(time()),
|
|
29846
|
+
clearOutPoint: () => store.setOutPoint(null),
|
|
29847
|
+
seekToIn: () => seek(store.inPoint ?? 0, { keepPlaying: true }),
|
|
29848
|
+
seekToOut: () => seek(end(), { keepPlaying: true })
|
|
29849
|
+
};
|
|
29850
|
+
const run = actions[action];
|
|
29851
|
+
if (!run || razorClaimsKey(e)) return false;
|
|
29683
29852
|
e.preventDefault();
|
|
29684
|
-
|
|
29853
|
+
run();
|
|
29685
29854
|
return true;
|
|
29686
29855
|
}
|
|
29687
29856
|
function usePlaybackKeyboard({
|
|
@@ -29695,7 +29864,7 @@ function usePlaybackKeyboard({
|
|
|
29695
29864
|
pause,
|
|
29696
29865
|
seek
|
|
29697
29866
|
}) {
|
|
29698
|
-
const
|
|
29867
|
+
const heldPauseRef = useRef46(/* @__PURE__ */ new Set());
|
|
29699
29868
|
const playbackKeyDownRef = useRef46(() => {
|
|
29700
29869
|
});
|
|
29701
29870
|
const playbackKeyUpRef = useRef46(() => {
|
|
@@ -29740,76 +29909,39 @@ function usePlaybackKeyboard({
|
|
|
29740
29909
|
}, [play, pause]);
|
|
29741
29910
|
const handlePlaybackKeyDown = useCallback37(
|
|
29742
29911
|
(e) => {
|
|
29743
|
-
if (e.defaultPrevented) return;
|
|
29744
|
-
const
|
|
29745
|
-
if (
|
|
29746
|
-
|
|
29747
|
-
|
|
29748
|
-
|
|
29749
|
-
|
|
29750
|
-
|
|
29751
|
-
const
|
|
29752
|
-
const
|
|
29753
|
-
|
|
29754
|
-
|
|
29755
|
-
|
|
29756
|
-
|
|
29757
|
-
|
|
29758
|
-
|
|
29759
|
-
|
|
29760
|
-
|
|
29761
|
-
|
|
29762
|
-
|
|
29763
|
-
|
|
29764
|
-
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
e.preventDefault();
|
|
29768
|
-
stepFrames(e.shiftKey ? 10 : 1);
|
|
29769
|
-
return;
|
|
29770
|
-
}
|
|
29771
|
-
if (e.repeat) return;
|
|
29772
|
-
if (key2 === keys.mute) {
|
|
29773
|
-
e.preventDefault();
|
|
29774
|
-
const state = usePlayerStore.getState();
|
|
29775
|
-
state.setAudioMuted(!state.audioMuted);
|
|
29776
|
-
return;
|
|
29777
|
-
}
|
|
29778
|
-
if (key2 === keys.shuttleForward && e.shiftKey) {
|
|
29779
|
-
e.preventDefault();
|
|
29780
|
-
const state = usePlayerStore.getState();
|
|
29781
|
-
state.setLoopEnabled(!state.loopEnabled);
|
|
29782
|
-
return;
|
|
29783
|
-
}
|
|
29784
|
-
if (key2 === keys.pause) {
|
|
29785
|
-
e.preventDefault();
|
|
29786
|
-
pause();
|
|
29787
|
-
return;
|
|
29788
|
-
}
|
|
29789
|
-
if (key2 === keys.shuttleBack) {
|
|
29790
|
-
e.preventDefault();
|
|
29791
|
-
if (pressedKeysRef.current.has(keys.pause)) {
|
|
29792
|
-
stepFrames(-1);
|
|
29793
|
-
return;
|
|
29794
|
-
}
|
|
29795
|
-
shuttle("backward");
|
|
29796
|
-
return;
|
|
29797
|
-
}
|
|
29798
|
-
if (key2 === keys.shuttleForward) {
|
|
29799
|
-
e.preventDefault();
|
|
29800
|
-
if (pressedKeysRef.current.has(keys.pause)) {
|
|
29801
|
-
stepFrames(1);
|
|
29802
|
-
return;
|
|
29803
|
-
}
|
|
29804
|
-
shuttle("forward");
|
|
29912
|
+
if (e.defaultPrevented || ignoresPlaybackKey(e)) return;
|
|
29913
|
+
const action = playbackActionOf(e);
|
|
29914
|
+
if (action === "pause") heldPauseRef.current.add(e.code || e.key);
|
|
29915
|
+
if (!action) return;
|
|
29916
|
+
const isFrameStep = action in FRAME_STEPS;
|
|
29917
|
+
if (isFrameStep && canvasNudgeKeysClaimed() && resolveCanvasNudgeDelta(e)) return;
|
|
29918
|
+
if (e.repeat && action !== "playPause" && !isFrameStep) return;
|
|
29919
|
+
const shuttleOrStep = (direction) => heldPauseRef.current.size > 0 ? stepFrames(direction) : shuttle(direction < 0 ? "backward" : "forward");
|
|
29920
|
+
const player = usePlayerStore.getState();
|
|
29921
|
+
const run = {
|
|
29922
|
+
playPause: togglePlay,
|
|
29923
|
+
frameBack: () => stepFrames(FRAME_STEPS.frameBack),
|
|
29924
|
+
frameForward: () => stepFrames(FRAME_STEPS.frameForward),
|
|
29925
|
+
frameBackTen: () => stepFrames(FRAME_STEPS.frameBackTen),
|
|
29926
|
+
frameForwardTen: () => stepFrames(FRAME_STEPS.frameForwardTen),
|
|
29927
|
+
mute: () => player.setAudioMuted(!player.audioMuted),
|
|
29928
|
+
loop: () => player.setLoopEnabled(!player.loopEnabled),
|
|
29929
|
+
pause,
|
|
29930
|
+
shuttleBack: () => shuttleOrStep(-1),
|
|
29931
|
+
shuttleForward: () => shuttleOrStep(1)
|
|
29932
|
+
};
|
|
29933
|
+
const act = run[action];
|
|
29934
|
+
if (!act) {
|
|
29935
|
+
handleWorkAreaKey(e, action, getAdapter, seek);
|
|
29805
29936
|
return;
|
|
29806
29937
|
}
|
|
29807
|
-
|
|
29938
|
+
e.preventDefault();
|
|
29939
|
+
act();
|
|
29808
29940
|
},
|
|
29809
29941
|
[pause, shuttle, stepFrames, togglePlay, getAdapter, seek]
|
|
29810
29942
|
);
|
|
29811
29943
|
const handlePlaybackKeyUp = useCallback37((e) => {
|
|
29812
|
-
|
|
29944
|
+
heldPauseRef.current.delete(e.code || e.key);
|
|
29813
29945
|
}, []);
|
|
29814
29946
|
playbackKeyDownRef.current = handlePlaybackKeyDown;
|
|
29815
29947
|
playbackKeyUpRef.current = handlePlaybackKeyUp;
|
|
@@ -36302,11 +36434,9 @@ import { useCallback as useCallback67 } from "react";
|
|
|
36302
36434
|
import { memo as memo27, useEffect as useEffect44, useState as useState44, useCallback as useCallback54, useRef as useRef63 } from "react";
|
|
36303
36435
|
|
|
36304
36436
|
// src/captions/keyboard.ts
|
|
36305
|
-
|
|
36306
|
-
|
|
36307
|
-
|
|
36308
|
-
if (target != null && ownsPlainKeys(target)) return false;
|
|
36309
|
-
return CAPTION_NUDGE_KEYS.has(event.key);
|
|
36437
|
+
function resolveCaptionNudge(event, target) {
|
|
36438
|
+
if (target != null && ownsPlainKeys(target)) return null;
|
|
36439
|
+
return resolveCanvasNudgeDelta(event);
|
|
36310
36440
|
}
|
|
36311
36441
|
|
|
36312
36442
|
// src/captions/components/CaptionOverlayUtils.ts
|
|
@@ -36597,7 +36727,7 @@ var CaptionOverlay = memo27(function CaptionOverlay2({ iframeRef }) {
|
|
|
36597
36727
|
const handleKeyDown = (e) => {
|
|
36598
36728
|
const store = useCaptionStore.getState();
|
|
36599
36729
|
const { selectedSegmentIds: sel, model: m } = store;
|
|
36600
|
-
if (e
|
|
36730
|
+
if (matchesKey(e, "cancel")) {
|
|
36601
36731
|
if (cancelActiveDrag()) {
|
|
36602
36732
|
e.preventDefault();
|
|
36603
36733
|
scheduleTick();
|
|
@@ -36609,18 +36739,16 @@ var CaptionOverlay = memo27(function CaptionOverlay2({ iframeRef }) {
|
|
|
36609
36739
|
}
|
|
36610
36740
|
return;
|
|
36611
36741
|
}
|
|
36612
|
-
if ((e
|
|
36742
|
+
if (matchesKey(e, "captionSelectAll") && !isTypingTarget(e.target)) {
|
|
36613
36743
|
e.preventDefault();
|
|
36614
36744
|
store.selectAll();
|
|
36615
36745
|
return;
|
|
36616
36746
|
}
|
|
36617
36747
|
if (sel.size === 0 || !m) return;
|
|
36618
|
-
const
|
|
36619
|
-
if (!
|
|
36748
|
+
const nudge = resolveCaptionNudge(e, e.target);
|
|
36749
|
+
if (!nudge) return;
|
|
36620
36750
|
e.preventDefault();
|
|
36621
|
-
const
|
|
36622
|
-
const dx = arrow === "ArrowLeft" ? -step : arrow === "ArrowRight" ? step : 0;
|
|
36623
|
-
const dy = arrow === "ArrowUp" ? -step : arrow === "ArrowDown" ? step : 0;
|
|
36751
|
+
const { dx, dy } = nudge;
|
|
36624
36752
|
const iframe = iframeRef.current;
|
|
36625
36753
|
const win = iframe?.contentWindow;
|
|
36626
36754
|
if (!iframe || !win) return;
|
|
@@ -37988,7 +38116,7 @@ function useMarqueeGestures(deps) {
|
|
|
37988
38116
|
}, [reset]);
|
|
37989
38117
|
useEffect45(() => {
|
|
37990
38118
|
const cancelBandBeforeHostEscape = (e) => {
|
|
37991
|
-
if (e
|
|
38119
|
+
if (!matchesKey(e, "cancel") || !marqueeRef.current) return;
|
|
37992
38120
|
e.preventDefault();
|
|
37993
38121
|
e.stopPropagation();
|
|
37994
38122
|
cancel();
|
|
@@ -41413,26 +41541,6 @@ function createDomEditOverlayGestureHandlers(opts) {
|
|
|
41413
41541
|
|
|
41414
41542
|
// src/components/editor/useDomEditNudge.ts
|
|
41415
41543
|
import { useCallback as useCallback58, useEffect as useEffect48, useRef as useRef67 } from "react";
|
|
41416
|
-
|
|
41417
|
-
// src/components/editor/domEditNudge.ts
|
|
41418
|
-
var CANVAS_NUDGE_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
41419
|
-
var CANVAS_NUDGE_STEP_PX = 1;
|
|
41420
|
-
var CANVAS_NUDGE_SHIFT_STEP_PX = 10;
|
|
41421
|
-
var CANVAS_NUDGE_COMMIT_DEBOUNCE_MS = 400;
|
|
41422
|
-
function resolveCanvasNudgeDelta(event) {
|
|
41423
|
-
if (event.metaKey || event.ctrlKey || event.altKey) return null;
|
|
41424
|
-
if (!CANVAS_NUDGE_KEYS.has(event.key)) return null;
|
|
41425
|
-
const step = event.shiftKey ? CANVAS_NUDGE_SHIFT_STEP_PX : CANVAS_NUDGE_STEP_PX;
|
|
41426
|
-
return {
|
|
41427
|
-
dx: event.key === "ArrowLeft" ? -step : event.key === "ArrowRight" ? step : 0,
|
|
41428
|
-
dy: event.key === "ArrowUp" ? -step : event.key === "ArrowDown" ? step : 0
|
|
41429
|
-
};
|
|
41430
|
-
}
|
|
41431
|
-
function canCanvasNudgeTargets(targets) {
|
|
41432
|
-
return targets.length > 0 && targets.every((t2) => t2.capabilities.canApplyManualOffset);
|
|
41433
|
-
}
|
|
41434
|
-
|
|
41435
|
-
// src/components/editor/useDomEditNudge.ts
|
|
41436
41544
|
function selectionIdentityKey(selection) {
|
|
41437
41545
|
if (!selection) return "";
|
|
41438
41546
|
return [
|
|
@@ -42651,7 +42759,7 @@ function InlineTextCaret({
|
|
|
42651
42759
|
let side = "after";
|
|
42652
42760
|
const update = () => setPlacement(composing ? null : placeAtCaret(element, iframe, color, side));
|
|
42653
42761
|
const onKey = ({ key: key2 }) => {
|
|
42654
|
-
if (!
|
|
42762
|
+
if (!MODIFIERS2.has(key2)) side = SIDE_OF_KEY[key2] ?? "after";
|
|
42655
42763
|
};
|
|
42656
42764
|
const onPress = () => void (side = "after");
|
|
42657
42765
|
const composition = (on) => () => {
|
|
@@ -42723,7 +42831,7 @@ function caretColorOf(element) {
|
|
|
42723
42831
|
if (!style) return "currentColor";
|
|
42724
42832
|
return style.caretColor && style.caretColor !== "auto" ? style.caretColor : style.color;
|
|
42725
42833
|
}
|
|
42726
|
-
var
|
|
42834
|
+
var MODIFIERS2 = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta"]);
|
|
42727
42835
|
var SIDE_OF_KEY = { End: "before" };
|
|
42728
42836
|
function placeAtCaret(element, iframe, color, side) {
|
|
42729
42837
|
const view = element.ownerDocument.defaultView;
|
|
@@ -49281,12 +49389,12 @@ var SnapToolbar = memo32(function SnapToolbar2() {
|
|
|
49281
49389
|
if (e.defaultPrevented) return;
|
|
49282
49390
|
if (ownsPlainKeys(e.target)) return;
|
|
49283
49391
|
if (e.target instanceof HTMLIFrameElement) return;
|
|
49284
|
-
if (e
|
|
49392
|
+
if (matchesKey(e, "snap")) {
|
|
49285
49393
|
e.preventDefault();
|
|
49286
49394
|
updatePrefs({ snapEnabled: !prefs.snapEnabled });
|
|
49287
49395
|
if (!e.repeat) trackPreviewFeatureUsed("snapping", "keyboard");
|
|
49288
49396
|
}
|
|
49289
|
-
if (e
|
|
49397
|
+
if (matchesKey(e, "grid")) {
|
|
49290
49398
|
e.preventDefault();
|
|
49291
49399
|
updatePrefs({ gridVisible: !prefs.gridVisible });
|
|
49292
49400
|
if (!e.repeat) trackPreviewFeatureUsed("grid", "keyboard");
|
|
@@ -53412,7 +53520,7 @@ function EditorShellBody({
|
|
|
53412
53520
|
}, []);
|
|
53413
53521
|
const handleKeyDown = useCallback75(
|
|
53414
53522
|
(e) => {
|
|
53415
|
-
if (e
|
|
53523
|
+
if (matchesKey(e, "cancel") && compositionStack.length > 1) {
|
|
53416
53524
|
updateCompositionStack((prev) => prev.slice(0, -1));
|
|
53417
53525
|
}
|
|
53418
53526
|
},
|
|
@@ -53467,16 +53575,16 @@ function EditorShellBody({
|
|
|
53467
53575
|
}
|
|
53468
53576
|
|
|
53469
53577
|
// src/hooks/linkShortcuts.ts
|
|
53470
|
-
var
|
|
53471
|
-
|
|
53472
|
-
|
|
53473
|
-
["
|
|
53474
|
-
["
|
|
53475
|
-
["\u2325\u232B", (e) => !hasMod(e) && e.altKey && !e.shiftKey && isDeleteKey(e)]
|
|
53578
|
+
var ACTIONS = [
|
|
53579
|
+
["linkToggle", "linkToggle"],
|
|
53580
|
+
["detachAudio", "detachAudio"],
|
|
53581
|
+
["deleteLinked", "deleteLinked"],
|
|
53582
|
+
["deleteLinkedAlt", "deleteLinked"]
|
|
53476
53583
|
];
|
|
53477
|
-
|
|
53478
|
-
|
|
53479
|
-
|
|
53584
|
+
var shortcutOf = (event) => {
|
|
53585
|
+
const hit = ACTIONS.find(([action]) => matchesKey(event, action));
|
|
53586
|
+
return hit ? keyHint(hit[1]) : null;
|
|
53587
|
+
};
|
|
53480
53588
|
function dispatchLinkShortcut(event, cb) {
|
|
53481
53589
|
if (isTypingTarget(event.target)) return false;
|
|
53482
53590
|
const shortcut = shortcutOf(event);
|
|
@@ -54286,7 +54394,7 @@ function InspectorHeaderActions({
|
|
|
54286
54394
|
track2("button", "Ungroup");
|
|
54287
54395
|
onUngroup();
|
|
54288
54396
|
},
|
|
54289
|
-
title:
|
|
54397
|
+
title: `Ungroup (${keyHint("ungroup", useStudioKeys())})`,
|
|
54290
54398
|
className: "flex h-6 items-center rounded-sm px-2 text-[11px] font-medium text-neutral-400 transition-colors hover:bg-neutral-800 hover:text-neutral-200",
|
|
54291
54399
|
children: "Ungroup"
|
|
54292
54400
|
}
|
|
@@ -62832,7 +62940,7 @@ function PropertyPanelFlatHeader({
|
|
|
62832
62940
|
{
|
|
62833
62941
|
type: "button",
|
|
62834
62942
|
"aria-label": "Ungroup",
|
|
62835
|
-
title:
|
|
62943
|
+
title: `Ungroup (${keyHint("ungroup", useStudioKeys())})`,
|
|
62836
62944
|
onClick: () => {
|
|
62837
62945
|
track2("button", "Ungroup");
|
|
62838
62946
|
onUngroup?.();
|
|
@@ -78731,7 +78839,7 @@ function useTimelineDeleteOps({
|
|
|
78731
78839
|
if (rippleChanges && !rippleFailed && !rippleNoticeShownRef.current) {
|
|
78732
78840
|
rippleNoticeShownRef.current = true;
|
|
78733
78841
|
showToast(
|
|
78734
|
-
|
|
78842
|
+
`Ripple closed the gap on the main track. Undo (${keyHint("undo")}) restores it, or turn off Ripple in the timeline toolbar.`,
|
|
78735
78843
|
"info"
|
|
78736
78844
|
);
|
|
78737
78845
|
}
|
|
@@ -88771,109 +88879,103 @@ import { useCallback as useCallback155, useEffect as useEffect129, useRef as use
|
|
|
88771
88879
|
|
|
88772
88880
|
// src/hooks/appHotkeysDispatch.ts
|
|
88773
88881
|
function handleUndoRedoKey(event, onUndo, onRedo) {
|
|
88774
|
-
const
|
|
88775
|
-
if (
|
|
88776
|
-
|
|
88777
|
-
|
|
88778
|
-
|
|
88779
|
-
}
|
|
88780
|
-
if (key2 === "z" && event.shiftKey || event.ctrlKey && !event.metaKey && key2 === "y") {
|
|
88781
|
-
event.preventDefault();
|
|
88782
|
-
onRedo();
|
|
88783
|
-
return true;
|
|
88784
|
-
}
|
|
88785
|
-
return false;
|
|
88882
|
+
const isUndo = matchesKey(event, "undo");
|
|
88883
|
+
if (!isUndo && !matchesKey(event, "redo") && !matchesKey(event, "redoAlt")) return false;
|
|
88884
|
+
event.preventDefault();
|
|
88885
|
+
(isUndo ? onUndo : onRedo)();
|
|
88886
|
+
return true;
|
|
88786
88887
|
}
|
|
88787
88888
|
function timelineOwnsKey(event) {
|
|
88788
88889
|
return event.target instanceof Element && event.target.closest("[data-studio-timeline]") !== null;
|
|
88789
88890
|
}
|
|
88790
|
-
function
|
|
88791
|
-
|
|
88792
|
-
|
|
88793
|
-
|
|
88794
|
-
|
|
88795
|
-
|
|
88796
|
-
|
|
88797
|
-
|
|
88798
|
-
|
|
88799
|
-
|
|
88891
|
+
function dispatchTabKey(event) {
|
|
88892
|
+
const tab = matchesKey(event, "tabCompositions") ? ["tab_compositions", "compositions"] : matchesKey(event, "tabAssets") ? ["tab_assets", "assets"] : null;
|
|
88893
|
+
if (!tab) return false;
|
|
88894
|
+
event.preventDefault();
|
|
88895
|
+
trackStudioEvent("keyboard_shortcut", { action: tab[0] });
|
|
88896
|
+
useDockLayoutStore.getState().activatePanel(tab[1]);
|
|
88897
|
+
return true;
|
|
88898
|
+
}
|
|
88899
|
+
function dispatchGroupKey(event, cb) {
|
|
88900
|
+
const group = matchesKey(event, "group");
|
|
88901
|
+
if (!group && !matchesKey(event, "ungroup")) return false;
|
|
88902
|
+
if (isTypingTarget(event.target)) return false;
|
|
88903
|
+
event.preventDefault();
|
|
88904
|
+
if (cb.readOnlyPreview) return true;
|
|
88905
|
+
if (group) cb.onGroupSelection?.();
|
|
88906
|
+
else cb.onUngroupSelection?.();
|
|
88907
|
+
return true;
|
|
88908
|
+
}
|
|
88909
|
+
function dispatchClipboardKey(event, cb) {
|
|
88910
|
+
if (isTypingTarget(event.target)) return false;
|
|
88911
|
+
const copy = matchesKey(event, "copy");
|
|
88912
|
+
const paste = matchesKey(event, "paste");
|
|
88913
|
+
const cut = matchesKey(event, "cut");
|
|
88914
|
+
const duplicate = matchesKey(event, "duplicate");
|
|
88915
|
+
if (!copy && !paste && !cut && !duplicate) return false;
|
|
88916
|
+
if (automationOwnsKey(event)) return true;
|
|
88917
|
+
if (copy) {
|
|
88918
|
+
if (cb.handleCopy()) {
|
|
88919
|
+
event.preventDefault();
|
|
88920
|
+
trackStudioEvent("keyboard_shortcut", { action: "copy" });
|
|
88800
88921
|
}
|
|
88801
|
-
))
|
|
88802
|
-
return true;
|
|
88803
|
-
if (event.key === "1") {
|
|
88804
|
-
event.preventDefault();
|
|
88805
|
-
trackStudioEvent("keyboard_shortcut", { action: "tab_compositions" });
|
|
88806
|
-
useDockLayoutStore.getState().activatePanel("compositions");
|
|
88807
88922
|
return true;
|
|
88808
88923
|
}
|
|
88809
|
-
if (
|
|
88924
|
+
if (cb.readOnlyPreview && cb.domEditSelectionRef.current !== null && !timelineOwnsKey(event)) {
|
|
88810
88925
|
event.preventDefault();
|
|
88811
|
-
trackStudioEvent("keyboard_shortcut", { action: "tab_assets" });
|
|
88812
|
-
useDockLayoutStore.getState().activatePanel("assets");
|
|
88813
88926
|
return true;
|
|
88814
88927
|
}
|
|
88815
|
-
|
|
88928
|
+
const hasSelection = usePlayerStore.getState().selectedElementId || cb.domEditSelectionRef.current;
|
|
88929
|
+
if (paste) {
|
|
88816
88930
|
event.preventDefault();
|
|
88817
|
-
|
|
88818
|
-
|
|
88819
|
-
|
|
88820
|
-
|
|
88821
|
-
|
|
88822
|
-
|
|
88823
|
-
|
|
88824
|
-
|
|
88825
|
-
|
|
88826
|
-
|
|
88827
|
-
|
|
88828
|
-
}
|
|
88829
|
-
return true;
|
|
88830
|
-
}
|
|
88831
|
-
const previewOwnsMutation = cb.readOnlyPreview && cb.domEditSelectionRef.current !== null && !timelineOwnsKey(event);
|
|
88832
|
-
if (previewOwnsMutation && ["v", "x", "d"].includes(key2)) {
|
|
88833
|
-
event.preventDefault();
|
|
88834
|
-
return true;
|
|
88835
|
-
}
|
|
88836
|
-
if (key2 === "v") {
|
|
88837
|
-
event.preventDefault();
|
|
88838
|
-
trackStudioEvent("keyboard_shortcut", { action: "paste" });
|
|
88839
|
-
void cb.handlePaste();
|
|
88840
|
-
return true;
|
|
88841
|
-
}
|
|
88842
|
-
if (key2 === "x") {
|
|
88843
|
-
if (usePlayerStore.getState().selectedElementId || cb.domEditSelectionRef.current) {
|
|
88844
|
-
event.preventDefault();
|
|
88845
|
-
trackStudioEvent("keyboard_shortcut", { action: "cut" });
|
|
88846
|
-
void cb.handleCut();
|
|
88847
|
-
}
|
|
88848
|
-
return true;
|
|
88931
|
+
trackStudioEvent("keyboard_shortcut", { action: "paste" });
|
|
88932
|
+
void cb.handlePaste();
|
|
88933
|
+
} else if (cut && hasSelection) {
|
|
88934
|
+
event.preventDefault();
|
|
88935
|
+
trackStudioEvent("keyboard_shortcut", { action: "cut" });
|
|
88936
|
+
void cb.handleCut();
|
|
88937
|
+
} else if (duplicate) {
|
|
88938
|
+
event.preventDefault();
|
|
88939
|
+
if (usePlayerStore.getState().selectedElementId) {
|
|
88940
|
+
trackStudioEvent("keyboard_shortcut", { action: "duplicate" });
|
|
88941
|
+
void cb.handleDuplicate();
|
|
88849
88942
|
}
|
|
88850
|
-
|
|
88851
|
-
|
|
88852
|
-
|
|
88853
|
-
|
|
88854
|
-
|
|
88943
|
+
}
|
|
88944
|
+
return true;
|
|
88945
|
+
}
|
|
88946
|
+
function dispatchModifierKey(event, _key, cb) {
|
|
88947
|
+
if (!shouldIgnoreHistoryShortcut(event.target)) {
|
|
88948
|
+
const handled = handleUndoRedoKey(
|
|
88949
|
+
event,
|
|
88950
|
+
() => {
|
|
88951
|
+
trackStudioEvent("keyboard_shortcut", { action: "undo" });
|
|
88952
|
+
void cb.handleUndo();
|
|
88953
|
+
},
|
|
88954
|
+
() => {
|
|
88955
|
+
trackStudioEvent("keyboard_shortcut", { action: "redo" });
|
|
88956
|
+
void cb.handleRedo();
|
|
88855
88957
|
}
|
|
88856
|
-
|
|
88857
|
-
|
|
88958
|
+
);
|
|
88959
|
+
if (handled) return true;
|
|
88858
88960
|
}
|
|
88859
|
-
return
|
|
88961
|
+
return dispatchTabKey(event) || dispatchGroupKey(event, cb) || dispatchClipboardKey(event, cb);
|
|
88860
88962
|
}
|
|
88861
|
-
function dispatchPlainKey(event,
|
|
88963
|
+
function dispatchPlainKey(event, _key, cb) {
|
|
88862
88964
|
if (ownsPlainKeys(event.target)) return;
|
|
88863
88965
|
const keys = getStudioKeys();
|
|
88864
|
-
if (
|
|
88966
|
+
if (matchesKey(event, "zoomSelection")) {
|
|
88865
88967
|
if (!zoomTimelineToSelectedClips()) return;
|
|
88866
88968
|
event.preventDefault();
|
|
88867
88969
|
return;
|
|
88868
88970
|
}
|
|
88869
|
-
if (
|
|
88971
|
+
if (matchesKey(event, "fullscreen")) {
|
|
88870
88972
|
event.preventDefault();
|
|
88871
88973
|
if (document.fullscreenElement) void document.exitFullscreen();
|
|
88872
88974
|
else
|
|
88873
88975
|
document.querySelector("[data-studio-fullscreen-target]")?.requestFullscreen();
|
|
88874
88976
|
return;
|
|
88875
88977
|
}
|
|
88876
|
-
if (event
|
|
88978
|
+
if (matchesKey(event, "split")) {
|
|
88877
88979
|
event.preventDefault();
|
|
88878
88980
|
if (cb.readOnlyPreview) return;
|
|
88879
88981
|
const { selectedElementId, elements, currentTime } = usePlayerStore.getState();
|
|
@@ -88892,36 +88994,37 @@ function dispatchPlainKey(event, key2, cb) {
|
|
|
88892
88994
|
}
|
|
88893
88995
|
}
|
|
88894
88996
|
}
|
|
88895
|
-
if (
|
|
88997
|
+
if (matchesKey(event, "audioGain")) {
|
|
88896
88998
|
if (!cb.readOnlyPreview && openAudioGainDialog()) {
|
|
88897
88999
|
event.preventDefault();
|
|
88898
89000
|
return;
|
|
88899
89001
|
}
|
|
88900
89002
|
}
|
|
88901
|
-
if (
|
|
89003
|
+
if (matchesKey(event, "razorTool")) {
|
|
88902
89004
|
event.preventDefault();
|
|
88903
89005
|
const { activeTool, setActiveTool } = usePlayerStore.getState();
|
|
88904
89006
|
setActiveTool(activeTool === "razor" ? "select" : "razor");
|
|
88905
89007
|
return;
|
|
88906
89008
|
}
|
|
88907
|
-
if (
|
|
89009
|
+
if (matchesKey(event, "selectTool")) {
|
|
88908
89010
|
event.preventDefault();
|
|
88909
89011
|
usePlayerStore.getState().setActiveTool("select");
|
|
88910
89012
|
return;
|
|
88911
89013
|
}
|
|
88912
|
-
|
|
89014
|
+
const leftward = matchesKey(event, "selectLeftward");
|
|
89015
|
+
if (leftward || matchesKey(event, "selectRightward")) {
|
|
88913
89016
|
event.preventDefault();
|
|
88914
89017
|
const store = usePlayerStore.getState();
|
|
88915
|
-
if (
|
|
89018
|
+
if (leftward) store.selectLeftward();
|
|
88916
89019
|
else store.selectRightward();
|
|
88917
89020
|
return;
|
|
88918
89021
|
}
|
|
88919
|
-
if (razorClaimsKey(event
|
|
89022
|
+
if (razorClaimsKey(event)) {
|
|
88920
89023
|
event.preventDefault();
|
|
88921
89024
|
usePlayerStore.getState().setActiveTool("select");
|
|
88922
89025
|
return;
|
|
88923
89026
|
}
|
|
88924
|
-
if (event
|
|
89027
|
+
if (matchesKey(event, "cancel")) {
|
|
88925
89028
|
const { activeTool, selectedElementId, setActiveTool, setSelectedElementId } = usePlayerStore.getState();
|
|
88926
89029
|
if (activeTool === "razor") {
|
|
88927
89030
|
if (selectedElementId) setSelectedElementId(null);
|
|
@@ -88930,7 +89033,7 @@ function dispatchPlainKey(event, key2, cb) {
|
|
|
88930
89033
|
return;
|
|
88931
89034
|
}
|
|
88932
89035
|
}
|
|
88933
|
-
if ((event
|
|
89036
|
+
if (matchesKey(event, "deleteSelected") || matchesKey(event, "deleteSelectedAlt")) {
|
|
88934
89037
|
if (usePlayerStore.getState().selectedKeyframes.size > 0) {
|
|
88935
89038
|
cb.onDeleteSelectedKeyframes();
|
|
88936
89039
|
usePlayerStore.getState().clearSelectedKeyframes();
|
|
@@ -88938,7 +89041,7 @@ function dispatchPlainKey(event, key2, cb) {
|
|
|
88938
89041
|
return;
|
|
88939
89042
|
}
|
|
88940
89043
|
if (usePlayerStore.getState().automationSelection) return;
|
|
88941
|
-
if (event
|
|
89044
|
+
if (matchesKey(event, "resetKeyframes")) {
|
|
88942
89045
|
const { selectedElementId: selectedElementId2, keyframeCache } = usePlayerStore.getState();
|
|
88943
89046
|
if (selectedElementId2 && keyframeCache.has(selectedElementId2) && cb.onResetKeyframes()) {
|
|
88944
89047
|
event.preventDefault();
|
|
@@ -88963,7 +89066,7 @@ function dispatchPlainKey(event, key2, cb) {
|
|
|
88963
89066
|
}
|
|
88964
89067
|
return;
|
|
88965
89068
|
}
|
|
88966
|
-
if (event
|
|
89069
|
+
if (matchesKey(event, "record") && cb.onToggleRecording) {
|
|
88967
89070
|
event.preventDefault();
|
|
88968
89071
|
cb.onToggleRecording();
|
|
88969
89072
|
}
|
|
@@ -89190,10 +89293,7 @@ function useAppHotkeys({
|
|
|
89190
89293
|
const cb = cbRef.current;
|
|
89191
89294
|
const key2 = event.key.toLowerCase();
|
|
89192
89295
|
if (dispatchLinkShortcut(event, cb)) return;
|
|
89193
|
-
if (event
|
|
89194
|
-
dispatchModifierKey(event, key2, cb);
|
|
89195
|
-
return;
|
|
89196
|
-
}
|
|
89296
|
+
if (dispatchModifierKey(event, key2, cb)) return;
|
|
89197
89297
|
dispatchPlainKey(event, key2, cb);
|
|
89198
89298
|
}, []);
|
|
89199
89299
|
useEffect129(() => {
|
|
@@ -100605,8 +100705,7 @@ function useKeyframeKeyboard({ enabled, onAddKeyframe }) {
|
|
|
100605
100705
|
(e) => {
|
|
100606
100706
|
if (!enabled || !onAddKeyframe) return;
|
|
100607
100707
|
if (isTypingTarget(document.activeElement)) return;
|
|
100608
|
-
if (e
|
|
100609
|
-
if (e.key.toLowerCase() !== getStudioKey("addKeyframe")) return;
|
|
100708
|
+
if (!matchesKey(e, "addKeyframe")) return;
|
|
100610
100709
|
e.preventDefault();
|
|
100611
100710
|
e.stopImmediatePropagation();
|
|
100612
100711
|
onAddKeyframe();
|
|
@@ -100973,8 +101072,7 @@ var TimelineToolbar = memo63(function TimelineToolbar2({
|
|
|
100973
101072
|
}, [showKeyframes, setAutoKeyframeEnabled]);
|
|
100974
101073
|
useEffect159(() => {
|
|
100975
101074
|
const onKeyDown = (e) => {
|
|
100976
|
-
if (e
|
|
100977
|
-
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
101075
|
+
if (!matchesKey(e, "timelineSnap")) return;
|
|
100978
101076
|
if (isTypingTarget(e.target)) return;
|
|
100979
101077
|
const store = usePlayerStore.getState();
|
|
100980
101078
|
store.setTimelineSnapEnabled(!store.timelineSnapEnabled);
|