embla-carousel
Advanced tools
Comparing version 2.4.4 to 2.4.5
231
lib/index.js
@@ -196,2 +196,67 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
function Limit(params) { | ||
var min = params.min, | ||
max = params.max; | ||
var loopLimits = { | ||
max: min, | ||
min: max | ||
}; | ||
var constrainLimits = { | ||
min: min, | ||
max: max | ||
}; | ||
function reachedMin(n) { | ||
return n < min; | ||
} | ||
function reachedMax(n) { | ||
return n > max; | ||
} | ||
function reachedAny(n) { | ||
return reachedMin(n) || reachedMax(n); | ||
} | ||
function reachedWhich(n) { | ||
var isMin = reachedMin(n) && 'min'; | ||
var isMax = reachedMax(n) && 'max'; | ||
return isMin || isMax || ''; | ||
} | ||
function loop(n) { | ||
var which = reachedWhich(n); | ||
return which ? loopLimits[which] : n; | ||
} | ||
function constrain(n) { | ||
var which = reachedWhich(n); | ||
return which ? constrainLimits[which] : n; | ||
} | ||
var self = { | ||
constrain: constrain, | ||
loop: loop, | ||
max: max, | ||
min: min, | ||
reachedAny: reachedAny, | ||
reachedMax: reachedMax, | ||
reachedMin: reachedMin | ||
}; | ||
return Object.freeze(self); | ||
} | ||
exports.Limit = Limit; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function rectWidth(node) { | ||
@@ -240,3 +305,3 @@ return node.getBoundingClientRect().width; | ||
/***/ }), | ||
/* 2 */ | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -277,67 +342,2 @@ | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function Limit(params) { | ||
var min = params.min, | ||
max = params.max; | ||
var loopLimits = { | ||
max: min, | ||
min: max | ||
}; | ||
var constrainLimits = { | ||
min: min, | ||
max: max | ||
}; | ||
function reachedMin(n) { | ||
return n < min; | ||
} | ||
function reachedMax(n) { | ||
return n > max; | ||
} | ||
function reachedAny(n) { | ||
return reachedMin(n) || reachedMax(n); | ||
} | ||
function reachedWhich(n) { | ||
var isMin = reachedMin(n) && 'min'; | ||
var isMax = reachedMax(n) && 'max'; | ||
return isMin || isMax || ''; | ||
} | ||
function loop(n) { | ||
var which = reachedWhich(n); | ||
return which ? loopLimits[which] : n; | ||
} | ||
function constrain(n) { | ||
var which = reachedWhich(n); | ||
return which ? constrainLimits[which] : n; | ||
} | ||
var self = { | ||
constrain: constrain, | ||
loop: loop, | ||
max: max, | ||
min: min, | ||
reachedAny: reachedAny, | ||
reachedMax: reachedMax, | ||
reachedMin: reachedMin | ||
}; | ||
return Object.freeze(self); | ||
} | ||
exports.Limit = Limit; | ||
/***/ }), | ||
/* 4 */ | ||
@@ -472,9 +472,9 @@ /***/ (function(module, exports, __webpack_require__) { | ||
var eventDispatcher_1 = __webpack_require__(23); | ||
var eventDispatcher_1 = __webpack_require__(24); | ||
var eventStore_1 = __webpack_require__(5); | ||
var options_1 = __webpack_require__(24); | ||
var options_1 = __webpack_require__(25); | ||
var utils_1 = __webpack_require__(1); | ||
var utils_1 = __webpack_require__(2); | ||
@@ -742,3 +742,3 @@ function EmblaCarousel(sliderRoot) { | ||
var limit_1 = __webpack_require__(3); | ||
var limit_1 = __webpack_require__(1); | ||
@@ -755,14 +755,16 @@ var mover_1 = __webpack_require__(13); | ||
var scrollLooper_1 = __webpack_require__(18); | ||
var scrollLimit_1 = __webpack_require__(18); | ||
var scrollSnap_1 = __webpack_require__(19); | ||
var scrollLooper_1 = __webpack_require__(19); | ||
var scrollTarget_1 = __webpack_require__(20); | ||
var scrollSnap_1 = __webpack_require__(20); | ||
var slideLooper_1 = __webpack_require__(21); | ||
var scrollTarget_1 = __webpack_require__(21); | ||
var translate_1 = __webpack_require__(22); | ||
var slideLooper_1 = __webpack_require__(22); | ||
var utils_1 = __webpack_require__(1); | ||
var translate_1 = __webpack_require__(23); | ||
var utils_1 = __webpack_require__(2); | ||
var vector1d_1 = __webpack_require__(0); | ||
@@ -831,9 +833,8 @@ | ||
var loopSize = -contentSize + chunkSize.measure(1); | ||
var max = scrollSnaps[0]; | ||
var min = loop ? max + loopSize : scrollSnaps[index.max]; | ||
var limit = limit_1.Limit({ | ||
max: max, | ||
min: min | ||
}); // Direction | ||
var scrollLimit = scrollLimit_1.ScrollLimit({ | ||
loop: loop, | ||
chunkSize: chunkSize, | ||
contentSize: contentSize | ||
}); | ||
var limit = scrollLimit.measure(scrollSnaps); // Direction | ||
@@ -1074,3 +1075,3 @@ var direction = function direction() { | ||
var direction_1 = __webpack_require__(2); | ||
var direction_1 = __webpack_require__(3); | ||
@@ -1260,5 +1261,5 @@ var eventStore_1 = __webpack_require__(5); | ||
var direction_1 = __webpack_require__(2); | ||
var direction_1 = __webpack_require__(3); | ||
var utils_1 = __webpack_require__(1); | ||
var utils_1 = __webpack_require__(2); | ||
@@ -1356,3 +1357,3 @@ var vector1d_1 = __webpack_require__(0); | ||
var direction_1 = __webpack_require__(2); | ||
var direction_1 = __webpack_require__(3); | ||
@@ -1567,5 +1568,5 @@ var vector1d_1 = __webpack_require__(0); | ||
var limit_1 = __webpack_require__(3); | ||
var limit_1 = __webpack_require__(1); | ||
var utils_1 = __webpack_require__(1); | ||
var utils_1 = __webpack_require__(2); | ||
@@ -1657,2 +1658,40 @@ function ScrollContain(params) { | ||
var limit_1 = __webpack_require__(1); | ||
function ScrollLimit(params) { | ||
var contentSize = params.contentSize, | ||
chunkSize = params.chunkSize, | ||
loop = params.loop; | ||
var loopSize = -contentSize + chunkSize.measure(1); | ||
function measure(scrollSnaps) { | ||
var startSnap = scrollSnaps[0]; | ||
var endSnap = scrollSnaps[scrollSnaps.length - 1]; | ||
var max = startSnap; | ||
var min = loop ? max + loopSize : endSnap; | ||
return limit_1.Limit({ | ||
max: max, | ||
min: min | ||
}); | ||
} | ||
var self = { | ||
measure: measure | ||
}; | ||
return Object.freeze(self); | ||
} | ||
exports.ScrollLimit = ScrollLimit; | ||
/***/ }), | ||
/* 19 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function ScrollLooper(params) { | ||
@@ -1689,3 +1728,3 @@ var limit = params.limit, | ||
/***/ }), | ||
/* 19 */ | ||
/* 20 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1702,3 +1741,3 @@ | ||
var limit_1 = __webpack_require__(3); | ||
var limit_1 = __webpack_require__(1); | ||
@@ -1744,3 +1783,3 @@ function ScrollSnap(params) { | ||
/***/ }), | ||
/* 20 */ | ||
/* 21 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1876,3 +1915,3 @@ | ||
/***/ }), | ||
/* 21 */ | ||
/* 22 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -1992,3 +2031,3 @@ | ||
/***/ }), | ||
/* 22 */ | ||
/* 23 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -2036,3 +2075,3 @@ | ||
/***/ }), | ||
/* 23 */ | ||
/* 24 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -2091,3 +2130,3 @@ | ||
/***/ }), | ||
/* 24 */ | ||
/* 25 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -2094,0 +2133,0 @@ |
{ | ||
"name": "embla-carousel", | ||
"version": "2.4.4", | ||
"version": "2.4.5", | ||
"author": "David Cetinkaya", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -408,7 +408,7 @@ <br /> | ||
<p align="center"> | ||
<a href="https://github.com/michaelrambeau"><img src="https://avatars0.githubusercontent.com/u/5546996?s=400&v=4" title="michaelrambeau" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/ehellman"><img src="https://avatars3.githubusercontent.com/u/586152?s=400&v=4" title="ehellman" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/afilp"><img src="https://avatars0.githubusercontent.com/u/7850073?s=400&v=4" title="afilp" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/mrksmts"><img src="https://avatars1.githubusercontent.com/u/437794?s=400&v=4" title="mrksmts" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/SLMNBJ"><img src="https://avatars2.githubusercontent.com/u/30017004?s=400&v=4" title="SLMNBJ" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/michaelrambeau"><img src="https://avatars0.githubusercontent.com/u/5546996?s=122&v=4" title="michaelrambeau" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/ehellman"><img src="https://avatars3.githubusercontent.com/u/586152?s=122&v=4" title="ehellman" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/afilp"><img src="https://avatars0.githubusercontent.com/u/7850073?s=122&v=4" title="afilp" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/mrksmts"><img src="https://avatars1.githubusercontent.com/u/437794?s=122&v=4" title="mrksmts" width="66" height="66" style="max-width:100%;"></a> | ||
<a href="https://github.com/SLMNBJ"><img src="https://avatars2.githubusercontent.com/u/30017004?s=122&v=4" title="SLMNBJ" width="66" height="66" style="max-width:100%;"></a> | ||
</p> | ||
@@ -415,0 +415,0 @@ </div> |
81110
29
2123