@nanoporetech-digital/components 5.10.0 → 5.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/dist/cjs/{algolia-data-6841724e.js → algolia-data-dba27b97.js} +2 -2
- package/dist/cjs/{algolia-data-6841724e.js.map → algolia-data-dba27b97.js.map} +1 -1
- package/dist/cjs/{algoliasearch-lite.esm.browser-992a2eff.js → algoliasearch-lite.esm.browser-b74ca774.js} +30 -5
- package/dist/cjs/algoliasearch-lite.esm.browser-b74ca774.js.map +1 -0
- package/dist/cjs/{component-store-6d7b8855.js → component-store-149aeffe.js} +2 -2
- package/dist/cjs/{component-store-6d7b8855.js.map → component-store-149aeffe.js.map} +1 -1
- package/dist/cjs/fade-dcabf3c1.js +211 -0
- package/dist/cjs/fade-dcabf3c1.js.map +1 -0
- package/dist/cjs/{form-control-8db579a2.js → form-control-f100407e.js} +2 -2
- package/dist/cjs/{form-control-8db579a2.js.map → form-control-f100407e.js.map} +1 -1
- package/dist/cjs/fullscreen-d24940a1.js +133 -0
- package/dist/cjs/fullscreen-d24940a1.js.map +1 -0
- package/dist/cjs/{global-3a6a7873.js → global-a5710651.js} +7 -7
- package/dist/cjs/{global-3a6a7873.js.map → global-a5710651.js.map} +1 -1
- package/dist/cjs/{index-1d3ebe1a.js → index-14451c95.js} +8 -6
- package/dist/cjs/index-14451c95.js.map +1 -0
- package/dist/cjs/{index-0f470227.js → index-f6f89d47.js} +2 -2
- package/dist/cjs/{index-0f470227.js.map → index-f6f89d47.js.map} +1 -1
- package/dist/cjs/lazyload-f6be7590.js +95 -0
- package/dist/cjs/lazyload-f6be7590.js.map +1 -0
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/nano-accordion.cjs.entry.js +1 -1
- package/dist/cjs/nano-alert.cjs.entry.js +3 -3
- package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia-filter.cjs.entry.js +3 -3
- package/dist/cjs/nano-algolia-filter.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia-pagination.cjs.entry.js +2 -7
- package/dist/cjs/nano-algolia-pagination.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia-results.cjs.entry.js +2 -2
- package/dist/cjs/nano-algolia-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia.cjs.entry.js +982 -26
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-aspect-ratio.cjs.entry.js +1 -1
- package/dist/cjs/nano-checkbox-group.cjs.entry.js +10 -4
- package/dist/cjs/nano-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-checkbox.cjs.entry.js +4 -2
- package/dist/cjs/nano-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-components.cjs.js +4 -4
- package/dist/cjs/nano-components.cjs.js.map +1 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js +4 -4
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-input.cjs.entry.js +1 -1
- package/dist/cjs/nano-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/nano-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-demo.cjs.entry.js +1 -1
- package/dist/cjs/nano-details.cjs.entry.js +2 -2
- package/dist/cjs/nano-details.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js +5 -5
- package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-drawer.cjs.entry.js +5 -5
- package/dist/cjs/nano-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-field-validator.cjs.entry.js +7 -5
- package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-file-upload.cjs.entry.js +2 -2
- package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +4 -4
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +122 -153
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +4 -4
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-grid-item.cjs.entry.js +1 -1
- package/dist/cjs/nano-grid_2.cjs.entry.js +2 -2
- package/dist/cjs/nano-grid_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js +2 -2
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button_2.cjs.entry.js +24 -4
- package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon.cjs.entry.js +4 -4
- package/dist/cjs/nano-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-input.cjs.entry.js +3 -3
- package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-menu-drawer.cjs.entry.js +2 -2
- package/dist/cjs/nano-menu-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-overflow-nav.cjs.entry.js +2 -2
- package/dist/cjs/nano-overflow-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-progress-bar.cjs.entry.js +2 -2
- package/dist/cjs/nano-progress-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-range.cjs.entry.js +2 -2
- package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-rating.cjs.entry.js +2 -2
- package/dist/cjs/nano-rating.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js +1 -1
- package/dist/cjs/nano-slide.cjs.entry.js +1 -1
- package/dist/cjs/nano-slides-2f3dcc02.js +2975 -0
- package/dist/cjs/nano-slides-2f3dcc02.js.map +1 -0
- package/dist/cjs/nano-slides.cjs.entry.js +3 -4292
- package/dist/cjs/nano-slides.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sortable.cjs.entry.js +1 -1
- package/dist/cjs/nano-spinner.cjs.entry.js +2 -2
- package/dist/cjs/nano-spinner.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-split-pane.cjs.entry.js +1 -1
- package/dist/cjs/nano-sticker.cjs.entry.js +3 -2
- package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-content.cjs.entry.js +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +4 -4
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js +2 -2
- package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-72d5dc63.js → nano-table-bbd65636.js} +5 -5
- package/dist/cjs/{nano-table-72d5dc63.js.map → nano-table-bbd65636.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +3 -3
- package/dist/cjs/page-dots-ae2cefb4.js +140 -0
- package/dist/cjs/page-dots-ae2cefb4.js.map +1 -0
- package/dist/cjs/{scroll-fc1b8387.js → scroll-e8c21f80.js} +8 -4
- package/dist/cjs/scroll-e8c21f80.js.map +1 -0
- package/dist/cjs/{table.worker-3df34efe.js → table.worker-ea98a8dd.js} +4 -4
- package/dist/cjs/table.worker-ea98a8dd.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/alert/alert.css +1 -2
- package/dist/collection/components/algolia/algolia-data.js.map +1 -1
- package/dist/collection/components/algolia/algolia-filter.js.map +1 -1
- package/dist/collection/components/algolia/algolia-pagination.js +0 -5
- package/dist/collection/components/algolia/algolia-pagination.js.map +1 -1
- package/dist/collection/components/algolia/algolia-results.js.map +1 -1
- package/dist/collection/components/algolia/algolia.js +4 -27
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- package/dist/collection/components/algolia/lib/squirrelly/browser.js +10 -0
- package/dist/collection/components/algolia/lib/squirrelly/browser.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/compile-string.js +151 -0
- package/dist/collection/components/algolia/lib/squirrelly/compile-string.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/compile.js +44 -0
- package/dist/collection/components/algolia/lib/squirrelly/compile.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/config.js +68 -0
- package/dist/collection/components/algolia/lib/squirrelly/config.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/container-utils.js +57 -0
- package/dist/collection/components/algolia/lib/squirrelly/container-utils.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/containers.js +128 -0
- package/dist/collection/components/algolia/lib/squirrelly/containers.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/err.js +39 -0
- package/dist/collection/components/algolia/lib/squirrelly/err.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/parse.js +327 -0
- package/dist/collection/components/algolia/lib/squirrelly/parse.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/render.js +62 -0
- package/dist/collection/components/algolia/lib/squirrelly/render.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/storage.js +32 -0
- package/dist/collection/components/algolia/lib/squirrelly/storage.js.map +1 -0
- package/dist/collection/components/algolia/lib/squirrelly/utils.js +102 -0
- package/dist/collection/components/algolia/lib/squirrelly/utils.js.map +1 -0
- package/dist/collection/{utils → components/algolia/lib}/template.js +1 -2
- package/dist/collection/components/algolia/lib/template.js.map +1 -0
- package/dist/collection/components/checkbox/checkbox-group.css +17 -15
- package/dist/collection/components/checkbox/checkbox-group.js +29 -2
- package/dist/collection/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.css +20 -22
- package/dist/collection/components/checkbox/checkbox.js +2 -0
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/date-picker/date-picker.css +5 -10
- package/dist/collection/components/details/details.css +4 -4
- package/dist/collection/components/dialog/dialog.css +3 -6
- package/dist/collection/components/dialog/dialog.js +1 -1
- package/dist/collection/components/dialog/dialog.js.map +1 -1
- package/dist/collection/components/drawer/drawer.css +18 -24
- package/dist/collection/components/drawer/drawer.js +1 -1
- package/dist/collection/components/drawer/drawer.js.map +1 -1
- package/dist/collection/components/dropdown/dropdown.js +1 -1
- package/dist/collection/components/dropdown/dropdown.js.map +1 -1
- package/dist/collection/components/field-validator/field-validator.js +5 -3
- package/dist/collection/components/field-validator/field-validator.js.map +1 -1
- package/dist/collection/components/file-upload/file-upload.css +16 -30
- package/dist/collection/components/global-nav/global-nav.js +118 -157
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-nav/style/global-nav.css +97 -138
- package/dist/collection/components/global-search-results/global-search-results.css +85 -127
- package/dist/collection/components/global-search-results/global-search-results.js +2 -2
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/hero/hero.css +13 -26
- package/dist/collection/components/icon/icon.css +6 -6
- package/dist/collection/components/icon/icon.js +2 -2
- package/dist/collection/components/icon/icon.js.map +1 -1
- package/dist/collection/components/img/img.css +7 -17
- package/dist/collection/components/input/input.css +15 -36
- package/dist/collection/components/menu/menu.css +1 -1
- package/dist/collection/components/menu/menu.js +1 -1
- package/dist/collection/components/menu/menu.js.map +1 -1
- package/dist/collection/components/menu-drawer/menu-drawer.css +5 -14
- package/dist/collection/components/nav-item/nav-item.css +25 -46
- package/dist/collection/components/option/option.css +3 -5
- package/dist/collection/components/overflow-nav/overflow-nav.css +16 -27
- package/dist/collection/components/progress-bar/progress-bar.css +2 -2
- package/dist/collection/components/range/range.css +17 -19
- package/dist/collection/components/rating/rating.css +2 -8
- package/dist/collection/components/select/select.css +30 -53
- package/dist/collection/components/slides/lib/js/animate.js +29 -54
- package/dist/collection/components/slides/lib/js/animate.js.map +1 -0
- package/dist/collection/components/slides/lib/js/cell.js +12 -24
- package/dist/collection/components/slides/lib/js/cell.js.map +1 -0
- package/dist/collection/components/slides/lib/js/drag.js +65 -116
- package/dist/collection/components/slides/lib/js/drag.js.map +1 -0
- package/dist/collection/components/slides/lib/js/fade.js +52 -79
- package/dist/collection/components/slides/lib/js/fade.js.map +1 -0
- package/dist/collection/components/slides/lib/js/flickity.js +118 -206
- package/dist/collection/components/slides/lib/js/flickity.js.map +1 -0
- package/dist/collection/components/slides/lib/js/fullscreen.js +21 -40
- package/dist/collection/components/slides/lib/js/fullscreen.js.map +1 -0
- package/dist/collection/components/slides/lib/js/index.js +4 -6
- package/dist/collection/components/slides/lib/js/index.js.map +1 -0
- package/dist/collection/components/slides/lib/js/lazyload.js +21 -36
- package/dist/collection/components/slides/lib/js/lazyload.js.map +1 -0
- package/dist/collection/components/slides/lib/js/page-dots.js +21 -45
- package/dist/collection/components/slides/lib/js/page-dots.js.map +1 -0
- package/dist/collection/components/slides/lib/js/player.js +12 -40
- package/dist/collection/components/slides/lib/js/player.js.map +1 -0
- package/dist/collection/components/slides/lib/js/prev-next-button.js +24 -52
- package/dist/collection/components/slides/lib/js/prev-next-button.js.map +1 -0
- package/dist/collection/components/slides/lib/js/slide.js +10 -15
- package/dist/collection/components/slides/lib/js/slide.js.map +1 -0
- package/dist/collection/components/slides/lib/js/utils/event-emitter.js +75 -0
- package/dist/collection/components/slides/lib/js/utils/event-emitter.js.map +1 -0
- package/dist/collection/components/slides/lib/js/utils/gestures.js +436 -0
- package/dist/collection/components/slides/lib/js/utils/gestures.js.map +1 -0
- package/dist/collection/components/slides/lib/js/utils/get-size.js +160 -0
- package/dist/collection/components/slides/lib/js/utils/get-size.js.map +1 -0
- package/dist/collection/components/slides/lib/js/utils/utils.js +166 -0
- package/dist/collection/components/slides/lib/js/utils/utils.js.map +1 -0
- package/dist/collection/components/slides/slides.css +18 -19
- package/dist/collection/components/slides/slides.js +31 -5
- package/dist/collection/components/slides/slides.js.map +1 -1
- package/dist/collection/components/spinner/spinner.css +1 -2
- package/dist/collection/components/sticker/sticker.js +2 -1
- package/dist/collection/components/sticker/sticker.js.map +1 -1
- package/dist/collection/components/table/table.css +29 -48
- package/dist/collection/components/tabs/tab-group.css +10 -14
- package/dist/collection/components/tabs/tab.css +8 -18
- package/dist/collection/components/tooltip/tooltip.css +34 -31
- package/dist/collection/components/tooltip/tooltip.js +23 -3
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/collection/global/script/global.js +6 -6
- package/dist/collection/global/script/global.js.map +1 -1
- package/dist/collection/utils/scroll.js +7 -3
- package/dist/collection/utils/scroll.js.map +1 -1
- package/dist/components/algolia-data.js.map +1 -1
- package/dist/components/algolia.js +978 -23
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/algoliasearch-lite.esm.browser.js +29 -4
- package/dist/components/algoliasearch-lite.esm.browser.js.map +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/fade.js +208 -0
- package/dist/components/fade.js.map +1 -0
- package/dist/components/fullscreen.js +130 -0
- package/dist/components/fullscreen.js.map +1 -0
- package/dist/components/icon.js +3 -3
- package/dist/components/icon.js.map +1 -1
- package/dist/components/img.js +1 -1
- package/dist/components/img.js.map +1 -1
- package/dist/components/index.js +6 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/lazyload.js +92 -0
- package/dist/components/lazyload.js.map +1 -0
- package/dist/components/menu.js +2 -2
- package/dist/components/menu.js.map +1 -1
- package/dist/components/nano-alert.js +1 -1
- package/dist/components/nano-alert.js.map +1 -1
- package/dist/components/nano-algolia-filter.js.map +1 -1
- package/dist/components/nano-algolia-pagination.js +0 -5
- package/dist/components/nano-algolia-pagination.js.map +1 -1
- package/dist/components/nano-algolia-results.js.map +1 -1
- package/dist/components/nano-checkbox-group.js +10 -3
- package/dist/components/nano-checkbox-group.js.map +1 -1
- package/dist/components/nano-checkbox.js +3 -1
- package/dist/components/nano-checkbox.js.map +1 -1
- package/dist/components/nano-details.js +1 -1
- package/dist/components/nano-details.js.map +1 -1
- package/dist/components/nano-dialog.js +2 -2
- package/dist/components/nano-dialog.js.map +1 -1
- package/dist/components/nano-drawer.js +2 -2
- package/dist/components/nano-drawer.js.map +1 -1
- package/dist/components/nano-field-validator.js +5 -3
- package/dist/components/nano-field-validator.js.map +1 -1
- package/dist/components/nano-file-upload.js +1 -1
- package/dist/components/nano-file-upload.js.map +1 -1
- package/dist/components/nano-global-nav.js +119 -152
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +3 -3
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-hero.js +1 -1
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-menu-drawer.js +1 -1
- package/dist/components/nano-menu-drawer.js.map +1 -1
- package/dist/components/nano-overflow-nav.js +1 -1
- package/dist/components/nano-overflow-nav.js.map +1 -1
- package/dist/components/nano-range.js +1 -1
- package/dist/components/nano-range.js.map +1 -1
- package/dist/components/nano-rating.js +1 -1
- package/dist/components/nano-rating.js.map +1 -1
- package/dist/components/nano-slides.js +760 -2090
- package/dist/components/nano-slides.js.map +1 -1
- package/dist/components/nano-tab-group.js +1 -1
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/nano-tab.js +1 -1
- package/dist/components/nano-tab.js.map +1 -1
- package/dist/components/nav-item.js +1 -1
- package/dist/components/nav-item.js.map +1 -1
- package/dist/components/option.js +1 -1
- package/dist/components/option.js.map +1 -1
- package/dist/components/page-dots.js +137 -0
- package/dist/components/page-dots.js.map +1 -0
- package/dist/components/progress-bar.js +1 -1
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/scroll.js +7 -3
- package/dist/components/scroll.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/sticker.js +2 -1
- package/dist/components/sticker.js.map +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tooltip.js +24 -4
- package/dist/components/tooltip.js.map +1 -1
- package/dist/esm/{algolia-data-ebf2a439.js → algolia-data-1b42827c.js} +2 -2
- package/dist/esm/{algolia-data-ebf2a439.js.map → algolia-data-1b42827c.js.map} +1 -1
- package/dist/esm/{algoliasearch-lite.esm.browser-04891fdc.js → algoliasearch-lite.esm.browser-d71a28dc.js} +30 -5
- package/dist/esm/algoliasearch-lite.esm.browser-d71a28dc.js.map +1 -0
- package/dist/esm/{component-store-54df2005.js → component-store-f7eb0a56.js} +2 -2
- package/dist/esm/{component-store-54df2005.js.map → component-store-f7eb0a56.js.map} +1 -1
- package/dist/esm/fade-1aa7a6db.js +209 -0
- package/dist/esm/fade-1aa7a6db.js.map +1 -0
- package/dist/esm/{form-control-eb06e009.js → form-control-881fa3af.js} +2 -2
- package/dist/esm/{form-control-eb06e009.js.map → form-control-881fa3af.js.map} +1 -1
- package/dist/esm/fullscreen-86fa276a.js +131 -0
- package/dist/esm/fullscreen-86fa276a.js.map +1 -0
- package/dist/esm/{global-f6e05656.js → global-be484e8c.js} +7 -7
- package/dist/esm/{global-f6e05656.js.map → global-be484e8c.js.map} +1 -1
- package/dist/esm/{index-e8891229.js → index-3003356f.js} +2 -2
- package/dist/esm/{index-e8891229.js.map → index-3003356f.js.map} +1 -1
- package/dist/esm/{index-06666022.js → index-9695db0a.js} +8 -6
- package/dist/esm/index-9695db0a.js.map +1 -0
- package/dist/esm/lazyload-994232a6.js +93 -0
- package/dist/esm/lazyload-994232a6.js.map +1 -0
- package/dist/esm/loader.js +5 -5
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/nano-accordion.entry.js +1 -1
- package/dist/esm/nano-alert.entry.js +3 -3
- package/dist/esm/nano-alert.entry.js.map +1 -1
- package/dist/esm/nano-algolia-filter.entry.js +3 -3
- package/dist/esm/nano-algolia-filter.entry.js.map +1 -1
- package/dist/esm/nano-algolia-pagination.entry.js +2 -7
- package/dist/esm/nano-algolia-pagination.entry.js.map +1 -1
- package/dist/esm/nano-algolia-results.entry.js +2 -2
- package/dist/esm/nano-algolia-results.entry.js.map +1 -1
- package/dist/esm/nano-algolia.entry.js +982 -26
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-aspect-ratio.entry.js +1 -1
- package/dist/esm/nano-checkbox-group.entry.js +10 -4
- package/dist/esm/nano-checkbox-group.entry.js.map +1 -1
- package/dist/esm/nano-checkbox.entry.js +4 -2
- package/dist/esm/nano-checkbox.entry.js.map +1 -1
- package/dist/esm/nano-components.js +5 -5
- package/dist/esm/nano-components.js.map +1 -1
- package/dist/esm/nano-datalist_3.entry.js +4 -4
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-date-input.entry.js +1 -1
- package/dist/esm/nano-date-picker.entry.js +2 -2
- package/dist/esm/nano-date-picker.entry.js.map +1 -1
- package/dist/esm/nano-demo.entry.js +1 -1
- package/dist/esm/nano-details.entry.js +2 -2
- package/dist/esm/nano-details.entry.js.map +1 -1
- package/dist/esm/nano-dialog.entry.js +5 -5
- package/dist/esm/nano-dialog.entry.js.map +1 -1
- package/dist/esm/nano-drawer.entry.js +5 -5
- package/dist/esm/nano-drawer.entry.js.map +1 -1
- package/dist/esm/nano-dropdown.entry.js +1 -1
- package/dist/esm/nano-dropdown.entry.js.map +1 -1
- package/dist/esm/nano-field-validator.entry.js +7 -5
- package/dist/esm/nano-field-validator.entry.js.map +1 -1
- package/dist/esm/nano-file-upload.entry.js +2 -2
- package/dist/esm/nano-file-upload.entry.js.map +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +4 -4
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +122 -153
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +4 -4
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-grid-item.entry.js +1 -1
- package/dist/esm/nano-grid_2.entry.js +2 -2
- package/dist/esm/nano-grid_2.entry.js.map +1 -1
- package/dist/esm/nano-hero.entry.js +2 -2
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-icon-button_2.entry.js +24 -4
- package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
- package/dist/esm/nano-icon.entry.js +4 -4
- package/dist/esm/nano-icon.entry.js.map +1 -1
- package/dist/esm/nano-input.entry.js +3 -3
- package/dist/esm/nano-input.entry.js.map +1 -1
- package/dist/esm/nano-menu-drawer.entry.js +2 -2
- package/dist/esm/nano-menu-drawer.entry.js.map +1 -1
- package/dist/esm/nano-overflow-nav.entry.js +2 -2
- package/dist/esm/nano-overflow-nav.entry.js.map +1 -1
- package/dist/esm/nano-progress-bar.entry.js +2 -2
- package/dist/esm/nano-progress-bar.entry.js.map +1 -1
- package/dist/esm/nano-range.entry.js +2 -2
- package/dist/esm/nano-range.entry.js.map +1 -1
- package/dist/esm/nano-rating.entry.js +2 -2
- package/dist/esm/nano-rating.entry.js.map +1 -1
- package/dist/esm/nano-resize-observe_2.entry.js +1 -1
- package/dist/esm/nano-slide.entry.js +1 -1
- package/dist/esm/nano-slides-9908c44d.js +2970 -0
- package/dist/esm/nano-slides-9908c44d.js.map +1 -0
- package/dist/esm/nano-slides.entry.js +2 -4295
- package/dist/esm/nano-slides.entry.js.map +1 -1
- package/dist/esm/nano-sortable.entry.js +1 -1
- package/dist/esm/nano-spinner.entry.js +2 -2
- package/dist/esm/nano-spinner.entry.js.map +1 -1
- package/dist/esm/nano-split-pane.entry.js +1 -1
- package/dist/esm/nano-sticker.entry.js +3 -2
- package/dist/esm/nano-sticker.entry.js.map +1 -1
- package/dist/esm/nano-tab-content.entry.js +1 -1
- package/dist/esm/nano-tab-group.entry.js +4 -4
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/nano-tab.entry.js +2 -2
- package/dist/esm/nano-tab.entry.js.map +1 -1
- package/dist/esm/{nano-table-5af42ba4.js → nano-table-3ab8cd85.js} +5 -5
- package/dist/esm/{nano-table-5af42ba4.js.map → nano-table-3ab8cd85.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +3 -3
- package/dist/esm/page-dots-467ace2e.js +138 -0
- package/dist/esm/page-dots-467ace2e.js.map +1 -0
- package/dist/esm/{scroll-ec7ac257.js → scroll-ac332213.js} +8 -4
- package/dist/esm/scroll-ac332213.js.map +1 -0
- package/dist/esm/{table.worker-3cae908c.js → table.worker-75d6e1d2.js} +4 -4
- package/dist/esm/table.worker-75d6e1d2.js.map +1 -0
- package/dist/nano-components/{p-74a7fc4f.js → active-element-75b7c8a0.js} +1 -1
- package/dist/nano-components/algolia-data-1b42827c.js +5 -0
- package/dist/nano-components/{p-a26bdb65.js.map → algolia-data-1b42827c.js.map} +1 -1
- package/dist/nano-components/algoliasearch-lite.esm.browser-d71a28dc.js +5 -0
- package/dist/nano-components/algoliasearch-lite.esm.browser-d71a28dc.js.map +1 -0
- package/dist/nano-components/component-store-f7eb0a56.js +5 -0
- package/dist/nano-components/{p-dd5687db.js.map → component-store-f7eb0a56.js.map} +1 -1
- package/dist/nano-components/{p-cecb9af1.js → date-utils-6b7a6e1f.js} +1 -1
- package/dist/nano-components/{p-cdfc507e.js → dom-8599fac1.js} +1 -1
- package/dist/nano-components/{p-842cf127.js → drag-1723a4cc.js} +1 -1
- package/dist/nano-components/{p-9bfdee71.js → events-6a805b42.js} +1 -1
- package/dist/nano-components/fade-1aa7a6db.js +5 -0
- package/dist/nano-components/fade-1aa7a6db.js.map +1 -0
- package/dist/nano-components/{p-f8f89998.js → focus-visible-8b2c14da.js} +1 -1
- package/dist/nano-components/form-control-881fa3af.js +5 -0
- package/dist/nano-components/{p-dc805ecc.js.map → form-control-881fa3af.js.map} +1 -1
- package/dist/nano-components/fullscreen-86fa276a.js +5 -0
- package/dist/nano-components/fullscreen-86fa276a.js.map +1 -0
- package/dist/nano-components/{p-d4f6ec9f.js → global-be484e8c.js} +2 -2
- package/dist/nano-components/{p-d4f6ec9f.js.map → global-be484e8c.js.map} +1 -1
- package/dist/nano-components/index-3003356f.js +5 -0
- package/dist/nano-components/{p-70747f20.js.map → index-3003356f.js.map} +1 -1
- package/dist/nano-components/{p-d6a04b3a.js → index-9695db0a.js} +2 -2
- package/dist/nano-components/{p-d6a04b3a.js.map → index-9695db0a.js.map} +1 -1
- package/dist/nano-components/{p-bb07c3d0.js → index-f626f476.js} +1 -1
- package/dist/nano-components/index.esm.js +1 -1
- package/dist/nano-components/index.esm.js.map +1 -1
- package/dist/nano-components/lazyload-994232a6.js +5 -0
- package/dist/nano-components/lazyload-994232a6.js.map +1 -0
- package/dist/nano-components/{p-2155fc2c.js → local-my-account-6662da72.js} +1 -1
- package/dist/nano-components/{p-ee045579.js → math-c02ddfda.js} +1 -1
- package/dist/nano-components/modal-bd9638c0.js +5 -0
- package/dist/nano-components/{p-2234694a.js.map → modal-bd9638c0.js.map} +1 -1
- package/dist/nano-components/nano-accordion.entry.js +5 -0
- package/dist/nano-components/{p-9f60ff14.entry.js.map → nano-accordion.entry.js.map} +1 -1
- package/dist/nano-components/nano-alert.entry.js +5 -0
- package/dist/nano-components/{p-191352c4.entry.js.map → nano-alert.entry.js.map} +1 -1
- package/dist/nano-components/nano-algolia-filter.entry.js +5 -0
- package/dist/nano-components/nano-algolia-filter.entry.js.map +1 -0
- package/dist/nano-components/nano-algolia-pagination.entry.js +5 -0
- package/dist/nano-components/nano-algolia-pagination.entry.js.map +1 -0
- package/dist/nano-components/nano-algolia-results.entry.js +5 -0
- package/dist/nano-components/nano-algolia-results.entry.js.map +1 -0
- package/dist/nano-components/nano-algolia.entry.js +5 -0
- package/dist/nano-components/nano-algolia.entry.js.map +1 -0
- package/dist/nano-components/nano-aspect-ratio.entry.js +5 -0
- package/dist/nano-components/{p-87329424.entry.js.map → nano-aspect-ratio.entry.js.map} +1 -1
- package/dist/nano-components/nano-checkbox-group.entry.js +5 -0
- package/dist/nano-components/nano-checkbox-group.entry.js.map +1 -0
- package/dist/nano-components/nano-checkbox.entry.js +5 -0
- package/dist/nano-components/nano-checkbox.entry.js.map +1 -0
- package/dist/nano-components/nano-components.css +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/nano-datalist_3.entry.js +5 -0
- package/dist/nano-components/nano-datalist_3.entry.js.map +1 -0
- package/dist/nano-components/nano-date-input.entry.js +5 -0
- package/dist/nano-components/{p-d4e44f93.entry.js.map → nano-date-input.entry.js.map} +1 -1
- package/dist/nano-components/nano-date-picker.entry.js +5 -0
- package/dist/nano-components/{p-efd3e121.entry.js.map → nano-date-picker.entry.js.map} +1 -1
- package/dist/nano-components/nano-demo.entry.js +5 -0
- package/dist/nano-components/{p-e98835e2.entry.js.map → nano-demo.entry.js.map} +1 -1
- package/dist/nano-components/nano-details.entry.js +5 -0
- package/dist/nano-components/nano-details.entry.js.map +1 -0
- package/dist/nano-components/nano-dialog.entry.js +5 -0
- package/dist/nano-components/{p-79fff4fd.entry.js.map → nano-dialog.entry.js.map} +1 -1
- package/dist/nano-components/nano-drawer.entry.js +5 -0
- package/dist/nano-components/nano-drawer.entry.js.map +1 -0
- package/dist/nano-components/nano-dropdown.entry.js +5 -0
- package/dist/nano-components/nano-dropdown.entry.js.map +1 -0
- package/dist/nano-components/nano-field-validator.entry.js +5 -0
- package/dist/nano-components/nano-field-validator.entry.js.map +1 -0
- package/dist/nano-components/nano-file-upload.entry.js +5 -0
- package/dist/nano-components/nano-file-upload.entry.js.map +1 -0
- package/dist/nano-components/nano-global-nav-user-profile_3.entry.js +5 -0
- package/dist/nano-components/nano-global-nav-user-profile_3.entry.js.map +1 -0
- package/dist/nano-components/nano-global-nav.entry.js +5 -0
- package/dist/nano-components/nano-global-nav.entry.js.map +1 -0
- package/dist/nano-components/nano-global-search-results.entry.js +5 -0
- package/dist/nano-components/nano-global-search-results.entry.js.map +1 -0
- package/dist/nano-components/nano-grid-item.entry.js +5 -0
- package/dist/nano-components/{p-9c290055.entry.js.map → nano-grid-item.entry.js.map} +1 -1
- package/dist/nano-components/nano-grid_2.entry.js +5 -0
- package/dist/nano-components/{p-7c82af28.entry.js.map → nano-grid_2.entry.js.map} +1 -1
- package/dist/nano-components/nano-hero.entry.js +5 -0
- package/dist/nano-components/{p-328ef9d3.entry.js.map → nano-hero.entry.js.map} +1 -1
- package/dist/nano-components/nano-icon-button_2.entry.js +5 -0
- package/dist/nano-components/nano-icon-button_2.entry.js.map +1 -0
- package/dist/nano-components/nano-icon.entry.js +5 -0
- package/dist/nano-components/nano-icon.entry.js.map +1 -0
- package/dist/nano-components/nano-input.entry.js +5 -0
- package/dist/nano-components/nano-input.entry.js.map +1 -0
- package/dist/nano-components/nano-menu-drawer.entry.js +5 -0
- package/dist/nano-components/nano-menu-drawer.entry.js.map +1 -0
- package/dist/nano-components/nano-overflow-nav.entry.js +5 -0
- package/dist/nano-components/nano-overflow-nav.entry.js.map +1 -0
- package/dist/nano-components/nano-progress-bar.entry.js +5 -0
- package/dist/nano-components/nano-progress-bar.entry.js.map +1 -0
- package/dist/nano-components/nano-range.entry.js +5 -0
- package/dist/nano-components/nano-range.entry.js.map +1 -0
- package/dist/nano-components/nano-rating.entry.js +5 -0
- package/dist/nano-components/nano-rating.entry.js.map +1 -0
- package/dist/nano-components/nano-resize-observe_2.entry.js +5 -0
- package/dist/nano-components/{p-e6a0675e.entry.js.map → nano-resize-observe_2.entry.js.map} +1 -1
- package/dist/nano-components/nano-slide.entry.js +5 -0
- package/dist/nano-components/{p-3d8fb8a1.entry.js.map → nano-slide.entry.js.map} +1 -1
- package/dist/nano-components/nano-slides-9908c44d.js +20 -0
- package/dist/nano-components/nano-slides-9908c44d.js.map +1 -0
- package/dist/nano-components/nano-slides.entry.js +5 -0
- package/dist/nano-components/nano-sortable.entry.js +5 -0
- package/dist/nano-components/{p-3ae362ae.entry.js.map → nano-sortable.entry.js.map} +1 -1
- package/dist/nano-components/nano-spinner.entry.js +5 -0
- package/dist/nano-components/{p-9925e504.entry.js.map → nano-spinner.entry.js.map} +1 -1
- package/dist/nano-components/nano-split-pane.entry.js +5 -0
- package/dist/nano-components/{p-6c4171fa.entry.js.map → nano-split-pane.entry.js.map} +1 -1
- package/dist/nano-components/nano-sticker.entry.js +5 -0
- package/dist/nano-components/nano-sticker.entry.js.map +1 -0
- package/dist/nano-components/nano-tab-content.entry.js +5 -0
- package/dist/nano-components/{p-3f40e370.entry.js.map → nano-tab-content.entry.js.map} +1 -1
- package/dist/nano-components/nano-tab-group.entry.js +5 -0
- package/dist/nano-components/nano-tab-group.entry.js.map +1 -0
- package/dist/nano-components/nano-tab.entry.js +5 -0
- package/dist/nano-components/{p-3cac5f6d.entry.js.map → nano-tab.entry.js.map} +1 -1
- package/dist/nano-components/nano-table-3ab8cd85.js +5 -0
- package/dist/nano-components/nano-table-3ab8cd85.js.map +1 -0
- package/dist/nano-components/nano-table.entry.js +5 -0
- package/dist/nano-components/page-dots-467ace2e.js +5 -0
- package/dist/nano-components/page-dots-467ace2e.js.map +1 -0
- package/dist/nano-components/{p-cd1fd454.js → popover-e5e7a641.js} +1 -1
- package/dist/nano-components/scroll-ac332213.js +5 -0
- package/dist/nano-components/scroll-ac332213.js.map +1 -0
- package/dist/nano-components/{p-dc565459.js → slot-8126e238.js} +1 -1
- package/dist/nano-components/{p-f88fa15c.js → tabbable-26a66a22.js} +1 -1
- package/dist/nano-components/table.worker-75d6e1d2.js +5 -0
- package/dist/nano-components/{p-411bb8f1.js → theme-82feb8cf.js} +1 -1
- package/dist/nano-components/{p-7bff5224.js → throttle-ac4fcefa.js} +1 -1
- package/dist/nano-components/{p-c3e8e3f9.js → transitions-fb09eb32.js} +1 -1
- package/dist/themes/nanopore.cn.css +1 -1
- package/dist/themes/nanopore.cn.css.map +1 -1
- package/dist/themes/nanopore.css +1 -1
- package/dist/themes/nanopore.css.map +1 -1
- package/dist/types/components/algolia/algolia-data.d.ts +1 -1
- package/dist/types/components/algolia/algolia-filter.d.ts +1 -1
- package/dist/types/components/algolia/algolia-pagination.d.ts +1 -1
- package/dist/types/components/algolia/algolia-results.d.ts +1 -1
- package/dist/types/components/algolia/algolia.d.ts +1 -7
- package/dist/types/components/algolia/lib/squirrelly/browser.d.ts +6 -0
- package/dist/types/components/algolia/lib/squirrelly/compile-string.d.ts +5 -0
- package/dist/types/components/algolia/lib/squirrelly/compile.d.ts +3 -0
- package/dist/types/components/algolia/lib/squirrelly/config.d.ts +48 -0
- package/dist/types/components/algolia/lib/squirrelly/container-utils.d.ts +8 -0
- package/dist/types/components/algolia/lib/squirrelly/containers.d.ts +18 -0
- package/dist/types/components/algolia/lib/squirrelly/err.d.ts +6 -0
- package/dist/types/components/algolia/lib/squirrelly/parse.d.ts +23 -0
- package/dist/types/components/algolia/lib/squirrelly/render.d.ts +3 -0
- package/dist/types/components/algolia/lib/squirrelly/storage.d.ts +13 -0
- package/dist/types/components/algolia/lib/squirrelly/utils.d.ts +8 -0
- package/dist/types/components/algolia/lib/template.d.ts +2 -0
- package/dist/types/components/checkbox/checkbox-group.d.ts +5 -0
- package/dist/types/components/global-nav/global-nav.d.ts +15 -20
- package/dist/types/components/slides/lib/js/animate.d.ts +2 -0
- package/dist/types/components/slides/lib/js/cell.d.ts +1 -0
- package/dist/types/components/slides/lib/js/drag.d.ts +1 -0
- package/dist/types/components/slides/lib/js/fade.d.ts +1 -0
- package/dist/types/components/slides/lib/js/flickity.d.ts +23 -0
- package/dist/types/components/slides/lib/js/fullscreen.d.ts +1 -0
- package/dist/types/components/slides/lib/js/index.d.ts +5 -0
- package/dist/types/components/slides/lib/js/lazyload.d.ts +1 -0
- package/dist/types/components/slides/lib/js/page-dots.d.ts +1 -0
- package/dist/types/components/slides/lib/js/player.d.ts +1 -0
- package/dist/types/components/slides/lib/js/prev-next-button.d.ts +1 -0
- package/dist/types/components/slides/lib/js/slide.d.ts +1 -0
- package/dist/types/components/slides/lib/js/utils/event-emitter.d.ts +1 -0
- package/dist/types/components/slides/lib/js/utils/gestures.d.ts +26 -0
- package/dist/types/components/slides/lib/js/utils/get-size.d.ts +6 -0
- package/dist/types/components/slides/lib/js/utils/utils.d.ts +5 -0
- package/dist/types/components/slides/slides-interface.d.ts +17 -7
- package/dist/types/components/slides/slides.d.ts +5 -0
- package/dist/types/components.d.ts +10 -10
- package/dist/types/utils/scroll.d.ts +5 -1
- package/docs-json.json +33 -24
- package/docs-vscode.json +4 -0
- package/hydrate/index.js +4147 -3953
- package/package.json +5 -8
- package/dist/cjs/_commonjsHelpers-29614748.js +0 -30
- package/dist/cjs/_commonjsHelpers-29614748.js.map +0 -1
- package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js.map +0 -1
- package/dist/cjs/index-1d3ebe1a.js.map +0 -1
- package/dist/cjs/scroll-fc1b8387.js.map +0 -1
- package/dist/cjs/table.worker-3df34efe.js.map +0 -1
- package/dist/collection/components/slides/lib/js/add-remove-cell.js +0 -128
- package/dist/collection/components/slides/lib/js/images-loaded.js +0 -24
- package/dist/collection/components/slides/slides-interface.js +0 -2
- package/dist/collection/components/slides/slides-interface.js.map +0 -1
- package/dist/collection/utils/template.js.map +0 -1
- package/dist/components/_commonjsHelpers.js +0 -26
- package/dist/components/_commonjsHelpers.js.map +0 -1
- package/dist/esm/_commonjsHelpers-04a0e019.js +0 -26
- package/dist/esm/_commonjsHelpers-04a0e019.js.map +0 -1
- package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js.map +0 -1
- package/dist/esm/index-06666022.js.map +0 -1
- package/dist/esm/scroll-ec7ac257.js.map +0 -1
- package/dist/esm/table.worker-3cae908c.js.map +0 -1
- package/dist/nano-components/p-0563e812.entry.js +0 -5
- package/dist/nano-components/p-0563e812.entry.js.map +0 -1
- package/dist/nano-components/p-0bc40dd1.entry.js +0 -5
- package/dist/nano-components/p-0bc40dd1.entry.js.map +0 -1
- package/dist/nano-components/p-0e0f07f0.entry.js +0 -5
- package/dist/nano-components/p-0e0f07f0.entry.js.map +0 -1
- package/dist/nano-components/p-0e4da739.entry.js +0 -5
- package/dist/nano-components/p-0e4da739.entry.js.map +0 -1
- package/dist/nano-components/p-16e75af9.entry.js +0 -5
- package/dist/nano-components/p-16e75af9.entry.js.map +0 -1
- package/dist/nano-components/p-17eb456c.entry.js +0 -5
- package/dist/nano-components/p-17eb456c.entry.js.map +0 -1
- package/dist/nano-components/p-191352c4.entry.js +0 -5
- package/dist/nano-components/p-1987f7a9.js +0 -5
- package/dist/nano-components/p-1a55e282.entry.js +0 -5
- package/dist/nano-components/p-1a55e282.entry.js.map +0 -1
- package/dist/nano-components/p-2234694a.js +0 -5
- package/dist/nano-components/p-2a105609.entry.js +0 -5
- package/dist/nano-components/p-2a105609.entry.js.map +0 -1
- package/dist/nano-components/p-2c0218e6.entry.js +0 -5
- package/dist/nano-components/p-2c0218e6.entry.js.map +0 -1
- package/dist/nano-components/p-328ef9d3.entry.js +0 -5
- package/dist/nano-components/p-359b7cd2.entry.js +0 -5
- package/dist/nano-components/p-359b7cd2.entry.js.map +0 -1
- package/dist/nano-components/p-36c3ded8.entry.js +0 -5
- package/dist/nano-components/p-36c3ded8.entry.js.map +0 -1
- package/dist/nano-components/p-3ae362ae.entry.js +0 -5
- package/dist/nano-components/p-3cac5f6d.entry.js +0 -5
- package/dist/nano-components/p-3d8fb8a1.entry.js +0 -5
- package/dist/nano-components/p-3eeaba47.entry.js +0 -5
- package/dist/nano-components/p-3eeaba47.entry.js.map +0 -1
- package/dist/nano-components/p-3f40e370.entry.js +0 -5
- package/dist/nano-components/p-51133e62.entry.js +0 -5
- package/dist/nano-components/p-51133e62.entry.js.map +0 -1
- package/dist/nano-components/p-54c4a2f5.entry.js +0 -5
- package/dist/nano-components/p-54c4a2f5.entry.js.map +0 -1
- package/dist/nano-components/p-5fc3035d.entry.js +0 -5
- package/dist/nano-components/p-5fc3035d.entry.js.map +0 -1
- package/dist/nano-components/p-650aa197.entry.js +0 -5
- package/dist/nano-components/p-650aa197.entry.js.map +0 -1
- package/dist/nano-components/p-67ab5a5f.entry.js +0 -5
- package/dist/nano-components/p-67ab5a5f.entry.js.map +0 -1
- package/dist/nano-components/p-688f1a55.entry.js +0 -5
- package/dist/nano-components/p-688f1a55.entry.js.map +0 -1
- package/dist/nano-components/p-6c4171fa.entry.js +0 -5
- package/dist/nano-components/p-70747f20.js +0 -5
- package/dist/nano-components/p-7670058b.entry.js +0 -5
- package/dist/nano-components/p-7670058b.entry.js.map +0 -1
- package/dist/nano-components/p-79fff4fd.entry.js +0 -5
- package/dist/nano-components/p-7c82af28.entry.js +0 -5
- package/dist/nano-components/p-87329424.entry.js +0 -5
- package/dist/nano-components/p-8fe51abf.js +0 -5
- package/dist/nano-components/p-935968b8.entry.js +0 -23
- package/dist/nano-components/p-935968b8.entry.js.map +0 -1
- package/dist/nano-components/p-9925e504.entry.js +0 -5
- package/dist/nano-components/p-9c290055.entry.js +0 -5
- package/dist/nano-components/p-9f60ff14.entry.js +0 -5
- package/dist/nano-components/p-a225e976.entry.js +0 -5
- package/dist/nano-components/p-a225e976.entry.js.map +0 -1
- package/dist/nano-components/p-a26bdb65.js +0 -5
- package/dist/nano-components/p-abd11243.entry.js +0 -5
- package/dist/nano-components/p-abd11243.entry.js.map +0 -1
- package/dist/nano-components/p-b27b56d3.js +0 -5
- package/dist/nano-components/p-b27b56d3.js.map +0 -1
- package/dist/nano-components/p-c80336b2.entry.js +0 -5
- package/dist/nano-components/p-c80336b2.entry.js.map +0 -1
- package/dist/nano-components/p-cad86fb8.js +0 -5
- package/dist/nano-components/p-cad86fb8.js.map +0 -1
- package/dist/nano-components/p-d4e44f93.entry.js +0 -5
- package/dist/nano-components/p-dc4020f8.js +0 -5
- package/dist/nano-components/p-dc4020f8.js.map +0 -1
- package/dist/nano-components/p-dc6cb252.entry.js +0 -5
- package/dist/nano-components/p-dc6cb252.entry.js.map +0 -1
- package/dist/nano-components/p-dc805ecc.js +0 -5
- package/dist/nano-components/p-dd5687db.js +0 -5
- package/dist/nano-components/p-e6a0675e.entry.js +0 -5
- package/dist/nano-components/p-e98835e2.entry.js +0 -5
- package/dist/nano-components/p-efd3e121.entry.js +0 -5
- package/dist/nano-components/p-f73f52ed.entry.js +0 -5
- package/dist/nano-components/p-f73f52ed.entry.js.map +0 -1
- package/dist/nano-components/p-fbde7010.entry.js +0 -5
- package/dist/nano-components/p-fcbc9122.entry.js +0 -5
- package/dist/nano-components/p-fcbc9122.entry.js.map +0 -1
- package/dist/types/utils/template.d.ts +0 -2
- /package/dist/nano-components/{p-74a7fc4f.js.map → active-element-75b7c8a0.js.map} +0 -0
- /package/dist/nano-components/{p-cecb9af1.js.map → date-utils-6b7a6e1f.js.map} +0 -0
- /package/dist/nano-components/{p-cdfc507e.js.map → dom-8599fac1.js.map} +0 -0
- /package/dist/nano-components/{p-842cf127.js.map → drag-1723a4cc.js.map} +0 -0
- /package/dist/nano-components/{p-9bfdee71.js.map → events-6a805b42.js.map} +0 -0
- /package/dist/nano-components/{p-f8f89998.js.map → focus-visible-8b2c14da.js.map} +0 -0
- /package/dist/nano-components/{p-bb07c3d0.js.map → index-f626f476.js.map} +0 -0
- /package/dist/nano-components/{p-1987f7a9.js.map → local-my-account-6662da72.js.map} +0 -0
- /package/dist/nano-components/{p-ee045579.js.map → math-c02ddfda.js.map} +0 -0
- /package/dist/nano-components/{p-2155fc2c.js.map → nano-slides.entry.js.map} +0 -0
- /package/dist/nano-components/{p-8fe51abf.js.map → nano-table.entry.js.map} +0 -0
- /package/dist/nano-components/{p-cd1fd454.js.map → popover-e5e7a641.js.map} +0 -0
- /package/dist/nano-components/{p-dc565459.js.map → slot-8126e238.js.map} +0 -0
- /package/dist/nano-components/{p-f88fa15c.js.map → tabbable-26a66a22.js.map} +0 -0
- /package/dist/nano-components/{p-fbde7010.entry.js.map → table.worker-75d6e1d2.js.map} +0 -0
- /package/dist/nano-components/{p-f258383d.js → table.worker-f258383d.js} +0 -0
- /package/dist/nano-components/{p-411bb8f1.js.map → theme-82feb8cf.js.map} +0 -0
- /package/dist/nano-components/{p-7bff5224.js.map → throttle-ac4fcefa.js.map} +0 -0
- /package/dist/nano-components/{p-c3e8e3f9.js.map → transitions-fb09eb32.js.map} +0 -0
@@ -5,4300 +5,11 @@
|
|
5
5
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
7
7
|
|
8
|
-
const
|
9
|
-
|
8
|
+
const nanoSlides_entry = require('./nano-slides-2f3dcc02.js');
|
9
|
+
require('./index-14451c95.js');
|
10
10
|
|
11
|
-
var evEmitter = _commonjsHelpers.createCommonjsModule(function (module) {
|
12
|
-
/**
|
13
|
-
* EvEmitter v1.1.0
|
14
|
-
* Lil' event emitter
|
15
|
-
* MIT License
|
16
|
-
*/
|
17
|
-
|
18
|
-
/* jshint unused: true, undef: true, strict: true */
|
19
|
-
|
20
|
-
( function( global, factory ) {
|
21
|
-
// universal module definition
|
22
|
-
/* jshint strict: false */ /* globals define, module, window */
|
23
|
-
if ( module.exports ) {
|
24
|
-
// CommonJS - Browserify, Webpack
|
25
|
-
module.exports = factory();
|
26
|
-
} else {
|
27
|
-
// Browser globals
|
28
|
-
global.EvEmitter = factory();
|
29
|
-
}
|
30
|
-
|
31
|
-
}( typeof window != 'undefined' ? window : _commonjsHelpers.commonjsGlobal, function() {
|
32
|
-
|
33
|
-
function EvEmitter() {}
|
34
|
-
|
35
|
-
var proto = EvEmitter.prototype;
|
36
|
-
|
37
|
-
proto.on = function( eventName, listener ) {
|
38
|
-
if ( !eventName || !listener ) {
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
// set events hash
|
42
|
-
var events = this._events = this._events || {};
|
43
|
-
// set listeners array
|
44
|
-
var listeners = events[ eventName ] = events[ eventName ] || [];
|
45
|
-
// only add once
|
46
|
-
if ( listeners.indexOf( listener ) == -1 ) {
|
47
|
-
listeners.push( listener );
|
48
|
-
}
|
49
|
-
|
50
|
-
return this;
|
51
|
-
};
|
52
|
-
|
53
|
-
proto.once = function( eventName, listener ) {
|
54
|
-
if ( !eventName || !listener ) {
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
// add event
|
58
|
-
this.on( eventName, listener );
|
59
|
-
// set once flag
|
60
|
-
// set onceEvents hash
|
61
|
-
var onceEvents = this._onceEvents = this._onceEvents || {};
|
62
|
-
// set onceListeners object
|
63
|
-
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
|
64
|
-
// set flag
|
65
|
-
onceListeners[ listener ] = true;
|
66
|
-
|
67
|
-
return this;
|
68
|
-
};
|
69
|
-
|
70
|
-
proto.off = function( eventName, listener ) {
|
71
|
-
var listeners = this._events && this._events[ eventName ];
|
72
|
-
if ( !listeners || !listeners.length ) {
|
73
|
-
return;
|
74
|
-
}
|
75
|
-
var index = listeners.indexOf( listener );
|
76
|
-
if ( index != -1 ) {
|
77
|
-
listeners.splice( index, 1 );
|
78
|
-
}
|
79
|
-
|
80
|
-
return this;
|
81
|
-
};
|
82
|
-
|
83
|
-
proto.emitEvent = function( eventName, args ) {
|
84
|
-
var listeners = this._events && this._events[ eventName ];
|
85
|
-
if ( !listeners || !listeners.length ) {
|
86
|
-
return;
|
87
|
-
}
|
88
|
-
// copy over to avoid interference if .off() in listener
|
89
|
-
listeners = listeners.slice(0);
|
90
|
-
args = args || [];
|
91
|
-
// once stuff
|
92
|
-
var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
|
93
|
-
|
94
|
-
for ( var i=0; i < listeners.length; i++ ) {
|
95
|
-
var listener = listeners[i];
|
96
|
-
var isOnce = onceListeners && onceListeners[ listener ];
|
97
|
-
if ( isOnce ) {
|
98
|
-
// remove listener
|
99
|
-
// remove before trigger to prevent recursion
|
100
|
-
this.off( eventName, listener );
|
101
|
-
// unset once flag
|
102
|
-
delete onceListeners[ listener ];
|
103
|
-
}
|
104
|
-
// trigger listener
|
105
|
-
listener.apply( this, args );
|
106
|
-
}
|
107
|
-
|
108
|
-
return this;
|
109
|
-
};
|
110
|
-
|
111
|
-
proto.allOff = function() {
|
112
|
-
delete this._events;
|
113
|
-
delete this._onceEvents;
|
114
|
-
};
|
115
|
-
|
116
|
-
return EvEmitter;
|
117
|
-
|
118
|
-
}));
|
119
|
-
});
|
120
|
-
|
121
|
-
var getSize = _commonjsHelpers.createCommonjsModule(function (module) {
|
122
|
-
/*!
|
123
|
-
* getSize v2.0.3
|
124
|
-
* measure size of elements
|
125
|
-
* MIT license
|
126
|
-
*/
|
127
|
-
|
128
|
-
/* jshint browser: true, strict: true, undef: true, unused: true */
|
129
|
-
/* globals console: false */
|
130
|
-
|
131
|
-
( function( window, factory ) {
|
132
|
-
/* jshint strict: false */ /* globals define, module */
|
133
|
-
if ( module.exports ) {
|
134
|
-
// CommonJS
|
135
|
-
module.exports = factory();
|
136
|
-
} else {
|
137
|
-
// browser global
|
138
|
-
window.getSize = factory();
|
139
|
-
}
|
140
|
-
|
141
|
-
})( window, function factory() {
|
142
|
-
|
143
|
-
// -------------------------- helpers -------------------------- //
|
144
|
-
|
145
|
-
// get a number from a string, not a percentage
|
146
|
-
function getStyleSize( value ) {
|
147
|
-
var num = parseFloat( value );
|
148
|
-
// not a percent like '100%', and a number
|
149
|
-
var isValid = value.indexOf('%') == -1 && !isNaN( num );
|
150
|
-
return isValid && num;
|
151
|
-
}
|
152
|
-
|
153
|
-
function noop() {}
|
154
|
-
|
155
|
-
var logError = typeof console == 'undefined' ? noop :
|
156
|
-
function( message ) {
|
157
|
-
console.error( message );
|
158
|
-
};
|
159
|
-
|
160
|
-
// -------------------------- measurements -------------------------- //
|
161
|
-
|
162
|
-
var measurements = [
|
163
|
-
'paddingLeft',
|
164
|
-
'paddingRight',
|
165
|
-
'paddingTop',
|
166
|
-
'paddingBottom',
|
167
|
-
'marginLeft',
|
168
|
-
'marginRight',
|
169
|
-
'marginTop',
|
170
|
-
'marginBottom',
|
171
|
-
'borderLeftWidth',
|
172
|
-
'borderRightWidth',
|
173
|
-
'borderTopWidth',
|
174
|
-
'borderBottomWidth'
|
175
|
-
];
|
176
|
-
|
177
|
-
var measurementsLength = measurements.length;
|
178
|
-
|
179
|
-
function getZeroSize() {
|
180
|
-
var size = {
|
181
|
-
width: 0,
|
182
|
-
height: 0,
|
183
|
-
innerWidth: 0,
|
184
|
-
innerHeight: 0,
|
185
|
-
outerWidth: 0,
|
186
|
-
outerHeight: 0
|
187
|
-
};
|
188
|
-
for ( var i=0; i < measurementsLength; i++ ) {
|
189
|
-
var measurement = measurements[i];
|
190
|
-
size[ measurement ] = 0;
|
191
|
-
}
|
192
|
-
return size;
|
193
|
-
}
|
194
|
-
|
195
|
-
// -------------------------- getStyle -------------------------- //
|
196
|
-
|
197
|
-
/**
|
198
|
-
* getStyle, get style of element, check for Firefox bug
|
199
|
-
* https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
200
|
-
*/
|
201
|
-
function getStyle( elem ) {
|
202
|
-
var style = getComputedStyle( elem );
|
203
|
-
if ( !style ) {
|
204
|
-
logError( 'Style returned ' + style +
|
205
|
-
'. Are you running this code in a hidden iframe on Firefox? ' +
|
206
|
-
'See https://bit.ly/getsizebug1' );
|
207
|
-
}
|
208
|
-
return style;
|
209
|
-
}
|
210
|
-
|
211
|
-
// -------------------------- setup -------------------------- //
|
212
|
-
|
213
|
-
var isSetup = false;
|
214
|
-
|
215
|
-
var isBoxSizeOuter;
|
216
|
-
|
217
|
-
/**
|
218
|
-
* setup
|
219
|
-
* check isBoxSizerOuter
|
220
|
-
* do on first getSize() rather than on page load for Firefox bug
|
221
|
-
*/
|
222
|
-
function setup() {
|
223
|
-
// setup once
|
224
|
-
if ( isSetup ) {
|
225
|
-
return;
|
226
|
-
}
|
227
|
-
isSetup = true;
|
228
|
-
|
229
|
-
// -------------------------- box sizing -------------------------- //
|
230
|
-
|
231
|
-
/**
|
232
|
-
* Chrome & Safari measure the outer-width on style.width on border-box elems
|
233
|
-
* IE11 & Firefox<29 measures the inner-width
|
234
|
-
*/
|
235
|
-
var div = document.createElement('div');
|
236
|
-
div.style.width = '200px';
|
237
|
-
div.style.padding = '1px 2px 3px 4px';
|
238
|
-
div.style.borderStyle = 'solid';
|
239
|
-
div.style.borderWidth = '1px 2px 3px 4px';
|
240
|
-
div.style.boxSizing = 'border-box';
|
241
|
-
|
242
|
-
var body = document.body || document.documentElement;
|
243
|
-
body.appendChild( div );
|
244
|
-
var style = getStyle( div );
|
245
|
-
// round value for browser zoom. desandro/masonry#928
|
246
|
-
isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
|
247
|
-
getSize.isBoxSizeOuter = isBoxSizeOuter;
|
248
|
-
|
249
|
-
body.removeChild( div );
|
250
|
-
}
|
251
|
-
|
252
|
-
// -------------------------- getSize -------------------------- //
|
253
|
-
|
254
|
-
function getSize( elem ) {
|
255
|
-
setup();
|
256
|
-
|
257
|
-
// use querySeletor if elem is string
|
258
|
-
if ( typeof elem == 'string' ) {
|
259
|
-
elem = document.querySelector( elem );
|
260
|
-
}
|
261
|
-
|
262
|
-
// do not proceed on non-objects
|
263
|
-
if ( !elem || typeof elem != 'object' || !elem.nodeType ) {
|
264
|
-
return;
|
265
|
-
}
|
266
|
-
|
267
|
-
var style = getStyle( elem );
|
268
|
-
|
269
|
-
// if hidden, everything is 0
|
270
|
-
if ( style.display == 'none' ) {
|
271
|
-
return getZeroSize();
|
272
|
-
}
|
273
|
-
|
274
|
-
var size = {};
|
275
|
-
size.width = elem.offsetWidth;
|
276
|
-
size.height = elem.offsetHeight;
|
277
|
-
|
278
|
-
var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';
|
279
|
-
|
280
|
-
// get all measurements
|
281
|
-
for ( var i=0; i < measurementsLength; i++ ) {
|
282
|
-
var measurement = measurements[i];
|
283
|
-
var value = style[ measurement ];
|
284
|
-
var num = parseFloat( value );
|
285
|
-
// any 'auto', 'medium' value will be 0
|
286
|
-
size[ measurement ] = !isNaN( num ) ? num : 0;
|
287
|
-
}
|
288
|
-
|
289
|
-
var paddingWidth = size.paddingLeft + size.paddingRight;
|
290
|
-
var paddingHeight = size.paddingTop + size.paddingBottom;
|
291
|
-
var marginWidth = size.marginLeft + size.marginRight;
|
292
|
-
var marginHeight = size.marginTop + size.marginBottom;
|
293
|
-
var borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
294
|
-
var borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
295
|
-
|
296
|
-
var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
|
297
|
-
|
298
|
-
// overwrite width and height if we can get it from style
|
299
|
-
var styleWidth = getStyleSize( style.width );
|
300
|
-
if ( styleWidth !== false ) {
|
301
|
-
size.width = styleWidth +
|
302
|
-
// add padding and border unless it's already including it
|
303
|
-
( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
|
304
|
-
}
|
305
|
-
|
306
|
-
var styleHeight = getStyleSize( style.height );
|
307
|
-
if ( styleHeight !== false ) {
|
308
|
-
size.height = styleHeight +
|
309
|
-
// add padding and border unless it's already including it
|
310
|
-
( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
|
311
|
-
}
|
312
|
-
|
313
|
-
size.innerWidth = size.width - ( paddingWidth + borderWidth );
|
314
|
-
size.innerHeight = size.height - ( paddingHeight + borderHeight );
|
315
|
-
|
316
|
-
size.outerWidth = size.width + marginWidth;
|
317
|
-
size.outerHeight = size.height + marginHeight;
|
318
|
-
|
319
|
-
return size;
|
320
|
-
}
|
321
|
-
|
322
|
-
return getSize;
|
323
|
-
|
324
|
-
});
|
325
|
-
});
|
326
|
-
|
327
|
-
var matchesSelector = _commonjsHelpers.createCommonjsModule(function (module) {
|
328
|
-
/**
|
329
|
-
* matchesSelector v2.0.2
|
330
|
-
* matchesSelector( element, '.selector' )
|
331
|
-
* MIT license
|
332
|
-
*/
|
333
|
-
|
334
|
-
/*jshint browser: true, strict: true, undef: true, unused: true */
|
335
|
-
|
336
|
-
( function( window, factory ) {
|
337
|
-
// universal module definition
|
338
|
-
if ( module.exports ) {
|
339
|
-
// CommonJS
|
340
|
-
module.exports = factory();
|
341
|
-
} else {
|
342
|
-
// browser global
|
343
|
-
window.matchesSelector = factory();
|
344
|
-
}
|
345
|
-
|
346
|
-
}( window, function factory() {
|
347
|
-
|
348
|
-
var matchesMethod = ( function() {
|
349
|
-
var ElemProto = window.Element.prototype;
|
350
|
-
// check for the standard method name first
|
351
|
-
if ( ElemProto.matches ) {
|
352
|
-
return 'matches';
|
353
|
-
}
|
354
|
-
// check un-prefixed
|
355
|
-
if ( ElemProto.matchesSelector ) {
|
356
|
-
return 'matchesSelector';
|
357
|
-
}
|
358
|
-
// check vendor prefixes
|
359
|
-
var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
|
360
|
-
|
361
|
-
for ( var i=0; i < prefixes.length; i++ ) {
|
362
|
-
var prefix = prefixes[i];
|
363
|
-
var method = prefix + 'MatchesSelector';
|
364
|
-
if ( ElemProto[ method ] ) {
|
365
|
-
return method;
|
366
|
-
}
|
367
|
-
}
|
368
|
-
})();
|
369
|
-
|
370
|
-
return function matchesSelector( elem, selector ) {
|
371
|
-
return elem[ matchesMethod ]( selector );
|
372
|
-
};
|
373
|
-
|
374
|
-
}));
|
375
|
-
});
|
376
|
-
|
377
|
-
var utils = _commonjsHelpers.createCommonjsModule(function (module) {
|
378
|
-
/**
|
379
|
-
* Fizzy UI utils v2.0.7
|
380
|
-
* MIT license
|
381
|
-
*/
|
382
|
-
|
383
|
-
/*jshint browser: true, undef: true, unused: true, strict: true */
|
384
|
-
|
385
|
-
( function( window, factory ) {
|
386
|
-
// universal module definition
|
387
|
-
/*jshint strict: false */ /*globals define, module, require */
|
388
|
-
|
389
|
-
if ( module.exports ) {
|
390
|
-
// CommonJS
|
391
|
-
module.exports = factory(
|
392
|
-
window,
|
393
|
-
matchesSelector
|
394
|
-
);
|
395
|
-
} else {
|
396
|
-
// browser global
|
397
|
-
window.fizzyUIUtils = factory(
|
398
|
-
window,
|
399
|
-
window.matchesSelector
|
400
|
-
);
|
401
|
-
}
|
402
|
-
|
403
|
-
}( window, function factory( window, matchesSelector ) {
|
404
|
-
|
405
|
-
var utils = {};
|
406
|
-
|
407
|
-
// ----- extend ----- //
|
408
|
-
|
409
|
-
// extends objects
|
410
|
-
utils.extend = function( a, b ) {
|
411
|
-
for ( var prop in b ) {
|
412
|
-
a[ prop ] = b[ prop ];
|
413
|
-
}
|
414
|
-
return a;
|
415
|
-
};
|
416
|
-
|
417
|
-
// ----- modulo ----- //
|
418
|
-
|
419
|
-
utils.modulo = function( num, div ) {
|
420
|
-
return ( ( num % div ) + div ) % div;
|
421
|
-
};
|
422
|
-
|
423
|
-
// ----- makeArray ----- //
|
424
|
-
|
425
|
-
var arraySlice = Array.prototype.slice;
|
426
|
-
|
427
|
-
// turn element or nodeList into an array
|
428
|
-
utils.makeArray = function( obj ) {
|
429
|
-
if ( Array.isArray( obj ) ) {
|
430
|
-
// use object if already an array
|
431
|
-
return obj;
|
432
|
-
}
|
433
|
-
// return empty array if undefined or null. #6
|
434
|
-
if ( obj === null || obj === undefined ) {
|
435
|
-
return [];
|
436
|
-
}
|
437
|
-
|
438
|
-
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
|
439
|
-
if ( isArrayLike ) {
|
440
|
-
// convert nodeList to array
|
441
|
-
return arraySlice.call( obj );
|
442
|
-
}
|
443
|
-
|
444
|
-
// array of single index
|
445
|
-
return [ obj ];
|
446
|
-
};
|
447
|
-
|
448
|
-
// ----- removeFrom ----- //
|
449
|
-
|
450
|
-
utils.removeFrom = function( ary, obj ) {
|
451
|
-
var index = ary.indexOf( obj );
|
452
|
-
if ( index != -1 ) {
|
453
|
-
ary.splice( index, 1 );
|
454
|
-
}
|
455
|
-
};
|
456
|
-
|
457
|
-
// ----- getParent ----- //
|
458
|
-
|
459
|
-
utils.getParent = function( elem, selector ) {
|
460
|
-
while ( elem.parentNode && elem != document.body ) {
|
461
|
-
elem = elem.parentNode;
|
462
|
-
if ( matchesSelector( elem, selector ) ) {
|
463
|
-
return elem;
|
464
|
-
}
|
465
|
-
}
|
466
|
-
};
|
467
|
-
|
468
|
-
// ----- getQueryElement ----- //
|
469
|
-
|
470
|
-
// use element as selector string
|
471
|
-
utils.getQueryElement = function( elem ) {
|
472
|
-
if ( typeof elem == 'string' ) {
|
473
|
-
return document.querySelector( elem );
|
474
|
-
}
|
475
|
-
return elem;
|
476
|
-
};
|
477
|
-
|
478
|
-
// ----- handleEvent ----- //
|
479
|
-
|
480
|
-
// enable .ontype to trigger from .addEventListener( elem, 'type' )
|
481
|
-
utils.handleEvent = function( event ) {
|
482
|
-
var method = 'on' + event.type;
|
483
|
-
if ( this[ method ] ) {
|
484
|
-
this[ method ]( event );
|
485
|
-
}
|
486
|
-
};
|
487
|
-
|
488
|
-
// ----- filterFindElements ----- //
|
489
|
-
|
490
|
-
utils.filterFindElements = function( elems, selector ) {
|
491
|
-
// make array of elems
|
492
|
-
elems = utils.makeArray( elems );
|
493
|
-
var ffElems = [];
|
494
|
-
|
495
|
-
elems.forEach( function( elem ) {
|
496
|
-
// check that elem is an actual element
|
497
|
-
if ( !( elem instanceof HTMLElement ) ) {
|
498
|
-
return;
|
499
|
-
}
|
500
|
-
// add elem if no selector
|
501
|
-
if ( !selector ) {
|
502
|
-
ffElems.push( elem );
|
503
|
-
return;
|
504
|
-
}
|
505
|
-
// filter & find items if we have a selector
|
506
|
-
// filter
|
507
|
-
if ( matchesSelector( elem, selector ) ) {
|
508
|
-
ffElems.push( elem );
|
509
|
-
}
|
510
|
-
// find children
|
511
|
-
var childElems = elem.querySelectorAll( selector );
|
512
|
-
// concat childElems to filterFound array
|
513
|
-
for ( var i=0; i < childElems.length; i++ ) {
|
514
|
-
ffElems.push( childElems[i] );
|
515
|
-
}
|
516
|
-
});
|
517
|
-
|
518
|
-
return ffElems;
|
519
|
-
};
|
520
|
-
|
521
|
-
// ----- debounceMethod ----- //
|
522
|
-
|
523
|
-
utils.debounceMethod = function( _class, methodName, threshold ) {
|
524
|
-
threshold = threshold || 100;
|
525
|
-
// original method
|
526
|
-
var method = _class.prototype[ methodName ];
|
527
|
-
var timeoutName = methodName + 'Timeout';
|
528
|
-
|
529
|
-
_class.prototype[ methodName ] = function() {
|
530
|
-
var timeout = this[ timeoutName ];
|
531
|
-
clearTimeout( timeout );
|
532
|
-
|
533
|
-
var args = arguments;
|
534
|
-
var _this = this;
|
535
|
-
this[ timeoutName ] = setTimeout( function() {
|
536
|
-
method.apply( _this, args );
|
537
|
-
delete _this[ timeoutName ];
|
538
|
-
}, threshold );
|
539
|
-
};
|
540
|
-
};
|
541
|
-
|
542
|
-
// ----- docReady ----- //
|
543
|
-
|
544
|
-
utils.docReady = function( callback ) {
|
545
|
-
var readyState = document.readyState;
|
546
|
-
if ( readyState == 'complete' || readyState == 'interactive' ) {
|
547
|
-
// do async to allow for other scripts to run. metafizzy/flickity#441
|
548
|
-
setTimeout( callback );
|
549
|
-
} else {
|
550
|
-
document.addEventListener( 'DOMContentLoaded', callback );
|
551
|
-
}
|
552
|
-
};
|
553
|
-
|
554
|
-
// ----- htmlInit ----- //
|
555
|
-
|
556
|
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
557
|
-
utils.toDashed = function( str ) {
|
558
|
-
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
|
559
|
-
return $1 + '-' + $2;
|
560
|
-
}).toLowerCase();
|
561
|
-
};
|
562
|
-
|
563
|
-
var console = window.console;
|
564
|
-
/**
|
565
|
-
* allow user to initialize classes via [data-namespace] or .js-namespace class
|
566
|
-
* htmlInit( Widget, 'widgetName' )
|
567
|
-
* options are parsed from data-namespace-options
|
568
|
-
*/
|
569
|
-
utils.htmlInit = function( WidgetClass, namespace ) {
|
570
|
-
utils.docReady( function() {
|
571
|
-
var dashedNamespace = utils.toDashed( namespace );
|
572
|
-
var dataAttr = 'data-' + dashedNamespace;
|
573
|
-
var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' );
|
574
|
-
var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace );
|
575
|
-
var elems = utils.makeArray( dataAttrElems )
|
576
|
-
.concat( utils.makeArray( jsDashElems ) );
|
577
|
-
var dataOptionsAttr = dataAttr + '-options';
|
578
|
-
var jQuery = window.jQuery;
|
579
|
-
|
580
|
-
elems.forEach( function( elem ) {
|
581
|
-
var attr = elem.getAttribute( dataAttr ) ||
|
582
|
-
elem.getAttribute( dataOptionsAttr );
|
583
|
-
var options;
|
584
|
-
try {
|
585
|
-
options = attr && JSON.parse( attr );
|
586
|
-
} catch ( error ) {
|
587
|
-
// log error, do not initialize
|
588
|
-
if ( console ) {
|
589
|
-
console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className +
|
590
|
-
': ' + error );
|
591
|
-
}
|
592
|
-
return;
|
593
|
-
}
|
594
|
-
// initialize
|
595
|
-
var instance = new WidgetClass( elem, options );
|
596
|
-
// make available via $().data('namespace')
|
597
|
-
if ( jQuery ) {
|
598
|
-
jQuery.data( elem, namespace, instance );
|
599
|
-
}
|
600
|
-
});
|
601
|
-
|
602
|
-
});
|
603
|
-
};
|
604
|
-
|
605
|
-
// ----- ----- //
|
606
|
-
|
607
|
-
return utils;
|
608
|
-
|
609
|
-
}));
|
610
|
-
});
|
611
|
-
|
612
|
-
function Cell(elem, parent) {
|
613
|
-
this.element = elem;
|
614
|
-
this.parent = parent;
|
615
|
-
|
616
|
-
this.create();
|
617
|
-
}
|
618
|
-
|
619
|
-
var proto$b = Cell.prototype;
|
620
|
-
|
621
|
-
proto$b.create = function () {
|
622
|
-
this.element.style.position = 'absolute';
|
623
|
-
this.element.setAttribute('aria-hidden', 'true');
|
624
|
-
this.x = 0;
|
625
|
-
this.shift = 0;
|
626
|
-
Array.from(this.element.querySelectorAll('*')).forEach((element) => {
|
627
|
-
element.setAttribute('tabindex', '-1');
|
628
|
-
});
|
629
|
-
};
|
630
|
-
|
631
|
-
proto$b.destroy = function () {
|
632
|
-
// reset style
|
633
|
-
this.unselect();
|
634
|
-
this.element.style.position = '';
|
635
|
-
var side = this.parent.originSide;
|
636
|
-
this.element.style[side] = '';
|
637
|
-
};
|
638
|
-
|
639
|
-
proto$b.getSize = function () {
|
640
|
-
this.size = getSize(this.element);
|
641
|
-
};
|
642
|
-
|
643
|
-
proto$b.setPosition = function (x) {
|
644
|
-
this.x = x;
|
645
|
-
this.updateTarget();
|
646
|
-
this.renderPosition(x);
|
647
|
-
};
|
648
|
-
|
649
|
-
// setDefaultTarget v1 method, backwards compatibility, remove in v3
|
650
|
-
proto$b.updateTarget = proto$b.setDefaultTarget = function () {
|
651
|
-
var marginProperty =
|
652
|
-
this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight';
|
653
|
-
this.target =
|
654
|
-
this.x +
|
655
|
-
this.size[marginProperty] +
|
656
|
-
this.size.width * this.parent.cellAlign;
|
657
|
-
};
|
658
|
-
|
659
|
-
proto$b.renderPosition = function (x) {
|
660
|
-
// render position of cell with in slider
|
661
|
-
var side = this.parent.originSide;
|
662
|
-
this.element.style[side] = this.parent.getPositionValue(x);
|
663
|
-
};
|
664
|
-
|
665
|
-
proto$b.select = function () {
|
666
|
-
this.element.classList.add('is-selected');
|
667
|
-
this.element.removeAttribute('aria-hidden');
|
668
|
-
Array.from(this.element.querySelectorAll('*')).forEach((element) => {
|
669
|
-
element.removeAttribute('tabindex');
|
670
|
-
});
|
671
|
-
};
|
672
|
-
|
673
|
-
proto$b.unselect = function () {
|
674
|
-
this.element.classList.remove('is-selected');
|
675
|
-
this.element.setAttribute('aria-hidden', 'true');
|
676
|
-
Array.from(this.element.querySelectorAll('*')).forEach((element) => {
|
677
|
-
element.setAttribute('tabindex', '-1');
|
678
|
-
});
|
679
|
-
};
|
680
|
-
|
681
|
-
/**
|
682
|
-
* @param {Integer} factor - 0, 1, or -1
|
683
|
-
**/
|
684
|
-
proto$b.wrapShift = function (shift) {
|
685
|
-
this.shift = shift;
|
686
|
-
this.renderPosition(this.x + this.parent.slideableWidth * shift);
|
687
|
-
};
|
688
|
-
|
689
|
-
proto$b.remove = function () {
|
690
|
-
this.element.parentNode.removeChild(this.element);
|
691
|
-
};
|
692
|
-
|
693
|
-
function Slide$1(parent) {
|
694
|
-
this.parent = parent;
|
695
|
-
this.isOriginLeft = parent.originSide == 'left';
|
696
|
-
this.cells = [];
|
697
|
-
this.outerWidth = 0;
|
698
|
-
this.height = 0;
|
699
|
-
}
|
700
|
-
|
701
|
-
var proto$a = Slide$1.prototype;
|
702
|
-
|
703
|
-
proto$a.addCell = function (cell) {
|
704
|
-
this.cells.push(cell);
|
705
|
-
this.outerWidth += cell.size.outerWidth;
|
706
|
-
this.height = Math.max(cell.size.outerHeight, this.height);
|
707
|
-
// first cell stuff
|
708
|
-
if (this.cells.length == 1) {
|
709
|
-
this.x = cell.x; // x comes from first cell
|
710
|
-
var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight';
|
711
|
-
this.firstMargin = cell.size[beginMargin];
|
712
|
-
}
|
713
|
-
};
|
714
|
-
|
715
|
-
proto$a.updateTarget = function () {
|
716
|
-
var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft';
|
717
|
-
var lastCell = this.getLastCell();
|
718
|
-
var lastMargin = lastCell ? lastCell.size[endMargin] : 0;
|
719
|
-
var slideWidth = this.outerWidth - (this.firstMargin + lastMargin);
|
720
|
-
this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign;
|
721
|
-
};
|
722
|
-
|
723
|
-
proto$a.getLastCell = function () {
|
724
|
-
return this.cells[this.cells.length - 1];
|
725
|
-
};
|
726
|
-
|
727
|
-
proto$a.select = function () {
|
728
|
-
this.cells.forEach(function (cell) {
|
729
|
-
cell.select();
|
730
|
-
});
|
731
|
-
};
|
732
|
-
|
733
|
-
proto$a.unselect = function () {
|
734
|
-
this.cells.forEach(function (cell) {
|
735
|
-
cell.unselect();
|
736
|
-
});
|
737
|
-
};
|
738
|
-
|
739
|
-
proto$a.getCellElements = function () {
|
740
|
-
return this.cells.map(function (cell) {
|
741
|
-
return cell.element;
|
742
|
-
});
|
743
|
-
};
|
744
|
-
|
745
|
-
const proto$9 = {};
|
746
|
-
|
747
|
-
proto$9.startAnimation = function () {
|
748
|
-
if (this.isAnimating) {
|
749
|
-
return;
|
750
|
-
}
|
751
|
-
|
752
|
-
this.isAnimating = true;
|
753
|
-
this.restingFrames = 0;
|
754
|
-
this.animate();
|
755
|
-
};
|
756
|
-
|
757
|
-
proto$9.animate = function () {
|
758
|
-
this.applyDragForce();
|
759
|
-
this.applySelectedAttraction();
|
760
|
-
|
761
|
-
var previousX = this.x;
|
762
|
-
|
763
|
-
this.integratePhysics();
|
764
|
-
this.positionSlider();
|
765
|
-
this.settle(previousX);
|
766
|
-
// animate next frame
|
767
|
-
if (this.isAnimating) {
|
768
|
-
var _this = this;
|
769
|
-
requestAnimationFrame(function animateFrame() {
|
770
|
-
_this.animate();
|
771
|
-
});
|
772
|
-
}
|
773
|
-
};
|
774
|
-
|
775
|
-
proto$9.positionSlider = function () {
|
776
|
-
var x = this.x;
|
777
|
-
// wrap position around
|
778
|
-
if (this.options.wrapAround && this.cells.length > 1) {
|
779
|
-
x = utils.modulo(x, this.slideableWidth);
|
780
|
-
x = x - this.slideableWidth;
|
781
|
-
this.shiftWrapCells(x);
|
782
|
-
}
|
783
|
-
|
784
|
-
this.setTranslateX(x, this.isAnimating);
|
785
|
-
this.dispatchScrollEvent();
|
786
|
-
};
|
787
|
-
|
788
|
-
proto$9.setTranslateX = function (x, is3d) {
|
789
|
-
x += this.cursorPosition;
|
790
|
-
// reverse if right-to-left and using transform
|
791
|
-
x = this.options.rightToLeft ? -x : x;
|
792
|
-
var translateX = this.getPositionValue(x);
|
793
|
-
// use 3D tranforms for hardware acceleration on iOS
|
794
|
-
// but use 2D when settled, for better font-rendering
|
795
|
-
// this.slider.style.transform = is3d
|
796
|
-
// ? 'translate3d(' + translateX + ',0,0)'
|
797
|
-
// : 'translateX(' + translateX + ')';
|
798
|
-
|
799
|
-
this.slider.style.transform = 'translate3d(' + translateX + ',0,0)';
|
800
|
-
};
|
801
|
-
|
802
|
-
proto$9.dispatchScrollEvent = function () {
|
803
|
-
var firstSlide = this.slides[0];
|
804
|
-
if (!firstSlide) {
|
805
|
-
return;
|
806
|
-
}
|
807
|
-
var positionX = -this.x - firstSlide.target;
|
808
|
-
var progress = positionX / this.slidesWidth;
|
809
|
-
this.dispatchEvent('scroll', null, [progress, positionX]);
|
810
|
-
};
|
811
|
-
|
812
|
-
proto$9.positionSliderAtSelected = function () {
|
813
|
-
if (!this.cells.length) {
|
814
|
-
return;
|
815
|
-
}
|
816
|
-
this.x = -this.selectedSlide.target;
|
817
|
-
this.velocity = 0; // stop wobble
|
818
|
-
this.positionSlider();
|
819
|
-
};
|
820
|
-
|
821
|
-
proto$9.getPositionValue = function (position) {
|
822
|
-
if (this.options.percentPosition) {
|
823
|
-
// percent position, round to 2 digits, like 12.34%
|
824
|
-
return Math.round((position / this.size.innerWidth) * 10000) * 0.01 + '%';
|
825
|
-
} else {
|
826
|
-
// pixel positioning
|
827
|
-
return Math.round(position) + 'px';
|
828
|
-
}
|
829
|
-
};
|
830
|
-
|
831
|
-
proto$9.settle = function (previousX) {
|
832
|
-
// keep track of frames where x hasn't moved
|
833
|
-
if (
|
834
|
-
!this.isPointerDown &&
|
835
|
-
Math.round(this.x * 100) == Math.round(previousX * 100)
|
836
|
-
) {
|
837
|
-
this.restingFrames++;
|
838
|
-
}
|
839
|
-
// stop animating if resting for 3 or more frames
|
840
|
-
if (this.restingFrames > 2) {
|
841
|
-
this.isAnimating = false;
|
842
|
-
delete this.isFreeScrolling;
|
843
|
-
// render position with translateX when settled
|
844
|
-
this.positionSlider();
|
845
|
-
this.dispatchEvent('settle', null, [this.selectedIndex]);
|
846
|
-
}
|
847
|
-
};
|
848
|
-
|
849
|
-
proto$9.shiftWrapCells = function (x) {
|
850
|
-
// shift before cells
|
851
|
-
var beforeGap = this.cursorPosition + x;
|
852
|
-
this._shiftCells(this.beforeShiftCells, beforeGap, -1);
|
853
|
-
// shift after cells
|
854
|
-
var afterGap =
|
855
|
-
this.size.innerWidth - (x + this.slideableWidth + this.cursorPosition);
|
856
|
-
this._shiftCells(this.afterShiftCells, afterGap, 1);
|
857
|
-
};
|
858
|
-
|
859
|
-
proto$9._shiftCells = function (cells, gap, shift) {
|
860
|
-
for (var i = 0; i < cells.length; i++) {
|
861
|
-
var cell = cells[i];
|
862
|
-
var cellShift = gap > 0 ? shift : 0;
|
863
|
-
cell.wrapShift(cellShift);
|
864
|
-
gap -= cell.size.outerWidth;
|
865
|
-
}
|
866
|
-
};
|
867
|
-
|
868
|
-
proto$9._unshiftCells = function (cells) {
|
869
|
-
if (!cells || !cells.length) {
|
870
|
-
return;
|
871
|
-
}
|
872
|
-
for (var i = 0; i < cells.length; i++) {
|
873
|
-
cells[i].wrapShift(0);
|
874
|
-
}
|
875
|
-
};
|
876
|
-
|
877
|
-
// -------------------------- physics -------------------------- //
|
878
|
-
|
879
|
-
proto$9.integratePhysics = function () {
|
880
|
-
this.x += this.velocity;
|
881
|
-
this.velocity *= this.getFrictionFactor();
|
882
|
-
};
|
883
|
-
|
884
|
-
proto$9.applyForce = function (force) {
|
885
|
-
this.velocity += force;
|
886
|
-
};
|
887
|
-
|
888
|
-
proto$9.getFrictionFactor = function () {
|
889
|
-
return (
|
890
|
-
1 - this.options[this.isFreeScrolling ? 'freeScrollFriction' : 'friction']
|
891
|
-
);
|
892
|
-
};
|
893
|
-
|
894
|
-
proto$9.getRestingPosition = function () {
|
895
|
-
// my thanks to Steven Wittens, who simplified this math greatly
|
896
|
-
return this.x + this.velocity / (1 - this.getFrictionFactor());
|
897
|
-
};
|
898
|
-
|
899
|
-
proto$9.applyDragForce = function () {
|
900
|
-
if (!this.isDraggable || !this.isPointerDown) {
|
901
|
-
return;
|
902
|
-
}
|
903
|
-
// change the position to drag position by applying force
|
904
|
-
var dragVelocity = this.dragX - this.x;
|
905
|
-
var dragForce = dragVelocity - this.velocity;
|
906
|
-
this.applyForce(dragForce);
|
907
|
-
};
|
908
|
-
|
909
|
-
proto$9.applySelectedAttraction = function () {
|
910
|
-
// do not attract if pointer down or no slides
|
911
|
-
var dragDown = this.isDraggable && this.isPointerDown;
|
912
|
-
if (dragDown || this.isFreeScrolling || !this.slides.length) {
|
913
|
-
return;
|
914
|
-
}
|
915
|
-
var distance = this.selectedSlide.target * -1 - this.x;
|
916
|
-
var force = distance * this.options.selectedAttraction;
|
917
|
-
this.applyForce(force);
|
918
|
-
};
|
919
|
-
|
920
|
-
// vars
|
921
|
-
var getComputedStyle$1 = window.getComputedStyle;
|
922
|
-
var console$1 = window.console;
|
923
|
-
|
924
|
-
function moveElements(elems, toElem) {
|
925
|
-
elems = utils.makeArray(elems);
|
926
|
-
while (elems.length) {
|
927
|
-
toElem.appendChild(elems.shift());
|
928
|
-
}
|
929
|
-
}
|
930
|
-
|
931
|
-
// -------------------------- Flickity -------------------------- //
|
932
|
-
|
933
|
-
// globally unique identifiers
|
934
|
-
var GUID = 0;
|
935
|
-
// internal store of all Flickity intances
|
936
|
-
var instances = {};
|
937
|
-
|
938
|
-
function Flickity(element, options) {
|
939
|
-
var queryElement = utils.getQueryElement(element);
|
940
|
-
if (!queryElement) {
|
941
|
-
if (console$1) {
|
942
|
-
console$1.error('Bad element for Flickity: ' + (queryElement || element));
|
943
|
-
}
|
944
|
-
return;
|
945
|
-
}
|
946
|
-
this.element = queryElement;
|
947
|
-
// do not initialize twice on same element
|
948
|
-
if (this.element.flickityGUID) {
|
949
|
-
var instance = instances[this.element.flickityGUID];
|
950
|
-
if (!instances[this.element.flickityGUID]) return;
|
951
|
-
instance.option(options);
|
952
|
-
return instance;
|
953
|
-
}
|
954
|
-
|
955
|
-
// options
|
956
|
-
this.options = utils.extend({}, this.constructor.defaults);
|
957
|
-
this.option(options);
|
958
|
-
|
959
|
-
// kick things off
|
960
|
-
this._create();
|
961
|
-
}
|
962
|
-
|
963
|
-
Flickity.defaults = {
|
964
|
-
accessibility: true,
|
965
|
-
// adaptiveHeight: false,
|
966
|
-
cellAlign: 'center',
|
967
|
-
// cellSelector: undefined,
|
968
|
-
// contain: false,
|
969
|
-
freeScrollFriction: 0.075, // friction when free-scrolling
|
970
|
-
friction: 0.28, // friction when selecting
|
971
|
-
namespaceJQueryEvents: true,
|
972
|
-
// initialIndex: 0,
|
973
|
-
percentPosition: true,
|
974
|
-
resize: true,
|
975
|
-
selectedAttraction: 0.025,
|
976
|
-
setGallerySize: true,
|
977
|
-
// watchCSS: false,
|
978
|
-
// wrapAround: false
|
979
|
-
};
|
980
|
-
|
981
|
-
// hash of methods triggered on _create()
|
982
|
-
Flickity.createMethods = [];
|
983
|
-
|
984
|
-
var proto$8 = Flickity.prototype;
|
985
|
-
// inherit EventEmitter
|
986
|
-
utils.extend(proto$8, evEmitter.prototype);
|
987
|
-
|
988
|
-
proto$8._create = function () {
|
989
|
-
// add id for Flickity.data
|
990
|
-
var id = (this.guid = ++GUID);
|
991
|
-
this.element.flickityGUID = id; // expando
|
992
|
-
instances[id] = this; // associate via id
|
993
|
-
// initial properties
|
994
|
-
this.selectedIndex = 0;
|
995
|
-
// how many frames slider has been in same position
|
996
|
-
this.restingFrames = 0;
|
997
|
-
// initial physics properties
|
998
|
-
this.x = 0;
|
999
|
-
this.velocity = 0;
|
1000
|
-
this.originSide = this.options.rightToLeft ? 'right' : 'left';
|
1001
|
-
// create viewport & slider
|
1002
|
-
this.viewport = document.createElement('div');
|
1003
|
-
this.viewport.className = 'flickity-viewport';
|
1004
|
-
this.viewport.part.add('slide-viewport');
|
1005
|
-
this._createSlider();
|
1006
|
-
|
1007
|
-
if (this.options.resize || this.options.watchCSS) {
|
1008
|
-
window.addEventListener('resize', this);
|
1009
|
-
}
|
1010
|
-
|
1011
|
-
// add listeners from on option
|
1012
|
-
for (var eventName in this.options.on) {
|
1013
|
-
var listener = this.options.on[eventName];
|
1014
|
-
this.on(eventName, listener);
|
1015
|
-
}
|
1016
|
-
|
1017
|
-
Flickity.createMethods.forEach(function (method) {
|
1018
|
-
this[method]();
|
1019
|
-
}, this);
|
1020
|
-
|
1021
|
-
if (this.options.watchCSS) {
|
1022
|
-
this.watchCSS();
|
1023
|
-
} else {
|
1024
|
-
this.activate();
|
1025
|
-
}
|
1026
|
-
};
|
1027
|
-
|
1028
|
-
/**
|
1029
|
-
* set options
|
1030
|
-
* @param {Object} opts
|
1031
|
-
*/
|
1032
|
-
proto$8.option = function (opts) {
|
1033
|
-
utils.extend(this.options, opts);
|
1034
|
-
};
|
1035
|
-
|
1036
|
-
proto$8.activate = function () {
|
1037
|
-
if (this.isActive) {
|
1038
|
-
return;
|
1039
|
-
}
|
1040
|
-
this.isActive = true;
|
1041
|
-
this.element.classList.add('flickity-enabled');
|
1042
|
-
if (this.options.rightToLeft) {
|
1043
|
-
this.element.classList.add('flickity-rtl');
|
1044
|
-
}
|
1045
|
-
|
1046
|
-
this.getSize();
|
1047
|
-
// move initial cell elements so they can be loaded as cells
|
1048
|
-
var cellElems = this.element.children; //this._filterFindCellElements( this.element.children );
|
1049
|
-
moveElements(cellElems, this.slider);
|
1050
|
-
this.viewport.appendChild(this.slider);
|
1051
|
-
this.element.appendChild(this.viewport);
|
1052
|
-
// get cells from children
|
1053
|
-
this.reloadCells();
|
1054
|
-
|
1055
|
-
if (this.options.accessibility) {
|
1056
|
-
// allow element to focusable
|
1057
|
-
this.element.tabIndex = 0;
|
1058
|
-
// listen for key presses
|
1059
|
-
this.element.addEventListener('keydown', this);
|
1060
|
-
}
|
1061
|
-
|
1062
|
-
this.emitEvent('activate');
|
1063
|
-
this.selectInitialIndex();
|
1064
|
-
// flag for initial activation, for using initialIndex
|
1065
|
-
this.isInitActivated = true;
|
1066
|
-
// ready event. #493
|
1067
|
-
this.dispatchEvent('ready');
|
1068
|
-
};
|
1069
|
-
|
1070
|
-
// slider positions the cells
|
1071
|
-
proto$8._createSlider = function () {
|
1072
|
-
// slider element does all the positioning
|
1073
|
-
var slider = document.createElement('div');
|
1074
|
-
slider.className = 'flickity-slider';
|
1075
|
-
slider.style[this.originSide] = 0;
|
1076
|
-
this.slider = slider;
|
1077
|
-
};
|
1078
|
-
|
1079
|
-
proto$8._filterFindCellElements = function (elems) {
|
1080
|
-
return utils.filterFindElements(elems, this.options.cellSelector);
|
1081
|
-
};
|
1082
|
-
|
1083
|
-
// goes through all children
|
1084
|
-
proto$8.reloadCells = function () {
|
1085
|
-
// collection of item elements
|
1086
|
-
this.cells = this._makeCells(
|
1087
|
-
this.slider.getRootNode().host
|
1088
|
-
? this.slider.getRootNode().host.children
|
1089
|
-
: this.slider.children
|
1090
|
-
);
|
1091
|
-
this.positionCells();
|
1092
|
-
this._getWrapShiftCells();
|
1093
|
-
this.setGallerySize();
|
1094
|
-
};
|
1095
|
-
|
1096
|
-
/**
|
1097
|
-
* turn elements into Flickity.Cells
|
1098
|
-
* @param {Array or NodeList or HTMLElement} elems
|
1099
|
-
* @returns {Array} items - collection of new Flickity Cells
|
1100
|
-
*/
|
1101
|
-
proto$8._makeCells = function (elems) {
|
1102
|
-
var cellElems = this._filterFindCellElements(elems);
|
1103
|
-
|
1104
|
-
// create new Flickity for collection
|
1105
|
-
var cells = cellElems.map(function (cellElem) {
|
1106
|
-
return new Cell(cellElem, this);
|
1107
|
-
}, this);
|
1108
|
-
|
1109
|
-
return cells;
|
1110
|
-
};
|
1111
|
-
|
1112
|
-
proto$8.getLastCell = function () {
|
1113
|
-
return this.cells[this.cells.length - 1];
|
1114
|
-
};
|
1115
|
-
|
1116
|
-
proto$8.getLastSlide = function () {
|
1117
|
-
return this.slides[this.slides.length - 1];
|
1118
|
-
};
|
1119
|
-
|
1120
|
-
// positions all cells
|
1121
|
-
proto$8.positionCells = function () {
|
1122
|
-
// size all cells
|
1123
|
-
this._sizeCells(this.cells);
|
1124
|
-
// position all cells
|
1125
|
-
this._positionCells(0);
|
1126
|
-
};
|
1127
|
-
|
1128
|
-
/**
|
1129
|
-
* position certain cells
|
1130
|
-
* @param {Integer} index - which cell to start with
|
1131
|
-
*/
|
1132
|
-
proto$8._positionCells = function (index) {
|
1133
|
-
index = index || 0;
|
1134
|
-
// also measure maxCellHeight
|
1135
|
-
// start 0 if positioning all cells
|
1136
|
-
this.maxCellHeight = index ? this.maxCellHeight || 0 : 0;
|
1137
|
-
var cellX = 0;
|
1138
|
-
// get cellX
|
1139
|
-
if (index > 0) {
|
1140
|
-
var startCell = this.cells[index - 1];
|
1141
|
-
cellX = startCell.x + startCell.size.outerWidth;
|
1142
|
-
}
|
1143
|
-
var len = this.cells.length;
|
1144
|
-
for (var i = index; i < len; i++) {
|
1145
|
-
var cell = this.cells[i];
|
1146
|
-
cell.setPosition(cellX);
|
1147
|
-
cellX += cell.size.outerWidth;
|
1148
|
-
this.maxCellHeight = Math.max(cell.size.outerHeight, this.maxCellHeight);
|
1149
|
-
}
|
1150
|
-
// keep track of cellX for wrap-around
|
1151
|
-
this.slideableWidth = cellX;
|
1152
|
-
// slides
|
1153
|
-
this.updateSlides();
|
1154
|
-
// contain slides target
|
1155
|
-
this._containSlides();
|
1156
|
-
// update slidesWidth
|
1157
|
-
this.slidesWidth = len
|
1158
|
-
? this.getLastSlide().target - this.slides[0].target
|
1159
|
-
: 0;
|
1160
|
-
};
|
1161
|
-
|
1162
|
-
/**
|
1163
|
-
* cell.getSize() on multiple cells
|
1164
|
-
* @param {Array} cells
|
1165
|
-
*/
|
1166
|
-
proto$8._sizeCells = function (cells) {
|
1167
|
-
cells.forEach(function (cell) {
|
1168
|
-
cell.getSize();
|
1169
|
-
});
|
1170
|
-
};
|
1171
|
-
|
1172
|
-
// -------------------------- -------------------------- //
|
1173
|
-
|
1174
|
-
proto$8.updateSlides = function () {
|
1175
|
-
this.slides = [];
|
1176
|
-
if (!this.cells.length) {
|
1177
|
-
return;
|
1178
|
-
}
|
1179
|
-
|
1180
|
-
var slide = new Slide$1(this);
|
1181
|
-
this.slides.push(slide);
|
1182
|
-
var isOriginLeft = this.originSide == 'left';
|
1183
|
-
var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft';
|
1184
|
-
|
1185
|
-
var canCellFit = this._getCanCellFit();
|
1186
|
-
|
1187
|
-
this.cells.forEach(function (cell, i) {
|
1188
|
-
// just add cell if first cell in slide
|
1189
|
-
if (!slide.cells.length) {
|
1190
|
-
slide.addCell(cell);
|
1191
|
-
return;
|
1192
|
-
}
|
1193
|
-
|
1194
|
-
var slideWidth =
|
1195
|
-
slide.outerWidth -
|
1196
|
-
slide.firstMargin +
|
1197
|
-
(cell.size.outerWidth - cell.size[nextMargin]);
|
1198
|
-
|
1199
|
-
if (canCellFit.call(this, i, slideWidth)) {
|
1200
|
-
slide.addCell(cell);
|
1201
|
-
} else {
|
1202
|
-
// doesn't fit, new slide
|
1203
|
-
slide.updateTarget();
|
1204
|
-
|
1205
|
-
slide = new Slide$1(this);
|
1206
|
-
this.slides.push(slide);
|
1207
|
-
slide.addCell(cell);
|
1208
|
-
}
|
1209
|
-
}, this);
|
1210
|
-
// last slide
|
1211
|
-
slide.updateTarget();
|
1212
|
-
// update .selectedSlide
|
1213
|
-
this.updateSelectedSlide();
|
1214
|
-
};
|
1215
|
-
|
1216
|
-
proto$8._getCanCellFit = function () {
|
1217
|
-
var groupCells = this.options.groupCells;
|
1218
|
-
if (!groupCells) {
|
1219
|
-
return function () {
|
1220
|
-
return false;
|
1221
|
-
};
|
1222
|
-
} else if (typeof groupCells == 'number') {
|
1223
|
-
// group by number. 3 -> [0,1,2], [3,4,5], ...
|
1224
|
-
var number = parseInt(groupCells, 10);
|
1225
|
-
return function (i) {
|
1226
|
-
return i % number !== 0;
|
1227
|
-
};
|
1228
|
-
}
|
1229
|
-
// default, group by width of slide
|
1230
|
-
// parse '75%
|
1231
|
-
var percentMatch =
|
1232
|
-
typeof groupCells == 'string' && groupCells.match(/^(\d+)%$/);
|
1233
|
-
var percent = percentMatch ? parseInt(percentMatch[1], 10) / 100 : 1;
|
1234
|
-
return function (i, slideWidth) {
|
1235
|
-
return slideWidth <= (this.size.innerWidth + 1) * percent;
|
1236
|
-
};
|
1237
|
-
};
|
1238
|
-
|
1239
|
-
// alias _init for jQuery plugin .flickity()
|
1240
|
-
proto$8._init = proto$8.reposition = function () {
|
1241
|
-
this.positionCells();
|
1242
|
-
this.positionSliderAtSelected();
|
1243
|
-
};
|
1244
|
-
|
1245
|
-
proto$8.getSize = function () {
|
1246
|
-
this.size = getSize(this.element);
|
1247
|
-
this.setCellAlign();
|
1248
|
-
this.cursorPosition = this.size.innerWidth * this.cellAlign;
|
1249
|
-
};
|
1250
|
-
|
1251
|
-
var cellAlignShorthands = {
|
1252
|
-
// cell align, then based on origin side
|
1253
|
-
center: {
|
1254
|
-
left: 0.5,
|
1255
|
-
right: 0.5,
|
1256
|
-
},
|
1257
|
-
left: {
|
1258
|
-
left: 0,
|
1259
|
-
right: 1,
|
1260
|
-
},
|
1261
|
-
right: {
|
1262
|
-
right: 0,
|
1263
|
-
left: 1,
|
1264
|
-
},
|
1265
|
-
};
|
1266
|
-
|
1267
|
-
proto$8.setCellAlign = function () {
|
1268
|
-
var shorthand = cellAlignShorthands[this.options.cellAlign];
|
1269
|
-
this.cellAlign = shorthand
|
1270
|
-
? shorthand[this.originSide]
|
1271
|
-
: this.options.cellAlign;
|
1272
|
-
};
|
1273
|
-
|
1274
|
-
proto$8.setGallerySize = function () {
|
1275
|
-
if (this.options.setGallerySize) {
|
1276
|
-
var height =
|
1277
|
-
this.options.adaptiveHeight && this.selectedSlide
|
1278
|
-
? this.selectedSlide.height
|
1279
|
-
: this.maxCellHeight;
|
1280
|
-
this.viewport.style.height = height + 'px';
|
1281
|
-
}
|
1282
|
-
};
|
1283
|
-
|
1284
|
-
proto$8._getWrapShiftCells = function () {
|
1285
|
-
// only for wrap-around
|
1286
|
-
if (!this.options.wrapAround) {
|
1287
|
-
return;
|
1288
|
-
}
|
1289
|
-
// unshift previous cells
|
1290
|
-
this._unshiftCells(this.beforeShiftCells);
|
1291
|
-
this._unshiftCells(this.afterShiftCells);
|
1292
|
-
// get before cells
|
1293
|
-
// initial gap
|
1294
|
-
var gapX = this.cursorPosition;
|
1295
|
-
var cellIndex = this.cells.length - 1;
|
1296
|
-
this.beforeShiftCells = this._getGapCells(gapX, cellIndex, -1);
|
1297
|
-
// get after cells
|
1298
|
-
// ending gap between last cell and end of gallery viewport
|
1299
|
-
gapX = this.size.innerWidth - this.cursorPosition;
|
1300
|
-
// start cloning at first cell, working forwards
|
1301
|
-
this.afterShiftCells = this._getGapCells(gapX, 0, 1);
|
1302
|
-
};
|
1303
|
-
|
1304
|
-
proto$8._getGapCells = function (gapX, cellIndex, increment) {
|
1305
|
-
// keep adding cells until the cover the initial gap
|
1306
|
-
var cells = [];
|
1307
|
-
while (gapX > 0) {
|
1308
|
-
var cell = this.cells[cellIndex];
|
1309
|
-
if (!cell) {
|
1310
|
-
break;
|
1311
|
-
}
|
1312
|
-
cells.push(cell);
|
1313
|
-
cellIndex += increment;
|
1314
|
-
gapX -= cell.size.outerWidth;
|
1315
|
-
}
|
1316
|
-
return cells;
|
1317
|
-
};
|
1318
|
-
|
1319
|
-
// ----- contain ----- //
|
1320
|
-
|
1321
|
-
// contain cell targets so no excess sliding
|
1322
|
-
proto$8._containSlides = function () {
|
1323
|
-
if (!this.options.contain || this.options.wrapAround || !this.cells.length) {
|
1324
|
-
return;
|
1325
|
-
}
|
1326
|
-
var isRightToLeft = this.options.rightToLeft;
|
1327
|
-
var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft';
|
1328
|
-
var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight';
|
1329
|
-
var contentWidth = this.slideableWidth - this.getLastCell().size[endMargin];
|
1330
|
-
// content is less than gallery size
|
1331
|
-
var isContentSmaller = contentWidth < this.size.innerWidth;
|
1332
|
-
// bounds
|
1333
|
-
var beginBound = this.cursorPosition + this.cells[0].size[beginMargin];
|
1334
|
-
var endBound = contentWidth - this.size.innerWidth * (1 - this.cellAlign);
|
1335
|
-
// contain each cell target
|
1336
|
-
this.slides.forEach(function (slide) {
|
1337
|
-
if (isContentSmaller) {
|
1338
|
-
// all cells fit inside gallery
|
1339
|
-
slide.target = contentWidth * this.cellAlign;
|
1340
|
-
} else {
|
1341
|
-
// contain to bounds
|
1342
|
-
slide.target = Math.max(slide.target, beginBound);
|
1343
|
-
slide.target = Math.min(slide.target, endBound);
|
1344
|
-
}
|
1345
|
-
}, this);
|
1346
|
-
};
|
1347
|
-
|
1348
|
-
// ----- ----- //
|
1349
|
-
|
1350
|
-
/**
|
1351
|
-
* emits events via eventEmitter and jQuery events
|
1352
|
-
* @param {String} type - name of event
|
1353
|
-
* @param {Event} event - original event
|
1354
|
-
* @param {Array} args - extra arguments
|
1355
|
-
*/
|
1356
|
-
proto$8.dispatchEvent = function (type, event, args) {
|
1357
|
-
var emitArgs = event ? [event].concat(args) : args;
|
1358
|
-
this.emitEvent(type, emitArgs);
|
1359
|
-
};
|
1360
|
-
|
1361
|
-
// -------------------------- select -------------------------- //
|
1362
|
-
|
1363
|
-
/**
|
1364
|
-
* @param {Integer} index - index of the slide
|
1365
|
-
* @param {Boolean} isWrap - will wrap-around to last/first if at the end
|
1366
|
-
* @param {Boolean} isInstant - will immediately set position at selected cell
|
1367
|
-
*/
|
1368
|
-
proto$8.select = function (index, isWrap, isInstant) {
|
1369
|
-
if (!this.isActive) {
|
1370
|
-
return;
|
1371
|
-
}
|
1372
|
-
index = parseInt(index, 10);
|
1373
|
-
this._wrapSelect(index);
|
1374
|
-
|
1375
|
-
if (this.options.wrapAround || isWrap) {
|
1376
|
-
index = utils.modulo(index, this.slides.length);
|
1377
|
-
}
|
1378
|
-
// bail if invalid index
|
1379
|
-
if (!this.slides[index]) {
|
1380
|
-
return;
|
1381
|
-
}
|
1382
|
-
var prevIndex = this.selectedIndex;
|
1383
|
-
this.selectedIndex = index;
|
1384
|
-
this.updateSelectedSlide();
|
1385
|
-
if (isInstant) {
|
1386
|
-
this.positionSliderAtSelected();
|
1387
|
-
} else {
|
1388
|
-
this.startAnimation();
|
1389
|
-
}
|
1390
|
-
if (this.options.adaptiveHeight) {
|
1391
|
-
this.setGallerySize();
|
1392
|
-
}
|
1393
|
-
// events
|
1394
|
-
this.dispatchEvent('select', null, [index]);
|
1395
|
-
// change event if new index
|
1396
|
-
if (index != prevIndex) {
|
1397
|
-
this.dispatchEvent('change', null, [index]);
|
1398
|
-
}
|
1399
|
-
// old v1 event name, remove in v3
|
1400
|
-
this.dispatchEvent('cellSelect');
|
1401
|
-
};
|
1402
|
-
|
1403
|
-
// wraps position for wrapAround, to move to closest slide. #113
|
1404
|
-
proto$8._wrapSelect = function (index) {
|
1405
|
-
var len = this.slides.length;
|
1406
|
-
var isWrapping = this.options.wrapAround && len > 1;
|
1407
|
-
if (!isWrapping) {
|
1408
|
-
return index;
|
1409
|
-
}
|
1410
|
-
var wrapIndex = utils.modulo(index, len);
|
1411
|
-
// go to shortest
|
1412
|
-
var delta = Math.abs(wrapIndex - this.selectedIndex);
|
1413
|
-
var backWrapDelta = Math.abs(wrapIndex + len - this.selectedIndex);
|
1414
|
-
var forewardWrapDelta = Math.abs(wrapIndex - len - this.selectedIndex);
|
1415
|
-
if (!this.isDragSelect && backWrapDelta < delta) {
|
1416
|
-
index += len;
|
1417
|
-
} else if (!this.isDragSelect && forewardWrapDelta < delta) {
|
1418
|
-
index -= len;
|
1419
|
-
}
|
1420
|
-
// wrap position so slider is within normal area
|
1421
|
-
if (index < 0) {
|
1422
|
-
this.x -= this.slideableWidth;
|
1423
|
-
} else if (index >= len) {
|
1424
|
-
this.x += this.slideableWidth;
|
1425
|
-
}
|
1426
|
-
};
|
1427
|
-
|
1428
|
-
proto$8.previous = function (isWrap, isInstant) {
|
1429
|
-
this.select(this.selectedIndex - 1, isWrap, isInstant);
|
1430
|
-
};
|
1431
|
-
|
1432
|
-
proto$8.next = function (isWrap, isInstant) {
|
1433
|
-
this.select(this.selectedIndex + 1, isWrap, isInstant);
|
1434
|
-
};
|
1435
|
-
|
1436
|
-
proto$8.updateSelectedSlide = function () {
|
1437
|
-
var slide = this.slides[this.selectedIndex];
|
1438
|
-
// selectedIndex could be outside of slides, if triggered before resize()
|
1439
|
-
if (!slide) {
|
1440
|
-
return;
|
1441
|
-
}
|
1442
|
-
// unselect previous selected slide
|
1443
|
-
this.unselectSelectedSlide();
|
1444
|
-
// update new selected slide
|
1445
|
-
this.selectedSlide = slide;
|
1446
|
-
slide.select();
|
1447
|
-
this.selectedCells = slide.cells;
|
1448
|
-
this.selectedElements = slide.getCellElements();
|
1449
|
-
// HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility
|
1450
|
-
// Remove in v3?
|
1451
|
-
this.selectedCell = slide.cells[0];
|
1452
|
-
this.selectedElement = this.selectedElements[0];
|
1453
|
-
};
|
1454
|
-
|
1455
|
-
proto$8.unselectSelectedSlide = function () {
|
1456
|
-
if (this.selectedSlide) {
|
1457
|
-
this.selectedSlide.unselect();
|
1458
|
-
}
|
1459
|
-
};
|
1460
|
-
|
1461
|
-
proto$8.selectInitialIndex = function () {
|
1462
|
-
var initialIndex = this.options.initialIndex;
|
1463
|
-
// already activated, select previous selectedIndex
|
1464
|
-
if (this.isInitActivated) {
|
1465
|
-
this.select(this.selectedIndex, false, true);
|
1466
|
-
return;
|
1467
|
-
}
|
1468
|
-
// select with selector string
|
1469
|
-
if (initialIndex && typeof initialIndex == 'string') {
|
1470
|
-
var cell = this.queryCell(initialIndex);
|
1471
|
-
if (cell) {
|
1472
|
-
this.selectCell(initialIndex, false, true);
|
1473
|
-
return;
|
1474
|
-
}
|
1475
|
-
}
|
1476
|
-
|
1477
|
-
var index = 0;
|
1478
|
-
// select with number
|
1479
|
-
if (initialIndex && this.slides[initialIndex]) {
|
1480
|
-
index = initialIndex;
|
1481
|
-
}
|
1482
|
-
// select instantly
|
1483
|
-
this.select(index, false, true);
|
1484
|
-
};
|
1485
|
-
|
1486
|
-
/**
|
1487
|
-
* select slide from number or cell element
|
1488
|
-
* @param {Element or Number} elem
|
1489
|
-
*/
|
1490
|
-
proto$8.selectCell = function (value, isWrap, isInstant) {
|
1491
|
-
// get cell
|
1492
|
-
var cell = this.queryCell(value);
|
1493
|
-
if (!cell) {
|
1494
|
-
return;
|
1495
|
-
}
|
1496
|
-
|
1497
|
-
var index = this.getCellSlideIndex(cell);
|
1498
|
-
this.select(index, isWrap, isInstant);
|
1499
|
-
};
|
1500
|
-
|
1501
|
-
proto$8.getCellSlideIndex = function (cell) {
|
1502
|
-
// get index of slides that has cell
|
1503
|
-
for (var i = 0; i < this.slides.length; i++) {
|
1504
|
-
var slide = this.slides[i];
|
1505
|
-
var index = slide.cells.indexOf(cell);
|
1506
|
-
if (index != -1) {
|
1507
|
-
return i;
|
1508
|
-
}
|
1509
|
-
}
|
1510
|
-
};
|
1511
|
-
|
1512
|
-
// -------------------------- get cells -------------------------- //
|
1513
|
-
|
1514
|
-
/**
|
1515
|
-
* get Flickity.Cell, given an Element
|
1516
|
-
* @param {Element} elem
|
1517
|
-
* @returns {Flickity.Cell} item
|
1518
|
-
*/
|
1519
|
-
proto$8.getCell = function (elem) {
|
1520
|
-
// loop through cells to get the one that matches
|
1521
|
-
for (var i = 0; i < this.cells.length; i++) {
|
1522
|
-
var cell = this.cells[i];
|
1523
|
-
if (cell.element == elem) {
|
1524
|
-
return cell;
|
1525
|
-
}
|
1526
|
-
}
|
1527
|
-
};
|
1528
|
-
|
1529
|
-
/**
|
1530
|
-
* get collection of Flickity.Cells, given Elements
|
1531
|
-
* @param {Element, Array, NodeList} elems
|
1532
|
-
* @returns {Array} cells - Flickity.Cells
|
1533
|
-
*/
|
1534
|
-
proto$8.getCells = function (elems) {
|
1535
|
-
elems = utils.makeArray(elems);
|
1536
|
-
var cells = [];
|
1537
|
-
elems.forEach(function (elem) {
|
1538
|
-
var cell = this.getCell(elem);
|
1539
|
-
if (cell) {
|
1540
|
-
cells.push(cell);
|
1541
|
-
}
|
1542
|
-
}, this);
|
1543
|
-
return cells;
|
1544
|
-
};
|
1545
|
-
|
1546
|
-
/**
|
1547
|
-
* get cell elements
|
1548
|
-
* @returns {Array} cellElems
|
1549
|
-
*/
|
1550
|
-
proto$8.getCellElements = function () {
|
1551
|
-
return this.cells.map(function (cell) {
|
1552
|
-
return cell.element;
|
1553
|
-
});
|
1554
|
-
};
|
1555
|
-
|
1556
|
-
/**
|
1557
|
-
* get parent cell from an element
|
1558
|
-
* @param {Element} elem
|
1559
|
-
* @returns {Flickit.Cell} cell
|
1560
|
-
*/
|
1561
|
-
proto$8.getParentCell = function (elem) {
|
1562
|
-
// first check if elem is cell
|
1563
|
-
var cell = this.getCell(elem);
|
1564
|
-
if (cell) {
|
1565
|
-
return cell;
|
1566
|
-
}
|
1567
|
-
// try to get parent cell elem
|
1568
|
-
elem = utils.getParent(elem, '.flickity-slider > *');
|
1569
|
-
return this.getCell(elem);
|
1570
|
-
};
|
1571
|
-
|
1572
|
-
/**
|
1573
|
-
* get cells adjacent to a slide
|
1574
|
-
* @param {Integer} adjCount - number of adjacent slides
|
1575
|
-
* @param {Integer} index - index of slide to start
|
1576
|
-
* @returns {Array} cells - array of Flickity.Cells
|
1577
|
-
*/
|
1578
|
-
proto$8.getAdjacentCellElements = function (adjCount, index) {
|
1579
|
-
if (!adjCount) {
|
1580
|
-
return this.selectedSlide.getCellElements();
|
1581
|
-
}
|
1582
|
-
index = index === undefined ? this.selectedIndex : index;
|
1583
|
-
|
1584
|
-
var len = this.slides.length;
|
1585
|
-
if (1 + adjCount * 2 >= len) {
|
1586
|
-
return this.getCellElements();
|
1587
|
-
}
|
1588
|
-
|
1589
|
-
var cellElems = [];
|
1590
|
-
for (var i = index - adjCount; i <= index + adjCount; i++) {
|
1591
|
-
var slideIndex = this.options.wrapAround ? utils.modulo(i, len) : i;
|
1592
|
-
var slide = this.slides[slideIndex];
|
1593
|
-
if (slide) {
|
1594
|
-
cellElems = cellElems.concat(slide.getCellElements());
|
1595
|
-
}
|
1596
|
-
}
|
1597
|
-
return cellElems;
|
1598
|
-
};
|
1599
|
-
|
1600
|
-
/**
|
1601
|
-
* select slide from number or cell element
|
1602
|
-
* @param {Element, Selector String, or Number} selector
|
1603
|
-
*/
|
1604
|
-
proto$8.queryCell = function (selector) {
|
1605
|
-
if (typeof selector == 'number') {
|
1606
|
-
// use number as index
|
1607
|
-
return this.cells[selector];
|
1608
|
-
}
|
1609
|
-
if (typeof selector == 'string') {
|
1610
|
-
// do not select invalid selectors from hash: #123, #/. #791
|
1611
|
-
if (selector.match(/^[#\.]?[\d\/]/)) {
|
1612
|
-
return;
|
1613
|
-
}
|
1614
|
-
// use string as selector, get element
|
1615
|
-
selector = this.element.querySelector(selector);
|
1616
|
-
}
|
1617
|
-
// get cell from element
|
1618
|
-
return this.getCell(selector);
|
1619
|
-
};
|
1620
|
-
|
1621
|
-
// -------------------------- events -------------------------- //
|
1622
|
-
|
1623
|
-
proto$8.uiChange = function () {
|
1624
|
-
this.emitEvent('uiChange');
|
1625
|
-
};
|
1626
|
-
|
1627
|
-
// keep focus on element when child UI elements are clicked
|
1628
|
-
proto$8.childUIPointerDown = function (event) {
|
1629
|
-
// HACK iOS does not allow touch events to bubble up?!
|
1630
|
-
if (event.type != 'touchstart') {
|
1631
|
-
event.preventDefault();
|
1632
|
-
}
|
1633
|
-
this.focus();
|
1634
|
-
};
|
1635
|
-
|
1636
|
-
// ----- resize ----- //
|
1637
|
-
|
1638
|
-
proto$8.onresize = function () {
|
1639
|
-
this.watchCSS();
|
1640
|
-
this.resize();
|
1641
|
-
};
|
1642
|
-
|
1643
|
-
utils.debounceMethod(Flickity, 'onresize', 150);
|
1644
|
-
|
1645
|
-
proto$8.resize = function () {
|
1646
|
-
if (!this.isActive) {
|
1647
|
-
return;
|
1648
|
-
}
|
1649
|
-
this.getSize();
|
1650
|
-
// wrap values
|
1651
|
-
if (this.options.wrapAround) {
|
1652
|
-
this.x = utils.modulo(this.x, this.slideableWidth);
|
1653
|
-
}
|
1654
|
-
this.positionCells();
|
1655
|
-
this._getWrapShiftCells();
|
1656
|
-
this.setGallerySize();
|
1657
|
-
this.emitEvent('resize');
|
1658
|
-
// update selected index for group slides, instant
|
1659
|
-
// TODO: position can be lost between groups of various numbers
|
1660
|
-
var selectedElement = this.selectedElements && this.selectedElements[0];
|
1661
|
-
this.selectCell(selectedElement, false, true);
|
1662
|
-
};
|
1663
|
-
|
1664
|
-
// watches the :after property, activates/deactivates
|
1665
|
-
proto$8.watchCSS = function () {
|
1666
|
-
var watchOption = this.options.watchCSS;
|
1667
|
-
if (!watchOption) {
|
1668
|
-
return;
|
1669
|
-
}
|
1670
|
-
|
1671
|
-
var afterContent = getComputedStyle$1(this.element, ':after').content;
|
1672
|
-
// activate if :after { content: 'flickity' }
|
1673
|
-
if (afterContent.indexOf('flickity') != -1) {
|
1674
|
-
this.activate();
|
1675
|
-
} else {
|
1676
|
-
this.deactivate();
|
1677
|
-
}
|
1678
|
-
};
|
1679
|
-
|
1680
|
-
// ----- keydown ----- //
|
1681
|
-
|
1682
|
-
// go previous/next if left/right keys pressed
|
1683
|
-
proto$8.onkeydown = function (event) {
|
1684
|
-
// only work if element is in focus
|
1685
|
-
var isNotFocused =
|
1686
|
-
document.activeElement && document.activeElement != this.element;
|
1687
|
-
if (!this.options.accessibility || isNotFocused) {
|
1688
|
-
return;
|
1689
|
-
}
|
1690
|
-
|
1691
|
-
var handler = Flickity.keyboardHandlers[event.keyCode];
|
1692
|
-
if (handler) {
|
1693
|
-
handler.call(this);
|
1694
|
-
}
|
1695
|
-
};
|
1696
|
-
|
1697
|
-
Flickity.keyboardHandlers = {
|
1698
|
-
// left arrow
|
1699
|
-
37: function () {
|
1700
|
-
var leftMethod = this.options.rightToLeft ? 'next' : 'previous';
|
1701
|
-
this.uiChange();
|
1702
|
-
this[leftMethod]();
|
1703
|
-
},
|
1704
|
-
// right arrow
|
1705
|
-
39: function () {
|
1706
|
-
var rightMethod = this.options.rightToLeft ? 'previous' : 'next';
|
1707
|
-
this.uiChange();
|
1708
|
-
this[rightMethod]();
|
1709
|
-
},
|
1710
|
-
};
|
1711
|
-
|
1712
|
-
// ----- focus ----- //
|
1713
|
-
|
1714
|
-
proto$8.focus = function () {
|
1715
|
-
// TODO remove scrollTo once focus options gets more support
|
1716
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#Browser_compatibility
|
1717
|
-
var prevScrollY = window.pageYOffset;
|
1718
|
-
this.element.focus({ preventScroll: true });
|
1719
|
-
// hack to fix scroll jump after focus, #76
|
1720
|
-
if (window.pageYOffset != prevScrollY) {
|
1721
|
-
window.scrollTo(window.pageXOffset, prevScrollY);
|
1722
|
-
}
|
1723
|
-
};
|
1724
|
-
|
1725
|
-
// -------------------------- destroy -------------------------- //
|
1726
|
-
|
1727
|
-
// deactivate all Flickity functionality, but keep stuff available
|
1728
|
-
proto$8.deactivate = function () {
|
1729
|
-
if (!this.isActive) {
|
1730
|
-
return;
|
1731
|
-
}
|
1732
|
-
this.element.classList.remove('flickity-enabled');
|
1733
|
-
this.element.classList.remove('flickity-rtl');
|
1734
|
-
this.unselectSelectedSlide();
|
1735
|
-
// destroy cells
|
1736
|
-
this.cells.forEach(function (cell) {
|
1737
|
-
cell.destroy();
|
1738
|
-
});
|
1739
|
-
this.element.removeChild(this.viewport);
|
1740
|
-
// move child elements back into element
|
1741
|
-
moveElements(this.slider.children, this.element);
|
1742
|
-
if (this.options.accessibility) {
|
1743
|
-
this.element.removeAttribute('tabIndex');
|
1744
|
-
this.element.removeEventListener('keydown', this);
|
1745
|
-
}
|
1746
|
-
// set flags
|
1747
|
-
this.isActive = false;
|
1748
|
-
this.emitEvent('deactivate');
|
1749
|
-
};
|
1750
|
-
|
1751
|
-
proto$8.destroy = function () {
|
1752
|
-
this.deactivate();
|
1753
|
-
window.removeEventListener('resize', this);
|
1754
|
-
this.allOff();
|
1755
|
-
this.emitEvent('destroy');
|
1756
|
-
delete this.element.flickityGUID;
|
1757
|
-
delete instances[this.guid];
|
1758
|
-
};
|
1759
|
-
|
1760
|
-
// -------------------------- prototype -------------------------- //
|
1761
|
-
|
1762
|
-
utils.extend(proto$8, proto$9);
|
1763
|
-
|
1764
|
-
// -------------------------- extras -------------------------- //
|
1765
|
-
|
1766
|
-
/**
|
1767
|
-
* get Flickity instance from element
|
1768
|
-
* @param {Element} elem
|
1769
|
-
* @returns {Flickity}
|
1770
|
-
*/
|
1771
|
-
Flickity.data = function (elem) {
|
1772
|
-
elem = utils.getQueryElement(elem);
|
1773
|
-
var id = elem && elem.flickityGUID;
|
1774
|
-
return id && instances[id];
|
1775
|
-
};
|
1776
|
-
|
1777
|
-
utils.htmlInit(Flickity, 'flickity');
|
1778
|
-
|
1779
|
-
Flickity.Cell = Cell;
|
1780
|
-
Flickity.Slide = Slide$1;
|
1781
|
-
|
1782
|
-
var unipointer = _commonjsHelpers.createCommonjsModule(function (module) {
|
1783
|
-
/*!
|
1784
|
-
* Unipointer v2.4.0
|
1785
|
-
* base class for doing one thing with pointer event
|
1786
|
-
* MIT license
|
1787
|
-
*/
|
1788
|
-
|
1789
|
-
/*jshint browser: true, undef: true, unused: true, strict: true */
|
1790
|
-
|
1791
|
-
( function( window, factory ) {
|
1792
|
-
// universal module definition
|
1793
|
-
/* jshint strict: false */ /*global define, module, require */
|
1794
|
-
if ( module.exports ) {
|
1795
|
-
// CommonJS
|
1796
|
-
module.exports = factory(
|
1797
|
-
window,
|
1798
|
-
evEmitter
|
1799
|
-
);
|
1800
|
-
} else {
|
1801
|
-
// browser global
|
1802
|
-
window.Unipointer = factory(
|
1803
|
-
window,
|
1804
|
-
window.EvEmitter
|
1805
|
-
);
|
1806
|
-
}
|
1807
|
-
|
1808
|
-
}( window, function factory( window, EvEmitter ) {
|
1809
|
-
|
1810
|
-
function noop() {}
|
1811
|
-
|
1812
|
-
function Unipointer() {}
|
1813
|
-
|
1814
|
-
// inherit EvEmitter
|
1815
|
-
var proto = Unipointer.prototype = Object.create( EvEmitter.prototype );
|
1816
|
-
|
1817
|
-
proto.bindStartEvent = function( elem ) {
|
1818
|
-
this._bindStartEvent( elem, true );
|
1819
|
-
};
|
1820
|
-
|
1821
|
-
proto.unbindStartEvent = function( elem ) {
|
1822
|
-
this._bindStartEvent( elem, false );
|
1823
|
-
};
|
1824
|
-
|
1825
|
-
/**
|
1826
|
-
* Add or remove start event
|
1827
|
-
* @param {Boolean} isAdd - remove if falsey
|
1828
|
-
*/
|
1829
|
-
proto._bindStartEvent = function( elem, isAdd ) {
|
1830
|
-
// munge isAdd, default to true
|
1831
|
-
isAdd = isAdd === undefined ? true : isAdd;
|
1832
|
-
var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
|
1833
|
-
|
1834
|
-
// default to mouse events
|
1835
|
-
var startEvent = 'mousedown';
|
1836
|
-
if ( 'ontouchstart' in window ) {
|
1837
|
-
// HACK prefer Touch Events as you can preventDefault on touchstart to
|
1838
|
-
// disable scroll in iOS & mobile Chrome metafizzy/flickity#1177
|
1839
|
-
startEvent = 'touchstart';
|
1840
|
-
} else if ( window.PointerEvent ) {
|
1841
|
-
// Pointer Events
|
1842
|
-
startEvent = 'pointerdown';
|
1843
|
-
}
|
1844
|
-
elem[ bindMethod ]( startEvent, this );
|
1845
|
-
};
|
1846
|
-
|
1847
|
-
// trigger handler methods for events
|
1848
|
-
proto.handleEvent = function( event ) {
|
1849
|
-
var method = 'on' + event.type;
|
1850
|
-
if ( this[ method ] ) {
|
1851
|
-
this[ method ]( event );
|
1852
|
-
}
|
1853
|
-
};
|
1854
|
-
|
1855
|
-
// returns the touch that we're keeping track of
|
1856
|
-
proto.getTouch = function( touches ) {
|
1857
|
-
for ( var i=0; i < touches.length; i++ ) {
|
1858
|
-
var touch = touches[i];
|
1859
|
-
if ( touch.identifier == this.pointerIdentifier ) {
|
1860
|
-
return touch;
|
1861
|
-
}
|
1862
|
-
}
|
1863
|
-
};
|
1864
|
-
|
1865
|
-
// ----- start event ----- //
|
1866
|
-
|
1867
|
-
proto.onmousedown = function( event ) {
|
1868
|
-
// dismiss clicks from right or middle buttons
|
1869
|
-
var button = event.button;
|
1870
|
-
if ( button && ( button !== 0 && button !== 1 ) ) {
|
1871
|
-
return;
|
1872
|
-
}
|
1873
|
-
this._pointerDown( event, event );
|
1874
|
-
};
|
1875
|
-
|
1876
|
-
proto.ontouchstart = function( event ) {
|
1877
|
-
this._pointerDown( event, event.changedTouches[0] );
|
1878
|
-
};
|
1879
|
-
|
1880
|
-
proto.onpointerdown = function( event ) {
|
1881
|
-
this._pointerDown( event, event );
|
1882
|
-
};
|
1883
|
-
|
1884
|
-
/**
|
1885
|
-
* pointer start
|
1886
|
-
* @param {Event} event
|
1887
|
-
* @param {Event or Touch} pointer
|
1888
|
-
*/
|
1889
|
-
proto._pointerDown = function( event, pointer ) {
|
1890
|
-
// dismiss right click and other pointers
|
1891
|
-
// button = 0 is okay, 1-4 not
|
1892
|
-
if ( event.button || this.isPointerDown ) {
|
1893
|
-
return;
|
1894
|
-
}
|
1895
|
-
|
1896
|
-
this.isPointerDown = true;
|
1897
|
-
// save pointer identifier to match up touch events
|
1898
|
-
this.pointerIdentifier = pointer.pointerId !== undefined ?
|
1899
|
-
// pointerId for pointer events, touch.indentifier for touch events
|
1900
|
-
pointer.pointerId : pointer.identifier;
|
1901
|
-
|
1902
|
-
this.pointerDown( event, pointer );
|
1903
|
-
};
|
1904
|
-
|
1905
|
-
proto.pointerDown = function( event, pointer ) {
|
1906
|
-
this._bindPostStartEvents( event );
|
1907
|
-
this.emitEvent( 'pointerDown', [ event, pointer ] );
|
1908
|
-
};
|
1909
|
-
|
1910
|
-
// hash of events to be bound after start event
|
1911
|
-
var postStartEvents = {
|
1912
|
-
mousedown: [ 'mousemove', 'mouseup' ],
|
1913
|
-
touchstart: [ 'touchmove', 'touchend', 'touchcancel' ],
|
1914
|
-
pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ],
|
1915
|
-
};
|
1916
|
-
|
1917
|
-
proto._bindPostStartEvents = function( event ) {
|
1918
|
-
if ( !event ) {
|
1919
|
-
return;
|
1920
|
-
}
|
1921
|
-
// get proper events to match start event
|
1922
|
-
var events = postStartEvents[ event.type ];
|
1923
|
-
// bind events to node
|
1924
|
-
events.forEach( function( eventName ) {
|
1925
|
-
window.addEventListener( eventName, this );
|
1926
|
-
}, this );
|
1927
|
-
// save these arguments
|
1928
|
-
this._boundPointerEvents = events;
|
1929
|
-
};
|
1930
|
-
|
1931
|
-
proto._unbindPostStartEvents = function() {
|
1932
|
-
// check for _boundEvents, in case dragEnd triggered twice (old IE8 bug)
|
1933
|
-
if ( !this._boundPointerEvents ) {
|
1934
|
-
return;
|
1935
|
-
}
|
1936
|
-
this._boundPointerEvents.forEach( function( eventName ) {
|
1937
|
-
window.removeEventListener( eventName, this );
|
1938
|
-
}, this );
|
1939
|
-
|
1940
|
-
delete this._boundPointerEvents;
|
1941
|
-
};
|
1942
|
-
|
1943
|
-
// ----- move event ----- //
|
1944
|
-
|
1945
|
-
proto.onmousemove = function( event ) {
|
1946
|
-
this._pointerMove( event, event );
|
1947
|
-
};
|
1948
|
-
|
1949
|
-
proto.onpointermove = function( event ) {
|
1950
|
-
if ( event.pointerId == this.pointerIdentifier ) {
|
1951
|
-
this._pointerMove( event, event );
|
1952
|
-
}
|
1953
|
-
};
|
1954
|
-
|
1955
|
-
proto.ontouchmove = function( event ) {
|
1956
|
-
var touch = this.getTouch( event.changedTouches );
|
1957
|
-
if ( touch ) {
|
1958
|
-
this._pointerMove( event, touch );
|
1959
|
-
}
|
1960
|
-
};
|
1961
|
-
|
1962
|
-
/**
|
1963
|
-
* pointer move
|
1964
|
-
* @param {Event} event
|
1965
|
-
* @param {Event or Touch} pointer
|
1966
|
-
* @private
|
1967
|
-
*/
|
1968
|
-
proto._pointerMove = function( event, pointer ) {
|
1969
|
-
this.pointerMove( event, pointer );
|
1970
|
-
};
|
1971
|
-
|
1972
|
-
// public
|
1973
|
-
proto.pointerMove = function( event, pointer ) {
|
1974
|
-
this.emitEvent( 'pointerMove', [ event, pointer ] );
|
1975
|
-
};
|
1976
|
-
|
1977
|
-
// ----- end event ----- //
|
1978
|
-
|
1979
|
-
|
1980
|
-
proto.onmouseup = function( event ) {
|
1981
|
-
this._pointerUp( event, event );
|
1982
|
-
};
|
1983
|
-
|
1984
|
-
proto.onpointerup = function( event ) {
|
1985
|
-
if ( event.pointerId == this.pointerIdentifier ) {
|
1986
|
-
this._pointerUp( event, event );
|
1987
|
-
}
|
1988
|
-
};
|
1989
|
-
|
1990
|
-
proto.ontouchend = function( event ) {
|
1991
|
-
var touch = this.getTouch( event.changedTouches );
|
1992
|
-
if ( touch ) {
|
1993
|
-
this._pointerUp( event, touch );
|
1994
|
-
}
|
1995
|
-
};
|
1996
|
-
|
1997
|
-
/**
|
1998
|
-
* pointer up
|
1999
|
-
* @param {Event} event
|
2000
|
-
* @param {Event or Touch} pointer
|
2001
|
-
* @private
|
2002
|
-
*/
|
2003
|
-
proto._pointerUp = function( event, pointer ) {
|
2004
|
-
this._pointerDone();
|
2005
|
-
this.pointerUp( event, pointer );
|
2006
|
-
};
|
2007
|
-
|
2008
|
-
// public
|
2009
|
-
proto.pointerUp = function( event, pointer ) {
|
2010
|
-
this.emitEvent( 'pointerUp', [ event, pointer ] );
|
2011
|
-
};
|
2012
|
-
|
2013
|
-
// ----- pointer done ----- //
|
2014
|
-
|
2015
|
-
// triggered on pointer up & pointer cancel
|
2016
|
-
proto._pointerDone = function() {
|
2017
|
-
this._pointerReset();
|
2018
|
-
this._unbindPostStartEvents();
|
2019
|
-
this.pointerDone();
|
2020
|
-
};
|
2021
|
-
|
2022
|
-
proto._pointerReset = function() {
|
2023
|
-
// reset properties
|
2024
|
-
this.isPointerDown = false;
|
2025
|
-
delete this.pointerIdentifier;
|
2026
|
-
};
|
2027
|
-
|
2028
|
-
proto.pointerDone = noop;
|
2029
|
-
|
2030
|
-
// ----- pointer cancel ----- //
|
2031
|
-
|
2032
|
-
proto.onpointercancel = function( event ) {
|
2033
|
-
if ( event.pointerId == this.pointerIdentifier ) {
|
2034
|
-
this._pointerCancel( event, event );
|
2035
|
-
}
|
2036
|
-
};
|
2037
|
-
|
2038
|
-
proto.ontouchcancel = function( event ) {
|
2039
|
-
var touch = this.getTouch( event.changedTouches );
|
2040
|
-
if ( touch ) {
|
2041
|
-
this._pointerCancel( event, touch );
|
2042
|
-
}
|
2043
|
-
};
|
2044
|
-
|
2045
|
-
/**
|
2046
|
-
* pointer cancel
|
2047
|
-
* @param {Event} event
|
2048
|
-
* @param {Event or Touch} pointer
|
2049
|
-
* @private
|
2050
|
-
*/
|
2051
|
-
proto._pointerCancel = function( event, pointer ) {
|
2052
|
-
this._pointerDone();
|
2053
|
-
this.pointerCancel( event, pointer );
|
2054
|
-
};
|
2055
|
-
|
2056
|
-
// public
|
2057
|
-
proto.pointerCancel = function( event, pointer ) {
|
2058
|
-
this.emitEvent( 'pointerCancel', [ event, pointer ] );
|
2059
|
-
};
|
2060
|
-
|
2061
|
-
// ----- ----- //
|
2062
|
-
|
2063
|
-
// utility function for getting x/y coords from event
|
2064
|
-
Unipointer.getPointerPoint = function( pointer ) {
|
2065
|
-
return {
|
2066
|
-
x: pointer.pageX,
|
2067
|
-
y: pointer.pageY
|
2068
|
-
};
|
2069
|
-
};
|
2070
|
-
|
2071
|
-
// ----- ----- //
|
2072
|
-
|
2073
|
-
return Unipointer;
|
2074
|
-
|
2075
|
-
}));
|
2076
|
-
});
|
2077
|
-
|
2078
|
-
var unidragger = _commonjsHelpers.createCommonjsModule(function (module) {
|
2079
|
-
/*!
|
2080
|
-
* Unidragger v2.4.0
|
2081
|
-
* Draggable base class
|
2082
|
-
* MIT license
|
2083
|
-
*/
|
2084
|
-
|
2085
|
-
/*jshint browser: true, unused: true, undef: true, strict: true */
|
2086
|
-
|
2087
|
-
( function( window, factory ) {
|
2088
|
-
// universal module definition
|
2089
|
-
/*jshint strict: false */ /*globals define, module, require */
|
2090
|
-
|
2091
|
-
if ( module.exports ) {
|
2092
|
-
// CommonJS
|
2093
|
-
module.exports = factory(
|
2094
|
-
window,
|
2095
|
-
unipointer
|
2096
|
-
);
|
2097
|
-
} else {
|
2098
|
-
// browser global
|
2099
|
-
window.Unidragger = factory(
|
2100
|
-
window,
|
2101
|
-
window.Unipointer
|
2102
|
-
);
|
2103
|
-
}
|
2104
|
-
|
2105
|
-
}( window, function factory( window, Unipointer ) {
|
2106
|
-
|
2107
|
-
// -------------------------- Unidragger -------------------------- //
|
2108
|
-
|
2109
|
-
function Unidragger() {}
|
2110
|
-
|
2111
|
-
// inherit Unipointer & EvEmitter
|
2112
|
-
var proto = Unidragger.prototype = Object.create( Unipointer.prototype );
|
2113
|
-
|
2114
|
-
// ----- bind start ----- //
|
2115
|
-
|
2116
|
-
proto.bindHandles = function() {
|
2117
|
-
this._bindHandles( true );
|
2118
|
-
};
|
2119
|
-
|
2120
|
-
proto.unbindHandles = function() {
|
2121
|
-
this._bindHandles( false );
|
2122
|
-
};
|
2123
|
-
|
2124
|
-
/**
|
2125
|
-
* Add or remove start event
|
2126
|
-
* @param {Boolean} isAdd
|
2127
|
-
*/
|
2128
|
-
proto._bindHandles = function( isAdd ) {
|
2129
|
-
// munge isAdd, default to true
|
2130
|
-
isAdd = isAdd === undefined ? true : isAdd;
|
2131
|
-
// bind each handle
|
2132
|
-
var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
|
2133
|
-
var touchAction = isAdd ? this._touchActionValue : '';
|
2134
|
-
for ( var i=0; i < this.handles.length; i++ ) {
|
2135
|
-
var handle = this.handles[i];
|
2136
|
-
this._bindStartEvent( handle, isAdd );
|
2137
|
-
handle[ bindMethod ]( 'click', this );
|
2138
|
-
// touch-action: none to override browser touch gestures. metafizzy/flickity#540
|
2139
|
-
if ( window.PointerEvent ) {
|
2140
|
-
handle.style.touchAction = touchAction;
|
2141
|
-
}
|
2142
|
-
}
|
2143
|
-
};
|
2144
|
-
|
2145
|
-
// prototype so it can be overwriteable by Flickity
|
2146
|
-
proto._touchActionValue = 'none';
|
2147
|
-
|
2148
|
-
// ----- start event ----- //
|
2149
|
-
|
2150
|
-
/**
|
2151
|
-
* pointer start
|
2152
|
-
* @param {Event} event
|
2153
|
-
* @param {Event or Touch} pointer
|
2154
|
-
*/
|
2155
|
-
proto.pointerDown = function( event, pointer ) {
|
2156
|
-
var isOkay = this.okayPointerDown( event );
|
2157
|
-
if ( !isOkay ) {
|
2158
|
-
return;
|
2159
|
-
}
|
2160
|
-
// track start event position
|
2161
|
-
// Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842
|
2162
|
-
this.pointerDownPointer = {
|
2163
|
-
pageX: pointer.pageX,
|
2164
|
-
pageY: pointer.pageY,
|
2165
|
-
};
|
2166
|
-
|
2167
|
-
event.preventDefault();
|
2168
|
-
this.pointerDownBlur();
|
2169
|
-
// bind move and end events
|
2170
|
-
this._bindPostStartEvents( event );
|
2171
|
-
this.emitEvent( 'pointerDown', [ event, pointer ] );
|
2172
|
-
};
|
2173
|
-
|
2174
|
-
// nodes that have text fields
|
2175
|
-
var cursorNodes = {
|
2176
|
-
TEXTAREA: true,
|
2177
|
-
INPUT: true,
|
2178
|
-
SELECT: true,
|
2179
|
-
OPTION: true,
|
2180
|
-
};
|
2181
|
-
|
2182
|
-
// input types that do not have text fields
|
2183
|
-
var clickTypes = {
|
2184
|
-
radio: true,
|
2185
|
-
checkbox: true,
|
2186
|
-
button: true,
|
2187
|
-
submit: true,
|
2188
|
-
image: true,
|
2189
|
-
file: true,
|
2190
|
-
};
|
2191
|
-
|
2192
|
-
// dismiss inputs with text fields. flickity#403, flickity#404
|
2193
|
-
proto.okayPointerDown = function( event ) {
|
2194
|
-
var isCursorNode = cursorNodes[ event.target.nodeName ];
|
2195
|
-
var isClickType = clickTypes[ event.target.type ];
|
2196
|
-
var isOkay = !isCursorNode || isClickType;
|
2197
|
-
if ( !isOkay ) {
|
2198
|
-
this._pointerReset();
|
2199
|
-
}
|
2200
|
-
return isOkay;
|
2201
|
-
};
|
2202
|
-
|
2203
|
-
// kludge to blur previously focused input
|
2204
|
-
proto.pointerDownBlur = function() {
|
2205
|
-
var focused = document.activeElement;
|
2206
|
-
// do not blur body for IE10, metafizzy/flickity#117
|
2207
|
-
var canBlur = focused && focused.blur && focused != document.body;
|
2208
|
-
if ( canBlur ) {
|
2209
|
-
focused.blur();
|
2210
|
-
}
|
2211
|
-
};
|
2212
|
-
|
2213
|
-
// ----- move event ----- //
|
2214
|
-
|
2215
|
-
/**
|
2216
|
-
* drag move
|
2217
|
-
* @param {Event} event
|
2218
|
-
* @param {Event or Touch} pointer
|
2219
|
-
*/
|
2220
|
-
proto.pointerMove = function( event, pointer ) {
|
2221
|
-
var moveVector = this._dragPointerMove( event, pointer );
|
2222
|
-
this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );
|
2223
|
-
this._dragMove( event, pointer, moveVector );
|
2224
|
-
};
|
2225
|
-
|
2226
|
-
// base pointer move logic
|
2227
|
-
proto._dragPointerMove = function( event, pointer ) {
|
2228
|
-
var moveVector = {
|
2229
|
-
x: pointer.pageX - this.pointerDownPointer.pageX,
|
2230
|
-
y: pointer.pageY - this.pointerDownPointer.pageY
|
2231
|
-
};
|
2232
|
-
// start drag if pointer has moved far enough to start drag
|
2233
|
-
if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {
|
2234
|
-
this._dragStart( event, pointer );
|
2235
|
-
}
|
2236
|
-
return moveVector;
|
2237
|
-
};
|
2238
|
-
|
2239
|
-
// condition if pointer has moved far enough to start drag
|
2240
|
-
proto.hasDragStarted = function( moveVector ) {
|
2241
|
-
return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3;
|
2242
|
-
};
|
2243
|
-
|
2244
|
-
// ----- end event ----- //
|
2245
|
-
|
2246
|
-
/**
|
2247
|
-
* pointer up
|
2248
|
-
* @param {Event} event
|
2249
|
-
* @param {Event or Touch} pointer
|
2250
|
-
*/
|
2251
|
-
proto.pointerUp = function( event, pointer ) {
|
2252
|
-
this.emitEvent( 'pointerUp', [ event, pointer ] );
|
2253
|
-
this._dragPointerUp( event, pointer );
|
2254
|
-
};
|
2255
|
-
|
2256
|
-
proto._dragPointerUp = function( event, pointer ) {
|
2257
|
-
if ( this.isDragging ) {
|
2258
|
-
this._dragEnd( event, pointer );
|
2259
|
-
} else {
|
2260
|
-
// pointer didn't move enough for drag to start
|
2261
|
-
this._staticClick( event, pointer );
|
2262
|
-
}
|
2263
|
-
};
|
2264
|
-
|
2265
|
-
// -------------------------- drag -------------------------- //
|
2266
|
-
|
2267
|
-
// dragStart
|
2268
|
-
proto._dragStart = function( event, pointer ) {
|
2269
|
-
this.isDragging = true;
|
2270
|
-
// prevent clicks
|
2271
|
-
this.isPreventingClicks = true;
|
2272
|
-
this.dragStart( event, pointer );
|
2273
|
-
};
|
2274
|
-
|
2275
|
-
proto.dragStart = function( event, pointer ) {
|
2276
|
-
this.emitEvent( 'dragStart', [ event, pointer ] );
|
2277
|
-
};
|
2278
|
-
|
2279
|
-
// dragMove
|
2280
|
-
proto._dragMove = function( event, pointer, moveVector ) {
|
2281
|
-
// do not drag if not dragging yet
|
2282
|
-
if ( !this.isDragging ) {
|
2283
|
-
return;
|
2284
|
-
}
|
2285
|
-
|
2286
|
-
this.dragMove( event, pointer, moveVector );
|
2287
|
-
};
|
2288
|
-
|
2289
|
-
proto.dragMove = function( event, pointer, moveVector ) {
|
2290
|
-
event.preventDefault();
|
2291
|
-
this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );
|
2292
|
-
};
|
2293
|
-
|
2294
|
-
// dragEnd
|
2295
|
-
proto._dragEnd = function( event, pointer ) {
|
2296
|
-
// set flags
|
2297
|
-
this.isDragging = false;
|
2298
|
-
// re-enable clicking async
|
2299
|
-
setTimeout( function() {
|
2300
|
-
delete this.isPreventingClicks;
|
2301
|
-
}.bind( this ) );
|
2302
|
-
|
2303
|
-
this.dragEnd( event, pointer );
|
2304
|
-
};
|
2305
|
-
|
2306
|
-
proto.dragEnd = function( event, pointer ) {
|
2307
|
-
this.emitEvent( 'dragEnd', [ event, pointer ] );
|
2308
|
-
};
|
2309
|
-
|
2310
|
-
// ----- onclick ----- //
|
2311
|
-
|
2312
|
-
// handle all clicks and prevent clicks when dragging
|
2313
|
-
proto.onclick = function( event ) {
|
2314
|
-
if ( this.isPreventingClicks ) {
|
2315
|
-
event.preventDefault();
|
2316
|
-
}
|
2317
|
-
};
|
2318
|
-
|
2319
|
-
// ----- staticClick ----- //
|
2320
|
-
|
2321
|
-
// triggered after pointer down & up with no/tiny movement
|
2322
|
-
proto._staticClick = function( event, pointer ) {
|
2323
|
-
// ignore emulated mouse up clicks
|
2324
|
-
if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) {
|
2325
|
-
return;
|
2326
|
-
}
|
2327
|
-
|
2328
|
-
this.staticClick( event, pointer );
|
2329
|
-
|
2330
|
-
// set flag for emulated clicks 300ms after touchend
|
2331
|
-
if ( event.type != 'mouseup' ) {
|
2332
|
-
this.isIgnoringMouseUp = true;
|
2333
|
-
// reset flag after 300ms
|
2334
|
-
setTimeout( function() {
|
2335
|
-
delete this.isIgnoringMouseUp;
|
2336
|
-
}.bind( this ), 400 );
|
2337
|
-
}
|
2338
|
-
};
|
2339
|
-
|
2340
|
-
proto.staticClick = function( event, pointer ) {
|
2341
|
-
this.emitEvent( 'staticClick', [ event, pointer ] );
|
2342
|
-
};
|
2343
|
-
|
2344
|
-
// ----- utils ----- //
|
2345
|
-
|
2346
|
-
Unidragger.getPointerPoint = Unipointer.getPointerPoint;
|
2347
|
-
|
2348
|
-
// ----- ----- //
|
2349
|
-
|
2350
|
-
return Unidragger;
|
2351
|
-
|
2352
|
-
}));
|
2353
|
-
});
|
2354
|
-
|
2355
|
-
// ----- defaults ----- //
|
2356
|
-
|
2357
|
-
utils.extend(Flickity.defaults, {
|
2358
|
-
draggable: '>1',
|
2359
|
-
dragThreshold: 3,
|
2360
|
-
});
|
2361
|
-
|
2362
|
-
// ----- create ----- //
|
2363
|
-
|
2364
|
-
Flickity.createMethods.push('_createDrag');
|
2365
|
-
|
2366
|
-
// -------------------------- drag prototype -------------------------- //
|
2367
|
-
|
2368
|
-
var proto$7 = Flickity.prototype;
|
2369
|
-
utils.extend(proto$7, unidragger.prototype);
|
2370
|
-
proto$7._touchActionValue = 'pan-y';
|
2371
|
-
|
2372
|
-
// -------------------------- -------------------------- //
|
2373
|
-
|
2374
|
-
var isTouch = 'createTouch' in document;
|
2375
|
-
var isTouchmoveScrollCanceled = false;
|
2376
|
-
|
2377
|
-
proto$7._createDrag = function () {
|
2378
|
-
this.on('activate', this.onActivateDrag);
|
2379
|
-
this.on('uiChange', this._uiChangeDrag);
|
2380
|
-
this.on('deactivate', this.onDeactivateDrag);
|
2381
|
-
this.on('cellChange', this.updateDraggable);
|
2382
|
-
// TODO updateDraggable on resize? if groupCells & slides change
|
2383
|
-
// HACK - add seemingly innocuous handler to fix iOS 10 scroll behavior
|
2384
|
-
// #457, RubaXa/Sortable#973
|
2385
|
-
if (isTouch && !isTouchmoveScrollCanceled) {
|
2386
|
-
window.addEventListener('touchmove', function () {});
|
2387
|
-
isTouchmoveScrollCanceled = true;
|
2388
|
-
}
|
2389
|
-
};
|
2390
|
-
|
2391
|
-
proto$7.onActivateDrag = function () {
|
2392
|
-
this.handles = [this.viewport];
|
2393
|
-
this.bindHandles();
|
2394
|
-
this.updateDraggable();
|
2395
|
-
};
|
2396
|
-
|
2397
|
-
proto$7.onDeactivateDrag = function () {
|
2398
|
-
this.unbindHandles();
|
2399
|
-
this.element.classList.remove('is-draggable');
|
2400
|
-
};
|
2401
|
-
|
2402
|
-
proto$7.updateDraggable = function () {
|
2403
|
-
// disable dragging if less than 2 slides. #278
|
2404
|
-
if (this.options.draggable == '>1') {
|
2405
|
-
this.isDraggable = this.slides.length > 1;
|
2406
|
-
} else {
|
2407
|
-
this.isDraggable = this.options.draggable;
|
2408
|
-
}
|
2409
|
-
if (this.isDraggable) {
|
2410
|
-
this.element.classList.add('is-draggable');
|
2411
|
-
} else {
|
2412
|
-
this.element.classList.remove('is-draggable');
|
2413
|
-
}
|
2414
|
-
};
|
2415
|
-
|
2416
|
-
// backwards compatibility
|
2417
|
-
proto$7.bindDrag = function () {
|
2418
|
-
this.options.draggable = true;
|
2419
|
-
this.updateDraggable();
|
2420
|
-
};
|
2421
|
-
|
2422
|
-
proto$7.unbindDrag = function () {
|
2423
|
-
this.options.draggable = false;
|
2424
|
-
this.updateDraggable();
|
2425
|
-
};
|
2426
|
-
|
2427
|
-
proto$7._uiChangeDrag = function () {
|
2428
|
-
delete this.isFreeScrolling;
|
2429
|
-
};
|
2430
|
-
|
2431
|
-
// -------------------------- pointer events -------------------------- //
|
2432
|
-
|
2433
|
-
proto$7.pointerDown = function (event, pointer) {
|
2434
|
-
if (!this.isDraggable) {
|
2435
|
-
this._pointerDownDefault(event, pointer);
|
2436
|
-
return;
|
2437
|
-
}
|
2438
|
-
var isOkay = this.okayPointerDown(event);
|
2439
|
-
if (!isOkay) {
|
2440
|
-
return;
|
2441
|
-
}
|
2442
|
-
|
2443
|
-
this._pointerDownPreventDefault(event);
|
2444
|
-
this.pointerDownFocus(event);
|
2445
|
-
// blur
|
2446
|
-
if (document.activeElement != this.element) {
|
2447
|
-
// do not blur if already focused
|
2448
|
-
this.pointerDownBlur();
|
2449
|
-
}
|
2450
|
-
|
2451
|
-
// stop if it was moving
|
2452
|
-
this.dragX = this.x;
|
2453
|
-
this.viewport.classList.add('is-pointer-down');
|
2454
|
-
// track scrolling
|
2455
|
-
this.pointerDownScroll = getScrollPosition();
|
2456
|
-
window.addEventListener('scroll', this);
|
2457
|
-
|
2458
|
-
this._pointerDownDefault(event, pointer);
|
2459
|
-
};
|
2460
|
-
|
2461
|
-
// default pointerDown logic, used for staticClick
|
2462
|
-
proto$7._pointerDownDefault = function (event, pointer) {
|
2463
|
-
// track start event position
|
2464
|
-
// Safari 9 overrides pageX and pageY. These values needs to be copied. #779
|
2465
|
-
this.pointerDownPointer = {
|
2466
|
-
pageX: pointer.pageX,
|
2467
|
-
pageY: pointer.pageY,
|
2468
|
-
};
|
2469
|
-
// bind move and end events
|
2470
|
-
this._bindPostStartEvents(event);
|
2471
|
-
this.dispatchEvent('pointerDown', event, [pointer]);
|
2472
|
-
};
|
2473
|
-
|
2474
|
-
var focusNodes = {
|
2475
|
-
INPUT: true,
|
2476
|
-
TEXTAREA: true,
|
2477
|
-
SELECT: true,
|
2478
|
-
};
|
2479
|
-
|
2480
|
-
proto$7.pointerDownFocus = function (event) {
|
2481
|
-
var isFocusNode = focusNodes[event.target.nodeName];
|
2482
|
-
if (!isFocusNode) {
|
2483
|
-
this.focus();
|
2484
|
-
}
|
2485
|
-
};
|
2486
|
-
|
2487
|
-
proto$7._pointerDownPreventDefault = function (event) {
|
2488
|
-
var isTouchStart = event.type == 'touchstart';
|
2489
|
-
var isTouchPointer = event.pointerType == 'touch';
|
2490
|
-
var isFocusNode = focusNodes[event.target.nodeName];
|
2491
|
-
if (!isTouchStart && !isTouchPointer && !isFocusNode) {
|
2492
|
-
event.preventDefault();
|
2493
|
-
}
|
2494
|
-
};
|
2495
|
-
|
2496
|
-
// ----- move ----- //
|
2497
|
-
|
2498
|
-
proto$7.hasDragStarted = function (moveVector) {
|
2499
|
-
return Math.abs(moveVector.x) > this.options.dragThreshold;
|
2500
|
-
};
|
2501
|
-
|
2502
|
-
// ----- up ----- //
|
2503
|
-
|
2504
|
-
proto$7.pointerUp = function (event, pointer) {
|
2505
|
-
delete this.isTouchScrolling;
|
2506
|
-
this.viewport.classList.remove('is-pointer-down');
|
2507
|
-
this.dispatchEvent('pointerUp', event, [pointer]);
|
2508
|
-
this._dragPointerUp(event, pointer);
|
2509
|
-
};
|
2510
|
-
|
2511
|
-
proto$7.pointerDone = function () {
|
2512
|
-
window.removeEventListener('scroll', this);
|
2513
|
-
delete this.pointerDownScroll;
|
2514
|
-
};
|
2515
|
-
|
2516
|
-
// -------------------------- dragging -------------------------- //
|
2517
|
-
|
2518
|
-
proto$7.dragStart = function (event, pointer) {
|
2519
|
-
if (!this.isDraggable) {
|
2520
|
-
return;
|
2521
|
-
}
|
2522
|
-
this.dragStartPosition = this.x;
|
2523
|
-
this.startAnimation();
|
2524
|
-
window.removeEventListener('scroll', this);
|
2525
|
-
this.dispatchEvent('dragStart', event, [pointer]);
|
2526
|
-
};
|
2527
|
-
|
2528
|
-
proto$7.pointerMove = function (event, pointer) {
|
2529
|
-
var moveVector = this._dragPointerMove(event, pointer);
|
2530
|
-
this.dispatchEvent('pointerMove', event, [pointer, moveVector]);
|
2531
|
-
this._dragMove(event, pointer, moveVector);
|
2532
|
-
};
|
2533
|
-
|
2534
|
-
proto$7.dragMove = function (event, pointer, moveVector) {
|
2535
|
-
if (!this.isDraggable) {
|
2536
|
-
return;
|
2537
|
-
}
|
2538
|
-
event.preventDefault();
|
2539
|
-
|
2540
|
-
this.previousDragX = this.dragX;
|
2541
|
-
// reverse if right-to-left
|
2542
|
-
var direction = this.options.rightToLeft ? -1 : 1;
|
2543
|
-
if (this.options.wrapAround) {
|
2544
|
-
// wrap around move. #589
|
2545
|
-
moveVector.x = moveVector.x % this.slideableWidth;
|
2546
|
-
}
|
2547
|
-
var dragX = this.dragStartPosition + moveVector.x * direction;
|
2548
|
-
|
2549
|
-
if (!this.options.wrapAround && this.slides.length) {
|
2550
|
-
// slow drag
|
2551
|
-
var originBound = Math.max(-this.slides[0].target, this.dragStartPosition);
|
2552
|
-
dragX = dragX > originBound ? (dragX + originBound) * 0.5 : dragX;
|
2553
|
-
var endBound = Math.min(
|
2554
|
-
-this.getLastSlide().target,
|
2555
|
-
this.dragStartPosition
|
2556
|
-
);
|
2557
|
-
dragX = dragX < endBound ? (dragX + endBound) * 0.5 : dragX;
|
2558
|
-
}
|
2559
|
-
|
2560
|
-
this.dragX = dragX;
|
2561
|
-
|
2562
|
-
this.dragMoveTime = new Date();
|
2563
|
-
this.dispatchEvent('dragMove', event, [pointer, moveVector]);
|
2564
|
-
};
|
2565
|
-
|
2566
|
-
proto$7.dragEnd = function (event, pointer) {
|
2567
|
-
if (!this.isDraggable) {
|
2568
|
-
return;
|
2569
|
-
}
|
2570
|
-
if (this.options.freeScroll) {
|
2571
|
-
this.isFreeScrolling = true;
|
2572
|
-
}
|
2573
|
-
// set selectedIndex based on where flick will end up
|
2574
|
-
var index = this.dragEndRestingSelect();
|
2575
|
-
|
2576
|
-
if (this.options.freeScroll && !this.options.wrapAround) {
|
2577
|
-
// if free-scroll & not wrap around
|
2578
|
-
// do not free-scroll if going outside of bounding slides
|
2579
|
-
// so bounding slides can attract slider, and keep it in bounds
|
2580
|
-
var restingX = this.getRestingPosition();
|
2581
|
-
this.isFreeScrolling =
|
2582
|
-
-restingX > this.slides[0].target &&
|
2583
|
-
-restingX < this.getLastSlide().target;
|
2584
|
-
} else if (!this.options.freeScroll && index == this.selectedIndex) {
|
2585
|
-
// boost selection if selected index has not changed
|
2586
|
-
index += this.dragEndBoostSelect();
|
2587
|
-
}
|
2588
|
-
delete this.previousDragX;
|
2589
|
-
// apply selection
|
2590
|
-
// TODO refactor this, selecting here feels weird
|
2591
|
-
// HACK, set flag so dragging stays in correct direction
|
2592
|
-
this.isDragSelect = this.options.wrapAround;
|
2593
|
-
this.select(index);
|
2594
|
-
delete this.isDragSelect;
|
2595
|
-
this.dispatchEvent('dragEnd', event, [pointer]);
|
2596
|
-
};
|
2597
|
-
|
2598
|
-
proto$7.dragEndRestingSelect = function () {
|
2599
|
-
var restingX = this.getRestingPosition();
|
2600
|
-
// how far away from selected slide
|
2601
|
-
var distance = Math.abs(this.getSlideDistance(-restingX, this.selectedIndex));
|
2602
|
-
// get closet resting going up and going down
|
2603
|
-
var positiveResting = this._getClosestResting(restingX, distance, 1);
|
2604
|
-
var negativeResting = this._getClosestResting(restingX, distance, -1);
|
2605
|
-
// use closer resting for wrap-around
|
2606
|
-
var index =
|
2607
|
-
positiveResting.distance < negativeResting.distance
|
2608
|
-
? positiveResting.index
|
2609
|
-
: negativeResting.index;
|
2610
|
-
return index;
|
2611
|
-
};
|
2612
|
-
|
2613
|
-
/**
|
2614
|
-
* given resting X and distance to selected cell
|
2615
|
-
* get the distance and index of the closest cell
|
2616
|
-
* @param {Number} restingX - estimated post-flick resting position
|
2617
|
-
* @param {Number} distance - distance to selected cell
|
2618
|
-
* @param {Integer} increment - +1 or -1, going up or down
|
2619
|
-
* @returns {Object} - { distance: {Number}, index: {Integer} }
|
2620
|
-
*/
|
2621
|
-
proto$7._getClosestResting = function (restingX, distance, increment) {
|
2622
|
-
var index = this.selectedIndex;
|
2623
|
-
var minDistance = Infinity;
|
2624
|
-
var condition =
|
2625
|
-
this.options.contain && !this.options.wrapAround
|
2626
|
-
? // if contain, keep going if distance is equal to minDistance
|
2627
|
-
function (d, md) {
|
2628
|
-
return d <= md;
|
2629
|
-
}
|
2630
|
-
: function (d, md) {
|
2631
|
-
return d < md;
|
2632
|
-
};
|
2633
|
-
while (condition(distance, minDistance)) {
|
2634
|
-
// measure distance to next cell
|
2635
|
-
index += increment;
|
2636
|
-
minDistance = distance;
|
2637
|
-
distance = this.getSlideDistance(-restingX, index);
|
2638
|
-
if (distance === null) {
|
2639
|
-
break;
|
2640
|
-
}
|
2641
|
-
distance = Math.abs(distance);
|
2642
|
-
}
|
2643
|
-
return {
|
2644
|
-
distance: minDistance,
|
2645
|
-
// selected was previous index
|
2646
|
-
index: index - increment,
|
2647
|
-
};
|
2648
|
-
};
|
2649
|
-
|
2650
|
-
/**
|
2651
|
-
* measure distance between x and a slide target
|
2652
|
-
* @param {Number} x
|
2653
|
-
* @param {Integer} index - slide index
|
2654
|
-
*/
|
2655
|
-
proto$7.getSlideDistance = function (x, index) {
|
2656
|
-
var len = this.slides.length;
|
2657
|
-
// wrap around if at least 2 slides
|
2658
|
-
var isWrapAround = this.options.wrapAround && len > 1;
|
2659
|
-
var slideIndex = isWrapAround ? utils.modulo(index, len) : index;
|
2660
|
-
var slide = this.slides[slideIndex];
|
2661
|
-
if (!slide) {
|
2662
|
-
return null;
|
2663
|
-
}
|
2664
|
-
// add distance for wrap-around slides
|
2665
|
-
var wrap = isWrapAround ? this.slideableWidth * Math.floor(index / len) : 0;
|
2666
|
-
return x - (slide.target + wrap);
|
2667
|
-
};
|
2668
|
-
|
2669
|
-
proto$7.dragEndBoostSelect = function () {
|
2670
|
-
// do not boost if no previousDragX or dragMoveTime
|
2671
|
-
if (
|
2672
|
-
this.previousDragX === undefined ||
|
2673
|
-
!this.dragMoveTime ||
|
2674
|
-
// or if drag was held for 100 ms
|
2675
|
-
new Date() - this.dragMoveTime > 100
|
2676
|
-
) {
|
2677
|
-
return 0;
|
2678
|
-
}
|
2679
|
-
|
2680
|
-
var distance = this.getSlideDistance(-this.dragX, this.selectedIndex);
|
2681
|
-
var delta = this.previousDragX - this.dragX;
|
2682
|
-
if (distance > 0 && delta > 0) {
|
2683
|
-
// boost to next if moving towards the right, and positive velocity
|
2684
|
-
return 1;
|
2685
|
-
} else if (distance < 0 && delta < 0) {
|
2686
|
-
// boost to previous if moving towards the left, and negative velocity
|
2687
|
-
return -1;
|
2688
|
-
}
|
2689
|
-
return 0;
|
2690
|
-
};
|
2691
|
-
|
2692
|
-
// ----- staticClick ----- //
|
2693
|
-
|
2694
|
-
proto$7.staticClick = function (event, pointer) {
|
2695
|
-
// get clickedCell, if cell was clicked
|
2696
|
-
var clickedCell = this.getParentCell(event.target);
|
2697
|
-
var cellElem = clickedCell && clickedCell.element;
|
2698
|
-
var cellIndex = clickedCell && this.cells.indexOf(clickedCell);
|
2699
|
-
this.dispatchEvent('staticClick', event, [pointer, cellElem, cellIndex]);
|
2700
|
-
};
|
2701
|
-
|
2702
|
-
// ----- scroll ----- //
|
2703
|
-
|
2704
|
-
proto$7.onscroll = function () {
|
2705
|
-
var scroll = getScrollPosition();
|
2706
|
-
var scrollMoveX = this.pointerDownScroll.x - scroll.x;
|
2707
|
-
var scrollMoveY = this.pointerDownScroll.y - scroll.y;
|
2708
|
-
// cancel click/tap if scroll is too much
|
2709
|
-
if (Math.abs(scrollMoveX) > 3 || Math.abs(scrollMoveY) > 3) {
|
2710
|
-
this._pointerDone();
|
2711
|
-
}
|
2712
|
-
};
|
2713
|
-
|
2714
|
-
// ----- utils ----- //
|
2715
|
-
|
2716
|
-
function getScrollPosition() {
|
2717
|
-
return {
|
2718
|
-
x: window.pageXOffset,
|
2719
|
-
y: window.pageYOffset,
|
2720
|
-
};
|
2721
|
-
}
|
2722
|
-
|
2723
|
-
// ----- ----- //
|
2724
|
-
|
2725
|
-
var svgURI$1 = 'http://www.w3.org/2000/svg';
|
2726
|
-
|
2727
|
-
// -------------------------- PrevNextButton -------------------------- //
|
2728
|
-
|
2729
|
-
function PrevNextButton(direction, parent) {
|
2730
|
-
this.direction = direction;
|
2731
|
-
this.parent = parent;
|
2732
|
-
this.parentElement = this.parent.element.shadowRoot || this.parent.element;
|
2733
|
-
this._create();
|
2734
|
-
}
|
2735
|
-
|
2736
|
-
PrevNextButton.prototype = Object.create(unipointer.prototype);
|
2737
|
-
|
2738
|
-
PrevNextButton.prototype._create = function () {
|
2739
|
-
// properties
|
2740
|
-
this.isEnabled = true;
|
2741
|
-
this.isPrevious = this.direction == -1;
|
2742
|
-
var leftDirection = this.parent.options.rightToLeft ? 1 : -1;
|
2743
|
-
this.isLeft = this.direction == leftDirection;
|
2744
|
-
|
2745
|
-
var button = (this.element = document.createElement('button'));
|
2746
|
-
button.className = 'flickity-button flickity-prev-next-button';
|
2747
|
-
button.part.add('navigation-button');
|
2748
|
-
if (this.isPrevious) {
|
2749
|
-
button.classList.add('previous');
|
2750
|
-
button.part.add('navigation-button--previous');
|
2751
|
-
} else {
|
2752
|
-
button.classList.add('next');
|
2753
|
-
button.part.add('navigation-button--next');
|
2754
|
-
}
|
2755
|
-
// prevent button from submitting form http://stackoverflow.com/a/10836076/182183
|
2756
|
-
button.setAttribute('type', 'button');
|
2757
|
-
// init as disabled
|
2758
|
-
this.disable();
|
2759
|
-
|
2760
|
-
button.setAttribute('aria-label', this.isPrevious ? 'Previous' : 'Next');
|
2761
|
-
|
2762
|
-
const slot = document.createElement('slot');
|
2763
|
-
slot.name = this.isPrevious ? 'previous-icon' : 'next-icon';
|
2764
|
-
button.appendChild(slot);
|
2765
|
-
slot.addEventListener('slotchange', () => {
|
2766
|
-
slot.assignedElements({ flatten: true }).forEach((ele) => {
|
2767
|
-
ele.removeAttribute('hidden');
|
2768
|
-
});
|
2769
|
-
});
|
2770
|
-
|
2771
|
-
// create arrow
|
2772
|
-
var svg = this.createSVG();
|
2773
|
-
slot.appendChild(svg);
|
2774
|
-
// events
|
2775
|
-
this.parent.on('select', this.update.bind(this));
|
2776
|
-
this.on('pointerDown', this.parent.childUIPointerDown.bind(this.parent));
|
2777
|
-
};
|
2778
|
-
|
2779
|
-
PrevNextButton.prototype.activate = function () {
|
2780
|
-
this.bindStartEvent(this.element);
|
2781
|
-
this.element.addEventListener('click', this);
|
2782
|
-
// add to DOM
|
2783
|
-
this.parentElement.appendChild(this.element);
|
2784
|
-
};
|
2785
|
-
|
2786
|
-
PrevNextButton.prototype.deactivate = function () {
|
2787
|
-
// remove from DOM
|
2788
|
-
this.parentElement.removeChild(this.element);
|
2789
|
-
// click events
|
2790
|
-
this.unbindStartEvent(this.element);
|
2791
|
-
this.element.removeEventListener('click', this);
|
2792
|
-
};
|
2793
|
-
|
2794
|
-
PrevNextButton.prototype.createSVG = function () {
|
2795
|
-
var svg = document.createElementNS(svgURI$1, 'svg');
|
2796
|
-
svg.setAttribute('class', 'flickity-button-icon');
|
2797
|
-
svg.setAttribute('viewBox', '0 0 100 100');
|
2798
|
-
svg.part.add('navigation-icon');
|
2799
|
-
var path = document.createElementNS(svgURI$1, 'path');
|
2800
|
-
var pathMovements = getArrowMovements(this.parent.options.arrowShape);
|
2801
|
-
path.setAttribute('d', pathMovements);
|
2802
|
-
path.setAttribute('class', 'arrow');
|
2803
|
-
// rotate arrow
|
2804
|
-
if (!this.isLeft) {
|
2805
|
-
path.setAttribute('transform', 'translate(100, 100) rotate(180) ');
|
2806
|
-
}
|
2807
|
-
svg.appendChild(path);
|
2808
|
-
return svg;
|
2809
|
-
};
|
2810
|
-
|
2811
|
-
// get SVG path movmement
|
2812
|
-
function getArrowMovements(shape) {
|
2813
|
-
// use shape as movement if string
|
2814
|
-
if (typeof shape == 'string') {
|
2815
|
-
return shape;
|
2816
|
-
}
|
2817
|
-
// create movement string
|
2818
|
-
return (
|
2819
|
-
'M ' +
|
2820
|
-
shape.x0 +
|
2821
|
-
',50' +
|
2822
|
-
' L ' +
|
2823
|
-
shape.x1 +
|
2824
|
-
',' +
|
2825
|
-
(shape.y1 + 50) +
|
2826
|
-
' L ' +
|
2827
|
-
shape.x2 +
|
2828
|
-
',' +
|
2829
|
-
(shape.y2 + 50) +
|
2830
|
-
' L ' +
|
2831
|
-
shape.x3 +
|
2832
|
-
',50 ' +
|
2833
|
-
' L ' +
|
2834
|
-
shape.x2 +
|
2835
|
-
',' +
|
2836
|
-
(50 - shape.y2) +
|
2837
|
-
' L ' +
|
2838
|
-
shape.x1 +
|
2839
|
-
',' +
|
2840
|
-
(50 - shape.y1) +
|
2841
|
-
' Z'
|
2842
|
-
);
|
2843
|
-
}
|
2844
|
-
|
2845
|
-
PrevNextButton.prototype.handleEvent = utils.handleEvent;
|
2846
|
-
|
2847
|
-
PrevNextButton.prototype.onclick = function () {
|
2848
|
-
if (!this.isEnabled) {
|
2849
|
-
return;
|
2850
|
-
}
|
2851
|
-
this.parent.uiChange();
|
2852
|
-
var method = this.isPrevious ? 'previous' : 'next';
|
2853
|
-
this.parent[method]();
|
2854
|
-
};
|
2855
|
-
|
2856
|
-
// ----- ----- //
|
2857
|
-
|
2858
|
-
PrevNextButton.prototype.enable = function () {
|
2859
|
-
if (this.isEnabled) {
|
2860
|
-
return;
|
2861
|
-
}
|
2862
|
-
this.element.disabled = false;
|
2863
|
-
this.isEnabled = true;
|
2864
|
-
};
|
2865
|
-
|
2866
|
-
PrevNextButton.prototype.disable = function () {
|
2867
|
-
if (!this.isEnabled) {
|
2868
|
-
return;
|
2869
|
-
}
|
2870
|
-
this.element.disabled = true;
|
2871
|
-
this.isEnabled = false;
|
2872
|
-
};
|
2873
|
-
|
2874
|
-
PrevNextButton.prototype.update = function () {
|
2875
|
-
// index of first or last slide, if previous or next
|
2876
|
-
var slides = this.parent.slides;
|
2877
|
-
// enable is wrapAround and at least 2 slides
|
2878
|
-
if (this.parent.options.wrapAround && slides.length > 1) {
|
2879
|
-
this.enable();
|
2880
|
-
return;
|
2881
|
-
}
|
2882
|
-
var lastIndex = slides.length ? slides.length - 1 : 0;
|
2883
|
-
var boundIndex = this.isPrevious ? 0 : lastIndex;
|
2884
|
-
var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable';
|
2885
|
-
this[method]();
|
2886
|
-
};
|
2887
|
-
|
2888
|
-
PrevNextButton.prototype.destroy = function () {
|
2889
|
-
this.deactivate();
|
2890
|
-
this.allOff();
|
2891
|
-
};
|
2892
|
-
|
2893
|
-
// -------------------------- Flickity prototype -------------------------- //
|
2894
|
-
|
2895
|
-
utils.extend(Flickity.defaults, {
|
2896
|
-
prevNextButtons: true,
|
2897
|
-
arrowShape: {
|
2898
|
-
x0: 10,
|
2899
|
-
x1: 60,
|
2900
|
-
y1: 50,
|
2901
|
-
x2: 70,
|
2902
|
-
y2: 40,
|
2903
|
-
x3: 30,
|
2904
|
-
},
|
2905
|
-
});
|
2906
|
-
|
2907
|
-
Flickity.createMethods.push('_createPrevNextButtons');
|
2908
|
-
var proto$6 = Flickity.prototype;
|
2909
|
-
|
2910
|
-
proto$6._createPrevNextButtons = function () {
|
2911
|
-
if (!this.options.prevNextButtons) {
|
2912
|
-
return;
|
2913
|
-
}
|
2914
|
-
|
2915
|
-
this.prevButton = new PrevNextButton(-1, this);
|
2916
|
-
this.nextButton = new PrevNextButton(1, this);
|
2917
|
-
|
2918
|
-
this.on('activate', this.activatePrevNextButtons);
|
2919
|
-
};
|
2920
|
-
|
2921
|
-
proto$6.activatePrevNextButtons = function () {
|
2922
|
-
this.prevButton.activate();
|
2923
|
-
this.nextButton.activate();
|
2924
|
-
this.on('deactivate', this.deactivatePrevNextButtons);
|
2925
|
-
};
|
2926
|
-
|
2927
|
-
proto$6.deactivatePrevNextButtons = function () {
|
2928
|
-
this.prevButton.deactivate();
|
2929
|
-
this.nextButton.deactivate();
|
2930
|
-
this.off('deactivate', this.deactivatePrevNextButtons);
|
2931
|
-
};
|
2932
|
-
|
2933
|
-
// -------------------------- -------------------------- //
|
2934
|
-
|
2935
|
-
Flickity.PrevNextButton = PrevNextButton;
|
2936
|
-
|
2937
|
-
function PageDots(parent) {
|
2938
|
-
this.parent = parent;
|
2939
|
-
this.parentElement = this.parent.element.shadowRoot || this.parent.element;
|
2940
|
-
this._create();
|
2941
|
-
}
|
2942
|
-
|
2943
|
-
PageDots.prototype = Object.create(unipointer.prototype);
|
2944
|
-
|
2945
|
-
PageDots.prototype._create = function () {
|
2946
|
-
// create holder element
|
2947
|
-
this.holder = document.createElement('ol');
|
2948
|
-
this.holder.className = 'flickity-page-dots';
|
2949
|
-
this.holder.part.add('pagination');
|
2950
|
-
|
2951
|
-
// create dots, array of elements
|
2952
|
-
this.dots = [];
|
2953
|
-
// events
|
2954
|
-
this.handleClick = this.onClick.bind(this);
|
2955
|
-
this.on('pointerDown', this.parent.childUIPointerDown.bind(this.parent));
|
2956
|
-
};
|
2957
|
-
|
2958
|
-
PageDots.prototype.activate = function () {
|
2959
|
-
this.setDots();
|
2960
|
-
this.holder.addEventListener('click', this.handleClick);
|
2961
|
-
this.bindStartEvent(this.holder);
|
2962
|
-
// add to DOM
|
2963
|
-
this.parentElement.appendChild(this.holder);
|
2964
|
-
};
|
2965
|
-
|
2966
|
-
PageDots.prototype.deactivate = function () {
|
2967
|
-
this.holder.removeEventListener('click', this.handleClick);
|
2968
|
-
this.unbindStartEvent(this.holder);
|
2969
|
-
// remove from DOM
|
2970
|
-
this.parentElement.removeChild(this.holder);
|
2971
|
-
};
|
2972
|
-
|
2973
|
-
PageDots.prototype.setDots = function () {
|
2974
|
-
// get difference between number of slides and number of dots
|
2975
|
-
var delta = this.parent.slides.length - this.dots.length;
|
2976
|
-
if (delta > 0) {
|
2977
|
-
this.addDots(delta);
|
2978
|
-
} else if (delta < 0) {
|
2979
|
-
this.removeDots(-delta);
|
2980
|
-
}
|
2981
|
-
};
|
2982
|
-
|
2983
|
-
PageDots.prototype.addDots = function (count) {
|
2984
|
-
var fragment = document.createDocumentFragment();
|
2985
|
-
var newDots = [];
|
2986
|
-
var length = this.dots.length;
|
2987
|
-
var max = length + count;
|
2988
|
-
|
2989
|
-
for (var i = length; i < max; i++) {
|
2990
|
-
var dot = document.createElement('li');
|
2991
|
-
dot.classList.add('dot');
|
2992
|
-
dot.part.add('pagination-item');
|
2993
|
-
dot.setAttribute('aria-label', 'Page dot ' + (i + 1));
|
2994
|
-
fragment.appendChild(dot);
|
2995
|
-
newDots.push(dot);
|
2996
|
-
}
|
2997
|
-
|
2998
|
-
this.holder.appendChild(fragment);
|
2999
|
-
this.dots = this.dots.concat(newDots);
|
3000
|
-
};
|
3001
|
-
|
3002
|
-
PageDots.prototype.removeDots = function (count) {
|
3003
|
-
// remove from this.dots collection
|
3004
|
-
var removeDots = this.dots.splice(this.dots.length - count, count);
|
3005
|
-
// remove from DOM
|
3006
|
-
removeDots.forEach(function (dot) {
|
3007
|
-
this.holder.removeChild(dot);
|
3008
|
-
}, this);
|
3009
|
-
};
|
3010
|
-
|
3011
|
-
PageDots.prototype.updateSelected = function () {
|
3012
|
-
// remove selected class on previous
|
3013
|
-
if (this.selectedDot) {
|
3014
|
-
this.selectedDot.classList.remove('is-selected');
|
3015
|
-
this.selectedDot.part.remove('pagination-item--active');
|
3016
|
-
this.selectedDot.removeAttribute('aria-current');
|
3017
|
-
}
|
3018
|
-
// don't proceed if no dots
|
3019
|
-
if (!this.dots.length) {
|
3020
|
-
return;
|
3021
|
-
}
|
3022
|
-
this.selectedDot = this.dots[this.parent.selectedIndex];
|
3023
|
-
this.selectedDot.classList.add('is-selected');
|
3024
|
-
this.selectedDot.part.add('pagination-item--active');
|
3025
|
-
this.selectedDot.setAttribute('aria-current', 'step');
|
3026
|
-
};
|
3027
|
-
|
3028
|
-
PageDots.prototype.onTap = PageDots.prototype.onClick = function (event) {
|
3029
|
-
// old method name, backwards-compatible
|
3030
|
-
var target = event.target;
|
3031
|
-
// only care about dot clicks
|
3032
|
-
if (target.nodeName != 'LI') {
|
3033
|
-
return;
|
3034
|
-
}
|
3035
|
-
|
3036
|
-
this.parent.uiChange();
|
3037
|
-
var index = this.dots.indexOf(target);
|
3038
|
-
this.parent.select(index);
|
3039
|
-
};
|
3040
|
-
|
3041
|
-
PageDots.prototype.destroy = function () {
|
3042
|
-
this.deactivate();
|
3043
|
-
this.allOff();
|
3044
|
-
};
|
3045
|
-
|
3046
|
-
Flickity.PageDots = PageDots;
|
3047
|
-
|
3048
|
-
// -------------------------- Flickity -------------------------- //
|
3049
|
-
|
3050
|
-
utils.extend(Flickity.defaults, {
|
3051
|
-
pageDots: true,
|
3052
|
-
});
|
3053
|
-
|
3054
|
-
Flickity.createMethods.push('_createPageDots');
|
3055
|
-
|
3056
|
-
var proto$5 = Flickity.prototype;
|
3057
|
-
|
3058
|
-
proto$5._createPageDots = function () {
|
3059
|
-
if (!this.options.pageDots) {
|
3060
|
-
return;
|
3061
|
-
}
|
3062
|
-
this.pageDots = new PageDots(this);
|
3063
|
-
// events
|
3064
|
-
this.on('activate', this.activatePageDots);
|
3065
|
-
this.on('select', this.updateSelectedPageDots);
|
3066
|
-
this.on('cellChange', this.updatePageDots);
|
3067
|
-
this.on('resize', this.updatePageDots);
|
3068
|
-
this.on('deactivate', this.deactivatePageDots);
|
3069
|
-
};
|
3070
|
-
|
3071
|
-
proto$5.activatePageDots = function () {
|
3072
|
-
this.pageDots.activate();
|
3073
|
-
};
|
3074
|
-
|
3075
|
-
proto$5.updateSelectedPageDots = function () {
|
3076
|
-
this.pageDots.updateSelected();
|
3077
|
-
};
|
3078
|
-
|
3079
|
-
proto$5.updatePageDots = function () {
|
3080
|
-
this.pageDots.setDots();
|
3081
|
-
};
|
3082
|
-
|
3083
|
-
proto$5.deactivatePageDots = function () {
|
3084
|
-
this.pageDots.deactivate();
|
3085
|
-
};
|
3086
|
-
|
3087
|
-
// ----- ----- //
|
3088
|
-
|
3089
|
-
Flickity.PageDots = PageDots;
|
3090
|
-
|
3091
|
-
// -------------------------- Player -------------------------- //
|
3092
|
-
|
3093
|
-
function Player(parent) {
|
3094
|
-
this.parent = parent;
|
3095
|
-
this.state = 'stopped';
|
3096
|
-
// visibility change event handler
|
3097
|
-
this.onVisibilityChange = this.visibilityChange.bind(this);
|
3098
|
-
this.onVisibilityPlay = this.visibilityPlay.bind(this);
|
3099
|
-
}
|
3100
|
-
|
3101
|
-
Player.prototype = Object.create(evEmitter.prototype);
|
3102
|
-
|
3103
|
-
// start play
|
3104
|
-
Player.prototype.play = function () {
|
3105
|
-
if (this.state == 'playing') {
|
3106
|
-
return;
|
3107
|
-
}
|
3108
|
-
// do not play if page is hidden, start playing when page is visible
|
3109
|
-
var isPageHidden = document.hidden;
|
3110
|
-
if (isPageHidden) {
|
3111
|
-
document.addEventListener('visibilitychange', this.onVisibilityPlay);
|
3112
|
-
return;
|
3113
|
-
}
|
3114
|
-
|
3115
|
-
this.state = 'playing';
|
3116
|
-
// listen to visibility change
|
3117
|
-
document.addEventListener('visibilitychange', this.onVisibilityChange);
|
3118
|
-
// start ticking
|
3119
|
-
this.tick();
|
3120
|
-
};
|
3121
|
-
|
3122
|
-
Player.prototype.tick = function () {
|
3123
|
-
// do not tick if not playing
|
3124
|
-
if (this.state != 'playing') {
|
3125
|
-
return;
|
3126
|
-
}
|
3127
|
-
|
3128
|
-
var time = this.parent.options.autoPlay;
|
3129
|
-
// default to 3 seconds
|
3130
|
-
time = typeof time == 'number' ? time : 3000;
|
3131
|
-
var _this = this;
|
3132
|
-
// HACK: reset ticks if stopped and started within interval
|
3133
|
-
this.clear();
|
3134
|
-
this.timeout = setTimeout(function () {
|
3135
|
-
_this.parent.next(true);
|
3136
|
-
_this.tick();
|
3137
|
-
}, time);
|
3138
|
-
};
|
3139
|
-
|
3140
|
-
Player.prototype.stop = function () {
|
3141
|
-
this.state = 'stopped';
|
3142
|
-
this.clear();
|
3143
|
-
// remove visibility change event
|
3144
|
-
document.removeEventListener('visibilitychange', this.onVisibilityChange);
|
3145
|
-
};
|
3146
|
-
|
3147
|
-
Player.prototype.clear = function () {
|
3148
|
-
clearTimeout(this.timeout);
|
3149
|
-
};
|
3150
|
-
|
3151
|
-
Player.prototype.pause = function () {
|
3152
|
-
if (this.state == 'playing') {
|
3153
|
-
this.state = 'paused';
|
3154
|
-
this.clear();
|
3155
|
-
}
|
3156
|
-
};
|
3157
|
-
|
3158
|
-
Player.prototype.unpause = function () {
|
3159
|
-
// re-start play if paused
|
3160
|
-
if (this.state == 'paused') {
|
3161
|
-
this.play();
|
3162
|
-
}
|
3163
|
-
};
|
3164
|
-
|
3165
|
-
// pause if page visibility is hidden, unpause if visible
|
3166
|
-
Player.prototype.visibilityChange = function () {
|
3167
|
-
var isPageHidden = document.hidden;
|
3168
|
-
this[isPageHidden ? 'pause' : 'unpause']();
|
3169
|
-
};
|
3170
|
-
|
3171
|
-
Player.prototype.visibilityPlay = function () {
|
3172
|
-
this.play();
|
3173
|
-
document.removeEventListener('visibilitychange', this.onVisibilityPlay);
|
3174
|
-
};
|
3175
|
-
|
3176
|
-
// -------------------------- Flickity -------------------------- //
|
3177
|
-
|
3178
|
-
utils.extend(Flickity.defaults, {
|
3179
|
-
pauseAutoPlayOnHover: true,
|
3180
|
-
});
|
3181
|
-
|
3182
|
-
Flickity.createMethods.push('_createPlayer');
|
3183
|
-
var proto$4 = Flickity.prototype;
|
3184
|
-
|
3185
|
-
proto$4._createPlayer = function () {
|
3186
|
-
this.player = new Player(this);
|
3187
|
-
|
3188
|
-
this.on('activate', this.activatePlayer);
|
3189
|
-
this.on('uiChange', this.stopPlayer);
|
3190
|
-
this.on('pointerDown', this.stopPlayer);
|
3191
|
-
this.on('deactivate', this.deactivatePlayer);
|
3192
|
-
};
|
3193
|
-
|
3194
|
-
proto$4.activatePlayer = function () {
|
3195
|
-
if (!this.options.autoPlay) {
|
3196
|
-
return;
|
3197
|
-
}
|
3198
|
-
this.player.play();
|
3199
|
-
this.element.addEventListener('mouseenter', this);
|
3200
|
-
};
|
3201
|
-
|
3202
|
-
// Player API, don't hate the ... thanks I know where the door is
|
3203
|
-
|
3204
|
-
proto$4.playPlayer = function () {
|
3205
|
-
this.player.play();
|
3206
|
-
};
|
3207
|
-
|
3208
|
-
proto$4.stopPlayer = function () {
|
3209
|
-
this.player.stop();
|
3210
|
-
};
|
3211
|
-
|
3212
|
-
proto$4.pausePlayer = function () {
|
3213
|
-
this.player.pause();
|
3214
|
-
};
|
3215
|
-
|
3216
|
-
proto$4.unpausePlayer = function () {
|
3217
|
-
this.player.unpause();
|
3218
|
-
};
|
3219
|
-
|
3220
|
-
proto$4.deactivatePlayer = function () {
|
3221
|
-
this.player.stop();
|
3222
|
-
this.element.removeEventListener('mouseenter', this);
|
3223
|
-
};
|
3224
|
-
|
3225
|
-
// ----- mouseenter/leave ----- //
|
3226
|
-
|
3227
|
-
// pause auto-play on hover
|
3228
|
-
proto$4.onmouseenter = function () {
|
3229
|
-
if (!this.options.pauseAutoPlayOnHover) {
|
3230
|
-
return;
|
3231
|
-
}
|
3232
|
-
this.player.pause();
|
3233
|
-
this.element.addEventListener('mouseleave', this);
|
3234
|
-
};
|
3235
|
-
|
3236
|
-
// resume auto-play on hover off
|
3237
|
-
proto$4.onmouseleave = function () {
|
3238
|
-
this.player.unpause();
|
3239
|
-
this.element.removeEventListener('mouseleave', this);
|
3240
|
-
};
|
3241
|
-
|
3242
|
-
// ----- ----- //
|
3243
|
-
|
3244
|
-
Flickity.Player = Player;
|
3245
|
-
|
3246
|
-
// append cells to a document fragment
|
3247
|
-
function getCellsFragment(cells) {
|
3248
|
-
var fragment = document.createDocumentFragment();
|
3249
|
-
cells.forEach(function (cell) {
|
3250
|
-
fragment.appendChild(cell.element);
|
3251
|
-
});
|
3252
|
-
return fragment;
|
3253
|
-
}
|
3254
|
-
|
3255
|
-
// -------------------------- add/remove cell prototype -------------------------- //
|
3256
|
-
|
3257
|
-
var proto$3 = Flickity.prototype;
|
3258
|
-
|
3259
|
-
/**
|
3260
|
-
* Insert, prepend, or append cells
|
3261
|
-
* @param {Element, Array, NodeList} elems
|
3262
|
-
* @param {Integer} index
|
3263
|
-
*/
|
3264
|
-
proto$3.insert = function (elems, index) {
|
3265
|
-
var cells = this._makeCells(elems);
|
3266
|
-
if (!cells || !cells.length) {
|
3267
|
-
return;
|
3268
|
-
}
|
3269
|
-
var len = this.cells.length;
|
3270
|
-
// default to append
|
3271
|
-
index = index === undefined ? len : index;
|
3272
|
-
// add cells with document fragment
|
3273
|
-
var fragment = getCellsFragment(cells);
|
3274
|
-
// append to slider
|
3275
|
-
var isAppend = index == len;
|
3276
|
-
if (isAppend) {
|
3277
|
-
this.slider.appendChild(fragment);
|
3278
|
-
} else {
|
3279
|
-
var insertCellElement = this.cells[index].element;
|
3280
|
-
this.slider.insertBefore(fragment, insertCellElement);
|
3281
|
-
}
|
3282
|
-
// add to this.cells
|
3283
|
-
if (index === 0) {
|
3284
|
-
// prepend, add to start
|
3285
|
-
this.cells = cells.concat(this.cells);
|
3286
|
-
} else if (isAppend) {
|
3287
|
-
// append, add to end
|
3288
|
-
this.cells = this.cells.concat(cells);
|
3289
|
-
} else {
|
3290
|
-
// insert in this.cells
|
3291
|
-
var endCells = this.cells.splice(index, len - index);
|
3292
|
-
this.cells = this.cells.concat(cells).concat(endCells);
|
3293
|
-
}
|
3294
|
-
|
3295
|
-
this._sizeCells(cells);
|
3296
|
-
this.cellChange(index, true);
|
3297
|
-
};
|
3298
|
-
|
3299
|
-
proto$3.append = function (elems) {
|
3300
|
-
this.insert(elems, this.cells.length);
|
3301
|
-
};
|
3302
|
-
|
3303
|
-
proto$3.prepend = function (elems) {
|
3304
|
-
this.insert(elems, 0);
|
3305
|
-
};
|
3306
|
-
|
3307
|
-
/**
|
3308
|
-
* Remove cells
|
3309
|
-
* @param {Element, Array, NodeList} elems
|
3310
|
-
*/
|
3311
|
-
proto$3.remove = function (elems) {
|
3312
|
-
var cells = this.getCells(elems);
|
3313
|
-
if (!cells || !cells.length) {
|
3314
|
-
return;
|
3315
|
-
}
|
3316
|
-
|
3317
|
-
var minCellIndex = this.cells.length - 1;
|
3318
|
-
// remove cells from collection & DOM
|
3319
|
-
cells.forEach(function (cell) {
|
3320
|
-
cell.remove();
|
3321
|
-
var index = this.cells.indexOf(cell);
|
3322
|
-
minCellIndex = Math.min(index, minCellIndex);
|
3323
|
-
utils.removeFrom(this.cells, cell);
|
3324
|
-
}, this);
|
3325
|
-
|
3326
|
-
this.cellChange(minCellIndex, true);
|
3327
|
-
};
|
3328
|
-
|
3329
|
-
/**
|
3330
|
-
* logic to be run after a cell's size changes
|
3331
|
-
* @param {Element} elem - cell's element
|
3332
|
-
*/
|
3333
|
-
proto$3.cellSizeChange = function (elem) {
|
3334
|
-
var cell = this.getCell(elem);
|
3335
|
-
if (!cell) {
|
3336
|
-
return;
|
3337
|
-
}
|
3338
|
-
cell.getSize();
|
3339
|
-
|
3340
|
-
var index = this.cells.indexOf(cell);
|
3341
|
-
this.cellChange(index);
|
3342
|
-
};
|
3343
|
-
|
3344
|
-
/**
|
3345
|
-
* logic any time a cell is changed: added, removed, or size changed
|
3346
|
-
* @param {Integer} changedCellIndex - index of the changed cell, optional
|
3347
|
-
*/
|
3348
|
-
proto$3.cellChange = function (changedCellIndex, isPositioningSlider) {
|
3349
|
-
var prevSelectedElem = this.selectedElement;
|
3350
|
-
this._positionCells(changedCellIndex);
|
3351
|
-
this._getWrapShiftCells();
|
3352
|
-
this.setGallerySize();
|
3353
|
-
// update selectedIndex
|
3354
|
-
// try to maintain position & select previous selected element
|
3355
|
-
var cell = this.getCell(prevSelectedElem);
|
3356
|
-
if (cell) {
|
3357
|
-
this.selectedIndex = this.getCellSlideIndex(cell);
|
3358
|
-
}
|
3359
|
-
this.selectedIndex = Math.min(this.slides.length - 1, this.selectedIndex);
|
3360
|
-
|
3361
|
-
this.emitEvent('cellChange', [changedCellIndex]);
|
3362
|
-
// position slider
|
3363
|
-
this.select(this.selectedIndex);
|
3364
|
-
// do not position slider after lazy load
|
3365
|
-
if (isPositioningSlider) {
|
3366
|
-
this.positionSliderAtSelected();
|
3367
|
-
}
|
3368
|
-
};
|
3369
|
-
|
3370
|
-
Flickity.createMethods.push('_createLazyload');
|
3371
|
-
var proto$2 = Flickity.prototype;
|
3372
|
-
|
3373
|
-
proto$2._createLazyload = function () {
|
3374
|
-
this.on('select', this.lazyLoad);
|
3375
|
-
};
|
3376
|
-
|
3377
|
-
proto$2.lazyLoad = function () {
|
3378
|
-
var lazyLoad = this.options.lazyLoad;
|
3379
|
-
if (!lazyLoad) {
|
3380
|
-
return;
|
3381
|
-
}
|
3382
|
-
// get adjacent cells, use lazyLoad option for adjacent count
|
3383
|
-
var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0;
|
3384
|
-
var cellElems = this.getAdjacentCellElements(adjCount);
|
3385
|
-
// get lazy images in those cells
|
3386
|
-
var lazyImages = [];
|
3387
|
-
cellElems.forEach(function (cellElem) {
|
3388
|
-
var lazyCellImages = getCellLazyImages(cellElem);
|
3389
|
-
lazyImages = lazyImages.concat(lazyCellImages);
|
3390
|
-
});
|
3391
|
-
// load lazy images
|
3392
|
-
lazyImages.forEach(function (img) {
|
3393
|
-
new LazyLoader(img, this);
|
3394
|
-
}, this);
|
3395
|
-
};
|
3396
|
-
|
3397
|
-
function getCellLazyImages(cellElem) {
|
3398
|
-
// check if cell element is lazy image
|
3399
|
-
if (cellElem.nodeName == 'IMG') {
|
3400
|
-
var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload');
|
3401
|
-
var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src');
|
3402
|
-
var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset');
|
3403
|
-
if (lazyloadAttr || srcAttr || srcsetAttr) {
|
3404
|
-
return [cellElem];
|
3405
|
-
}
|
3406
|
-
}
|
3407
|
-
// select lazy images in cell
|
3408
|
-
var lazySelector =
|
3409
|
-
'img[data-flickity-lazyload], ' +
|
3410
|
-
'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]';
|
3411
|
-
var imgs = cellElem.querySelectorAll(lazySelector);
|
3412
|
-
return utils.makeArray(imgs);
|
3413
|
-
}
|
3414
|
-
|
3415
|
-
// -------------------------- LazyLoader -------------------------- //
|
3416
|
-
|
3417
|
-
/**
|
3418
|
-
* class to handle loading images
|
3419
|
-
*/
|
3420
|
-
function LazyLoader(img, flickity) {
|
3421
|
-
this.img = img;
|
3422
|
-
this.flickity = flickity;
|
3423
|
-
this.load();
|
3424
|
-
}
|
3425
|
-
|
3426
|
-
LazyLoader.prototype.handleEvent = utils.handleEvent;
|
3427
|
-
|
3428
|
-
LazyLoader.prototype.load = function () {
|
3429
|
-
this.img.addEventListener('load', this);
|
3430
|
-
this.img.addEventListener('error', this);
|
3431
|
-
// get src & srcset
|
3432
|
-
var src =
|
3433
|
-
this.img.getAttribute('data-flickity-lazyload') ||
|
3434
|
-
this.img.getAttribute('data-flickity-lazyload-src');
|
3435
|
-
var srcset = this.img.getAttribute('data-flickity-lazyload-srcset');
|
3436
|
-
// set src & serset
|
3437
|
-
this.img.src = src;
|
3438
|
-
if (srcset) {
|
3439
|
-
this.img.setAttribute('srcset', srcset);
|
3440
|
-
}
|
3441
|
-
// remove attr
|
3442
|
-
this.img.removeAttribute('data-flickity-lazyload');
|
3443
|
-
this.img.removeAttribute('data-flickity-lazyload-src');
|
3444
|
-
this.img.removeAttribute('data-flickity-lazyload-srcset');
|
3445
|
-
};
|
3446
|
-
|
3447
|
-
LazyLoader.prototype.onload = function (event) {
|
3448
|
-
this.complete(event, 'flickity-lazyloaded');
|
3449
|
-
};
|
3450
|
-
|
3451
|
-
LazyLoader.prototype.onerror = function (event) {
|
3452
|
-
this.complete(event, 'flickity-lazyerror');
|
3453
|
-
};
|
3454
|
-
|
3455
|
-
LazyLoader.prototype.complete = function (event, className) {
|
3456
|
-
// unbind events
|
3457
|
-
this.img.removeEventListener('load', this);
|
3458
|
-
this.img.removeEventListener('error', this);
|
3459
|
-
|
3460
|
-
var cell = this.flickity.getParentCell(this.img);
|
3461
|
-
var cellElem = cell && cell.element;
|
3462
|
-
this.flickity.cellSizeChange(cellElem);
|
3463
|
-
|
3464
|
-
this.img.classList.add(className);
|
3465
|
-
this.flickity.dispatchEvent('lazyLoad', event, cellElem);
|
3466
|
-
};
|
3467
|
-
|
3468
|
-
// ----- ----- //
|
3469
|
-
|
3470
|
-
Flickity.LazyLoader = LazyLoader;
|
3471
|
-
|
3472
|
-
Flickity.createMethods.push('_createFullscreen');
|
3473
|
-
var proto$1 = Flickity.prototype;
|
3474
|
-
|
3475
|
-
proto$1._createFullscreen = function () {
|
3476
|
-
this.isFullscreen = false;
|
3477
|
-
|
3478
|
-
if (!this.options.fullscreen) {
|
3479
|
-
return;
|
3480
|
-
}
|
3481
|
-
// buttons
|
3482
|
-
this.viewFullscreenButton = new FullscreenButton('view', this);
|
3483
|
-
this.exitFullscreenButton = new FullscreenButton('exit', this);
|
3484
|
-
|
3485
|
-
this.on('activate', this._changeFullscreenActive);
|
3486
|
-
this.on('deactivate', this._changeFullscreenActive);
|
3487
|
-
};
|
3488
|
-
|
3489
|
-
// ----- activation ----- //
|
3490
|
-
|
3491
|
-
proto$1._changeFullscreenActive = function () {
|
3492
|
-
var childMethod = this.isActive ? 'appendChild' : 'removeChild';
|
3493
|
-
this.element[childMethod](this.viewFullscreenButton.element);
|
3494
|
-
this.element[childMethod](this.exitFullscreenButton.element);
|
3495
|
-
// activate or deactivate buttons
|
3496
|
-
var activeMethod = this.isActive ? 'activate' : 'deactivate';
|
3497
|
-
this.viewFullscreenButton[activeMethod]();
|
3498
|
-
this.exitFullscreenButton[activeMethod]();
|
3499
|
-
};
|
3500
|
-
|
3501
|
-
// ----- view, exit, toggle ----- //
|
3502
|
-
|
3503
|
-
proto$1.viewFullscreen = function () {
|
3504
|
-
this._changeFullscreen(true);
|
3505
|
-
this.focus();
|
3506
|
-
};
|
3507
|
-
|
3508
|
-
proto$1.exitFullscreen = function () {
|
3509
|
-
this._changeFullscreen(false);
|
3510
|
-
};
|
3511
|
-
|
3512
|
-
proto$1._changeFullscreen = function (isView) {
|
3513
|
-
if (this.isFullscreen == isView) {
|
3514
|
-
return;
|
3515
|
-
}
|
3516
|
-
this.isFullscreen = isView;
|
3517
|
-
var classMethod = isView ? 'add' : 'remove';
|
3518
|
-
document.documentElement.classList[classMethod]('is-flickity-fullscreen');
|
3519
|
-
this.element.classList[classMethod]('is-fullscreen');
|
3520
|
-
this.resize();
|
3521
|
-
// HACK extra reposition on fullscreen for images
|
3522
|
-
if (this.isFullscreen) {
|
3523
|
-
this.reposition();
|
3524
|
-
}
|
3525
|
-
this.dispatchEvent('fullscreenChange', null, [isView]);
|
3526
|
-
};
|
3527
|
-
|
3528
|
-
proto$1.toggleFullscreen = function () {
|
3529
|
-
this._changeFullscreen(!this.isFullscreen);
|
3530
|
-
};
|
3531
|
-
|
3532
|
-
// ----- setGallerySize ----- //
|
3533
|
-
|
3534
|
-
// overwrite so fullscreen cells are full height
|
3535
|
-
var setGallerySize = proto$1.setGallerySize;
|
3536
|
-
proto$1.setGallerySize = function () {
|
3537
|
-
if (!this.options.setGallerySize) {
|
3538
|
-
return;
|
3539
|
-
}
|
3540
|
-
if (this.isFullscreen) {
|
3541
|
-
// remove height style on fullscreen
|
3542
|
-
this.viewport.style.height = '';
|
3543
|
-
} else {
|
3544
|
-
// otherwise, do normal
|
3545
|
-
setGallerySize.call(this);
|
3546
|
-
}
|
3547
|
-
};
|
3548
|
-
|
3549
|
-
// ----- keyboard ----- //
|
3550
|
-
|
3551
|
-
// ESC key closes full screen
|
3552
|
-
Flickity.keyboardHandlers[27] = function () {
|
3553
|
-
this.exitFullscreen();
|
3554
|
-
};
|
3555
|
-
|
3556
|
-
// ----- FullscreenButton ----- //
|
3557
|
-
|
3558
|
-
function FullscreenButton(name, flickity) {
|
3559
|
-
this.name = name;
|
3560
|
-
this.createButton();
|
3561
|
-
this.createIcon();
|
3562
|
-
// events
|
3563
|
-
// trigger viewFullscreen or exitFullscreen on click
|
3564
|
-
this.onClick = function () {
|
3565
|
-
flickity[name + 'Fullscreen']();
|
3566
|
-
};
|
3567
|
-
this.clickHandler = this.onClick.bind(this);
|
3568
|
-
}
|
3569
|
-
|
3570
|
-
FullscreenButton.prototype.createButton = function () {
|
3571
|
-
var element = (this.element = document.createElement('button'));
|
3572
|
-
element.className =
|
3573
|
-
'flickity-button flickity-fullscreen-button ' +
|
3574
|
-
'flickity-fullscreen-button-' +
|
3575
|
-
this.name;
|
3576
|
-
// prevent button from submitting form
|
3577
|
-
element.setAttribute('type', 'button');
|
3578
|
-
// set label
|
3579
|
-
var label = capitalize(this.name + ' full-screen');
|
3580
|
-
element.setAttribute('aria-label', label);
|
3581
|
-
element.title = label;
|
3582
|
-
};
|
3583
|
-
|
3584
|
-
function capitalize(text) {
|
3585
|
-
return text[0].toUpperCase() + text.slice(1);
|
3586
|
-
}
|
3587
|
-
|
3588
|
-
var svgURI = 'http://www.w3.org/2000/svg';
|
3589
|
-
|
3590
|
-
var pathDirections = {
|
3591
|
-
view: 'M15,20,7,28h5v4H0V20H4v5l8-8Zm5-5,8-8v5h4V0H20V4h5l-8,8Z',
|
3592
|
-
exit: 'M32,3l-7,7h5v4H18V2h4V7l7-7ZM3,32l7-7v5h4V18H2v4H7L0,29Z',
|
3593
|
-
};
|
3594
|
-
|
3595
|
-
FullscreenButton.prototype.createIcon = function () {
|
3596
|
-
var svg = document.createElementNS(svgURI, 'svg');
|
3597
|
-
svg.setAttribute('class', 'flickity-button-icon');
|
3598
|
-
svg.setAttribute('viewBox', '0 0 32 32');
|
3599
|
-
// path & direction
|
3600
|
-
var path = document.createElementNS(svgURI, 'path');
|
3601
|
-
var direction = pathDirections[this.name];
|
3602
|
-
path.setAttribute('d', direction);
|
3603
|
-
// put it together
|
3604
|
-
svg.appendChild(path);
|
3605
|
-
this.element.appendChild(svg);
|
3606
|
-
};
|
3607
|
-
|
3608
|
-
FullscreenButton.prototype.activate = function () {
|
3609
|
-
this.element.addEventListener('click', this.clickHandler);
|
3610
|
-
};
|
3611
|
-
|
3612
|
-
FullscreenButton.prototype.deactivate = function () {
|
3613
|
-
this.element.removeEventListener('click', this.clickHandler);
|
3614
|
-
};
|
3615
|
-
|
3616
|
-
Flickity.FullscreenButton = FullscreenButton;
|
3617
|
-
|
3618
|
-
var Slide = Flickity.Slide;
|
3619
|
-
|
3620
|
-
var slideUpdateTarget = Slide.prototype.updateTarget;
|
3621
|
-
Slide.prototype.updateTarget = function () {
|
3622
|
-
slideUpdateTarget.apply(this, arguments);
|
3623
|
-
if (!this.parent.options.fade) {
|
3624
|
-
return;
|
3625
|
-
}
|
3626
|
-
// position cells at selected target
|
3627
|
-
var slideTargetX = this.target - this.x;
|
3628
|
-
var firstCellX = this.cells[0].x;
|
3629
|
-
this.cells.forEach(function (cell) {
|
3630
|
-
var targetX = cell.x - firstCellX - slideTargetX;
|
3631
|
-
cell.renderPosition(targetX);
|
3632
|
-
});
|
3633
|
-
};
|
3634
|
-
|
3635
|
-
Slide.prototype.setOpacity = function (alpha) {
|
3636
|
-
this.cells.forEach(function (cell) {
|
3637
|
-
cell.element.style.opacity = alpha;
|
3638
|
-
});
|
3639
|
-
};
|
3640
|
-
|
3641
|
-
// ---- Flickity ---- //
|
3642
|
-
|
3643
|
-
var proto = Flickity.prototype;
|
3644
|
-
|
3645
|
-
Flickity.createMethods.push('_createFade');
|
3646
|
-
|
3647
|
-
proto._createFade = function () {
|
3648
|
-
this.fadeIndex = this.selectedIndex;
|
3649
|
-
this.prevSelectedIndex = this.selectedIndex;
|
3650
|
-
this.on('select', this.onSelectFade);
|
3651
|
-
this.on('dragEnd', this.onDragEndFade);
|
3652
|
-
this.on('settle', this.onSettleFade);
|
3653
|
-
this.on('activate', this.onActivateFade);
|
3654
|
-
this.on('deactivate', this.onDeactivateFade);
|
3655
|
-
};
|
3656
|
-
|
3657
|
-
var updateSlides = proto.updateSlides;
|
3658
|
-
proto.updateSlides = function () {
|
3659
|
-
updateSlides.apply(this, arguments);
|
3660
|
-
if (!this.options.fade) {
|
3661
|
-
return;
|
3662
|
-
}
|
3663
|
-
// set initial opacity
|
3664
|
-
this.slides.forEach(function (slide, i) {
|
3665
|
-
var alpha = i == this.selectedIndex ? 1 : 0;
|
3666
|
-
slide.setOpacity(alpha);
|
3667
|
-
}, this);
|
3668
|
-
};
|
3669
|
-
|
3670
|
-
/* ---- events ---- */
|
3671
|
-
|
3672
|
-
proto.onSelectFade = function () {
|
3673
|
-
// in case of resize, keep fadeIndex within current count
|
3674
|
-
this.fadeIndex = Math.min(this.prevSelectedIndex, this.slides.length - 1);
|
3675
|
-
this.prevSelectedIndex = this.selectedIndex;
|
3676
|
-
};
|
3677
|
-
|
3678
|
-
proto.onSettleFade = function () {
|
3679
|
-
delete this.didDragEnd;
|
3680
|
-
if (!this.options.fade) {
|
3681
|
-
return;
|
3682
|
-
}
|
3683
|
-
// set full and 0 opacity on selected & faded slides
|
3684
|
-
this.selectedSlide.setOpacity(1);
|
3685
|
-
var fadedSlide = this.slides[this.fadeIndex];
|
3686
|
-
if (fadedSlide && this.fadeIndex != this.selectedIndex) {
|
3687
|
-
this.slides[this.fadeIndex].setOpacity(0);
|
3688
|
-
}
|
3689
|
-
};
|
3690
|
-
|
3691
|
-
proto.onDragEndFade = function () {
|
3692
|
-
// set flag
|
3693
|
-
this.didDragEnd = true;
|
3694
|
-
};
|
3695
|
-
|
3696
|
-
proto.onActivateFade = function () {
|
3697
|
-
if (this.options.fade) {
|
3698
|
-
this.element.classList.add('is-fade');
|
3699
|
-
}
|
3700
|
-
};
|
3701
|
-
|
3702
|
-
proto.onDeactivateFade = function () {
|
3703
|
-
if (!this.options.fade) {
|
3704
|
-
return;
|
3705
|
-
}
|
3706
|
-
this.element.classList.remove('is-fade');
|
3707
|
-
// reset opacity
|
3708
|
-
this.slides.forEach(function (slide) {
|
3709
|
-
slide.setOpacity('');
|
3710
|
-
});
|
3711
|
-
};
|
3712
|
-
|
3713
|
-
/* ---- position & fading ---- */
|
3714
|
-
|
3715
|
-
var positionSlider = proto.positionSlider;
|
3716
|
-
proto.positionSlider = function () {
|
3717
|
-
if (!this.options.fade) {
|
3718
|
-
positionSlider.apply(this, arguments);
|
3719
|
-
return;
|
3720
|
-
}
|
3721
|
-
|
3722
|
-
this.fadeSlides();
|
3723
|
-
this.dispatchScrollEvent();
|
3724
|
-
};
|
3725
|
-
|
3726
|
-
var positionSliderAtSelected = proto.positionSliderAtSelected;
|
3727
|
-
proto.positionSliderAtSelected = function () {
|
3728
|
-
if (this.options.fade) {
|
3729
|
-
// position fade slider at origin
|
3730
|
-
this.setTranslateX(0);
|
3731
|
-
}
|
3732
|
-
positionSliderAtSelected.apply(this, arguments);
|
3733
|
-
};
|
3734
|
-
|
3735
|
-
proto.fadeSlides = function () {
|
3736
|
-
if (this.slides.length < 2) {
|
3737
|
-
return;
|
3738
|
-
}
|
3739
|
-
// get slides to fade-in & fade-out
|
3740
|
-
var indexes = this.getFadeIndexes();
|
3741
|
-
var fadeSlideA = this.slides[indexes.a];
|
3742
|
-
var fadeSlideB = this.slides[indexes.b];
|
3743
|
-
var distance = this.wrapDifference(fadeSlideA.target, fadeSlideB.target);
|
3744
|
-
var progress = this.wrapDifference(fadeSlideA.target, -this.x);
|
3745
|
-
progress = progress / distance;
|
3746
|
-
|
3747
|
-
fadeSlideA.setOpacity(1 - progress);
|
3748
|
-
fadeSlideB.setOpacity(progress);
|
3749
|
-
|
3750
|
-
// hide previous slide
|
3751
|
-
var fadeHideIndex = indexes.a;
|
3752
|
-
if (this.isDragging) {
|
3753
|
-
fadeHideIndex = progress > 0.5 ? indexes.a : indexes.b;
|
3754
|
-
}
|
3755
|
-
var isNewHideIndex =
|
3756
|
-
this.fadeHideIndex != undefined &&
|
3757
|
-
this.fadeHideIndex != fadeHideIndex &&
|
3758
|
-
this.fadeHideIndex != indexes.a &&
|
3759
|
-
this.fadeHideIndex != indexes.b;
|
3760
|
-
if (isNewHideIndex) {
|
3761
|
-
// new fadeHideSlide set, hide previous
|
3762
|
-
this.slides[this.fadeHideIndex].setOpacity(0);
|
3763
|
-
}
|
3764
|
-
this.fadeHideIndex = fadeHideIndex;
|
3765
|
-
};
|
3766
|
-
|
3767
|
-
proto.getFadeIndexes = function () {
|
3768
|
-
if (!this.isDragging && !this.didDragEnd) {
|
3769
|
-
return {
|
3770
|
-
a: this.fadeIndex,
|
3771
|
-
b: this.selectedIndex,
|
3772
|
-
};
|
3773
|
-
}
|
3774
|
-
if (this.options.wrapAround) {
|
3775
|
-
return this.getFadeDragWrapIndexes();
|
3776
|
-
} else {
|
3777
|
-
return this.getFadeDragLimitIndexes();
|
3778
|
-
}
|
3779
|
-
};
|
3780
|
-
|
3781
|
-
proto.getFadeDragWrapIndexes = function () {
|
3782
|
-
var distances = this.slides.map(function (slide, i) {
|
3783
|
-
return this.getSlideDistance(-this.x, i);
|
3784
|
-
}, this);
|
3785
|
-
var absDistances = distances.map(function (distance) {
|
3786
|
-
return Math.abs(distance);
|
3787
|
-
});
|
3788
|
-
var minDistance = Math.min.apply(Math, absDistances);
|
3789
|
-
var closestIndex = absDistances.indexOf(minDistance);
|
3790
|
-
var distance = distances[closestIndex];
|
3791
|
-
var len = this.slides.length;
|
3792
|
-
|
3793
|
-
var delta = distance >= 0 ? 1 : -1;
|
3794
|
-
return {
|
3795
|
-
a: closestIndex,
|
3796
|
-
b: utils.modulo(closestIndex + delta, len),
|
3797
|
-
};
|
3798
|
-
};
|
3799
|
-
|
3800
|
-
proto.getFadeDragLimitIndexes = function () {
|
3801
|
-
// calculate closest previous slide
|
3802
|
-
var dragIndex = 0;
|
3803
|
-
for (var i = 0; i < this.slides.length - 1; i++) {
|
3804
|
-
var slide = this.slides[i];
|
3805
|
-
if (-this.x < slide.target) {
|
3806
|
-
break;
|
3807
|
-
}
|
3808
|
-
dragIndex = i;
|
3809
|
-
}
|
3810
|
-
return {
|
3811
|
-
a: dragIndex,
|
3812
|
-
b: dragIndex + 1,
|
3813
|
-
};
|
3814
|
-
};
|
3815
|
-
|
3816
|
-
proto.wrapDifference = function (a, b) {
|
3817
|
-
var diff = b - a;
|
3818
|
-
|
3819
|
-
if (!this.options.wrapAround) {
|
3820
|
-
return diff;
|
3821
|
-
}
|
3822
|
-
|
3823
|
-
var diffPlus = diff + this.slideableWidth;
|
3824
|
-
var diffMinus = diff - this.slideableWidth;
|
3825
|
-
if (Math.abs(diffPlus) < Math.abs(diff)) {
|
3826
|
-
diff = diffPlus;
|
3827
|
-
}
|
3828
|
-
if (Math.abs(diffMinus) < Math.abs(diff)) {
|
3829
|
-
diff = diffMinus;
|
3830
|
-
}
|
3831
|
-
return diff;
|
3832
|
-
};
|
3833
|
-
|
3834
|
-
// ---- wrapAround ---- //
|
3835
|
-
|
3836
|
-
var _getWrapShiftCells = proto._getWrapShiftCells;
|
3837
|
-
proto._getWrapShiftCells = function () {
|
3838
|
-
if (!this.options.fade) {
|
3839
|
-
_getWrapShiftCells.apply(this, arguments);
|
3840
|
-
}
|
3841
|
-
};
|
3842
|
-
|
3843
|
-
var shiftWrapCells = proto.shiftWrapCells;
|
3844
|
-
proto.shiftWrapCells = function () {
|
3845
|
-
if (!this.options.fade) {
|
3846
|
-
shiftWrapCells.apply(this, arguments);
|
3847
|
-
}
|
3848
|
-
};
|
3849
|
-
|
3850
|
-
const flickity = Flickity;
|
3851
|
-
|
3852
|
-
const slidesCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--dot-color:#ccc;--dot-color-active:var(--nano-color-primary, #007495);--navbtns-icon-color:var(--dot-color-active);--navbtns-bg-color:white;--navbtns-icon-color-disabled:var(--dot-color-active);--navbtns-bg-color-disabled:white;--fsbtn-icon-color:var(--dot-color-active);--fsbtn-bg-color:white;display:block;-webkit-user-select:none;user-select:none;overflow:hidden;transition:opacity 0.2s;opacity:0;max-width:100vw}:host([ready]){opacity:1}.slideshow{max-height:100%;min-height:inherit;height:inherit;position:relative}.slideshow.not-ready{width:100%;overflow:hidden}.flickity-container{opacity:0;transition:opacity 0.2s;display:flex;width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content}.not-ready .flickity-container{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content}.flickity-container.slides-ready{min-height:inherit;max-height:inherit;height:inherit;width:auto}[hidden]{display:none !important}.ui-extras{pointer-events:none;position:absolute;block-size:100%;inline-size:100%;inset-block-start:0;inset-inline-start:0}.ui-extras *{pointer-events:all}/*! Flickity v2.2.1\nhttps://flickity.metafizzy.co\n---------------------------------------------- */.flickity-enabled{position:relative;opacity:1}.flickity-enabled:focus{outline:none}.flickity-viewport{overflow:hidden;position:relative;min-block-size:100%;flex:1}.flickity-slider{position:absolute;inline-size:100%;block-size:100%}.flickity-enabled.is-draggable{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.flickity-enabled.is-draggable .flickity-viewport{cursor:move;cursor:grab;cursor:grab}.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down{cursor:grabbing}.flickity-button{position:absolute;background:var(--navbtns-bg-color);border:none;color:#333;opacity:0.75}.flickity-button:hover{opacity:1;cursor:pointer}.flickity-button:focus{outline:none;box-shadow:0 0 0 5px #19f}.flickity-button:active{opacity:0.6}.flickity-button:disabled{opacity:0.3;cursor:auto;pointer-events:none;background:var(--navbtns-bg-color-disabled)}.flickity-button-icon{fill:var(--navbtns-icon-color)}.flickity-button:disabled .flickity-button-icon{fill:var(--navbtns-icon-color-disabled)}.flickity-prev-next-button{inset-block-start:50%;inline-size:44px;block-size:44px;border-radius:50%;transform:translateY(-50%)}.flickity-prev-next-button.previous{inset-inline-start:10px}.flickity-prev-next-button.next{inset-inline-end:10px}.flickity-rtl .flickity-prev-next-button.previous{inset-inline:auto 10px}.flickity-rtl .flickity-prev-next-button.next{inset-inline:10px auto}.flickity-prev-next-button .flickity-button-icon{position:absolute;inset-inline-start:20%;inset-block-start:20%;inline-size:60%;block-size:60%}.flickity-page-dots{position:absolute;inline-size:100%;inset-block-end:10px;padding:0;margin:0;list-style:none;text-align:center;line-height:1;z-index:4}.flickity-rtl .flickity-page-dots{direction:rtl}.flickity-page-dots .dot{display:inline-block;inline-size:10px;block-size:10px;margin-block:0;margin-inline:8px;border-radius:50%;cursor:pointer;background:var(--dot-color)}.flickity-page-dots .dot.is-selected{opacity:1;background:var(--dot-color-active)}.flickity-enabled.is-fullscreen{position:fixed;inset-inline-start:0;inset-block-start:0;inline-size:100%;block-size:100%;background:rgba(0, 0, 0, 0.9);-webkit-padding-after:35px;padding-block-end:35px;z-index:100}.flickity-enabled.is-fullscreen .flickity-page-dots{inset-block-end:45px}html.is-flickity-fullscreen{overflow:hidden}.flickity-fullscreen-button{display:block;inset-inline-end:10px;inset-block-start:10px;inline-size:24px;block-size:24px;border-radius:4px;background:var(--fsbtn-bg-color);fill:var(--fsbtn-icon-color)}.flickity-rtl .flickity-fullscreen-button{inset-inline:10px auto}.flickity-fullscreen-button-exit{display:none}.flickity-enabled.is-fullscreen .flickity-fullscreen-button-exit{display:block}.flickity-enabled.is-fullscreen .flickity-fullscreen-button-view{display:none}.flickity-fullscreen-button .flickity-button-icon{position:absolute;inline-size:16px;block-size:16px;inset-inline-start:4px;inset-block-start:4px}.flickity-enabled.is-fade .flickity-slider>*{pointer-events:none;z-index:0}.flickity-enabled.is-fade .flickity-slider ::slotted(.is-selected){pointer-events:auto;z-index:1}";
|
3853
11
|
|
3854
|
-
const modulo = (num, div) => {
|
3855
|
-
return ((num % div) + div) % div;
|
3856
|
-
};
|
3857
|
-
const Slides = class {
|
3858
|
-
constructor(hostRef) {
|
3859
|
-
index.registerInstance(this, hostRef);
|
3860
|
-
this.nanoSlidesDidLoad = index.createEvent(this, "nanoSlidesDidLoad", 7);
|
3861
|
-
this.nanoSlidesReady = index.createEvent(this, "nanoSlidesReady", 7);
|
3862
|
-
this.nanoSlidesSelect = index.createEvent(this, "nanoSlidesSelect", 7);
|
3863
|
-
this.nanoSlidesChange = index.createEvent(this, "nanoSlidesChange", 7);
|
3864
|
-
this.nanoSlidesScroll = index.createEvent(this, "nanoSlidesScroll", 7);
|
3865
|
-
this.nanoSlidesTransitionEnd = index.createEvent(this, "nanoSlidesTransitionEnd", 7);
|
3866
|
-
this.nanoSlidesDragStart = index.createEvent(this, "nanoSlidesDragStart", 7);
|
3867
|
-
this.nanoSlidesDragMove = index.createEvent(this, "nanoSlidesDragMove", 7);
|
3868
|
-
this.nanoSlidesDragEnd = index.createEvent(this, "nanoSlidesDragEnd", 7);
|
3869
|
-
this.nanoSlidesTap = index.createEvent(this, "nanoSlidesTap", 7);
|
3870
|
-
this.nanoSlidesFullscreenChange = index.createEvent(this, "nanoSlidesFullscreenChange", 7);
|
3871
|
-
this.flickityReady = false;
|
3872
|
-
this.flickity = new Promise((resolve) => {
|
3873
|
-
this.readyflickity = resolve;
|
3874
|
-
});
|
3875
|
-
this.parallax = async () => {
|
3876
|
-
const flkty = await this.flickity;
|
3877
|
-
const cells = flkty.cells;
|
3878
|
-
cells.forEach((cell) => {
|
3879
|
-
const ele = cell.element.children[0];
|
3880
|
-
let flkX = flkty.x;
|
3881
|
-
if (flkty.options.wrapAround && flkty.cells.length > 1) {
|
3882
|
-
flkX = modulo(flkX, flkty.slideableWidth);
|
3883
|
-
flkX = flkX - flkty.slideableWidth;
|
3884
|
-
}
|
3885
|
-
let x = ((cell.target + flkX) * -1) / 3;
|
3886
|
-
if (cell.shift < 0) {
|
3887
|
-
x = ((cell.target - flkty.slideableWidth + flkX) * -1) / 3;
|
3888
|
-
}
|
3889
|
-
else if (cell.shift > 0) {
|
3890
|
-
x = ((cell.target + (flkX + flkty.slideableWidth)) * -1) / 3;
|
3891
|
-
}
|
3892
|
-
ele.style.transform = 'translate3d(' + x + 'px, 0, 0)';
|
3893
|
-
const animAmount = ((x * 3) / cell.size.width) * 100;
|
3894
|
-
cell.element.style.setProperty('--animation-amount', animAmount.toString());
|
3895
|
-
});
|
3896
|
-
};
|
3897
|
-
this.handleFullscreen = (isFullScreen) => {
|
3898
|
-
this.fullscreen = isFullScreen;
|
3899
|
-
this.nanoSlidesFullscreenChange.emit(isFullScreen);
|
3900
|
-
};
|
3901
|
-
this.handleSlideSelect = (slide) => {
|
3902
|
-
this.iCurrentSlide = slide;
|
3903
|
-
this.nanoSlidesSelect.emit(slide);
|
3904
|
-
};
|
3905
|
-
this.iCurrentSlide = undefined;
|
3906
|
-
this.slidesReady = undefined;
|
3907
|
-
this.didInit = false;
|
3908
|
-
this.options = {};
|
3909
|
-
this.navbtns = false;
|
3910
|
-
this.pager = false;
|
3911
|
-
this.fullscreenbtn = false;
|
3912
|
-
this.fullscreen = false;
|
3913
|
-
this.animation = 'scroll';
|
3914
|
-
this.currentSlide = 0;
|
3915
|
-
this.autoplay = false;
|
3916
|
-
this.ready = false;
|
3917
|
-
}
|
3918
|
-
async optionsChanged() {
|
3919
|
-
if (this.flickityReady) {
|
3920
|
-
const flickity = await this.getflickity();
|
3921
|
-
Object.assign(flickity.options, this.options);
|
3922
|
-
await this.update();
|
3923
|
-
}
|
3924
|
-
}
|
3925
|
-
async navbtnsChanged() {
|
3926
|
-
Array.from(this._getRoot().querySelectorAll('.flickity-prev-next-button')).forEach((btn) => {
|
3927
|
-
btn.hidden = !this.navbtns;
|
3928
|
-
});
|
3929
|
-
}
|
3930
|
-
async pagerChanged() {
|
3931
|
-
const dots = this._getRoot().querySelector('.flickity-page-dots');
|
3932
|
-
dots.hidden = !this.pager;
|
3933
|
-
}
|
3934
|
-
async fullscreenBtnChanged() {
|
3935
|
-
const btn = this._getRoot().querySelector('.flickity-fullscreen-button');
|
3936
|
-
btn.hidden = !this.fullscreenbtn;
|
3937
|
-
}
|
3938
|
-
async fullscreenChanged(_, oldFs) {
|
3939
|
-
const flickity = await this.getflickity();
|
3940
|
-
if (this.fullscreen)
|
3941
|
-
flickity.viewFullscreen();
|
3942
|
-
else if (typeof oldFs !== 'undefined')
|
3943
|
-
flickity.exitFullscreen();
|
3944
|
-
}
|
3945
|
-
async animationChange(_, oldAnim) {
|
3946
|
-
const [flkty, slides] = await Promise.all([
|
3947
|
-
this.getflickity(),
|
3948
|
-
waitForSlides(this.host),
|
3949
|
-
]);
|
3950
|
-
// clear old stuff
|
3951
|
-
slides.forEach((slide) => {
|
3952
|
-
slide.style['left'] = undefined;
|
3953
|
-
});
|
3954
|
-
if (oldAnim === 'parallax') {
|
3955
|
-
flkty.off('scroll', this.parallax);
|
3956
|
-
slides.forEach((_, i) => {
|
3957
|
-
if (this.childrenEles && this.childrenEles[i])
|
3958
|
-
this.childrenEles[i].style['transform'] = undefined;
|
3959
|
-
});
|
3960
|
-
this.update();
|
3961
|
-
}
|
3962
|
-
// was a custom animation
|
3963
|
-
if (typeof oldAnim === 'function') {
|
3964
|
-
flkty.off('scroll', oldAnim);
|
3965
|
-
}
|
3966
|
-
// is a custom animation
|
3967
|
-
if (typeof this.animation === 'function') {
|
3968
|
-
this.options = { fade: false, percentPosition: true };
|
3969
|
-
flkty.on('scroll', this.animation);
|
3970
|
-
return;
|
3971
|
-
}
|
3972
|
-
// setup new stuff
|
3973
|
-
switch (this.animation) {
|
3974
|
-
case 'fade':
|
3975
|
-
this.options = { fade: true, percentPosition: true };
|
3976
|
-
break;
|
3977
|
-
case 'parallax':
|
3978
|
-
this.options = { fade: false, percentPosition: true };
|
3979
|
-
flkty.on('scroll', this.parallax);
|
3980
|
-
break;
|
3981
|
-
default:
|
3982
|
-
this.options = { fade: false, percentPosition: true };
|
3983
|
-
break;
|
3984
|
-
}
|
3985
|
-
}
|
3986
|
-
currentSlideChange() {
|
3987
|
-
if (this.currentSlide !== this.iCurrentSlide)
|
3988
|
-
this.slideTo(this.currentSlide);
|
3989
|
-
}
|
3990
|
-
internalSlideChange() {
|
3991
|
-
this.currentSlide = this.iCurrentSlide;
|
3992
|
-
}
|
3993
|
-
async autoPlayChange() {
|
3994
|
-
await this.stopAutoplay();
|
3995
|
-
if (this.autoplay) {
|
3996
|
-
if (typeof this.autoplay === 'string')
|
3997
|
-
this.autoplay = parseInt(this.autoplay);
|
3998
|
-
if (this.autoplay > 0)
|
3999
|
-
this.startAutoplay(this.autoplay);
|
4000
|
-
}
|
4001
|
-
}
|
4002
|
-
/**
|
4003
|
-
* Update the underlying flickity implementation. Call this if you've added or removed
|
4004
|
-
* child slides.
|
4005
|
-
*/
|
4006
|
-
async update() {
|
4007
|
-
const [flickity] = await Promise.all([
|
4008
|
-
this.getflickity(),
|
4009
|
-
waitForSlides(this.host),
|
4010
|
-
]);
|
4011
|
-
this.childrenEles = this.host.querySelectorAll('nano-slide > *');
|
4012
|
-
flickity.reloadCells();
|
4013
|
-
flickity.resize();
|
4014
|
-
flickity.reposition();
|
4015
|
-
}
|
4016
|
-
/**
|
4017
|
-
* Force flickity to update its height (when adaptiveHeight is enabled) for the duration
|
4018
|
-
* equal to 'speed' parameter.
|
4019
|
-
*
|
4020
|
-
* @param speed The transition duration (in ms).
|
4021
|
-
*/
|
4022
|
-
async updateAutoHeight(speed) {
|
4023
|
-
const vp = document.querySelector('.flickity-viewport');
|
4024
|
-
if (vp)
|
4025
|
-
vp.style.transition = speed + 'ms';
|
4026
|
-
}
|
4027
|
-
/**
|
4028
|
-
* Transition to the specified slide.
|
4029
|
-
*
|
4030
|
-
* @param index The index of the slide to transition to.
|
4031
|
-
* @param instant Immediately view the selected slide without animation.
|
4032
|
-
*/
|
4033
|
-
async slideTo(index, instant) {
|
4034
|
-
const flickity = await this.getflickity();
|
4035
|
-
flickity.select(index, instant);
|
4036
|
-
}
|
4037
|
-
/**
|
4038
|
-
* Transition to the next slide.
|
4039
|
-
*
|
4040
|
-
* @param instant The transition duration (in ms).
|
4041
|
-
* @param wrap If true, the first slide will be selected if at the last slide.
|
4042
|
-
*/
|
4043
|
-
async slideNext(instant, wrap) {
|
4044
|
-
const flickity = await this.getflickity();
|
4045
|
-
flickity.next(wrap, instant);
|
4046
|
-
}
|
4047
|
-
/**
|
4048
|
-
* Transition to the previous slide.
|
4049
|
-
*
|
4050
|
-
* @param instant The transition duration (in ms).
|
4051
|
-
* @param wrap If true, the last slide will be selected if at the first slide.
|
4052
|
-
*/
|
4053
|
-
async slidePrev(instant, wrap) {
|
4054
|
-
const flickity = await this.getflickity();
|
4055
|
-
flickity.previous(instant, wrap);
|
4056
|
-
}
|
4057
|
-
/** Get the index of the active slide. */
|
4058
|
-
async getActiveIndex() {
|
4059
|
-
const flickity = await this.getflickity();
|
4060
|
-
return flickity.selectedIndex;
|
4061
|
-
}
|
4062
|
-
/** Get the total number of slides. */
|
4063
|
-
async length() {
|
4064
|
-
const flickity = await this.getflickity();
|
4065
|
-
return flickity.slides.length;
|
4066
|
-
}
|
4067
|
-
/** Get whether or not the current slide is the last slide. */
|
4068
|
-
async isEnd() {
|
4069
|
-
const flickity = await this.getflickity();
|
4070
|
-
return flickity.selectedIndex === flickity.slides.length - 1;
|
4071
|
-
}
|
4072
|
-
/** Get whether or not the current slide is the first slide. */
|
4073
|
-
async isBeginning() {
|
4074
|
-
const flickity = await this.getflickity();
|
4075
|
-
return flickity.selectedIndex === 0;
|
4076
|
-
}
|
4077
|
-
/**
|
4078
|
-
* Start auto play.
|
4079
|
-
* @param time - optional time duration to show slides
|
4080
|
-
*/
|
4081
|
-
async startAutoplay(time) {
|
4082
|
-
const flickity = await this.getflickity();
|
4083
|
-
if (time)
|
4084
|
-
this.options = { autoPlay: time };
|
4085
|
-
setTimeout(() => flickity.playPlayer());
|
4086
|
-
}
|
4087
|
-
/** Stop auto play. */
|
4088
|
-
async stopAutoplay() {
|
4089
|
-
const flickity = await this.getflickity();
|
4090
|
-
flickity.stopPlayer();
|
4091
|
-
}
|
4092
|
-
/**
|
4093
|
-
* Lock or unlock the ability to slide to the next slide.
|
4094
|
-
*
|
4095
|
-
* @param lock If `true`, disable swiping
|
4096
|
-
*/
|
4097
|
-
async lockSwipes(lock) {
|
4098
|
-
const flickity = await this.getflickity();
|
4099
|
-
flickity.options.draggable = !lock;
|
4100
|
-
flickity.updateDraggable();
|
4101
|
-
}
|
4102
|
-
/**
|
4103
|
-
* Get the flickity instance.
|
4104
|
-
* Use this to access the full flickity API.
|
4105
|
-
* See https://flickity.metafizzy.co/ for all API options.
|
4106
|
-
*/
|
4107
|
-
async getflickity() {
|
4108
|
-
return this.flickity;
|
4109
|
-
}
|
4110
|
-
/**
|
4111
|
-
* Hard destroy / create.
|
4112
|
-
* Certain flickity options, you will require the instance to be re-initialised
|
4113
|
-
*/
|
4114
|
-
async reload() {
|
4115
|
-
this.destroyflickity();
|
4116
|
-
setTimeout(() => this.initflickity(), 20);
|
4117
|
-
}
|
4118
|
-
_getRoot() {
|
4119
|
-
return this.host.shadowRoot ? this.host.shadowRoot : this.host;
|
4120
|
-
}
|
4121
|
-
destroyflickity() {
|
4122
|
-
/**
|
4123
|
-
* We need to synchronously destroy
|
4124
|
-
* flickity otherwise it is possible
|
4125
|
-
* that it will be left in a
|
4126
|
-
* destroyed state if connectedCallback
|
4127
|
-
* is called multiple times
|
4128
|
-
*/
|
4129
|
-
const flickity = this.syncflickity;
|
4130
|
-
if (flickity !== undefined) {
|
4131
|
-
flickity.destroy();
|
4132
|
-
this.flickity = new Promise((resolve) => {
|
4133
|
-
this.readyflickity = resolve;
|
4134
|
-
});
|
4135
|
-
this.flickityReady = false;
|
4136
|
-
this.syncflickity = undefined;
|
4137
|
-
this.ready = false;
|
4138
|
-
}
|
4139
|
-
this.didInit = false;
|
4140
|
-
}
|
4141
|
-
async initflickity() {
|
4142
|
-
const finalOptions = this.normalizeOptions();
|
4143
|
-
// init flickity core
|
4144
|
-
await waitForSlides(this.host);
|
4145
|
-
this.flickityEl =
|
4146
|
-
this.flickityEl || this._getRoot().querySelector('.flickity-container');
|
4147
|
-
if (!this.flickityEl)
|
4148
|
-
return;
|
4149
|
-
this.slidesReady = true;
|
4150
|
-
if (this.flickityEl.classList.contains('flickity-enabled')) {
|
4151
|
-
this.destroyflickity();
|
4152
|
-
}
|
4153
|
-
this.flickityEl.style.height =
|
4154
|
-
this.flickityEl.getBoundingClientRect().height + 'px';
|
4155
|
-
setTimeout(() => {
|
4156
|
-
this.flickityEl.style.height = '';
|
4157
|
-
const flick = new flickity(this.flickityEl, finalOptions);
|
4158
|
-
this.flickityReady = true;
|
4159
|
-
this.syncflickity = flick;
|
4160
|
-
this.animationChange();
|
4161
|
-
this.navbtnsChanged();
|
4162
|
-
this.pagerChanged();
|
4163
|
-
this.fullscreenChanged();
|
4164
|
-
this.fullscreenBtnChanged();
|
4165
|
-
this.readyflickity(flick);
|
4166
|
-
this.ready = true;
|
4167
|
-
if (!window['ResizeObserver'])
|
4168
|
-
return;
|
4169
|
-
// just boots and braces to make sure it's the correct size oninit
|
4170
|
-
const ro = (this.resizeO = new ResizeObserver(() => {
|
4171
|
-
flick.resize();
|
4172
|
-
// this.resizeO.disconnect();
|
4173
|
-
}));
|
4174
|
-
ro.observe(this.host);
|
4175
|
-
}, 100);
|
4176
|
-
}
|
4177
|
-
normalizeOptions() {
|
4178
|
-
// Base options, can be changed
|
4179
|
-
const flickityOptions = {
|
4180
|
-
cellSelector: 'nano-slide',
|
4181
|
-
contain: true,
|
4182
|
-
prevNextButtons: true,
|
4183
|
-
fullscreen: true,
|
4184
|
-
accessibility: true,
|
4185
|
-
imagesLoaded: true,
|
4186
|
-
pageDots: true,
|
4187
|
-
};
|
4188
|
-
if (this.animation === 'fade') {
|
4189
|
-
flickityOptions.fade = true;
|
4190
|
-
}
|
4191
|
-
if (this.currentSlide > 0) {
|
4192
|
-
flickityOptions.initialIndex = this.currentSlide;
|
4193
|
-
}
|
4194
|
-
if (this.autoplay) {
|
4195
|
-
if (typeof this.autoplay === 'string')
|
4196
|
-
this.autoplay = parseInt(this.autoplay);
|
4197
|
-
if (this.autoplay > 0)
|
4198
|
-
flickityOptions.autoPlay = this.autoplay;
|
4199
|
-
}
|
4200
|
-
// Keep the event options separate, we dont want users
|
4201
|
-
// overwriting these
|
4202
|
-
const eventOptions = {
|
4203
|
-
ready: () => {
|
4204
|
-
setTimeout(() => {
|
4205
|
-
this.nanoSlidesReady.emit();
|
4206
|
-
}, 20);
|
4207
|
-
},
|
4208
|
-
select: this.handleSlideSelect,
|
4209
|
-
change: this.nanoSlidesChange.emit,
|
4210
|
-
scroll: this.nanoSlidesScroll.emit,
|
4211
|
-
settle: this.nanoSlidesTransitionEnd.emit,
|
4212
|
-
dragStart: this.nanoSlidesDragStart.emit,
|
4213
|
-
dragMove: this.nanoSlidesDragMove.emit,
|
4214
|
-
dragEnd: this.nanoSlidesDragEnd.emit,
|
4215
|
-
staticClick: this.nanoSlidesTap.emit,
|
4216
|
-
fullscreenChange: this.handleFullscreen,
|
4217
|
-
};
|
4218
|
-
const customEvents = !!this.options && !!this.options.on ? this.options.on : {};
|
4219
|
-
// merge "on" event listeners, while giving our event listeners priority
|
4220
|
-
const mergedEventOptions = { on: Object.assign(Object.assign({}, customEvents), eventOptions) };
|
4221
|
-
// Merge the base, user options, and events together then pass to flickity
|
4222
|
-
// @ts-ignore
|
4223
|
-
return Object.assign(Object.assign(Object.assign({}, flickityOptions), mergedEventOptions), this.options);
|
4224
|
-
}
|
4225
|
-
componentDidLoad() {
|
4226
|
-
if (typeof window !== 'undefined' &&
|
4227
|
-
window.MutationObserver) {
|
4228
|
-
const mut = (this.mutationO = new MutationObserver((e) => {
|
4229
|
-
if (e[0].addedNodes[0] &&
|
4230
|
-
e[0].addedNodes[0].nodeName.toLowerCase() === 'nano-slide' &&
|
4231
|
-
this.flickityReady) {
|
4232
|
-
this.update();
|
4233
|
-
}
|
4234
|
-
}));
|
4235
|
-
mut.observe(this.host, {
|
4236
|
-
childList: true,
|
4237
|
-
subtree: true,
|
4238
|
-
});
|
4239
|
-
}
|
4240
|
-
}
|
4241
|
-
componentWillLoad() {
|
4242
|
-
this.nanoSlidesDidLoad.emit();
|
4243
|
-
if (!this.didInit) {
|
4244
|
-
this.didInit = true;
|
4245
|
-
this.initflickity();
|
4246
|
-
}
|
4247
|
-
}
|
4248
|
-
disconnectedCallback() {
|
4249
|
-
if (this.mutationO) {
|
4250
|
-
this.mutationO.disconnect();
|
4251
|
-
this.mutationO = undefined;
|
4252
|
-
}
|
4253
|
-
if (this.resizeO)
|
4254
|
-
this.resizeO.disconnect();
|
4255
|
-
this.destroyflickity();
|
4256
|
-
}
|
4257
|
-
render() {
|
4258
|
-
return (index.h(index.Host, null, index.h("div", { class: {
|
4259
|
-
slideshow: true,
|
4260
|
-
ready: this.ready,
|
4261
|
-
'not-ready': !this.ready,
|
4262
|
-
}, part: "base" }, index.h("div", { ref: (div) => (this.flickityEl = div), class: {
|
4263
|
-
'flickity-container': true,
|
4264
|
-
'slides-ready': this.slidesReady,
|
4265
|
-
'slides-not-ready': !this.slidesReady,
|
4266
|
-
}, part: "slide-container" }, index.h("slot", null)), index.h("div", { class: "ui-extras" }, index.h("slot", { name: "ui" })))));
|
4267
|
-
}
|
4268
|
-
get host() { return index.getElement(this); }
|
4269
|
-
static get watchers() { return {
|
4270
|
-
"options": ["optionsChanged"],
|
4271
|
-
"navbtns": ["navbtnsChanged"],
|
4272
|
-
"pager": ["pagerChanged"],
|
4273
|
-
"fullscreenbtn": ["fullscreenBtnChanged"],
|
4274
|
-
"fullscreen": ["fullscreenChanged"],
|
4275
|
-
"animation": ["animationChange"],
|
4276
|
-
"currentSlide": ["currentSlideChange"],
|
4277
|
-
"iCurrentSlide": ["internalSlideChange"],
|
4278
|
-
"autoplay": ["autoPlayChange"]
|
4279
|
-
}; }
|
4280
|
-
};
|
4281
|
-
const waitForSlides = (host) => {
|
4282
|
-
const allSlides = Array.from(host.querySelectorAll('nano-slide'));
|
4283
|
-
let toLoadSlides = allSlides.filter((ele) => !ele.ready);
|
4284
|
-
if (!toLoadSlides.length)
|
4285
|
-
return Promise.resolve(allSlides);
|
4286
|
-
return new Promise((resolve) => {
|
4287
|
-
const slideResolver = (ev) => {
|
4288
|
-
toLoadSlides = toLoadSlides.filter((ele) => ele !== ev.target);
|
4289
|
-
if (!toLoadSlides.length) {
|
4290
|
-
resolve(allSlides);
|
4291
|
-
host.removeEventListener('nanoSlideReady', slideResolver);
|
4292
|
-
host.removeEventListener('nano-slide-ready', slideResolver);
|
4293
|
-
}
|
4294
|
-
};
|
4295
|
-
host.addEventListener('nanoSlideReady', slideResolver);
|
4296
|
-
// fallback for vue who can't handle camelcase event names
|
4297
|
-
host.addEventListener('nano-slide-ready', slideResolver);
|
4298
|
-
});
|
4299
|
-
};
|
4300
|
-
Slides.style = slidesCss;
|
4301
12
|
|
4302
|
-
exports.nano_slides = Slides;
|
13
|
+
exports.nano_slides = nanoSlides_entry.Slides;
|
4303
14
|
|
4304
15
|
//# sourceMappingURL=nano-slides.cjs.entry.js.map
|