|
a |
|
b/docs/static/js/bulma-carousel.js |
|
|
1 |
(function webpackUniversalModuleDefinition(root, factory) { |
|
|
2 |
if(typeof exports === 'object' && typeof module === 'object') |
|
|
3 |
module.exports = factory(); |
|
|
4 |
else if(typeof define === 'function' && define.amd) |
|
|
5 |
define([], factory); |
|
|
6 |
else if(typeof exports === 'object') |
|
|
7 |
exports["bulmaCarousel"] = factory(); |
|
|
8 |
else |
|
|
9 |
root["bulmaCarousel"] = factory(); |
|
|
10 |
})(typeof self !== 'undefined' ? self : this, function() { |
|
|
11 |
return /******/ (function(modules) { // webpackBootstrap |
|
|
12 |
/******/ // The module cache |
|
|
13 |
/******/ var installedModules = {}; |
|
|
14 |
/******/ |
|
|
15 |
/******/ // The require function |
|
|
16 |
/******/ function __webpack_require__(moduleId) { |
|
|
17 |
/******/ |
|
|
18 |
/******/ // Check if module is in cache |
|
|
19 |
/******/ if(installedModules[moduleId]) { |
|
|
20 |
/******/ return installedModules[moduleId].exports; |
|
|
21 |
/******/ } |
|
|
22 |
/******/ // Create a new module (and put it into the cache) |
|
|
23 |
/******/ var module = installedModules[moduleId] = { |
|
|
24 |
/******/ i: moduleId, |
|
|
25 |
/******/ l: false, |
|
|
26 |
/******/ exports: {} |
|
|
27 |
/******/ }; |
|
|
28 |
/******/ |
|
|
29 |
/******/ // Execute the module function |
|
|
30 |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
|
31 |
/******/ |
|
|
32 |
/******/ // Flag the module as loaded |
|
|
33 |
/******/ module.l = true; |
|
|
34 |
/******/ |
|
|
35 |
/******/ // Return the exports of the module |
|
|
36 |
/******/ return module.exports; |
|
|
37 |
/******/ } |
|
|
38 |
/******/ |
|
|
39 |
/******/ |
|
|
40 |
/******/ // expose the modules object (__webpack_modules__) |
|
|
41 |
/******/ __webpack_require__.m = modules; |
|
|
42 |
/******/ |
|
|
43 |
/******/ // expose the module cache |
|
|
44 |
/******/ __webpack_require__.c = installedModules; |
|
|
45 |
/******/ |
|
|
46 |
/******/ // define getter function for harmony exports |
|
|
47 |
/******/ __webpack_require__.d = function(exports, name, getter) { |
|
|
48 |
/******/ if(!__webpack_require__.o(exports, name)) { |
|
|
49 |
/******/ Object.defineProperty(exports, name, { |
|
|
50 |
/******/ configurable: false, |
|
|
51 |
/******/ enumerable: true, |
|
|
52 |
/******/ get: getter |
|
|
53 |
/******/ }); |
|
|
54 |
/******/ } |
|
|
55 |
/******/ }; |
|
|
56 |
/******/ |
|
|
57 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
|
|
58 |
/******/ __webpack_require__.n = function(module) { |
|
|
59 |
/******/ var getter = module && module.__esModule ? |
|
|
60 |
/******/ function getDefault() { return module['default']; } : |
|
|
61 |
/******/ function getModuleExports() { return module; }; |
|
|
62 |
/******/ __webpack_require__.d(getter, 'a', getter); |
|
|
63 |
/******/ return getter; |
|
|
64 |
/******/ }; |
|
|
65 |
/******/ |
|
|
66 |
/******/ // Object.prototype.hasOwnProperty.call |
|
|
67 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
|
68 |
/******/ |
|
|
69 |
/******/ // __webpack_public_path__ |
|
|
70 |
/******/ __webpack_require__.p = ""; |
|
|
71 |
/******/ |
|
|
72 |
/******/ // Load entry module and return exports |
|
|
73 |
/******/ return __webpack_require__(__webpack_require__.s = 5); |
|
|
74 |
/******/ }) |
|
|
75 |
/************************************************************************/ |
|
|
76 |
/******/ ([ |
|
|
77 |
/* 0 */ |
|
|
78 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
79 |
|
|
|
80 |
"use strict"; |
|
|
81 |
/* unused harmony export addClasses */ |
|
|
82 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return removeClasses; }); |
|
|
83 |
/* unused harmony export show */ |
|
|
84 |
/* unused harmony export hide */ |
|
|
85 |
/* unused harmony export offset */ |
|
|
86 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return width; }); |
|
|
87 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return height; }); |
|
|
88 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return outerHeight; }); |
|
|
89 |
/* unused harmony export outerWidth */ |
|
|
90 |
/* unused harmony export position */ |
|
|
91 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return css; }); |
|
|
92 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__type__ = __webpack_require__(2); |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
var addClasses = function addClasses(element, classes) { |
|
|
96 |
classes = Array.isArray(classes) ? classes : classes.split(' '); |
|
|
97 |
classes.forEach(function (cls) { |
|
|
98 |
element.classList.add(cls); |
|
|
99 |
}); |
|
|
100 |
}; |
|
|
101 |
|
|
|
102 |
var removeClasses = function removeClasses(element, classes) { |
|
|
103 |
classes = Array.isArray(classes) ? classes : classes.split(' '); |
|
|
104 |
classes.forEach(function (cls) { |
|
|
105 |
element.classList.remove(cls); |
|
|
106 |
}); |
|
|
107 |
}; |
|
|
108 |
|
|
|
109 |
var show = function show(elements) { |
|
|
110 |
elements = Array.isArray(elements) ? elements : [elements]; |
|
|
111 |
elements.forEach(function (element) { |
|
|
112 |
element.style.display = ''; |
|
|
113 |
}); |
|
|
114 |
}; |
|
|
115 |
|
|
|
116 |
var hide = function hide(elements) { |
|
|
117 |
elements = Array.isArray(elements) ? elements : [elements]; |
|
|
118 |
elements.forEach(function (element) { |
|
|
119 |
element.style.display = 'none'; |
|
|
120 |
}); |
|
|
121 |
}; |
|
|
122 |
|
|
|
123 |
var offset = function offset(element) { |
|
|
124 |
var rect = element.getBoundingClientRect(); |
|
|
125 |
return { |
|
|
126 |
top: rect.top + document.body.scrollTop, |
|
|
127 |
left: rect.left + document.body.scrollLeft |
|
|
128 |
}; |
|
|
129 |
}; |
|
|
130 |
|
|
|
131 |
// returns an element's width |
|
|
132 |
var width = function width(element) { |
|
|
133 |
return element.getBoundingClientRect().width || element.offsetWidth; |
|
|
134 |
}; |
|
|
135 |
// returns an element's height |
|
|
136 |
var height = function height(element) { |
|
|
137 |
return element.getBoundingClientRect().height || element.offsetHeight; |
|
|
138 |
}; |
|
|
139 |
|
|
|
140 |
var outerHeight = function outerHeight(element) { |
|
|
141 |
var withMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
|
|
142 |
|
|
|
143 |
var height = element.offsetHeight; |
|
|
144 |
if (withMargin) { |
|
|
145 |
var style = window.getComputedStyle(element); |
|
|
146 |
height += parseInt(style.marginTop) + parseInt(style.marginBottom); |
|
|
147 |
} |
|
|
148 |
return height; |
|
|
149 |
}; |
|
|
150 |
|
|
|
151 |
var outerWidth = function outerWidth(element) { |
|
|
152 |
var withMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
|
|
153 |
|
|
|
154 |
var width = element.offsetWidth; |
|
|
155 |
if (withMargin) { |
|
|
156 |
var style = window.getComputedStyle(element); |
|
|
157 |
width += parseInt(style.marginLeft) + parseInt(style.marginRight); |
|
|
158 |
} |
|
|
159 |
return width; |
|
|
160 |
}; |
|
|
161 |
|
|
|
162 |
var position = function position(element) { |
|
|
163 |
return { |
|
|
164 |
left: element.offsetLeft, |
|
|
165 |
top: element.offsetTop |
|
|
166 |
}; |
|
|
167 |
}; |
|
|
168 |
|
|
|
169 |
var css = function css(element, obj) { |
|
|
170 |
if (!obj) { |
|
|
171 |
return window.getComputedStyle(element); |
|
|
172 |
} |
|
|
173 |
if (Object(__WEBPACK_IMPORTED_MODULE_0__type__["b" /* isObject */])(obj)) { |
|
|
174 |
var style = ''; |
|
|
175 |
Object.keys(obj).forEach(function (key) { |
|
|
176 |
style += key + ': ' + obj[key] + ';'; |
|
|
177 |
}); |
|
|
178 |
|
|
|
179 |
element.style.cssText += style; |
|
|
180 |
} |
|
|
181 |
}; |
|
|
182 |
|
|
|
183 |
/***/ }), |
|
|
184 |
/* 1 */ |
|
|
185 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
186 |
|
|
|
187 |
"use strict"; |
|
|
188 |
/* harmony export (immutable) */ __webpack_exports__["a"] = detectSupportsPassive; |
|
|
189 |
function detectSupportsPassive() { |
|
|
190 |
var supportsPassive = false; |
|
|
191 |
|
|
|
192 |
try { |
|
|
193 |
var opts = Object.defineProperty({}, 'passive', { |
|
|
194 |
get: function get() { |
|
|
195 |
supportsPassive = true; |
|
|
196 |
} |
|
|
197 |
}); |
|
|
198 |
|
|
|
199 |
window.addEventListener('testPassive', null, opts); |
|
|
200 |
window.removeEventListener('testPassive', null, opts); |
|
|
201 |
} catch (e) {} |
|
|
202 |
|
|
|
203 |
return supportsPassive; |
|
|
204 |
} |
|
|
205 |
|
|
|
206 |
/***/ }), |
|
|
207 |
/* 2 */ |
|
|
208 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
209 |
|
|
|
210 |
"use strict"; |
|
|
211 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isFunction; }); |
|
|
212 |
/* unused harmony export isNumber */ |
|
|
213 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isString; }); |
|
|
214 |
/* unused harmony export isDate */ |
|
|
215 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isObject; }); |
|
|
216 |
/* unused harmony export isEmptyObject */ |
|
|
217 |
/* unused harmony export isNode */ |
|
|
218 |
/* unused harmony export isVideo */ |
|
|
219 |
/* unused harmony export isHTML5 */ |
|
|
220 |
/* unused harmony export isIFrame */ |
|
|
221 |
/* unused harmony export isYoutube */ |
|
|
222 |
/* unused harmony export isVimeo */ |
|
|
223 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|
|
224 |
|
|
|
225 |
var isFunction = function isFunction(unknown) { |
|
|
226 |
return typeof unknown === 'function'; |
|
|
227 |
}; |
|
|
228 |
var isNumber = function isNumber(unknown) { |
|
|
229 |
return typeof unknown === "number"; |
|
|
230 |
}; |
|
|
231 |
var isString = function isString(unknown) { |
|
|
232 |
return typeof unknown === 'string' || !!unknown && (typeof unknown === 'undefined' ? 'undefined' : _typeof(unknown)) === 'object' && Object.prototype.toString.call(unknown) === '[object String]'; |
|
|
233 |
}; |
|
|
234 |
var isDate = function isDate(unknown) { |
|
|
235 |
return (Object.prototype.toString.call(unknown) === '[object Date]' || unknown instanceof Date) && !isNaN(unknown.valueOf()); |
|
|
236 |
}; |
|
|
237 |
var isObject = function isObject(unknown) { |
|
|
238 |
return (typeof unknown === 'function' || (typeof unknown === 'undefined' ? 'undefined' : _typeof(unknown)) === 'object' && !!unknown) && !Array.isArray(unknown); |
|
|
239 |
}; |
|
|
240 |
var isEmptyObject = function isEmptyObject(unknown) { |
|
|
241 |
for (var name in unknown) { |
|
|
242 |
if (unknown.hasOwnProperty(name)) { |
|
|
243 |
return false; |
|
|
244 |
} |
|
|
245 |
} |
|
|
246 |
return true; |
|
|
247 |
}; |
|
|
248 |
|
|
|
249 |
var isNode = function isNode(unknown) { |
|
|
250 |
return !!(unknown && unknown.nodeType === HTMLElement | SVGElement); |
|
|
251 |
}; |
|
|
252 |
var isVideo = function isVideo(unknown) { |
|
|
253 |
return isYoutube(unknown) || isVimeo(unknown) || isHTML5(unknown); |
|
|
254 |
}; |
|
|
255 |
var isHTML5 = function isHTML5(unknown) { |
|
|
256 |
return isNode(unknown) && unknown.tagName === 'VIDEO'; |
|
|
257 |
}; |
|
|
258 |
var isIFrame = function isIFrame(unknown) { |
|
|
259 |
return isNode(unknown) && unknown.tagName === 'IFRAME'; |
|
|
260 |
}; |
|
|
261 |
var isYoutube = function isYoutube(unknown) { |
|
|
262 |
return isIFrame(unknown) && !!unknown.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/); |
|
|
263 |
}; |
|
|
264 |
var isVimeo = function isVimeo(unknown) { |
|
|
265 |
return isIFrame(unknown) && !!unknown.src.match(/vimeo\.com\/video\/.*/); |
|
|
266 |
}; |
|
|
267 |
|
|
|
268 |
/***/ }), |
|
|
269 |
/* 3 */ |
|
|
270 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
271 |
|
|
|
272 |
"use strict"; |
|
|
273 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
274 |
|
|
|
275 |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } |
|
|
276 |
|
|
|
277 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
278 |
|
|
|
279 |
var EventEmitter = function () { |
|
|
280 |
function EventEmitter() { |
|
|
281 |
var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
|
282 |
|
|
|
283 |
_classCallCheck(this, EventEmitter); |
|
|
284 |
|
|
|
285 |
this.events = new Map(events); |
|
|
286 |
} |
|
|
287 |
|
|
|
288 |
_createClass(EventEmitter, [{ |
|
|
289 |
key: "on", |
|
|
290 |
value: function on(name, cb) { |
|
|
291 |
var _this = this; |
|
|
292 |
|
|
|
293 |
this.events.set(name, [].concat(_toConsumableArray(this.events.has(name) ? this.events.get(name) : []), [cb])); |
|
|
294 |
|
|
|
295 |
return function () { |
|
|
296 |
return _this.events.set(name, _this.events.get(name).filter(function (fn) { |
|
|
297 |
return fn !== cb; |
|
|
298 |
})); |
|
|
299 |
}; |
|
|
300 |
} |
|
|
301 |
}, { |
|
|
302 |
key: "emit", |
|
|
303 |
value: function emit(name) { |
|
|
304 |
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
|
|
305 |
args[_key - 1] = arguments[_key]; |
|
|
306 |
} |
|
|
307 |
|
|
|
308 |
return this.events.has(name) && this.events.get(name).map(function (fn) { |
|
|
309 |
return fn.apply(undefined, args); |
|
|
310 |
}); |
|
|
311 |
} |
|
|
312 |
}]); |
|
|
313 |
|
|
|
314 |
return EventEmitter; |
|
|
315 |
}(); |
|
|
316 |
|
|
|
317 |
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter); |
|
|
318 |
|
|
|
319 |
/***/ }), |
|
|
320 |
/* 4 */ |
|
|
321 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
322 |
|
|
|
323 |
"use strict"; |
|
|
324 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
325 |
|
|
|
326 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
327 |
|
|
|
328 |
var Coordinate = function () { |
|
|
329 |
function Coordinate() { |
|
|
330 |
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; |
|
|
331 |
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
|
|
332 |
|
|
|
333 |
_classCallCheck(this, Coordinate); |
|
|
334 |
|
|
|
335 |
this._x = x; |
|
|
336 |
this._y = y; |
|
|
337 |
} |
|
|
338 |
|
|
|
339 |
_createClass(Coordinate, [{ |
|
|
340 |
key: 'add', |
|
|
341 |
value: function add(coord) { |
|
|
342 |
return new Coordinate(this._x + coord._x, this._y + coord._y); |
|
|
343 |
} |
|
|
344 |
}, { |
|
|
345 |
key: 'sub', |
|
|
346 |
value: function sub(coord) { |
|
|
347 |
return new Coordinate(this._x - coord._x, this._y - coord._y); |
|
|
348 |
} |
|
|
349 |
}, { |
|
|
350 |
key: 'distance', |
|
|
351 |
value: function distance(coord) { |
|
|
352 |
var deltaX = this._x - coord._x; |
|
|
353 |
var deltaY = this._y - coord._y; |
|
|
354 |
|
|
|
355 |
return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); |
|
|
356 |
} |
|
|
357 |
}, { |
|
|
358 |
key: 'max', |
|
|
359 |
value: function max(coord) { |
|
|
360 |
var x = Math.max(this._x, coord._x); |
|
|
361 |
var y = Math.max(this._y, coord._y); |
|
|
362 |
|
|
|
363 |
return new Coordinate(x, y); |
|
|
364 |
} |
|
|
365 |
}, { |
|
|
366 |
key: 'equals', |
|
|
367 |
value: function equals(coord) { |
|
|
368 |
if (this == coord) { |
|
|
369 |
return true; |
|
|
370 |
} |
|
|
371 |
if (!coord || coord == null) { |
|
|
372 |
return false; |
|
|
373 |
} |
|
|
374 |
return this._x == coord._x && this._y == coord._y; |
|
|
375 |
} |
|
|
376 |
}, { |
|
|
377 |
key: 'inside', |
|
|
378 |
value: function inside(northwest, southeast) { |
|
|
379 |
if (this._x >= northwest._x && this._x <= southeast._x && this._y >= northwest._y && this._y <= southeast._y) { |
|
|
380 |
|
|
|
381 |
return true; |
|
|
382 |
} |
|
|
383 |
return false; |
|
|
384 |
} |
|
|
385 |
}, { |
|
|
386 |
key: 'constrain', |
|
|
387 |
value: function constrain(min, max) { |
|
|
388 |
if (min._x > max._x || min._y > max._y) { |
|
|
389 |
return this; |
|
|
390 |
} |
|
|
391 |
|
|
|
392 |
var x = this._x, |
|
|
393 |
y = this._y; |
|
|
394 |
|
|
|
395 |
if (min._x !== null) { |
|
|
396 |
x = Math.max(x, min._x); |
|
|
397 |
} |
|
|
398 |
if (max._x !== null) { |
|
|
399 |
x = Math.min(x, max._x); |
|
|
400 |
} |
|
|
401 |
if (min._y !== null) { |
|
|
402 |
y = Math.max(y, min._y); |
|
|
403 |
} |
|
|
404 |
if (max._y !== null) { |
|
|
405 |
y = Math.min(y, max._y); |
|
|
406 |
} |
|
|
407 |
|
|
|
408 |
return new Coordinate(x, y); |
|
|
409 |
} |
|
|
410 |
}, { |
|
|
411 |
key: 'reposition', |
|
|
412 |
value: function reposition(element) { |
|
|
413 |
element.style['top'] = this._y + 'px'; |
|
|
414 |
element.style['left'] = this._x + 'px'; |
|
|
415 |
} |
|
|
416 |
}, { |
|
|
417 |
key: 'toString', |
|
|
418 |
value: function toString() { |
|
|
419 |
return '(' + this._x + ',' + this._y + ')'; |
|
|
420 |
} |
|
|
421 |
}, { |
|
|
422 |
key: 'x', |
|
|
423 |
get: function get() { |
|
|
424 |
return this._x; |
|
|
425 |
}, |
|
|
426 |
set: function set() { |
|
|
427 |
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; |
|
|
428 |
|
|
|
429 |
this._x = value; |
|
|
430 |
return this; |
|
|
431 |
} |
|
|
432 |
}, { |
|
|
433 |
key: 'y', |
|
|
434 |
get: function get() { |
|
|
435 |
return this._y; |
|
|
436 |
}, |
|
|
437 |
set: function set() { |
|
|
438 |
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; |
|
|
439 |
|
|
|
440 |
this._y = value; |
|
|
441 |
return this; |
|
|
442 |
} |
|
|
443 |
}]); |
|
|
444 |
|
|
|
445 |
return Coordinate; |
|
|
446 |
}(); |
|
|
447 |
|
|
|
448 |
/* harmony default export */ __webpack_exports__["a"] = (Coordinate); |
|
|
449 |
|
|
|
450 |
/***/ }), |
|
|
451 |
/* 5 */ |
|
|
452 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
453 |
|
|
|
454 |
"use strict"; |
|
|
455 |
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); |
|
|
456 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_index__ = __webpack_require__(6); |
|
|
457 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_css__ = __webpack_require__(0); |
|
|
458 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_type__ = __webpack_require__(2); |
|
|
459 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_eventEmitter__ = __webpack_require__(3); |
|
|
460 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_autoplay__ = __webpack_require__(7); |
|
|
461 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_breakpoint__ = __webpack_require__(9); |
|
|
462 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_infinite__ = __webpack_require__(10); |
|
|
463 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_loop__ = __webpack_require__(11); |
|
|
464 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_navigation__ = __webpack_require__(13); |
|
|
465 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_pagination__ = __webpack_require__(15); |
|
|
466 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_swipe__ = __webpack_require__(18); |
|
|
467 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__components_transitioner__ = __webpack_require__(19); |
|
|
468 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__defaultOptions__ = __webpack_require__(22); |
|
|
469 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__templates__ = __webpack_require__(23); |
|
|
470 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__templates_item__ = __webpack_require__(24); |
|
|
471 |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
|
|
472 |
|
|
|
473 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
474 |
|
|
|
475 |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
|
476 |
|
|
|
477 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
478 |
|
|
|
479 |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
|
|
480 |
|
|
|
481 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
|
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
var bulmaCarousel = function (_EventEmitter) { |
|
|
502 |
_inherits(bulmaCarousel, _EventEmitter); |
|
|
503 |
|
|
|
504 |
function bulmaCarousel(selector) { |
|
|
505 |
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
|
506 |
|
|
|
507 |
_classCallCheck(this, bulmaCarousel); |
|
|
508 |
|
|
|
509 |
var _this = _possibleConstructorReturn(this, (bulmaCarousel.__proto__ || Object.getPrototypeOf(bulmaCarousel)).call(this)); |
|
|
510 |
|
|
|
511 |
_this.element = Object(__WEBPACK_IMPORTED_MODULE_2__utils_type__["c" /* isString */])(selector) ? document.querySelector(selector) : selector; |
|
|
512 |
// An invalid selector or non-DOM node has been provided. |
|
|
513 |
if (!_this.element) { |
|
|
514 |
throw new Error('An invalid selector or non-DOM node has been provided.'); |
|
|
515 |
} |
|
|
516 |
_this._clickEvents = ['click', 'touch']; |
|
|
517 |
|
|
|
518 |
// Use Element dataset values to override options |
|
|
519 |
var elementConfig = _this.element.dataset ? Object.keys(_this.element.dataset).filter(function (key) { |
|
|
520 |
return Object.keys(__WEBPACK_IMPORTED_MODULE_12__defaultOptions__["a" /* default */]).includes(key); |
|
|
521 |
}).reduce(function (obj, key) { |
|
|
522 |
return _extends({}, obj, _defineProperty({}, key, _this.element.dataset[key])); |
|
|
523 |
}, {}) : {}; |
|
|
524 |
// Set default options - dataset attributes are master |
|
|
525 |
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_12__defaultOptions__["a" /* default */], options, elementConfig); |
|
|
526 |
|
|
|
527 |
_this._id = Object(__WEBPACK_IMPORTED_MODULE_0__utils_index__["a" /* uuid */])('slider'); |
|
|
528 |
|
|
|
529 |
_this.onShow = _this.onShow.bind(_this); |
|
|
530 |
|
|
|
531 |
// Initiate plugin |
|
|
532 |
_this._init(); |
|
|
533 |
return _this; |
|
|
534 |
} |
|
|
535 |
|
|
|
536 |
/** |
|
|
537 |
* Initiate all DOM element containing datePicker class |
|
|
538 |
* @method |
|
|
539 |
* @return {Array} Array of all datePicker instances |
|
|
540 |
*/ |
|
|
541 |
|
|
|
542 |
|
|
|
543 |
_createClass(bulmaCarousel, [{ |
|
|
544 |
key: '_init', |
|
|
545 |
|
|
|
546 |
|
|
|
547 |
/**************************************************** |
|
|
548 |
* * |
|
|
549 |
* PRIVATE FUNCTIONS * |
|
|
550 |
* * |
|
|
551 |
****************************************************/ |
|
|
552 |
/** |
|
|
553 |
* Initiate plugin instance |
|
|
554 |
* @method _init |
|
|
555 |
* @return {Slider} Current plugin instance |
|
|
556 |
*/ |
|
|
557 |
value: function _init() { |
|
|
558 |
this._items = Array.from(this.element.children); |
|
|
559 |
|
|
|
560 |
// Load plugins |
|
|
561 |
this._breakpoint = new __WEBPACK_IMPORTED_MODULE_5__components_breakpoint__["a" /* default */](this); |
|
|
562 |
this._autoplay = new __WEBPACK_IMPORTED_MODULE_4__components_autoplay__["a" /* default */](this); |
|
|
563 |
this._navigation = new __WEBPACK_IMPORTED_MODULE_8__components_navigation__["a" /* default */](this); |
|
|
564 |
this._pagination = new __WEBPACK_IMPORTED_MODULE_9__components_pagination__["a" /* default */](this); |
|
|
565 |
this._infinite = new __WEBPACK_IMPORTED_MODULE_6__components_infinite__["a" /* default */](this); |
|
|
566 |
this._loop = new __WEBPACK_IMPORTED_MODULE_7__components_loop__["a" /* default */](this); |
|
|
567 |
this._swipe = new __WEBPACK_IMPORTED_MODULE_10__components_swipe__["a" /* default */](this); |
|
|
568 |
|
|
|
569 |
this._build(); |
|
|
570 |
|
|
|
571 |
if (Object(__WEBPACK_IMPORTED_MODULE_2__utils_type__["a" /* isFunction */])(this.options.onReady)) { |
|
|
572 |
this.options.onReady(this); |
|
|
573 |
} |
|
|
574 |
|
|
|
575 |
return this; |
|
|
576 |
} |
|
|
577 |
|
|
|
578 |
/** |
|
|
579 |
* Build Slider HTML component and append it to the DOM |
|
|
580 |
* @method _build |
|
|
581 |
*/ |
|
|
582 |
|
|
|
583 |
}, { |
|
|
584 |
key: '_build', |
|
|
585 |
value: function _build() { |
|
|
586 |
var _this2 = this; |
|
|
587 |
|
|
|
588 |
// Generate HTML Fragment of template |
|
|
589 |
this.node = document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_13__templates__["a" /* default */])(this.id)); |
|
|
590 |
// Save pointers to template parts |
|
|
591 |
this._ui = { |
|
|
592 |
wrapper: this.node.firstChild, |
|
|
593 |
container: this.node.querySelector('.slider-container') |
|
|
594 |
|
|
|
595 |
// Add slider to DOM |
|
|
596 |
};this.element.appendChild(this.node); |
|
|
597 |
this._ui.wrapper.classList.add('is-loading'); |
|
|
598 |
this._ui.container.style.opacity = 0; |
|
|
599 |
|
|
|
600 |
this._transitioner = new __WEBPACK_IMPORTED_MODULE_11__components_transitioner__["a" /* default */](this); |
|
|
601 |
|
|
|
602 |
// Wrap all items by slide element |
|
|
603 |
this._slides = this._items.map(function (item, index) { |
|
|
604 |
return _this2._createSlide(item, index); |
|
|
605 |
}); |
|
|
606 |
|
|
|
607 |
this.reset(); |
|
|
608 |
|
|
|
609 |
this._bindEvents(); |
|
|
610 |
|
|
|
611 |
this._ui.container.style.opacity = 1; |
|
|
612 |
this._ui.wrapper.classList.remove('is-loading'); |
|
|
613 |
} |
|
|
614 |
|
|
|
615 |
/** |
|
|
616 |
* Bind all events |
|
|
617 |
* @method _bindEvents |
|
|
618 |
* @return {void} |
|
|
619 |
*/ |
|
|
620 |
|
|
|
621 |
}, { |
|
|
622 |
key: '_bindEvents', |
|
|
623 |
value: function _bindEvents() { |
|
|
624 |
this.on('show', this.onShow); |
|
|
625 |
} |
|
|
626 |
}, { |
|
|
627 |
key: '_unbindEvents', |
|
|
628 |
value: function _unbindEvents() { |
|
|
629 |
this.off('show', this.onShow); |
|
|
630 |
} |
|
|
631 |
}, { |
|
|
632 |
key: '_createSlide', |
|
|
633 |
value: function _createSlide(item, index) { |
|
|
634 |
var slide = document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_14__templates_item__["a" /* default */])()).firstChild; |
|
|
635 |
slide.dataset.sliderIndex = index; |
|
|
636 |
slide.appendChild(item); |
|
|
637 |
return slide; |
|
|
638 |
} |
|
|
639 |
|
|
|
640 |
/** |
|
|
641 |
* Calculate slider dimensions |
|
|
642 |
*/ |
|
|
643 |
|
|
|
644 |
}, { |
|
|
645 |
key: '_setDimensions', |
|
|
646 |
value: function _setDimensions() { |
|
|
647 |
var _this3 = this; |
|
|
648 |
|
|
|
649 |
if (!this.options.vertical) { |
|
|
650 |
if (this.options.centerMode) { |
|
|
651 |
this._ui.wrapper.style.padding = '0px ' + this.options.centerPadding; |
|
|
652 |
} |
|
|
653 |
} else { |
|
|
654 |
this._ui.wrapper.style.height = Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["c" /* outerHeight */])(this._slides[0]) * this.slidesToShow; |
|
|
655 |
if (this.options.centerMode) { |
|
|
656 |
this._ui.wrapper.style.padding = this.options.centerPadding + ' 0px'; |
|
|
657 |
} |
|
|
658 |
} |
|
|
659 |
|
|
|
660 |
this._wrapperWidth = Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["e" /* width */])(this._ui.wrapper); |
|
|
661 |
this._wrapperHeight = Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["c" /* outerHeight */])(this._ui.wrapper); |
|
|
662 |
|
|
|
663 |
if (!this.options.vertical) { |
|
|
664 |
this._slideWidth = Math.ceil(this._wrapperWidth / this.slidesToShow); |
|
|
665 |
this._containerWidth = Math.ceil(this._slideWidth * this._slides.length); |
|
|
666 |
this._ui.container.style.width = this._containerWidth + 'px'; |
|
|
667 |
} else { |
|
|
668 |
this._slideWidth = Math.ceil(this._wrapperWidth); |
|
|
669 |
this._containerHeight = Math.ceil(Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["c" /* outerHeight */])(this._slides[0]) * this._slides.length); |
|
|
670 |
this._ui.container.style.height = this._containerHeight + 'px'; |
|
|
671 |
} |
|
|
672 |
|
|
|
673 |
this._slides.forEach(function (slide) { |
|
|
674 |
slide.style.width = _this3._slideWidth + 'px'; |
|
|
675 |
}); |
|
|
676 |
} |
|
|
677 |
}, { |
|
|
678 |
key: '_setHeight', |
|
|
679 |
value: function _setHeight() { |
|
|
680 |
if (this.options.effect !== 'translate') { |
|
|
681 |
this._ui.container.style.height = Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["c" /* outerHeight */])(this._slides[this.state.index]) + 'px'; |
|
|
682 |
} |
|
|
683 |
} |
|
|
684 |
|
|
|
685 |
// Update slides classes |
|
|
686 |
|
|
|
687 |
}, { |
|
|
688 |
key: '_setClasses', |
|
|
689 |
value: function _setClasses() { |
|
|
690 |
var _this4 = this; |
|
|
691 |
|
|
|
692 |
this._slides.forEach(function (slide) { |
|
|
693 |
Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["d" /* removeClasses */])(slide, 'is-active is-current is-slide-previous is-slide-next'); |
|
|
694 |
if (Math.abs((_this4.state.index - 1) % _this4.state.length) === parseInt(slide.dataset.sliderIndex, 10)) { |
|
|
695 |
slide.classList.add('is-slide-previous'); |
|
|
696 |
} |
|
|
697 |
if (Math.abs(_this4.state.index % _this4.state.length) === parseInt(slide.dataset.sliderIndex, 10)) { |
|
|
698 |
slide.classList.add('is-current'); |
|
|
699 |
} |
|
|
700 |
if (Math.abs((_this4.state.index + 1) % _this4.state.length) === parseInt(slide.dataset.sliderIndex, 10)) { |
|
|
701 |
slide.classList.add('is-slide-next'); |
|
|
702 |
} |
|
|
703 |
}); |
|
|
704 |
} |
|
|
705 |
|
|
|
706 |
/**************************************************** |
|
|
707 |
* * |
|
|
708 |
* GETTERS and SETTERS * |
|
|
709 |
* * |
|
|
710 |
****************************************************/ |
|
|
711 |
|
|
|
712 |
/** |
|
|
713 |
* Get id of current datePicker |
|
|
714 |
*/ |
|
|
715 |
|
|
|
716 |
}, { |
|
|
717 |
key: 'onShow', |
|
|
718 |
|
|
|
719 |
|
|
|
720 |
/**************************************************** |
|
|
721 |
* * |
|
|
722 |
* EVENTS FUNCTIONS * |
|
|
723 |
* * |
|
|
724 |
****************************************************/ |
|
|
725 |
value: function onShow(e) { |
|
|
726 |
this._navigation.refresh(); |
|
|
727 |
this._pagination.refresh(); |
|
|
728 |
this._setClasses(); |
|
|
729 |
} |
|
|
730 |
|
|
|
731 |
/**************************************************** |
|
|
732 |
* * |
|
|
733 |
* PUBLIC FUNCTIONS * |
|
|
734 |
* * |
|
|
735 |
****************************************************/ |
|
|
736 |
|
|
|
737 |
}, { |
|
|
738 |
key: 'next', |
|
|
739 |
value: function next() { |
|
|
740 |
if (!this.options.loop && !this.options.infinite && this.state.index + this.slidesToScroll > this.state.length - this.slidesToShow && !this.options.centerMode) { |
|
|
741 |
this.state.next = this.state.index; |
|
|
742 |
} else { |
|
|
743 |
this.state.next = this.state.index + this.slidesToScroll; |
|
|
744 |
} |
|
|
745 |
this.show(); |
|
|
746 |
} |
|
|
747 |
}, { |
|
|
748 |
key: 'previous', |
|
|
749 |
value: function previous() { |
|
|
750 |
if (!this.options.loop && !this.options.infinite && this.state.index === 0) { |
|
|
751 |
this.state.next = this.state.index; |
|
|
752 |
} else { |
|
|
753 |
this.state.next = this.state.index - this.slidesToScroll; |
|
|
754 |
} |
|
|
755 |
this.show(); |
|
|
756 |
} |
|
|
757 |
}, { |
|
|
758 |
key: 'start', |
|
|
759 |
value: function start() { |
|
|
760 |
this._autoplay.start(); |
|
|
761 |
} |
|
|
762 |
}, { |
|
|
763 |
key: 'pause', |
|
|
764 |
value: function pause() { |
|
|
765 |
this._autoplay.pause(); |
|
|
766 |
} |
|
|
767 |
}, { |
|
|
768 |
key: 'stop', |
|
|
769 |
value: function stop() { |
|
|
770 |
this._autoplay.stop(); |
|
|
771 |
} |
|
|
772 |
}, { |
|
|
773 |
key: 'show', |
|
|
774 |
value: function show(index) { |
|
|
775 |
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
|
|
776 |
|
|
|
777 |
// If all slides are already visible then return |
|
|
778 |
if (!this.state.length || this.state.length <= this.slidesToShow) { |
|
|
779 |
return; |
|
|
780 |
} |
|
|
781 |
|
|
|
782 |
if (typeof index === 'Number') { |
|
|
783 |
this.state.next = index; |
|
|
784 |
} |
|
|
785 |
|
|
|
786 |
if (this.options.loop) { |
|
|
787 |
this._loop.apply(); |
|
|
788 |
} |
|
|
789 |
if (this.options.infinite) { |
|
|
790 |
this._infinite.apply(); |
|
|
791 |
} |
|
|
792 |
|
|
|
793 |
// If new slide is already the current one then return |
|
|
794 |
if (this.state.index === this.state.next) { |
|
|
795 |
return; |
|
|
796 |
} |
|
|
797 |
|
|
|
798 |
this.emit('before:show', this.state); |
|
|
799 |
this._transitioner.apply(force, this._setHeight.bind(this)); |
|
|
800 |
this.emit('after:show', this.state); |
|
|
801 |
|
|
|
802 |
this.emit('show', this); |
|
|
803 |
} |
|
|
804 |
}, { |
|
|
805 |
key: 'reset', |
|
|
806 |
value: function reset() { |
|
|
807 |
var _this5 = this; |
|
|
808 |
|
|
|
809 |
this.state = { |
|
|
810 |
length: this._items.length, |
|
|
811 |
index: Math.abs(this.options.initialSlide), |
|
|
812 |
next: Math.abs(this.options.initialSlide), |
|
|
813 |
prev: undefined |
|
|
814 |
}; |
|
|
815 |
|
|
|
816 |
// Fix options |
|
|
817 |
if (this.options.loop && this.options.infinite) { |
|
|
818 |
this.options.loop = false; |
|
|
819 |
} |
|
|
820 |
if (this.options.slidesToScroll > this.options.slidesToShow) { |
|
|
821 |
this.options.slidesToScroll = this.slidesToShow; |
|
|
822 |
} |
|
|
823 |
this._breakpoint.init(); |
|
|
824 |
|
|
|
825 |
if (this.state.index >= this.state.length && this.state.index !== 0) { |
|
|
826 |
this.state.index = this.state.index - this.slidesToScroll; |
|
|
827 |
} |
|
|
828 |
if (this.state.length <= this.slidesToShow) { |
|
|
829 |
this.state.index = 0; |
|
|
830 |
} |
|
|
831 |
|
|
|
832 |
this._ui.wrapper.appendChild(this._navigation.init().render()); |
|
|
833 |
this._ui.wrapper.appendChild(this._pagination.init().render()); |
|
|
834 |
|
|
|
835 |
if (this.options.navigationSwipe) { |
|
|
836 |
this._swipe.bindEvents(); |
|
|
837 |
} else { |
|
|
838 |
this._swipe._bindEvents(); |
|
|
839 |
} |
|
|
840 |
|
|
|
841 |
this._breakpoint.apply(); |
|
|
842 |
// Move all created slides into slider |
|
|
843 |
this._slides.forEach(function (slide) { |
|
|
844 |
return _this5._ui.container.appendChild(slide); |
|
|
845 |
}); |
|
|
846 |
this._transitioner.init().apply(true, this._setHeight.bind(this)); |
|
|
847 |
|
|
|
848 |
if (this.options.autoplay) { |
|
|
849 |
this._autoplay.init().start(); |
|
|
850 |
} |
|
|
851 |
} |
|
|
852 |
|
|
|
853 |
/** |
|
|
854 |
* Destroy Slider |
|
|
855 |
* @method destroy |
|
|
856 |
*/ |
|
|
857 |
|
|
|
858 |
}, { |
|
|
859 |
key: 'destroy', |
|
|
860 |
value: function destroy() { |
|
|
861 |
var _this6 = this; |
|
|
862 |
|
|
|
863 |
this._unbindEvents(); |
|
|
864 |
this._items.forEach(function (item) { |
|
|
865 |
_this6.element.appendChild(item); |
|
|
866 |
}); |
|
|
867 |
this.node.remove(); |
|
|
868 |
} |
|
|
869 |
}, { |
|
|
870 |
key: 'id', |
|
|
871 |
get: function get() { |
|
|
872 |
return this._id; |
|
|
873 |
} |
|
|
874 |
}, { |
|
|
875 |
key: 'index', |
|
|
876 |
set: function set(index) { |
|
|
877 |
this._index = index; |
|
|
878 |
}, |
|
|
879 |
get: function get() { |
|
|
880 |
return this._index; |
|
|
881 |
} |
|
|
882 |
}, { |
|
|
883 |
key: 'length', |
|
|
884 |
set: function set(length) { |
|
|
885 |
this._length = length; |
|
|
886 |
}, |
|
|
887 |
get: function get() { |
|
|
888 |
return this._length; |
|
|
889 |
} |
|
|
890 |
}, { |
|
|
891 |
key: 'slides', |
|
|
892 |
get: function get() { |
|
|
893 |
return this._slides; |
|
|
894 |
}, |
|
|
895 |
set: function set(slides) { |
|
|
896 |
this._slides = slides; |
|
|
897 |
} |
|
|
898 |
}, { |
|
|
899 |
key: 'slidesToScroll', |
|
|
900 |
get: function get() { |
|
|
901 |
return this.options.effect === 'translate' ? this._breakpoint.getSlidesToScroll() : 1; |
|
|
902 |
} |
|
|
903 |
}, { |
|
|
904 |
key: 'slidesToShow', |
|
|
905 |
get: function get() { |
|
|
906 |
return this.options.effect === 'translate' ? this._breakpoint.getSlidesToShow() : 1; |
|
|
907 |
} |
|
|
908 |
}, { |
|
|
909 |
key: 'direction', |
|
|
910 |
get: function get() { |
|
|
911 |
return this.element.dir.toLowerCase() === 'rtl' || this.element.style.direction === 'rtl' ? 'rtl' : 'ltr'; |
|
|
912 |
} |
|
|
913 |
}, { |
|
|
914 |
key: 'wrapper', |
|
|
915 |
get: function get() { |
|
|
916 |
return this._ui.wrapper; |
|
|
917 |
} |
|
|
918 |
}, { |
|
|
919 |
key: 'wrapperWidth', |
|
|
920 |
get: function get() { |
|
|
921 |
return this._wrapperWidth || 0; |
|
|
922 |
} |
|
|
923 |
}, { |
|
|
924 |
key: 'container', |
|
|
925 |
get: function get() { |
|
|
926 |
return this._ui.container; |
|
|
927 |
} |
|
|
928 |
}, { |
|
|
929 |
key: 'containerWidth', |
|
|
930 |
get: function get() { |
|
|
931 |
return this._containerWidth || 0; |
|
|
932 |
} |
|
|
933 |
}, { |
|
|
934 |
key: 'slideWidth', |
|
|
935 |
get: function get() { |
|
|
936 |
return this._slideWidth || 0; |
|
|
937 |
} |
|
|
938 |
}, { |
|
|
939 |
key: 'transitioner', |
|
|
940 |
get: function get() { |
|
|
941 |
return this._transitioner; |
|
|
942 |
} |
|
|
943 |
}], [{ |
|
|
944 |
key: 'attach', |
|
|
945 |
value: function attach() { |
|
|
946 |
var _this7 = this; |
|
|
947 |
|
|
|
948 |
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.slider'; |
|
|
949 |
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
|
950 |
|
|
|
951 |
var instances = new Array(); |
|
|
952 |
|
|
|
953 |
var elements = Object(__WEBPACK_IMPORTED_MODULE_2__utils_type__["c" /* isString */])(selector) ? document.querySelectorAll(selector) : Array.isArray(selector) ? selector : [selector]; |
|
|
954 |
[].forEach.call(elements, function (element) { |
|
|
955 |
if (typeof element[_this7.constructor.name] === 'undefined') { |
|
|
956 |
var instance = new bulmaCarousel(element, options); |
|
|
957 |
element[_this7.constructor.name] = instance; |
|
|
958 |
instances.push(instance); |
|
|
959 |
} else { |
|
|
960 |
instances.push(element[_this7.constructor.name]); |
|
|
961 |
} |
|
|
962 |
}); |
|
|
963 |
|
|
|
964 |
return instances; |
|
|
965 |
} |
|
|
966 |
}]); |
|
|
967 |
|
|
|
968 |
return bulmaCarousel; |
|
|
969 |
}(__WEBPACK_IMPORTED_MODULE_3__utils_eventEmitter__["a" /* default */]); |
|
|
970 |
|
|
|
971 |
/* harmony default export */ __webpack_exports__["default"] = (bulmaCarousel); |
|
|
972 |
|
|
|
973 |
/***/ }), |
|
|
974 |
/* 6 */ |
|
|
975 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
976 |
|
|
|
977 |
"use strict"; |
|
|
978 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return uuid; }); |
|
|
979 |
/* unused harmony export isRtl */ |
|
|
980 |
/* unused harmony export defer */ |
|
|
981 |
/* unused harmony export getNodeIndex */ |
|
|
982 |
/* unused harmony export camelize */ |
|
|
983 |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } |
|
|
984 |
|
|
|
985 |
var uuid = function uuid() { |
|
|
986 |
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; |
|
|
987 |
return prefix + ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) { |
|
|
988 |
return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16); |
|
|
989 |
}); |
|
|
990 |
}; |
|
|
991 |
var isRtl = function isRtl() { |
|
|
992 |
return document.documentElement.getAttribute('dir') === 'rtl'; |
|
|
993 |
}; |
|
|
994 |
|
|
|
995 |
var defer = function defer() { |
|
|
996 |
this.promise = new Promise(function (resolve, reject) { |
|
|
997 |
this.resolve = resolve; |
|
|
998 |
this.reject = reject; |
|
|
999 |
}.bind(this)); |
|
|
1000 |
|
|
|
1001 |
this.then = this.promise.then.bind(this.promise); |
|
|
1002 |
this.catch = this.promise.catch.bind(this.promise); |
|
|
1003 |
}; |
|
|
1004 |
|
|
|
1005 |
var getNodeIndex = function getNodeIndex(node) { |
|
|
1006 |
return [].concat(_toConsumableArray(node.parentNode.children)).indexOf(node); |
|
|
1007 |
}; |
|
|
1008 |
var camelize = function camelize(str) { |
|
|
1009 |
return str.replace(/-(\w)/g, toUpper); |
|
|
1010 |
}; |
|
|
1011 |
|
|
|
1012 |
/***/ }), |
|
|
1013 |
/* 7 */ |
|
|
1014 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1015 |
|
|
|
1016 |
"use strict"; |
|
|
1017 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_eventEmitter__ = __webpack_require__(3); |
|
|
1018 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_device__ = __webpack_require__(8); |
|
|
1019 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1020 |
|
|
|
1021 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1022 |
|
|
|
1023 |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
|
|
1024 |
|
|
|
1025 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
|
|
1026 |
|
|
|
1027 |
|
|
|
1028 |
|
|
|
1029 |
|
|
|
1030 |
var onVisibilityChange = Symbol('onVisibilityChange'); |
|
|
1031 |
var onMouseEnter = Symbol('onMouseEnter'); |
|
|
1032 |
var onMouseLeave = Symbol('onMouseLeave'); |
|
|
1033 |
|
|
|
1034 |
var defaultOptions = { |
|
|
1035 |
autoplay: false, |
|
|
1036 |
autoplaySpeed: 3000 |
|
|
1037 |
}; |
|
|
1038 |
|
|
|
1039 |
var Autoplay = function (_EventEmitter) { |
|
|
1040 |
_inherits(Autoplay, _EventEmitter); |
|
|
1041 |
|
|
|
1042 |
function Autoplay(slider) { |
|
|
1043 |
_classCallCheck(this, Autoplay); |
|
|
1044 |
|
|
|
1045 |
var _this = _possibleConstructorReturn(this, (Autoplay.__proto__ || Object.getPrototypeOf(Autoplay)).call(this)); |
|
|
1046 |
|
|
|
1047 |
_this.slider = slider; |
|
|
1048 |
|
|
|
1049 |
_this.onVisibilityChange = _this.onVisibilityChange.bind(_this); |
|
|
1050 |
_this.onMouseEnter = _this.onMouseEnter.bind(_this); |
|
|
1051 |
_this.onMouseLeave = _this.onMouseLeave.bind(_this); |
|
|
1052 |
return _this; |
|
|
1053 |
} |
|
|
1054 |
|
|
|
1055 |
_createClass(Autoplay, [{ |
|
|
1056 |
key: 'init', |
|
|
1057 |
value: function init() { |
|
|
1058 |
this._bindEvents(); |
|
|
1059 |
return this; |
|
|
1060 |
} |
|
|
1061 |
}, { |
|
|
1062 |
key: '_bindEvents', |
|
|
1063 |
value: function _bindEvents() { |
|
|
1064 |
document.addEventListener('visibilitychange', this.onVisibilityChange); |
|
|
1065 |
if (this.slider.options.pauseOnHover) { |
|
|
1066 |
this.slider.container.addEventListener(__WEBPACK_IMPORTED_MODULE_1__utils_device__["a" /* pointerEnter */], this.onMouseEnter); |
|
|
1067 |
this.slider.container.addEventListener(__WEBPACK_IMPORTED_MODULE_1__utils_device__["b" /* pointerLeave */], this.onMouseLeave); |
|
|
1068 |
} |
|
|
1069 |
} |
|
|
1070 |
}, { |
|
|
1071 |
key: '_unbindEvents', |
|
|
1072 |
value: function _unbindEvents() { |
|
|
1073 |
document.removeEventListener('visibilitychange', this.onVisibilityChange); |
|
|
1074 |
this.slider.container.removeEventListener(__WEBPACK_IMPORTED_MODULE_1__utils_device__["a" /* pointerEnter */], this.onMouseEnter); |
|
|
1075 |
this.slider.container.removeEventListener(__WEBPACK_IMPORTED_MODULE_1__utils_device__["b" /* pointerLeave */], this.onMouseLeave); |
|
|
1076 |
} |
|
|
1077 |
}, { |
|
|
1078 |
key: 'start', |
|
|
1079 |
value: function start() { |
|
|
1080 |
var _this2 = this; |
|
|
1081 |
|
|
|
1082 |
this.stop(); |
|
|
1083 |
if (this.slider.options.autoplay) { |
|
|
1084 |
this.emit('start', this); |
|
|
1085 |
this._interval = setInterval(function () { |
|
|
1086 |
if (!(_this2._hovering && _this2.slider.options.pauseOnHover)) { |
|
|
1087 |
if (!_this2.slider.options.centerMode && _this2.slider.state.next >= _this2.slider.state.length - _this2.slider.slidesToShow && !_this2.slider.options.loop && !_this2.slider.options.infinite) { |
|
|
1088 |
_this2.stop(); |
|
|
1089 |
} else { |
|
|
1090 |
_this2.slider.next(); |
|
|
1091 |
} |
|
|
1092 |
} |
|
|
1093 |
}, this.slider.options.autoplaySpeed); |
|
|
1094 |
} |
|
|
1095 |
} |
|
|
1096 |
}, { |
|
|
1097 |
key: 'stop', |
|
|
1098 |
value: function stop() { |
|
|
1099 |
this._interval = clearInterval(this._interval); |
|
|
1100 |
this.emit('stop', this); |
|
|
1101 |
} |
|
|
1102 |
}, { |
|
|
1103 |
key: 'pause', |
|
|
1104 |
value: function pause() { |
|
|
1105 |
var _this3 = this; |
|
|
1106 |
|
|
|
1107 |
var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; |
|
|
1108 |
|
|
|
1109 |
if (this.paused) { |
|
|
1110 |
return; |
|
|
1111 |
} |
|
|
1112 |
if (this.timer) { |
|
|
1113 |
this.stop(); |
|
|
1114 |
} |
|
|
1115 |
this.paused = true; |
|
|
1116 |
if (speed === 0) { |
|
|
1117 |
this.paused = false; |
|
|
1118 |
this.start(); |
|
|
1119 |
} else { |
|
|
1120 |
this.slider.on('transition:end', function () { |
|
|
1121 |
if (!_this3) { |
|
|
1122 |
return; |
|
|
1123 |
} |
|
|
1124 |
_this3.paused = false; |
|
|
1125 |
if (!_this3.run) { |
|
|
1126 |
_this3.stop(); |
|
|
1127 |
} else { |
|
|
1128 |
_this3.start(); |
|
|
1129 |
} |
|
|
1130 |
}); |
|
|
1131 |
} |
|
|
1132 |
} |
|
|
1133 |
}, { |
|
|
1134 |
key: 'onVisibilityChange', |
|
|
1135 |
value: function onVisibilityChange(e) { |
|
|
1136 |
if (document.hidden) { |
|
|
1137 |
this.stop(); |
|
|
1138 |
} else { |
|
|
1139 |
this.start(); |
|
|
1140 |
} |
|
|
1141 |
} |
|
|
1142 |
}, { |
|
|
1143 |
key: 'onMouseEnter', |
|
|
1144 |
value: function onMouseEnter(e) { |
|
|
1145 |
this._hovering = true; |
|
|
1146 |
if (this.slider.options.pauseOnHover) { |
|
|
1147 |
this.pause(); |
|
|
1148 |
} |
|
|
1149 |
} |
|
|
1150 |
}, { |
|
|
1151 |
key: 'onMouseLeave', |
|
|
1152 |
value: function onMouseLeave(e) { |
|
|
1153 |
this._hovering = false; |
|
|
1154 |
if (this.slider.options.pauseOnHover) { |
|
|
1155 |
this.pause(); |
|
|
1156 |
} |
|
|
1157 |
} |
|
|
1158 |
}]); |
|
|
1159 |
|
|
|
1160 |
return Autoplay; |
|
|
1161 |
}(__WEBPACK_IMPORTED_MODULE_0__utils_eventEmitter__["a" /* default */]); |
|
|
1162 |
|
|
|
1163 |
/* harmony default export */ __webpack_exports__["a"] = (Autoplay); |
|
|
1164 |
|
|
|
1165 |
/***/ }), |
|
|
1166 |
/* 8 */ |
|
|
1167 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1168 |
|
|
|
1169 |
"use strict"; |
|
|
1170 |
/* unused harmony export isIE */ |
|
|
1171 |
/* unused harmony export isIETouch */ |
|
|
1172 |
/* unused harmony export isAndroid */ |
|
|
1173 |
/* unused harmony export isiPad */ |
|
|
1174 |
/* unused harmony export isiPod */ |
|
|
1175 |
/* unused harmony export isiPhone */ |
|
|
1176 |
/* unused harmony export isSafari */ |
|
|
1177 |
/* unused harmony export isUiWebView */ |
|
|
1178 |
/* unused harmony export supportsTouchEvents */ |
|
|
1179 |
/* unused harmony export supportsPointerEvents */ |
|
|
1180 |
/* unused harmony export supportsTouch */ |
|
|
1181 |
/* unused harmony export pointerDown */ |
|
|
1182 |
/* unused harmony export pointerMove */ |
|
|
1183 |
/* unused harmony export pointerUp */ |
|
|
1184 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return pointerEnter; }); |
|
|
1185 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return pointerLeave; }); |
|
|
1186 |
var isIE = window.navigator.pointerEnabled || window.navigator.msPointerEnabled; |
|
|
1187 |
var isIETouch = window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1 || window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1; |
|
|
1188 |
var isAndroid = navigator.userAgent.match(/(Android);?[\s\/]+([\d.]+)?/); |
|
|
1189 |
var isiPad = navigator.userAgent.match(/(iPad).*OS\s([\d_]+)/); |
|
|
1190 |
var isiPod = navigator.userAgent.match(/(iPod)(.*OS\s([\d_]+))?/); |
|
|
1191 |
var isiPhone = !navigator.userAgent.match(/(iPad).*OS\s([\d_]+)/) && navigator.userAgent.match(/(iPhone\sOS)\s([\d_]+)/); |
|
|
1192 |
var isSafari = navigator.userAgent.toLowerCase().indexOf('safari') >= 0 && navigator.userAgent.toLowerCase().indexOf('chrome') < 0 && navigator.userAgent.toLowerCase().indexOf('android') < 0; |
|
|
1193 |
var isUiWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent); |
|
|
1194 |
|
|
|
1195 |
var supportsTouchEvents = !!('ontouchstart' in window); |
|
|
1196 |
var supportsPointerEvents = !!('PointerEvent' in window); |
|
|
1197 |
var supportsTouch = supportsTouchEvents || window.DocumentTouch && document instanceof DocumentTouch || navigator.maxTouchPoints; // IE >=11 |
|
|
1198 |
var pointerDown = !supportsTouch ? 'mousedown' : 'mousedown ' + (supportsTouchEvents ? 'touchstart' : 'pointerdown'); |
|
|
1199 |
var pointerMove = !supportsTouch ? 'mousemove' : 'mousemove ' + (supportsTouchEvents ? 'touchmove' : 'pointermove'); |
|
|
1200 |
var pointerUp = !supportsTouch ? 'mouseup' : 'mouseup ' + (supportsTouchEvents ? 'touchend' : 'pointerup'); |
|
|
1201 |
var pointerEnter = supportsTouch && supportsPointerEvents ? 'pointerenter' : 'mouseenter'; |
|
|
1202 |
var pointerLeave = supportsTouch && supportsPointerEvents ? 'pointerleave' : 'mouseleave'; |
|
|
1203 |
|
|
|
1204 |
/***/ }), |
|
|
1205 |
/* 9 */ |
|
|
1206 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1207 |
|
|
|
1208 |
"use strict"; |
|
|
1209 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1210 |
|
|
|
1211 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1212 |
|
|
|
1213 |
var onResize = Symbol('onResize'); |
|
|
1214 |
|
|
|
1215 |
var Breakpoints = function () { |
|
|
1216 |
function Breakpoints(slider) { |
|
|
1217 |
_classCallCheck(this, Breakpoints); |
|
|
1218 |
|
|
|
1219 |
this.slider = slider; |
|
|
1220 |
this.options = slider.options; |
|
|
1221 |
|
|
|
1222 |
this[onResize] = this[onResize].bind(this); |
|
|
1223 |
|
|
|
1224 |
this._bindEvents(); |
|
|
1225 |
} |
|
|
1226 |
|
|
|
1227 |
_createClass(Breakpoints, [{ |
|
|
1228 |
key: 'init', |
|
|
1229 |
value: function init() { |
|
|
1230 |
this._defaultBreakpoint = { |
|
|
1231 |
slidesToShow: this.options.slidesToShow, |
|
|
1232 |
slidesToScroll: this.options.slidesToScroll |
|
|
1233 |
}; |
|
|
1234 |
this.options.breakpoints.sort(function (a, b) { |
|
|
1235 |
return parseInt(a.changePoint, 10) > parseInt(b.changePoint, 10); |
|
|
1236 |
}); |
|
|
1237 |
this._currentBreakpoint = this._getActiveBreakpoint(); |
|
|
1238 |
|
|
|
1239 |
return this; |
|
|
1240 |
} |
|
|
1241 |
}, { |
|
|
1242 |
key: 'destroy', |
|
|
1243 |
value: function destroy() { |
|
|
1244 |
this._unbindEvents(); |
|
|
1245 |
} |
|
|
1246 |
}, { |
|
|
1247 |
key: '_bindEvents', |
|
|
1248 |
value: function _bindEvents() { |
|
|
1249 |
window.addEventListener('resize', this[onResize]); |
|
|
1250 |
window.addEventListener('orientationchange', this[onResize]); |
|
|
1251 |
} |
|
|
1252 |
}, { |
|
|
1253 |
key: '_unbindEvents', |
|
|
1254 |
value: function _unbindEvents() { |
|
|
1255 |
window.removeEventListener('resize', this[onResize]); |
|
|
1256 |
window.removeEventListener('orientationchange', this[onResize]); |
|
|
1257 |
} |
|
|
1258 |
}, { |
|
|
1259 |
key: '_getActiveBreakpoint', |
|
|
1260 |
value: function _getActiveBreakpoint() { |
|
|
1261 |
//Get breakpoint for window width |
|
|
1262 |
var _iteratorNormalCompletion = true; |
|
|
1263 |
var _didIteratorError = false; |
|
|
1264 |
var _iteratorError = undefined; |
|
|
1265 |
|
|
|
1266 |
try { |
|
|
1267 |
for (var _iterator = this.options.breakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { |
|
|
1268 |
var point = _step.value; |
|
|
1269 |
|
|
|
1270 |
if (point.changePoint >= window.innerWidth) { |
|
|
1271 |
return point; |
|
|
1272 |
} |
|
|
1273 |
} |
|
|
1274 |
} catch (err) { |
|
|
1275 |
_didIteratorError = true; |
|
|
1276 |
_iteratorError = err; |
|
|
1277 |
} finally { |
|
|
1278 |
try { |
|
|
1279 |
if (!_iteratorNormalCompletion && _iterator.return) { |
|
|
1280 |
_iterator.return(); |
|
|
1281 |
} |
|
|
1282 |
} finally { |
|
|
1283 |
if (_didIteratorError) { |
|
|
1284 |
throw _iteratorError; |
|
|
1285 |
} |
|
|
1286 |
} |
|
|
1287 |
} |
|
|
1288 |
|
|
|
1289 |
return this._defaultBreakpoint; |
|
|
1290 |
} |
|
|
1291 |
}, { |
|
|
1292 |
key: 'getSlidesToShow', |
|
|
1293 |
value: function getSlidesToShow() { |
|
|
1294 |
return this._currentBreakpoint ? this._currentBreakpoint.slidesToShow : this._defaultBreakpoint.slidesToShow; |
|
|
1295 |
} |
|
|
1296 |
}, { |
|
|
1297 |
key: 'getSlidesToScroll', |
|
|
1298 |
value: function getSlidesToScroll() { |
|
|
1299 |
return this._currentBreakpoint ? this._currentBreakpoint.slidesToScroll : this._defaultBreakpoint.slidesToScroll; |
|
|
1300 |
} |
|
|
1301 |
}, { |
|
|
1302 |
key: 'apply', |
|
|
1303 |
value: function apply() { |
|
|
1304 |
if (this.slider.state.index >= this.slider.state.length && this.slider.state.index !== 0) { |
|
|
1305 |
this.slider.state.index = this.slider.state.index - this._currentBreakpoint.slidesToScroll; |
|
|
1306 |
} |
|
|
1307 |
if (this.slider.state.length <= this._currentBreakpoint.slidesToShow) { |
|
|
1308 |
this.slider.state.index = 0; |
|
|
1309 |
} |
|
|
1310 |
|
|
|
1311 |
if (this.options.loop) { |
|
|
1312 |
this.slider._loop.init().apply(); |
|
|
1313 |
} |
|
|
1314 |
|
|
|
1315 |
if (this.options.infinite) { |
|
|
1316 |
this.slider._infinite.init().apply(); |
|
|
1317 |
} |
|
|
1318 |
|
|
|
1319 |
this.slider._setDimensions(); |
|
|
1320 |
this.slider._transitioner.init().apply(true, this.slider._setHeight.bind(this.slider)); |
|
|
1321 |
this.slider._setClasses(); |
|
|
1322 |
|
|
|
1323 |
this.slider._navigation.refresh(); |
|
|
1324 |
this.slider._pagination.refresh(); |
|
|
1325 |
} |
|
|
1326 |
}, { |
|
|
1327 |
key: onResize, |
|
|
1328 |
value: function value(e) { |
|
|
1329 |
var newBreakPoint = this._getActiveBreakpoint(); |
|
|
1330 |
if (newBreakPoint.slidesToShow !== this._currentBreakpoint.slidesToShow) { |
|
|
1331 |
this._currentBreakpoint = newBreakPoint; |
|
|
1332 |
this.apply(); |
|
|
1333 |
} |
|
|
1334 |
} |
|
|
1335 |
}]); |
|
|
1336 |
|
|
|
1337 |
return Breakpoints; |
|
|
1338 |
}(); |
|
|
1339 |
|
|
|
1340 |
/* harmony default export */ __webpack_exports__["a"] = (Breakpoints); |
|
|
1341 |
|
|
|
1342 |
/***/ }), |
|
|
1343 |
/* 10 */ |
|
|
1344 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1345 |
|
|
|
1346 |
"use strict"; |
|
|
1347 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1348 |
|
|
|
1349 |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } |
|
|
1350 |
|
|
|
1351 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1352 |
|
|
|
1353 |
var Infinite = function () { |
|
|
1354 |
function Infinite(slider) { |
|
|
1355 |
_classCallCheck(this, Infinite); |
|
|
1356 |
|
|
|
1357 |
this.slider = slider; |
|
|
1358 |
} |
|
|
1359 |
|
|
|
1360 |
_createClass(Infinite, [{ |
|
|
1361 |
key: 'init', |
|
|
1362 |
value: function init() { |
|
|
1363 |
if (this.slider.options.infinite && this.slider.options.effect === 'translate') { |
|
|
1364 |
if (this.slider.options.centerMode) { |
|
|
1365 |
this._infiniteCount = Math.ceil(this.slider.slidesToShow + this.slider.slidesToShow / 2); |
|
|
1366 |
} else { |
|
|
1367 |
this._infiniteCount = this.slider.slidesToShow; |
|
|
1368 |
} |
|
|
1369 |
|
|
|
1370 |
var frontClones = []; |
|
|
1371 |
var slideIndex = 0; |
|
|
1372 |
for (var i = this.slider.state.length; i > this.slider.state.length - 1 - this._infiniteCount; i -= 1) { |
|
|
1373 |
slideIndex = i - 1; |
|
|
1374 |
frontClones.unshift(this._cloneSlide(this.slider.slides[slideIndex], slideIndex - this.slider.state.length)); |
|
|
1375 |
} |
|
|
1376 |
|
|
|
1377 |
var backClones = []; |
|
|
1378 |
for (var _i = 0; _i < this._infiniteCount + this.slider.state.length; _i += 1) { |
|
|
1379 |
backClones.push(this._cloneSlide(this.slider.slides[_i % this.slider.state.length], _i + this.slider.state.length)); |
|
|
1380 |
} |
|
|
1381 |
|
|
|
1382 |
this.slider.slides = [].concat(frontClones, _toConsumableArray(this.slider.slides), backClones); |
|
|
1383 |
} |
|
|
1384 |
return this; |
|
|
1385 |
} |
|
|
1386 |
}, { |
|
|
1387 |
key: 'apply', |
|
|
1388 |
value: function apply() {} |
|
|
1389 |
}, { |
|
|
1390 |
key: 'onTransitionEnd', |
|
|
1391 |
value: function onTransitionEnd(e) { |
|
|
1392 |
if (this.slider.options.infinite) { |
|
|
1393 |
if (this.slider.state.next >= this.slider.state.length) { |
|
|
1394 |
this.slider.state.index = this.slider.state.next = this.slider.state.next - this.slider.state.length; |
|
|
1395 |
this.slider.transitioner.apply(true); |
|
|
1396 |
} else if (this.slider.state.next < 0) { |
|
|
1397 |
this.slider.state.index = this.slider.state.next = this.slider.state.length + this.slider.state.next; |
|
|
1398 |
this.slider.transitioner.apply(true); |
|
|
1399 |
} |
|
|
1400 |
} |
|
|
1401 |
} |
|
|
1402 |
}, { |
|
|
1403 |
key: '_cloneSlide', |
|
|
1404 |
value: function _cloneSlide(slide, index) { |
|
|
1405 |
var newSlide = slide.cloneNode(true); |
|
|
1406 |
newSlide.dataset.sliderIndex = index; |
|
|
1407 |
newSlide.dataset.cloned = true; |
|
|
1408 |
var ids = newSlide.querySelectorAll('[id]') || []; |
|
|
1409 |
ids.forEach(function (id) { |
|
|
1410 |
id.setAttribute('id', ''); |
|
|
1411 |
}); |
|
|
1412 |
return newSlide; |
|
|
1413 |
} |
|
|
1414 |
}]); |
|
|
1415 |
|
|
|
1416 |
return Infinite; |
|
|
1417 |
}(); |
|
|
1418 |
|
|
|
1419 |
/* harmony default export */ __webpack_exports__["a"] = (Infinite); |
|
|
1420 |
|
|
|
1421 |
/***/ }), |
|
|
1422 |
/* 11 */ |
|
|
1423 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1424 |
|
|
|
1425 |
"use strict"; |
|
|
1426 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_dom__ = __webpack_require__(12); |
|
|
1427 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1428 |
|
|
|
1429 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1430 |
|
|
|
1431 |
|
|
|
1432 |
|
|
|
1433 |
var Loop = function () { |
|
|
1434 |
function Loop(slider) { |
|
|
1435 |
_classCallCheck(this, Loop); |
|
|
1436 |
|
|
|
1437 |
this.slider = slider; |
|
|
1438 |
} |
|
|
1439 |
|
|
|
1440 |
_createClass(Loop, [{ |
|
|
1441 |
key: "init", |
|
|
1442 |
value: function init() { |
|
|
1443 |
return this; |
|
|
1444 |
} |
|
|
1445 |
}, { |
|
|
1446 |
key: "apply", |
|
|
1447 |
value: function apply() { |
|
|
1448 |
if (this.slider.options.loop) { |
|
|
1449 |
if (this.slider.state.next > 0) { |
|
|
1450 |
if (this.slider.state.next < this.slider.state.length) { |
|
|
1451 |
if (this.slider.state.next > this.slider.state.length - this.slider.slidesToShow && Object(__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* isInViewport */])(this.slider._slides[this.slider.state.length - 1], this.slider.wrapper)) { |
|
|
1452 |
this.slider.state.next = 0; |
|
|
1453 |
} else { |
|
|
1454 |
this.slider.state.next = Math.min(Math.max(this.slider.state.next, 0), this.slider.state.length - this.slider.slidesToShow); |
|
|
1455 |
} |
|
|
1456 |
} else { |
|
|
1457 |
this.slider.state.next = 0; |
|
|
1458 |
} |
|
|
1459 |
} else { |
|
|
1460 |
if (this.slider.state.next <= 0 - this.slider.slidesToScroll) { |
|
|
1461 |
this.slider.state.next = this.slider.state.length - this.slider.slidesToShow; |
|
|
1462 |
} else { |
|
|
1463 |
this.slider.state.next = 0; |
|
|
1464 |
} |
|
|
1465 |
} |
|
|
1466 |
} |
|
|
1467 |
} |
|
|
1468 |
}]); |
|
|
1469 |
|
|
|
1470 |
return Loop; |
|
|
1471 |
}(); |
|
|
1472 |
|
|
|
1473 |
/* harmony default export */ __webpack_exports__["a"] = (Loop); |
|
|
1474 |
|
|
|
1475 |
/***/ }), |
|
|
1476 |
/* 12 */ |
|
|
1477 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1478 |
|
|
|
1479 |
"use strict"; |
|
|
1480 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isInViewport; }); |
|
|
1481 |
var isInViewport = function isInViewport(element, html) { |
|
|
1482 |
var rect = element.getBoundingClientRect(); |
|
|
1483 |
html = html || document.documentElement; |
|
|
1484 |
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || html.clientHeight) && rect.right <= (window.innerWidth || html.clientWidth); |
|
|
1485 |
}; |
|
|
1486 |
|
|
|
1487 |
/***/ }), |
|
|
1488 |
/* 13 */ |
|
|
1489 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1490 |
|
|
|
1491 |
"use strict"; |
|
|
1492 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__templates_navigation__ = __webpack_require__(14); |
|
|
1493 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_detect_supportsPassive__ = __webpack_require__(1); |
|
|
1494 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1495 |
|
|
|
1496 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1497 |
|
|
|
1498 |
|
|
|
1499 |
|
|
|
1500 |
|
|
|
1501 |
var Navigation = function () { |
|
|
1502 |
function Navigation(slider) { |
|
|
1503 |
_classCallCheck(this, Navigation); |
|
|
1504 |
|
|
|
1505 |
this.slider = slider; |
|
|
1506 |
|
|
|
1507 |
this._clickEvents = ['click', 'touch']; |
|
|
1508 |
this._supportsPassive = Object(__WEBPACK_IMPORTED_MODULE_1__utils_detect_supportsPassive__["a" /* default */])(); |
|
|
1509 |
|
|
|
1510 |
this.onPreviousClick = this.onPreviousClick.bind(this); |
|
|
1511 |
this.onNextClick = this.onNextClick.bind(this); |
|
|
1512 |
this.onKeyUp = this.onKeyUp.bind(this); |
|
|
1513 |
} |
|
|
1514 |
|
|
|
1515 |
_createClass(Navigation, [{ |
|
|
1516 |
key: 'init', |
|
|
1517 |
value: function init() { |
|
|
1518 |
this.node = document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_0__templates_navigation__["a" /* default */])(this.slider.options.icons)); |
|
|
1519 |
this._ui = { |
|
|
1520 |
previous: this.node.querySelector('.slider-navigation-previous'), |
|
|
1521 |
next: this.node.querySelector('.slider-navigation-next') |
|
|
1522 |
}; |
|
|
1523 |
|
|
|
1524 |
this._unbindEvents(); |
|
|
1525 |
this._bindEvents(); |
|
|
1526 |
|
|
|
1527 |
this.refresh(); |
|
|
1528 |
|
|
|
1529 |
return this; |
|
|
1530 |
} |
|
|
1531 |
}, { |
|
|
1532 |
key: 'destroy', |
|
|
1533 |
value: function destroy() { |
|
|
1534 |
this._unbindEvents(); |
|
|
1535 |
} |
|
|
1536 |
}, { |
|
|
1537 |
key: '_bindEvents', |
|
|
1538 |
value: function _bindEvents() { |
|
|
1539 |
var _this = this; |
|
|
1540 |
|
|
|
1541 |
this.slider.wrapper.addEventListener('keyup', this.onKeyUp); |
|
|
1542 |
this._clickEvents.forEach(function (clickEvent) { |
|
|
1543 |
_this._ui.previous.addEventListener(clickEvent, _this.onPreviousClick); |
|
|
1544 |
_this._ui.next.addEventListener(clickEvent, _this.onNextClick); |
|
|
1545 |
}); |
|
|
1546 |
} |
|
|
1547 |
}, { |
|
|
1548 |
key: '_unbindEvents', |
|
|
1549 |
value: function _unbindEvents() { |
|
|
1550 |
var _this2 = this; |
|
|
1551 |
|
|
|
1552 |
this.slider.wrapper.removeEventListener('keyup', this.onKeyUp); |
|
|
1553 |
this._clickEvents.forEach(function (clickEvent) { |
|
|
1554 |
_this2._ui.previous.removeEventListener(clickEvent, _this2.onPreviousClick); |
|
|
1555 |
_this2._ui.next.removeEventListener(clickEvent, _this2.onNextClick); |
|
|
1556 |
}); |
|
|
1557 |
} |
|
|
1558 |
}, { |
|
|
1559 |
key: 'onNextClick', |
|
|
1560 |
value: function onNextClick(e) { |
|
|
1561 |
if (!this._supportsPassive) { |
|
|
1562 |
e.preventDefault(); |
|
|
1563 |
} |
|
|
1564 |
|
|
|
1565 |
if (this.slider.options.navigation) { |
|
|
1566 |
this.slider.next(); |
|
|
1567 |
} |
|
|
1568 |
} |
|
|
1569 |
}, { |
|
|
1570 |
key: 'onPreviousClick', |
|
|
1571 |
value: function onPreviousClick(e) { |
|
|
1572 |
if (!this._supportsPassive) { |
|
|
1573 |
e.preventDefault(); |
|
|
1574 |
} |
|
|
1575 |
|
|
|
1576 |
if (this.slider.options.navigation) { |
|
|
1577 |
this.slider.previous(); |
|
|
1578 |
} |
|
|
1579 |
} |
|
|
1580 |
}, { |
|
|
1581 |
key: 'onKeyUp', |
|
|
1582 |
value: function onKeyUp(e) { |
|
|
1583 |
if (this.slider.options.keyNavigation) { |
|
|
1584 |
if (e.key === 'ArrowRight' || e.key === 'Right') { |
|
|
1585 |
this.slider.next(); |
|
|
1586 |
} else if (e.key === 'ArrowLeft' || e.key === 'Left') { |
|
|
1587 |
this.slider.previous(); |
|
|
1588 |
} |
|
|
1589 |
} |
|
|
1590 |
} |
|
|
1591 |
}, { |
|
|
1592 |
key: 'refresh', |
|
|
1593 |
value: function refresh() { |
|
|
1594 |
// let centerOffset = Math.floor(this.options.slidesToShow / 2); |
|
|
1595 |
if (!this.slider.options.loop && !this.slider.options.infinite) { |
|
|
1596 |
if (this.slider.options.navigation && this.slider.state.length > this.slider.slidesToShow) { |
|
|
1597 |
this._ui.previous.classList.remove('is-hidden'); |
|
|
1598 |
this._ui.next.classList.remove('is-hidden'); |
|
|
1599 |
if (this.slider.state.next === 0) { |
|
|
1600 |
this._ui.previous.classList.add('is-hidden'); |
|
|
1601 |
this._ui.next.classList.remove('is-hidden'); |
|
|
1602 |
} else if (this.slider.state.next >= this.slider.state.length - this.slider.slidesToShow && !this.slider.options.centerMode) { |
|
|
1603 |
this._ui.previous.classList.remove('is-hidden'); |
|
|
1604 |
this._ui.next.classList.add('is-hidden'); |
|
|
1605 |
} else if (this.slider.state.next >= this.slider.state.length - 1 && this.slider.options.centerMode) { |
|
|
1606 |
this._ui.previous.classList.remove('is-hidden'); |
|
|
1607 |
this._ui.next.classList.add('is-hidden'); |
|
|
1608 |
} |
|
|
1609 |
} else { |
|
|
1610 |
this._ui.previous.classList.add('is-hidden'); |
|
|
1611 |
this._ui.next.classList.add('is-hidden'); |
|
|
1612 |
} |
|
|
1613 |
} |
|
|
1614 |
} |
|
|
1615 |
}, { |
|
|
1616 |
key: 'render', |
|
|
1617 |
value: function render() { |
|
|
1618 |
return this.node; |
|
|
1619 |
} |
|
|
1620 |
}]); |
|
|
1621 |
|
|
|
1622 |
return Navigation; |
|
|
1623 |
}(); |
|
|
1624 |
|
|
|
1625 |
/* harmony default export */ __webpack_exports__["a"] = (Navigation); |
|
|
1626 |
|
|
|
1627 |
/***/ }), |
|
|
1628 |
/* 14 */ |
|
|
1629 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1630 |
|
|
|
1631 |
"use strict"; |
|
|
1632 |
/* harmony default export */ __webpack_exports__["a"] = (function (icons) { |
|
|
1633 |
return "<div class=\"slider-navigation-previous\">" + icons.previous + "</div>\n<div class=\"slider-navigation-next\">" + icons.next + "</div>"; |
|
|
1634 |
}); |
|
|
1635 |
|
|
|
1636 |
/***/ }), |
|
|
1637 |
/* 15 */ |
|
|
1638 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1639 |
|
|
|
1640 |
"use strict"; |
|
|
1641 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__templates_pagination__ = __webpack_require__(16); |
|
|
1642 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__templates_pagination_page__ = __webpack_require__(17); |
|
|
1643 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_detect_supportsPassive__ = __webpack_require__(1); |
|
|
1644 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1645 |
|
|
|
1646 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1647 |
|
|
|
1648 |
|
|
|
1649 |
|
|
|
1650 |
|
|
|
1651 |
|
|
|
1652 |
var Pagination = function () { |
|
|
1653 |
function Pagination(slider) { |
|
|
1654 |
_classCallCheck(this, Pagination); |
|
|
1655 |
|
|
|
1656 |
this.slider = slider; |
|
|
1657 |
|
|
|
1658 |
this._clickEvents = ['click', 'touch']; |
|
|
1659 |
this._supportsPassive = Object(__WEBPACK_IMPORTED_MODULE_2__utils_detect_supportsPassive__["a" /* default */])(); |
|
|
1660 |
|
|
|
1661 |
this.onPageClick = this.onPageClick.bind(this); |
|
|
1662 |
this.onResize = this.onResize.bind(this); |
|
|
1663 |
} |
|
|
1664 |
|
|
|
1665 |
_createClass(Pagination, [{ |
|
|
1666 |
key: 'init', |
|
|
1667 |
value: function init() { |
|
|
1668 |
this._pages = []; |
|
|
1669 |
this.node = document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_0__templates_pagination__["a" /* default */])()); |
|
|
1670 |
this._ui = { |
|
|
1671 |
container: this.node.firstChild |
|
|
1672 |
}; |
|
|
1673 |
|
|
|
1674 |
this._count = Math.ceil((this.slider.state.length - this.slider.slidesToShow) / this.slider.slidesToScroll); |
|
|
1675 |
|
|
|
1676 |
this._draw(); |
|
|
1677 |
this.refresh(); |
|
|
1678 |
|
|
|
1679 |
return this; |
|
|
1680 |
} |
|
|
1681 |
}, { |
|
|
1682 |
key: 'destroy', |
|
|
1683 |
value: function destroy() { |
|
|
1684 |
this._unbindEvents(); |
|
|
1685 |
} |
|
|
1686 |
}, { |
|
|
1687 |
key: '_bindEvents', |
|
|
1688 |
value: function _bindEvents() { |
|
|
1689 |
var _this = this; |
|
|
1690 |
|
|
|
1691 |
window.addEventListener('resize', this.onResize); |
|
|
1692 |
window.addEventListener('orientationchange', this.onResize); |
|
|
1693 |
|
|
|
1694 |
this._clickEvents.forEach(function (clickEvent) { |
|
|
1695 |
_this._pages.forEach(function (page) { |
|
|
1696 |
return page.addEventListener(clickEvent, _this.onPageClick); |
|
|
1697 |
}); |
|
|
1698 |
}); |
|
|
1699 |
} |
|
|
1700 |
}, { |
|
|
1701 |
key: '_unbindEvents', |
|
|
1702 |
value: function _unbindEvents() { |
|
|
1703 |
var _this2 = this; |
|
|
1704 |
|
|
|
1705 |
window.removeEventListener('resize', this.onResize); |
|
|
1706 |
window.removeEventListener('orientationchange', this.onResize); |
|
|
1707 |
|
|
|
1708 |
this._clickEvents.forEach(function (clickEvent) { |
|
|
1709 |
_this2._pages.forEach(function (page) { |
|
|
1710 |
return page.removeEventListener(clickEvent, _this2.onPageClick); |
|
|
1711 |
}); |
|
|
1712 |
}); |
|
|
1713 |
} |
|
|
1714 |
}, { |
|
|
1715 |
key: '_draw', |
|
|
1716 |
value: function _draw() { |
|
|
1717 |
this._ui.container.innerHTML = ''; |
|
|
1718 |
if (this.slider.options.pagination && this.slider.state.length > this.slider.slidesToShow) { |
|
|
1719 |
for (var i = 0; i <= this._count; i++) { |
|
|
1720 |
var newPageNode = document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_1__templates_pagination_page__["a" /* default */])()).firstChild; |
|
|
1721 |
newPageNode.dataset.index = i * this.slider.slidesToScroll; |
|
|
1722 |
this._pages.push(newPageNode); |
|
|
1723 |
this._ui.container.appendChild(newPageNode); |
|
|
1724 |
} |
|
|
1725 |
this._bindEvents(); |
|
|
1726 |
} |
|
|
1727 |
} |
|
|
1728 |
}, { |
|
|
1729 |
key: 'onPageClick', |
|
|
1730 |
value: function onPageClick(e) { |
|
|
1731 |
if (!this._supportsPassive) { |
|
|
1732 |
e.preventDefault(); |
|
|
1733 |
} |
|
|
1734 |
|
|
|
1735 |
this.slider.state.next = e.currentTarget.dataset.index; |
|
|
1736 |
this.slider.show(); |
|
|
1737 |
} |
|
|
1738 |
}, { |
|
|
1739 |
key: 'onResize', |
|
|
1740 |
value: function onResize() { |
|
|
1741 |
this._draw(); |
|
|
1742 |
} |
|
|
1743 |
}, { |
|
|
1744 |
key: 'refresh', |
|
|
1745 |
value: function refresh() { |
|
|
1746 |
var _this3 = this; |
|
|
1747 |
|
|
|
1748 |
var newCount = void 0; |
|
|
1749 |
|
|
|
1750 |
if (this.slider.options.infinite) { |
|
|
1751 |
newCount = Math.ceil(this.slider.state.length - 1 / this.slider.slidesToScroll); |
|
|
1752 |
} else { |
|
|
1753 |
newCount = Math.ceil((this.slider.state.length - this.slider.slidesToShow) / this.slider.slidesToScroll); |
|
|
1754 |
} |
|
|
1755 |
if (newCount !== this._count) { |
|
|
1756 |
this._count = newCount; |
|
|
1757 |
this._draw(); |
|
|
1758 |
} |
|
|
1759 |
|
|
|
1760 |
this._pages.forEach(function (page) { |
|
|
1761 |
page.classList.remove('is-active'); |
|
|
1762 |
if (parseInt(page.dataset.index, 10) === _this3.slider.state.next % _this3.slider.state.length) { |
|
|
1763 |
page.classList.add('is-active'); |
|
|
1764 |
} |
|
|
1765 |
}); |
|
|
1766 |
} |
|
|
1767 |
}, { |
|
|
1768 |
key: 'render', |
|
|
1769 |
value: function render() { |
|
|
1770 |
return this.node; |
|
|
1771 |
} |
|
|
1772 |
}]); |
|
|
1773 |
|
|
|
1774 |
return Pagination; |
|
|
1775 |
}(); |
|
|
1776 |
|
|
|
1777 |
/* harmony default export */ __webpack_exports__["a"] = (Pagination); |
|
|
1778 |
|
|
|
1779 |
/***/ }), |
|
|
1780 |
/* 16 */ |
|
|
1781 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1782 |
|
|
|
1783 |
"use strict"; |
|
|
1784 |
/* harmony default export */ __webpack_exports__["a"] = (function () { |
|
|
1785 |
return "<div class=\"slider-pagination\"></div>"; |
|
|
1786 |
}); |
|
|
1787 |
|
|
|
1788 |
/***/ }), |
|
|
1789 |
/* 17 */ |
|
|
1790 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1791 |
|
|
|
1792 |
"use strict"; |
|
|
1793 |
/* harmony default export */ __webpack_exports__["a"] = (function () { |
|
|
1794 |
return "<div class=\"slider-page\"></div>"; |
|
|
1795 |
}); |
|
|
1796 |
|
|
|
1797 |
/***/ }), |
|
|
1798 |
/* 18 */ |
|
|
1799 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1800 |
|
|
|
1801 |
"use strict"; |
|
|
1802 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__ = __webpack_require__(4); |
|
|
1803 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_detect_supportsPassive__ = __webpack_require__(1); |
|
|
1804 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1805 |
|
|
|
1806 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1807 |
|
|
|
1808 |
|
|
|
1809 |
|
|
|
1810 |
|
|
|
1811 |
var Swipe = function () { |
|
|
1812 |
function Swipe(slider) { |
|
|
1813 |
_classCallCheck(this, Swipe); |
|
|
1814 |
|
|
|
1815 |
this.slider = slider; |
|
|
1816 |
|
|
|
1817 |
this._supportsPassive = Object(__WEBPACK_IMPORTED_MODULE_1__utils_detect_supportsPassive__["a" /* default */])(); |
|
|
1818 |
|
|
|
1819 |
this.onStartDrag = this.onStartDrag.bind(this); |
|
|
1820 |
this.onMoveDrag = this.onMoveDrag.bind(this); |
|
|
1821 |
this.onStopDrag = this.onStopDrag.bind(this); |
|
|
1822 |
|
|
|
1823 |
this._init(); |
|
|
1824 |
} |
|
|
1825 |
|
|
|
1826 |
_createClass(Swipe, [{ |
|
|
1827 |
key: '_init', |
|
|
1828 |
value: function _init() {} |
|
|
1829 |
}, { |
|
|
1830 |
key: 'bindEvents', |
|
|
1831 |
value: function bindEvents() { |
|
|
1832 |
var _this = this; |
|
|
1833 |
|
|
|
1834 |
this.slider.container.addEventListener('dragstart', function (e) { |
|
|
1835 |
if (!_this._supportsPassive) { |
|
|
1836 |
e.preventDefault(); |
|
|
1837 |
} |
|
|
1838 |
}); |
|
|
1839 |
this.slider.container.addEventListener('mousedown', this.onStartDrag); |
|
|
1840 |
this.slider.container.addEventListener('touchstart', this.onStartDrag); |
|
|
1841 |
|
|
|
1842 |
window.addEventListener('mousemove', this.onMoveDrag); |
|
|
1843 |
window.addEventListener('touchmove', this.onMoveDrag); |
|
|
1844 |
|
|
|
1845 |
window.addEventListener('mouseup', this.onStopDrag); |
|
|
1846 |
window.addEventListener('touchend', this.onStopDrag); |
|
|
1847 |
window.addEventListener('touchcancel', this.onStopDrag); |
|
|
1848 |
} |
|
|
1849 |
}, { |
|
|
1850 |
key: 'unbindEvents', |
|
|
1851 |
value: function unbindEvents() { |
|
|
1852 |
var _this2 = this; |
|
|
1853 |
|
|
|
1854 |
this.slider.container.removeEventListener('dragstart', function (e) { |
|
|
1855 |
if (!_this2._supportsPassive) { |
|
|
1856 |
e.preventDefault(); |
|
|
1857 |
} |
|
|
1858 |
}); |
|
|
1859 |
this.slider.container.removeEventListener('mousedown', this.onStartDrag); |
|
|
1860 |
this.slider.container.removeEventListener('touchstart', this.onStartDrag); |
|
|
1861 |
|
|
|
1862 |
window.removeEventListener('mousemove', this.onMoveDrag); |
|
|
1863 |
window.removeEventListener('touchmove', this.onMoveDrag); |
|
|
1864 |
|
|
|
1865 |
window.removeEventListener('mouseup', this.onStopDrag); |
|
|
1866 |
window.removeEventListener('mouseup', this.onStopDrag); |
|
|
1867 |
window.removeEventListener('touchcancel', this.onStopDrag); |
|
|
1868 |
} |
|
|
1869 |
|
|
|
1870 |
/** |
|
|
1871 |
* @param {MouseEvent|TouchEvent} |
|
|
1872 |
*/ |
|
|
1873 |
|
|
|
1874 |
}, { |
|
|
1875 |
key: 'onStartDrag', |
|
|
1876 |
value: function onStartDrag(e) { |
|
|
1877 |
if (e.touches) { |
|
|
1878 |
if (e.touches.length > 1) { |
|
|
1879 |
return; |
|
|
1880 |
} else { |
|
|
1881 |
e = e.touches[0]; |
|
|
1882 |
} |
|
|
1883 |
} |
|
|
1884 |
|
|
|
1885 |
this._origin = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](e.screenX, e.screenY); |
|
|
1886 |
this.width = this.slider.wrapperWidth; |
|
|
1887 |
this.slider.transitioner.disable(); |
|
|
1888 |
} |
|
|
1889 |
|
|
|
1890 |
/** |
|
|
1891 |
* @param {MouseEvent|TouchEvent} |
|
|
1892 |
*/ |
|
|
1893 |
|
|
|
1894 |
}, { |
|
|
1895 |
key: 'onMoveDrag', |
|
|
1896 |
value: function onMoveDrag(e) { |
|
|
1897 |
if (this._origin) { |
|
|
1898 |
var point = e.touches ? e.touches[0] : e; |
|
|
1899 |
this._lastTranslate = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](point.screenX - this._origin.x, point.screenY - this._origin.y); |
|
|
1900 |
if (e.touches) { |
|
|
1901 |
if (Math.abs(this._lastTranslate.x) > Math.abs(this._lastTranslate.y)) { |
|
|
1902 |
if (!this._supportsPassive) { |
|
|
1903 |
e.preventDefault(); |
|
|
1904 |
} |
|
|
1905 |
e.stopPropagation(); |
|
|
1906 |
} |
|
|
1907 |
} |
|
|
1908 |
} |
|
|
1909 |
} |
|
|
1910 |
|
|
|
1911 |
/** |
|
|
1912 |
* @param {MouseEvent|TouchEvent} |
|
|
1913 |
*/ |
|
|
1914 |
|
|
|
1915 |
}, { |
|
|
1916 |
key: 'onStopDrag', |
|
|
1917 |
value: function onStopDrag(e) { |
|
|
1918 |
if (this._origin && this._lastTranslate) { |
|
|
1919 |
if (Math.abs(this._lastTranslate.x) > 0.2 * this.width) { |
|
|
1920 |
if (this._lastTranslate.x < 0) { |
|
|
1921 |
this.slider.next(); |
|
|
1922 |
} else { |
|
|
1923 |
this.slider.previous(); |
|
|
1924 |
} |
|
|
1925 |
} else { |
|
|
1926 |
this.slider.show(true); |
|
|
1927 |
} |
|
|
1928 |
} |
|
|
1929 |
this._origin = null; |
|
|
1930 |
this._lastTranslate = null; |
|
|
1931 |
} |
|
|
1932 |
}]); |
|
|
1933 |
|
|
|
1934 |
return Swipe; |
|
|
1935 |
}(); |
|
|
1936 |
|
|
|
1937 |
/* harmony default export */ __webpack_exports__["a"] = (Swipe); |
|
|
1938 |
|
|
|
1939 |
/***/ }), |
|
|
1940 |
/* 19 */ |
|
|
1941 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
1942 |
|
|
|
1943 |
"use strict"; |
|
|
1944 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__transitions_fade__ = __webpack_require__(20); |
|
|
1945 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_translate__ = __webpack_require__(21); |
|
|
1946 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
1947 |
|
|
|
1948 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
1949 |
|
|
|
1950 |
|
|
|
1951 |
|
|
|
1952 |
|
|
|
1953 |
var Transitioner = function () { |
|
|
1954 |
function Transitioner(slider) { |
|
|
1955 |
_classCallCheck(this, Transitioner); |
|
|
1956 |
|
|
|
1957 |
this.slider = slider; |
|
|
1958 |
this.options = slider.options; |
|
|
1959 |
|
|
|
1960 |
this._animating = false; |
|
|
1961 |
this._animation = undefined; |
|
|
1962 |
|
|
|
1963 |
this._translate = new __WEBPACK_IMPORTED_MODULE_1__transitions_translate__["a" /* default */](this, slider, slider.options); |
|
|
1964 |
this._fade = new __WEBPACK_IMPORTED_MODULE_0__transitions_fade__["a" /* default */](this, slider, slider.options); |
|
|
1965 |
} |
|
|
1966 |
|
|
|
1967 |
_createClass(Transitioner, [{ |
|
|
1968 |
key: 'init', |
|
|
1969 |
value: function init() { |
|
|
1970 |
this._fade.init(); |
|
|
1971 |
this._translate.init(); |
|
|
1972 |
return this; |
|
|
1973 |
} |
|
|
1974 |
}, { |
|
|
1975 |
key: 'isAnimating', |
|
|
1976 |
value: function isAnimating() { |
|
|
1977 |
return this._animating; |
|
|
1978 |
} |
|
|
1979 |
}, { |
|
|
1980 |
key: 'enable', |
|
|
1981 |
value: function enable() { |
|
|
1982 |
this._animation && this._animation.enable(); |
|
|
1983 |
} |
|
|
1984 |
}, { |
|
|
1985 |
key: 'disable', |
|
|
1986 |
value: function disable() { |
|
|
1987 |
this._animation && this._animation.disable(); |
|
|
1988 |
} |
|
|
1989 |
}, { |
|
|
1990 |
key: 'apply', |
|
|
1991 |
value: function apply(force, callback) { |
|
|
1992 |
// If we don't force refresh and animation in progress then return |
|
|
1993 |
if (this._animating && !force) { |
|
|
1994 |
return; |
|
|
1995 |
} |
|
|
1996 |
|
|
|
1997 |
switch (this.options.effect) { |
|
|
1998 |
case 'fade': |
|
|
1999 |
this._animation = this._fade; |
|
|
2000 |
break; |
|
|
2001 |
case 'translate': |
|
|
2002 |
default: |
|
|
2003 |
this._animation = this._translate; |
|
|
2004 |
break; |
|
|
2005 |
} |
|
|
2006 |
|
|
|
2007 |
this._animationCallback = callback; |
|
|
2008 |
|
|
|
2009 |
if (force) { |
|
|
2010 |
this._animation && this._animation.disable(); |
|
|
2011 |
} else { |
|
|
2012 |
this._animation && this._animation.enable(); |
|
|
2013 |
this._animating = true; |
|
|
2014 |
} |
|
|
2015 |
|
|
|
2016 |
this._animation && this._animation.apply(); |
|
|
2017 |
|
|
|
2018 |
if (force) { |
|
|
2019 |
this.end(); |
|
|
2020 |
} |
|
|
2021 |
} |
|
|
2022 |
}, { |
|
|
2023 |
key: 'end', |
|
|
2024 |
value: function end() { |
|
|
2025 |
this._animating = false; |
|
|
2026 |
this._animation = undefined; |
|
|
2027 |
this.slider.state.index = this.slider.state.next; |
|
|
2028 |
if (this._animationCallback) { |
|
|
2029 |
this._animationCallback(); |
|
|
2030 |
} |
|
|
2031 |
} |
|
|
2032 |
}]); |
|
|
2033 |
|
|
|
2034 |
return Transitioner; |
|
|
2035 |
}(); |
|
|
2036 |
|
|
|
2037 |
/* harmony default export */ __webpack_exports__["a"] = (Transitioner); |
|
|
2038 |
|
|
|
2039 |
/***/ }), |
|
|
2040 |
/* 20 */ |
|
|
2041 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
2042 |
|
|
|
2043 |
"use strict"; |
|
|
2044 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_css__ = __webpack_require__(0); |
|
|
2045 |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
|
|
2046 |
|
|
|
2047 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
2048 |
|
|
|
2049 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
2050 |
|
|
|
2051 |
|
|
|
2052 |
|
|
|
2053 |
var Fade = function () { |
|
|
2054 |
function Fade(transitioner, slider) { |
|
|
2055 |
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
|
2056 |
|
|
|
2057 |
_classCallCheck(this, Fade); |
|
|
2058 |
|
|
|
2059 |
this.transitioner = transitioner; |
|
|
2060 |
this.slider = slider; |
|
|
2061 |
this.options = _extends({}, options); |
|
|
2062 |
} |
|
|
2063 |
|
|
|
2064 |
_createClass(Fade, [{ |
|
|
2065 |
key: 'init', |
|
|
2066 |
value: function init() { |
|
|
2067 |
var _this = this; |
|
|
2068 |
|
|
|
2069 |
if (this.options.effect === 'fade') { |
|
|
2070 |
this.slider.slides.forEach(function (slide, index) { |
|
|
2071 |
Object(__WEBPACK_IMPORTED_MODULE_0__utils_css__["a" /* css */])(slide, { |
|
|
2072 |
position: 'absolute', |
|
|
2073 |
left: 0, |
|
|
2074 |
top: 0, |
|
|
2075 |
bottom: 0, |
|
|
2076 |
'z-index': slide.dataset.sliderIndex == _this.slider.state.index ? 0 : -2, |
|
|
2077 |
opacity: slide.dataset.sliderIndex == _this.slider.state.index ? 1 : 0 |
|
|
2078 |
}); |
|
|
2079 |
}); |
|
|
2080 |
} |
|
|
2081 |
return this; |
|
|
2082 |
} |
|
|
2083 |
}, { |
|
|
2084 |
key: 'enable', |
|
|
2085 |
value: function enable() { |
|
|
2086 |
var _this2 = this; |
|
|
2087 |
|
|
|
2088 |
this._oldSlide = this.slider.slides.filter(function (slide) { |
|
|
2089 |
return slide.dataset.sliderIndex == _this2.slider.state.index; |
|
|
2090 |
})[0]; |
|
|
2091 |
this._newSlide = this.slider.slides.filter(function (slide) { |
|
|
2092 |
return slide.dataset.sliderIndex == _this2.slider.state.next; |
|
|
2093 |
})[0]; |
|
|
2094 |
if (this._newSlide) { |
|
|
2095 |
this._newSlide.addEventListener('transitionend', this.onTransitionEnd.bind(this)); |
|
|
2096 |
this._newSlide.style.transition = this.options.duration + 'ms ' + this.options.timing; |
|
|
2097 |
if (this._oldSlide) { |
|
|
2098 |
this._oldSlide.addEventListener('transitionend', this.onTransitionEnd.bind(this)); |
|
|
2099 |
this._oldSlide.style.transition = this.options.duration + 'ms ' + this.options.timing; |
|
|
2100 |
} |
|
|
2101 |
} |
|
|
2102 |
} |
|
|
2103 |
}, { |
|
|
2104 |
key: 'disable', |
|
|
2105 |
value: function disable() { |
|
|
2106 |
var _this3 = this; |
|
|
2107 |
|
|
|
2108 |
this._oldSlide = this.slider.slides.filter(function (slide) { |
|
|
2109 |
return slide.dataset.sliderIndex == _this3.slider.state.index; |
|
|
2110 |
})[0]; |
|
|
2111 |
this._newSlide = this.slider.slides.filter(function (slide) { |
|
|
2112 |
return slide.dataset.sliderIndex == _this3.slider.state.next; |
|
|
2113 |
})[0]; |
|
|
2114 |
if (this._newSlide) { |
|
|
2115 |
this._newSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this)); |
|
|
2116 |
this._newSlide.style.transition = 'none'; |
|
|
2117 |
if (this._oldSlide) { |
|
|
2118 |
this._oldSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this)); |
|
|
2119 |
this._oldSlide.style.transition = 'none'; |
|
|
2120 |
} |
|
|
2121 |
} |
|
|
2122 |
} |
|
|
2123 |
}, { |
|
|
2124 |
key: 'apply', |
|
|
2125 |
value: function apply(force) { |
|
|
2126 |
var _this4 = this; |
|
|
2127 |
|
|
|
2128 |
this._oldSlide = this.slider.slides.filter(function (slide) { |
|
|
2129 |
return slide.dataset.sliderIndex == _this4.slider.state.index; |
|
|
2130 |
})[0]; |
|
|
2131 |
this._newSlide = this.slider.slides.filter(function (slide) { |
|
|
2132 |
return slide.dataset.sliderIndex == _this4.slider.state.next; |
|
|
2133 |
})[0]; |
|
|
2134 |
|
|
|
2135 |
if (this._oldSlide && this._newSlide) { |
|
|
2136 |
Object(__WEBPACK_IMPORTED_MODULE_0__utils_css__["a" /* css */])(this._oldSlide, { |
|
|
2137 |
opacity: 0 |
|
|
2138 |
}); |
|
|
2139 |
Object(__WEBPACK_IMPORTED_MODULE_0__utils_css__["a" /* css */])(this._newSlide, { |
|
|
2140 |
opacity: 1, |
|
|
2141 |
'z-index': force ? 0 : -1 |
|
|
2142 |
}); |
|
|
2143 |
} |
|
|
2144 |
} |
|
|
2145 |
}, { |
|
|
2146 |
key: 'onTransitionEnd', |
|
|
2147 |
value: function onTransitionEnd(e) { |
|
|
2148 |
if (this.options.effect === 'fade') { |
|
|
2149 |
if (this.transitioner.isAnimating() && e.target == this._newSlide) { |
|
|
2150 |
if (this._newSlide) { |
|
|
2151 |
Object(__WEBPACK_IMPORTED_MODULE_0__utils_css__["a" /* css */])(this._newSlide, { |
|
|
2152 |
'z-index': 0 |
|
|
2153 |
}); |
|
|
2154 |
this._newSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this)); |
|
|
2155 |
} |
|
|
2156 |
if (this._oldSlide) { |
|
|
2157 |
Object(__WEBPACK_IMPORTED_MODULE_0__utils_css__["a" /* css */])(this._oldSlide, { |
|
|
2158 |
'z-index': -2 |
|
|
2159 |
}); |
|
|
2160 |
this._oldSlide.removeEventListener('transitionend', this.onTransitionEnd.bind(this)); |
|
|
2161 |
} |
|
|
2162 |
} |
|
|
2163 |
this.transitioner.end(); |
|
|
2164 |
} |
|
|
2165 |
} |
|
|
2166 |
}]); |
|
|
2167 |
|
|
|
2168 |
return Fade; |
|
|
2169 |
}(); |
|
|
2170 |
|
|
|
2171 |
/* harmony default export */ __webpack_exports__["a"] = (Fade); |
|
|
2172 |
|
|
|
2173 |
/***/ }), |
|
|
2174 |
/* 21 */ |
|
|
2175 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
2176 |
|
|
|
2177 |
"use strict"; |
|
|
2178 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__ = __webpack_require__(4); |
|
|
2179 |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_css__ = __webpack_require__(0); |
|
|
2180 |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; |
|
|
2181 |
|
|
|
2182 |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
|
2183 |
|
|
|
2184 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
|
2185 |
|
|
|
2186 |
|
|
|
2187 |
|
|
|
2188 |
|
|
|
2189 |
var Translate = function () { |
|
|
2190 |
function Translate(transitioner, slider) { |
|
|
2191 |
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
|
2192 |
|
|
|
2193 |
_classCallCheck(this, Translate); |
|
|
2194 |
|
|
|
2195 |
this.transitioner = transitioner; |
|
|
2196 |
this.slider = slider; |
|
|
2197 |
this.options = _extends({}, options); |
|
|
2198 |
|
|
|
2199 |
this.onTransitionEnd = this.onTransitionEnd.bind(this); |
|
|
2200 |
} |
|
|
2201 |
|
|
|
2202 |
_createClass(Translate, [{ |
|
|
2203 |
key: 'init', |
|
|
2204 |
value: function init() { |
|
|
2205 |
this._position = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](this.slider.container.offsetLeft, this.slider.container.offsetTop); |
|
|
2206 |
this._bindEvents(); |
|
|
2207 |
return this; |
|
|
2208 |
} |
|
|
2209 |
}, { |
|
|
2210 |
key: 'destroy', |
|
|
2211 |
value: function destroy() { |
|
|
2212 |
this._unbindEvents(); |
|
|
2213 |
} |
|
|
2214 |
}, { |
|
|
2215 |
key: '_bindEvents', |
|
|
2216 |
value: function _bindEvents() { |
|
|
2217 |
this.slider.container.addEventListener('transitionend', this.onTransitionEnd); |
|
|
2218 |
} |
|
|
2219 |
}, { |
|
|
2220 |
key: '_unbindEvents', |
|
|
2221 |
value: function _unbindEvents() { |
|
|
2222 |
this.slider.container.removeEventListener('transitionend', this.onTransitionEnd); |
|
|
2223 |
} |
|
|
2224 |
}, { |
|
|
2225 |
key: 'enable', |
|
|
2226 |
value: function enable() { |
|
|
2227 |
this.slider.container.style.transition = this.options.duration + 'ms ' + this.options.timing; |
|
|
2228 |
} |
|
|
2229 |
}, { |
|
|
2230 |
key: 'disable', |
|
|
2231 |
value: function disable() { |
|
|
2232 |
this.slider.container.style.transition = 'none'; |
|
|
2233 |
} |
|
|
2234 |
}, { |
|
|
2235 |
key: 'apply', |
|
|
2236 |
value: function apply() { |
|
|
2237 |
var _this = this; |
|
|
2238 |
|
|
|
2239 |
var maxOffset = void 0; |
|
|
2240 |
if (this.options.effect === 'translate') { |
|
|
2241 |
var slide = this.slider.slides.filter(function (slide) { |
|
|
2242 |
return slide.dataset.sliderIndex == _this.slider.state.next; |
|
|
2243 |
})[0]; |
|
|
2244 |
var slideOffset = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](slide.offsetLeft, slide.offsetTop); |
|
|
2245 |
if (this.options.centerMode) { |
|
|
2246 |
maxOffset = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](Math.round(Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["e" /* width */])(this.slider.container)), Math.round(Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["b" /* height */])(this.slider.container))); |
|
|
2247 |
} else { |
|
|
2248 |
maxOffset = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](Math.round(Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["e" /* width */])(this.slider.container) - Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["e" /* width */])(this.slider.wrapper)), Math.round(Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["b" /* height */])(this.slider.container) - Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["b" /* height */])(this.slider.wrapper))); |
|
|
2249 |
} |
|
|
2250 |
var nextOffset = new __WEBPACK_IMPORTED_MODULE_0__utils_coordinate__["a" /* default */](Math.min(Math.max(slideOffset.x * -1, maxOffset.x * -1), 0), Math.min(Math.max(slideOffset.y * -1, maxOffset.y * -1), 0)); |
|
|
2251 |
if (this.options.loop) { |
|
|
2252 |
if (!this.options.vertical && Math.abs(this._position.x) > maxOffset.x) { |
|
|
2253 |
nextOffset.x = 0; |
|
|
2254 |
this.slider.state.next = 0; |
|
|
2255 |
} else if (this.options.vertical && Math.abs(this._position.y) > maxOffset.y) { |
|
|
2256 |
nextOffset.y = 0; |
|
|
2257 |
this.slider.state.next = 0; |
|
|
2258 |
} |
|
|
2259 |
} |
|
|
2260 |
|
|
|
2261 |
this._position.x = nextOffset.x; |
|
|
2262 |
this._position.y = nextOffset.y; |
|
|
2263 |
if (this.options.centerMode) { |
|
|
2264 |
this._position.x = this._position.x + this.slider.wrapperWidth / 2 - Object(__WEBPACK_IMPORTED_MODULE_1__utils_css__["e" /* width */])(slide) / 2; |
|
|
2265 |
} |
|
|
2266 |
|
|
|
2267 |
if (this.slider.direction === 'rtl') { |
|
|
2268 |
this._position.x = -this._position.x; |
|
|
2269 |
this._position.y = -this._position.y; |
|
|
2270 |
} |
|
|
2271 |
this.slider.container.style.transform = 'translate3d(' + this._position.x + 'px, ' + this._position.y + 'px, 0)'; |
|
|
2272 |
|
|
|
2273 |
/** |
|
|
2274 |
* update the index with the nextIndex only if |
|
|
2275 |
* the offset of the nextIndex is in the range of the maxOffset |
|
|
2276 |
*/ |
|
|
2277 |
if (slideOffset.x > maxOffset.x) { |
|
|
2278 |
this.slider.transitioner.end(); |
|
|
2279 |
} |
|
|
2280 |
} |
|
|
2281 |
} |
|
|
2282 |
}, { |
|
|
2283 |
key: 'onTransitionEnd', |
|
|
2284 |
value: function onTransitionEnd(e) { |
|
|
2285 |
if (this.options.effect === 'translate') { |
|
|
2286 |
|
|
|
2287 |
if (this.transitioner.isAnimating() && e.target == this.slider.container) { |
|
|
2288 |
if (this.options.infinite) { |
|
|
2289 |
this.slider._infinite.onTransitionEnd(e); |
|
|
2290 |
} |
|
|
2291 |
} |
|
|
2292 |
this.transitioner.end(); |
|
|
2293 |
} |
|
|
2294 |
} |
|
|
2295 |
}]); |
|
|
2296 |
|
|
|
2297 |
return Translate; |
|
|
2298 |
}(); |
|
|
2299 |
|
|
|
2300 |
/* harmony default export */ __webpack_exports__["a"] = (Translate); |
|
|
2301 |
|
|
|
2302 |
/***/ }), |
|
|
2303 |
/* 22 */ |
|
|
2304 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
2305 |
|
|
|
2306 |
"use strict"; |
|
|
2307 |
var defaultOptions = { |
|
|
2308 |
initialSlide: 0, |
|
|
2309 |
slidesToScroll: 1, |
|
|
2310 |
slidesToShow: 1, |
|
|
2311 |
|
|
|
2312 |
navigation: true, |
|
|
2313 |
navigationKeys: true, |
|
|
2314 |
navigationSwipe: true, |
|
|
2315 |
|
|
|
2316 |
pagination: true, |
|
|
2317 |
|
|
|
2318 |
loop: false, |
|
|
2319 |
infinite: false, |
|
|
2320 |
|
|
|
2321 |
effect: 'translate', |
|
|
2322 |
duration: 300, |
|
|
2323 |
timing: 'ease', |
|
|
2324 |
|
|
|
2325 |
autoplay: false, |
|
|
2326 |
autoplaySpeed: 3000, |
|
|
2327 |
pauseOnHover: true, |
|
|
2328 |
breakpoints: [{ |
|
|
2329 |
changePoint: 480, |
|
|
2330 |
slidesToShow: 1, |
|
|
2331 |
slidesToScroll: 1 |
|
|
2332 |
}, { |
|
|
2333 |
changePoint: 640, |
|
|
2334 |
slidesToShow: 2, |
|
|
2335 |
slidesToScroll: 2 |
|
|
2336 |
}, { |
|
|
2337 |
changePoint: 768, |
|
|
2338 |
slidesToShow: 3, |
|
|
2339 |
slidesToScroll: 3 |
|
|
2340 |
}], |
|
|
2341 |
|
|
|
2342 |
onReady: null, |
|
|
2343 |
icons: { |
|
|
2344 |
'previous': '<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="currentColor" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/>\n </svg>', |
|
|
2345 |
'next': '<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="currentColor" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/>\n </svg>' |
|
|
2346 |
} |
|
|
2347 |
}; |
|
|
2348 |
|
|
|
2349 |
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions); |
|
|
2350 |
|
|
|
2351 |
/***/ }), |
|
|
2352 |
/* 23 */ |
|
|
2353 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
2354 |
|
|
|
2355 |
"use strict"; |
|
|
2356 |
/* harmony default export */ __webpack_exports__["a"] = (function (id) { |
|
|
2357 |
return "<div id=\"" + id + "\" class=\"slider\" tabindex=\"0\">\n <div class=\"slider-container\"></div>\n </div>"; |
|
|
2358 |
}); |
|
|
2359 |
|
|
|
2360 |
/***/ }), |
|
|
2361 |
/* 24 */ |
|
|
2362 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
2363 |
|
|
|
2364 |
"use strict"; |
|
|
2365 |
/* harmony default export */ __webpack_exports__["a"] = (function () { |
|
|
2366 |
return "<div class=\"slider-item\"></div>"; |
|
|
2367 |
}); |
|
|
2368 |
|
|
|
2369 |
/***/ }) |
|
|
2370 |
/******/ ])["default"]; |
|
|
2371 |
}); |