@gem-sdk/swiper 0.0.20-dev.1 → 0.0.22-dev.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Swiper 0.0.20-dev.1
2
+ * Swiper 0.0.22-dev.1
3
3
  * Gem SDK - Swiper, Customized of swiper
4
4
  * https://swiperjs.com
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the MIT License
9
9
  *
10
- * Released on: April 6, 2026
10
+ * Released on: April 8, 2026
11
11
  */
12
12
 
13
13
  import{S as Swiper}from"./shared/swiper-core.min.mjs";import Virtual from"./modules/virtual.min.mjs";import Keyboard from"./modules/keyboard.min.mjs";import Mousewheel from"./modules/mousewheel.min.mjs";import Navigation from"./modules/navigation.min.mjs";import Pagination from"./modules/pagination.min.mjs";import Scrollbar from"./modules/scrollbar.min.mjs";import Parallax from"./modules/parallax.min.mjs";import Zoom from"./modules/zoom.min.mjs";import Controller from"./modules/controller.min.mjs";import A11y from"./modules/a11y.min.mjs";import History from"./modules/history.min.mjs";import HashNavigation from"./modules/hash-navigation.min.mjs";import Autoplay from"./modules/autoplay.min.mjs";import Thumb from"./modules/thumbs.min.mjs";import freeMode from"./modules/free-mode.min.mjs";import Grid from"./modules/grid.min.mjs";import Manipulation from"./modules/manipulation.min.mjs";import EffectFade from"./modules/effect-fade.min.mjs";import EffectCube from"./modules/effect-cube.min.mjs";import EffectFlip from"./modules/effect-flip.min.mjs";import EffectCoverflow from"./modules/effect-coverflow.min.mjs";import EffectCreative from"./modules/effect-creative.min.mjs";import EffectCards from"./modules/effect-cards.min.mjs";const modules=[Virtual,Keyboard,Mousewheel,Navigation,Pagination,Scrollbar,Parallax,Zoom,Controller,A11y,History,HashNavigation,Autoplay,Thumb,freeMode,Grid,Manipulation,EffectFade,EffectCube,EffectFlip,EffectCoverflow,EffectCreative,EffectCards];Swiper.use(modules);export{Swiper,Swiper as default};
package/swiper-bundle.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Swiper 0.0.20-dev.1
2
+ * Swiper 0.0.22-dev.1
3
3
  * Gem SDK - Swiper, Customized of swiper
4
4
  * https://swiperjs.com
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the MIT License
9
9
  *
10
- * Released on: April 6, 2026
10
+ * Released on: April 8, 2026
11
11
  */
12
12
 
13
13
  import { S as Swiper } from './shared/swiper-core.mjs';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Swiper 0.0.20-dev.1
2
+ * Swiper 0.0.22-dev.1
3
3
  * Gem SDK - Swiper, Customized of swiper
4
4
  * https://swiperjs.com
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the MIT License
9
9
  *
10
- * Released on: April 6, 2026
10
+ * Released on: April 8, 2026
11
11
  */
12
12
 
13
13
  export{c as createShadow}from"./shared/create-shadow.min.mjs";export{e as effectInit}from"./shared/effect-init.min.mjs";export{e as effectTarget}from"./shared/effect-target.min.mjs";export{e as effectVirtualTransitionEnd}from"./shared/effect-virtual-transition-end.min.mjs";export{g as getSlideTransformEl}from"./shared/utils.min.mjs";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Swiper 0.0.20-dev.1
2
+ * Swiper 0.0.22-dev.1
3
3
  * Gem SDK - Swiper, Customized of swiper
4
4
  * https://swiperjs.com
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the MIT License
9
9
  *
10
- * Released on: April 6, 2026
10
+ * Released on: April 8, 2026
11
11
  */
12
12
 
13
13
  export { c as createShadow } from './shared/create-shadow.mjs';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Swiper Custom Element 0.0.20-dev.1
2
+ * Swiper Custom Element 0.0.22-dev.1
3
3
  * Gem SDK - Swiper, Customized of swiper
4
4
  * https://swiperjs.com
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Released under the MIT License
9
9
  *
10
- * Released on: April 6, 2026
10
+ * Released on: April 8, 2026
11
11
  */
12
12
 
13
13
  (function () {
@@ -666,6 +666,12 @@
666
666
  const createObserver = () => {
667
667
  if (!swiper || swiper.destroyed || !swiper.initialized) return;
668
668
  observer = new ResizeObserver(entries => {
669
+ // Resize observer will triggered when it is attached and when the element is removed from DOM
670
+ // If element is added to the DOM, ignore this resize
671
+ if (!swiper.__addedToDOM__) {
672
+ swiper.__addedToDOM__ = true;
673
+ return;
674
+ }
669
675
  animationFrame = window.requestAnimationFrame(() => {
670
676
  const {
671
677
  width,
@@ -1674,7 +1680,21 @@
1674
1680
  }
1675
1681
 
1676
1682
  function maxTranslate() {
1677
- return -this.snapGrid[this.snapGrid.length - 1];
1683
+ const {
1684
+ params,
1685
+ snapGrid
1686
+ } = this;
1687
+ const physicalMax = -snapGrid[snapGrid.length - 1];
1688
+ if (!params?.centeredSlides || !params?.isSneakPeekCenter) {
1689
+ return physicalMax;
1690
+ }
1691
+
1692
+ // For sneak-peek centered mode in this project, the last snap is a trailing buffer.
1693
+ // Use penultimate snap as logical max to prevent extra end movement.
1694
+ if (snapGrid.length >= 2) {
1695
+ return -snapGrid[snapGrid.length - 2];
1696
+ }
1697
+ return physicalMax;
1678
1698
  }
1679
1699
 
1680
1700
  function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
@@ -3291,7 +3311,19 @@
3291
3311
  if (params.cssMode) return;
3292
3312
 
3293
3313
  // Find current slide
3294
- const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
3314
+ const logicalMaxTranslate = swiper.maxTranslate();
3315
+ const swipeToLast = currentPos >= -logicalMaxTranslate && !swiper.params.loop;
3316
+ let logicalLastStopIndex = slidesGrid.length - 1;
3317
+ if (params.centeredSlides && params.isSneakPeekCenter) {
3318
+ let slidesPerView = params.slidesPerView;
3319
+ if (slidesPerView === 'auto') {
3320
+ slidesPerView = swiper.slidesPerViewDynamic();
3321
+ } else {
3322
+ slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
3323
+ }
3324
+ slidesPerView = Math.max(slidesPerView, 1);
3325
+ logicalLastStopIndex = Math.max(slidesGrid.length - slidesPerView, 0);
3326
+ }
3295
3327
  let stopIndex = 0;
3296
3328
  let groupSize = swiper.slidesSizesGrid[0];
3297
3329
  for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
@@ -3306,6 +3338,11 @@
3306
3338
  groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
3307
3339
  }
3308
3340
  }
3341
+ if (swipeToLast && stopIndex > logicalLastStopIndex) {
3342
+ stopIndex = logicalLastStopIndex;
3343
+ const nextLogicalIndex = Math.min(logicalLastStopIndex + 1, slidesGrid.length - 1);
3344
+ groupSize = slidesGrid[nextLogicalIndex] - slidesGrid[logicalLastStopIndex] || groupSize;
3345
+ }
3309
3346
  let rewindFirstIndex = null;
3310
3347
  let rewindLastIndex = null;
3311
3348
  if (params.rewind) {
@@ -3817,12 +3854,11 @@
3817
3854
  isLocked: wasLocked,
3818
3855
  params
3819
3856
  } = swiper;
3820
- const {
3821
- slidesOffsetBefore
3822
- } = params;
3823
- if (slidesOffsetBefore) {
3857
+ const offsetBefore = params.slidesOffsetBefore || 0;
3858
+ const offsetAfter = params.slidesOffsetAfter || 0;
3859
+ if (offsetBefore > 0 || offsetAfter > 0) {
3824
3860
  const lastSlideIndex = swiper.slides.length - 1;
3825
- const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
3861
+ const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + offsetBefore + offsetAfter;
3826
3862
  swiper.isLocked = swiper.size > lastSlideRightEdge;
3827
3863
  } else {
3828
3864
  swiper.isLocked = swiper.snapGrid.length === 1;
@@ -4160,7 +4196,8 @@
4160
4196
  // Images
4161
4197
  imagesToLoad: [],
4162
4198
  imagesLoaded: 0,
4163
- rtl: params?.rtl
4199
+ rtl: params?.rtl,
4200
+ __addedToDOM__: false
4164
4201
  });
4165
4202
  swiper.emit('_swiper');
4166
4203
 
@@ -4481,6 +4518,9 @@
4481
4518
  const mounted = swiper.mount(el);
4482
4519
  if (mounted === false) return swiper;
4483
4520
  swiper.emit('beforeInit');
4521
+ console.log('Swiper pấm: ', {
4522
+ ...this.params
4523
+ });
4484
4524
  if (swiper.params.breakpoints) {
4485
4525
  swiper.setBreakpoint();
4486
4526
  }
@@ -4513,7 +4553,6 @@
4513
4553
  });
4514
4554
  preload(swiper);
4515
4555
  swiper.initialized = true;
4516
-
4517
4556
  // Emit
4518
4557
  swiper.emit('init');
4519
4558
  swiper.emit('afterInit');
@@ -4538,6 +4577,7 @@
4538
4577
  }
4539
4578
  swiper.emit('beforeDestroy');
4540
4579
  swiper.initialized = false;
4580
+ swiper.__addedToDOM__ = false;
4541
4581
  swiper.detachEvents();
4542
4582
  if (params.loop) {
4543
4583
  swiper.loopDestroy();
@@ -9989,7 +10029,7 @@
9989
10029
  }
9990
10030
 
9991
10031
  /**
9992
- * Swiper 0.0.20-dev.1
10032
+ * Swiper 0.0.22-dev.1
9993
10033
  * Gem SDK - Swiper, Customized of swiper
9994
10034
  * https://swiperjs.com
9995
10035
  *
@@ -9997,7 +10037,7 @@
9997
10037
  *
9998
10038
  * Released under the MIT License
9999
10039
  *
10000
- * Released on: April 6, 2026
10040
+ * Released on: April 8, 2026
10001
10041
  */
10002
10042
 
10003
10043
 
@@ -10331,7 +10371,7 @@
10331
10371
  }
10332
10372
 
10333
10373
  /**
10334
- * Swiper Custom Element 0.0.20-dev.1
10374
+ * Swiper Custom Element 0.0.22-dev.1
10335
10375
  * Gem SDK - Swiper, Customized of swiper
10336
10376
  * https://swiperjs.com
10337
10377
  *
@@ -10339,7 +10379,7 @@
10339
10379
  *
10340
10380
  * Released under the MIT License
10341
10381
  *
10342
- * Released on: April 6, 2026
10382
+ * Released on: April 8, 2026
10343
10383
  */
10344
10384
 
10345
10385