infinity-forge 0.54.1 → 0.54.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/sites/fixed-components/list-blog/carousel-configs.d.ts +1 -2
  2. package/dist/sites/fixed-components/list-blog/carousel-configs.js.map +1 -1
  3. package/dist/ui/components/carousel/interfaces.d.ts +1 -2
  4. package/dist/ui/components/carousel/swiper/core/core.d.ts +116 -0
  5. package/dist/ui/components/carousel/swiper/core/core.js +654 -0
  6. package/dist/ui/components/carousel/swiper/core/core.js.map +1 -0
  7. package/dist/ui/components/carousel/swiper/core/defaults.d.ts +92 -0
  8. package/dist/ui/components/carousel/swiper/core/defaults.js +119 -0
  9. package/dist/ui/components/carousel/swiper/core/defaults.js.map +1 -0
  10. package/dist/ui/components/carousel/swiper/core/events-emitter.d.ts +9 -0
  11. package/dist/ui/components/carousel/swiper/core/events-emitter.js +133 -0
  12. package/dist/ui/components/carousel/swiper/core/events-emitter.js.map +1 -0
  13. package/dist/ui/components/carousel/swiper/core/moduleExtendParams.d.ts +1 -0
  14. package/dist/ui/components/carousel/swiper/core/moduleExtendParams.js +42 -0
  15. package/dist/ui/components/carousel/swiper/core/moduleExtendParams.js.map +1 -0
  16. package/dist/ui/components/carousel/swiper/modules/effect-fade.js +4 -4
  17. package/dist/ui/components/carousel/swiper/modules/free-mode.js +1 -1
  18. package/dist/ui/components/carousel/swiper/modules/navigation.js +2 -2
  19. package/dist/ui/components/carousel/swiper/modules/pagination.js +3 -3
  20. package/dist/ui/components/carousel/swiper/modules/virtual.js +1 -1
  21. package/dist/ui/components/carousel/swiper/react/swiper.js +1 -1
  22. package/dist/ui/components/carousel/swiper/shared/classes-to-selector.d.ts +1 -0
  23. package/dist/ui/components/carousel/swiper/shared/classes-to-selector.js +11 -0
  24. package/dist/ui/components/carousel/swiper/shared/classes-to-selector.js.map +1 -0
  25. package/dist/ui/components/carousel/swiper/shared/classes-to-tokens.d.ts +1 -0
  26. package/dist/ui/components/carousel/swiper/shared/classes-to-tokens.js +11 -0
  27. package/dist/ui/components/carousel/swiper/shared/classes-to-tokens.js.map +1 -0
  28. package/dist/ui/components/carousel/swiper/shared/create-element-if-not-defined.d.ts +1 -0
  29. package/dist/ui/components/carousel/swiper/shared/create-element-if-not-defined.js +22 -0
  30. package/dist/ui/components/carousel/swiper/shared/create-element-if-not-defined.js.map +1 -0
  31. package/dist/ui/components/carousel/swiper/shared/create-shadow.d.ts +1 -0
  32. package/dist/ui/components/carousel/swiper/shared/create-shadow.js +15 -0
  33. package/dist/ui/components/carousel/swiper/shared/create-shadow.js.map +1 -0
  34. package/dist/ui/components/carousel/swiper/shared/effect-init.d.ts +1 -0
  35. package/dist/ui/components/carousel/swiper/shared/effect-init.js +58 -0
  36. package/dist/ui/components/carousel/swiper/shared/effect-init.js.map +1 -0
  37. package/dist/ui/components/carousel/swiper/shared/effect-target.d.ts +1 -0
  38. package/dist/ui/components/carousel/swiper/shared/effect-target.js +13 -0
  39. package/dist/ui/components/carousel/swiper/shared/effect-target.js.map +1 -0
  40. package/dist/ui/components/carousel/swiper/shared/effect-virtual-transition-end.d.ts +6 -0
  41. package/dist/ui/components/carousel/swiper/shared/effect-virtual-transition-end.js +47 -0
  42. package/dist/ui/components/carousel/swiper/shared/effect-virtual-transition-end.js.map +1 -0
  43. package/dist/ui/components/carousel/swiper/shared/get-browser.d.ts +2 -0
  44. package/dist/ui/components/carousel/swiper/shared/get-browser.js +43 -0
  45. package/dist/ui/components/carousel/swiper/shared/get-browser.js.map +1 -0
  46. package/dist/ui/components/carousel/swiper/shared/get-device.d.ts +1 -0
  47. package/dist/ui/components/carousel/swiper/shared/get-device.js +69 -0
  48. package/dist/ui/components/carousel/swiper/shared/get-device.js.map +1 -0
  49. package/dist/ui/components/carousel/swiper/shared/get-support.d.ts +2 -0
  50. package/dist/ui/components/carousel/swiper/shared/get-support.js +24 -0
  51. package/dist/ui/components/carousel/swiper/shared/get-support.js.map +1 -0
  52. package/dist/ui/components/carousel/swiper/shared/process-lazy-preloader.d.ts +2 -0
  53. package/dist/ui/components/carousel/swiper/shared/process-lazy-preloader.js +79 -0
  54. package/dist/ui/components/carousel/swiper/shared/process-lazy-preloader.js.map +1 -0
  55. package/dist/ui/components/carousel/swiper/shared/utils.d.ts +32 -0
  56. package/dist/ui/components/carousel/swiper/shared/utils.js +371 -0
  57. package/dist/ui/components/carousel/swiper/shared/utils.js.map +1 -0
  58. package/dist/ui/components/carousel/swiper/swiper-bundle.d.ts +1 -0
  59. package/dist/ui/components/carousel/swiper/swiper-bundle.js +18 -0
  60. package/dist/ui/components/carousel/swiper/swiper-bundle.js.map +1 -0
  61. package/dist/ui/components/carousel/swiper/swiper-effect-utils.d.ts +6 -0
  62. package/dist/ui/components/carousel/swiper/swiper-effect-utils.js +17 -0
  63. package/dist/ui/components/carousel/swiper/swiper-effect-utils.js.map +1 -0
  64. package/dist/ui/components/carousel/swiper/swiper-react.d.ts +4 -0
  65. package/dist/ui/components/carousel/swiper/swiper-react.js +11 -0
  66. package/dist/ui/components/carousel/swiper/swiper-react.js.map +1 -0
  67. package/dist/ui/components/carousel/swiper/swiper.d.ts +1 -0
  68. package/dist/ui/components/carousel/swiper/swiper.js +10 -0
  69. package/dist/ui/components/carousel/swiper/swiper.js.map +1 -0
  70. package/package.json +1 -1
@@ -0,0 +1,654 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //@ts-nocheck
16
+ /* eslint no-param-reassign: "off" */
17
+ var ssr_window_1 = require("ssr-window");
18
+ var utils_1 = require("../shared/utils.js");
19
+ var get_support_1 = require("../shared/get-support.js");
20
+ var get_device_1 = require("../shared/get-device.js");
21
+ var get_browser_1 = require("../shared/get-browser.js");
22
+ var resize_1 = __importDefault(require("./modules/resize/resize"));
23
+ var observer_1 = __importDefault(require("./modules/observer/observer"));
24
+ var events_emitter_1 = __importDefault(require("./events-emitter.js"));
25
+ var index_1 = __importDefault(require("./update/index"));
26
+ var index_2 = __importDefault(require("./translate/index"));
27
+ var index_3 = __importDefault(require("./transition/index"));
28
+ var index_4 = __importDefault(require("./slide/index"));
29
+ var index_5 = __importDefault(require("./loop/index"));
30
+ var index_6 = __importDefault(require("./grab-cursor/index"));
31
+ var index_7 = __importDefault(require("./events/index"));
32
+ var index_8 = __importDefault(require("./breakpoints/index"));
33
+ var index_9 = __importDefault(require("./classes/index"));
34
+ var index_10 = __importDefault(require("./check-overflow/index"));
35
+ var defaults_1 = __importDefault(require("./defaults.js"));
36
+ var moduleExtendParams_1 = __importDefault(require("./moduleExtendParams.js"));
37
+ var process_lazy_preloader_1 = require("../shared/process-lazy-preloader.js");
38
+ var prototypes = {
39
+ eventsEmitter: events_emitter_1.default,
40
+ update: index_1.default,
41
+ translate: index_2.default,
42
+ transition: index_3.default,
43
+ slide: index_4.default,
44
+ loop: index_5.default,
45
+ grabCursor: index_6.default,
46
+ events: index_7.default,
47
+ breakpoints: index_8.default,
48
+ checkOverflow: index_10.default,
49
+ classes: index_9.default,
50
+ };
51
+ var extendedDefaults = {};
52
+ var Swiper = /** @class */ (function () {
53
+ function Swiper() {
54
+ var _a;
55
+ var args = [];
56
+ for (var _i = 0; _i < arguments.length; _i++) {
57
+ args[_i] = arguments[_i];
58
+ }
59
+ var el;
60
+ var params;
61
+ if (args.length === 1 &&
62
+ args[0].constructor &&
63
+ Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
64
+ params = args[0];
65
+ }
66
+ else {
67
+ el = args[0], params = args[1];
68
+ }
69
+ if (!params)
70
+ params = {};
71
+ params = (0, utils_1.extend)({}, params);
72
+ if (el && !params.el)
73
+ params.el = el;
74
+ var document = (0, ssr_window_1.getDocument)();
75
+ if (params.el &&
76
+ typeof params.el === 'string' &&
77
+ document.querySelectorAll(params.el).length > 1) {
78
+ var swipers_1 = [];
79
+ document.querySelectorAll(params.el).forEach(function (containerEl) {
80
+ var newParams = (0, utils_1.extend)({}, params, { el: containerEl });
81
+ swipers_1.push(new Swiper(newParams));
82
+ });
83
+ // eslint-disable-next-line no-constructor-return
84
+ return swipers_1;
85
+ }
86
+ // Swiper Instance
87
+ var swiper = this;
88
+ swiper.__swiper__ = true;
89
+ swiper.support = (0, get_support_1.getSupport)();
90
+ swiper.device = (0, get_device_1.getDevice)({ userAgent: params.userAgent });
91
+ swiper.browser = (0, get_browser_1.getBrowser)();
92
+ swiper.eventsListeners = {};
93
+ swiper.eventsAnyListeners = [];
94
+ swiper.modules = __spreadArray([], swiper.__modules__, true);
95
+ if (params.modules && Array.isArray(params.modules)) {
96
+ (_a = swiper.modules).push.apply(_a, params.modules);
97
+ }
98
+ var allModulesParams = {};
99
+ swiper.modules.forEach(function (mod) {
100
+ mod({
101
+ params: params,
102
+ swiper: swiper,
103
+ extendParams: (0, moduleExtendParams_1.default)(params, allModulesParams),
104
+ on: swiper.on.bind(swiper),
105
+ once: swiper.once.bind(swiper),
106
+ off: swiper.off.bind(swiper),
107
+ emit: swiper.emit.bind(swiper),
108
+ });
109
+ });
110
+ // Extend defaults with modules params
111
+ var swiperParams = (0, utils_1.extend)({}, defaults_1.default, allModulesParams);
112
+ // Extend defaults with passed params
113
+ swiper.params = (0, utils_1.extend)({}, swiperParams, extendedDefaults, params);
114
+ swiper.originalParams = (0, utils_1.extend)({}, swiper.params);
115
+ swiper.passedParams = (0, utils_1.extend)({}, params);
116
+ // add event listeners
117
+ if (swiper.params && swiper.params.on) {
118
+ Object.keys(swiper.params.on).forEach(function (eventName) {
119
+ swiper.on(eventName, swiper.params.on[eventName]);
120
+ });
121
+ }
122
+ if (swiper.params && swiper.params.onAny) {
123
+ swiper.onAny(swiper.params.onAny);
124
+ }
125
+ // Extend Swiper
126
+ Object.assign(swiper, {
127
+ enabled: swiper.params.enabled,
128
+ el: el,
129
+ // Classes
130
+ classNames: [],
131
+ // Slides
132
+ slides: [],
133
+ slidesGrid: [],
134
+ snapGrid: [],
135
+ slidesSizesGrid: [],
136
+ // isDirection
137
+ isHorizontal: function () {
138
+ return swiper.params.direction === 'horizontal';
139
+ },
140
+ isVertical: function () {
141
+ return swiper.params.direction === 'vertical';
142
+ },
143
+ // Indexes
144
+ activeIndex: 0,
145
+ realIndex: 0,
146
+ //
147
+ isBeginning: true,
148
+ isEnd: false,
149
+ // Props
150
+ translate: 0,
151
+ previousTranslate: 0,
152
+ progress: 0,
153
+ velocity: 0,
154
+ animating: false,
155
+ cssOverflowAdjustment: function () {
156
+ // Returns 0 unless `translate` is > 2**23
157
+ // Should be subtracted from css values to prevent overflow
158
+ return Math.trunc(this.translate / Math.pow(2, 23)) * Math.pow(2, 23);
159
+ },
160
+ // Locks
161
+ allowSlideNext: swiper.params.allowSlideNext,
162
+ allowSlidePrev: swiper.params.allowSlidePrev,
163
+ // Touch Events
164
+ touchEventsData: {
165
+ isTouched: undefined,
166
+ isMoved: undefined,
167
+ allowTouchCallbacks: undefined,
168
+ touchStartTime: undefined,
169
+ isScrolling: undefined,
170
+ currentTranslate: undefined,
171
+ startTranslate: undefined,
172
+ allowThresholdMove: undefined,
173
+ // Form elements to match
174
+ focusableElements: swiper.params.focusableElements,
175
+ // Last click time
176
+ lastClickTime: 0,
177
+ clickTimeout: undefined,
178
+ // Velocities
179
+ velocities: [],
180
+ allowMomentumBounce: undefined,
181
+ startMoving: undefined,
182
+ pointerId: null,
183
+ touchId: null,
184
+ },
185
+ // Clicks
186
+ allowClick: true,
187
+ // Touches
188
+ allowTouchMove: swiper.params.allowTouchMove,
189
+ touches: {
190
+ startX: 0,
191
+ startY: 0,
192
+ currentX: 0,
193
+ currentY: 0,
194
+ diff: 0,
195
+ },
196
+ // Images
197
+ imagesToLoad: [],
198
+ imagesLoaded: 0,
199
+ });
200
+ swiper.emit('_swiper');
201
+ // Init
202
+ if (swiper.params.init) {
203
+ swiper.init();
204
+ }
205
+ // Return app instance
206
+ // eslint-disable-next-line no-constructor-return
207
+ return swiper;
208
+ }
209
+ Swiper.prototype.getDirectionLabel = function (property) {
210
+ if (this.isHorizontal()) {
211
+ return property;
212
+ }
213
+ // prettier-ignore
214
+ return {
215
+ 'width': 'height',
216
+ 'margin-top': 'margin-left',
217
+ 'margin-bottom ': 'margin-right',
218
+ 'margin-left': 'margin-top',
219
+ 'margin-right': 'margin-bottom',
220
+ 'padding-left': 'padding-top',
221
+ 'padding-right': 'padding-bottom',
222
+ 'marginRight': 'marginBottom',
223
+ }[property];
224
+ };
225
+ Swiper.prototype.getSlideIndex = function (slideEl) {
226
+ var _a = this, slidesEl = _a.slidesEl, params = _a.params;
227
+ var slides = (0, utils_1.elementChildren)(slidesEl, ".".concat(params.slideClass, ", swiper-slide"));
228
+ var firstSlideIndex = (0, utils_1.elementIndex)(slides[0]);
229
+ return (0, utils_1.elementIndex)(slideEl) - firstSlideIndex;
230
+ };
231
+ Swiper.prototype.getSlideIndexByData = function (index) {
232
+ return this.getSlideIndex(this.slides.filter(function (slideEl) { return slideEl.getAttribute('data-swiper-slide-index') * 1 === index; })[0]);
233
+ };
234
+ Swiper.prototype.recalcSlides = function () {
235
+ var swiper = this;
236
+ var slidesEl = swiper.slidesEl, params = swiper.params;
237
+ swiper.slides = (0, utils_1.elementChildren)(slidesEl, ".".concat(params.slideClass, ", swiper-slide"));
238
+ };
239
+ Swiper.prototype.enable = function () {
240
+ var swiper = this;
241
+ if (swiper.enabled)
242
+ return;
243
+ swiper.enabled = true;
244
+ if (swiper.params.grabCursor) {
245
+ swiper.setGrabCursor();
246
+ }
247
+ swiper.emit('enable');
248
+ };
249
+ Swiper.prototype.disable = function () {
250
+ var swiper = this;
251
+ if (!swiper.enabled)
252
+ return;
253
+ swiper.enabled = false;
254
+ if (swiper.params.grabCursor) {
255
+ swiper.unsetGrabCursor();
256
+ }
257
+ swiper.emit('disable');
258
+ };
259
+ Swiper.prototype.setProgress = function (progress, speed) {
260
+ var swiper = this;
261
+ progress = Math.min(Math.max(progress, 0), 1);
262
+ var min = swiper.minTranslate();
263
+ var max = swiper.maxTranslate();
264
+ var current = (max - min) * progress + min;
265
+ swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
266
+ swiper.updateActiveIndex();
267
+ swiper.updateSlidesClasses();
268
+ };
269
+ Swiper.prototype.emitContainerClasses = function () {
270
+ var swiper = this;
271
+ if (!swiper.params._emitClasses || !swiper.el)
272
+ return;
273
+ var cls = swiper.el.className.split(' ').filter(function (className) {
274
+ return (className.indexOf('swiper') === 0 ||
275
+ className.indexOf(swiper.params.containerModifierClass) === 0);
276
+ });
277
+ swiper.emit('_containerClasses', cls.join(' '));
278
+ };
279
+ Swiper.prototype.getSlideClasses = function (slideEl) {
280
+ var swiper = this;
281
+ if (swiper.destroyed)
282
+ return '';
283
+ return slideEl.className
284
+ .split(' ')
285
+ .filter(function (className) {
286
+ return (className.indexOf('swiper-slide') === 0 ||
287
+ className.indexOf(swiper.params.slideClass) === 0);
288
+ })
289
+ .join(' ');
290
+ };
291
+ Swiper.prototype.emitSlidesClasses = function () {
292
+ var swiper = this;
293
+ if (!swiper.params._emitClasses || !swiper.el)
294
+ return;
295
+ var updates = [];
296
+ swiper.slides.forEach(function (slideEl) {
297
+ var classNames = swiper.getSlideClasses(slideEl);
298
+ updates.push({ slideEl: slideEl, classNames: classNames });
299
+ swiper.emit('_slideClass', slideEl, classNames);
300
+ });
301
+ swiper.emit('_slideClasses', updates);
302
+ };
303
+ Swiper.prototype.slidesPerViewDynamic = function (view, exact) {
304
+ if (view === void 0) { view = 'current'; }
305
+ if (exact === void 0) { exact = false; }
306
+ var swiper = this;
307
+ var params = swiper.params, slides = swiper.slides, slidesGrid = swiper.slidesGrid, slidesSizesGrid = swiper.slidesSizesGrid, swiperSize = swiper.size, activeIndex = swiper.activeIndex;
308
+ var spv = 1;
309
+ if (typeof params.slidesPerView === 'number')
310
+ return params.slidesPerView;
311
+ if (params.centeredSlides) {
312
+ var slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
313
+ var breakLoop = void 0;
314
+ for (var i = activeIndex + 1; i < slides.length; i += 1) {
315
+ if (slides[i] && !breakLoop) {
316
+ slideSize += Math.ceil(slides[i].swiperSlideSize);
317
+ spv += 1;
318
+ if (slideSize > swiperSize)
319
+ breakLoop = true;
320
+ }
321
+ }
322
+ for (var i = activeIndex - 1; i >= 0; i -= 1) {
323
+ if (slides[i] && !breakLoop) {
324
+ slideSize += slides[i].swiperSlideSize;
325
+ spv += 1;
326
+ if (slideSize > swiperSize)
327
+ breakLoop = true;
328
+ }
329
+ }
330
+ }
331
+ else {
332
+ // eslint-disable-next-line
333
+ if (view === 'current') {
334
+ for (var i = activeIndex + 1; i < slides.length; i += 1) {
335
+ var slideInView = exact
336
+ ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize
337
+ : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
338
+ if (slideInView) {
339
+ spv += 1;
340
+ }
341
+ }
342
+ }
343
+ else {
344
+ // previous
345
+ for (var i = activeIndex - 1; i >= 0; i -= 1) {
346
+ var slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
347
+ if (slideInView) {
348
+ spv += 1;
349
+ }
350
+ }
351
+ }
352
+ }
353
+ return spv;
354
+ };
355
+ Swiper.prototype.update = function () {
356
+ var swiper = this;
357
+ if (!swiper || swiper.destroyed)
358
+ return;
359
+ var snapGrid = swiper.snapGrid, params = swiper.params;
360
+ // Breakpoints
361
+ if (params.breakpoints) {
362
+ swiper.setBreakpoint();
363
+ }
364
+ __spreadArray([], swiper.el.querySelectorAll('[loading="lazy"]'), true).forEach(function (imageEl) {
365
+ if (imageEl.complete) {
366
+ (0, process_lazy_preloader_1.processLazyPreloader)(swiper, imageEl);
367
+ }
368
+ });
369
+ swiper.updateSize();
370
+ swiper.updateSlides();
371
+ swiper.updateProgress();
372
+ swiper.updateSlidesClasses();
373
+ function setTranslate() {
374
+ var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
375
+ var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
376
+ swiper.setTranslate(newTranslate);
377
+ swiper.updateActiveIndex();
378
+ swiper.updateSlidesClasses();
379
+ }
380
+ var translated;
381
+ if (params.freeMode && params.freeMode.enabled && !params.cssMode) {
382
+ setTranslate();
383
+ if (params.autoHeight) {
384
+ swiper.updateAutoHeight();
385
+ }
386
+ }
387
+ else {
388
+ if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) &&
389
+ swiper.isEnd &&
390
+ !params.centeredSlides) {
391
+ var slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
392
+ translated = swiper.slideTo(slides.length - 1, 0, false, true);
393
+ }
394
+ else {
395
+ translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
396
+ }
397
+ if (!translated) {
398
+ setTranslate();
399
+ }
400
+ }
401
+ if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
402
+ swiper.checkOverflow();
403
+ }
404
+ swiper.emit('update');
405
+ };
406
+ Swiper.prototype.changeDirection = function (newDirection, needUpdate) {
407
+ if (needUpdate === void 0) { needUpdate = true; }
408
+ var swiper = this;
409
+ var currentDirection = swiper.params.direction;
410
+ if (!newDirection) {
411
+ // eslint-disable-next-line
412
+ newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
413
+ }
414
+ if (newDirection === currentDirection ||
415
+ (newDirection !== 'horizontal' && newDirection !== 'vertical')) {
416
+ return swiper;
417
+ }
418
+ swiper.el.classList.remove("".concat(swiper.params.containerModifierClass).concat(currentDirection));
419
+ swiper.el.classList.add("".concat(swiper.params.containerModifierClass).concat(newDirection));
420
+ swiper.emitContainerClasses();
421
+ swiper.params.direction = newDirection;
422
+ swiper.slides.forEach(function (slideEl) {
423
+ if (newDirection === 'vertical') {
424
+ slideEl.style.width = '';
425
+ }
426
+ else {
427
+ slideEl.style.height = '';
428
+ }
429
+ });
430
+ swiper.emit('changeDirection');
431
+ if (needUpdate)
432
+ swiper.update();
433
+ return swiper;
434
+ };
435
+ Swiper.prototype.changeLanguageDirection = function (direction) {
436
+ var swiper = this;
437
+ if ((swiper.rtl && direction === 'rtl') || (!swiper.rtl && direction === 'ltr'))
438
+ return;
439
+ swiper.rtl = direction === 'rtl';
440
+ swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
441
+ if (swiper.rtl) {
442
+ swiper.el.classList.add("".concat(swiper.params.containerModifierClass, "rtl"));
443
+ swiper.el.dir = 'rtl';
444
+ }
445
+ else {
446
+ swiper.el.classList.remove("".concat(swiper.params.containerModifierClass, "rtl"));
447
+ swiper.el.dir = 'ltr';
448
+ }
449
+ swiper.update();
450
+ };
451
+ Swiper.prototype.mount = function (element) {
452
+ var swiper = this;
453
+ if (swiper.mounted)
454
+ return true;
455
+ // Find el
456
+ var el = element || swiper.params.el;
457
+ if (typeof el === 'string') {
458
+ el = document.querySelector(el);
459
+ }
460
+ if (!el) {
461
+ return false;
462
+ }
463
+ el.swiper = swiper;
464
+ if (el.parentNode &&
465
+ el.parentNode.host &&
466
+ el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
467
+ swiper.isElement = true;
468
+ }
469
+ var getWrapperSelector = function () {
470
+ return ".".concat((swiper.params.wrapperClass || '').trim().split(' ').join('.'));
471
+ };
472
+ var getWrapper = function () {
473
+ if (el && el.shadowRoot && el.shadowRoot.querySelector) {
474
+ var res = el.shadowRoot.querySelector(getWrapperSelector());
475
+ // Children needs to return slot items
476
+ return res;
477
+ }
478
+ return (0, utils_1.elementChildren)(el, getWrapperSelector())[0];
479
+ };
480
+ // Find Wrapper
481
+ var wrapperEl = getWrapper();
482
+ if (!wrapperEl && swiper.params.createElements) {
483
+ wrapperEl = (0, utils_1.createElement)('div', swiper.params.wrapperClass);
484
+ el.append(wrapperEl);
485
+ (0, utils_1.elementChildren)(el, ".".concat(swiper.params.slideClass)).forEach(function (slideEl) {
486
+ wrapperEl.append(slideEl);
487
+ });
488
+ }
489
+ Object.assign(swiper, {
490
+ el: el,
491
+ wrapperEl: wrapperEl,
492
+ slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl,
493
+ hostEl: swiper.isElement ? el.parentNode.host : el,
494
+ mounted: true,
495
+ // RTL
496
+ rtl: el.dir.toLowerCase() === 'rtl' || (0, utils_1.elementStyle)(el, 'direction') === 'rtl',
497
+ rtlTranslate: swiper.params.direction === 'horizontal' &&
498
+ (el.dir.toLowerCase() === 'rtl' || (0, utils_1.elementStyle)(el, 'direction') === 'rtl'),
499
+ wrongRTL: (0, utils_1.elementStyle)(wrapperEl, 'display') === '-webkit-box',
500
+ });
501
+ return true;
502
+ };
503
+ Swiper.prototype.init = function (el) {
504
+ var swiper = this;
505
+ if (swiper.initialized)
506
+ return swiper;
507
+ var mounted = swiper.mount(el);
508
+ if (mounted === false)
509
+ return swiper;
510
+ swiper.emit('beforeInit');
511
+ // Set breakpoint
512
+ if (swiper.params.breakpoints) {
513
+ swiper.setBreakpoint();
514
+ }
515
+ // Add Classes
516
+ swiper.addClasses();
517
+ // Update size
518
+ swiper.updateSize();
519
+ // Update slides
520
+ swiper.updateSlides();
521
+ if (swiper.params.watchOverflow) {
522
+ swiper.checkOverflow();
523
+ }
524
+ // Set Grab Cursor
525
+ if (swiper.params.grabCursor && swiper.enabled) {
526
+ swiper.setGrabCursor();
527
+ }
528
+ // Slide To Initial Slide
529
+ if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
530
+ swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);
531
+ }
532
+ else {
533
+ swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
534
+ }
535
+ // Create loop
536
+ if (swiper.params.loop) {
537
+ swiper.loopCreate();
538
+ }
539
+ // Attach events
540
+ swiper.attachEvents();
541
+ var lazyElements = __spreadArray([], swiper.el.querySelectorAll('[loading="lazy"]'), true);
542
+ if (swiper.isElement) {
543
+ lazyElements.push.apply(lazyElements, swiper.hostEl.querySelectorAll('[loading="lazy"]'));
544
+ }
545
+ lazyElements.forEach(function (imageEl) {
546
+ if (imageEl.complete) {
547
+ (0, process_lazy_preloader_1.processLazyPreloader)(swiper, imageEl);
548
+ }
549
+ else {
550
+ imageEl.addEventListener('load', function (e) {
551
+ (0, process_lazy_preloader_1.processLazyPreloader)(swiper, e.target);
552
+ });
553
+ }
554
+ });
555
+ (0, process_lazy_preloader_1.preload)(swiper);
556
+ // Init Flag
557
+ swiper.initialized = true;
558
+ (0, process_lazy_preloader_1.preload)(swiper);
559
+ // Emit
560
+ swiper.emit('init');
561
+ swiper.emit('afterInit');
562
+ return swiper;
563
+ };
564
+ Swiper.prototype.destroy = function (deleteInstance, cleanStyles) {
565
+ if (deleteInstance === void 0) { deleteInstance = true; }
566
+ if (cleanStyles === void 0) { cleanStyles = true; }
567
+ var swiper = this;
568
+ var params = swiper.params, el = swiper.el, wrapperEl = swiper.wrapperEl, slides = swiper.slides;
569
+ if (typeof swiper.params === 'undefined' || swiper.destroyed) {
570
+ return null;
571
+ }
572
+ swiper.emit('beforeDestroy');
573
+ // Init Flag
574
+ swiper.initialized = false;
575
+ // Detach events
576
+ swiper.detachEvents();
577
+ // Destroy loop
578
+ if (params.loop) {
579
+ swiper.loopDestroy();
580
+ }
581
+ // Cleanup styles
582
+ if (cleanStyles) {
583
+ swiper.removeClasses();
584
+ if (el && typeof el !== 'string') {
585
+ el.removeAttribute('style');
586
+ }
587
+ if (wrapperEl) {
588
+ wrapperEl.removeAttribute('style');
589
+ }
590
+ if (slides && slides.length) {
591
+ slides.forEach(function (slideEl) {
592
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
593
+ slideEl.removeAttribute('style');
594
+ slideEl.removeAttribute('data-swiper-slide-index');
595
+ });
596
+ }
597
+ }
598
+ swiper.emit('destroy');
599
+ // Detach emitter events
600
+ Object.keys(swiper.eventsListeners).forEach(function (eventName) {
601
+ swiper.off(eventName);
602
+ });
603
+ if (deleteInstance !== false) {
604
+ if (swiper.el && typeof swiper.el !== 'string') {
605
+ swiper.el.swiper = null;
606
+ }
607
+ (0, utils_1.deleteProps)(swiper);
608
+ }
609
+ swiper.destroyed = true;
610
+ return null;
611
+ };
612
+ Swiper.extendDefaults = function (newDefaults) {
613
+ (0, utils_1.extend)(extendedDefaults, newDefaults);
614
+ };
615
+ Object.defineProperty(Swiper, "extendedDefaults", {
616
+ get: function () {
617
+ return extendedDefaults;
618
+ },
619
+ enumerable: false,
620
+ configurable: true
621
+ });
622
+ Object.defineProperty(Swiper, "defaults", {
623
+ get: function () {
624
+ return defaults_1.default;
625
+ },
626
+ enumerable: false,
627
+ configurable: true
628
+ });
629
+ Swiper.installModule = function (mod) {
630
+ if (!Swiper.prototype.__modules__)
631
+ Swiper.prototype.__modules__ = [];
632
+ var modules = Swiper.prototype.__modules__;
633
+ if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
634
+ modules.push(mod);
635
+ }
636
+ };
637
+ Swiper.use = function (module) {
638
+ if (Array.isArray(module)) {
639
+ module.forEach(function (m) { return Swiper.installModule(m); });
640
+ return Swiper;
641
+ }
642
+ Swiper.installModule(module);
643
+ return Swiper;
644
+ };
645
+ return Swiper;
646
+ }());
647
+ Object.keys(prototypes).forEach(function (prototypeGroup) {
648
+ Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {
649
+ Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
650
+ });
651
+ });
652
+ Swiper.use([resize_1.default, observer_1.default]);
653
+ exports.default = Swiper;
654
+ //# sourceMappingURL=core.js.map