@content-blocks/js 0.7.6 → 0.8.0
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.
- package/LICENSE +1 -1
- package/README.md +111 -3
- package/THIRD-PARTY-NOTICES.md +21 -0
- package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -2
- package/dist/cjs/content-accordion.cjs.entry.js +87 -0
- package/dist/cjs/content-blocks.cjs.js +35 -11
- package/dist/cjs/content-button.cjs.entry.js +113 -0
- package/dist/cjs/content-carousel.cjs.entry.js +153 -47
- package/dist/cjs/content-grid-formatter.cjs.entry.js +102 -0
- package/dist/cjs/content-hero-block.cjs.entry.js +45 -0
- package/dist/cjs/content-image.cjs.entry.js +153 -0
- package/dist/cjs/content-line.cjs.entry.js +61 -0
- package/dist/cjs/content-navigation-block.cjs.entry.js +51 -34
- package/dist/cjs/content-overlay.cjs.entry.js +641 -0
- package/dist/cjs/content-spacer.cjs.entry.js +75 -0
- package/dist/cjs/content-split-block.cjs.entry.js +22 -19
- package/dist/cjs/content-tabs.cjs.entry.js +38 -21
- package/dist/cjs/content-text-block.cjs.entry.js +63 -0
- package/dist/cjs/content-tout-block.cjs.entry.js +34 -0
- package/dist/cjs/{content-accordion_11.cjs.entry.js → content-video.cjs.entry.js} +14560 -12927
- package/dist/cjs/{focus-trap.esm-7bc384a0.js → focus-trap.esm-ZwN-anf1.js} +484 -190
- package/dist/cjs/{index-2e0ce692.js → index-B1U6Gweq.js} +348 -246
- package/dist/cjs/index-ClnpH9XB.js +2170 -0
- package/dist/cjs/index-CyalvZJn.js +1719 -0
- package/dist/cjs/index-DUvWvBDN.js +290 -0
- package/dist/cjs/index-voGY4Tkl.js +4705 -0
- package/dist/cjs/index.cjs.js +2 -5
- package/dist/cjs/loader.cjs.js +3 -8
- package/dist/cjs/responsive-component-C5eJS82z.js +171 -0
- package/dist/cjs/responsive-component-DMdnQIPV.js +171 -0
- package/dist/cjs/swiper-KLYbvU1K.js +3931 -0
- package/dist/cjs/{swiper-8221f4e8.js → swiper-_Z8Y4IJI.js} +269 -236
- package/dist/cjs/utils-BCHaRGm_.js +462 -0
- package/dist/cjs/{utils-df044337.js → utils-C3gXIS2t.js} +51 -49
- package/dist/cjs/utils-DUvWvBDN.js +290 -0
- package/dist/collection/blocks/content-hero-block/content-hero-block.css +1 -1
- package/dist/collection/blocks/content-hero-block/content-hero-block.js +33 -48
- package/dist/collection/blocks/content-split-block/content-split-block.css +16 -5
- package/dist/collection/blocks/content-split-block/content-split-block.js +29 -48
- package/dist/collection/blocks/content-text-block/content-text-block.js +65 -59
- package/dist/collection/blocks/content-tout-block/content-tout-block.css +3 -0
- package/dist/collection/blocks/content-tout-block/content-tout-block.js +22 -47
- package/dist/collection/collection-manifest.json +8 -5
- package/dist/collection/components/content-accordion/content-accordion.css +20 -1
- package/dist/collection/components/content-accordion/content-accordion.js +67 -33
- package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js +0 -1
- package/dist/collection/components/content-carousel/content-carousel.css +60 -4
- package/dist/collection/components/content-carousel/content-carousel.js +294 -44
- package/dist/collection/components/content-navigation-block/content-navigation-block.css +15 -1
- package/dist/collection/components/content-navigation-block/content-navigation-block.js +86 -42
- package/dist/collection/components/content-overlay/content-overlay.css +36 -5
- package/dist/collection/components/content-overlay/content-overlay.js +181 -120
- package/dist/collection/components/content-overlay/libraries/aria-dialog.js +0 -1
- package/dist/collection/components/content-overlay/libraries/aria-utilities.js +0 -1
- package/dist/collection/components/content-tabs/content-tabs.js +7 -49
- package/dist/collection/components/content-tabs/libraries/w3_tabs.js +0 -1
- package/dist/collection/elements/content-button/content-button.css +8 -7
- package/dist/collection/elements/content-button/content-button.js +103 -84
- package/dist/collection/elements/content-image/content-image.css +3 -1
- package/dist/collection/elements/content-image/content-image.js +176 -95
- package/dist/collection/elements/content-line/content-line.js +63 -54
- package/dist/collection/elements/content-video/content-video.css +1 -1
- package/dist/collection/elements/content-video/content-video.js +165 -92
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +8 -2
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +167 -89
- package/dist/collection/formatters/content-spacer/content-spacer.js +86 -209
- package/dist/collection/global/content-blocks-reset.css +77 -0
- package/dist/collection/index.js +1 -1
- package/dist/collection/sass/_mixins.scss +21 -5
- package/dist/collection/sass/_variables.scss +15 -15
- package/dist/collection/setupFiles.js +0 -1
- package/dist/collection/site/site.js +67 -0
- package/dist/collection/utils/breakpoints.js +162 -0
- package/dist/collection/utils/responsive-component.js +249 -0
- package/dist/collection/utils/utils.js +32 -42
- package/dist/components/content-accordion.js +65 -44
- package/dist/components/content-button.js +89 -43
- package/dist/components/content-carousel.js +172 -55
- package/dist/components/content-grid-formatter.js +127 -3
- package/dist/components/content-hero-block.js +33 -26
- package/dist/components/content-image.js +127 -71
- package/dist/components/content-line.js +56 -35
- package/dist/components/content-navigation-block.js +62 -39
- package/dist/components/content-overlay.js +128 -67
- package/dist/components/content-spacer.js +70 -54
- package/dist/components/content-split-block.js +33 -32
- package/dist/components/content-tabs.js +46 -25
- package/dist/components/content-text-block.js +55 -35
- package/dist/components/content-tout-block.js +29 -27
- package/dist/components/content-video.js +14624 -11972
- package/dist/{esm/focus-trap.esm-8fb54175.js → components/focus-trap.esm.js} +484 -190
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +3 -3
- package/dist/components/{p-5a91aa1b.js → index2.js} +348 -246
- package/dist/components/p-BWRCeMvO.js +1 -0
- package/dist/components/p-CYF5GU_q.js +1 -0
- package/dist/components/p-DXUoPIwl.js +10 -0
- package/dist/components/p-D_Ll4QNj.js +1 -0
- package/dist/components/p-DhIoW7H3.js +1 -0
- package/dist/components/responsive-component.js +168 -0
- package/dist/components/{p-e5dc4ea4.js → swiper.js} +268 -235
- package/dist/components/utils.js +4969 -0
- package/dist/{esm/utils-1c9f0ec1.js → components/utils2.js} +51 -50
- package/dist/content-blocks/content-accordion.entry.js +85 -0
- package/dist/content-blocks/content-blocks.esm.js +47 -2
- package/dist/content-blocks/content-button.entry.js +111 -0
- package/dist/content-blocks/content-carousel.entry.js +188 -0
- package/dist/content-blocks/content-grid-formatter.entry.js +100 -0
- package/dist/content-blocks/content-hero-block.entry.js +43 -0
- package/dist/content-blocks/content-image.entry.js +151 -0
- package/dist/content-blocks/content-line.entry.js +59 -0
- package/dist/content-blocks/content-navigation-block.entry.js +105 -0
- package/dist/content-blocks/content-overlay.entry.js +639 -0
- package/dist/content-blocks/content-spacer.entry.js +73 -0
- package/dist/content-blocks/content-split-block.entry.js +34 -0
- package/dist/content-blocks/content-tabs.entry.js +245 -0
- package/dist/content-blocks/content-text-block.entry.js +61 -0
- package/dist/content-blocks/content-tout-block.entry.js +32 -0
- package/dist/{esm/content-accordion_11.entry.js → content-blocks/content-video.entry.js} +14535 -12890
- package/dist/{components/p-a2fedf8a.js → content-blocks/focus-trap.esm-DXUoPIwl.js} +484 -190
- package/dist/content-blocks/global/content-blocks-reset.css +77 -0
- package/dist/content-blocks/index-BFDJMblF.js +4690 -0
- package/dist/{esm/index-f45a9c45.js → content-blocks/index-P1YnSd-O.js} +348 -246
- package/dist/content-blocks/index.esm.js +1 -2
- package/dist/content-blocks/p-008457f0.entry.js +1 -0
- package/dist/content-blocks/p-052692f1.entry.js +1 -0
- package/dist/content-blocks/p-0f71bd32.entry.js +1 -0
- package/dist/content-blocks/p-1f154617.entry.js +1 -0
- package/dist/content-blocks/p-2554ebd8.entry.js +1 -0
- package/dist/content-blocks/p-4afd6511.entry.js +1 -0
- package/dist/content-blocks/p-78d5de9f.entry.js +1 -0
- package/dist/content-blocks/p-7bcf7e7e.entry.js +1 -0
- package/dist/content-blocks/p-9058031c.entry.js +1 -0
- package/dist/content-blocks/p-9c41ac23.entry.js +17 -0
- package/dist/content-blocks/p-CLwOzPEO.js +3 -0
- package/dist/content-blocks/p-CYF5GU_q.js +1 -0
- package/dist/content-blocks/p-CjR_4mPu.js +1 -0
- package/dist/content-blocks/p-DQuL1Twl.js +1 -0
- package/dist/content-blocks/p-DXUoPIwl.js +10 -0
- package/dist/content-blocks/p-D_Ll4QNj.js +1 -0
- package/dist/content-blocks/p-DhIoW7H3.js +1 -0
- package/dist/content-blocks/p-DzYwy_62.js +1 -0
- package/dist/content-blocks/p-b2e6358a.entry.js +1 -0
- package/dist/content-blocks/p-c783bc68.entry.js +1 -0
- package/dist/content-blocks/p-e3d81e15.entry.js +1 -0
- package/dist/content-blocks/p-f23b4aae.entry.js +1 -0
- package/dist/content-blocks/p-f75c9094.entry.js +1 -0
- package/dist/content-blocks/responsive-component-BsLrcKbS.js +169 -0
- package/dist/content-blocks/sass/_mixins.scss +21 -5
- package/dist/content-blocks/sass/_variables.scss +15 -15
- package/dist/{esm/swiper-e9621adb.js → content-blocks/swiper-nBv069TB.js} +268 -235
- package/dist/{components/p-b85cfa86.js → content-blocks/utils--SDsQnWS.js} +51 -50
- package/dist/content-blocks/utils-Bak__24s.js +280 -0
- package/dist/docs.d.ts +480 -0
- package/dist/docs.json +5312 -0
- package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -2
- package/dist/esm/content-accordion.entry.js +85 -0
- package/dist/esm/content-blocks.js +33 -8
- package/dist/esm/content-button.entry.js +111 -0
- package/dist/esm/content-carousel.entry.js +153 -45
- package/dist/esm/content-grid-formatter.entry.js +100 -0
- package/dist/esm/content-hero-block.entry.js +43 -0
- package/dist/esm/content-image.entry.js +151 -0
- package/dist/esm/content-line.entry.js +59 -0
- package/dist/esm/content-navigation-block.entry.js +51 -32
- package/dist/esm/content-overlay.entry.js +639 -0
- package/dist/esm/content-spacer.entry.js +73 -0
- package/dist/esm/content-split-block.entry.js +22 -17
- package/dist/esm/content-tabs.entry.js +38 -19
- package/dist/esm/content-text-block.entry.js +61 -0
- package/dist/esm/content-tout-block.entry.js +32 -0
- package/dist/esm/content-video.entry.js +72033 -0
- package/dist/esm/focus-trap.esm-DXUoPIwl.js +1801 -0
- package/dist/esm/index-BASCLGuP.js +1713 -0
- package/dist/esm/index-BFDJMblF.js +4690 -0
- package/dist/esm/index-CLwOzPEO.js +2161 -0
- package/dist/esm/index-CjR_4mPu.js +280 -0
- package/dist/esm/index-P1YnSd-O.js +5397 -0
- package/dist/esm/index.js +1 -3
- package/dist/esm/loader.js +3 -6
- package/dist/esm/responsive-component-BsLrcKbS.js +169 -0
- package/dist/esm/responsive-component-D7dJHMp0.js +169 -0
- package/dist/esm/swiper-CtypHPwF.js +3928 -0
- package/dist/esm/swiper-nBv069TB.js +3941 -0
- package/dist/esm/utils--SDsQnWS.js +460 -0
- package/dist/esm/utils-Bak__24s.js +280 -0
- package/dist/esm/utils-CYF5GU_q.js +438 -0
- package/dist/node_modules/video.js/dist/video-js.min.css +1 -0
- package/dist/test/axe.js +60 -0
- package/dist/types/Users/shahrukceo/Developer/content-blocks/packages/js/.stencil/test/axe.d.ts +16 -0
- package/dist/types/blocks/content-hero-block/content-hero-block.d.ts +7 -11
- package/dist/types/blocks/content-split-block/content-split-block.d.ts +5 -9
- package/dist/types/blocks/content-text-block/content-text-block.d.ts +4 -9
- package/dist/types/blocks/content-tout-block/content-tout-block.d.ts +5 -10
- package/dist/types/components/content-accordion/content-accordion.d.ts +4 -3
- package/dist/types/components/content-accordion/libraries/w3_disclosure_button.d.ts +0 -1
- package/dist/types/components/content-carousel/content-carousel.d.ts +44 -7
- package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +14 -8
- package/dist/types/components/content-overlay/content-overlay.d.ts +15 -16
- package/dist/types/components/content-overlay/libraries/aria-dialog.d.ts +0 -1
- package/dist/types/components/content-overlay/libraries/aria-utilities.d.ts +0 -1
- package/dist/types/components/content-tabs/content-tabs.d.ts +4 -10
- package/dist/types/components/content-tabs/libraries/w3_tabs.d.ts +0 -1
- package/dist/types/components.d.ts +900 -196
- package/dist/types/elements/content-button/content-button.d.ts +8 -13
- package/dist/types/elements/content-image/content-image.d.ts +15 -9
- package/dist/types/elements/content-line/content-line.d.ts +5 -12
- package/dist/types/elements/content-video/content-video.d.ts +12 -11
- package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +14 -9
- package/dist/types/formatters/content-spacer/content-spacer.d.ts +4 -36
- package/dist/types/index.d.ts +3 -1
- package/dist/types/setupFiles.d.ts +0 -1
- package/dist/types/stencil-public-runtime.d.ts +265 -60
- package/dist/types/typings.d.ts +10 -0
- package/dist/types/utils/breakpoints.d.ts +57 -0
- package/dist/types/utils/responsive-component.d.ts +49 -0
- package/dist/types/utils/utils.d.ts +11 -8
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +75 -65
- package/dist/cjs/BehaviorSubject-12116537.js +0 -655
- package/dist/cjs/BehaviorSubject-12116537.js.map +0 -1
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/content-accordion_11.cjs.entry.js.map +0 -1
- package/dist/cjs/content-blocks.cjs.js.map +0 -1
- package/dist/cjs/content-carousel.cjs.entry.js.map +0 -1
- package/dist/cjs/content-navigation-block.cjs.entry.js.map +0 -1
- package/dist/cjs/content-split-block.cjs.entry.js.map +0 -1
- package/dist/cjs/content-tabs.cjs.entry.js.map +0 -1
- package/dist/cjs/focus-trap.esm-7bc384a0.js.map +0 -1
- package/dist/cjs/index-2e0ce692.js.map +0 -1
- package/dist/cjs/index-8af2820a.js +0 -1650
- package/dist/cjs/index-8af2820a.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/swiper-8221f4e8.js.map +0 -1
- package/dist/cjs/utils-df044337.js.map +0 -1
- package/dist/cjs/utils-f8ccab0a.js +0 -126
- package/dist/cjs/utils-f8ccab0a.js.map +0 -1
- package/dist/cjs/window-resize-service-65a5a370.js +0 -37
- package/dist/cjs/window-resize-service-65a5a370.js.map +0 -1
- package/dist/collection/blocks/content-hero-block/content-hero-block.js.map +0 -1
- package/dist/collection/blocks/content-split-block/content-split-block.js.map +0 -1
- package/dist/collection/blocks/content-text-block/content-text-block.js.map +0 -1
- package/dist/collection/blocks/content-tout-block/content-tout-block.js.map +0 -1
- package/dist/collection/components/content-accordion/content-accordion.js.map +0 -1
- package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js.map +0 -1
- package/dist/collection/components/content-carousel/content-carousel.js.map +0 -1
- package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +0 -1
- package/dist/collection/components/content-overlay/content-overlay.js.map +0 -1
- package/dist/collection/components/content-overlay/libraries/aria-dialog.js.map +0 -1
- package/dist/collection/components/content-overlay/libraries/aria-utilities.js.map +0 -1
- package/dist/collection/components/content-tabs/content-tabs.js.map +0 -1
- package/dist/collection/components/content-tabs/libraries/w3_tabs.js.map +0 -1
- package/dist/collection/elements/content-button/content-button.js.map +0 -1
- package/dist/collection/elements/content-image/content-image.js.map +0 -1
- package/dist/collection/elements/content-line/content-line.js.map +0 -1
- package/dist/collection/elements/content-video/content-video.js.map +0 -1
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +0 -1
- package/dist/collection/formatters/content-spacer/content-spacer.js.map +0 -1
- package/dist/collection/globalScript.js +0 -15
- package/dist/collection/globalScript.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/services/content-events-service.js +0 -23
- package/dist/collection/services/content-events-service.js.map +0 -1
- package/dist/collection/services/window-resize-service.js +0 -31
- package/dist/collection/services/window-resize-service.js.map +0 -1
- package/dist/collection/setupFiles.js.map +0 -1
- package/dist/collection/stories/ContentHeroBlock.stories.js +0 -51
- package/dist/collection/stories/ContentHeroBlock.stories.js.map +0 -1
- package/dist/collection/stories/ContentNavigationBlock.stories.js +0 -33
- package/dist/collection/stories/ContentNavigationBlock.stories.js.map +0 -1
- package/dist/collection/stories/ContentSpacer.stories.js +0 -20
- package/dist/collection/stories/ContentSpacer.stories.js.map +0 -1
- package/dist/collection/stories/ContentTextBlock.stories.js +0 -17
- package/dist/collection/stories/ContentTextBlock.stories.js.map +0 -1
- package/dist/collection/stories/ContentToutBlock.stories.js +0 -17
- package/dist/collection/stories/ContentToutBlock.stories.js.map +0 -1
- package/dist/collection/stories/FullPageExample.stories.js +0 -432
- package/dist/collection/stories/FullPageExample.stories.js.map +0 -1
- package/dist/collection/stories/assets/accessibility.svg +0 -5
- package/dist/collection/stories/assets/discord.svg +0 -15
- package/dist/collection/stories/assets/github.svg +0 -3
- package/dist/collection/stories/assets/tutorials.svg +0 -12
- package/dist/collection/stories/assets/youtube.svg +0 -4
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/content-accordion.js.map +0 -1
- package/dist/components/content-button.js.map +0 -1
- package/dist/components/content-carousel.js.map +0 -1
- package/dist/components/content-grid-formatter.js.map +0 -1
- package/dist/components/content-hero-block.js.map +0 -1
- package/dist/components/content-image.js.map +0 -1
- package/dist/components/content-line.js.map +0 -1
- package/dist/components/content-navigation-block.js.map +0 -1
- package/dist/components/content-overlay.js.map +0 -1
- package/dist/components/content-spacer.js.map +0 -1
- package/dist/components/content-split-block.js.map +0 -1
- package/dist/components/content-tabs.js.map +0 -1
- package/dist/components/content-text-block.js.map +0 -1
- package/dist/components/content-tout-block.js.map +0 -1
- package/dist/components/content-video.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/p-26483b46.js +0 -35
- package/dist/components/p-26483b46.js.map +0 -1
- package/dist/components/p-5a91aa1b.js.map +0 -1
- package/dist/components/p-74be971f.js +0 -652
- package/dist/components/p-74be971f.js.map +0 -1
- package/dist/components/p-7a436263.js +0 -122
- package/dist/components/p-7a436263.js.map +0 -1
- package/dist/components/p-a2fedf8a.js.map +0 -1
- package/dist/components/p-b85cfa86.js.map +0 -1
- package/dist/components/p-e28db040.js +0 -1452
- package/dist/components/p-e28db040.js.map +0 -1
- package/dist/components/p-e5dc4ea4.js.map +0 -1
- package/dist/components/p-e9bce2ab.js +0 -88
- package/dist/components/p-e9bce2ab.js.map +0 -1
- package/dist/content-blocks/content-blocks.esm.js.map +0 -1
- package/dist/content-blocks/index.esm.js.map +0 -1
- package/dist/content-blocks/p-13c3cc4f.js +0 -3
- package/dist/content-blocks/p-13c3cc4f.js.map +0 -1
- package/dist/content-blocks/p-5422c25b.entry.js +0 -2
- package/dist/content-blocks/p-5422c25b.entry.js.map +0 -1
- package/dist/content-blocks/p-5a91aa1b.js +0 -2
- package/dist/content-blocks/p-5a91aa1b.js.map +0 -1
- package/dist/content-blocks/p-650d1757.js +0 -2
- package/dist/content-blocks/p-650d1757.js.map +0 -1
- package/dist/content-blocks/p-74be971f.js +0 -2
- package/dist/content-blocks/p-74be971f.js.map +0 -1
- package/dist/content-blocks/p-8deb755c.entry.js +0 -26
- package/dist/content-blocks/p-8deb755c.entry.js.map +0 -1
- package/dist/content-blocks/p-a2fedf8a.js +0 -10
- package/dist/content-blocks/p-a2fedf8a.js.map +0 -1
- package/dist/content-blocks/p-b305392e.entry.js +0 -2
- package/dist/content-blocks/p-b305392e.entry.js.map +0 -1
- package/dist/content-blocks/p-b85cfa86.js +0 -2
- package/dist/content-blocks/p-b85cfa86.js.map +0 -1
- package/dist/content-blocks/p-cc7397cf.js +0 -2
- package/dist/content-blocks/p-cc7397cf.js.map +0 -1
- package/dist/content-blocks/p-d62775d7.entry.js +0 -2
- package/dist/content-blocks/p-d62775d7.entry.js.map +0 -1
- package/dist/content-blocks/p-e1255160.js +0 -2
- package/dist/content-blocks/p-e1255160.js.map +0 -1
- package/dist/content-blocks/p-e5dc4ea4.js +0 -2
- package/dist/content-blocks/p-e5dc4ea4.js.map +0 -1
- package/dist/content-blocks/p-f73f934a.entry.js +0 -2
- package/dist/content-blocks/p-f73f934a.entry.js.map +0 -1
- package/dist/esm/BehaviorSubject-f7a12fd8.js +0 -652
- package/dist/esm/BehaviorSubject-f7a12fd8.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/content-accordion_11.entry.js.map +0 -1
- package/dist/esm/content-blocks.js.map +0 -1
- package/dist/esm/content-carousel.entry.js.map +0 -1
- package/dist/esm/content-navigation-block.entry.js.map +0 -1
- package/dist/esm/content-split-block.entry.js.map +0 -1
- package/dist/esm/content-tabs.entry.js.map +0 -1
- package/dist/esm/focus-trap.esm-8fb54175.js.map +0 -1
- package/dist/esm/index-ec24af7a.js +0 -1621
- package/dist/esm/index-ec24af7a.js.map +0 -1
- package/dist/esm/index-f45a9c45.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/swiper-e9621adb.js.map +0 -1
- package/dist/esm/utils-1c9f0ec1.js.map +0 -1
- package/dist/esm/utils-9a901aa9.js +0 -122
- package/dist/esm/utils-9a901aa9.js.map +0 -1
- package/dist/esm/window-resize-service-354f2ac5.js +0 -35
- package/dist/esm/window-resize-service-354f2ac5.js.map +0 -1
- package/dist/types/globalScript.d.ts +0 -1
- package/dist/types/old-components.d.ts +0 -1239
- package/dist/types/services/content-events-service.d.ts +0 -11
- package/dist/types/services/window-resize-service.d.ts +0 -11
- package/dist/types/stories/ContentHeroBlock.stories.d.ts +0 -11
- package/dist/types/stories/ContentNavigationBlock.stories.d.ts +0 -9
- package/dist/types/stories/ContentSpacer.stories.d.ts +0 -15
- package/dist/types/stories/ContentTextBlock.stories.d.ts +0 -9
- package/dist/types/stories/ContentToutBlock.stories.d.ts +0 -9
- package/dist/types/stories/FullPageExample.stories.d.ts +0 -10
|
@@ -0,0 +1,1719 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('./utils-BCHaRGm_.js');
|
|
4
|
+
|
|
5
|
+
function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
|
|
6
|
+
if (swiper.params.createElements) {
|
|
7
|
+
Object.keys(checkProps).forEach(key => {
|
|
8
|
+
if (!params[key] && params.auto === true) {
|
|
9
|
+
let element = utils.elementChildren(swiper.el, `.${checkProps[key]}`)[0];
|
|
10
|
+
if (!element) {
|
|
11
|
+
element = utils.createElement('div', checkProps[key]);
|
|
12
|
+
element.className = checkProps[key];
|
|
13
|
+
swiper.el.append(element);
|
|
14
|
+
}
|
|
15
|
+
params[key] = element;
|
|
16
|
+
originalParams[key] = element;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return params;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const arrowSvg = `<svg class="swiper-navigation-icon" width="11" height="20" viewBox="0 0 11 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.38296 20.0762C0.111788 19.805 0.111788 19.3654 0.38296 19.0942L9.19758 10.2796L0.38296 1.46497C0.111788 1.19379 0.111788 0.754138 0.38296 0.482966C0.654131 0.211794 1.09379 0.211794 1.36496 0.482966L10.4341 9.55214C10.8359 9.9539 10.8359 10.6053 10.4341 11.007L1.36496 20.0762C1.09379 20.3474 0.654131 20.3474 0.38296 20.0762Z" fill="currentColor"/></svg>`;
|
|
24
|
+
function Navigation({
|
|
25
|
+
swiper,
|
|
26
|
+
extendParams,
|
|
27
|
+
on,
|
|
28
|
+
emit
|
|
29
|
+
}) {
|
|
30
|
+
extendParams({
|
|
31
|
+
navigation: {
|
|
32
|
+
nextEl: null,
|
|
33
|
+
prevEl: null,
|
|
34
|
+
addIcons: true,
|
|
35
|
+
hideOnClick: false,
|
|
36
|
+
disabledClass: 'swiper-button-disabled',
|
|
37
|
+
hiddenClass: 'swiper-button-hidden',
|
|
38
|
+
lockClass: 'swiper-button-lock',
|
|
39
|
+
navigationDisabledClass: 'swiper-navigation-disabled'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
swiper.navigation = {
|
|
43
|
+
nextEl: null,
|
|
44
|
+
prevEl: null,
|
|
45
|
+
arrowSvg
|
|
46
|
+
};
|
|
47
|
+
function getEl(el) {
|
|
48
|
+
let res;
|
|
49
|
+
if (el && typeof el === 'string' && swiper.isElement) {
|
|
50
|
+
res = swiper.el.querySelector(el) || swiper.hostEl.querySelector(el);
|
|
51
|
+
if (res) return res;
|
|
52
|
+
}
|
|
53
|
+
if (el) {
|
|
54
|
+
if (typeof el === 'string') res = [...document.querySelectorAll(el)];
|
|
55
|
+
if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
|
|
56
|
+
res = swiper.el.querySelector(el);
|
|
57
|
+
} else if (res && res.length === 1) {
|
|
58
|
+
res = res[0];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (el && !res) return el;
|
|
62
|
+
// if (Array.isArray(res) && res.length === 1) res = res[0];
|
|
63
|
+
return res;
|
|
64
|
+
}
|
|
65
|
+
function toggleEl(el, disabled) {
|
|
66
|
+
const params = swiper.params.navigation;
|
|
67
|
+
el = utils.makeElementsArray(el);
|
|
68
|
+
el.forEach(subEl => {
|
|
69
|
+
if (subEl) {
|
|
70
|
+
subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
|
|
71
|
+
if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
|
|
72
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
73
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function update() {
|
|
79
|
+
// Update Navigation Buttons
|
|
80
|
+
const {
|
|
81
|
+
nextEl,
|
|
82
|
+
prevEl
|
|
83
|
+
} = swiper.navigation;
|
|
84
|
+
if (swiper.params.loop) {
|
|
85
|
+
toggleEl(prevEl, false);
|
|
86
|
+
toggleEl(nextEl, false);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
|
|
90
|
+
toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
|
|
91
|
+
}
|
|
92
|
+
function onPrevClick(e) {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
|
|
95
|
+
swiper.slidePrev();
|
|
96
|
+
emit('navigationPrev');
|
|
97
|
+
}
|
|
98
|
+
function onNextClick(e) {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
|
|
101
|
+
swiper.slideNext();
|
|
102
|
+
emit('navigationNext');
|
|
103
|
+
}
|
|
104
|
+
function init() {
|
|
105
|
+
const params = swiper.params.navigation;
|
|
106
|
+
swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
|
|
107
|
+
nextEl: 'swiper-button-next',
|
|
108
|
+
prevEl: 'swiper-button-prev'
|
|
109
|
+
});
|
|
110
|
+
if (!(params.nextEl || params.prevEl)) return;
|
|
111
|
+
let nextEl = getEl(params.nextEl);
|
|
112
|
+
let prevEl = getEl(params.prevEl);
|
|
113
|
+
Object.assign(swiper.navigation, {
|
|
114
|
+
nextEl,
|
|
115
|
+
prevEl
|
|
116
|
+
});
|
|
117
|
+
nextEl = utils.makeElementsArray(nextEl);
|
|
118
|
+
prevEl = utils.makeElementsArray(prevEl);
|
|
119
|
+
const initButton = (el, dir) => {
|
|
120
|
+
if (el) {
|
|
121
|
+
if (params.addIcons && el.matches('.swiper-button-next,.swiper-button-prev') && !el.querySelector('svg')) {
|
|
122
|
+
const tempEl = document.createElement('div');
|
|
123
|
+
utils.setInnerHTML(tempEl, arrowSvg);
|
|
124
|
+
el.appendChild(tempEl.querySelector('svg'));
|
|
125
|
+
tempEl.remove();
|
|
126
|
+
}
|
|
127
|
+
el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
|
|
128
|
+
}
|
|
129
|
+
if (!swiper.enabled && el) {
|
|
130
|
+
el.classList.add(...params.lockClass.split(' '));
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
nextEl.forEach(el => initButton(el, 'next'));
|
|
134
|
+
prevEl.forEach(el => initButton(el, 'prev'));
|
|
135
|
+
}
|
|
136
|
+
function destroy() {
|
|
137
|
+
let {
|
|
138
|
+
nextEl,
|
|
139
|
+
prevEl
|
|
140
|
+
} = swiper.navigation;
|
|
141
|
+
nextEl = utils.makeElementsArray(nextEl);
|
|
142
|
+
prevEl = utils.makeElementsArray(prevEl);
|
|
143
|
+
const destroyButton = (el, dir) => {
|
|
144
|
+
el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
|
|
145
|
+
el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
|
|
146
|
+
};
|
|
147
|
+
nextEl.forEach(el => destroyButton(el, 'next'));
|
|
148
|
+
prevEl.forEach(el => destroyButton(el, 'prev'));
|
|
149
|
+
}
|
|
150
|
+
on('init', () => {
|
|
151
|
+
if (swiper.params.navigation.enabled === false) {
|
|
152
|
+
// eslint-disable-next-line
|
|
153
|
+
disable();
|
|
154
|
+
} else {
|
|
155
|
+
init();
|
|
156
|
+
update();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
on('toEdge fromEdge lock unlock', () => {
|
|
160
|
+
update();
|
|
161
|
+
});
|
|
162
|
+
on('destroy', () => {
|
|
163
|
+
destroy();
|
|
164
|
+
});
|
|
165
|
+
on('enable disable', () => {
|
|
166
|
+
let {
|
|
167
|
+
nextEl,
|
|
168
|
+
prevEl
|
|
169
|
+
} = swiper.navigation;
|
|
170
|
+
nextEl = utils.makeElementsArray(nextEl);
|
|
171
|
+
prevEl = utils.makeElementsArray(prevEl);
|
|
172
|
+
if (swiper.enabled) {
|
|
173
|
+
update();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
[...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass));
|
|
177
|
+
});
|
|
178
|
+
on('click', (_s, e) => {
|
|
179
|
+
let {
|
|
180
|
+
nextEl,
|
|
181
|
+
prevEl
|
|
182
|
+
} = swiper.navigation;
|
|
183
|
+
nextEl = utils.makeElementsArray(nextEl);
|
|
184
|
+
prevEl = utils.makeElementsArray(prevEl);
|
|
185
|
+
const targetEl = e.target;
|
|
186
|
+
let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl);
|
|
187
|
+
if (swiper.isElement && !targetIsButton) {
|
|
188
|
+
const path = e.path || e.composedPath && e.composedPath();
|
|
189
|
+
if (path) {
|
|
190
|
+
targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (swiper.params.navigation.hideOnClick && !targetIsButton) {
|
|
194
|
+
if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
|
|
195
|
+
let isHidden;
|
|
196
|
+
if (nextEl.length) {
|
|
197
|
+
isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
|
|
198
|
+
} else if (prevEl.length) {
|
|
199
|
+
isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
|
|
200
|
+
}
|
|
201
|
+
if (isHidden === true) {
|
|
202
|
+
emit('navigationShow');
|
|
203
|
+
} else {
|
|
204
|
+
emit('navigationHide');
|
|
205
|
+
}
|
|
206
|
+
[...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
const enable = () => {
|
|
210
|
+
swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
|
|
211
|
+
init();
|
|
212
|
+
update();
|
|
213
|
+
};
|
|
214
|
+
const disable = () => {
|
|
215
|
+
swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
|
|
216
|
+
destroy();
|
|
217
|
+
};
|
|
218
|
+
Object.assign(swiper.navigation, {
|
|
219
|
+
enable,
|
|
220
|
+
disable,
|
|
221
|
+
update,
|
|
222
|
+
init,
|
|
223
|
+
destroy
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function classesToSelector(classes = '') {
|
|
228
|
+
// Escape all CSS selector special characters
|
|
229
|
+
return `.${classes.trim().replace(/([\.:!+\/()[\]#>~*^$|=,'"@{}\\])/g, '\\$1') // eslint-disable-line
|
|
230
|
+
.replace(/ /g, '.')}`;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function Pagination({
|
|
234
|
+
swiper,
|
|
235
|
+
extendParams,
|
|
236
|
+
on,
|
|
237
|
+
emit
|
|
238
|
+
}) {
|
|
239
|
+
const pfx = 'swiper-pagination';
|
|
240
|
+
extendParams({
|
|
241
|
+
pagination: {
|
|
242
|
+
el: null,
|
|
243
|
+
bulletElement: 'span',
|
|
244
|
+
clickable: false,
|
|
245
|
+
hideOnClick: false,
|
|
246
|
+
renderBullet: null,
|
|
247
|
+
renderProgressbar: null,
|
|
248
|
+
renderFraction: null,
|
|
249
|
+
renderCustom: null,
|
|
250
|
+
progressbarOpposite: false,
|
|
251
|
+
type: 'bullets',
|
|
252
|
+
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
253
|
+
dynamicBullets: false,
|
|
254
|
+
dynamicMainBullets: 1,
|
|
255
|
+
formatFractionCurrent: number => number,
|
|
256
|
+
formatFractionTotal: number => number,
|
|
257
|
+
bulletClass: `${pfx}-bullet`,
|
|
258
|
+
bulletActiveClass: `${pfx}-bullet-active`,
|
|
259
|
+
modifierClass: `${pfx}-`,
|
|
260
|
+
currentClass: `${pfx}-current`,
|
|
261
|
+
totalClass: `${pfx}-total`,
|
|
262
|
+
hiddenClass: `${pfx}-hidden`,
|
|
263
|
+
progressbarFillClass: `${pfx}-progressbar-fill`,
|
|
264
|
+
progressbarOppositeClass: `${pfx}-progressbar-opposite`,
|
|
265
|
+
clickableClass: `${pfx}-clickable`,
|
|
266
|
+
lockClass: `${pfx}-lock`,
|
|
267
|
+
horizontalClass: `${pfx}-horizontal`,
|
|
268
|
+
verticalClass: `${pfx}-vertical`,
|
|
269
|
+
paginationDisabledClass: `${pfx}-disabled`
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
swiper.pagination = {
|
|
273
|
+
el: null,
|
|
274
|
+
bullets: []
|
|
275
|
+
};
|
|
276
|
+
let bulletSize;
|
|
277
|
+
let dynamicBulletIndex = 0;
|
|
278
|
+
function isPaginationDisabled() {
|
|
279
|
+
return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
|
|
280
|
+
}
|
|
281
|
+
function setSideBullets(bulletEl, position) {
|
|
282
|
+
const {
|
|
283
|
+
bulletActiveClass
|
|
284
|
+
} = swiper.params.pagination;
|
|
285
|
+
if (!bulletEl) return;
|
|
286
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
287
|
+
if (bulletEl) {
|
|
288
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}`);
|
|
289
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
290
|
+
if (bulletEl) {
|
|
291
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function getMoveDirection(prevIndex, nextIndex, length) {
|
|
296
|
+
prevIndex = prevIndex % length;
|
|
297
|
+
nextIndex = nextIndex % length;
|
|
298
|
+
if (nextIndex === prevIndex + 1) {
|
|
299
|
+
return 'next';
|
|
300
|
+
} else if (nextIndex === prevIndex - 1) {
|
|
301
|
+
return 'previous';
|
|
302
|
+
}
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
function onBulletClick(e) {
|
|
306
|
+
const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
|
|
307
|
+
if (!bulletEl) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
const index = utils.elementIndex(bulletEl) * swiper.params.slidesPerGroup;
|
|
312
|
+
if (swiper.params.loop) {
|
|
313
|
+
if (swiper.realIndex === index) return;
|
|
314
|
+
const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length);
|
|
315
|
+
if (moveDirection === 'next') {
|
|
316
|
+
swiper.slideNext();
|
|
317
|
+
} else if (moveDirection === 'previous') {
|
|
318
|
+
swiper.slidePrev();
|
|
319
|
+
} else {
|
|
320
|
+
swiper.slideToLoop(index);
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
swiper.slideTo(index);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function update() {
|
|
327
|
+
// Render || Update Pagination bullets/items
|
|
328
|
+
const rtl = swiper.rtl;
|
|
329
|
+
const params = swiper.params.pagination;
|
|
330
|
+
if (isPaginationDisabled()) return;
|
|
331
|
+
let el = swiper.pagination.el;
|
|
332
|
+
el = utils.makeElementsArray(el);
|
|
333
|
+
// Current/Total
|
|
334
|
+
let current;
|
|
335
|
+
let previousIndex;
|
|
336
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
337
|
+
const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
338
|
+
if (swiper.params.loop) {
|
|
339
|
+
previousIndex = swiper.previousRealIndex || 0;
|
|
340
|
+
current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
|
|
341
|
+
} else if (typeof swiper.snapIndex !== 'undefined') {
|
|
342
|
+
current = swiper.snapIndex;
|
|
343
|
+
previousIndex = swiper.previousSnapIndex;
|
|
344
|
+
} else {
|
|
345
|
+
previousIndex = swiper.previousIndex || 0;
|
|
346
|
+
current = swiper.activeIndex || 0;
|
|
347
|
+
}
|
|
348
|
+
// Types
|
|
349
|
+
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
|
|
350
|
+
const bullets = swiper.pagination.bullets;
|
|
351
|
+
let firstIndex;
|
|
352
|
+
let lastIndex;
|
|
353
|
+
let midIndex;
|
|
354
|
+
if (params.dynamicBullets) {
|
|
355
|
+
bulletSize = utils.elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height');
|
|
356
|
+
el.forEach(subEl => {
|
|
357
|
+
subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
|
|
358
|
+
});
|
|
359
|
+
if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {
|
|
360
|
+
dynamicBulletIndex += current - (previousIndex || 0);
|
|
361
|
+
if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
|
|
362
|
+
dynamicBulletIndex = params.dynamicMainBullets - 1;
|
|
363
|
+
} else if (dynamicBulletIndex < 0) {
|
|
364
|
+
dynamicBulletIndex = 0;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
firstIndex = Math.max(current - dynamicBulletIndex, 0);
|
|
368
|
+
lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
|
|
369
|
+
midIndex = (lastIndex + firstIndex) / 2;
|
|
370
|
+
}
|
|
371
|
+
bullets.forEach(bulletEl => {
|
|
372
|
+
const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();
|
|
373
|
+
bulletEl.classList.remove(...classesToRemove);
|
|
374
|
+
});
|
|
375
|
+
if (el.length > 1) {
|
|
376
|
+
bullets.forEach(bullet => {
|
|
377
|
+
const bulletIndex = utils.elementIndex(bullet);
|
|
378
|
+
if (bulletIndex === current) {
|
|
379
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
380
|
+
} else if (swiper.isElement) {
|
|
381
|
+
bullet.setAttribute('part', 'bullet');
|
|
382
|
+
}
|
|
383
|
+
if (params.dynamicBullets) {
|
|
384
|
+
if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
|
|
385
|
+
bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
386
|
+
}
|
|
387
|
+
if (bulletIndex === firstIndex) {
|
|
388
|
+
setSideBullets(bullet, 'prev');
|
|
389
|
+
}
|
|
390
|
+
if (bulletIndex === lastIndex) {
|
|
391
|
+
setSideBullets(bullet, 'next');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
} else {
|
|
396
|
+
const bullet = bullets[current];
|
|
397
|
+
if (bullet) {
|
|
398
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
399
|
+
}
|
|
400
|
+
if (swiper.isElement) {
|
|
401
|
+
bullets.forEach((bulletEl, bulletIndex) => {
|
|
402
|
+
bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
if (params.dynamicBullets) {
|
|
406
|
+
const firstDisplayedBullet = bullets[firstIndex];
|
|
407
|
+
const lastDisplayedBullet = bullets[lastIndex];
|
|
408
|
+
for (let i = firstIndex; i <= lastIndex; i += 1) {
|
|
409
|
+
if (bullets[i]) {
|
|
410
|
+
bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
setSideBullets(firstDisplayedBullet, 'prev');
|
|
414
|
+
setSideBullets(lastDisplayedBullet, 'next');
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (params.dynamicBullets) {
|
|
418
|
+
const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
|
|
419
|
+
const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
|
|
420
|
+
const offsetProp = rtl ? 'right' : 'left';
|
|
421
|
+
bullets.forEach(bullet => {
|
|
422
|
+
bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
el.forEach((subEl, subElIndex) => {
|
|
427
|
+
if (params.type === 'fraction') {
|
|
428
|
+
subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
|
|
429
|
+
fractionEl.textContent = params.formatFractionCurrent(current + 1);
|
|
430
|
+
});
|
|
431
|
+
subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
|
|
432
|
+
totalEl.textContent = params.formatFractionTotal(total);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (params.type === 'progressbar') {
|
|
436
|
+
let progressbarDirection;
|
|
437
|
+
if (params.progressbarOpposite) {
|
|
438
|
+
progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
|
|
439
|
+
} else {
|
|
440
|
+
progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
|
|
441
|
+
}
|
|
442
|
+
const scale = (current + 1) / total;
|
|
443
|
+
let scaleX = 1;
|
|
444
|
+
let scaleY = 1;
|
|
445
|
+
if (progressbarDirection === 'horizontal') {
|
|
446
|
+
scaleX = scale;
|
|
447
|
+
} else {
|
|
448
|
+
scaleY = scale;
|
|
449
|
+
}
|
|
450
|
+
subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
|
|
451
|
+
progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
|
|
452
|
+
progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
if (params.type === 'custom' && params.renderCustom) {
|
|
456
|
+
utils.setInnerHTML(subEl, params.renderCustom(swiper, current + 1, total));
|
|
457
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
458
|
+
} else {
|
|
459
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
460
|
+
emit('paginationUpdate', subEl);
|
|
461
|
+
}
|
|
462
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
463
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
function render() {
|
|
468
|
+
// Render Container
|
|
469
|
+
const params = swiper.params.pagination;
|
|
470
|
+
if (isPaginationDisabled()) return;
|
|
471
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length;
|
|
472
|
+
let el = swiper.pagination.el;
|
|
473
|
+
el = utils.makeElementsArray(el);
|
|
474
|
+
let paginationHTML = '';
|
|
475
|
+
if (params.type === 'bullets') {
|
|
476
|
+
let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
477
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
|
|
478
|
+
numberOfBullets = slidesLength;
|
|
479
|
+
}
|
|
480
|
+
for (let i = 0; i < numberOfBullets; i += 1) {
|
|
481
|
+
if (params.renderBullet) {
|
|
482
|
+
paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
|
|
483
|
+
} else {
|
|
484
|
+
// prettier-ignore
|
|
485
|
+
paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (params.type === 'fraction') {
|
|
490
|
+
if (params.renderFraction) {
|
|
491
|
+
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
|
|
492
|
+
} else {
|
|
493
|
+
paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (params.type === 'progressbar') {
|
|
497
|
+
if (params.renderProgressbar) {
|
|
498
|
+
paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
|
|
499
|
+
} else {
|
|
500
|
+
paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
swiper.pagination.bullets = [];
|
|
504
|
+
el.forEach(subEl => {
|
|
505
|
+
if (params.type !== 'custom') {
|
|
506
|
+
utils.setInnerHTML(subEl, paginationHTML || '');
|
|
507
|
+
}
|
|
508
|
+
if (params.type === 'bullets') {
|
|
509
|
+
swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
if (params.type !== 'custom') {
|
|
513
|
+
emit('paginationRender', el[0]);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function init() {
|
|
517
|
+
swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
|
|
518
|
+
el: 'swiper-pagination'
|
|
519
|
+
});
|
|
520
|
+
const params = swiper.params.pagination;
|
|
521
|
+
if (!params.el) return;
|
|
522
|
+
let el;
|
|
523
|
+
if (typeof params.el === 'string' && swiper.isElement) {
|
|
524
|
+
el = swiper.el.querySelector(params.el);
|
|
525
|
+
}
|
|
526
|
+
if (!el && typeof params.el === 'string') {
|
|
527
|
+
el = [...document.querySelectorAll(params.el)];
|
|
528
|
+
}
|
|
529
|
+
if (!el) {
|
|
530
|
+
el = params.el;
|
|
531
|
+
}
|
|
532
|
+
if (!el || el.length === 0) return;
|
|
533
|
+
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
|
|
534
|
+
el = [...swiper.el.querySelectorAll(params.el)];
|
|
535
|
+
// check if it belongs to another nested Swiper
|
|
536
|
+
if (el.length > 1) {
|
|
537
|
+
el = el.find(subEl => {
|
|
538
|
+
if (utils.elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
|
|
539
|
+
return true;
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (Array.isArray(el) && el.length === 1) el = el[0];
|
|
544
|
+
Object.assign(swiper.pagination, {
|
|
545
|
+
el
|
|
546
|
+
});
|
|
547
|
+
el = utils.makeElementsArray(el);
|
|
548
|
+
el.forEach(subEl => {
|
|
549
|
+
if (params.type === 'bullets' && params.clickable) {
|
|
550
|
+
subEl.classList.add(...(params.clickableClass || '').split(' '));
|
|
551
|
+
}
|
|
552
|
+
subEl.classList.add(params.modifierClass + params.type);
|
|
553
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
554
|
+
if (params.type === 'bullets' && params.dynamicBullets) {
|
|
555
|
+
subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
|
|
556
|
+
dynamicBulletIndex = 0;
|
|
557
|
+
if (params.dynamicMainBullets < 1) {
|
|
558
|
+
params.dynamicMainBullets = 1;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (params.type === 'progressbar' && params.progressbarOpposite) {
|
|
562
|
+
subEl.classList.add(params.progressbarOppositeClass);
|
|
563
|
+
}
|
|
564
|
+
if (params.clickable) {
|
|
565
|
+
subEl.addEventListener('click', onBulletClick);
|
|
566
|
+
}
|
|
567
|
+
if (!swiper.enabled) {
|
|
568
|
+
subEl.classList.add(params.lockClass);
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
function destroy() {
|
|
573
|
+
const params = swiper.params.pagination;
|
|
574
|
+
if (isPaginationDisabled()) return;
|
|
575
|
+
let el = swiper.pagination.el;
|
|
576
|
+
if (el) {
|
|
577
|
+
el = utils.makeElementsArray(el);
|
|
578
|
+
el.forEach(subEl => {
|
|
579
|
+
subEl.classList.remove(params.hiddenClass);
|
|
580
|
+
subEl.classList.remove(params.modifierClass + params.type);
|
|
581
|
+
subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
582
|
+
if (params.clickable) {
|
|
583
|
+
subEl.classList.remove(...(params.clickableClass || '').split(' '));
|
|
584
|
+
subEl.removeEventListener('click', onBulletClick);
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
|
|
589
|
+
}
|
|
590
|
+
on('changeDirection', () => {
|
|
591
|
+
if (!swiper.pagination || !swiper.pagination.el) return;
|
|
592
|
+
const params = swiper.params.pagination;
|
|
593
|
+
let {
|
|
594
|
+
el
|
|
595
|
+
} = swiper.pagination;
|
|
596
|
+
el = utils.makeElementsArray(el);
|
|
597
|
+
el.forEach(subEl => {
|
|
598
|
+
subEl.classList.remove(params.horizontalClass, params.verticalClass);
|
|
599
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
600
|
+
});
|
|
601
|
+
});
|
|
602
|
+
on('init', () => {
|
|
603
|
+
if (swiper.params.pagination.enabled === false) {
|
|
604
|
+
// eslint-disable-next-line
|
|
605
|
+
disable();
|
|
606
|
+
} else {
|
|
607
|
+
init();
|
|
608
|
+
render();
|
|
609
|
+
update();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
on('activeIndexChange', () => {
|
|
613
|
+
if (typeof swiper.snapIndex === 'undefined') {
|
|
614
|
+
update();
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
on('snapIndexChange', () => {
|
|
618
|
+
update();
|
|
619
|
+
});
|
|
620
|
+
on('snapGridLengthChange', () => {
|
|
621
|
+
render();
|
|
622
|
+
update();
|
|
623
|
+
});
|
|
624
|
+
on('destroy', () => {
|
|
625
|
+
destroy();
|
|
626
|
+
});
|
|
627
|
+
on('enable disable', () => {
|
|
628
|
+
let {
|
|
629
|
+
el
|
|
630
|
+
} = swiper.pagination;
|
|
631
|
+
if (el) {
|
|
632
|
+
el = utils.makeElementsArray(el);
|
|
633
|
+
el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
on('lock unlock', () => {
|
|
637
|
+
update();
|
|
638
|
+
});
|
|
639
|
+
on('click', (_s, e) => {
|
|
640
|
+
const targetEl = e.target;
|
|
641
|
+
const el = utils.makeElementsArray(swiper.pagination.el);
|
|
642
|
+
if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
|
|
643
|
+
if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
|
|
644
|
+
const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
|
|
645
|
+
if (isHidden === true) {
|
|
646
|
+
emit('paginationShow');
|
|
647
|
+
} else {
|
|
648
|
+
emit('paginationHide');
|
|
649
|
+
}
|
|
650
|
+
el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
const enable = () => {
|
|
654
|
+
swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
|
|
655
|
+
let {
|
|
656
|
+
el
|
|
657
|
+
} = swiper.pagination;
|
|
658
|
+
if (el) {
|
|
659
|
+
el = utils.makeElementsArray(el);
|
|
660
|
+
el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
|
|
661
|
+
}
|
|
662
|
+
init();
|
|
663
|
+
render();
|
|
664
|
+
update();
|
|
665
|
+
};
|
|
666
|
+
const disable = () => {
|
|
667
|
+
swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
|
|
668
|
+
let {
|
|
669
|
+
el
|
|
670
|
+
} = swiper.pagination;
|
|
671
|
+
if (el) {
|
|
672
|
+
el = utils.makeElementsArray(el);
|
|
673
|
+
el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
|
|
674
|
+
}
|
|
675
|
+
destroy();
|
|
676
|
+
};
|
|
677
|
+
Object.assign(swiper.pagination, {
|
|
678
|
+
enable,
|
|
679
|
+
disable,
|
|
680
|
+
render,
|
|
681
|
+
update,
|
|
682
|
+
init,
|
|
683
|
+
destroy
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
function Scrollbar({
|
|
688
|
+
swiper,
|
|
689
|
+
extendParams,
|
|
690
|
+
on,
|
|
691
|
+
emit
|
|
692
|
+
}) {
|
|
693
|
+
const document = utils.getDocument();
|
|
694
|
+
let isTouched = false;
|
|
695
|
+
let timeout = null;
|
|
696
|
+
let dragTimeout = null;
|
|
697
|
+
let dragStartPos;
|
|
698
|
+
let dragSize;
|
|
699
|
+
let trackSize;
|
|
700
|
+
let divider;
|
|
701
|
+
extendParams({
|
|
702
|
+
scrollbar: {
|
|
703
|
+
el: null,
|
|
704
|
+
dragSize: 'auto',
|
|
705
|
+
hide: false,
|
|
706
|
+
draggable: false,
|
|
707
|
+
snapOnRelease: true,
|
|
708
|
+
lockClass: 'swiper-scrollbar-lock',
|
|
709
|
+
dragClass: 'swiper-scrollbar-drag',
|
|
710
|
+
scrollbarDisabledClass: 'swiper-scrollbar-disabled',
|
|
711
|
+
horizontalClass: `swiper-scrollbar-horizontal`,
|
|
712
|
+
verticalClass: `swiper-scrollbar-vertical`
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
swiper.scrollbar = {
|
|
716
|
+
el: null,
|
|
717
|
+
dragEl: null
|
|
718
|
+
};
|
|
719
|
+
function setTranslate() {
|
|
720
|
+
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
|
|
721
|
+
const {
|
|
722
|
+
scrollbar,
|
|
723
|
+
rtlTranslate: rtl
|
|
724
|
+
} = swiper;
|
|
725
|
+
const {
|
|
726
|
+
dragEl,
|
|
727
|
+
el
|
|
728
|
+
} = scrollbar;
|
|
729
|
+
const params = swiper.params.scrollbar;
|
|
730
|
+
const progress = swiper.params.loop ? swiper.progressLoop : swiper.progress;
|
|
731
|
+
let newSize = dragSize;
|
|
732
|
+
let newPos = (trackSize - dragSize) * progress;
|
|
733
|
+
if (rtl) {
|
|
734
|
+
newPos = -newPos;
|
|
735
|
+
if (newPos > 0) {
|
|
736
|
+
newSize = dragSize - newPos;
|
|
737
|
+
newPos = 0;
|
|
738
|
+
} else if (-newPos + dragSize > trackSize) {
|
|
739
|
+
newSize = trackSize + newPos;
|
|
740
|
+
}
|
|
741
|
+
} else if (newPos < 0) {
|
|
742
|
+
newSize = dragSize + newPos;
|
|
743
|
+
newPos = 0;
|
|
744
|
+
} else if (newPos + dragSize > trackSize) {
|
|
745
|
+
newSize = trackSize - newPos;
|
|
746
|
+
}
|
|
747
|
+
if (swiper.isHorizontal()) {
|
|
748
|
+
dragEl.style.transform = `translate3d(${newPos}px, 0, 0)`;
|
|
749
|
+
dragEl.style.width = `${newSize}px`;
|
|
750
|
+
} else {
|
|
751
|
+
dragEl.style.transform = `translate3d(0px, ${newPos}px, 0)`;
|
|
752
|
+
dragEl.style.height = `${newSize}px`;
|
|
753
|
+
}
|
|
754
|
+
if (params.hide) {
|
|
755
|
+
clearTimeout(timeout);
|
|
756
|
+
el.style.opacity = 1;
|
|
757
|
+
timeout = setTimeout(() => {
|
|
758
|
+
el.style.opacity = 0;
|
|
759
|
+
el.style.transitionDuration = '400ms';
|
|
760
|
+
}, 1000);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
function setTransition(duration) {
|
|
764
|
+
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
|
|
765
|
+
swiper.scrollbar.dragEl.style.transitionDuration = `${duration}ms`;
|
|
766
|
+
}
|
|
767
|
+
function updateSize() {
|
|
768
|
+
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
|
|
769
|
+
const {
|
|
770
|
+
scrollbar
|
|
771
|
+
} = swiper;
|
|
772
|
+
const {
|
|
773
|
+
dragEl,
|
|
774
|
+
el
|
|
775
|
+
} = scrollbar;
|
|
776
|
+
dragEl.style.width = '';
|
|
777
|
+
dragEl.style.height = '';
|
|
778
|
+
trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight;
|
|
779
|
+
divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0));
|
|
780
|
+
if (swiper.params.scrollbar.dragSize === 'auto') {
|
|
781
|
+
dragSize = trackSize * divider;
|
|
782
|
+
} else {
|
|
783
|
+
dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);
|
|
784
|
+
}
|
|
785
|
+
if (swiper.isHorizontal()) {
|
|
786
|
+
dragEl.style.width = `${dragSize}px`;
|
|
787
|
+
} else {
|
|
788
|
+
dragEl.style.height = `${dragSize}px`;
|
|
789
|
+
}
|
|
790
|
+
if (divider >= 1) {
|
|
791
|
+
el.style.display = 'none';
|
|
792
|
+
} else {
|
|
793
|
+
el.style.display = '';
|
|
794
|
+
}
|
|
795
|
+
if (swiper.params.scrollbar.hide) {
|
|
796
|
+
el.style.opacity = 0;
|
|
797
|
+
}
|
|
798
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
799
|
+
scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
function getPointerPosition(e) {
|
|
803
|
+
return swiper.isHorizontal() ? e.clientX : e.clientY;
|
|
804
|
+
}
|
|
805
|
+
function setDragPosition(e) {
|
|
806
|
+
const {
|
|
807
|
+
scrollbar,
|
|
808
|
+
rtlTranslate: rtl
|
|
809
|
+
} = swiper;
|
|
810
|
+
const {
|
|
811
|
+
el
|
|
812
|
+
} = scrollbar;
|
|
813
|
+
let positionRatio;
|
|
814
|
+
positionRatio = (getPointerPosition(e) - utils.elementOffset(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize);
|
|
815
|
+
positionRatio = Math.max(Math.min(positionRatio, 1), 0);
|
|
816
|
+
if (rtl) {
|
|
817
|
+
positionRatio = 1 - positionRatio;
|
|
818
|
+
}
|
|
819
|
+
const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio;
|
|
820
|
+
swiper.updateProgress(position);
|
|
821
|
+
swiper.setTranslate(position);
|
|
822
|
+
swiper.updateActiveIndex();
|
|
823
|
+
swiper.updateSlidesClasses();
|
|
824
|
+
}
|
|
825
|
+
function onDragStart(e) {
|
|
826
|
+
const params = swiper.params.scrollbar;
|
|
827
|
+
const {
|
|
828
|
+
scrollbar,
|
|
829
|
+
wrapperEl
|
|
830
|
+
} = swiper;
|
|
831
|
+
const {
|
|
832
|
+
el,
|
|
833
|
+
dragEl
|
|
834
|
+
} = scrollbar;
|
|
835
|
+
isTouched = true;
|
|
836
|
+
dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null;
|
|
837
|
+
e.preventDefault();
|
|
838
|
+
e.stopPropagation();
|
|
839
|
+
wrapperEl.style.transitionDuration = '100ms';
|
|
840
|
+
dragEl.style.transitionDuration = '100ms';
|
|
841
|
+
setDragPosition(e);
|
|
842
|
+
clearTimeout(dragTimeout);
|
|
843
|
+
el.style.transitionDuration = '0ms';
|
|
844
|
+
if (params.hide) {
|
|
845
|
+
el.style.opacity = 1;
|
|
846
|
+
}
|
|
847
|
+
if (swiper.params.cssMode) {
|
|
848
|
+
swiper.wrapperEl.style['scroll-snap-type'] = 'none';
|
|
849
|
+
}
|
|
850
|
+
emit('scrollbarDragStart', e);
|
|
851
|
+
}
|
|
852
|
+
function onDragMove(e) {
|
|
853
|
+
const {
|
|
854
|
+
scrollbar,
|
|
855
|
+
wrapperEl
|
|
856
|
+
} = swiper;
|
|
857
|
+
const {
|
|
858
|
+
el,
|
|
859
|
+
dragEl
|
|
860
|
+
} = scrollbar;
|
|
861
|
+
if (!isTouched) return;
|
|
862
|
+
if (e.preventDefault && e.cancelable) e.preventDefault();else e.returnValue = false;
|
|
863
|
+
setDragPosition(e);
|
|
864
|
+
wrapperEl.style.transitionDuration = '0ms';
|
|
865
|
+
el.style.transitionDuration = '0ms';
|
|
866
|
+
dragEl.style.transitionDuration = '0ms';
|
|
867
|
+
emit('scrollbarDragMove', e);
|
|
868
|
+
}
|
|
869
|
+
function onDragEnd(e) {
|
|
870
|
+
const params = swiper.params.scrollbar;
|
|
871
|
+
const {
|
|
872
|
+
scrollbar,
|
|
873
|
+
wrapperEl
|
|
874
|
+
} = swiper;
|
|
875
|
+
const {
|
|
876
|
+
el
|
|
877
|
+
} = scrollbar;
|
|
878
|
+
if (!isTouched) return;
|
|
879
|
+
isTouched = false;
|
|
880
|
+
if (swiper.params.cssMode) {
|
|
881
|
+
swiper.wrapperEl.style['scroll-snap-type'] = '';
|
|
882
|
+
wrapperEl.style.transitionDuration = '';
|
|
883
|
+
}
|
|
884
|
+
if (params.hide) {
|
|
885
|
+
clearTimeout(dragTimeout);
|
|
886
|
+
dragTimeout = utils.nextTick(() => {
|
|
887
|
+
el.style.opacity = 0;
|
|
888
|
+
el.style.transitionDuration = '400ms';
|
|
889
|
+
}, 1000);
|
|
890
|
+
}
|
|
891
|
+
emit('scrollbarDragEnd', e);
|
|
892
|
+
if (params.snapOnRelease) {
|
|
893
|
+
swiper.slideToClosest();
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
function events(method) {
|
|
897
|
+
const {
|
|
898
|
+
scrollbar,
|
|
899
|
+
params
|
|
900
|
+
} = swiper;
|
|
901
|
+
const el = scrollbar.el;
|
|
902
|
+
if (!el) return;
|
|
903
|
+
const target = el;
|
|
904
|
+
const activeListener = params.passiveListeners ? {
|
|
905
|
+
passive: false,
|
|
906
|
+
capture: false
|
|
907
|
+
} : false;
|
|
908
|
+
const passiveListener = params.passiveListeners ? {
|
|
909
|
+
passive: true,
|
|
910
|
+
capture: false
|
|
911
|
+
} : false;
|
|
912
|
+
if (!target) return;
|
|
913
|
+
const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
|
|
914
|
+
target[eventMethod]('pointerdown', onDragStart, activeListener);
|
|
915
|
+
document[eventMethod]('pointermove', onDragMove, activeListener);
|
|
916
|
+
document[eventMethod]('pointerup', onDragEnd, passiveListener);
|
|
917
|
+
}
|
|
918
|
+
function enableDraggable() {
|
|
919
|
+
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
|
|
920
|
+
events('on');
|
|
921
|
+
}
|
|
922
|
+
function disableDraggable() {
|
|
923
|
+
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
|
|
924
|
+
events('off');
|
|
925
|
+
}
|
|
926
|
+
function init() {
|
|
927
|
+
const {
|
|
928
|
+
scrollbar,
|
|
929
|
+
el: swiperEl
|
|
930
|
+
} = swiper;
|
|
931
|
+
swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, {
|
|
932
|
+
el: 'swiper-scrollbar'
|
|
933
|
+
});
|
|
934
|
+
const params = swiper.params.scrollbar;
|
|
935
|
+
if (!params.el) return;
|
|
936
|
+
let el;
|
|
937
|
+
if (typeof params.el === 'string' && swiper.isElement) {
|
|
938
|
+
el = swiper.el.querySelector(params.el);
|
|
939
|
+
}
|
|
940
|
+
if (!el && typeof params.el === 'string') {
|
|
941
|
+
el = document.querySelectorAll(params.el);
|
|
942
|
+
if (!el.length) return;
|
|
943
|
+
} else if (!el) {
|
|
944
|
+
el = params.el;
|
|
945
|
+
}
|
|
946
|
+
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) {
|
|
947
|
+
el = swiperEl.querySelector(params.el);
|
|
948
|
+
}
|
|
949
|
+
if (el.length > 0) el = el[0];
|
|
950
|
+
el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
951
|
+
let dragEl;
|
|
952
|
+
if (el) {
|
|
953
|
+
dragEl = el.querySelector(classesToSelector(swiper.params.scrollbar.dragClass));
|
|
954
|
+
if (!dragEl) {
|
|
955
|
+
dragEl = utils.createElement('div', swiper.params.scrollbar.dragClass);
|
|
956
|
+
el.append(dragEl);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
Object.assign(scrollbar, {
|
|
960
|
+
el,
|
|
961
|
+
dragEl
|
|
962
|
+
});
|
|
963
|
+
if (params.draggable) {
|
|
964
|
+
enableDraggable();
|
|
965
|
+
}
|
|
966
|
+
if (el) {
|
|
967
|
+
el.classList[swiper.enabled ? 'remove' : 'add'](...utils.classesToTokens(swiper.params.scrollbar.lockClass));
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
function destroy() {
|
|
971
|
+
const params = swiper.params.scrollbar;
|
|
972
|
+
const el = swiper.scrollbar.el;
|
|
973
|
+
if (el) {
|
|
974
|
+
el.classList.remove(...utils.classesToTokens(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass));
|
|
975
|
+
}
|
|
976
|
+
disableDraggable();
|
|
977
|
+
}
|
|
978
|
+
on('changeDirection', () => {
|
|
979
|
+
if (!swiper.scrollbar || !swiper.scrollbar.el) return;
|
|
980
|
+
const params = swiper.params.scrollbar;
|
|
981
|
+
let {
|
|
982
|
+
el
|
|
983
|
+
} = swiper.scrollbar;
|
|
984
|
+
el = utils.makeElementsArray(el);
|
|
985
|
+
el.forEach(subEl => {
|
|
986
|
+
subEl.classList.remove(params.horizontalClass, params.verticalClass);
|
|
987
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
on('init', () => {
|
|
991
|
+
if (swiper.params.scrollbar.enabled === false) {
|
|
992
|
+
// eslint-disable-next-line
|
|
993
|
+
disable();
|
|
994
|
+
} else {
|
|
995
|
+
init();
|
|
996
|
+
updateSize();
|
|
997
|
+
setTranslate();
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
on('update resize observerUpdate lock unlock changeDirection', () => {
|
|
1001
|
+
updateSize();
|
|
1002
|
+
});
|
|
1003
|
+
on('setTranslate', () => {
|
|
1004
|
+
setTranslate();
|
|
1005
|
+
});
|
|
1006
|
+
on('setTransition', (_s, duration) => {
|
|
1007
|
+
setTransition(duration);
|
|
1008
|
+
});
|
|
1009
|
+
on('enable disable', () => {
|
|
1010
|
+
const {
|
|
1011
|
+
el
|
|
1012
|
+
} = swiper.scrollbar;
|
|
1013
|
+
if (el) {
|
|
1014
|
+
el.classList[swiper.enabled ? 'remove' : 'add'](...utils.classesToTokens(swiper.params.scrollbar.lockClass));
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
on('destroy', () => {
|
|
1018
|
+
destroy();
|
|
1019
|
+
});
|
|
1020
|
+
const enable = () => {
|
|
1021
|
+
swiper.el.classList.remove(...utils.classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass));
|
|
1022
|
+
if (swiper.scrollbar.el) {
|
|
1023
|
+
swiper.scrollbar.el.classList.remove(...utils.classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass));
|
|
1024
|
+
}
|
|
1025
|
+
init();
|
|
1026
|
+
updateSize();
|
|
1027
|
+
setTranslate();
|
|
1028
|
+
};
|
|
1029
|
+
const disable = () => {
|
|
1030
|
+
swiper.el.classList.add(...utils.classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass));
|
|
1031
|
+
if (swiper.scrollbar.el) {
|
|
1032
|
+
swiper.scrollbar.el.classList.add(...utils.classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass));
|
|
1033
|
+
}
|
|
1034
|
+
destroy();
|
|
1035
|
+
};
|
|
1036
|
+
Object.assign(swiper.scrollbar, {
|
|
1037
|
+
enable,
|
|
1038
|
+
disable,
|
|
1039
|
+
updateSize,
|
|
1040
|
+
setTranslate,
|
|
1041
|
+
init,
|
|
1042
|
+
destroy
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
function A11y({
|
|
1047
|
+
swiper,
|
|
1048
|
+
extendParams,
|
|
1049
|
+
on
|
|
1050
|
+
}) {
|
|
1051
|
+
extendParams({
|
|
1052
|
+
a11y: {
|
|
1053
|
+
enabled: true,
|
|
1054
|
+
notificationClass: 'swiper-notification',
|
|
1055
|
+
prevSlideMessage: 'Previous slide',
|
|
1056
|
+
nextSlideMessage: 'Next slide',
|
|
1057
|
+
firstSlideMessage: 'This is the first slide',
|
|
1058
|
+
lastSlideMessage: 'This is the last slide',
|
|
1059
|
+
paginationBulletMessage: 'Go to slide {{index}}',
|
|
1060
|
+
slideLabelMessage: '{{index}} / {{slidesLength}}',
|
|
1061
|
+
containerMessage: null,
|
|
1062
|
+
containerRoleDescriptionMessage: null,
|
|
1063
|
+
containerRole: null,
|
|
1064
|
+
itemRoleDescriptionMessage: null,
|
|
1065
|
+
slideRole: 'group',
|
|
1066
|
+
id: null,
|
|
1067
|
+
scrollOnFocus: true,
|
|
1068
|
+
wrapperLiveRegion: true
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
swiper.a11y = {
|
|
1072
|
+
clicked: false
|
|
1073
|
+
};
|
|
1074
|
+
let liveRegion = null;
|
|
1075
|
+
let preventFocusHandler;
|
|
1076
|
+
let focusTargetSlideEl;
|
|
1077
|
+
let visibilityChangedTimestamp = new Date().getTime();
|
|
1078
|
+
function notify(message) {
|
|
1079
|
+
const notification = liveRegion;
|
|
1080
|
+
if (notification.length === 0) return;
|
|
1081
|
+
utils.setInnerHTML(notification, message);
|
|
1082
|
+
}
|
|
1083
|
+
function getRandomNumber(size = 16) {
|
|
1084
|
+
const randomChar = () => Math.round(16 * Math.random()).toString(16);
|
|
1085
|
+
return 'x'.repeat(size).replace(/x/g, randomChar);
|
|
1086
|
+
}
|
|
1087
|
+
function makeElFocusable(el) {
|
|
1088
|
+
el = utils.makeElementsArray(el);
|
|
1089
|
+
el.forEach(subEl => {
|
|
1090
|
+
subEl.setAttribute('tabIndex', '0');
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
function makeElNotFocusable(el) {
|
|
1094
|
+
el = utils.makeElementsArray(el);
|
|
1095
|
+
el.forEach(subEl => {
|
|
1096
|
+
subEl.setAttribute('tabIndex', '-1');
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
function addElRole(el, role) {
|
|
1100
|
+
el = utils.makeElementsArray(el);
|
|
1101
|
+
el.forEach(subEl => {
|
|
1102
|
+
subEl.setAttribute('role', role);
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
function addElRoleDescription(el, description) {
|
|
1106
|
+
el = utils.makeElementsArray(el);
|
|
1107
|
+
el.forEach(subEl => {
|
|
1108
|
+
subEl.setAttribute('aria-roledescription', description);
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
function addElLabel(el, label) {
|
|
1112
|
+
el = utils.makeElementsArray(el);
|
|
1113
|
+
el.forEach(subEl => {
|
|
1114
|
+
subEl.setAttribute('aria-label', label);
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
function addElId(el, id) {
|
|
1118
|
+
el = utils.makeElementsArray(el);
|
|
1119
|
+
el.forEach(subEl => {
|
|
1120
|
+
subEl.setAttribute('id', id);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
function addElLive(el, live) {
|
|
1124
|
+
el = utils.makeElementsArray(el);
|
|
1125
|
+
el.forEach(subEl => {
|
|
1126
|
+
subEl.setAttribute('aria-live', live);
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
function disableEl(el) {
|
|
1130
|
+
el = utils.makeElementsArray(el);
|
|
1131
|
+
el.forEach(subEl => {
|
|
1132
|
+
subEl.setAttribute('aria-disabled', true);
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
function enableEl(el) {
|
|
1136
|
+
el = utils.makeElementsArray(el);
|
|
1137
|
+
el.forEach(subEl => {
|
|
1138
|
+
subEl.removeAttribute('aria-disabled');
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
function onEnterOrSpaceKey(e) {
|
|
1142
|
+
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
|
1143
|
+
const params = swiper.params.a11y;
|
|
1144
|
+
const targetEl = e.target;
|
|
1145
|
+
if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
|
|
1146
|
+
if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
|
|
1147
|
+
}
|
|
1148
|
+
if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) {
|
|
1149
|
+
const prevEls = utils.makeElementsArray(swiper.navigation.prevEl);
|
|
1150
|
+
const nextEls = utils.makeElementsArray(swiper.navigation.nextEl);
|
|
1151
|
+
if (nextEls.includes(targetEl)) {
|
|
1152
|
+
if (!(swiper.isEnd && !swiper.params.loop)) {
|
|
1153
|
+
swiper.slideNext();
|
|
1154
|
+
}
|
|
1155
|
+
if (swiper.isEnd) {
|
|
1156
|
+
notify(params.lastSlideMessage);
|
|
1157
|
+
} else {
|
|
1158
|
+
notify(params.nextSlideMessage);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
if (prevEls.includes(targetEl)) {
|
|
1162
|
+
if (!(swiper.isBeginning && !swiper.params.loop)) {
|
|
1163
|
+
swiper.slidePrev();
|
|
1164
|
+
}
|
|
1165
|
+
if (swiper.isBeginning) {
|
|
1166
|
+
notify(params.firstSlideMessage);
|
|
1167
|
+
} else {
|
|
1168
|
+
notify(params.prevSlideMessage);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
|
|
1173
|
+
targetEl.click();
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
function updateNavigation() {
|
|
1177
|
+
if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
|
|
1178
|
+
const {
|
|
1179
|
+
nextEl,
|
|
1180
|
+
prevEl
|
|
1181
|
+
} = swiper.navigation;
|
|
1182
|
+
if (prevEl) {
|
|
1183
|
+
if (swiper.isBeginning) {
|
|
1184
|
+
disableEl(prevEl);
|
|
1185
|
+
makeElNotFocusable(prevEl);
|
|
1186
|
+
} else {
|
|
1187
|
+
enableEl(prevEl);
|
|
1188
|
+
makeElFocusable(prevEl);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
if (nextEl) {
|
|
1192
|
+
if (swiper.isEnd) {
|
|
1193
|
+
disableEl(nextEl);
|
|
1194
|
+
makeElNotFocusable(nextEl);
|
|
1195
|
+
} else {
|
|
1196
|
+
enableEl(nextEl);
|
|
1197
|
+
makeElFocusable(nextEl);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function hasPagination() {
|
|
1202
|
+
return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
|
|
1203
|
+
}
|
|
1204
|
+
function hasClickablePagination() {
|
|
1205
|
+
return hasPagination() && swiper.params.pagination.clickable;
|
|
1206
|
+
}
|
|
1207
|
+
function updatePagination() {
|
|
1208
|
+
const params = swiper.params.a11y;
|
|
1209
|
+
if (!hasPagination()) return;
|
|
1210
|
+
swiper.pagination.bullets.forEach(bulletEl => {
|
|
1211
|
+
if (swiper.params.pagination.clickable) {
|
|
1212
|
+
makeElFocusable(bulletEl);
|
|
1213
|
+
if (!swiper.params.pagination.renderBullet) {
|
|
1214
|
+
addElRole(bulletEl, 'button');
|
|
1215
|
+
addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, utils.elementIndex(bulletEl) + 1));
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) {
|
|
1219
|
+
bulletEl.setAttribute('aria-current', 'true');
|
|
1220
|
+
} else {
|
|
1221
|
+
bulletEl.removeAttribute('aria-current');
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
const initNavEl = (el, wrapperId, message) => {
|
|
1226
|
+
makeElFocusable(el);
|
|
1227
|
+
if (el.tagName !== 'BUTTON') {
|
|
1228
|
+
addElRole(el, 'button');
|
|
1229
|
+
el.addEventListener('keydown', onEnterOrSpaceKey);
|
|
1230
|
+
}
|
|
1231
|
+
addElLabel(el, message);
|
|
1232
|
+
};
|
|
1233
|
+
const handlePointerDown = e => {
|
|
1234
|
+
if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) {
|
|
1235
|
+
preventFocusHandler = true;
|
|
1236
|
+
}
|
|
1237
|
+
swiper.a11y.clicked = true;
|
|
1238
|
+
};
|
|
1239
|
+
const handlePointerUp = () => {
|
|
1240
|
+
preventFocusHandler = false;
|
|
1241
|
+
requestAnimationFrame(() => {
|
|
1242
|
+
requestAnimationFrame(() => {
|
|
1243
|
+
if (!swiper.destroyed) {
|
|
1244
|
+
swiper.a11y.clicked = false;
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
});
|
|
1248
|
+
};
|
|
1249
|
+
const onVisibilityChange = e => {
|
|
1250
|
+
visibilityChangedTimestamp = new Date().getTime();
|
|
1251
|
+
};
|
|
1252
|
+
const handleFocus = e => {
|
|
1253
|
+
if (swiper.a11y.clicked || !swiper.params.a11y.scrollOnFocus) return;
|
|
1254
|
+
if (new Date().getTime() - visibilityChangedTimestamp < 100) return;
|
|
1255
|
+
const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
|
|
1256
|
+
if (!slideEl || !swiper.slides.includes(slideEl)) return;
|
|
1257
|
+
focusTargetSlideEl = slideEl;
|
|
1258
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
1259
|
+
const isActive = (isVirtual ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : swiper.slides.indexOf(slideEl)) === swiper.activeIndex;
|
|
1260
|
+
const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
|
|
1261
|
+
if (isActive || isVisible) return;
|
|
1262
|
+
if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
|
|
1263
|
+
if (swiper.isHorizontal()) {
|
|
1264
|
+
swiper.el.scrollLeft = 0;
|
|
1265
|
+
} else {
|
|
1266
|
+
swiper.el.scrollTop = 0;
|
|
1267
|
+
}
|
|
1268
|
+
requestAnimationFrame(() => {
|
|
1269
|
+
if (preventFocusHandler) return;
|
|
1270
|
+
if (swiper.params.loop) {
|
|
1271
|
+
swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'))), 0);
|
|
1272
|
+
} else if (isVirtual) {
|
|
1273
|
+
swiper.slideTo(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10)), 0);
|
|
1274
|
+
} else {
|
|
1275
|
+
swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0);
|
|
1276
|
+
}
|
|
1277
|
+
preventFocusHandler = false;
|
|
1278
|
+
});
|
|
1279
|
+
};
|
|
1280
|
+
const initSlides = () => {
|
|
1281
|
+
const params = swiper.params.a11y;
|
|
1282
|
+
if (params.itemRoleDescriptionMessage) {
|
|
1283
|
+
addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage);
|
|
1284
|
+
}
|
|
1285
|
+
if (params.slideRole) {
|
|
1286
|
+
addElRole(swiper.slides, params.slideRole);
|
|
1287
|
+
}
|
|
1288
|
+
const slidesLength = swiper.slides.length;
|
|
1289
|
+
if (params.slideLabelMessage) {
|
|
1290
|
+
swiper.slides.forEach((slideEl, index) => {
|
|
1291
|
+
const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index;
|
|
1292
|
+
const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
|
|
1293
|
+
addElLabel(slideEl, ariaLabelMessage);
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
const init = () => {
|
|
1298
|
+
const params = swiper.params.a11y;
|
|
1299
|
+
swiper.el.append(liveRegion);
|
|
1300
|
+
|
|
1301
|
+
// Container
|
|
1302
|
+
const containerEl = swiper.el;
|
|
1303
|
+
if (params.containerRoleDescriptionMessage) {
|
|
1304
|
+
addElRoleDescription(containerEl, params.containerRoleDescriptionMessage);
|
|
1305
|
+
}
|
|
1306
|
+
if (params.containerMessage) {
|
|
1307
|
+
addElLabel(containerEl, params.containerMessage);
|
|
1308
|
+
}
|
|
1309
|
+
if (params.containerRole) {
|
|
1310
|
+
addElRole(containerEl, params.containerRole);
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
// Wrapper
|
|
1314
|
+
const wrapperEl = swiper.wrapperEl;
|
|
1315
|
+
const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`;
|
|
1316
|
+
addElId(wrapperEl, wrapperId);
|
|
1317
|
+
if (params.wrapperLiveRegion) {
|
|
1318
|
+
const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
|
|
1319
|
+
addElLive(wrapperEl, live);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// Slide
|
|
1323
|
+
initSlides();
|
|
1324
|
+
|
|
1325
|
+
// Navigation
|
|
1326
|
+
let {
|
|
1327
|
+
nextEl,
|
|
1328
|
+
prevEl
|
|
1329
|
+
} = swiper.navigation ? swiper.navigation : {};
|
|
1330
|
+
nextEl = utils.makeElementsArray(nextEl);
|
|
1331
|
+
prevEl = utils.makeElementsArray(prevEl);
|
|
1332
|
+
if (nextEl) {
|
|
1333
|
+
nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage));
|
|
1334
|
+
}
|
|
1335
|
+
if (prevEl) {
|
|
1336
|
+
prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage));
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// Pagination
|
|
1340
|
+
if (hasClickablePagination()) {
|
|
1341
|
+
const paginationEl = utils.makeElementsArray(swiper.pagination.el);
|
|
1342
|
+
paginationEl.forEach(el => {
|
|
1343
|
+
el.addEventListener('keydown', onEnterOrSpaceKey);
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
// Tab focus
|
|
1348
|
+
const document = utils.getDocument();
|
|
1349
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
1350
|
+
swiper.el.addEventListener('focus', handleFocus, true);
|
|
1351
|
+
swiper.el.addEventListener('pointerdown', handlePointerDown, true);
|
|
1352
|
+
swiper.el.addEventListener('pointerup', handlePointerUp, true);
|
|
1353
|
+
};
|
|
1354
|
+
function destroy() {
|
|
1355
|
+
if (liveRegion) liveRegion.remove();
|
|
1356
|
+
let {
|
|
1357
|
+
nextEl,
|
|
1358
|
+
prevEl
|
|
1359
|
+
} = swiper.navigation ? swiper.navigation : {};
|
|
1360
|
+
nextEl = utils.makeElementsArray(nextEl);
|
|
1361
|
+
prevEl = utils.makeElementsArray(prevEl);
|
|
1362
|
+
if (nextEl) {
|
|
1363
|
+
nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
|
|
1364
|
+
}
|
|
1365
|
+
if (prevEl) {
|
|
1366
|
+
prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
// Pagination
|
|
1370
|
+
if (hasClickablePagination()) {
|
|
1371
|
+
const paginationEl = utils.makeElementsArray(swiper.pagination.el);
|
|
1372
|
+
paginationEl.forEach(el => {
|
|
1373
|
+
el.removeEventListener('keydown', onEnterOrSpaceKey);
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
const document = utils.getDocument();
|
|
1377
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
1378
|
+
// Tab focus
|
|
1379
|
+
if (swiper.el && typeof swiper.el !== 'string') {
|
|
1380
|
+
swiper.el.removeEventListener('focus', handleFocus, true);
|
|
1381
|
+
swiper.el.removeEventListener('pointerdown', handlePointerDown, true);
|
|
1382
|
+
swiper.el.removeEventListener('pointerup', handlePointerUp, true);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
on('beforeInit', () => {
|
|
1386
|
+
liveRegion = utils.createElement('span', swiper.params.a11y.notificationClass);
|
|
1387
|
+
liveRegion.setAttribute('aria-live', 'assertive');
|
|
1388
|
+
liveRegion.setAttribute('aria-atomic', 'true');
|
|
1389
|
+
});
|
|
1390
|
+
on('afterInit', () => {
|
|
1391
|
+
if (!swiper.params.a11y.enabled) return;
|
|
1392
|
+
init();
|
|
1393
|
+
});
|
|
1394
|
+
on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {
|
|
1395
|
+
if (!swiper.params.a11y.enabled) return;
|
|
1396
|
+
initSlides();
|
|
1397
|
+
});
|
|
1398
|
+
on('fromEdge toEdge afterInit lock unlock', () => {
|
|
1399
|
+
if (!swiper.params.a11y.enabled) return;
|
|
1400
|
+
updateNavigation();
|
|
1401
|
+
});
|
|
1402
|
+
on('paginationUpdate', () => {
|
|
1403
|
+
if (!swiper.params.a11y.enabled) return;
|
|
1404
|
+
updatePagination();
|
|
1405
|
+
});
|
|
1406
|
+
on('destroy', () => {
|
|
1407
|
+
if (!swiper.params.a11y.enabled) return;
|
|
1408
|
+
destroy();
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/* eslint no-underscore-dangle: "off" */
|
|
1413
|
+
/* eslint no-use-before-define: "off" */
|
|
1414
|
+
function Autoplay({
|
|
1415
|
+
swiper,
|
|
1416
|
+
extendParams,
|
|
1417
|
+
on,
|
|
1418
|
+
emit,
|
|
1419
|
+
params
|
|
1420
|
+
}) {
|
|
1421
|
+
swiper.autoplay = {
|
|
1422
|
+
running: false,
|
|
1423
|
+
paused: false,
|
|
1424
|
+
timeLeft: 0
|
|
1425
|
+
};
|
|
1426
|
+
extendParams({
|
|
1427
|
+
autoplay: {
|
|
1428
|
+
enabled: false,
|
|
1429
|
+
delay: 3000,
|
|
1430
|
+
waitForTransition: true,
|
|
1431
|
+
disableOnInteraction: false,
|
|
1432
|
+
stopOnLastSlide: false,
|
|
1433
|
+
reverseDirection: false,
|
|
1434
|
+
pauseOnMouseEnter: false
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
let timeout;
|
|
1438
|
+
let raf;
|
|
1439
|
+
let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;
|
|
1440
|
+
let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;
|
|
1441
|
+
let autoplayTimeLeft;
|
|
1442
|
+
let autoplayStartTime = new Date().getTime();
|
|
1443
|
+
let wasPaused;
|
|
1444
|
+
let isTouched;
|
|
1445
|
+
let pausedByTouch;
|
|
1446
|
+
let touchStartTimeout;
|
|
1447
|
+
let pausedByInteraction;
|
|
1448
|
+
let pausedByPointerEnter;
|
|
1449
|
+
function onTransitionEnd(e) {
|
|
1450
|
+
if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
|
|
1451
|
+
if (e.target !== swiper.wrapperEl) return;
|
|
1452
|
+
swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
|
|
1453
|
+
if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
resume();
|
|
1457
|
+
}
|
|
1458
|
+
const calcTimeLeft = () => {
|
|
1459
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1460
|
+
if (swiper.autoplay.paused) {
|
|
1461
|
+
wasPaused = true;
|
|
1462
|
+
} else if (wasPaused) {
|
|
1463
|
+
autoplayDelayCurrent = autoplayTimeLeft;
|
|
1464
|
+
wasPaused = false;
|
|
1465
|
+
}
|
|
1466
|
+
const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime();
|
|
1467
|
+
swiper.autoplay.timeLeft = timeLeft;
|
|
1468
|
+
emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal);
|
|
1469
|
+
raf = requestAnimationFrame(() => {
|
|
1470
|
+
calcTimeLeft();
|
|
1471
|
+
});
|
|
1472
|
+
};
|
|
1473
|
+
const getSlideDelay = () => {
|
|
1474
|
+
let activeSlideEl;
|
|
1475
|
+
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
1476
|
+
activeSlideEl = swiper.slides.find(slideEl => slideEl.classList.contains('swiper-slide-active'));
|
|
1477
|
+
} else {
|
|
1478
|
+
activeSlideEl = swiper.slides[swiper.activeIndex];
|
|
1479
|
+
}
|
|
1480
|
+
if (!activeSlideEl) return undefined;
|
|
1481
|
+
const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10);
|
|
1482
|
+
return currentSlideDelay;
|
|
1483
|
+
};
|
|
1484
|
+
const getTotalDelay = () => {
|
|
1485
|
+
let totalDelay = swiper.params.autoplay.delay;
|
|
1486
|
+
const currentSlideDelay = getSlideDelay();
|
|
1487
|
+
if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0) {
|
|
1488
|
+
totalDelay = currentSlideDelay;
|
|
1489
|
+
}
|
|
1490
|
+
return totalDelay;
|
|
1491
|
+
};
|
|
1492
|
+
const run = delayForce => {
|
|
1493
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1494
|
+
cancelAnimationFrame(raf);
|
|
1495
|
+
calcTimeLeft();
|
|
1496
|
+
let delay = delayForce;
|
|
1497
|
+
if (typeof delay === 'undefined') {
|
|
1498
|
+
delay = getTotalDelay();
|
|
1499
|
+
autoplayDelayTotal = delay;
|
|
1500
|
+
autoplayDelayCurrent = delay;
|
|
1501
|
+
}
|
|
1502
|
+
autoplayTimeLeft = delay;
|
|
1503
|
+
const speed = swiper.params.speed;
|
|
1504
|
+
const proceed = () => {
|
|
1505
|
+
if (!swiper || swiper.destroyed) return;
|
|
1506
|
+
if (swiper.params.autoplay.reverseDirection) {
|
|
1507
|
+
if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) {
|
|
1508
|
+
swiper.slidePrev(speed, true, true);
|
|
1509
|
+
emit('autoplay');
|
|
1510
|
+
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
1511
|
+
swiper.slideTo(swiper.slides.length - 1, speed, true, true);
|
|
1512
|
+
emit('autoplay');
|
|
1513
|
+
}
|
|
1514
|
+
} else {
|
|
1515
|
+
if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) {
|
|
1516
|
+
swiper.slideNext(speed, true, true);
|
|
1517
|
+
emit('autoplay');
|
|
1518
|
+
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
1519
|
+
swiper.slideTo(0, speed, true, true);
|
|
1520
|
+
emit('autoplay');
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (swiper.params.cssMode) {
|
|
1524
|
+
autoplayStartTime = new Date().getTime();
|
|
1525
|
+
requestAnimationFrame(() => {
|
|
1526
|
+
run();
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
if (delay > 0) {
|
|
1531
|
+
clearTimeout(timeout);
|
|
1532
|
+
timeout = setTimeout(() => {
|
|
1533
|
+
proceed();
|
|
1534
|
+
}, delay);
|
|
1535
|
+
} else {
|
|
1536
|
+
requestAnimationFrame(() => {
|
|
1537
|
+
proceed();
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
// eslint-disable-next-line
|
|
1542
|
+
return delay;
|
|
1543
|
+
};
|
|
1544
|
+
const start = () => {
|
|
1545
|
+
autoplayStartTime = new Date().getTime();
|
|
1546
|
+
swiper.autoplay.running = true;
|
|
1547
|
+
run();
|
|
1548
|
+
emit('autoplayStart');
|
|
1549
|
+
};
|
|
1550
|
+
const stop = () => {
|
|
1551
|
+
swiper.autoplay.running = false;
|
|
1552
|
+
clearTimeout(timeout);
|
|
1553
|
+
cancelAnimationFrame(raf);
|
|
1554
|
+
emit('autoplayStop');
|
|
1555
|
+
};
|
|
1556
|
+
const pause = (internal, reset) => {
|
|
1557
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1558
|
+
clearTimeout(timeout);
|
|
1559
|
+
if (!internal) {
|
|
1560
|
+
pausedByInteraction = true;
|
|
1561
|
+
}
|
|
1562
|
+
const proceed = () => {
|
|
1563
|
+
emit('autoplayPause');
|
|
1564
|
+
if (swiper.params.autoplay.waitForTransition) {
|
|
1565
|
+
swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd);
|
|
1566
|
+
} else {
|
|
1567
|
+
resume();
|
|
1568
|
+
}
|
|
1569
|
+
};
|
|
1570
|
+
swiper.autoplay.paused = true;
|
|
1571
|
+
if (reset) {
|
|
1572
|
+
proceed();
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
const delay = autoplayTimeLeft || swiper.params.autoplay.delay;
|
|
1576
|
+
autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime);
|
|
1577
|
+
if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return;
|
|
1578
|
+
if (autoplayTimeLeft < 0) autoplayTimeLeft = 0;
|
|
1579
|
+
proceed();
|
|
1580
|
+
};
|
|
1581
|
+
const resume = () => {
|
|
1582
|
+
if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return;
|
|
1583
|
+
autoplayStartTime = new Date().getTime();
|
|
1584
|
+
if (pausedByInteraction) {
|
|
1585
|
+
pausedByInteraction = false;
|
|
1586
|
+
run(autoplayTimeLeft);
|
|
1587
|
+
} else {
|
|
1588
|
+
run();
|
|
1589
|
+
}
|
|
1590
|
+
swiper.autoplay.paused = false;
|
|
1591
|
+
emit('autoplayResume');
|
|
1592
|
+
};
|
|
1593
|
+
const onVisibilityChange = () => {
|
|
1594
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1595
|
+
const document = utils.getDocument();
|
|
1596
|
+
if (document.visibilityState === 'hidden') {
|
|
1597
|
+
pausedByInteraction = true;
|
|
1598
|
+
pause(true);
|
|
1599
|
+
}
|
|
1600
|
+
if (document.visibilityState === 'visible') {
|
|
1601
|
+
resume();
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
const onPointerEnter = e => {
|
|
1605
|
+
if (e.pointerType !== 'mouse') return;
|
|
1606
|
+
pausedByInteraction = true;
|
|
1607
|
+
pausedByPointerEnter = true;
|
|
1608
|
+
if (swiper.animating || swiper.autoplay.paused) return;
|
|
1609
|
+
pause(true);
|
|
1610
|
+
};
|
|
1611
|
+
const onPointerLeave = e => {
|
|
1612
|
+
if (e.pointerType !== 'mouse') return;
|
|
1613
|
+
pausedByPointerEnter = false;
|
|
1614
|
+
if (swiper.autoplay.paused) {
|
|
1615
|
+
resume();
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
const attachMouseEvents = () => {
|
|
1619
|
+
if (swiper.params.autoplay.pauseOnMouseEnter) {
|
|
1620
|
+
swiper.el.addEventListener('pointerenter', onPointerEnter);
|
|
1621
|
+
swiper.el.addEventListener('pointerleave', onPointerLeave);
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
const detachMouseEvents = () => {
|
|
1625
|
+
if (swiper.el && typeof swiper.el !== 'string') {
|
|
1626
|
+
swiper.el.removeEventListener('pointerenter', onPointerEnter);
|
|
1627
|
+
swiper.el.removeEventListener('pointerleave', onPointerLeave);
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
const attachDocumentEvents = () => {
|
|
1631
|
+
const document = utils.getDocument();
|
|
1632
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
1633
|
+
};
|
|
1634
|
+
const detachDocumentEvents = () => {
|
|
1635
|
+
const document = utils.getDocument();
|
|
1636
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
1637
|
+
};
|
|
1638
|
+
on('init', () => {
|
|
1639
|
+
if (swiper.params.autoplay.enabled) {
|
|
1640
|
+
attachMouseEvents();
|
|
1641
|
+
attachDocumentEvents();
|
|
1642
|
+
start();
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
on('destroy', () => {
|
|
1646
|
+
detachMouseEvents();
|
|
1647
|
+
detachDocumentEvents();
|
|
1648
|
+
if (swiper.autoplay.running) {
|
|
1649
|
+
stop();
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1652
|
+
on('_freeModeStaticRelease', () => {
|
|
1653
|
+
if (pausedByTouch || pausedByInteraction) {
|
|
1654
|
+
resume();
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
on('_freeModeNoMomentumRelease', () => {
|
|
1658
|
+
if (!swiper.params.autoplay.disableOnInteraction) {
|
|
1659
|
+
pause(true, true);
|
|
1660
|
+
} else {
|
|
1661
|
+
stop();
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
on('beforeTransitionStart', (_s, speed, internal) => {
|
|
1665
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1666
|
+
if (internal || !swiper.params.autoplay.disableOnInteraction) {
|
|
1667
|
+
pause(true, true);
|
|
1668
|
+
} else {
|
|
1669
|
+
stop();
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
on('sliderFirstMove', () => {
|
|
1673
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1674
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
1675
|
+
stop();
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
isTouched = true;
|
|
1679
|
+
pausedByTouch = false;
|
|
1680
|
+
pausedByInteraction = false;
|
|
1681
|
+
touchStartTimeout = setTimeout(() => {
|
|
1682
|
+
pausedByInteraction = true;
|
|
1683
|
+
pausedByTouch = true;
|
|
1684
|
+
pause(true);
|
|
1685
|
+
}, 200);
|
|
1686
|
+
});
|
|
1687
|
+
on('touchEnd', () => {
|
|
1688
|
+
if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return;
|
|
1689
|
+
clearTimeout(touchStartTimeout);
|
|
1690
|
+
clearTimeout(timeout);
|
|
1691
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
1692
|
+
pausedByTouch = false;
|
|
1693
|
+
isTouched = false;
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
if (pausedByTouch && swiper.params.cssMode) resume();
|
|
1697
|
+
pausedByTouch = false;
|
|
1698
|
+
isTouched = false;
|
|
1699
|
+
});
|
|
1700
|
+
on('slideChange', () => {
|
|
1701
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
1702
|
+
if (swiper.autoplay.paused) {
|
|
1703
|
+
autoplayTimeLeft = getTotalDelay();
|
|
1704
|
+
autoplayDelayTotal = getTotalDelay();
|
|
1705
|
+
}
|
|
1706
|
+
});
|
|
1707
|
+
Object.assign(swiper.autoplay, {
|
|
1708
|
+
start,
|
|
1709
|
+
stop,
|
|
1710
|
+
pause,
|
|
1711
|
+
resume
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
exports.A11y = A11y;
|
|
1716
|
+
exports.Autoplay = Autoplay;
|
|
1717
|
+
exports.Navigation = Navigation;
|
|
1718
|
+
exports.Pagination = Pagination;
|
|
1719
|
+
exports.Scrollbar = Scrollbar;
|