carousel-html5
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Carousel",[],e):"object"==typeof exports?exports.Carousel=e():t.Carousel=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e){function i(t){if(!(this instanceof i))return void a("Carousel is a constructor and should be called with the `new` keyword");var e=t||{};this.root=h(e.root),this.itemWrap=this.root.children[0];var n=this.itemWrap.children;n.length<2||(n.length<3&&this.fill(n),this.items=Array.prototype.slice.call(this.itemWrap.children,0),this.length=this.items.length,this.speed=e.speed||300,this.onSwitch=e.onSwitch||function(){},this.indexArray=o(this.length),this.init(),this.handleEvent(),e.interval&&(this.interval=e.interval,this.play()))}function n(t,e,i){t.style.transform=e,t.style.transitionDuration=i+"ms"}function o(t){for(var e=[],i=0;i<t;i++)e.push(i);return e}function r(t,e){var i=e.match(/[A-Z]/g);if(!t.currentStyle&&i)for(var n=e,o=0;o<i.length;o++){var r=i[o];n=n.replace(r,"-"+r.toLowerCase())}return parseFloat(t.currentStyle&&t.currentStyle[n]||getComputedStyle(t,null)[e])}function s(t){var e=r(t,"width"),i=r(t,"paddingLeft"),n=r(t,"paddingRight"),o=e-i-n;return o>0&&o||document.clientWidth||document.documentElement.clientWidth}function h(t){return t&&("string"==typeof t||"object"==typeof t&&1===t.nodeType)||a("element does not exist"),"string"==typeof t&&document.querySelector("#"+t)||t}function a(t){throw new Error(t)}i.prototype.play=function(){this.timer=setInterval(function(){this.move("left")}.bind(this),this.interval)},i.prototype.stop=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},i.prototype.handleTransitionEnd=function(){null===this.timer&&this.play()},i.prototype.handleEvent=function(){this.itemWrap.addEventListener("touchstart",this.handleTouchStart.bind(this),!1),this.itemWrap.addEventListener("transitionend",this.handleTransitionEnd.bind(this),!1),window.addEventListener("resize",this.init.bind(this),!1),this.onSwitch(0)},i.prototype.handleTouchStart=function(){this.stop();var t=event.touches[0];this.touchStart={x:t.pageX,y:t.pageY,time:Date.now()},this.bindTouchMoveFn=this.handleTouchMove.bind(this),this.bindTouchEndFn=this.handleTouchEnd.bind(this),this.itemWrap.addEventListener("touchmove",this.bindTouchMoveFn,!1),this.itemWrap.addEventListener("touchend",this.bindTouchEndFn,!1)},i.prototype.handleTouchMove=function(){if(!(event.touches.length>1||event.scale&&1!==event.scale)){var t=event.touches[0],e=this.touchStart,i=this.delta={x:t.pageX-e.x,y:t.pageY-e.y};this.isScrolling=this.isScrolling||Math.abs(i.x)>Math.abs(i.y),this.isScrolling&&(event.preventDefault(),this.handleMove(i.x))}},i.prototype.handleTouchEnd=function(){if(this.itemWrap.removeEventListener("touchmove",this.bindTouchMoveFn,!1),this.itemWrap.removeEventListener("touchend",this.bindTouchEndFn,!1),!this.delta)return void(null===this.timer&&this.play());var t=Date.now()-this.touchStart.time,e=Math.abs(this.delta.x),i=t<250&&e>20||e>this.offset/2,n=["left","right"],o=this.delta.x>0?n.pop():n.shift(),r=n[0];i?this.move(o):this.handleMove(r),this.delta=null,this.isScrolling=!1},i.prototype.getIndex=function(){var t=this.indexArray[0];return this.__fill?t%2:t},i.prototype.move=function(t){var e=this.indexArray;"left"===t?e.push(e.shift()):e.unshift(e.pop()),this.handleMove(t),this.onSwitch(this.getIndex())},i.prototype.handleMove=function(t){for(var e="string"==typeof t?0:t,i="string"==typeof t?t:t>0?"right":"left",o=this.indexArray.slice(0),r=this.getTransform(e),s=0,h=[];s<3;)h[s]=s<2?o.shift():o.pop(),s++;var a="left"===i?h[1]:h[2];if(h.forEach(function(t,i){var o=t===a||0!==e?0:this.speed;n(this.items[t],r[i],o)}.bind(this)),o.length&&0===e){var l="left"===i?o.pop():o.shift();n(this.items[l],this.hideTransform,0)}},i.prototype.getTransform=function(t){return["translate("+t+"px, 0px) translateZ(0px)","translate("+(this.offset+t)+"px, 0px) translateZ(0px)","translate("+(-this.offset+t)+"px, 0px) translateZ(0px)"]},i.prototype.init=function(){this.offset=s(this.root),this.hideTransform="translate("+this.offset+"px, 0px) translateZ(0px)",this.itemWrap.style.width=this.offset*this.length+"px";for(var t=this.getTransform(0),e=this.indexArray.slice(0),i=new Array(this.length),o=0;o<3;)i[o<2?e.shift():e.pop()]=t[o++];this.items.forEach(function(t,e){t.style.width=this.offset+"px",t.style.left=-this.offset*e+"px",n(t,i[e]||this.hideTransform,0)}.bind(this))},i.prototype.fill=function(t){this.__fill=!0;var e=t[0],i=t[1],n=e.cloneNode(!0),o=i.cloneNode(!0);this.itemWrap.appendChild(n),this.itemWrap.appendChild(o)},t.exports=i}])}); | ||
| !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Carousel",[],e):"object"==typeof exports?exports.Carousel=e():t.Carousel=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e){function i(t){if(!(this instanceof i))return void a("Carousel is a constructor and should be called with the `new` keyword");var e=t||{};this.root=h(e.root),this.itemWrap=this.root.children[0];var n=this.itemWrap.children;n.length<2||(n.length<3&&this.fill(n),this.items=Array.prototype.slice.call(this.itemWrap.children,0),this.length=this.items.length,this.speed=e.speed||300,this.onSwitch=e.onSwitch||function(){},this.indexArray=r(this.length),this.init(),this.handleEvent(),e.interval&&(this.interval=e.interval,this.play()))}function n(t,e,i){t.style.transform=e,t.style.transitionDuration=i+"ms"}function r(t){for(var e=[],i=0;i<t;i++)e.push(i);return e}function o(t,e){var i=e.match(/[A-Z]/g);if(!t.currentStyle&&i)for(var n=e,r=0;r<i.length;r++){var o=i[r];n=n.replace(o,"-"+o.toLowerCase())}return parseFloat(t.currentStyle&&t.currentStyle[n]||getComputedStyle(t,null)[e])}function s(t){var e=o(t,"width"),i=o(t,"paddingLeft"),n=o(t,"paddingRight"),r=e-i-n;return r>0&&r||document.clientWidth||document.documentElement.clientWidth}function h(t){return t&&("string"==typeof t||"object"==typeof t&&1===t.nodeType)||a("element does not exist"),"string"==typeof t&&document.querySelector("#"+t)||t}function a(t){throw new Error(t)}i.prototype.play=function(){this.timer=setInterval(function(){this.move("left")}.bind(this),this.interval)},i.prototype.stop=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},i.prototype.handleTransitionEnd=function(){null===this.timer&&this.play()},i.prototype.handleEvent=function(){this.itemWrap.addEventListener("touchstart",this.handleTouchStart.bind(this),!1),this.itemWrap.addEventListener("touchmove",this.handleTouchMove.bind(this),!1),this.itemWrap.addEventListener("transitionend",this.handleTransitionEnd.bind(this),!1),window.addEventListener("resize",this.init.bind(this),!1),this.onSwitch(0)},i.prototype.handleTouchStart=function(){this.stop();var t=event.touches[0];this.touchStart={x:t.pageX,y:t.pageY,time:Date.now()},this.bindTouchEndFn=this.handleTouchEnd.bind(this),this.itemWrap.addEventListener("touchend",this.bindTouchEndFn,!1)},i.prototype.handleTouchMove=function(){if(!(event.touches.length>1||event.scale&&1!==event.scale)){var t=event.touches[0],e=this.touchStart,i=this.delta={x:t.pageX-e.x,y:t.pageY-e.y};this.isScrolling=this.isScrolling||Math.abs(i.x)>Math.abs(i.y),this.isScrolling&&(event.preventDefault(),this.handleMove(i.x))}},i.prototype.handleTouchEnd=function(){if(this.itemWrap.removeEventListener("touchend",this.bindTouchEndFn,!1),!this.isScrolling)return void(null===this.timer&&this.play());var t=Date.now()-this.touchStart.time,e=Math.abs(this.delta.x),i=t<250&&e>20||e>this.offset/2,n=["left","right"],r=this.delta.x>0?n.pop():n.shift(),o=n[0];i?this.move(r):this.handleMove(o),this.delta=null,this.isScrolling=!1},i.prototype.getIndex=function(){var t=this.indexArray[0];return this.__fill?t%2:t},i.prototype.move=function(t){var e=this.indexArray;"left"===t?e.push(e.shift()):e.unshift(e.pop()),this.handleMove(t),this.onSwitch(this.getIndex())},i.prototype.handleMove=function(t){for(var e="string"==typeof t?0:t,i="string"==typeof t?t:t>0?"right":"left",r=this.indexArray.slice(0),o=this.getTransform(e),s=0,h=[];s<3;)h[s]=s<2?r.shift():r.pop(),s++;var a="left"===i?h[1]:h[2];if(h.forEach(function(t,i){var r=t===a||0!==e?0:this.speed;n(this.items[t],o[i],r)}.bind(this)),r.length&&0===e){var l="left"===i?r.pop():r.shift();n(this.items[l],this.hideTransform,0)}},i.prototype.getTransform=function(t){return["translate("+t+"px, 0px) translateZ(0px)","translate("+(this.offset+t)+"px, 0px) translateZ(0px)","translate("+(-this.offset+t)+"px, 0px) translateZ(0px)"]},i.prototype.init=function(){this.offset=s(this.root),this.hideTransform="translate("+this.offset+"px, 0px) translateZ(0px)",this.itemWrap.style.width=this.offset*this.length+"px";for(var t=this.getTransform(0),e=this.indexArray.slice(0),i=new Array(this.length),r=0;r<3;)i[r<2?e.shift():e.pop()]=t[r++];this.items.forEach(function(t,e){t.style.width=this.offset+"px",t.style.left=-this.offset*e+"px",n(t,i[e]||this.hideTransform,0)}.bind(this))},i.prototype.fill=function(t){this.__fill=!0;var e=t[0],i=t[1],n=e.cloneNode(!0),r=i.cloneNode(!0);this.itemWrap.appendChild(n),this.itemWrap.appendChild(r)},t.exports=i}])}); |
+2
-2
| { | ||
| "name": "carousel-html5", | ||
| "version": "1.0.6", | ||
| "version": "1.0.7", | ||
| "description": "carousel", | ||
@@ -54,4 +54,4 @@ "main": "dist/carousel.js", | ||
| "dependencies": { | ||
| "carousel-html5": "^1.0.4" | ||
| "carousel-html5": "^1.0.6" | ||
| } | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
1
-50%7847
-0.1%Updated