@itcase/ui 1.0.77 → 1.0.78

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.
@@ -175,6 +175,13 @@ function getWindow() {
175
175
  return win;
176
176
  }
177
177
 
178
+ function classesToTokens(classes) {
179
+ if (classes === void 0) {
180
+ classes = '';
181
+ }
182
+ return classes.trim().split(' ').filter(c => !!c.trim());
183
+ }
184
+
178
185
  function deleteProps(obj) {
179
186
  const object = obj;
180
187
  Object.keys(object).forEach(key => {
@@ -351,12 +358,20 @@ function elementChildren(element, selector) {
351
358
  }
352
359
  return [...element.children].filter(el => el.matches(selector));
353
360
  }
361
+ function showWarning(text) {
362
+ try {
363
+ console.warn(text);
364
+ return;
365
+ } catch (err) {
366
+ // err
367
+ }
368
+ }
354
369
  function createElement(tag, classes) {
355
370
  if (classes === void 0) {
356
371
  classes = [];
357
372
  }
358
373
  const el = document.createElement(tag);
359
- el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
374
+ el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
360
375
  return el;
361
376
  }
362
377
  function elementPrevAll(el, selector) {
@@ -795,24 +810,8 @@ function updateSize() {
795
810
 
796
811
  function updateSlides() {
797
812
  const swiper = this;
798
- function getDirectionLabel(property) {
799
- if (swiper.isHorizontal()) {
800
- return property;
801
- }
802
- // prettier-ignore
803
- return {
804
- 'width': 'height',
805
- 'margin-top': 'margin-left',
806
- 'margin-bottom ': 'margin-right',
807
- 'margin-left': 'margin-top',
808
- 'margin-right': 'margin-bottom',
809
- 'padding-left': 'padding-top',
810
- 'padding-right': 'padding-bottom',
811
- 'marginRight': 'marginBottom'
812
- }[property];
813
- }
814
813
  function getDirectionPropertyValue(node, label) {
815
- return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
814
+ return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
816
815
  }
817
816
  const params = swiper.params;
818
817
  const {
@@ -871,7 +870,9 @@ function updateSlides() {
871
870
  }
872
871
  const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
873
872
  if (gridEnabled) {
874
- swiper.grid.initSlides(slidesLength);
873
+ swiper.grid.initSlides(slides);
874
+ } else if (swiper.grid) {
875
+ swiper.grid.unsetSlides();
875
876
  }
876
877
 
877
878
  // Calc slides
@@ -884,13 +885,13 @@ function updateSlides() {
884
885
  let slide;
885
886
  if (slides[i]) slide = slides[i];
886
887
  if (gridEnabled) {
887
- swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
888
+ swiper.grid.updateSlide(i, slide, slides);
888
889
  }
889
890
  if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
890
891
 
891
892
  if (params.slidesPerView === 'auto') {
892
893
  if (shouldResetSlideSize) {
893
- slides[i].style[getDirectionLabel('width')] = ``;
894
+ slides[i].style[swiper.getDirectionLabel('width')] = ``;
894
895
  }
895
896
  const slideStyles = getComputedStyle(slide);
896
897
  const currentTransform = slide.style.transform;
@@ -932,7 +933,7 @@ function updateSlides() {
932
933
  slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
933
934
  if (params.roundLengths) slideSize = Math.floor(slideSize);
934
935
  if (slides[i]) {
935
- slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
936
+ slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
936
937
  }
937
938
  }
938
939
  if (slides[i]) {
@@ -962,10 +963,10 @@ function updateSlides() {
962
963
  wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
963
964
  }
964
965
  if (params.setWrapperSize) {
965
- wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
966
+ wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
966
967
  }
967
968
  if (gridEnabled) {
968
- swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
969
+ swiper.grid.updateWrapperSize(slideSize, snapGrid);
969
970
  }
970
971
 
971
972
  // Remove last grid elements depending on width
@@ -1002,7 +1003,7 @@ function updateSlides() {
1002
1003
  }
1003
1004
  if (snapGrid.length === 0) snapGrid = [0];
1004
1005
  if (spaceBetween !== 0) {
1005
- const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
1006
+ const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
1006
1007
  slides.filter((_, slideIndex) => {
1007
1008
  if (!params.cssMode || params.loop) return true;
1008
1009
  if (slideIndex === slides.length - 1) {
@@ -1154,7 +1155,7 @@ function updateSlidesProgress(translate) {
1154
1155
 
1155
1156
  // Visible Slides
1156
1157
  slides.forEach(slideEl => {
1157
- slideEl.classList.remove(params.slideVisibleClass);
1158
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass);
1158
1159
  });
1159
1160
  swiper.visibleSlidesIndexes = [];
1160
1161
  swiper.visibleSlides = [];
@@ -1174,12 +1175,16 @@ function updateSlidesProgress(translate) {
1174
1175
  const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
1175
1176
  const slideBefore = -(offsetCenter - slideOffset);
1176
1177
  const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
1178
+ const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
1177
1179
  const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
1178
1180
  if (isVisible) {
1179
1181
  swiper.visibleSlides.push(slide);
1180
1182
  swiper.visibleSlidesIndexes.push(i);
1181
1183
  slides[i].classList.add(params.slideVisibleClass);
1182
1184
  }
1185
+ if (isFullyVisible) {
1186
+ slides[i].classList.add(params.slideFullyVisibleClass);
1187
+ }
1183
1188
  slide.progress = rtl ? -slideProgress : slideProgress;
1184
1189
  slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
1185
1190
  }
@@ -1257,6 +1262,7 @@ function updateSlidesClasses() {
1257
1262
  activeIndex
1258
1263
  } = swiper;
1259
1264
  const isVirtual = swiper.virtual && params.virtual.enabled;
1265
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1260
1266
  const getFilteredSlide = selector => {
1261
1267
  return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
1262
1268
  };
@@ -1264,6 +1270,8 @@ function updateSlidesClasses() {
1264
1270
  slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
1265
1271
  });
1266
1272
  let activeSlide;
1273
+ let prevSlide;
1274
+ let nextSlide;
1267
1275
  if (isVirtual) {
1268
1276
  if (params.loop) {
1269
1277
  let slideIndex = activeIndex - swiper.virtual.slidesBefore;
@@ -1274,27 +1282,42 @@ function updateSlidesClasses() {
1274
1282
  activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
1275
1283
  }
1276
1284
  } else {
1277
- activeSlide = slides[activeIndex];
1285
+ if (gridEnabled) {
1286
+ activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
1287
+ nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
1288
+ prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
1289
+ } else {
1290
+ activeSlide = slides[activeIndex];
1291
+ }
1278
1292
  }
1279
1293
  if (activeSlide) {
1280
1294
  // Active classes
1281
1295
  activeSlide.classList.add(params.slideActiveClass);
1296
+ if (gridEnabled) {
1297
+ if (nextSlide) {
1298
+ nextSlide.classList.add(params.slideNextClass);
1299
+ }
1300
+ if (prevSlide) {
1301
+ prevSlide.classList.add(params.slidePrevClass);
1302
+ }
1303
+ } else {
1304
+ // Next Slide
1305
+ nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1306
+ if (params.loop && !nextSlide) {
1307
+ nextSlide = slides[0];
1308
+ }
1309
+ if (nextSlide) {
1310
+ nextSlide.classList.add(params.slideNextClass);
1311
+ }
1282
1312
 
1283
- // Next Slide
1284
- let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1285
- if (params.loop && !nextSlide) {
1286
- nextSlide = slides[0];
1287
- }
1288
- if (nextSlide) {
1289
- nextSlide.classList.add(params.slideNextClass);
1290
- }
1291
- // Prev Slide
1292
- let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1293
- if (params.loop && !prevSlide === 0) {
1294
- prevSlide = slides[slides.length - 1];
1295
- }
1296
- if (prevSlide) {
1297
- prevSlide.classList.add(params.slidePrevClass);
1313
+ // Prev Slide
1314
+ prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
1315
+ if (params.loop && !prevSlide === 0) {
1316
+ prevSlide = slides[slides.length - 1];
1317
+ }
1318
+ if (prevSlide) {
1319
+ prevSlide.classList.add(params.slidePrevClass);
1320
+ }
1298
1321
  }
1299
1322
  }
1300
1323
  swiper.emitSlidesClasses();
@@ -1419,22 +1442,37 @@ function updateActiveIndex(newActiveIndex) {
1419
1442
  snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
1420
1443
  }
1421
1444
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
1422
- if (activeIndex === previousIndex) {
1445
+ if (activeIndex === previousIndex && !swiper.params.loop) {
1423
1446
  if (snapIndex !== previousSnapIndex) {
1424
1447
  swiper.snapIndex = snapIndex;
1425
1448
  swiper.emit('snapIndexChange');
1426
1449
  }
1427
- if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
1428
- swiper.realIndex = getVirtualRealIndex(activeIndex);
1429
- }
1430
1450
  return;
1431
1451
  }
1452
+ if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
1453
+ swiper.realIndex = getVirtualRealIndex(activeIndex);
1454
+ return;
1455
+ }
1456
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
1457
+
1432
1458
  // Get real index
1433
1459
  let realIndex;
1434
1460
  if (swiper.virtual && params.virtual.enabled && params.loop) {
1435
1461
  realIndex = getVirtualRealIndex(activeIndex);
1462
+ } else if (gridEnabled) {
1463
+ const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
1464
+ let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
1465
+ if (Number.isNaN(activeSlideIndex)) {
1466
+ activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
1467
+ }
1468
+ realIndex = Math.floor(activeSlideIndex / params.grid.rows);
1436
1469
  } else if (swiper.slides[activeIndex]) {
1437
- realIndex = parseInt(swiper.slides[activeIndex].getAttribute('data-swiper-slide-index') || activeIndex, 10);
1470
+ const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
1471
+ if (slideIndex) {
1472
+ realIndex = parseInt(slideIndex, 10);
1473
+ } else {
1474
+ realIndex = activeIndex;
1475
+ }
1438
1476
  } else {
1439
1477
  realIndex = activeIndex;
1440
1478
  }
@@ -1928,16 +1966,58 @@ function slideToLoop(index, speed, runCallbacks, internal) {
1928
1966
  index = indexAsNumber;
1929
1967
  }
1930
1968
  const swiper = this;
1969
+ const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
1931
1970
  let newIndex = index;
1932
1971
  if (swiper.params.loop) {
1933
1972
  if (swiper.virtual && swiper.params.virtual.enabled) {
1934
1973
  // eslint-disable-next-line
1935
1974
  newIndex = newIndex + swiper.virtual.slidesBefore;
1936
1975
  } else {
1937
- newIndex = swiper.getSlideIndexByData(newIndex);
1976
+ let targetSlideIndex;
1977
+ if (gridEnabled) {
1978
+ const slideIndex = newIndex * swiper.params.grid.rows;
1979
+ targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
1980
+ } else {
1981
+ targetSlideIndex = swiper.getSlideIndexByData(newIndex);
1982
+ }
1983
+ const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
1984
+ const {
1985
+ centeredSlides
1986
+ } = swiper.params;
1987
+ let slidesPerView = swiper.params.slidesPerView;
1988
+ if (slidesPerView === 'auto') {
1989
+ slidesPerView = swiper.slidesPerViewDynamic();
1990
+ } else {
1991
+ slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
1992
+ if (centeredSlides && slidesPerView % 2 === 0) {
1993
+ slidesPerView = slidesPerView + 1;
1994
+ }
1995
+ }
1996
+ let needLoopFix = cols - targetSlideIndex < slidesPerView;
1997
+ if (centeredSlides) {
1998
+ needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
1999
+ }
2000
+ if (needLoopFix) {
2001
+ const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
2002
+ swiper.loopFix({
2003
+ direction,
2004
+ slideTo: true,
2005
+ activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
2006
+ slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
2007
+ });
2008
+ }
2009
+ if (gridEnabled) {
2010
+ const slideIndex = newIndex * swiper.params.grid.rows;
2011
+ newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
2012
+ } else {
2013
+ newIndex = swiper.getSlideIndexByData(newIndex);
2014
+ }
1938
2015
  }
1939
2016
  }
1940
- return swiper.slideTo(newIndex, speed, runCallbacks, internal);
2017
+ requestAnimationFrame(() => {
2018
+ swiper.slideTo(newIndex, speed, runCallbacks, internal);
2019
+ });
2020
+ return swiper;
1941
2021
  }
1942
2022
 
1943
2023
  /* eslint no-unused-vars: "off" */
@@ -2153,10 +2233,45 @@ function loopCreate(slideRealIndex) {
2153
2233
  slidesEl
2154
2234
  } = swiper;
2155
2235
  if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
2156
- const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
2157
- slides.forEach((el, index) => {
2158
- el.setAttribute('data-swiper-slide-index', index);
2159
- });
2236
+ const initSlides = () => {
2237
+ const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
2238
+ slides.forEach((el, index) => {
2239
+ el.setAttribute('data-swiper-slide-index', index);
2240
+ });
2241
+ };
2242
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2243
+ const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
2244
+ const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
2245
+ const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
2246
+ const addBlankSlides = amountOfSlides => {
2247
+ for (let i = 0; i < amountOfSlides; i += 1) {
2248
+ const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
2249
+ swiper.slidesEl.append(slideEl);
2250
+ }
2251
+ };
2252
+ if (shouldFillGroup) {
2253
+ if (params.loopAddBlankSlides) {
2254
+ const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
2255
+ addBlankSlides(slidesToAdd);
2256
+ swiper.recalcSlides();
2257
+ swiper.updateSlides();
2258
+ } else {
2259
+ showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
2260
+ }
2261
+ initSlides();
2262
+ } else if (shouldFillGrid) {
2263
+ if (params.loopAddBlankSlides) {
2264
+ const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
2265
+ addBlankSlides(slidesToAdd);
2266
+ swiper.recalcSlides();
2267
+ swiper.updateSlides();
2268
+ } else {
2269
+ showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
2270
+ }
2271
+ initSlides();
2272
+ } else {
2273
+ initSlides();
2274
+ }
2160
2275
  swiper.loopFix({
2161
2276
  slideRealIndex,
2162
2277
  direction: params.centeredSlides ? undefined : 'next'
@@ -2183,6 +2298,9 @@ function loopFix(_temp) {
2183
2298
  slidesEl,
2184
2299
  params
2185
2300
  } = swiper;
2301
+ const {
2302
+ centeredSlides
2303
+ } = params;
2186
2304
  swiper.allowSlidePrev = true;
2187
2305
  swiper.allowSlideNext = true;
2188
2306
  if (swiper.virtual && params.virtual.enabled) {
@@ -2200,17 +2318,33 @@ function loopFix(_temp) {
2200
2318
  swiper.emit('loopFix');
2201
2319
  return;
2202
2320
  }
2203
- const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
2204
- let loopedSlides = params.loopedSlides || slidesPerView;
2205
- if (loopedSlides % params.slidesPerGroup !== 0) {
2206
- loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;
2321
+ let slidesPerView = params.slidesPerView;
2322
+ if (slidesPerView === 'auto') {
2323
+ slidesPerView = swiper.slidesPerViewDynamic();
2324
+ } else {
2325
+ slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
2326
+ if (centeredSlides && slidesPerView % 2 === 0) {
2327
+ slidesPerView = slidesPerView + 1;
2328
+ }
2207
2329
  }
2330
+ const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
2331
+ let loopedSlides = slidesPerGroup;
2332
+ if (loopedSlides % slidesPerGroup !== 0) {
2333
+ loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
2334
+ }
2335
+ loopedSlides += params.loopAdditionalSlides;
2208
2336
  swiper.loopedSlides = loopedSlides;
2337
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2338
+ if (slides.length < slidesPerView + loopedSlides) {
2339
+ showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
2340
+ } else if (gridEnabled && params.grid.fill === 'row') {
2341
+ showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
2342
+ }
2209
2343
  const prependSlidesIndexes = [];
2210
2344
  const appendSlidesIndexes = [];
2211
2345
  let activeIndex = swiper.activeIndex;
2212
2346
  if (typeof activeSlideIndex === 'undefined') {
2213
- activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
2347
+ activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
2214
2348
  } else {
2215
2349
  activeIndex = activeSlideIndex;
2216
2350
  }
@@ -2218,37 +2352,60 @@ function loopFix(_temp) {
2218
2352
  const isPrev = direction === 'prev' || !direction;
2219
2353
  let slidesPrepended = 0;
2220
2354
  let slidesAppended = 0;
2355
+ const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
2356
+ const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
2357
+ const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
2221
2358
  // prepend last slides before start
2222
- if (activeSlideIndex < loopedSlides) {
2223
- slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);
2224
- for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {
2225
- const index = i - Math.floor(i / slides.length) * slides.length;
2226
- prependSlidesIndexes.push(slides.length - index - 1);
2227
- }
2228
- } else if (activeSlideIndex /* + slidesPerView */ > swiper.slides.length - loopedSlides * 2) {
2229
- slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);
2359
+ if (activeColIndexWithShift < loopedSlides) {
2360
+ slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
2361
+ for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
2362
+ const index = i - Math.floor(i / cols) * cols;
2363
+ if (gridEnabled) {
2364
+ const colIndexToPrepend = cols - index - 1;
2365
+ for (let i = slides.length - 1; i >= 0; i -= 1) {
2366
+ if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
2367
+ }
2368
+ // slides.forEach((slide, slideIndex) => {
2369
+ // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
2370
+ // });
2371
+ } else {
2372
+ prependSlidesIndexes.push(cols - index - 1);
2373
+ }
2374
+ }
2375
+ } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
2376
+ slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
2230
2377
  for (let i = 0; i < slidesAppended; i += 1) {
2231
- const index = i - Math.floor(i / slides.length) * slides.length;
2232
- appendSlidesIndexes.push(index);
2378
+ const index = i - Math.floor(i / cols) * cols;
2379
+ if (gridEnabled) {
2380
+ slides.forEach((slide, slideIndex) => {
2381
+ if (slide.column === index) appendSlidesIndexes.push(slideIndex);
2382
+ });
2383
+ } else {
2384
+ appendSlidesIndexes.push(index);
2385
+ }
2233
2386
  }
2234
2387
  }
2235
2388
  if (isPrev) {
2236
2389
  prependSlidesIndexes.forEach(index => {
2237
- swiper.slides[index].swiperLoopMoveDOM = true;
2238
- slidesEl.prepend(swiper.slides[index]);
2239
- swiper.slides[index].swiperLoopMoveDOM = false;
2390
+ slides[index].swiperLoopMoveDOM = true;
2391
+ slidesEl.prepend(slides[index]);
2392
+ slides[index].swiperLoopMoveDOM = false;
2240
2393
  });
2241
2394
  }
2242
2395
  if (isNext) {
2243
2396
  appendSlidesIndexes.forEach(index => {
2244
- swiper.slides[index].swiperLoopMoveDOM = true;
2245
- slidesEl.append(swiper.slides[index]);
2246
- swiper.slides[index].swiperLoopMoveDOM = false;
2397
+ slides[index].swiperLoopMoveDOM = true;
2398
+ slidesEl.append(slides[index]);
2399
+ slides[index].swiperLoopMoveDOM = false;
2247
2400
  });
2248
2401
  }
2249
2402
  swiper.recalcSlides();
2250
2403
  if (params.slidesPerView === 'auto') {
2251
2404
  swiper.updateSlides();
2405
+ } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
2406
+ swiper.slides.forEach((slide, slideIndex) => {
2407
+ swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
2408
+ });
2252
2409
  }
2253
2410
  if (params.watchSlidesProgress) {
2254
2411
  swiper.updateSlidesOffset();
@@ -2264,13 +2421,14 @@ function loopFix(_temp) {
2264
2421
  } else {
2265
2422
  swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
2266
2423
  if (setTranslate) {
2267
- swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
2268
- swiper.touchEventsData.currentTranslate = swiper.translate;
2424
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2425
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2269
2426
  }
2270
2427
  }
2271
2428
  } else {
2272
2429
  if (setTranslate) {
2273
- swiper.slideToLoop(slideRealIndex, 0, false, true);
2430
+ const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
2431
+ swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
2274
2432
  swiper.touchEventsData.currentTranslate = swiper.translate;
2275
2433
  }
2276
2434
  }
@@ -2284,12 +2442,13 @@ function loopFix(_temp) {
2284
2442
  } else {
2285
2443
  swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
2286
2444
  if (setTranslate) {
2287
- swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
2288
- swiper.touchEventsData.currentTranslate = swiper.translate;
2445
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
2446
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
2289
2447
  }
2290
2448
  }
2291
2449
  } else {
2292
- swiper.slideToLoop(slideRealIndex, 0, false, true);
2450
+ const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
2451
+ swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
2293
2452
  }
2294
2453
  }
2295
2454
  }
@@ -2402,27 +2561,54 @@ function closestElement(selector, base) {
2402
2561
  }
2403
2562
  return __closestFrom(base);
2404
2563
  }
2564
+ function preventEdgeSwipe(swiper, event, startX) {
2565
+ const window = getWindow();
2566
+ const {
2567
+ params
2568
+ } = swiper;
2569
+ const edgeSwipeDetection = params.edgeSwipeDetection;
2570
+ const edgeSwipeThreshold = params.edgeSwipeThreshold;
2571
+ if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
2572
+ if (edgeSwipeDetection === 'prevent') {
2573
+ event.preventDefault();
2574
+ return true;
2575
+ }
2576
+ return false;
2577
+ }
2578
+ return true;
2579
+ }
2405
2580
  function onTouchStart(event) {
2406
2581
  const swiper = this;
2407
2582
  const document = getDocument();
2408
- const window = getWindow();
2583
+ let e = event;
2584
+ if (e.originalEvent) e = e.originalEvent;
2409
2585
  const data = swiper.touchEventsData;
2410
- data.evCache.push(event);
2586
+ if (e.type === 'pointerdown') {
2587
+ if (data.pointerId !== null && data.pointerId !== e.pointerId) {
2588
+ return;
2589
+ }
2590
+ data.pointerId = e.pointerId;
2591
+ } else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
2592
+ data.touchId = e.targetTouches[0].identifier;
2593
+ }
2594
+ if (e.type === 'touchstart') {
2595
+ // don't proceed touch event
2596
+ preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
2597
+ return;
2598
+ }
2411
2599
  const {
2412
2600
  params,
2413
2601
  touches,
2414
2602
  enabled
2415
2603
  } = swiper;
2416
2604
  if (!enabled) return;
2417
- if (!params.simulateTouch && event.pointerType === 'mouse') return;
2605
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
2418
2606
  if (swiper.animating && params.preventInteractionOnTransition) {
2419
2607
  return;
2420
2608
  }
2421
2609
  if (!swiper.animating && params.cssMode && params.loop) {
2422
2610
  swiper.loopFix();
2423
2611
  }
2424
- let e = event;
2425
- if (e.originalEvent) e = e.originalEvent;
2426
2612
  let targetEl = e.target;
2427
2613
  if (params.touchEventsTarget === 'wrapper') {
2428
2614
  if (!swiper.wrapperEl.contains(targetEl)) return;
@@ -2434,7 +2620,7 @@ function onTouchStart(event) {
2434
2620
  // change target el for shadow root component
2435
2621
  const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
2436
2622
  // eslint-disable-next-line
2437
- const eventPath = event.composedPath ? event.composedPath() : event.path;
2623
+ const eventPath = e.composedPath ? e.composedPath() : e.path;
2438
2624
  if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
2439
2625
  targetEl = eventPath[0];
2440
2626
  }
@@ -2456,14 +2642,8 @@ function onTouchStart(event) {
2456
2642
 
2457
2643
  // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
2458
2644
 
2459
- const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
2460
- const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
2461
- if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
2462
- if (edgeSwipeDetection === 'prevent') {
2463
- event.preventDefault();
2464
- } else {
2465
- return;
2466
- }
2645
+ if (!preventEdgeSwipe(swiper, e, startX)) {
2646
+ return;
2467
2647
  }
2468
2648
  Object.assign(data, {
2469
2649
  isTouched: true,
@@ -2513,15 +2693,24 @@ function onTouchMove(event) {
2513
2693
  if (!params.simulateTouch && event.pointerType === 'mouse') return;
2514
2694
  let e = event;
2515
2695
  if (e.originalEvent) e = e.originalEvent;
2696
+ if (e.type === 'pointermove') {
2697
+ if (data.touchId !== null) return; // return from pointer if we use touch
2698
+ const id = e.pointerId;
2699
+ if (id !== data.pointerId) return;
2700
+ }
2701
+ let targetTouch;
2702
+ if (e.type === 'touchmove') {
2703
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
2704
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2705
+ } else {
2706
+ targetTouch = e;
2707
+ }
2516
2708
  if (!data.isTouched) {
2517
2709
  if (data.startMoving && data.isScrolling) {
2518
2710
  swiper.emit('touchMoveOpposite', e);
2519
2711
  }
2520
2712
  return;
2521
2713
  }
2522
- const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
2523
- if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
2524
- const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
2525
2714
  const pageX = targetTouch.pageX;
2526
2715
  const pageY = targetTouch.pageY;
2527
2716
  if (e.preventedByNestedSwiper) {
@@ -2537,8 +2726,6 @@ function onTouchMove(event) {
2537
2726
  Object.assign(touches, {
2538
2727
  startX: pageX,
2539
2728
  startY: pageY,
2540
- prevX: swiper.touches.currentX,
2541
- prevY: swiper.touches.currentY,
2542
2729
  currentX: pageX,
2543
2730
  currentY: pageY
2544
2731
  });
@@ -2568,7 +2755,8 @@ function onTouchMove(event) {
2568
2755
  if (data.allowTouchCallbacks) {
2569
2756
  swiper.emit('touchMove', e);
2570
2757
  }
2571
- if (e.targetTouches && e.targetTouches.length > 1) return;
2758
+ touches.previousX = touches.currentX;
2759
+ touches.previousY = touches.currentY;
2572
2760
  touches.currentX = pageX;
2573
2761
  touches.currentY = pageY;
2574
2762
  const diffX = touches.currentX - touches.startX;
@@ -2594,7 +2782,7 @@ function onTouchMove(event) {
2594
2782
  data.startMoving = true;
2595
2783
  }
2596
2784
  }
2597
- if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {
2785
+ if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled) {
2598
2786
  data.isTouched = false;
2599
2787
  return;
2600
2788
  }
@@ -2624,7 +2812,7 @@ function onTouchMove(event) {
2624
2812
  swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
2625
2813
  swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
2626
2814
  const isLoop = swiper.params.loop && !params.cssMode;
2627
- const allowLoopFix = swiper.swipeDirection === 'next' && swiper.allowSlideNext || swiper.swipeDirection === 'prev' && swiper.allowSlidePrev;
2815
+ const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
2628
2816
  if (!data.isMoved) {
2629
2817
  if (isLoop && allowLoopFix) {
2630
2818
  swiper.loopFix({
@@ -2648,13 +2836,18 @@ function onTouchMove(event) {
2648
2836
  swiper.emit('sliderFirstMove', e);
2649
2837
  }
2650
2838
  let loopFixed;
2651
- if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
2652
- // need another loop fix
2653
- swiper.loopFix({
2654
- direction: swiper.swipeDirection,
2655
- setTranslate: true
2839
+ new Date().getTime();
2840
+ if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
2841
+ Object.assign(touches, {
2842
+ startX: pageX,
2843
+ startY: pageY,
2844
+ currentX: pageX,
2845
+ currentY: pageY,
2846
+ startTranslate: data.currentTranslate
2656
2847
  });
2657
- loopFixed = true;
2848
+ data.loopSwapReset = true;
2849
+ data.startTranslate = data.currentTranslate;
2850
+ return;
2658
2851
  }
2659
2852
  swiper.emit('sliderMove', e);
2660
2853
  data.isMoved = true;
@@ -2665,7 +2858,7 @@ function onTouchMove(event) {
2665
2858
  resistanceRatio = 0;
2666
2859
  }
2667
2860
  if (diff > 0) {
2668
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {
2861
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {
2669
2862
  swiper.loopFix({
2670
2863
  direction: 'prev',
2671
2864
  setTranslate: true,
@@ -2679,7 +2872,7 @@ function onTouchMove(event) {
2679
2872
  }
2680
2873
  }
2681
2874
  } else if (diff < 0) {
2682
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {
2875
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {
2683
2876
  swiper.loopFix({
2684
2877
  direction: 'next',
2685
2878
  setTranslate: true,
@@ -2743,16 +2936,26 @@ function onTouchMove(event) {
2743
2936
  function onTouchEnd(event) {
2744
2937
  const swiper = this;
2745
2938
  const data = swiper.touchEventsData;
2746
- const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
2747
- if (pointerIndex >= 0) {
2748
- data.evCache.splice(pointerIndex, 1);
2939
+ let e = event;
2940
+ if (e.originalEvent) e = e.originalEvent;
2941
+ let targetTouch;
2942
+ const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
2943
+ if (!isTouchEvent) {
2944
+ if (data.touchId !== null) return; // return from pointer if we use touch
2945
+ if (e.pointerId !== data.pointerId) return;
2946
+ targetTouch = e;
2947
+ } else {
2948
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
2949
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
2749
2950
  }
2750
- if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(event.type)) {
2751
- const proceed = ['pointercancel', 'contextmenu'].includes(event.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
2951
+ if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
2952
+ const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
2752
2953
  if (!proceed) {
2753
2954
  return;
2754
2955
  }
2755
2956
  }
2957
+ data.pointerId = null;
2958
+ data.touchId = null;
2756
2959
  const {
2757
2960
  params,
2758
2961
  touches,
@@ -2761,9 +2964,7 @@ function onTouchEnd(event) {
2761
2964
  enabled
2762
2965
  } = swiper;
2763
2966
  if (!enabled) return;
2764
- if (!params.simulateTouch && event.pointerType === 'mouse') return;
2765
- let e = event;
2766
- if (e.originalEvent) e = e.originalEvent;
2967
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
2767
2968
  if (data.allowTouchCallbacks) {
2768
2969
  swiper.emit('touchEnd', e);
2769
2970
  }
@@ -2776,6 +2977,7 @@ function onTouchEnd(event) {
2776
2977
  data.startMoving = false;
2777
2978
  return;
2778
2979
  }
2980
+
2779
2981
  // Return Grab Cursor
2780
2982
  if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
2781
2983
  swiper.setGrabCursor(false);
@@ -2798,7 +3000,7 @@ function onTouchEnd(event) {
2798
3000
  nextTick(() => {
2799
3001
  if (!swiper.destroyed) swiper.allowClick = true;
2800
3002
  });
2801
- if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
3003
+ if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
2802
3004
  data.isTouched = false;
2803
3005
  data.isMoved = false;
2804
3006
  data.startMoving = false;
@@ -2995,8 +3197,15 @@ function onLoad(e) {
2995
3197
  swiper.update();
2996
3198
  }
2997
3199
 
2998
- let dummyEventAttached = false;
2999
- function dummyEventListener() {}
3200
+ function onDocumentTouchStart() {
3201
+ const swiper = this;
3202
+ if (swiper.documentTouchHandlerProceeded) return;
3203
+ swiper.documentTouchHandlerProceeded = true;
3204
+ if (swiper.params.touchReleaseOnEdges) {
3205
+ swiper.el.style.touchAction = 'auto';
3206
+ }
3207
+ }
3208
+
3000
3209
  const events = (swiper, method) => {
3001
3210
  const document = getDocument();
3002
3211
  const {
@@ -3010,19 +3219,36 @@ const events = (swiper, method) => {
3010
3219
  const swiperMethod = method;
3011
3220
 
3012
3221
  // Touch Events
3222
+ document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
3223
+ passive: false,
3224
+ capture
3225
+ });
3226
+ el[domMethod]('touchstart', swiper.onTouchStart, {
3227
+ passive: false
3228
+ });
3013
3229
  el[domMethod]('pointerdown', swiper.onTouchStart, {
3014
3230
  passive: false
3015
3231
  });
3232
+ document[domMethod]('touchmove', swiper.onTouchMove, {
3233
+ passive: false,
3234
+ capture
3235
+ });
3016
3236
  document[domMethod]('pointermove', swiper.onTouchMove, {
3017
3237
  passive: false,
3018
3238
  capture
3019
3239
  });
3240
+ document[domMethod]('touchend', swiper.onTouchEnd, {
3241
+ passive: true
3242
+ });
3020
3243
  document[domMethod]('pointerup', swiper.onTouchEnd, {
3021
3244
  passive: true
3022
3245
  });
3023
3246
  document[domMethod]('pointercancel', swiper.onTouchEnd, {
3024
3247
  passive: true
3025
3248
  });
3249
+ document[domMethod]('touchcancel', swiper.onTouchEnd, {
3250
+ passive: true
3251
+ });
3026
3252
  document[domMethod]('pointerout', swiper.onTouchEnd, {
3027
3253
  passive: true
3028
3254
  });
@@ -3055,22 +3281,18 @@ const events = (swiper, method) => {
3055
3281
  };
3056
3282
  function attachEvents() {
3057
3283
  const swiper = this;
3058
- const document = getDocument();
3059
3284
  const {
3060
3285
  params
3061
3286
  } = swiper;
3062
3287
  swiper.onTouchStart = onTouchStart.bind(swiper);
3063
3288
  swiper.onTouchMove = onTouchMove.bind(swiper);
3064
3289
  swiper.onTouchEnd = onTouchEnd.bind(swiper);
3290
+ swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
3065
3291
  if (params.cssMode) {
3066
3292
  swiper.onScroll = onScroll.bind(swiper);
3067
3293
  }
3068
3294
  swiper.onClick = onClick.bind(swiper);
3069
3295
  swiper.onLoad = onLoad.bind(swiper);
3070
- if (!dummyEventAttached) {
3071
- document.addEventListener('touchstart', dummyEventListener);
3072
- dummyEventAttached = true;
3073
- }
3074
3296
  events(swiper, 'on');
3075
3297
  }
3076
3298
  function detachEvents() {
@@ -3318,6 +3540,7 @@ var defaults = {
3318
3540
  resizeObserver: true,
3319
3541
  nested: false,
3320
3542
  createElements: false,
3543
+ eventsPrefix: 'swiper',
3321
3544
  enabled: true,
3322
3545
  focusableElements: 'input, select, option, textarea, button, video, label',
3323
3546
  // Overrides
@@ -3392,7 +3615,8 @@ var defaults = {
3392
3615
  slideToClickedSlide: false,
3393
3616
  // loop
3394
3617
  loop: false,
3395
- loopedSlides: null,
3618
+ loopAddBlankSlides: true,
3619
+ loopAdditionalSlides: 0,
3396
3620
  loopPreventsSliding: true,
3397
3621
  // rewind
3398
3622
  rewind: false,
@@ -3411,8 +3635,10 @@ var defaults = {
3411
3635
  containerModifierClass: 'swiper-',
3412
3636
  // NEW
3413
3637
  slideClass: 'swiper-slide',
3638
+ slideBlankClass: 'swiper-slide-blank',
3414
3639
  slideActiveClass: 'swiper-slide-active',
3415
3640
  slideVisibleClass: 'swiper-slide-visible',
3641
+ slideFullyVisibleClass: 'swiper-slide-fully-visible',
3416
3642
  slideNextClass: 'swiper-slide-next',
3417
3643
  slidePrevClass: 'swiper-slide-prev',
3418
3644
  wrapperClass: 'swiper-wrapper',
@@ -3605,7 +3831,8 @@ let Swiper$2 = class Swiper {
3605
3831
  velocities: [],
3606
3832
  allowMomentumBounce: undefined,
3607
3833
  startMoving: undefined,
3608
- evCache: []
3834
+ pointerId: null,
3835
+ touchId: null
3609
3836
  },
3610
3837
  // Clicks
3611
3838
  allowClick: true,
@@ -3633,6 +3860,22 @@ let Swiper$2 = class Swiper {
3633
3860
  // eslint-disable-next-line no-constructor-return
3634
3861
  return swiper;
3635
3862
  }
3863
+ getDirectionLabel(property) {
3864
+ if (this.isHorizontal()) {
3865
+ return property;
3866
+ }
3867
+ // prettier-ignore
3868
+ return {
3869
+ 'width': 'height',
3870
+ 'margin-top': 'margin-left',
3871
+ 'margin-bottom ': 'margin-right',
3872
+ 'margin-left': 'margin-top',
3873
+ 'margin-right': 'margin-bottom',
3874
+ 'padding-left': 'padding-top',
3875
+ 'padding-right': 'padding-bottom',
3876
+ 'marginRight': 'marginBottom'
3877
+ }[property];
3878
+ }
3636
3879
  getSlideIndex(slideEl) {
3637
3880
  const {
3638
3881
  slidesEl,
@@ -4010,7 +4253,7 @@ let Swiper$2 = class Swiper {
4010
4253
  wrapperEl.removeAttribute('style');
4011
4254
  if (slides && slides.length) {
4012
4255
  slides.forEach(slideEl => {
4013
- slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
4256
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
4014
4257
  slideEl.removeAttribute('style');
4015
4258
  slideEl.removeAttribute('data-swiper-slide-index');
4016
4259
  });
@@ -4062,7 +4305,7 @@ Object.keys(prototypes).forEach(prototypeGroup => {
4062
4305
  Swiper$2.use([Resize, Observer]);
4063
4306
 
4064
4307
  /* underscore in name -> watch for changes */
4065
- const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopedSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideNextClass', 'slidePrevClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
4308
+ const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopAdditionalSlides', 'loopAddBlankSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideFullyVisibleClass', 'slideNextClass', 'slidePrevClass', 'slideBlankClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
4066
4309
  // modules
4067
4310
  'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];
4068
4311
 
@@ -4191,7 +4434,7 @@ function updateSwiper(_ref) {
4191
4434
  }
4192
4435
  updateParams.forEach(key => {
4193
4436
  if (isObject(currentParams[key]) && isObject(passedParams[key])) {
4194
- extend(currentParams[key], passedParams[key]);
4437
+ Object.assign(currentParams[key], passedParams[key]);
4195
4438
  if ((key === 'navigation' || key === 'pagination' || key === 'scrollbar') && 'enabled' in passedParams[key] && !passedParams[key].enabled) {
4196
4439
  destroyModule(key);
4197
4440
  }
@@ -4212,6 +4455,9 @@ function updateSwiper(_ref) {
4212
4455
  if (changedParams.includes('children') && slides && virtual && currentParams.virtual.enabled) {
4213
4456
  virtual.slides = slides;
4214
4457
  virtual.update(true);
4458
+ } else if (changedParams.includes('virtual') && virtual && currentParams.virtual.enabled) {
4459
+ if (slides) virtual.slides = slides;
4460
+ virtual.update(true);
4215
4461
  }
4216
4462
  if (changedParams.includes('children') && slides && currentParams.loop) {
4217
4463
  loopNeedReloop = true;
@@ -4414,7 +4660,7 @@ const updateOnVirtualData = swiper => {
4414
4660
  };
4415
4661
 
4416
4662
  /**
4417
- * Swiper React 10.3.1
4663
+ * Swiper React 11.0.2
4418
4664
  * Most modern mobile touch slider and framework with hardware accelerated transitions
4419
4665
  * https://swiperjs.com
4420
4666
  *
@@ -4422,7 +4668,7 @@ const updateOnVirtualData = swiper => {
4422
4668
  *
4423
4669
  * Released under the MIT License
4424
4670
  *
4425
- * Released on: September 28, 2023
4671
+ * Released on: October 25, 2023
4426
4672
  */
4427
4673
 
4428
4674