@itcenteratunihelsinki/huds-lib 0.8.42 → 0.8.44
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/components/accordion-container.js +48 -0
- package/components/accordion-item.js +239 -0
- package/components/color-box.d.ts +11 -0
- package/components/color-box.js +33 -0
- package/components/cta-button.js +57 -0
- package/components/cta-link.js +50 -0
- package/components/custom-elements.d.ts +2 -0
- package/components/emotion.esm.js +1395 -0
- package/{dist/esm/globalScript-4ad40215.js → components/globalScript.js} +7 -9
- package/components/heading.js +80 -0
- package/components/hy-accordion-container.d.ts +11 -0
- package/components/hy-accordion-container.js +6 -0
- package/components/hy-accordion-item.d.ts +11 -0
- package/components/hy-accordion-item.js +6 -0
- package/components/hy-adjacent-image-text.d.ts +11 -0
- package/components/hy-adjacent-image-text.js +106 -0
- package/components/hy-anchor-link-list.d.ts +11 -0
- package/components/hy-anchor-link-list.js +76 -0
- package/components/hy-badge.d.ts +11 -0
- package/components/hy-badge.js +37 -0
- package/components/hy-banner.d.ts +11 -0
- package/components/hy-banner.js +94 -0
- package/components/hy-baseline.d.ts +11 -0
- package/components/hy-baseline.js +44 -0
- package/components/hy-box-container.d.ts +11 -0
- package/components/hy-box-container.js +43 -0
- package/components/hy-box.d.ts +11 -0
- package/components/hy-box.js +6 -0
- package/components/hy-box2.js +195 -0
- package/components/hy-breadcrumbs.d.ts +11 -0
- package/components/hy-breadcrumbs.js +69 -0
- package/components/hy-button.d.ts +11 -0
- package/components/hy-button.js +111 -0
- package/components/hy-checkbox.d.ts +11 -0
- package/components/hy-checkbox.js +55 -0
- package/components/hy-collaboration.d.ts +11 -0
- package/components/hy-collaboration.js +49 -0
- package/components/hy-content-list-item.d.ts +11 -0
- package/components/hy-content-list-item.js +6 -0
- package/components/hy-content-list-item2.js +109 -0
- package/components/hy-content-list.d.ts +11 -0
- package/components/hy-content-list.js +155 -0
- package/components/hy-crisis-banner.d.ts +11 -0
- package/components/hy-crisis-banner.js +47 -0
- package/components/hy-cta-button.d.ts +11 -0
- package/components/hy-cta-button.js +6 -0
- package/components/hy-cta-link.d.ts +11 -0
- package/components/hy-cta-link.js +6 -0
- package/components/hy-docs-container.d.ts +11 -0
- package/components/hy-docs-container.js +32 -0
- package/components/hy-dropdown-panel-item.d.ts +11 -0
- package/components/hy-dropdown-panel-item.js +6 -0
- package/components/hy-dropdown-panel.d.ts +11 -0
- package/components/hy-dropdown-panel.js +6 -0
- package/components/hy-dropdown.d.ts +11 -0
- package/components/hy-dropdown.js +155 -0
- package/components/hy-dropdown.panel.item.js +41 -0
- package/components/hy-dropdown.panel.js +29 -0
- package/components/hy-event-item.d.ts +11 -0
- package/components/hy-event-item.js +73 -0
- package/components/hy-events.d.ts +11 -0
- package/components/hy-events.js +131 -0
- package/components/hy-filter-group-item.d.ts +11 -0
- package/components/hy-filter-group-item.js +6 -0
- package/components/hy-filter-group.d.ts +11 -0
- package/components/hy-filter-group.item.js +38 -0
- package/components/hy-filter-group.js +67 -0
- package/components/hy-filter-list-type.d.ts +11 -0
- package/components/hy-filter-list-type.js +52 -0
- package/components/hy-filter-visibility-tool-reset.d.ts +11 -0
- package/components/hy-filter-visibility-tool-reset.js +6 -0
- package/components/hy-filter-visibility-tool-toggle.d.ts +11 -0
- package/components/hy-filter-visibility-tool-toggle.js +6 -0
- package/components/hy-filter-visibility-tool.d.ts +11 -0
- package/components/hy-filter-visibility-tool.js +58 -0
- package/components/hy-filter-visibility-tool.reset.js +32 -0
- package/components/hy-filter-visibility-tool.reset.toggle.js +32 -0
- package/components/hy-footer-action.d.ts +11 -0
- package/components/hy-footer-action.js +55 -0
- package/components/hy-footer-base.d.ts +11 -0
- package/components/hy-footer-base.js +89 -0
- package/components/hy-footer-info.d.ts +11 -0
- package/components/hy-footer-info.js +167 -0
- package/components/hy-footer-link-item.d.ts +11 -0
- package/components/hy-footer-link-item.js +6 -0
- package/components/hy-footer-link-item2.js +99 -0
- package/components/hy-footer.d.ts +11 -0
- package/components/hy-footer.js +33 -0
- package/components/hy-general-list-item.d.ts +11 -0
- package/components/hy-general-list-item.js +6 -0
- package/components/hy-general-list-item2.js +74 -0
- package/components/hy-general-list.d.ts +11 -0
- package/components/hy-general-list.js +90 -0
- package/components/hy-grid-container.d.ts +11 -0
- package/components/hy-grid-container.js +33 -0
- package/components/hy-grid-item.d.ts +11 -0
- package/components/hy-grid-item.js +49 -0
- package/components/hy-grid-row.d.ts +11 -0
- package/components/hy-grid-row.js +33 -0
- package/components/hy-heading.d.ts +11 -0
- package/components/hy-heading.js +6 -0
- package/components/hy-hero-carousel.d.ts +11 -0
- package/components/hy-hero-carousel.js +4935 -0
- package/components/hy-hero.d.ts +11 -0
- package/components/hy-hero.js +155 -0
- package/components/hy-icon.d.ts +11 -0
- package/components/hy-icon.js +6 -0
- package/components/hy-image.d.ts +11 -0
- package/components/hy-image.js +6 -0
- package/components/hy-ingress.d.ts +11 -0
- package/components/hy-ingress.js +45 -0
- package/components/hy-introduction.d.ts +11 -0
- package/components/hy-introduction.js +118 -0
- package/components/hy-key-figure-group.d.ts +11 -0
- package/components/hy-key-figure-group.js +106 -0
- package/components/hy-key-figure.d.ts +11 -0
- package/components/hy-key-figure.js +6 -0
- package/components/hy-key-figure2.js +39 -0
- package/components/hy-key-highlight-group.d.ts +11 -0
- package/components/hy-key-highlight-group.js +69 -0
- package/components/hy-key-highlight.d.ts +11 -0
- package/components/hy-key-highlight.js +6 -0
- package/components/hy-key-highlight2.js +39 -0
- package/components/hy-large-process-flow-phase.d.ts +11 -0
- package/components/hy-large-process-flow-phase.js +6 -0
- package/components/hy-large-process-flow-phase2.js +63 -0
- package/components/hy-large-process-flow.d.ts +11 -0
- package/components/hy-large-process-flow.js +86 -0
- package/components/hy-link-box-list.d.ts +11 -0
- package/components/hy-link-box-list.js +92 -0
- package/components/hy-link-box.d.ts +11 -0
- package/components/hy-link-box.js +6 -0
- package/components/hy-link-list.d.ts +11 -0
- package/components/hy-link-list.js +77 -0
- package/components/hy-link.d.ts +11 -0
- package/components/hy-link.js +46 -0
- package/components/hy-list-item.d.ts +11 -0
- package/components/hy-list-item.js +293 -0
- package/components/hy-logo-grid-item.d.ts +11 -0
- package/components/hy-logo-grid-item.js +48 -0
- package/components/hy-logo-grid.d.ts +11 -0
- package/components/hy-logo-grid.js +38 -0
- package/components/hy-main-content-wrapper.d.ts +11 -0
- package/components/hy-main-content-wrapper.js +6 -0
- package/components/hy-main-content-wrapper2.js +30 -0
- package/components/hy-main.d.ts +11 -0
- package/components/hy-main.js +40 -0
- package/components/hy-menu-language-item.d.ts +11 -0
- package/components/hy-menu-language-item.js +6 -0
- package/components/hy-menu-language.d.ts +11 -0
- package/components/hy-menu-language.js +6 -0
- package/components/hy-menu-main-group.d.ts +11 -0
- package/components/hy-menu-main-group.js +6 -0
- package/components/hy-menu-main-group2.js +192 -0
- package/components/hy-opening-hours-content.d.ts +11 -0
- package/components/hy-opening-hours-content.js +62 -0
- package/components/hy-opening-hours.d.ts +11 -0
- package/components/hy-opening-hours.js +90 -0
- package/components/hy-pager-item.d.ts +11 -0
- package/components/hy-pager-item.js +73 -0
- package/components/hy-pager.d.ts +11 -0
- package/components/hy-pager.js +34 -0
- package/components/hy-paragraph-text.d.ts +11 -0
- package/components/hy-paragraph-text.js +6 -0
- package/components/hy-person-card.d.ts +11 -0
- package/components/hy-person-card.js +137 -0
- package/components/hy-person-profile-listing.d.ts +11 -0
- package/components/hy-person-profile-listing.js +6 -0
- package/components/hy-person-profile.d.ts +11 -0
- package/components/hy-person-profile.js +142 -0
- package/components/hy-process-flow-box.d.ts +11 -0
- package/components/hy-process-flow-box.js +6 -0
- package/components/hy-process.d.ts +11 -0
- package/components/hy-process.js +89 -0
- package/components/hy-prominent-image.d.ts +11 -0
- package/components/hy-prominent-image.js +71 -0
- package/components/hy-quote.d.ts +11 -0
- package/components/hy-quote.js +54 -0
- package/components/hy-row.d.ts +11 -0
- package/components/hy-row.js +50 -0
- package/components/hy-search-field.d.ts +11 -0
- package/components/hy-search-field.js +6 -0
- package/components/hy-search-field2.js +81 -0
- package/components/hy-section-container.d.ts +11 -0
- package/components/hy-section-container.js +32 -0
- package/components/hy-shortcuts.d.ts +11 -0
- package/components/hy-shortcuts.js +96 -0
- package/components/hy-site-header.d.ts +11 -0
- package/components/hy-site-header.js +369 -0
- package/components/hy-site-logo.d.ts +11 -0
- package/components/hy-site-logo.js +6 -0
- package/components/hy-site-search.d.ts +11 -0
- package/components/hy-site-search.js +6 -0
- package/components/hy-table-container.d.ts +11 -0
- package/components/hy-table-container.js +39 -0
- package/components/hy-tabs-item.d.ts +11 -0
- package/components/hy-tabs-item.js +6 -0
- package/components/hy-tabs-item2.js +33 -0
- package/components/hy-tabs.d.ts +11 -0
- package/components/hy-tabs.js +6 -0
- package/components/hy-tabs2.js +346 -0
- package/components/hy-tag.d.ts +11 -0
- package/components/hy-tag.js +6 -0
- package/components/hy-tag2.js +31 -0
- package/components/hy-tiny-text.d.ts +11 -0
- package/components/hy-tiny-text.js +34 -0
- package/components/hy-twitter-feed.d.ts +11 -0
- package/components/hy-twitter-feed.js +57 -0
- package/components/hy-two-columns.d.ts +11 -0
- package/components/hy-two-columns.js +36 -0
- package/components/hy-user-login-form.d.ts +11 -0
- package/components/hy-user-login-form.js +53 -0
- package/components/hy-video.d.ts +11 -0
- package/components/hy-video.js +156 -0
- package/components/icon.js +830 -0
- package/components/image.js +75 -0
- package/components/index.d.ts +27 -0
- package/components/index.js +2 -0
- package/components/index2.js +965 -0
- package/components/link-box.js +116 -0
- package/components/menu-language-item.js +47 -0
- package/components/menu-language.js +121 -0
- package/components/package.json +8 -0
- package/components/paragraph-text.js +60 -0
- package/components/person-profile.listing.js +57 -0
- package/components/process-flow-box.js +57 -0
- package/components/site-logo.js +59 -0
- package/components/site-search.js +249 -0
- package/{dist/esm/utils-43c56d92.js → components/utils.js} +1 -3
- package/dist/cjs/{hy-accordion-container_83.cjs.entry.js → color-box_91.cjs.entry.js} +1177 -1001
- package/dist/cjs/{globalScript-45ad6d41.js → globalScript-d341436f.js} +7 -9
- package/dist/cjs/huds-lib.cjs.js +3 -5
- package/dist/cjs/hy-event-item.cjs.entry.js +10 -12
- package/dist/cjs/hy-events.cjs.entry.js +22 -24
- package/dist/cjs/hy-hero-carousel.cjs.entry.js +4902 -0
- package/dist/cjs/{index-25bd964b.js → index-ca4e37f2.js} +0 -2
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +3 -5
- package/dist/cjs/utils-14d5aa6f.js +0 -2
- package/dist/collection/collection-manifest.json +8 -11
- package/dist/collection/components/accordion-container/accordion-container.js +4 -5
- package/dist/collection/components/accordion-item/accordion-item.js +78 -79
- package/dist/collection/components/adjacent-image-text/adjacent-image-text.js +17 -18
- package/dist/collection/components/baseline/baseline.js +2 -3
- package/dist/collection/components/button/button.js +28 -29
- package/dist/collection/components/color-box/color-box.js +1 -2
- package/dist/collection/components/courses/hy-content-list/hy-content-list.js +42 -43
- package/dist/collection/components/courses/hy-content-list-item/hy-content-list-item.js +15 -16
- package/dist/collection/components/cta-button/cta-button.js +12 -13
- package/dist/collection/components/cta-link/cta-link.js +7 -8
- package/dist/collection/components/docs-container/docs-container.js +0 -1
- package/dist/collection/components/footer/hy-footer/hy-footer.js +3 -4
- package/dist/collection/components/footer/hy-footer-action/hy-footer-action.js +5 -6
- package/dist/collection/components/footer/hy-footer-base/hy-footer-base.js +6 -7
- package/dist/collection/components/footer/hy-footer-info/hy-footer-info.js +19 -20
- package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.js +22 -23
- package/dist/collection/components/global-workers/globals.worker.js +0 -1
- package/dist/collection/components/grid-container/grid-container.js +1 -2
- package/dist/collection/components/grid-item/grid-item.js +5 -6
- package/dist/collection/components/grid-row/grid-row.js +3 -4
- package/dist/collection/components/heading/heading.js +17 -18
- package/dist/collection/components/hy-anchor-link-list/hy-anchor-link-list.js +13 -14
- package/dist/collection/components/hy-badge/hy-badge.js +6 -7
- package/dist/collection/components/hy-banner/hy-banner.js +13 -14
- package/dist/collection/components/hy-box/hy-box.js +26 -27
- package/dist/collection/components/hy-box-container/hy-box-container.js +5 -6
- package/dist/collection/components/hy-breadcrumbs/hy-breadcrumbs.js +10 -11
- package/dist/collection/components/hy-checkbox/hy-checkbox.js +5 -6
- package/dist/collection/components/hy-collaboration/hy-collaboration.js +2 -3
- package/dist/collection/components/hy-crisis-banner/hy-crisis-banner.js +2 -3
- package/dist/collection/components/hy-dropdown/hy-dropdown.js +16 -17
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js +2 -3
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js +2 -3
- package/dist/collection/components/hy-event-item/hy-event-item.js +15 -16
- package/dist/collection/components/hy-events/hy-events.js +25 -26
- package/dist/collection/components/hy-filter-group/hy-filter-group.item.js +3 -4
- package/dist/collection/components/hy-filter-group/hy-filter-group.js +3 -4
- package/dist/collection/components/hy-filter-list-type/hy-filter-list-type.js +10 -11
- package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.js +4 -5
- package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.js +2 -3
- package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.toggle.js +2 -3
- package/dist/collection/components/hy-general-list/hy-general-list.js +11 -12
- package/dist/collection/components/hy-general-list-item/hy-general-list-item.js +18 -19
- package/dist/collection/components/hy-hero/hy-hero.js +26 -27
- package/dist/collection/components/hy-hero-carousel/hy-hero-carousel.css +1306 -0
- package/dist/collection/components/hy-hero-carousel/hy-hero-carousel.js +211 -0
- package/dist/collection/components/hy-introduction/hy-introduction.js +23 -24
- package/dist/collection/components/hy-key-figure/hy-key-figure.js +3 -4
- package/dist/collection/components/hy-key-figure-group/hy-key-figure-group.js +17 -18
- package/dist/collection/components/hy-key-highlight/hy-key-highlight.js +3 -4
- package/dist/collection/components/hy-key-highlight-group/hy-key-highlight-group.js +12 -13
- package/dist/collection/components/hy-large-process-flow/hy-large-process-flow.js +11 -12
- package/dist/collection/components/hy-large-process-flow-phase/hy-large-process-flow-phase.js +5 -6
- package/dist/collection/components/hy-link-list/hy-link-list.js +16 -17
- package/dist/collection/components/hy-list-item/hy-list-item.js +71 -72
- package/dist/collection/components/hy-logo-grid/hy-logo-grid.item.js +3 -4
- package/dist/collection/components/hy-logo-grid/hy-logo-grid.js +1 -2
- package/dist/collection/components/hy-main/hy-main.js +5 -6
- package/dist/collection/components/hy-main-content-wrapper/hy-main-content-wrapper.js +2 -3
- package/dist/collection/components/hy-opening-hours/hy-opening-hours.js +12 -13
- package/dist/collection/components/hy-opening-hours-content/hy-opening-hours-content.js +10 -11
- package/dist/collection/components/hy-person-card/hy-person-card.js +17 -18
- package/dist/collection/components/hy-prominent-image/hy-prominent-image.js +12 -13
- package/dist/collection/components/hy-quote/hy-quote.js +8 -9
- package/dist/collection/components/hy-search-field/hy-search-field.js +15 -16
- package/dist/collection/components/hy-shortcuts/hy-shortcuts.js +21 -22
- package/dist/collection/components/hy-table-container/hy-table-container.js +2 -3
- package/dist/collection/components/hy-tabs/hy-tabs.js +52 -53
- package/dist/collection/components/hy-tabs-item/hy-tabs-item.js +2 -3
- package/dist/collection/components/hy-tag/hy-tag.js +2 -3
- package/dist/collection/components/hy-twitter-feed/hy-twitter-feed.js +4 -5
- package/dist/collection/components/hy-two-columns/hy-two-columns.js +2 -3
- package/dist/collection/components/hy-user-login-form/hy-user-login-form.js +4 -5
- package/dist/collection/components/hy-video/hy-video.js +26 -27
- package/dist/collection/components/icon/AddToTodoList.js +0 -1
- package/dist/collection/components/icon/Alert.js +1 -2
- package/dist/collection/components/icon/Archive.js +1 -2
- package/dist/collection/components/icon/Arrow.js +0 -1
- package/dist/collection/components/icon/ArrowDown.js +0 -1
- package/dist/collection/components/icon/ArrowRight.js +1 -2
- package/dist/collection/components/icon/ArrowUp.js +0 -1
- package/dist/collection/components/icon/Avatar.js +0 -1
- package/dist/collection/components/icon/AvatarGroup.js +0 -1
- package/dist/collection/components/icon/Bachelor.js +0 -1
- package/dist/collection/components/icon/BulletList.js +0 -1
- package/dist/collection/components/icon/Camera.js +0 -1
- package/dist/collection/components/icon/CaretDown.js +0 -1
- package/dist/collection/components/icon/CaretLeft.js +0 -1
- package/dist/collection/components/icon/CaretRight.js +1 -2
- package/dist/collection/components/icon/CaretUp.js +0 -1
- package/dist/collection/components/icon/Chat.js +0 -1
- package/dist/collection/components/icon/CodeFork.js +0 -1
- package/dist/collection/components/icon/Cogs.js +0 -1
- package/dist/collection/components/icon/Contentlink.js +0 -1
- package/dist/collection/components/icon/Customlink.js +0 -1
- package/dist/collection/components/icon/Date.js +0 -1
- package/dist/collection/components/icon/Discover.js +0 -1
- package/dist/collection/components/icon/Done.js +0 -1
- package/dist/collection/components/icon/Dot.js +0 -1
- package/dist/collection/components/icon/DotArrowRight.js +1 -2
- package/dist/collection/components/icon/Download.js +0 -1
- package/dist/collection/components/icon/Drag.js +0 -1
- package/dist/collection/components/icon/Dragbutton.js +0 -1
- package/dist/collection/components/icon/DropDown.js +0 -1
- package/dist/collection/components/icon/Edit.js +0 -1
- package/dist/collection/components/icon/EditEvent.js +0 -1
- package/dist/collection/components/icon/Embed.js +0 -1
- package/dist/collection/components/icon/Euro.js +1 -2
- package/dist/collection/components/icon/Events.js +0 -1
- package/dist/collection/components/icon/ExternalLink.js +0 -1
- package/dist/collection/components/icon/EyeSlash.js +0 -1
- package/dist/collection/components/icon/Facebook.js +0 -1
- package/dist/collection/components/icon/Favorites.js +0 -1
- package/dist/collection/components/icon/Feed.js +0 -1
- package/dist/collection/components/icon/FileText.js +0 -1
- package/dist/collection/components/icon/FullScreen.js +0 -1
- package/dist/collection/components/icon/Globe.js +1 -2
- package/dist/collection/components/icon/GooglePlus.js +0 -1
- package/dist/collection/components/icon/Grid.js +0 -1
- package/dist/collection/components/icon/Hamburger.js +0 -1
- package/dist/collection/components/icon/Heart.js +0 -1
- package/dist/collection/components/icon/HeartSupport.js +1 -2
- package/dist/collection/components/icon/Helsinginyliopisto.js +0 -1
- package/dist/collection/components/icon/Home.js +1 -2
- package/dist/collection/components/icon/HorizontalResize.js +0 -1
- package/dist/collection/components/icon/HyLogo.js +0 -1
- package/dist/collection/components/icon/IdNumber.js +0 -1
- package/dist/collection/components/icon/Image.js +0 -1
- package/dist/collection/components/icon/ImageGallery.js +0 -1
- package/dist/collection/components/icon/Images.js +0 -1
- package/dist/collection/components/icon/Info.js +1 -2
- package/dist/collection/components/icon/InfoStroke.js +0 -1
- package/dist/collection/components/icon/Instagram.js +0 -1
- package/dist/collection/components/icon/LeikiList.js +0 -1
- package/dist/collection/components/icon/LinkArrow.js +0 -1
- package/dist/collection/components/icon/LinkArrow1.js +0 -1
- package/dist/collection/components/icon/LinkArrowDown.js +0 -1
- package/dist/collection/components/icon/LinkArrowLeft.js +0 -1
- package/dist/collection/components/icon/LinkArrowOffsite.js +0 -1
- package/dist/collection/components/icon/LinkArrowUp.js +0 -1
- package/dist/collection/components/icon/Linkedin.js +0 -1
- package/dist/collection/components/icon/List.js +0 -1
- package/dist/collection/components/icon/ListAsBlocks.js +0 -1
- package/dist/collection/components/icon/ListStyleGrid.js +1 -2
- package/dist/collection/components/icon/ListStyleList.js +1 -2
- package/dist/collection/components/icon/Listoflinks.js +0 -1
- package/dist/collection/components/icon/Location.js +0 -1
- package/dist/collection/components/icon/Log.js +0 -1
- package/dist/collection/components/icon/Login.js +0 -1
- package/dist/collection/components/icon/Logout.js +0 -1
- package/dist/collection/components/icon/MagnifyMinus.js +0 -1
- package/dist/collection/components/icon/MagnifyPlus.js +0 -1
- package/dist/collection/components/icon/Mail.js +0 -1
- package/dist/collection/components/icon/Master.js +0 -1
- package/dist/collection/components/icon/Minus.js +0 -1
- package/dist/collection/components/icon/Mobile.js +0 -1
- package/dist/collection/components/icon/Modify.js +0 -1
- package/dist/collection/components/icon/NaviTriangle.js +0 -1
- package/dist/collection/components/icon/NewGroup.js +0 -1
- package/dist/collection/components/icon/NewPerson.js +0 -1
- package/dist/collection/components/icon/Notification.js +0 -1
- package/dist/collection/components/icon/OpinderLogo.js +0 -1
- package/dist/collection/components/icon/OpinderLogoNew.js +0 -1
- package/dist/collection/components/icon/Pdf.js +0 -1
- package/dist/collection/components/icon/People.js +0 -1
- package/dist/collection/components/icon/PermissionAll.js +0 -1
- package/dist/collection/components/icon/PermissionGroup.js +0 -1
- package/dist/collection/components/icon/PermissionPrivate.js +0 -1
- package/dist/collection/components/icon/Person.js +0 -1
- package/dist/collection/components/icon/PersonOutline.js +0 -1
- package/dist/collection/components/icon/Phone.js +0 -1
- package/dist/collection/components/icon/Play.js +0 -1
- package/dist/collection/components/icon/Plus.js +0 -1
- package/dist/collection/components/icon/Preview.js +0 -1
- package/dist/collection/components/icon/Profile.js +0 -1
- package/dist/collection/components/icon/Question.js +0 -1
- package/dist/collection/components/icon/Remove.js +0 -1
- package/dist/collection/components/icon/Retweet.js +0 -1
- package/dist/collection/components/icon/RotateLeft.js +0 -1
- package/dist/collection/components/icon/RotateRight.js +0 -1
- package/dist/collection/components/icon/Search.js +1 -2
- package/dist/collection/components/icon/Share.js +0 -1
- package/dist/collection/components/icon/SlimHamburgerMenu.js +1 -2
- package/dist/collection/components/icon/SocialMedia.js +0 -1
- package/dist/collection/components/icon/SomeFacebook.js +1 -2
- package/dist/collection/components/icon/SomeInstagram.js +1 -2
- package/dist/collection/components/icon/SomeLinkedin.js +1 -2
- package/dist/collection/components/icon/SomeTwitter.js +1 -2
- package/dist/collection/components/icon/SomeYoutube.js +1 -2
- package/dist/collection/components/icon/Spinner.js +0 -1
- package/dist/collection/components/icon/Square.js +0 -1
- package/dist/collection/components/icon/SquareChecked.js +0 -1
- package/dist/collection/components/icon/Time.js +0 -1
- package/dist/collection/components/icon/TodoList.js +0 -1
- package/dist/collection/components/icon/Tour.js +0 -1
- package/dist/collection/components/icon/Twitter.js +0 -1
- package/dist/collection/components/icon/TwitterLike.js +1 -2
- package/dist/collection/components/icon/UnitsAndFaculties.js +0 -1
- package/dist/collection/components/icon/Url.js +0 -1
- package/dist/collection/components/icon/Video.js +0 -1
- package/dist/collection/components/icon/Warning.js +0 -1
- package/dist/collection/components/icon/Wrench.js +0 -1
- package/dist/collection/components/icon/Youtube.js +0 -1
- package/dist/collection/components/icon/allIcons.js +114 -115
- package/dist/collection/components/icon/icon.js +134 -135
- package/dist/collection/components/icon/icons.js +132 -133
- package/dist/collection/components/image/image.js +10 -11
- package/dist/collection/components/ingress/ingress.js +7 -8
- package/dist/collection/components/link/link.js +7 -8
- package/dist/collection/components/link-box/link-box.js +23 -24
- package/dist/collection/components/link-box-list/link-box-list.js +12 -13
- package/dist/collection/components/navigation/hy-menu-main-group/hy-menu-main-group.js +45 -46
- package/dist/collection/components/navigation/menu-language/menu-language.js +15 -16
- package/dist/collection/components/navigation/menu-language-item/menu-language-item.js +4 -5
- package/dist/collection/components/pagination/hy-pager/hy-pager.js +2 -3
- package/dist/collection/components/pagination/hy-pager-item/hy-pager-item.js +12 -13
- package/dist/collection/components/paragraph-text/paragraph-text.js +10 -11
- package/dist/collection/components/person-profile/person-profile-listing/person-profile.listing.js +9 -10
- package/dist/collection/components/person-profile/person-profile.js +16 -17
- package/dist/collection/components/process/process.js +12 -13
- package/dist/collection/components/process-flow-box/process-flow-box.js +11 -12
- package/dist/collection/components/row/row.js +6 -7
- package/dist/collection/components/section-container/section-container.js +1 -2
- package/dist/collection/components/site-header/site-header.js +69 -70
- package/dist/collection/components/site-header/site-logo/site-logo.js +7 -8
- package/dist/collection/components/site-header/site-search/site-search.js +56 -57
- package/dist/collection/components/tiny-text/tiny-text.js +0 -1
- package/dist/collection/global/colors.js +21 -22
- package/dist/collection/global/globalScript.js +7 -8
- package/dist/collection/global/typography.js +0 -1
- package/dist/collection/index.js +1 -2
- package/dist/collection/utils/utils.js +0 -1
- package/dist/esm/{hy-accordion-container_83.entry.js → color-box_91.entry.js} +1171 -1003
- package/dist/esm/globalScript-3c6fab71.js +26 -0
- package/dist/esm/huds-lib.js +4 -6
- package/dist/esm/hy-event-item.entry.js +10 -12
- package/dist/esm/hy-events.entry.js +23 -25
- package/dist/esm/hy-hero-carousel.entry.js +4898 -0
- package/dist/esm/{index-3a66d87e.js → index-9920074a.js} +0 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/loader.js +4 -6
- package/dist/esm/utils-a4d55421.js +239 -0
- package/dist/fonts/fonts.css +20 -20
- package/dist/huds-lib/color-box_91.entry.js +87 -0
- package/dist/huds-lib/globalScript-3c6fab71.js +1 -0
- package/dist/huds-lib/huds-lib.esm.js +1 -2
- package/dist/huds-lib/hy-event-item.entry.js +1 -0
- package/dist/huds-lib/hy-events.entry.js +1 -0
- package/dist/huds-lib/hy-hero-carousel.entry.js +1 -0
- package/dist/huds-lib/index-9920074a.js +2 -0
- package/dist/huds-lib/index.esm.js +0 -2
- package/dist/huds-lib/utils-a4d55421.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +11 -0
- package/dist/types/components/accordion-item/accordion-item.d.ts +1 -1
- package/dist/types/components/adjacent-image-text/adjacent-image-text.d.ts +1 -1
- package/dist/types/components/button/button.d.ts +3 -3
- package/dist/types/components/color-box/color-box.d.ts +1 -1
- package/dist/types/components/courses/hy-content-list/hy-content-list.d.ts +2 -2
- package/dist/types/components/courses/hy-content-list-item/hy-content-list-item.d.ts +1 -1
- package/dist/types/components/cta-button/cta-button.d.ts +2 -2
- package/dist/types/components/cta-link/cta-link.d.ts +2 -2
- package/dist/types/components/footer/hy-footer-base/hy-footer-base.d.ts +2 -2
- package/dist/types/components/footer/hy-footer-info/hy-footer-info.d.ts +1 -1
- package/dist/types/components/footer/hy-footer-link-item/hy-footer-link-item.d.ts +1 -1
- package/dist/types/components/grid-item/grid-item.d.ts +1 -1
- package/dist/types/components/heading/heading.d.ts +1 -1
- package/dist/types/components/hy-badge/hy-badge.d.ts +2 -2
- package/dist/types/components/hy-breadcrumbs/hy-breadcrumbs.d.ts +1 -1
- package/dist/types/components/hy-checkbox/hy-checkbox.d.ts +1 -1
- package/dist/types/components/hy-filter-visibility-tool/hy-filter-visibility-tool.d.ts +1 -1
- package/dist/types/components/hy-general-list/hy-general-list.d.ts +1 -1
- package/dist/types/components/hy-hero/hy-hero.d.ts +1 -1
- package/dist/types/components/hy-hero-carousel/hy-hero-carousel.d.ts +30 -0
- package/dist/types/components/hy-introduction/hy-introduction.d.ts +1 -1
- package/dist/types/components/hy-key-figure/hy-key-figure.d.ts +2 -2
- package/dist/types/components/hy-key-figure-group/hy-key-figure-group.d.ts +1 -1
- package/dist/types/components/hy-key-highlight/hy-key-highlight.d.ts +2 -2
- package/dist/types/components/hy-key-highlight-group/hy-key-highlight-group.d.ts +2 -2
- package/dist/types/components/hy-large-process-flow/hy-large-process-flow.d.ts +1 -1
- package/dist/types/components/hy-large-process-flow-phase/hy-large-process-flow-phase.d.ts +1 -1
- package/dist/types/components/hy-link-list/hy-link-list.d.ts +1 -1
- package/dist/types/components/hy-list-item/hy-list-item.d.ts +1 -1
- package/dist/types/components/hy-person-card/hy-person-card.d.ts +1 -1
- package/dist/types/components/hy-shortcuts/hy-shortcuts.d.ts +1 -1
- package/dist/types/components/hy-tabs/hy-tabs.d.ts +1 -1
- package/dist/types/components/icon/allIcons.d.ts +114 -114
- package/dist/types/components/icon/icons.d.ts +130 -130
- package/dist/types/components/image/image.d.ts +1 -1
- package/dist/types/components/link/link.d.ts +1 -1
- package/dist/types/components/link-box/link-box.d.ts +2 -2
- package/dist/types/components/link-box-list/link-box-list.d.ts +2 -2
- package/dist/types/components/navigation/hy-menu-main-group/hy-menu-main-group.d.ts +1 -1
- package/dist/types/components/navigation/menu-language/menu-language.d.ts +2 -2
- package/dist/types/components/pagination/hy-pager-item/hy-pager-item.d.ts +1 -1
- package/dist/types/components/person-profile/person-profile-listing/person-profile.listing.d.ts +1 -1
- package/dist/types/components/process/process.d.ts +1 -1
- package/dist/types/components/process-flow-box/process-flow-box.d.ts +3 -3
- package/dist/types/components/site-header/site-header.d.ts +2 -2
- package/dist/types/components/site-header/site-logo/site-logo.d.ts +1 -1
- package/dist/types/components/site-header/site-search/site-search.d.ts +3 -3
- package/dist/types/components.d.ts +39 -10
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +4 -4
- package/loader/cdn.js +4 -3
- package/loader/index.cjs.js +4 -3
- package/loader/index.d.ts +13 -3
- package/loader/index.es2017.js +2 -3
- package/loader/index.js +13 -4
- package/loader/package.json +1 -1
- package/package.json +11 -3
- package/dist/cjs/color-box_8.cjs.entry.js +0 -187
- package/dist/cjs/color-box_8.cjs.entry.js.map +0 -1
- package/dist/cjs/globalScript-45ad6d41.js.map +0 -1
- package/dist/cjs/huds-lib.cjs.js.map +0 -1
- package/dist/cjs/hy-accordion-container_83.cjs.entry.js.map +0 -1
- package/dist/cjs/hy-event-item.cjs.entry.js.map +0 -1
- package/dist/cjs/hy-events.cjs.entry.js.map +0 -1
- package/dist/cjs/index-25bd964b.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/utils-14d5aa6f.js.map +0 -1
- package/dist/collection/components/accordion-container/accordion-container.js.map +0 -1
- package/dist/collection/components/accordion-item/accordion-item.js.map +0 -1
- package/dist/collection/components/adjacent-image-text/adjacent-image-text.js.map +0 -1
- package/dist/collection/components/baseline/baseline.js.map +0 -1
- package/dist/collection/components/button/button.js.map +0 -1
- package/dist/collection/components/color-box/color-box.js.map +0 -1
- package/dist/collection/components/courses/hy-content-list/hy-content-list.js.map +0 -1
- package/dist/collection/components/courses/hy-content-list-item/hy-content-list-item.js.map +0 -1
- package/dist/collection/components/cta-button/cta-button.js.map +0 -1
- package/dist/collection/components/cta-link/cta-link.js.map +0 -1
- package/dist/collection/components/docs-container/docs-container.js.map +0 -1
- package/dist/collection/components/footer/hy-footer/hy-footer.js.map +0 -1
- package/dist/collection/components/footer/hy-footer-action/hy-footer-action.js.map +0 -1
- package/dist/collection/components/footer/hy-footer-base/hy-footer-base.js.map +0 -1
- package/dist/collection/components/footer/hy-footer-info/hy-footer-info.js.map +0 -1
- package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.js.map +0 -1
- package/dist/collection/components/global-workers/globals.worker.js.map +0 -1
- package/dist/collection/components/grid-container/grid-container.js.map +0 -1
- package/dist/collection/components/grid-item/grid-item.js.map +0 -1
- package/dist/collection/components/grid-row/grid-row.js.map +0 -1
- package/dist/collection/components/heading/heading.js.map +0 -1
- package/dist/collection/components/hy-anchor-link-list/hy-anchor-link-list.js.map +0 -1
- package/dist/collection/components/hy-badge/hy-badge.js.map +0 -1
- package/dist/collection/components/hy-banner/hy-banner.js.map +0 -1
- package/dist/collection/components/hy-box/hy-box.js.map +0 -1
- package/dist/collection/components/hy-box-container/hy-box-container.js.map +0 -1
- package/dist/collection/components/hy-breadcrumbs/hy-breadcrumbs.js.map +0 -1
- package/dist/collection/components/hy-checkbox/hy-checkbox.js.map +0 -1
- package/dist/collection/components/hy-collaboration/hy-collaboration.js.map +0 -1
- package/dist/collection/components/hy-crisis-banner/hy-crisis-banner.js.map +0 -1
- package/dist/collection/components/hy-dropdown/hy-dropdown.js.map +0 -1
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js.map +0 -1
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js.map +0 -1
- package/dist/collection/components/hy-event-item/hy-event-item.js.map +0 -1
- package/dist/collection/components/hy-events/hy-events.js.map +0 -1
- package/dist/collection/components/hy-filter-group/hy-filter-group.item.js.map +0 -1
- package/dist/collection/components/hy-filter-group/hy-filter-group.js.map +0 -1
- package/dist/collection/components/hy-filter-list-type/hy-filter-list-type.js.map +0 -1
- package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.js.map +0 -1
- package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.js.map +0 -1
- package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.toggle.js.map +0 -1
- package/dist/collection/components/hy-general-list/hy-general-list.js.map +0 -1
- package/dist/collection/components/hy-general-list-item/hy-general-list-item.js.map +0 -1
- package/dist/collection/components/hy-hero/hy-hero.js.map +0 -1
- package/dist/collection/components/hy-introduction/hy-introduction.js.map +0 -1
- package/dist/collection/components/hy-key-figure/hy-key-figure.js.map +0 -1
- package/dist/collection/components/hy-key-figure-group/hy-key-figure-group.js.map +0 -1
- package/dist/collection/components/hy-key-highlight/hy-key-highlight.js.map +0 -1
- package/dist/collection/components/hy-key-highlight-group/hy-key-highlight-group.js.map +0 -1
- package/dist/collection/components/hy-large-process-flow/hy-large-process-flow.js.map +0 -1
- package/dist/collection/components/hy-large-process-flow-phase/hy-large-process-flow-phase.js.map +0 -1
- package/dist/collection/components/hy-link-list/hy-link-list.js.map +0 -1
- package/dist/collection/components/hy-list-item/hy-list-item.js.map +0 -1
- package/dist/collection/components/hy-logo-grid/hy-logo-grid.item.js.map +0 -1
- package/dist/collection/components/hy-logo-grid/hy-logo-grid.js.map +0 -1
- package/dist/collection/components/hy-main/hy-main.js.map +0 -1
- package/dist/collection/components/hy-main-content-wrapper/hy-main-content-wrapper.js.map +0 -1
- package/dist/collection/components/hy-opening-hours/hy-opening-hours.js.map +0 -1
- package/dist/collection/components/hy-opening-hours-content/hy-opening-hours-content.js.map +0 -1
- package/dist/collection/components/hy-person-card/hy-person-card.js.map +0 -1
- package/dist/collection/components/hy-prominent-image/hy-prominent-image.js.map +0 -1
- package/dist/collection/components/hy-quote/hy-quote.js.map +0 -1
- package/dist/collection/components/hy-search-field/hy-search-field.js.map +0 -1
- package/dist/collection/components/hy-shortcuts/hy-shortcuts.js.map +0 -1
- package/dist/collection/components/hy-table-container/hy-table-container.js.map +0 -1
- package/dist/collection/components/hy-tabs/hy-tabs.js.map +0 -1
- package/dist/collection/components/hy-tabs-item/hy-tabs-item.js.map +0 -1
- package/dist/collection/components/hy-tag/hy-tag.js.map +0 -1
- package/dist/collection/components/hy-twitter-feed/hy-twitter-feed.js.map +0 -1
- package/dist/collection/components/hy-two-columns/hy-two-columns.js.map +0 -1
- package/dist/collection/components/hy-user-login-form/hy-user-login-form.js.map +0 -1
- package/dist/collection/components/hy-video/hy-video.js.map +0 -1
- package/dist/collection/components/icon/AddToTodoList.js.map +0 -1
- package/dist/collection/components/icon/Alert.js.map +0 -1
- package/dist/collection/components/icon/Archive.js.map +0 -1
- package/dist/collection/components/icon/Arrow.js.map +0 -1
- package/dist/collection/components/icon/ArrowDown.js.map +0 -1
- package/dist/collection/components/icon/ArrowRight.js.map +0 -1
- package/dist/collection/components/icon/ArrowUp.js.map +0 -1
- package/dist/collection/components/icon/Avatar.js.map +0 -1
- package/dist/collection/components/icon/AvatarGroup.js.map +0 -1
- package/dist/collection/components/icon/Bachelor.js.map +0 -1
- package/dist/collection/components/icon/BulletList.js.map +0 -1
- package/dist/collection/components/icon/Camera.js.map +0 -1
- package/dist/collection/components/icon/CaretDown.js.map +0 -1
- package/dist/collection/components/icon/CaretLeft.js.map +0 -1
- package/dist/collection/components/icon/CaretRight.js.map +0 -1
- package/dist/collection/components/icon/CaretUp.js.map +0 -1
- package/dist/collection/components/icon/Chat.js.map +0 -1
- package/dist/collection/components/icon/CodeFork.js.map +0 -1
- package/dist/collection/components/icon/Cogs.js.map +0 -1
- package/dist/collection/components/icon/Contentlink.js.map +0 -1
- package/dist/collection/components/icon/Customlink.js.map +0 -1
- package/dist/collection/components/icon/Date.js.map +0 -1
- package/dist/collection/components/icon/Discover.js.map +0 -1
- package/dist/collection/components/icon/Done.js.map +0 -1
- package/dist/collection/components/icon/Dot.js.map +0 -1
- package/dist/collection/components/icon/DotArrowRight.js.map +0 -1
- package/dist/collection/components/icon/Download.js.map +0 -1
- package/dist/collection/components/icon/Drag.js.map +0 -1
- package/dist/collection/components/icon/Dragbutton.js.map +0 -1
- package/dist/collection/components/icon/DropDown.js.map +0 -1
- package/dist/collection/components/icon/Edit.js.map +0 -1
- package/dist/collection/components/icon/EditEvent.js.map +0 -1
- package/dist/collection/components/icon/Embed.js.map +0 -1
- package/dist/collection/components/icon/Euro.js.map +0 -1
- package/dist/collection/components/icon/Events.js.map +0 -1
- package/dist/collection/components/icon/ExternalLink.js.map +0 -1
- package/dist/collection/components/icon/EyeSlash.js.map +0 -1
- package/dist/collection/components/icon/Facebook.js.map +0 -1
- package/dist/collection/components/icon/Favorites.js.map +0 -1
- package/dist/collection/components/icon/Feed.js.map +0 -1
- package/dist/collection/components/icon/FileText.js.map +0 -1
- package/dist/collection/components/icon/FullScreen.js.map +0 -1
- package/dist/collection/components/icon/Globe.js.map +0 -1
- package/dist/collection/components/icon/GooglePlus.js.map +0 -1
- package/dist/collection/components/icon/Grid.js.map +0 -1
- package/dist/collection/components/icon/Hamburger.js.map +0 -1
- package/dist/collection/components/icon/Heart.js.map +0 -1
- package/dist/collection/components/icon/HeartSupport.js.map +0 -1
- package/dist/collection/components/icon/Helsinginyliopisto.js.map +0 -1
- package/dist/collection/components/icon/Home.js.map +0 -1
- package/dist/collection/components/icon/HorizontalResize.js.map +0 -1
- package/dist/collection/components/icon/HyLogo.js.map +0 -1
- package/dist/collection/components/icon/IdNumber.js.map +0 -1
- package/dist/collection/components/icon/Image.js.map +0 -1
- package/dist/collection/components/icon/ImageGallery.js.map +0 -1
- package/dist/collection/components/icon/Images.js.map +0 -1
- package/dist/collection/components/icon/Info.js.map +0 -1
- package/dist/collection/components/icon/InfoStroke.js.map +0 -1
- package/dist/collection/components/icon/Instagram.js.map +0 -1
- package/dist/collection/components/icon/LeikiList.js.map +0 -1
- package/dist/collection/components/icon/LinkArrow.js.map +0 -1
- package/dist/collection/components/icon/LinkArrow1.js.map +0 -1
- package/dist/collection/components/icon/LinkArrowDown.js.map +0 -1
- package/dist/collection/components/icon/LinkArrowLeft.js.map +0 -1
- package/dist/collection/components/icon/LinkArrowOffsite.js.map +0 -1
- package/dist/collection/components/icon/LinkArrowUp.js.map +0 -1
- package/dist/collection/components/icon/Linkedin.js.map +0 -1
- package/dist/collection/components/icon/List.js.map +0 -1
- package/dist/collection/components/icon/ListAsBlocks.js.map +0 -1
- package/dist/collection/components/icon/ListStyleGrid.js.map +0 -1
- package/dist/collection/components/icon/ListStyleList.js.map +0 -1
- package/dist/collection/components/icon/Listoflinks.js.map +0 -1
- package/dist/collection/components/icon/Location.js.map +0 -1
- package/dist/collection/components/icon/Log.js.map +0 -1
- package/dist/collection/components/icon/Login.js.map +0 -1
- package/dist/collection/components/icon/Logout.js.map +0 -1
- package/dist/collection/components/icon/MagnifyMinus.js.map +0 -1
- package/dist/collection/components/icon/MagnifyPlus.js.map +0 -1
- package/dist/collection/components/icon/Mail.js.map +0 -1
- package/dist/collection/components/icon/Master.js.map +0 -1
- package/dist/collection/components/icon/Minus.js.map +0 -1
- package/dist/collection/components/icon/Mobile.js.map +0 -1
- package/dist/collection/components/icon/Modify.js.map +0 -1
- package/dist/collection/components/icon/NaviTriangle.js.map +0 -1
- package/dist/collection/components/icon/NewGroup.js.map +0 -1
- package/dist/collection/components/icon/NewPerson.js.map +0 -1
- package/dist/collection/components/icon/Notification.js.map +0 -1
- package/dist/collection/components/icon/OpinderLogo.js.map +0 -1
- package/dist/collection/components/icon/OpinderLogoNew.js.map +0 -1
- package/dist/collection/components/icon/Pdf.js.map +0 -1
- package/dist/collection/components/icon/People.js.map +0 -1
- package/dist/collection/components/icon/PermissionAll.js.map +0 -1
- package/dist/collection/components/icon/PermissionGroup.js.map +0 -1
- package/dist/collection/components/icon/PermissionPrivate.js.map +0 -1
- package/dist/collection/components/icon/Person.js.map +0 -1
- package/dist/collection/components/icon/PersonOutline.js.map +0 -1
- package/dist/collection/components/icon/Phone.js.map +0 -1
- package/dist/collection/components/icon/Play.js.map +0 -1
- package/dist/collection/components/icon/Plus.js.map +0 -1
- package/dist/collection/components/icon/Preview.js.map +0 -1
- package/dist/collection/components/icon/Profile.js.map +0 -1
- package/dist/collection/components/icon/Question.js.map +0 -1
- package/dist/collection/components/icon/Remove.js.map +0 -1
- package/dist/collection/components/icon/Retweet.js.map +0 -1
- package/dist/collection/components/icon/RotateLeft.js.map +0 -1
- package/dist/collection/components/icon/RotateRight.js.map +0 -1
- package/dist/collection/components/icon/Search.js.map +0 -1
- package/dist/collection/components/icon/Share.js.map +0 -1
- package/dist/collection/components/icon/SlimHamburgerMenu.js.map +0 -1
- package/dist/collection/components/icon/SocialMedia.js.map +0 -1
- package/dist/collection/components/icon/SomeFacebook.js.map +0 -1
- package/dist/collection/components/icon/SomeInstagram.js.map +0 -1
- package/dist/collection/components/icon/SomeLinkedin.js.map +0 -1
- package/dist/collection/components/icon/SomeTwitter.js.map +0 -1
- package/dist/collection/components/icon/SomeYoutube.js.map +0 -1
- package/dist/collection/components/icon/Spinner.js.map +0 -1
- package/dist/collection/components/icon/Square.js.map +0 -1
- package/dist/collection/components/icon/SquareChecked.js.map +0 -1
- package/dist/collection/components/icon/Time.js.map +0 -1
- package/dist/collection/components/icon/TodoList.js.map +0 -1
- package/dist/collection/components/icon/Tour.js.map +0 -1
- package/dist/collection/components/icon/Twitter.js.map +0 -1
- package/dist/collection/components/icon/TwitterLike.js.map +0 -1
- package/dist/collection/components/icon/UnitsAndFaculties.js.map +0 -1
- package/dist/collection/components/icon/Url.js.map +0 -1
- package/dist/collection/components/icon/Video.js.map +0 -1
- package/dist/collection/components/icon/Warning.js.map +0 -1
- package/dist/collection/components/icon/Wrench.js.map +0 -1
- package/dist/collection/components/icon/Youtube.js.map +0 -1
- package/dist/collection/components/icon/allIcons.js.map +0 -1
- package/dist/collection/components/icon/icon.js.map +0 -1
- package/dist/collection/components/icon/icons.js.map +0 -1
- package/dist/collection/components/image/image.js.map +0 -1
- package/dist/collection/components/ingress/ingress.js.map +0 -1
- package/dist/collection/components/link/link.js.map +0 -1
- package/dist/collection/components/link-box/link-box.js.map +0 -1
- package/dist/collection/components/link-box-list/link-box-list.js.map +0 -1
- package/dist/collection/components/navigation/hy-menu-main-group/hy-menu-main-group.js.map +0 -1
- package/dist/collection/components/navigation/menu-language/menu-language.js.map +0 -1
- package/dist/collection/components/navigation/menu-language-item/menu-language-item.js.map +0 -1
- package/dist/collection/components/pagination/hy-pager/hy-pager.js.map +0 -1
- package/dist/collection/components/pagination/hy-pager-item/hy-pager-item.js.map +0 -1
- package/dist/collection/components/paragraph-text/paragraph-text.js.map +0 -1
- package/dist/collection/components/person-profile/person-profile-listing/person-profile.listing.js.map +0 -1
- package/dist/collection/components/person-profile/person-profile.js.map +0 -1
- package/dist/collection/components/process/process.js.map +0 -1
- package/dist/collection/components/process-flow-box/process-flow-box.js.map +0 -1
- package/dist/collection/components/row/row.js.map +0 -1
- package/dist/collection/components/section-container/section-container.js.map +0 -1
- package/dist/collection/components/site-header/site-header.js.map +0 -1
- package/dist/collection/components/site-header/site-logo/site-logo.js.map +0 -1
- package/dist/collection/components/site-header/site-search/site-search.js.map +0 -1
- package/dist/collection/components/tiny-text/tiny-text.js.map +0 -1
- package/dist/collection/global/colors.js.map +0 -1
- package/dist/collection/global/globalScript.js.map +0 -1
- package/dist/collection/global/typography.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/esm/color-box_8.entry.js +0 -176
- package/dist/esm/color-box_8.entry.js.map +0 -1
- package/dist/esm/globalScript-4ad40215.js.map +0 -1
- package/dist/esm/huds-lib.js.map +0 -1
- package/dist/esm/hy-accordion-container_83.entry.js.map +0 -1
- package/dist/esm/hy-event-item.entry.js.map +0 -1
- package/dist/esm/hy-events.entry.js.map +0 -1
- package/dist/esm/index-3a66d87e.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/utils-43c56d92.js.map +0 -1
- package/dist/huds-lib/huds-lib.esm.js.map +0 -1
- package/dist/huds-lib/index.esm.js.map +0 -1
- package/dist/huds-lib/p-1aeae669.entry.js +0 -2
- package/dist/huds-lib/p-1aeae669.entry.js.map +0 -1
- package/dist/huds-lib/p-30e3190a.entry.js +0 -88
- package/dist/huds-lib/p-30e3190a.entry.js.map +0 -1
- package/dist/huds-lib/p-63584350.js +0 -2
- package/dist/huds-lib/p-63584350.js.map +0 -1
- package/dist/huds-lib/p-7b75f0ea.entry.js +0 -2
- package/dist/huds-lib/p-7b75f0ea.entry.js.map +0 -1
- package/dist/huds-lib/p-b02e49ad.js +0 -2
- package/dist/huds-lib/p-b02e49ad.js.map +0 -1
- package/dist/huds-lib/p-c8ed784d.entry.js +0 -2
- package/dist/huds-lib/p-c8ed784d.entry.js.map +0 -1
- package/dist/huds-lib/p-ff975a68.js +0 -3
- package/dist/huds-lib/p-ff975a68.js.map +0 -1
|
@@ -0,0 +1,4935 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement as HTMLElement$1, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { j as jsonParserWorker } from './globalScript.js';
|
|
3
|
+
import { a as CtaLinkButtonVariants } from './utils.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './cta-button.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './icon.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* SSR Window 4.0.2
|
|
9
|
+
* Better handling for window object in SSR environment
|
|
10
|
+
* https://github.com/nolimits4web/ssr-window
|
|
11
|
+
*
|
|
12
|
+
* Copyright 2021, Vladimir Kharlampidi
|
|
13
|
+
*
|
|
14
|
+
* Licensed under MIT
|
|
15
|
+
*
|
|
16
|
+
* Released on: December 13, 2021
|
|
17
|
+
*/
|
|
18
|
+
/* eslint-disable no-param-reassign */
|
|
19
|
+
function isObject$1(obj) {
|
|
20
|
+
return (obj !== null &&
|
|
21
|
+
typeof obj === 'object' &&
|
|
22
|
+
'constructor' in obj &&
|
|
23
|
+
obj.constructor === Object);
|
|
24
|
+
}
|
|
25
|
+
function extend$1(target = {}, src = {}) {
|
|
26
|
+
Object.keys(src).forEach((key) => {
|
|
27
|
+
if (typeof target[key] === 'undefined')
|
|
28
|
+
target[key] = src[key];
|
|
29
|
+
else if (isObject$1(src[key]) &&
|
|
30
|
+
isObject$1(target[key]) &&
|
|
31
|
+
Object.keys(src[key]).length > 0) {
|
|
32
|
+
extend$1(target[key], src[key]);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ssrDocument = {
|
|
38
|
+
body: {},
|
|
39
|
+
addEventListener() { },
|
|
40
|
+
removeEventListener() { },
|
|
41
|
+
activeElement: {
|
|
42
|
+
blur() { },
|
|
43
|
+
nodeName: '',
|
|
44
|
+
},
|
|
45
|
+
querySelector() {
|
|
46
|
+
return null;
|
|
47
|
+
},
|
|
48
|
+
querySelectorAll() {
|
|
49
|
+
return [];
|
|
50
|
+
},
|
|
51
|
+
getElementById() {
|
|
52
|
+
return null;
|
|
53
|
+
},
|
|
54
|
+
createEvent() {
|
|
55
|
+
return {
|
|
56
|
+
initEvent() { },
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
createElement() {
|
|
60
|
+
return {
|
|
61
|
+
children: [],
|
|
62
|
+
childNodes: [],
|
|
63
|
+
style: {},
|
|
64
|
+
setAttribute() { },
|
|
65
|
+
getElementsByTagName() {
|
|
66
|
+
return [];
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
createElementNS() {
|
|
71
|
+
return {};
|
|
72
|
+
},
|
|
73
|
+
importNode() {
|
|
74
|
+
return null;
|
|
75
|
+
},
|
|
76
|
+
location: {
|
|
77
|
+
hash: '',
|
|
78
|
+
host: '',
|
|
79
|
+
hostname: '',
|
|
80
|
+
href: '',
|
|
81
|
+
origin: '',
|
|
82
|
+
pathname: '',
|
|
83
|
+
protocol: '',
|
|
84
|
+
search: '',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
function getDocument() {
|
|
88
|
+
const doc = typeof document !== 'undefined' ? document : {};
|
|
89
|
+
extend$1(doc, ssrDocument);
|
|
90
|
+
return doc;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const ssrWindow = {
|
|
94
|
+
document: ssrDocument,
|
|
95
|
+
navigator: {
|
|
96
|
+
userAgent: '',
|
|
97
|
+
},
|
|
98
|
+
location: {
|
|
99
|
+
hash: '',
|
|
100
|
+
host: '',
|
|
101
|
+
hostname: '',
|
|
102
|
+
href: '',
|
|
103
|
+
origin: '',
|
|
104
|
+
pathname: '',
|
|
105
|
+
protocol: '',
|
|
106
|
+
search: '',
|
|
107
|
+
},
|
|
108
|
+
history: {
|
|
109
|
+
replaceState() { },
|
|
110
|
+
pushState() { },
|
|
111
|
+
go() { },
|
|
112
|
+
back() { },
|
|
113
|
+
},
|
|
114
|
+
CustomEvent: function CustomEvent() {
|
|
115
|
+
return this;
|
|
116
|
+
},
|
|
117
|
+
addEventListener() { },
|
|
118
|
+
removeEventListener() { },
|
|
119
|
+
getComputedStyle() {
|
|
120
|
+
return {
|
|
121
|
+
getPropertyValue() {
|
|
122
|
+
return '';
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
Image() { },
|
|
127
|
+
Date() { },
|
|
128
|
+
screen: {},
|
|
129
|
+
setTimeout() { },
|
|
130
|
+
clearTimeout() { },
|
|
131
|
+
matchMedia() {
|
|
132
|
+
return {};
|
|
133
|
+
},
|
|
134
|
+
requestAnimationFrame(callback) {
|
|
135
|
+
if (typeof setTimeout === 'undefined') {
|
|
136
|
+
callback();
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return setTimeout(callback, 0);
|
|
140
|
+
},
|
|
141
|
+
cancelAnimationFrame(id) {
|
|
142
|
+
if (typeof setTimeout === 'undefined') {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
clearTimeout(id);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
function getWindow() {
|
|
149
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
150
|
+
extend$1(win, ssrWindow);
|
|
151
|
+
return win;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function deleteProps(obj) {
|
|
155
|
+
const object = obj;
|
|
156
|
+
Object.keys(object).forEach(key => {
|
|
157
|
+
try {
|
|
158
|
+
object[key] = null;
|
|
159
|
+
} catch (e) {
|
|
160
|
+
// no getter for object
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
delete object[key];
|
|
164
|
+
} catch (e) {
|
|
165
|
+
// something got wrong
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function nextTick(callback, delay = 0) {
|
|
170
|
+
return setTimeout(callback, delay);
|
|
171
|
+
}
|
|
172
|
+
function now() {
|
|
173
|
+
return Date.now();
|
|
174
|
+
}
|
|
175
|
+
function getComputedStyle$1(el) {
|
|
176
|
+
const window = getWindow();
|
|
177
|
+
let style;
|
|
178
|
+
if (window.getComputedStyle) {
|
|
179
|
+
style = window.getComputedStyle(el, null);
|
|
180
|
+
}
|
|
181
|
+
if (!style && el.currentStyle) {
|
|
182
|
+
style = el.currentStyle;
|
|
183
|
+
}
|
|
184
|
+
if (!style) {
|
|
185
|
+
style = el.style;
|
|
186
|
+
}
|
|
187
|
+
return style;
|
|
188
|
+
}
|
|
189
|
+
function getTranslate(el, axis = 'x') {
|
|
190
|
+
const window = getWindow();
|
|
191
|
+
let matrix;
|
|
192
|
+
let curTransform;
|
|
193
|
+
let transformMatrix;
|
|
194
|
+
const curStyle = getComputedStyle$1(el);
|
|
195
|
+
if (window.WebKitCSSMatrix) {
|
|
196
|
+
curTransform = curStyle.transform || curStyle.webkitTransform;
|
|
197
|
+
if (curTransform.split(',').length > 6) {
|
|
198
|
+
curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
|
|
199
|
+
}
|
|
200
|
+
// Some old versions of Webkit choke when 'none' is passed; pass
|
|
201
|
+
// empty string instead in this case
|
|
202
|
+
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
|
|
203
|
+
} else {
|
|
204
|
+
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
|
|
205
|
+
matrix = transformMatrix.toString().split(',');
|
|
206
|
+
}
|
|
207
|
+
if (axis === 'x') {
|
|
208
|
+
// Latest Chrome and webkits Fix
|
|
209
|
+
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
|
|
210
|
+
// Crazy IE10 Matrix
|
|
211
|
+
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
|
|
212
|
+
// Normal Browsers
|
|
213
|
+
else curTransform = parseFloat(matrix[4]);
|
|
214
|
+
}
|
|
215
|
+
if (axis === 'y') {
|
|
216
|
+
// Latest Chrome and webkits Fix
|
|
217
|
+
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
|
|
218
|
+
// Crazy IE10 Matrix
|
|
219
|
+
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
|
|
220
|
+
// Normal Browsers
|
|
221
|
+
else curTransform = parseFloat(matrix[5]);
|
|
222
|
+
}
|
|
223
|
+
return curTransform || 0;
|
|
224
|
+
}
|
|
225
|
+
function isObject(o) {
|
|
226
|
+
return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
|
|
227
|
+
}
|
|
228
|
+
function isNode(node) {
|
|
229
|
+
// eslint-disable-next-line
|
|
230
|
+
if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
|
|
231
|
+
return node instanceof HTMLElement;
|
|
232
|
+
}
|
|
233
|
+
return node && (node.nodeType === 1 || node.nodeType === 11);
|
|
234
|
+
}
|
|
235
|
+
function extend(...args) {
|
|
236
|
+
const to = Object(args[0]);
|
|
237
|
+
const noExtend = ['__proto__', 'constructor', 'prototype'];
|
|
238
|
+
for (let i = 1; i < args.length; i += 1) {
|
|
239
|
+
const nextSource = args[i];
|
|
240
|
+
if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
|
|
241
|
+
const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
|
|
242
|
+
for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
|
|
243
|
+
const nextKey = keysArray[nextIndex];
|
|
244
|
+
const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
245
|
+
if (desc !== undefined && desc.enumerable) {
|
|
246
|
+
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
|
|
247
|
+
if (nextSource[nextKey].__swiper__) {
|
|
248
|
+
to[nextKey] = nextSource[nextKey];
|
|
249
|
+
} else {
|
|
250
|
+
extend(to[nextKey], nextSource[nextKey]);
|
|
251
|
+
}
|
|
252
|
+
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
|
|
253
|
+
to[nextKey] = {};
|
|
254
|
+
if (nextSource[nextKey].__swiper__) {
|
|
255
|
+
to[nextKey] = nextSource[nextKey];
|
|
256
|
+
} else {
|
|
257
|
+
extend(to[nextKey], nextSource[nextKey]);
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
to[nextKey] = nextSource[nextKey];
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return to;
|
|
267
|
+
}
|
|
268
|
+
function setCSSProperty(el, varName, varValue) {
|
|
269
|
+
el.style.setProperty(varName, varValue);
|
|
270
|
+
}
|
|
271
|
+
function animateCSSModeScroll({
|
|
272
|
+
swiper,
|
|
273
|
+
targetPosition,
|
|
274
|
+
side
|
|
275
|
+
}) {
|
|
276
|
+
const window = getWindow();
|
|
277
|
+
const startPosition = -swiper.translate;
|
|
278
|
+
let startTime = null;
|
|
279
|
+
let time;
|
|
280
|
+
const duration = swiper.params.speed;
|
|
281
|
+
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
282
|
+
window.cancelAnimationFrame(swiper.cssModeFrameID);
|
|
283
|
+
const dir = targetPosition > startPosition ? 'next' : 'prev';
|
|
284
|
+
const isOutOfBound = (current, target) => {
|
|
285
|
+
return dir === 'next' && current >= target || dir === 'prev' && current <= target;
|
|
286
|
+
};
|
|
287
|
+
const animate = () => {
|
|
288
|
+
time = new Date().getTime();
|
|
289
|
+
if (startTime === null) {
|
|
290
|
+
startTime = time;
|
|
291
|
+
}
|
|
292
|
+
const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
|
|
293
|
+
const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
|
|
294
|
+
let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
|
|
295
|
+
if (isOutOfBound(currentPosition, targetPosition)) {
|
|
296
|
+
currentPosition = targetPosition;
|
|
297
|
+
}
|
|
298
|
+
swiper.wrapperEl.scrollTo({
|
|
299
|
+
[side]: currentPosition
|
|
300
|
+
});
|
|
301
|
+
if (isOutOfBound(currentPosition, targetPosition)) {
|
|
302
|
+
swiper.wrapperEl.style.overflow = 'hidden';
|
|
303
|
+
swiper.wrapperEl.style.scrollSnapType = '';
|
|
304
|
+
setTimeout(() => {
|
|
305
|
+
swiper.wrapperEl.style.overflow = '';
|
|
306
|
+
swiper.wrapperEl.scrollTo({
|
|
307
|
+
[side]: currentPosition
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
window.cancelAnimationFrame(swiper.cssModeFrameID);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
swiper.cssModeFrameID = window.requestAnimationFrame(animate);
|
|
314
|
+
};
|
|
315
|
+
animate();
|
|
316
|
+
}
|
|
317
|
+
function elementChildren(element, selector = '') {
|
|
318
|
+
return [...element.children].filter(el => el.matches(selector));
|
|
319
|
+
}
|
|
320
|
+
function createElement(tag, classes = []) {
|
|
321
|
+
const el = document.createElement(tag);
|
|
322
|
+
el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
|
|
323
|
+
return el;
|
|
324
|
+
}
|
|
325
|
+
function elementPrevAll(el, selector) {
|
|
326
|
+
const prevEls = [];
|
|
327
|
+
while (el.previousElementSibling) {
|
|
328
|
+
const prev = el.previousElementSibling; // eslint-disable-line
|
|
329
|
+
if (selector) {
|
|
330
|
+
if (prev.matches(selector)) prevEls.push(prev);
|
|
331
|
+
} else prevEls.push(prev);
|
|
332
|
+
el = prev;
|
|
333
|
+
}
|
|
334
|
+
return prevEls;
|
|
335
|
+
}
|
|
336
|
+
function elementNextAll(el, selector) {
|
|
337
|
+
const nextEls = [];
|
|
338
|
+
while (el.nextElementSibling) {
|
|
339
|
+
const next = el.nextElementSibling; // eslint-disable-line
|
|
340
|
+
if (selector) {
|
|
341
|
+
if (next.matches(selector)) nextEls.push(next);
|
|
342
|
+
} else nextEls.push(next);
|
|
343
|
+
el = next;
|
|
344
|
+
}
|
|
345
|
+
return nextEls;
|
|
346
|
+
}
|
|
347
|
+
function elementStyle(el, prop) {
|
|
348
|
+
const window = getWindow();
|
|
349
|
+
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
|
350
|
+
}
|
|
351
|
+
function elementIndex(el) {
|
|
352
|
+
let child = el;
|
|
353
|
+
let i;
|
|
354
|
+
if (child) {
|
|
355
|
+
i = 0;
|
|
356
|
+
// eslint-disable-next-line
|
|
357
|
+
while ((child = child.previousSibling) !== null) {
|
|
358
|
+
if (child.nodeType === 1) i += 1;
|
|
359
|
+
}
|
|
360
|
+
return i;
|
|
361
|
+
}
|
|
362
|
+
return undefined;
|
|
363
|
+
}
|
|
364
|
+
function elementParents(el, selector) {
|
|
365
|
+
const parents = []; // eslint-disable-line
|
|
366
|
+
let parent = el.parentElement; // eslint-disable-line
|
|
367
|
+
while (parent) {
|
|
368
|
+
if (selector) {
|
|
369
|
+
if (parent.matches(selector)) parents.push(parent);
|
|
370
|
+
} else {
|
|
371
|
+
parents.push(parent);
|
|
372
|
+
}
|
|
373
|
+
parent = parent.parentElement;
|
|
374
|
+
}
|
|
375
|
+
return parents;
|
|
376
|
+
}
|
|
377
|
+
function elementOuterSize(el, size, includeMargins) {
|
|
378
|
+
const window = getWindow();
|
|
379
|
+
if (includeMargins) {
|
|
380
|
+
return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));
|
|
381
|
+
}
|
|
382
|
+
return el.offsetWidth;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
let support;
|
|
386
|
+
function calcSupport() {
|
|
387
|
+
const window = getWindow();
|
|
388
|
+
const document = getDocument();
|
|
389
|
+
return {
|
|
390
|
+
smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,
|
|
391
|
+
touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function getSupport() {
|
|
395
|
+
if (!support) {
|
|
396
|
+
support = calcSupport();
|
|
397
|
+
}
|
|
398
|
+
return support;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
let deviceCached;
|
|
402
|
+
function calcDevice({
|
|
403
|
+
userAgent
|
|
404
|
+
} = {}) {
|
|
405
|
+
const support = getSupport();
|
|
406
|
+
const window = getWindow();
|
|
407
|
+
const platform = window.navigator.platform;
|
|
408
|
+
const ua = userAgent || window.navigator.userAgent;
|
|
409
|
+
const device = {
|
|
410
|
+
ios: false,
|
|
411
|
+
android: false
|
|
412
|
+
};
|
|
413
|
+
const screenWidth = window.screen.width;
|
|
414
|
+
const screenHeight = window.screen.height;
|
|
415
|
+
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
|
|
416
|
+
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
|
|
417
|
+
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
|
|
418
|
+
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
|
|
419
|
+
const windows = platform === 'Win32';
|
|
420
|
+
let macos = platform === 'MacIntel';
|
|
421
|
+
|
|
422
|
+
// iPadOs 13 fix
|
|
423
|
+
const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
|
|
424
|
+
if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {
|
|
425
|
+
ipad = ua.match(/(Version)\/([\d.]+)/);
|
|
426
|
+
if (!ipad) ipad = [0, 1, '13_0_0'];
|
|
427
|
+
macos = false;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Android
|
|
431
|
+
if (android && !windows) {
|
|
432
|
+
device.os = 'android';
|
|
433
|
+
device.android = true;
|
|
434
|
+
}
|
|
435
|
+
if (ipad || iphone || ipod) {
|
|
436
|
+
device.os = 'ios';
|
|
437
|
+
device.ios = true;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Export object
|
|
441
|
+
return device;
|
|
442
|
+
}
|
|
443
|
+
function getDevice(overrides = {}) {
|
|
444
|
+
if (!deviceCached) {
|
|
445
|
+
deviceCached = calcDevice(overrides);
|
|
446
|
+
}
|
|
447
|
+
return deviceCached;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
let browser;
|
|
451
|
+
function calcBrowser() {
|
|
452
|
+
const window = getWindow();
|
|
453
|
+
let needPerspectiveFix = false;
|
|
454
|
+
function isSafari() {
|
|
455
|
+
const ua = window.navigator.userAgent.toLowerCase();
|
|
456
|
+
return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
|
|
457
|
+
}
|
|
458
|
+
if (isSafari()) {
|
|
459
|
+
const ua = String(window.navigator.userAgent);
|
|
460
|
+
if (ua.includes('Version/')) {
|
|
461
|
+
const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num));
|
|
462
|
+
needPerspectiveFix = major < 16 || major === 16 && minor < 2;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return {
|
|
466
|
+
isSafari: needPerspectiveFix || isSafari(),
|
|
467
|
+
needPerspectiveFix,
|
|
468
|
+
isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function getBrowser() {
|
|
472
|
+
if (!browser) {
|
|
473
|
+
browser = calcBrowser();
|
|
474
|
+
}
|
|
475
|
+
return browser;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function Resize({
|
|
479
|
+
swiper,
|
|
480
|
+
on,
|
|
481
|
+
emit
|
|
482
|
+
}) {
|
|
483
|
+
const window = getWindow();
|
|
484
|
+
let observer = null;
|
|
485
|
+
let animationFrame = null;
|
|
486
|
+
const resizeHandler = () => {
|
|
487
|
+
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
|
488
|
+
emit('beforeResize');
|
|
489
|
+
emit('resize');
|
|
490
|
+
};
|
|
491
|
+
const createObserver = () => {
|
|
492
|
+
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
|
493
|
+
observer = new ResizeObserver(entries => {
|
|
494
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
495
|
+
const {
|
|
496
|
+
width,
|
|
497
|
+
height
|
|
498
|
+
} = swiper;
|
|
499
|
+
let newWidth = width;
|
|
500
|
+
let newHeight = height;
|
|
501
|
+
entries.forEach(({
|
|
502
|
+
contentBoxSize,
|
|
503
|
+
contentRect,
|
|
504
|
+
target
|
|
505
|
+
}) => {
|
|
506
|
+
if (target && target !== swiper.el) return;
|
|
507
|
+
newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
|
|
508
|
+
newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
|
|
509
|
+
});
|
|
510
|
+
if (newWidth !== width || newHeight !== height) {
|
|
511
|
+
resizeHandler();
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
observer.observe(swiper.el);
|
|
516
|
+
};
|
|
517
|
+
const removeObserver = () => {
|
|
518
|
+
if (animationFrame) {
|
|
519
|
+
window.cancelAnimationFrame(animationFrame);
|
|
520
|
+
}
|
|
521
|
+
if (observer && observer.unobserve && swiper.el) {
|
|
522
|
+
observer.unobserve(swiper.el);
|
|
523
|
+
observer = null;
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
const orientationChangeHandler = () => {
|
|
527
|
+
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
|
528
|
+
emit('orientationchange');
|
|
529
|
+
};
|
|
530
|
+
on('init', () => {
|
|
531
|
+
if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
|
|
532
|
+
createObserver();
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
window.addEventListener('resize', resizeHandler);
|
|
536
|
+
window.addEventListener('orientationchange', orientationChangeHandler);
|
|
537
|
+
});
|
|
538
|
+
on('destroy', () => {
|
|
539
|
+
removeObserver();
|
|
540
|
+
window.removeEventListener('resize', resizeHandler);
|
|
541
|
+
window.removeEventListener('orientationchange', orientationChangeHandler);
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function Observer({
|
|
546
|
+
swiper,
|
|
547
|
+
extendParams,
|
|
548
|
+
on,
|
|
549
|
+
emit
|
|
550
|
+
}) {
|
|
551
|
+
const observers = [];
|
|
552
|
+
const window = getWindow();
|
|
553
|
+
const attach = (target, options = {}) => {
|
|
554
|
+
const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
|
|
555
|
+
const observer = new ObserverFunc(mutations => {
|
|
556
|
+
// The observerUpdate event should only be triggered
|
|
557
|
+
// once despite the number of mutations. Additional
|
|
558
|
+
// triggers are redundant and are very costly
|
|
559
|
+
if (swiper.__preventObserver__) return;
|
|
560
|
+
if (mutations.length === 1) {
|
|
561
|
+
emit('observerUpdate', mutations[0]);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const observerUpdate = function observerUpdate() {
|
|
565
|
+
emit('observerUpdate', mutations[0]);
|
|
566
|
+
};
|
|
567
|
+
if (window.requestAnimationFrame) {
|
|
568
|
+
window.requestAnimationFrame(observerUpdate);
|
|
569
|
+
} else {
|
|
570
|
+
window.setTimeout(observerUpdate, 0);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
observer.observe(target, {
|
|
574
|
+
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
|
|
575
|
+
childList: typeof options.childList === 'undefined' ? true : options.childList,
|
|
576
|
+
characterData: typeof options.characterData === 'undefined' ? true : options.characterData
|
|
577
|
+
});
|
|
578
|
+
observers.push(observer);
|
|
579
|
+
};
|
|
580
|
+
const init = () => {
|
|
581
|
+
if (!swiper.params.observer) return;
|
|
582
|
+
if (swiper.params.observeParents) {
|
|
583
|
+
const containerParents = elementParents(swiper.el);
|
|
584
|
+
for (let i = 0; i < containerParents.length; i += 1) {
|
|
585
|
+
attach(containerParents[i]);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
// Observe container
|
|
589
|
+
attach(swiper.el, {
|
|
590
|
+
childList: swiper.params.observeSlideChildren
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
// Observe wrapper
|
|
594
|
+
attach(swiper.wrapperEl, {
|
|
595
|
+
attributes: false
|
|
596
|
+
});
|
|
597
|
+
};
|
|
598
|
+
const destroy = () => {
|
|
599
|
+
observers.forEach(observer => {
|
|
600
|
+
observer.disconnect();
|
|
601
|
+
});
|
|
602
|
+
observers.splice(0, observers.length);
|
|
603
|
+
};
|
|
604
|
+
extendParams({
|
|
605
|
+
observer: false,
|
|
606
|
+
observeParents: false,
|
|
607
|
+
observeSlideChildren: false
|
|
608
|
+
});
|
|
609
|
+
on('init', init);
|
|
610
|
+
on('destroy', destroy);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/* eslint-disable no-underscore-dangle */
|
|
614
|
+
|
|
615
|
+
const eventsEmitter = {
|
|
616
|
+
on(events, handler, priority) {
|
|
617
|
+
const self = this;
|
|
618
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
619
|
+
if (typeof handler !== 'function') return self;
|
|
620
|
+
const method = priority ? 'unshift' : 'push';
|
|
621
|
+
events.split(' ').forEach(event => {
|
|
622
|
+
if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
|
|
623
|
+
self.eventsListeners[event][method](handler);
|
|
624
|
+
});
|
|
625
|
+
return self;
|
|
626
|
+
},
|
|
627
|
+
once(events, handler, priority) {
|
|
628
|
+
const self = this;
|
|
629
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
630
|
+
if (typeof handler !== 'function') return self;
|
|
631
|
+
function onceHandler(...args) {
|
|
632
|
+
self.off(events, onceHandler);
|
|
633
|
+
if (onceHandler.__emitterProxy) {
|
|
634
|
+
delete onceHandler.__emitterProxy;
|
|
635
|
+
}
|
|
636
|
+
handler.apply(self, args);
|
|
637
|
+
}
|
|
638
|
+
onceHandler.__emitterProxy = handler;
|
|
639
|
+
return self.on(events, onceHandler, priority);
|
|
640
|
+
},
|
|
641
|
+
onAny(handler, priority) {
|
|
642
|
+
const self = this;
|
|
643
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
644
|
+
if (typeof handler !== 'function') return self;
|
|
645
|
+
const method = priority ? 'unshift' : 'push';
|
|
646
|
+
if (self.eventsAnyListeners.indexOf(handler) < 0) {
|
|
647
|
+
self.eventsAnyListeners[method](handler);
|
|
648
|
+
}
|
|
649
|
+
return self;
|
|
650
|
+
},
|
|
651
|
+
offAny(handler) {
|
|
652
|
+
const self = this;
|
|
653
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
654
|
+
if (!self.eventsAnyListeners) return self;
|
|
655
|
+
const index = self.eventsAnyListeners.indexOf(handler);
|
|
656
|
+
if (index >= 0) {
|
|
657
|
+
self.eventsAnyListeners.splice(index, 1);
|
|
658
|
+
}
|
|
659
|
+
return self;
|
|
660
|
+
},
|
|
661
|
+
off(events, handler) {
|
|
662
|
+
const self = this;
|
|
663
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
664
|
+
if (!self.eventsListeners) return self;
|
|
665
|
+
events.split(' ').forEach(event => {
|
|
666
|
+
if (typeof handler === 'undefined') {
|
|
667
|
+
self.eventsListeners[event] = [];
|
|
668
|
+
} else if (self.eventsListeners[event]) {
|
|
669
|
+
self.eventsListeners[event].forEach((eventHandler, index) => {
|
|
670
|
+
if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
|
|
671
|
+
self.eventsListeners[event].splice(index, 1);
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
return self;
|
|
677
|
+
},
|
|
678
|
+
emit(...args) {
|
|
679
|
+
const self = this;
|
|
680
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
681
|
+
if (!self.eventsListeners) return self;
|
|
682
|
+
let events;
|
|
683
|
+
let data;
|
|
684
|
+
let context;
|
|
685
|
+
if (typeof args[0] === 'string' || Array.isArray(args[0])) {
|
|
686
|
+
events = args[0];
|
|
687
|
+
data = args.slice(1, args.length);
|
|
688
|
+
context = self;
|
|
689
|
+
} else {
|
|
690
|
+
events = args[0].events;
|
|
691
|
+
data = args[0].data;
|
|
692
|
+
context = args[0].context || self;
|
|
693
|
+
}
|
|
694
|
+
data.unshift(context);
|
|
695
|
+
const eventsArray = Array.isArray(events) ? events : events.split(' ');
|
|
696
|
+
eventsArray.forEach(event => {
|
|
697
|
+
if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
|
|
698
|
+
self.eventsAnyListeners.forEach(eventHandler => {
|
|
699
|
+
eventHandler.apply(context, [event, ...data]);
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
if (self.eventsListeners && self.eventsListeners[event]) {
|
|
703
|
+
self.eventsListeners[event].forEach(eventHandler => {
|
|
704
|
+
eventHandler.apply(context, data);
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
return self;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
function updateSize() {
|
|
713
|
+
const swiper = this;
|
|
714
|
+
let width;
|
|
715
|
+
let height;
|
|
716
|
+
const el = swiper.el;
|
|
717
|
+
if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
|
|
718
|
+
width = swiper.params.width;
|
|
719
|
+
} else {
|
|
720
|
+
width = el.clientWidth;
|
|
721
|
+
}
|
|
722
|
+
if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
|
|
723
|
+
height = swiper.params.height;
|
|
724
|
+
} else {
|
|
725
|
+
height = el.clientHeight;
|
|
726
|
+
}
|
|
727
|
+
if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// Subtract paddings
|
|
732
|
+
width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10);
|
|
733
|
+
height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10);
|
|
734
|
+
if (Number.isNaN(width)) width = 0;
|
|
735
|
+
if (Number.isNaN(height)) height = 0;
|
|
736
|
+
Object.assign(swiper, {
|
|
737
|
+
width,
|
|
738
|
+
height,
|
|
739
|
+
size: swiper.isHorizontal() ? width : height
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function updateSlides() {
|
|
744
|
+
const swiper = this;
|
|
745
|
+
function getDirectionLabel(property) {
|
|
746
|
+
if (swiper.isHorizontal()) {
|
|
747
|
+
return property;
|
|
748
|
+
}
|
|
749
|
+
// prettier-ignore
|
|
750
|
+
return {
|
|
751
|
+
'width': 'height',
|
|
752
|
+
'margin-top': 'margin-left',
|
|
753
|
+
'margin-bottom ': 'margin-right',
|
|
754
|
+
'margin-left': 'margin-top',
|
|
755
|
+
'margin-right': 'margin-bottom',
|
|
756
|
+
'padding-left': 'padding-top',
|
|
757
|
+
'padding-right': 'padding-bottom',
|
|
758
|
+
'marginRight': 'marginBottom'
|
|
759
|
+
}[property];
|
|
760
|
+
}
|
|
761
|
+
function getDirectionPropertyValue(node, label) {
|
|
762
|
+
return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
|
|
763
|
+
}
|
|
764
|
+
const params = swiper.params;
|
|
765
|
+
const {
|
|
766
|
+
wrapperEl,
|
|
767
|
+
slidesEl,
|
|
768
|
+
size: swiperSize,
|
|
769
|
+
rtlTranslate: rtl,
|
|
770
|
+
wrongRTL
|
|
771
|
+
} = swiper;
|
|
772
|
+
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
773
|
+
const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
|
|
774
|
+
const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);
|
|
775
|
+
const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
|
|
776
|
+
let snapGrid = [];
|
|
777
|
+
const slidesGrid = [];
|
|
778
|
+
const slidesSizesGrid = [];
|
|
779
|
+
let offsetBefore = params.slidesOffsetBefore;
|
|
780
|
+
if (typeof offsetBefore === 'function') {
|
|
781
|
+
offsetBefore = params.slidesOffsetBefore.call(swiper);
|
|
782
|
+
}
|
|
783
|
+
let offsetAfter = params.slidesOffsetAfter;
|
|
784
|
+
if (typeof offsetAfter === 'function') {
|
|
785
|
+
offsetAfter = params.slidesOffsetAfter.call(swiper);
|
|
786
|
+
}
|
|
787
|
+
const previousSnapGridLength = swiper.snapGrid.length;
|
|
788
|
+
const previousSlidesGridLength = swiper.slidesGrid.length;
|
|
789
|
+
let spaceBetween = params.spaceBetween;
|
|
790
|
+
let slidePosition = -offsetBefore;
|
|
791
|
+
let prevSlideSize = 0;
|
|
792
|
+
let index = 0;
|
|
793
|
+
if (typeof swiperSize === 'undefined') {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
|
|
797
|
+
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
|
|
798
|
+
} else if (typeof spaceBetween === 'string') {
|
|
799
|
+
spaceBetween = parseFloat(spaceBetween);
|
|
800
|
+
}
|
|
801
|
+
swiper.virtualSize = -spaceBetween;
|
|
802
|
+
|
|
803
|
+
// reset margins
|
|
804
|
+
slides.forEach(slideEl => {
|
|
805
|
+
if (rtl) {
|
|
806
|
+
slideEl.style.marginLeft = '';
|
|
807
|
+
} else {
|
|
808
|
+
slideEl.style.marginRight = '';
|
|
809
|
+
}
|
|
810
|
+
slideEl.style.marginBottom = '';
|
|
811
|
+
slideEl.style.marginTop = '';
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
// reset cssMode offsets
|
|
815
|
+
if (params.centeredSlides && params.cssMode) {
|
|
816
|
+
setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');
|
|
817
|
+
setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');
|
|
818
|
+
}
|
|
819
|
+
const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
|
|
820
|
+
if (gridEnabled) {
|
|
821
|
+
swiper.grid.initSlides(slidesLength);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// Calc slides
|
|
825
|
+
let slideSize;
|
|
826
|
+
const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
|
|
827
|
+
return typeof params.breakpoints[key].slidesPerView !== 'undefined';
|
|
828
|
+
}).length > 0;
|
|
829
|
+
for (let i = 0; i < slidesLength; i += 1) {
|
|
830
|
+
slideSize = 0;
|
|
831
|
+
let slide;
|
|
832
|
+
if (slides[i]) slide = slides[i];
|
|
833
|
+
if (gridEnabled) {
|
|
834
|
+
swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
|
|
835
|
+
}
|
|
836
|
+
if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
|
|
837
|
+
|
|
838
|
+
if (params.slidesPerView === 'auto') {
|
|
839
|
+
if (shouldResetSlideSize) {
|
|
840
|
+
slides[i].style[getDirectionLabel('width')] = ``;
|
|
841
|
+
}
|
|
842
|
+
const slideStyles = getComputedStyle(slide);
|
|
843
|
+
const currentTransform = slide.style.transform;
|
|
844
|
+
const currentWebKitTransform = slide.style.webkitTransform;
|
|
845
|
+
if (currentTransform) {
|
|
846
|
+
slide.style.transform = 'none';
|
|
847
|
+
}
|
|
848
|
+
if (currentWebKitTransform) {
|
|
849
|
+
slide.style.webkitTransform = 'none';
|
|
850
|
+
}
|
|
851
|
+
if (params.roundLengths) {
|
|
852
|
+
slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true);
|
|
853
|
+
} else {
|
|
854
|
+
// eslint-disable-next-line
|
|
855
|
+
const width = getDirectionPropertyValue(slideStyles, 'width');
|
|
856
|
+
const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
|
|
857
|
+
const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
|
|
858
|
+
const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
|
|
859
|
+
const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
|
|
860
|
+
const boxSizing = slideStyles.getPropertyValue('box-sizing');
|
|
861
|
+
if (boxSizing && boxSizing === 'border-box') {
|
|
862
|
+
slideSize = width + marginLeft + marginRight;
|
|
863
|
+
} else {
|
|
864
|
+
const {
|
|
865
|
+
clientWidth,
|
|
866
|
+
offsetWidth
|
|
867
|
+
} = slide;
|
|
868
|
+
slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
if (currentTransform) {
|
|
872
|
+
slide.style.transform = currentTransform;
|
|
873
|
+
}
|
|
874
|
+
if (currentWebKitTransform) {
|
|
875
|
+
slide.style.webkitTransform = currentWebKitTransform;
|
|
876
|
+
}
|
|
877
|
+
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
878
|
+
} else {
|
|
879
|
+
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
|
|
880
|
+
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
881
|
+
if (slides[i]) {
|
|
882
|
+
slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (slides[i]) {
|
|
886
|
+
slides[i].swiperSlideSize = slideSize;
|
|
887
|
+
}
|
|
888
|
+
slidesSizesGrid.push(slideSize);
|
|
889
|
+
if (params.centeredSlides) {
|
|
890
|
+
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
|
|
891
|
+
if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
|
892
|
+
if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
|
893
|
+
if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
|
|
894
|
+
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
|
895
|
+
if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
|
|
896
|
+
slidesGrid.push(slidePosition);
|
|
897
|
+
} else {
|
|
898
|
+
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
|
899
|
+
if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
|
|
900
|
+
slidesGrid.push(slidePosition);
|
|
901
|
+
slidePosition = slidePosition + slideSize + spaceBetween;
|
|
902
|
+
}
|
|
903
|
+
swiper.virtualSize += slideSize + spaceBetween;
|
|
904
|
+
prevSlideSize = slideSize;
|
|
905
|
+
index += 1;
|
|
906
|
+
}
|
|
907
|
+
swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
|
|
908
|
+
if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
|
|
909
|
+
wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
|
|
910
|
+
}
|
|
911
|
+
if (params.setWrapperSize) {
|
|
912
|
+
wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
|
|
913
|
+
}
|
|
914
|
+
if (gridEnabled) {
|
|
915
|
+
swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// Remove last grid elements depending on width
|
|
919
|
+
if (!params.centeredSlides) {
|
|
920
|
+
const newSlidesGrid = [];
|
|
921
|
+
for (let i = 0; i < snapGrid.length; i += 1) {
|
|
922
|
+
let slidesGridItem = snapGrid[i];
|
|
923
|
+
if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
|
|
924
|
+
if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
|
|
925
|
+
newSlidesGrid.push(slidesGridItem);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
snapGrid = newSlidesGrid;
|
|
929
|
+
if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
|
|
930
|
+
snapGrid.push(swiper.virtualSize - swiperSize);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
if (isVirtual && params.loop) {
|
|
934
|
+
const size = slidesSizesGrid[0] + spaceBetween;
|
|
935
|
+
if (params.slidesPerGroup > 1) {
|
|
936
|
+
const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);
|
|
937
|
+
const groupSize = size * params.slidesPerGroup;
|
|
938
|
+
for (let i = 0; i < groups; i += 1) {
|
|
939
|
+
snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {
|
|
943
|
+
if (params.slidesPerGroup === 1) {
|
|
944
|
+
snapGrid.push(snapGrid[snapGrid.length - 1] + size);
|
|
945
|
+
}
|
|
946
|
+
slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);
|
|
947
|
+
swiper.virtualSize += size;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
if (snapGrid.length === 0) snapGrid = [0];
|
|
951
|
+
if (spaceBetween !== 0) {
|
|
952
|
+
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
|
|
953
|
+
slides.filter((_, slideIndex) => {
|
|
954
|
+
if (!params.cssMode || params.loop) return true;
|
|
955
|
+
if (slideIndex === slides.length - 1) {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
return true;
|
|
959
|
+
}).forEach(slideEl => {
|
|
960
|
+
slideEl.style[key] = `${spaceBetween}px`;
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
if (params.centeredSlides && params.centeredSlidesBounds) {
|
|
964
|
+
let allSlidesSize = 0;
|
|
965
|
+
slidesSizesGrid.forEach(slideSizeValue => {
|
|
966
|
+
allSlidesSize += slideSizeValue + (spaceBetween || 0);
|
|
967
|
+
});
|
|
968
|
+
allSlidesSize -= spaceBetween;
|
|
969
|
+
const maxSnap = allSlidesSize - swiperSize;
|
|
970
|
+
snapGrid = snapGrid.map(snap => {
|
|
971
|
+
if (snap < 0) return -offsetBefore;
|
|
972
|
+
if (snap > maxSnap) return maxSnap + offsetAfter;
|
|
973
|
+
return snap;
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
if (params.centerInsufficientSlides) {
|
|
977
|
+
let allSlidesSize = 0;
|
|
978
|
+
slidesSizesGrid.forEach(slideSizeValue => {
|
|
979
|
+
allSlidesSize += slideSizeValue + (spaceBetween || 0);
|
|
980
|
+
});
|
|
981
|
+
allSlidesSize -= spaceBetween;
|
|
982
|
+
if (allSlidesSize < swiperSize) {
|
|
983
|
+
const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
|
|
984
|
+
snapGrid.forEach((snap, snapIndex) => {
|
|
985
|
+
snapGrid[snapIndex] = snap - allSlidesOffset;
|
|
986
|
+
});
|
|
987
|
+
slidesGrid.forEach((snap, snapIndex) => {
|
|
988
|
+
slidesGrid[snapIndex] = snap + allSlidesOffset;
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
Object.assign(swiper, {
|
|
993
|
+
slides,
|
|
994
|
+
snapGrid,
|
|
995
|
+
slidesGrid,
|
|
996
|
+
slidesSizesGrid
|
|
997
|
+
});
|
|
998
|
+
if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
|
|
999
|
+
setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
|
|
1000
|
+
setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
|
|
1001
|
+
const addToSnapGrid = -swiper.snapGrid[0];
|
|
1002
|
+
const addToSlidesGrid = -swiper.slidesGrid[0];
|
|
1003
|
+
swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
|
|
1004
|
+
swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
|
|
1005
|
+
}
|
|
1006
|
+
if (slidesLength !== previousSlidesLength) {
|
|
1007
|
+
swiper.emit('slidesLengthChange');
|
|
1008
|
+
}
|
|
1009
|
+
if (snapGrid.length !== previousSnapGridLength) {
|
|
1010
|
+
if (swiper.params.watchOverflow) swiper.checkOverflow();
|
|
1011
|
+
swiper.emit('snapGridLengthChange');
|
|
1012
|
+
}
|
|
1013
|
+
if (slidesGrid.length !== previousSlidesGridLength) {
|
|
1014
|
+
swiper.emit('slidesGridLengthChange');
|
|
1015
|
+
}
|
|
1016
|
+
if (params.watchSlidesProgress) {
|
|
1017
|
+
swiper.updateSlidesOffset();
|
|
1018
|
+
}
|
|
1019
|
+
if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
|
|
1020
|
+
const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
|
|
1021
|
+
const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
|
|
1022
|
+
if (slidesLength <= params.maxBackfaceHiddenSlides) {
|
|
1023
|
+
if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass);
|
|
1024
|
+
} else if (hasClassBackfaceClassAdded) {
|
|
1025
|
+
swiper.el.classList.remove(backFaceHiddenClass);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function updateAutoHeight(speed) {
|
|
1031
|
+
const swiper = this;
|
|
1032
|
+
const activeSlides = [];
|
|
1033
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
1034
|
+
let newHeight = 0;
|
|
1035
|
+
let i;
|
|
1036
|
+
if (typeof speed === 'number') {
|
|
1037
|
+
swiper.setTransition(speed);
|
|
1038
|
+
} else if (speed === true) {
|
|
1039
|
+
swiper.setTransition(swiper.params.speed);
|
|
1040
|
+
}
|
|
1041
|
+
const getSlideByIndex = index => {
|
|
1042
|
+
if (isVirtual) {
|
|
1043
|
+
return swiper.slides[swiper.getSlideIndexByData(index)];
|
|
1044
|
+
}
|
|
1045
|
+
return swiper.slides[index];
|
|
1046
|
+
};
|
|
1047
|
+
// Find slides currently in view
|
|
1048
|
+
if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
|
|
1049
|
+
if (swiper.params.centeredSlides) {
|
|
1050
|
+
(swiper.visibleSlides || []).forEach(slide => {
|
|
1051
|
+
activeSlides.push(slide);
|
|
1052
|
+
});
|
|
1053
|
+
} else {
|
|
1054
|
+
for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
|
|
1055
|
+
const index = swiper.activeIndex + i;
|
|
1056
|
+
if (index > swiper.slides.length && !isVirtual) break;
|
|
1057
|
+
activeSlides.push(getSlideByIndex(index));
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
} else {
|
|
1061
|
+
activeSlides.push(getSlideByIndex(swiper.activeIndex));
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// Find new height from highest slide in view
|
|
1065
|
+
for (i = 0; i < activeSlides.length; i += 1) {
|
|
1066
|
+
if (typeof activeSlides[i] !== 'undefined') {
|
|
1067
|
+
const height = activeSlides[i].offsetHeight;
|
|
1068
|
+
newHeight = height > newHeight ? height : newHeight;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// Update Height
|
|
1073
|
+
if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
function updateSlidesOffset() {
|
|
1077
|
+
const swiper = this;
|
|
1078
|
+
const slides = swiper.slides;
|
|
1079
|
+
// eslint-disable-next-line
|
|
1080
|
+
const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;
|
|
1081
|
+
for (let i = 0; i < slides.length; i += 1) {
|
|
1082
|
+
slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
function updateSlidesProgress(translate = this && this.translate || 0) {
|
|
1087
|
+
const swiper = this;
|
|
1088
|
+
const params = swiper.params;
|
|
1089
|
+
const {
|
|
1090
|
+
slides,
|
|
1091
|
+
rtlTranslate: rtl,
|
|
1092
|
+
snapGrid
|
|
1093
|
+
} = swiper;
|
|
1094
|
+
if (slides.length === 0) return;
|
|
1095
|
+
if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
|
|
1096
|
+
let offsetCenter = -translate;
|
|
1097
|
+
if (rtl) offsetCenter = translate;
|
|
1098
|
+
|
|
1099
|
+
// Visible Slides
|
|
1100
|
+
slides.forEach(slideEl => {
|
|
1101
|
+
slideEl.classList.remove(params.slideVisibleClass);
|
|
1102
|
+
});
|
|
1103
|
+
swiper.visibleSlidesIndexes = [];
|
|
1104
|
+
swiper.visibleSlides = [];
|
|
1105
|
+
let spaceBetween = params.spaceBetween;
|
|
1106
|
+
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
|
|
1107
|
+
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;
|
|
1108
|
+
} else if (typeof spaceBetween === 'string') {
|
|
1109
|
+
spaceBetween = parseFloat(spaceBetween);
|
|
1110
|
+
}
|
|
1111
|
+
for (let i = 0; i < slides.length; i += 1) {
|
|
1112
|
+
const slide = slides[i];
|
|
1113
|
+
let slideOffset = slide.swiperSlideOffset;
|
|
1114
|
+
if (params.cssMode && params.centeredSlides) {
|
|
1115
|
+
slideOffset -= slides[0].swiperSlideOffset;
|
|
1116
|
+
}
|
|
1117
|
+
const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
|
|
1118
|
+
const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
|
|
1119
|
+
const slideBefore = -(offsetCenter - slideOffset);
|
|
1120
|
+
const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
|
|
1121
|
+
const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
|
|
1122
|
+
if (isVisible) {
|
|
1123
|
+
swiper.visibleSlides.push(slide);
|
|
1124
|
+
swiper.visibleSlidesIndexes.push(i);
|
|
1125
|
+
slides[i].classList.add(params.slideVisibleClass);
|
|
1126
|
+
}
|
|
1127
|
+
slide.progress = rtl ? -slideProgress : slideProgress;
|
|
1128
|
+
slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
function updateProgress(translate) {
|
|
1133
|
+
const swiper = this;
|
|
1134
|
+
if (typeof translate === 'undefined') {
|
|
1135
|
+
const multiplier = swiper.rtlTranslate ? -1 : 1;
|
|
1136
|
+
// eslint-disable-next-line
|
|
1137
|
+
translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
|
|
1138
|
+
}
|
|
1139
|
+
const params = swiper.params;
|
|
1140
|
+
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
|
1141
|
+
let {
|
|
1142
|
+
progress,
|
|
1143
|
+
isBeginning,
|
|
1144
|
+
isEnd,
|
|
1145
|
+
progressLoop
|
|
1146
|
+
} = swiper;
|
|
1147
|
+
const wasBeginning = isBeginning;
|
|
1148
|
+
const wasEnd = isEnd;
|
|
1149
|
+
if (translatesDiff === 0) {
|
|
1150
|
+
progress = 0;
|
|
1151
|
+
isBeginning = true;
|
|
1152
|
+
isEnd = true;
|
|
1153
|
+
} else {
|
|
1154
|
+
progress = (translate - swiper.minTranslate()) / translatesDiff;
|
|
1155
|
+
const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1;
|
|
1156
|
+
const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1;
|
|
1157
|
+
isBeginning = isBeginningRounded || progress <= 0;
|
|
1158
|
+
isEnd = isEndRounded || progress >= 1;
|
|
1159
|
+
if (isBeginningRounded) progress = 0;
|
|
1160
|
+
if (isEndRounded) progress = 1;
|
|
1161
|
+
}
|
|
1162
|
+
if (params.loop) {
|
|
1163
|
+
const firstSlideIndex = swiper.getSlideIndexByData(0);
|
|
1164
|
+
const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1);
|
|
1165
|
+
const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex];
|
|
1166
|
+
const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex];
|
|
1167
|
+
const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1];
|
|
1168
|
+
const translateAbs = Math.abs(translate);
|
|
1169
|
+
if (translateAbs >= firstSlideTranslate) {
|
|
1170
|
+
progressLoop = (translateAbs - firstSlideTranslate) / translateMax;
|
|
1171
|
+
} else {
|
|
1172
|
+
progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax;
|
|
1173
|
+
}
|
|
1174
|
+
if (progressLoop > 1) progressLoop -= 1;
|
|
1175
|
+
}
|
|
1176
|
+
Object.assign(swiper, {
|
|
1177
|
+
progress,
|
|
1178
|
+
progressLoop,
|
|
1179
|
+
isBeginning,
|
|
1180
|
+
isEnd
|
|
1181
|
+
});
|
|
1182
|
+
if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
|
|
1183
|
+
if (isBeginning && !wasBeginning) {
|
|
1184
|
+
swiper.emit('reachBeginning toEdge');
|
|
1185
|
+
}
|
|
1186
|
+
if (isEnd && !wasEnd) {
|
|
1187
|
+
swiper.emit('reachEnd toEdge');
|
|
1188
|
+
}
|
|
1189
|
+
if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
|
|
1190
|
+
swiper.emit('fromEdge');
|
|
1191
|
+
}
|
|
1192
|
+
swiper.emit('progress', progress);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
function updateSlidesClasses() {
|
|
1196
|
+
const swiper = this;
|
|
1197
|
+
const {
|
|
1198
|
+
slides,
|
|
1199
|
+
params,
|
|
1200
|
+
slidesEl,
|
|
1201
|
+
activeIndex
|
|
1202
|
+
} = swiper;
|
|
1203
|
+
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
1204
|
+
const getFilteredSlide = selector => {
|
|
1205
|
+
return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
|
|
1206
|
+
};
|
|
1207
|
+
slides.forEach(slideEl => {
|
|
1208
|
+
slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
1209
|
+
});
|
|
1210
|
+
let activeSlide;
|
|
1211
|
+
if (isVirtual) {
|
|
1212
|
+
if (params.loop) {
|
|
1213
|
+
let slideIndex = activeIndex - swiper.virtual.slidesBefore;
|
|
1214
|
+
if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;
|
|
1215
|
+
if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;
|
|
1216
|
+
activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`);
|
|
1217
|
+
} else {
|
|
1218
|
+
activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
|
|
1219
|
+
}
|
|
1220
|
+
} else {
|
|
1221
|
+
activeSlide = slides[activeIndex];
|
|
1222
|
+
}
|
|
1223
|
+
if (activeSlide) {
|
|
1224
|
+
// Active classes
|
|
1225
|
+
activeSlide.classList.add(params.slideActiveClass);
|
|
1226
|
+
|
|
1227
|
+
// Next Slide
|
|
1228
|
+
let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
1229
|
+
if (params.loop && !nextSlide) {
|
|
1230
|
+
nextSlide = slides[0];
|
|
1231
|
+
}
|
|
1232
|
+
if (nextSlide) {
|
|
1233
|
+
nextSlide.classList.add(params.slideNextClass);
|
|
1234
|
+
}
|
|
1235
|
+
// Prev Slide
|
|
1236
|
+
let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
1237
|
+
if (params.loop && !prevSlide === 0) {
|
|
1238
|
+
prevSlide = slides[slides.length - 1];
|
|
1239
|
+
}
|
|
1240
|
+
if (prevSlide) {
|
|
1241
|
+
prevSlide.classList.add(params.slidePrevClass);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
swiper.emitSlidesClasses();
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
const processLazyPreloader = (swiper, imageEl) => {
|
|
1248
|
+
if (!swiper || swiper.destroyed || !swiper.params) return;
|
|
1249
|
+
const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;
|
|
1250
|
+
const slideEl = imageEl.closest(slideSelector());
|
|
1251
|
+
if (slideEl) {
|
|
1252
|
+
const lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
1253
|
+
if (lazyEl) lazyEl.remove();
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
const unlazy = (swiper, index) => {
|
|
1257
|
+
if (!swiper.slides[index]) return;
|
|
1258
|
+
const imageEl = swiper.slides[index].querySelector('[loading="lazy"]');
|
|
1259
|
+
if (imageEl) imageEl.removeAttribute('loading');
|
|
1260
|
+
};
|
|
1261
|
+
const preload = swiper => {
|
|
1262
|
+
if (!swiper || swiper.destroyed || !swiper.params) return;
|
|
1263
|
+
let amount = swiper.params.lazyPreloadPrevNext;
|
|
1264
|
+
const len = swiper.slides.length;
|
|
1265
|
+
if (!len || !amount || amount < 0) return;
|
|
1266
|
+
amount = Math.min(amount, len);
|
|
1267
|
+
const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView);
|
|
1268
|
+
const activeIndex = swiper.activeIndex;
|
|
1269
|
+
const slideIndexLastInView = activeIndex + slidesPerView - 1;
|
|
1270
|
+
if (swiper.params.rewind) {
|
|
1271
|
+
for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {
|
|
1272
|
+
const realIndex = (i % len + len) % len;
|
|
1273
|
+
if (realIndex !== activeIndex && realIndex > slideIndexLastInView) unlazy(swiper, realIndex);
|
|
1274
|
+
}
|
|
1275
|
+
} else {
|
|
1276
|
+
for (let i = Math.max(slideIndexLastInView - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) {
|
|
1277
|
+
if (i !== activeIndex && i > slideIndexLastInView) unlazy(swiper, i);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
function getActiveIndexByTranslate(swiper) {
|
|
1283
|
+
const {
|
|
1284
|
+
slidesGrid,
|
|
1285
|
+
params
|
|
1286
|
+
} = swiper;
|
|
1287
|
+
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
|
1288
|
+
let activeIndex;
|
|
1289
|
+
for (let i = 0; i < slidesGrid.length; i += 1) {
|
|
1290
|
+
if (typeof slidesGrid[i + 1] !== 'undefined') {
|
|
1291
|
+
if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
|
|
1292
|
+
activeIndex = i;
|
|
1293
|
+
} else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
|
|
1294
|
+
activeIndex = i + 1;
|
|
1295
|
+
}
|
|
1296
|
+
} else if (translate >= slidesGrid[i]) {
|
|
1297
|
+
activeIndex = i;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
// Normalize slideIndex
|
|
1301
|
+
if (params.normalizeSlideIndex) {
|
|
1302
|
+
if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
|
|
1303
|
+
}
|
|
1304
|
+
return activeIndex;
|
|
1305
|
+
}
|
|
1306
|
+
function updateActiveIndex(newActiveIndex) {
|
|
1307
|
+
const swiper = this;
|
|
1308
|
+
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
|
1309
|
+
const {
|
|
1310
|
+
snapGrid,
|
|
1311
|
+
params,
|
|
1312
|
+
activeIndex: previousIndex,
|
|
1313
|
+
realIndex: previousRealIndex,
|
|
1314
|
+
snapIndex: previousSnapIndex
|
|
1315
|
+
} = swiper;
|
|
1316
|
+
let activeIndex = newActiveIndex;
|
|
1317
|
+
let snapIndex;
|
|
1318
|
+
const getVirtualRealIndex = aIndex => {
|
|
1319
|
+
let realIndex = aIndex - swiper.virtual.slidesBefore;
|
|
1320
|
+
if (realIndex < 0) {
|
|
1321
|
+
realIndex = swiper.virtual.slides.length + realIndex;
|
|
1322
|
+
}
|
|
1323
|
+
if (realIndex >= swiper.virtual.slides.length) {
|
|
1324
|
+
realIndex -= swiper.virtual.slides.length;
|
|
1325
|
+
}
|
|
1326
|
+
return realIndex;
|
|
1327
|
+
};
|
|
1328
|
+
if (typeof activeIndex === 'undefined') {
|
|
1329
|
+
activeIndex = getActiveIndexByTranslate(swiper);
|
|
1330
|
+
}
|
|
1331
|
+
if (snapGrid.indexOf(translate) >= 0) {
|
|
1332
|
+
snapIndex = snapGrid.indexOf(translate);
|
|
1333
|
+
} else {
|
|
1334
|
+
const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
|
|
1335
|
+
snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
|
|
1336
|
+
}
|
|
1337
|
+
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
1338
|
+
if (activeIndex === previousIndex) {
|
|
1339
|
+
if (snapIndex !== previousSnapIndex) {
|
|
1340
|
+
swiper.snapIndex = snapIndex;
|
|
1341
|
+
swiper.emit('snapIndexChange');
|
|
1342
|
+
}
|
|
1343
|
+
if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
|
|
1344
|
+
swiper.realIndex = getVirtualRealIndex(activeIndex);
|
|
1345
|
+
}
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
// Get real index
|
|
1349
|
+
let realIndex;
|
|
1350
|
+
if (swiper.virtual && params.virtual.enabled && params.loop) {
|
|
1351
|
+
realIndex = getVirtualRealIndex(activeIndex);
|
|
1352
|
+
} else if (swiper.slides[activeIndex]) {
|
|
1353
|
+
realIndex = parseInt(swiper.slides[activeIndex].getAttribute('data-swiper-slide-index') || activeIndex, 10);
|
|
1354
|
+
} else {
|
|
1355
|
+
realIndex = activeIndex;
|
|
1356
|
+
}
|
|
1357
|
+
Object.assign(swiper, {
|
|
1358
|
+
previousSnapIndex,
|
|
1359
|
+
snapIndex,
|
|
1360
|
+
previousRealIndex,
|
|
1361
|
+
realIndex,
|
|
1362
|
+
previousIndex,
|
|
1363
|
+
activeIndex
|
|
1364
|
+
});
|
|
1365
|
+
if (swiper.initialized) {
|
|
1366
|
+
preload(swiper);
|
|
1367
|
+
}
|
|
1368
|
+
swiper.emit('activeIndexChange');
|
|
1369
|
+
swiper.emit('snapIndexChange');
|
|
1370
|
+
if (previousRealIndex !== realIndex) {
|
|
1371
|
+
swiper.emit('realIndexChange');
|
|
1372
|
+
}
|
|
1373
|
+
if (swiper.initialized || swiper.params.runCallbacksOnInit) {
|
|
1374
|
+
swiper.emit('slideChange');
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
function updateClickedSlide(e) {
|
|
1379
|
+
const swiper = this;
|
|
1380
|
+
const params = swiper.params;
|
|
1381
|
+
const slide = e.closest(`.${params.slideClass}, swiper-slide`);
|
|
1382
|
+
let slideFound = false;
|
|
1383
|
+
let slideIndex;
|
|
1384
|
+
if (slide) {
|
|
1385
|
+
for (let i = 0; i < swiper.slides.length; i += 1) {
|
|
1386
|
+
if (swiper.slides[i] === slide) {
|
|
1387
|
+
slideFound = true;
|
|
1388
|
+
slideIndex = i;
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
if (slide && slideFound) {
|
|
1394
|
+
swiper.clickedSlide = slide;
|
|
1395
|
+
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
1396
|
+
swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);
|
|
1397
|
+
} else {
|
|
1398
|
+
swiper.clickedIndex = slideIndex;
|
|
1399
|
+
}
|
|
1400
|
+
} else {
|
|
1401
|
+
swiper.clickedSlide = undefined;
|
|
1402
|
+
swiper.clickedIndex = undefined;
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
|
|
1406
|
+
swiper.slideToClickedSlide();
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
const update = {
|
|
1411
|
+
updateSize,
|
|
1412
|
+
updateSlides,
|
|
1413
|
+
updateAutoHeight,
|
|
1414
|
+
updateSlidesOffset,
|
|
1415
|
+
updateSlidesProgress,
|
|
1416
|
+
updateProgress,
|
|
1417
|
+
updateSlidesClasses,
|
|
1418
|
+
updateActiveIndex,
|
|
1419
|
+
updateClickedSlide
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') {
|
|
1423
|
+
const swiper = this;
|
|
1424
|
+
const {
|
|
1425
|
+
params,
|
|
1426
|
+
rtlTranslate: rtl,
|
|
1427
|
+
translate,
|
|
1428
|
+
wrapperEl
|
|
1429
|
+
} = swiper;
|
|
1430
|
+
if (params.virtualTranslate) {
|
|
1431
|
+
return rtl ? -translate : translate;
|
|
1432
|
+
}
|
|
1433
|
+
if (params.cssMode) {
|
|
1434
|
+
return translate;
|
|
1435
|
+
}
|
|
1436
|
+
let currentTranslate = getTranslate(wrapperEl, axis);
|
|
1437
|
+
currentTranslate += swiper.cssOverflowAdjustment();
|
|
1438
|
+
if (rtl) currentTranslate = -currentTranslate;
|
|
1439
|
+
return currentTranslate || 0;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
function setTranslate(translate, byController) {
|
|
1443
|
+
const swiper = this;
|
|
1444
|
+
const {
|
|
1445
|
+
rtlTranslate: rtl,
|
|
1446
|
+
params,
|
|
1447
|
+
wrapperEl,
|
|
1448
|
+
progress
|
|
1449
|
+
} = swiper;
|
|
1450
|
+
let x = 0;
|
|
1451
|
+
let y = 0;
|
|
1452
|
+
const z = 0;
|
|
1453
|
+
if (swiper.isHorizontal()) {
|
|
1454
|
+
x = rtl ? -translate : translate;
|
|
1455
|
+
} else {
|
|
1456
|
+
y = translate;
|
|
1457
|
+
}
|
|
1458
|
+
if (params.roundLengths) {
|
|
1459
|
+
x = Math.floor(x);
|
|
1460
|
+
y = Math.floor(y);
|
|
1461
|
+
}
|
|
1462
|
+
swiper.previousTranslate = swiper.translate;
|
|
1463
|
+
swiper.translate = swiper.isHorizontal() ? x : y;
|
|
1464
|
+
if (params.cssMode) {
|
|
1465
|
+
wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
|
|
1466
|
+
} else if (!params.virtualTranslate) {
|
|
1467
|
+
if (swiper.isHorizontal()) {
|
|
1468
|
+
x -= swiper.cssOverflowAdjustment();
|
|
1469
|
+
} else {
|
|
1470
|
+
y -= swiper.cssOverflowAdjustment();
|
|
1471
|
+
}
|
|
1472
|
+
wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
// Check if we need to update progress
|
|
1476
|
+
let newProgress;
|
|
1477
|
+
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
|
1478
|
+
if (translatesDiff === 0) {
|
|
1479
|
+
newProgress = 0;
|
|
1480
|
+
} else {
|
|
1481
|
+
newProgress = (translate - swiper.minTranslate()) / translatesDiff;
|
|
1482
|
+
}
|
|
1483
|
+
if (newProgress !== progress) {
|
|
1484
|
+
swiper.updateProgress(translate);
|
|
1485
|
+
}
|
|
1486
|
+
swiper.emit('setTranslate', swiper.translate, byController);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
function minTranslate() {
|
|
1490
|
+
return -this.snapGrid[0];
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
function maxTranslate() {
|
|
1494
|
+
return -this.snapGrid[this.snapGrid.length - 1];
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
function translateTo(translate = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) {
|
|
1498
|
+
const swiper = this;
|
|
1499
|
+
const {
|
|
1500
|
+
params,
|
|
1501
|
+
wrapperEl
|
|
1502
|
+
} = swiper;
|
|
1503
|
+
if (swiper.animating && params.preventInteractionOnTransition) {
|
|
1504
|
+
return false;
|
|
1505
|
+
}
|
|
1506
|
+
const minTranslate = swiper.minTranslate();
|
|
1507
|
+
const maxTranslate = swiper.maxTranslate();
|
|
1508
|
+
let newTranslate;
|
|
1509
|
+
if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate;
|
|
1510
|
+
|
|
1511
|
+
// Update progress
|
|
1512
|
+
swiper.updateProgress(newTranslate);
|
|
1513
|
+
if (params.cssMode) {
|
|
1514
|
+
const isH = swiper.isHorizontal();
|
|
1515
|
+
if (speed === 0) {
|
|
1516
|
+
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
|
|
1517
|
+
} else {
|
|
1518
|
+
if (!swiper.support.smoothScroll) {
|
|
1519
|
+
animateCSSModeScroll({
|
|
1520
|
+
swiper,
|
|
1521
|
+
targetPosition: -newTranslate,
|
|
1522
|
+
side: isH ? 'left' : 'top'
|
|
1523
|
+
});
|
|
1524
|
+
return true;
|
|
1525
|
+
}
|
|
1526
|
+
wrapperEl.scrollTo({
|
|
1527
|
+
[isH ? 'left' : 'top']: -newTranslate,
|
|
1528
|
+
behavior: 'smooth'
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
return true;
|
|
1532
|
+
}
|
|
1533
|
+
if (speed === 0) {
|
|
1534
|
+
swiper.setTransition(0);
|
|
1535
|
+
swiper.setTranslate(newTranslate);
|
|
1536
|
+
if (runCallbacks) {
|
|
1537
|
+
swiper.emit('beforeTransitionStart', speed, internal);
|
|
1538
|
+
swiper.emit('transitionEnd');
|
|
1539
|
+
}
|
|
1540
|
+
} else {
|
|
1541
|
+
swiper.setTransition(speed);
|
|
1542
|
+
swiper.setTranslate(newTranslate);
|
|
1543
|
+
if (runCallbacks) {
|
|
1544
|
+
swiper.emit('beforeTransitionStart', speed, internal);
|
|
1545
|
+
swiper.emit('transitionStart');
|
|
1546
|
+
}
|
|
1547
|
+
if (!swiper.animating) {
|
|
1548
|
+
swiper.animating = true;
|
|
1549
|
+
if (!swiper.onTranslateToWrapperTransitionEnd) {
|
|
1550
|
+
swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
|
|
1551
|
+
if (!swiper || swiper.destroyed) return;
|
|
1552
|
+
if (e.target !== this) return;
|
|
1553
|
+
swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
|
|
1554
|
+
swiper.onTranslateToWrapperTransitionEnd = null;
|
|
1555
|
+
delete swiper.onTranslateToWrapperTransitionEnd;
|
|
1556
|
+
if (runCallbacks) {
|
|
1557
|
+
swiper.emit('transitionEnd');
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
return true;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
const translate = {
|
|
1568
|
+
getTranslate: getSwiperTranslate,
|
|
1569
|
+
setTranslate,
|
|
1570
|
+
minTranslate,
|
|
1571
|
+
maxTranslate,
|
|
1572
|
+
translateTo
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
function setTransition(duration, byController) {
|
|
1576
|
+
const swiper = this;
|
|
1577
|
+
if (!swiper.params.cssMode) {
|
|
1578
|
+
swiper.wrapperEl.style.transitionDuration = `${duration}ms`;
|
|
1579
|
+
}
|
|
1580
|
+
swiper.emit('setTransition', duration, byController);
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
function transitionEmit({
|
|
1584
|
+
swiper,
|
|
1585
|
+
runCallbacks,
|
|
1586
|
+
direction,
|
|
1587
|
+
step
|
|
1588
|
+
}) {
|
|
1589
|
+
const {
|
|
1590
|
+
activeIndex,
|
|
1591
|
+
previousIndex
|
|
1592
|
+
} = swiper;
|
|
1593
|
+
let dir = direction;
|
|
1594
|
+
if (!dir) {
|
|
1595
|
+
if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
|
|
1596
|
+
}
|
|
1597
|
+
swiper.emit(`transition${step}`);
|
|
1598
|
+
if (runCallbacks && activeIndex !== previousIndex) {
|
|
1599
|
+
if (dir === 'reset') {
|
|
1600
|
+
swiper.emit(`slideResetTransition${step}`);
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
swiper.emit(`slideChangeTransition${step}`);
|
|
1604
|
+
if (dir === 'next') {
|
|
1605
|
+
swiper.emit(`slideNextTransition${step}`);
|
|
1606
|
+
} else {
|
|
1607
|
+
swiper.emit(`slidePrevTransition${step}`);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
function transitionStart(runCallbacks = true, direction) {
|
|
1613
|
+
const swiper = this;
|
|
1614
|
+
const {
|
|
1615
|
+
params
|
|
1616
|
+
} = swiper;
|
|
1617
|
+
if (params.cssMode) return;
|
|
1618
|
+
if (params.autoHeight) {
|
|
1619
|
+
swiper.updateAutoHeight();
|
|
1620
|
+
}
|
|
1621
|
+
transitionEmit({
|
|
1622
|
+
swiper,
|
|
1623
|
+
runCallbacks,
|
|
1624
|
+
direction,
|
|
1625
|
+
step: 'Start'
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
function transitionEnd(runCallbacks = true, direction) {
|
|
1630
|
+
const swiper = this;
|
|
1631
|
+
const {
|
|
1632
|
+
params
|
|
1633
|
+
} = swiper;
|
|
1634
|
+
swiper.animating = false;
|
|
1635
|
+
if (params.cssMode) return;
|
|
1636
|
+
swiper.setTransition(0);
|
|
1637
|
+
transitionEmit({
|
|
1638
|
+
swiper,
|
|
1639
|
+
runCallbacks,
|
|
1640
|
+
direction,
|
|
1641
|
+
step: 'End'
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
const transition = {
|
|
1646
|
+
setTransition,
|
|
1647
|
+
transitionStart,
|
|
1648
|
+
transitionEnd
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
function slideTo(index = 0, speed = this.params.speed, runCallbacks = true, internal, initial) {
|
|
1652
|
+
if (typeof index === 'string') {
|
|
1653
|
+
index = parseInt(index, 10);
|
|
1654
|
+
}
|
|
1655
|
+
const swiper = this;
|
|
1656
|
+
let slideIndex = index;
|
|
1657
|
+
if (slideIndex < 0) slideIndex = 0;
|
|
1658
|
+
const {
|
|
1659
|
+
params,
|
|
1660
|
+
snapGrid,
|
|
1661
|
+
slidesGrid,
|
|
1662
|
+
previousIndex,
|
|
1663
|
+
activeIndex,
|
|
1664
|
+
rtlTranslate: rtl,
|
|
1665
|
+
wrapperEl,
|
|
1666
|
+
enabled
|
|
1667
|
+
} = swiper;
|
|
1668
|
+
if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
|
|
1669
|
+
return false;
|
|
1670
|
+
}
|
|
1671
|
+
const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
|
|
1672
|
+
let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
|
|
1673
|
+
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
1674
|
+
const translate = -snapGrid[snapIndex];
|
|
1675
|
+
// Normalize slideIndex
|
|
1676
|
+
if (params.normalizeSlideIndex) {
|
|
1677
|
+
for (let i = 0; i < slidesGrid.length; i += 1) {
|
|
1678
|
+
const normalizedTranslate = -Math.floor(translate * 100);
|
|
1679
|
+
const normalizedGrid = Math.floor(slidesGrid[i] * 100);
|
|
1680
|
+
const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
|
|
1681
|
+
if (typeof slidesGrid[i + 1] !== 'undefined') {
|
|
1682
|
+
if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
|
|
1683
|
+
slideIndex = i;
|
|
1684
|
+
} else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
|
|
1685
|
+
slideIndex = i + 1;
|
|
1686
|
+
}
|
|
1687
|
+
} else if (normalizedTranslate >= normalizedGrid) {
|
|
1688
|
+
slideIndex = i;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
// Directions locks
|
|
1693
|
+
if (swiper.initialized && slideIndex !== activeIndex) {
|
|
1694
|
+
if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
|
|
1695
|
+
return false;
|
|
1696
|
+
}
|
|
1697
|
+
if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
|
|
1698
|
+
if ((activeIndex || 0) !== slideIndex) {
|
|
1699
|
+
return false;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
if (slideIndex !== (previousIndex || 0) && runCallbacks) {
|
|
1704
|
+
swiper.emit('beforeSlideChangeStart');
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
// Update progress
|
|
1708
|
+
swiper.updateProgress(translate);
|
|
1709
|
+
let direction;
|
|
1710
|
+
if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';
|
|
1711
|
+
|
|
1712
|
+
// Update Index
|
|
1713
|
+
if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
|
|
1714
|
+
swiper.updateActiveIndex(slideIndex);
|
|
1715
|
+
// Update Height
|
|
1716
|
+
if (params.autoHeight) {
|
|
1717
|
+
swiper.updateAutoHeight();
|
|
1718
|
+
}
|
|
1719
|
+
swiper.updateSlidesClasses();
|
|
1720
|
+
if (params.effect !== 'slide') {
|
|
1721
|
+
swiper.setTranslate(translate);
|
|
1722
|
+
}
|
|
1723
|
+
if (direction !== 'reset') {
|
|
1724
|
+
swiper.transitionStart(runCallbacks, direction);
|
|
1725
|
+
swiper.transitionEnd(runCallbacks, direction);
|
|
1726
|
+
}
|
|
1727
|
+
return false;
|
|
1728
|
+
}
|
|
1729
|
+
if (params.cssMode) {
|
|
1730
|
+
const isH = swiper.isHorizontal();
|
|
1731
|
+
const t = rtl ? translate : -translate;
|
|
1732
|
+
if (speed === 0) {
|
|
1733
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
1734
|
+
if (isVirtual) {
|
|
1735
|
+
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
1736
|
+
swiper._immediateVirtual = true;
|
|
1737
|
+
}
|
|
1738
|
+
if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {
|
|
1739
|
+
swiper._cssModeVirtualInitialSet = true;
|
|
1740
|
+
requestAnimationFrame(() => {
|
|
1741
|
+
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
|
1742
|
+
});
|
|
1743
|
+
} else {
|
|
1744
|
+
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
|
1745
|
+
}
|
|
1746
|
+
if (isVirtual) {
|
|
1747
|
+
requestAnimationFrame(() => {
|
|
1748
|
+
swiper.wrapperEl.style.scrollSnapType = '';
|
|
1749
|
+
swiper._immediateVirtual = false;
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
} else {
|
|
1753
|
+
if (!swiper.support.smoothScroll) {
|
|
1754
|
+
animateCSSModeScroll({
|
|
1755
|
+
swiper,
|
|
1756
|
+
targetPosition: t,
|
|
1757
|
+
side: isH ? 'left' : 'top'
|
|
1758
|
+
});
|
|
1759
|
+
return true;
|
|
1760
|
+
}
|
|
1761
|
+
wrapperEl.scrollTo({
|
|
1762
|
+
[isH ? 'left' : 'top']: t,
|
|
1763
|
+
behavior: 'smooth'
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
return true;
|
|
1767
|
+
}
|
|
1768
|
+
swiper.setTransition(speed);
|
|
1769
|
+
swiper.setTranslate(translate);
|
|
1770
|
+
swiper.updateActiveIndex(slideIndex);
|
|
1771
|
+
swiper.updateSlidesClasses();
|
|
1772
|
+
swiper.emit('beforeTransitionStart', speed, internal);
|
|
1773
|
+
swiper.transitionStart(runCallbacks, direction);
|
|
1774
|
+
if (speed === 0) {
|
|
1775
|
+
swiper.transitionEnd(runCallbacks, direction);
|
|
1776
|
+
} else if (!swiper.animating) {
|
|
1777
|
+
swiper.animating = true;
|
|
1778
|
+
if (!swiper.onSlideToWrapperTransitionEnd) {
|
|
1779
|
+
swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
|
|
1780
|
+
if (!swiper || swiper.destroyed) return;
|
|
1781
|
+
if (e.target !== this) return;
|
|
1782
|
+
swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
|
|
1783
|
+
swiper.onSlideToWrapperTransitionEnd = null;
|
|
1784
|
+
delete swiper.onSlideToWrapperTransitionEnd;
|
|
1785
|
+
swiper.transitionEnd(runCallbacks, direction);
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
|
|
1789
|
+
}
|
|
1790
|
+
return true;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
function slideToLoop(index = 0, speed = this.params.speed, runCallbacks = true, internal) {
|
|
1794
|
+
if (typeof index === 'string') {
|
|
1795
|
+
const indexAsNumber = parseInt(index, 10);
|
|
1796
|
+
index = indexAsNumber;
|
|
1797
|
+
}
|
|
1798
|
+
const swiper = this;
|
|
1799
|
+
let newIndex = index;
|
|
1800
|
+
if (swiper.params.loop) {
|
|
1801
|
+
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
1802
|
+
// eslint-disable-next-line
|
|
1803
|
+
newIndex = newIndex + swiper.virtual.slidesBefore;
|
|
1804
|
+
} else {
|
|
1805
|
+
newIndex = swiper.getSlideIndexByData(newIndex);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
return swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
/* eslint no-unused-vars: "off" */
|
|
1812
|
+
function slideNext(speed = this.params.speed, runCallbacks = true, internal) {
|
|
1813
|
+
const swiper = this;
|
|
1814
|
+
const {
|
|
1815
|
+
enabled,
|
|
1816
|
+
params,
|
|
1817
|
+
animating
|
|
1818
|
+
} = swiper;
|
|
1819
|
+
if (!enabled) return swiper;
|
|
1820
|
+
let perGroup = params.slidesPerGroup;
|
|
1821
|
+
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
|
1822
|
+
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
|
|
1823
|
+
}
|
|
1824
|
+
const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
|
|
1825
|
+
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
1826
|
+
if (params.loop) {
|
|
1827
|
+
if (animating && !isVirtual && params.loopPreventsSliding) return false;
|
|
1828
|
+
swiper.loopFix({
|
|
1829
|
+
direction: 'next'
|
|
1830
|
+
});
|
|
1831
|
+
// eslint-disable-next-line
|
|
1832
|
+
swiper._clientLeft = swiper.wrapperEl.clientLeft;
|
|
1833
|
+
}
|
|
1834
|
+
if (params.rewind && swiper.isEnd) {
|
|
1835
|
+
return swiper.slideTo(0, speed, runCallbacks, internal);
|
|
1836
|
+
}
|
|
1837
|
+
return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/* eslint no-unused-vars: "off" */
|
|
1841
|
+
function slidePrev(speed = this.params.speed, runCallbacks = true, internal) {
|
|
1842
|
+
const swiper = this;
|
|
1843
|
+
const {
|
|
1844
|
+
params,
|
|
1845
|
+
snapGrid,
|
|
1846
|
+
slidesGrid,
|
|
1847
|
+
rtlTranslate,
|
|
1848
|
+
enabled,
|
|
1849
|
+
animating
|
|
1850
|
+
} = swiper;
|
|
1851
|
+
if (!enabled) return swiper;
|
|
1852
|
+
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
1853
|
+
if (params.loop) {
|
|
1854
|
+
if (animating && !isVirtual && params.loopPreventsSliding) return false;
|
|
1855
|
+
swiper.loopFix({
|
|
1856
|
+
direction: 'prev'
|
|
1857
|
+
});
|
|
1858
|
+
// eslint-disable-next-line
|
|
1859
|
+
swiper._clientLeft = swiper.wrapperEl.clientLeft;
|
|
1860
|
+
}
|
|
1861
|
+
const translate = rtlTranslate ? swiper.translate : -swiper.translate;
|
|
1862
|
+
function normalize(val) {
|
|
1863
|
+
if (val < 0) return -Math.floor(Math.abs(val));
|
|
1864
|
+
return Math.floor(val);
|
|
1865
|
+
}
|
|
1866
|
+
const normalizedTranslate = normalize(translate);
|
|
1867
|
+
const normalizedSnapGrid = snapGrid.map(val => normalize(val));
|
|
1868
|
+
let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
|
|
1869
|
+
if (typeof prevSnap === 'undefined' && params.cssMode) {
|
|
1870
|
+
let prevSnapIndex;
|
|
1871
|
+
snapGrid.forEach((snap, snapIndex) => {
|
|
1872
|
+
if (normalizedTranslate >= snap) {
|
|
1873
|
+
// prevSnap = snap;
|
|
1874
|
+
prevSnapIndex = snapIndex;
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
if (typeof prevSnapIndex !== 'undefined') {
|
|
1878
|
+
prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
let prevIndex = 0;
|
|
1882
|
+
if (typeof prevSnap !== 'undefined') {
|
|
1883
|
+
prevIndex = slidesGrid.indexOf(prevSnap);
|
|
1884
|
+
if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
|
|
1885
|
+
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
|
1886
|
+
prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
|
|
1887
|
+
prevIndex = Math.max(prevIndex, 0);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
if (params.rewind && swiper.isBeginning) {
|
|
1891
|
+
const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
|
|
1892
|
+
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
|
|
1893
|
+
}
|
|
1894
|
+
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
/* eslint no-unused-vars: "off" */
|
|
1898
|
+
function slideReset(speed = this.params.speed, runCallbacks = true, internal) {
|
|
1899
|
+
const swiper = this;
|
|
1900
|
+
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/* eslint no-unused-vars: "off" */
|
|
1904
|
+
function slideToClosest(speed = this.params.speed, runCallbacks = true, internal, threshold = 0.5) {
|
|
1905
|
+
const swiper = this;
|
|
1906
|
+
let index = swiper.activeIndex;
|
|
1907
|
+
const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
|
|
1908
|
+
const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
|
|
1909
|
+
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
|
1910
|
+
if (translate >= swiper.snapGrid[snapIndex]) {
|
|
1911
|
+
// The current translate is on or after the current snap index, so the choice
|
|
1912
|
+
// is between the current index and the one after it.
|
|
1913
|
+
const currentSnap = swiper.snapGrid[snapIndex];
|
|
1914
|
+
const nextSnap = swiper.snapGrid[snapIndex + 1];
|
|
1915
|
+
if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
|
|
1916
|
+
index += swiper.params.slidesPerGroup;
|
|
1917
|
+
}
|
|
1918
|
+
} else {
|
|
1919
|
+
// The current translate is before the current snap index, so the choice
|
|
1920
|
+
// is between the current index and the one before it.
|
|
1921
|
+
const prevSnap = swiper.snapGrid[snapIndex - 1];
|
|
1922
|
+
const currentSnap = swiper.snapGrid[snapIndex];
|
|
1923
|
+
if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
|
|
1924
|
+
index -= swiper.params.slidesPerGroup;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
index = Math.max(index, 0);
|
|
1928
|
+
index = Math.min(index, swiper.slidesGrid.length - 1);
|
|
1929
|
+
return swiper.slideTo(index, speed, runCallbacks, internal);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
function slideToClickedSlide() {
|
|
1933
|
+
const swiper = this;
|
|
1934
|
+
const {
|
|
1935
|
+
params,
|
|
1936
|
+
slidesEl
|
|
1937
|
+
} = swiper;
|
|
1938
|
+
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
|
|
1939
|
+
let slideToIndex = swiper.clickedIndex;
|
|
1940
|
+
let realIndex;
|
|
1941
|
+
const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
|
|
1942
|
+
if (params.loop) {
|
|
1943
|
+
if (swiper.animating) return;
|
|
1944
|
+
realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
|
|
1945
|
+
if (params.centeredSlides) {
|
|
1946
|
+
if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
|
|
1947
|
+
swiper.loopFix();
|
|
1948
|
+
slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
|
|
1949
|
+
nextTick(() => {
|
|
1950
|
+
swiper.slideTo(slideToIndex);
|
|
1951
|
+
});
|
|
1952
|
+
} else {
|
|
1953
|
+
swiper.slideTo(slideToIndex);
|
|
1954
|
+
}
|
|
1955
|
+
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
|
|
1956
|
+
swiper.loopFix();
|
|
1957
|
+
slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
|
|
1958
|
+
nextTick(() => {
|
|
1959
|
+
swiper.slideTo(slideToIndex);
|
|
1960
|
+
});
|
|
1961
|
+
} else {
|
|
1962
|
+
swiper.slideTo(slideToIndex);
|
|
1963
|
+
}
|
|
1964
|
+
} else {
|
|
1965
|
+
swiper.slideTo(slideToIndex);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
const slide = {
|
|
1970
|
+
slideTo,
|
|
1971
|
+
slideToLoop,
|
|
1972
|
+
slideNext,
|
|
1973
|
+
slidePrev,
|
|
1974
|
+
slideReset,
|
|
1975
|
+
slideToClosest,
|
|
1976
|
+
slideToClickedSlide
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
function loopCreate(slideRealIndex) {
|
|
1980
|
+
const swiper = this;
|
|
1981
|
+
const {
|
|
1982
|
+
params,
|
|
1983
|
+
slidesEl
|
|
1984
|
+
} = swiper;
|
|
1985
|
+
if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
|
|
1986
|
+
const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
|
|
1987
|
+
slides.forEach((el, index) => {
|
|
1988
|
+
el.setAttribute('data-swiper-slide-index', index);
|
|
1989
|
+
});
|
|
1990
|
+
swiper.loopFix({
|
|
1991
|
+
slideRealIndex,
|
|
1992
|
+
direction: params.centeredSlides ? undefined : 'next'
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
function loopFix({
|
|
1997
|
+
slideRealIndex,
|
|
1998
|
+
slideTo = true,
|
|
1999
|
+
direction,
|
|
2000
|
+
setTranslate,
|
|
2001
|
+
activeSlideIndex,
|
|
2002
|
+
byController,
|
|
2003
|
+
byMousewheel
|
|
2004
|
+
} = {}) {
|
|
2005
|
+
const swiper = this;
|
|
2006
|
+
if (!swiper.params.loop) return;
|
|
2007
|
+
swiper.emit('beforeLoopFix');
|
|
2008
|
+
const {
|
|
2009
|
+
slides,
|
|
2010
|
+
allowSlidePrev,
|
|
2011
|
+
allowSlideNext,
|
|
2012
|
+
slidesEl,
|
|
2013
|
+
params
|
|
2014
|
+
} = swiper;
|
|
2015
|
+
swiper.allowSlidePrev = true;
|
|
2016
|
+
swiper.allowSlideNext = true;
|
|
2017
|
+
if (swiper.virtual && params.virtual.enabled) {
|
|
2018
|
+
if (slideTo) {
|
|
2019
|
+
if (!params.centeredSlides && swiper.snapIndex === 0) {
|
|
2020
|
+
swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
|
|
2021
|
+
} else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
|
|
2022
|
+
swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
|
|
2023
|
+
} else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
|
|
2024
|
+
swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
swiper.allowSlidePrev = allowSlidePrev;
|
|
2028
|
+
swiper.allowSlideNext = allowSlideNext;
|
|
2029
|
+
swiper.emit('loopFix');
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
2033
|
+
let loopedSlides = params.loopedSlides || slidesPerView;
|
|
2034
|
+
if (loopedSlides % params.slidesPerGroup !== 0) {
|
|
2035
|
+
loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;
|
|
2036
|
+
}
|
|
2037
|
+
swiper.loopedSlides = loopedSlides;
|
|
2038
|
+
const prependSlidesIndexes = [];
|
|
2039
|
+
const appendSlidesIndexes = [];
|
|
2040
|
+
let activeIndex = swiper.activeIndex;
|
|
2041
|
+
if (typeof activeSlideIndex === 'undefined') {
|
|
2042
|
+
activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
|
|
2043
|
+
} else {
|
|
2044
|
+
activeIndex = activeSlideIndex;
|
|
2045
|
+
}
|
|
2046
|
+
const isNext = direction === 'next' || !direction;
|
|
2047
|
+
const isPrev = direction === 'prev' || !direction;
|
|
2048
|
+
let slidesPrepended = 0;
|
|
2049
|
+
let slidesAppended = 0;
|
|
2050
|
+
// prepend last slides before start
|
|
2051
|
+
if (activeSlideIndex < loopedSlides) {
|
|
2052
|
+
slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);
|
|
2053
|
+
for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {
|
|
2054
|
+
const index = i - Math.floor(i / slides.length) * slides.length;
|
|
2055
|
+
prependSlidesIndexes.push(slides.length - index - 1);
|
|
2056
|
+
}
|
|
2057
|
+
} else if (activeSlideIndex /* + slidesPerView */ > swiper.slides.length - loopedSlides * 2) {
|
|
2058
|
+
slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);
|
|
2059
|
+
for (let i = 0; i < slidesAppended; i += 1) {
|
|
2060
|
+
const index = i - Math.floor(i / slides.length) * slides.length;
|
|
2061
|
+
appendSlidesIndexes.push(index);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
if (isPrev) {
|
|
2065
|
+
prependSlidesIndexes.forEach(index => {
|
|
2066
|
+
swiper.slides[index].swiperLoopMoveDOM = true;
|
|
2067
|
+
slidesEl.prepend(swiper.slides[index]);
|
|
2068
|
+
swiper.slides[index].swiperLoopMoveDOM = false;
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
if (isNext) {
|
|
2072
|
+
appendSlidesIndexes.forEach(index => {
|
|
2073
|
+
swiper.slides[index].swiperLoopMoveDOM = true;
|
|
2074
|
+
slidesEl.append(swiper.slides[index]);
|
|
2075
|
+
swiper.slides[index].swiperLoopMoveDOM = false;
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
swiper.recalcSlides();
|
|
2079
|
+
if (params.slidesPerView === 'auto') {
|
|
2080
|
+
swiper.updateSlides();
|
|
2081
|
+
}
|
|
2082
|
+
if (params.watchSlidesProgress) {
|
|
2083
|
+
swiper.updateSlidesOffset();
|
|
2084
|
+
}
|
|
2085
|
+
if (slideTo) {
|
|
2086
|
+
if (prependSlidesIndexes.length > 0 && isPrev) {
|
|
2087
|
+
if (typeof slideRealIndex === 'undefined') {
|
|
2088
|
+
const currentSlideTranslate = swiper.slidesGrid[activeIndex];
|
|
2089
|
+
const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended];
|
|
2090
|
+
const diff = newSlideTranslate - currentSlideTranslate;
|
|
2091
|
+
if (byMousewheel) {
|
|
2092
|
+
swiper.setTranslate(swiper.translate - diff);
|
|
2093
|
+
} else {
|
|
2094
|
+
swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
|
|
2095
|
+
if (setTranslate) {
|
|
2096
|
+
swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
} else {
|
|
2100
|
+
if (setTranslate) {
|
|
2101
|
+
swiper.slideToLoop(slideRealIndex, 0, false, true);
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
} else if (appendSlidesIndexes.length > 0 && isNext) {
|
|
2105
|
+
if (typeof slideRealIndex === 'undefined') {
|
|
2106
|
+
const currentSlideTranslate = swiper.slidesGrid[activeIndex];
|
|
2107
|
+
const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended];
|
|
2108
|
+
const diff = newSlideTranslate - currentSlideTranslate;
|
|
2109
|
+
if (byMousewheel) {
|
|
2110
|
+
swiper.setTranslate(swiper.translate - diff);
|
|
2111
|
+
} else {
|
|
2112
|
+
swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
|
|
2113
|
+
if (setTranslate) {
|
|
2114
|
+
swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
} else {
|
|
2118
|
+
swiper.slideToLoop(slideRealIndex, 0, false, true);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
swiper.allowSlidePrev = allowSlidePrev;
|
|
2123
|
+
swiper.allowSlideNext = allowSlideNext;
|
|
2124
|
+
if (swiper.controller && swiper.controller.control && !byController) {
|
|
2125
|
+
const loopParams = {
|
|
2126
|
+
slideRealIndex,
|
|
2127
|
+
slideTo: false,
|
|
2128
|
+
direction,
|
|
2129
|
+
setTranslate,
|
|
2130
|
+
activeSlideIndex,
|
|
2131
|
+
byController: true
|
|
2132
|
+
};
|
|
2133
|
+
if (Array.isArray(swiper.controller.control)) {
|
|
2134
|
+
swiper.controller.control.forEach(c => {
|
|
2135
|
+
if (!c.destroyed && c.params.loop) c.loopFix(loopParams);
|
|
2136
|
+
});
|
|
2137
|
+
} else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {
|
|
2138
|
+
swiper.controller.control.loopFix(loopParams);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
swiper.emit('loopFix');
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
function loopDestroy() {
|
|
2145
|
+
const swiper = this;
|
|
2146
|
+
const {
|
|
2147
|
+
params,
|
|
2148
|
+
slidesEl
|
|
2149
|
+
} = swiper;
|
|
2150
|
+
if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
|
|
2151
|
+
swiper.recalcSlides();
|
|
2152
|
+
const newSlidesOrder = [];
|
|
2153
|
+
swiper.slides.forEach(slideEl => {
|
|
2154
|
+
const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex;
|
|
2155
|
+
newSlidesOrder[index] = slideEl;
|
|
2156
|
+
});
|
|
2157
|
+
swiper.slides.forEach(slideEl => {
|
|
2158
|
+
slideEl.removeAttribute('data-swiper-slide-index');
|
|
2159
|
+
});
|
|
2160
|
+
newSlidesOrder.forEach(slideEl => {
|
|
2161
|
+
slidesEl.append(slideEl);
|
|
2162
|
+
});
|
|
2163
|
+
swiper.recalcSlides();
|
|
2164
|
+
swiper.slideTo(swiper.realIndex, 0);
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
const loop = {
|
|
2168
|
+
loopCreate,
|
|
2169
|
+
loopFix,
|
|
2170
|
+
loopDestroy
|
|
2171
|
+
};
|
|
2172
|
+
|
|
2173
|
+
function setGrabCursor(moving) {
|
|
2174
|
+
const swiper = this;
|
|
2175
|
+
if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
|
|
2176
|
+
const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
|
|
2177
|
+
if (swiper.isElement) {
|
|
2178
|
+
swiper.__preventObserver__ = true;
|
|
2179
|
+
}
|
|
2180
|
+
el.style.cursor = 'move';
|
|
2181
|
+
el.style.cursor = moving ? 'grabbing' : 'grab';
|
|
2182
|
+
if (swiper.isElement) {
|
|
2183
|
+
requestAnimationFrame(() => {
|
|
2184
|
+
swiper.__preventObserver__ = false;
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
function unsetGrabCursor() {
|
|
2190
|
+
const swiper = this;
|
|
2191
|
+
if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
if (swiper.isElement) {
|
|
2195
|
+
swiper.__preventObserver__ = true;
|
|
2196
|
+
}
|
|
2197
|
+
swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
|
|
2198
|
+
if (swiper.isElement) {
|
|
2199
|
+
requestAnimationFrame(() => {
|
|
2200
|
+
swiper.__preventObserver__ = false;
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
const grabCursor = {
|
|
2206
|
+
setGrabCursor,
|
|
2207
|
+
unsetGrabCursor
|
|
2208
|
+
};
|
|
2209
|
+
|
|
2210
|
+
// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
|
|
2211
|
+
function closestElement(selector, base = this) {
|
|
2212
|
+
function __closestFrom(el) {
|
|
2213
|
+
if (!el || el === getDocument() || el === getWindow()) return null;
|
|
2214
|
+
if (el.assignedSlot) el = el.assignedSlot;
|
|
2215
|
+
const found = el.closest(selector);
|
|
2216
|
+
if (!found && !el.getRootNode) {
|
|
2217
|
+
return null;
|
|
2218
|
+
}
|
|
2219
|
+
return found || __closestFrom(el.getRootNode().host);
|
|
2220
|
+
}
|
|
2221
|
+
return __closestFrom(base);
|
|
2222
|
+
}
|
|
2223
|
+
function onTouchStart(event) {
|
|
2224
|
+
const swiper = this;
|
|
2225
|
+
const document = getDocument();
|
|
2226
|
+
const window = getWindow();
|
|
2227
|
+
const data = swiper.touchEventsData;
|
|
2228
|
+
data.evCache.push(event);
|
|
2229
|
+
const {
|
|
2230
|
+
params,
|
|
2231
|
+
touches,
|
|
2232
|
+
enabled
|
|
2233
|
+
} = swiper;
|
|
2234
|
+
if (!enabled) return;
|
|
2235
|
+
if (!params.simulateTouch && event.pointerType === 'mouse') return;
|
|
2236
|
+
if (swiper.animating && params.preventInteractionOnTransition) {
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
if (!swiper.animating && params.cssMode && params.loop) {
|
|
2240
|
+
swiper.loopFix();
|
|
2241
|
+
}
|
|
2242
|
+
let e = event;
|
|
2243
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
2244
|
+
let targetEl = e.target;
|
|
2245
|
+
if (params.touchEventsTarget === 'wrapper') {
|
|
2246
|
+
if (!swiper.wrapperEl.contains(targetEl)) return;
|
|
2247
|
+
}
|
|
2248
|
+
if ('which' in e && e.which === 3) return;
|
|
2249
|
+
if ('button' in e && e.button > 0) return;
|
|
2250
|
+
if (data.isTouched && data.isMoved) return;
|
|
2251
|
+
|
|
2252
|
+
// change target el for shadow root component
|
|
2253
|
+
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
|
|
2254
|
+
// eslint-disable-next-line
|
|
2255
|
+
const eventPath = event.composedPath ? event.composedPath() : event.path;
|
|
2256
|
+
if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
|
|
2257
|
+
targetEl = eventPath[0];
|
|
2258
|
+
}
|
|
2259
|
+
const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
|
|
2260
|
+
const isTargetShadow = !!(e.target && e.target.shadowRoot);
|
|
2261
|
+
|
|
2262
|
+
// use closestElement for shadow root element to get the actual closest for nested shadow root element
|
|
2263
|
+
if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {
|
|
2264
|
+
swiper.allowClick = true;
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
if (params.swipeHandler) {
|
|
2268
|
+
if (!targetEl.closest(params.swipeHandler)) return;
|
|
2269
|
+
}
|
|
2270
|
+
touches.currentX = e.pageX;
|
|
2271
|
+
touches.currentY = e.pageY;
|
|
2272
|
+
const startX = touches.currentX;
|
|
2273
|
+
const startY = touches.currentY;
|
|
2274
|
+
|
|
2275
|
+
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
|
|
2276
|
+
|
|
2277
|
+
const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
|
|
2278
|
+
const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
|
|
2279
|
+
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
|
2280
|
+
if (edgeSwipeDetection === 'prevent') {
|
|
2281
|
+
event.preventDefault();
|
|
2282
|
+
} else {
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
Object.assign(data, {
|
|
2287
|
+
isTouched: true,
|
|
2288
|
+
isMoved: false,
|
|
2289
|
+
allowTouchCallbacks: true,
|
|
2290
|
+
isScrolling: undefined,
|
|
2291
|
+
startMoving: undefined
|
|
2292
|
+
});
|
|
2293
|
+
touches.startX = startX;
|
|
2294
|
+
touches.startY = startY;
|
|
2295
|
+
data.touchStartTime = now();
|
|
2296
|
+
swiper.allowClick = true;
|
|
2297
|
+
swiper.updateSize();
|
|
2298
|
+
swiper.swipeDirection = undefined;
|
|
2299
|
+
if (params.threshold > 0) data.allowThresholdMove = false;
|
|
2300
|
+
let preventDefault = true;
|
|
2301
|
+
if (targetEl.matches(data.focusableElements)) {
|
|
2302
|
+
preventDefault = false;
|
|
2303
|
+
if (targetEl.nodeName === 'SELECT') {
|
|
2304
|
+
data.isTouched = false;
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl) {
|
|
2308
|
+
document.activeElement.blur();
|
|
2309
|
+
}
|
|
2310
|
+
const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
|
|
2311
|
+
if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {
|
|
2312
|
+
e.preventDefault();
|
|
2313
|
+
}
|
|
2314
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
|
|
2315
|
+
swiper.freeMode.onTouchStart();
|
|
2316
|
+
}
|
|
2317
|
+
swiper.emit('touchStart', e);
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
function onTouchMove(event) {
|
|
2321
|
+
const document = getDocument();
|
|
2322
|
+
const swiper = this;
|
|
2323
|
+
const data = swiper.touchEventsData;
|
|
2324
|
+
const {
|
|
2325
|
+
params,
|
|
2326
|
+
touches,
|
|
2327
|
+
rtlTranslate: rtl,
|
|
2328
|
+
enabled
|
|
2329
|
+
} = swiper;
|
|
2330
|
+
if (!enabled) return;
|
|
2331
|
+
if (!params.simulateTouch && event.pointerType === 'mouse') return;
|
|
2332
|
+
let e = event;
|
|
2333
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
2334
|
+
if (!data.isTouched) {
|
|
2335
|
+
if (data.startMoving && data.isScrolling) {
|
|
2336
|
+
swiper.emit('touchMoveOpposite', e);
|
|
2337
|
+
}
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
|
|
2341
|
+
if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
|
|
2342
|
+
const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
|
|
2343
|
+
const pageX = targetTouch.pageX;
|
|
2344
|
+
const pageY = targetTouch.pageY;
|
|
2345
|
+
if (e.preventedByNestedSwiper) {
|
|
2346
|
+
touches.startX = pageX;
|
|
2347
|
+
touches.startY = pageY;
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
if (!swiper.allowTouchMove) {
|
|
2351
|
+
if (!e.target.matches(data.focusableElements)) {
|
|
2352
|
+
swiper.allowClick = false;
|
|
2353
|
+
}
|
|
2354
|
+
if (data.isTouched) {
|
|
2355
|
+
Object.assign(touches, {
|
|
2356
|
+
startX: pageX,
|
|
2357
|
+
startY: pageY,
|
|
2358
|
+
prevX: swiper.touches.currentX,
|
|
2359
|
+
prevY: swiper.touches.currentY,
|
|
2360
|
+
currentX: pageX,
|
|
2361
|
+
currentY: pageY
|
|
2362
|
+
});
|
|
2363
|
+
data.touchStartTime = now();
|
|
2364
|
+
}
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
if (params.touchReleaseOnEdges && !params.loop) {
|
|
2368
|
+
if (swiper.isVertical()) {
|
|
2369
|
+
// Vertical
|
|
2370
|
+
if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
|
|
2371
|
+
data.isTouched = false;
|
|
2372
|
+
data.isMoved = false;
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
} else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
|
|
2376
|
+
return;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
if (document.activeElement) {
|
|
2380
|
+
if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {
|
|
2381
|
+
data.isMoved = true;
|
|
2382
|
+
swiper.allowClick = false;
|
|
2383
|
+
return;
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
if (data.allowTouchCallbacks) {
|
|
2387
|
+
swiper.emit('touchMove', e);
|
|
2388
|
+
}
|
|
2389
|
+
if (e.targetTouches && e.targetTouches.length > 1) return;
|
|
2390
|
+
touches.currentX = pageX;
|
|
2391
|
+
touches.currentY = pageY;
|
|
2392
|
+
const diffX = touches.currentX - touches.startX;
|
|
2393
|
+
const diffY = touches.currentY - touches.startY;
|
|
2394
|
+
if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
|
|
2395
|
+
if (typeof data.isScrolling === 'undefined') {
|
|
2396
|
+
let touchAngle;
|
|
2397
|
+
if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
|
|
2398
|
+
data.isScrolling = false;
|
|
2399
|
+
} else {
|
|
2400
|
+
// eslint-disable-next-line
|
|
2401
|
+
if (diffX * diffX + diffY * diffY >= 25) {
|
|
2402
|
+
touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
|
|
2403
|
+
data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
if (data.isScrolling) {
|
|
2408
|
+
swiper.emit('touchMoveOpposite', e);
|
|
2409
|
+
}
|
|
2410
|
+
if (typeof data.startMoving === 'undefined') {
|
|
2411
|
+
if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
|
|
2412
|
+
data.startMoving = true;
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {
|
|
2416
|
+
data.isTouched = false;
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
if (!data.startMoving) {
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
swiper.allowClick = false;
|
|
2423
|
+
if (!params.cssMode && e.cancelable) {
|
|
2424
|
+
e.preventDefault();
|
|
2425
|
+
}
|
|
2426
|
+
if (params.touchMoveStopPropagation && !params.nested) {
|
|
2427
|
+
e.stopPropagation();
|
|
2428
|
+
}
|
|
2429
|
+
let diff = swiper.isHorizontal() ? diffX : diffY;
|
|
2430
|
+
let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY;
|
|
2431
|
+
if (params.oneWayMovement) {
|
|
2432
|
+
diff = Math.abs(diff) * (rtl ? 1 : -1);
|
|
2433
|
+
touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1);
|
|
2434
|
+
}
|
|
2435
|
+
touches.diff = diff;
|
|
2436
|
+
diff *= params.touchRatio;
|
|
2437
|
+
if (rtl) {
|
|
2438
|
+
diff = -diff;
|
|
2439
|
+
touchesDiff = -touchesDiff;
|
|
2440
|
+
}
|
|
2441
|
+
const prevTouchesDirection = swiper.touchesDirection;
|
|
2442
|
+
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
|
|
2443
|
+
swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
|
|
2444
|
+
const isLoop = swiper.params.loop && !params.cssMode;
|
|
2445
|
+
if (!data.isMoved) {
|
|
2446
|
+
if (isLoop) {
|
|
2447
|
+
swiper.loopFix({
|
|
2448
|
+
direction: swiper.swipeDirection
|
|
2449
|
+
});
|
|
2450
|
+
}
|
|
2451
|
+
data.startTranslate = swiper.getTranslate();
|
|
2452
|
+
swiper.setTransition(0);
|
|
2453
|
+
if (swiper.animating) {
|
|
2454
|
+
const evt = new window.CustomEvent('transitionend', {
|
|
2455
|
+
bubbles: true,
|
|
2456
|
+
cancelable: true
|
|
2457
|
+
});
|
|
2458
|
+
swiper.wrapperEl.dispatchEvent(evt);
|
|
2459
|
+
}
|
|
2460
|
+
data.allowMomentumBounce = false;
|
|
2461
|
+
// Grab Cursor
|
|
2462
|
+
if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
2463
|
+
swiper.setGrabCursor(true);
|
|
2464
|
+
}
|
|
2465
|
+
swiper.emit('sliderFirstMove', e);
|
|
2466
|
+
}
|
|
2467
|
+
let loopFixed;
|
|
2468
|
+
if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && Math.abs(diff) >= 1) {
|
|
2469
|
+
// need another loop fix
|
|
2470
|
+
swiper.loopFix({
|
|
2471
|
+
direction: swiper.swipeDirection,
|
|
2472
|
+
setTranslate: true
|
|
2473
|
+
});
|
|
2474
|
+
loopFixed = true;
|
|
2475
|
+
}
|
|
2476
|
+
swiper.emit('sliderMove', e);
|
|
2477
|
+
data.isMoved = true;
|
|
2478
|
+
data.currentTranslate = diff + data.startTranslate;
|
|
2479
|
+
let disableParentSwiper = true;
|
|
2480
|
+
let resistanceRatio = params.resistanceRatio;
|
|
2481
|
+
if (params.touchReleaseOnEdges) {
|
|
2482
|
+
resistanceRatio = 0;
|
|
2483
|
+
}
|
|
2484
|
+
if (diff > 0) {
|
|
2485
|
+
if (isLoop && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {
|
|
2486
|
+
swiper.loopFix({
|
|
2487
|
+
direction: 'prev',
|
|
2488
|
+
setTranslate: true,
|
|
2489
|
+
activeSlideIndex: 0
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
if (data.currentTranslate > swiper.minTranslate()) {
|
|
2493
|
+
disableParentSwiper = false;
|
|
2494
|
+
if (params.resistance) {
|
|
2495
|
+
data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
} else if (diff < 0) {
|
|
2499
|
+
if (isLoop && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {
|
|
2500
|
+
swiper.loopFix({
|
|
2501
|
+
direction: 'next',
|
|
2502
|
+
setTranslate: true,
|
|
2503
|
+
activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10)))
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
if (data.currentTranslate < swiper.maxTranslate()) {
|
|
2507
|
+
disableParentSwiper = false;
|
|
2508
|
+
if (params.resistance) {
|
|
2509
|
+
data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
if (disableParentSwiper) {
|
|
2514
|
+
e.preventedByNestedSwiper = true;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
// Directions locks
|
|
2518
|
+
if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
|
|
2519
|
+
data.currentTranslate = data.startTranslate;
|
|
2520
|
+
}
|
|
2521
|
+
if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
|
|
2522
|
+
data.currentTranslate = data.startTranslate;
|
|
2523
|
+
}
|
|
2524
|
+
if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
|
|
2525
|
+
data.currentTranslate = data.startTranslate;
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
// Threshold
|
|
2529
|
+
if (params.threshold > 0) {
|
|
2530
|
+
if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
|
|
2531
|
+
if (!data.allowThresholdMove) {
|
|
2532
|
+
data.allowThresholdMove = true;
|
|
2533
|
+
touches.startX = touches.currentX;
|
|
2534
|
+
touches.startY = touches.currentY;
|
|
2535
|
+
data.currentTranslate = data.startTranslate;
|
|
2536
|
+
touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
|
|
2537
|
+
return;
|
|
2538
|
+
}
|
|
2539
|
+
} else {
|
|
2540
|
+
data.currentTranslate = data.startTranslate;
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
if (!params.followFinger || params.cssMode) return;
|
|
2545
|
+
|
|
2546
|
+
// Update active index in free mode
|
|
2547
|
+
if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
|
|
2548
|
+
swiper.updateActiveIndex();
|
|
2549
|
+
swiper.updateSlidesClasses();
|
|
2550
|
+
}
|
|
2551
|
+
if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) {
|
|
2552
|
+
swiper.freeMode.onTouchMove();
|
|
2553
|
+
}
|
|
2554
|
+
// Update progress
|
|
2555
|
+
swiper.updateProgress(data.currentTranslate);
|
|
2556
|
+
// Update translate
|
|
2557
|
+
swiper.setTranslate(data.currentTranslate);
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
function onTouchEnd(event) {
|
|
2561
|
+
const swiper = this;
|
|
2562
|
+
const data = swiper.touchEventsData;
|
|
2563
|
+
const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
|
|
2564
|
+
if (pointerIndex >= 0) {
|
|
2565
|
+
data.evCache.splice(pointerIndex, 1);
|
|
2566
|
+
}
|
|
2567
|
+
if (['pointercancel', 'pointerout', 'pointerleave'].includes(event.type)) {
|
|
2568
|
+
const proceed = event.type === 'pointercancel' && (swiper.browser.isSafari || swiper.browser.isWebView);
|
|
2569
|
+
if (!proceed) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
const {
|
|
2574
|
+
params,
|
|
2575
|
+
touches,
|
|
2576
|
+
rtlTranslate: rtl,
|
|
2577
|
+
slidesGrid,
|
|
2578
|
+
enabled
|
|
2579
|
+
} = swiper;
|
|
2580
|
+
if (!enabled) return;
|
|
2581
|
+
if (!params.simulateTouch && event.pointerType === 'mouse') return;
|
|
2582
|
+
let e = event;
|
|
2583
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
2584
|
+
if (data.allowTouchCallbacks) {
|
|
2585
|
+
swiper.emit('touchEnd', e);
|
|
2586
|
+
}
|
|
2587
|
+
data.allowTouchCallbacks = false;
|
|
2588
|
+
if (!data.isTouched) {
|
|
2589
|
+
if (data.isMoved && params.grabCursor) {
|
|
2590
|
+
swiper.setGrabCursor(false);
|
|
2591
|
+
}
|
|
2592
|
+
data.isMoved = false;
|
|
2593
|
+
data.startMoving = false;
|
|
2594
|
+
return;
|
|
2595
|
+
}
|
|
2596
|
+
// Return Grab Cursor
|
|
2597
|
+
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
2598
|
+
swiper.setGrabCursor(false);
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
// Time diff
|
|
2602
|
+
const touchEndTime = now();
|
|
2603
|
+
const timeDiff = touchEndTime - data.touchStartTime;
|
|
2604
|
+
|
|
2605
|
+
// Tap, doubleTap, Click
|
|
2606
|
+
if (swiper.allowClick) {
|
|
2607
|
+
const pathTree = e.path || e.composedPath && e.composedPath();
|
|
2608
|
+
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
|
|
2609
|
+
swiper.emit('tap click', e);
|
|
2610
|
+
if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
|
|
2611
|
+
swiper.emit('doubleTap doubleClick', e);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
data.lastClickTime = now();
|
|
2615
|
+
nextTick(() => {
|
|
2616
|
+
if (!swiper.destroyed) swiper.allowClick = true;
|
|
2617
|
+
});
|
|
2618
|
+
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
|
|
2619
|
+
data.isTouched = false;
|
|
2620
|
+
data.isMoved = false;
|
|
2621
|
+
data.startMoving = false;
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2624
|
+
data.isTouched = false;
|
|
2625
|
+
data.isMoved = false;
|
|
2626
|
+
data.startMoving = false;
|
|
2627
|
+
let currentPos;
|
|
2628
|
+
if (params.followFinger) {
|
|
2629
|
+
currentPos = rtl ? swiper.translate : -swiper.translate;
|
|
2630
|
+
} else {
|
|
2631
|
+
currentPos = -data.currentTranslate;
|
|
2632
|
+
}
|
|
2633
|
+
if (params.cssMode) {
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2636
|
+
if (swiper.params.freeMode && params.freeMode.enabled) {
|
|
2637
|
+
swiper.freeMode.onTouchEnd({
|
|
2638
|
+
currentPos
|
|
2639
|
+
});
|
|
2640
|
+
return;
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
// Find current slide
|
|
2644
|
+
let stopIndex = 0;
|
|
2645
|
+
let groupSize = swiper.slidesSizesGrid[0];
|
|
2646
|
+
for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
|
|
2647
|
+
const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
|
2648
|
+
if (typeof slidesGrid[i + increment] !== 'undefined') {
|
|
2649
|
+
if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
|
|
2650
|
+
stopIndex = i;
|
|
2651
|
+
groupSize = slidesGrid[i + increment] - slidesGrid[i];
|
|
2652
|
+
}
|
|
2653
|
+
} else if (currentPos >= slidesGrid[i]) {
|
|
2654
|
+
stopIndex = i;
|
|
2655
|
+
groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
let rewindFirstIndex = null;
|
|
2659
|
+
let rewindLastIndex = null;
|
|
2660
|
+
if (params.rewind) {
|
|
2661
|
+
if (swiper.isBeginning) {
|
|
2662
|
+
rewindLastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
|
|
2663
|
+
} else if (swiper.isEnd) {
|
|
2664
|
+
rewindFirstIndex = 0;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
// Find current slide size
|
|
2668
|
+
const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
|
|
2669
|
+
const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
|
2670
|
+
if (timeDiff > params.longSwipesMs) {
|
|
2671
|
+
// Long touches
|
|
2672
|
+
if (!params.longSwipes) {
|
|
2673
|
+
swiper.slideTo(swiper.activeIndex);
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
if (swiper.swipeDirection === 'next') {
|
|
2677
|
+
if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
|
|
2678
|
+
}
|
|
2679
|
+
if (swiper.swipeDirection === 'prev') {
|
|
2680
|
+
if (ratio > 1 - params.longSwipesRatio) {
|
|
2681
|
+
swiper.slideTo(stopIndex + increment);
|
|
2682
|
+
} else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
|
|
2683
|
+
swiper.slideTo(rewindLastIndex);
|
|
2684
|
+
} else {
|
|
2685
|
+
swiper.slideTo(stopIndex);
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
} else {
|
|
2689
|
+
// Short swipes
|
|
2690
|
+
if (!params.shortSwipes) {
|
|
2691
|
+
swiper.slideTo(swiper.activeIndex);
|
|
2692
|
+
return;
|
|
2693
|
+
}
|
|
2694
|
+
const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
|
|
2695
|
+
if (!isNavButtonTarget) {
|
|
2696
|
+
if (swiper.swipeDirection === 'next') {
|
|
2697
|
+
swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
|
|
2698
|
+
}
|
|
2699
|
+
if (swiper.swipeDirection === 'prev') {
|
|
2700
|
+
swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
|
|
2701
|
+
}
|
|
2702
|
+
} else if (e.target === swiper.navigation.nextEl) {
|
|
2703
|
+
swiper.slideTo(stopIndex + increment);
|
|
2704
|
+
} else {
|
|
2705
|
+
swiper.slideTo(stopIndex);
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
function onResize() {
|
|
2711
|
+
const swiper = this;
|
|
2712
|
+
const {
|
|
2713
|
+
params,
|
|
2714
|
+
el
|
|
2715
|
+
} = swiper;
|
|
2716
|
+
if (el && el.offsetWidth === 0) return;
|
|
2717
|
+
|
|
2718
|
+
// Breakpoints
|
|
2719
|
+
if (params.breakpoints) {
|
|
2720
|
+
swiper.setBreakpoint();
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
// Save locks
|
|
2724
|
+
const {
|
|
2725
|
+
allowSlideNext,
|
|
2726
|
+
allowSlidePrev,
|
|
2727
|
+
snapGrid
|
|
2728
|
+
} = swiper;
|
|
2729
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
2730
|
+
|
|
2731
|
+
// Disable locks on resize
|
|
2732
|
+
swiper.allowSlideNext = true;
|
|
2733
|
+
swiper.allowSlidePrev = true;
|
|
2734
|
+
swiper.updateSize();
|
|
2735
|
+
swiper.updateSlides();
|
|
2736
|
+
swiper.updateSlidesClasses();
|
|
2737
|
+
const isVirtualLoop = isVirtual && params.loop;
|
|
2738
|
+
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
|
|
2739
|
+
swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
|
2740
|
+
} else {
|
|
2741
|
+
if (swiper.params.loop && !isVirtual) {
|
|
2742
|
+
swiper.slideToLoop(swiper.realIndex, 0, false, true);
|
|
2743
|
+
} else {
|
|
2744
|
+
swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
|
|
2748
|
+
clearTimeout(swiper.autoplay.resizeTimeout);
|
|
2749
|
+
swiper.autoplay.resizeTimeout = setTimeout(() => {
|
|
2750
|
+
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
|
|
2751
|
+
swiper.autoplay.resume();
|
|
2752
|
+
}
|
|
2753
|
+
}, 500);
|
|
2754
|
+
}
|
|
2755
|
+
// Return locks after resize
|
|
2756
|
+
swiper.allowSlidePrev = allowSlidePrev;
|
|
2757
|
+
swiper.allowSlideNext = allowSlideNext;
|
|
2758
|
+
if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
|
2759
|
+
swiper.checkOverflow();
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
function onClick(e) {
|
|
2764
|
+
const swiper = this;
|
|
2765
|
+
if (!swiper.enabled) return;
|
|
2766
|
+
if (!swiper.allowClick) {
|
|
2767
|
+
if (swiper.params.preventClicks) e.preventDefault();
|
|
2768
|
+
if (swiper.params.preventClicksPropagation && swiper.animating) {
|
|
2769
|
+
e.stopPropagation();
|
|
2770
|
+
e.stopImmediatePropagation();
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
function onScroll() {
|
|
2776
|
+
const swiper = this;
|
|
2777
|
+
const {
|
|
2778
|
+
wrapperEl,
|
|
2779
|
+
rtlTranslate,
|
|
2780
|
+
enabled
|
|
2781
|
+
} = swiper;
|
|
2782
|
+
if (!enabled) return;
|
|
2783
|
+
swiper.previousTranslate = swiper.translate;
|
|
2784
|
+
if (swiper.isHorizontal()) {
|
|
2785
|
+
swiper.translate = -wrapperEl.scrollLeft;
|
|
2786
|
+
} else {
|
|
2787
|
+
swiper.translate = -wrapperEl.scrollTop;
|
|
2788
|
+
}
|
|
2789
|
+
// eslint-disable-next-line
|
|
2790
|
+
if (swiper.translate === 0) swiper.translate = 0;
|
|
2791
|
+
swiper.updateActiveIndex();
|
|
2792
|
+
swiper.updateSlidesClasses();
|
|
2793
|
+
let newProgress;
|
|
2794
|
+
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
|
2795
|
+
if (translatesDiff === 0) {
|
|
2796
|
+
newProgress = 0;
|
|
2797
|
+
} else {
|
|
2798
|
+
newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
|
|
2799
|
+
}
|
|
2800
|
+
if (newProgress !== swiper.progress) {
|
|
2801
|
+
swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
|
|
2802
|
+
}
|
|
2803
|
+
swiper.emit('setTranslate', swiper.translate, false);
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
function onLoad(e) {
|
|
2807
|
+
const swiper = this;
|
|
2808
|
+
processLazyPreloader(swiper, e.target);
|
|
2809
|
+
if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) {
|
|
2810
|
+
return;
|
|
2811
|
+
}
|
|
2812
|
+
swiper.update();
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
let dummyEventAttached = false;
|
|
2816
|
+
function dummyEventListener() {}
|
|
2817
|
+
const events = (swiper, method) => {
|
|
2818
|
+
const document = getDocument();
|
|
2819
|
+
const {
|
|
2820
|
+
params,
|
|
2821
|
+
el,
|
|
2822
|
+
wrapperEl,
|
|
2823
|
+
device
|
|
2824
|
+
} = swiper;
|
|
2825
|
+
const capture = !!params.nested;
|
|
2826
|
+
const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
|
|
2827
|
+
const swiperMethod = method;
|
|
2828
|
+
|
|
2829
|
+
// Touch Events
|
|
2830
|
+
el[domMethod]('pointerdown', swiper.onTouchStart, {
|
|
2831
|
+
passive: false
|
|
2832
|
+
});
|
|
2833
|
+
document[domMethod]('pointermove', swiper.onTouchMove, {
|
|
2834
|
+
passive: false,
|
|
2835
|
+
capture
|
|
2836
|
+
});
|
|
2837
|
+
document[domMethod]('pointerup', swiper.onTouchEnd, {
|
|
2838
|
+
passive: true
|
|
2839
|
+
});
|
|
2840
|
+
document[domMethod]('pointercancel', swiper.onTouchEnd, {
|
|
2841
|
+
passive: true
|
|
2842
|
+
});
|
|
2843
|
+
document[domMethod]('pointerout', swiper.onTouchEnd, {
|
|
2844
|
+
passive: true
|
|
2845
|
+
});
|
|
2846
|
+
document[domMethod]('pointerleave', swiper.onTouchEnd, {
|
|
2847
|
+
passive: true
|
|
2848
|
+
});
|
|
2849
|
+
|
|
2850
|
+
// Prevent Links Clicks
|
|
2851
|
+
if (params.preventClicks || params.preventClicksPropagation) {
|
|
2852
|
+
el[domMethod]('click', swiper.onClick, true);
|
|
2853
|
+
}
|
|
2854
|
+
if (params.cssMode) {
|
|
2855
|
+
wrapperEl[domMethod]('scroll', swiper.onScroll);
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
// Resize handler
|
|
2859
|
+
if (params.updateOnWindowResize) {
|
|
2860
|
+
swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
|
|
2861
|
+
} else {
|
|
2862
|
+
swiper[swiperMethod]('observerUpdate', onResize, true);
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
// Images loader
|
|
2866
|
+
el[domMethod]('load', swiper.onLoad, {
|
|
2867
|
+
capture: true
|
|
2868
|
+
});
|
|
2869
|
+
};
|
|
2870
|
+
function attachEvents() {
|
|
2871
|
+
const swiper = this;
|
|
2872
|
+
const document = getDocument();
|
|
2873
|
+
const {
|
|
2874
|
+
params
|
|
2875
|
+
} = swiper;
|
|
2876
|
+
swiper.onTouchStart = onTouchStart.bind(swiper);
|
|
2877
|
+
swiper.onTouchMove = onTouchMove.bind(swiper);
|
|
2878
|
+
swiper.onTouchEnd = onTouchEnd.bind(swiper);
|
|
2879
|
+
if (params.cssMode) {
|
|
2880
|
+
swiper.onScroll = onScroll.bind(swiper);
|
|
2881
|
+
}
|
|
2882
|
+
swiper.onClick = onClick.bind(swiper);
|
|
2883
|
+
swiper.onLoad = onLoad.bind(swiper);
|
|
2884
|
+
if (!dummyEventAttached) {
|
|
2885
|
+
document.addEventListener('touchstart', dummyEventListener);
|
|
2886
|
+
dummyEventAttached = true;
|
|
2887
|
+
}
|
|
2888
|
+
events(swiper, 'on');
|
|
2889
|
+
}
|
|
2890
|
+
function detachEvents() {
|
|
2891
|
+
const swiper = this;
|
|
2892
|
+
events(swiper, 'off');
|
|
2893
|
+
}
|
|
2894
|
+
const events$1 = {
|
|
2895
|
+
attachEvents,
|
|
2896
|
+
detachEvents
|
|
2897
|
+
};
|
|
2898
|
+
|
|
2899
|
+
const isGridEnabled = (swiper, params) => {
|
|
2900
|
+
return swiper.grid && params.grid && params.grid.rows > 1;
|
|
2901
|
+
};
|
|
2902
|
+
function setBreakpoint() {
|
|
2903
|
+
const swiper = this;
|
|
2904
|
+
const {
|
|
2905
|
+
realIndex,
|
|
2906
|
+
initialized,
|
|
2907
|
+
params,
|
|
2908
|
+
el
|
|
2909
|
+
} = swiper;
|
|
2910
|
+
const breakpoints = params.breakpoints;
|
|
2911
|
+
if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return;
|
|
2912
|
+
|
|
2913
|
+
// Get breakpoint for window width and update parameters
|
|
2914
|
+
const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
|
|
2915
|
+
if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
|
|
2916
|
+
const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
|
|
2917
|
+
const breakpointParams = breakpointOnlyParams || swiper.originalParams;
|
|
2918
|
+
const wasMultiRow = isGridEnabled(swiper, params);
|
|
2919
|
+
const isMultiRow = isGridEnabled(swiper, breakpointParams);
|
|
2920
|
+
const wasEnabled = params.enabled;
|
|
2921
|
+
if (wasMultiRow && !isMultiRow) {
|
|
2922
|
+
el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
|
|
2923
|
+
swiper.emitContainerClasses();
|
|
2924
|
+
} else if (!wasMultiRow && isMultiRow) {
|
|
2925
|
+
el.classList.add(`${params.containerModifierClass}grid`);
|
|
2926
|
+
if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
|
|
2927
|
+
el.classList.add(`${params.containerModifierClass}grid-column`);
|
|
2928
|
+
}
|
|
2929
|
+
swiper.emitContainerClasses();
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
// Toggle navigation, pagination, scrollbar
|
|
2933
|
+
['navigation', 'pagination', 'scrollbar'].forEach(prop => {
|
|
2934
|
+
const wasModuleEnabled = params[prop] && params[prop].enabled;
|
|
2935
|
+
const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
|
|
2936
|
+
if (wasModuleEnabled && !isModuleEnabled) {
|
|
2937
|
+
swiper[prop].disable();
|
|
2938
|
+
}
|
|
2939
|
+
if (!wasModuleEnabled && isModuleEnabled) {
|
|
2940
|
+
swiper[prop].enable();
|
|
2941
|
+
}
|
|
2942
|
+
});
|
|
2943
|
+
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
|
2944
|
+
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
|
2945
|
+
if (directionChanged && initialized) {
|
|
2946
|
+
swiper.changeDirection();
|
|
2947
|
+
}
|
|
2948
|
+
extend(swiper.params, breakpointParams);
|
|
2949
|
+
const isEnabled = swiper.params.enabled;
|
|
2950
|
+
Object.assign(swiper, {
|
|
2951
|
+
allowTouchMove: swiper.params.allowTouchMove,
|
|
2952
|
+
allowSlideNext: swiper.params.allowSlideNext,
|
|
2953
|
+
allowSlidePrev: swiper.params.allowSlidePrev
|
|
2954
|
+
});
|
|
2955
|
+
if (wasEnabled && !isEnabled) {
|
|
2956
|
+
swiper.disable();
|
|
2957
|
+
} else if (!wasEnabled && isEnabled) {
|
|
2958
|
+
swiper.enable();
|
|
2959
|
+
}
|
|
2960
|
+
swiper.currentBreakpoint = breakpoint;
|
|
2961
|
+
swiper.emit('_beforeBreakpoint', breakpointParams);
|
|
2962
|
+
if (needsReLoop && initialized) {
|
|
2963
|
+
swiper.loopDestroy();
|
|
2964
|
+
swiper.loopCreate(realIndex);
|
|
2965
|
+
swiper.updateSlides();
|
|
2966
|
+
}
|
|
2967
|
+
swiper.emit('breakpoint', breakpointParams);
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
function getBreakpoint(breakpoints, base = 'window', containerEl) {
|
|
2971
|
+
if (!breakpoints || base === 'container' && !containerEl) return undefined;
|
|
2972
|
+
let breakpoint = false;
|
|
2973
|
+
const window = getWindow();
|
|
2974
|
+
const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
|
|
2975
|
+
const points = Object.keys(breakpoints).map(point => {
|
|
2976
|
+
if (typeof point === 'string' && point.indexOf('@') === 0) {
|
|
2977
|
+
const minRatio = parseFloat(point.substr(1));
|
|
2978
|
+
const value = currentHeight * minRatio;
|
|
2979
|
+
return {
|
|
2980
|
+
value,
|
|
2981
|
+
point
|
|
2982
|
+
};
|
|
2983
|
+
}
|
|
2984
|
+
return {
|
|
2985
|
+
value: point,
|
|
2986
|
+
point
|
|
2987
|
+
};
|
|
2988
|
+
});
|
|
2989
|
+
points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
|
|
2990
|
+
for (let i = 0; i < points.length; i += 1) {
|
|
2991
|
+
const {
|
|
2992
|
+
point,
|
|
2993
|
+
value
|
|
2994
|
+
} = points[i];
|
|
2995
|
+
if (base === 'window') {
|
|
2996
|
+
if (window.matchMedia(`(min-width: ${value}px)`).matches) {
|
|
2997
|
+
breakpoint = point;
|
|
2998
|
+
}
|
|
2999
|
+
} else if (value <= containerEl.clientWidth) {
|
|
3000
|
+
breakpoint = point;
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
return breakpoint || 'max';
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
const breakpoints = {
|
|
3007
|
+
setBreakpoint,
|
|
3008
|
+
getBreakpoint
|
|
3009
|
+
};
|
|
3010
|
+
|
|
3011
|
+
function prepareClasses(entries, prefix) {
|
|
3012
|
+
const resultClasses = [];
|
|
3013
|
+
entries.forEach(item => {
|
|
3014
|
+
if (typeof item === 'object') {
|
|
3015
|
+
Object.keys(item).forEach(classNames => {
|
|
3016
|
+
if (item[classNames]) {
|
|
3017
|
+
resultClasses.push(prefix + classNames);
|
|
3018
|
+
}
|
|
3019
|
+
});
|
|
3020
|
+
} else if (typeof item === 'string') {
|
|
3021
|
+
resultClasses.push(prefix + item);
|
|
3022
|
+
}
|
|
3023
|
+
});
|
|
3024
|
+
return resultClasses;
|
|
3025
|
+
}
|
|
3026
|
+
function addClasses() {
|
|
3027
|
+
const swiper = this;
|
|
3028
|
+
const {
|
|
3029
|
+
classNames,
|
|
3030
|
+
params,
|
|
3031
|
+
rtl,
|
|
3032
|
+
el,
|
|
3033
|
+
device
|
|
3034
|
+
} = swiper;
|
|
3035
|
+
// prettier-ignore
|
|
3036
|
+
const suffixes = prepareClasses(['initialized', params.direction, {
|
|
3037
|
+
'free-mode': swiper.params.freeMode && params.freeMode.enabled
|
|
3038
|
+
}, {
|
|
3039
|
+
'autoheight': params.autoHeight
|
|
3040
|
+
}, {
|
|
3041
|
+
'rtl': rtl
|
|
3042
|
+
}, {
|
|
3043
|
+
'grid': params.grid && params.grid.rows > 1
|
|
3044
|
+
}, {
|
|
3045
|
+
'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
|
|
3046
|
+
}, {
|
|
3047
|
+
'android': device.android
|
|
3048
|
+
}, {
|
|
3049
|
+
'ios': device.ios
|
|
3050
|
+
}, {
|
|
3051
|
+
'css-mode': params.cssMode
|
|
3052
|
+
}, {
|
|
3053
|
+
'centered': params.cssMode && params.centeredSlides
|
|
3054
|
+
}, {
|
|
3055
|
+
'watch-progress': params.watchSlidesProgress
|
|
3056
|
+
}], params.containerModifierClass);
|
|
3057
|
+
classNames.push(...suffixes);
|
|
3058
|
+
el.classList.add(...classNames);
|
|
3059
|
+
swiper.emitContainerClasses();
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
function removeClasses() {
|
|
3063
|
+
const swiper = this;
|
|
3064
|
+
const {
|
|
3065
|
+
el,
|
|
3066
|
+
classNames
|
|
3067
|
+
} = swiper;
|
|
3068
|
+
el.classList.remove(...classNames);
|
|
3069
|
+
swiper.emitContainerClasses();
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
const classes = {
|
|
3073
|
+
addClasses,
|
|
3074
|
+
removeClasses
|
|
3075
|
+
};
|
|
3076
|
+
|
|
3077
|
+
function checkOverflow() {
|
|
3078
|
+
const swiper = this;
|
|
3079
|
+
const {
|
|
3080
|
+
isLocked: wasLocked,
|
|
3081
|
+
params
|
|
3082
|
+
} = swiper;
|
|
3083
|
+
const {
|
|
3084
|
+
slidesOffsetBefore
|
|
3085
|
+
} = params;
|
|
3086
|
+
if (slidesOffsetBefore) {
|
|
3087
|
+
const lastSlideIndex = swiper.slides.length - 1;
|
|
3088
|
+
const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
|
|
3089
|
+
swiper.isLocked = swiper.size > lastSlideRightEdge;
|
|
3090
|
+
} else {
|
|
3091
|
+
swiper.isLocked = swiper.snapGrid.length === 1;
|
|
3092
|
+
}
|
|
3093
|
+
if (params.allowSlideNext === true) {
|
|
3094
|
+
swiper.allowSlideNext = !swiper.isLocked;
|
|
3095
|
+
}
|
|
3096
|
+
if (params.allowSlidePrev === true) {
|
|
3097
|
+
swiper.allowSlidePrev = !swiper.isLocked;
|
|
3098
|
+
}
|
|
3099
|
+
if (wasLocked && wasLocked !== swiper.isLocked) {
|
|
3100
|
+
swiper.isEnd = false;
|
|
3101
|
+
}
|
|
3102
|
+
if (wasLocked !== swiper.isLocked) {
|
|
3103
|
+
swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
const checkOverflow$1 = {
|
|
3107
|
+
checkOverflow
|
|
3108
|
+
};
|
|
3109
|
+
|
|
3110
|
+
const defaults = {
|
|
3111
|
+
init: true,
|
|
3112
|
+
direction: 'horizontal',
|
|
3113
|
+
oneWayMovement: false,
|
|
3114
|
+
touchEventsTarget: 'wrapper',
|
|
3115
|
+
initialSlide: 0,
|
|
3116
|
+
speed: 300,
|
|
3117
|
+
cssMode: false,
|
|
3118
|
+
updateOnWindowResize: true,
|
|
3119
|
+
resizeObserver: true,
|
|
3120
|
+
nested: false,
|
|
3121
|
+
createElements: false,
|
|
3122
|
+
enabled: true,
|
|
3123
|
+
focusableElements: 'input, select, option, textarea, button, video, label',
|
|
3124
|
+
// Overrides
|
|
3125
|
+
width: null,
|
|
3126
|
+
height: null,
|
|
3127
|
+
//
|
|
3128
|
+
preventInteractionOnTransition: false,
|
|
3129
|
+
// ssr
|
|
3130
|
+
userAgent: null,
|
|
3131
|
+
url: null,
|
|
3132
|
+
// To support iOS's swipe-to-go-back gesture (when being used in-app).
|
|
3133
|
+
edgeSwipeDetection: false,
|
|
3134
|
+
edgeSwipeThreshold: 20,
|
|
3135
|
+
// Autoheight
|
|
3136
|
+
autoHeight: false,
|
|
3137
|
+
// Set wrapper width
|
|
3138
|
+
setWrapperSize: false,
|
|
3139
|
+
// Virtual Translate
|
|
3140
|
+
virtualTranslate: false,
|
|
3141
|
+
// Effects
|
|
3142
|
+
effect: 'slide',
|
|
3143
|
+
// 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
|
|
3144
|
+
|
|
3145
|
+
// Breakpoints
|
|
3146
|
+
breakpoints: undefined,
|
|
3147
|
+
breakpointsBase: 'window',
|
|
3148
|
+
// Slides grid
|
|
3149
|
+
spaceBetween: 0,
|
|
3150
|
+
slidesPerView: 1,
|
|
3151
|
+
slidesPerGroup: 1,
|
|
3152
|
+
slidesPerGroupSkip: 0,
|
|
3153
|
+
slidesPerGroupAuto: false,
|
|
3154
|
+
centeredSlides: false,
|
|
3155
|
+
centeredSlidesBounds: false,
|
|
3156
|
+
slidesOffsetBefore: 0,
|
|
3157
|
+
// in px
|
|
3158
|
+
slidesOffsetAfter: 0,
|
|
3159
|
+
// in px
|
|
3160
|
+
normalizeSlideIndex: true,
|
|
3161
|
+
centerInsufficientSlides: false,
|
|
3162
|
+
// Disable swiper and hide navigation when container not overflow
|
|
3163
|
+
watchOverflow: true,
|
|
3164
|
+
// Round length
|
|
3165
|
+
roundLengths: false,
|
|
3166
|
+
// Touches
|
|
3167
|
+
touchRatio: 1,
|
|
3168
|
+
touchAngle: 45,
|
|
3169
|
+
simulateTouch: true,
|
|
3170
|
+
shortSwipes: true,
|
|
3171
|
+
longSwipes: true,
|
|
3172
|
+
longSwipesRatio: 0.5,
|
|
3173
|
+
longSwipesMs: 300,
|
|
3174
|
+
followFinger: true,
|
|
3175
|
+
allowTouchMove: true,
|
|
3176
|
+
threshold: 5,
|
|
3177
|
+
touchMoveStopPropagation: false,
|
|
3178
|
+
touchStartPreventDefault: true,
|
|
3179
|
+
touchStartForcePreventDefault: false,
|
|
3180
|
+
touchReleaseOnEdges: false,
|
|
3181
|
+
// Unique Navigation Elements
|
|
3182
|
+
uniqueNavElements: true,
|
|
3183
|
+
// Resistance
|
|
3184
|
+
resistance: true,
|
|
3185
|
+
resistanceRatio: 0.85,
|
|
3186
|
+
// Progress
|
|
3187
|
+
watchSlidesProgress: false,
|
|
3188
|
+
// Cursor
|
|
3189
|
+
grabCursor: false,
|
|
3190
|
+
// Clicks
|
|
3191
|
+
preventClicks: true,
|
|
3192
|
+
preventClicksPropagation: true,
|
|
3193
|
+
slideToClickedSlide: false,
|
|
3194
|
+
// loop
|
|
3195
|
+
loop: false,
|
|
3196
|
+
loopedSlides: null,
|
|
3197
|
+
loopPreventsSliding: true,
|
|
3198
|
+
// rewind
|
|
3199
|
+
rewind: false,
|
|
3200
|
+
// Swiping/no swiping
|
|
3201
|
+
allowSlidePrev: true,
|
|
3202
|
+
allowSlideNext: true,
|
|
3203
|
+
swipeHandler: null,
|
|
3204
|
+
// '.swipe-handler',
|
|
3205
|
+
noSwiping: true,
|
|
3206
|
+
noSwipingClass: 'swiper-no-swiping',
|
|
3207
|
+
noSwipingSelector: null,
|
|
3208
|
+
// Passive Listeners
|
|
3209
|
+
passiveListeners: true,
|
|
3210
|
+
maxBackfaceHiddenSlides: 10,
|
|
3211
|
+
// NS
|
|
3212
|
+
containerModifierClass: 'swiper-',
|
|
3213
|
+
// NEW
|
|
3214
|
+
slideClass: 'swiper-slide',
|
|
3215
|
+
slideActiveClass: 'swiper-slide-active',
|
|
3216
|
+
slideVisibleClass: 'swiper-slide-visible',
|
|
3217
|
+
slideNextClass: 'swiper-slide-next',
|
|
3218
|
+
slidePrevClass: 'swiper-slide-prev',
|
|
3219
|
+
wrapperClass: 'swiper-wrapper',
|
|
3220
|
+
lazyPreloaderClass: 'swiper-lazy-preloader',
|
|
3221
|
+
lazyPreloadPrevNext: 0,
|
|
3222
|
+
// Callbacks
|
|
3223
|
+
runCallbacksOnInit: true,
|
|
3224
|
+
// Internals
|
|
3225
|
+
_emitClasses: false
|
|
3226
|
+
};
|
|
3227
|
+
|
|
3228
|
+
function moduleExtendParams(params, allModulesParams) {
|
|
3229
|
+
return function extendParams(obj = {}) {
|
|
3230
|
+
const moduleParamName = Object.keys(obj)[0];
|
|
3231
|
+
const moduleParams = obj[moduleParamName];
|
|
3232
|
+
if (typeof moduleParams !== 'object' || moduleParams === null) {
|
|
3233
|
+
extend(allModulesParams, obj);
|
|
3234
|
+
return;
|
|
3235
|
+
}
|
|
3236
|
+
if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
|
|
3237
|
+
params[moduleParamName] = {
|
|
3238
|
+
auto: true
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
if (!(moduleParamName in params && 'enabled' in moduleParams)) {
|
|
3242
|
+
extend(allModulesParams, obj);
|
|
3243
|
+
return;
|
|
3244
|
+
}
|
|
3245
|
+
if (params[moduleParamName] === true) {
|
|
3246
|
+
params[moduleParamName] = {
|
|
3247
|
+
enabled: true
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
|
|
3251
|
+
params[moduleParamName].enabled = true;
|
|
3252
|
+
}
|
|
3253
|
+
if (!params[moduleParamName]) params[moduleParamName] = {
|
|
3254
|
+
enabled: false
|
|
3255
|
+
};
|
|
3256
|
+
extend(allModulesParams, obj);
|
|
3257
|
+
};
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
/* eslint no-param-reassign: "off" */
|
|
3261
|
+
const prototypes = {
|
|
3262
|
+
eventsEmitter,
|
|
3263
|
+
update,
|
|
3264
|
+
translate,
|
|
3265
|
+
transition,
|
|
3266
|
+
slide,
|
|
3267
|
+
loop,
|
|
3268
|
+
grabCursor,
|
|
3269
|
+
events: events$1,
|
|
3270
|
+
breakpoints,
|
|
3271
|
+
checkOverflow: checkOverflow$1,
|
|
3272
|
+
classes
|
|
3273
|
+
};
|
|
3274
|
+
const extendedDefaults = {};
|
|
3275
|
+
class Swiper {
|
|
3276
|
+
constructor(...args) {
|
|
3277
|
+
let el;
|
|
3278
|
+
let params;
|
|
3279
|
+
if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
|
|
3280
|
+
params = args[0];
|
|
3281
|
+
} else {
|
|
3282
|
+
[el, params] = args;
|
|
3283
|
+
}
|
|
3284
|
+
if (!params) params = {};
|
|
3285
|
+
params = extend({}, params);
|
|
3286
|
+
if (el && !params.el) params.el = el;
|
|
3287
|
+
const document = getDocument();
|
|
3288
|
+
if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) {
|
|
3289
|
+
const swipers = [];
|
|
3290
|
+
document.querySelectorAll(params.el).forEach(containerEl => {
|
|
3291
|
+
const newParams = extend({}, params, {
|
|
3292
|
+
el: containerEl
|
|
3293
|
+
});
|
|
3294
|
+
swipers.push(new Swiper(newParams));
|
|
3295
|
+
});
|
|
3296
|
+
// eslint-disable-next-line no-constructor-return
|
|
3297
|
+
return swipers;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
// Swiper Instance
|
|
3301
|
+
const swiper = this;
|
|
3302
|
+
swiper.__swiper__ = true;
|
|
3303
|
+
swiper.support = getSupport();
|
|
3304
|
+
swiper.device = getDevice({
|
|
3305
|
+
userAgent: params.userAgent
|
|
3306
|
+
});
|
|
3307
|
+
swiper.browser = getBrowser();
|
|
3308
|
+
swiper.eventsListeners = {};
|
|
3309
|
+
swiper.eventsAnyListeners = [];
|
|
3310
|
+
swiper.modules = [...swiper.__modules__];
|
|
3311
|
+
if (params.modules && Array.isArray(params.modules)) {
|
|
3312
|
+
swiper.modules.push(...params.modules);
|
|
3313
|
+
}
|
|
3314
|
+
const allModulesParams = {};
|
|
3315
|
+
swiper.modules.forEach(mod => {
|
|
3316
|
+
mod({
|
|
3317
|
+
params,
|
|
3318
|
+
swiper,
|
|
3319
|
+
extendParams: moduleExtendParams(params, allModulesParams),
|
|
3320
|
+
on: swiper.on.bind(swiper),
|
|
3321
|
+
once: swiper.once.bind(swiper),
|
|
3322
|
+
off: swiper.off.bind(swiper),
|
|
3323
|
+
emit: swiper.emit.bind(swiper)
|
|
3324
|
+
});
|
|
3325
|
+
});
|
|
3326
|
+
|
|
3327
|
+
// Extend defaults with modules params
|
|
3328
|
+
const swiperParams = extend({}, defaults, allModulesParams);
|
|
3329
|
+
|
|
3330
|
+
// Extend defaults with passed params
|
|
3331
|
+
swiper.params = extend({}, swiperParams, extendedDefaults, params);
|
|
3332
|
+
swiper.originalParams = extend({}, swiper.params);
|
|
3333
|
+
swiper.passedParams = extend({}, params);
|
|
3334
|
+
|
|
3335
|
+
// add event listeners
|
|
3336
|
+
if (swiper.params && swiper.params.on) {
|
|
3337
|
+
Object.keys(swiper.params.on).forEach(eventName => {
|
|
3338
|
+
swiper.on(eventName, swiper.params.on[eventName]);
|
|
3339
|
+
});
|
|
3340
|
+
}
|
|
3341
|
+
if (swiper.params && swiper.params.onAny) {
|
|
3342
|
+
swiper.onAny(swiper.params.onAny);
|
|
3343
|
+
}
|
|
3344
|
+
|
|
3345
|
+
// Extend Swiper
|
|
3346
|
+
Object.assign(swiper, {
|
|
3347
|
+
enabled: swiper.params.enabled,
|
|
3348
|
+
el,
|
|
3349
|
+
// Classes
|
|
3350
|
+
classNames: [],
|
|
3351
|
+
// Slides
|
|
3352
|
+
slides: [],
|
|
3353
|
+
slidesGrid: [],
|
|
3354
|
+
snapGrid: [],
|
|
3355
|
+
slidesSizesGrid: [],
|
|
3356
|
+
// isDirection
|
|
3357
|
+
isHorizontal() {
|
|
3358
|
+
return swiper.params.direction === 'horizontal';
|
|
3359
|
+
},
|
|
3360
|
+
isVertical() {
|
|
3361
|
+
return swiper.params.direction === 'vertical';
|
|
3362
|
+
},
|
|
3363
|
+
// Indexes
|
|
3364
|
+
activeIndex: 0,
|
|
3365
|
+
realIndex: 0,
|
|
3366
|
+
//
|
|
3367
|
+
isBeginning: true,
|
|
3368
|
+
isEnd: false,
|
|
3369
|
+
// Props
|
|
3370
|
+
translate: 0,
|
|
3371
|
+
previousTranslate: 0,
|
|
3372
|
+
progress: 0,
|
|
3373
|
+
velocity: 0,
|
|
3374
|
+
animating: false,
|
|
3375
|
+
cssOverflowAdjustment() {
|
|
3376
|
+
// Returns 0 unless `translate` is > 2**23
|
|
3377
|
+
// Should be subtracted from css values to prevent overflow
|
|
3378
|
+
return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;
|
|
3379
|
+
},
|
|
3380
|
+
// Locks
|
|
3381
|
+
allowSlideNext: swiper.params.allowSlideNext,
|
|
3382
|
+
allowSlidePrev: swiper.params.allowSlidePrev,
|
|
3383
|
+
// Touch Events
|
|
3384
|
+
touchEventsData: {
|
|
3385
|
+
isTouched: undefined,
|
|
3386
|
+
isMoved: undefined,
|
|
3387
|
+
allowTouchCallbacks: undefined,
|
|
3388
|
+
touchStartTime: undefined,
|
|
3389
|
+
isScrolling: undefined,
|
|
3390
|
+
currentTranslate: undefined,
|
|
3391
|
+
startTranslate: undefined,
|
|
3392
|
+
allowThresholdMove: undefined,
|
|
3393
|
+
// Form elements to match
|
|
3394
|
+
focusableElements: swiper.params.focusableElements,
|
|
3395
|
+
// Last click time
|
|
3396
|
+
lastClickTime: 0,
|
|
3397
|
+
clickTimeout: undefined,
|
|
3398
|
+
// Velocities
|
|
3399
|
+
velocities: [],
|
|
3400
|
+
allowMomentumBounce: undefined,
|
|
3401
|
+
startMoving: undefined,
|
|
3402
|
+
evCache: []
|
|
3403
|
+
},
|
|
3404
|
+
// Clicks
|
|
3405
|
+
allowClick: true,
|
|
3406
|
+
// Touches
|
|
3407
|
+
allowTouchMove: swiper.params.allowTouchMove,
|
|
3408
|
+
touches: {
|
|
3409
|
+
startX: 0,
|
|
3410
|
+
startY: 0,
|
|
3411
|
+
currentX: 0,
|
|
3412
|
+
currentY: 0,
|
|
3413
|
+
diff: 0
|
|
3414
|
+
},
|
|
3415
|
+
// Images
|
|
3416
|
+
imagesToLoad: [],
|
|
3417
|
+
imagesLoaded: 0
|
|
3418
|
+
});
|
|
3419
|
+
swiper.emit('_swiper');
|
|
3420
|
+
|
|
3421
|
+
// Init
|
|
3422
|
+
if (swiper.params.init) {
|
|
3423
|
+
swiper.init();
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
// Return app instance
|
|
3427
|
+
// eslint-disable-next-line no-constructor-return
|
|
3428
|
+
return swiper;
|
|
3429
|
+
}
|
|
3430
|
+
getSlideIndex(slideEl) {
|
|
3431
|
+
const {
|
|
3432
|
+
slidesEl,
|
|
3433
|
+
params
|
|
3434
|
+
} = this;
|
|
3435
|
+
const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
|
|
3436
|
+
const firstSlideIndex = elementIndex(slides[0]);
|
|
3437
|
+
return elementIndex(slideEl) - firstSlideIndex;
|
|
3438
|
+
}
|
|
3439
|
+
getSlideIndexByData(index) {
|
|
3440
|
+
return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]);
|
|
3441
|
+
}
|
|
3442
|
+
recalcSlides() {
|
|
3443
|
+
const swiper = this;
|
|
3444
|
+
const {
|
|
3445
|
+
slidesEl,
|
|
3446
|
+
params
|
|
3447
|
+
} = swiper;
|
|
3448
|
+
swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
|
|
3449
|
+
}
|
|
3450
|
+
enable() {
|
|
3451
|
+
const swiper = this;
|
|
3452
|
+
if (swiper.enabled) return;
|
|
3453
|
+
swiper.enabled = true;
|
|
3454
|
+
if (swiper.params.grabCursor) {
|
|
3455
|
+
swiper.setGrabCursor();
|
|
3456
|
+
}
|
|
3457
|
+
swiper.emit('enable');
|
|
3458
|
+
}
|
|
3459
|
+
disable() {
|
|
3460
|
+
const swiper = this;
|
|
3461
|
+
if (!swiper.enabled) return;
|
|
3462
|
+
swiper.enabled = false;
|
|
3463
|
+
if (swiper.params.grabCursor) {
|
|
3464
|
+
swiper.unsetGrabCursor();
|
|
3465
|
+
}
|
|
3466
|
+
swiper.emit('disable');
|
|
3467
|
+
}
|
|
3468
|
+
setProgress(progress, speed) {
|
|
3469
|
+
const swiper = this;
|
|
3470
|
+
progress = Math.min(Math.max(progress, 0), 1);
|
|
3471
|
+
const min = swiper.minTranslate();
|
|
3472
|
+
const max = swiper.maxTranslate();
|
|
3473
|
+
const current = (max - min) * progress + min;
|
|
3474
|
+
swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
|
|
3475
|
+
swiper.updateActiveIndex();
|
|
3476
|
+
swiper.updateSlidesClasses();
|
|
3477
|
+
}
|
|
3478
|
+
emitContainerClasses() {
|
|
3479
|
+
const swiper = this;
|
|
3480
|
+
if (!swiper.params._emitClasses || !swiper.el) return;
|
|
3481
|
+
const cls = swiper.el.className.split(' ').filter(className => {
|
|
3482
|
+
return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
|
|
3483
|
+
});
|
|
3484
|
+
swiper.emit('_containerClasses', cls.join(' '));
|
|
3485
|
+
}
|
|
3486
|
+
getSlideClasses(slideEl) {
|
|
3487
|
+
const swiper = this;
|
|
3488
|
+
if (swiper.destroyed) return '';
|
|
3489
|
+
return slideEl.className.split(' ').filter(className => {
|
|
3490
|
+
return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
|
|
3491
|
+
}).join(' ');
|
|
3492
|
+
}
|
|
3493
|
+
emitSlidesClasses() {
|
|
3494
|
+
const swiper = this;
|
|
3495
|
+
if (!swiper.params._emitClasses || !swiper.el) return;
|
|
3496
|
+
const updates = [];
|
|
3497
|
+
swiper.slides.forEach(slideEl => {
|
|
3498
|
+
const classNames = swiper.getSlideClasses(slideEl);
|
|
3499
|
+
updates.push({
|
|
3500
|
+
slideEl,
|
|
3501
|
+
classNames
|
|
3502
|
+
});
|
|
3503
|
+
swiper.emit('_slideClass', slideEl, classNames);
|
|
3504
|
+
});
|
|
3505
|
+
swiper.emit('_slideClasses', updates);
|
|
3506
|
+
}
|
|
3507
|
+
slidesPerViewDynamic(view = 'current', exact = false) {
|
|
3508
|
+
const swiper = this;
|
|
3509
|
+
const {
|
|
3510
|
+
params,
|
|
3511
|
+
slides,
|
|
3512
|
+
slidesGrid,
|
|
3513
|
+
slidesSizesGrid,
|
|
3514
|
+
size: swiperSize,
|
|
3515
|
+
activeIndex
|
|
3516
|
+
} = swiper;
|
|
3517
|
+
let spv = 1;
|
|
3518
|
+
if (params.centeredSlides) {
|
|
3519
|
+
let slideSize = slides[activeIndex].swiperSlideSize;
|
|
3520
|
+
let breakLoop;
|
|
3521
|
+
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
|
3522
|
+
if (slides[i] && !breakLoop) {
|
|
3523
|
+
slideSize += slides[i].swiperSlideSize;
|
|
3524
|
+
spv += 1;
|
|
3525
|
+
if (slideSize > swiperSize) breakLoop = true;
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
|
3529
|
+
if (slides[i] && !breakLoop) {
|
|
3530
|
+
slideSize += slides[i].swiperSlideSize;
|
|
3531
|
+
spv += 1;
|
|
3532
|
+
if (slideSize > swiperSize) breakLoop = true;
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
} else {
|
|
3536
|
+
// eslint-disable-next-line
|
|
3537
|
+
if (view === 'current') {
|
|
3538
|
+
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
|
3539
|
+
const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
|
|
3540
|
+
if (slideInView) {
|
|
3541
|
+
spv += 1;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
} else {
|
|
3545
|
+
// previous
|
|
3546
|
+
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
|
3547
|
+
const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
|
|
3548
|
+
if (slideInView) {
|
|
3549
|
+
spv += 1;
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
return spv;
|
|
3555
|
+
}
|
|
3556
|
+
update() {
|
|
3557
|
+
const swiper = this;
|
|
3558
|
+
if (!swiper || swiper.destroyed) return;
|
|
3559
|
+
const {
|
|
3560
|
+
snapGrid,
|
|
3561
|
+
params
|
|
3562
|
+
} = swiper;
|
|
3563
|
+
// Breakpoints
|
|
3564
|
+
if (params.breakpoints) {
|
|
3565
|
+
swiper.setBreakpoint();
|
|
3566
|
+
}
|
|
3567
|
+
[...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
|
|
3568
|
+
if (imageEl.complete) {
|
|
3569
|
+
processLazyPreloader(swiper, imageEl);
|
|
3570
|
+
}
|
|
3571
|
+
});
|
|
3572
|
+
swiper.updateSize();
|
|
3573
|
+
swiper.updateSlides();
|
|
3574
|
+
swiper.updateProgress();
|
|
3575
|
+
swiper.updateSlidesClasses();
|
|
3576
|
+
function setTranslate() {
|
|
3577
|
+
const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
|
|
3578
|
+
const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
|
|
3579
|
+
swiper.setTranslate(newTranslate);
|
|
3580
|
+
swiper.updateActiveIndex();
|
|
3581
|
+
swiper.updateSlidesClasses();
|
|
3582
|
+
}
|
|
3583
|
+
let translated;
|
|
3584
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled) {
|
|
3585
|
+
setTranslate();
|
|
3586
|
+
if (swiper.params.autoHeight) {
|
|
3587
|
+
swiper.updateAutoHeight();
|
|
3588
|
+
}
|
|
3589
|
+
} else {
|
|
3590
|
+
if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
|
|
3591
|
+
const slides = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
|
|
3592
|
+
translated = swiper.slideTo(slides.length - 1, 0, false, true);
|
|
3593
|
+
} else {
|
|
3594
|
+
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
3595
|
+
}
|
|
3596
|
+
if (!translated) {
|
|
3597
|
+
setTranslate();
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
|
3601
|
+
swiper.checkOverflow();
|
|
3602
|
+
}
|
|
3603
|
+
swiper.emit('update');
|
|
3604
|
+
}
|
|
3605
|
+
changeDirection(newDirection, needUpdate = true) {
|
|
3606
|
+
const swiper = this;
|
|
3607
|
+
const currentDirection = swiper.params.direction;
|
|
3608
|
+
if (!newDirection) {
|
|
3609
|
+
// eslint-disable-next-line
|
|
3610
|
+
newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
|
|
3611
|
+
}
|
|
3612
|
+
if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
|
|
3613
|
+
return swiper;
|
|
3614
|
+
}
|
|
3615
|
+
swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`);
|
|
3616
|
+
swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`);
|
|
3617
|
+
swiper.emitContainerClasses();
|
|
3618
|
+
swiper.params.direction = newDirection;
|
|
3619
|
+
swiper.slides.forEach(slideEl => {
|
|
3620
|
+
if (newDirection === 'vertical') {
|
|
3621
|
+
slideEl.style.width = '';
|
|
3622
|
+
} else {
|
|
3623
|
+
slideEl.style.height = '';
|
|
3624
|
+
}
|
|
3625
|
+
});
|
|
3626
|
+
swiper.emit('changeDirection');
|
|
3627
|
+
if (needUpdate) swiper.update();
|
|
3628
|
+
return swiper;
|
|
3629
|
+
}
|
|
3630
|
+
changeLanguageDirection(direction) {
|
|
3631
|
+
const swiper = this;
|
|
3632
|
+
if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;
|
|
3633
|
+
swiper.rtl = direction === 'rtl';
|
|
3634
|
+
swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
|
|
3635
|
+
if (swiper.rtl) {
|
|
3636
|
+
swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`);
|
|
3637
|
+
swiper.el.dir = 'rtl';
|
|
3638
|
+
} else {
|
|
3639
|
+
swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`);
|
|
3640
|
+
swiper.el.dir = 'ltr';
|
|
3641
|
+
}
|
|
3642
|
+
swiper.update();
|
|
3643
|
+
}
|
|
3644
|
+
mount(element) {
|
|
3645
|
+
const swiper = this;
|
|
3646
|
+
if (swiper.mounted) return true;
|
|
3647
|
+
|
|
3648
|
+
// Find el
|
|
3649
|
+
let el = element || swiper.params.el;
|
|
3650
|
+
if (typeof el === 'string') {
|
|
3651
|
+
el = document.querySelector(el);
|
|
3652
|
+
}
|
|
3653
|
+
if (!el) {
|
|
3654
|
+
return false;
|
|
3655
|
+
}
|
|
3656
|
+
el.swiper = swiper;
|
|
3657
|
+
if (el.shadowEl) {
|
|
3658
|
+
swiper.isElement = true;
|
|
3659
|
+
}
|
|
3660
|
+
const getWrapperSelector = () => {
|
|
3661
|
+
return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
|
|
3662
|
+
};
|
|
3663
|
+
const getWrapper = () => {
|
|
3664
|
+
if (el && el.shadowRoot && el.shadowRoot.querySelector) {
|
|
3665
|
+
const res = el.shadowRoot.querySelector(getWrapperSelector());
|
|
3666
|
+
// Children needs to return slot items
|
|
3667
|
+
return res;
|
|
3668
|
+
}
|
|
3669
|
+
return elementChildren(el, getWrapperSelector())[0];
|
|
3670
|
+
};
|
|
3671
|
+
// Find Wrapper
|
|
3672
|
+
let wrapperEl = getWrapper();
|
|
3673
|
+
if (!wrapperEl && swiper.params.createElements) {
|
|
3674
|
+
wrapperEl = createElement('div', swiper.params.wrapperClass);
|
|
3675
|
+
el.append(wrapperEl);
|
|
3676
|
+
elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => {
|
|
3677
|
+
wrapperEl.append(slideEl);
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
Object.assign(swiper, {
|
|
3681
|
+
el,
|
|
3682
|
+
wrapperEl,
|
|
3683
|
+
slidesEl: swiper.isElement ? el : wrapperEl,
|
|
3684
|
+
mounted: true,
|
|
3685
|
+
// RTL
|
|
3686
|
+
rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',
|
|
3687
|
+
rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),
|
|
3688
|
+
wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'
|
|
3689
|
+
});
|
|
3690
|
+
return true;
|
|
3691
|
+
}
|
|
3692
|
+
init(el) {
|
|
3693
|
+
const swiper = this;
|
|
3694
|
+
if (swiper.initialized) return swiper;
|
|
3695
|
+
const mounted = swiper.mount(el);
|
|
3696
|
+
if (mounted === false) return swiper;
|
|
3697
|
+
swiper.emit('beforeInit');
|
|
3698
|
+
|
|
3699
|
+
// Set breakpoint
|
|
3700
|
+
if (swiper.params.breakpoints) {
|
|
3701
|
+
swiper.setBreakpoint();
|
|
3702
|
+
}
|
|
3703
|
+
|
|
3704
|
+
// Add Classes
|
|
3705
|
+
swiper.addClasses();
|
|
3706
|
+
|
|
3707
|
+
// Update size
|
|
3708
|
+
swiper.updateSize();
|
|
3709
|
+
|
|
3710
|
+
// Update slides
|
|
3711
|
+
swiper.updateSlides();
|
|
3712
|
+
if (swiper.params.watchOverflow) {
|
|
3713
|
+
swiper.checkOverflow();
|
|
3714
|
+
}
|
|
3715
|
+
|
|
3716
|
+
// Set Grab Cursor
|
|
3717
|
+
if (swiper.params.grabCursor && swiper.enabled) {
|
|
3718
|
+
swiper.setGrabCursor();
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
// Slide To Initial Slide
|
|
3722
|
+
if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
|
|
3723
|
+
swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
3724
|
+
} else {
|
|
3725
|
+
swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
// Create loop
|
|
3729
|
+
if (swiper.params.loop) {
|
|
3730
|
+
swiper.loopCreate();
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
// Attach events
|
|
3734
|
+
swiper.attachEvents();
|
|
3735
|
+
[...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
|
|
3736
|
+
if (imageEl.complete) {
|
|
3737
|
+
processLazyPreloader(swiper, imageEl);
|
|
3738
|
+
} else {
|
|
3739
|
+
imageEl.addEventListener('load', e => {
|
|
3740
|
+
processLazyPreloader(swiper, e.target);
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
});
|
|
3744
|
+
preload(swiper);
|
|
3745
|
+
|
|
3746
|
+
// Init Flag
|
|
3747
|
+
swiper.initialized = true;
|
|
3748
|
+
preload(swiper);
|
|
3749
|
+
|
|
3750
|
+
// Emit
|
|
3751
|
+
swiper.emit('init');
|
|
3752
|
+
swiper.emit('afterInit');
|
|
3753
|
+
return swiper;
|
|
3754
|
+
}
|
|
3755
|
+
destroy(deleteInstance = true, cleanStyles = true) {
|
|
3756
|
+
const swiper = this;
|
|
3757
|
+
const {
|
|
3758
|
+
params,
|
|
3759
|
+
el,
|
|
3760
|
+
wrapperEl,
|
|
3761
|
+
slides
|
|
3762
|
+
} = swiper;
|
|
3763
|
+
if (typeof swiper.params === 'undefined' || swiper.destroyed) {
|
|
3764
|
+
return null;
|
|
3765
|
+
}
|
|
3766
|
+
swiper.emit('beforeDestroy');
|
|
3767
|
+
|
|
3768
|
+
// Init Flag
|
|
3769
|
+
swiper.initialized = false;
|
|
3770
|
+
|
|
3771
|
+
// Detach events
|
|
3772
|
+
swiper.detachEvents();
|
|
3773
|
+
|
|
3774
|
+
// Destroy loop
|
|
3775
|
+
if (params.loop) {
|
|
3776
|
+
swiper.loopDestroy();
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
// Cleanup styles
|
|
3780
|
+
if (cleanStyles) {
|
|
3781
|
+
swiper.removeClasses();
|
|
3782
|
+
el.removeAttribute('style');
|
|
3783
|
+
wrapperEl.removeAttribute('style');
|
|
3784
|
+
if (slides && slides.length) {
|
|
3785
|
+
slides.forEach(slideEl => {
|
|
3786
|
+
slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
3787
|
+
slideEl.removeAttribute('style');
|
|
3788
|
+
slideEl.removeAttribute('data-swiper-slide-index');
|
|
3789
|
+
});
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
swiper.emit('destroy');
|
|
3793
|
+
|
|
3794
|
+
// Detach emitter events
|
|
3795
|
+
Object.keys(swiper.eventsListeners).forEach(eventName => {
|
|
3796
|
+
swiper.off(eventName);
|
|
3797
|
+
});
|
|
3798
|
+
if (deleteInstance !== false) {
|
|
3799
|
+
swiper.el.swiper = null;
|
|
3800
|
+
deleteProps(swiper);
|
|
3801
|
+
}
|
|
3802
|
+
swiper.destroyed = true;
|
|
3803
|
+
return null;
|
|
3804
|
+
}
|
|
3805
|
+
static extendDefaults(newDefaults) {
|
|
3806
|
+
extend(extendedDefaults, newDefaults);
|
|
3807
|
+
}
|
|
3808
|
+
static get extendedDefaults() {
|
|
3809
|
+
return extendedDefaults;
|
|
3810
|
+
}
|
|
3811
|
+
static get defaults() {
|
|
3812
|
+
return defaults;
|
|
3813
|
+
}
|
|
3814
|
+
static installModule(mod) {
|
|
3815
|
+
if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
|
|
3816
|
+
const modules = Swiper.prototype.__modules__;
|
|
3817
|
+
if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
|
|
3818
|
+
modules.push(mod);
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
static use(module) {
|
|
3822
|
+
if (Array.isArray(module)) {
|
|
3823
|
+
module.forEach(m => Swiper.installModule(m));
|
|
3824
|
+
return Swiper;
|
|
3825
|
+
}
|
|
3826
|
+
Swiper.installModule(module);
|
|
3827
|
+
return Swiper;
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
Object.keys(prototypes).forEach(prototypeGroup => {
|
|
3831
|
+
Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
|
|
3832
|
+
Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
|
|
3833
|
+
});
|
|
3834
|
+
});
|
|
3835
|
+
Swiper.use([Resize, Observer]);
|
|
3836
|
+
|
|
3837
|
+
function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
|
|
3838
|
+
if (swiper.params.createElements) {
|
|
3839
|
+
Object.keys(checkProps).forEach(key => {
|
|
3840
|
+
if (!params[key] && params.auto === true) {
|
|
3841
|
+
let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
|
|
3842
|
+
if (!element) {
|
|
3843
|
+
element = createElement('div', checkProps[key]);
|
|
3844
|
+
element.className = checkProps[key];
|
|
3845
|
+
swiper.el.append(element);
|
|
3846
|
+
}
|
|
3847
|
+
params[key] = element;
|
|
3848
|
+
originalParams[key] = element;
|
|
3849
|
+
}
|
|
3850
|
+
});
|
|
3851
|
+
}
|
|
3852
|
+
return params;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3855
|
+
function Navigation({
|
|
3856
|
+
swiper,
|
|
3857
|
+
extendParams,
|
|
3858
|
+
on,
|
|
3859
|
+
emit
|
|
3860
|
+
}) {
|
|
3861
|
+
extendParams({
|
|
3862
|
+
navigation: {
|
|
3863
|
+
nextEl: null,
|
|
3864
|
+
prevEl: null,
|
|
3865
|
+
hideOnClick: false,
|
|
3866
|
+
disabledClass: 'swiper-button-disabled',
|
|
3867
|
+
hiddenClass: 'swiper-button-hidden',
|
|
3868
|
+
lockClass: 'swiper-button-lock',
|
|
3869
|
+
navigationDisabledClass: 'swiper-navigation-disabled'
|
|
3870
|
+
}
|
|
3871
|
+
});
|
|
3872
|
+
swiper.navigation = {
|
|
3873
|
+
nextEl: null,
|
|
3874
|
+
prevEl: null
|
|
3875
|
+
};
|
|
3876
|
+
const makeElementsArray = el => {
|
|
3877
|
+
if (!Array.isArray(el)) el = [el].filter(e => !!e);
|
|
3878
|
+
return el;
|
|
3879
|
+
};
|
|
3880
|
+
function getEl(el) {
|
|
3881
|
+
let res;
|
|
3882
|
+
if (el && typeof el === 'string' && swiper.isElement) {
|
|
3883
|
+
res = swiper.el.shadowRoot.querySelector(el);
|
|
3884
|
+
if (res) return res;
|
|
3885
|
+
}
|
|
3886
|
+
if (el) {
|
|
3887
|
+
if (typeof el === 'string') res = [...document.querySelectorAll(el)];
|
|
3888
|
+
if (swiper.params.uniqueNavElements && typeof el === 'string' && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
|
|
3889
|
+
res = swiper.el.querySelector(el);
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
if (el && !res) return el;
|
|
3893
|
+
// if (Array.isArray(res) && res.length === 1) res = res[0];
|
|
3894
|
+
return res;
|
|
3895
|
+
}
|
|
3896
|
+
function toggleEl(el, disabled) {
|
|
3897
|
+
const params = swiper.params.navigation;
|
|
3898
|
+
el = makeElementsArray(el);
|
|
3899
|
+
el.forEach(subEl => {
|
|
3900
|
+
if (subEl) {
|
|
3901
|
+
subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
|
|
3902
|
+
if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
|
|
3903
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
3904
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
function update() {
|
|
3910
|
+
// Update Navigation Buttons
|
|
3911
|
+
const {
|
|
3912
|
+
nextEl,
|
|
3913
|
+
prevEl
|
|
3914
|
+
} = swiper.navigation;
|
|
3915
|
+
if (swiper.params.loop) {
|
|
3916
|
+
toggleEl(prevEl, false);
|
|
3917
|
+
toggleEl(nextEl, false);
|
|
3918
|
+
return;
|
|
3919
|
+
}
|
|
3920
|
+
toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
|
|
3921
|
+
toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
|
|
3922
|
+
}
|
|
3923
|
+
function onPrevClick(e) {
|
|
3924
|
+
e.preventDefault();
|
|
3925
|
+
if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
|
|
3926
|
+
swiper.slidePrev();
|
|
3927
|
+
emit('navigationPrev');
|
|
3928
|
+
}
|
|
3929
|
+
function onNextClick(e) {
|
|
3930
|
+
e.preventDefault();
|
|
3931
|
+
if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
|
|
3932
|
+
swiper.slideNext();
|
|
3933
|
+
emit('navigationNext');
|
|
3934
|
+
}
|
|
3935
|
+
function init() {
|
|
3936
|
+
const params = swiper.params.navigation;
|
|
3937
|
+
swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
|
|
3938
|
+
nextEl: 'swiper-button-next',
|
|
3939
|
+
prevEl: 'swiper-button-prev'
|
|
3940
|
+
});
|
|
3941
|
+
if (!(params.nextEl || params.prevEl)) return;
|
|
3942
|
+
let nextEl = getEl(params.nextEl);
|
|
3943
|
+
let prevEl = getEl(params.prevEl);
|
|
3944
|
+
Object.assign(swiper.navigation, {
|
|
3945
|
+
nextEl,
|
|
3946
|
+
prevEl
|
|
3947
|
+
});
|
|
3948
|
+
nextEl = makeElementsArray(nextEl);
|
|
3949
|
+
prevEl = makeElementsArray(prevEl);
|
|
3950
|
+
const initButton = (el, dir) => {
|
|
3951
|
+
if (el) {
|
|
3952
|
+
el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
|
|
3953
|
+
}
|
|
3954
|
+
if (!swiper.enabled && el) {
|
|
3955
|
+
el.classList.add(...params.lockClass.split(' '));
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
nextEl.forEach(el => initButton(el, 'next'));
|
|
3959
|
+
prevEl.forEach(el => initButton(el, 'prev'));
|
|
3960
|
+
}
|
|
3961
|
+
function destroy() {
|
|
3962
|
+
let {
|
|
3963
|
+
nextEl,
|
|
3964
|
+
prevEl
|
|
3965
|
+
} = swiper.navigation;
|
|
3966
|
+
nextEl = makeElementsArray(nextEl);
|
|
3967
|
+
prevEl = makeElementsArray(prevEl);
|
|
3968
|
+
const destroyButton = (el, dir) => {
|
|
3969
|
+
el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
|
|
3970
|
+
el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
|
|
3971
|
+
};
|
|
3972
|
+
nextEl.forEach(el => destroyButton(el, 'next'));
|
|
3973
|
+
prevEl.forEach(el => destroyButton(el, 'prev'));
|
|
3974
|
+
}
|
|
3975
|
+
on('init', () => {
|
|
3976
|
+
if (swiper.params.navigation.enabled === false) {
|
|
3977
|
+
// eslint-disable-next-line
|
|
3978
|
+
disable();
|
|
3979
|
+
} else {
|
|
3980
|
+
init();
|
|
3981
|
+
update();
|
|
3982
|
+
}
|
|
3983
|
+
});
|
|
3984
|
+
on('toEdge fromEdge lock unlock', () => {
|
|
3985
|
+
update();
|
|
3986
|
+
});
|
|
3987
|
+
on('destroy', () => {
|
|
3988
|
+
destroy();
|
|
3989
|
+
});
|
|
3990
|
+
on('enable disable', () => {
|
|
3991
|
+
let {
|
|
3992
|
+
nextEl,
|
|
3993
|
+
prevEl
|
|
3994
|
+
} = swiper.navigation;
|
|
3995
|
+
nextEl = makeElementsArray(nextEl);
|
|
3996
|
+
prevEl = makeElementsArray(prevEl);
|
|
3997
|
+
[...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.navigation.lockClass));
|
|
3998
|
+
});
|
|
3999
|
+
on('click', (_s, e) => {
|
|
4000
|
+
let {
|
|
4001
|
+
nextEl,
|
|
4002
|
+
prevEl
|
|
4003
|
+
} = swiper.navigation;
|
|
4004
|
+
nextEl = makeElementsArray(nextEl);
|
|
4005
|
+
prevEl = makeElementsArray(prevEl);
|
|
4006
|
+
const targetEl = e.target;
|
|
4007
|
+
if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {
|
|
4008
|
+
if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
|
|
4009
|
+
let isHidden;
|
|
4010
|
+
if (nextEl.length) {
|
|
4011
|
+
isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
|
|
4012
|
+
} else if (prevEl.length) {
|
|
4013
|
+
isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
|
|
4014
|
+
}
|
|
4015
|
+
if (isHidden === true) {
|
|
4016
|
+
emit('navigationShow');
|
|
4017
|
+
} else {
|
|
4018
|
+
emit('navigationHide');
|
|
4019
|
+
}
|
|
4020
|
+
[...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
|
|
4021
|
+
}
|
|
4022
|
+
});
|
|
4023
|
+
const enable = () => {
|
|
4024
|
+
swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
|
|
4025
|
+
init();
|
|
4026
|
+
update();
|
|
4027
|
+
};
|
|
4028
|
+
const disable = () => {
|
|
4029
|
+
swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
|
|
4030
|
+
destroy();
|
|
4031
|
+
};
|
|
4032
|
+
Object.assign(swiper.navigation, {
|
|
4033
|
+
enable,
|
|
4034
|
+
disable,
|
|
4035
|
+
update,
|
|
4036
|
+
init,
|
|
4037
|
+
destroy
|
|
4038
|
+
});
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
function classesToSelector(classes = '') {
|
|
4042
|
+
return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
|
|
4043
|
+
.replace(/ /g, '.')}`;
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
function Pagination({
|
|
4047
|
+
swiper,
|
|
4048
|
+
extendParams,
|
|
4049
|
+
on,
|
|
4050
|
+
emit
|
|
4051
|
+
}) {
|
|
4052
|
+
const pfx = 'swiper-pagination';
|
|
4053
|
+
extendParams({
|
|
4054
|
+
pagination: {
|
|
4055
|
+
el: null,
|
|
4056
|
+
bulletElement: 'span',
|
|
4057
|
+
clickable: false,
|
|
4058
|
+
hideOnClick: false,
|
|
4059
|
+
renderBullet: null,
|
|
4060
|
+
renderProgressbar: null,
|
|
4061
|
+
renderFraction: null,
|
|
4062
|
+
renderCustom: null,
|
|
4063
|
+
progressbarOpposite: false,
|
|
4064
|
+
type: 'bullets',
|
|
4065
|
+
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
4066
|
+
dynamicBullets: false,
|
|
4067
|
+
dynamicMainBullets: 1,
|
|
4068
|
+
formatFractionCurrent: number => number,
|
|
4069
|
+
formatFractionTotal: number => number,
|
|
4070
|
+
bulletClass: `${pfx}-bullet`,
|
|
4071
|
+
bulletActiveClass: `${pfx}-bullet-active`,
|
|
4072
|
+
modifierClass: `${pfx}-`,
|
|
4073
|
+
currentClass: `${pfx}-current`,
|
|
4074
|
+
totalClass: `${pfx}-total`,
|
|
4075
|
+
hiddenClass: `${pfx}-hidden`,
|
|
4076
|
+
progressbarFillClass: `${pfx}-progressbar-fill`,
|
|
4077
|
+
progressbarOppositeClass: `${pfx}-progressbar-opposite`,
|
|
4078
|
+
clickableClass: `${pfx}-clickable`,
|
|
4079
|
+
lockClass: `${pfx}-lock`,
|
|
4080
|
+
horizontalClass: `${pfx}-horizontal`,
|
|
4081
|
+
verticalClass: `${pfx}-vertical`,
|
|
4082
|
+
paginationDisabledClass: `${pfx}-disabled`
|
|
4083
|
+
}
|
|
4084
|
+
});
|
|
4085
|
+
swiper.pagination = {
|
|
4086
|
+
el: null,
|
|
4087
|
+
bullets: []
|
|
4088
|
+
};
|
|
4089
|
+
let bulletSize;
|
|
4090
|
+
let dynamicBulletIndex = 0;
|
|
4091
|
+
const makeElementsArray = el => {
|
|
4092
|
+
if (!Array.isArray(el)) el = [el].filter(e => !!e);
|
|
4093
|
+
return el;
|
|
4094
|
+
};
|
|
4095
|
+
function isPaginationDisabled() {
|
|
4096
|
+
return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
|
|
4097
|
+
}
|
|
4098
|
+
function setSideBullets(bulletEl, position) {
|
|
4099
|
+
const {
|
|
4100
|
+
bulletActiveClass
|
|
4101
|
+
} = swiper.params.pagination;
|
|
4102
|
+
if (!bulletEl) return;
|
|
4103
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
4104
|
+
if (bulletEl) {
|
|
4105
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}`);
|
|
4106
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
4107
|
+
if (bulletEl) {
|
|
4108
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
function onBulletClick(e) {
|
|
4113
|
+
const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
|
|
4114
|
+
if (!bulletEl) {
|
|
4115
|
+
return;
|
|
4116
|
+
}
|
|
4117
|
+
e.preventDefault();
|
|
4118
|
+
const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
|
|
4119
|
+
if (swiper.params.loop) {
|
|
4120
|
+
if (swiper.realIndex === index) return;
|
|
4121
|
+
const newSlideIndex = swiper.getSlideIndexByData(index);
|
|
4122
|
+
const currentSlideIndex = swiper.getSlideIndexByData(swiper.realIndex);
|
|
4123
|
+
if (newSlideIndex > swiper.slides.length - swiper.loopedSlides) {
|
|
4124
|
+
swiper.loopFix({
|
|
4125
|
+
direction: newSlideIndex > currentSlideIndex ? 'next' : 'prev',
|
|
4126
|
+
activeSlideIndex: newSlideIndex,
|
|
4127
|
+
slideTo: false
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
swiper.slideToLoop(index);
|
|
4131
|
+
} else {
|
|
4132
|
+
swiper.slideTo(index);
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
function update() {
|
|
4136
|
+
// Render || Update Pagination bullets/items
|
|
4137
|
+
const rtl = swiper.rtl;
|
|
4138
|
+
const params = swiper.params.pagination;
|
|
4139
|
+
if (isPaginationDisabled()) return;
|
|
4140
|
+
let el = swiper.pagination.el;
|
|
4141
|
+
el = makeElementsArray(el);
|
|
4142
|
+
// Current/Total
|
|
4143
|
+
let current;
|
|
4144
|
+
let previousIndex;
|
|
4145
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
4146
|
+
const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
4147
|
+
if (swiper.params.loop) {
|
|
4148
|
+
previousIndex = swiper.previousRealIndex || 0;
|
|
4149
|
+
current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
|
|
4150
|
+
} else if (typeof swiper.snapIndex !== 'undefined') {
|
|
4151
|
+
current = swiper.snapIndex;
|
|
4152
|
+
previousIndex = swiper.previousSnapIndex;
|
|
4153
|
+
} else {
|
|
4154
|
+
previousIndex = swiper.previousIndex || 0;
|
|
4155
|
+
current = swiper.activeIndex || 0;
|
|
4156
|
+
}
|
|
4157
|
+
// Types
|
|
4158
|
+
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
|
|
4159
|
+
const bullets = swiper.pagination.bullets;
|
|
4160
|
+
let firstIndex;
|
|
4161
|
+
let lastIndex;
|
|
4162
|
+
let midIndex;
|
|
4163
|
+
if (params.dynamicBullets) {
|
|
4164
|
+
bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true);
|
|
4165
|
+
el.forEach(subEl => {
|
|
4166
|
+
subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
|
|
4167
|
+
});
|
|
4168
|
+
if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {
|
|
4169
|
+
dynamicBulletIndex += current - (previousIndex || 0);
|
|
4170
|
+
if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
|
|
4171
|
+
dynamicBulletIndex = params.dynamicMainBullets - 1;
|
|
4172
|
+
} else if (dynamicBulletIndex < 0) {
|
|
4173
|
+
dynamicBulletIndex = 0;
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
firstIndex = Math.max(current - dynamicBulletIndex, 0);
|
|
4177
|
+
lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
|
|
4178
|
+
midIndex = (lastIndex + firstIndex) / 2;
|
|
4179
|
+
}
|
|
4180
|
+
bullets.forEach(bulletEl => {
|
|
4181
|
+
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();
|
|
4182
|
+
bulletEl.classList.remove(...classesToRemove);
|
|
4183
|
+
});
|
|
4184
|
+
if (el.length > 1) {
|
|
4185
|
+
bullets.forEach(bullet => {
|
|
4186
|
+
const bulletIndex = elementIndex(bullet);
|
|
4187
|
+
if (bulletIndex === current) {
|
|
4188
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
4189
|
+
}
|
|
4190
|
+
if (params.dynamicBullets) {
|
|
4191
|
+
if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
|
|
4192
|
+
bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
4193
|
+
}
|
|
4194
|
+
if (bulletIndex === firstIndex) {
|
|
4195
|
+
setSideBullets(bullet, 'prev');
|
|
4196
|
+
}
|
|
4197
|
+
if (bulletIndex === lastIndex) {
|
|
4198
|
+
setSideBullets(bullet, 'next');
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
});
|
|
4202
|
+
} else {
|
|
4203
|
+
const bullet = bullets[current];
|
|
4204
|
+
if (bullet) {
|
|
4205
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
4206
|
+
}
|
|
4207
|
+
if (params.dynamicBullets) {
|
|
4208
|
+
const firstDisplayedBullet = bullets[firstIndex];
|
|
4209
|
+
const lastDisplayedBullet = bullets[lastIndex];
|
|
4210
|
+
for (let i = firstIndex; i <= lastIndex; i += 1) {
|
|
4211
|
+
if (bullets[i]) {
|
|
4212
|
+
bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
setSideBullets(firstDisplayedBullet, 'prev');
|
|
4216
|
+
setSideBullets(lastDisplayedBullet, 'next');
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
if (params.dynamicBullets) {
|
|
4220
|
+
const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
|
|
4221
|
+
const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
|
|
4222
|
+
const offsetProp = rtl ? 'right' : 'left';
|
|
4223
|
+
bullets.forEach(bullet => {
|
|
4224
|
+
bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
|
|
4225
|
+
});
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
el.forEach((subEl, subElIndex) => {
|
|
4229
|
+
if (params.type === 'fraction') {
|
|
4230
|
+
subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
|
|
4231
|
+
fractionEl.textContent = params.formatFractionCurrent(current + 1);
|
|
4232
|
+
});
|
|
4233
|
+
subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
|
|
4234
|
+
totalEl.textContent = params.formatFractionTotal(total);
|
|
4235
|
+
});
|
|
4236
|
+
}
|
|
4237
|
+
if (params.type === 'progressbar') {
|
|
4238
|
+
let progressbarDirection;
|
|
4239
|
+
if (params.progressbarOpposite) {
|
|
4240
|
+
progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
|
|
4241
|
+
} else {
|
|
4242
|
+
progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
|
|
4243
|
+
}
|
|
4244
|
+
const scale = (current + 1) / total;
|
|
4245
|
+
let scaleX = 1;
|
|
4246
|
+
let scaleY = 1;
|
|
4247
|
+
if (progressbarDirection === 'horizontal') {
|
|
4248
|
+
scaleX = scale;
|
|
4249
|
+
} else {
|
|
4250
|
+
scaleY = scale;
|
|
4251
|
+
}
|
|
4252
|
+
subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
|
|
4253
|
+
progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
|
|
4254
|
+
progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4257
|
+
if (params.type === 'custom' && params.renderCustom) {
|
|
4258
|
+
subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
|
|
4259
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
4260
|
+
} else {
|
|
4261
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
4262
|
+
emit('paginationUpdate', subEl);
|
|
4263
|
+
}
|
|
4264
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
4265
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
4266
|
+
}
|
|
4267
|
+
});
|
|
4268
|
+
}
|
|
4269
|
+
function render() {
|
|
4270
|
+
// Render Container
|
|
4271
|
+
const params = swiper.params.pagination;
|
|
4272
|
+
if (isPaginationDisabled()) return;
|
|
4273
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
4274
|
+
let el = swiper.pagination.el;
|
|
4275
|
+
el = makeElementsArray(el);
|
|
4276
|
+
let paginationHTML = '';
|
|
4277
|
+
if (params.type === 'bullets') {
|
|
4278
|
+
let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
4279
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
|
|
4280
|
+
numberOfBullets = slidesLength;
|
|
4281
|
+
}
|
|
4282
|
+
for (let i = 0; i < numberOfBullets; i += 1) {
|
|
4283
|
+
if (params.renderBullet) {
|
|
4284
|
+
paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
|
|
4285
|
+
} else {
|
|
4286
|
+
paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`;
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
if (params.type === 'fraction') {
|
|
4291
|
+
if (params.renderFraction) {
|
|
4292
|
+
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
|
|
4293
|
+
} else {
|
|
4294
|
+
paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
if (params.type === 'progressbar') {
|
|
4298
|
+
if (params.renderProgressbar) {
|
|
4299
|
+
paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
|
|
4300
|
+
} else {
|
|
4301
|
+
paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
swiper.pagination.bullets = [];
|
|
4305
|
+
el.forEach(subEl => {
|
|
4306
|
+
if (params.type !== 'custom') {
|
|
4307
|
+
subEl.innerHTML = paginationHTML || '';
|
|
4308
|
+
}
|
|
4309
|
+
if (params.type === 'bullets') {
|
|
4310
|
+
swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
|
|
4311
|
+
}
|
|
4312
|
+
});
|
|
4313
|
+
if (params.type !== 'custom') {
|
|
4314
|
+
emit('paginationRender', el[0]);
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
function init() {
|
|
4318
|
+
swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
|
|
4319
|
+
el: 'swiper-pagination'
|
|
4320
|
+
});
|
|
4321
|
+
const params = swiper.params.pagination;
|
|
4322
|
+
if (!params.el) return;
|
|
4323
|
+
let el;
|
|
4324
|
+
if (typeof params.el === 'string' && swiper.isElement) {
|
|
4325
|
+
el = swiper.el.shadowRoot.querySelector(params.el);
|
|
4326
|
+
}
|
|
4327
|
+
if (!el && typeof params.el === 'string') {
|
|
4328
|
+
el = [...document.querySelectorAll(params.el)];
|
|
4329
|
+
}
|
|
4330
|
+
if (!el) {
|
|
4331
|
+
el = params.el;
|
|
4332
|
+
}
|
|
4333
|
+
if (!el || el.length === 0) return;
|
|
4334
|
+
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
|
|
4335
|
+
el = [...swiper.el.querySelectorAll(params.el)];
|
|
4336
|
+
// check if it belongs to another nested Swiper
|
|
4337
|
+
if (el.length > 1) {
|
|
4338
|
+
el = el.filter(subEl => {
|
|
4339
|
+
if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
|
|
4340
|
+
return true;
|
|
4341
|
+
})[0];
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
if (Array.isArray(el) && el.length === 1) el = el[0];
|
|
4345
|
+
Object.assign(swiper.pagination, {
|
|
4346
|
+
el
|
|
4347
|
+
});
|
|
4348
|
+
el = makeElementsArray(el);
|
|
4349
|
+
el.forEach(subEl => {
|
|
4350
|
+
if (params.type === 'bullets' && params.clickable) {
|
|
4351
|
+
subEl.classList.add(params.clickableClass);
|
|
4352
|
+
}
|
|
4353
|
+
subEl.classList.add(params.modifierClass + params.type);
|
|
4354
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
4355
|
+
if (params.type === 'bullets' && params.dynamicBullets) {
|
|
4356
|
+
subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
|
|
4357
|
+
dynamicBulletIndex = 0;
|
|
4358
|
+
if (params.dynamicMainBullets < 1) {
|
|
4359
|
+
params.dynamicMainBullets = 1;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
if (params.type === 'progressbar' && params.progressbarOpposite) {
|
|
4363
|
+
subEl.classList.add(params.progressbarOppositeClass);
|
|
4364
|
+
}
|
|
4365
|
+
if (params.clickable) {
|
|
4366
|
+
subEl.addEventListener('click', onBulletClick);
|
|
4367
|
+
}
|
|
4368
|
+
if (!swiper.enabled) {
|
|
4369
|
+
subEl.classList.add(params.lockClass);
|
|
4370
|
+
}
|
|
4371
|
+
});
|
|
4372
|
+
}
|
|
4373
|
+
function destroy() {
|
|
4374
|
+
const params = swiper.params.pagination;
|
|
4375
|
+
if (isPaginationDisabled()) return;
|
|
4376
|
+
let el = swiper.pagination.el;
|
|
4377
|
+
if (el) {
|
|
4378
|
+
el = makeElementsArray(el);
|
|
4379
|
+
el.forEach(subEl => {
|
|
4380
|
+
subEl.classList.remove(params.hiddenClass);
|
|
4381
|
+
subEl.classList.remove(params.modifierClass + params.type);
|
|
4382
|
+
subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
4383
|
+
if (params.clickable) {
|
|
4384
|
+
subEl.removeEventListener('click', onBulletClick);
|
|
4385
|
+
}
|
|
4386
|
+
});
|
|
4387
|
+
}
|
|
4388
|
+
if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
|
|
4389
|
+
}
|
|
4390
|
+
on('changeDirection', () => {
|
|
4391
|
+
if (!swiper.pagination || !swiper.pagination.el) return;
|
|
4392
|
+
const params = swiper.params.pagination;
|
|
4393
|
+
let {
|
|
4394
|
+
el
|
|
4395
|
+
} = swiper.pagination;
|
|
4396
|
+
el = makeElementsArray(el);
|
|
4397
|
+
el.forEach(subEl => {
|
|
4398
|
+
subEl.classList.remove(params.horizontalClass, params.verticalClass);
|
|
4399
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
4400
|
+
});
|
|
4401
|
+
});
|
|
4402
|
+
on('init', () => {
|
|
4403
|
+
if (swiper.params.pagination.enabled === false) {
|
|
4404
|
+
// eslint-disable-next-line
|
|
4405
|
+
disable();
|
|
4406
|
+
} else {
|
|
4407
|
+
init();
|
|
4408
|
+
render();
|
|
4409
|
+
update();
|
|
4410
|
+
}
|
|
4411
|
+
});
|
|
4412
|
+
on('activeIndexChange', () => {
|
|
4413
|
+
if (typeof swiper.snapIndex === 'undefined') {
|
|
4414
|
+
update();
|
|
4415
|
+
}
|
|
4416
|
+
});
|
|
4417
|
+
on('snapIndexChange', () => {
|
|
4418
|
+
update();
|
|
4419
|
+
});
|
|
4420
|
+
on('snapGridLengthChange', () => {
|
|
4421
|
+
render();
|
|
4422
|
+
update();
|
|
4423
|
+
});
|
|
4424
|
+
on('destroy', () => {
|
|
4425
|
+
destroy();
|
|
4426
|
+
});
|
|
4427
|
+
on('enable disable', () => {
|
|
4428
|
+
let {
|
|
4429
|
+
el
|
|
4430
|
+
} = swiper.pagination;
|
|
4431
|
+
if (el) {
|
|
4432
|
+
el = makeElementsArray(el);
|
|
4433
|
+
el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
|
|
4434
|
+
}
|
|
4435
|
+
});
|
|
4436
|
+
on('lock unlock', () => {
|
|
4437
|
+
update();
|
|
4438
|
+
});
|
|
4439
|
+
on('click', (_s, e) => {
|
|
4440
|
+
const targetEl = e.target;
|
|
4441
|
+
let {
|
|
4442
|
+
el
|
|
4443
|
+
} = swiper.pagination;
|
|
4444
|
+
if (!Array.isArray(el)) el = [el].filter(element => !!element);
|
|
4445
|
+
if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
|
|
4446
|
+
if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
|
|
4447
|
+
const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
|
|
4448
|
+
if (isHidden === true) {
|
|
4449
|
+
emit('paginationShow');
|
|
4450
|
+
} else {
|
|
4451
|
+
emit('paginationHide');
|
|
4452
|
+
}
|
|
4453
|
+
el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
|
|
4454
|
+
}
|
|
4455
|
+
});
|
|
4456
|
+
const enable = () => {
|
|
4457
|
+
swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
|
|
4458
|
+
let {
|
|
4459
|
+
el
|
|
4460
|
+
} = swiper.pagination;
|
|
4461
|
+
if (el) {
|
|
4462
|
+
el = makeElementsArray(el);
|
|
4463
|
+
el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
|
|
4464
|
+
}
|
|
4465
|
+
init();
|
|
4466
|
+
render();
|
|
4467
|
+
update();
|
|
4468
|
+
};
|
|
4469
|
+
const disable = () => {
|
|
4470
|
+
swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
|
|
4471
|
+
let {
|
|
4472
|
+
el
|
|
4473
|
+
} = swiper.pagination;
|
|
4474
|
+
if (el) {
|
|
4475
|
+
el = makeElementsArray(el);
|
|
4476
|
+
el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
|
|
4477
|
+
}
|
|
4478
|
+
destroy();
|
|
4479
|
+
};
|
|
4480
|
+
Object.assign(swiper.pagination, {
|
|
4481
|
+
enable,
|
|
4482
|
+
disable,
|
|
4483
|
+
render,
|
|
4484
|
+
update,
|
|
4485
|
+
init,
|
|
4486
|
+
destroy
|
|
4487
|
+
});
|
|
4488
|
+
}
|
|
4489
|
+
|
|
4490
|
+
function A11y({
|
|
4491
|
+
swiper,
|
|
4492
|
+
extendParams,
|
|
4493
|
+
on
|
|
4494
|
+
}) {
|
|
4495
|
+
extendParams({
|
|
4496
|
+
a11y: {
|
|
4497
|
+
enabled: true,
|
|
4498
|
+
notificationClass: 'swiper-notification',
|
|
4499
|
+
prevSlideMessage: 'Previous slide',
|
|
4500
|
+
nextSlideMessage: 'Next slide',
|
|
4501
|
+
firstSlideMessage: 'This is the first slide',
|
|
4502
|
+
lastSlideMessage: 'This is the last slide',
|
|
4503
|
+
paginationBulletMessage: 'Go to slide {{index}}',
|
|
4504
|
+
slideLabelMessage: '{{index}} / {{slidesLength}}',
|
|
4505
|
+
containerMessage: null,
|
|
4506
|
+
containerRoleDescriptionMessage: null,
|
|
4507
|
+
itemRoleDescriptionMessage: null,
|
|
4508
|
+
slideRole: 'group',
|
|
4509
|
+
id: null
|
|
4510
|
+
}
|
|
4511
|
+
});
|
|
4512
|
+
swiper.a11y = {
|
|
4513
|
+
clicked: false
|
|
4514
|
+
};
|
|
4515
|
+
let liveRegion = null;
|
|
4516
|
+
function notify(message) {
|
|
4517
|
+
const notification = liveRegion;
|
|
4518
|
+
if (notification.length === 0) return;
|
|
4519
|
+
notification.innerHTML = '';
|
|
4520
|
+
notification.innerHTML = message;
|
|
4521
|
+
}
|
|
4522
|
+
const makeElementsArray = el => {
|
|
4523
|
+
if (!Array.isArray(el)) el = [el].filter(e => !!e);
|
|
4524
|
+
return el;
|
|
4525
|
+
};
|
|
4526
|
+
function getRandomNumber(size = 16) {
|
|
4527
|
+
const randomChar = () => Math.round(16 * Math.random()).toString(16);
|
|
4528
|
+
return 'x'.repeat(size).replace(/x/g, randomChar);
|
|
4529
|
+
}
|
|
4530
|
+
function makeElFocusable(el) {
|
|
4531
|
+
el = makeElementsArray(el);
|
|
4532
|
+
el.forEach(subEl => {
|
|
4533
|
+
subEl.setAttribute('tabIndex', '0');
|
|
4534
|
+
});
|
|
4535
|
+
}
|
|
4536
|
+
function makeElNotFocusable(el) {
|
|
4537
|
+
el = makeElementsArray(el);
|
|
4538
|
+
el.forEach(subEl => {
|
|
4539
|
+
subEl.setAttribute('tabIndex', '-1');
|
|
4540
|
+
});
|
|
4541
|
+
}
|
|
4542
|
+
function addElRole(el, role) {
|
|
4543
|
+
el = makeElementsArray(el);
|
|
4544
|
+
el.forEach(subEl => {
|
|
4545
|
+
subEl.setAttribute('role', role);
|
|
4546
|
+
});
|
|
4547
|
+
}
|
|
4548
|
+
function addElRoleDescription(el, description) {
|
|
4549
|
+
el = makeElementsArray(el);
|
|
4550
|
+
el.forEach(subEl => {
|
|
4551
|
+
subEl.setAttribute('aria-roledescription', description);
|
|
4552
|
+
});
|
|
4553
|
+
}
|
|
4554
|
+
function addElControls(el, controls) {
|
|
4555
|
+
el = makeElementsArray(el);
|
|
4556
|
+
el.forEach(subEl => {
|
|
4557
|
+
subEl.setAttribute('aria-controls', controls);
|
|
4558
|
+
});
|
|
4559
|
+
}
|
|
4560
|
+
function addElLabel(el, label) {
|
|
4561
|
+
el = makeElementsArray(el);
|
|
4562
|
+
el.forEach(subEl => {
|
|
4563
|
+
subEl.setAttribute('aria-label', label);
|
|
4564
|
+
});
|
|
4565
|
+
}
|
|
4566
|
+
function addElId(el, id) {
|
|
4567
|
+
el = makeElementsArray(el);
|
|
4568
|
+
el.forEach(subEl => {
|
|
4569
|
+
subEl.setAttribute('id', id);
|
|
4570
|
+
});
|
|
4571
|
+
}
|
|
4572
|
+
function addElLive(el, live) {
|
|
4573
|
+
el = makeElementsArray(el);
|
|
4574
|
+
el.forEach(subEl => {
|
|
4575
|
+
subEl.setAttribute('aria-live', live);
|
|
4576
|
+
});
|
|
4577
|
+
}
|
|
4578
|
+
function disableEl(el) {
|
|
4579
|
+
el = makeElementsArray(el);
|
|
4580
|
+
el.forEach(subEl => {
|
|
4581
|
+
subEl.setAttribute('aria-disabled', true);
|
|
4582
|
+
});
|
|
4583
|
+
}
|
|
4584
|
+
function enableEl(el) {
|
|
4585
|
+
el = makeElementsArray(el);
|
|
4586
|
+
el.forEach(subEl => {
|
|
4587
|
+
subEl.setAttribute('aria-disabled', false);
|
|
4588
|
+
});
|
|
4589
|
+
}
|
|
4590
|
+
function onEnterOrSpaceKey(e) {
|
|
4591
|
+
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
|
4592
|
+
const params = swiper.params.a11y;
|
|
4593
|
+
const targetEl = e.target;
|
|
4594
|
+
if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
|
|
4595
|
+
if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
|
|
4596
|
+
}
|
|
4597
|
+
if (swiper.navigation && swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl) {
|
|
4598
|
+
if (!(swiper.isEnd && !swiper.params.loop)) {
|
|
4599
|
+
swiper.slideNext();
|
|
4600
|
+
}
|
|
4601
|
+
if (swiper.isEnd) {
|
|
4602
|
+
notify(params.lastSlideMessage);
|
|
4603
|
+
} else {
|
|
4604
|
+
notify(params.nextSlideMessage);
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
if (swiper.navigation && swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl) {
|
|
4608
|
+
if (!(swiper.isBeginning && !swiper.params.loop)) {
|
|
4609
|
+
swiper.slidePrev();
|
|
4610
|
+
}
|
|
4611
|
+
if (swiper.isBeginning) {
|
|
4612
|
+
notify(params.firstSlideMessage);
|
|
4613
|
+
} else {
|
|
4614
|
+
notify(params.prevSlideMessage);
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4617
|
+
if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
|
|
4618
|
+
targetEl.click();
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4621
|
+
function updateNavigation() {
|
|
4622
|
+
if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
|
|
4623
|
+
const {
|
|
4624
|
+
nextEl,
|
|
4625
|
+
prevEl
|
|
4626
|
+
} = swiper.navigation;
|
|
4627
|
+
if (prevEl) {
|
|
4628
|
+
if (swiper.isBeginning) {
|
|
4629
|
+
disableEl(prevEl);
|
|
4630
|
+
makeElNotFocusable(prevEl);
|
|
4631
|
+
} else {
|
|
4632
|
+
enableEl(prevEl);
|
|
4633
|
+
makeElFocusable(prevEl);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
if (nextEl) {
|
|
4637
|
+
if (swiper.isEnd) {
|
|
4638
|
+
disableEl(nextEl);
|
|
4639
|
+
makeElNotFocusable(nextEl);
|
|
4640
|
+
} else {
|
|
4641
|
+
enableEl(nextEl);
|
|
4642
|
+
makeElFocusable(nextEl);
|
|
4643
|
+
}
|
|
4644
|
+
}
|
|
4645
|
+
}
|
|
4646
|
+
function hasPagination() {
|
|
4647
|
+
return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
|
|
4648
|
+
}
|
|
4649
|
+
function hasClickablePagination() {
|
|
4650
|
+
return hasPagination() && swiper.params.pagination.clickable;
|
|
4651
|
+
}
|
|
4652
|
+
function updatePagination() {
|
|
4653
|
+
const params = swiper.params.a11y;
|
|
4654
|
+
if (!hasPagination()) return;
|
|
4655
|
+
swiper.pagination.bullets.forEach(bulletEl => {
|
|
4656
|
+
if (swiper.params.pagination.clickable) {
|
|
4657
|
+
makeElFocusable(bulletEl);
|
|
4658
|
+
if (!swiper.params.pagination.renderBullet) {
|
|
4659
|
+
addElRole(bulletEl, 'button');
|
|
4660
|
+
addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, elementIndex(bulletEl) + 1));
|
|
4661
|
+
}
|
|
4662
|
+
}
|
|
4663
|
+
if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) {
|
|
4664
|
+
bulletEl.setAttribute('aria-current', 'true');
|
|
4665
|
+
} else {
|
|
4666
|
+
bulletEl.removeAttribute('aria-current');
|
|
4667
|
+
}
|
|
4668
|
+
});
|
|
4669
|
+
}
|
|
4670
|
+
const initNavEl = (el, wrapperId, message) => {
|
|
4671
|
+
makeElFocusable(el);
|
|
4672
|
+
if (el.tagName !== 'BUTTON') {
|
|
4673
|
+
addElRole(el, 'button');
|
|
4674
|
+
el.addEventListener('keydown', onEnterOrSpaceKey);
|
|
4675
|
+
}
|
|
4676
|
+
addElLabel(el, message);
|
|
4677
|
+
addElControls(el, wrapperId);
|
|
4678
|
+
};
|
|
4679
|
+
const handlePointerDown = () => {
|
|
4680
|
+
swiper.a11y.clicked = true;
|
|
4681
|
+
};
|
|
4682
|
+
const handlePointerUp = () => {
|
|
4683
|
+
requestAnimationFrame(() => {
|
|
4684
|
+
requestAnimationFrame(() => {
|
|
4685
|
+
if (!swiper.destroyed) {
|
|
4686
|
+
swiper.a11y.clicked = false;
|
|
4687
|
+
}
|
|
4688
|
+
});
|
|
4689
|
+
});
|
|
4690
|
+
};
|
|
4691
|
+
const handleFocus = e => {
|
|
4692
|
+
if (swiper.a11y.clicked) return;
|
|
4693
|
+
const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
|
|
4694
|
+
if (!slideEl || !swiper.slides.includes(slideEl)) return;
|
|
4695
|
+
const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
|
|
4696
|
+
const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
|
|
4697
|
+
if (isActive || isVisible) return;
|
|
4698
|
+
if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
|
|
4699
|
+
if (swiper.isHorizontal()) {
|
|
4700
|
+
swiper.el.scrollLeft = 0;
|
|
4701
|
+
} else {
|
|
4702
|
+
swiper.el.scrollTop = 0;
|
|
4703
|
+
}
|
|
4704
|
+
swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
|
|
4705
|
+
};
|
|
4706
|
+
const initSlides = () => {
|
|
4707
|
+
const params = swiper.params.a11y;
|
|
4708
|
+
if (params.itemRoleDescriptionMessage) {
|
|
4709
|
+
addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage);
|
|
4710
|
+
}
|
|
4711
|
+
if (params.slideRole) {
|
|
4712
|
+
addElRole(swiper.slides, params.slideRole);
|
|
4713
|
+
}
|
|
4714
|
+
const slidesLength = swiper.slides.length;
|
|
4715
|
+
if (params.slideLabelMessage) {
|
|
4716
|
+
swiper.slides.forEach((slideEl, index) => {
|
|
4717
|
+
const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index;
|
|
4718
|
+
const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
|
|
4719
|
+
addElLabel(slideEl, ariaLabelMessage);
|
|
4720
|
+
});
|
|
4721
|
+
}
|
|
4722
|
+
};
|
|
4723
|
+
const init = () => {
|
|
4724
|
+
const params = swiper.params.a11y;
|
|
4725
|
+
if (swiper.isElement) {
|
|
4726
|
+
swiper.el.shadowEl.append(liveRegion);
|
|
4727
|
+
} else {
|
|
4728
|
+
swiper.el.append(liveRegion);
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4731
|
+
// Container
|
|
4732
|
+
const containerEl = swiper.el;
|
|
4733
|
+
if (params.containerRoleDescriptionMessage) {
|
|
4734
|
+
addElRoleDescription(containerEl, params.containerRoleDescriptionMessage);
|
|
4735
|
+
}
|
|
4736
|
+
if (params.containerMessage) {
|
|
4737
|
+
addElLabel(containerEl, params.containerMessage);
|
|
4738
|
+
}
|
|
4739
|
+
|
|
4740
|
+
// Wrapper
|
|
4741
|
+
const wrapperEl = swiper.wrapperEl;
|
|
4742
|
+
const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`;
|
|
4743
|
+
const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
|
|
4744
|
+
addElId(wrapperEl, wrapperId);
|
|
4745
|
+
addElLive(wrapperEl, live);
|
|
4746
|
+
|
|
4747
|
+
// Slide
|
|
4748
|
+
initSlides();
|
|
4749
|
+
|
|
4750
|
+
// Navigation
|
|
4751
|
+
let {
|
|
4752
|
+
nextEl,
|
|
4753
|
+
prevEl
|
|
4754
|
+
} = swiper.navigation ? swiper.navigation : {};
|
|
4755
|
+
nextEl = makeElementsArray(nextEl);
|
|
4756
|
+
prevEl = makeElementsArray(prevEl);
|
|
4757
|
+
if (nextEl) {
|
|
4758
|
+
nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage));
|
|
4759
|
+
}
|
|
4760
|
+
if (prevEl) {
|
|
4761
|
+
prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage));
|
|
4762
|
+
}
|
|
4763
|
+
|
|
4764
|
+
// Pagination
|
|
4765
|
+
if (hasClickablePagination()) {
|
|
4766
|
+
const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
|
|
4767
|
+
paginationEl.forEach(el => {
|
|
4768
|
+
el.addEventListener('keydown', onEnterOrSpaceKey);
|
|
4769
|
+
});
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
// Tab focus
|
|
4773
|
+
swiper.el.addEventListener('focus', handleFocus, true);
|
|
4774
|
+
swiper.el.addEventListener('pointerdown', handlePointerDown, true);
|
|
4775
|
+
swiper.el.addEventListener('pointerup', handlePointerUp, true);
|
|
4776
|
+
};
|
|
4777
|
+
function destroy() {
|
|
4778
|
+
if (liveRegion) liveRegion.remove();
|
|
4779
|
+
let {
|
|
4780
|
+
nextEl,
|
|
4781
|
+
prevEl
|
|
4782
|
+
} = swiper.navigation ? swiper.navigation : {};
|
|
4783
|
+
nextEl = makeElementsArray(nextEl);
|
|
4784
|
+
prevEl = makeElementsArray(prevEl);
|
|
4785
|
+
if (nextEl) {
|
|
4786
|
+
nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
|
|
4787
|
+
}
|
|
4788
|
+
if (prevEl) {
|
|
4789
|
+
prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
|
|
4790
|
+
}
|
|
4791
|
+
|
|
4792
|
+
// Pagination
|
|
4793
|
+
if (hasClickablePagination()) {
|
|
4794
|
+
const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
|
|
4795
|
+
paginationEl.forEach(el => {
|
|
4796
|
+
el.removeEventListener('keydown', onEnterOrSpaceKey);
|
|
4797
|
+
});
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
// Tab focus
|
|
4801
|
+
swiper.el.removeEventListener('focus', handleFocus, true);
|
|
4802
|
+
swiper.el.removeEventListener('pointerdown', handlePointerDown, true);
|
|
4803
|
+
swiper.el.removeEventListener('pointerup', handlePointerUp, true);
|
|
4804
|
+
}
|
|
4805
|
+
on('beforeInit', () => {
|
|
4806
|
+
liveRegion = createElement('span', swiper.params.a11y.notificationClass);
|
|
4807
|
+
liveRegion.setAttribute('aria-live', 'assertive');
|
|
4808
|
+
liveRegion.setAttribute('aria-atomic', 'true');
|
|
4809
|
+
});
|
|
4810
|
+
on('afterInit', () => {
|
|
4811
|
+
if (!swiper.params.a11y.enabled) return;
|
|
4812
|
+
init();
|
|
4813
|
+
});
|
|
4814
|
+
on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {
|
|
4815
|
+
if (!swiper.params.a11y.enabled) return;
|
|
4816
|
+
initSlides();
|
|
4817
|
+
});
|
|
4818
|
+
on('fromEdge toEdge afterInit lock unlock', () => {
|
|
4819
|
+
if (!swiper.params.a11y.enabled) return;
|
|
4820
|
+
updateNavigation();
|
|
4821
|
+
});
|
|
4822
|
+
on('paginationUpdate', () => {
|
|
4823
|
+
if (!swiper.params.a11y.enabled) return;
|
|
4824
|
+
updatePagination();
|
|
4825
|
+
});
|
|
4826
|
+
on('destroy', () => {
|
|
4827
|
+
if (!swiper.params.a11y.enabled) return;
|
|
4828
|
+
destroy();
|
|
4829
|
+
});
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4832
|
+
const hyHeroCarouselCss = "@font-face{font-family:swiper-icons;src:url(\"data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}.swiper,swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{-webkit-transform:translate3d(0px, 0, 0);transform:translate3d(0px, 0, 0)}.swiper-horizontal{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-vertical{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-slide,swiper-slide{-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height, -webkit-transform;transition-property:height, -webkit-transform;transition-property:transform, height;transition-property:transform, height, -webkit-transform}.swiper-backface-hidden .swiper-slide{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{-webkit-perspective:1200px;perspective:1200px}.swiper-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d .swiper-slide,.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0, 0, 0, 0.15)}.swiper-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));background-image:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-horizontal.swiper-css-mode>.swiper-wrapper{-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:\"\";-ms-flex-negative:0;flex-shrink:0;-webkit-box-ordinal-group:10000;-ms-flex-order:9999;order:9999}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-start:var(--swiper-centered-offset-before);margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-before:var(--swiper-centered-offset-before);margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;transform-origin:50%;-webkit-box-sizing:border-box;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader,.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,swiper-container:not(.swiper-watch-progress) .swiper-lazy-preloader{-webkit-animation:swiper-preloader-spin 1s infinite linear;animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@-webkit-keyframes swiper-preloader-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes swiper-preloader-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.swiper-virtual .swiper-slide{-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0)}.swiper-virtual.swiper-css-mode .swiper-wrapper::after{content:\"\";position:absolute;left:0;top:0;pointer-events:none}.swiper-virtual.swiper-css-mode.swiper-horizontal .swiper-wrapper::after{height:1px;width:var(--swiper-virtual-size)}.swiper-virtual.swiper-css-mode.swiper-vertical .swiper-wrapper::after{width:1px;height:var(--swiper-virtual-size)}:root{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:var(--swiper-navigation-top-offset, 50%);width:calc(var(--swiper-navigation-size) / 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size) / 2));z-index:10;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:var(--swiper-navigation-color, var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:0.35;cursor:auto;pointer-events:none}.swiper-button-next.swiper-button-hidden,.swiper-button-prev.swiper-button-hidden{opacity:0;cursor:auto;pointer-events:none}.swiper-navigation-disabled .swiper-button-next,.swiper-navigation-disabled .swiper-button-prev{display:none !important}.swiper-button-next:after,.swiper-button-prev:after{font-family:swiper-icons;font-size:var(--swiper-navigation-size);text-transform:none !important;letter-spacing:0;font-variant:initial;line-height:1}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:var(--swiper-navigation-sides-offset, 10px);right:auto}.swiper-button-prev:after,.swiper-rtl .swiper-button-next:after{content:\"prev\"}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:var(--swiper-navigation-sides-offset, 10px);left:auto}.swiper-button-next:after,.swiper-rtl .swiper-button-prev:after{content:\"next\"}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:0.3s opacity;transition:0.3s opacity;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-pagination-disabled>.swiper-pagination,.swiper-pagination.swiper-pagination-disabled{display:none !important}.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:var(--swiper-pagination-bottom, 8px);top:var(--swiper-pagination-top, auto);left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(0.33);transform:scale(0.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{-webkit-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{-webkit-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(0.66);transform:scale(0.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(0.33);transform:scale(0.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(0.66);transform:scale(0.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(0.33);transform:scale(0.33)}.swiper-pagination-bullet{width:var(--swiper-pagination-bullet-width, var(--swiper-pagination-bullet-size, 8px));height:var(--swiper-pagination-bullet-height, var(--swiper-pagination-bullet-size, 8px));display:inline-block;border-radius:var(--swiper-pagination-bullet-border-radius, 50%);background:var(--swiper-pagination-bullet-inactive-color, #000);opacity:var(--swiper-pagination-bullet-inactive-opacity, 0.2)}button.swiper-pagination-bullet{border:none;margin:0;padding:0;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet:only-child{display:none !important}.swiper-pagination-bullet-active{opacity:var(--swiper-pagination-bullet-opacity, 1);background:var(--swiper-pagination-color, var(--swiper-theme-color))}.swiper-pagination-vertical.swiper-pagination-bullets,.swiper-vertical>.swiper-pagination-bullets{right:var(--swiper-pagination-right, 8px);left:var(--swiper-pagination-left, auto);top:50%;-webkit-transform:translate3d(0px, -50%, 0);transform:translate3d(0px, -50%, 0)}.swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:var(--swiper-pagination-bullet-vertical-gap, 6px) 0;display:block}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:8px}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;-webkit-transition:0.2s top, 0.2s -webkit-transform;transition:0.2s top, 0.2s -webkit-transform;transition:0.2s transform, 0.2s top;transition:0.2s transform, 0.2s top, 0.2s -webkit-transform}.swiper-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap, 4px)}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);white-space:nowrap}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:0.2s left, 0.2s -webkit-transform;transition:0.2s left, 0.2s -webkit-transform;transition:0.2s transform, 0.2s left;transition:0.2s transform, 0.2s left, 0.2s -webkit-transform}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,:host(.swiper-horizontal.swiper-rtl) .swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:0.2s right, 0.2s -webkit-transform;transition:0.2s right, 0.2s -webkit-transform;transition:0.2s transform, 0.2s right;transition:0.2s transform, 0.2s right, 0.2s -webkit-transform}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color, inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color, rgba(0, 0, 0, 0.25));position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color, var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:left top;transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:right top;transform-origin:right top}.swiper-horizontal>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-horizontal,.swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite,.swiper-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:var(--swiper-pagination-progressbar-size, 4px);left:0;top:0}.swiper-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-vertical,.swiper-vertical>.swiper-pagination-progressbar{width:var(--swiper-pagination-progressbar-size, 4px);height:100%;left:0;top:0}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:var(--swiper-scrollbar-border-radius, 10px);position:relative;-ms-touch-action:none;background:var(--swiper-scrollbar-bg-color, rgba(0, 0, 0, 0.1))}.swiper-scrollbar-disabled>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-disabled{display:none !important}.swiper-horizontal>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-horizontal{position:absolute;left:var(--swiper-scrollbar-sides-offset, 1%);bottom:var(--swiper-scrollbar-bottom, 4px);top:var(--swiper-scrollbar-top, auto);z-index:50;height:var(--swiper-scrollbar-size, 4px);width:calc(100% - 2 * var(--swiper-scrollbar-sides-offset, 1%))}.swiper-scrollbar.swiper-scrollbar-vertical,.swiper-vertical>.swiper-scrollbar{position:absolute;left:var(--swiper-scrollbar-left, auto);right:var(--swiper-scrollbar-right, 4px);top:var(--swiper-scrollbar-sides-offset, 1%);z-index:50;width:var(--swiper-scrollbar-size, 4px);height:calc(100% - 2 * var(--swiper-scrollbar-sides-offset, 1%))}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:var(--swiper-scrollbar-drag-bg-color, rgba(0, 0, 0, 0.5));border-radius:var(--swiper-scrollbar-border-radius, 10px);left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.swiper-slide-zoomed{cursor:move;-ms-touch-action:none;touch-action:none}.swiper .swiper-notification,swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-grid>.swiper-wrapper{-ms-flex-wrap:wrap;flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.swiper-fade.swiper-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;transition-property:opacity}.swiper-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-fade .swiper-slide-active,.swiper-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-cube{overflow:visible}.swiper-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;-webkit-transform-origin:0 0;transform-origin:0 0;width:100%;height:100%}.swiper-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-cube.swiper-rtl .swiper-slide{-webkit-transform-origin:100% 0;transform-origin:100% 0}.swiper-cube .swiper-slide-active,.swiper-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-cube .swiper-slide-active,.swiper-cube .swiper-slide-next,.swiper-cube .swiper-slide-next+.swiper-slide,.swiper-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-cube .swiper-slide-shadow-bottom,.swiper-cube .swiper-slide-shadow-left,.swiper-cube .swiper-slide-shadow-right,.swiper-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0px;width:100%;height:100%;opacity:0.6;z-index:0}.swiper-cube .swiper-cube-shadow:before{content:\"\";background:#000;position:absolute;left:0;top:0;bottom:0;right:0;-webkit-filter:blur(50px);filter:blur(50px)}.swiper-flip{overflow:visible}.swiper-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-flip .swiper-slide-active,.swiper-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-flip .swiper-slide-shadow-bottom,.swiper-flip .swiper-slide-shadow-left,.swiper-flip .swiper-slide-shadow-right,.swiper-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-creative .swiper-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden;-webkit-transition-property:opacity, height, -webkit-transform;transition-property:opacity, height, -webkit-transform;transition-property:transform, opacity, height;transition-property:transform, opacity, height, -webkit-transform}.swiper-cards{overflow:visible}.swiper-cards .swiper-slide{-webkit-transform-origin:center bottom;transform-origin:center bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden}:root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}:host{display:block}.hero-carousel-container{border-bottom:1px solid var(--grayscale-medium-dark);margin:1.5rem 1rem;--button-size:35px;--button-offset:0px}@media (min-width: 60rem){.hero-carousel-container{border:none;margin:1.5rem 0 0 0;min-height:600px}.hero-carousel-container .swiper{padding:0 10px}}.hero-carousel-container .swiper-button-prev,.hero-carousel-container .swiper-button-next{-webkit-box-align:center;-ms-flex-align:center;align-items:center;aspect-ratio:1;background-color:none;border:none;-webkit-box-shadow:none;box-shadow:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:var(--button-size);z-index:9}@media (min-width: 60rem){.hero-carousel-container .swiper-button-prev,.hero-carousel-container .swiper-button-next{background-color:var(--brand-main-light);width:40px}.hero-carousel-container .swiper-button-prev:hover,.hero-carousel-container .swiper-button-next:hover{background-color:var(--brand-main-active)}}.hero-carousel-container .swiper-button-prev::after,.hero-carousel-container .swiper-button-next::after{display:none}@media (min-width: 60rem){.hero-carousel-container .swiper-button-next{bottom:50%;position:absolute;right:var(--button-offset);-webkit-transform:translateY(-50%);transform:translateY(-50%)}}@media (min-width: 60rem){.hero-carousel-container .swiper-button-prev{bottom:50%;left:var(--button-offset);position:absolute;-webkit-transform:translateY(-50%);transform:translateY(-50%)}}.hero-carousel-container .arrow svg{display:none}@media (min-width: 60rem){.hero-carousel-container .arrow svg{display:block}}.hero-carousel-container .caret svg{display:block}@media (min-width: 60rem){.hero-carousel-container .caret svg{display:none}}.hero-carousel-container svg{fill:var(--grayscale-medium-dark);height:16px;width:16px}@media (min-width: 60rem){.hero-carousel-container svg{fill:var(--grayscale-white)}}.hero-carousel--controls{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin:30px 0;position:relative;width:100%}@media (min-width: 60rem){.hero-carousel--controls{display:block;margin:0;position:initial;width:auto}}.hero-carousel--pagination--mobile{bottom:auto !important;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;gap:12px;left:auto !important;position:relative;top:auto !important;width:100px !important}@media (min-width: 60rem){.hero-carousel--pagination--mobile{display:none}}.hero-carousel--controls__buttons{position:relative;margin-right:-15px;width:100px}@media (min-width: 60rem){.hero-carousel--controls__buttons{margin:0;position:initial;width:auto}}.hero-carousel--pagination__bullet{background-color:var(--grayscale-medium);content:\"\";display:block;height:12px;width:12px}.hero-carousel--pagination__bullet--active{background-color:var(--brand-main-active)}.hero-carousel--item__pagination ul{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;display:none;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;list-style-type:none;margin:24px 0 0 0;padding:0}@media (min-width: 60rem){.hero-carousel--item__pagination ul{display:-webkit-box;display:-ms-flexbox;display:flex}}.hero-carousel--item__pagination ul li.hero-carousel--item__pagination__button button{font-size:1.125rem;line-height:24px;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;background:none;border:none;-webkit-box-shadow:none;box-shadow:none;color:var(--grayscale-white);display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--main-font-family);font-style:normal;font-weight:700;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;letter-spacing:-0.36px;opacity:0.25;text-align:left}.hero-carousel--item__pagination ul li.hero-carousel--item__pagination__button button:is(:hover,:focus){cursor:pointer;opacity:0.5}.hero-carousel--item__pagination ul li.hero-carousel--item__pagination__button button .hero-carousel--item__pagination__button__theme{font-size:0.875rem;line-height:18px;font-family:var(--main-font-family);font-weight:600;letter-spacing:-0.5px;text-transform:uppercase;text-align:left;margin-bottom:0.4rem}.hero-carousel--item__pagination ul li.hero-carousel--item__pagination__button.is-current button{opacity:1}.hero-carousel--item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}@media (min-width: 60rem){.hero-carousel--item{display:grid;grid-template-columns:1fr 1fr}}.hero-carousel--item__content{background-color:var(--brand-main);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding:1rem 0.95rem}@media (min-width: 60rem){.hero-carousel--item__content{padding:clamp(15px, 10%, 72px) clamp(24px, 15%, 102px) clamp(15px, 10%, 65px) clamp(24px, 15%, 102px)}}.hero-carousel--item__content hy-cta-button{margin-bottom:30px}@media (min-width: 60rem){.hero-carousel--item__content hy-cta-button{margin-bottom:60px}}.hero-carousel--item__title{font-size:26px;line-height:32px;color:var(--grayscale-white);font-family:var(--main-font-family);font-weight:700;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;letter-spacing:-0.5px;margin:1rem 0;text-transform:uppercase}@media (min-width: 480px){.hero-carousel--item__title{font-size:calc(\n 26px + 28 * (100vw - 480px) / 1120\n )}}@media (min-width: 1600px){.hero-carousel--item__title{font-size:54px}}@media (min-width: 480px){.hero-carousel--item__title{line-height:calc(\n 32px + 28 * (100vw - 480px) / 1120\n )}}@media (min-width: 1600px){.hero-carousel--item__title{line-height:60px}}.hero-carousel--item__desc{font-size:0.9375rem;line-height:22px;-webkit-box-orient:vertical;-webkit-line-clamp:5;color:var(--grayscale-white);display:-webkit-box;font-family:var(--main-font-family);font-style:normal;line-clamp:3;margin-bottom:2rem;overflow:hidden;text-overflow:ellipsis}@media (min-width: 60rem){.hero-carousel--item__desc{font-size:1.0625rem;line-height:26px;font-weight:400;margin-bottom:2.5rem}}@media (min-width: 60rem){.hero-carousel--item__image{margin:10px 0}}.hero-carousel--item__image img{-o-object-fit:cover;object-fit:cover}";
|
|
4833
|
+
|
|
4834
|
+
const HyHeroCarousel$1 = /*@__PURE__*/ proxyCustomElement(class HyHeroCarousel extends HTMLElement$1 {
|
|
4835
|
+
constructor() {
|
|
4836
|
+
super();
|
|
4837
|
+
this.__registerHost();
|
|
4838
|
+
this.itemCount = undefined;
|
|
4839
|
+
this.ariaLabelNext = "Next slide";
|
|
4840
|
+
this.ariaLabelPrev = "Previous slide";
|
|
4841
|
+
this.ariaLabelFirstSlide = "This is the first slide";
|
|
4842
|
+
this.ariaLabelLastSlide = "This is the first slide";
|
|
4843
|
+
this.ariaLabelBulletMessage = "Go to slide";
|
|
4844
|
+
this.data = undefined;
|
|
4845
|
+
}
|
|
4846
|
+
async componentWillLoad() {
|
|
4847
|
+
this._data = await jsonParserWorker(this.data);
|
|
4848
|
+
}
|
|
4849
|
+
componentDidLoad() {
|
|
4850
|
+
new Swiper(".swiper", {
|
|
4851
|
+
modules: [Navigation, Pagination, A11y],
|
|
4852
|
+
enabled: true,
|
|
4853
|
+
direction: "horizontal",
|
|
4854
|
+
loop: true,
|
|
4855
|
+
spaceBetween: 50,
|
|
4856
|
+
navigation: {
|
|
4857
|
+
nextEl: ".swiper-button-next",
|
|
4858
|
+
prevEl: ".swiper-button-prev",
|
|
4859
|
+
},
|
|
4860
|
+
pagination: {
|
|
4861
|
+
el: ".swiper-pagination",
|
|
4862
|
+
bulletClass: "hero-carousel--pagination__bullet",
|
|
4863
|
+
bulletActiveClass: "hero-carousel--pagination__bullet--active",
|
|
4864
|
+
clickable: true,
|
|
4865
|
+
renderBullet: function (index, className) {
|
|
4866
|
+
return `<span aria-label="${this.ariaLabelBulletMessage} ${index}" data-index="${index}" class="${className}"></span>`;
|
|
4867
|
+
},
|
|
4868
|
+
},
|
|
4869
|
+
a11y: {
|
|
4870
|
+
enabled: true,
|
|
4871
|
+
firstSlideMessage: this.ariaLabelFirstSlide,
|
|
4872
|
+
lastSlideMessage: this.ariaLabelLastSlide,
|
|
4873
|
+
nextSlideMessage: this.ariaLabelNext,
|
|
4874
|
+
prevSlideMessage: this.ariaLabelPrev,
|
|
4875
|
+
paginationBulletMessage: `${this.ariaLabelBulletMessage} {{index}}`,
|
|
4876
|
+
},
|
|
4877
|
+
});
|
|
4878
|
+
}
|
|
4879
|
+
handleSlideChangeFromButtons(index) {
|
|
4880
|
+
const swiperEl = document.querySelector(".swiper");
|
|
4881
|
+
swiperEl.swiper.slideTo(index, 300, null);
|
|
4882
|
+
}
|
|
4883
|
+
render() {
|
|
4884
|
+
const carouselContentClasses = ["hero-carousel--item__content", this.itemCount > 1 ? "has-pagination" : ""].join(" ");
|
|
4885
|
+
return (h("div", { class: "hero-carousel-container" }, h("div", { class: "swiper" }, h("div", { class: "swiper-wrapper" }, this._data["items"] &&
|
|
4886
|
+
this._data["items"].map((i, index) => {
|
|
4887
|
+
const currentIndex = index;
|
|
4888
|
+
const srcSet = JSON.parse(i.image_sources);
|
|
4889
|
+
return (h("div", { class: "swiper-slide", "data-title": i.title, "data-desc": i.desc }, h("div", { class: "swiper-slide hero-carousel--item" }, h("div", { class: carouselContentClasses }, h("h2", { class: "hero-carousel--item__title" }, i.title), h("div", { class: "hero-carousel--item__desc" }, i.desc), i.uri && (h("hy-cta-button", { "link-content": i.uri_title, "sc-label": i.uri_title, url: i.uri, "is-external": "false", variant: CtaLinkButtonVariants.heroBlue })), this.itemCount > 1 ? (h("div", { class: "hero-carousel--item__pagination" }, h("ul", null, this._data["items"].map((i, index) => {
|
|
4890
|
+
const paginationButtonClasses = [
|
|
4891
|
+
"hero-carousel--item__pagination__button",
|
|
4892
|
+
index === currentIndex ? "is-current" : "",
|
|
4893
|
+
].join(" ");
|
|
4894
|
+
return (h("li", { class: paginationButtonClasses }, h("button", { "aria-label": `${this.ariaLabelBulletMessage} ${index}`, onClick: () => this.handleSlideChangeFromButtons(index), "data-index": index, "aria-current": index === currentIndex ? "true" : "false" }, h("span", { class: "hero-carousel--item__pagination__button__theme" }, i.theme_text), i.title)));
|
|
4895
|
+
})))) : null), h("div", { class: "hero-carousel--item__image" }, srcSet.length > 0 ? (h("picture", null, srcSet.map((item) => (h("source", { srcSet: item.src, media: item.media, type: item.type, sizes: item.sizes ? item.sizes : "" }))), h("img", { "aria-hidden": "true", loading: "eager", alt: i.image_alt, class: `hy-image__image`, src: i.image_fallback }))) : (h("img", { "aria-hidden": "true", loading: "eager", alt: i.image_alt, class: `hy-image__image`, src: i.image_fallback }))))));
|
|
4896
|
+
})), this.itemCount > 1 ? (h("div", { class: "hero-carousel--controls" }, h("div", { class: "swiper-pagination hero-carousel--pagination--mobile" }), h("div", { class: "hero-carousel--controls__buttons" }, h("div", { class: "swiper-button-prev" }, h("hy-icon", { class: "arrow", icon: "hy-icon-arrow-left" }), h("hy-icon", { class: "caret", icon: "hy-icon-caret-left" })), h("div", { class: "swiper-button-next" }, h("hy-icon", { class: "arrow", icon: "hy-icon-arrow-right" }), h("hy-icon", { class: "caret", icon: "hy-icon-caret-right" }))))) : null)));
|
|
4897
|
+
}
|
|
4898
|
+
static get style() { return hyHeroCarouselCss; }
|
|
4899
|
+
}, [0, "hy-hero-carousel", {
|
|
4900
|
+
"itemCount": [2, "item-count"],
|
|
4901
|
+
"ariaLabelNext": [1, "aria-label-next"],
|
|
4902
|
+
"ariaLabelPrev": [1, "aria-label-prev"],
|
|
4903
|
+
"ariaLabelFirstSlide": [1, "aria-label-first-slide"],
|
|
4904
|
+
"ariaLabelLastSlide": [1, "aria-label-last-slide"],
|
|
4905
|
+
"ariaLabelBulletMessage": [1, "aria-label-bullet-message"],
|
|
4906
|
+
"data": [1]
|
|
4907
|
+
}]);
|
|
4908
|
+
function defineCustomElement$1() {
|
|
4909
|
+
if (typeof customElements === "undefined") {
|
|
4910
|
+
return;
|
|
4911
|
+
}
|
|
4912
|
+
const components = ["hy-hero-carousel", "hy-cta-button", "hy-icon"];
|
|
4913
|
+
components.forEach(tagName => { switch (tagName) {
|
|
4914
|
+
case "hy-hero-carousel":
|
|
4915
|
+
if (!customElements.get(tagName)) {
|
|
4916
|
+
customElements.define(tagName, HyHeroCarousel$1);
|
|
4917
|
+
}
|
|
4918
|
+
break;
|
|
4919
|
+
case "hy-cta-button":
|
|
4920
|
+
if (!customElements.get(tagName)) {
|
|
4921
|
+
defineCustomElement$3();
|
|
4922
|
+
}
|
|
4923
|
+
break;
|
|
4924
|
+
case "hy-icon":
|
|
4925
|
+
if (!customElements.get(tagName)) {
|
|
4926
|
+
defineCustomElement$2();
|
|
4927
|
+
}
|
|
4928
|
+
break;
|
|
4929
|
+
} });
|
|
4930
|
+
}
|
|
4931
|
+
|
|
4932
|
+
const HyHeroCarousel = HyHeroCarousel$1;
|
|
4933
|
+
const defineCustomElement = defineCustomElement$1;
|
|
4934
|
+
|
|
4935
|
+
export { HyHeroCarousel, defineCustomElement };
|