@rwh/keystrokes
Advanced tools
Comparing version 1.0.0-beta.8 to 1.0.0-beta.9
@@ -164,6 +164,6 @@ function $parcel$export(e, n, v, s) { | ||
// ensure all active keys are part of sequence | ||
for (const activeKey of activeKeys){ | ||
for (const activeKey1 of activeKeys){ | ||
let foundActiveKey = false; | ||
for (const unit of sequence){ | ||
for (const key of unit)if (activeKey === key) { | ||
for (const unit1 of sequence){ | ||
for (const key1 of unit1)if (activeKey1 === key1) { | ||
foundActiveKey = true; | ||
@@ -388,4 +388,4 @@ break; | ||
} | ||
for (const activeKey of this._activeKeys)this._handleKeyRelease({ | ||
key: activeKey | ||
for (const activeKey1 of this._activeKeys)this._handleKeyRelease({ | ||
key: activeKey1 | ||
}); | ||
@@ -392,0 +392,0 @@ } |
@@ -146,6 +146,6 @@ class $f323746ddedca5d6$export$7d68c18adf0621c5 { | ||
// ensure all active keys are part of sequence | ||
for (const activeKey of activeKeys){ | ||
for (const activeKey1 of activeKeys){ | ||
let foundActiveKey = false; | ||
for (const unit of sequence){ | ||
for (const key of unit)if (activeKey === key) { | ||
for (const unit1 of sequence){ | ||
for (const key1 of unit1)if (activeKey1 === key1) { | ||
foundActiveKey = true; | ||
@@ -370,4 +370,4 @@ break; | ||
} | ||
for (const activeKey of this._activeKeys)this._handleKeyRelease({ | ||
key: activeKey | ||
for (const activeKey1 of this._activeKeys)this._handleKeyRelease({ | ||
key: activeKey1 | ||
}); | ||
@@ -374,0 +374,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(){function e(e,t,s,i){Object.defineProperty(e,t,{get:s,set:i,enumerable:!0,configurable:!0})}var t={};function s(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}e(t,"setGlobalKeystrokes",(function(){return u})),e(t,"getGlobalKeystrokes",(function(){return m})),e(t,"setGlobalKeystrokesOptions",(function(){return K})),e(t,"bindKey",(function(){return b})),e(t,"unbindKey",(function(){return f})),e(t,"bindKeyCombo",(function(){return C})),e(t,"unbindKeyCombo",(function(){return p})),e(t,"checkKey",(function(){return v})),e(t,"checkKeyCombo",(function(){return k})),e(t,"normalizeKeyCombo",(function(){return S})),e(t,"stringifyKeyCombo",(function(){return P})),e(t,"parseKeyCombo",(function(){return g})),e(t,"createTestKeystrokes",(function(){return w})),e(t,"Keystrokes",(function(){return d}));class i{get isEmpty(){return!this._onPressed&&!this._onPressedWithRepeat&&!this._onReleased}isOwnHandler(e){return this._identity===e}executePressed(e){this._isPressed||this._onPressed?.(e),this._isPressed=!0,this._onPressedWithRepeat?.(e)}executeReleased(e){this._isPressed&&this._onReleased?.(e),this._isPressed=!1}constructor(e){this._isPressed=!1,this._identity=e,"function"==typeof e?this._onPressedWithRepeat=e:(this._onPressed=e.onPressed,this._onPressedWithRepeat=e.onPressedWithRepeat,this._onReleased=e.onReleased)}}class n{static parseKeyCombo(e){if(n._parseCache[e])return n._parseCache[e];const t=e.toLowerCase();let s="",i=[],o=[i],r=[o];const a=[r];let h=!1;for(let n=0;n<e.length;n+=1)"\\"===t[n]?h=!0:"+"!==t[n]&&">"!==t[n]&&","!==t[n]||h?t[n].match(/[^\s]/)&&(s&&(","===s?(i=[],o=[i],r=[o],a.push(r)):">"===s?(i=[],o=[i],r.push(o)):"+"===s&&(i=[],o.push(i)),s=""),h=!1,i.push(t[n])):s=t[n];const c=a.map((e=>e.map((e=>e.map((e=>e.join("")))))));return n._parseCache[e]=c,c}static stringifyKeyCombo(e){return e.map((e=>e.map((e=>e.map((e=>"+"===e?"\\+":">"===e?"\\>":","===e?"\\,":e)).join("+"))).join(">"))).join(",")}static normalizeKeyCombo(e){if(n._normalizationCache[e])return n._normalizationCache[e];const t=this.stringifyKeyCombo(this.parseKeyCombo(e));return n._normalizationCache[e]=t,t}get isPressed(){return!!this._isPressedWithFinalKey}isOwnHandler(e){return this._handlerState.isOwnHandler(e)}executePressed(e){this._isPressedWithFinalKey===e.key&&this._handlerState.executePressed(this._wrapEvent(e))}executeReleased(e){this._isPressedWithFinalKey===e.key&&(this._isPressedWithFinalKey="",this._handlerState.executeReleased(this._wrapEvent(e)))}updateState(e){const t=this._parsedKeyCombo[this._sequenceIndex];if(0===e.length)return;let s=0;for(const i of t){let t=s;for(const n of i){let i=!1;for(let o=s;o<e.length;o+=1){if(n===e[o]){o>t&&(t=o),i=!0;break}}if(!i)return void(this._handlerState.isEmpty&&(this._isPressedWithFinalKey=""))}s=t}for(const s of e){let e=!1;for(const i of t)for(const t of i)if(s===t){e=!0;break}if(!e)return void(this._sequenceIndex=0)}this._sequenceIndex<this._parsedKeyCombo.length-1?this._sequenceIndex+=1:(this._sequenceIndex=0,this._isPressedWithFinalKey=e[e.length-1])}_wrapEvent(e){return{keyCombo:this._normalizedKeyCombo,originalEvent:e.originalEvent}}constructor(e,t={}){this._normalizedKeyCombo=n.normalizeKeyCombo(e),this._parsedKeyCombo=n.parseKeyCombo(e),this._handlerState=new i(t),this._isPressedWithFinalKey="",this._sequenceIndex=0}}s(n,"_parseCache",{}),s(n,"_normalizationCache",{});const o="function"==typeof requestAnimationFrame?e=>requestAnimationFrame(e):e=>setTimeout(e,0),r=()=>new Promise((e=>o(e))),a=e=>{try{const t=()=>e();return addEventListener("focus",t),()=>{removeEventListener("focus",t)}}catch{}},h=e=>{try{const t=()=>e();return addEventListener("blur",t),()=>{removeEventListener("blur",t)}}catch{}},c=e=>{try{const t=t=>e({key:t.key,originalEvent:t});return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}catch{}},y=e=>{try{const t=t=>e({key:t.key,originalEvent:t});return document.addEventListener("keyup",t),()=>{document.removeEventListener("keyup",t)}}catch{}};class d{get pressedKeys(){return this._activeKeys.slice(0)}bindKey(e,t){e=e.toLowerCase();const s=new i(t);this._handlerStates[e]??=[],this._handlerStates[e].push(s)}unbindKey(e,t){e=e.toLowerCase();const s=this._handlerStates[e];if(s)if(t)for(let e=0;e<s.length;e+=1)s[e].isOwnHandler(t)&&(s.splice(e,1),e-=1);else s.length=0}bindKeyCombo(e,t){e=n.normalizeKeyCombo(e);const s=new n(e,t);this._keyComboStates[e]??=[],this._keyComboStates[e].push(s),this._keyComboStatesArray.push(s)}unbindKeyCombo(e,t){e=n.normalizeKeyCombo(e);const s=this._keyComboStates[e];if(s)if(t){for(let e=0;e<s.length;e+=1)if(s[e].isOwnHandler(t)){for(let t=0;t<this._keyComboStatesArray.length;t+=1)this._keyComboStatesArray[t]===s[e]&&(this._keyComboStatesArray.splice(t,1),t-=1);s.splice(e,1),e-=1}}else s.length=0}checkKey(e){return this._activeKeySet.has(e.toLowerCase())}checkKeyCombo(e){e=n.normalizeKeyCombo(e),this._watchedKeyComboStates[e]||(this._watchedKeyComboStates[e]=new n(e));const t=this._watchedKeyComboStates[e];return t.updateState(this._activeKeys),t.isPressed}bindEnvironment(){this.unbindEnvironment();const e=this._onActiveBinder((()=>{this._isActive=!0})),t=this._onInactiveBinder((()=>{this._isActive=!1})),s=this._onKeyPressedBinder((e=>{this._handleKeyPress(e)})),i=this._onKeyReleasedBinder((e=>{this._handleKeyRelease(e)}));this._unbinder=()=>{e?.(),t?.(),s?.(),i?.()}}unbindEnvironment(){this._unbinder?.()}_handleKeyPress(e){(async()=>{if(!this._isActive)return;let t=e.key.toLowerCase();const s=this._keyRemap[t];s&&(t=s);const i=this._handlerStates[t];if(i)for(const t of i)t.executePressed(e);this._activeKeySet.has(t)||(this._activeKeySet.add(t),this._activeKeys.push(t)),await this._updateKeyComboStates();for(const t of this._keyComboStatesArray)t.executePressed(e)})().catch((e=>{console.error(e)}))}_handleKeyRelease(e){(async()=>{const t=e.key.toLowerCase(),s=this._handlerStates[t];if(s)for(const t of s)t.executeReleased(e);if(this._activeKeySet.has(t)){this._activeKeySet.delete(t);for(let e=0;e<this._activeKeys.length;e+=1)if(this._activeKeys[e]===t){this._activeKeys.splice(e,1),e-=1;break}}this._tryReleaseSelfReleasingKeys(),await this._updateKeyComboStates();for(const t of this._keyComboStatesArray)t.executeReleased(e)})().catch((e=>{console.error(e)}))}async _updateKeyComboStates(){if(this._isUpdatingKeyComboState)return await r();this._isUpdatingKeyComboState=!0,await r();for(const e of this._keyComboStatesArray)e.updateState(this._activeKeys);this._isUpdatingKeyComboState=!1}_tryReleaseSelfReleasingKeys(){for(const e of this._activeKeys){let t=!1;for(const s of this._selfReleasingKeys)if(e===s){t=!0;break}if(!t)return}for(const e of this._activeKeys)this._handleKeyRelease({key:e})}constructor(e={}){this._isActive=!0,this._isUpdatingKeyComboState=!1,this._onActiveBinder=e.onActive??a,this._onInactiveBinder=e.onInactive??h,this._onKeyPressedBinder=e.onKeyPressed??c,this._onKeyReleasedBinder=e.onKeyReleased??y,this._selfReleasingKeys=e.selfReleasingKeys??[],this._keyRemap=e.keyRemap??{},this._handlerStates={},this._keyComboStates={},this._keyComboStatesArray=[],this._activeKeys=[],this._activeKeySet=new Set,this._watchedKeyComboStates={},this.bindEnvironment()}}let l,_;const u=e=>{_=e??new d(l)},m=()=>(_||u(),_),K=e=>{l=e},b=(...e)=>m().bindKey(...e),f=(...e)=>m().unbindKey(...e),C=(...e)=>m().bindKeyCombo(...e),p=(...e)=>m().unbindKeyCombo(...e),v=(...e)=>m().checkKey(...e),k=(...e)=>m().checkKeyCombo(...e),S=n.normalizeKeyCombo,P=n.stringifyKeyCombo,g=n.parseKeyCombo,w=()=>{let e,t,s,i;return Object.assign(new d({onActive(t){e=t},onInactive(e){t=e},onKeyPressed(e){s=e},onKeyReleased(e){i=e}}),{activate:e,deactivate:t,press:s,release:i})};window.keystrokes=t}(); | ||
!function(e,t,s,o,r){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof n[o]&&n[o],a=i.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,s){if(!a[t]){if(!e[t]){var r="function"==typeof n[o]&&n[o];if(!s&&r)return r(t,!0);if(i)return i(t,!0);if(c&&"string"==typeof t)return c(t);var h=new Error("Cannot find module '"+t+"'");throw h.code="MODULE_NOT_FOUND",h}y.resolve=function(s){var o=e[t][1][s];return null!=o?o:s},y.cache={};var l=a[t]=new d.Module(t);e[t][0].call(l.exports,y,l,l.exports,this)}return a[t].exports;function y(e){var t=y.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=i,d.register=function(t,s){e[t]=[function(e,t){t.exports=s},{}]},Object.defineProperty(d,"root",{get:function(){return n[o]}}),n[o]=d;for(var h=0;h<t.length;h++)d(t[h]);if(s){var l=d(s);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd&&define((function(){return l}))}}({"3gymj":[function(e,t,s){var o=e("./index");window.keystrokes=o},{"./index":"geiQx"}],geiQx:[function(e,t,s){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(s),o.export(s,"Keystrokes",(()=>n.Keystrokes)),o.export(s,"setGlobalKeystrokes",(()=>c)),o.export(s,"getGlobalKeystrokes",(()=>d)),o.export(s,"setGlobalKeystrokesOptions",(()=>h)),o.export(s,"bindKey",(()=>l)),o.export(s,"unbindKey",(()=>y)),o.export(s,"bindKeyCombo",(()=>u)),o.export(s,"unbindKeyCombo",(()=>f)),o.export(s,"checkKey",(()=>m)),o.export(s,"checkKeyCombo",(()=>p)),o.export(s,"normalizeKeyCombo",(()=>_)),o.export(s,"stringifyKeyCombo",(()=>b)),o.export(s,"parseKeyCombo",(()=>K)),o.export(s,"createTestKeystrokes",(()=>C));var r=e("./key-combo-state"),n=e("./keystrokes");let i,a;const c=e=>{a=e??new(0,n.Keystrokes)(i)},d=()=>(a||c(),a),h=e=>{i=e},l=(...e)=>d().bindKey(...e),y=(...e)=>d().unbindKey(...e),u=(...e)=>d().bindKeyCombo(...e),f=(...e)=>d().unbindKeyCombo(...e),m=(...e)=>d().checkKey(...e),p=(...e)=>d().checkKeyCombo(...e),_=r.KeyComboState.normalizeKeyCombo,b=r.KeyComboState.stringifyKeyCombo,K=r.KeyComboState.parseKeyCombo,C=()=>{let e,t,s,o;return Object.assign(new(0,n.Keystrokes)({onActive(t){e=t},onInactive(e){t=e},onKeyPressed(e){s=e},onKeyReleased(e){o=e}}),{activate:e,deactivate:t,press:s,release:o})}},{"./key-combo-state":"5Tr86","./keystrokes":"bJP3g","@parcel/transformer-js/src/esmodule-helpers.js":"df8iB"}],"5Tr86":[function(e,t,s){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(s),o.export(s,"KeyComboState",(()=>a));var r=e("@swc/helpers/src/_define_property.mjs"),n=o.interopDefault(r),i=e("./handler-state");class a{static parseKeyCombo(e){if(a._parseCache[e])return a._parseCache[e];const t=e.toLowerCase();let s="",o=[],r=[o],n=[r];const i=[n];let c=!1;for(let a=0;a<e.length;a+=1)"\\"===t[a]?c=!0:"+"!==t[a]&&">"!==t[a]&&","!==t[a]||c?t[a].match(/[^\s]/)&&(s&&(","===s?(o=[],r=[o],n=[r],i.push(n)):">"===s?(o=[],r=[o],n.push(r)):"+"===s&&(o=[],r.push(o)),s=""),c=!1,o.push(t[a])):s=t[a];const d=i.map((e=>e.map((e=>e.map((e=>e.join("")))))));return a._parseCache[e]=d,d}static stringifyKeyCombo(e){return e.map((e=>e.map((e=>e.map((e=>"+"===e?"\\+":">"===e?"\\>":","===e?"\\,":e)).join("+"))).join(">"))).join(",")}static normalizeKeyCombo(e){if(a._normalizationCache[e])return a._normalizationCache[e];const t=this.stringifyKeyCombo(this.parseKeyCombo(e));return a._normalizationCache[e]=t,t}get isPressed(){return!!this._isPressedWithFinalKey}isOwnHandler(e){return this._handlerState.isOwnHandler(e)}executePressed(e){this._isPressedWithFinalKey===e.key&&this._handlerState.executePressed(this._wrapEvent(e))}executeReleased(e){this._isPressedWithFinalKey===e.key&&(this._isPressedWithFinalKey="",this._handlerState.executeReleased(this._wrapEvent(e)))}updateState(e){const t=this._parsedKeyCombo[this._sequenceIndex];if(0===e.length)return;let s=0;for(const o of t){let t=s;for(const r of o){let o=!1;for(let n=s;n<e.length;n+=1){if(r===e[n]){n>t&&(t=n),o=!0;break}}if(!o)return void(this._handlerState.isEmpty&&(this._isPressedWithFinalKey=""))}s=t}for(const s of e){let e=!1;for(const o of t)for(const t of o)if(s===t){e=!0;break}if(!e)return void(this._sequenceIndex=0)}this._sequenceIndex<this._parsedKeyCombo.length-1?this._sequenceIndex+=1:(this._sequenceIndex=0,this._isPressedWithFinalKey=e[e.length-1])}_wrapEvent(e){return{keyCombo:this._normalizedKeyCombo,originalEvent:e.originalEvent}}constructor(e,t={}){this._normalizedKeyCombo=a.normalizeKeyCombo(e),this._parsedKeyCombo=a.parseKeyCombo(e),this._handlerState=new(0,i.HandlerState)(t),this._isPressedWithFinalKey="",this._sequenceIndex=0}}(0,n.default)(a,"_parseCache",{}),(0,n.default)(a,"_normalizationCache",{})},{"@swc/helpers/src/_define_property.mjs":"eRMBM","./handler-state":"aKDhB","@parcel/transformer-js/src/esmodule-helpers.js":"df8iB"}],eRMBM:[function(e,t,s){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(s),s.default=function(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}},{"@parcel/transformer-js/src/esmodule-helpers.js":"df8iB"}],df8iB:[function(e,t,s){s.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},s.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},s.exportAll=function(e,t){return Object.keys(e).forEach((function(s){"default"===s||"__esModule"===s||t.hasOwnProperty(s)||Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[s]}})})),t},s.export=function(e,t,s){Object.defineProperty(e,t,{enumerable:!0,get:s})}},{}],aKDhB:[function(e,t,s){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(s),o.export(s,"HandlerState",(()=>r));class r{get isEmpty(){return!this._onPressed&&!this._onPressedWithRepeat&&!this._onReleased}isOwnHandler(e){return this._identity===e}executePressed(e){this._isPressed||this._onPressed?.(e),this._isPressed=!0,this._onPressedWithRepeat?.(e)}executeReleased(e){this._isPressed&&this._onReleased?.(e),this._isPressed=!1}constructor(e){this._isPressed=!1,this._identity=e,"function"==typeof e?this._onPressedWithRepeat=e:(this._onPressed=e.onPressed,this._onPressedWithRepeat=e.onPressedWithRepeat,this._onReleased=e.onReleased)}}},{"@parcel/transformer-js/src/esmodule-helpers.js":"df8iB"}],bJP3g:[function(e,t,s){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(s),o.export(s,"nextTick",(()=>a)),o.export(s,"Keystrokes",(()=>y));var r=e("./handler-state"),n=e("./key-combo-state");const i="function"==typeof requestAnimationFrame?e=>requestAnimationFrame(e):e=>setTimeout(e,0),a=()=>new Promise((e=>i(e))),c=e=>{try{const t=()=>e();return addEventListener("focus",t),()=>{removeEventListener("focus",t)}}catch{}},d=e=>{try{const t=()=>e();return addEventListener("blur",t),()=>{removeEventListener("blur",t)}}catch{}},h=e=>{try{const t=t=>e({key:t.key,originalEvent:t});return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}catch{}},l=e=>{try{const t=t=>e({key:t.key,originalEvent:t});return document.addEventListener("keyup",t),()=>{document.removeEventListener("keyup",t)}}catch{}};class y{get pressedKeys(){return this._activeKeys.slice(0)}bindKey(e,t){e=e.toLowerCase();const s=new(0,r.HandlerState)(t);this._handlerStates[e]??=[],this._handlerStates[e].push(s)}unbindKey(e,t){e=e.toLowerCase();const s=this._handlerStates[e];if(s)if(t)for(let e=0;e<s.length;e+=1)s[e].isOwnHandler(t)&&(s.splice(e,1),e-=1);else s.length=0}bindKeyCombo(e,t){e=n.KeyComboState.normalizeKeyCombo(e);const s=new(0,n.KeyComboState)(e,t);this._keyComboStates[e]??=[],this._keyComboStates[e].push(s),this._keyComboStatesArray.push(s)}unbindKeyCombo(e,t){e=n.KeyComboState.normalizeKeyCombo(e);const s=this._keyComboStates[e];if(s)if(t){for(let e=0;e<s.length;e+=1)if(s[e].isOwnHandler(t)){for(let t=0;t<this._keyComboStatesArray.length;t+=1)this._keyComboStatesArray[t]===s[e]&&(this._keyComboStatesArray.splice(t,1),t-=1);s.splice(e,1),e-=1}}else s.length=0}checkKey(e){return this._activeKeySet.has(e.toLowerCase())}checkKeyCombo(e){e=n.KeyComboState.normalizeKeyCombo(e),this._watchedKeyComboStates[e]||(this._watchedKeyComboStates[e]=new(0,n.KeyComboState)(e));const t=this._watchedKeyComboStates[e];return t.updateState(this._activeKeys),t.isPressed}bindEnvironment(){this.unbindEnvironment();const e=this._onActiveBinder((()=>{this._isActive=!0})),t=this._onInactiveBinder((()=>{this._isActive=!1})),s=this._onKeyPressedBinder((e=>{this._handleKeyPress(e)})),o=this._onKeyReleasedBinder((e=>{this._handleKeyRelease(e)}));this._unbinder=()=>{e?.(),t?.(),s?.(),o?.()}}unbindEnvironment(){this._unbinder?.()}_handleKeyPress(e){(async()=>{if(!this._isActive)return;let t=e.key.toLowerCase();const s=this._keyRemap[t];s&&(t=s);const o=this._handlerStates[t];if(o)for(const t of o)t.executePressed(e);this._activeKeySet.has(t)||(this._activeKeySet.add(t),this._activeKeys.push(t)),await this._updateKeyComboStates();for(const t of this._keyComboStatesArray)t.executePressed(e)})().catch((e=>{console.error(e)}))}_handleKeyRelease(e){(async()=>{const t=e.key.toLowerCase(),s=this._handlerStates[t];if(s)for(const t of s)t.executeReleased(e);if(this._activeKeySet.has(t)){this._activeKeySet.delete(t);for(let e=0;e<this._activeKeys.length;e+=1)if(this._activeKeys[e]===t){this._activeKeys.splice(e,1),e-=1;break}}this._tryReleaseSelfReleasingKeys(),await this._updateKeyComboStates();for(const t of this._keyComboStatesArray)t.executeReleased(e)})().catch((e=>{console.error(e)}))}async _updateKeyComboStates(){if(this._isUpdatingKeyComboState)return await a();this._isUpdatingKeyComboState=!0,await a();for(const e of this._keyComboStatesArray)e.updateState(this._activeKeys);this._isUpdatingKeyComboState=!1}_tryReleaseSelfReleasingKeys(){for(const e of this._activeKeys){let t=!1;for(const s of this._selfReleasingKeys)if(e===s){t=!0;break}if(!t)return}for(const e of this._activeKeys)this._handleKeyRelease({key:e})}constructor(e={}){this._isActive=!0,this._isUpdatingKeyComboState=!1,this._onActiveBinder=e.onActive??c,this._onInactiveBinder=e.onInactive??d,this._onKeyPressedBinder=e.onKeyPressed??h,this._onKeyReleasedBinder=e.onKeyReleased??l,this._selfReleasingKeys=e.selfReleasingKeys??[],this._keyRemap=e.keyRemap??{},this._handlerStates={},this._keyComboStates={},this._keyComboStatesArray=[],this._activeKeys=[],this._activeKeySet=new Set,this._watchedKeyComboStates={},this.bindEnvironment()}}},{"./handler-state":"aKDhB","./key-combo-state":"5Tr86","@parcel/transformer-js/src/esmodule-helpers.js":"df8iB"}]},["3gymj"],"3gymj","parcelRequirefbeb"); | ||
//# sourceMappingURL=keystrokes.js.map |
{ | ||
"name": "@rwh/keystrokes", | ||
"version": "1.0.0-beta.8", | ||
"version": "1.0.0-beta.9", | ||
"description": "Keystrokes is an easy to use library for binding functions to keys and key combos. It can be used with any TypeScript or JavaScript project, even in non-browser environments.", | ||
@@ -49,5 +49,5 @@ "source": "./src/index.ts", | ||
"devDependencies": { | ||
"@parcel/core": "^2.8.3", | ||
"@parcel/packager-ts": "^2.8.3", | ||
"@parcel/transformer-typescript-types": "^2.8.3", | ||
"@parcel/core": "2.7.0", | ||
"@parcel/packager-ts": "2.7.0", | ||
"@parcel/transformer-typescript-types": "2.7.0", | ||
"@types/mocha": "^10.0.1", | ||
@@ -63,3 +63,3 @@ "@types/node": "^18.11.18", | ||
"node-static": "^0.7.11", | ||
"parcel": "^2.8.3", | ||
"parcel": "2.7.0", | ||
"prettier": "^2.8.3", | ||
@@ -73,5 +73,5 @@ "sinon": "^14.0.2", | ||
"test": "mocha -r ts-node/register ./src/tests/**/*.spec.ts", | ||
"build": "rm -rf dist/ && parcel build", | ||
"build": "rm -rf dist/ && parcel build --no-scope-hoist", | ||
"dev": "parcel build --watch" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
190889
964