fix(shortcuts): keep shortcut contract in config/ (Rust include_str! path)

The shortcut contract (shortcutActions.ts + shortcutTypes.ts) is NOT a
pure-frontend file: src-tauri/src/cli/parse.rs include_str!s
'/../src/config/shortcutActions.ts' at compile time, so moving it to
lib/shortcuts/ (slice 7ad19671) broke the Rust build (couldn't read the file ->
dev build won't start). Revert the contract back to src/config/ — it has a
build-time backend path contract and belongs where Rust anchors it, not in lib/.
No Rust file touched (fix = restore the frontend path the backend expects).

cargo check green (13s), tsc 0, lint 0/0, frontend suite 319/2353 green.

Lesson: grep src-tauri for include_str!/include_bytes! '../src/...' before
moving ANY frontend file — Rust can pin a TS file by path.
This commit is contained in:
Psychotoxical
2026-06-30 08:46:59 +02:00
parent d5bbabac1d
commit a27b26abbd
13 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ import { usePlayerStore } from '../store/playerStore';
import { usePreviewStore } from '../store/previewStore';
import { useLyricsStore } from '../store/lyricsStore';
import { showToast } from '../utils/ui/toast';
import type { ActionContext, ShortcutSlot, ShortcutActionMeta } from '@/lib/shortcuts/shortcutTypes';
import type { ActionContext, ShortcutSlot, ShortcutActionMeta } from '@/config/shortcutTypes';
let cliPremuteVolume: number | null = null;
@@ -48,7 +48,7 @@ export type {
ActionContext,
CliContext,
ShortcutActionMeta,
} from '@/lib/shortcuts/shortcutTypes';
} from '@/config/shortcutTypes';
export {
SHORTCUT_ACTION_REGISTRY,
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ShortcutSlot } from '@/lib/shortcuts/shortcutTypes';
import type { ShortcutSlot } from '@/config/shortcutTypes';
import {
SHORTCUT_ACTION_REGISTRY,
type ShortcutAction,
+1 -1
View File
@@ -3,7 +3,7 @@ import i18n from '@/lib/i18n';
import { usePlayerStore } from '../store/playerStore';
import { showToast } from '../utils/ui/toast';
import { playByOpaqueId } from '../utils/playback/playByOpaqueId';
import type { ActionContext, CliContext } from '@/lib/shortcuts/shortcutTypes';
import type { ActionContext, CliContext } from '@/config/shortcutTypes';
import {
SHORTCUT_ACTION_REGISTRY,
type ShortcutAction,
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Keyboard, RotateCcw, X } from 'lucide-react';
import { IN_APP_SHORTCUT_ACTIONS, GLOBAL_SHORTCUT_ACTIONS } from '@/lib/shortcuts/shortcutActions';
import { IN_APP_SHORTCUT_ACTIONS, GLOBAL_SHORTCUT_ACTIONS } from '@/config/shortcutActions';
import { useGlobalShortcutsStore, type GlobalAction, buildGlobalShortcut, formatGlobalShortcut } from '@/store/globalShortcutsStore';
import { useKeybindingsStore, type KeyAction, buildInAppBinding, formatBinding } from '@/store/keybindingsStore';
import SettingsSubSection from '@/features/settings/components/SettingsSubSection';
@@ -1,5 +1,5 @@
import type { TFunction } from 'i18next';
import { GLOBAL_SHORTCUT_ACTIONS, IN_APP_SHORTCUT_ACTIONS } from '@/lib/shortcuts/shortcutActions';
import { GLOBAL_SHORTCUT_ACTIONS, IN_APP_SHORTCUT_ACTIONS } from '@/config/shortcutActions';
import { SETTINGS_INDEX, matchScore, type Tab } from '@/features/settings/components/settingsTabs';
export type SettingsSearchHit = {
+1 -1
View File
@@ -13,7 +13,7 @@ import { switchActiveServer } from '../../utils/server/switchActiveServer';
import i18n from '@/lib/i18n';
import { usePlayerStore } from '../../store/playerStore';
import { useAuthStore } from '../../store/authStore';
import { executeCliPlayerCommand } from '@/lib/shortcuts/shortcutActions';
import { executeCliPlayerCommand } from '@/config/shortcutActions';
/** The full `cli:*` listener surface forwarded from the Rust single-instance
* handler: audio-device, instant-mix, library / server resolution, search and
+1 -1
View File
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
import type { NavigateFunction } from 'react-router-dom';
import { useKeybindingsStore, buildInAppBinding } from '../../store/keybindingsStore';
import { useGlobalShortcutsStore } from '../../store/globalShortcutsStore';
import { DEFAULT_IN_APP_BINDINGS, executeRuntimeAction } from '@/lib/shortcuts/shortcutActions';
import { DEFAULT_IN_APP_BINDINGS, executeRuntimeAction } from '@/config/shortcutActions';
import { matchInAppShortcutAction } from '../../shortcuts/runtime';
/** Configurable in-app keybindings: matches keydown chords against the user's
@@ -16,7 +16,7 @@ import {
executeRuntimeAction,
isGlobalShortcutActionId,
isShortcutAction,
} from '@/lib/shortcuts/shortcutActions';
} from '@/config/shortcutActions';
/** Media keys, tray actions, global / cross-window shortcut events, relative &
* absolute seek + volume, and the window-close / force-quit exit flow. */
+1 -1
View File
@@ -1,5 +1,5 @@
import { matchInAppBinding, type Bindings } from '../store/keybindingsStore';
import type { KeyAction } from '@/lib/shortcuts/shortcutActions';
import type { KeyAction } from '@/config/shortcutActions';
export function matchInAppShortcutAction(
event: KeyboardEvent,
+2 -2
View File
@@ -2,7 +2,7 @@ import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { invoke } from '@tauri-apps/api/core';
import { MODIFIER_KEY_CODES, formatBinding } from './keybindingsStore';
import { DEFAULT_GLOBAL_SHORTCUTS, isGlobalShortcutActionId, type GlobalAction } from '@/lib/shortcuts/shortcutActions';
import { DEFAULT_GLOBAL_SHORTCUTS, isGlobalShortcutActionId, type GlobalAction } from '@/config/shortcutActions';
/** Dev builds run alongside release — OS-level grabs stay on the release instance. */
const GLOBAL_SHORTCUTS_OS_ENABLED = !import.meta.env.DEV;
@@ -101,4 +101,4 @@ export const useGlobalShortcutsStore = create<GlobalShortcutsState>()(
)
);
export type { GlobalAction } from '@/lib/shortcuts/shortcutActions';
export type { GlobalAction } from '@/config/shortcutActions';
+2 -2
View File
@@ -1,6 +1,6 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { DEFAULT_IN_APP_BINDINGS, type KeyAction } from '@/lib/shortcuts/shortcutActions';
import { DEFAULT_IN_APP_BINDINGS, type KeyAction } from '@/config/shortcutActions';
/** Physical keys only — ignore for binding capture */
export const MODIFIER_KEY_CODES = [
@@ -12,7 +12,7 @@ export const MODIFIER_KEY_CODES = [
export type Bindings = Record<KeyAction, string | null>;
export const DEFAULT_BINDINGS: Bindings = { ...DEFAULT_IN_APP_BINDINGS };
export type { KeyAction } from '@/lib/shortcuts/shortcutActions';
export type { KeyAction } from '@/config/shortcutActions';
function normalizeBindings(
bindings: Partial<Record<KeyAction, string | null>> | undefined