@beyonk/svelte-carousel
Advanced tools
Comparing version 2.6.1 to 2.7.0
@@ -336,3 +336,3 @@ (function (global, factory) { | ||
const child_ctx = Object.create(ctx); | ||
child_ctx.pip = list[i]; | ||
child_ctx._ = list[i]; | ||
child_ctx.i = i; | ||
@@ -349,3 +349,3 @@ return child_ctx; | ||
var each_value = ctx.pips; | ||
var each_value = {length: ctx.totalDots}; | ||
@@ -377,4 +377,4 @@ var each_blocks = []; | ||
p(changed, ctx) { | ||
if (changed.currentIndex || changed.pips) { | ||
each_value = ctx.pips; | ||
if (changed.isDotActive || changed.currentIndex || changed.totalDots) { | ||
each_value = {length: ctx.totalDots}; | ||
@@ -410,3 +410,3 @@ for (var i = 0; i < each_value.length; i += 1) { | ||
// (11:2) {#each pips as pip, i} | ||
// (11:2) {#each {length: totalDots} as _, i} | ||
function create_each_block(ctx) { | ||
@@ -422,3 +422,3 @@ var li, li_class_value, dispose; | ||
li = element("li"); | ||
attr(li, "class", li_class_value = "" + (ctx.currentIndex === ctx.i ? "active" : "") + " svelte-1ppqxio"); | ||
attr(li, "class", li_class_value = "" + (ctx.isDotActive(ctx.currentIndex, ctx.i) ? "active" : "") + " svelte-1ppqxio"); | ||
dispose = listen(li, "click", click_handler); | ||
@@ -433,3 +433,3 @@ }, | ||
ctx = new_ctx; | ||
if ((changed.currentIndex) && li_class_value !== (li_class_value = "" + (ctx.currentIndex === ctx.i ? "active" : "") + " svelte-1ppqxio")) { | ||
if ((changed.currentIndex) && li_class_value !== (li_class_value = "" + (ctx.isDotActive(ctx.currentIndex, ctx.i) ? "active" : "") + " svelte-1ppqxio")) { | ||
attr(li, "class", li_class_value); | ||
@@ -631,2 +631,7 @@ } | ||
}); | ||
function isDotActive (currentIndex, dotIndex) { | ||
if (currentIndex < 0) currentIndex = pips.length + currentIndex; | ||
return currentIndex >= dotIndex*perPage && currentIndex < (dotIndex*perPage)+perPage | ||
} | ||
@@ -672,3 +677,3 @@ function left () { | ||
function click_handler({ i }) { | ||
return go(i); | ||
return go(i*perPage); | ||
} | ||
@@ -691,6 +696,7 @@ | ||
let pips; | ||
let pips, totalDots; | ||
$$self.$$.update = ($$dirty = { controller: 1 }) => { | ||
if ($$dirty.controller) { $$invalidate('pips', pips = controller ? controller.innerElements : []); } | ||
$$self.$$.update = ($$dirty = { controller: 1, perPage: 1 }) => { | ||
if ($$dirty.controller) { pips = controller ? controller.innerElements : []; } | ||
if ($$dirty.controller || $$dirty.perPage) { $$invalidate('totalDots', totalDots = controller ? Math.ceil(controller.innerElements.length / perPage) : []); } | ||
}; | ||
@@ -712,2 +718,3 @@ | ||
siema, | ||
isDotActive, | ||
left, | ||
@@ -718,3 +725,3 @@ right, | ||
resume, | ||
pips, | ||
totalDots, | ||
div0_binding, | ||
@@ -731,5 +738,9 @@ click_handler, | ||
if (!document.getElementById("svelte-1ppqxio-style")) add_css(); | ||
init(this, options, instance, create_fragment, safe_not_equal, ["perPage", "loop", "autoplay", "duration", "easing", "startIndex", "draggable", "multipleDrag", "dots", "threshold", "rtl", "left", "right", "go", "pause", "resume"]); | ||
init(this, options, instance, create_fragment, safe_not_equal, ["perPage", "loop", "autoplay", "duration", "easing", "startIndex", "draggable", "multipleDrag", "dots", "threshold", "rtl", "isDotActive", "left", "right", "go", "pause", "resume"]); | ||
} | ||
get isDotActive() { | ||
return this.$$.ctx.isDotActive; | ||
} | ||
get left() { | ||
@@ -736,0 +747,0 @@ return this.$$.ctx.left; |
@@ -6,3 +6,3 @@ { | ||
"main": "dist/index.js", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"scripts": { | ||
@@ -9,0 +9,0 @@ "build": "rollup -c", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
81452
1412