@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
@@ -0,0 +1,2970 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import { r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-9695db0a.js';
|
5
|
+
|
6
|
+
function EvEmitter() { }
|
7
|
+
const proto$7 = EvEmitter.prototype;
|
8
|
+
proto$7.on = function (eventName, listener) {
|
9
|
+
if (!eventName || !listener) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
// set events hash
|
13
|
+
const events = (this._events = this._events || {});
|
14
|
+
// set listeners array
|
15
|
+
const listeners = (events[eventName] = events[eventName] || []);
|
16
|
+
// only add once
|
17
|
+
if (listeners.indexOf(listener) == -1) {
|
18
|
+
listeners.push(listener);
|
19
|
+
}
|
20
|
+
return this;
|
21
|
+
};
|
22
|
+
proto$7.once = function (eventName, listener) {
|
23
|
+
if (!eventName || !listener) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
// add event
|
27
|
+
this.on(eventName, listener);
|
28
|
+
// set once flag
|
29
|
+
// set onceEvents hash
|
30
|
+
const onceEvents = (this._onceEvents = this._onceEvents || {});
|
31
|
+
// set onceListeners object
|
32
|
+
const onceListeners = (onceEvents[eventName] = onceEvents[eventName] || {});
|
33
|
+
// set flag
|
34
|
+
onceListeners[listener] = true;
|
35
|
+
return this;
|
36
|
+
};
|
37
|
+
proto$7.off = function (eventName, listener) {
|
38
|
+
const listeners = this._events && this._events[eventName];
|
39
|
+
if (!listeners || !listeners.length) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
const index = listeners.indexOf(listener);
|
43
|
+
if (index != -1) {
|
44
|
+
listeners.splice(index, 1);
|
45
|
+
}
|
46
|
+
return this;
|
47
|
+
};
|
48
|
+
proto$7.emitEvent = function (eventName, args) {
|
49
|
+
let listeners = this._events && this._events[eventName];
|
50
|
+
if (!listeners || !listeners.length) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
// copy over to avoid interference if .off() in listener
|
54
|
+
listeners = listeners.slice(0);
|
55
|
+
args = args || [];
|
56
|
+
// once stuff
|
57
|
+
const onceListeners = this._onceEvents && this._onceEvents[eventName];
|
58
|
+
for (let i = 0; i < listeners.length; i++) {
|
59
|
+
const listener = listeners[i];
|
60
|
+
const isOnce = onceListeners && onceListeners[listener];
|
61
|
+
if (isOnce) {
|
62
|
+
// remove listener
|
63
|
+
// remove before trigger to prevent recursion
|
64
|
+
this.off(eventName, listener);
|
65
|
+
// unset once flag
|
66
|
+
delete onceListeners[listener];
|
67
|
+
}
|
68
|
+
// trigger listener
|
69
|
+
listener.apply(this, args);
|
70
|
+
}
|
71
|
+
return this;
|
72
|
+
};
|
73
|
+
proto$7.allOff = function () {
|
74
|
+
delete this._events;
|
75
|
+
delete this._onceEvents;
|
76
|
+
};
|
77
|
+
|
78
|
+
/*!
|
79
|
+
* getSize v2.0.3
|
80
|
+
* measure size of elements
|
81
|
+
* MIT license
|
82
|
+
*/
|
83
|
+
// get a number from a string, not a percentage
|
84
|
+
function getStyleSize(value) {
|
85
|
+
const num = parseFloat(value);
|
86
|
+
// not a percent like '100%', and a number
|
87
|
+
const isValid = value.indexOf('%') == -1 && !isNaN(num);
|
88
|
+
return isValid && num;
|
89
|
+
}
|
90
|
+
function noop$1() { }
|
91
|
+
const logError = typeof console == 'undefined'
|
92
|
+
? noop$1
|
93
|
+
: function (message) {
|
94
|
+
console.error(message);
|
95
|
+
};
|
96
|
+
// -------------------------- measurements -------------------------- //
|
97
|
+
const measurements = [
|
98
|
+
'paddingLeft',
|
99
|
+
'paddingRight',
|
100
|
+
'paddingTop',
|
101
|
+
'paddingBottom',
|
102
|
+
'marginLeft',
|
103
|
+
'marginRight',
|
104
|
+
'marginTop',
|
105
|
+
'marginBottom',
|
106
|
+
'borderLeftWidth',
|
107
|
+
'borderRightWidth',
|
108
|
+
'borderTopWidth',
|
109
|
+
'borderBottomWidth',
|
110
|
+
];
|
111
|
+
const measurementsLength = measurements.length;
|
112
|
+
function getZeroSize() {
|
113
|
+
const size = {
|
114
|
+
width: 0,
|
115
|
+
height: 0,
|
116
|
+
innerWidth: 0,
|
117
|
+
innerHeight: 0,
|
118
|
+
outerWidth: 0,
|
119
|
+
outerHeight: 0,
|
120
|
+
};
|
121
|
+
for (let i = 0; i < measurementsLength; i++) {
|
122
|
+
const measurement = measurements[i];
|
123
|
+
size[measurement] = 0;
|
124
|
+
}
|
125
|
+
return size;
|
126
|
+
}
|
127
|
+
// -------------------------- getStyle -------------------------- //
|
128
|
+
/**
|
129
|
+
* getStyle, get style of element, check for Firefox bug
|
130
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
131
|
+
* @param elem element to get styles for
|
132
|
+
* @returns {CSSStyleDeclaration} styles of element
|
133
|
+
*/
|
134
|
+
function getStyle(elem) {
|
135
|
+
const style = getComputedStyle(elem);
|
136
|
+
if (!style) {
|
137
|
+
logError('Style returned ' +
|
138
|
+
style +
|
139
|
+
'. Are you running this code in a hidden iframe on Firefox? ' +
|
140
|
+
'See https://bit.ly/getsizebug1');
|
141
|
+
}
|
142
|
+
return style;
|
143
|
+
}
|
144
|
+
// -------------------------- setup -------------------------- //
|
145
|
+
let isSetup = false;
|
146
|
+
let isBoxSizeOuter;
|
147
|
+
/**
|
148
|
+
* setup
|
149
|
+
* check isBoxSizerOuter
|
150
|
+
* do on first getSize() rather than on page load for Firefox bug
|
151
|
+
*/
|
152
|
+
function setup() {
|
153
|
+
// setup once
|
154
|
+
if (isSetup) {
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
isSetup = true;
|
158
|
+
// -------------------------- box sizing -------------------------- //
|
159
|
+
/**
|
160
|
+
* Chrome & Safari measure the outer-width on style.width on border-box elems
|
161
|
+
* IE11 & Firefox<29 measures the inner-width
|
162
|
+
*/
|
163
|
+
const div = document.createElement('div');
|
164
|
+
div.style.width = '200px';
|
165
|
+
div.style.padding = '1px 2px 3px 4px';
|
166
|
+
div.style.borderStyle = 'solid';
|
167
|
+
div.style.borderWidth = '1px 2px 3px 4px';
|
168
|
+
div.style.boxSizing = 'border-box';
|
169
|
+
const body = document.body || document.documentElement;
|
170
|
+
body.appendChild(div);
|
171
|
+
const style = getStyle(div);
|
172
|
+
// round value for browser zoom. desandro/masonry#928
|
173
|
+
isBoxSizeOuter = Math.round(getStyleSize(style.width)) == 200;
|
174
|
+
// @ts-ignore
|
175
|
+
getSize.isBoxSizeOuter = isBoxSizeOuter;
|
176
|
+
body.removeChild(div);
|
177
|
+
}
|
178
|
+
// -------------------------- getSize -------------------------- //
|
179
|
+
function getSize(elem) {
|
180
|
+
setup();
|
181
|
+
// use querySeletor if elem is string
|
182
|
+
if (typeof elem == 'string') {
|
183
|
+
elem = document.querySelector(elem);
|
184
|
+
}
|
185
|
+
// do not proceed on non-objects
|
186
|
+
if (!elem || typeof elem != 'object' || !elem.nodeType) {
|
187
|
+
return;
|
188
|
+
}
|
189
|
+
const style = getStyle(elem);
|
190
|
+
// if hidden, everything is 0
|
191
|
+
if (style.display == 'none') {
|
192
|
+
return getZeroSize();
|
193
|
+
}
|
194
|
+
const size = {};
|
195
|
+
size.width = elem.offsetWidth;
|
196
|
+
size.height = elem.offsetHeight;
|
197
|
+
const isBorderBox = (size.isBorderBox = style.boxSizing == 'border-box');
|
198
|
+
// get all measurements
|
199
|
+
for (let i = 0; i < measurementsLength; i++) {
|
200
|
+
const measurement = measurements[i];
|
201
|
+
const value = style[measurement];
|
202
|
+
const num = parseFloat(value);
|
203
|
+
// any 'auto', 'medium' value will be 0
|
204
|
+
size[measurement] = !isNaN(num) ? num : 0;
|
205
|
+
}
|
206
|
+
const paddingWidth = size.paddingLeft + size.paddingRight;
|
207
|
+
const paddingHeight = size.paddingTop + size.paddingBottom;
|
208
|
+
const marginWidth = size.marginLeft + size.marginRight;
|
209
|
+
const marginHeight = size.marginTop + size.marginBottom;
|
210
|
+
const borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
211
|
+
const borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
212
|
+
const isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
|
213
|
+
// overwrite width and height if we can get it from style
|
214
|
+
const styleWidth = getStyleSize(style.width);
|
215
|
+
if (styleWidth !== false) {
|
216
|
+
size.width =
|
217
|
+
styleWidth +
|
218
|
+
// add padding and border unless it's already including it
|
219
|
+
(isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth);
|
220
|
+
}
|
221
|
+
const styleHeight = getStyleSize(style.height);
|
222
|
+
if (styleHeight !== false) {
|
223
|
+
size.height =
|
224
|
+
styleHeight +
|
225
|
+
// add padding and border unless it's already including it
|
226
|
+
(isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight);
|
227
|
+
}
|
228
|
+
size.innerWidth = size.width - (paddingWidth + borderWidth);
|
229
|
+
size.innerHeight = size.height - (paddingHeight + borderHeight);
|
230
|
+
size.outerWidth = size.width + marginWidth;
|
231
|
+
size.outerHeight = size.height + marginHeight;
|
232
|
+
return size;
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Fizzy UI utils v2.0.7
|
237
|
+
* MIT license
|
238
|
+
*/
|
239
|
+
/*jshint browser: true, undef: true, unused: true, strict: true */
|
240
|
+
const utils = {};
|
241
|
+
// ----- extend ----- //
|
242
|
+
// extends objects
|
243
|
+
utils.extend = function (a, b) {
|
244
|
+
for (const prop in b) {
|
245
|
+
a[prop] = b[prop];
|
246
|
+
}
|
247
|
+
return a;
|
248
|
+
};
|
249
|
+
// ----- docReady ----- //
|
250
|
+
utils.docReady = function (callback) {
|
251
|
+
const readyState = document.readyState;
|
252
|
+
if (readyState == 'complete' || readyState == 'interactive') {
|
253
|
+
// do async to allow for other scripts to run. metafizzy/flickity#441
|
254
|
+
setTimeout(callback);
|
255
|
+
}
|
256
|
+
else {
|
257
|
+
document.addEventListener('DOMContentLoaded', callback);
|
258
|
+
}
|
259
|
+
};
|
260
|
+
// ----- toDashed ----- //
|
261
|
+
utils.toDashed = function (str) {
|
262
|
+
return str
|
263
|
+
.replace(/(.)([A-Z])/g, function (_match, $1, $2) {
|
264
|
+
return $1 + '-' + $2;
|
265
|
+
})
|
266
|
+
.toLowerCase();
|
267
|
+
};
|
268
|
+
// ----- modulo ----- //
|
269
|
+
utils.modulo = function (num, div) {
|
270
|
+
return ((num % div) + div) % div;
|
271
|
+
};
|
272
|
+
// ----- makeArray ----- //
|
273
|
+
const arraySlice = Array.prototype.slice;
|
274
|
+
// turn element or nodeList into an array
|
275
|
+
utils.makeArray = function (obj) {
|
276
|
+
if (Array.isArray(obj)) {
|
277
|
+
// use object if already an array
|
278
|
+
return obj;
|
279
|
+
}
|
280
|
+
// return empty array if undefined or null. #6
|
281
|
+
if (obj === null || obj === undefined) {
|
282
|
+
return [];
|
283
|
+
}
|
284
|
+
const isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
|
285
|
+
if (isArrayLike) {
|
286
|
+
// convert nodeList to array
|
287
|
+
return arraySlice.call(obj);
|
288
|
+
}
|
289
|
+
// array of single index
|
290
|
+
return [obj];
|
291
|
+
};
|
292
|
+
// ----- getParent ----- //
|
293
|
+
utils.getParent = function (elem, selector) {
|
294
|
+
while (elem.parentNode && elem != document.body) {
|
295
|
+
elem = elem.parentElement;
|
296
|
+
if (elem.matches(selector)) {
|
297
|
+
return elem;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
};
|
301
|
+
// ----- getQueryElement ----- //
|
302
|
+
// use element as selector string
|
303
|
+
utils.getQueryElement = function (elem) {
|
304
|
+
if (typeof elem == 'string') {
|
305
|
+
return document.querySelector(elem);
|
306
|
+
}
|
307
|
+
return elem;
|
308
|
+
};
|
309
|
+
// ----- handleEvent ----- //
|
310
|
+
// enable .ontype to trigger from .addEventListener( elem, 'type' )
|
311
|
+
utils.handleEvent = function (event) {
|
312
|
+
const method = 'on' + event.type;
|
313
|
+
if (this[method]) {
|
314
|
+
this[method](event);
|
315
|
+
}
|
316
|
+
};
|
317
|
+
// ----- filterFindElements ----- //
|
318
|
+
utils.filterFindElements = function (elems, selector) {
|
319
|
+
// make array of elems
|
320
|
+
elems = utils.makeArray(elems);
|
321
|
+
const ffElems = [];
|
322
|
+
elems.forEach(function (elem) {
|
323
|
+
// check that elem is an actual element
|
324
|
+
if (!(elem instanceof HTMLElement)) {
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
// add elem if no selector
|
328
|
+
if (!selector) {
|
329
|
+
ffElems.push(elem);
|
330
|
+
return;
|
331
|
+
}
|
332
|
+
// filter & find items if we have a selector
|
333
|
+
// filter
|
334
|
+
if (elem.matches(selector)) {
|
335
|
+
ffElems.push(elem);
|
336
|
+
}
|
337
|
+
// find children
|
338
|
+
const childElems = elem.querySelectorAll(selector);
|
339
|
+
// concat childElems to filterFound array
|
340
|
+
for (let i = 0; i < childElems.length; i++) {
|
341
|
+
ffElems.push(childElems[i]);
|
342
|
+
}
|
343
|
+
});
|
344
|
+
return ffElems;
|
345
|
+
};
|
346
|
+
// ----- debounceMethod ----- //
|
347
|
+
utils.debounceMethod = function (_class, methodName, threshold) {
|
348
|
+
threshold = threshold || 100;
|
349
|
+
// original method
|
350
|
+
const method = _class.prototype[methodName];
|
351
|
+
const timeoutName = methodName + 'Timeout';
|
352
|
+
_class.prototype[methodName] = function (...args) {
|
353
|
+
const timeout = this[timeoutName];
|
354
|
+
clearTimeout(timeout);
|
355
|
+
const _this = this;
|
356
|
+
this[timeoutName] = setTimeout(function () {
|
357
|
+
method.apply(_this, args);
|
358
|
+
delete _this[timeoutName];
|
359
|
+
}, threshold);
|
360
|
+
};
|
361
|
+
};
|
362
|
+
const console$2 = window.console;
|
363
|
+
/**
|
364
|
+
* allow user to initialize classes via [data-namespace] or .js-namespace class
|
365
|
+
* htmlInit( Widget, 'widgetName' )
|
366
|
+
* options are parsed from data-namespace-options
|
367
|
+
*/
|
368
|
+
utils.htmlInit = function (WidgetClass, namespace) {
|
369
|
+
utils.docReady(function () {
|
370
|
+
const dashedNamespace = utils.toDashed(namespace);
|
371
|
+
const dataAttr = 'data-' + dashedNamespace;
|
372
|
+
const dataAttrElems = document.querySelectorAll('[' + dataAttr + ']');
|
373
|
+
const jsDashElems = document.querySelectorAll('.js-' + dashedNamespace);
|
374
|
+
const elems = utils
|
375
|
+
.makeArray(dataAttrElems)
|
376
|
+
.concat(utils.makeArray(jsDashElems));
|
377
|
+
const dataOptionsAttr = dataAttr + '-options';
|
378
|
+
elems.forEach(function (elem) {
|
379
|
+
const attr = elem.getAttribute(dataAttr) || elem.getAttribute(dataOptionsAttr);
|
380
|
+
let options;
|
381
|
+
try {
|
382
|
+
options = attr && JSON.parse(attr);
|
383
|
+
}
|
384
|
+
catch (error) {
|
385
|
+
// log error, do not initialize
|
386
|
+
if (console$2) {
|
387
|
+
console$2.error('Error parsing ' + dataAttr + ' on ' + elem.className + ': ' + error);
|
388
|
+
}
|
389
|
+
return;
|
390
|
+
}
|
391
|
+
// initialize
|
392
|
+
// @ts-ignore
|
393
|
+
new WidgetClass(elem, options);
|
394
|
+
});
|
395
|
+
});
|
396
|
+
};
|
397
|
+
|
398
|
+
function Cell(elem, parent) {
|
399
|
+
this.element = elem;
|
400
|
+
this.parent = parent;
|
401
|
+
this.create();
|
402
|
+
}
|
403
|
+
const proto$6 = Cell.prototype;
|
404
|
+
proto$6.create = function () {
|
405
|
+
this.element.style.position = 'absolute';
|
406
|
+
this.element.setAttribute('aria-hidden', 'true');
|
407
|
+
this.x = 0;
|
408
|
+
this.shift = 0;
|
409
|
+
Array.from(this.element.querySelectorAll('*')).forEach((element) => {
|
410
|
+
element.setAttribute('tabindex', '-1');
|
411
|
+
});
|
412
|
+
};
|
413
|
+
proto$6.destroy = function () {
|
414
|
+
// reset style
|
415
|
+
this.unselect();
|
416
|
+
this.element.style.position = '';
|
417
|
+
const side = this.parent.originSide;
|
418
|
+
this.element.style[side] = '';
|
419
|
+
};
|
420
|
+
proto$6.getSize = function () {
|
421
|
+
this.size = getSize(this.element);
|
422
|
+
};
|
423
|
+
proto$6.setPosition = function (x) {
|
424
|
+
this.x = x;
|
425
|
+
this.updateTarget();
|
426
|
+
this.renderPosition(x);
|
427
|
+
};
|
428
|
+
// setDefaultTarget v1 method, backwards compatibility, remove in v3
|
429
|
+
proto$6.updateTarget = proto$6.setDefaultTarget = function () {
|
430
|
+
const marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight';
|
431
|
+
this.target =
|
432
|
+
this.x +
|
433
|
+
this.size[marginProperty] +
|
434
|
+
this.size.width * this.parent.cellAlign;
|
435
|
+
};
|
436
|
+
proto$6.renderPosition = function (x) {
|
437
|
+
// render position of cell with in slider
|
438
|
+
const side = this.parent.originSide;
|
439
|
+
this.element.style[side] = this.parent.getPositionValue(x);
|
440
|
+
};
|
441
|
+
proto$6.select = function () {
|
442
|
+
this.element.classList.add('is-selected');
|
443
|
+
this.element.removeAttribute('aria-hidden');
|
444
|
+
Array.from(this.element.querySelectorAll('*')).forEach((element) => {
|
445
|
+
element.removeAttribute('tabindex');
|
446
|
+
});
|
447
|
+
};
|
448
|
+
proto$6.unselect = function () {
|
449
|
+
this.element.classList.remove('is-selected');
|
450
|
+
this.element.setAttribute('aria-hidden', 'true');
|
451
|
+
Array.from(this.element.querySelectorAll('*')).forEach((element) => {
|
452
|
+
element.setAttribute('tabindex', '-1');
|
453
|
+
});
|
454
|
+
};
|
455
|
+
/**
|
456
|
+
* @param {Integer} shift - 0, 1, or -1
|
457
|
+
**/
|
458
|
+
proto$6.wrapShift = function (shift) {
|
459
|
+
this.shift = shift;
|
460
|
+
this.renderPosition(this.x + this.parent.slideableWidth * shift);
|
461
|
+
};
|
462
|
+
proto$6.remove = function () {
|
463
|
+
this.element.parentNode.removeChild(this.element);
|
464
|
+
};
|
465
|
+
|
466
|
+
function Slide(parent) {
|
467
|
+
this.parent = parent;
|
468
|
+
this.isOriginLeft = parent.originSide == 'left';
|
469
|
+
this.cells = [];
|
470
|
+
this.outerWidth = 0;
|
471
|
+
this.height = 0;
|
472
|
+
}
|
473
|
+
const proto$5 = Slide.prototype;
|
474
|
+
proto$5.addCell = function (cell) {
|
475
|
+
this.cells.push(cell);
|
476
|
+
this.outerWidth += cell.size.outerWidth;
|
477
|
+
this.height = Math.max(cell.size.outerHeight, this.height);
|
478
|
+
// first cell stuff
|
479
|
+
if (this.cells.length == 1) {
|
480
|
+
this.x = cell.x; // x comes from first cell
|
481
|
+
const beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight';
|
482
|
+
this.firstMargin = cell.size[beginMargin];
|
483
|
+
}
|
484
|
+
};
|
485
|
+
proto$5.updateTarget = function () {
|
486
|
+
const endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft';
|
487
|
+
const lastCell = this.getLastCell();
|
488
|
+
const lastMargin = lastCell ? lastCell.size[endMargin] : 0;
|
489
|
+
const slideWidth = this.outerWidth - (this.firstMargin + lastMargin);
|
490
|
+
this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign;
|
491
|
+
};
|
492
|
+
proto$5.getLastCell = function () {
|
493
|
+
return this.cells[this.cells.length - 1];
|
494
|
+
};
|
495
|
+
proto$5.select = function () {
|
496
|
+
this.cells.forEach(function (cell) {
|
497
|
+
cell.select();
|
498
|
+
});
|
499
|
+
};
|
500
|
+
proto$5.unselect = function () {
|
501
|
+
this.cells.forEach(function (cell) {
|
502
|
+
cell.unselect();
|
503
|
+
});
|
504
|
+
};
|
505
|
+
proto$5.getCellElements = function () {
|
506
|
+
return this.cells.map(function (cell) {
|
507
|
+
return cell.element;
|
508
|
+
});
|
509
|
+
};
|
510
|
+
|
511
|
+
const proto$4 = {};
|
512
|
+
proto$4.startAnimation = function () {
|
513
|
+
if (this.isAnimating) {
|
514
|
+
return;
|
515
|
+
}
|
516
|
+
this.isAnimating = true;
|
517
|
+
this.restingFrames = 0;
|
518
|
+
this.animate();
|
519
|
+
};
|
520
|
+
proto$4.animate = function () {
|
521
|
+
this.applyDragForce();
|
522
|
+
this.applySelectedAttraction();
|
523
|
+
const previousX = this.x;
|
524
|
+
this.integratePhysics();
|
525
|
+
this.positionSlider();
|
526
|
+
this.settle(previousX);
|
527
|
+
// animate next frame
|
528
|
+
if (this.isAnimating) {
|
529
|
+
const _this = this;
|
530
|
+
requestAnimationFrame(function animateFrame() {
|
531
|
+
_this.animate();
|
532
|
+
});
|
533
|
+
}
|
534
|
+
};
|
535
|
+
proto$4.positionSlider = function () {
|
536
|
+
let x = this.x;
|
537
|
+
// wrap position around
|
538
|
+
if (this.options.wrapAround && this.cells.length > 1) {
|
539
|
+
x = utils.modulo(x, this.slideableWidth);
|
540
|
+
x = x - this.slideableWidth;
|
541
|
+
this.shiftWrapCells(x);
|
542
|
+
}
|
543
|
+
this.setTranslateX(x, this.isAnimating);
|
544
|
+
this.dispatchScrollEvent();
|
545
|
+
};
|
546
|
+
proto$4.setTranslateX = function (x, _is3d) {
|
547
|
+
x += this.cursorPosition;
|
548
|
+
// reverse if right-to-left and using transform
|
549
|
+
x = this.options.rightToLeft ? -x : x;
|
550
|
+
const translateX = this.getPositionValue(x);
|
551
|
+
// use 3D tranforms for hardware acceleration on iOS
|
552
|
+
// but use 2D when settled, for better font-rendering
|
553
|
+
// this.slider.style.transform = is3d
|
554
|
+
// ? 'translate3d(' + translateX + ',0,0)'
|
555
|
+
// : 'translateX(' + translateX + ')';
|
556
|
+
this.slider.style.transform = 'translate3d(' + translateX + ',0,0)';
|
557
|
+
};
|
558
|
+
proto$4.dispatchScrollEvent = function () {
|
559
|
+
const firstSlide = this.slides[0];
|
560
|
+
if (!firstSlide) {
|
561
|
+
return;
|
562
|
+
}
|
563
|
+
const positionX = -this.x - firstSlide.target;
|
564
|
+
const progress = positionX / this.slidesWidth;
|
565
|
+
this.dispatchEvent('scroll', null, [progress, positionX]);
|
566
|
+
};
|
567
|
+
proto$4.positionSliderAtSelected = function () {
|
568
|
+
if (!this.cells.length) {
|
569
|
+
return;
|
570
|
+
}
|
571
|
+
this.x = -this.selectedSlide.target;
|
572
|
+
this.velocity = 0; // stop wobble
|
573
|
+
this.positionSlider();
|
574
|
+
};
|
575
|
+
proto$4.getPositionValue = function (position) {
|
576
|
+
if (this.options.percentPosition) {
|
577
|
+
// percent position, round to 2 digits, like 12.34%
|
578
|
+
return Math.round((position / this.size.innerWidth) * 10000) * 0.01 + '%';
|
579
|
+
}
|
580
|
+
else {
|
581
|
+
// pixel positioning
|
582
|
+
return Math.round(position) + 'px';
|
583
|
+
}
|
584
|
+
};
|
585
|
+
proto$4.settle = function (previousX) {
|
586
|
+
// keep track of frames where x hasn't moved
|
587
|
+
if (!this.isPointerDown &&
|
588
|
+
Math.round(this.x * 100) == Math.round(previousX * 100)) {
|
589
|
+
this.restingFrames++;
|
590
|
+
}
|
591
|
+
// stop animating if resting for 3 or more frames
|
592
|
+
if (this.restingFrames > 2) {
|
593
|
+
this.isAnimating = false;
|
594
|
+
delete this.isFreeScrolling;
|
595
|
+
// render position with translateX when settled
|
596
|
+
this.positionSlider();
|
597
|
+
this.dispatchEvent('settle', null, [this.selectedIndex]);
|
598
|
+
}
|
599
|
+
};
|
600
|
+
proto$4.shiftWrapCells = function (x) {
|
601
|
+
// shift before cells
|
602
|
+
const beforeGap = this.cursorPosition + x;
|
603
|
+
this._shiftCells(this.beforeShiftCells, beforeGap, -1);
|
604
|
+
// shift after cells
|
605
|
+
const afterGap = this.size.innerWidth - (x + this.slideableWidth + this.cursorPosition);
|
606
|
+
this._shiftCells(this.afterShiftCells, afterGap, 1);
|
607
|
+
};
|
608
|
+
proto$4._shiftCells = function (cells, gap, shift) {
|
609
|
+
for (let i = 0; i < cells.length; i++) {
|
610
|
+
const cell = cells[i];
|
611
|
+
const cellShift = gap > 0 ? shift : 0;
|
612
|
+
cell.wrapShift(cellShift);
|
613
|
+
gap -= cell.size.outerWidth;
|
614
|
+
}
|
615
|
+
};
|
616
|
+
proto$4._unshiftCells = function (cells) {
|
617
|
+
if (!cells || !cells.length) {
|
618
|
+
return;
|
619
|
+
}
|
620
|
+
for (let i = 0; i < cells.length; i++) {
|
621
|
+
cells[i].wrapShift(0);
|
622
|
+
}
|
623
|
+
};
|
624
|
+
// -------------------------- physics -------------------------- //
|
625
|
+
proto$4.integratePhysics = function () {
|
626
|
+
this.x += this.velocity;
|
627
|
+
this.velocity *= this.getFrictionFactor();
|
628
|
+
};
|
629
|
+
proto$4.applyForce = function (force) {
|
630
|
+
this.velocity += force;
|
631
|
+
};
|
632
|
+
proto$4.getFrictionFactor = function () {
|
633
|
+
return (1 - this.options[this.isFreeScrolling ? 'freeScrollFriction' : 'friction']);
|
634
|
+
};
|
635
|
+
proto$4.getRestingPosition = function () {
|
636
|
+
// my thanks to Steven Wittens, who simplified this math greatly
|
637
|
+
return this.x + this.velocity / (1 - this.getFrictionFactor());
|
638
|
+
};
|
639
|
+
proto$4.applyDragForce = function () {
|
640
|
+
if (!this.isDraggable || !this.isPointerDown) {
|
641
|
+
return;
|
642
|
+
}
|
643
|
+
// change the position to drag position by applying force
|
644
|
+
const dragVelocity = this.dragX - this.x;
|
645
|
+
const dragForce = dragVelocity - this.velocity;
|
646
|
+
this.applyForce(dragForce);
|
647
|
+
};
|
648
|
+
proto$4.applySelectedAttraction = function () {
|
649
|
+
// do not attract if pointer down or no slides
|
650
|
+
const dragDown = this.isDraggable && this.isPointerDown;
|
651
|
+
if (dragDown || this.isFreeScrolling || !this.slides.length) {
|
652
|
+
return;
|
653
|
+
}
|
654
|
+
const distance = this.selectedSlide.target * -1 - this.x;
|
655
|
+
const force = distance * this.options.selectedAttraction;
|
656
|
+
this.applyForce(force);
|
657
|
+
};
|
658
|
+
|
659
|
+
// vars
|
660
|
+
const getComputedStyle$1 = window.getComputedStyle;
|
661
|
+
const console$1 = window.console;
|
662
|
+
function moveElements(elems, toElem) {
|
663
|
+
elems = utils.makeArray(elems);
|
664
|
+
while (elems.length) {
|
665
|
+
toElem.appendChild(elems.shift());
|
666
|
+
}
|
667
|
+
}
|
668
|
+
// -------------------------- Flickity -------------------------- //
|
669
|
+
// globally unique identifiers
|
670
|
+
let GUID = 0;
|
671
|
+
// internal store of all Flickity intances
|
672
|
+
const instances = {};
|
673
|
+
function Flickity(element, options) {
|
674
|
+
const queryElement = utils.getQueryElement(element);
|
675
|
+
if (!queryElement) {
|
676
|
+
if (console$1) {
|
677
|
+
console$1.error('Bad element for Flickity: ' + (queryElement || element));
|
678
|
+
}
|
679
|
+
return;
|
680
|
+
}
|
681
|
+
this.element = queryElement;
|
682
|
+
// do not initialize twice on same element
|
683
|
+
if (this.element.flickityGUID) {
|
684
|
+
const instance = instances[this.element.flickityGUID];
|
685
|
+
if (!instances[this.element.flickityGUID])
|
686
|
+
return;
|
687
|
+
instance.option(options);
|
688
|
+
return instance;
|
689
|
+
}
|
690
|
+
// options
|
691
|
+
this.options = utils.extend({}, this.constructor.defaults);
|
692
|
+
this.option(options);
|
693
|
+
// kick things off
|
694
|
+
this._create();
|
695
|
+
}
|
696
|
+
Flickity.defaults = {
|
697
|
+
accessibility: true,
|
698
|
+
// adaptiveHeight: false,
|
699
|
+
cellAlign: 'center',
|
700
|
+
// cellSelector: undefined,
|
701
|
+
// contain: false,
|
702
|
+
freeScrollFriction: 0.075,
|
703
|
+
friction: 0.28,
|
704
|
+
namespaceJQueryEvents: true,
|
705
|
+
// initialIndex: 0,
|
706
|
+
percentPosition: true,
|
707
|
+
resize: true,
|
708
|
+
selectedAttraction: 0.025,
|
709
|
+
setGallerySize: true,
|
710
|
+
// watchCSS: false,
|
711
|
+
// wrapAround: false
|
712
|
+
};
|
713
|
+
// hash of methods triggered on _create()
|
714
|
+
Flickity.createMethods = [];
|
715
|
+
const proto$3 = Flickity.prototype;
|
716
|
+
// inherit EventEmitter
|
717
|
+
utils.extend(proto$3, EvEmitter.prototype);
|
718
|
+
proto$3._create = function () {
|
719
|
+
// add id for Flickity.data
|
720
|
+
const id = (this.guid = ++GUID);
|
721
|
+
this.element.flickityGUID = id; // expando
|
722
|
+
instances[id] = this; // associate via id
|
723
|
+
// initial properties
|
724
|
+
this.selectedIndex = 0;
|
725
|
+
// how many frames slider has been in same position
|
726
|
+
this.restingFrames = 0;
|
727
|
+
// initial physics properties
|
728
|
+
this.x = 0;
|
729
|
+
this.velocity = 0;
|
730
|
+
this.originSide = this.options.rightToLeft ? 'right' : 'left';
|
731
|
+
// create viewport & slider
|
732
|
+
this.viewport = document.createElement('div');
|
733
|
+
this.viewport.className = 'flickity-viewport';
|
734
|
+
this.viewport.part.add('slide-viewport');
|
735
|
+
this._createSlider();
|
736
|
+
if (this.options.resize || this.options.watchCSS) {
|
737
|
+
window.addEventListener('resize', this);
|
738
|
+
}
|
739
|
+
// add listeners from on option
|
740
|
+
for (const eventName in this.options.on) {
|
741
|
+
const listener = this.options.on[eventName];
|
742
|
+
this.on(eventName, listener);
|
743
|
+
}
|
744
|
+
Flickity.createMethods.forEach(function (method) {
|
745
|
+
this[method]();
|
746
|
+
}, this);
|
747
|
+
if (this.options.watchCSS) {
|
748
|
+
this.watchCSS();
|
749
|
+
}
|
750
|
+
else {
|
751
|
+
this.activate();
|
752
|
+
}
|
753
|
+
};
|
754
|
+
/**
|
755
|
+
* set options
|
756
|
+
* @param {Object} opts
|
757
|
+
*/
|
758
|
+
proto$3.option = function (opts) {
|
759
|
+
utils.extend(this.options, opts);
|
760
|
+
};
|
761
|
+
proto$3.activate = function () {
|
762
|
+
if (this.isActive) {
|
763
|
+
return;
|
764
|
+
}
|
765
|
+
this.isActive = true;
|
766
|
+
this.element.classList.add('flickity-enabled');
|
767
|
+
if (this.options.rightToLeft) {
|
768
|
+
this.element.classList.add('flickity-rtl');
|
769
|
+
}
|
770
|
+
this.getSize();
|
771
|
+
// move initial cell elements so they can be loaded as cells
|
772
|
+
const cellElems = this.element.children; //this._filterFindCellElements( this.element.children );
|
773
|
+
moveElements(cellElems, this.slider);
|
774
|
+
this.viewport.appendChild(this.slider);
|
775
|
+
this.element.appendChild(this.viewport);
|
776
|
+
// get cells from children
|
777
|
+
this.reloadCells();
|
778
|
+
if (this.options.accessibility) {
|
779
|
+
// allow element to focusable
|
780
|
+
this.element.tabIndex = 0;
|
781
|
+
// listen for key presses
|
782
|
+
this.element.addEventListener('keydown', this);
|
783
|
+
}
|
784
|
+
this.emitEvent('activate');
|
785
|
+
this.selectInitialIndex();
|
786
|
+
// flag for initial activation, for using initialIndex
|
787
|
+
this.isInitActivated = true;
|
788
|
+
// ready event. #493
|
789
|
+
this.dispatchEvent('ready');
|
790
|
+
};
|
791
|
+
// slider positions the cells
|
792
|
+
proto$3._createSlider = function () {
|
793
|
+
// slider element does all the positioning
|
794
|
+
const slider = document.createElement('div');
|
795
|
+
slider.className = 'flickity-slider';
|
796
|
+
slider.style[this.originSide] = 0;
|
797
|
+
this.slider = slider;
|
798
|
+
};
|
799
|
+
proto$3._filterFindCellElements = function (elems) {
|
800
|
+
return utils.filterFindElements(elems, this.options.cellSelector);
|
801
|
+
};
|
802
|
+
// goes through all children
|
803
|
+
proto$3.reloadCells = function () {
|
804
|
+
// collection of item elements
|
805
|
+
this.cells = this._makeCells(this.slider.getRootNode().host
|
806
|
+
? this.slider.getRootNode().host.children
|
807
|
+
: this.slider.children);
|
808
|
+
this.positionCells();
|
809
|
+
this._getWrapShiftCells();
|
810
|
+
this.setGallerySize();
|
811
|
+
};
|
812
|
+
/**
|
813
|
+
* turn elements into Flickity.Cells
|
814
|
+
* @param {Array or NodeList or HTMLElement} elems
|
815
|
+
* @returns {Array} items - collection of new Flickity Cells
|
816
|
+
*/
|
817
|
+
proto$3._makeCells = function (elems) {
|
818
|
+
const cellElems = this._filterFindCellElements(elems);
|
819
|
+
// create new Flickity for collection
|
820
|
+
const cells = cellElems.map(function (cellElem) {
|
821
|
+
return new Cell(cellElem, this);
|
822
|
+
}, this);
|
823
|
+
return cells;
|
824
|
+
};
|
825
|
+
proto$3.getLastCell = function () {
|
826
|
+
return this.cells[this.cells.length - 1];
|
827
|
+
};
|
828
|
+
proto$3.getLastSlide = function () {
|
829
|
+
return this.slides[this.slides.length - 1];
|
830
|
+
};
|
831
|
+
// positions all cells
|
832
|
+
proto$3.positionCells = function () {
|
833
|
+
// size all cells
|
834
|
+
this._sizeCells(this.cells);
|
835
|
+
// position all cells
|
836
|
+
this._positionCells(0);
|
837
|
+
};
|
838
|
+
/**
|
839
|
+
* position certain cells
|
840
|
+
* @param {Integer} index - which cell to start with
|
841
|
+
*/
|
842
|
+
proto$3._positionCells = function (index) {
|
843
|
+
index = index || 0;
|
844
|
+
// also measure maxCellHeight
|
845
|
+
// start 0 if positioning all cells
|
846
|
+
this.maxCellHeight = index ? this.maxCellHeight || 0 : 0;
|
847
|
+
let cellX = 0;
|
848
|
+
// get cellX
|
849
|
+
if (index > 0) {
|
850
|
+
const startCell = this.cells[index - 1];
|
851
|
+
cellX = startCell.x + startCell.size.outerWidth;
|
852
|
+
}
|
853
|
+
const len = this.cells.length;
|
854
|
+
for (let i = index; i < len; i++) {
|
855
|
+
const cell = this.cells[i];
|
856
|
+
cell.setPosition(cellX);
|
857
|
+
cellX += cell.size.outerWidth;
|
858
|
+
this.maxCellHeight = Math.max(cell.size.outerHeight, this.maxCellHeight);
|
859
|
+
}
|
860
|
+
// keep track of cellX for wrap-around
|
861
|
+
this.slideableWidth = cellX;
|
862
|
+
// slides
|
863
|
+
this.updateSlides();
|
864
|
+
// contain slides target
|
865
|
+
this._containSlides();
|
866
|
+
// update slidesWidth
|
867
|
+
this.slidesWidth = len
|
868
|
+
? this.getLastSlide().target - this.slides[0].target
|
869
|
+
: 0;
|
870
|
+
};
|
871
|
+
/**
|
872
|
+
* cell.getSize() on multiple cells
|
873
|
+
* @param {Array} cells
|
874
|
+
*/
|
875
|
+
proto$3._sizeCells = function (cells) {
|
876
|
+
cells.forEach(function (cell) {
|
877
|
+
cell.getSize();
|
878
|
+
});
|
879
|
+
};
|
880
|
+
// -------------------------- -------------------------- //
|
881
|
+
proto$3.updateSlides = function () {
|
882
|
+
this.slides = [];
|
883
|
+
if (!this.cells.length) {
|
884
|
+
return;
|
885
|
+
}
|
886
|
+
let slide = new Slide(this);
|
887
|
+
this.slides.push(slide);
|
888
|
+
const isOriginLeft = this.originSide == 'left';
|
889
|
+
const nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft';
|
890
|
+
const canCellFit = this._getCanCellFit();
|
891
|
+
this.cells.forEach(function (cell, i) {
|
892
|
+
// just add cell if first cell in slide
|
893
|
+
if (!slide.cells.length) {
|
894
|
+
slide.addCell(cell);
|
895
|
+
return;
|
896
|
+
}
|
897
|
+
const slideWidth = slide.outerWidth -
|
898
|
+
slide.firstMargin +
|
899
|
+
(cell.size.outerWidth - cell.size[nextMargin]);
|
900
|
+
if (canCellFit.call(this, i, slideWidth)) {
|
901
|
+
slide.addCell(cell);
|
902
|
+
}
|
903
|
+
else {
|
904
|
+
// doesn't fit, new slide
|
905
|
+
slide.updateTarget();
|
906
|
+
slide = new Slide(this);
|
907
|
+
this.slides.push(slide);
|
908
|
+
slide.addCell(cell);
|
909
|
+
}
|
910
|
+
}, this);
|
911
|
+
// last slide
|
912
|
+
slide.updateTarget();
|
913
|
+
// update .selectedSlide
|
914
|
+
this.updateSelectedSlide();
|
915
|
+
};
|
916
|
+
proto$3._getCanCellFit = function () {
|
917
|
+
const groupCells = this.options.groupCells;
|
918
|
+
if (!groupCells) {
|
919
|
+
return function () {
|
920
|
+
return false;
|
921
|
+
};
|
922
|
+
}
|
923
|
+
else if (typeof groupCells == 'number') {
|
924
|
+
// group by number. 3 -> [0,1,2], [3,4,5], ...
|
925
|
+
// @ts-ignore
|
926
|
+
const number = parseInt(groupCells, 10);
|
927
|
+
return function (i) {
|
928
|
+
return i % number !== 0;
|
929
|
+
};
|
930
|
+
}
|
931
|
+
// default, group by width of slide
|
932
|
+
// parse '75%
|
933
|
+
const percentMatch = typeof groupCells == 'string' && groupCells.match(/^(\d+)%$/);
|
934
|
+
const percent = percentMatch ? parseInt(percentMatch[1], 10) / 100 : 1;
|
935
|
+
return function (_i, slideWidth) {
|
936
|
+
return slideWidth <= (this.size.innerWidth + 1) * percent;
|
937
|
+
};
|
938
|
+
};
|
939
|
+
// alias _init for jQuery plugin .flickity()
|
940
|
+
proto$3._init = proto$3.reposition = function () {
|
941
|
+
this.positionCells();
|
942
|
+
this.positionSliderAtSelected();
|
943
|
+
};
|
944
|
+
proto$3.getSize = function () {
|
945
|
+
this.size = getSize(this.element);
|
946
|
+
this.setCellAlign();
|
947
|
+
this.cursorPosition = this.size.innerWidth * this.cellAlign;
|
948
|
+
};
|
949
|
+
const cellAlignShorthands = {
|
950
|
+
// cell align, then based on origin side
|
951
|
+
center: {
|
952
|
+
left: 0.5,
|
953
|
+
right: 0.5,
|
954
|
+
},
|
955
|
+
left: {
|
956
|
+
left: 0,
|
957
|
+
right: 1,
|
958
|
+
},
|
959
|
+
right: {
|
960
|
+
right: 0,
|
961
|
+
left: 1,
|
962
|
+
},
|
963
|
+
};
|
964
|
+
proto$3.setCellAlign = function () {
|
965
|
+
const shorthand = cellAlignShorthands[this.options.cellAlign];
|
966
|
+
this.cellAlign = shorthand
|
967
|
+
? shorthand[this.originSide]
|
968
|
+
: this.options.cellAlign;
|
969
|
+
};
|
970
|
+
proto$3.setGallerySize = function () {
|
971
|
+
if (this.options.setGallerySize) {
|
972
|
+
const height = this.options.adaptiveHeight && this.selectedSlide
|
973
|
+
? this.selectedSlide.height
|
974
|
+
: this.maxCellHeight;
|
975
|
+
this.viewport.style.height = height + 'px';
|
976
|
+
}
|
977
|
+
};
|
978
|
+
proto$3._getWrapShiftCells = function () {
|
979
|
+
// only for wrap-around
|
980
|
+
if (!this.options.wrapAround) {
|
981
|
+
return;
|
982
|
+
}
|
983
|
+
// unshift previous cells
|
984
|
+
this._unshiftCells(this.beforeShiftCells);
|
985
|
+
this._unshiftCells(this.afterShiftCells);
|
986
|
+
// get before cells
|
987
|
+
// initial gap
|
988
|
+
let gapX = this.cursorPosition;
|
989
|
+
const cellIndex = this.cells.length - 1;
|
990
|
+
this.beforeShiftCells = this._getGapCells(gapX, cellIndex, -1);
|
991
|
+
// get after cells
|
992
|
+
// ending gap between last cell and end of gallery viewport
|
993
|
+
gapX = this.size.innerWidth - this.cursorPosition;
|
994
|
+
// start cloning at first cell, working forwards
|
995
|
+
this.afterShiftCells = this._getGapCells(gapX, 0, 1);
|
996
|
+
};
|
997
|
+
proto$3._getGapCells = function (gapX, cellIndex, increment) {
|
998
|
+
// keep adding cells until the cover the initial gap
|
999
|
+
const cells = [];
|
1000
|
+
while (gapX > 0) {
|
1001
|
+
const cell = this.cells[cellIndex];
|
1002
|
+
if (!cell) {
|
1003
|
+
break;
|
1004
|
+
}
|
1005
|
+
cells.push(cell);
|
1006
|
+
cellIndex += increment;
|
1007
|
+
gapX -= cell.size.outerWidth;
|
1008
|
+
}
|
1009
|
+
return cells;
|
1010
|
+
};
|
1011
|
+
// ----- contain ----- //
|
1012
|
+
// contain cell targets so no excess sliding
|
1013
|
+
proto$3._containSlides = function () {
|
1014
|
+
if (!this.options.contain || this.options.wrapAround || !this.cells.length) {
|
1015
|
+
return;
|
1016
|
+
}
|
1017
|
+
const isRightToLeft = this.options.rightToLeft;
|
1018
|
+
const beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft';
|
1019
|
+
const endMargin = isRightToLeft ? 'marginLeft' : 'marginRight';
|
1020
|
+
const contentWidth = this.slideableWidth - this.getLastCell().size[endMargin];
|
1021
|
+
// content is less than gallery size
|
1022
|
+
const isContentSmaller = contentWidth < this.size.innerWidth;
|
1023
|
+
// bounds
|
1024
|
+
const beginBound = this.cursorPosition + this.cells[0].size[beginMargin];
|
1025
|
+
const endBound = contentWidth - this.size.innerWidth * (1 - this.cellAlign);
|
1026
|
+
// contain each cell target
|
1027
|
+
this.slides.forEach(function (slide) {
|
1028
|
+
if (isContentSmaller) {
|
1029
|
+
// all cells fit inside gallery
|
1030
|
+
slide.target = contentWidth * this.cellAlign;
|
1031
|
+
}
|
1032
|
+
else {
|
1033
|
+
// contain to bounds
|
1034
|
+
slide.target = Math.max(slide.target, beginBound);
|
1035
|
+
slide.target = Math.min(slide.target, endBound);
|
1036
|
+
}
|
1037
|
+
}, this);
|
1038
|
+
};
|
1039
|
+
// ----- ----- //
|
1040
|
+
/**
|
1041
|
+
* emits events via eventEmitter and jQuery events
|
1042
|
+
* @param {String} type - name of event
|
1043
|
+
* @param {Event} event - original event
|
1044
|
+
* @param {Array} args - extra arguments
|
1045
|
+
*/
|
1046
|
+
proto$3.dispatchEvent = function (type, event, args) {
|
1047
|
+
const emitArgs = event ? [event].concat(args) : args;
|
1048
|
+
this.emitEvent(type, emitArgs);
|
1049
|
+
};
|
1050
|
+
// -------------------------- select -------------------------- //
|
1051
|
+
/**
|
1052
|
+
* @param {Integer} index - index of the slide
|
1053
|
+
* @param {Boolean} isWrap - will wrap-around to last/first if at the end
|
1054
|
+
* @param {Boolean} isInstant - will immediately set position at selected cell
|
1055
|
+
*/
|
1056
|
+
proto$3.select = function (index, isWrap, isInstant) {
|
1057
|
+
if (!this.isActive) {
|
1058
|
+
return;
|
1059
|
+
}
|
1060
|
+
index = parseInt(index, 10);
|
1061
|
+
this._wrapSelect(index);
|
1062
|
+
if (this.options.wrapAround || isWrap) {
|
1063
|
+
index = utils.modulo(index, this.slides.length);
|
1064
|
+
}
|
1065
|
+
// bail if invalid index
|
1066
|
+
if (!this.slides[index]) {
|
1067
|
+
return;
|
1068
|
+
}
|
1069
|
+
const prevIndex = this.selectedIndex;
|
1070
|
+
this.selectedIndex = index;
|
1071
|
+
this.updateSelectedSlide();
|
1072
|
+
if (isInstant) {
|
1073
|
+
this.positionSliderAtSelected();
|
1074
|
+
}
|
1075
|
+
else {
|
1076
|
+
this.startAnimation();
|
1077
|
+
}
|
1078
|
+
if (this.options.adaptiveHeight) {
|
1079
|
+
this.setGallerySize();
|
1080
|
+
}
|
1081
|
+
// events
|
1082
|
+
this.dispatchEvent('select', null, [index]);
|
1083
|
+
// change event if new index
|
1084
|
+
if (index != prevIndex) {
|
1085
|
+
this.dispatchEvent('change', null, [index]);
|
1086
|
+
}
|
1087
|
+
// old v1 event name, remove in v3
|
1088
|
+
this.dispatchEvent('cellSelect');
|
1089
|
+
};
|
1090
|
+
// wraps position for wrapAround, to move to closest slide. #113
|
1091
|
+
proto$3._wrapSelect = function (index) {
|
1092
|
+
const len = this.slides.length;
|
1093
|
+
const isWrapping = this.options.wrapAround && len > 1;
|
1094
|
+
if (!isWrapping) {
|
1095
|
+
return index;
|
1096
|
+
}
|
1097
|
+
const wrapIndex = utils.modulo(index, len);
|
1098
|
+
// go to shortest
|
1099
|
+
const delta = Math.abs(wrapIndex - this.selectedIndex);
|
1100
|
+
const backWrapDelta = Math.abs(wrapIndex + len - this.selectedIndex);
|
1101
|
+
const forewardWrapDelta = Math.abs(wrapIndex - len - this.selectedIndex);
|
1102
|
+
if (!this.isDragSelect && backWrapDelta < delta) {
|
1103
|
+
index += len;
|
1104
|
+
}
|
1105
|
+
else if (!this.isDragSelect && forewardWrapDelta < delta) {
|
1106
|
+
index -= len;
|
1107
|
+
}
|
1108
|
+
// wrap position so slider is within normal area
|
1109
|
+
if (index < 0) {
|
1110
|
+
this.x -= this.slideableWidth;
|
1111
|
+
}
|
1112
|
+
else if (index >= len) {
|
1113
|
+
this.x += this.slideableWidth;
|
1114
|
+
}
|
1115
|
+
};
|
1116
|
+
proto$3.previous = function (isWrap, isInstant) {
|
1117
|
+
this.select(this.selectedIndex - 1, isWrap, isInstant);
|
1118
|
+
};
|
1119
|
+
proto$3.next = function (isWrap, isInstant) {
|
1120
|
+
this.select(this.selectedIndex + 1, isWrap, isInstant);
|
1121
|
+
};
|
1122
|
+
proto$3.updateSelectedSlide = function () {
|
1123
|
+
const slide = this.slides[this.selectedIndex];
|
1124
|
+
// selectedIndex could be outside of slides, if triggered before resize()
|
1125
|
+
if (!slide) {
|
1126
|
+
return;
|
1127
|
+
}
|
1128
|
+
// unselect previous selected slide
|
1129
|
+
this.unselectSelectedSlide();
|
1130
|
+
// update new selected slide
|
1131
|
+
this.selectedSlide = slide;
|
1132
|
+
slide.select();
|
1133
|
+
this.selectedCells = slide.cells;
|
1134
|
+
this.selectedElements = slide.getCellElements();
|
1135
|
+
// HACK: selectedCell & selectedElement is first cell in slide, backwards compatibility
|
1136
|
+
// Remove in v3?
|
1137
|
+
this.selectedCell = slide.cells[0];
|
1138
|
+
this.selectedElement = this.selectedElements[0];
|
1139
|
+
};
|
1140
|
+
proto$3.unselectSelectedSlide = function () {
|
1141
|
+
if (this.selectedSlide) {
|
1142
|
+
this.selectedSlide.unselect();
|
1143
|
+
}
|
1144
|
+
};
|
1145
|
+
proto$3.selectInitialIndex = function () {
|
1146
|
+
const initialIndex = this.options.initialIndex;
|
1147
|
+
// already activated, select previous selectedIndex
|
1148
|
+
if (this.isInitActivated) {
|
1149
|
+
this.select(this.selectedIndex, false, true);
|
1150
|
+
return;
|
1151
|
+
}
|
1152
|
+
// select with selector string
|
1153
|
+
if (initialIndex && typeof initialIndex == 'string') {
|
1154
|
+
const cell = this.queryCell(initialIndex);
|
1155
|
+
if (cell) {
|
1156
|
+
this.selectCell(initialIndex, false, true);
|
1157
|
+
return;
|
1158
|
+
}
|
1159
|
+
}
|
1160
|
+
let index = 0;
|
1161
|
+
// select with number
|
1162
|
+
if (initialIndex && this.slides[initialIndex]) {
|
1163
|
+
index = initialIndex;
|
1164
|
+
}
|
1165
|
+
// select instantly
|
1166
|
+
this.select(index, false, true);
|
1167
|
+
};
|
1168
|
+
/**
|
1169
|
+
* select slide from number or cell element
|
1170
|
+
* @param {Element or Number} elem
|
1171
|
+
* @param { Boolean } isWrap
|
1172
|
+
* @param { Boolean } isInstant
|
1173
|
+
*/
|
1174
|
+
proto$3.selectCell = function (elem, isWrap, isInstant) {
|
1175
|
+
// get cell
|
1176
|
+
const cell = this.queryCell(elem);
|
1177
|
+
if (!cell) {
|
1178
|
+
return;
|
1179
|
+
}
|
1180
|
+
const index = this.getCellSlideIndex(cell);
|
1181
|
+
this.select(index, isWrap, isInstant);
|
1182
|
+
};
|
1183
|
+
proto$3.getCellSlideIndex = function (cell) {
|
1184
|
+
// get index of slides that has cell
|
1185
|
+
for (let i = 0; i < this.slides.length; i++) {
|
1186
|
+
const slide = this.slides[i];
|
1187
|
+
const index = slide.cells.indexOf(cell);
|
1188
|
+
if (index != -1) {
|
1189
|
+
return i;
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
};
|
1193
|
+
// -------------------------- get cells -------------------------- //
|
1194
|
+
/**
|
1195
|
+
* get Flickity.Cell, given an Element
|
1196
|
+
* @param {Element} elem
|
1197
|
+
* @returns found flickity cell
|
1198
|
+
*/
|
1199
|
+
proto$3.getCell = function (elem) {
|
1200
|
+
// loop through cells to get the one that matches
|
1201
|
+
for (let i = 0; i < this.cells.length; i++) {
|
1202
|
+
const cell = this.cells[i];
|
1203
|
+
if (cell.element == elem) {
|
1204
|
+
return cell;
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
};
|
1208
|
+
/**
|
1209
|
+
* get collection of Flickity.Cells, given Elements
|
1210
|
+
* @param {Element, Array, NodeList} elems
|
1211
|
+
* @returns {Array} cells - Flickity.Cells
|
1212
|
+
*/
|
1213
|
+
proto$3.getCells = function (elems) {
|
1214
|
+
elems = utils.makeArray(elems);
|
1215
|
+
const cells = [];
|
1216
|
+
elems.forEach(function (elem) {
|
1217
|
+
const cell = this.getCell(elem);
|
1218
|
+
if (cell) {
|
1219
|
+
cells.push(cell);
|
1220
|
+
}
|
1221
|
+
}, this);
|
1222
|
+
return cells;
|
1223
|
+
};
|
1224
|
+
/**
|
1225
|
+
* get cell elements
|
1226
|
+
* @returns {Array} cellElems
|
1227
|
+
*/
|
1228
|
+
proto$3.getCellElements = function () {
|
1229
|
+
return this.cells.map(function (cell) {
|
1230
|
+
return cell.element;
|
1231
|
+
});
|
1232
|
+
};
|
1233
|
+
/**
|
1234
|
+
* get parent cell from an element
|
1235
|
+
* @param {Element} elem
|
1236
|
+
* @returns {Flickit.Cell} cell
|
1237
|
+
*/
|
1238
|
+
proto$3.getParentCell = function (elem) {
|
1239
|
+
// first check if elem is cell
|
1240
|
+
const cell = this.getCell(elem);
|
1241
|
+
if (cell) {
|
1242
|
+
return cell;
|
1243
|
+
}
|
1244
|
+
// try to get parent cell elem
|
1245
|
+
elem = utils.getParent(elem, '.flickity-slider > *');
|
1246
|
+
return this.getCell(elem);
|
1247
|
+
};
|
1248
|
+
/**
|
1249
|
+
* get cells adjacent to a slide
|
1250
|
+
* @param {Integer} adjCount - number of adjacent slides
|
1251
|
+
* @param {Integer} index - index of slide to start
|
1252
|
+
* @returns {Array} cells - array of Flickity.Cells
|
1253
|
+
*/
|
1254
|
+
proto$3.getAdjacentCellElements = function (adjCount, index) {
|
1255
|
+
if (!adjCount) {
|
1256
|
+
return this.selectedSlide.getCellElements();
|
1257
|
+
}
|
1258
|
+
index = index === undefined ? this.selectedIndex : index;
|
1259
|
+
const len = this.slides.length;
|
1260
|
+
if (1 + adjCount * 2 >= len) {
|
1261
|
+
return this.getCellElements();
|
1262
|
+
}
|
1263
|
+
let cellElems = [];
|
1264
|
+
for (let i = index - adjCount; i <= index + adjCount; i++) {
|
1265
|
+
const slideIndex = this.options.wrapAround ? utils.modulo(i, len) : i;
|
1266
|
+
const slide = this.slides[slideIndex];
|
1267
|
+
if (slide) {
|
1268
|
+
cellElems = cellElems.concat(slide.getCellElements());
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
return cellElems;
|
1272
|
+
};
|
1273
|
+
/**
|
1274
|
+
* select slide from number or cell element
|
1275
|
+
* @param {Element, Selector String, or Number} selector
|
1276
|
+
* @returns {Flickity.Cell} found flickity cell
|
1277
|
+
*/
|
1278
|
+
proto$3.queryCell = function (selector) {
|
1279
|
+
if (typeof selector == 'number') {
|
1280
|
+
// use number as index
|
1281
|
+
return this.cells[selector];
|
1282
|
+
}
|
1283
|
+
if (typeof selector == 'string') {
|
1284
|
+
// do not select invalid selectors from hash: #123, #/. #791
|
1285
|
+
if (selector.match(/^[#\.]?[\d\/]/)) {
|
1286
|
+
return;
|
1287
|
+
}
|
1288
|
+
// use string as selector, get element
|
1289
|
+
selector = this.element.querySelector(selector);
|
1290
|
+
}
|
1291
|
+
// get cell from element
|
1292
|
+
return this.getCell(selector);
|
1293
|
+
};
|
1294
|
+
// -------------------------- events -------------------------- //
|
1295
|
+
proto$3.uiChange = function () {
|
1296
|
+
this.emitEvent('uiChange');
|
1297
|
+
};
|
1298
|
+
// keep focus on element when child UI elements are clicked
|
1299
|
+
proto$3.childUIPointerDown = function (event) {
|
1300
|
+
// HACK iOS does not allow touch events to bubble up?!
|
1301
|
+
if (event.type != 'touchstart') {
|
1302
|
+
event.preventDefault();
|
1303
|
+
}
|
1304
|
+
this.focus();
|
1305
|
+
};
|
1306
|
+
// ----- resize ----- //
|
1307
|
+
proto$3.onresize = function () {
|
1308
|
+
this.watchCSS();
|
1309
|
+
this.resize();
|
1310
|
+
};
|
1311
|
+
utils.debounceMethod(Flickity, 'onresize', 150);
|
1312
|
+
proto$3.resize = function () {
|
1313
|
+
if (!this.isActive) {
|
1314
|
+
return;
|
1315
|
+
}
|
1316
|
+
this.getSize();
|
1317
|
+
// wrap values
|
1318
|
+
if (this.options.wrapAround) {
|
1319
|
+
this.x = utils.modulo(this.x, this.slideableWidth);
|
1320
|
+
}
|
1321
|
+
this.positionCells();
|
1322
|
+
this._getWrapShiftCells();
|
1323
|
+
this.setGallerySize();
|
1324
|
+
this.emitEvent('resize');
|
1325
|
+
// update selected index for group slides, instant
|
1326
|
+
// TODO: position can be lost between groups of various numbers
|
1327
|
+
const selectedElement = this.selectedElements && this.selectedElements[0];
|
1328
|
+
this.selectCell(selectedElement, false, true);
|
1329
|
+
};
|
1330
|
+
// watches the :after property, activates/deactivates
|
1331
|
+
proto$3.watchCSS = function () {
|
1332
|
+
const watchOption = this.options.watchCSS;
|
1333
|
+
if (!watchOption) {
|
1334
|
+
return;
|
1335
|
+
}
|
1336
|
+
const afterContent = getComputedStyle$1(this.element, ':after').content;
|
1337
|
+
// activate if :after { content: 'flickity' }
|
1338
|
+
if (afterContent.indexOf('flickity') != -1) {
|
1339
|
+
this.activate();
|
1340
|
+
}
|
1341
|
+
else {
|
1342
|
+
this.deactivate();
|
1343
|
+
}
|
1344
|
+
};
|
1345
|
+
// ----- keydown ----- //
|
1346
|
+
// go previous/next if left/right keys pressed
|
1347
|
+
proto$3.onkeydown = function (event) {
|
1348
|
+
// only work if element is in focus
|
1349
|
+
const isNotFocused = document.activeElement && document.activeElement != this.element;
|
1350
|
+
if (!this.options.accessibility || isNotFocused) {
|
1351
|
+
return;
|
1352
|
+
}
|
1353
|
+
const handler = Flickity.keyboardHandlers[event.keyCode];
|
1354
|
+
if (handler) {
|
1355
|
+
handler.call(this);
|
1356
|
+
}
|
1357
|
+
};
|
1358
|
+
Flickity.keyboardHandlers = {
|
1359
|
+
// left arrow
|
1360
|
+
37: function () {
|
1361
|
+
const leftMethod = this.options.rightToLeft ? 'next' : 'previous';
|
1362
|
+
this.uiChange();
|
1363
|
+
this[leftMethod]();
|
1364
|
+
},
|
1365
|
+
// right arrow
|
1366
|
+
39: function () {
|
1367
|
+
const rightMethod = this.options.rightToLeft ? 'previous' : 'next';
|
1368
|
+
this.uiChange();
|
1369
|
+
this[rightMethod]();
|
1370
|
+
},
|
1371
|
+
};
|
1372
|
+
// ----- focus ----- //
|
1373
|
+
proto$3.focus = function () {
|
1374
|
+
// TODO remove scrollTo once focus options gets more support
|
1375
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#Browser_compatibility
|
1376
|
+
const prevScrollY = window.pageYOffset;
|
1377
|
+
this.element.focus({ preventScroll: true });
|
1378
|
+
// hack to fix scroll jump after focus, #76
|
1379
|
+
if (window.pageYOffset != prevScrollY) {
|
1380
|
+
window.scrollTo(window.pageXOffset, prevScrollY);
|
1381
|
+
}
|
1382
|
+
};
|
1383
|
+
// -------------------------- destroy -------------------------- //
|
1384
|
+
// deactivate all Flickity functionality, but keep stuff available
|
1385
|
+
proto$3.deactivate = function () {
|
1386
|
+
if (!this.isActive) {
|
1387
|
+
return;
|
1388
|
+
}
|
1389
|
+
this.element.classList.remove('flickity-enabled');
|
1390
|
+
this.element.classList.remove('flickity-rtl');
|
1391
|
+
this.unselectSelectedSlide();
|
1392
|
+
// destroy cells
|
1393
|
+
this.cells.forEach(function (cell) {
|
1394
|
+
cell.destroy();
|
1395
|
+
});
|
1396
|
+
this.element.removeChild(this.viewport);
|
1397
|
+
// move child elements back into element
|
1398
|
+
moveElements(this.slider.children, this.element);
|
1399
|
+
if (this.options.accessibility) {
|
1400
|
+
this.element.removeAttribute('tabIndex');
|
1401
|
+
this.element.removeEventListener('keydown', this);
|
1402
|
+
}
|
1403
|
+
// set flags
|
1404
|
+
this.isActive = false;
|
1405
|
+
this.emitEvent('deactivate');
|
1406
|
+
};
|
1407
|
+
proto$3.destroy = function () {
|
1408
|
+
this.deactivate();
|
1409
|
+
window.removeEventListener('resize', this);
|
1410
|
+
this.allOff();
|
1411
|
+
this.emitEvent('destroy');
|
1412
|
+
delete this.element.flickityGUID;
|
1413
|
+
delete instances[this.guid];
|
1414
|
+
};
|
1415
|
+
// -------------------------- prototype -------------------------- //
|
1416
|
+
utils.extend(proto$3, proto$4);
|
1417
|
+
// -------------------------- extras -------------------------- //
|
1418
|
+
/**
|
1419
|
+
* get Flickity instance from element
|
1420
|
+
* @param {Element} elem
|
1421
|
+
* @returns {Flickity} Flickity instance
|
1422
|
+
*/
|
1423
|
+
Flickity.data = function (elem) {
|
1424
|
+
elem = utils.getQueryElement(elem);
|
1425
|
+
const id = elem && elem.flickityGUID;
|
1426
|
+
return id && instances[id];
|
1427
|
+
};
|
1428
|
+
utils.htmlInit(Flickity, 'flickity');
|
1429
|
+
Flickity.Cell = Cell;
|
1430
|
+
Flickity.Slide = Slide;
|
1431
|
+
|
1432
|
+
/*!
|
1433
|
+
* Unipointer v2.4.0
|
1434
|
+
* base class for doing one thing with pointer event
|
1435
|
+
* MIT license
|
1436
|
+
*/
|
1437
|
+
function noop() { }
|
1438
|
+
function Unipointer() { }
|
1439
|
+
// inherit EvEmitter
|
1440
|
+
const pointerProto = (Unipointer.prototype = Object.create(EvEmitter.prototype));
|
1441
|
+
pointerProto.bindStartEvent = function (elem) {
|
1442
|
+
this._bindStartEvent(elem, true);
|
1443
|
+
};
|
1444
|
+
pointerProto.unbindStartEvent = function (elem) {
|
1445
|
+
this._bindStartEvent(elem, false);
|
1446
|
+
};
|
1447
|
+
/**
|
1448
|
+
* Add or remove start event
|
1449
|
+
* @param {Element} elem
|
1450
|
+
* @param {Boolean} isAdd - remove if falsey
|
1451
|
+
*/
|
1452
|
+
pointerProto._bindStartEvent = function (elem, isAdd) {
|
1453
|
+
// munge isAdd, default to true
|
1454
|
+
isAdd = isAdd === undefined ? true : isAdd;
|
1455
|
+
const bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
|
1456
|
+
// default to mouse events
|
1457
|
+
let startEvent = 'mousedown';
|
1458
|
+
if ('ontouchstart' in window) {
|
1459
|
+
// HACK prefer Touch Events as you can preventDefault on touchstart to
|
1460
|
+
// disable scroll in iOS & mobile Chrome metafizzy/flickity#1177
|
1461
|
+
startEvent = 'touchstart';
|
1462
|
+
}
|
1463
|
+
else if (window.PointerEvent) {
|
1464
|
+
// Pointer Events
|
1465
|
+
startEvent = 'pointerdown';
|
1466
|
+
}
|
1467
|
+
elem[bindMethod](startEvent, this);
|
1468
|
+
};
|
1469
|
+
// trigger handler methods for events
|
1470
|
+
pointerProto.handleEvent = function (event) {
|
1471
|
+
const method = 'on' + event.type;
|
1472
|
+
if (this[method]) {
|
1473
|
+
this[method](event);
|
1474
|
+
}
|
1475
|
+
};
|
1476
|
+
// returns the touch that we're keeping track of
|
1477
|
+
pointerProto.getTouch = function (touches) {
|
1478
|
+
for (let i = 0; i < touches.length; i++) {
|
1479
|
+
const touch = touches[i];
|
1480
|
+
if (touch.identifier == this.pointerIdentifier) {
|
1481
|
+
return touch;
|
1482
|
+
}
|
1483
|
+
}
|
1484
|
+
};
|
1485
|
+
// ----- start event ----- //
|
1486
|
+
pointerProto.onmousedown = function (event) {
|
1487
|
+
// dismiss clicks from right or middle buttons
|
1488
|
+
const button = event.button;
|
1489
|
+
if (button && button !== 0 && button !== 1) {
|
1490
|
+
return;
|
1491
|
+
}
|
1492
|
+
this._pointerDown(event, event);
|
1493
|
+
};
|
1494
|
+
pointerProto.ontouchstart = function (event) {
|
1495
|
+
this._pointerDown(event, event.changedTouches[0]);
|
1496
|
+
};
|
1497
|
+
pointerProto.onpointerdown = function (event) {
|
1498
|
+
this._pointerDown(event, event);
|
1499
|
+
};
|
1500
|
+
/**
|
1501
|
+
* pointer start
|
1502
|
+
* @param {Event} event
|
1503
|
+
* @param {Event or Touch} pointer
|
1504
|
+
*/
|
1505
|
+
pointerProto._pointerDown = function (event, pointer) {
|
1506
|
+
// dismiss right click and other pointers
|
1507
|
+
// button = 0 is okay, 1-4 not
|
1508
|
+
if (event.button || this.isPointerDown) {
|
1509
|
+
return;
|
1510
|
+
}
|
1511
|
+
this.isPointerDown = true;
|
1512
|
+
// save pointer identifier to match up touch events
|
1513
|
+
this.pointerIdentifier =
|
1514
|
+
pointer.pointerId !== undefined
|
1515
|
+
? // pointerId for pointer events, touch.indentifier for touch events
|
1516
|
+
pointer.pointerId
|
1517
|
+
: pointer.identifier;
|
1518
|
+
this.pointerDown(event, pointer);
|
1519
|
+
};
|
1520
|
+
pointerProto.pointerDown = function (event, pointer) {
|
1521
|
+
this._bindPostStartEvents(event);
|
1522
|
+
this.emitEvent('pointerDown', [event, pointer]);
|
1523
|
+
};
|
1524
|
+
// hash of events to be bound after start event
|
1525
|
+
const postStartEvents = {
|
1526
|
+
mousedown: ['mousemove', 'mouseup'],
|
1527
|
+
touchstart: ['touchmove', 'touchend', 'touchcancel'],
|
1528
|
+
pointerdown: ['pointermove', 'pointerup', 'pointercancel'],
|
1529
|
+
};
|
1530
|
+
pointerProto._bindPostStartEvents = function (event) {
|
1531
|
+
if (!event) {
|
1532
|
+
return;
|
1533
|
+
}
|
1534
|
+
// get proper events to match start event
|
1535
|
+
const events = postStartEvents[event.type];
|
1536
|
+
// bind events to node
|
1537
|
+
events.forEach(function (eventName) {
|
1538
|
+
window.addEventListener(eventName, this);
|
1539
|
+
}, this);
|
1540
|
+
// save these arguments
|
1541
|
+
this._boundPointerEvents = events;
|
1542
|
+
};
|
1543
|
+
pointerProto._unbindPostStartEvents = function () {
|
1544
|
+
// check for _boundEvents, in case dragEnd triggered twice (old IE8 bug)
|
1545
|
+
if (!this._boundPointerEvents) {
|
1546
|
+
return;
|
1547
|
+
}
|
1548
|
+
this._boundPointerEvents.forEach(function (eventName) {
|
1549
|
+
window.removeEventListener(eventName, this);
|
1550
|
+
}, this);
|
1551
|
+
delete this._boundPointerEvents;
|
1552
|
+
};
|
1553
|
+
// ----- move event ----- //
|
1554
|
+
pointerProto.onmousemove = function (event) {
|
1555
|
+
this._pointerMove(event, event);
|
1556
|
+
};
|
1557
|
+
pointerProto.onpointermove = function (event) {
|
1558
|
+
if (event.pointerId == this.pointerIdentifier) {
|
1559
|
+
this._pointerMove(event, event);
|
1560
|
+
}
|
1561
|
+
};
|
1562
|
+
pointerProto.ontouchmove = function (event) {
|
1563
|
+
const touch = this.getTouch(event.changedTouches);
|
1564
|
+
if (touch) {
|
1565
|
+
this._pointerMove(event, touch);
|
1566
|
+
}
|
1567
|
+
};
|
1568
|
+
/**
|
1569
|
+
* pointer move
|
1570
|
+
* @param {Event} event
|
1571
|
+
* @param {Event or Touch} pointer
|
1572
|
+
* @private
|
1573
|
+
*/
|
1574
|
+
pointerProto._pointerMove = function (event, pointer) {
|
1575
|
+
this.pointerMove(event, pointer);
|
1576
|
+
};
|
1577
|
+
// public
|
1578
|
+
pointerProto.pointerMove = function (event, pointer) {
|
1579
|
+
this.emitEvent('pointerMove', [event, pointer]);
|
1580
|
+
};
|
1581
|
+
// ----- end event ----- //
|
1582
|
+
pointerProto.onmouseup = function (event) {
|
1583
|
+
this._pointerUp(event, event);
|
1584
|
+
};
|
1585
|
+
pointerProto.onpointerup = function (event) {
|
1586
|
+
if (event.pointerId == this.pointerIdentifier) {
|
1587
|
+
this._pointerUp(event, event);
|
1588
|
+
}
|
1589
|
+
};
|
1590
|
+
pointerProto.ontouchend = function (event) {
|
1591
|
+
const touch = this.getTouch(event.changedTouches);
|
1592
|
+
if (touch) {
|
1593
|
+
this._pointerUp(event, touch);
|
1594
|
+
}
|
1595
|
+
};
|
1596
|
+
/**
|
1597
|
+
* pointer up
|
1598
|
+
* @param {Event} event
|
1599
|
+
* @param {Event or Touch} pointer
|
1600
|
+
* @private
|
1601
|
+
*/
|
1602
|
+
pointerProto._pointerUp = function (event, pointer) {
|
1603
|
+
this._pointerDone();
|
1604
|
+
this.pointerUp(event, pointer);
|
1605
|
+
};
|
1606
|
+
// public
|
1607
|
+
pointerProto.pointerUp = function (event, pointer) {
|
1608
|
+
this.emitEvent('pointerUp', [event, pointer]);
|
1609
|
+
};
|
1610
|
+
// ----- pointer done ----- //
|
1611
|
+
// triggered on pointer up & pointer cancel
|
1612
|
+
pointerProto._pointerDone = function () {
|
1613
|
+
this._pointerReset();
|
1614
|
+
this._unbindPostStartEvents();
|
1615
|
+
this.pointerDone();
|
1616
|
+
};
|
1617
|
+
pointerProto._pointerReset = function () {
|
1618
|
+
// reset properties
|
1619
|
+
this.isPointerDown = false;
|
1620
|
+
delete this.pointerIdentifier;
|
1621
|
+
};
|
1622
|
+
pointerProto.pointerDone = noop;
|
1623
|
+
// ----- pointer cancel ----- //
|
1624
|
+
pointerProto.onpointercancel = function (event) {
|
1625
|
+
if (event.pointerId == this.pointerIdentifier) {
|
1626
|
+
this._pointerCancel(event, event);
|
1627
|
+
}
|
1628
|
+
};
|
1629
|
+
pointerProto.ontouchcancel = function (event) {
|
1630
|
+
const touch = this.getTouch(event.changedTouches);
|
1631
|
+
if (touch) {
|
1632
|
+
this._pointerCancel(event, touch);
|
1633
|
+
}
|
1634
|
+
};
|
1635
|
+
/**
|
1636
|
+
* pointer cancel
|
1637
|
+
* @param {Event} event
|
1638
|
+
* @param {Event or Touch} pointer
|
1639
|
+
* @private
|
1640
|
+
*/
|
1641
|
+
pointerProto._pointerCancel = function (event, pointer) {
|
1642
|
+
this._pointerDone();
|
1643
|
+
this.pointerCancel(event, pointer);
|
1644
|
+
};
|
1645
|
+
// public
|
1646
|
+
pointerProto.pointerCancel = function (event, pointer) {
|
1647
|
+
this.emitEvent('pointerCancel', [event, pointer]);
|
1648
|
+
};
|
1649
|
+
// ----- ----- //
|
1650
|
+
// utility function for getting x/y coords from event
|
1651
|
+
Unipointer.getPointerPoint = function (pointer) {
|
1652
|
+
return {
|
1653
|
+
x: pointer.pageX,
|
1654
|
+
y: pointer.pageY,
|
1655
|
+
};
|
1656
|
+
};
|
1657
|
+
/*!
|
1658
|
+
* Unidragger v2.4.0
|
1659
|
+
* Draggable base class
|
1660
|
+
* MIT license
|
1661
|
+
*/
|
1662
|
+
function Unidragger() { }
|
1663
|
+
// inherit Unipointer & EvEmitter
|
1664
|
+
const draggerProto = (Unidragger.prototype = Object.create(Unipointer.prototype));
|
1665
|
+
// ----- bind start ----- //
|
1666
|
+
draggerProto.bindHandles = function () {
|
1667
|
+
this._bindHandles(true);
|
1668
|
+
};
|
1669
|
+
draggerProto.unbindHandles = function () {
|
1670
|
+
this._bindHandles(false);
|
1671
|
+
};
|
1672
|
+
/**
|
1673
|
+
* Add or remove start event
|
1674
|
+
* @param {Boolean} isAdd
|
1675
|
+
*/
|
1676
|
+
draggerProto._bindHandles = function (isAdd) {
|
1677
|
+
// munge isAdd, default to true
|
1678
|
+
isAdd = isAdd === undefined ? true : isAdd;
|
1679
|
+
// bind each handle
|
1680
|
+
const bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
|
1681
|
+
const touchAction = isAdd ? this._touchActionValue : '';
|
1682
|
+
for (let i = 0; i < this.handles.length; i++) {
|
1683
|
+
const handle = this.handles[i];
|
1684
|
+
this._bindStartEvent(handle, isAdd);
|
1685
|
+
handle[bindMethod]('click', this);
|
1686
|
+
// touch-action: none to override browser touch gestures. metafizzy/flickity#540
|
1687
|
+
if (window.PointerEvent) {
|
1688
|
+
handle.style.touchAction = touchAction;
|
1689
|
+
}
|
1690
|
+
}
|
1691
|
+
};
|
1692
|
+
// prototype so it can be overwriteable by Flickity
|
1693
|
+
draggerProto._touchActionValue = 'none';
|
1694
|
+
// ----- start event ----- //
|
1695
|
+
/**
|
1696
|
+
* pointer start
|
1697
|
+
* @param {Event} event
|
1698
|
+
* @param {Event or Touch} pointer
|
1699
|
+
*/
|
1700
|
+
draggerProto.pointerDown = function (event, pointer) {
|
1701
|
+
const isOkay = this.okayPointerDown(event);
|
1702
|
+
if (!isOkay) {
|
1703
|
+
return;
|
1704
|
+
}
|
1705
|
+
// track start event position
|
1706
|
+
// Safari 9 overrides pageX and pageY. These values needs to be copied. flickity#842
|
1707
|
+
this.pointerDownPointer = {
|
1708
|
+
pageX: pointer.pageX,
|
1709
|
+
pageY: pointer.pageY,
|
1710
|
+
};
|
1711
|
+
event.preventDefault();
|
1712
|
+
this.pointerDownBlur();
|
1713
|
+
// bind move and end events
|
1714
|
+
this._bindPostStartEvents(event);
|
1715
|
+
this.emitEvent('pointerDown', [event, pointer]);
|
1716
|
+
};
|
1717
|
+
// nodes that have text fields
|
1718
|
+
const cursorNodes = {
|
1719
|
+
TEXTAREA: true,
|
1720
|
+
INPUT: true,
|
1721
|
+
SELECT: true,
|
1722
|
+
OPTION: true,
|
1723
|
+
};
|
1724
|
+
// input types that do not have text fields
|
1725
|
+
const clickTypes = {
|
1726
|
+
radio: true,
|
1727
|
+
checkbox: true,
|
1728
|
+
button: true,
|
1729
|
+
submit: true,
|
1730
|
+
image: true,
|
1731
|
+
file: true,
|
1732
|
+
};
|
1733
|
+
// dismiss inputs with text fields. flickity#403, flickity#404
|
1734
|
+
draggerProto.okayPointerDown = function (event) {
|
1735
|
+
const isCursorNode = cursorNodes[event.target.nodeName];
|
1736
|
+
const isClickType = clickTypes[event.target.type];
|
1737
|
+
const isOkay = !isCursorNode || isClickType;
|
1738
|
+
if (!isOkay) {
|
1739
|
+
this._pointerReset();
|
1740
|
+
}
|
1741
|
+
return isOkay;
|
1742
|
+
};
|
1743
|
+
// kludge to blur previously focused input
|
1744
|
+
draggerProto.pointerDownBlur = function () {
|
1745
|
+
const focused = document.activeElement;
|
1746
|
+
// do not blur body for IE10, metafizzy/flickity#117
|
1747
|
+
const canBlur = focused && focused.blur && focused != document.body;
|
1748
|
+
if (canBlur) {
|
1749
|
+
focused.blur();
|
1750
|
+
}
|
1751
|
+
};
|
1752
|
+
// ----- move event ----- //
|
1753
|
+
/**
|
1754
|
+
* drag move
|
1755
|
+
* @param {Event} event
|
1756
|
+
* @param {Event or Touch} pointer
|
1757
|
+
*/
|
1758
|
+
draggerProto.pointerMove = function (event, pointer) {
|
1759
|
+
const moveVector = this._dragPointerMove(event, pointer);
|
1760
|
+
this.emitEvent('pointerMove', [event, pointer, moveVector]);
|
1761
|
+
this._dragMove(event, pointer, moveVector);
|
1762
|
+
};
|
1763
|
+
// base pointer move logic
|
1764
|
+
draggerProto._dragPointerMove = function (event, pointer) {
|
1765
|
+
const moveVector = {
|
1766
|
+
x: pointer.pageX - this.pointerDownPointer.pageX,
|
1767
|
+
y: pointer.pageY - this.pointerDownPointer.pageY,
|
1768
|
+
};
|
1769
|
+
// start drag if pointer has moved far enough to start drag
|
1770
|
+
if (!this.isDragging && this.hasDragStarted(moveVector)) {
|
1771
|
+
this._dragStart(event, pointer);
|
1772
|
+
}
|
1773
|
+
return moveVector;
|
1774
|
+
};
|
1775
|
+
// condition if pointer has moved far enough to start drag
|
1776
|
+
draggerProto.hasDragStarted = function (moveVector) {
|
1777
|
+
return Math.abs(moveVector.x) > 3 || Math.abs(moveVector.y) > 3;
|
1778
|
+
};
|
1779
|
+
// ----- end event ----- //
|
1780
|
+
/**
|
1781
|
+
* pointer up
|
1782
|
+
* @param {Event} event
|
1783
|
+
* @param {Event or Touch} pointer
|
1784
|
+
*/
|
1785
|
+
draggerProto.pointerUp = function (event, pointer) {
|
1786
|
+
this.emitEvent('pointerUp', [event, pointer]);
|
1787
|
+
this._dragPointerUp(event, pointer);
|
1788
|
+
};
|
1789
|
+
draggerProto._dragPointerUp = function (event, pointer) {
|
1790
|
+
if (this.isDragging) {
|
1791
|
+
this._dragEnd(event, pointer);
|
1792
|
+
}
|
1793
|
+
else {
|
1794
|
+
// pointer didn't move enough for drag to start
|
1795
|
+
this._staticClick(event, pointer);
|
1796
|
+
}
|
1797
|
+
};
|
1798
|
+
// -------------------------- drag -------------------------- //
|
1799
|
+
// dragStart
|
1800
|
+
draggerProto._dragStart = function (event, pointer) {
|
1801
|
+
this.isDragging = true;
|
1802
|
+
// prevent clicks
|
1803
|
+
this.isPreventingClicks = true;
|
1804
|
+
this.dragStart(event, pointer);
|
1805
|
+
};
|
1806
|
+
draggerProto.dragStart = function (event, pointer) {
|
1807
|
+
this.emitEvent('dragStart', [event, pointer]);
|
1808
|
+
};
|
1809
|
+
// dragMove
|
1810
|
+
draggerProto._dragMove = function (event, pointer, moveVector) {
|
1811
|
+
// do not drag if not dragging yet
|
1812
|
+
if (!this.isDragging) {
|
1813
|
+
return;
|
1814
|
+
}
|
1815
|
+
this.dragMove(event, pointer, moveVector);
|
1816
|
+
};
|
1817
|
+
draggerProto.dragMove = function (event, pointer, moveVector) {
|
1818
|
+
event.preventDefault();
|
1819
|
+
this.emitEvent('dragMove', [event, pointer, moveVector]);
|
1820
|
+
};
|
1821
|
+
// dragEnd
|
1822
|
+
draggerProto._dragEnd = function (event, pointer) {
|
1823
|
+
// set flags
|
1824
|
+
this.isDragging = false;
|
1825
|
+
// re-enable clicking async
|
1826
|
+
setTimeout(function () {
|
1827
|
+
delete this.isPreventingClicks;
|
1828
|
+
}.bind(this));
|
1829
|
+
this.dragEnd(event, pointer);
|
1830
|
+
};
|
1831
|
+
draggerProto.dragEnd = function (event, pointer) {
|
1832
|
+
this.emitEvent('dragEnd', [event, pointer]);
|
1833
|
+
};
|
1834
|
+
// ----- onclick ----- //
|
1835
|
+
// handle all clicks and prevent clicks when dragging
|
1836
|
+
draggerProto.onclick = function (event) {
|
1837
|
+
if (this.isPreventingClicks) {
|
1838
|
+
event.preventDefault();
|
1839
|
+
}
|
1840
|
+
};
|
1841
|
+
// ----- staticClick ----- //
|
1842
|
+
// triggered after pointer down & up with no/tiny movement
|
1843
|
+
draggerProto._staticClick = function (event, pointer) {
|
1844
|
+
// ignore emulated mouse up clicks
|
1845
|
+
if (this.isIgnoringMouseUp && event.type == 'mouseup') {
|
1846
|
+
return;
|
1847
|
+
}
|
1848
|
+
this.staticClick(event, pointer);
|
1849
|
+
// set flag for emulated clicks 300ms after touchend
|
1850
|
+
if (event.type != 'mouseup') {
|
1851
|
+
this.isIgnoringMouseUp = true;
|
1852
|
+
// reset flag after 300ms
|
1853
|
+
setTimeout(function () {
|
1854
|
+
delete this.isIgnoringMouseUp;
|
1855
|
+
}.bind(this), 400);
|
1856
|
+
}
|
1857
|
+
};
|
1858
|
+
draggerProto.staticClick = function (event, pointer) {
|
1859
|
+
this.emitEvent('staticClick', [event, pointer]);
|
1860
|
+
};
|
1861
|
+
// ----- utils ----- //
|
1862
|
+
Unidragger.getPointerPoint = Unipointer.getPointerPoint;
|
1863
|
+
|
1864
|
+
// ----- defaults ----- //
|
1865
|
+
utils.extend(Flickity.defaults, {
|
1866
|
+
draggable: '>1',
|
1867
|
+
dragThreshold: 3,
|
1868
|
+
});
|
1869
|
+
// ----- create ----- //
|
1870
|
+
Flickity.createMethods.push('_createDrag');
|
1871
|
+
// -------------------------- drag prototype -------------------------- //
|
1872
|
+
const proto$2 = Flickity.prototype;
|
1873
|
+
utils.extend(proto$2, Unidragger.prototype);
|
1874
|
+
proto$2._touchActionValue = 'pan-y';
|
1875
|
+
// -------------------------- -------------------------- //
|
1876
|
+
const isTouch = 'createTouch' in document;
|
1877
|
+
let isTouchmoveScrollCanceled = false;
|
1878
|
+
proto$2._createDrag = function () {
|
1879
|
+
this.on('activate', this.onActivateDrag);
|
1880
|
+
this.on('uiChange', this._uiChangeDrag);
|
1881
|
+
this.on('deactivate', this.onDeactivateDrag);
|
1882
|
+
this.on('cellChange', this.updateDraggable);
|
1883
|
+
// TODO updateDraggable on resize? if groupCells & slides change
|
1884
|
+
// HACK - add seemingly innocuous handler to fix iOS 10 scroll behavior
|
1885
|
+
// #457, RubaXa/Sortable#973
|
1886
|
+
if (isTouch && !isTouchmoveScrollCanceled) {
|
1887
|
+
window.addEventListener('touchmove', function () { });
|
1888
|
+
isTouchmoveScrollCanceled = true;
|
1889
|
+
}
|
1890
|
+
};
|
1891
|
+
proto$2.onActivateDrag = function () {
|
1892
|
+
this.handles = [this.viewport];
|
1893
|
+
this.bindHandles();
|
1894
|
+
this.updateDraggable();
|
1895
|
+
};
|
1896
|
+
proto$2.onDeactivateDrag = function () {
|
1897
|
+
this.unbindHandles();
|
1898
|
+
this.element.classList.remove('is-draggable');
|
1899
|
+
};
|
1900
|
+
proto$2.updateDraggable = function () {
|
1901
|
+
// disable dragging if less than 2 slides. #278
|
1902
|
+
if (this.options.draggable == '>1') {
|
1903
|
+
this.isDraggable = this.slides.length > 1;
|
1904
|
+
}
|
1905
|
+
else {
|
1906
|
+
this.isDraggable = this.options.draggable;
|
1907
|
+
}
|
1908
|
+
if (this.isDraggable) {
|
1909
|
+
this.element.classList.add('is-draggable');
|
1910
|
+
}
|
1911
|
+
else {
|
1912
|
+
this.element.classList.remove('is-draggable');
|
1913
|
+
}
|
1914
|
+
};
|
1915
|
+
// backwards compatibility
|
1916
|
+
proto$2.bindDrag = function () {
|
1917
|
+
this.options.draggable = true;
|
1918
|
+
this.updateDraggable();
|
1919
|
+
};
|
1920
|
+
proto$2.unbindDrag = function () {
|
1921
|
+
this.options.draggable = false;
|
1922
|
+
this.updateDraggable();
|
1923
|
+
};
|
1924
|
+
proto$2._uiChangeDrag = function () {
|
1925
|
+
delete this.isFreeScrolling;
|
1926
|
+
};
|
1927
|
+
// -------------------------- pointer events -------------------------- //
|
1928
|
+
proto$2.pointerDown = function (event, pointer) {
|
1929
|
+
if (!this.isDraggable) {
|
1930
|
+
this._pointerDownDefault(event, pointer);
|
1931
|
+
return;
|
1932
|
+
}
|
1933
|
+
const isOkay = this.okayPointerDown(event);
|
1934
|
+
if (!isOkay) {
|
1935
|
+
return;
|
1936
|
+
}
|
1937
|
+
this._pointerDownPreventDefault(event);
|
1938
|
+
this.pointerDownFocus(event);
|
1939
|
+
// blur
|
1940
|
+
if (document.activeElement != this.element) {
|
1941
|
+
// do not blur if already focused
|
1942
|
+
this.pointerDownBlur();
|
1943
|
+
}
|
1944
|
+
// stop if it was moving
|
1945
|
+
this.dragX = this.x;
|
1946
|
+
this.viewport.classList.add('is-pointer-down');
|
1947
|
+
// track scrolling
|
1948
|
+
this.pointerDownScroll = getScrollPosition();
|
1949
|
+
window.addEventListener('scroll', this);
|
1950
|
+
this._pointerDownDefault(event, pointer);
|
1951
|
+
};
|
1952
|
+
// default pointerDown logic, used for staticClick
|
1953
|
+
proto$2._pointerDownDefault = function (event, pointer) {
|
1954
|
+
// track start event position
|
1955
|
+
// Safari 9 overrides pageX and pageY. These values needs to be copied. #779
|
1956
|
+
this.pointerDownPointer = {
|
1957
|
+
pageX: pointer.pageX,
|
1958
|
+
pageY: pointer.pageY,
|
1959
|
+
};
|
1960
|
+
// bind move and end events
|
1961
|
+
this._bindPostStartEvents(event);
|
1962
|
+
this.dispatchEvent('pointerDown', event, [pointer]);
|
1963
|
+
};
|
1964
|
+
const focusNodes = {
|
1965
|
+
INPUT: true,
|
1966
|
+
TEXTAREA: true,
|
1967
|
+
SELECT: true,
|
1968
|
+
};
|
1969
|
+
proto$2.pointerDownFocus = function (event) {
|
1970
|
+
const isFocusNode = focusNodes[event.target.nodeName];
|
1971
|
+
if (!isFocusNode) {
|
1972
|
+
this.focus();
|
1973
|
+
}
|
1974
|
+
};
|
1975
|
+
proto$2._pointerDownPreventDefault = function (event) {
|
1976
|
+
const isTouchStart = event.type == 'touchstart';
|
1977
|
+
const isTouchPointer = event.pointerType == 'touch';
|
1978
|
+
const isFocusNode = focusNodes[event.target.nodeName];
|
1979
|
+
if (!isTouchStart && !isTouchPointer && !isFocusNode) {
|
1980
|
+
event.preventDefault();
|
1981
|
+
}
|
1982
|
+
};
|
1983
|
+
// ----- move ----- //
|
1984
|
+
proto$2.hasDragStarted = function (moveVector) {
|
1985
|
+
return Math.abs(moveVector.x) > this.options.dragThreshold;
|
1986
|
+
};
|
1987
|
+
// ----- up ----- //
|
1988
|
+
proto$2.pointerUp = function (event, pointer) {
|
1989
|
+
delete this.isTouchScrolling;
|
1990
|
+
this.viewport.classList.remove('is-pointer-down');
|
1991
|
+
this.dispatchEvent('pointerUp', event, [pointer]);
|
1992
|
+
this._dragPointerUp(event, pointer);
|
1993
|
+
};
|
1994
|
+
proto$2.pointerDone = function () {
|
1995
|
+
window.removeEventListener('scroll', this);
|
1996
|
+
delete this.pointerDownScroll;
|
1997
|
+
};
|
1998
|
+
// -------------------------- dragging -------------------------- //
|
1999
|
+
proto$2.dragStart = function (event, pointer) {
|
2000
|
+
if (!this.isDraggable) {
|
2001
|
+
return;
|
2002
|
+
}
|
2003
|
+
this.dragStartPosition = this.x;
|
2004
|
+
this.startAnimation();
|
2005
|
+
window.removeEventListener('scroll', this);
|
2006
|
+
this.dispatchEvent('dragStart', event, [pointer]);
|
2007
|
+
};
|
2008
|
+
proto$2.pointerMove = function (event, pointer) {
|
2009
|
+
const moveVector = this._dragPointerMove(event, pointer);
|
2010
|
+
this.dispatchEvent('pointerMove', event, [pointer, moveVector]);
|
2011
|
+
this._dragMove(event, pointer, moveVector);
|
2012
|
+
};
|
2013
|
+
proto$2.dragMove = function (event, pointer, moveVector) {
|
2014
|
+
if (!this.isDraggable) {
|
2015
|
+
return;
|
2016
|
+
}
|
2017
|
+
event.preventDefault();
|
2018
|
+
this.previousDragX = this.dragX;
|
2019
|
+
// reverse if right-to-left
|
2020
|
+
const direction = this.options.rightToLeft ? -1 : 1;
|
2021
|
+
if (this.options.wrapAround) {
|
2022
|
+
// wrap around move. #589
|
2023
|
+
moveVector.x = moveVector.x % this.slideableWidth;
|
2024
|
+
}
|
2025
|
+
let dragX = this.dragStartPosition + moveVector.x * direction;
|
2026
|
+
if (!this.options.wrapAround && this.slides.length) {
|
2027
|
+
// slow drag
|
2028
|
+
const originBound = Math.max(-this.slides[0].target, this.dragStartPosition);
|
2029
|
+
dragX = dragX > originBound ? (dragX + originBound) * 0.5 : dragX;
|
2030
|
+
const endBound = Math.min(-this.getLastSlide().target, this.dragStartPosition);
|
2031
|
+
dragX = dragX < endBound ? (dragX + endBound) * 0.5 : dragX;
|
2032
|
+
}
|
2033
|
+
this.dragX = dragX;
|
2034
|
+
this.dragMoveTime = new Date();
|
2035
|
+
this.dispatchEvent('dragMove', event, [pointer, moveVector]);
|
2036
|
+
};
|
2037
|
+
proto$2.dragEnd = function (event, pointer) {
|
2038
|
+
if (!this.isDraggable) {
|
2039
|
+
return;
|
2040
|
+
}
|
2041
|
+
if (this.options.freeScroll) {
|
2042
|
+
this.isFreeScrolling = true;
|
2043
|
+
}
|
2044
|
+
// set selectedIndex based on where flick will end up
|
2045
|
+
let index = this.dragEndRestingSelect();
|
2046
|
+
if (this.options.freeScroll && !this.options.wrapAround) {
|
2047
|
+
// if free-scroll & not wrap around
|
2048
|
+
// do not free-scroll if going outside of bounding slides
|
2049
|
+
// so bounding slides can attract slider, and keep it in bounds
|
2050
|
+
const restingX = this.getRestingPosition();
|
2051
|
+
this.isFreeScrolling =
|
2052
|
+
-restingX > this.slides[0].target &&
|
2053
|
+
-restingX < this.getLastSlide().target;
|
2054
|
+
}
|
2055
|
+
else if (!this.options.freeScroll && index == this.selectedIndex) {
|
2056
|
+
// boost selection if selected index has not changed
|
2057
|
+
index += this.dragEndBoostSelect();
|
2058
|
+
}
|
2059
|
+
delete this.previousDragX;
|
2060
|
+
// apply selection
|
2061
|
+
// TODO refactor this, selecting here feels weird
|
2062
|
+
// HACK, set flag so dragging stays in correct direction
|
2063
|
+
this.isDragSelect = this.options.wrapAround;
|
2064
|
+
this.select(index);
|
2065
|
+
delete this.isDragSelect;
|
2066
|
+
this.dispatchEvent('dragEnd', event, [pointer]);
|
2067
|
+
};
|
2068
|
+
proto$2.dragEndRestingSelect = function () {
|
2069
|
+
const restingX = this.getRestingPosition();
|
2070
|
+
// how far away from selected slide
|
2071
|
+
const distance = Math.abs(this.getSlideDistance(-restingX, this.selectedIndex));
|
2072
|
+
// get closet resting going up and going down
|
2073
|
+
const positiveResting = this._getClosestResting(restingX, distance, 1);
|
2074
|
+
const negativeResting = this._getClosestResting(restingX, distance, -1);
|
2075
|
+
// use closer resting for wrap-around
|
2076
|
+
const index = positiveResting.distance < negativeResting.distance
|
2077
|
+
? positiveResting.index
|
2078
|
+
: negativeResting.index;
|
2079
|
+
return index;
|
2080
|
+
};
|
2081
|
+
/**
|
2082
|
+
* given resting X and distance to selected cell
|
2083
|
+
* get the distance and index of the closest cell
|
2084
|
+
* @param {Number} restingX - estimated post-flick resting position
|
2085
|
+
* @param {Number} distance - distance to selected cell
|
2086
|
+
* @param {Integer} increment - +1 or -1, going up or down
|
2087
|
+
* @returns {Object} - { distance: {Number}, index: {Integer} }
|
2088
|
+
*/
|
2089
|
+
proto$2._getClosestResting = function (restingX, distance, increment) {
|
2090
|
+
let index = this.selectedIndex;
|
2091
|
+
let minDistance = Infinity;
|
2092
|
+
const condition = this.options.contain && !this.options.wrapAround
|
2093
|
+
? // if contain, keep going if distance is equal to minDistance
|
2094
|
+
function (d, md) {
|
2095
|
+
return d <= md;
|
2096
|
+
}
|
2097
|
+
: function (d, md) {
|
2098
|
+
return d < md;
|
2099
|
+
};
|
2100
|
+
while (condition(distance, minDistance)) {
|
2101
|
+
// measure distance to next cell
|
2102
|
+
index += increment;
|
2103
|
+
minDistance = distance;
|
2104
|
+
distance = this.getSlideDistance(-restingX, index);
|
2105
|
+
if (distance === null) {
|
2106
|
+
break;
|
2107
|
+
}
|
2108
|
+
distance = Math.abs(distance);
|
2109
|
+
}
|
2110
|
+
return {
|
2111
|
+
distance: minDistance,
|
2112
|
+
// selected was previous index
|
2113
|
+
index: index - increment,
|
2114
|
+
};
|
2115
|
+
};
|
2116
|
+
/**
|
2117
|
+
* measure distance between x and a slide target
|
2118
|
+
* @param {Number} x
|
2119
|
+
* @param {Integer} index - slide index
|
2120
|
+
* @returns null or distance number
|
2121
|
+
*/
|
2122
|
+
proto$2.getSlideDistance = function (x, index) {
|
2123
|
+
const len = this.slides.length;
|
2124
|
+
// wrap around if at least 2 slides
|
2125
|
+
const isWrapAround = this.options.wrapAround && len > 1;
|
2126
|
+
const slideIndex = isWrapAround ? utils.modulo(index, len) : index;
|
2127
|
+
const slide = this.slides[slideIndex];
|
2128
|
+
if (!slide) {
|
2129
|
+
return null;
|
2130
|
+
}
|
2131
|
+
// add distance for wrap-around slides
|
2132
|
+
const wrap = isWrapAround ? this.slideableWidth * Math.floor(index / len) : 0;
|
2133
|
+
return x - (slide.target + wrap);
|
2134
|
+
};
|
2135
|
+
proto$2.dragEndBoostSelect = function () {
|
2136
|
+
// do not boost if no previousDragX or dragMoveTime
|
2137
|
+
if (this.previousDragX === undefined ||
|
2138
|
+
!this.dragMoveTime ||
|
2139
|
+
// or if drag was held for 100 ms
|
2140
|
+
new Date() - this.dragMoveTime > 100) {
|
2141
|
+
return 0;
|
2142
|
+
}
|
2143
|
+
const distance = this.getSlideDistance(-this.dragX, this.selectedIndex);
|
2144
|
+
const delta = this.previousDragX - this.dragX;
|
2145
|
+
if (distance > 0 && delta > 0) {
|
2146
|
+
// boost to next if moving towards the right, and positive velocity
|
2147
|
+
return 1;
|
2148
|
+
}
|
2149
|
+
else if (distance < 0 && delta < 0) {
|
2150
|
+
// boost to previous if moving towards the left, and negative velocity
|
2151
|
+
return -1;
|
2152
|
+
}
|
2153
|
+
return 0;
|
2154
|
+
};
|
2155
|
+
// ----- staticClick ----- //
|
2156
|
+
proto$2.staticClick = function (event, pointer) {
|
2157
|
+
// get clickedCell, if cell was clicked
|
2158
|
+
const clickedCell = this.getParentCell(event.target);
|
2159
|
+
const cellElem = clickedCell && clickedCell.element;
|
2160
|
+
const cellIndex = clickedCell && this.cells.indexOf(clickedCell);
|
2161
|
+
this.dispatchEvent('staticClick', event, [pointer, cellElem, cellIndex]);
|
2162
|
+
};
|
2163
|
+
// ----- scroll ----- //
|
2164
|
+
proto$2.onscroll = function () {
|
2165
|
+
const scroll = getScrollPosition();
|
2166
|
+
const scrollMoveX = this.pointerDownScroll.x - scroll.x;
|
2167
|
+
const scrollMoveY = this.pointerDownScroll.y - scroll.y;
|
2168
|
+
// cancel click/tap if scroll is too much
|
2169
|
+
if (Math.abs(scrollMoveX) > 3 || Math.abs(scrollMoveY) > 3) {
|
2170
|
+
this._pointerDone();
|
2171
|
+
}
|
2172
|
+
};
|
2173
|
+
// ----- utils ----- //
|
2174
|
+
function getScrollPosition() {
|
2175
|
+
return {
|
2176
|
+
x: window.pageXOffset,
|
2177
|
+
y: window.pageYOffset,
|
2178
|
+
};
|
2179
|
+
}
|
2180
|
+
// ----- ----- //
|
2181
|
+
|
2182
|
+
const svgURI = 'http://www.w3.org/2000/svg';
|
2183
|
+
// -------------------------- PrevNextButton -------------------------- //
|
2184
|
+
function PrevNextButton(direction, parent) {
|
2185
|
+
this.direction = direction;
|
2186
|
+
this.parent = parent;
|
2187
|
+
this.parentElement = this.parent.element.shadowRoot || this.parent.element;
|
2188
|
+
this._create();
|
2189
|
+
}
|
2190
|
+
PrevNextButton.prototype = Object.create(Unipointer.prototype);
|
2191
|
+
PrevNextButton.prototype._create = function () {
|
2192
|
+
// properties
|
2193
|
+
this.isEnabled = true;
|
2194
|
+
this.isPrevious = this.direction == -1;
|
2195
|
+
const leftDirection = this.parent.options.rightToLeft ? 1 : -1;
|
2196
|
+
this.isLeft = this.direction == leftDirection;
|
2197
|
+
const button = (this.element = document.createElement('button'));
|
2198
|
+
button.className = 'flickity-button flickity-prev-next-button';
|
2199
|
+
button.part.add('navigation-button');
|
2200
|
+
if (this.isPrevious) {
|
2201
|
+
button.classList.add('previous');
|
2202
|
+
button.part.add('navigation-button--previous');
|
2203
|
+
}
|
2204
|
+
else {
|
2205
|
+
button.classList.add('next');
|
2206
|
+
button.part.add('navigation-button--next');
|
2207
|
+
}
|
2208
|
+
// prevent button from submitting form http://stackoverflow.com/a/10836076/182183
|
2209
|
+
button.setAttribute('type', 'button');
|
2210
|
+
// init as disabled
|
2211
|
+
this.disable();
|
2212
|
+
button.setAttribute('aria-label', this.isPrevious ? 'Previous' : 'Next');
|
2213
|
+
const slot = document.createElement('slot');
|
2214
|
+
slot.name = this.isPrevious ? 'previous-icon' : 'next-icon';
|
2215
|
+
button.appendChild(slot);
|
2216
|
+
slot.addEventListener('slotchange', () => {
|
2217
|
+
slot.assignedElements({ flatten: true }).forEach((ele) => {
|
2218
|
+
ele.removeAttribute('hidden');
|
2219
|
+
});
|
2220
|
+
});
|
2221
|
+
// create arrow
|
2222
|
+
const svg = this.createSVG();
|
2223
|
+
slot.appendChild(svg);
|
2224
|
+
// events
|
2225
|
+
this.parent.on('select', this.update.bind(this));
|
2226
|
+
this.on('pointerDown', this.parent.childUIPointerDown.bind(this.parent));
|
2227
|
+
};
|
2228
|
+
PrevNextButton.prototype.activate = function () {
|
2229
|
+
this.bindStartEvent(this.element);
|
2230
|
+
this.element.addEventListener('click', this);
|
2231
|
+
// add to DOM
|
2232
|
+
this.parentElement.appendChild(this.element);
|
2233
|
+
};
|
2234
|
+
PrevNextButton.prototype.deactivate = function () {
|
2235
|
+
// remove from DOM
|
2236
|
+
this.parentElement.removeChild(this.element);
|
2237
|
+
// click events
|
2238
|
+
this.unbindStartEvent(this.element);
|
2239
|
+
this.element.removeEventListener('click', this);
|
2240
|
+
};
|
2241
|
+
PrevNextButton.prototype.createSVG = function () {
|
2242
|
+
const svg = document.createElementNS(svgURI, 'svg');
|
2243
|
+
svg.setAttribute('class', 'flickity-button-icon');
|
2244
|
+
svg.setAttribute('viewBox', '0 0 100 100');
|
2245
|
+
svg.part.add('navigation-icon');
|
2246
|
+
const path = document.createElementNS(svgURI, 'path');
|
2247
|
+
const pathMovements = getArrowMovements(this.parent.options.arrowShape);
|
2248
|
+
path.setAttribute('d', pathMovements);
|
2249
|
+
path.setAttribute('class', 'arrow');
|
2250
|
+
// rotate arrow
|
2251
|
+
if (!this.isLeft) {
|
2252
|
+
path.setAttribute('transform', 'translate(100, 100) rotate(180) ');
|
2253
|
+
}
|
2254
|
+
svg.appendChild(path);
|
2255
|
+
return svg;
|
2256
|
+
};
|
2257
|
+
// get SVG path movmement
|
2258
|
+
function getArrowMovements(shape) {
|
2259
|
+
// use shape as movement if string
|
2260
|
+
if (typeof shape == 'string') {
|
2261
|
+
return shape;
|
2262
|
+
}
|
2263
|
+
// create movement string
|
2264
|
+
return ('M ' +
|
2265
|
+
shape.x0 +
|
2266
|
+
',50' +
|
2267
|
+
' L ' +
|
2268
|
+
shape.x1 +
|
2269
|
+
',' +
|
2270
|
+
(shape.y1 + 50) +
|
2271
|
+
' L ' +
|
2272
|
+
shape.x2 +
|
2273
|
+
',' +
|
2274
|
+
(shape.y2 + 50) +
|
2275
|
+
' L ' +
|
2276
|
+
shape.x3 +
|
2277
|
+
',50 ' +
|
2278
|
+
' L ' +
|
2279
|
+
shape.x2 +
|
2280
|
+
',' +
|
2281
|
+
(50 - shape.y2) +
|
2282
|
+
' L ' +
|
2283
|
+
shape.x1 +
|
2284
|
+
',' +
|
2285
|
+
(50 - shape.y1) +
|
2286
|
+
' Z');
|
2287
|
+
}
|
2288
|
+
PrevNextButton.prototype.handleEvent = utils.handleEvent;
|
2289
|
+
PrevNextButton.prototype.onclick = function () {
|
2290
|
+
if (!this.isEnabled) {
|
2291
|
+
return;
|
2292
|
+
}
|
2293
|
+
this.parent.uiChange();
|
2294
|
+
const method = this.isPrevious ? 'previous' : 'next';
|
2295
|
+
this.parent[method]();
|
2296
|
+
};
|
2297
|
+
// ----- ----- //
|
2298
|
+
PrevNextButton.prototype.enable = function () {
|
2299
|
+
if (this.isEnabled) {
|
2300
|
+
return;
|
2301
|
+
}
|
2302
|
+
this.element.disabled = false;
|
2303
|
+
this.isEnabled = true;
|
2304
|
+
};
|
2305
|
+
PrevNextButton.prototype.disable = function () {
|
2306
|
+
if (!this.isEnabled) {
|
2307
|
+
return;
|
2308
|
+
}
|
2309
|
+
this.element.disabled = true;
|
2310
|
+
this.isEnabled = false;
|
2311
|
+
};
|
2312
|
+
PrevNextButton.prototype.update = function () {
|
2313
|
+
// index of first or last slide, if previous or next
|
2314
|
+
const slides = this.parent.slides;
|
2315
|
+
// enable is wrapAround and at least 2 slides
|
2316
|
+
if (this.parent.options.wrapAround && slides.length > 1) {
|
2317
|
+
this.enable();
|
2318
|
+
return;
|
2319
|
+
}
|
2320
|
+
const lastIndex = slides.length ? slides.length - 1 : 0;
|
2321
|
+
const boundIndex = this.isPrevious ? 0 : lastIndex;
|
2322
|
+
const method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable';
|
2323
|
+
this[method]();
|
2324
|
+
};
|
2325
|
+
PrevNextButton.prototype.destroy = function () {
|
2326
|
+
this.deactivate();
|
2327
|
+
this.allOff();
|
2328
|
+
};
|
2329
|
+
// -------------------------- Flickity prototype -------------------------- //
|
2330
|
+
utils.extend(Flickity.defaults, {
|
2331
|
+
prevNextButtons: true,
|
2332
|
+
arrowShape: {
|
2333
|
+
x0: 10,
|
2334
|
+
x1: 60,
|
2335
|
+
y1: 50,
|
2336
|
+
x2: 70,
|
2337
|
+
y2: 40,
|
2338
|
+
x3: 30,
|
2339
|
+
},
|
2340
|
+
});
|
2341
|
+
Flickity.createMethods.push('_createPrevNextButtons');
|
2342
|
+
const proto$1 = Flickity.prototype;
|
2343
|
+
proto$1._createPrevNextButtons = function () {
|
2344
|
+
if (!this.options.prevNextButtons) {
|
2345
|
+
return;
|
2346
|
+
}
|
2347
|
+
this.prevButton = new PrevNextButton(-1, this);
|
2348
|
+
this.nextButton = new PrevNextButton(1, this);
|
2349
|
+
this.on('activate', this.activatePrevNextButtons);
|
2350
|
+
};
|
2351
|
+
proto$1.activatePrevNextButtons = function () {
|
2352
|
+
this.prevButton.activate();
|
2353
|
+
this.nextButton.activate();
|
2354
|
+
this.on('deactivate', this.deactivatePrevNextButtons);
|
2355
|
+
};
|
2356
|
+
proto$1.deactivatePrevNextButtons = function () {
|
2357
|
+
this.prevButton.deactivate();
|
2358
|
+
this.nextButton.deactivate();
|
2359
|
+
this.off('deactivate', this.deactivatePrevNextButtons);
|
2360
|
+
};
|
2361
|
+
// @ts-ignore
|
2362
|
+
Flickity.PrevNextButton = PrevNextButton;
|
2363
|
+
|
2364
|
+
// -------------------------- Player -------------------------- //
|
2365
|
+
function Player(parent) {
|
2366
|
+
this.parent = parent;
|
2367
|
+
this.state = 'stopped';
|
2368
|
+
// visibility change event handler
|
2369
|
+
this.onVisibilityChange = this.visibilityChange.bind(this);
|
2370
|
+
this.onVisibilityPlay = this.visibilityPlay.bind(this);
|
2371
|
+
}
|
2372
|
+
Player.prototype = Object.create(EvEmitter.prototype);
|
2373
|
+
// start play
|
2374
|
+
Player.prototype.play = function () {
|
2375
|
+
if (this.state == 'playing') {
|
2376
|
+
return;
|
2377
|
+
}
|
2378
|
+
// do not play if page is hidden, start playing when page is visible
|
2379
|
+
const isPageHidden = document.hidden;
|
2380
|
+
if (isPageHidden) {
|
2381
|
+
document.addEventListener('visibilitychange', this.onVisibilityPlay);
|
2382
|
+
return;
|
2383
|
+
}
|
2384
|
+
this.state = 'playing';
|
2385
|
+
// listen to visibility change
|
2386
|
+
document.addEventListener('visibilitychange', this.onVisibilityChange);
|
2387
|
+
// start ticking
|
2388
|
+
this.tick();
|
2389
|
+
};
|
2390
|
+
Player.prototype.tick = function () {
|
2391
|
+
// do not tick if not playing
|
2392
|
+
if (this.state != 'playing') {
|
2393
|
+
return;
|
2394
|
+
}
|
2395
|
+
let time = this.parent.options.autoPlay;
|
2396
|
+
// default to 3 seconds
|
2397
|
+
time = typeof time == 'number' ? time : 3000;
|
2398
|
+
const _this = this;
|
2399
|
+
// HACK: reset ticks if stopped and started within interval
|
2400
|
+
this.clear();
|
2401
|
+
this.timeout = setTimeout(function () {
|
2402
|
+
_this.parent.next(true);
|
2403
|
+
_this.tick();
|
2404
|
+
}, time);
|
2405
|
+
};
|
2406
|
+
Player.prototype.stop = function () {
|
2407
|
+
this.state = 'stopped';
|
2408
|
+
this.clear();
|
2409
|
+
// remove visibility change event
|
2410
|
+
document.removeEventListener('visibilitychange', this.onVisibilityChange);
|
2411
|
+
};
|
2412
|
+
Player.prototype.clear = function () {
|
2413
|
+
clearTimeout(this.timeout);
|
2414
|
+
};
|
2415
|
+
Player.prototype.pause = function () {
|
2416
|
+
if (this.state == 'playing') {
|
2417
|
+
this.state = 'paused';
|
2418
|
+
this.clear();
|
2419
|
+
}
|
2420
|
+
};
|
2421
|
+
Player.prototype.unpause = function () {
|
2422
|
+
// re-start play if paused
|
2423
|
+
if (this.state == 'paused') {
|
2424
|
+
this.play();
|
2425
|
+
}
|
2426
|
+
};
|
2427
|
+
// pause if page visibility is hidden, unpause if visible
|
2428
|
+
Player.prototype.visibilityChange = function () {
|
2429
|
+
const isPageHidden = document.hidden;
|
2430
|
+
this[isPageHidden ? 'pause' : 'unpause']();
|
2431
|
+
};
|
2432
|
+
Player.prototype.visibilityPlay = function () {
|
2433
|
+
this.play();
|
2434
|
+
document.removeEventListener('visibilitychange', this.onVisibilityPlay);
|
2435
|
+
};
|
2436
|
+
// -------------------------- Flickity -------------------------- //
|
2437
|
+
utils.extend(Flickity.defaults, {
|
2438
|
+
pauseAutoPlayOnHover: true,
|
2439
|
+
});
|
2440
|
+
Flickity.createMethods.push('_createPlayer');
|
2441
|
+
const proto = Flickity.prototype;
|
2442
|
+
proto._createPlayer = function () {
|
2443
|
+
this.player = new Player(this);
|
2444
|
+
this.on('activate', this.activatePlayer);
|
2445
|
+
this.on('uiChange', this.stopPlayer);
|
2446
|
+
this.on('pointerDown', this.stopPlayer);
|
2447
|
+
this.on('deactivate', this.deactivatePlayer);
|
2448
|
+
};
|
2449
|
+
proto.activatePlayer = function () {
|
2450
|
+
if (!this.options.autoPlay) {
|
2451
|
+
return;
|
2452
|
+
}
|
2453
|
+
this.player.play();
|
2454
|
+
this.element.addEventListener('mouseenter', this);
|
2455
|
+
};
|
2456
|
+
// Player API, don't hate the ... thanks I know where the door is
|
2457
|
+
proto.playPlayer = function () {
|
2458
|
+
this.player.play();
|
2459
|
+
};
|
2460
|
+
proto.stopPlayer = function () {
|
2461
|
+
this.player.stop();
|
2462
|
+
};
|
2463
|
+
proto.pausePlayer = function () {
|
2464
|
+
this.player.pause();
|
2465
|
+
};
|
2466
|
+
proto.unpausePlayer = function () {
|
2467
|
+
this.player.unpause();
|
2468
|
+
};
|
2469
|
+
proto.deactivatePlayer = function () {
|
2470
|
+
this.player.stop();
|
2471
|
+
this.element.removeEventListener('mouseenter', this);
|
2472
|
+
};
|
2473
|
+
// ----- mouseenter/leave ----- //
|
2474
|
+
// pause auto-play on hover
|
2475
|
+
proto.onmouseenter = function () {
|
2476
|
+
if (!this.options.pauseAutoPlayOnHover) {
|
2477
|
+
return;
|
2478
|
+
}
|
2479
|
+
this.player.pause();
|
2480
|
+
this.element.addEventListener('mouseleave', this);
|
2481
|
+
};
|
2482
|
+
// resume auto-play on hover off
|
2483
|
+
proto.onmouseleave = function () {
|
2484
|
+
this.player.unpause();
|
2485
|
+
this.element.removeEventListener('mouseleave', this);
|
2486
|
+
};
|
2487
|
+
// @ts-ignore
|
2488
|
+
Flickity.Player = Player;
|
2489
|
+
|
2490
|
+
const flickity = Flickity;
|
2491
|
+
|
2492
|
+
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-inline-size:100vw}:host([ready]){opacity:1}.slideshow{max-block-size:100%;min-block-size:inherit;block-size:inherit;position:relative}.slideshow.not-ready{inline-size:100%;overflow:hidden}.flickity-container{opacity:0;transition:opacity 0.2s;display:flex;inline-size:-moz-fit-content;inline-size:fit-content;block-size:-moz-fit-content;block-size:fit-content}.not-ready .flickity-container{inline-size:-moz-fit-content;inline-size:fit-content;block-size:-moz-fit-content;block-size:fit-content}.flickity-container.slides-ready{min-block-size:inherit;max-block-size:inherit;block-size:inherit;inline-size: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);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}";
|
2493
|
+
|
2494
|
+
const modulo = (num, div) => {
|
2495
|
+
return ((num % div) + div) % div;
|
2496
|
+
};
|
2497
|
+
const Slides = class {
|
2498
|
+
constructor(hostRef) {
|
2499
|
+
registerInstance(this, hostRef);
|
2500
|
+
this.nanoSlidesDidLoad = createEvent(this, "nanoSlidesDidLoad", 7);
|
2501
|
+
this.nanoSlidesReady = createEvent(this, "nanoSlidesReady", 7);
|
2502
|
+
this.nanoSlidesSelect = createEvent(this, "nanoSlidesSelect", 7);
|
2503
|
+
this.nanoSlidesChange = createEvent(this, "nanoSlidesChange", 7);
|
2504
|
+
this.nanoSlidesScroll = createEvent(this, "nanoSlidesScroll", 7);
|
2505
|
+
this.nanoSlidesTransitionEnd = createEvent(this, "nanoSlidesTransitionEnd", 7);
|
2506
|
+
this.nanoSlidesDragStart = createEvent(this, "nanoSlidesDragStart", 7);
|
2507
|
+
this.nanoSlidesDragMove = createEvent(this, "nanoSlidesDragMove", 7);
|
2508
|
+
this.nanoSlidesDragEnd = createEvent(this, "nanoSlidesDragEnd", 7);
|
2509
|
+
this.nanoSlidesTap = createEvent(this, "nanoSlidesTap", 7);
|
2510
|
+
this.nanoSlidesFullscreenChange = createEvent(this, "nanoSlidesFullscreenChange", 7);
|
2511
|
+
this.flickityReady = false;
|
2512
|
+
this.flickity = new Promise((resolve) => {
|
2513
|
+
this.readyflickity = resolve;
|
2514
|
+
});
|
2515
|
+
this.hasFullScreenModule = false;
|
2516
|
+
this.hasLazyLoadModule = false;
|
2517
|
+
this.hasDotsModule = false;
|
2518
|
+
this.hasFadeModule = false;
|
2519
|
+
this.parallax = async () => {
|
2520
|
+
const flkty = await this.flickity;
|
2521
|
+
const cells = flkty.cells;
|
2522
|
+
cells.forEach((cell) => {
|
2523
|
+
const ele = cell.element.children[0];
|
2524
|
+
let flkX = flkty.x;
|
2525
|
+
if (flkty.options.wrapAround && flkty.cells.length > 1) {
|
2526
|
+
flkX = modulo(flkX, flkty.slideableWidth);
|
2527
|
+
flkX = flkX - flkty.slideableWidth;
|
2528
|
+
}
|
2529
|
+
let x = ((cell.target + flkX) * -1) / 3;
|
2530
|
+
if (cell.shift < 0) {
|
2531
|
+
x = ((cell.target - flkty.slideableWidth + flkX) * -1) / 3;
|
2532
|
+
}
|
2533
|
+
else if (cell.shift > 0) {
|
2534
|
+
x = ((cell.target + (flkX + flkty.slideableWidth)) * -1) / 3;
|
2535
|
+
}
|
2536
|
+
ele.style.transform = 'translate3d(' + x + 'px, 0, 0)';
|
2537
|
+
const animAmount = ((x * 3) / cell.size.width) * 100;
|
2538
|
+
cell.element.style.setProperty('--animation-amount', animAmount.toString());
|
2539
|
+
});
|
2540
|
+
};
|
2541
|
+
this.handleFullscreen = (isFullScreen) => {
|
2542
|
+
this.fullscreen = isFullScreen;
|
2543
|
+
this.nanoSlidesFullscreenChange.emit(isFullScreen);
|
2544
|
+
};
|
2545
|
+
this.handleSlideSelect = (slide) => {
|
2546
|
+
this.iCurrentSlide = slide;
|
2547
|
+
this.nanoSlidesSelect.emit(slide);
|
2548
|
+
};
|
2549
|
+
this.iCurrentSlide = undefined;
|
2550
|
+
this.slidesReady = undefined;
|
2551
|
+
this.didInit = false;
|
2552
|
+
this.options = {};
|
2553
|
+
this.navbtns = false;
|
2554
|
+
this.pager = false;
|
2555
|
+
this.fullscreenbtn = false;
|
2556
|
+
this.fullscreen = false;
|
2557
|
+
this.animation = 'scroll';
|
2558
|
+
this.currentSlide = 0;
|
2559
|
+
this.autoplay = false;
|
2560
|
+
this.ready = false;
|
2561
|
+
}
|
2562
|
+
async optionsChanged() {
|
2563
|
+
if (this.flickityReady) {
|
2564
|
+
const flickity = await this.getflickity();
|
2565
|
+
const newOpts = Object.assign(flickity.options, this.options);
|
2566
|
+
await this.loadFlickityModules(newOpts);
|
2567
|
+
await this.update();
|
2568
|
+
}
|
2569
|
+
}
|
2570
|
+
async navbtnsChanged() {
|
2571
|
+
Array.from(this._getRoot().querySelectorAll('.flickity-prev-next-button')).forEach((btn) => {
|
2572
|
+
btn.hidden = !this.navbtns;
|
2573
|
+
});
|
2574
|
+
}
|
2575
|
+
async pagerChanged() {
|
2576
|
+
const dots = this._getRoot().querySelector('.flickity-page-dots');
|
2577
|
+
if (dots)
|
2578
|
+
dots.hidden = !this.pager;
|
2579
|
+
}
|
2580
|
+
async fullscreenBtnChanged() {
|
2581
|
+
const btn = this._getRoot().querySelector('.flickity-fullscreen-button');
|
2582
|
+
if (btn)
|
2583
|
+
btn.hidden = !this.fullscreenbtn;
|
2584
|
+
}
|
2585
|
+
async fullscreenChanged(_, oldFs) {
|
2586
|
+
const flickity = await this.getflickity();
|
2587
|
+
if (this.fullscreen)
|
2588
|
+
flickity.viewFullscreen();
|
2589
|
+
else if (typeof oldFs !== 'undefined')
|
2590
|
+
flickity.exitFullscreen();
|
2591
|
+
}
|
2592
|
+
async animationChange(_, oldAnim) {
|
2593
|
+
const [flkty, slides] = await Promise.all([
|
2594
|
+
this.getflickity(),
|
2595
|
+
waitForSlides(this.host),
|
2596
|
+
]);
|
2597
|
+
// clear old stuff
|
2598
|
+
slides.forEach((slide) => {
|
2599
|
+
slide.style['left'] = undefined;
|
2600
|
+
});
|
2601
|
+
if (oldAnim === 'parallax') {
|
2602
|
+
flkty.off('scroll', this.parallax);
|
2603
|
+
slides.forEach((_, i) => {
|
2604
|
+
if (this.childrenEles && this.childrenEles[i])
|
2605
|
+
this.childrenEles[i].style['transform'] = undefined;
|
2606
|
+
});
|
2607
|
+
this.update();
|
2608
|
+
}
|
2609
|
+
// was a custom animation
|
2610
|
+
if (typeof oldAnim === 'function') {
|
2611
|
+
flkty.off('scroll', oldAnim);
|
2612
|
+
}
|
2613
|
+
// is a custom animation
|
2614
|
+
if (typeof this.animation === 'function') {
|
2615
|
+
this.options = { fade: false, percentPosition: true };
|
2616
|
+
flkty.on('scroll', this.animation);
|
2617
|
+
return;
|
2618
|
+
}
|
2619
|
+
// setup new stuff
|
2620
|
+
switch (this.animation) {
|
2621
|
+
case 'fade':
|
2622
|
+
this.options = { fade: true, percentPosition: true };
|
2623
|
+
break;
|
2624
|
+
case 'parallax':
|
2625
|
+
this.options = { fade: false, percentPosition: true };
|
2626
|
+
flkty.on('scroll', this.parallax);
|
2627
|
+
break;
|
2628
|
+
default:
|
2629
|
+
this.options = { fade: false, percentPosition: true };
|
2630
|
+
break;
|
2631
|
+
}
|
2632
|
+
}
|
2633
|
+
currentSlideChange() {
|
2634
|
+
if (this.currentSlide !== this.iCurrentSlide)
|
2635
|
+
this.slideTo(this.currentSlide);
|
2636
|
+
}
|
2637
|
+
internalSlideChange() {
|
2638
|
+
this.currentSlide = this.iCurrentSlide;
|
2639
|
+
}
|
2640
|
+
async autoPlayChange() {
|
2641
|
+
await this.stopAutoplay();
|
2642
|
+
if (this.autoplay) {
|
2643
|
+
if (typeof this.autoplay === 'string')
|
2644
|
+
this.autoplay = parseInt(this.autoplay);
|
2645
|
+
if (this.autoplay > 0)
|
2646
|
+
this.startAutoplay(this.autoplay);
|
2647
|
+
}
|
2648
|
+
}
|
2649
|
+
/**
|
2650
|
+
* Update the underlying flickity implementation. Call this if you've added or removed
|
2651
|
+
* child slides.
|
2652
|
+
*/
|
2653
|
+
async update() {
|
2654
|
+
const [flickity] = await Promise.all([
|
2655
|
+
this.getflickity(),
|
2656
|
+
waitForSlides(this.host),
|
2657
|
+
]);
|
2658
|
+
this.childrenEles = this.host.querySelectorAll('nano-slide > *');
|
2659
|
+
flickity.reloadCells();
|
2660
|
+
flickity.resize();
|
2661
|
+
flickity.reposition();
|
2662
|
+
}
|
2663
|
+
/**
|
2664
|
+
* Force flickity to update its height (when adaptiveHeight is enabled) for the duration
|
2665
|
+
* equal to 'speed' parameter.
|
2666
|
+
*
|
2667
|
+
* @param speed The transition duration (in ms).
|
2668
|
+
*/
|
2669
|
+
async updateAutoHeight(speed) {
|
2670
|
+
const vp = document.querySelector('.flickity-viewport');
|
2671
|
+
if (vp)
|
2672
|
+
vp.style.transition = speed + 'ms';
|
2673
|
+
}
|
2674
|
+
/**
|
2675
|
+
* Transition to the specified slide.
|
2676
|
+
*
|
2677
|
+
* @param index The index of the slide to transition to.
|
2678
|
+
* @param instant Immediately view the selected slide without animation.
|
2679
|
+
*/
|
2680
|
+
async slideTo(index, instant) {
|
2681
|
+
const flickity = await this.getflickity();
|
2682
|
+
flickity.select(index, instant);
|
2683
|
+
}
|
2684
|
+
/**
|
2685
|
+
* Transition to the next slide.
|
2686
|
+
*
|
2687
|
+
* @param instant The transition duration (in ms).
|
2688
|
+
* @param wrap If true, the first slide will be selected if at the last slide.
|
2689
|
+
*/
|
2690
|
+
async slideNext(instant, wrap) {
|
2691
|
+
const flickity = await this.getflickity();
|
2692
|
+
flickity.next(wrap, instant);
|
2693
|
+
}
|
2694
|
+
/**
|
2695
|
+
* Transition to the previous slide.
|
2696
|
+
*
|
2697
|
+
* @param instant The transition duration (in ms).
|
2698
|
+
* @param wrap If true, the last slide will be selected if at the first slide.
|
2699
|
+
*/
|
2700
|
+
async slidePrev(instant, wrap) {
|
2701
|
+
const flickity = await this.getflickity();
|
2702
|
+
flickity.previous(instant, wrap);
|
2703
|
+
}
|
2704
|
+
/** Get the index of the active slide. */
|
2705
|
+
async getActiveIndex() {
|
2706
|
+
const flickity = await this.getflickity();
|
2707
|
+
return flickity.selectedIndex;
|
2708
|
+
}
|
2709
|
+
/** Get the total number of slides. */
|
2710
|
+
async length() {
|
2711
|
+
const flickity = await this.getflickity();
|
2712
|
+
return flickity.slides.length;
|
2713
|
+
}
|
2714
|
+
/** Get whether or not the current slide is the last slide. */
|
2715
|
+
async isEnd() {
|
2716
|
+
const flickity = await this.getflickity();
|
2717
|
+
return flickity.selectedIndex === flickity.slides.length - 1;
|
2718
|
+
}
|
2719
|
+
/** Get whether or not the current slide is the first slide. */
|
2720
|
+
async isBeginning() {
|
2721
|
+
const flickity = await this.getflickity();
|
2722
|
+
return flickity.selectedIndex === 0;
|
2723
|
+
}
|
2724
|
+
/**
|
2725
|
+
* Start auto play.
|
2726
|
+
* @param time - optional time duration to show slides
|
2727
|
+
*/
|
2728
|
+
async startAutoplay(time) {
|
2729
|
+
const flickity = await this.getflickity();
|
2730
|
+
if (time)
|
2731
|
+
this.options = { autoPlay: time };
|
2732
|
+
setTimeout(() => flickity.playPlayer());
|
2733
|
+
}
|
2734
|
+
/** Stop auto play. */
|
2735
|
+
async stopAutoplay() {
|
2736
|
+
const flickity = await this.getflickity();
|
2737
|
+
flickity.stopPlayer();
|
2738
|
+
}
|
2739
|
+
/**
|
2740
|
+
* Lock or unlock the ability to slide to the next slide.
|
2741
|
+
*
|
2742
|
+
* @param lock If `true`, disable swiping
|
2743
|
+
*/
|
2744
|
+
async lockSwipes(lock) {
|
2745
|
+
const flickity = await this.getflickity();
|
2746
|
+
flickity.options.draggable = !lock;
|
2747
|
+
flickity.updateDraggable();
|
2748
|
+
}
|
2749
|
+
/**
|
2750
|
+
* Get the flickity instance.
|
2751
|
+
* Use this to access the full flickity API.
|
2752
|
+
* See https://flickity.metafizzy.co/ for all API options.
|
2753
|
+
*/
|
2754
|
+
async getflickity() {
|
2755
|
+
return this.flickity;
|
2756
|
+
}
|
2757
|
+
/**
|
2758
|
+
* Hard destroy / create.
|
2759
|
+
* Certain flickity options, you will require the instance to be re-initialised
|
2760
|
+
*/
|
2761
|
+
async reload() {
|
2762
|
+
this.destroyflickity();
|
2763
|
+
setTimeout(() => this.initflickity(), 20);
|
2764
|
+
}
|
2765
|
+
_getRoot() {
|
2766
|
+
return this.host.shadowRoot ? this.host.shadowRoot : this.host;
|
2767
|
+
}
|
2768
|
+
destroyflickity() {
|
2769
|
+
/**
|
2770
|
+
* We need to synchronously destroy
|
2771
|
+
* flickity otherwise it is possible
|
2772
|
+
* that it will be left in a
|
2773
|
+
* destroyed state if connectedCallback
|
2774
|
+
* is called multiple times
|
2775
|
+
*/
|
2776
|
+
const flickity = this.syncflickity;
|
2777
|
+
if (flickity !== undefined) {
|
2778
|
+
flickity.destroy();
|
2779
|
+
this.flickity = new Promise((resolve) => {
|
2780
|
+
this.readyflickity = resolve;
|
2781
|
+
});
|
2782
|
+
this.flickityReady = false;
|
2783
|
+
this.syncflickity = undefined;
|
2784
|
+
this.ready = false;
|
2785
|
+
}
|
2786
|
+
this.didInit = false;
|
2787
|
+
}
|
2788
|
+
async loadFlickityModules(opts) {
|
2789
|
+
if (!this.hasFullScreenModule && opts.fullscreen) {
|
2790
|
+
await import('./fullscreen-86fa276a.js');
|
2791
|
+
this.hasFullScreenModule = true;
|
2792
|
+
}
|
2793
|
+
if (!this.hasLazyLoadModule && opts.lazyLoad) {
|
2794
|
+
await import('./lazyload-994232a6.js');
|
2795
|
+
this.hasLazyLoadModule = true;
|
2796
|
+
}
|
2797
|
+
if (!this.hasDotsModule && opts.pageDots) {
|
2798
|
+
await import('./page-dots-467ace2e.js');
|
2799
|
+
this.hasDotsModule = true;
|
2800
|
+
}
|
2801
|
+
if (!this.hasFadeModule && opts.fade) {
|
2802
|
+
await import('./fade-1aa7a6db.js');
|
2803
|
+
this.hasFadeModule = true;
|
2804
|
+
}
|
2805
|
+
}
|
2806
|
+
async initflickity() {
|
2807
|
+
const finalOptions = this.normalizeOptions();
|
2808
|
+
await this.loadFlickityModules(finalOptions);
|
2809
|
+
// init flickity core
|
2810
|
+
await waitForSlides(this.host);
|
2811
|
+
this.flickityEl =
|
2812
|
+
this.flickityEl || this._getRoot().querySelector('.flickity-container');
|
2813
|
+
if (!this.flickityEl)
|
2814
|
+
return;
|
2815
|
+
this.slidesReady = true;
|
2816
|
+
if (this.flickityEl.classList.contains('flickity-enabled')) {
|
2817
|
+
this.destroyflickity();
|
2818
|
+
}
|
2819
|
+
this.flickityEl.style.height =
|
2820
|
+
this.flickityEl.getBoundingClientRect().height + 'px';
|
2821
|
+
setTimeout(() => {
|
2822
|
+
this.flickityEl.style.height = '';
|
2823
|
+
const flick = new flickity(this.flickityEl, finalOptions);
|
2824
|
+
this.flickityReady = true;
|
2825
|
+
this.syncflickity = flick;
|
2826
|
+
this.animationChange();
|
2827
|
+
this.navbtnsChanged();
|
2828
|
+
this.pagerChanged();
|
2829
|
+
this.fullscreenChanged();
|
2830
|
+
this.fullscreenBtnChanged();
|
2831
|
+
this.readyflickity(flick);
|
2832
|
+
this.ready = true;
|
2833
|
+
if (!window['ResizeObserver'])
|
2834
|
+
return;
|
2835
|
+
// just boots and braces to make sure it's the correct size oninit
|
2836
|
+
const ro = (this.resizeO = new ResizeObserver(() => {
|
2837
|
+
flick.resize();
|
2838
|
+
// this.resizeO.disconnect();
|
2839
|
+
}));
|
2840
|
+
ro.observe(this.host);
|
2841
|
+
}, 100);
|
2842
|
+
}
|
2843
|
+
normalizeOptions() {
|
2844
|
+
// Base options, can be changed
|
2845
|
+
const flickityOptions = {
|
2846
|
+
cellSelector: 'nano-slide',
|
2847
|
+
contain: true,
|
2848
|
+
prevNextButtons: true,
|
2849
|
+
fullscreen: this.fullscreen,
|
2850
|
+
accessibility: true,
|
2851
|
+
imagesLoaded: true,
|
2852
|
+
pageDots: this.pager,
|
2853
|
+
};
|
2854
|
+
if (this.animation === 'fade') {
|
2855
|
+
flickityOptions.fade = true;
|
2856
|
+
}
|
2857
|
+
if (this.currentSlide > 0) {
|
2858
|
+
flickityOptions.initialIndex = this.currentSlide;
|
2859
|
+
}
|
2860
|
+
if (this.autoplay) {
|
2861
|
+
if (typeof this.autoplay === 'string')
|
2862
|
+
this.autoplay = parseInt(this.autoplay);
|
2863
|
+
if (this.autoplay > 0)
|
2864
|
+
flickityOptions.autoPlay = this.autoplay;
|
2865
|
+
}
|
2866
|
+
// Keep the event options separate, we dont want users
|
2867
|
+
// overwriting these
|
2868
|
+
const eventOptions = {
|
2869
|
+
ready: () => {
|
2870
|
+
setTimeout(() => {
|
2871
|
+
this.nanoSlidesReady.emit();
|
2872
|
+
}, 20);
|
2873
|
+
},
|
2874
|
+
select: this.handleSlideSelect,
|
2875
|
+
change: this.nanoSlidesChange.emit,
|
2876
|
+
scroll: this.nanoSlidesScroll.emit,
|
2877
|
+
settle: this.nanoSlidesTransitionEnd.emit,
|
2878
|
+
dragStart: this.nanoSlidesDragStart.emit,
|
2879
|
+
dragMove: this.nanoSlidesDragMove.emit,
|
2880
|
+
dragEnd: this.nanoSlidesDragEnd.emit,
|
2881
|
+
staticClick: this.nanoSlidesTap.emit,
|
2882
|
+
fullscreenChange: this.handleFullscreen,
|
2883
|
+
};
|
2884
|
+
const customEvents = !!this.options && !!this.options.on ? this.options.on : {};
|
2885
|
+
// merge "on" event listeners, while giving our event listeners priority
|
2886
|
+
const mergedEventOptions = { on: Object.assign(Object.assign({}, customEvents), eventOptions) };
|
2887
|
+
// Merge the base, user options, and events together then pass to flickity
|
2888
|
+
// @ts-ignore
|
2889
|
+
return Object.assign(Object.assign(Object.assign({}, flickityOptions), mergedEventOptions), this.options);
|
2890
|
+
}
|
2891
|
+
componentDidLoad() {
|
2892
|
+
if (typeof window !== 'undefined' &&
|
2893
|
+
window.MutationObserver) {
|
2894
|
+
const mut = (this.mutationO = new MutationObserver((e) => {
|
2895
|
+
if (e[0].addedNodes[0] &&
|
2896
|
+
e[0].addedNodes[0].nodeName.toLowerCase() === 'nano-slide' &&
|
2897
|
+
this.flickityReady) {
|
2898
|
+
this.update();
|
2899
|
+
}
|
2900
|
+
}));
|
2901
|
+
mut.observe(this.host, {
|
2902
|
+
childList: true,
|
2903
|
+
subtree: true,
|
2904
|
+
});
|
2905
|
+
}
|
2906
|
+
}
|
2907
|
+
componentWillLoad() {
|
2908
|
+
this.nanoSlidesDidLoad.emit();
|
2909
|
+
if (!this.didInit) {
|
2910
|
+
this.didInit = true;
|
2911
|
+
this.initflickity();
|
2912
|
+
}
|
2913
|
+
}
|
2914
|
+
disconnectedCallback() {
|
2915
|
+
if (this.mutationO) {
|
2916
|
+
this.mutationO.disconnect();
|
2917
|
+
this.mutationO = undefined;
|
2918
|
+
}
|
2919
|
+
if (this.resizeO)
|
2920
|
+
this.resizeO.disconnect();
|
2921
|
+
this.destroyflickity();
|
2922
|
+
}
|
2923
|
+
render() {
|
2924
|
+
return (h(Host, null, h("div", { class: {
|
2925
|
+
slideshow: true,
|
2926
|
+
ready: this.ready,
|
2927
|
+
'not-ready': !this.ready,
|
2928
|
+
}, part: "base" }, h("div", { ref: (div) => (this.flickityEl = div), class: {
|
2929
|
+
'flickity-container': true,
|
2930
|
+
'slides-ready': this.slidesReady,
|
2931
|
+
'slides-not-ready': !this.slidesReady,
|
2932
|
+
}, part: "slide-container" }, h("slot", null)), h("div", { class: "ui-extras" }, h("slot", { name: "ui" })))));
|
2933
|
+
}
|
2934
|
+
get host() { return getElement(this); }
|
2935
|
+
static get watchers() { return {
|
2936
|
+
"options": ["optionsChanged"],
|
2937
|
+
"navbtns": ["navbtnsChanged"],
|
2938
|
+
"pager": ["pagerChanged"],
|
2939
|
+
"fullscreenbtn": ["fullscreenBtnChanged"],
|
2940
|
+
"fullscreen": ["fullscreenChanged"],
|
2941
|
+
"animation": ["animationChange"],
|
2942
|
+
"currentSlide": ["currentSlideChange"],
|
2943
|
+
"iCurrentSlide": ["internalSlideChange"],
|
2944
|
+
"autoplay": ["autoPlayChange"]
|
2945
|
+
}; }
|
2946
|
+
};
|
2947
|
+
const waitForSlides = (host) => {
|
2948
|
+
const allSlides = Array.from(host.querySelectorAll('nano-slide'));
|
2949
|
+
let toLoadSlides = allSlides.filter((ele) => !ele.ready);
|
2950
|
+
if (!toLoadSlides.length)
|
2951
|
+
return Promise.resolve(allSlides);
|
2952
|
+
return new Promise((resolve) => {
|
2953
|
+
const slideResolver = (ev) => {
|
2954
|
+
toLoadSlides = toLoadSlides.filter((ele) => ele !== ev.target);
|
2955
|
+
if (!toLoadSlides.length) {
|
2956
|
+
resolve(allSlides);
|
2957
|
+
host.removeEventListener('nanoSlideReady', slideResolver);
|
2958
|
+
host.removeEventListener('nano-slide-ready', slideResolver);
|
2959
|
+
}
|
2960
|
+
};
|
2961
|
+
host.addEventListener('nanoSlideReady', slideResolver);
|
2962
|
+
// fallback for vue who can't handle camelcase event names
|
2963
|
+
host.addEventListener('nano-slide-ready', slideResolver);
|
2964
|
+
});
|
2965
|
+
};
|
2966
|
+
Slides.style = slidesCss;
|
2967
|
+
|
2968
|
+
export { Flickity as F, Slides as S, Unipointer as U, utils as u };
|
2969
|
+
|
2970
|
+
//# sourceMappingURL=nano-slides-9908c44d.js.map
|