Socket
Socket
Sign inDemoInstall

pulling

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pulling - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

build/transforms/index.js

4

build/pulling-drawer.js

@@ -28,6 +28,6 @@ (function (global, factory) {

Element.prototype.oMatchesSelector;
Object.entries = Object.entries || (function (obj) {
Object.entries = /* Object.entries || */ (function (obj) {
return Object.keys(obj).map(function (key) { return [key, obj[key]]; });
});
Object.values = Object.values || (function (obj) {
Object.values = /* Object.values || */ (function (obj) {
return Object.keys(obj).map(function (key) { return obj[key]; });

@@ -34,0 +34,0 @@ });

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pulling",e):t.Pulling=e()}(this,function(){"use strict";function t(t,e){function n(){this.constructor=t}for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function e(t,e){if(!t)throw TypeError("Invalid arguments: "+e)}var n=["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"],s=function(e){function n(t){var n=e.call(this,t)||this;return n.touched=!1,n.ignores=[],n.ignoreSelector="",n.touch=!1!==t.touch,n.touch&&n.addTouchEvents(),n}return t(n,e),n.prototype.applyOffset=function(t){},n.prototype.initTouchEvents=function(){var t=this,e=this,n=e.width,s=e.margin,i=e.side,o=e.slope,r=e.sensitivity,u=e.menu,h=e.panel,a="left"===i?1:-1,c=0,l=0,d=0,p=0,m=0,f=0,y=0,v=!1;return{onTouchstart:function(e){if(!(t.ignoreSelector&&e.target.matches(t.ignoreSelector)||(t.emit("touchstart",e),t.disabled||(t.touched=!1,1!==e.touches.length)))){var n=e.touches[0],o=n.clientX,r=n.clientY,u=t.offset(),h=s+u;("left"===i&&o<=h||"right"===i&&window.innerWidth-o<=h)&&(t.touched=!0,c=o,l=r,d=o,p=u,f=Date.now(),v=!0)}},onTouchmove:function(e){if(t.emit("touchmove",e),!t.disabled&&t.touched){var s=e.touches[0],i=s.clientX,r=s.clientY,g=(i-c)*a;if(!(Math.abs(g)<10)){if(v){var b=r-l;if(Math.abs(b/g)>o)return void(t.touched=!1);t.state.closed&&g>0?t.emit("beforeopen"):t.state.opened&&t.emit("beforeopen"),u.style.transition=null,h.style.transition=null}if(t.state.opened&&g>0||t.state.closed&&g<0)return d=i,void(f=Date.now());t.state.opened=!1,t.state.closed=!1;var E=(i-d)*a>0;t.state.opening=E,t.state.closing=!E;var w=Math.min(Math.max(0,p+g),n);t.applyOffset(w),y=d,d=i,m=f,f=Date.now(),v=!1}}},onTouchend:function(e){if(t.touched&&(t.touched=!1,!v)){t.emit("touchend",e),Object.assign(t.panel.style,t.styles.base.panel),Object.assign(t.menu.style,t.styles.base.menu);var s,i,o=t.offset(),u=e.changedTouches[0].clientX;u===d?(s=y,i=m):(s=d,i=f);var h=(u-s)/(Date.now()-i)*a;o>n/2&&h>-r||h>r?t.open(e):t.close(e)}}}},n.prototype.addTouchEvents=function(){this.touchEvents||(this.touchEvents=this.initTouchEvents()),document.documentElement.addEventListener("touchstart",this.touchEvents.onTouchstart,!1),document.documentElement.addEventListener("touchmove",this.touchEvents.onTouchmove,!1),document.documentElement.addEventListener("touchend",this.touchEvents.onTouchend,!1)},n.prototype.removeTouchEvents=function(){document.documentElement.removeEventListener("touchstart",this.touchEvents.onTouchstart),document.documentElement.removeEventListener("touchmove",this.touchEvents.onTouchmove),document.documentElement.removeEventListener("touchend",this.touchEvents.onTouchend)},n.prototype.ignore=function(t){return this.ignores.push(t),this.ignoreSelector=this.ignores.join(", "),this},n.prototype.unignore=function(t){return this.ignores=this.ignores.filter(function(e){return e!==t}),this.ignoreSelector=this.ignores.join(", "),this},n.prototype.enableTouch=function(){return this.touch||(this.addTouchEvents(),this.touch=!0),this},n.prototype.disableTouch=function(){return this.touch&&(this.removeTouchEvents(),this.touch=!1),this},n}(function(){function t(s){var i=this;if(this.styles={base:{menu:{},panel:{}},open:{menu:{},panel:{}},closed:{menu:{},panel:{}}},this.handlers={beforeclose:[],closed:[],beforeopen:[],opened:[],touchstart:[],touchmove:[],touchend:[]},this.state={opened:!1,opening:!1,closed:!0,closing:!1},this.disabled=!1,!Object.values(t.modes).some(function(t){return i instanceof t}))throw TypeError("Calling this constructor is not allowed. Use `Pulling.create` instead");var o=s.menu,r=s.panel,u=s.side,h=s.mode,a=s.margin,c=s.timing,l=s.timingFunction,d=s.width,p=s.sensitivity,m=s.slope;s.touch;this.menu=o,this.panel=r,this.side=u||"left",this.mode=h||"drawer",this.margin=a||25,this.timing=c||200,this.timingFunction=l||"ease",this.width=d||256,this.sensitivity=p||.25,this.slope=m||.5,e(this.menu instanceof Element,"`menu` must be of type `Element`"),e(this.panel instanceof Element,"`panel` must be of type `Element`"),e("left"===this.side||"right"===this.side,'`side` must be equal to "left" or "right"'),e("number"==typeof this.margin,'`margin` must be of type "number"'),e("number"==typeof this.timing,'`timing` must be of type "number"'),e(n.includes(this.timingFunction),"`timingFunction` must be one of "+n.map(function(t){return'"'+t+'"'}).join(", ")),e("number"==typeof this.width,'`width` must be of type "number"'),e("number"==typeof this.sensitivity,'`sensitivity` must be of type "number"'),e("number"==typeof this.slope,'`slope` must be of type "number"')}return t.create=function(e){var n=e.mode||Object.keys(t.modes)[0]||"drawer";if(!t.modes[n]){var s=Object.keys(t.modes).map(function(t){return'"'+t+'"'}).join(", ");throw TypeError("`mode` must be one of "+s)}return new t.modes[n](e)},t.prototype.emit=function(t,e){var n=this;this.handlers[t].forEach(function(t){return t.call(n,e)})},t.prototype.on=function(t,e){return this.handlers[t].push(e),this},t.prototype.off=function(t,e){return this.handlers[t]=e?this.handlers[t].filter(function(t){return t!==e}):[],this},t.prototype.open=function(t){var e=this;if(this.emit("beforeopen",t),this.disabled)return this;if(this.state.opened)return this;this.state.closed=!1,this.state.closing=!1,this.state.opening=!0,this.state.opened=!1;var n=this.offset();if(n>0){var s=this.timing*(1-n/this.width)+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.open.menu),Object.assign(this.panel.style,this.styles.open.panel);var i=function(){e.state.opening=!1,e.state.opened=!0,Object.assign(e.menu.style,e.styles.open.menu),Object.assign(e.panel.style,e.styles.open.panel),e.emit("opened")};return n===this.width?i():this.afterTransitionend(i),this},t.prototype.close=function(t){var e=this;if(this.emit("beforeclose",t),this.disabled)return this;if(this.state.closed)return this.state.closing=!1,this;this.state.closed=!1,this.state.closing=!0,this.state.opening=!1,this.state.opened=!1;var n=this.offset();if(n>0){var s=this.timing*n/this.width+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.closed.menu),Object.assign(this.panel.style,this.styles.closed.panel);var i=function(){e.state.closing=!1,e.state.closed=!0,Object.assign(e.menu.style,e.styles.closed.menu),Object.assign(e.panel.style,e.styles.closed.panel),e.emit("closed")};return 0===n?i():this.afterTransitionend(i),this},t.prototype.toggle=function(t){return!0===t?this.open():!1===t?this.close():this.toggle(this.state.closed||this.state.closing),this},t.prototype.disable=function(){return this.disabled=!0,this},t.prototype.enable=function(){return this.disabled=!1,this},t.prototype.afterTransitionend=function(t){},t.prototype.offset=function(){return 0},t.modes={},t}()),i=function(e){function n(t){var n=e.call(this,t)||this;return n.styles.base.menu=(s={transition:"transform "+n.timing+"ms "+n.timingFunction,overflowX:"hidden",overflowY:"auto",position:"fixed"},s[n.side]="-"+n.width+"px",s.top="0",s.bottom="0",s.width=n.width+"px",s.zIndex="1",s),n.styles.open.menu={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.menu={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n;var s}return t(n,e),n.prototype.offset=function(){var t=this.menu.getBoundingClientRect();return"left"===this.side?t.left+this.width:window.innerWidth-t.left},n.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.menu.style.transform="translateX("+t*e+"px)"},n.prototype.afterTransitionend=function(t){this.onTransitionend=t},n.prototype.initTransitionend=function(){var t=this;this.menu.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},n}(s);return s.modes.drawer=i,Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector,Object.entries=Object.entries||function(t){return Object.keys(t).map(function(e){return[e,t[e]]})},Object.values=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},Object.assign=Object.assign||function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var s=0,i=e;s<i.length;s++)for(var o=i[s],r=0,u=Object.entries(o);r<u.length;r++){var h=u[r],a=h[0],c=h[1];t[a]=c}return t},Array.prototype.includes=function(t){return-1!==this.indexOf(t)},s});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pulling",e):t.Pulling=e()}(this,function(){"use strict";function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function s(){this.constructor=t}t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}function p(t,e){if(!t)throw TypeError("Invalid arguments: "+e)}var m=["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"],t=function(n){function t(t){var e=n.call(this,t)||this;return e.touched=!1,e.ignores=[],e.ignoreSelector="",e.touch=!1!==t.touch,e.touch&&e.addTouchEvents(),e}return e(t,n),t.prototype.applyOffset=function(t){},t.prototype.initTouchEvents=function(){var a=this,t=this,c=t.width,r=t.margin,u=t.side,l=t.slope,h=t.sensitivity,d=t.menu,p=t.panel,m="left"===u?1:-1,f=0,y=0,v=0,g=0,b=0,E=0,w=0,T=!1;return{onTouchstart:function(t){if(!(a.ignoreSelector&&t.target.matches(a.ignoreSelector)||(a.emit("touchstart",t),a.disabled||(a.touched=!1,1!==t.touches.length)))){var e=t.touches[0],n=e.clientX,s=e.clientY,i=a.offset(),o=r+i;("left"===u&&n<=o||"right"===u&&window.innerWidth-n<=o)&&(a.touched=!0,y=s,v=f=n,g=i,E=Date.now(),T=!0)}},onTouchmove:function(t){if(a.emit("touchmove",t),!a.disabled&&a.touched){var e=t.touches[0],n=e.clientX,s=e.clientY,i=(n-f)*m;if(!(Math.abs(i)<10)){if(T){var o=s-y,r=Math.abs(o/i);if(l<r)return void(a.touched=!1);a.state.closed&&0<i?a.emit("beforeopen"):a.state.opened&&a.emit("beforeopen"),d.style.transition=null,p.style.transition=null}if(a.state.opened&&0<i||a.state.closed&&i<0)return v=n,void(E=Date.now());a.state.opened=!1,a.state.closed=!1;var u=0<(n-v)*m;a.state.opening=u,a.state.closing=!u;var h=Math.min(Math.max(0,g+i),c);a.applyOffset(h),w=v,v=n,b=E,E=Date.now(),T=!1}}},onTouchend:function(t){if(a.touched&&(a.touched=!1,!T)){a.emit("touchend",t),Object.assign(a.panel.style,a.styles.base.panel),Object.assign(a.menu.style,a.styles.base.menu);var e,n,s=a.offset(),i=t.changedTouches[0].clientX;i===v?(e=w,n=b):(e=v,n=E);var o=(i-e)/(Date.now()-n)*m;c/2<s&&-h<o||h<o?a.open(t):a.close(t)}}}},t.prototype.addTouchEvents=function(){this.touchEvents||(this.touchEvents=this.initTouchEvents()),document.documentElement.addEventListener("touchstart",this.touchEvents.onTouchstart,!1),document.documentElement.addEventListener("touchmove",this.touchEvents.onTouchmove,!1),document.documentElement.addEventListener("touchend",this.touchEvents.onTouchend,!1)},t.prototype.removeTouchEvents=function(){document.documentElement.removeEventListener("touchstart",this.touchEvents.onTouchstart),document.documentElement.removeEventListener("touchmove",this.touchEvents.onTouchmove),document.documentElement.removeEventListener("touchend",this.touchEvents.onTouchend)},t.prototype.ignore=function(t){return this.ignores.push(t),this.ignoreSelector=this.ignores.join(", "),this},t.prototype.unignore=function(e){return this.ignores=this.ignores.filter(function(t){return t!==e}),this.ignoreSelector=this.ignores.join(", "),this},t.prototype.enableTouch=function(){return this.touch||(this.addTouchEvents(),this.touch=!0),this},t.prototype.disableTouch=function(){return this.touch&&(this.removeTouchEvents(),this.touch=!1),this},t}(function(){function d(t){var e=this;if(this.styles={base:{menu:{},panel:{}},open:{menu:{},panel:{}},closed:{menu:{},panel:{}}},this.handlers={beforeclose:[],closed:[],beforeopen:[],opened:[],touchstart:[],touchmove:[],touchend:[]},this.state={opened:!1,opening:!1,closed:!0,closing:!1},this.disabled=!1,!Object.values(d.modes).some(function(t){return e instanceof t}))throw TypeError("Calling this constructor is not allowed. Use `Pulling.create` instead");var n=t.menu,s=t.panel,i=t.side,o=t.mode,r=t.margin,u=t.timing,h=t.timingFunction,a=t.width,c=t.sensitivity,l=t.slope;t.touch;this.menu=n,this.panel=s,this.side=i||"left",this.mode=o||"drawer",this.margin=r||25,this.timing=u||200,this.timingFunction=h||"ease",this.width=a||256,this.sensitivity=c||.25,this.slope=l||.5,p(this.menu instanceof Element,"`menu` must be of type `Element`"),p(this.panel instanceof Element,"`panel` must be of type `Element`"),p("left"===this.side||"right"===this.side,'`side` must be equal to "left" or "right"'),p("number"==typeof this.margin,'`margin` must be of type "number"'),p("number"==typeof this.timing,'`timing` must be of type "number"'),p(m.includes(this.timingFunction),"`timingFunction` must be one of "+m.map(function(t){return'"'+t+'"'}).join(", ")),p("number"==typeof this.width,'`width` must be of type "number"'),p("number"==typeof this.sensitivity,'`sensitivity` must be of type "number"'),p("number"==typeof this.slope,'`slope` must be of type "number"')}return d.create=function(t){var e=t.mode||Object.keys(d.modes)[0]||"drawer";if(!d.modes[e]){var n=Object.keys(d.modes).map(function(t){return'"'+t+'"'}).join(", ");throw TypeError("`mode` must be one of "+n)}return new d.modes[e](t)},d.prototype.emit=function(t,e){var n=this;this.handlers[t].forEach(function(t){return t.call(n,e)})},d.prototype.on=function(t,e){return this.handlers[t].push(e),this},d.prototype.off=function(t,e){return this.handlers[t]=e?this.handlers[t].filter(function(t){return t!==e}):[],this},d.prototype.open=function(t){var e=this;if(this.emit("beforeopen",t),this.disabled)return this;if(this.state.opened)return this;this.state.closed=!1,this.state.closing=!1,this.state.opening=!0,this.state.opened=!1;var n=this.offset();if(0<n){var s=this.timing*(1-n/this.width)+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.open.menu),Object.assign(this.panel.style,this.styles.open.panel);var i=function(){e.state.opening=!1,e.state.opened=!0,Object.assign(e.menu.style,e.styles.open.menu),Object.assign(e.panel.style,e.styles.open.panel),e.emit("opened")};return n===this.width?i():this.afterTransitionend(i),this},d.prototype.close=function(t){var e=this;if(this.emit("beforeclose",t),this.disabled)return this;if(this.state.closed)return this.state.closing=!1,this;this.state.closed=!1,this.state.closing=!0,this.state.opening=!1,this.state.opened=!1;var n=this.offset();if(0<n){var s=this.timing*n/this.width+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.closed.menu),Object.assign(this.panel.style,this.styles.closed.panel);var i=function(){e.state.closing=!1,e.state.closed=!0,Object.assign(e.menu.style,e.styles.closed.menu),Object.assign(e.panel.style,e.styles.closed.panel),e.emit("closed")};return 0===n?i():this.afterTransitionend(i),this},d.prototype.toggle=function(t){return!0===t?this.open():!1===t?this.close():this.toggle(this.state.closed||this.state.closing),this},d.prototype.disable=function(){return this.disabled=!0,this},d.prototype.enable=function(){return this.disabled=!1,this},d.prototype.afterTransitionend=function(t){},d.prototype.offset=function(){return 0},d.modes={},d}()),n=function(s){function t(t){var e,n=s.call(this,t)||this;return n.styles.base.menu=((e={transition:"transform "+n.timing+"ms "+n.timingFunction,overflowX:"hidden",overflowY:"auto",position:"fixed"})[n.side]="-"+n.width+"px",e.top="0",e.bottom="0",e.width=n.width+"px",e.zIndex="1",e),n.styles.open.menu={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.menu={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n}return e(t,s),t.prototype.offset=function(){var t=this.menu.getBoundingClientRect();return"left"===this.side?t.left+this.width:window.innerWidth-t.left},t.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.menu.style.transform="translateX("+t*e+"px)"},t.prototype.afterTransitionend=function(t){this.onTransitionend=t},t.prototype.initTransitionend=function(){var t=this;this.menu.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},t}(t);return t.modes.drawer=n,Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector,Object.entries=function(e){return Object.keys(e).map(function(t){return[t,e[t]]})},Object.values=function(e){return Object.keys(e).map(function(t){return e[t]})},Object.assign=Object.assign||function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var s=0,i=e;s<i.length;s++)for(var o=i[s],r=0,u=Object.entries(o);r<u.length;r++){var h=u[r],a=h[0],c=h[1];t[a]=c}return t},Array.prototype.includes=function(t){return-1!==this.indexOf(t)},t});
//# sourceMappingURL=pulling-drawer.min.js.map

@@ -28,6 +28,6 @@ (function (global, factory) {

Element.prototype.oMatchesSelector;
Object.entries = Object.entries || (function (obj) {
Object.entries = /* Object.entries || */ (function (obj) {
return Object.keys(obj).map(function (key) { return [key, obj[key]]; });
});
Object.values = Object.values || (function (obj) {
Object.values = /* Object.values || */ (function (obj) {
return Object.keys(obj).map(function (key) { return obj[key]; });

@@ -34,0 +34,0 @@ });

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pulling",e):t.Pulling=e()}(this,function(){"use strict";function t(t,e){function n(){this.constructor=t}for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function e(t,e){if(!t)throw TypeError("Invalid arguments: "+e)}var n=["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"],s=function(e){function n(t){var n=e.call(this,t)||this;return n.touched=!1,n.ignores=[],n.ignoreSelector="",n.touch=!1!==t.touch,n.touch&&n.addTouchEvents(),n}return t(n,e),n.prototype.applyOffset=function(t){},n.prototype.initTouchEvents=function(){var t=this,e=this,n=e.width,s=e.margin,i=e.side,o=e.slope,r=e.sensitivity,a=e.menu,u=e.panel,h="left"===i?1:-1,c=0,l=0,p=0,d=0,m=0,f=0,y=0,v=!1;return{onTouchstart:function(e){if(!(t.ignoreSelector&&e.target.matches(t.ignoreSelector)||(t.emit("touchstart",e),t.disabled||(t.touched=!1,1!==e.touches.length)))){var n=e.touches[0],o=n.clientX,r=n.clientY,a=t.offset(),u=s+a;("left"===i&&o<=u||"right"===i&&window.innerWidth-o<=u)&&(t.touched=!0,c=o,l=r,p=o,d=a,f=Date.now(),v=!0)}},onTouchmove:function(e){if(t.emit("touchmove",e),!t.disabled&&t.touched){var s=e.touches[0],i=s.clientX,r=s.clientY,g=(i-c)*h;if(!(Math.abs(g)<10)){if(v){var b=r-l;if(Math.abs(b/g)>o)return void(t.touched=!1);t.state.closed&&g>0?t.emit("beforeopen"):t.state.opened&&t.emit("beforeopen"),a.style.transition=null,u.style.transition=null}if(t.state.opened&&g>0||t.state.closed&&g<0)return p=i,void(f=Date.now());t.state.opened=!1,t.state.closed=!1;var E=(i-p)*h>0;t.state.opening=E,t.state.closing=!E;var T=Math.min(Math.max(0,d+g),n);t.applyOffset(T),y=p,p=i,m=f,f=Date.now(),v=!1}}},onTouchend:function(e){if(t.touched&&(t.touched=!1,!v)){t.emit("touchend",e),Object.assign(t.panel.style,t.styles.base.panel),Object.assign(t.menu.style,t.styles.base.menu);var s,i,o=t.offset(),a=e.changedTouches[0].clientX;a===p?(s=y,i=m):(s=p,i=f);var u=(a-s)/(Date.now()-i)*h;o>n/2&&u>-r||u>r?t.open(e):t.close(e)}}}},n.prototype.addTouchEvents=function(){this.touchEvents||(this.touchEvents=this.initTouchEvents()),document.documentElement.addEventListener("touchstart",this.touchEvents.onTouchstart,!1),document.documentElement.addEventListener("touchmove",this.touchEvents.onTouchmove,!1),document.documentElement.addEventListener("touchend",this.touchEvents.onTouchend,!1)},n.prototype.removeTouchEvents=function(){document.documentElement.removeEventListener("touchstart",this.touchEvents.onTouchstart),document.documentElement.removeEventListener("touchmove",this.touchEvents.onTouchmove),document.documentElement.removeEventListener("touchend",this.touchEvents.onTouchend)},n.prototype.ignore=function(t){return this.ignores.push(t),this.ignoreSelector=this.ignores.join(", "),this},n.prototype.unignore=function(t){return this.ignores=this.ignores.filter(function(e){return e!==t}),this.ignoreSelector=this.ignores.join(", "),this},n.prototype.enableTouch=function(){return this.touch||(this.addTouchEvents(),this.touch=!0),this},n.prototype.disableTouch=function(){return this.touch&&(this.removeTouchEvents(),this.touch=!1),this},n}(function(){function t(s){var i=this;if(this.styles={base:{menu:{},panel:{}},open:{menu:{},panel:{}},closed:{menu:{},panel:{}}},this.handlers={beforeclose:[],closed:[],beforeopen:[],opened:[],touchstart:[],touchmove:[],touchend:[]},this.state={opened:!1,opening:!1,closed:!0,closing:!1},this.disabled=!1,!Object.values(t.modes).some(function(t){return i instanceof t}))throw TypeError("Calling this constructor is not allowed. Use `Pulling.create` instead");var o=s.menu,r=s.panel,a=s.side,u=s.mode,h=s.margin,c=s.timing,l=s.timingFunction,p=s.width,d=s.sensitivity,m=s.slope;s.touch;this.menu=o,this.panel=r,this.side=a||"left",this.mode=u||"drawer",this.margin=h||25,this.timing=c||200,this.timingFunction=l||"ease",this.width=p||256,this.sensitivity=d||.25,this.slope=m||.5,e(this.menu instanceof Element,"`menu` must be of type `Element`"),e(this.panel instanceof Element,"`panel` must be of type `Element`"),e("left"===this.side||"right"===this.side,'`side` must be equal to "left" or "right"'),e("number"==typeof this.margin,'`margin` must be of type "number"'),e("number"==typeof this.timing,'`timing` must be of type "number"'),e(n.includes(this.timingFunction),"`timingFunction` must be one of "+n.map(function(t){return'"'+t+'"'}).join(", ")),e("number"==typeof this.width,'`width` must be of type "number"'),e("number"==typeof this.sensitivity,'`sensitivity` must be of type "number"'),e("number"==typeof this.slope,'`slope` must be of type "number"')}return t.create=function(e){var n=e.mode||Object.keys(t.modes)[0]||"drawer";if(!t.modes[n]){var s=Object.keys(t.modes).map(function(t){return'"'+t+'"'}).join(", ");throw TypeError("`mode` must be one of "+s)}return new t.modes[n](e)},t.prototype.emit=function(t,e){var n=this;this.handlers[t].forEach(function(t){return t.call(n,e)})},t.prototype.on=function(t,e){return this.handlers[t].push(e),this},t.prototype.off=function(t,e){return this.handlers[t]=e?this.handlers[t].filter(function(t){return t!==e}):[],this},t.prototype.open=function(t){var e=this;if(this.emit("beforeopen",t),this.disabled)return this;if(this.state.opened)return this;this.state.closed=!1,this.state.closing=!1,this.state.opening=!0,this.state.opened=!1;var n=this.offset();if(n>0){var s=this.timing*(1-n/this.width)+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.open.menu),Object.assign(this.panel.style,this.styles.open.panel);var i=function(){e.state.opening=!1,e.state.opened=!0,Object.assign(e.menu.style,e.styles.open.menu),Object.assign(e.panel.style,e.styles.open.panel),e.emit("opened")};return n===this.width?i():this.afterTransitionend(i),this},t.prototype.close=function(t){var e=this;if(this.emit("beforeclose",t),this.disabled)return this;if(this.state.closed)return this.state.closing=!1,this;this.state.closed=!1,this.state.closing=!0,this.state.opening=!1,this.state.opened=!1;var n=this.offset();if(n>0){var s=this.timing*n/this.width+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.closed.menu),Object.assign(this.panel.style,this.styles.closed.panel);var i=function(){e.state.closing=!1,e.state.closed=!0,Object.assign(e.menu.style,e.styles.closed.menu),Object.assign(e.panel.style,e.styles.closed.panel),e.emit("closed")};return 0===n?i():this.afterTransitionend(i),this},t.prototype.toggle=function(t){return!0===t?this.open():!1===t?this.close():this.toggle(this.state.closed||this.state.closing),this},t.prototype.disable=function(){return this.disabled=!0,this},t.prototype.enable=function(){return this.disabled=!1,this},t.prototype.afterTransitionend=function(t){},t.prototype.offset=function(){return 0},t.modes={},t}()),i=function(e){function n(t){var n=e.call(this,t)||this;return n.styles.base.menu=(s={overflowX:"hidden",overflowY:"auto",position:"fixed"},s[n.side]="0",s.top="0",s.bottom="0",s.width=n.width+"px",s.zIndex="-1",s),n.styles.base.panel={transition:"transform "+n.timing+"ms "+n.timingFunction},n.styles.open.panel={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.panel={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n;var s}return t(n,e),n.prototype.offset=function(){var t=this.panel.getBoundingClientRect();return Math.abs(t.left)},n.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.panel.style.transform="translateX("+t*e+"px)"},n.prototype.afterTransitionend=function(t){this.onTransitionend=t},n.prototype.initTransitionend=function(){var t=this;this.panel.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},n}(s);return s.modes.reveal=i,Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector,Object.entries=Object.entries||function(t){return Object.keys(t).map(function(e){return[e,t[e]]})},Object.values=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},Object.assign=Object.assign||function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var s=0,i=e;s<i.length;s++)for(var o=i[s],r=0,a=Object.entries(o);r<a.length;r++){var u=a[r],h=u[0],c=u[1];t[h]=c}return t},Array.prototype.includes=function(t){return-1!==this.indexOf(t)},s});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pulling",e):t.Pulling=e()}(this,function(){"use strict";function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function s(){this.constructor=t}t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}function d(t,e){if(!t)throw TypeError("Invalid arguments: "+e)}var m=["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"],t=function(n){function t(t){var e=n.call(this,t)||this;return e.touched=!1,e.ignores=[],e.ignoreSelector="",e.touch=!1!==t.touch,e.touch&&e.addTouchEvents(),e}return e(t,n),t.prototype.applyOffset=function(t){},t.prototype.initTouchEvents=function(){var h=this,t=this,c=t.width,r=t.margin,a=t.side,l=t.slope,u=t.sensitivity,p=t.menu,d=t.panel,m="left"===a?1:-1,f=0,y=0,v=0,g=0,b=0,E=0,T=0,w=!1;return{onTouchstart:function(t){if(!(h.ignoreSelector&&t.target.matches(h.ignoreSelector)||(h.emit("touchstart",t),h.disabled||(h.touched=!1,1!==t.touches.length)))){var e=t.touches[0],n=e.clientX,s=e.clientY,o=h.offset(),i=r+o;("left"===a&&n<=i||"right"===a&&window.innerWidth-n<=i)&&(h.touched=!0,y=s,v=f=n,g=o,E=Date.now(),w=!0)}},onTouchmove:function(t){if(h.emit("touchmove",t),!h.disabled&&h.touched){var e=t.touches[0],n=e.clientX,s=e.clientY,o=(n-f)*m;if(!(Math.abs(o)<10)){if(w){var i=s-y,r=Math.abs(i/o);if(l<r)return void(h.touched=!1);h.state.closed&&0<o?h.emit("beforeopen"):h.state.opened&&h.emit("beforeopen"),p.style.transition=null,d.style.transition=null}if(h.state.opened&&0<o||h.state.closed&&o<0)return v=n,void(E=Date.now());h.state.opened=!1,h.state.closed=!1;var a=0<(n-v)*m;h.state.opening=a,h.state.closing=!a;var u=Math.min(Math.max(0,g+o),c);h.applyOffset(u),T=v,v=n,b=E,E=Date.now(),w=!1}}},onTouchend:function(t){if(h.touched&&(h.touched=!1,!w)){h.emit("touchend",t),Object.assign(h.panel.style,h.styles.base.panel),Object.assign(h.menu.style,h.styles.base.menu);var e,n,s=h.offset(),o=t.changedTouches[0].clientX;o===v?(e=T,n=b):(e=v,n=E);var i=(o-e)/(Date.now()-n)*m;c/2<s&&-u<i||u<i?h.open(t):h.close(t)}}}},t.prototype.addTouchEvents=function(){this.touchEvents||(this.touchEvents=this.initTouchEvents()),document.documentElement.addEventListener("touchstart",this.touchEvents.onTouchstart,!1),document.documentElement.addEventListener("touchmove",this.touchEvents.onTouchmove,!1),document.documentElement.addEventListener("touchend",this.touchEvents.onTouchend,!1)},t.prototype.removeTouchEvents=function(){document.documentElement.removeEventListener("touchstart",this.touchEvents.onTouchstart),document.documentElement.removeEventListener("touchmove",this.touchEvents.onTouchmove),document.documentElement.removeEventListener("touchend",this.touchEvents.onTouchend)},t.prototype.ignore=function(t){return this.ignores.push(t),this.ignoreSelector=this.ignores.join(", "),this},t.prototype.unignore=function(e){return this.ignores=this.ignores.filter(function(t){return t!==e}),this.ignoreSelector=this.ignores.join(", "),this},t.prototype.enableTouch=function(){return this.touch||(this.addTouchEvents(),this.touch=!0),this},t.prototype.disableTouch=function(){return this.touch&&(this.removeTouchEvents(),this.touch=!1),this},t}(function(){function p(t){var e=this;if(this.styles={base:{menu:{},panel:{}},open:{menu:{},panel:{}},closed:{menu:{},panel:{}}},this.handlers={beforeclose:[],closed:[],beforeopen:[],opened:[],touchstart:[],touchmove:[],touchend:[]},this.state={opened:!1,opening:!1,closed:!0,closing:!1},this.disabled=!1,!Object.values(p.modes).some(function(t){return e instanceof t}))throw TypeError("Calling this constructor is not allowed. Use `Pulling.create` instead");var n=t.menu,s=t.panel,o=t.side,i=t.mode,r=t.margin,a=t.timing,u=t.timingFunction,h=t.width,c=t.sensitivity,l=t.slope;t.touch;this.menu=n,this.panel=s,this.side=o||"left",this.mode=i||"drawer",this.margin=r||25,this.timing=a||200,this.timingFunction=u||"ease",this.width=h||256,this.sensitivity=c||.25,this.slope=l||.5,d(this.menu instanceof Element,"`menu` must be of type `Element`"),d(this.panel instanceof Element,"`panel` must be of type `Element`"),d("left"===this.side||"right"===this.side,'`side` must be equal to "left" or "right"'),d("number"==typeof this.margin,'`margin` must be of type "number"'),d("number"==typeof this.timing,'`timing` must be of type "number"'),d(m.includes(this.timingFunction),"`timingFunction` must be one of "+m.map(function(t){return'"'+t+'"'}).join(", ")),d("number"==typeof this.width,'`width` must be of type "number"'),d("number"==typeof this.sensitivity,'`sensitivity` must be of type "number"'),d("number"==typeof this.slope,'`slope` must be of type "number"')}return p.create=function(t){var e=t.mode||Object.keys(p.modes)[0]||"drawer";if(!p.modes[e]){var n=Object.keys(p.modes).map(function(t){return'"'+t+'"'}).join(", ");throw TypeError("`mode` must be one of "+n)}return new p.modes[e](t)},p.prototype.emit=function(t,e){var n=this;this.handlers[t].forEach(function(t){return t.call(n,e)})},p.prototype.on=function(t,e){return this.handlers[t].push(e),this},p.prototype.off=function(t,e){return this.handlers[t]=e?this.handlers[t].filter(function(t){return t!==e}):[],this},p.prototype.open=function(t){var e=this;if(this.emit("beforeopen",t),this.disabled)return this;if(this.state.opened)return this;this.state.closed=!1,this.state.closing=!1,this.state.opening=!0,this.state.opened=!1;var n=this.offset();if(0<n){var s=this.timing*(1-n/this.width)+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.open.menu),Object.assign(this.panel.style,this.styles.open.panel);var o=function(){e.state.opening=!1,e.state.opened=!0,Object.assign(e.menu.style,e.styles.open.menu),Object.assign(e.panel.style,e.styles.open.panel),e.emit("opened")};return n===this.width?o():this.afterTransitionend(o),this},p.prototype.close=function(t){var e=this;if(this.emit("beforeclose",t),this.disabled)return this;if(this.state.closed)return this.state.closing=!1,this;this.state.closed=!1,this.state.closing=!0,this.state.opening=!1,this.state.opened=!1;var n=this.offset();if(0<n){var s=this.timing*n/this.width+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.closed.menu),Object.assign(this.panel.style,this.styles.closed.panel);var o=function(){e.state.closing=!1,e.state.closed=!0,Object.assign(e.menu.style,e.styles.closed.menu),Object.assign(e.panel.style,e.styles.closed.panel),e.emit("closed")};return 0===n?o():this.afterTransitionend(o),this},p.prototype.toggle=function(t){return!0===t?this.open():!1===t?this.close():this.toggle(this.state.closed||this.state.closing),this},p.prototype.disable=function(){return this.disabled=!0,this},p.prototype.enable=function(){return this.disabled=!1,this},p.prototype.afterTransitionend=function(t){},p.prototype.offset=function(){return 0},p.modes={},p}()),n=function(s){function t(t){var e,n=s.call(this,t)||this;return n.styles.base.menu=((e={overflowX:"hidden",overflowY:"auto",position:"fixed"})[n.side]="0",e.top="0",e.bottom="0",e.width=n.width+"px",e.zIndex="-1",e),n.styles.base.panel={transition:"transform "+n.timing+"ms "+n.timingFunction},n.styles.open.panel={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.panel={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n}return e(t,s),t.prototype.offset=function(){var t=this.panel.getBoundingClientRect();return Math.abs(t.left)},t.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.panel.style.transform="translateX("+t*e+"px)"},t.prototype.afterTransitionend=function(t){this.onTransitionend=t},t.prototype.initTransitionend=function(){var t=this;this.panel.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},t}(t);return t.modes.reveal=n,Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector,Object.entries=function(e){return Object.keys(e).map(function(t){return[t,e[t]]})},Object.values=function(e){return Object.keys(e).map(function(t){return e[t]})},Object.assign=Object.assign||function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var s=0,o=e;s<o.length;s++)for(var i=o[s],r=0,a=Object.entries(i);r<a.length;r++){var u=a[r],h=u[0],c=u[1];t[h]=c}return t},Array.prototype.includes=function(t){return-1!==this.indexOf(t)},t});
//# sourceMappingURL=pulling-reveal.min.js.map

@@ -28,6 +28,6 @@ (function (global, factory) {

Element.prototype.oMatchesSelector;
Object.entries = Object.entries || (function (obj) {
Object.entries = /* Object.entries || */ (function (obj) {
return Object.keys(obj).map(function (key) { return [key, obj[key]]; });
});
Object.values = Object.values || (function (obj) {
Object.values = /* Object.values || */ (function (obj) {
return Object.keys(obj).map(function (key) { return obj[key]; });

@@ -34,0 +34,0 @@ });

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pulling",e):t.Pulling=e()}(this,function(){"use strict";function t(t,e){function n(){this.constructor=t}for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function e(t,e){if(!t)throw TypeError("Invalid arguments: "+e)}var n=["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"],s=function(e){function n(t){var n=e.call(this,t)||this;return n.touched=!1,n.ignores=[],n.ignoreSelector="",n.touch=!1!==t.touch,n.touch&&n.addTouchEvents(),n}return t(n,e),n.prototype.applyOffset=function(t){},n.prototype.initTouchEvents=function(){var t=this,e=this,n=e.width,s=e.margin,i=e.side,o=e.slope,r=e.sensitivity,a=e.menu,u=e.panel,h="left"===i?1:-1,c=0,l=0,d=0,p=0,f=0,m=0,y=0,v=!1;return{onTouchstart:function(e){if(!(t.ignoreSelector&&e.target.matches(t.ignoreSelector)||(t.emit("touchstart",e),t.disabled||(t.touched=!1,1!==e.touches.length)))){var n=e.touches[0],o=n.clientX,r=n.clientY,a=t.offset(),u=s+a;("left"===i&&o<=u||"right"===i&&window.innerWidth-o<=u)&&(t.touched=!0,c=o,l=r,d=o,p=a,m=Date.now(),v=!0)}},onTouchmove:function(e){if(t.emit("touchmove",e),!t.disabled&&t.touched){var s=e.touches[0],i=s.clientX,r=s.clientY,g=(i-c)*h;if(!(Math.abs(g)<10)){if(v){var b=r-l;if(Math.abs(b/g)>o)return void(t.touched=!1);t.state.closed&&g>0?t.emit("beforeopen"):t.state.opened&&t.emit("beforeopen"),a.style.transition=null,u.style.transition=null}if(t.state.opened&&g>0||t.state.closed&&g<0)return d=i,void(m=Date.now());t.state.opened=!1,t.state.closed=!1;var E=(i-d)*h>0;t.state.opening=E,t.state.closing=!E;var w=Math.min(Math.max(0,p+g),n);t.applyOffset(w),y=d,d=i,f=m,m=Date.now(),v=!1}}},onTouchend:function(e){if(t.touched&&(t.touched=!1,!v)){t.emit("touchend",e),Object.assign(t.panel.style,t.styles.base.panel),Object.assign(t.menu.style,t.styles.base.menu);var s,i,o=t.offset(),a=e.changedTouches[0].clientX;a===d?(s=y,i=f):(s=d,i=m);var u=(a-s)/(Date.now()-i)*h;o>n/2&&u>-r||u>r?t.open(e):t.close(e)}}}},n.prototype.addTouchEvents=function(){this.touchEvents||(this.touchEvents=this.initTouchEvents()),document.documentElement.addEventListener("touchstart",this.touchEvents.onTouchstart,!1),document.documentElement.addEventListener("touchmove",this.touchEvents.onTouchmove,!1),document.documentElement.addEventListener("touchend",this.touchEvents.onTouchend,!1)},n.prototype.removeTouchEvents=function(){document.documentElement.removeEventListener("touchstart",this.touchEvents.onTouchstart),document.documentElement.removeEventListener("touchmove",this.touchEvents.onTouchmove),document.documentElement.removeEventListener("touchend",this.touchEvents.onTouchend)},n.prototype.ignore=function(t){return this.ignores.push(t),this.ignoreSelector=this.ignores.join(", "),this},n.prototype.unignore=function(t){return this.ignores=this.ignores.filter(function(e){return e!==t}),this.ignoreSelector=this.ignores.join(", "),this},n.prototype.enableTouch=function(){return this.touch||(this.addTouchEvents(),this.touch=!0),this},n.prototype.disableTouch=function(){return this.touch&&(this.removeTouchEvents(),this.touch=!1),this},n}(function(){function t(s){var i=this;if(this.styles={base:{menu:{},panel:{}},open:{menu:{},panel:{}},closed:{menu:{},panel:{}}},this.handlers={beforeclose:[],closed:[],beforeopen:[],opened:[],touchstart:[],touchmove:[],touchend:[]},this.state={opened:!1,opening:!1,closed:!0,closing:!1},this.disabled=!1,!Object.values(t.modes).some(function(t){return i instanceof t}))throw TypeError("Calling this constructor is not allowed. Use `Pulling.create` instead");var o=s.menu,r=s.panel,a=s.side,u=s.mode,h=s.margin,c=s.timing,l=s.timingFunction,d=s.width,p=s.sensitivity,f=s.slope;s.touch;this.menu=o,this.panel=r,this.side=a||"left",this.mode=u||"drawer",this.margin=h||25,this.timing=c||200,this.timingFunction=l||"ease",this.width=d||256,this.sensitivity=p||.25,this.slope=f||.5,e(this.menu instanceof Element,"`menu` must be of type `Element`"),e(this.panel instanceof Element,"`panel` must be of type `Element`"),e("left"===this.side||"right"===this.side,'`side` must be equal to "left" or "right"'),e("number"==typeof this.margin,'`margin` must be of type "number"'),e("number"==typeof this.timing,'`timing` must be of type "number"'),e(n.includes(this.timingFunction),"`timingFunction` must be one of "+n.map(function(t){return'"'+t+'"'}).join(", ")),e("number"==typeof this.width,'`width` must be of type "number"'),e("number"==typeof this.sensitivity,'`sensitivity` must be of type "number"'),e("number"==typeof this.slope,'`slope` must be of type "number"')}return t.create=function(e){var n=e.mode||Object.keys(t.modes)[0]||"drawer";if(!t.modes[n]){var s=Object.keys(t.modes).map(function(t){return'"'+t+'"'}).join(", ");throw TypeError("`mode` must be one of "+s)}return new t.modes[n](e)},t.prototype.emit=function(t,e){var n=this;this.handlers[t].forEach(function(t){return t.call(n,e)})},t.prototype.on=function(t,e){return this.handlers[t].push(e),this},t.prototype.off=function(t,e){return this.handlers[t]=e?this.handlers[t].filter(function(t){return t!==e}):[],this},t.prototype.open=function(t){var e=this;if(this.emit("beforeopen",t),this.disabled)return this;if(this.state.opened)return this;this.state.closed=!1,this.state.closing=!1,this.state.opening=!0,this.state.opened=!1;var n=this.offset();if(n>0){var s=this.timing*(1-n/this.width)+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.open.menu),Object.assign(this.panel.style,this.styles.open.panel);var i=function(){e.state.opening=!1,e.state.opened=!0,Object.assign(e.menu.style,e.styles.open.menu),Object.assign(e.panel.style,e.styles.open.panel),e.emit("opened")};return n===this.width?i():this.afterTransitionend(i),this},t.prototype.close=function(t){var e=this;if(this.emit("beforeclose",t),this.disabled)return this;if(this.state.closed)return this.state.closing=!1,this;this.state.closed=!1,this.state.closing=!0,this.state.opening=!1,this.state.opened=!1;var n=this.offset();if(n>0){var s=this.timing*n/this.width+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.closed.menu),Object.assign(this.panel.style,this.styles.closed.panel);var i=function(){e.state.closing=!1,e.state.closed=!0,Object.assign(e.menu.style,e.styles.closed.menu),Object.assign(e.panel.style,e.styles.closed.panel),e.emit("closed")};return 0===n?i():this.afterTransitionend(i),this},t.prototype.toggle=function(t){return!0===t?this.open():!1===t?this.close():this.toggle(this.state.closed||this.state.closing),this},t.prototype.disable=function(){return this.disabled=!0,this},t.prototype.enable=function(){return this.disabled=!1,this},t.prototype.afterTransitionend=function(t){},t.prototype.offset=function(){return 0},t.modes={},t}()),i=function(e){function n(t){var n=e.call(this,t)||this;return n.styles.base.menu=(s={overflowX:"hidden",overflowY:"auto",position:"fixed"},s[n.side]="0",s.top="0",s.bottom="0",s.width=n.width+"px",s.zIndex="-1",s),n.styles.base.panel={transition:"transform "+n.timing+"ms "+n.timingFunction},n.styles.open.panel={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.panel={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n;var s}return t(n,e),n.prototype.offset=function(){var t=this.panel.getBoundingClientRect();return Math.abs(t.left)},n.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.panel.style.transform="translateX("+t*e+"px)"},n.prototype.afterTransitionend=function(t){this.onTransitionend=t},n.prototype.initTransitionend=function(){var t=this;this.panel.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},n}(s);s.modes.reveal=i;var o=function(e){function n(t){var n=e.call(this,t)||this;return n.styles.base.menu=(s={transition:"transform "+n.timing+"ms "+n.timingFunction,overflowX:"hidden",overflowY:"auto",position:"fixed"},s[n.side]="-"+n.width+"px",s.top="0",s.bottom="0",s.width=n.width+"px",s.zIndex="1",s),n.styles.open.menu={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.menu={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n;var s}return t(n,e),n.prototype.offset=function(){var t=this.menu.getBoundingClientRect();return"left"===this.side?t.left+this.width:window.innerWidth-t.left},n.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.menu.style.transform="translateX("+t*e+"px)"},n.prototype.afterTransitionend=function(t){this.onTransitionend=t},n.prototype.initTransitionend=function(){var t=this;this.menu.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},n}(s);return s.modes.drawer=o,Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector,Object.entries=Object.entries||function(t){return Object.keys(t).map(function(e){return[e,t[e]]})},Object.values=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},Object.assign=Object.assign||function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var s=0,i=e;s<i.length;s++)for(var o=i[s],r=0,a=Object.entries(o);r<a.length;r++){var u=a[r],h=u[0],c=u[1];t[h]=c}return t},Array.prototype.includes=function(t){return-1!==this.indexOf(t)},s});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pulling",e):t.Pulling=e()}(this,function(){"use strict";function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function s(){this.constructor=t}t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}function p(t,e){if(!t)throw TypeError("Invalid arguments: "+e)}var f=["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"],t=function(n){function t(t){var e=n.call(this,t)||this;return e.touched=!1,e.ignores=[],e.ignoreSelector="",e.touch=!1!==t.touch,e.touch&&e.addTouchEvents(),e}return e(t,n),t.prototype.applyOffset=function(t){},t.prototype.initTouchEvents=function(){var h=this,t=this,l=t.width,r=t.margin,a=t.side,c=t.slope,u=t.sensitivity,d=t.menu,p=t.panel,f="left"===a?1:-1,m=0,y=0,v=0,g=0,b=0,E=0,w=0,T=!1;return{onTouchstart:function(t){if(!(h.ignoreSelector&&t.target.matches(h.ignoreSelector)||(h.emit("touchstart",t),h.disabled||(h.touched=!1,1!==t.touches.length)))){var e=t.touches[0],n=e.clientX,s=e.clientY,i=h.offset(),o=r+i;("left"===a&&n<=o||"right"===a&&window.innerWidth-n<=o)&&(h.touched=!0,y=s,v=m=n,g=i,E=Date.now(),T=!0)}},onTouchmove:function(t){if(h.emit("touchmove",t),!h.disabled&&h.touched){var e=t.touches[0],n=e.clientX,s=e.clientY,i=(n-m)*f;if(!(Math.abs(i)<10)){if(T){var o=s-y,r=Math.abs(o/i);if(c<r)return void(h.touched=!1);h.state.closed&&0<i?h.emit("beforeopen"):h.state.opened&&h.emit("beforeopen"),d.style.transition=null,p.style.transition=null}if(h.state.opened&&0<i||h.state.closed&&i<0)return v=n,void(E=Date.now());h.state.opened=!1,h.state.closed=!1;var a=0<(n-v)*f;h.state.opening=a,h.state.closing=!a;var u=Math.min(Math.max(0,g+i),l);h.applyOffset(u),w=v,v=n,b=E,E=Date.now(),T=!1}}},onTouchend:function(t){if(h.touched&&(h.touched=!1,!T)){h.emit("touchend",t),Object.assign(h.panel.style,h.styles.base.panel),Object.assign(h.menu.style,h.styles.base.menu);var e,n,s=h.offset(),i=t.changedTouches[0].clientX;i===v?(e=w,n=b):(e=v,n=E);var o=(i-e)/(Date.now()-n)*f;l/2<s&&-u<o||u<o?h.open(t):h.close(t)}}}},t.prototype.addTouchEvents=function(){this.touchEvents||(this.touchEvents=this.initTouchEvents()),document.documentElement.addEventListener("touchstart",this.touchEvents.onTouchstart,!1),document.documentElement.addEventListener("touchmove",this.touchEvents.onTouchmove,!1),document.documentElement.addEventListener("touchend",this.touchEvents.onTouchend,!1)},t.prototype.removeTouchEvents=function(){document.documentElement.removeEventListener("touchstart",this.touchEvents.onTouchstart),document.documentElement.removeEventListener("touchmove",this.touchEvents.onTouchmove),document.documentElement.removeEventListener("touchend",this.touchEvents.onTouchend)},t.prototype.ignore=function(t){return this.ignores.push(t),this.ignoreSelector=this.ignores.join(", "),this},t.prototype.unignore=function(e){return this.ignores=this.ignores.filter(function(t){return t!==e}),this.ignoreSelector=this.ignores.join(", "),this},t.prototype.enableTouch=function(){return this.touch||(this.addTouchEvents(),this.touch=!0),this},t.prototype.disableTouch=function(){return this.touch&&(this.removeTouchEvents(),this.touch=!1),this},t}(function(){function d(t){var e=this;if(this.styles={base:{menu:{},panel:{}},open:{menu:{},panel:{}},closed:{menu:{},panel:{}}},this.handlers={beforeclose:[],closed:[],beforeopen:[],opened:[],touchstart:[],touchmove:[],touchend:[]},this.state={opened:!1,opening:!1,closed:!0,closing:!1},this.disabled=!1,!Object.values(d.modes).some(function(t){return e instanceof t}))throw TypeError("Calling this constructor is not allowed. Use `Pulling.create` instead");var n=t.menu,s=t.panel,i=t.side,o=t.mode,r=t.margin,a=t.timing,u=t.timingFunction,h=t.width,l=t.sensitivity,c=t.slope;t.touch;this.menu=n,this.panel=s,this.side=i||"left",this.mode=o||"drawer",this.margin=r||25,this.timing=a||200,this.timingFunction=u||"ease",this.width=h||256,this.sensitivity=l||.25,this.slope=c||.5,p(this.menu instanceof Element,"`menu` must be of type `Element`"),p(this.panel instanceof Element,"`panel` must be of type `Element`"),p("left"===this.side||"right"===this.side,'`side` must be equal to "left" or "right"'),p("number"==typeof this.margin,'`margin` must be of type "number"'),p("number"==typeof this.timing,'`timing` must be of type "number"'),p(f.includes(this.timingFunction),"`timingFunction` must be one of "+f.map(function(t){return'"'+t+'"'}).join(", ")),p("number"==typeof this.width,'`width` must be of type "number"'),p("number"==typeof this.sensitivity,'`sensitivity` must be of type "number"'),p("number"==typeof this.slope,'`slope` must be of type "number"')}return d.create=function(t){var e=t.mode||Object.keys(d.modes)[0]||"drawer";if(!d.modes[e]){var n=Object.keys(d.modes).map(function(t){return'"'+t+'"'}).join(", ");throw TypeError("`mode` must be one of "+n)}return new d.modes[e](t)},d.prototype.emit=function(t,e){var n=this;this.handlers[t].forEach(function(t){return t.call(n,e)})},d.prototype.on=function(t,e){return this.handlers[t].push(e),this},d.prototype.off=function(t,e){return this.handlers[t]=e?this.handlers[t].filter(function(t){return t!==e}):[],this},d.prototype.open=function(t){var e=this;if(this.emit("beforeopen",t),this.disabled)return this;if(this.state.opened)return this;this.state.closed=!1,this.state.closing=!1,this.state.opening=!0,this.state.opened=!1;var n=this.offset();if(0<n){var s=this.timing*(1-n/this.width)+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.open.menu),Object.assign(this.panel.style,this.styles.open.panel);var i=function(){e.state.opening=!1,e.state.opened=!0,Object.assign(e.menu.style,e.styles.open.menu),Object.assign(e.panel.style,e.styles.open.panel),e.emit("opened")};return n===this.width?i():this.afterTransitionend(i),this},d.prototype.close=function(t){var e=this;if(this.emit("beforeclose",t),this.disabled)return this;if(this.state.closed)return this.state.closing=!1,this;this.state.closed=!1,this.state.closing=!0,this.state.opening=!1,this.state.opened=!1;var n=this.offset();if(0<n){var s=this.timing*n/this.width+"ms";this.menu.style.transitionDuration=s,this.panel.style.transitionDuration=s}Object.assign(this.menu.style,this.styles.closed.menu),Object.assign(this.panel.style,this.styles.closed.panel);var i=function(){e.state.closing=!1,e.state.closed=!0,Object.assign(e.menu.style,e.styles.closed.menu),Object.assign(e.panel.style,e.styles.closed.panel),e.emit("closed")};return 0===n?i():this.afterTransitionend(i),this},d.prototype.toggle=function(t){return!0===t?this.open():!1===t?this.close():this.toggle(this.state.closed||this.state.closing),this},d.prototype.disable=function(){return this.disabled=!0,this},d.prototype.enable=function(){return this.disabled=!1,this},d.prototype.afterTransitionend=function(t){},d.prototype.offset=function(){return 0},d.modes={},d}()),n=function(s){function t(t){var e,n=s.call(this,t)||this;return n.styles.base.menu=((e={overflowX:"hidden",overflowY:"auto",position:"fixed"})[n.side]="0",e.top="0",e.bottom="0",e.width=n.width+"px",e.zIndex="-1",e),n.styles.base.panel={transition:"transform "+n.timing+"ms "+n.timingFunction},n.styles.open.panel={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.panel={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n}return e(t,s),t.prototype.offset=function(){var t=this.panel.getBoundingClientRect();return Math.abs(t.left)},t.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.panel.style.transform="translateX("+t*e+"px)"},t.prototype.afterTransitionend=function(t){this.onTransitionend=t},t.prototype.initTransitionend=function(){var t=this;this.panel.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},t}(t);t.modes.reveal=n;var s=function(s){function t(t){var e,n=s.call(this,t)||this;return n.styles.base.menu=((e={transition:"transform "+n.timing+"ms "+n.timingFunction,overflowX:"hidden",overflowY:"auto",position:"fixed"})[n.side]="-"+n.width+"px",e.top="0",e.bottom="0",e.width=n.width+"px",e.zIndex="1",e),n.styles.open.menu={transform:"translateX("+("right"===n.side?"-":"")+n.width+"px)"},n.styles.closed.menu={transform:"translateX(0)"},Object.assign(n.menu.style,n.styles.base.menu,n.styles.closed.menu),Object.assign(n.panel.style,n.styles.base.panel,n.styles.closed.panel),n.initTransitionend(),n}return e(t,s),t.prototype.offset=function(){var t=this.menu.getBoundingClientRect();return"left"===this.side?t.left+this.width:window.innerWidth-t.left},t.prototype.applyOffset=function(t){var e="left"===this.side?1:-1;this.menu.style.transform="translateX("+t*e+"px)"},t.prototype.afterTransitionend=function(t){this.onTransitionend=t},t.prototype.initTransitionend=function(){var t=this;this.menu.addEventListener("transitionend",function(){t.onTransitionend&&t.onTransitionend(),t.onTransitionend=null},!1)},t}(t);return t.modes.drawer=s,Element.prototype.matches=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector,Object.entries=function(e){return Object.keys(e).map(function(t){return[t,e[t]]})},Object.values=function(e){return Object.keys(e).map(function(t){return e[t]})},Object.assign=Object.assign||function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var s=0,i=e;s<i.length;s++)for(var o=i[s],r=0,a=Object.entries(o);r<a.length;r++){var u=a[r],h=u[0],l=u[1];t[h]=l}return t},Array.prototype.includes=function(t){return-1!==this.indexOf(t)},t});
//# sourceMappingURL=pulling.min.js.map
{
"name": "pulling",
"version": "1.1.1",
"version": "1.1.2",
"description": "Flexible slideout menu for mobile webapps",

@@ -14,3 +14,3 @@ "main": "build/pulling.js",

"type": "git",
"url": "git+https://github.com/pitaj/pulling.git"
"url": "git+https://github.com/nodebb/pulling.git"
},

@@ -28,5 +28,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/pitaj/pulling/issues"
"url": "https://github.com/nodebb/pulling/issues"
},
"homepage": "https://github.com/pitaj/pulling#readme",
"homepage": "https://github.com/nodebb/pulling#readme",
"devDependencies": {

@@ -33,0 +33,0 @@ "rollup": "^0.51.1",

@@ -8,5 +8,5 @@ import { assertArg } from './util';

export default class Pulling {
export default abstract class Pulling {
static modes: {
[key: string]: typeof Pulling;
[key: string]: new (options: Options) => Pulling;
} = {};

@@ -13,0 +13,0 @@

@@ -18,7 +18,7 @@ export function assertArg(condition: any, message: string) {

Object.entries = Object.entries || ((obj: any) => {
return Object.keys(obj).map(key => [key, obj[key]]);
Object.entries = /* Object.entries || */ ((obj: any) => {
return Object.keys(obj).map(key => [key, obj[key]] as [string, any]);
});
Object.values = Object.values || ((obj: any) => {
Object.values = /* Object.values || */ ((obj: any) => {
return Object.keys(obj).map(key => obj[key]);

@@ -25,0 +25,0 @@ });

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc