@covet-pics/covet-pics-widget 0.176.1 → 0.176.2

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 (142) hide show
  1. package/dist/cjs/{a11y-DFTngZna.js → a11y-Drre73Gf.js} +249 -277
  2. package/dist/cjs/{app-globals-eqDkvgYO.js → app-globals-Ds5XaOob.js} +2 -1
  3. package/dist/cjs/covet-pics-checkbox_9.cjs.entry.js +40 -38
  4. package/dist/cjs/covet-pics-crop-text.cjs.entry.js +5 -5
  5. package/dist/cjs/covet-pics-gallery-grid_7.cjs.entry.js +106 -130
  6. package/dist/cjs/covet-pics-gallery-header_3.cjs.entry.js +19 -15
  7. package/dist/cjs/covet-pics-highlighted-hotspots_2.cjs.entry.js +35 -29
  8. package/dist/cjs/covet-pics-popup-freeflow-carousel_3.cjs.entry.js +25 -17
  9. package/dist/cjs/covet-pics-post.cjs.entry.js +4 -4
  10. package/dist/cjs/covet-pics-star-rating.cjs.entry.js +5 -5
  11. package/dist/cjs/covet-pics-widget.cjs.entry.js +14 -510
  12. package/dist/cjs/covet-pics-widget.cjs.js +4 -4
  13. package/dist/cjs/funcComponents-B-lyUd46.js +198 -0
  14. package/dist/cjs/{getters-CyBn8UrZ.js → getters-QyYi8Ngl.js} +2 -2
  15. package/dist/cjs/{index-C5a8iHmi.js → index-CG_KRDPc.js} +478 -310
  16. package/dist/cjs/{items-3V7r4_YT.js → items-BLw2Ww63.js} +1 -1
  17. package/dist/cjs/loader.cjs.js +3 -3
  18. package/dist/cjs/{navigation-XeIeQQXp.js → navigation-DrZal_Fg.js} +17 -9
  19. package/dist/cjs/{popup-BgupOeY7.js → popup-BAyUo7oR.js} +358 -186
  20. package/dist/cjs/{popupFuncComponents-Bt--NSom.js → popupFuncComponents-BbjlT9qN.js} +2 -2
  21. package/dist/cjs/{shopcart-DyUcCct4.js → shopcart-CY9qbEzl.js} +10 -10
  22. package/dist/cjs/{slider-DuFctxkr.js → slider-DCHuxpro.js} +1 -1
  23. package/dist/cjs/{sort-DzLm-x1V.js → sort-DkopdmhF.js} +1 -1
  24. package/dist/cjs/{utils-DVZVIghB.js → utils-CkIicOF2.js} +4 -4
  25. package/dist/collection/collection-manifest.json +3 -2
  26. package/dist/collection/components/covet-pics-checkbox/covet-pics-checkbox.js +8 -8
  27. package/dist/collection/components/covet-pics-crop-text/covet-pics-crop-text.js +4 -5
  28. package/dist/collection/components/covet-pics-direct-buy/covet-pics-direct-buy.css +127 -95
  29. package/dist/collection/components/covet-pics-direct-buy/covet-pics-direct-buy.js +11 -11
  30. package/dist/collection/components/covet-pics-direct-buy/test/test-data.js +1 -1
  31. package/dist/collection/components/covet-pics-gallery-grid/covet-pics-gallery-grid.js +7 -9
  32. package/dist/collection/components/covet-pics-gallery-header/covet-pics-gallery-header.js +5 -6
  33. package/dist/collection/components/covet-pics-gallery-item/covet-pics-gallery-item.css +3 -1
  34. package/dist/collection/components/covet-pics-gallery-item/covet-pics-gallery-item.js +29 -30
  35. package/dist/collection/components/covet-pics-gallery-item-detail/covet-pics-gallery-item-detail.css +17 -13
  36. package/dist/collection/components/covet-pics-gallery-item-detail/covet-pics-gallery-item-detail.js +27 -28
  37. package/dist/collection/components/covet-pics-gallery-slider/covet-pics-gallery-slider.css +386 -307
  38. package/dist/collection/components/covet-pics-gallery-slider/covet-pics-gallery-slider.js +11 -11
  39. package/dist/collection/components/covet-pics-highlighted/covet-pics-highlighted-hotspots.js +14 -15
  40. package/dist/collection/components/covet-pics-highlighted/covet-pics-highlighted-page.js +31 -33
  41. package/dist/collection/components/covet-pics-highlighted/covet-pics-highlighted.css +349 -268
  42. package/dist/collection/components/covet-pics-highlighted/covet-pics-highlighted.js +6 -7
  43. package/dist/collection/components/covet-pics-hotspots/covet-pics-hotspots.js +3 -4
  44. package/dist/collection/components/covet-pics-notifications/covet-pics-notifications.js +8 -8
  45. package/dist/collection/components/covet-pics-popup/covet-gallery-popup.css +337 -265
  46. package/dist/collection/components/covet-pics-popup/covet-pics-popup-review.js +12 -12
  47. package/dist/collection/components/covet-pics-popup/covet-pics-popup-shared-links.js +6 -6
  48. package/dist/collection/components/covet-pics-popup/covet-pics-popup-slider.js +4 -4
  49. package/dist/collection/components/covet-pics-popup/covet-pics-popup.js +9 -9
  50. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow-carousel.css +330 -256
  51. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow-carousel.js +5 -5
  52. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow-links.css +121 -95
  53. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow-links.js +4 -5
  54. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow.css +222 -193
  55. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow.js +6 -6
  56. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-slide.css +4 -2
  57. package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-slide.js +9 -9
  58. package/dist/collection/components/covet-pics-popup-links/covet-pics-popup-links.js +8 -9
  59. package/dist/collection/components/covet-pics-post/covet-pics-post.css +341 -269
  60. package/dist/collection/components/covet-pics-post/covet-pics-post.js +4 -4
  61. package/dist/collection/components/covet-pics-select/covet-pics-select.js +9 -9
  62. package/dist/collection/components/covet-pics-shop-cart/covet-pics-shop-cart.js +5 -5
  63. package/dist/collection/components/covet-pics-star-rating/covet-pics-star-rating.js +13 -13
  64. package/dist/collection/components/covet-pics-upload/covet-gallery-upload.css +363 -267
  65. package/dist/collection/components/covet-pics-upload/covet-pics-upload.js +8 -8
  66. package/dist/collection/components/covet-pics-widget/covet-pics-widget.js +19 -19
  67. package/dist/collection/store/getters.js +1 -1
  68. package/dist/collection/store/popup.js +1 -1
  69. package/dist/collection/utils/normalize.js +12 -12
  70. package/dist/collection/utils/utils.js +4 -4
  71. package/dist/covet-pics-widget/covet-pics-widget.esm.js +1 -1
  72. package/dist/covet-pics-widget/p-06f32bc9.entry.js +47 -0
  73. package/dist/covet-pics-widget/p-23c45383.entry.js +4 -0
  74. package/dist/covet-pics-widget/p-43a16550.entry.js +4 -0
  75. package/dist/covet-pics-widget/p-4bca7f2b.entry.js +4 -0
  76. package/dist/covet-pics-widget/{p-C5d8fbcq.js → p-62BBe1im.js} +1 -1
  77. package/dist/covet-pics-widget/{p-bba2df15.entry.js → p-8cb0e707.entry.js} +1 -1
  78. package/dist/covet-pics-widget/p-9eb0e2c3.entry.js +4 -0
  79. package/dist/covet-pics-widget/{p-CWiAxP5O.js → p-BMxoP_07.js} +1 -1
  80. package/dist/covet-pics-widget/{p-Bktxki-n.js → p-BdrI5mVo.js} +1 -1
  81. package/dist/covet-pics-widget/p-BwHEPJHf.js +4 -0
  82. package/dist/covet-pics-widget/{p-BYVCq0H2.js → p-CHHYXTE1.js} +1 -1
  83. package/dist/covet-pics-widget/p-CHfigq-l.js +4 -0
  84. package/dist/covet-pics-widget/{p-Ty8D-DF-.js → p-CO8quyCG.js} +1 -1
  85. package/dist/covet-pics-widget/p-DE_ezvkD.js +4 -0
  86. package/dist/covet-pics-widget/p-DU3EMtiX.js +4 -0
  87. package/dist/covet-pics-widget/{p-B9r3XOsD.js → p-DbWg8R2g.js} +1 -1
  88. package/dist/covet-pics-widget/{p-Bk_zIAb3.js → p-DiRo1Zz-.js} +1 -1
  89. package/dist/covet-pics-widget/p-d8babc0f.entry.js +4 -0
  90. package/dist/covet-pics-widget/p-f6e6fb6b.entry.js +4 -0
  91. package/dist/covet-pics-widget/p-fbf57932.entry.js +4 -0
  92. package/dist/covet-pics-widget/p-ykblUknv.js +5 -0
  93. package/dist/esm/{a11y-sycwJ1v1.js → a11y-DU3EMtiX.js} +249 -278
  94. package/dist/esm/{app-globals-CWiAxP5O.js → app-globals-BMxoP_07.js} +2 -1
  95. package/dist/esm/covet-pics-checkbox_9.entry.js +40 -38
  96. package/dist/esm/covet-pics-crop-text.entry.js +5 -5
  97. package/dist/esm/covet-pics-gallery-grid_7.entry.js +106 -130
  98. package/dist/esm/covet-pics-gallery-header_3.entry.js +19 -15
  99. package/dist/esm/covet-pics-highlighted-hotspots_2.entry.js +35 -29
  100. package/dist/esm/covet-pics-popup-freeflow-carousel_3.entry.js +25 -17
  101. package/dist/esm/covet-pics-post.entry.js +4 -4
  102. package/dist/esm/covet-pics-star-rating.entry.js +5 -5
  103. package/dist/esm/covet-pics-widget.entry.js +14 -510
  104. package/dist/esm/covet-pics-widget.js +5 -5
  105. package/dist/esm/funcComponents-DfANI5rb.js +154 -0
  106. package/dist/esm/{getters-DdnjbzQ7.js → getters-Ehdd87SV.js} +2 -2
  107. package/dist/esm/{index-DuzFSMH7.js → index-ykblUknv.js} +478 -310
  108. package/dist/esm/{items-BOT19y8z.js → items-DzmaTgJO.js} +1 -1
  109. package/dist/esm/loader.js +4 -4
  110. package/dist/esm/{navigation-tjGnaVXK.js → navigation-gBoeU05C.js} +17 -9
  111. package/dist/esm/{popup-TepDt0BT.js → popup-CHfigq-l.js} +358 -186
  112. package/dist/esm/{popupFuncComponents-Bb_xHazd.js → popupFuncComponents-BTOacB4P.js} +2 -2
  113. package/dist/esm/{shopcart-CrfvBTez.js → shopcart-DsnyBbuM.js} +10 -10
  114. package/dist/esm/{slider-CU0Nt6AJ.js → slider-at4v3S0F.js} +1 -1
  115. package/dist/esm/{sort-BTlmY0Ww.js → sort-Db7QzPLz.js} +1 -1
  116. package/dist/esm/{utils-BpmmEYRs.js → utils-Ctzj3V36.js} +4 -4
  117. package/dist/types/components/covet-pics-checkbox/covet-pics-checkbox.d.ts +1 -1
  118. package/dist/types/components/covet-pics-notifications/covet-pics-notifications.d.ts +1 -1
  119. package/dist/types/components/covet-pics-select/covet-pics-select.d.ts +2 -2
  120. package/dist/types/components.d.ts +380 -51
  121. package/dist/types/stencil-public-runtime.d.ts +170 -12
  122. package/dist/types/store/configureStore.d.ts +168 -0
  123. package/dist/types/store/popup.d.ts +1 -12
  124. package/dist/types/store/reducer.d.ts +164 -0
  125. package/dist/types/utils/types.d.ts +11 -0
  126. package/package.json +16 -14
  127. package/dist/cjs/funcComponents-CKK6ULzk.js +0 -302
  128. package/dist/covet-pics-widget/p-0db43ad2.entry.js +0 -4
  129. package/dist/covet-pics-widget/p-12c8756e.entry.js +0 -4
  130. package/dist/covet-pics-widget/p-2cb934cb.entry.js +0 -4
  131. package/dist/covet-pics-widget/p-408dfc96.entry.js +0 -4
  132. package/dist/covet-pics-widget/p-61c2e607.entry.js +0 -4
  133. package/dist/covet-pics-widget/p-8d039b40.entry.js +0 -47
  134. package/dist/covet-pics-widget/p-97e62926.entry.js +0 -4
  135. package/dist/covet-pics-widget/p-B9yyH3wb.js +0 -4
  136. package/dist/covet-pics-widget/p-DVsh_O2H.js +0 -4
  137. package/dist/covet-pics-widget/p-DuzFSMH7.js +0 -5
  138. package/dist/covet-pics-widget/p-TepDt0BT.js +0 -4
  139. package/dist/covet-pics-widget/p-a71aa5d9.entry.js +0 -4
  140. package/dist/covet-pics-widget/p-sycwJ1v1.js +0 -4
  141. package/dist/esm/funcComponents-CTTfRwAW.js +0 -258
  142. /package/dist/covet-pics-widget/{p-BpmmEYRs.js → p-Ctzj3V36.js} +0 -0
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  /**
7
- * SSR Window 5.0.0
7
+ * SSR Window 5.0.1
8
8
  * Better handling for window object in SSR environment
9
9
  * https://github.com/nolimits4web/ssr-window
10
10
  *
@@ -12,19 +12,13 @@
12
12
  *
13
13
  * Licensed under MIT
14
14
  *
15
- * Released on: February 12, 2025
15
+ * Released on: June 27, 2025
16
16
  */
17
17
  /* eslint-disable no-param-reassign */
18
18
  function isObject$1(obj) {
19
19
  return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;
20
20
  }
21
- function extend$1(target, src) {
22
- if (target === void 0) {
23
- target = {};
24
- }
25
- if (src === void 0) {
26
- src = {};
27
- }
21
+ function extend$1(target = {}, src = {}) {
28
22
  const noExtend = ['__proto__', 'constructor', 'prototype'];
29
23
  Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => {
30
24
  if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) {
@@ -148,10 +142,7 @@ function getWindow() {
148
142
  return win;
149
143
  }
150
144
 
151
- function classesToTokens(classes) {
152
- if (classes === void 0) {
153
- classes = '';
154
- }
145
+ function classesToTokens(classes = '') {
155
146
  return classes.trim().split(' ').filter(c => !!c.trim());
156
147
  }
157
148
 
@@ -170,10 +161,7 @@ function deleteProps(obj) {
170
161
  }
171
162
  });
172
163
  }
173
- function nextTick(callback, delay) {
174
- if (delay === void 0) {
175
- delay = 0;
176
- }
164
+ function nextTick(callback, delay = 0) {
177
165
  return setTimeout(callback, delay);
178
166
  }
179
167
  function now() {
@@ -193,10 +181,7 @@ function getComputedStyle$1(el) {
193
181
  }
194
182
  return style;
195
183
  }
196
- function getTranslate(el, axis) {
197
- if (axis === void 0) {
198
- axis = 'x';
199
- }
184
+ function getTranslate(el, axis = 'x') {
200
185
  const window = getWindow();
201
186
  let matrix;
202
187
  let curTransform;
@@ -242,13 +227,12 @@ function isNode(node) {
242
227
  }
243
228
  return node && (node.nodeType === 1 || node.nodeType === 11);
244
229
  }
245
- function extend() {
246
- const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
247
- const noExtend = ['__proto__', 'constructor', 'prototype'];
248
- for (let i = 1; i < arguments.length; i += 1) {
249
- const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
230
+ function extend(...args) {
231
+ const to = Object(args[0]);
232
+ for (let i = 1; i < args.length; i += 1) {
233
+ const nextSource = args[i];
250
234
  if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
251
- const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
235
+ const keysArray = Object.keys(Object(nextSource)).filter(key => key !== '__proto__' && key !== 'constructor' && key !== 'prototype');
252
236
  for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
253
237
  const nextKey = keysArray[nextIndex];
254
238
  const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
@@ -278,12 +262,11 @@ function extend() {
278
262
  function setCSSProperty(el, varName, varValue) {
279
263
  el.style.setProperty(varName, varValue);
280
264
  }
281
- function animateCSSModeScroll(_ref) {
282
- let {
283
- swiper,
284
- targetPosition,
285
- side
286
- } = _ref;
265
+ function animateCSSModeScroll({
266
+ swiper,
267
+ targetPosition,
268
+ side
269
+ }) {
287
270
  const window = getWindow();
288
271
  const startPosition = -swiper.translate;
289
272
  let startTime = null;
@@ -328,10 +311,7 @@ function animateCSSModeScroll(_ref) {
328
311
  function getSlideTransformEl(slideEl) {
329
312
  return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;
330
313
  }
331
- function elementChildren(element, selector) {
332
- if (selector === void 0) {
333
- selector = '';
334
- }
314
+ function elementChildren(element, selector = '') {
335
315
  const window = getWindow();
336
316
  const children = [...element.children];
337
317
  if (window.HTMLSlotElement && element instanceof HTMLSlotElement) {
@@ -373,10 +353,7 @@ function showWarning(text) {
373
353
  // err
374
354
  }
375
355
  }
376
- function createElement(tag, classes) {
377
- if (classes === void 0) {
378
- classes = [];
379
- }
356
+ function createElement(tag, classes = []) {
380
357
  const el = document.createElement(tag);
381
358
  el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
382
359
  return el;
@@ -466,6 +443,15 @@ function elementOuterSize(el, size, includeMargins) {
466
443
  function makeElementsArray(el) {
467
444
  return (Array.isArray(el) ? el : [el]).filter(e => !!e);
468
445
  }
446
+ function setInnerHTML(el, html = '') {
447
+ if (typeof trustedTypes !== 'undefined') {
448
+ el.innerHTML = trustedTypes.createPolicy('html', {
449
+ createHTML: s => s
450
+ }).createHTML(html);
451
+ } else {
452
+ el.innerHTML = html;
453
+ }
454
+ }
469
455
 
470
456
  let support;
471
457
  function calcSupport() {
@@ -484,10 +470,9 @@ function getSupport() {
484
470
  }
485
471
 
486
472
  let deviceCached;
487
- function calcDevice(_temp) {
488
- let {
489
- userAgent
490
- } = _temp === void 0 ? {} : _temp;
473
+ function calcDevice({
474
+ userAgent
475
+ } = {}) {
491
476
  const support = getSupport();
492
477
  const window = getWindow();
493
478
  const platform = window.navigator.platform;
@@ -499,7 +484,7 @@ function calcDevice(_temp) {
499
484
  const screenWidth = window.screen.width;
500
485
  const screenHeight = window.screen.height;
501
486
  const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
502
- let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
487
+ let ipad = ua.match(/(iPad)(?!\1).*OS\s([\d_]+)/);
503
488
  const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
504
489
  const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
505
490
  const windows = platform === 'Win32';
@@ -526,10 +511,7 @@ function calcDevice(_temp) {
526
511
  // Export object
527
512
  return device;
528
513
  }
529
- function getDevice(overrides) {
530
- if (overrides === void 0) {
531
- overrides = {};
532
- }
514
+ function getDevice(overrides = {}) {
533
515
  if (!deviceCached) {
534
516
  deviceCached = calcDevice(overrides);
535
517
  }
@@ -569,12 +551,11 @@ function getBrowser() {
569
551
  return browser;
570
552
  }
571
553
 
572
- function Resize(_ref) {
573
- let {
574
- swiper,
575
- on,
576
- emit
577
- } = _ref;
554
+ function Resize({
555
+ swiper,
556
+ on,
557
+ emit
558
+ }) {
578
559
  const window = getWindow();
579
560
  let observer = null;
580
561
  let animationFrame = null;
@@ -593,12 +574,11 @@ function Resize(_ref) {
593
574
  } = swiper;
594
575
  let newWidth = width;
595
576
  let newHeight = height;
596
- entries.forEach(_ref2 => {
597
- let {
598
- contentBoxSize,
599
- contentRect,
600
- target
601
- } = _ref2;
577
+ entries.forEach(({
578
+ contentBoxSize,
579
+ contentRect,
580
+ target
581
+ }) => {
602
582
  if (target && target !== swiper.el) return;
603
583
  newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
604
584
  newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
@@ -638,19 +618,15 @@ function Resize(_ref) {
638
618
  });
639
619
  }
640
620
 
641
- function Observer(_ref) {
642
- let {
643
- swiper,
644
- extendParams,
645
- on,
646
- emit
647
- } = _ref;
621
+ function Observer({
622
+ swiper,
623
+ extendParams,
624
+ on,
625
+ emit
626
+ }) {
648
627
  const observers = [];
649
628
  const window = getWindow();
650
- const attach = function (target, options) {
651
- if (options === void 0) {
652
- options = {};
653
- }
629
+ const attach = (target, options = {}) => {
654
630
  const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
655
631
  const observer = new ObserverFunc(mutations => {
656
632
  // The observerUpdate event should only be triggered
@@ -728,14 +704,11 @@ var eventsEmitter = {
728
704
  const self = this;
729
705
  if (!self.eventsListeners || self.destroyed) return self;
730
706
  if (typeof handler !== 'function') return self;
731
- function onceHandler() {
707
+ function onceHandler(...args) {
732
708
  self.off(events, onceHandler);
733
709
  if (onceHandler.__emitterProxy) {
734
710
  delete onceHandler.__emitterProxy;
735
711
  }
736
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
737
- args[_key] = arguments[_key];
738
- }
739
712
  handler.apply(self, args);
740
713
  }
741
714
  onceHandler.__emitterProxy = handler;
@@ -778,16 +751,13 @@ var eventsEmitter = {
778
751
  });
779
752
  return self;
780
753
  },
781
- emit() {
754
+ emit(...args) {
782
755
  const self = this;
783
756
  if (!self.eventsListeners || self.destroyed) return self;
784
757
  if (!self.eventsListeners) return self;
785
758
  let events;
786
759
  let data;
787
760
  let context;
788
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
789
- args[_key2] = arguments[_key2];
790
- }
791
761
  if (typeof args[0] === 'string' || Array.isArray(args[0])) {
792
762
  events = args[0];
793
763
  data = args.slice(1, args.length);
@@ -855,7 +825,6 @@ function updateSlides() {
855
825
  const {
856
826
  wrapperEl,
857
827
  slidesEl,
858
- size: swiperSize,
859
828
  rtlTranslate: rtl,
860
829
  wrongRTL
861
830
  } = swiper;
@@ -876,6 +845,7 @@ function updateSlides() {
876
845
  }
877
846
  const previousSnapGridLength = swiper.snapGrid.length;
878
847
  const previousSlidesGridLength = swiper.slidesGrid.length;
848
+ const swiperSize = swiper.size - offsetBefore - offsetAfter;
879
849
  let spaceBetween = params.spaceBetween;
880
850
  let slidePosition = -offsetBefore;
881
851
  let prevSlideSize = 0;
@@ -888,7 +858,7 @@ function updateSlides() {
888
858
  } else if (typeof spaceBetween === 'string') {
889
859
  spaceBetween = parseFloat(spaceBetween);
890
860
  }
891
- swiper.virtualSize = -spaceBetween;
861
+ swiper.virtualSize = -spaceBetween - offsetBefore - offsetAfter;
892
862
 
893
863
  // reset margins
894
864
  slides.forEach(slideEl => {
@@ -906,6 +876,12 @@ function updateSlides() {
906
876
  setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');
907
877
  setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');
908
878
  }
879
+
880
+ // set cssMode offsets
881
+ if (params.cssMode) {
882
+ setCSSProperty(wrapperEl, '--swiper-slides-offset-before', `${offsetBefore}px`);
883
+ setCSSProperty(wrapperEl, '--swiper-slides-offset-after', `${offsetAfter}px`);
884
+ }
909
885
  const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
910
886
  if (gridEnabled) {
911
887
  swiper.grid.initSlides(slides);
@@ -920,16 +896,25 @@ function updateSlides() {
920
896
  }).length > 0;
921
897
  for (let i = 0; i < slidesLength; i += 1) {
922
898
  slideSize = 0;
923
- let slide;
924
- if (slides[i]) slide = slides[i];
925
- if (gridEnabled) {
926
- swiper.grid.updateSlide(i, slide, slides);
899
+ const slide = slides[i];
900
+ if (slide) {
901
+ if (gridEnabled) {
902
+ swiper.grid.updateSlide(i, slide, slides);
903
+ }
904
+ if (elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
927
905
  }
928
- if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
929
906
 
930
- if (params.slidesPerView === 'auto') {
907
+ if (isVirtual && params.slidesPerView === 'auto') {
908
+ if (params.virtual.slidesPerViewAutoSlideSize) {
909
+ slideSize = params.virtual.slidesPerViewAutoSlideSize;
910
+ }
911
+ if (slideSize && slide) {
912
+ if (params.roundLengths) slideSize = Math.floor(slideSize);
913
+ slide.style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
914
+ }
915
+ } else if (params.slidesPerView === 'auto') {
931
916
  if (shouldResetSlideSize) {
932
- slides[i].style[swiper.getDirectionLabel('width')] = ``;
917
+ slide.style[swiper.getDirectionLabel('width')] = ``;
933
918
  }
934
919
  const slideStyles = getComputedStyle(slide);
935
920
  const currentTransform = slide.style.transform;
@@ -970,12 +955,12 @@ function updateSlides() {
970
955
  } else {
971
956
  slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
972
957
  if (params.roundLengths) slideSize = Math.floor(slideSize);
973
- if (slides[i]) {
974
- slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
958
+ if (slide) {
959
+ slide.style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
975
960
  }
976
961
  }
977
- if (slides[i]) {
978
- slides[i].swiperSlideSize = slideSize;
962
+ if (slide) {
963
+ slide.swiperSlideSize = slideSize;
979
964
  }
980
965
  slidesSizesGrid.push(slideSize);
981
966
  if (params.centeredSlides) {
@@ -1009,17 +994,52 @@ function updateSlides() {
1009
994
 
1010
995
  // Remove last grid elements depending on width
1011
996
  if (!params.centeredSlides) {
997
+ // Check if snapToSlideEdge should be applied
998
+ const isFractionalSlidesPerView = params.slidesPerView !== 'auto' && params.slidesPerView % 1 !== 0;
999
+ const shouldSnapToSlideEdge = params.snapToSlideEdge && !params.loop && (params.slidesPerView === 'auto' || isFractionalSlidesPerView);
1000
+
1001
+ // Calculate the last allowed snap index when snapToSlideEdge is enabled
1002
+ // This ensures minimum slides are visible at the end
1003
+ let lastAllowedSnapIndex = snapGrid.length;
1004
+ if (shouldSnapToSlideEdge) {
1005
+ let minVisibleSlides;
1006
+ if (params.slidesPerView === 'auto') {
1007
+ // For 'auto' mode, calculate how many slides fit based on actual sizes
1008
+ minVisibleSlides = 1;
1009
+ let accumulatedSize = 0;
1010
+ for (let i = slidesSizesGrid.length - 1; i >= 0; i -= 1) {
1011
+ accumulatedSize += slidesSizesGrid[i] + (i < slidesSizesGrid.length - 1 ? spaceBetween : 0);
1012
+ if (accumulatedSize <= swiperSize) {
1013
+ minVisibleSlides = slidesSizesGrid.length - i;
1014
+ } else {
1015
+ break;
1016
+ }
1017
+ }
1018
+ } else {
1019
+ minVisibleSlides = Math.floor(params.slidesPerView);
1020
+ }
1021
+ lastAllowedSnapIndex = Math.max(slidesLength - minVisibleSlides, 0);
1022
+ }
1012
1023
  const newSlidesGrid = [];
1013
1024
  for (let i = 0; i < snapGrid.length; i += 1) {
1014
1025
  let slidesGridItem = snapGrid[i];
1015
1026
  if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
1016
- if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
1027
+ if (shouldSnapToSlideEdge) {
1028
+ // When snapToSlideEdge is enabled, only keep snaps up to lastAllowedSnapIndex
1029
+ if (i <= lastAllowedSnapIndex) {
1030
+ newSlidesGrid.push(slidesGridItem);
1031
+ }
1032
+ } else if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
1033
+ // When snapToSlideEdge is disabled, keep snaps that fit within scrollable area
1017
1034
  newSlidesGrid.push(slidesGridItem);
1018
1035
  }
1019
1036
  }
1020
1037
  snapGrid = newSlidesGrid;
1021
1038
  if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
1022
- snapGrid.push(swiper.virtualSize - swiperSize);
1039
+ // Only add edge-aligned snap if snapToSlideEdge is not enabled
1040
+ if (!shouldSnapToSlideEdge) {
1041
+ snapGrid.push(swiper.virtualSize - swiperSize);
1042
+ }
1023
1043
  }
1024
1044
  }
1025
1045
  if (isVirtual && params.loop) {
@@ -1071,9 +1091,8 @@ function updateSlides() {
1071
1091
  allSlidesSize += slideSizeValue + (spaceBetween || 0);
1072
1092
  });
1073
1093
  allSlidesSize -= spaceBetween;
1074
- const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
1075
- if (allSlidesSize + offsetSize < swiperSize) {
1076
- const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
1094
+ if (allSlidesSize < swiperSize) {
1095
+ const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
1077
1096
  snapGrid.forEach((snap, snapIndex) => {
1078
1097
  snapGrid[snapIndex] = snap - allSlidesOffset;
1079
1098
  });
@@ -1184,10 +1203,7 @@ const toggleSlideClasses$1 = (slideEl, condition, className) => {
1184
1203
  slideEl.classList.remove(className);
1185
1204
  }
1186
1205
  };
1187
- function updateSlidesProgress(translate) {
1188
- if (translate === void 0) {
1189
- translate = this && this.translate || 0;
1190
- }
1206
+ function updateSlidesProgress(translate = this && this.translate || 0) {
1191
1207
  const swiper = this;
1192
1208
  const params = swiper.params;
1193
1209
  const {
@@ -1371,12 +1387,13 @@ const processLazyPreloader = (swiper, imageEl) => {
1371
1387
  requestAnimationFrame(() => {
1372
1388
  if (slideEl.shadowRoot) {
1373
1389
  lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
1374
- if (lazyEl) lazyEl.remove();
1390
+ if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove();
1375
1391
  }
1376
1392
  });
1377
1393
  }
1378
1394
  }
1379
- if (lazyEl) lazyEl.remove();
1395
+ // Skip removal if managed by React/Vue component
1396
+ if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove();
1380
1397
  }
1381
1398
  };
1382
1399
  const unlazy = (swiper, index) => {
@@ -1491,8 +1508,12 @@ function updateActiveIndex(newActiveIndex) {
1491
1508
 
1492
1509
  // Get real index
1493
1510
  let realIndex;
1494
- if (swiper.virtual && params.virtual.enabled && params.loop) {
1495
- realIndex = getVirtualRealIndex(activeIndex);
1511
+ if (swiper.virtual && params.virtual.enabled) {
1512
+ if (params.loop) {
1513
+ realIndex = getVirtualRealIndex(activeIndex);
1514
+ } else {
1515
+ realIndex = activeIndex;
1516
+ }
1496
1517
  } else if (gridEnabled) {
1497
1518
  const firstSlideInColumn = swiper.slides.find(slideEl => slideEl.column === activeIndex);
1498
1519
  let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
@@ -1582,10 +1603,7 @@ var update = {
1582
1603
  updateClickedSlide
1583
1604
  };
1584
1605
 
1585
- function getSwiperTranslate(axis) {
1586
- if (axis === void 0) {
1587
- axis = this.isHorizontal() ? 'x' : 'y';
1588
- }
1606
+ function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') {
1589
1607
  const swiper = this;
1590
1608
  const {
1591
1609
  params,
@@ -1660,19 +1678,7 @@ function maxTranslate() {
1660
1678
  return -this.snapGrid[this.snapGrid.length - 1];
1661
1679
  }
1662
1680
 
1663
- function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
1664
- if (translate === void 0) {
1665
- translate = 0;
1666
- }
1667
- if (speed === void 0) {
1668
- speed = this.params.speed;
1669
- }
1670
- if (runCallbacks === void 0) {
1671
- runCallbacks = true;
1672
- }
1673
- if (translateBounds === void 0) {
1674
- translateBounds = true;
1675
- }
1681
+ function translateTo(translate = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) {
1676
1682
  const swiper = this;
1677
1683
  const {
1678
1684
  params,
@@ -1760,13 +1766,12 @@ function setTransition(duration, byController) {
1760
1766
  swiper.emit('setTransition', duration, byController);
1761
1767
  }
1762
1768
 
1763
- function transitionEmit(_ref) {
1764
- let {
1765
- swiper,
1766
- runCallbacks,
1767
- direction,
1768
- step
1769
- } = _ref;
1769
+ function transitionEmit({
1770
+ swiper,
1771
+ runCallbacks,
1772
+ direction,
1773
+ step
1774
+ }) {
1770
1775
  const {
1771
1776
  activeIndex,
1772
1777
  previousIndex
@@ -1776,11 +1781,9 @@ function transitionEmit(_ref) {
1776
1781
  if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
1777
1782
  }
1778
1783
  swiper.emit(`transition${step}`);
1779
- if (runCallbacks && activeIndex !== previousIndex) {
1780
- if (dir === 'reset') {
1781
- swiper.emit(`slideResetTransition${step}`);
1782
- return;
1783
- }
1784
+ if (runCallbacks && dir === 'reset') {
1785
+ swiper.emit(`slideResetTransition${step}`);
1786
+ } else if (runCallbacks && activeIndex !== previousIndex) {
1784
1787
  swiper.emit(`slideChangeTransition${step}`);
1785
1788
  if (dir === 'next') {
1786
1789
  swiper.emit(`slideNextTransition${step}`);
@@ -1790,10 +1793,7 @@ function transitionEmit(_ref) {
1790
1793
  }
1791
1794
  }
1792
1795
 
1793
- function transitionStart(runCallbacks, direction) {
1794
- if (runCallbacks === void 0) {
1795
- runCallbacks = true;
1796
- }
1796
+ function transitionStart(runCallbacks = true, direction) {
1797
1797
  const swiper = this;
1798
1798
  const {
1799
1799
  params
@@ -1810,10 +1810,7 @@ function transitionStart(runCallbacks, direction) {
1810
1810
  });
1811
1811
  }
1812
1812
 
1813
- function transitionEnd(runCallbacks, direction) {
1814
- if (runCallbacks === void 0) {
1815
- runCallbacks = true;
1816
- }
1813
+ function transitionEnd(runCallbacks = true, direction) {
1817
1814
  const swiper = this;
1818
1815
  const {
1819
1816
  params
@@ -1835,13 +1832,7 @@ var transition = {
1835
1832
  transitionEnd
1836
1833
  };
1837
1834
 
1838
- function slideTo(index, speed, runCallbacks, internal, initial) {
1839
- if (index === void 0) {
1840
- index = 0;
1841
- }
1842
- if (runCallbacks === void 0) {
1843
- runCallbacks = true;
1844
- }
1835
+ function slideTo(index = 0, speed, runCallbacks = true, internal, initial) {
1845
1836
  if (typeof index === 'string') {
1846
1837
  index = parseInt(index, 10);
1847
1838
  }
@@ -1993,13 +1984,7 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
1993
1984
  return true;
1994
1985
  }
1995
1986
 
1996
- function slideToLoop(index, speed, runCallbacks, internal) {
1997
- if (index === void 0) {
1998
- index = 0;
1999
- }
2000
- if (runCallbacks === void 0) {
2001
- runCallbacks = true;
2002
- }
1987
+ function slideToLoop(index = 0, speed, runCallbacks = true, internal) {
2003
1988
  if (typeof index === 'string') {
2004
1989
  const indexAsNumber = parseInt(index, 10);
2005
1990
  index = indexAsNumber;
@@ -2025,26 +2010,29 @@ function slideToLoop(index, speed, runCallbacks, internal) {
2025
2010
  }
2026
2011
  const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
2027
2012
  const {
2028
- centeredSlides
2013
+ centeredSlides,
2014
+ slidesOffsetBefore,
2015
+ slidesOffsetAfter
2029
2016
  } = swiper.params;
2017
+ const bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter;
2030
2018
  let slidesPerView = swiper.params.slidesPerView;
2031
2019
  if (slidesPerView === 'auto') {
2032
2020
  slidesPerView = swiper.slidesPerViewDynamic();
2033
2021
  } else {
2034
2022
  slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
2035
- if (centeredSlides && slidesPerView % 2 === 0) {
2023
+ if (bothDirections && slidesPerView % 2 === 0) {
2036
2024
  slidesPerView = slidesPerView + 1;
2037
2025
  }
2038
2026
  }
2039
2027
  let needLoopFix = cols - targetSlideIndex < slidesPerView;
2040
- if (centeredSlides) {
2028
+ if (bothDirections) {
2041
2029
  needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
2042
2030
  }
2043
- if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
2031
+ if (internal && bothDirections && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
2044
2032
  needLoopFix = false;
2045
2033
  }
2046
2034
  if (needLoopFix) {
2047
- const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
2035
+ const direction = bothDirections ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
2048
2036
  swiper.loopFix({
2049
2037
  direction,
2050
2038
  slideTo: true,
@@ -2067,10 +2055,7 @@ function slideToLoop(index, speed, runCallbacks, internal) {
2067
2055
  }
2068
2056
 
2069
2057
  /* eslint no-unused-vars: "off" */
2070
- function slideNext(speed, runCallbacks, internal) {
2071
- if (runCallbacks === void 0) {
2072
- runCallbacks = true;
2073
- }
2058
+ function slideNext(speed, runCallbacks = true, internal) {
2074
2059
  const swiper = this;
2075
2060
  const {
2076
2061
  enabled,
@@ -2108,10 +2093,7 @@ function slideNext(speed, runCallbacks, internal) {
2108
2093
  }
2109
2094
 
2110
2095
  /* eslint no-unused-vars: "off" */
2111
- function slidePrev(speed, runCallbacks, internal) {
2112
- if (runCallbacks === void 0) {
2113
- runCallbacks = true;
2114
- }
2096
+ function slidePrev(speed, runCallbacks = true, internal) {
2115
2097
  const swiper = this;
2116
2098
  const {
2117
2099
  params,
@@ -2177,10 +2159,7 @@ function slidePrev(speed, runCallbacks, internal) {
2177
2159
  }
2178
2160
 
2179
2161
  /* eslint no-unused-vars: "off" */
2180
- function slideReset(speed, runCallbacks, internal) {
2181
- if (runCallbacks === void 0) {
2182
- runCallbacks = true;
2183
- }
2162
+ function slideReset(speed, runCallbacks = true, internal) {
2184
2163
  const swiper = this;
2185
2164
  if (swiper.destroyed) return;
2186
2165
  if (typeof speed === 'undefined') {
@@ -2190,13 +2169,7 @@ function slideReset(speed, runCallbacks, internal) {
2190
2169
  }
2191
2170
 
2192
2171
  /* eslint no-unused-vars: "off" */
2193
- function slideToClosest(speed, runCallbacks, internal, threshold) {
2194
- if (runCallbacks === void 0) {
2195
- runCallbacks = true;
2196
- }
2197
- if (threshold === void 0) {
2198
- threshold = 0.5;
2199
- }
2172
+ function slideToClosest(speed, runCallbacks = true, internal, threshold = 0.5) {
2200
2173
  const swiper = this;
2201
2174
  if (swiper.destroyed) return;
2202
2175
  if (typeof speed === 'undefined') {
@@ -2236,23 +2209,16 @@ function slideToClickedSlide() {
2236
2209
  slidesEl
2237
2210
  } = swiper;
2238
2211
  const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
2239
- let slideToIndex = swiper.clickedIndex;
2212
+ let slideToIndex = swiper.getSlideIndexWhenGrid(swiper.clickedIndex);
2240
2213
  let realIndex;
2241
2214
  const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
2215
+ const isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
2242
2216
  if (params.loop) {
2243
2217
  if (swiper.animating) return;
2244
2218
  realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
2245
2219
  if (params.centeredSlides) {
2246
- if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
2247
- swiper.loopFix();
2248
- slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
2249
- nextTick(() => {
2250
- swiper.slideTo(slideToIndex);
2251
- });
2252
- } else {
2253
- swiper.slideTo(slideToIndex);
2254
- }
2255
- } else if (slideToIndex > swiper.slides.length - slidesPerView) {
2220
+ swiper.slideToLoop(realIndex);
2221
+ } else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) {
2256
2222
  swiper.loopFix();
2257
2223
  slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
2258
2224
  nextTick(() => {
@@ -2289,7 +2255,20 @@ function loopCreate(slideRealIndex, initial) {
2289
2255
  el.setAttribute('data-swiper-slide-index', index);
2290
2256
  });
2291
2257
  };
2258
+ const clearBlankSlides = () => {
2259
+ const slides = elementChildren(slidesEl, `.${params.slideBlankClass}`);
2260
+ slides.forEach(el => {
2261
+ el.remove();
2262
+ });
2263
+ if (slides.length > 0) {
2264
+ swiper.recalcSlides();
2265
+ swiper.updateSlides();
2266
+ }
2267
+ };
2292
2268
  const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
2269
+ if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) {
2270
+ clearBlankSlides();
2271
+ }
2293
2272
  const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
2294
2273
  const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
2295
2274
  const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
@@ -2322,24 +2301,24 @@ function loopCreate(slideRealIndex, initial) {
2322
2301
  } else {
2323
2302
  initSlides();
2324
2303
  }
2304
+ const bothDirections = params.centeredSlides || !!params.slidesOffsetBefore || !!params.slidesOffsetAfter;
2325
2305
  swiper.loopFix({
2326
2306
  slideRealIndex,
2327
- direction: params.centeredSlides ? undefined : 'next',
2307
+ direction: bothDirections ? undefined : 'next',
2328
2308
  initial
2329
2309
  });
2330
2310
  }
2331
2311
 
2332
- function loopFix(_temp) {
2333
- let {
2334
- slideRealIndex,
2335
- slideTo = true,
2336
- direction,
2337
- setTranslate,
2338
- activeSlideIndex,
2339
- initial,
2340
- byController,
2341
- byMousewheel
2342
- } = _temp === void 0 ? {} : _temp;
2312
+ function loopFix({
2313
+ slideRealIndex,
2314
+ slideTo = true,
2315
+ direction,
2316
+ setTranslate,
2317
+ activeSlideIndex,
2318
+ initial,
2319
+ byController,
2320
+ byMousewheel
2321
+ } = {}) {
2343
2322
  const swiper = this;
2344
2323
  if (!swiper.params.loop) return;
2345
2324
  swiper.emit('beforeLoopFix');
@@ -2352,15 +2331,18 @@ function loopFix(_temp) {
2352
2331
  } = swiper;
2353
2332
  const {
2354
2333
  centeredSlides,
2334
+ slidesOffsetBefore,
2335
+ slidesOffsetAfter,
2355
2336
  initialSlide
2356
2337
  } = params;
2338
+ const bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter;
2357
2339
  swiper.allowSlidePrev = true;
2358
2340
  swiper.allowSlideNext = true;
2359
2341
  if (swiper.virtual && params.virtual.enabled) {
2360
2342
  if (slideTo) {
2361
- if (!params.centeredSlides && swiper.snapIndex === 0) {
2343
+ if (!bothDirections && swiper.snapIndex === 0) {
2362
2344
  swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
2363
- } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
2345
+ } else if (bothDirections && swiper.snapIndex < params.slidesPerView) {
2364
2346
  swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
2365
2347
  } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
2366
2348
  swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
@@ -2376,12 +2358,12 @@ function loopFix(_temp) {
2376
2358
  slidesPerView = swiper.slidesPerViewDynamic();
2377
2359
  } else {
2378
2360
  slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
2379
- if (centeredSlides && slidesPerView % 2 === 0) {
2361
+ if (bothDirections && slidesPerView % 2 === 0) {
2380
2362
  slidesPerView = slidesPerView + 1;
2381
2363
  }
2382
2364
  }
2383
2365
  const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
2384
- let loopedSlides = slidesPerGroup;
2366
+ let loopedSlides = bothDirections ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup;
2385
2367
  if (loopedSlides % slidesPerGroup !== 0) {
2386
2368
  loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
2387
2369
  }
@@ -2396,7 +2378,7 @@ function loopFix(_temp) {
2396
2378
  const prependSlidesIndexes = [];
2397
2379
  const appendSlidesIndexes = [];
2398
2380
  const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
2399
- const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !centeredSlides;
2381
+ const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !bothDirections;
2400
2382
  let activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex;
2401
2383
  if (typeof activeSlideIndex === 'undefined') {
2402
2384
  activeSlideIndex = swiper.getSlideIndex(slides.find(el => el.classList.contains(params.slideActiveClass)));
@@ -2408,7 +2390,7 @@ function loopFix(_temp) {
2408
2390
  let slidesPrepended = 0;
2409
2391
  let slidesAppended = 0;
2410
2392
  const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
2411
- const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
2393
+ const activeColIndexWithShift = activeColIndex + (bothDirections && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
2412
2394
  // prepend last slides before start
2413
2395
  if (activeColIndexWithShift < loopedSlides) {
2414
2396
  slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
@@ -2615,10 +2597,7 @@ var grabCursor = {
2615
2597
  };
2616
2598
 
2617
2599
  // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
2618
- function closestElement(selector, base) {
2619
- if (base === void 0) {
2620
- base = this;
2621
- }
2600
+ function closestElement(selector, base = this) {
2622
2601
  function __closestFrom(el) {
2623
2602
  if (!el || el === getDocument() || el === getWindow()) return null;
2624
2603
  if (el.assignedSlot) el = el.assignedSlot;
@@ -3198,7 +3177,8 @@ function onResize() {
3198
3177
  swiper.updateSlidesClasses();
3199
3178
  const isVirtualLoop = isVirtual && params.loop;
3200
3179
  if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
3201
- swiper.slideTo(swiper.slides.length - 1, 0, false, true);
3180
+ const slides = isVirtual ? swiper.virtual.slides : swiper.slides;
3181
+ swiper.slideTo(slides.length - 1, 0, false, true);
3202
3182
  } else {
3203
3183
  if (swiper.params.loop && !isVirtual) {
3204
3184
  swiper.slideToLoop(swiper.realIndex, 0, false, true);
@@ -3473,10 +3453,7 @@ function setBreakpoint() {
3473
3453
  swiper.emit('breakpoint', breakpointParams);
3474
3454
  }
3475
3455
 
3476
- function getBreakpoint(breakpoints, base, containerEl) {
3477
- if (base === void 0) {
3478
- base = 'window';
3479
- }
3456
+ function getBreakpoint(breakpoints, base = 'window', containerEl) {
3480
3457
  if (!breakpoints || base === 'container' && !containerEl) return undefined;
3481
3458
  let breakpoint = false;
3482
3459
  const window = getWindow();
@@ -3671,6 +3648,7 @@ var defaults = {
3671
3648
  // in px
3672
3649
  normalizeSlideIndex: true,
3673
3650
  centerInsufficientSlides: false,
3651
+ snapToSlideEdge: false,
3674
3652
  // Disable swiper and hide navigation when container not overflow
3675
3653
  watchOverflow: true,
3676
3654
  // Round length
@@ -3741,10 +3719,7 @@ var defaults = {
3741
3719
  };
3742
3720
 
3743
3721
  function moduleExtendParams(params, allModulesParams) {
3744
- return function extendParams(obj) {
3745
- if (obj === void 0) {
3746
- obj = {};
3747
- }
3722
+ return function extendParams(obj = {}) {
3748
3723
  const moduleParamName = Object.keys(obj)[0];
3749
3724
  const moduleParams = obj[moduleParamName];
3750
3725
  if (typeof moduleParams !== 'object' || moduleParams === null) {
@@ -3792,12 +3767,9 @@ const prototypes = {
3792
3767
  };
3793
3768
  const extendedDefaults = {};
3794
3769
  class Swiper {
3795
- constructor() {
3770
+ constructor(...args) {
3796
3771
  let el;
3797
3772
  let params;
3798
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3799
- args[_key] = arguments[_key];
3800
- }
3801
3773
  if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
3802
3774
  params = args[0];
3803
3775
  } else {
@@ -3831,7 +3803,11 @@ class Swiper {
3831
3803
  swiper.eventsAnyListeners = [];
3832
3804
  swiper.modules = [...swiper.__modules__];
3833
3805
  if (params.modules && Array.isArray(params.modules)) {
3834
- swiper.modules.push(...params.modules);
3806
+ params.modules.forEach(mod => {
3807
+ if (typeof mod === 'function' && swiper.modules.indexOf(mod) < 0) {
3808
+ swiper.modules.push(mod);
3809
+ }
3810
+ });
3835
3811
  }
3836
3812
  const allModulesParams = {};
3837
3813
  swiper.modules.forEach(mod => {
@@ -3978,6 +3954,16 @@ class Swiper {
3978
3954
  getSlideIndexByData(index) {
3979
3955
  return this.getSlideIndex(this.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index));
3980
3956
  }
3957
+ getSlideIndexWhenGrid(index) {
3958
+ if (this.grid && this.params.grid && this.params.grid.rows > 1) {
3959
+ if (this.params.grid.fill === 'column') {
3960
+ index = Math.floor(index / this.params.grid.rows);
3961
+ } else if (this.params.grid.fill === 'row') {
3962
+ index = index % Math.ceil(this.slides.length / this.params.grid.rows);
3963
+ }
3964
+ }
3965
+ return index;
3966
+ }
3981
3967
  recalcSlides() {
3982
3968
  const swiper = this;
3983
3969
  const {
@@ -4043,13 +4029,7 @@ class Swiper {
4043
4029
  });
4044
4030
  swiper.emit('_slideClasses', updates);
4045
4031
  }
4046
- slidesPerViewDynamic(view, exact) {
4047
- if (view === void 0) {
4048
- view = 'current';
4049
- }
4050
- if (exact === void 0) {
4051
- exact = false;
4052
- }
4032
+ slidesPerViewDynamic(view = 'current', exact = false) {
4053
4033
  const swiper = this;
4054
4034
  const {
4055
4035
  params,
@@ -4148,10 +4128,7 @@ class Swiper {
4148
4128
  }
4149
4129
  swiper.emit('update');
4150
4130
  }
4151
- changeDirection(newDirection, needUpdate) {
4152
- if (needUpdate === void 0) {
4153
- needUpdate = true;
4154
- }
4131
+ changeDirection(newDirection, needUpdate = true) {
4155
4132
  const swiper = this;
4156
4133
  const currentDirection = swiper.params.direction;
4157
4134
  if (!newDirection) {
@@ -4306,13 +4283,7 @@ class Swiper {
4306
4283
  swiper.emit('afterInit');
4307
4284
  return swiper;
4308
4285
  }
4309
- destroy(deleteInstance, cleanStyles) {
4310
- if (deleteInstance === void 0) {
4311
- deleteInstance = true;
4312
- }
4313
- if (cleanStyles === void 0) {
4314
- cleanStyles = true;
4315
- }
4286
+ destroy(deleteInstance = true, cleanStyles = true) {
4316
4287
  const swiper = this;
4317
4288
  const {
4318
4289
  params,
@@ -4418,21 +4389,18 @@ function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
4418
4389
  return params;
4419
4390
  }
4420
4391
 
4421
- function classesToSelector(classes) {
4422
- if (classes === void 0) {
4423
- classes = '';
4424
- }
4425
- return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
4392
+ function classesToSelector(classes = '') {
4393
+ // Escape all CSS selector special characters
4394
+ return `.${classes.trim().replace(/([\.:!+\/()[\]#>~*^$|=,'"@{}\\])/g, '\\$1') // eslint-disable-line
4426
4395
  .replace(/ /g, '.')}`;
4427
4396
  }
4428
4397
 
4429
- function Pagination(_ref) {
4430
- let {
4431
- swiper,
4432
- extendParams,
4433
- on,
4434
- emit
4435
- } = _ref;
4398
+ function Pagination({
4399
+ swiper,
4400
+ extendParams,
4401
+ on,
4402
+ emit
4403
+ }) {
4436
4404
  const pfx = 'swiper-pagination';
4437
4405
  extendParams({
4438
4406
  pagination: {
@@ -4650,7 +4618,7 @@ function Pagination(_ref) {
4650
4618
  });
4651
4619
  }
4652
4620
  if (params.type === 'custom' && params.renderCustom) {
4653
- subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
4621
+ setInnerHTML(subEl, params.renderCustom(swiper, current + 1, total));
4654
4622
  if (subElIndex === 0) emit('paginationRender', subEl);
4655
4623
  } else {
4656
4624
  if (subElIndex === 0) emit('paginationRender', subEl);
@@ -4700,7 +4668,7 @@ function Pagination(_ref) {
4700
4668
  swiper.pagination.bullets = [];
4701
4669
  el.forEach(subEl => {
4702
4670
  if (params.type !== 'custom') {
4703
- subEl.innerHTML = paginationHTML || '';
4671
+ setInnerHTML(subEl, paginationHTML || '');
4704
4672
  }
4705
4673
  if (params.type === 'bullets') {
4706
4674
  swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
@@ -4881,12 +4849,11 @@ function Pagination(_ref) {
4881
4849
  });
4882
4850
  }
4883
4851
 
4884
- function A11y(_ref) {
4885
- let {
4886
- swiper,
4887
- extendParams,
4888
- on
4889
- } = _ref;
4852
+ function A11y({
4853
+ swiper,
4854
+ extendParams,
4855
+ on
4856
+ }) {
4890
4857
  extendParams({
4891
4858
  a11y: {
4892
4859
  enabled: true,
@@ -4903,7 +4870,8 @@ function A11y(_ref) {
4903
4870
  itemRoleDescriptionMessage: null,
4904
4871
  slideRole: 'group',
4905
4872
  id: null,
4906
- scrollOnFocus: true
4873
+ scrollOnFocus: true,
4874
+ wrapperLiveRegion: true
4907
4875
  }
4908
4876
  });
4909
4877
  swiper.a11y = {
@@ -4916,10 +4884,9 @@ function A11y(_ref) {
4916
4884
  function notify(message) {
4917
4885
  const notification = liveRegion;
4918
4886
  if (notification.length === 0) return;
4919
- notification.innerHTML = '';
4920
- notification.innerHTML = message;
4887
+ setInnerHTML(notification, message);
4921
4888
  }
4922
- function getRandomNumber(size) {
4889
+ function getRandomNumber(size = 16) {
4923
4890
  const randomChar = () => Math.round(16 * Math.random()).toString(16);
4924
4891
  return 'x'.repeat(size).replace(/x/g, randomChar);
4925
4892
  }
@@ -5101,7 +5068,8 @@ function A11y(_ref) {
5101
5068
  const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
5102
5069
  if (!slideEl || !swiper.slides.includes(slideEl)) return;
5103
5070
  focusTargetSlideEl = slideEl;
5104
- const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
5071
+ const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
5072
+ const isActive = (isVirtual ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : swiper.slides.indexOf(slideEl)) === swiper.activeIndex;
5105
5073
  const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
5106
5074
  if (isActive || isVisible) return;
5107
5075
  if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
@@ -5113,9 +5081,11 @@ function A11y(_ref) {
5113
5081
  requestAnimationFrame(() => {
5114
5082
  if (preventFocusHandler) return;
5115
5083
  if (swiper.params.loop) {
5116
- swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0);
5084
+ swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'))), 0);
5085
+ } else if (isVirtual) {
5086
+ swiper.slideTo(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10)), 0);
5117
5087
  } else {
5118
- swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
5088
+ swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0);
5119
5089
  }
5120
5090
  preventFocusHandler = false;
5121
5091
  });
@@ -5156,9 +5126,11 @@ function A11y(_ref) {
5156
5126
  // Wrapper
5157
5127
  const wrapperEl = swiper.wrapperEl;
5158
5128
  const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`;
5159
- const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
5160
5129
  addElId(wrapperEl, wrapperId);
5161
- addElLive(wrapperEl, live);
5130
+ if (params.wrapperLiveRegion) {
5131
+ const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
5132
+ addElLive(wrapperEl, live);
5133
+ }
5162
5134
 
5163
5135
  // Slide
5164
5136
  initSlides();
@@ -5189,7 +5161,6 @@ function A11y(_ref) {
5189
5161
  const document = getDocument();
5190
5162
  document.addEventListener('visibilitychange', onVisibilityChange);
5191
5163
  swiper.el.addEventListener('focus', handleFocus, true);
5192
- swiper.el.addEventListener('focus', handleFocus, true);
5193
5164
  swiper.el.addEventListener('pointerdown', handlePointerDown, true);
5194
5165
  swiper.el.addEventListener('pointerup', handlePointerUp, true);
5195
5166
  };
@@ -5264,3 +5235,4 @@ exports.getDocument = getDocument;
5264
5235
  exports.getSlideTransformEl = getSlideTransformEl;
5265
5236
  exports.makeElementsArray = makeElementsArray;
5266
5237
  exports.nextTick = nextTick;
5238
+ exports.setInnerHTML = setInnerHTML;