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