Comparing version 1.0.0 to 1.1.0
@@ -107,3 +107,2 @@ (function (global, factory) { | ||
assertArg(this.side === 'left' || this.side === 'right', '`side` must be equal to "left" or "right"'); | ||
assertArg(this.mode === 'drawer' || this.mode === 'reveal', '`type` must be equal to "drawer" or "reveal"'); | ||
assertArg(typeof this.margin === 'number', '`margin` must be of type "number"'); | ||
@@ -117,3 +116,3 @@ assertArg(typeof this.timing === 'number', '`timing` must be of type "number"'); | ||
Pulling.create = function (options) { | ||
var mode = options.mode || 'drawer'; | ||
var mode = options.mode || Object.keys(Pulling.modes)[0] || 'drawer'; | ||
if (!Pulling.modes[mode]) { | ||
@@ -120,0 +119,0 @@ var modes = Object.keys(Pulling.modes).map(function (x) { return "\"" + x + "\""; }).join(', '); |
@@ -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=null==t.touch||t.touch,n}return t(n,e),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,l=0,c=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,l=o,c=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-l)*h;if(!(Math.abs(g)<10)){if(v){var b=r-c;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 w=Math.min(Math.max(0,d+g),n);t.applyOffset(w),y=p,p=i,m=f,f=Date.now(),v=!1}}},onTouchend:function(e){if(t.touched){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,l=s.timing,c=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=l||200,this.timingFunction=c||"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("drawer"===this.mode||"reveal"===this.mode,'`type` must be equal to "drawer" or "reveal"'),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||"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.prototype.applyOffset=function(t){},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.touch&&n.addTouchEvents(),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){var e=this,n=function(){e.panel.removeEventListener("transitionend",n),t()};this.panel.removeEventListener("transitionend",this.prevTransitionEnd),this.prevTransitionEnd=n,this.panel.addEventListener("transitionend",n,!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.touch&&n.addTouchEvents(),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){var e=this,n=function(){e.menu.removeEventListener("transitionend",n),t()};this.menu.removeEventListener("transitionend",this.prevTransitionEnd),this.prevTransitionEnd=n,this.menu.addEventListener("transitionend",n,!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],l=u[1];t[h]=l}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 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=null==t.touch||t.touch,n}return t(n,e),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 w=Math.min(Math.max(0,d+g),n);t.applyOffset(w),y=p,p=i,m=f,f=Date.now(),v=!1}}},onTouchend:function(e){if(t.touched){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.prototype.applyOffset=function(t){},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.touch&&n.addTouchEvents(),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){var e=this,n=function(){e.panel.removeEventListener("transitionend",n),t()};this.panel.removeEventListener("transitionend",this.prevTransitionEnd),this.prevTransitionEnd=n,this.panel.addEventListener("transitionend",n,!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.touch&&n.addTouchEvents(),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){var e=this,n=function(){e.menu.removeEventListener("transitionend",n),t()};this.menu.removeEventListener("transitionend",this.prevTransitionEnd),this.prevTransitionEnd=n,this.menu.addEventListener("transitionend",n,!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}); | ||
//# sourceMappingURL=pulling.min.js.map |
{ | ||
"name": "pulling", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Flexible slideout menu for mobile webapps", | ||
@@ -5,0 +5,0 @@ "main": "build/pulling.js", |
@@ -7,21 +7,63 @@ import typescript from 'typescript'; | ||
export default { | ||
input: 'src/index.ts', | ||
export default [ | ||
{ | ||
input: 'src/all.ts', | ||
output: { | ||
file: prod ? 'build/pulling.min.js' : 'build/pulling.js', | ||
format: 'umd', | ||
name: 'Pulling', | ||
sourcemap: true, | ||
amd: { | ||
id: 'pulling', | ||
output: { | ||
file: prod ? 'build/pulling.min.js' : 'build/pulling.js', | ||
format: 'umd', | ||
name: 'Pulling', | ||
sourcemap: true, | ||
amd: { | ||
id: 'pulling', | ||
}, | ||
}, | ||
plugins: [ | ||
tsPlugin({ | ||
typescript, | ||
}), | ||
(prod && uglify()), | ||
], | ||
}, | ||
{ | ||
input: 'src/drawer-only.ts', | ||
plugins: [ | ||
tsPlugin({ | ||
typescript, | ||
}), | ||
(prod && uglify()), | ||
], | ||
}; | ||
output: { | ||
file: prod ? 'build/pulling-drawer.min.js' : 'build/pulling-drawer.js', | ||
format: 'umd', | ||
name: 'Pulling', | ||
sourcemap: true, | ||
amd: { | ||
id: 'pulling', | ||
}, | ||
}, | ||
plugins: [ | ||
tsPlugin({ | ||
typescript, | ||
}), | ||
(prod && uglify()), | ||
], | ||
}, | ||
{ | ||
input: 'src/reveal-only.ts', | ||
output: { | ||
file: prod ? 'build/pulling-reveal.min.js' : 'build/pulling-reveal.js', | ||
format: 'umd', | ||
name: 'Pulling', | ||
sourcemap: true, | ||
amd: { | ||
id: 'pulling', | ||
}, | ||
}, | ||
plugins: [ | ||
tsPlugin({ | ||
typescript, | ||
}), | ||
(prod && uglify()), | ||
], | ||
}, | ||
]; |
@@ -14,3 +14,3 @@ import { assertArg } from './util'; | ||
static create(options: Options) { | ||
const mode = options.mode || 'drawer'; | ||
const mode = options.mode || Object.keys(Pulling.modes)[0] || 'drawer'; | ||
if (!Pulling.modes[mode]) { | ||
@@ -96,6 +96,2 @@ const modes = Object.keys(Pulling.modes).map(x => `"${x}"`).join(', '); | ||
assertArg( | ||
this.mode === 'drawer' || this.mode === 'reveal', | ||
'`type` must be equal to "drawer" or "reveal"', | ||
); | ||
assertArg( | ||
typeof this.margin === 'number', | ||
@@ -102,0 +98,0 @@ '`margin` must be of type "number"', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
299569
28
2333