embla-carousel
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -6,10 +6,17 @@ import { ChunkSize } from './chunkSize'; | ||
chunkSize: ChunkSize; | ||
contentSize: number; | ||
slides: HTMLElement[]; | ||
location: Vector1D; | ||
slideSizes: number[]; | ||
span: number; | ||
}; | ||
declare type ShiftPoint = { | ||
point: number; | ||
location: Vector1D; | ||
index: number; | ||
findTarget: (location: number) => Vector1D; | ||
}; | ||
export declare type InfiniteShifter = { | ||
shiftAccordingTo: (parentLocation: Vector1D) => void; | ||
shiftInfinite: (slides: HTMLElement[]) => void; | ||
shiftPoints: ShiftPoint[]; | ||
}; | ||
export declare function InfiniteShifter(params: Params): Readonly<InfiniteShifter>; | ||
export {}; |
@@ -428,3 +428,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (options.loop) { | ||
slider.shifter.shiftAccordingTo(slider.mover.location); | ||
slider.shifter.shiftInfinite(slides); | ||
} | ||
@@ -680,3 +680,3 @@ | ||
slider.edgeLooper.loop(direction()); | ||
slider.shifter.shiftAccordingTo(slider.mover.location); | ||
slider.shifter.shiftInfinite(slides); | ||
} | ||
@@ -756,5 +756,5 @@ | ||
chunkSize: chunkSize, | ||
contentSize: contentSize, | ||
location: location, | ||
slideSizes: slideSizes, | ||
slides: slides | ||
span: contentSize | ||
}), | ||
@@ -1199,3 +1199,3 @@ target: target, | ||
function InfiniteShifter(params) { | ||
var slides = params.slides, | ||
var span = params.span, | ||
chunkSize = params.chunkSize, | ||
@@ -1205,4 +1205,3 @@ slideSizes = params.slideSizes, | ||
var viewSize = chunkSize.root; | ||
var distance = params.contentSize; | ||
var ascItems = Object.keys(slides).map(Number); | ||
var ascItems = Object.keys(slideSizes).map(Number); | ||
var descItems = ascItems.slice().reverse(); | ||
@@ -1233,3 +1232,3 @@ var shiftPoints = startPoints().concat(endPoints()); | ||
function shiftPoint(indexes, from, direction) { | ||
var slideCount = slides.length - 1; | ||
var slideCount = ascItems.length - 1; | ||
return subtractItemSizesOf(indexes.map(function (i) { | ||
@@ -1245,5 +1244,5 @@ return (i + direction) % slideCount; | ||
return ascIndexes.map(function (i, j) { | ||
var node = slides[i]; | ||
var initial = distance * (!direction ? 0 : -1); | ||
var offset = distance * (!direction ? 1 : 0); | ||
var index = i; | ||
var initial = span * (!direction ? 0 : -1); | ||
var offset = span * (!direction ? 1 : 0); | ||
var slidesInSpan = ascIndexes.slice(0, j); | ||
@@ -1260,5 +1259,6 @@ var point = shiftPoint(slidesInSpan, from, direction); | ||
return { | ||
point: point, | ||
findTarget: findTarget, | ||
location: location, | ||
node: node | ||
index: index | ||
}; | ||
@@ -1278,15 +1278,17 @@ }); | ||
var indexes = shiftItemsIn(gap, ascItems); | ||
var start = shiftStart(distance, ascItems, -viewSize); | ||
var start = shiftStart(span, ascItems, -viewSize); | ||
return shiftPointsFor(indexes, -start, 0); | ||
} | ||
function shiftAccordingTo(parentLocation) { | ||
function shiftInfinite(slides) { | ||
var parentLocation = params.location; | ||
shiftPoints.forEach(function (point) { | ||
var findTarget = point.findTarget, | ||
location = point.location, | ||
node = point.node; | ||
index = point.index; | ||
var target = findTarget(parentLocation.get()); | ||
if (target.get() !== location.get()) { | ||
node.style.left = "".concat(target.get(), "%"); | ||
slides[index].style.left = "".concat(target.get(), "%"); | ||
location.set(target); | ||
} | ||
@@ -1297,3 +1299,4 @@ }); | ||
var self = { | ||
shiftAccordingTo: shiftAccordingTo | ||
shiftInfinite: shiftInfinite, | ||
shiftPoints: shiftPoints | ||
}; | ||
@@ -1300,0 +1303,0 @@ return Object.freeze(self); |
{ | ||
"name": "embla-carousel", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"author": "David Cetinkaya", | ||
@@ -5,0 +5,0 @@ "private": false, |
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
63928
1900