hotkeys/types.ts

www-sacred · modules/hotkeys/types.ts · typescript · MIT
ui

Type definitions for keyboard shortcut handling in React applications.

// Source: https://github.com/internet-development/www-sacred | License: MIT | Copyright 2024 INTERNET DEVELOPMENT STUDIO COMPANY
// Provided via justclaw.it.com; keep this notice with the code.
//NOTE(jimmylee): vendored from https://github.com/JohannesKlauss/react-hotkeys-hook/blob/main/src/types.ts
import type { DependencyList } from 'react'

export type FormTags = 'input' | 'textarea' | 'select' | 'INPUT' | 'TEXTAREA' | 'SELECT'
export type Keys = string | readonly string[]
export type Scopes = string | readonly string[]

export type RefType<T> = T | null

export type KeyboardModifiers = {
  alt?: boolean
  ctrl?: boolean
  meta?: boolean
  shift?: boolean
  mod?: boolean
}

export type Hotkey = KeyboardModifiers & {
  keys?: readonly string[]
  scopes?: Scopes
  description?: string
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key