|
@@ -528,8 +528,7 @@
|
|
ArrowRight: [ARROW_DOWN, ARROW_LEFT]
|
|
ArrowRight: [ARROW_DOWN, ARROW_LEFT]
|
|
};
|
|
};
|
|
const Direction = (Splide2, Components2, options) => {
|
|
const Direction = (Splide2, Components2, options) => {
|
|
- function resolve(prop, axisOnly, direction) {
|
|
|
|
- direction = direction || options.direction;
|
|
|
|
|
|
+ function resolve(prop, axisOnly, direction = options.direction) {
|
|
const index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
|
|
const index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
|
|
return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, (match, offset) => {
|
|
return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, (match, offset) => {
|
|
const replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
|
|
const replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
|
|
@@ -1180,7 +1179,7 @@
|
|
if (!Components.Controller.isBusy()) {
|
|
if (!Components.Controller.isBusy()) {
|
|
Components.Scroll.cancel();
|
|
Components.Scroll.cancel();
|
|
jump(Splide.index);
|
|
jump(Splide.index);
|
|
- Components.Slides.update();
|
|
|
|
|
|
+ Slides.update();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function move(dest, index, prev, callback) {
|
|
function move(dest, index, prev, callback) {
|
|
@@ -1699,8 +1698,9 @@
|
|
emit(EVENT_SCROLLED);
|
|
emit(EVENT_SCROLLED);
|
|
}
|
|
}
|
|
function update(from, to, noConstrain, rate) {
|
|
function update(from, to, noConstrain, rate) {
|
|
|
|
+ const { easingFunc = (t) => 1 - Math.pow(1 - t, 4) } = options;
|
|
const position = getPosition();
|
|
const position = getPosition();
|
|
- const target = from + (to - from) * easing(rate);
|
|
|
|
|
|
+ const target = from + (to - from) * easingFunc(rate);
|
|
const diff = (target - position) * friction;
|
|
const diff = (target - position) * friction;
|
|
translate(position + diff);
|
|
translate(position + diff);
|
|
if (isSlide && !noConstrain && exceededLimit()) {
|
|
if (isSlide && !noConstrain && exceededLimit()) {
|
|
@@ -1721,10 +1721,6 @@
|
|
onEnd();
|
|
onEnd();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- function easing(t) {
|
|
|
|
- const { easingFunc } = options;
|
|
|
|
- return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
|
|
|
|
- }
|
|
|
|
return {
|
|
return {
|
|
mount,
|
|
mount,
|
|
destroy: clear,
|
|
destroy: clear,
|
|
@@ -2061,20 +2057,21 @@
|
|
const { length } = Splide;
|
|
const { length } = Splide;
|
|
const { classes, i18n, perPage, paginationKeyboard = true } = options;
|
|
const { classes, i18n, perPage, paginationKeyboard = true } = options;
|
|
const max = hasFocus() ? Controller.getEnd() + 1 : ceil(length / perPage);
|
|
const max = hasFocus() ? Controller.getEnd() + 1 : ceil(length / perPage);
|
|
|
|
+ const dir = getDirection();
|
|
list = placeholder || create("ul", classes.pagination, Elements.track.parentElement);
|
|
list = placeholder || create("ul", classes.pagination, Elements.track.parentElement);
|
|
- addClass(list, paginationClasses = `${CLASS_PAGINATION}--${getDirection()}`);
|
|
|
|
|
|
+ addClass(list, paginationClasses = `${CLASS_PAGINATION}--${dir}`);
|
|
setAttribute(list, ROLE, "tablist");
|
|
setAttribute(list, ROLE, "tablist");
|
|
setAttribute(list, ARIA_LABEL, i18n.select);
|
|
setAttribute(list, ARIA_LABEL, i18n.select);
|
|
- setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : "");
|
|
|
|
|
|
+ setAttribute(list, ARIA_ORIENTATION, dir === TTB ? "vertical" : "");
|
|
for (let i = 0; i < max; i++) {
|
|
for (let i = 0; i < max; i++) {
|
|
const li = create("li", null, list);
|
|
const li = create("li", null, list);
|
|
const button = create("button", { class: classes.page, type: "button" }, li);
|
|
const button = create("button", { class: classes.page, type: "button" }, li);
|
|
const controls = Slides.getIn(i).map((Slide) => Slide.slide.id);
|
|
const controls = Slides.getIn(i).map((Slide) => Slide.slide.id);
|
|
const text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
|
|
const text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
|
|
- bind(button, "click", apply(onClick, i));
|
|
|
|
- if (paginationKeyboard) {
|
|
|
|
- bind(button, "keydown", apply(onKeydown, i));
|
|
|
|
- }
|
|
|
|
|
|
+ bind(button, "click", () => {
|
|
|
|
+ go(`>${i}`, true);
|
|
|
|
+ });
|
|
|
|
+ paginationKeyboard && bind(button, "keydown", apply(onKeydown, i));
|
|
setAttribute(li, ROLE, "presentation");
|
|
setAttribute(li, ROLE, "presentation");
|
|
setAttribute(button, ROLE, "tab");
|
|
setAttribute(button, ROLE, "tab");
|
|
setAttribute(button, ARIA_CONTROLS, controls.join(" "));
|
|
setAttribute(button, ARIA_CONTROLS, controls.join(" "));
|
|
@@ -2083,9 +2080,6 @@
|
|
items.push({ li, button, page: i });
|
|
items.push({ li, button, page: i });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- function onClick(page) {
|
|
|
|
- go(`>${page}`, true);
|
|
|
|
- }
|
|
|
|
function onKeydown(page, e) {
|
|
function onKeydown(page, e) {
|
|
const { length } = items;
|
|
const { length } = items;
|
|
const { key } = e;
|
|
const { key } = e;
|