videorc/ui

Hooks and libs

The small pieces videorc/ui components share. Accelerators, platform glyphs, the modal check, the theme toggle and reduced motion.

These are plain TypeScript, with no Next.js and no Electron in them. The libs are pure functions you can call anywhere, including Electron's main process; the hooks need React. Components install the ones they use, and you can install any of them on its own.

ItemPathWhat it does
Acceleratorlib/accelerator.tsParses Electron accelerators and prints them per platform: ⇧⌘J on macOS, Ctrl+Shift+J elsewhere
Platformlib/platform.tsWorks out the platform, and gives shortcut labels and OS words such as Finder and Trash
Modal openlib/modal-open.tsTells a global key whether a dialog, menu or select is open, so it doesn't fire from under one
useThemeTogglehooks/use-theme-toggle.tsToggles light and dark with a button and the D key, handing back to System when it can
useReducedMotionhooks/use-reduced-motion.tsTrue when the system asks to reduce motion, plus a scroll behavior that respects it
Status wordlib/status-word.tsThe status tones and their chip utilities, and the guard that a status says a word, never a raw value