embla-carousel
Advanced tools
Comparing version 4.4.0 to 4.4.1
@@ -1236,37 +1236,2 @@ function _extends() { | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = window.getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EventEmitter() { | ||
@@ -1307,2 +1272,37 @@ var listeners = {}; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EmblaCarousel(sliderRoot, userOptions) { | ||
@@ -1309,0 +1309,0 @@ var events = EventEmitter(); |
@@ -1238,37 +1238,2 @@ 'use strict'; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = window.getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EventEmitter() { | ||
@@ -1309,2 +1274,37 @@ var listeners = {}; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EmblaCarousel(sliderRoot, userOptions) { | ||
@@ -1311,0 +1311,0 @@ var events = EventEmitter(); |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis: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,e){var t={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return e-n}return{measure:function(r){return"number"==typeof n?e*Number(n):t[n](r)}}}function t(n,e){var t=Math.abs(n-e);function r(e){return e<n}function o(n){return n>e}function i(n){return r(n)||o(n)}return{constrain:function(t){return i(t)?r(t)?n:e:t},length:t,max:e,min:n,reachedAny:i,reachedMax:o,reachedMin:r,removeOffset:function(n){return t?n-t*Math.ceil((n-e)/t):n}}}function r(){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=n.filter((function(n){return n()})),e}};return e}function o(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 i(n){return n?n/Math.abs(n):0}function a(n,e){return Math.abs(n-e)}function u(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function c(n){return Object.keys(n).map(Number)}function s(n){return n[d(n)]}function d(n){return Math.max(0,n.length-1)}function f(n,e){var t=n.classList;e&&t.contains(e)&&t.remove(e)}function l(n,e){var t=n.classList;e&&!t.contains(e)&&t.add(e)}function p(n,e,t,u,c,s,d,f,l,p,g,m,v,h){var x=n.scroll,y=n.cross,b=["INPUT","SELECT","TEXTAREA"],w=o(0),M=o(0),S=o(0),E=r(),A=r(),T={mouse:2.5,touch:3.5},C={mouse:5,touch:7},D=c?5:12,P=!1,B=!1,I=!1,L=!1;function z(n){if(!(L="mousedown"===n.type)||0===n.button){var e,r,o=a(u.get(),d.get())>=2,i=L||!o,c=(e=n.target,r=e.nodeName||"",!(b.indexOf(r)>-1)),f=o||L&&c;P=!0,s.pointerDown(n),S.set(u),u.set(d),p.useBaseMass().useSpeed(80),function(){var n=L?document:t;A.add(n,"touchmove",O).add(n,"touchend",k).add(n,"mousemove",O).add(n,"mouseup",k)}(),w.set(s.readPoint(n,x)),M.set(s.readPoint(n,y)),h.emit("pointerDown"),i&&(I=!1),f&&n.preventDefault()}}function O(n){if(!B&&!L){if(!n.cancelable)return k();var t=s.readPoint(n,x).get(),r=s.readPoint(n,y).get(),o=a(t,w.get()),i=a(r,M.get());if(!(B=o>i)&&!I)return k()}var c=s.pointerMove(n);!I&&c&&(I=!0),f.start(),u.add(e.applyTo(c)),n.preventDefault()}function k(){var n=s.pointerUp()*(c?C:T)[L?"mouse":"touch"],t=function(n){var e=!(g.byDistance(0,!1).index!==m.get())&&Math.abs(n)>4,t=n+d.get();if(e&&!c&&!v.reachedAny(t)){var r=m.clone().add(-1*i(n));return g.byIndex(r.get(),0).distance}return g.byDistance(n,!c).distance}(e.applyTo(n)),r=function(n,e){if(0===n||0===e)return 0;if(Math.abs(n)<=Math.abs(e))return 0;var t=a(Math.abs(n),Math.abs(e));return Math.abs(t/n)}(n,t);a(u.get(),S.get())>=.5&&!L&&(I=!0),B=!1,P=!1,A.removeAll(),p.useSpeed(D+D*r),l.distance(t,!c),L=!1,h.emit("pointerUp")}function N(n){I&&n.preventDefault()}return{addActivationEvents:function(){var n=t;E.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",z).add(n,"mousedown",z).add(n,"touchcancel",k).add(n,"contextmenu",k).add(n,"click",N)},clickAllowed:function(){return!I},pointerDown:function(){return P},removeAllEvents:function(){E.removeAll(),A.removeAll()}}}function g(n,e,t){var r,a,u=(r=2,a=Math.pow(10,r),function(n){return Math.round(n*a)/a}),c=o(0),s=o(0),d=o(0),f=0,l=e,p=t;function g(n){return l=n,v}function m(n){return p=n,v}var v={direction:function(){return f},seek:function(e){d.set(e).subtract(n);var t,r,o,a=(t=d.get(),(o=0)+(t-(r=0))/(100-r)*(l-o));return f=i(d.get()),d.normalize().multiply(a).subtract(c),function(n){n.divide(p),s.add(n)}(d),v},settle:function(e){var t=e.get()-n.get(),r=!u(t);return r&&n.set(e),r},update:function(){c.add(s),n.add(c),s.multiply(0)},useBaseMass:function(){return m(t)},useBaseSpeed:function(){return g(e)},useMass:m,useSpeed:g};return v}function m(n,e,t,r){var o=!1;return{constrain:function(i){if(!o&&n.reachedAny(t.get())&&n.reachedAny(e.get())){var a=i?.7:.4,u=t.get()-e.get();t.subtract(u*a),!i&&Math.abs(u)<10&&(t.set(n.constrain(t.get())),r.useSpeed(10).useMass(3))}},toggleActive:function(n){o=!n}}}function v(n,e,r,o,i){var a=t(-e+n,r[0]),u=o.map(a.constrain);return{snapsContained:function(){if(e<=n)return[a.max];if("keepSnaps"===i)return u;var r=function(){var n=u[0],e=s(u),r=u.lastIndexOf(n),o=u.indexOf(e)+1;return t(r,o)}(),o=r.min,c=r.max;return u.slice(o,c)}()}}function h(n,e,r,o,i){var a=t(r.min+e.measure(.1),r.max+e.measure(.1)),u=a.reachedMin,c=a.reachedMax;return{loop:function(e){if(function(n){return 1===n?c(o.get()):-1===n&&u(o.get())}(e)){var t=n*(-1*e);i.forEach((function(n){return n.add(t)}))}}}}function x(n){var e=n.max,t=n.length;return{get:function(n){return(n-e)/-t}}}function y(n,e,t,r,o,i){var a,c,d=n.startEdge,f=n.endEdge,l=o.map((function(n){return r[d]-n[d]})).map(t.measure).map((function(n){return-Math.abs(n)})),p=(a=u(l,i).map((function(n){return n[0]})),c=u(o,i).map((function(n){return s(n)[f]-n[0][d]})).map(t.measure).map(Math.abs).map(e.measure),a.map((function(n,e){return n+c[e]})));return{snaps:l,snapsAligned:p}}function b(n,e,t,r,o){var i=r.reachedAny,a=r.removeOffset,u=r.constrain;function c(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(e,r){var o=e,i=e+t,a=e-t;if(!n)return o;if(!r)return c(c(o,i),a);var u=c(o,1===r?i:a);return Math.abs(u)*r}return{byDistance:function(t,r){var c=o.get()+t,d=function(t){var r=n?a(t):u(t);return{index:e.map((function(n){return n-r})).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:r}}(c),f=d.index,l=d.distance,p=!n&&i(c);return!r||p?{index:f,distance:t}:{index:f,distance:t+s(e[f]-l,0)}},byIndex:function(n,t){return{index:n,distance:s(e[n]-o.get(),t)}},shortcut:s}}function w(n,e,t,r,o,i,a,u){var s,d=c(r),f=c(r).reverse(),l=(s=o[0]-1,m(g(f,s),"end")).concat(function(){var n=e-o[0]-1;return m(g(d,n),"start")}());function p(n,e){return n.reduce((function(n,e){return n-r[e]}),e)}function g(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function m(n,e){var r="start"===e,o=r?-t:t,u=i.findSlideBounds(o);return n.map((function(n){var e=r?0:-t,o=r?t:0,i=u.filter((function(e){return e.index===n}))[0][r?"end":"start"];return{point:i,getTarget:function(){return a.get()>i?e:o},index:n,location:-1}}))}return{canLoop:function(){return l.every((function(n){var t=n.index;return p(d.filter((function(n){return n!==t})),e)<=0}))},clear:function(){l.forEach((function(e){var t=e.index;u[t].style[n.startEdge]=""}))},loop:function(){l.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(u[o].style[n.startEdge]=i+"%",e.location=i)}))},loopPoints:l}}function M(n,e,t){var o=r(),i=o.removeAll,a=0;function u(n){9===n.keyCode&&(a=(new Date).getTime())}function c(r,i){o.add(r,"focus",(function(){if(!((new Date).getTime()-a>10)){n.scrollLeft=0;var r=Math.floor(i/t);e.index(r,0)}}),!0)}return{addActivationEvents:function(n){o.add(document,"keydown",u,!1),n.forEach(c)},removeAllEvents:i}}function S(n,e,t){var r=t.style,o="x"===n.scroll?function(n){return"translate3d("+n+"%,0px,0px)"}:function(n){return"translate3d(0px,"+n+"%,0px)"},i=!1;return{clear:function(){r.transform=""},to:function(n){i||(r.transform=o(e.applyTo(n.get())))},toggleActive:function(n){i=!n}}}function E(n,r,i,a,u){var f,l=a.align,E=a.axis,A=a.direction,T=a.startIndex,C=a.inViewThreshold,D=a.loop,P=a.speed,B=a.dragFree,I=a.slidesToScroll,L=a.containScroll,z=r.getBoundingClientRect(),O=i.map((function(n){return n.getBoundingClientRect()})),k=function(n){var e="rtl"===n?-1:1;return{applyTo:function(n){return n*e}}}(A),N=function(n,e){var t="y"===n?"y":"x";return{scroll:t,cross:"y"===n?"x":"y",startEdge:"y"===t?"top":"rtl"===e?"right":"left",endEdge:"y"===t?"bottom":"rtl"===e?"left":"right",measureSize:function(n){var e=n.width,r=n.height;return"x"===t?e:r}}}(E,A),F=(f=N.measureSize(z),{measure:function(n){return 0===f?0:n/f*100},totalPercent:100}),U=F.totalPercent,V=e(l,U),H=function(n,e,t,r,o){var i=n.measureSize,a=n.startEdge,u=n.endEdge,c=r.map(i);return{slideSizes:c.map(e.measure),slideSizesWithGaps:r.map((function(n,e,r){var i=e===d(r),f=window.getComputedStyle(s(t)),l=parseFloat(f.getPropertyValue("margin-"+u));return i?c[e]+(o?l:0):r[e+1][a]-n[a]})).map(e.measure).map(Math.abs)}}(N,F,i,O,D),R=H.slideSizes,j=H.slideSizesWithGaps,G=y(N,V,F,z,O,I),q=G.snaps,W=G.snapsAligned,X=-1*s(q)+s(j),J=v(U,X,q,W,L).snapsContained,Y=!D&&""!==L?J:W,K=function(n,e,r){var o,i;return{limit:(o=e[0],i=s(e),t(r?o-n:i,o))}}(X,Y,D).limit,Q=function n(e,r,o){var i=t(0,e).constrain,a=e+1,u=c(r);function c(n){return o?Math.abs((a+n)%a):i(n)}function s(){return u}function d(n){return u=c(n),f}var f={add:function(n){return d(s()+n)},clone:function(){return n(e,s(),o)},get:s,set:d};return f}(d(Y),T,D),Z=Q.clone(),$=c(i),_=function(n){var e=0;function t(n,t){return function(){n===!!e&&t()}}function r(){e=window.requestAnimationFrame(n)}return{proceed:t(!0,r),start:t(!1,r),stop:t(!0,(function(){window.cancelAnimationFrame(e),e=0}))}}((function(){D||cn.scrollBounds.constrain(cn.dragHandler.pointerDown()),cn.scrollBody.seek(tn).update();var n=cn.scrollBody.settle(tn);n&&!cn.dragHandler.pointerDown()&&(cn.animation.stop(),u.emit("settle")),n||u.emit("scroll"),D&&(cn.scrollLooper.loop(cn.scrollBody.direction()),cn.slideLooper.loop()),cn.translate.to(en),cn.animation.proceed()})),nn=Y[Q.get()],en=o(nn),tn=o(nn),rn=g(en,P,1),on=b(D,Y,X,K,tn),an=function(n,e,t,r,o,i){function a(r){var a=r.distance,u=r.index!==e.get();a&&(n.start(),o.add(a)),u&&(t.set(e.get()),e.set(r.index),i.emit("select"))}return{distance:function(n,e){a(r.byDistance(n,e))},index:function(n,t){var o=e.clone().set(n);a(r.byIndex(o.get(),t))}}}(_,Q,Z,on,tn,u),un=function(n,e,t,r,o,i){var a=Math.min(Math.max(i,.01),.99),u=(o?[0,e,-e]:[0]).reduce((function(n,e){return n.concat(c(e,a))}),[]);function c(e,o){var i=t.map((function(n){return n*(o||0)}));return r.map((function(r,o){return{start:r-t[o]+i[o]+e,end:r+n-i[o]+e,index:o}}))}return{check:function(n){return u.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}),[])},findSlideBounds:c}}(U,X,R,q,D,C),cn={animation:_,axis:N,direction:k,dragHandler:p(N,k,n,tn,B,function(n,e){var t=n.scroll,r={x:"clientX",y:"clientY"},i=o(0),a=o(0),u=o(0),c=o(0),s=[],d=(new Date).getTime(),f=!1;function l(n,e){f=!n.touches;var t=r[e],o=f?n[t]:n.touches[0][t];return c.set(o)}return{pointerDown:function(n){var r=l(n,t);return i.set(r),u.set(r),e.measure(i.get())},pointerMove:function(n){var r=l(n,t),o=(new Date).getTime(),i=o-d;return i>=10&&(i>=100&&(s=[]),s.push(r.get()),d=o),a.set(r).subtract(u),u.set(r),e.measure(a.get())},pointerUp:function(){var n=(new Date).getTime()-d,t=u.get(),r=s.slice(-5).map((function(n){return t-n})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return u.set(n>100||!r?0:r),s=[],e.measure(u.get())},readPoint:l}}(N,F),en,_,an,rn,on,Q,K,u),pxToPercent:F,index:Q,indexPrevious:Z,limit:K,location:en,options:a,scrollBody:rn,scrollBounds:m(K,en,tn,rn),scrollLooper:h(X,F,K,en,[en,tn]),scrollProgress:x(K),scrollSnaps:Y,scrollTarget:on,scrollTo:an,slideFocus:M(n,an,I),slideLooper:w(N,U,X,j,Y,un,en,i),slidesInView:un,slideIndexes:$,target:tn,translate:S(N,k,r)};return cn}var A={align:"center",axis:"x",containScroll:"",direction:"ltr",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){var o,i,a,u,c,s,d,p=function(){var n={};function e(e){return n[e]||[]}var t={emit:function(n){return e(n).forEach((function(e){return e(n)})),t},off:function(r,o){return n[r]=e(r).filter((function(n){return n!==o})),t},on:function(r,o){return n[r]=e(r).concat([o]),t}};return t}(),g=r(),m=(o=function(){if(y){var n=u.axis.measureSize(e.getBoundingClientRect());M!==n&&B(),p.emit("resize")}},i=500,a=0,function(){window.clearTimeout(a),a=window.setTimeout(o,i)||0}),v=B,h=p.on,x=p.off,y=!1,b=n({},A),w=n({},b),M=0;function S(){if(!e)throw new Error("Missing root node 😢");var n,t,r=e.querySelector("*");if(!r)throw new Error("Missing container node 😢");s=r,d=Array.prototype.slice.call(s.children),n=e,t=window.getComputedStyle(n,":before").content,c={get:function(){try{return JSON.parse(t.slice(1,-1).replace(/\\/g,""))}catch(n){}return{}}}}function T(t){if(S(),b=n({},b,t),w=n({},b,c.get()),u=E(e,s,d,w,p),g.add(window,"resize",m),u.translate.to(u.location),M=u.axis.measureSize(e.getBoundingClientRect()),w.loop){if(!u.slideLooper.canLoop())return P(),T({loop:!1});u.slideLooper.loop()}w.draggable&&s.offsetParent&&d.length&&(u.dragHandler.addActivationEvents(),w.draggableClass&&l(e,w.draggableClass),w.draggingClass&&p.on("pointerDown",C).on("pointerUp",C)),d.length&&u.slideFocus.addActivationEvents(d),w.selectedClass&&(D(),p.on("select",D).on("pointerUp",D)),y||(setTimeout((function(){return p.emit("init")}),0),y=!0)}function C(n){var t=w.draggingClass;"pointerDown"===n?l(e,t):f(e,t)}function D(){var n=w.selectedClass,e=I(!0);L(!0).forEach((function(e){return f(d[e],n)})),e.forEach((function(e){return l(d[e],n)}))}function P(){u.dragHandler.removeAllEvents(),u.slideFocus.removeAllEvents(),u.animation.stop(),g.removeAll(),u.translate.clear(),u.slideLooper.clear(),f(e,w.draggableClass),d.forEach((function(n){return f(n,w.selectedClass)})),p.off("select",D).off("pointerUp",D).off("pointerDown",C).off("pointerUp",C)}function B(e){if(y){var t=n({startIndex:O()},e);P(),T(t),p.emit("reInit")}}function I(n){var e=u[n?"target":"location"].get(),t=w.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function L(n){var e=I(n);return u.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}function z(n,e,t){u.scrollBody.useBaseMass().useSpeed(e?100:w.speed),y&&u.scrollTo.index(n,t||0)}function O(){return u.index.get()}return T(t),{canScrollNext:function(){return u.index.clone().add(1).get()!==O()},canScrollPrev:function(){return u.index.clone().add(-1).get()!==O()},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return s},dangerouslyGetEngine:function(){return u},destroy:function(){y&&(P(),y=!1,p.emit("destroy"))},off:x,on:h,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:v,rootNode:function(){return e},scrollNext:function(n){z(u.index.clone().add(1).get(),n,-1)},scrollPrev:function(n){z(u.index.clone().add(-1).get(),n,1)},scrollProgress:function(){return u.scrollProgress.get(u.location.get())},scrollSnapList:function(){return u.scrollSnaps.map(u.scrollProgress.get)},scrollTo:z,selectedScrollSnap:O,slideNodes:function(){return d},slidesInView:I,slidesNotInView:L}}})); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis: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,e){var t={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return e-n}return{measure:function(r){return"number"==typeof n?e*Number(n):t[n](r)}}}function t(n,e){var t=Math.abs(n-e);function r(e){return e<n}function o(n){return n>e}function i(n){return r(n)||o(n)}return{constrain:function(t){return i(t)?r(t)?n:e:t},length:t,max:e,min:n,reachedAny:i,reachedMax:o,reachedMin:r,removeOffset:function(n){return t?n-t*Math.ceil((n-e)/t):n}}}function r(n,e,o){var i=t(0,n).constrain,a=n+1,u=c(e);function c(n){return o?Math.abs((a+n)%a):i(n)}function s(){return u}function d(n){return u=c(n),f}var f={add:function(n){return d(s()+n)},clone:function(){return r(n,s(),o)},get:s,set:d};return f}function o(){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=n.filter((function(n){return n()})),e}};return e}function i(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 a(n){return n?n/Math.abs(n):0}function u(n,e){return Math.abs(n-e)}function c(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function s(n){return Object.keys(n).map(Number)}function d(n){return n[f(n)]}function f(n){return Math.max(0,n.length-1)}function l(n,e){var t=n.classList;e&&t.contains(e)&&t.remove(e)}function p(n,e){var t=n.classList;e&&!t.contains(e)&&t.add(e)}function g(n,e,t,r,c,s,d,f,l,p,g,m,v,h){var x=n.scroll,y=n.cross,b=["INPUT","SELECT","TEXTAREA"],w=i(0),M=i(0),S=i(0),E=o(),A=o(),T={mouse:2.5,touch:3.5},C={mouse:5,touch:7},D=c?5:12,P=!1,B=!1,I=!1,L=!1;function z(n){if(!(L="mousedown"===n.type)||0===n.button){var e,o,i=u(r.get(),d.get())>=2,a=L||!i,c=(e=n.target,o=e.nodeName||"",!(b.indexOf(o)>-1)),f=i||L&&c;P=!0,s.pointerDown(n),S.set(r),r.set(d),p.useBaseMass().useSpeed(80),function(){var n=L?document:t;A.add(n,"touchmove",O).add(n,"touchend",k).add(n,"mousemove",O).add(n,"mouseup",k)}(),w.set(s.readPoint(n,x)),M.set(s.readPoint(n,y)),h.emit("pointerDown"),a&&(I=!1),f&&n.preventDefault()}}function O(n){if(!B&&!L){if(!n.cancelable)return k();var t=s.readPoint(n,x).get(),o=s.readPoint(n,y).get(),i=u(t,w.get()),a=u(o,M.get());if(!(B=i>a)&&!I)return k()}var c=s.pointerMove(n);!I&&c&&(I=!0),f.start(),r.add(e.applyTo(c)),n.preventDefault()}function k(){var n=s.pointerUp()*(c?C:T)[L?"mouse":"touch"],t=function(n){var e=!(g.byDistance(0,!1).index!==m.get())&&Math.abs(n)>4,t=n+d.get();if(e&&!c&&!v.reachedAny(t)){var r=m.clone().add(-1*a(n));return g.byIndex(r.get(),0).distance}return g.byDistance(n,!c).distance}(e.applyTo(n)),o=function(n,e){if(0===n||0===e)return 0;if(Math.abs(n)<=Math.abs(e))return 0;var t=u(Math.abs(n),Math.abs(e));return Math.abs(t/n)}(n,t);u(r.get(),S.get())>=.5&&!L&&(I=!0),B=!1,P=!1,A.removeAll(),p.useSpeed(D+D*o),l.distance(t,!c),L=!1,h.emit("pointerUp")}function N(n){I&&n.preventDefault()}return{addActivationEvents:function(){var n=t;E.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",z).add(n,"mousedown",z).add(n,"touchcancel",k).add(n,"contextmenu",k).add(n,"click",N)},clickAllowed:function(){return!I},pointerDown:function(){return P},removeAllEvents:function(){E.removeAll(),A.removeAll()}}}function m(n,e,t){var r,o,u=(r=2,o=Math.pow(10,r),function(n){return Math.round(n*o)/o}),c=i(0),s=i(0),d=i(0),f=0,l=e,p=t;function g(n){return l=n,v}function m(n){return p=n,v}var v={direction:function(){return f},seek:function(e){d.set(e).subtract(n);var t,r,o,i=(t=d.get(),(o=0)+(t-(r=0))/(100-r)*(l-o));return f=a(d.get()),d.normalize().multiply(i).subtract(c),function(n){n.divide(p),s.add(n)}(d),v},settle:function(e){var t=e.get()-n.get(),r=!u(t);return r&&n.set(e),r},update:function(){c.add(s),n.add(c),s.multiply(0)},useBaseMass:function(){return m(t)},useBaseSpeed:function(){return g(e)},useMass:m,useSpeed:g};return v}function v(n,e,t,r){var o=!1;return{constrain:function(i){if(!o&&n.reachedAny(t.get())&&n.reachedAny(e.get())){var a=i?.7:.4,u=t.get()-e.get();t.subtract(u*a),!i&&Math.abs(u)<10&&(t.set(n.constrain(t.get())),r.useSpeed(10).useMass(3))}},toggleActive:function(n){o=!n}}}function h(n,e,r,o,i){var a=t(-e+n,r[0]),u=o.map(a.constrain);return{snapsContained:function(){if(e<=n)return[a.max];if("keepSnaps"===i)return u;var r=function(){var n=u[0],e=d(u),r=u.lastIndexOf(n),o=u.indexOf(e)+1;return t(r,o)}(),o=r.min,c=r.max;return u.slice(o,c)}()}}function x(n,e,r,o,i){var a=t(r.min+e.measure(.1),r.max+e.measure(.1)),u=a.reachedMin,c=a.reachedMax;return{loop:function(e){if(function(n){return 1===n?c(o.get()):-1===n&&u(o.get())}(e)){var t=n*(-1*e);i.forEach((function(n){return n.add(t)}))}}}}function y(n){var e=n.max,t=n.length;return{get:function(n){return(n-e)/-t}}}function b(n,e,t,r,o,i){var a,u,s=n.startEdge,f=n.endEdge,l=o.map((function(n){return r[s]-n[s]})).map(t.measure).map((function(n){return-Math.abs(n)})),p=(a=c(l,i).map((function(n){return n[0]})),u=c(o,i).map((function(n){return d(n)[f]-n[0][s]})).map(t.measure).map(Math.abs).map(e.measure),a.map((function(n,e){return n+u[e]})));return{snaps:l,snapsAligned:p}}function w(n,e,t,r,o){var i=r.reachedAny,a=r.removeOffset,u=r.constrain;function c(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(e,r){var o=e,i=e+t,a=e-t;if(!n)return o;if(!r)return c(c(o,i),a);var u=c(o,1===r?i:a);return Math.abs(u)*r}return{byDistance:function(t,r){var c=o.get()+t,d=function(t){var r=n?a(t):u(t);return{index:e.map((function(n){return n-r})).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:r}}(c),f=d.index,l=d.distance,p=!n&&i(c);return!r||p?{index:f,distance:t}:{index:f,distance:t+s(e[f]-l,0)}},byIndex:function(n,t){return{index:n,distance:s(e[n]-o.get(),t)}},shortcut:s}}function M(n,e,t,r,o,i,a,u){var c,d=s(r),f=s(r).reverse(),l=(c=o[0]-1,m(g(f,c),"end")).concat(function(){var n=e-o[0]-1;return m(g(d,n),"start")}());function p(n,e){return n.reduce((function(n,e){return n-r[e]}),e)}function g(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function m(n,e){var r="start"===e,o=r?-t:t,u=i.findSlideBounds(o);return n.map((function(n){var e=r?0:-t,o=r?t:0,i=u.filter((function(e){return e.index===n}))[0][r?"end":"start"];return{point:i,getTarget:function(){return a.get()>i?e:o},index:n,location:-1}}))}return{canLoop:function(){return l.every((function(n){var t=n.index;return p(d.filter((function(n){return n!==t})),e)<=0}))},clear:function(){l.forEach((function(e){var t=e.index;u[t].style[n.startEdge]=""}))},loop:function(){l.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(u[o].style[n.startEdge]=i+"%",e.location=i)}))},loopPoints:l}}function S(n,e,t){var r=o(),i=r.removeAll,a=0;function u(n){9===n.keyCode&&(a=(new Date).getTime())}function c(o,i){r.add(o,"focus",(function(){if(!((new Date).getTime()-a>10)){n.scrollLeft=0;var r=Math.floor(i/t);e.index(r,0)}}),!0)}return{addActivationEvents:function(n){r.add(document,"keydown",u,!1),n.forEach(c)},removeAllEvents:i}}function E(n,e,t){var r=t.style,o="x"===n.scroll?function(n){return"translate3d("+n+"%,0px,0px)"}:function(n){return"translate3d(0px,"+n+"%,0px)"},i=!1;return{clear:function(){r.transform=""},to:function(n){i||(r.transform=o(e.applyTo(n.get())))},toggleActive:function(n){i=!n}}}function A(n,o,a,u,c){var l,p=u.align,A=u.axis,T=u.direction,C=u.startIndex,D=u.inViewThreshold,P=u.loop,B=u.speed,I=u.dragFree,L=u.slidesToScroll,z=u.containScroll,O=o.getBoundingClientRect(),k=a.map((function(n){return n.getBoundingClientRect()})),N=function(n){var e="rtl"===n?-1:1;return{applyTo:function(n){return n*e}}}(T),F=function(n,e){var t="y"===n?"y":"x";return{scroll:t,cross:"y"===n?"x":"y",startEdge:"y"===t?"top":"rtl"===e?"right":"left",endEdge:"y"===t?"bottom":"rtl"===e?"left":"right",measureSize:function(n){var e=n.width,r=n.height;return"x"===t?e:r}}}(A,T),U=(l=F.measureSize(O),{measure:function(n){return 0===l?0:n/l*100},totalPercent:100}),V=U.totalPercent,H=e(p,V),R=function(n,e,t,r,o){var i=n.measureSize,a=n.startEdge,u=n.endEdge,c=r.map(i);return{slideSizes:c.map(e.measure),slideSizesWithGaps:r.map((function(n,e,r){var i=e===f(r),s=window.getComputedStyle(d(t)),l=parseFloat(s.getPropertyValue("margin-"+u));return i?c[e]+(o?l:0):r[e+1][a]-n[a]})).map(e.measure).map(Math.abs)}}(F,U,a,k,P),j=R.slideSizes,G=R.slideSizesWithGaps,q=b(F,H,U,O,k,L),W=q.snaps,X=q.snapsAligned,J=-1*d(W)+d(G),Y=h(V,J,W,X,z).snapsContained,K=!P&&""!==z?Y:X,Q=function(n,e,r){var o,i;return{limit:(o=e[0],i=d(e),t(r?o-n:i,o))}}(J,K,P).limit,Z=r(f(K),C,P),$=Z.clone(),_=s(a),nn=function(n){var e=0;function t(n,t){return function(){n===!!e&&t()}}function r(){e=window.requestAnimationFrame(n)}return{proceed:t(!0,r),start:t(!1,r),stop:t(!0,(function(){window.cancelAnimationFrame(e),e=0}))}}((function(){P||sn.scrollBounds.constrain(sn.dragHandler.pointerDown()),sn.scrollBody.seek(rn).update();var n=sn.scrollBody.settle(rn);n&&!sn.dragHandler.pointerDown()&&(sn.animation.stop(),c.emit("settle")),n||c.emit("scroll"),P&&(sn.scrollLooper.loop(sn.scrollBody.direction()),sn.slideLooper.loop()),sn.translate.to(tn),sn.animation.proceed()})),en=K[Z.get()],tn=i(en),rn=i(en),on=m(tn,B,1),an=w(P,K,J,Q,rn),un=function(n,e,t,r,o,i){function a(r){var a=r.distance,u=r.index!==e.get();a&&(n.start(),o.add(a)),u&&(t.set(e.get()),e.set(r.index),i.emit("select"))}return{distance:function(n,e){a(r.byDistance(n,e))},index:function(n,t){var o=e.clone().set(n);a(r.byIndex(o.get(),t))}}}(nn,Z,$,an,rn,c),cn=function(n,e,t,r,o,i){var a=Math.min(Math.max(i,.01),.99),u=(o?[0,e,-e]:[0]).reduce((function(n,e){return n.concat(c(e,a))}),[]);function c(e,o){var i=t.map((function(n){return n*(o||0)}));return r.map((function(r,o){return{start:r-t[o]+i[o]+e,end:r+n-i[o]+e,index:o}}))}return{check:function(n){return u.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}),[])},findSlideBounds:c}}(V,J,j,W,P,D),sn={animation:nn,axis:F,direction:N,dragHandler:g(F,N,n,rn,I,function(n,e){var t=n.scroll,r={x:"clientX",y:"clientY"},o=i(0),a=i(0),u=i(0),c=i(0),s=[],d=(new Date).getTime(),f=!1;function l(n,e){f=!n.touches;var t=r[e],o=f?n[t]:n.touches[0][t];return c.set(o)}return{pointerDown:function(n){var r=l(n,t);return o.set(r),u.set(r),e.measure(o.get())},pointerMove:function(n){var r=l(n,t),o=(new Date).getTime(),i=o-d;return i>=10&&(i>=100&&(s=[]),s.push(r.get()),d=o),a.set(r).subtract(u),u.set(r),e.measure(a.get())},pointerUp:function(){var n=(new Date).getTime()-d,t=u.get(),r=s.slice(-5).map((function(n){return t-n})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return u.set(n>100||!r?0:r),s=[],e.measure(u.get())},readPoint:l}}(F,U),tn,nn,un,on,an,Z,Q,c),pxToPercent:U,index:Z,indexPrevious:$,limit:Q,location:tn,options:u,scrollBody:on,scrollBounds:v(Q,tn,rn,on),scrollLooper:x(J,U,Q,tn,[tn,rn]),scrollProgress:y(Q),scrollSnaps:K,scrollTarget:an,scrollTo:un,slideFocus:S(n,un,L),slideLooper:M(F,V,J,G,K,cn,tn,a),slidesInView:cn,slideIndexes:_,target:rn,translate:E(F,N,o)};return sn}var T={align:"center",axis:"x",containScroll:"",direction:"ltr",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){var r,i,a,u,c,s,d,f=function(){var n={};function e(e){return n[e]||[]}var t={emit:function(n){return e(n).forEach((function(e){return e(n)})),t},off:function(r,o){return n[r]=e(r).filter((function(n){return n!==o})),t},on:function(r,o){return n[r]=e(r).concat([o]),t}};return t}(),g=o(),m=(r=function(){if(y){var n=u.axis.measureSize(e.getBoundingClientRect());M!==n&&B(),f.emit("resize")}},i=500,a=0,function(){window.clearTimeout(a),a=window.setTimeout(r,i)||0}),v=B,h=f.on,x=f.off,y=!1,b=n({},T),w=n({},b),M=0;function S(){if(!e)throw new Error("Missing root node 😢");var n,t=e.querySelector("*");if(!t)throw new Error("Missing container node 😢");s=t,d=Array.prototype.slice.call(s.children),n=getComputedStyle(e,":before").content,c={get:function(){try{return JSON.parse(n.slice(1,-1).replace(/\\/g,""))}catch(n){}return{}}}}function E(t){if(S(),b=n({},b,t),w=n({},b,c.get()),u=A(e,s,d,w,f),g.add(window,"resize",m),u.translate.to(u.location),M=u.axis.measureSize(e.getBoundingClientRect()),w.loop){if(!u.slideLooper.canLoop())return P(),E({loop:!1});u.slideLooper.loop()}w.draggable&&s.offsetParent&&d.length&&(u.dragHandler.addActivationEvents(),w.draggableClass&&p(e,w.draggableClass),w.draggingClass&&f.on("pointerDown",C).on("pointerUp",C)),d.length&&u.slideFocus.addActivationEvents(d),w.selectedClass&&(D(),f.on("select",D).on("pointerUp",D)),y||(setTimeout((function(){return f.emit("init")}),0),y=!0)}function C(n){var t=w.draggingClass;"pointerDown"===n?p(e,t):l(e,t)}function D(){var n=w.selectedClass,e=I(!0);L(!0).forEach((function(e){return l(d[e],n)})),e.forEach((function(e){return p(d[e],n)}))}function P(){u.dragHandler.removeAllEvents(),u.slideFocus.removeAllEvents(),u.animation.stop(),g.removeAll(),u.translate.clear(),u.slideLooper.clear(),l(e,w.draggableClass),d.forEach((function(n){return l(n,w.selectedClass)})),f.off("select",D).off("pointerUp",D).off("pointerDown",C).off("pointerUp",C)}function B(e){if(y){var t=n({startIndex:O()},e);P(),E(t),f.emit("reInit")}}function I(n){var e=u[n?"target":"location"].get(),t=w.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function L(n){var e=I(n);return u.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}function z(n,e,t){u.scrollBody.useBaseMass().useSpeed(e?100:w.speed),y&&u.scrollTo.index(n,t||0)}function O(){return u.index.get()}return E(t),{canScrollNext:function(){return u.index.clone().add(1).get()!==O()},canScrollPrev:function(){return u.index.clone().add(-1).get()!==O()},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return s},dangerouslyGetEngine:function(){return u},destroy:function(){y&&(P(),y=!1,f.emit("destroy"))},off:x,on:h,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:v,rootNode:function(){return e},scrollNext:function(n){z(u.index.clone().add(1).get(),n,-1)},scrollPrev:function(n){z(u.index.clone().add(-1).get(),n,1)},scrollProgress:function(){return u.scrollProgress.get(u.location.get())},scrollSnapList:function(){return u.scrollSnaps.map(u.scrollProgress.get)},scrollTo:z,selectedScrollSnap:O,slideNodes:function(){return d},slidesInView:I,slidesNotInView:L}}})); |
@@ -1,3 +0,3 @@ | ||
export { EmblaOptionsType } from './vanilla/components/options'; | ||
export { EmblaEventType } from './vanilla/components/eventEmitter'; | ||
export { EmblaOptionsType } from './vanilla/options'; | ||
export { EmblaEventType } from './vanilla/eventEmitter'; | ||
export { EmblaCarouselType } from './vanilla'; | ||
@@ -4,0 +4,0 @@ export { UseEmblaCarouselType } from './react'; |
{ | ||
"name": "embla-carousel", | ||
"version": "4.4.0", | ||
"version": "4.4.1", | ||
"private": false, | ||
@@ -57,26 +57,25 @@ "author": "David Cetinkaya <david.o.cetinkaya@gmail.com>", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.10", | ||
"@babel/core": "^7.13.15", | ||
"@babel/plugin-transform-object-assign": "^7.12.13", | ||
"@babel/preset-env": "^7.13.10", | ||
"@babel/preset-env": "^7.13.15", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-node-resolve": "^8.4.0", | ||
"@types/jest": "^24.9.1", | ||
"@types/jest-diff": "^20.0.0", | ||
"@types/react": "^16.14.5", | ||
"@typescript-eslint/eslint-plugin": "^4.18.0", | ||
"@typescript-eslint/parser": "^4.18.0", | ||
"eslint": "^7.22.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"jest": "^24.9.0", | ||
"@rollup/plugin-node-resolve": "^11.2.1", | ||
"@types/jest": "^26.0.22", | ||
"@types/react": "^17.0.3", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"eslint": "^7.24.0", | ||
"eslint-config-prettier": "^8.2.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"jest": "^26.6.3", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.2.1", | ||
"react": "^16.14.0", | ||
"rollup": "^2.42.0", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"rollup-plugin-typescript2": "^0.27.3", | ||
"ts-jest": "^26.5.4", | ||
"typescript": "^3.9.9" | ||
"react": "^17.0.2", | ||
"rollup": "^2.45.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"ts-jest": "^26.5.5", | ||
"typescript": "^4.2.4" | ||
} | ||
} |
@@ -1238,37 +1238,2 @@ import { useState, useRef, useMemo, useEffect } from 'react'; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = window.getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EventEmitter() { | ||
@@ -1309,2 +1274,37 @@ var listeners = {}; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EmblaCarousel(sliderRoot, userOptions) { | ||
@@ -1311,0 +1311,0 @@ var events = EventEmitter(); |
70
react.js
@@ -1242,37 +1242,2 @@ 'use strict'; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = window.getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EventEmitter() { | ||
@@ -1313,2 +1278,37 @@ var listeners = {}; | ||
var defaultOptions = { | ||
align: 'center', | ||
axis: 'x', | ||
containScroll: '', | ||
direction: 'ltr', | ||
dragFree: false, | ||
draggable: true, | ||
draggableClass: 'is-draggable', | ||
draggingClass: 'is-dragging', | ||
inViewThreshold: 0, | ||
loop: false, | ||
selectedClass: 'is-selected', | ||
slidesToScroll: 1, | ||
speed: 10, | ||
startIndex: 0 | ||
}; | ||
function OptionsPseudo(node) { | ||
var pseudoString = getComputedStyle(node, ':before').content; | ||
function get() { | ||
try { | ||
return JSON.parse(pseudoString.slice(1, -1).replace(/\\/g, '')); | ||
} catch (error) {} // eslint-disable-line no-empty | ||
return {}; | ||
} | ||
var self = { | ||
get: get | ||
}; | ||
return self; | ||
} | ||
function EmblaCarousel(sliderRoot, userOptions) { | ||
@@ -1315,0 +1315,0 @@ var events = EventEmitter(); |
import { EmblaCarouselType } from '../vanilla'; | ||
import { EmblaOptionsType } from '../vanilla/components/options'; | ||
import { EmblaOptionsType } from '../vanilla/options'; | ||
declare type ViewportRefType = <ViewportElement extends HTMLElement>(instance: ViewportElement | null) => void; | ||
export declare type UseEmblaCarouselType = [ViewportRefType, EmblaCarouselType | undefined]; | ||
export declare type UseEmblaCarouselType = [ | ||
ViewportRefType, | ||
EmblaCarouselType | undefined | ||
]; | ||
declare function useEmblaCarousel(options?: EmblaOptionsType): UseEmblaCarouselType; | ||
export { useEmblaCarousel }; |
@@ -1,4 +0,4 @@ | ||
import { Engine } from './components/engine'; | ||
import { EmblaOptionsType } from './components/options'; | ||
import { EventEmitterType } from './components/eventEmitter'; | ||
import { Engine } from './engine'; | ||
import { EventEmitterType } from './eventEmitter'; | ||
import { EmblaOptionsType } from './options'; | ||
export declare type EmblaCarouselType = { | ||
@@ -5,0 +5,0 @@ canScrollNext: () => boolean; |
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
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
22
5729
635929