UNPKG

use-keybinds

Version:

Lightweight keybind library for React

3 lines 499 B
"use client" import c,{createContext as a,useMemo as K}from"react";var r=(e,n)=>(n?"isSequential-":"")+e.join("");var m=a({keybinds:{},combinationsToKeybindKey:{}}),g=e=>{let{children:n,keybinds:i={}}=e,s=K(()=>Object.entries(i).reduce((d,t)=>{let b=t[0],o=t[1],y=r(o.keybind,o.isSequential);return{...d,[y]:b}},{}),[i]);return c.createElement(m.Provider,{value:{keybinds:i,combinationsToKeybindKey:s}},n)},S=g;export{m as KeybindsContext,S as default}; //# sourceMappingURL=KeybindsProvider.mjs.map