embla-carousel
Advanced tools
Comparing version 3.0.17 to 3.0.18
@@ -350,3 +350,3 @@ function _extends() { | ||
mouse: 2.5, | ||
touch: 4 | ||
touch: 3.5 | ||
}; | ||
@@ -353,0 +353,0 @@ var freeForceBoost = { |
@@ -352,3 +352,3 @@ 'use strict'; | ||
mouse: 2.5, | ||
touch: 4 | ||
touch: 3.5 | ||
}; | ||
@@ -355,0 +355,0 @@ var freeForceBoost = { |
@@ -1,2 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).EmblaCarousel=e()}(this,(function(){"use strict";function n(){return(n=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function e(n){var e=n.viewSize,t=n.align,r={start:function(){return 0},center:function(n){return(e-n)/2},end:function(n){return e-n}};return{measure:function(n){return"number"==typeof t?e*Number(t):r[t](n)}}}function t(n){var e=n.start,r=n.limit,o=n.loop,i=r.min,a=r.max,u=o?"loop":"constrain",c=f(e);function s(){return c}function l(n){return c=f(n),d}function f(n){return r[u](n)}var d={add:function n(e){if(0!==e){var t=e/Math.abs(e);return l(s()+t),n(e+-1*t)}return d},clone:function(){return t({start:s(),limit:r,loop:o})},get:s,max:a,min:i,set:l};return d}function r(n){var e=n;function t(n){return e/=n,o}function r(n){return"number"==typeof n?n:n.get()}var o={add:function(n){return e+=r(n),o},divide:t,get:function(){return e},multiply:function(n){return e*=n,o},normalize:function(){return 0!==e&&t(e),o},set:function(n){return e=r(n),o},subtract:function(n){return e-=r(n),o}};return o}function o(n){var e=r(t(n));function t(n){return 0===n?0:n/Math.abs(n)}var o={get:e.get,set:function(n){var r=t(n.get());return 0!==r&&e.set(r),o}};return o}function i(){var n=[];var e={add:function(t,r,o,i){return void 0===i&&(i=!1),t.addEventListener(r,o,i),n.push((function(){return t.removeEventListener(r,o,i)})),e},removeAll:function(){return n.filter((function(n){return n()})),n.length=0,e}};return e}function a(n){var e=n.min,t=n.max,r={min:t,max:e},o={min:e,max:t},i=Math.abs(e-t);function a(n){return n<e}function u(n){return n>t}function c(n){return a(n)?"min":u(n)?"max":""}return{constrain:function(n){var e=c(n);return e?o[e]:n},length:i,loop:function(n){var e=c(n);return e?r[e]:n},max:t,min:e,reachedAny:function(n){return a(n)||u(n)},reachedMax:u,reachedMin:a,removeOffset:function(n){if(e===t)return n;for(;a(n);)n+=i;for(;u(n);)n-=i;return n}}}function u(n){var e=n.target,t=n.scrollBody,u=n.dragFree,c=n.animation,s=n.axis,l=n.element,f=n.dragTracker,d=n.location,m=n.events,v=n.limit,p=s.scroll,g=s.cross,x=["INPUT","SELECT","TEXTAREA"],h=r(0),S=r(0),y=r(0),w=i(),b=i(),M=w.removeAll,T=b.removeAll,z={mouse:2.5,touch:4},D={mouse:4,touch:7},E={mouse:12,touch:14},P={mouse:5,touch:5},A=a({min:v.min-70,max:v.max+70}),I=!1,B=!1,L=!1,C=!1;function O(){return(u?P:E)[C?"mouse":"touch"]}function k(r){var o,i,a,u=r+d.get();if(!n.loop&&A.reachedAny(u)){var c=A.reachedMax(u)?"max":"min",s=A[c]-e.get(),l=(o=r,i=s,a=F(Math.abs(o),Math.abs(i)),Math.abs(o)<=Math.abs(i)||0===o||0===i?0:Math.abs(a/o));return t.useSpeed(O()+O()*l),0===l?r:s}return t.useSpeed(O()),r}function N(n){if(!(C="mousedown"===n.type)||0===n.button){var r,o,i=F(e.get(),d.get())>=2,a=C||!i,u=(r=n.target,o=r.nodeName||"",!(x.indexOf(o)>-1)),c=i||C&&u;I=!0,f.pointerDown(n),y.set(e),e.set(d),t.useDefaultMass().useSpeed(80),function(){var n=C?document:l;b.add(n,"touchmove",U).add(n,"touchend",V).add(n,"mousemove",U).add(n,"mouseup",V)}(),h.set(f.readPoint(n,p)),S.set(f.readPoint(n,g)),m.emit("pointerDown"),a&&(L=!1),c&&n.preventDefault()}}function U(t){if(!B&&!C){var r=f.readPoint(t,p).get(),o=f.readPoint(t,g).get(),i=F(r,h.get()),a=F(o,S.get());if(!(B=i>a)&&!L)return V()}var u=f.pointerMove(t),s=v.reachedAny(d.get()),l=!n.loop&&s?2:1;!L&&u&&(L=!0),c.start(),e.add(u/l),t.preventDefault()}function V(){var t=f.pointerUp()*(u?D:z)[C?"mouse":"touch"];F(e.get(),y.get())>=.5&&!C&&(L=!0),B=!1,I=!1,b.removeAll(),function(t){var r=n.scrollTo,i=n.scrollTarget,a=n.index,c=v.reachedAny(e.get()+t),s=!(i.byDistance(0,!1).index!==a.get())&&Math.abs(t)>4;if(u||c||!s)r.distance(t,!u);else{var l=-1*o(t).get(),f=a.clone().add(l);r.index(f.get(),0)}}(k(t)),C=!1,m.emit("pointerUp")}function F(n,e){return Math.abs(n-e)}function j(n){L&&n.preventDefault()}return{addActivationEvents:function(){var n=l;w.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",N).add(n,"mousedown",N).add(n,"touchcancel",V).add(n,"contextmenu",V).add(n,"click",j)},clickAllowed:function(){return!L},pointerDown:function(){return I},removeActivationEvents:M,removeInteractionEvents:T}}function c(n){var e=n.axis,t=n.pxToPercent,o=e.scroll,i={x:"clientX",y:"clientY"},a=r(0),u=r(0),c=r(0),s=r(0),l=[],f=(new Date).getTime(),d=!1;function m(n,e){d=!n.touches;var t=i[e],r=d?n[t]:n.touches[0][t];return s.set(r)}return{pointerDown:function(n){var e=m(n,o);return a.set(e),c.set(e),t.measure(a.get())},pointerMove:function(n){var e=m(n,o),r=(new Date).getTime();return r-f>=10&&(l.push(e.get()),f=r),u.set(e).subtract(c),c.set(e),t.measure(u.get())},pointerUp:function(){var n=c.get(),e=d?5:4,r=l.slice(-e).map((function(e){return n-e})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return c.set(r||0),l=[],t.measure(c.get())},readPoint:m}}function s(n){var e=Math.pow(10,n);return function(n){return Math.round(n*e)/e}}function l(n){return Object.keys(n).map(Number)}function f(n,e){var t=n.classList;t.contains(e)&&t.remove(e)}function d(n,e){var t=n.classList;t.contains(e)||t.add(e)}function m(n){var e=n.location,t=n.speed,i=n.mass,a=s(2),u=r(0),c=r(0),l=r(0),f=o(0),d={speed:t,mass:i};function m(n){return d.speed=n,p}function v(n){return d.mass=n,p}var p={direction:f,location:e,seek:function(n){l.set(n).subtract(e);var t,r,o,i,a,s=l.get(),m=(t=s,r=0,o=100,i=0,a=d.speed,i+(t-r)/(o-r)*(a-i));return f.set(l),l.normalize().multiply(m).subtract(u),function(n){n.divide(d.mass),c.add(n)}(l),p},settle:function(n){var t=n.get()-e.get(),r=!a(t);return r&&e.set(n),r},update:function(){u.add(c),e.add(u),c.multiply(0)},useDefaultMass:function(){return v(i),p},useDefaultSpeed:function(){return m(t),p},useMass:v,useSpeed:m};return p}function v(n){var e=n.limit,t=n.location,r=n.scrollBody,o=n.animation,i=e.min,a=e.max,u=e.reachedMin,c=e.reachedMax,s=!1,l=0;return{constrain:function(n){(function(n){return!s&&!l&&(u(t.get())?n.get()!==i:!!c(t.get())&&n.get()!==a)})(n)&&(l=window.setTimeout((function(){var t=e.constrain(n.get());n.set(t),r.useSpeed(10).useMass(3),o.start(),l=0}),50))},toggleActive:function(n){s=!n}}}function p(n){var e=n.alignment,t=n.contentSize,r=n.viewSize,o=a({min:-t+r,max:0}),i=[e.measure(t)],u=t>r;return{measure:function(n,e){var t=n.map(o.constrain),r=function(n){var e=n[0],t=n[n.length-1];return a({min:n.lastIndexOf(e)+1,max:n.indexOf(t)})}(t),c=r.min,s=r.max;return u?e?t.slice(c-1,s+1):t:i}}}function g(n){var e=n.contentSize,t=n.location,r=n.limit,o=n.pxToPercent,i=a({min:r.min+o.measure(.1),max:r.max+o.measure(.1)}),u=i.reachedMin,c=i.reachedMax;return{loop:function(n,r){if(function(n){return 1===n?c(t.get()):-1===n&&u(t.get())}(r)){var o=e*(-1*r);n.forEach((function(n){return n.add(o)}))}}}}function x(n){var e=n.loop,t=n.limit,r=n.scrollSnaps,o=n.contentSize,i=t.reachedMax,a=t.reachedAny,u=t.removeOffset;function c(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(n,t){var r=n,i=n+o,a=n-o;if(!e)return r;if(!t)return c(c(r,i),a);var u=c(r,1===t?i:a);return Math.abs(u)*t}return{byDistance:function(t,o){var c=n.target.get()+t,l=function(n){var e=u(n);return{index:r.map((function(n){return n-e})).map((function(n){return s(n,0)})).map((function(n,e){return{diff:n,index:e}})).sort((function(n,e){return Math.abs(n.diff)-Math.abs(e.diff)}))[0].index,distance:e}}(c),f=function(t,r){if(!(!e&&a(t)))return r;var o=n.index,u=o.min,c=o.max;return i(t)?u:c}(c,l.index),d=!e&&a(c);return!o||d?{index:f,distance:t}:{index:f,distance:t+s(r[f]-l.distance,0)}},byIndex:function(e,t){return{index:e,distance:s(r[e]-n.target.get(),t)}},shortcut:s}}function h(n){var e,t,r,o=n.axis,i=n.location,a=n.contentSize,u=n.viewSize,c=n.slideSizes,s=n.scrollSnaps,f=l(c),d=l(c).reverse(),m=(e=s[0]-1,t=g(e,d),r=x(e,t,0),h(t,r,1)).concat(function(){var n=g(u-s[0]-1,f),e=x(a,f,-u);return h(n,-e,0)}()),v="x"===o.scroll?"left":"top";function p(n,e){return n.reduce((function(n,e){return n-c[e]}),e)}function g(n,e){return e.reduce((function(e,t){return p(e,n)>0?e.concat([t]):e}),[])}function x(n,e,t){return e.reduce((function(e,t){var r=e+c[t];return r<n?r:e}),t)}function h(n,e,t){var r=n.slice().sort((function(n,e){return n-e}));return r.map((function(n,o){var i=a*(t?-1:0),u=a*(t?0:1),c=function(n,e,t){var r=f.length-1;return p(n.map((function(n){return(n+t)%r})),e)}(r.slice(0,o),e,t);return{point:c,getTarget:function(n){return n>c?i:u},index:n,location:-1}}))}return{canLoop:function(){return m.every((function(n){var e=n.index;return p(f.filter((function(n){return n!==e})),u)<=0}))},clear:function(n){m.forEach((function(e){var t=e.index;n[t].style[v]=""}))},loop:function(n){m.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,a=t(i.get());a!==r&&(n[o].style[v]=a+"%",e.location=a)}))},loopPoints:m}}function S(n){var e=n.contentSize,t=n.slideSizes,r=n.viewSize,o=n.inViewThreshold,i=n.loop,a=t.map((function(n){return n*o})),u=l(t).map((function(n){return t.slice(0,n).reduce((function(n,e){return n-e}),0)})),c=(i?[0,e,-e]:[0]).map(s).reduce((function(n,e){return n.concat(e)}),[]);function s(n){return u.map((function(e,o){return{start:e-t[o]+a[o]+n,end:e+r-a[o]+n,index:o}}))}return{check:function(n){return c.reduce((function(e,t){var r=t.index,o=t.start,i=t.end;return!(-1!==e.indexOf(r))&&(o<n&&i>n)?e.concat([r]):e}),[])}}}function y(n){var e=n.axis,t=n.container,r={x:function(n){return"translate3d("+n+"%,0px,0px)"},y:function(n){return"translate3d(0px,"+n+"%,0px)"}}[e.scroll],o=s(2),i=t.style,a=!1,u=0;return{clear:function(){i.transform="",u=0},to:function(n){if(!a){var e=o(n.get());u!==e&&(getComputedStyle(t).transform,i.transform=r(e),u=e)}},toggleActive:function(n){a=!n}}}function w(n,o,i,s,f){var d,w,b,M,T=s.align,z=s.axis,D=s.startIndex,E=s.inViewThreshold,P=s.loop,A=s.speed,I=s.dragFree,B=s.slidesToScroll,L=s.containScroll,C=function(n){var e="y"===n?"y":"x";return{cross:"y"===n?"x":"y",measure:function(n){var t=n.getBoundingClientRect(),r=t.width,o=t.height;return"x"===e?r:o},scroll:e}}(z),O=function(n){var e={measure:function(e){return e/n*100},totalPercent:100};return Object.freeze(e)}(C.measure(o)),k=O.totalPercent,N=i.map(C.measure).map(O.measure),U=function(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}(N,B).map((function(n){return n.reduce((function(n,e){return n+e}))})),V=l(U),F=N.reduce((function(n,e){return n+e}),0),j=e({align:T,viewSize:k}),H=function(n){var e,r=n.snapSizes,o=n.alignment,i=n.loop,u=r.map(o.measure),c=(e=t({limit:a({min:0,max:r.length-1}),start:0,loop:i}),r.map((function(n,t){var r=e.set(t+1).get();return n+u[t]-u[r]})));return{measure:function(n){return c.slice(0,n).reduce((function(n,e){return n-e}),u[0])}}}({snapSizes:U,alignment:j,loop:P}),q=V.map(H.measure),R=p({alignment:j,contentSize:F,viewSize:k}),X=!P&&""!==L,G="trimSnaps"===L,Y=R.measure(q,G),J=X?Y:q,K=t({limit:a({min:0,max:J.length-1}),start:D,loop:P}),Q=K.clone(),W=function(n){var e=n.contentSize,t=n.loop;return{measure:function(n){var r=n[0],o=n[n.length-1];return a({min:t?r-e:o,max:r})}}}({loop:P,contentSize:F}).measure(J),Z=function(n){var e=requestAnimationFrame.bind(window),t=cancelAnimationFrame.bind(window),r=0;function o(n,e){return function(){n===!!r&&e()}}function i(){r=e(n)}return{proceed:o(!0,i),start:o(!1,i),stop:o(!0,(function(){t(r),r=0}))}}((function(){un.scrollBody.seek(nn).update();var n=un.scrollBody.settle(nn);if(an.pointerDown()||(P||un.scrollBounds.constrain(nn),n&&(un.animation.stop(),f.emit("settle"))),P){var e=un.scrollBody.direction.get();un.scrollLooper.loop(en,e),un.slideLooper.loop(i)}n||f.emit("scroll"),un.translate.to(un.scrollBody.location),un.animation.proceed()})),$=J[K.get()],_=r($),nn=r($),en=[_,nn],tn=m({location:_,speed:A,mass:1}),rn=x({contentSize:F,index:K,limit:W,loop:P,scrollSnaps:J,target:nn}),on=function(n){var e=n.index,t=n.scrollTarget,r=n.animation,o=n.indexPrevious,i=n.events,a=n.target;function u(n){var t=n.distance,u=n.index!==e.get();t&&(r.start(),a.add(t)),u&&(o.set(e.get()),e.set(n.index),i.emit("select"))}return{distance:function(n,e){u(t.byDistance(n,e))},index:function(n,r){var o=e.clone().set(n);u(t.byIndex(o.get(),r))}}}({animation:Z,events:f,index:K,indexPrevious:Q,scrollTarget:rn,target:nn}),an=u({animation:Z,axis:C,dragFree:I,dragTracker:c({axis:C,pxToPercent:O}),element:n,events:f,index:K,limit:W,location:_,loop:P,scrollBody:tn,scrollTo:on,scrollTarget:rn,target:nn}),un={animation:Z,axis:C,dragHandler:an,pxToPercent:O,index:K,indexPrevious:Q,limit:W,location:_,options:s,scrollBody:tn,scrollBounds:v({animation:Z,limit:W,location:_,scrollBody:tn}),scrollLooper:g({contentSize:F,limit:W,location:_,pxToPercent:O}),scrollProgress:(d={limit:W},w=d.limit,b=w.max,M=w.length,{get:function(n){return(n-b)/-M}}),scrollSnaps:J,scrollTarget:rn,scrollTo:on,slideLooper:h({axis:C,contentSize:F,location:_,scrollSnaps:J,slideSizes:N,viewSize:k}),slidesInView:S({contentSize:F,inViewThreshold:E,loop:P,slideSizes:N,viewSize:k}),snapIndexes:V,target:nn,translate:y({axis:C,container:o})};return un}var b={align:"center",axis:"x",containScroll:"",containerSelector:"*",dragFree:!1,draggable:!0,draggableClass:"is-draggable",draggingClass:"is-dragging",inViewThreshold:0,loop:!1,selectedClass:"is-selected",slidesToScroll:1,speed:10,startIndex:0};return function(e,t){void 0===t&&(t={});var r,o,a,u,c,s,l=function(){var n={destroy:[],pointerDown:[],pointerUp:[],init:[],reInit:[],resize:[],scroll:[],select:[],settle:[]},e={emit:function(t){return n[t].forEach((function(n){return n(t)})),e},off:function(t,r){return n[t]=n[t].filter((function(n){return n!==r})),e},on:function(t,r){return n[t]=n[t].concat([r]),e}};return e}(),m=i(),v=(r=function(){var n=u.axis.measure(c);y!==n&&P(),l.emit("resize")},o=500,a={id:0},function(){window.clearTimeout(a.id),a.id=window.setTimeout(r,o)||0}),p=P,g=l.on,x=l.off,h=!1,S=n({},b),y=0;function M(){if(!e)throw new Error("Missing root node 😢");var n,t=S.containerSelector,r=e.querySelector(t);if(!r)throw new Error("Missing container node 😢");n=(c=r).children,s=Array.prototype.slice.call(n)}function T(t){void 0===t&&(t={}),M(),S=n(S,t);var r=(u=w(e,c,s,S,l)).axis,o=u.scrollBody,i=u.translate,a=u.dragHandler,f=u.slideLooper,p=S.loop,g=S.draggable,x=S.draggableClass,b=S.selectedClass,T=S.draggingClass;if(y=r.measure(c),m.add(window,"resize",v),i.to(o.location),s.forEach(E),a.addActivationEvents(),p){if(!f.canLoop())return P({loop:!1});f.loop(s)}g?(x&&d(e,x),T&&(l.on("pointerDown",z),l.on("pointerUp",z))):l.on("pointerDown",a.removeInteractionEvents),b&&(D(),l.on("select",D),l.on("pointerUp",D)),h||(setTimeout((function(){return l.emit("init")}),0),h=!0)}function z(n){var t=S.draggingClass;"pointerDown"===n?d(e,t):f(e,t)}function D(){var n=S.selectedClass,e=I(!0);B(!0).forEach((function(e){return f(s[e],n)})),e.forEach((function(e){return d(s[e],n)}))}function E(n,t){m.add(n,"focus",(function(){var n=Math.floor(t/S.slidesToScroll),r=t?n:t;e.scrollLeft=0,L(r)}),!0)}function P(e){void 0===e&&(e={});var t=n({startIndex:u.index.get()},e);A(),T(t),l.emit("reInit")}function A(){var n=S.selectedClass,t=S.draggableClass;u.dragHandler.removeActivationEvents(),u.dragHandler.removeInteractionEvents(),u.animation.stop(),m.removeAll(),u.translate.clear(),u.slideLooper.clear(s),f(e,t),s.forEach((function(e){return f(e,n)})),l.off("select",D),l.off("pointerUp",D),l.off("pointerDown",z),l.off("pointerUp",z)}function I(n){void 0===n&&(n=!1);var e=u[n?"target":"location"].get(),t=S.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function B(n){void 0===n&&(n=!1);var e=I(n);return u.snapIndexes.filter((function(n){return-1===e.indexOf(n)}))}function L(n){u.scrollBody.useDefaultMass().useDefaultSpeed(),u.scrollTo.index(n,0)}return T(t),{canScrollNext:function(){var n=u.index;return S.loop||n.get()!==n.max},canScrollPrev:function(){var n=u.index;return S.loop||n.get()!==n.min},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return c},dangerouslyGetEngine:function(){return u},destroy:function(){h&&(A(),h=!1,u={},l.emit("destroy"))},off:x,on:g,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:p,scrollNext:function(){var n=u.index.clone().add(1);u.scrollBody.useDefaultMass().useDefaultSpeed(),u.scrollTo.index(n.get(),-1)},scrollPrev:function(){var n=u.index.clone().add(-1);u.scrollBody.useDefaultMass().useDefaultSpeed(),u.scrollTo.index(n.get(),1)},scrollProgress:function(){var n=u.location.get();return u.scrollProgress.get(n)},scrollSnapList:function(){var n=u.scrollProgress.get;return u.scrollSnaps.map(n)},scrollTo:L,selectedScrollSnap:function(){return u.index.get()},slideNodes:function(){return s},slidesInView:I,slidesNotInView:B}}})); | ||
//# sourceMappingURL=embla-carousel.umd.js.map | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).EmblaCarousel=e()}(this,(function(){"use strict";function n(){return(n=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function e(n){var e=n.viewSize,t=n.align,r={start:function(){return 0},center:function(n){return(e-n)/2},end:function(n){return e-n}};return{measure:function(n){return"number"==typeof t?e*Number(t):r[t](n)}}}function t(n){var e=n.start,r=n.limit,o=n.loop,i=r.min,a=r.max,u=o?"loop":"constrain",c=f(e);function s(){return c}function l(n){return c=f(n),d}function f(n){return r[u](n)}var d={add:function n(e){if(0!==e){var t=e/Math.abs(e);return l(s()+t),n(e+-1*t)}return d},clone:function(){return t({start:s(),limit:r,loop:o})},get:s,max:a,min:i,set:l};return d}function r(n){var e=n;function t(n){return e/=n,o}function r(n){return"number"==typeof n?n:n.get()}var o={add:function(n){return e+=r(n),o},divide:t,get:function(){return e},multiply:function(n){return e*=n,o},normalize:function(){return 0!==e&&t(e),o},set:function(n){return e=r(n),o},subtract:function(n){return e-=r(n),o}};return o}function o(n){var e=r(t(n));function t(n){return 0===n?0:n/Math.abs(n)}var o={get:e.get,set:function(n){var r=t(n.get());return 0!==r&&e.set(r),o}};return o}function i(){var n=[];var e={add:function(t,r,o,i){return void 0===i&&(i=!1),t.addEventListener(r,o,i),n.push((function(){return t.removeEventListener(r,o,i)})),e},removeAll:function(){return n.filter((function(n){return n()})),n.length=0,e}};return e}function a(n){var e=n.min,t=n.max,r={min:t,max:e},o={min:e,max:t},i=Math.abs(e-t);function a(n){return n<e}function u(n){return n>t}function c(n){return a(n)?"min":u(n)?"max":""}return{constrain:function(n){var e=c(n);return e?o[e]:n},length:i,loop:function(n){var e=c(n);return e?r[e]:n},max:t,min:e,reachedAny:function(n){return a(n)||u(n)},reachedMax:u,reachedMin:a,removeOffset:function(n){if(e===t)return n;for(;a(n);)n+=i;for(;u(n);)n-=i;return n}}}function u(n){var e=n.target,t=n.scrollBody,u=n.dragFree,c=n.animation,s=n.axis,l=n.element,f=n.dragTracker,d=n.location,m=n.events,v=n.limit,p=s.scroll,g=s.cross,x=["INPUT","SELECT","TEXTAREA"],h=r(0),S=r(0),y=r(0),w=i(),b=i(),M=w.removeAll,T=b.removeAll,z={mouse:2.5,touch:3.5},D={mouse:4,touch:7},E={mouse:12,touch:14},P={mouse:5,touch:5},A=a({min:v.min-70,max:v.max+70}),I=!1,B=!1,L=!1,C=!1;function O(){return(u?P:E)[C?"mouse":"touch"]}function k(r){var o,i,a,u=r+d.get();if(!n.loop&&A.reachedAny(u)){var c=A.reachedMax(u)?"max":"min",s=A[c]-e.get(),l=(o=r,i=s,a=F(Math.abs(o),Math.abs(i)),Math.abs(o)<=Math.abs(i)||0===o||0===i?0:Math.abs(a/o));return t.useSpeed(O()+O()*l),0===l?r:s}return t.useSpeed(O()),r}function N(n){if(!(C="mousedown"===n.type)||0===n.button){var r,o,i=F(e.get(),d.get())>=2,a=C||!i,u=(r=n.target,o=r.nodeName||"",!(x.indexOf(o)>-1)),c=i||C&&u;I=!0,f.pointerDown(n),y.set(e),e.set(d),t.useDefaultMass().useSpeed(80),function(){var n=C?document:l;b.add(n,"touchmove",U).add(n,"touchend",V).add(n,"mousemove",U).add(n,"mouseup",V)}(),h.set(f.readPoint(n,p)),S.set(f.readPoint(n,g)),m.emit("pointerDown"),a&&(L=!1),c&&n.preventDefault()}}function U(t){if(!B&&!C){var r=f.readPoint(t,p).get(),o=f.readPoint(t,g).get(),i=F(r,h.get()),a=F(o,S.get());if(!(B=i>a)&&!L)return V()}var u=f.pointerMove(t),s=v.reachedAny(d.get()),l=!n.loop&&s?2:1;!L&&u&&(L=!0),c.start(),e.add(u/l),t.preventDefault()}function V(){var t=f.pointerUp()*(u?D:z)[C?"mouse":"touch"];F(e.get(),y.get())>=.5&&!C&&(L=!0),B=!1,I=!1,b.removeAll(),function(t){var r=n.scrollTo,i=n.scrollTarget,a=n.index,c=v.reachedAny(e.get()+t),s=!(i.byDistance(0,!1).index!==a.get())&&Math.abs(t)>4;if(u||c||!s)r.distance(t,!u);else{var l=-1*o(t).get(),f=a.clone().add(l);r.index(f.get(),0)}}(k(t)),C=!1,m.emit("pointerUp")}function F(n,e){return Math.abs(n-e)}function j(n){L&&n.preventDefault()}return{addActivationEvents:function(){var n=l;w.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",N).add(n,"mousedown",N).add(n,"touchcancel",V).add(n,"contextmenu",V).add(n,"click",j)},clickAllowed:function(){return!L},pointerDown:function(){return I},removeActivationEvents:M,removeInteractionEvents:T}}function c(n){var e=n.axis,t=n.pxToPercent,o=e.scroll,i={x:"clientX",y:"clientY"},a=r(0),u=r(0),c=r(0),s=r(0),l=[],f=(new Date).getTime(),d=!1;function m(n,e){d=!n.touches;var t=i[e],r=d?n[t]:n.touches[0][t];return s.set(r)}return{pointerDown:function(n){var e=m(n,o);return a.set(e),c.set(e),t.measure(a.get())},pointerMove:function(n){var e=m(n,o),r=(new Date).getTime();return r-f>=10&&(l.push(e.get()),f=r),u.set(e).subtract(c),c.set(e),t.measure(u.get())},pointerUp:function(){var n=c.get(),e=d?5:4,r=l.slice(-e).map((function(e){return n-e})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return c.set(r||0),l=[],t.measure(c.get())},readPoint:m}}function s(n){var e=Math.pow(10,n);return function(n){return Math.round(n*e)/e}}function l(n){return Object.keys(n).map(Number)}function f(n,e){var t=n.classList;t.contains(e)&&t.remove(e)}function d(n,e){var t=n.classList;t.contains(e)||t.add(e)}function m(n){var e=n.location,t=n.speed,i=n.mass,a=s(2),u=r(0),c=r(0),l=r(0),f=o(0),d={speed:t,mass:i};function m(n){return d.speed=n,p}function v(n){return d.mass=n,p}var p={direction:f,location:e,seek:function(n){l.set(n).subtract(e);var t,r,o,i,a,s=l.get(),m=(t=s,r=0,o=100,i=0,a=d.speed,i+(t-r)/(o-r)*(a-i));return f.set(l),l.normalize().multiply(m).subtract(u),function(n){n.divide(d.mass),c.add(n)}(l),p},settle:function(n){var t=n.get()-e.get(),r=!a(t);return r&&e.set(n),r},update:function(){u.add(c),e.add(u),c.multiply(0)},useDefaultMass:function(){return v(i),p},useDefaultSpeed:function(){return m(t),p},useMass:v,useSpeed:m};return p}function v(n){var e=n.limit,t=n.location,r=n.scrollBody,o=n.animation,i=e.min,a=e.max,u=e.reachedMin,c=e.reachedMax,s=!1,l=0;return{constrain:function(n){(function(n){return!s&&!l&&(u(t.get())?n.get()!==i:!!c(t.get())&&n.get()!==a)})(n)&&(l=window.setTimeout((function(){var t=e.constrain(n.get());n.set(t),r.useSpeed(10).useMass(3),o.start(),l=0}),50))},toggleActive:function(n){s=!n}}}function p(n){var e=n.alignment,t=n.contentSize,r=n.viewSize,o=a({min:-t+r,max:0}),i=[e.measure(t)],u=t>r;return{measure:function(n,e){var t=n.map(o.constrain),r=function(n){var e=n[0],t=n[n.length-1];return a({min:n.lastIndexOf(e)+1,max:n.indexOf(t)})}(t),c=r.min,s=r.max;return u?e?t.slice(c-1,s+1):t:i}}}function g(n){var e=n.contentSize,t=n.location,r=n.limit,o=n.pxToPercent,i=a({min:r.min+o.measure(.1),max:r.max+o.measure(.1)}),u=i.reachedMin,c=i.reachedMax;return{loop:function(n,r){if(function(n){return 1===n?c(t.get()):-1===n&&u(t.get())}(r)){var o=e*(-1*r);n.forEach((function(n){return n.add(o)}))}}}}function x(n){var e=n.loop,t=n.limit,r=n.scrollSnaps,o=n.contentSize,i=t.reachedMax,a=t.reachedAny,u=t.removeOffset;function c(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(n,t){var r=n,i=n+o,a=n-o;if(!e)return r;if(!t)return c(c(r,i),a);var u=c(r,1===t?i:a);return Math.abs(u)*t}return{byDistance:function(t,o){var c=n.target.get()+t,l=function(n){var e=u(n);return{index:r.map((function(n){return n-e})).map((function(n){return s(n,0)})).map((function(n,e){return{diff:n,index:e}})).sort((function(n,e){return Math.abs(n.diff)-Math.abs(e.diff)}))[0].index,distance:e}}(c),f=function(t,r){if(!(!e&&a(t)))return r;var o=n.index,u=o.min,c=o.max;return i(t)?u:c}(c,l.index),d=!e&&a(c);return!o||d?{index:f,distance:t}:{index:f,distance:t+s(r[f]-l.distance,0)}},byIndex:function(e,t){return{index:e,distance:s(r[e]-n.target.get(),t)}},shortcut:s}}function h(n){var e,t,r,o=n.axis,i=n.location,a=n.contentSize,u=n.viewSize,c=n.slideSizes,s=n.scrollSnaps,f=l(c),d=l(c).reverse(),m=(e=s[0]-1,t=g(e,d),r=x(e,t,0),h(t,r,1)).concat(function(){var n=g(u-s[0]-1,f),e=x(a,f,-u);return h(n,-e,0)}()),v="x"===o.scroll?"left":"top";function p(n,e){return n.reduce((function(n,e){return n-c[e]}),e)}function g(n,e){return e.reduce((function(e,t){return p(e,n)>0?e.concat([t]):e}),[])}function x(n,e,t){return e.reduce((function(e,t){var r=e+c[t];return r<n?r:e}),t)}function h(n,e,t){var r=n.slice().sort((function(n,e){return n-e}));return r.map((function(n,o){var i=a*(t?-1:0),u=a*(t?0:1),c=function(n,e,t){var r=f.length-1;return p(n.map((function(n){return(n+t)%r})),e)}(r.slice(0,o),e,t);return{point:c,getTarget:function(n){return n>c?i:u},index:n,location:-1}}))}return{canLoop:function(){return m.every((function(n){var e=n.index;return p(f.filter((function(n){return n!==e})),u)<=0}))},clear:function(n){m.forEach((function(e){var t=e.index;n[t].style[v]=""}))},loop:function(n){m.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,a=t(i.get());a!==r&&(n[o].style[v]=a+"%",e.location=a)}))},loopPoints:m}}function S(n){var e=n.contentSize,t=n.slideSizes,r=n.viewSize,o=n.inViewThreshold,i=n.loop,a=t.map((function(n){return n*o})),u=l(t).map((function(n){return t.slice(0,n).reduce((function(n,e){return n-e}),0)})),c=(i?[0,e,-e]:[0]).map(s).reduce((function(n,e){return n.concat(e)}),[]);function s(n){return u.map((function(e,o){return{start:e-t[o]+a[o]+n,end:e+r-a[o]+n,index:o}}))}return{check:function(n){return c.reduce((function(e,t){var r=t.index,o=t.start,i=t.end;return!(-1!==e.indexOf(r))&&(o<n&&i>n)?e.concat([r]):e}),[])}}}function y(n){var e=n.axis,t=n.container,r={x:function(n){return"translate3d("+n+"%,0px,0px)"},y:function(n){return"translate3d(0px,"+n+"%,0px)"}}[e.scroll],o=s(2),i=t.style,a=!1,u=0;return{clear:function(){i.transform="",u=0},to:function(n){if(!a){var e=o(n.get());u!==e&&(getComputedStyle(t).transform,i.transform=r(e),u=e)}},toggleActive:function(n){a=!n}}}function w(n,o,i,s,f){var d,w,b,M,T=s.align,z=s.axis,D=s.startIndex,E=s.inViewThreshold,P=s.loop,A=s.speed,I=s.dragFree,B=s.slidesToScroll,L=s.containScroll,C=function(n){var e="y"===n?"y":"x";return{cross:"y"===n?"x":"y",measure:function(n){var t=n.getBoundingClientRect(),r=t.width,o=t.height;return"x"===e?r:o},scroll:e}}(z),O=function(n){var e={measure:function(e){return e/n*100},totalPercent:100};return Object.freeze(e)}(C.measure(o)),k=O.totalPercent,N=i.map(C.measure).map(O.measure),U=function(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}(N,B).map((function(n){return n.reduce((function(n,e){return n+e}))})),V=l(U),F=N.reduce((function(n,e){return n+e}),0),j=e({align:T,viewSize:k}),H=function(n){var e,r=n.snapSizes,o=n.alignment,i=n.loop,u=r.map(o.measure),c=(e=t({limit:a({min:0,max:r.length-1}),start:0,loop:i}),r.map((function(n,t){var r=e.set(t+1).get();return n+u[t]-u[r]})));return{measure:function(n){return c.slice(0,n).reduce((function(n,e){return n-e}),u[0])}}}({snapSizes:U,alignment:j,loop:P}),q=V.map(H.measure),R=p({alignment:j,contentSize:F,viewSize:k}),X=!P&&""!==L,G="trimSnaps"===L,Y=R.measure(q,G),J=X?Y:q,K=t({limit:a({min:0,max:J.length-1}),start:D,loop:P}),Q=K.clone(),W=function(n){var e=n.contentSize,t=n.loop;return{measure:function(n){var r=n[0],o=n[n.length-1];return a({min:t?r-e:o,max:r})}}}({loop:P,contentSize:F}).measure(J),Z=function(n){var e=requestAnimationFrame.bind(window),t=cancelAnimationFrame.bind(window),r=0;function o(n,e){return function(){n===!!r&&e()}}function i(){r=e(n)}return{proceed:o(!0,i),start:o(!1,i),stop:o(!0,(function(){t(r),r=0}))}}((function(){un.scrollBody.seek(nn).update();var n=un.scrollBody.settle(nn);if(an.pointerDown()||(P||un.scrollBounds.constrain(nn),n&&(un.animation.stop(),f.emit("settle"))),P){var e=un.scrollBody.direction.get();un.scrollLooper.loop(en,e),un.slideLooper.loop(i)}n||f.emit("scroll"),un.translate.to(un.scrollBody.location),un.animation.proceed()})),$=J[K.get()],_=r($),nn=r($),en=[_,nn],tn=m({location:_,speed:A,mass:1}),rn=x({contentSize:F,index:K,limit:W,loop:P,scrollSnaps:J,target:nn}),on=function(n){var e=n.index,t=n.scrollTarget,r=n.animation,o=n.indexPrevious,i=n.events,a=n.target;function u(n){var t=n.distance,u=n.index!==e.get();t&&(r.start(),a.add(t)),u&&(o.set(e.get()),e.set(n.index),i.emit("select"))}return{distance:function(n,e){u(t.byDistance(n,e))},index:function(n,r){var o=e.clone().set(n);u(t.byIndex(o.get(),r))}}}({animation:Z,events:f,index:K,indexPrevious:Q,scrollTarget:rn,target:nn}),an=u({animation:Z,axis:C,dragFree:I,dragTracker:c({axis:C,pxToPercent:O}),element:n,events:f,index:K,limit:W,location:_,loop:P,scrollBody:tn,scrollTo:on,scrollTarget:rn,target:nn}),un={animation:Z,axis:C,dragHandler:an,pxToPercent:O,index:K,indexPrevious:Q,limit:W,location:_,options:s,scrollBody:tn,scrollBounds:v({animation:Z,limit:W,location:_,scrollBody:tn}),scrollLooper:g({contentSize:F,limit:W,location:_,pxToPercent:O}),scrollProgress:(d={limit:W},w=d.limit,b=w.max,M=w.length,{get:function(n){return(n-b)/-M}}),scrollSnaps:J,scrollTarget:rn,scrollTo:on,slideLooper:h({axis:C,contentSize:F,location:_,scrollSnaps:J,slideSizes:N,viewSize:k}),slidesInView:S({contentSize:F,inViewThreshold:E,loop:P,slideSizes:N,viewSize:k}),snapIndexes:V,target:nn,translate:y({axis:C,container:o})};return un}var b={align:"center",axis:"x",containScroll:"",containerSelector:"*",dragFree:!1,draggable:!0,draggableClass:"is-draggable",draggingClass:"is-dragging",inViewThreshold:0,loop:!1,selectedClass:"is-selected",slidesToScroll:1,speed:10,startIndex:0};return function(e,t){void 0===t&&(t={});var r,o,a,u,c,s,l=function(){var n={destroy:[],pointerDown:[],pointerUp:[],init:[],reInit:[],resize:[],scroll:[],select:[],settle:[]},e={emit:function(t){return n[t].forEach((function(n){return n(t)})),e},off:function(t,r){return n[t]=n[t].filter((function(n){return n!==r})),e},on:function(t,r){return n[t]=n[t].concat([r]),e}};return e}(),m=i(),v=(r=function(){var n=u.axis.measure(c);y!==n&&P(),l.emit("resize")},o=500,a={id:0},function(){window.clearTimeout(a.id),a.id=window.setTimeout(r,o)||0}),p=P,g=l.on,x=l.off,h=!1,S=n({},b),y=0;function M(){if(!e)throw new Error("Missing root node 😢");var n,t=S.containerSelector,r=e.querySelector(t);if(!r)throw new Error("Missing container node 😢");n=(c=r).children,s=Array.prototype.slice.call(n)}function T(t){void 0===t&&(t={}),M(),S=n(S,t);var r=(u=w(e,c,s,S,l)).axis,o=u.scrollBody,i=u.translate,a=u.dragHandler,f=u.slideLooper,p=S.loop,g=S.draggable,x=S.draggableClass,b=S.selectedClass,T=S.draggingClass;if(y=r.measure(c),m.add(window,"resize",v),i.to(o.location),s.forEach(E),a.addActivationEvents(),p){if(!f.canLoop())return P({loop:!1});f.loop(s)}g?(x&&d(e,x),T&&(l.on("pointerDown",z),l.on("pointerUp",z))):l.on("pointerDown",a.removeInteractionEvents),b&&(D(),l.on("select",D),l.on("pointerUp",D)),h||(setTimeout((function(){return l.emit("init")}),0),h=!0)}function z(n){var t=S.draggingClass;"pointerDown"===n?d(e,t):f(e,t)}function D(){var n=S.selectedClass,e=I(!0);B(!0).forEach((function(e){return f(s[e],n)})),e.forEach((function(e){return d(s[e],n)}))}function E(n,t){m.add(n,"focus",(function(){var n=Math.floor(t/S.slidesToScroll),r=t?n:t;e.scrollLeft=0,L(r)}),!0)}function P(e){void 0===e&&(e={});var t=n({startIndex:u.index.get()},e);A(),T(t),l.emit("reInit")}function A(){var n=S.selectedClass,t=S.draggableClass;u.dragHandler.removeActivationEvents(),u.dragHandler.removeInteractionEvents(),u.animation.stop(),m.removeAll(),u.translate.clear(),u.slideLooper.clear(s),f(e,t),s.forEach((function(e){return f(e,n)})),l.off("select",D),l.off("pointerUp",D),l.off("pointerDown",z),l.off("pointerUp",z)}function I(n){void 0===n&&(n=!1);var e=u[n?"target":"location"].get(),t=S.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function B(n){void 0===n&&(n=!1);var e=I(n);return u.snapIndexes.filter((function(n){return-1===e.indexOf(n)}))}function L(n){u.scrollBody.useDefaultMass().useDefaultSpeed(),u.scrollTo.index(n,0)}return T(t),{canScrollNext:function(){var n=u.index;return S.loop||n.get()!==n.max},canScrollPrev:function(){var n=u.index;return S.loop||n.get()!==n.min},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return c},dangerouslyGetEngine:function(){return u},destroy:function(){h&&(A(),h=!1,u={},l.emit("destroy"))},off:x,on:g,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:p,scrollNext:function(){var n=u.index.clone().add(1);u.scrollBody.useDefaultMass().useDefaultSpeed(),u.scrollTo.index(n.get(),-1)},scrollPrev:function(){var n=u.index.clone().add(-1);u.scrollBody.useDefaultMass().useDefaultSpeed(),u.scrollTo.index(n.get(),1)},scrollProgress:function(){var n=u.location.get();return u.scrollProgress.get(n)},scrollSnapList:function(){var n=u.scrollProgress.get;return u.scrollSnaps.map(n)},scrollTo:L,selectedScrollSnap:function(){return u.index.get()},slideNodes:function(){return s},slidesInView:I,slidesNotInView:B}}})); |
{ | ||
"name": "embla-carousel", | ||
"version": "3.0.17", | ||
"version": "3.0.18", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "author": "David Cetinkaya <david.o.cetinkaya@gmail.com>", |
@@ -352,3 +352,3 @@ import { useState, createRef, useEffect, useCallback, createElement } from 'react'; | ||
mouse: 2.5, | ||
touch: 4 | ||
touch: 3.5 | ||
}; | ||
@@ -355,0 +355,0 @@ var freeForceBoost = { |
@@ -356,3 +356,3 @@ 'use strict'; | ||
mouse: 2.5, | ||
touch: 4 | ||
touch: 3.5 | ||
}; | ||
@@ -359,0 +359,0 @@ var freeForceBoost = { |
<br /> | ||
<div align="center"> | ||
<p align="center"> | ||
<a href="https://davidcetinkaya.github.io/embla-carousel" target="_blank"><img width="70" height="70" src="https://rawgit.com/davidcetinkaya/embla-carousel/master/assets/embla-logo.svg" alt="Embla Carousel"> | ||
<a href="https://davidcetinkaya.github.io/embla-carousel" target="_blank"><img width="70" height="70" src="https://davidcetinkaya.github.io/embla-carousel/build/img/embla-logo.svg" alt="Embla Carousel"> | ||
</a> | ||
@@ -49,7 +49,7 @@ </p> | ||
<a href="https://davidcetinkaya.github.io/embla-carousel/#module-usage"> | ||
<img src="https://rawgit.com/davidcetinkaya/embla-carousel/master/assets/javascript-logo.svg" height="45" /> | ||
<img src="https://davidcetinkaya.github.io/embla-carousel/build/img/javascript-logo.svg" height="45" /> | ||
</a> | ||
| ||
<a href="https://davidcetinkaya.github.io/embla-carousel/#react-usage"> | ||
<img src="https://rawgit.com/davidcetinkaya/embla-carousel/master/assets/react-logo.svg" height="45" /> | ||
<img src="https://davidcetinkaya.github.io/embla-carousel/build/img/react-logo.svg" height="45" /> | ||
</a> | ||
@@ -98,4 +98,4 @@ </p> | ||
<a href="https://www.browserstack.com"> | ||
<img src="https://rawgit.com/davidcetinkaya/embla-carousel/master/assets/browserstack-logo.svg" height="60" /> | ||
<img src="https://davidcetinkaya.github.io/embla-carousel/build/img/browserstack-logo.svg" height="50" /> | ||
</a> | ||
</p> |
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
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
658098
42
6750