spatial-navigation
Version:
A javascript-based implementation of Spatial Navigation.
1 lines • 21.1 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.spatialNavigation=t():e.spatialNavigation=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Element=t.Container=t.ElementCollection=t.ContainerCollection=t.EventAggregator=t.Keyboard=void 0;var o=n(14),r=(i(o),n(5)),a=i(r),u=n(1),s=i(u),l=n(7),c=i(l),f=n(4),d=i(f),h=n(3),p=i(h),v=n(11),y=i(v);t.Keyboard=a.default,t.EventAggregator=s.default,t.ContainerCollection=c.default,t.ElementCollection=d.default,t.Container=p.default,t.Element=y.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.EventAggregator=t.EVENT_PREFIX=void 0;var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(13),u=i(a),s=n(2),l=function(){function e(){o(this,e),this.events=[]}return r(e,[{key:"getEvent",value:function(e){return this.events.find(function(t){var n=t.name;return n===e})}},{key:"dispatchEvent",value:function(e){var t,n=this.getEvent(e);n||(n=new u.default(e),this.events.push(n));for(var i=arguments.length,o=Array(i>1?i-1:0),r=1;i>r;r++)o[r-1]=arguments[r];(t=n).call.apply(t,o)}},{key:"subscribe",value:function(e,t,n){var i=this.getEvent(e);return i||(i=new u.default(e),this.events.push(i)),i.addHandler(t,n),{event:i,handler:t}}},{key:"once",value:function(e,t,n){var i=this.getEvent(e);i||(i=new u.default(e),this.events.push(i));var o=function e(){var o=t.apply(void 0,arguments);o&&i.removeHandler(e,n)};return i.addHandler(o,n),{event:i,handlerWrapper:o}}}]),e}();t.default=new l,t.EVENT_PREFIX=s.EVENT_PREFIX,t.EventAggregator=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LOG_LEVEL="DEBUG",t.EVENT_PREFIX="sn:",t.EVENT_DELAY=180},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(1),u=i(a),s=n(5),l=i(s),c=n(4),f=i(c),d=n(8),h=i(d),p=n(2),v=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.map,a=void 0===r?{}:r,s=i.keyBindings,l=i.autoFocus;o(this,e),this.name=t,this.disabled=!1,this.focused=!1,this.collection=new f.default(this),this.leaveFor=a,l&&u.default.once(p.EVENT_PREFIX+"addElement",function(e){return(n===e||n===e.getContainer())&&(n.focus(),!0)}),s&&this.bindKeyAction(s)}return r(e,[{key:"bindKeyAction",value:function(e){var t=l.default.addToMap(e);h.default.addRelation(t,this)}},{key:"disable",value:function(){this.disabled=!0}},{key:"enable",value:function(){this.disabled=!1}},{key:"focus",value:function(){this.focused=!0,this.collection.focus(),u.default.dispatchEvent(p.EVENT_PREFIX+"focusContainer",this)}},{key:"blur",value:function(){this.focused=!1,u.default.dispatchEvent(p.EVENT_PREFIX+"blurContainer",this)}}]),e}();v.create=function(e,t){return new v(e,t)},t.default=v,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,i)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(i):void 0},l=n(1),c=(i(l),n(2),n(6)),f=i(c),d=n(3),h=(i(d),function(e){function t(e,n){o(this,t);var i=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.parent=e,i.settings=n,i.focusedIndex=null,i.eventAggregator=new l.EventAggregator,i.lazyLoading=!1,i.onLazyLoad=null,i}return a(t,e),u(t,[{key:"_extendElement",value:function(e){e.parent=this.parent}},{key:"unshift",value:function(e){return this._extendElement(e),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"unshift",this).call(this,e),e}},{key:"push",value:function(e){return this._extendElement(e),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"push",this).call(this,e),e}},{key:"focus",value:function(){if("Container"===this.parent.constructor.name&&!this.length)throw Error("You must add at least one element to each container. Check "+this.parent.name+" container");var e=void 0;if(null===this.focusedIndex)this.focusedIndex=e=0;else switch(this.enterTo){case"first":e=0;break;case"last":e=this.length-1;break;default:e=this.focusedIndex}var t=this.getByIndex(e);t.focus()}},{key:"getIndex",value:function(e){return this.indexOf(e)}},{key:"setFocusedIndex",value:function(e){this.focusedIndex=this.getIndex(e)}},{key:"lazyLoad",value:function(){var e=this;"function"!=typeof this.onLazyLoad||this.lazyLoading||(this.lazyLoading=!0,this.onLazyLoad(function(){e.lazyLoading=!1}))}},{key:"subscribeLazyLoad",value:function(e){this.onLazyLoad=e}}]),t}(f.default));t.default=h,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(1),u=i(a),s=n(2),l=function(){function e(){o(this,e),this.normalizedMap={},this.bindListeners()}return r(e,[{key:"addToMap",value:function(t){var n=this,i={};return"Array"!==t.constructor.name&&(t=[t]),t.forEach(function(t){var o=e.getEventKey(t.keyCode,t.modifier);!(o in n.normalizedMap)||console.warn("Keymap "+o+" already exists"),n.normalizedMap[o]=t,i[o]=t}),i}},{key:"bindListeners",value:function(){var t=e.throttle(this.keyPress.bind(this),s.EVENT_DELAY);window.addEventListener("keydown",t),window.addEventListener("keyup",t.finish)}},{key:"keyPress",value:function(t){var n=e.getEventKey(t.keyCode,t);if(!(n in this.normalizedMap&&e.getModifier(t,this.normalizedMap[n].modifier)))return!0;t.preventDefault(),u.default.dispatchEvent(s.EVENT_PREFIX+"keypress",n);var i=this.normalizedMap[n].name;return!i||(u.default.dispatchEvent(s.EVENT_PREFIX+"navigate",i),u.default.dispatchEvent(""+s.EVENT_PREFIX+i)),!0}}],[{key:"getEventKey",value:function(e,t){var n=[e];return t&&"KeyboardEvent"===t.constructor.name?t.metaKey?n.push("meta"):t.ctrlKey?n.push("ctrl"):t.shiftKey?n.push("shift"):t.altKey&&n.push("alt"):!t||n.push(t),n.join("|")}},{key:"getModifier",value:function(e,t){switch(t){case"meta":return e.metaKey;case"ctrl":return e.ctrlKey;case"shift":return e.shiftKey;case"alt":return e.altKey;default:return!0}}}]),e}();l.throttle=function(e,t){var n=null,i=!1,o=void 0,r=function(){n=null,i=!1},a=function(r){var a=this,u=l.getEventKey(r.keyCode,r);(n!==u||u.match(/\|/))&&(e.call(this,r),n=u),i||(i=!0,o=setTimeout(function(){i=!e.call(a,r)},t))};return a.__proto__.finish=function(){r(),clearTimeout(o)},a},t.default=new l,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(){n(this,e),this.items=[],this.itemIds={}}return i(e,[{key:"add",value:function(e,t){if(this.push(e),"Element"===e.constructor.name)return e;if("Container"===e.constructor.name&&!t)throw Error("You must pass name of item you try add to Collection");return this.itemIds||(this.itemIds={}),t in this.itemIds&&console.warn('Item with name "'+t+'" already exists in Collection'),this.itemIds[t]=this.items.length-1,e}},{key:"unshift",value:function(e){return this.items.unshift(e),e}},{key:"push",value:function(e){return this.items.push(e),e}},{key:"indexOf",value:function(e){return this.items.indexOf(e)}},{key:"getByIndex",value:function(e){return this.items[e]}},{key:"getByName",value:function(e){return this.items[this.itemIds[e]]}},{key:"isExists",value:function(e){return!!this.getByName(e)}},{key:"length",get:function(){return this.items.length}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=n(6),s=i(u),l=n(1),c=function(e){function t(){o(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.eventAggregator=new l.EventAggregator,e}return a(t,e),t}(s.default);t.default=new c,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(1),u=i(a),s=n(9),l=i(s),c=function(){function e(){o(this,e),this.map={},this.bindListeners()}return r(e,[{key:"bindListeners",value:function(){u.default.subscribe(a.EVENT_PREFIX+"keypress",this.navigate.bind(this))}},{key:"navigate",value:function(e){var t=this.getInstance(e);if(t){var n=l.default.focusedElement,i=u.default.subscribe(a.EVENT_PREFIX+"esc",function(){n.focus()}),o=i.event,r=i.handler;u.default.once(a.EVENT_PREFIX+"blurElement",function(e){if(t==e)return o.removeHandler(r),!0}),t.focus()}}},{key:"addRelation",value:function(e,t){for(var n in e)this.map[n]=t}},{key:"getInstance",value:function(e){return this.map[e]}}]),e}();t.default=new c,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(1),u=i(a),s=n(2),l=n(3),c=(i(l),n(10)),f=i(c),d=n(12),h=i(d),p=function(){function e(){o(this,e),this.focusedElement=null,this.bindListeners()}return r(e,[{key:"bindListeners",value:function(){u.default.subscribe(s.EVENT_PREFIX+"navigate",this.navigate.bind(this)),u.default.subscribe(s.EVENT_PREFIX+"focusElement",this.setFocusedElement.bind(this))}},{key:"navigate",value:function(e){if(~["up","down","left","right"].indexOf(e)){var t=this.getInstanceToFocus(e);t&&this.focusInstance(t)}}},{key:"getInstanceToFocus",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.focusedElement;if(!t)return null;var n=h.default.getToNavigate(t,e);if(!n){if("Container"!==t.parent.constructor.name)return this.getInstanceToFocus(e,t.parent);n=f.default.getToNavigate(t.parent,e)}return n}},{key:"focusInstance",value:function(e){var t=this.focusedElement;e.focus(),e.parent&&e.parent.collection&&e.parent.collection.eventAggregator.dispatchEvent("onNavigate"),t&&e.parent&&t.parent&&e.parent!=t.parent&&e.parent.parent&&e.parent.parent.collection&&e.parent.parent.collection.eventAggregator.dispatchEvent("onNavigate")}},{key:"setFocusedElement",value:function(e){this.focusedElement=e}}]),e}();t.default=new p,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(7),u=i(a),s=function(){function e(){o(this,e)}return r(e,[{key:"getToNavigate",value:function(e,t){var n=e.leaveFor[t],i=u.default.getByName(n);return!i||!i.disabled&&i.collection.length?i:this.getToNavigate(i,t)}}]),e}();t.default=new s,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(1),u=i(a),s=n(4),l=i(s),c=n(8),f=i(c),d=n(3),h=(i(d),n(5)),p=i(h),v=n(9),y=i(v),b=n(2),g=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.keyBindings,a=i.autoFocus,u=i.hasCollection,s=i.collectionSettings;o(this,e),this.domEl=t||null,this.disabled=!1,this.parent=null,this.collection=u||s?new l.default(this,s):null,t&&this.connectDomEl(t),r&&this.bindKeyAction(r),a&&(this.collection?this.collection.eventAggregator.once(b.EVENT_PREFIX+"addElement",function(e){return e===n&&(n.focus(),!0)}):this.focus())}return r(e,[{key:"connectDomEl",value:function(e){this.domEl=e,this.designDomEl(),this.bindListeners()}},{key:"designDomEl",value:function(){this.domEl.setAttribute("tabindex","-1"),this.domEl.style.outline="none"}},{key:"bindListeners",value:function(){this.domEl.addEventListener("click",this.onUserClick.bind(this))}},{key:"unbindListeners",value:function(){this.domEl.removeEventListener("click",this.onUserClick.bind(this))}},{key:"bindKeyAction",value:function(e){var t=p.default.addToMap(e);f.default.addRelation(t,this)}},{key:"disable",value:function(){this.disabled=!0}},{key:"enable",value:function(){this.disabled=!1}},{key:"focus",value:function(){if(this.collection)this.collection.focus();else{if(this.domEl.focus(),this.parent.collection.setFocusedIndex(this),"Element"===this.parent.constructor.name&&this.parent.parent.collection.setFocusedIndex(this.parent),y.default.focusedElement){var e=y.default.focusedElement.getContainer();e!=this.getContainer()&&e.blur()}u.default.dispatchEvent(b.EVENT_PREFIX+"focusElement",this)}}},{key:"onUserClick",value:function(e){e.stopPropagation(),this.disabled||this.collection||y.default.focusInstance(this)}},{key:"blur",value:function(){this.domEl.blur(),u.default.dispatchEvent(b.EVENT_PREFIX+"blurElement",this)}},{key:"getContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;return e&&"Container"===e.constructor.name?e:this.getContainer(e.parent)}},{key:"destroy",value:function(){this.unbindListeners()}}]),e}();g.create=function(e,t){return new g(e,t)},t.default=g,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(){n(this,e)}return i(e,[{key:"getToNavigate",value:function(e,t){var n=void 0,i=this.getCountInRow(e.parent.collection),o=e.parent.collection.getIndex(e);switch(t){case"up":case"down":if("up"===t)n=e.parent.collection.getByIndex(o-i);else{var r=o+i,a=Math.ceil(e.parent.collection.length/i)*i,u=e.parent.collection.length-1;r>u&&a>r&&(r=u),n=e.parent.collection.getByIndex(r)}break;case"left":o%i!==0&&(n=e.parent.collection.getByIndex(--o));break;case"right":(o+1)%i!==0&&(n=e.parent.collection.getByIndex(++o))}if(n&&n.parent.collection.settings&&n.parent.collection.settings.lazy&&n.parent.collection.settings.lazy[t]){var s=this.getCountFromEnd(n,t);n.parent.collection.settings.lazy[t].fromEnd===s&&n.parent.collection.lazyLoad()}return n&&n.disabled?this.getToNavigate(n,t):n}},{key:"getCountFromEnd",value:function(e,t){var n=this.getCountInRow(e.parent.collection),i=e.parent.collection.getIndex(e),o=i%n,r=n-(o+1);return r}},{key:"getCountInRow",value:function(e){for(var t=1,n=e.items[0].domEl.offsetLeft,i=1;;i++){var o=e.items[i];if(!o||n>=o.domEl.offsetLeft)return t;n=o.domEl.offsetLeft,t++}}}]),e}();t.default=new o,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(){n(this,e),this.propagationStopped=!1}return i(e,[{key:"isPropagationStopped",value:function(){return this.propagationStopped}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}}]),e}(),r=function(){function e(t){n(this,e),this.name=t,this.handlers={}}return i(e,[{key:"addHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;t in this.handlers||(this.handlers[t+""]=[]),this.handlers[t+""].push(e)}},{key:"removeHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;t in this.handlers||(this.handlers[t+""]=[]);var n=this.handlers[t].indexOf(e);if(~n)return this.handlers[t].splice(n,1)}},{key:"call",value:function(e){if(Object.keys(this.handlers).length){var t=new o;for(var n in this.handlers)this.handlers.hasOwnProperty(n)&&(t.isPropagationStopped()||this.handlers[n].forEach(function(n){n(e,t)}))}}}]),e}();t.default=r,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(){n(this,e),this.bindListeners()}return i(e,[{key:"preventDefault",value:function(e){e.preventDefault()}},{key:"bindListeners",value:function(){document.addEventListener("mousedown",this.preventDefault),document.addEventListener("mouseup",this.preventDefault),document.addEventListener("click",this.preventDefault),document.addEventListener("dblclick",this.preventDefault)}}]),e}();t.default=new o,e.exports=t.default}])});