2 lines
1017 B
JavaScript
2 lines
1017 B
JavaScript
import{V as o}from"./index.710b8de0.js";function f(n,e,t=1){const i=e!==void 0?n:0;if(e=e!==void 0?e:n,e==i)return[];const s=e>i?1:-1;return[...Array(Math.floor(Math.abs(e-i)/t))].map((d,r)=>i+r*t*s)}function h(n,e,t){return n>t?t:n<e?e:n}class c extends o{constructor(){super(...arguments),this.keybinds={},this._keybinds={}}initKeybinds(){}mounted(){document.addEventListener("keydown",this.keyListener),this.initKeybinds(),Object.keys(this.keybinds).forEach(e=>this._keybinds[e.toLowerCase()]=this.keybinds[e])}unmounted(){document.removeEventListener("keydown",this.keyListener)}keyListener(e){let t=e.key;e.shiftKey&&(t="Shift"+t),e.altKey&&(t="Alt"+t),e.ctrlKey&&(t="Ctrl"+t),e.metaKey&&(t="Cmd"+t),t=t.toLowerCase(),console.log(t),t in this._keybinds&&this._keybinds[t](e)!==!1&&e.preventDefault()}}function a(n){return n.charAt(0).toUpperCase()+n.slice(1)}function l(n){let e=n.length,t;for(;e!=0;)t=Math.floor(Math.random()*e),e--,[n[e],n[t]]=[n[t],n[e]];return n}export{c as K,a as c,h as m,f as r,l as s};
|