export { DefaultMagicKeysAliasMap } from './aliasMap.js'; import { Accessor } from 'solid-js'; import { MaybeAccessor } from '@solidjs-use/shared'; interface UseMagicKeysOptions { /** * Target for listening events * * @default window */ target?: MaybeAccessor; /** * Alias map for keys, all the keys should be lowercase * { target: keycode } * * @example { ctrl: "control" } * @default */ aliasMap?: Record; /** * Register passive listener * * @default true */ passive?: boolean; /** * Custom event handler for keydown/keyup event. * Useful when you want to apply custom logic. * * When using `e.preventDefault()`, you will need to pass `passive: false` to useMagicKeys(). */ onEventFired?: (e: KeyboardEvent) => void | boolean; } interface MagicKeysInternal { /** * A Set of currently pressed keys, * Stores raw keyCodes. * * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key */ current: Set; } type UseMagicKeysReturn = Readonly>, keyof MagicKeysInternal> & MagicKeysInternal>; declare const getSetCompat: () => { value(): T[]; add: (val: T) => undefined; has: (val: T) => boolean; delete: (val: T) => boolean; clear: () => void; }; /** * Reactive keys pressed state, with magical keys combination support. * * @see https://solidjs-use.github.io/solidjs-use/core/useMagicKeys */ declare function useMagicKeys(options?: UseMagicKeysOptions): UseMagicKeysReturn; declare function useMagicKeys(options: UseMagicKeysOptions): UseMagicKeysReturn; export { MagicKeysInternal, UseMagicKeysOptions, UseMagicKeysReturn, getSetCompat, useMagicKeys };