j1-template 2020.0.11 → 2020.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/blocks/ads/ad.html +64 -0
- data/_includes/themes/j1/blocks/footer/boxes/about_box.proc +2 -2
- data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +3 -3
- data/_includes/themes/j1/blocks/footer/boxes/news_box.proc +3 -3
- data/_includes/themes/j1/layouts/content_generator_blog_archive.html +3 -2
- data/_includes/themes/j1/layouts/content_generator_collection.html +3 -2
- data/_includes/themes/j1/layouts/content_generator_page.html +26 -25
- data/_includes/themes/j1/layouts/content_generator_post.html +13 -13
- data/_includes/themes/j1/layouts/layout_metadata_generator.html +134 -4
- data/_includes/themes/j1/modules/connectors/ad/custom-provider.html +6 -9
- data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +9 -6
- data/_includes/themes/j1/modules/connectors/ads +3 -6
- data/_includes/themes/j1/modules/navigator/generator.html +0 -1
- data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +5 -5
- data/_includes/themes/j1/procedures/global/create_word_cloud.proc +5 -2
- data/_includes/themes/j1/procedures/layouts/content_writer.proc +8 -9
- data/_includes/themes/j1/procedures/layouts/module_writer.proc +3 -13
- data/_includes/themes/j1/procedures/posts/collate_timeline.proc +14 -14
- data/_layouts/default.html +60 -59
- data/apps/public/cc/index.adoc +1 -5
- data/assets/data/authclient.html +48 -27
- data/assets/data/banner.html +23 -23
- data/assets/data/carousel.json +30 -21
- data/assets/data/cookiebar.html +277 -0
- data/assets/data/footer.html +14 -7
- data/assets/data/galleries.json +90 -81
- data/assets/data/gallery_customizer.html +21 -12
- data/assets/data/jupyter/notebooks/_html/template.full.head.html +10 -10
- data/assets/data/jupyter/notebooks/_html/visualisation.html +11 -11
- data/assets/data/jupyter/notebooks/html/template.html +7 -7
- data/assets/data/jupyter/notebooks/html/visualisation.ok.html +12 -12
- data/assets/data/jupyter/notebooks/visualisation.ipynb +1 -1
- data/assets/data/mdi_icons.json +55 -1
- data/assets/data/menu.html +16 -9
- data/assets/data/mmenu.html +48 -95
- data/assets/data/mmenu_sidebar.html +40 -44
- data/assets/data/mmenu_toc.html +20 -4
- data/assets/data/panel.html +44 -38
- data/assets/data/quicklinks.html +36 -20
- data/assets/data/search.json +165 -0
- data/assets/data/ssm.html +15 -4
- data/assets/data/themes.json +17 -6
- data/assets/data/twa_v1.json +54 -0
- data/assets/themes/j1/adapter/js/algolia.js +28 -17
- data/assets/themes/j1/adapter/js/attic.js +51 -40
- data/assets/themes/j1/adapter/js/carousel.js +27 -13
- data/assets/themes/j1/adapter/js/clipboard.js +232 -0
- data/assets/themes/j1/adapter/js/cookiebar.js +204 -0
- data/assets/themes/j1/adapter/js/framer.js +37 -21
- data/assets/themes/j1/adapter/js/gallery_customizer.js +230 -250
- data/assets/themes/j1/adapter/js/j1.js +563 -803
- data/assets/themes/j1/adapter/js/{justified_gallery.js → jf_gallery.js} +32 -22
- data/assets/themes/j1/adapter/js/lightbox.js +20 -10
- data/assets/themes/j1/adapter/js/logger.js +13 -6
- data/assets/themes/j1/adapter/js/mdb.js +164 -0
- data/assets/themes/j1/adapter/js/mmenu.js +60 -69
- data/assets/themes/j1/adapter/js/navigator.js +200 -169
- data/assets/themes/j1/adapter/js/searcher.js +30 -14
- data/assets/themes/j1/adapter/js/ssm.js +111 -88
- data/assets/themes/j1/adapter/js/themer.js +71 -103
- data/assets/themes/j1/adapter/js/toccer.js +30 -22
- data/assets/themes/j1/core/css/animate.css +2382 -0
- data/assets/themes/j1/core/css/animate.min.css +7 -0
- data/assets/themes/j1/core/css/fontawesome.css +4415 -0
- data/assets/themes/j1/core/css/fontawesome.min.css +1 -0
- data/assets/themes/j1/core/css/iconify-icons.css +4106 -0
- data/assets/themes/j1/core/css/iconify-icons.min.css +1 -0
- data/assets/themes/j1/core/css/material-design-icons.css +14532 -0
- data/assets/themes/j1/core/css/material-design-icons.min.css +1 -0
- data/assets/themes/j1/core/css/theme_extensions.css +326 -3004
- data/assets/themes/j1/core/css/theme_extensions.min.css +1 -1
- data/assets/themes/j1/core/css/twemoji.css +9485 -0
- data/assets/themes/j1/core/css/twemoji.min.css +1 -0
- data/assets/themes/j1/core/css/uno.css +453 -3039
- data/assets/themes/j1/core/css/uno.min.css +1 -1
- data/assets/themes/j1/core/css/vendor.css +884 -33335
- data/assets/themes/j1/core/css/vendor.min.css +2 -9
- data/assets/themes/j1/core/js/template.js +25 -416
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +1 -1
- data/assets/themes/j1/modules/backstretch/js/backstretch.js +1695 -0
- data/assets/themes/j1/modules/backstretch/js/backstretch.min.js +21 -0
- data/assets/themes/j1/modules/backstretch/js/backstretch.min.js.org +1 -0
- data/assets/themes/j1/modules/bmd/css/bootstrap-material-design.css +12177 -0
- data/assets/themes/j1/modules/bmd/css/bootstrap-material-design.min.css +8 -0
- data/assets/themes/j1/modules/bmd/js/bootstrap-material-design.js +6930 -0
- data/assets/themes/j1/modules/bmd/js/bootstrap-material-design.js.map +1 -0
- data/assets/themes/j1/modules/bmd/js/bootstrap-material-design.min.js +1 -0
- data/assets/themes/j1/modules/bootstrap/css/bootstrap.css +10278 -0
- data/assets/themes/j1/modules/bootstrap/css/bootstrap.css.map +1 -0
- data/assets/themes/j1/modules/bootstrap/css/bootstrap.min.css +7 -0
- data/assets/themes/j1/modules/bootstrap/css/bootstrap.min.css.map +1 -0
- data/assets/themes/j1/modules/bootstrap/js/bootstrap.js +4420 -0
- data/assets/themes/j1/modules/bootstrap/js/bootstrap.js.map +1 -0
- data/assets/themes/j1/modules/bootstrap/js/bootstrap.min.js +7 -0
- data/assets/themes/j1/modules/bootstrap/js/bootstrap.min.js.map +1 -0
- data/assets/themes/j1/modules/bsDatepicker/css/datepicker.css +203 -0
- data/assets/themes/j1/modules/bsDatepicker/css/theme/uno.css +235 -0
- data/assets/themes/j1/modules/bsDatepicker/js/datepicker.js +509 -0
- data/assets/themes/j1/modules/bsDatepicker/less/datepicker.less +122 -0
- data/assets/themes/j1/modules/bsThemeSwitcher/js/switcher.js +435 -0
- data/assets/themes/j1/modules/bsThemeSwitcher/js/switcher.min.js +20 -0
- data/assets/themes/j1/{extensions → modules}/carousel/css/carousel.css +1 -1
- data/assets/themes/j1/{extensions → modules}/carousel/css/carousel.min.css +1 -1
- data/assets/themes/j1/{extensions → modules}/carousel/css/carousel_transitions.css +1 -1
- data/assets/themes/j1/{extensions → modules}/carousel/css/carousel_transitions.min.css +1 -1
- data/assets/themes/j1/{extensions → modules}/carousel/css/theme/uno.css +1 -1
- data/assets/themes/j1/{extensions → modules}/carousel/css/theme/uno.min.css +1 -1
- data/assets/themes/j1/{extensions → modules}/carousel/images/ajax-loader.gif +0 -0
- data/assets/themes/j1/{extensions → modules}/carousel/images/grabbing.png +0 -0
- data/assets/themes/j1/{extensions → modules}/carousel/images/owl-logo.png +0 -0
- data/assets/themes/j1/{extensions → modules}/carousel/images/owl.video.play.png +0 -0
- data/assets/themes/j1/{extensions → modules}/carousel/js/carousel.js +0 -0
- data/assets/themes/j1/{extensions → modules}/carousel/js/carousel.min.js +0 -0
- data/assets/themes/j1/modules/clipboard/LICENSE +20 -0
- data/assets/themes/j1/modules/clipboard/css/theme/uno.css +52 -0
- data/assets/themes/j1/modules/clipboard/css/theme/uno.min.css +52 -0
- data/assets/themes/j1/modules/clipboard/js/clipboard.js +975 -0
- data/assets/themes/j1/modules/clipboard/js/clipboard.min.js +7 -0
- data/assets/themes/j1/{extensions/iconify → modules/iconifyAPI}/js/iconify.min.js +0 -0
- data/assets/themes/j1/modules/iframeResizer/LICENSE +21 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.absolute.html +127 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.content.html +157 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.hover.html +68 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +100 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.textarea.html +45 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.tolerance.html +113 -0
- data/assets/themes/j1/modules/iframeResizer/examples/index.html +83 -0
- data/assets/themes/j1/modules/iframeResizer/examples/two.html +88 -0
- data/assets/themes/j1/modules/iframeResizer/js/client/iframeResizer.contentWindow.js +1288 -0
- data/assets/themes/j1/modules/iframeResizer/js/client/iframeResizer.contentWindow.map +1 -0
- data/assets/themes/j1/modules/iframeResizer/js/client/iframeResizer.contentWindow.min.js +10 -0
- data/assets/themes/j1/modules/iframeResizer/js/iframeResizer.js +1390 -0
- data/assets/themes/j1/modules/iframeResizer/js/iframeResizer.map +1 -0
- data/assets/themes/j1/modules/iframeResizer/js/iframeResizer.min.js +9 -0
- data/assets/themes/j1/modules/jekyllSearch/js/simple-jekyll-search.js +468 -0
- data/assets/themes/j1/modules/jekyllSearch/js/simple-jekyll-search.min.js +6 -0
- data/assets/themes/j1/modules/jqMouseWheel/README.md +76 -0
- data/assets/themes/j1/modules/jqMouseWheel/js/jquery.mousewheel.js +221 -0
- data/assets/themes/j1/modules/jqMouseWheel/js/jquery.mousewheel.min.js +9 -0
- data/assets/themes/j1/modules/jquery/js/jquery.js +10869 -0
- data/assets/themes/j1/modules/jquery/js/jquery.min.js +2 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/LICENSE +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/README.md +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/css/justifiedGallery.css +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/css/justifiedGallery.min.css +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/css/theme/uno.css +1 -1
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/js/justifiedGallery.3.7.0.js +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/js/justifiedGallery.js +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/js/justifiedGallery.min.js +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/less/.csslintrc +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v3.7.0/less/justifiedGallery.less +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v4.0.0/css/justifiedGallery.css +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v4.0.0/css/justifiedGallery.min.css +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v4.0.0/css/theme/uno.css +1 -1
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v4.0.0/js/jquery.justifiedGallery.js +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/_versions/v4.0.0/js/jquery.justifiedGallery.min.js +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/css/justifiedGallery.css +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/css/justifiedGallery.min.css +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/css/theme/uno.css +1 -1
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/css/theme/uno.min.css +1 -1
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/js/justifiedGallery.js +0 -0
- data/assets/themes/j1/{extensions/justified_gallery → modules/justifiedGallery}/js/justifiedGallery.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/core/lg-fb-comment-box.css +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/core/lg-fb-comment-box.min.css +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/core/lg-transitions.css +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/core/lg-transitions.min.css +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/core/lightgallery.css +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/core/lightgallery.min.css +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/fonts/lg.eot +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/fonts/lg.svg +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/fonts/lg.ttf +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/fonts/lg.woff +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/img/loading.gif +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/img/video-play.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/img/vimeo-play.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/img/youtube-play.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/animation-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/customize-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/dynamic-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/facebook-icon.svg +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/googleplus-icon.svg +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/html5-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/linked-in.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/module-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/play-button.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/responsive-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/thumb-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/touch-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/twitter-icon.svg +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/twitter.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/video1-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/zoom-w.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/icons/zoom.png +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/uno.css +1 -1
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/css/themes/uno.min.css +1 -1
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/core/lightgallery.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/core/lightgallery.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/j1/j1-video.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/j1/j1-video.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-autoplay.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-autoplay.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-fullscreen.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-fullscreen.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-hash.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-hash.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-pager.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-pager.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-share.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-share.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-thumbnail.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-thumbnail.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-video.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-video.min.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-zoom.js +0 -0
- data/assets/themes/j1/{extensions/light_gallery → modules/lightGallery}/js/modules/lg-zoom.min.js +0 -0
- data/assets/themes/j1/modules/lightbox/LICENSE +22 -0
- data/assets/themes/j1/modules/lightbox/css/lightbox.css +224 -0
- data/assets/themes/j1/modules/lightbox/css/lightbox.min.css +21 -0
- data/assets/themes/j1/modules/lightbox/css/theme/uno.css +25 -0
- data/assets/themes/j1/modules/lightbox/css/theme/uno.min.css +26 -0
- data/assets/themes/j1/modules/lightbox/images/close.png +0 -0
- data/assets/themes/j1/modules/lightbox/images/loading.gif +0 -0
- data/assets/themes/j1/modules/lightbox/images/next.png +0 -0
- data/assets/themes/j1/modules/lightbox/images/prev.png +0 -0
- data/assets/themes/j1/modules/lightbox/js/lightbox.js +583 -0
- data/assets/themes/j1/modules/lightbox/js/lightbox.min.js +35 -0
- data/assets/themes/j1/modules/mmenuLight/css/mmenu.css +392 -0
- data/assets/themes/j1/modules/mmenuLight/css/mmenu.min.css +393 -0
- data/assets/themes/j1/modules/mmenuLight/css/theme/uno.css +178 -0
- data/assets/themes/j1/modules/mmenuLight/css/theme/uno.min.css +170 -0
- data/assets/themes/j1/modules/mmenuLight/js/mmenu.js +563 -0
- data/assets/themes/j1/modules/mmenuLight/js/mmenu.min.js +30 -0
- data/assets/themes/j1/modules/noUISlider/LICENSE +13 -0
- data/assets/themes/j1/modules/noUISlider/css/nouislider.css +260 -0
- data/assets/themes/j1/modules/noUISlider/css/nouislider.min.css +1 -0
- data/assets/themes/j1/modules/noUISlider/js/nouislider.js +2312 -0
- data/assets/themes/j1/modules/noUISlider/js/nouislider.min.js +3 -0
- data/assets/themes/j1/modules/polyfills/js/msie.js +140 -0
- data/assets/themes/j1/modules/popper/js/popper.js +2623 -0
- data/assets/themes/j1/modules/popper/js/popper.js.map +1 -0
- data/assets/themes/j1/modules/popper/js/popper.min.js +4 -0
- data/assets/themes/j1/modules/popper/js/popper.min.js.map +1 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.dark/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.light/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.monokai.dark/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.monokai.light/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.monokai/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.solarized.dark/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.solarized.light/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16.solarized/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/base16/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/colorful/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/github/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/gruvbox.dark/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/gruvbox.light/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/gruvbox/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/igorpro/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/molokai/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/monokai.sublime/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/monokai/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/pastie/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/thankful_eyes/theme.css +0 -0
- data/assets/themes/j1/{extensions → modules}/rouge/css/tulip/theme.css +0 -0
- data/assets/themes/j1/modules/tocbot/css/theme/uno.css +89 -0
- data/assets/themes/j1/modules/tocbot/css/theme/uno.min.css +89 -0
- data/assets/themes/j1/modules/tocbot/css/tocbot.css +75 -0
- data/assets/themes/j1/modules/tocbot/css/tocbot.min.css +19 -0
- data/assets/themes/j1/modules/tocbot/js/tocbot.js +19 -0
- data/assets/themes/j1/modules/tocbot/js/tocbot.min.js +19 -0
- data/assets/themes/j1/modules/twemoji/js/LICENSE +21 -0
- data/assets/themes/j1/modules/twemoji/js/picker/LICENSE +21 -0
- data/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.js +275 -0
- data/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.min.js +275 -0
- data/assets/themes/j1/modules/twemoji/js/twemoji.js +589 -0
- data/assets/themes/j1/modules/twemoji/js/twemoji.min.js +25 -0
- data/assets/themes/j1/modules/util/js/js.cookie.js +163 -0
- data/assets/themes/j1/modules/util/js/lite-url.js +203 -0
- data/assets/themes/j1/modules/util/js/lite-url.min.js +7 -0
- data/assets/themes/j1/{extensions/log4javascript/log4javascript.min.js → modules/util/js/log4javascript.js} +0 -2
- data/assets/themes/j1/modules/util/js/platform.js +1260 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/city.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/city.min.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/fantasy.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/fantasy.min.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/forest.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/forest.min.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/sea.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/themes/sea.min.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/video-js.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/css/video-js.min.css +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/js/video.js +0 -0
- data/assets/themes/j1/{extensions → modules}/videojs/js/video.min.js +0 -0
- data/assets/themes/j1/{extensions → modules}/vimeo/froogaloop/js/froogaloop2.min.js +0 -0
- data/assets/themes/j1/{extensions → modules}/vimeo/player/js/player.js +0 -0
- data/assets/themes/j1/{extensions → modules}/vimeo/player/js/player.js.map +0 -0
- data/assets/themes/j1/{extensions → modules}/vimeo/player/js/player.min.js +0 -0
- data/assets/themes/j1/{extensions → modules}/vimeo/player/js/player.min.js.map +0 -0
- data/lib/j1/version.rb +1 -1
- data/lib/j1_app/j1_auth_manager/views/auth_manager_ui.erb +391 -389
- data/lib/starter_web/Gemfile +22 -13
- data/lib/starter_web/_config.yml +9 -8
- data/lib/starter_web/_data/_defaults/resources.yml +13 -13
- data/lib/starter_web/_data/blocks/banner.yml +23 -31
- data/lib/starter_web/_data/blocks/footer.yml +10 -3
- data/lib/starter_web/_data/blocks/panel.yml +21 -21
- data/lib/starter_web/_data/layouts/default.yml +10 -0
- data/lib/starter_web/_data/layouts/home.yml +7 -7
- data/lib/starter_web/_data/layouts/page.yml +15 -16
- data/lib/starter_web/_data/modules/advertising.yml +48 -0
- data/lib/starter_web/_data/modules/attics.yml +2 -38
- data/lib/starter_web/_data/modules/cookiebar.yml +2 -2
- data/lib/starter_web/_data/modules/defaults/attics.yml +16 -15
- data/lib/starter_web/_data/modules/defaults/authentication.yml +8 -9
- data/lib/starter_web/_data/modules/defaults/cookie_consent.yml +75 -12
- data/lib/starter_web/_data/modules/defaults/cookiebar.yml +101 -50
- data/lib/starter_web/_data/modules/defaults/jekyll_search.yml +12 -9
- data/lib/starter_web/_data/modules/defaults/navigator.yml +57 -21
- data/lib/starter_web/_data/modules/jekyll_search.yml +1 -20
- data/lib/starter_web/_data/modules/navigator.yml +1 -1
- data/lib/starter_web/_data/modules/navigator_menu.yml +6 -7
- data/lib/starter_web/_data/modules/themer.yml +10 -11
- data/lib/starter_web/_data/resources.yml +379 -174
- data/lib/starter_web/_data/template_settings.yml +96 -4
- data/lib/starter_web/_data/utilities/util_srv.yml +1 -1
- data/lib/starter_web/_plugins/asciidoctor-extensions/banner.rb +43 -0
- data/lib/starter_web/_plugins/asciidoctor-extensions/fab-icon-inline.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor-extensions/fas-icon-inline.rb +2 -2
- data/lib/starter_web/_plugins/asciidoctor-extensions/iconify-icon-inline.rb +2 -2
- data/lib/starter_web/_plugins/asciidoctor-extensions/mdi-icon-inline.rb +2 -2
- data/lib/starter_web/_plugins/asciidoctor-extensions/panel.rb +43 -0
- data/lib/starter_web/_plugins/asciidoctor-extensions/twitter-emoji-inline.rb +2 -2
- data/lib/starter_web/_plugins/{asciidoctor-extensions/lorem-inline.rb → lorem-inline.rb} +0 -0
- data/lib/starter_web/_plugins/minifyJS.rb +54 -0
- data/lib/starter_web/_plugins/minifyJSON.rb +47 -0
- data/lib/starter_web/assets/images/pages/material/apple-touch-icon.png +0 -0
- data/lib/starter_web/assets/videos/headers/still/underground-broadway.webp +0 -0
- data/lib/starter_web/assets/videos/headers/still/victoria-oskolovich-on-vimeo.webp +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1-template.adoc.erb +3 -4
- data/lib/starter_web/collections/posts/public/featured/_posts/2018-05-01-confusion-about-base-url.adoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2019-05-01-top-open-source-static-site-generators.adoc +17 -17
- data/lib/starter_web/collections/posts/public/featured/_posts/2019-06-01-about-cookies.adoc +36 -40
- data/lib/starter_web/collections/posts/public/series/_posts/2018-11-01-docker-using-shared-folders.adoc +4 -6
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-20-minneapolis.adoc +1 -3
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc +3 -3
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-26-columbia-river.adoc +4 -4
- data/lib/starter_web/index.html +12 -13
- data/lib/starter_web/package.json +10 -10
- data/lib/starter_web/pages/{public → protected}/site_search.adoc +2 -2
- data/lib/starter_web/pages/public/blog/navigator/archive.html +24 -18
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +39 -34
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +43 -30
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +29 -29
- data/lib/starter_web/pages/public/blog/navigator/index.html +2 -2
- data/lib/starter_web/pages/public/learn/examples/floating_ad.adoc +221 -0
- data/lib/starter_web/pages/public/learn/examples/floating_div.adoc +33 -1
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/100_meet_and_greet_jekyll.adoc +1 -0
- data/lib/starter_web/pages/public/learn/roundtrip/000_bs_tour.1.asciidoc +1 -2
- data/lib/starter_web/pages/public/learn/roundtrip/000_bs_tour.adoc +1 -2
- data/lib/starter_web/pages/public/learn/roundtrip/000_bs_tour_api.adoc +16 -18
- data/lib/starter_web/pages/public/learn/roundtrip/000_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/000_includes/documents/419_advanced_modals_html.asciidoc +5 -5
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +7 -3
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +36 -45
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +9 -10
- data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +39 -39
- data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +20 -22
- data/lib/starter_web/pages/public/{previewer/mdb_preview → learn/roundtrip/510_mdb_preview}/000_includes/attributes.asciidoc +0 -0
- data/lib/starter_web/pages/public/{previewer/mdb_preview → learn/roundtrip/510_mdb_preview}/000_includes/documents/100_buttons.asciidoc +0 -0
- data/lib/starter_web/pages/public/{previewer/mdb_preview → learn/roundtrip/510_mdb_preview}/mdb_previewer.adoc +2 -2
- data/lib/starter_web/pages/public/learn/vtutorials/000_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/pages/public/learn/vtutorials/000_includes/documents/419_advanced_modals_html.asciidoc +5 -5
- data/lib/starter_web/pages/public/learn/whats_up.adoc +2 -2
- data/lib/starter_web/pages/public/previewer/bootstrap_theme.adoc +11 -13
- data/lib/starter_web/pages/public/previewer/iframer.adoc +17 -15
- data/lib/starter_web/pages/public/previewer/justified_gallery.html +2 -2
- data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +2 -2
- data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +3 -3
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +255 -165
- data/assets/data/colors.json +0 -42
- data/assets/data/cookie_consent.html +0 -223
- data/assets/data/font_sizes.json +0 -42
- data/assets/data/messages.yml +0 -131
- data/assets/data/search.yml +0 -153
- data/assets/themes/j1/adapter/js/cookie_consent.js +0 -277
- data/assets/themes/j1/core/css/custom.scss +0 -28
- data/assets/themes/j1/core/css/globals.css +0 -14523
- data/assets/themes/j1/core/css/globals.min.css +0 -1
- data/assets/themes/j1/core/css/uno.scss +0 -28
- data/assets/themes/j1/core/css/vendor.scss +0 -28
- data/assets/themes/j1/extensions/iframe_resizer/examples/frame.absolute.html +0 -86
- data/assets/themes/j1/extensions/iframe_resizer/examples/frame.content.html +0 -58
- data/assets/themes/j1/extensions/iframe_resizer/examples/frame.hover.html +0 -51
- data/assets/themes/j1/extensions/iframe_resizer/examples/frame.nested.html +0 -68
- data/assets/themes/j1/extensions/iframe_resizer/examples/frame.textarea.html +0 -46
- data/assets/themes/j1/extensions/iframe_resizer/examples/frame.tolerance.html +0 -79
- data/assets/themes/j1/extensions/iframe_resizer/examples/index.html +0 -70
- data/assets/themes/j1/extensions/iframe_resizer/examples/two.html +0 -71
- data/assets/themes/j1/extensions/iframe_resizer/js/client/iframeResizer.contentWindow.js +0 -1104
- data/assets/themes/j1/extensions/iframe_resizer/js/client/iframeResizer.contentWindow.map +0 -1
- data/assets/themes/j1/extensions/iframe_resizer/js/client/iframeResizer.contentWindow.min.js +0 -10
- data/assets/themes/j1/extensions/log4javascript/log4javascript.js +0 -5826
- data/lib/starter_web/_data/modules/cookie_consent.yml +0 -128
- data/lib/starter_web/assets/videos/headers/still/underground-broadway.png +0 -0
- data/lib/starter_web/assets/videos/headers/still/victoria-oskolovich-on-vimeo.png +0 -0
- data/lib/starter_web/pages/public/clear_button.adoc +0 -121
@@ -0,0 +1,3 @@
|
|
1
|
+
/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */
|
2
|
+
|
3
|
+
!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+_+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+_+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d<e.length;d++)A(e[d][1],e[d][0],this);for(this.xNumSteps=this.xSteps.slice(0),d=0;d<this.xNumSteps.length;d++)B(d,this.xNumSteps[d],this)}function D(b){if(a(b))return!0;throw new Error("noUiSlider ("+_+"): 'format' requires 'to' and 'from' methods.")}function E(a,b){if(!g(b))throw new Error("noUiSlider ("+_+"): 'step' is not numeric.");a.singleStep=b}function F(a,b){if("object"!=typeof b||Array.isArray(b))throw new Error("noUiSlider ("+_+"): 'range' is not an object.");if(void 0===b.min||void 0===b.max)throw new Error("noUiSlider ("+_+"): Missing 'min' or 'max' in 'range'.");if(b.min===b.max)throw new Error("noUiSlider ("+_+"): 'range' 'min' and 'max' cannot be equal.");a.spectrum=new C(b,a.snap,a.singleStep)}function G(a,b){if(b=j(b),!Array.isArray(b)||!b.length)throw new Error("noUiSlider ("+_+"): 'start' option is incorrect.");a.handles=b.length,a.start=b}function H(a,b){if(a.snap=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'snap' option must be a boolean.")}function I(a,b){if(a.animate=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'animate' option must be a boolean.")}function J(a,b){if(a.animationDuration=b,"number"!=typeof b)throw new Error("noUiSlider ("+_+"): 'animationDuration' option must be a number.")}function K(a,b){var c,d=[!1];if("lower"===b?b=[!0,!1]:"upper"===b&&(b=[!1,!0]),!0===b||!1===b){for(c=1;c<a.handles;c++)d.push(b);d.push(!1)}else{if(!Array.isArray(b)||!b.length||b.length!==a.handles+1)throw new Error("noUiSlider ("+_+"): 'connect' option doesn't match handle count.");d=b}a.connect=d}function L(a,b){switch(b){case"horizontal":a.ort=0;break;case"vertical":a.ort=1;break;default:throw new Error("noUiSlider ("+_+"): 'orientation' option is invalid.")}}function M(a,b){if(!g(b))throw new Error("noUiSlider ("+_+"): 'margin' option must be numeric.");if(0!==b&&(a.margin=a.spectrum.getMargin(b),!a.margin))throw new Error("noUiSlider ("+_+"): 'margin' option is only supported on linear sliders.")}function N(a,b){if(!g(b))throw new Error("noUiSlider ("+_+"): 'limit' option must be numeric.");if(a.limit=a.spectrum.getMargin(b),!a.limit||a.handles<2)throw new Error("noUiSlider ("+_+"): 'limit' option is only supported on linear sliders with 2 or more handles.")}function O(a,b){if(!g(b))throw new Error("noUiSlider ("+_+"): 'padding' option must be numeric.");if(0!==b){if(a.padding=a.spectrum.getMargin(b),!a.padding)throw new Error("noUiSlider ("+_+"): 'padding' option is only supported on linear sliders.");if(a.padding<0)throw new Error("noUiSlider ("+_+"): 'padding' option must be a positive number.");if(a.padding>=50)throw new Error("noUiSlider ("+_+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+_+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+_+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+_+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(a.multitouch=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'multitouch' option must be a boolean.")}function S(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c<a.handles;c++)a.tooltips.push(!0)}else{if(a.tooltips=j(b),a.tooltips.length!==a.handles)throw new Error("noUiSlider ("+_+"): must pass a formatter for all handles.");a.tooltips.forEach(function(a){if("boolean"!=typeof a&&("object"!=typeof a||"function"!=typeof a.to))throw new Error("noUiSlider ("+_+"): 'tooltips' must be passed a formatter or 'false'.")})}}function T(a,b){a.ariaFormat=b,D(b)}function U(a,b){a.format=b,D(b)}function V(a,b){if(void 0!==b&&"string"!=typeof b&&!1!==b)throw new Error("noUiSlider ("+_+"): 'cssPrefix' must be a string or `false`.");a.cssPrefix=b}function W(a,b){if(void 0!==b&&"object"!=typeof b)throw new Error("noUiSlider ("+_+"): 'cssClasses' must be an object.");if("string"==typeof a.cssPrefix){a.cssClasses={};for(var c in b)b.hasOwnProperty(c)&&(a.cssClasses[c]=a.cssPrefix+b[c])}else a.cssClasses=b}function X(a,b){if(!0!==b&&!1!==b)throw new Error("noUiSlider ("+_+"): 'useRequestAnimationFrame' option should be true (default) or false.");a.useRequestAnimationFrame=b}function Y(a){var b={margin:0,limit:0,padding:0,animate:!0,animationDuration:300,ariaFormat:aa,format:aa},c={step:{r:!1,t:E},start:{r:!0,t:G},connect:{r:!0,t:K},direction:{r:!0,t:P},snap:{r:!1,t:H},animate:{r:!1,t:I},animationDuration:{r:!1,t:J},range:{r:!0,t:F},orientation:{r:!1,t:L},margin:{r:!1,t:M},limit:{r:!1,t:N},padding:{r:!1,t:O},behaviour:{r:!0,t:Q},multitouch:{r:!0,t:R},ariaFormat:{r:!1,t:T},format:{r:!1,t:U},tooltips:{r:!1,t:S},cssPrefix:{r:!1,t:V},cssClasses:{r:!1,t:W},useRequestAnimationFrame:{r:!1,t:X}},d={connect:!1,direction:"ltr",behaviour:"tap",multitouch:!1,orientation:"horizontal",cssPrefix:"noUi-",cssClasses:{target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",ltr:"ltr",rtl:"rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"},useRequestAnimationFrame:!0};a.format&&!a.ariaFormat&&(a.ariaFormat=a.format),Object.keys(c).forEach(function(e){if(void 0===a[e]&&void 0===d[e]){if(c[e].r)throw new Error("noUiSlider ("+_+"): '"+e+"' is required.");return!0}c[e].t(b,void 0===a[e]?d[e]:a[e])}),b.pips=a.pips;var e=[["left","top"],["right","bottom"]];return b.style=e[b.dir][b.ort],b.styleOposite=e[b.dir?0:1][b.ort],b}function Z(a,e,g){function k(a,b){var c=wa.createElement("div");return b&&l(c,b),a.appendChild(c),c}function s(a,b){var c=k(a,e.cssClasses.origin),d=k(c,e.cssClasses.handle);return d.setAttribute("data-handle",b),d.setAttribute("tabindex","0"),d.setAttribute("role","slider"),d.setAttribute("aria-orientation",e.ort?"vertical":"horizontal"),0===b?l(d,e.cssClasses.handleLower):b===e.handles-1&&l(d,e.cssClasses.handleUpper),c}function t(a,b){return!!b&&k(a,e.cssClasses.connect)}function u(a,b){ia=[],ja=[],ja.push(t(b,a[0]));for(var c=0;c<e.handles;c++)ia.push(s(b,c)),ra[c]=c,ja.push(t(b,a[c+1]))}function v(a){l(a,e.cssClasses.target),0===e.dir?l(a,e.cssClasses.ltr):l(a,e.cssClasses.rtl),0===e.ort?l(a,e.cssClasses.horizontal):l(a,e.cssClasses.vertical),ha=k(a,e.cssClasses.base)}function w(a,b){return!!e.tooltips[b]&&k(a.firstChild,e.cssClasses.tooltip)}function x(){var a=ia.map(w);ea("update",function(b,c,d){if(a[c]){var f=b[c];!0!==e.tooltips[c]&&(f=e.tooltips[c].to(d[c])),a[c].innerHTML=f}})}function y(){ea("update",function(a,b,c,d,f){ra.forEach(function(a){var b=ia[a],d=S(qa,a,0,!0,!0,!0),g=S(qa,a,100,!0,!0,!0),h=f[a],i=e.ariaFormat.to(c[a]);b.children[0].setAttribute("aria-valuemin",d.toFixed(1)),b.children[0].setAttribute("aria-valuemax",g.toFixed(1)),b.children[0].setAttribute("aria-valuenow",h.toFixed(1)),b.children[0].setAttribute("aria-valuetext",i)})})}function z(a,b,c){if("range"===a||"steps"===a)return ta.xVal;if("count"===a){if(!b)throw new Error("noUiSlider ("+_+"): 'values' required for mode 'count'.");var d,e=100/(b-1),f=0;for(b=[];(d=f++*e)<=100;)b.push(d);a="positions"}return"positions"===a?b.map(function(a){return ta.fromStepping(c?ta.getStep(a):a)}):"values"===a?c?b.map(function(a){return ta.fromStepping(ta.getStep(ta.toStepping(a)))}):b:void 0}function A(a,b,c){function e(a,b){return(a+b).toFixed(7)/1}var f={},g=ta.xVal[0],h=ta.xVal[ta.xVal.length-1],i=!1,j=!1,k=0;return c=d(c.slice().sort(function(a,b){return a-b})),c[0]!==g&&(c.unshift(g),i=!0),c[c.length-1]!==h&&(c.push(h),j=!0),c.forEach(function(d,g){var h,l,m,n,o,p,q,r,s,t,u=d,v=c[g+1];if("steps"===b&&(h=ta.xNumSteps[g]),h||(h=v-u),!1!==u&&void 0!==v)for(h=Math.max(h,1e-7),l=u;l<=v;l=e(l,h)){for(n=ta.toStepping(l),o=n-k,r=o/a,s=Math.round(r),t=o/s,m=1;m<=s;m+=1)p=k+m*t,f[p.toFixed(5)]=["x",0];q=c.indexOf(l)>-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=wa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(f){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(f=G(f,d.pageOffset,d.target||b))&&(!(a===ma.start&&void 0!==f.buttons&&f.buttons>1)&&((!d.hover||!f.buttons)&&(oa||f.preventDefault(),f.calcPoint=f.points[e.ort],void c(f,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b,c){var d,f,g=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),i=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(i=!0),g&&e.multitouch){var j=function(a){return a.target===c||c.contains(a.target)};if("touchstart"===a.type){var k=Array.prototype.filter.call(a.touches,j);if(k.length>1)return!1;d=k[0].pageX,f=k[0].pageY}else{var l=Array.prototype.find.call(a.changedTouches,j);if(!l)return!1;d=l.pageX,f=l.pageY}}else if(g){if(a.touches.length>1)return!1;d=a.changedTouches[0].pageX,f=a.changedTouches[0].pageY}return b=b||o(wa),(h||i)&&(d=a.clientX+b.x,f=a.clientY+b.y),a.pageOffset=b,a.points=[d,f],a.cursor=h||i,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f<b&&(c=e,b=f)}}),c}function J(a,b,c,d){var e=c.slice(),f=[!a,a],g=[a,!a];d=d.slice(),a&&d.reverse(),d.length>1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){b.handle&&(m(b.handle,e.cssClasses.active),sa-=1),b.listeners.forEach(function(a){xa.removeEventListener(a[0],a[1])}),0===sa&&(m(pa,e.cssClasses.drag),V(),a.cursor&&(ya.style.cursor="",ya.removeEventListener("selectstart",c))),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){var d;if(1===b.handleNumbers.length){var f=ia[b.handleNumbers[0]];if(f.hasAttribute("disabled"))return!1;d=f.children[0],sa+=1,l(d,e.cssClasses.active)}a.stopPropagation();var g=[],h=F(ma.move,xa,M,{target:a.target,handle:d,listeners:g,startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),i=F(ma.end,xa,N,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers}),j=F("mouseout",xa,L,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers});g.push.apply(g,h.concat(i,j)),a.cursor&&(ya.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),ya.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b<ia.length-1&&(c=Math.min(c,a[b+1]-e.margin))),ia.length>1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b<ia.length-1&&(c=Math.max(c,a[b+1]-e.limit))),e.padding&&(0===b&&(c=Math.max(c,e.padding)),b===ia.length-1&&(c=Math.min(c,100-e.padding))),c=ta.getStep(c),!((c=i(c))===a[b]&&!g)&&c}function T(a){return a+"%"}function U(a,b){qa[a]=b,ua[a]=ta.fromStepping(b);var c=function(){ia[a].style[e.style]=T(b),X(a),X(a+1)};window.requestAnimationFrame&&e.useRequestAnimationFrame?window.requestAnimationFrame(c):c()}function V(){ra.forEach(function(a){var b=qa[a]>50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function X(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function $(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){$(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=Y(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],$(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=0,ta=e.spectrum,ua=[],va={},wa=a.ownerDocument,xa=wa.documentElement,ya=wa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+_+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:$,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),$(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function $(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+_+"): create requires a single element, got: "+a);var c=Y(b,a),d=Z(a,c,b);return a.noUiSlider=d,d}var _="10.1.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+_+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var aa={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:_,create:$}});
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/*
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# ~/assets/themes/j1/modules/polyfills/js/msie.js
|
4
|
+
# Provides JavaScript Polyfills for Internet Explorer 10 and 11
|
5
|
+
#
|
6
|
+
# Product/Info:
|
7
|
+
# http://jekyll.one
|
8
|
+
#
|
9
|
+
# Copyright (C) 2020 Juergen Adams
|
10
|
+
# Copyright (C) 2005–2020 Mozilla and Contributors
|
11
|
+
#
|
12
|
+
# J1 Template is licensed under MIT License.
|
13
|
+
# See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
|
14
|
+
# -----------------------------------------------------------------------------
|
15
|
+
*/
|
16
|
+
|
17
|
+
/*!
|
18
|
+
* MS Polyfills
|
19
|
+
* Copyright (C) 2005–2020 Mozilla and Contributors
|
20
|
+
* Licensed under MIT License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
// Source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
|
24
|
+
if (window.NodeList && !NodeList.prototype.forEach) {
|
25
|
+
NodeList.prototype.forEach = function(callback, thisArg) {
|
26
|
+
thisArg = thisArg || window;
|
27
|
+
for (var i = 0; i < this.length; i++) {
|
28
|
+
callback.call(thisArg, this[i], i, this);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
// Source: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
34
|
+
if (!Element.prototype.matches) {
|
35
|
+
Element.prototype.matches =
|
36
|
+
Element.prototype.matchesSelector ||
|
37
|
+
Element.prototype.mozMatchesSelector ||
|
38
|
+
Element.prototype.msMatchesSelector ||
|
39
|
+
Element.prototype.oMatchesSelector ||
|
40
|
+
Element.prototype.webkitMatchesSelector ||
|
41
|
+
function(s) {
|
42
|
+
var matches = (
|
43
|
+
this.document || this.ownerDocument
|
44
|
+
).querySelectorAll(s),
|
45
|
+
i = matches.length;
|
46
|
+
while (--i >= 0 && matches.item(i) !== this) {}
|
47
|
+
return i > -1;
|
48
|
+
};
|
49
|
+
}
|
50
|
+
|
51
|
+
// Source: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
|
52
|
+
if (!Element.prototype.matches) {
|
53
|
+
Element.prototype.matches =
|
54
|
+
Element.prototype.msMatchesSelector ||
|
55
|
+
Element.prototype.webkitMatchesSelector;
|
56
|
+
}
|
57
|
+
|
58
|
+
if (!Element.prototype.closest) {
|
59
|
+
Element.prototype.closest = function(s) {
|
60
|
+
var el = this;
|
61
|
+
|
62
|
+
do {
|
63
|
+
if (el.matches(s)) return el;
|
64
|
+
el = el.parentElement || el.parentNode;
|
65
|
+
} while (el !== null && el.nodeType === 1);
|
66
|
+
return null;
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
// from: https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/after()/after().md
|
71
|
+
(function(arr) {
|
72
|
+
arr.forEach(function(item) {
|
73
|
+
if (item.hasOwnProperty('after')) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
Object.defineProperty(item, 'after', {
|
77
|
+
configurable: true,
|
78
|
+
enumerable: true,
|
79
|
+
writable: true,
|
80
|
+
value: function after() {
|
81
|
+
var argArr = Array.prototype.slice.call(arguments),
|
82
|
+
docFrag = document.createDocumentFragment();
|
83
|
+
|
84
|
+
argArr.forEach(function(argItem) {
|
85
|
+
var isNode = argItem instanceof Node;
|
86
|
+
docFrag.appendChild(
|
87
|
+
isNode
|
88
|
+
? argItem
|
89
|
+
: document.createTextNode(String(argItem))
|
90
|
+
);
|
91
|
+
});
|
92
|
+
|
93
|
+
this.parentNode.insertBefore(docFrag, this.nextSibling);
|
94
|
+
}
|
95
|
+
});
|
96
|
+
});
|
97
|
+
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
|
98
|
+
|
99
|
+
// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/append()/append().md
|
100
|
+
(function(arr) {
|
101
|
+
arr.forEach(function(item) {
|
102
|
+
if (item.hasOwnProperty('append')) {
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
Object.defineProperty(item, 'append', {
|
106
|
+
configurable: true,
|
107
|
+
enumerable: true,
|
108
|
+
writable: true,
|
109
|
+
value: function append() {
|
110
|
+
var argArr = Array.prototype.slice.call(arguments),
|
111
|
+
docFrag = document.createDocumentFragment();
|
112
|
+
|
113
|
+
argArr.forEach(function(argItem) {
|
114
|
+
var isNode = argItem instanceof Node;
|
115
|
+
docFrag.appendChild(
|
116
|
+
isNode
|
117
|
+
? argItem
|
118
|
+
: document.createTextNode(String(argItem))
|
119
|
+
);
|
120
|
+
});
|
121
|
+
|
122
|
+
this.appendChild(docFrag);
|
123
|
+
}
|
124
|
+
});
|
125
|
+
});
|
126
|
+
})([Element.prototype, Document.prototype, DocumentFragment.prototype]);
|
127
|
+
|
128
|
+
// from: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
129
|
+
(function() {
|
130
|
+
if (typeof window.Event === 'function') return false;
|
131
|
+
|
132
|
+
function Event(event, params) {
|
133
|
+
params = params || { bubbles: false, cancelable: false };
|
134
|
+
var evt = document.createEvent('Event');
|
135
|
+
evt.initEvent(event, params.bubbles, params.cancelable);
|
136
|
+
return evt;
|
137
|
+
}
|
138
|
+
|
139
|
+
window.Event = Event;
|
140
|
+
})();
|
@@ -0,0 +1,2623 @@
|
|
1
|
+
/**!
|
2
|
+
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
3
|
+
* @version 1.16.1
|
4
|
+
* @license
|
5
|
+
* Copyright (c) 2016 Federico Zivolo and contributors
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
15
|
+
* copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
* SOFTWARE.
|
24
|
+
*/
|
25
|
+
(function (global, factory) {
|
26
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
27
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
28
|
+
(global.Popper = factory());
|
29
|
+
}(this, (function () { 'use strict';
|
30
|
+
|
31
|
+
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
|
32
|
+
|
33
|
+
var timeoutDuration = function () {
|
34
|
+
var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
|
35
|
+
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
|
36
|
+
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
|
37
|
+
return 1;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return 0;
|
41
|
+
}();
|
42
|
+
|
43
|
+
function microtaskDebounce(fn) {
|
44
|
+
var called = false;
|
45
|
+
return function () {
|
46
|
+
if (called) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
called = true;
|
50
|
+
window.Promise.resolve().then(function () {
|
51
|
+
called = false;
|
52
|
+
fn();
|
53
|
+
});
|
54
|
+
};
|
55
|
+
}
|
56
|
+
|
57
|
+
function taskDebounce(fn) {
|
58
|
+
var scheduled = false;
|
59
|
+
return function () {
|
60
|
+
if (!scheduled) {
|
61
|
+
scheduled = true;
|
62
|
+
setTimeout(function () {
|
63
|
+
scheduled = false;
|
64
|
+
fn();
|
65
|
+
}, timeoutDuration);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
var supportsMicroTasks = isBrowser && window.Promise;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Create a debounced version of a method, that's asynchronously deferred
|
74
|
+
* but called in the minimum time possible.
|
75
|
+
*
|
76
|
+
* @method
|
77
|
+
* @memberof Popper.Utils
|
78
|
+
* @argument {Function} fn
|
79
|
+
* @returns {Function}
|
80
|
+
*/
|
81
|
+
var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Check if the given variable is a function
|
85
|
+
* @method
|
86
|
+
* @memberof Popper.Utils
|
87
|
+
* @argument {Any} functionToCheck - variable to check
|
88
|
+
* @returns {Boolean} answer to: is a function?
|
89
|
+
*/
|
90
|
+
function isFunction(functionToCheck) {
|
91
|
+
var getType = {};
|
92
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Get CSS computed property of the given element
|
97
|
+
* @method
|
98
|
+
* @memberof Popper.Utils
|
99
|
+
* @argument {Eement} element
|
100
|
+
* @argument {String} property
|
101
|
+
*/
|
102
|
+
function getStyleComputedProperty(element, property) {
|
103
|
+
if (element.nodeType !== 1) {
|
104
|
+
return [];
|
105
|
+
}
|
106
|
+
// NOTE: 1 DOM access here
|
107
|
+
var window = element.ownerDocument.defaultView;
|
108
|
+
var css = window.getComputedStyle(element, null);
|
109
|
+
return property ? css[property] : css;
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Returns the parentNode or the host of the element
|
114
|
+
* @method
|
115
|
+
* @memberof Popper.Utils
|
116
|
+
* @argument {Element} element
|
117
|
+
* @returns {Element} parent
|
118
|
+
*/
|
119
|
+
function getParentNode(element) {
|
120
|
+
if (element.nodeName === 'HTML') {
|
121
|
+
return element;
|
122
|
+
}
|
123
|
+
return element.parentNode || element.host;
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Returns the scrolling parent of the given element
|
128
|
+
* @method
|
129
|
+
* @memberof Popper.Utils
|
130
|
+
* @argument {Element} element
|
131
|
+
* @returns {Element} scroll parent
|
132
|
+
*/
|
133
|
+
function getScrollParent(element) {
|
134
|
+
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
|
135
|
+
if (!element) {
|
136
|
+
return document.body;
|
137
|
+
}
|
138
|
+
|
139
|
+
switch (element.nodeName) {
|
140
|
+
case 'HTML':
|
141
|
+
case 'BODY':
|
142
|
+
return element.ownerDocument.body;
|
143
|
+
case '#document':
|
144
|
+
return element.body;
|
145
|
+
}
|
146
|
+
|
147
|
+
// Firefox want us to check `-x` and `-y` variations as well
|
148
|
+
|
149
|
+
var _getStyleComputedProp = getStyleComputedProperty(element),
|
150
|
+
overflow = _getStyleComputedProp.overflow,
|
151
|
+
overflowX = _getStyleComputedProp.overflowX,
|
152
|
+
overflowY = _getStyleComputedProp.overflowY;
|
153
|
+
|
154
|
+
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
155
|
+
return element;
|
156
|
+
}
|
157
|
+
|
158
|
+
return getScrollParent(getParentNode(element));
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Returns the reference node of the reference object, or the reference object itself.
|
163
|
+
* @method
|
164
|
+
* @memberof Popper.Utils
|
165
|
+
* @param {Element|Object} reference - the reference element (the popper will be relative to this)
|
166
|
+
* @returns {Element} parent
|
167
|
+
*/
|
168
|
+
function getReferenceNode(reference) {
|
169
|
+
return reference && reference.referenceNode ? reference.referenceNode : reference;
|
170
|
+
}
|
171
|
+
|
172
|
+
var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
|
173
|
+
var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Determines if the browser is Internet Explorer
|
177
|
+
* @method
|
178
|
+
* @memberof Popper.Utils
|
179
|
+
* @param {Number} version to check
|
180
|
+
* @returns {Boolean} isIE
|
181
|
+
*/
|
182
|
+
function isIE(version) {
|
183
|
+
if (version === 11) {
|
184
|
+
return isIE11;
|
185
|
+
}
|
186
|
+
if (version === 10) {
|
187
|
+
return isIE10;
|
188
|
+
}
|
189
|
+
return isIE11 || isIE10;
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Returns the offset parent of the given element
|
194
|
+
* @method
|
195
|
+
* @memberof Popper.Utils
|
196
|
+
* @argument {Element} element
|
197
|
+
* @returns {Element} offset parent
|
198
|
+
*/
|
199
|
+
function getOffsetParent(element) {
|
200
|
+
if (!element) {
|
201
|
+
return document.documentElement;
|
202
|
+
}
|
203
|
+
|
204
|
+
var noOffsetParent = isIE(10) ? document.body : null;
|
205
|
+
|
206
|
+
// NOTE: 1 DOM access here
|
207
|
+
var offsetParent = element.offsetParent || null;
|
208
|
+
// Skip hidden elements which don't have an offsetParent
|
209
|
+
while (offsetParent === noOffsetParent && element.nextElementSibling) {
|
210
|
+
offsetParent = (element = element.nextElementSibling).offsetParent;
|
211
|
+
}
|
212
|
+
|
213
|
+
var nodeName = offsetParent && offsetParent.nodeName;
|
214
|
+
|
215
|
+
if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
|
216
|
+
return element ? element.ownerDocument.documentElement : document.documentElement;
|
217
|
+
}
|
218
|
+
|
219
|
+
// .offsetParent will return the closest TH, TD or TABLE in case
|
220
|
+
// no offsetParent is present, I hate this job...
|
221
|
+
if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
|
222
|
+
return getOffsetParent(offsetParent);
|
223
|
+
}
|
224
|
+
|
225
|
+
return offsetParent;
|
226
|
+
}
|
227
|
+
|
228
|
+
function isOffsetContainer(element) {
|
229
|
+
var nodeName = element.nodeName;
|
230
|
+
|
231
|
+
if (nodeName === 'BODY') {
|
232
|
+
return false;
|
233
|
+
}
|
234
|
+
return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
|
235
|
+
}
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Finds the root node (document, shadowDOM root) of the given element
|
239
|
+
* @method
|
240
|
+
* @memberof Popper.Utils
|
241
|
+
* @argument {Element} node
|
242
|
+
* @returns {Element} root node
|
243
|
+
*/
|
244
|
+
function getRoot(node) {
|
245
|
+
if (node.parentNode !== null) {
|
246
|
+
return getRoot(node.parentNode);
|
247
|
+
}
|
248
|
+
|
249
|
+
return node;
|
250
|
+
}
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Finds the offset parent common to the two provided nodes
|
254
|
+
* @method
|
255
|
+
* @memberof Popper.Utils
|
256
|
+
* @argument {Element} element1
|
257
|
+
* @argument {Element} element2
|
258
|
+
* @returns {Element} common offset parent
|
259
|
+
*/
|
260
|
+
function findCommonOffsetParent(element1, element2) {
|
261
|
+
// This check is needed to avoid errors in case one of the elements isn't defined for any reason
|
262
|
+
if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
|
263
|
+
return document.documentElement;
|
264
|
+
}
|
265
|
+
|
266
|
+
// Here we make sure to give as "start" the element that comes first in the DOM
|
267
|
+
var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
|
268
|
+
var start = order ? element1 : element2;
|
269
|
+
var end = order ? element2 : element1;
|
270
|
+
|
271
|
+
// Get common ancestor container
|
272
|
+
var range = document.createRange();
|
273
|
+
range.setStart(start, 0);
|
274
|
+
range.setEnd(end, 0);
|
275
|
+
var commonAncestorContainer = range.commonAncestorContainer;
|
276
|
+
|
277
|
+
// Both nodes are inside #document
|
278
|
+
|
279
|
+
if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
|
280
|
+
if (isOffsetContainer(commonAncestorContainer)) {
|
281
|
+
return commonAncestorContainer;
|
282
|
+
}
|
283
|
+
|
284
|
+
return getOffsetParent(commonAncestorContainer);
|
285
|
+
}
|
286
|
+
|
287
|
+
// one of the nodes is inside shadowDOM, find which one
|
288
|
+
var element1root = getRoot(element1);
|
289
|
+
if (element1root.host) {
|
290
|
+
return findCommonOffsetParent(element1root.host, element2);
|
291
|
+
} else {
|
292
|
+
return findCommonOffsetParent(element1, getRoot(element2).host);
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Gets the scroll value of the given element in the given side (top and left)
|
298
|
+
* @method
|
299
|
+
* @memberof Popper.Utils
|
300
|
+
* @argument {Element} element
|
301
|
+
* @argument {String} side `top` or `left`
|
302
|
+
* @returns {number} amount of scrolled pixels
|
303
|
+
*/
|
304
|
+
function getScroll(element) {
|
305
|
+
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
306
|
+
|
307
|
+
var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
|
308
|
+
var nodeName = element.nodeName;
|
309
|
+
|
310
|
+
if (nodeName === 'BODY' || nodeName === 'HTML') {
|
311
|
+
var html = element.ownerDocument.documentElement;
|
312
|
+
var scrollingElement = element.ownerDocument.scrollingElement || html;
|
313
|
+
return scrollingElement[upperSide];
|
314
|
+
}
|
315
|
+
|
316
|
+
return element[upperSide];
|
317
|
+
}
|
318
|
+
|
319
|
+
/*
|
320
|
+
* Sum or subtract the element scroll values (left and top) from a given rect object
|
321
|
+
* @method
|
322
|
+
* @memberof Popper.Utils
|
323
|
+
* @param {Object} rect - Rect object you want to change
|
324
|
+
* @param {HTMLElement} element - The element from the function reads the scroll values
|
325
|
+
* @param {Boolean} subtract - set to true if you want to subtract the scroll values
|
326
|
+
* @return {Object} rect - The modifier rect object
|
327
|
+
*/
|
328
|
+
function includeScroll(rect, element) {
|
329
|
+
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
330
|
+
|
331
|
+
var scrollTop = getScroll(element, 'top');
|
332
|
+
var scrollLeft = getScroll(element, 'left');
|
333
|
+
var modifier = subtract ? -1 : 1;
|
334
|
+
rect.top += scrollTop * modifier;
|
335
|
+
rect.bottom += scrollTop * modifier;
|
336
|
+
rect.left += scrollLeft * modifier;
|
337
|
+
rect.right += scrollLeft * modifier;
|
338
|
+
return rect;
|
339
|
+
}
|
340
|
+
|
341
|
+
/*
|
342
|
+
* Helper to detect borders of a given element
|
343
|
+
* @method
|
344
|
+
* @memberof Popper.Utils
|
345
|
+
* @param {CSSStyleDeclaration} styles
|
346
|
+
* Result of `getStyleComputedProperty` on the given element
|
347
|
+
* @param {String} axis - `x` or `y`
|
348
|
+
* @return {number} borders - The borders size of the given axis
|
349
|
+
*/
|
350
|
+
|
351
|
+
function getBordersSize(styles, axis) {
|
352
|
+
var sideA = axis === 'x' ? 'Left' : 'Top';
|
353
|
+
var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
|
354
|
+
|
355
|
+
return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
|
356
|
+
}
|
357
|
+
|
358
|
+
function getSize(axis, body, html, computedStyle) {
|
359
|
+
return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
|
360
|
+
}
|
361
|
+
|
362
|
+
function getWindowSizes(document) {
|
363
|
+
var body = document.body;
|
364
|
+
var html = document.documentElement;
|
365
|
+
var computedStyle = isIE(10) && getComputedStyle(html);
|
366
|
+
|
367
|
+
return {
|
368
|
+
height: getSize('Height', body, html, computedStyle),
|
369
|
+
width: getSize('Width', body, html, computedStyle)
|
370
|
+
};
|
371
|
+
}
|
372
|
+
|
373
|
+
var classCallCheck = function (instance, Constructor) {
|
374
|
+
if (!(instance instanceof Constructor)) {
|
375
|
+
throw new TypeError("Cannot call a class as a function");
|
376
|
+
}
|
377
|
+
};
|
378
|
+
|
379
|
+
var createClass = function () {
|
380
|
+
function defineProperties(target, props) {
|
381
|
+
for (var i = 0; i < props.length; i++) {
|
382
|
+
var descriptor = props[i];
|
383
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
384
|
+
descriptor.configurable = true;
|
385
|
+
if ("value" in descriptor) descriptor.writable = true;
|
386
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
390
|
+
return function (Constructor, protoProps, staticProps) {
|
391
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
392
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
393
|
+
return Constructor;
|
394
|
+
};
|
395
|
+
}();
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
var defineProperty = function (obj, key, value) {
|
402
|
+
if (key in obj) {
|
403
|
+
Object.defineProperty(obj, key, {
|
404
|
+
value: value,
|
405
|
+
enumerable: true,
|
406
|
+
configurable: true,
|
407
|
+
writable: true
|
408
|
+
});
|
409
|
+
} else {
|
410
|
+
obj[key] = value;
|
411
|
+
}
|
412
|
+
|
413
|
+
return obj;
|
414
|
+
};
|
415
|
+
|
416
|
+
var _extends = Object.assign || function (target) {
|
417
|
+
for (var i = 1; i < arguments.length; i++) {
|
418
|
+
var source = arguments[i];
|
419
|
+
|
420
|
+
for (var key in source) {
|
421
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
422
|
+
target[key] = source[key];
|
423
|
+
}
|
424
|
+
}
|
425
|
+
}
|
426
|
+
|
427
|
+
return target;
|
428
|
+
};
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Given element offsets, generate an output similar to getBoundingClientRect
|
432
|
+
* @method
|
433
|
+
* @memberof Popper.Utils
|
434
|
+
* @argument {Object} offsets
|
435
|
+
* @returns {Object} ClientRect like output
|
436
|
+
*/
|
437
|
+
function getClientRect(offsets) {
|
438
|
+
return _extends({}, offsets, {
|
439
|
+
right: offsets.left + offsets.width,
|
440
|
+
bottom: offsets.top + offsets.height
|
441
|
+
});
|
442
|
+
}
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Get bounding client rect of given element
|
446
|
+
* @method
|
447
|
+
* @memberof Popper.Utils
|
448
|
+
* @param {HTMLElement} element
|
449
|
+
* @return {Object} client rect
|
450
|
+
*/
|
451
|
+
function getBoundingClientRect(element) {
|
452
|
+
var rect = {};
|
453
|
+
|
454
|
+
// IE10 10 FIX: Please, don't ask, the element isn't
|
455
|
+
// considered in DOM in some circumstances...
|
456
|
+
// This isn't reproducible in IE10 compatibility mode of IE11
|
457
|
+
try {
|
458
|
+
if (isIE(10)) {
|
459
|
+
rect = element.getBoundingClientRect();
|
460
|
+
var scrollTop = getScroll(element, 'top');
|
461
|
+
var scrollLeft = getScroll(element, 'left');
|
462
|
+
rect.top += scrollTop;
|
463
|
+
rect.left += scrollLeft;
|
464
|
+
rect.bottom += scrollTop;
|
465
|
+
rect.right += scrollLeft;
|
466
|
+
} else {
|
467
|
+
rect = element.getBoundingClientRect();
|
468
|
+
}
|
469
|
+
} catch (e) {}
|
470
|
+
|
471
|
+
var result = {
|
472
|
+
left: rect.left,
|
473
|
+
top: rect.top,
|
474
|
+
width: rect.right - rect.left,
|
475
|
+
height: rect.bottom - rect.top
|
476
|
+
};
|
477
|
+
|
478
|
+
// subtract scrollbar size from sizes
|
479
|
+
var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
|
480
|
+
var width = sizes.width || element.clientWidth || result.width;
|
481
|
+
var height = sizes.height || element.clientHeight || result.height;
|
482
|
+
|
483
|
+
var horizScrollbar = element.offsetWidth - width;
|
484
|
+
var vertScrollbar = element.offsetHeight - height;
|
485
|
+
|
486
|
+
// if an hypothetical scrollbar is detected, we must be sure it's not a `border`
|
487
|
+
// we make this check conditional for performance reasons
|
488
|
+
if (horizScrollbar || vertScrollbar) {
|
489
|
+
var styles = getStyleComputedProperty(element);
|
490
|
+
horizScrollbar -= getBordersSize(styles, 'x');
|
491
|
+
vertScrollbar -= getBordersSize(styles, 'y');
|
492
|
+
|
493
|
+
result.width -= horizScrollbar;
|
494
|
+
result.height -= vertScrollbar;
|
495
|
+
}
|
496
|
+
|
497
|
+
return getClientRect(result);
|
498
|
+
}
|
499
|
+
|
500
|
+
function getOffsetRectRelativeToArbitraryNode(children, parent) {
|
501
|
+
var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
502
|
+
|
503
|
+
var isIE10 = isIE(10);
|
504
|
+
var isHTML = parent.nodeName === 'HTML';
|
505
|
+
var childrenRect = getBoundingClientRect(children);
|
506
|
+
var parentRect = getBoundingClientRect(parent);
|
507
|
+
var scrollParent = getScrollParent(children);
|
508
|
+
|
509
|
+
var styles = getStyleComputedProperty(parent);
|
510
|
+
var borderTopWidth = parseFloat(styles.borderTopWidth);
|
511
|
+
var borderLeftWidth = parseFloat(styles.borderLeftWidth);
|
512
|
+
|
513
|
+
// In cases where the parent is fixed, we must ignore negative scroll in offset calc
|
514
|
+
if (fixedPosition && isHTML) {
|
515
|
+
parentRect.top = Math.max(parentRect.top, 0);
|
516
|
+
parentRect.left = Math.max(parentRect.left, 0);
|
517
|
+
}
|
518
|
+
var offsets = getClientRect({
|
519
|
+
top: childrenRect.top - parentRect.top - borderTopWidth,
|
520
|
+
left: childrenRect.left - parentRect.left - borderLeftWidth,
|
521
|
+
width: childrenRect.width,
|
522
|
+
height: childrenRect.height
|
523
|
+
});
|
524
|
+
offsets.marginTop = 0;
|
525
|
+
offsets.marginLeft = 0;
|
526
|
+
|
527
|
+
// Subtract margins of documentElement in case it's being used as parent
|
528
|
+
// we do this only on HTML because it's the only element that behaves
|
529
|
+
// differently when margins are applied to it. The margins are included in
|
530
|
+
// the box of the documentElement, in the other cases not.
|
531
|
+
if (!isIE10 && isHTML) {
|
532
|
+
var marginTop = parseFloat(styles.marginTop);
|
533
|
+
var marginLeft = parseFloat(styles.marginLeft);
|
534
|
+
|
535
|
+
offsets.top -= borderTopWidth - marginTop;
|
536
|
+
offsets.bottom -= borderTopWidth - marginTop;
|
537
|
+
offsets.left -= borderLeftWidth - marginLeft;
|
538
|
+
offsets.right -= borderLeftWidth - marginLeft;
|
539
|
+
|
540
|
+
// Attach marginTop and marginLeft because in some circumstances we may need them
|
541
|
+
offsets.marginTop = marginTop;
|
542
|
+
offsets.marginLeft = marginLeft;
|
543
|
+
}
|
544
|
+
|
545
|
+
if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
|
546
|
+
offsets = includeScroll(offsets, parent);
|
547
|
+
}
|
548
|
+
|
549
|
+
return offsets;
|
550
|
+
}
|
551
|
+
|
552
|
+
function getViewportOffsetRectRelativeToArtbitraryNode(element) {
|
553
|
+
var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
554
|
+
|
555
|
+
var html = element.ownerDocument.documentElement;
|
556
|
+
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
|
557
|
+
var width = Math.max(html.clientWidth, window.innerWidth || 0);
|
558
|
+
var height = Math.max(html.clientHeight, window.innerHeight || 0);
|
559
|
+
|
560
|
+
var scrollTop = !excludeScroll ? getScroll(html) : 0;
|
561
|
+
var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
|
562
|
+
|
563
|
+
var offset = {
|
564
|
+
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
|
565
|
+
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
|
566
|
+
width: width,
|
567
|
+
height: height
|
568
|
+
};
|
569
|
+
|
570
|
+
return getClientRect(offset);
|
571
|
+
}
|
572
|
+
|
573
|
+
/**
|
574
|
+
* Check if the given element is fixed or is inside a fixed parent
|
575
|
+
* @method
|
576
|
+
* @memberof Popper.Utils
|
577
|
+
* @argument {Element} element
|
578
|
+
* @argument {Element} customContainer
|
579
|
+
* @returns {Boolean} answer to "isFixed?"
|
580
|
+
*/
|
581
|
+
function isFixed(element) {
|
582
|
+
var nodeName = element.nodeName;
|
583
|
+
if (nodeName === 'BODY' || nodeName === 'HTML') {
|
584
|
+
return false;
|
585
|
+
}
|
586
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
587
|
+
return true;
|
588
|
+
}
|
589
|
+
var parentNode = getParentNode(element);
|
590
|
+
if (!parentNode) {
|
591
|
+
return false;
|
592
|
+
}
|
593
|
+
return isFixed(parentNode);
|
594
|
+
}
|
595
|
+
|
596
|
+
/**
|
597
|
+
* Finds the first parent of an element that has a transformed property defined
|
598
|
+
* @method
|
599
|
+
* @memberof Popper.Utils
|
600
|
+
* @argument {Element} element
|
601
|
+
* @returns {Element} first transformed parent or documentElement
|
602
|
+
*/
|
603
|
+
|
604
|
+
function getFixedPositionOffsetParent(element) {
|
605
|
+
// This check is needed to avoid errors in case one of the elements isn't defined for any reason
|
606
|
+
if (!element || !element.parentElement || isIE()) {
|
607
|
+
return document.documentElement;
|
608
|
+
}
|
609
|
+
var el = element.parentElement;
|
610
|
+
while (el && getStyleComputedProperty(el, 'transform') === 'none') {
|
611
|
+
el = el.parentElement;
|
612
|
+
}
|
613
|
+
return el || document.documentElement;
|
614
|
+
}
|
615
|
+
|
616
|
+
/**
|
617
|
+
* Computed the boundaries limits and return them
|
618
|
+
* @method
|
619
|
+
* @memberof Popper.Utils
|
620
|
+
* @param {HTMLElement} popper
|
621
|
+
* @param {HTMLElement} reference
|
622
|
+
* @param {number} padding
|
623
|
+
* @param {HTMLElement} boundariesElement - Element used to define the boundaries
|
624
|
+
* @param {Boolean} fixedPosition - Is in fixed position mode
|
625
|
+
* @returns {Object} Coordinates of the boundaries
|
626
|
+
*/
|
627
|
+
function getBoundaries(popper, reference, padding, boundariesElement) {
|
628
|
+
var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
629
|
+
|
630
|
+
// NOTE: 1 DOM access here
|
631
|
+
|
632
|
+
var boundaries = { top: 0, left: 0 };
|
633
|
+
var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
|
634
|
+
|
635
|
+
// Handle viewport case
|
636
|
+
if (boundariesElement === 'viewport') {
|
637
|
+
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
|
638
|
+
} else {
|
639
|
+
// Handle other cases based on DOM element used as boundaries
|
640
|
+
var boundariesNode = void 0;
|
641
|
+
if (boundariesElement === 'scrollParent') {
|
642
|
+
boundariesNode = getScrollParent(getParentNode(reference));
|
643
|
+
if (boundariesNode.nodeName === 'BODY') {
|
644
|
+
boundariesNode = popper.ownerDocument.documentElement;
|
645
|
+
}
|
646
|
+
} else if (boundariesElement === 'window') {
|
647
|
+
boundariesNode = popper.ownerDocument.documentElement;
|
648
|
+
} else {
|
649
|
+
boundariesNode = boundariesElement;
|
650
|
+
}
|
651
|
+
|
652
|
+
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
|
653
|
+
|
654
|
+
// In case of HTML, we need a different computation
|
655
|
+
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
|
656
|
+
var _getWindowSizes = getWindowSizes(popper.ownerDocument),
|
657
|
+
height = _getWindowSizes.height,
|
658
|
+
width = _getWindowSizes.width;
|
659
|
+
|
660
|
+
boundaries.top += offsets.top - offsets.marginTop;
|
661
|
+
boundaries.bottom = height + offsets.top;
|
662
|
+
boundaries.left += offsets.left - offsets.marginLeft;
|
663
|
+
boundaries.right = width + offsets.left;
|
664
|
+
} else {
|
665
|
+
// for all the other DOM elements, this one is good
|
666
|
+
boundaries = offsets;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
|
670
|
+
// Add paddings
|
671
|
+
padding = padding || 0;
|
672
|
+
var isPaddingNumber = typeof padding === 'number';
|
673
|
+
boundaries.left += isPaddingNumber ? padding : padding.left || 0;
|
674
|
+
boundaries.top += isPaddingNumber ? padding : padding.top || 0;
|
675
|
+
boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
|
676
|
+
boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
|
677
|
+
|
678
|
+
return boundaries;
|
679
|
+
}
|
680
|
+
|
681
|
+
function getArea(_ref) {
|
682
|
+
var width = _ref.width,
|
683
|
+
height = _ref.height;
|
684
|
+
|
685
|
+
return width * height;
|
686
|
+
}
|
687
|
+
|
688
|
+
/**
|
689
|
+
* Utility used to transform the `auto` placement to the placement with more
|
690
|
+
* available space.
|
691
|
+
* @method
|
692
|
+
* @memberof Popper.Utils
|
693
|
+
* @argument {Object} data - The data object generated by update method
|
694
|
+
* @argument {Object} options - Modifiers configuration and options
|
695
|
+
* @returns {Object} The data object, properly modified
|
696
|
+
*/
|
697
|
+
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
|
698
|
+
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
699
|
+
|
700
|
+
if (placement.indexOf('auto') === -1) {
|
701
|
+
return placement;
|
702
|
+
}
|
703
|
+
|
704
|
+
var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
|
705
|
+
|
706
|
+
var rects = {
|
707
|
+
top: {
|
708
|
+
width: boundaries.width,
|
709
|
+
height: refRect.top - boundaries.top
|
710
|
+
},
|
711
|
+
right: {
|
712
|
+
width: boundaries.right - refRect.right,
|
713
|
+
height: boundaries.height
|
714
|
+
},
|
715
|
+
bottom: {
|
716
|
+
width: boundaries.width,
|
717
|
+
height: boundaries.bottom - refRect.bottom
|
718
|
+
},
|
719
|
+
left: {
|
720
|
+
width: refRect.left - boundaries.left,
|
721
|
+
height: boundaries.height
|
722
|
+
}
|
723
|
+
};
|
724
|
+
|
725
|
+
var sortedAreas = Object.keys(rects).map(function (key) {
|
726
|
+
return _extends({
|
727
|
+
key: key
|
728
|
+
}, rects[key], {
|
729
|
+
area: getArea(rects[key])
|
730
|
+
});
|
731
|
+
}).sort(function (a, b) {
|
732
|
+
return b.area - a.area;
|
733
|
+
});
|
734
|
+
|
735
|
+
var filteredAreas = sortedAreas.filter(function (_ref2) {
|
736
|
+
var width = _ref2.width,
|
737
|
+
height = _ref2.height;
|
738
|
+
return width >= popper.clientWidth && height >= popper.clientHeight;
|
739
|
+
});
|
740
|
+
|
741
|
+
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
|
742
|
+
|
743
|
+
var variation = placement.split('-')[1];
|
744
|
+
|
745
|
+
return computedPlacement + (variation ? '-' + variation : '');
|
746
|
+
}
|
747
|
+
|
748
|
+
/**
|
749
|
+
* Get offsets to the reference element
|
750
|
+
* @method
|
751
|
+
* @memberof Popper.Utils
|
752
|
+
* @param {Object} state
|
753
|
+
* @param {Element} popper - the popper element
|
754
|
+
* @param {Element} reference - the reference element (the popper will be relative to this)
|
755
|
+
* @param {Element} fixedPosition - is in fixed position mode
|
756
|
+
* @returns {Object} An object containing the offsets which will be applied to the popper
|
757
|
+
*/
|
758
|
+
function getReferenceOffsets(state, popper, reference) {
|
759
|
+
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
760
|
+
|
761
|
+
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
|
762
|
+
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
|
763
|
+
}
|
764
|
+
|
765
|
+
/**
|
766
|
+
* Get the outer sizes of the given element (offset size + margins)
|
767
|
+
* @method
|
768
|
+
* @memberof Popper.Utils
|
769
|
+
* @argument {Element} element
|
770
|
+
* @returns {Object} object containing width and height properties
|
771
|
+
*/
|
772
|
+
function getOuterSizes(element) {
|
773
|
+
var window = element.ownerDocument.defaultView;
|
774
|
+
var styles = window.getComputedStyle(element);
|
775
|
+
var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
|
776
|
+
var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
|
777
|
+
var result = {
|
778
|
+
width: element.offsetWidth + y,
|
779
|
+
height: element.offsetHeight + x
|
780
|
+
};
|
781
|
+
return result;
|
782
|
+
}
|
783
|
+
|
784
|
+
/**
|
785
|
+
* Get the opposite placement of the given one
|
786
|
+
* @method
|
787
|
+
* @memberof Popper.Utils
|
788
|
+
* @argument {String} placement
|
789
|
+
* @returns {String} flipped placement
|
790
|
+
*/
|
791
|
+
function getOppositePlacement(placement) {
|
792
|
+
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
793
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
794
|
+
return hash[matched];
|
795
|
+
});
|
796
|
+
}
|
797
|
+
|
798
|
+
/**
|
799
|
+
* Get offsets to the popper
|
800
|
+
* @method
|
801
|
+
* @memberof Popper.Utils
|
802
|
+
* @param {Object} position - CSS position the Popper will get applied
|
803
|
+
* @param {HTMLElement} popper - the popper element
|
804
|
+
* @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
|
805
|
+
* @param {String} placement - one of the valid placement options
|
806
|
+
* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
|
807
|
+
*/
|
808
|
+
function getPopperOffsets(popper, referenceOffsets, placement) {
|
809
|
+
placement = placement.split('-')[0];
|
810
|
+
|
811
|
+
// Get popper node sizes
|
812
|
+
var popperRect = getOuterSizes(popper);
|
813
|
+
|
814
|
+
// Add position, width and height to our offsets object
|
815
|
+
var popperOffsets = {
|
816
|
+
width: popperRect.width,
|
817
|
+
height: popperRect.height
|
818
|
+
};
|
819
|
+
|
820
|
+
// depending by the popper placement we have to compute its offsets slightly differently
|
821
|
+
var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
|
822
|
+
var mainSide = isHoriz ? 'top' : 'left';
|
823
|
+
var secondarySide = isHoriz ? 'left' : 'top';
|
824
|
+
var measurement = isHoriz ? 'height' : 'width';
|
825
|
+
var secondaryMeasurement = !isHoriz ? 'height' : 'width';
|
826
|
+
|
827
|
+
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
|
828
|
+
if (placement === secondarySide) {
|
829
|
+
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
|
830
|
+
} else {
|
831
|
+
popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
|
832
|
+
}
|
833
|
+
|
834
|
+
return popperOffsets;
|
835
|
+
}
|
836
|
+
|
837
|
+
/**
|
838
|
+
* Mimics the `find` method of Array
|
839
|
+
* @method
|
840
|
+
* @memberof Popper.Utils
|
841
|
+
* @argument {Array} arr
|
842
|
+
* @argument prop
|
843
|
+
* @argument value
|
844
|
+
* @returns index or -1
|
845
|
+
*/
|
846
|
+
function find(arr, check) {
|
847
|
+
// use native find if supported
|
848
|
+
if (Array.prototype.find) {
|
849
|
+
return arr.find(check);
|
850
|
+
}
|
851
|
+
|
852
|
+
// use `filter` to obtain the same behavior of `find`
|
853
|
+
return arr.filter(check)[0];
|
854
|
+
}
|
855
|
+
|
856
|
+
/**
|
857
|
+
* Return the index of the matching object
|
858
|
+
* @method
|
859
|
+
* @memberof Popper.Utils
|
860
|
+
* @argument {Array} arr
|
861
|
+
* @argument prop
|
862
|
+
* @argument value
|
863
|
+
* @returns index or -1
|
864
|
+
*/
|
865
|
+
function findIndex(arr, prop, value) {
|
866
|
+
// use native findIndex if supported
|
867
|
+
if (Array.prototype.findIndex) {
|
868
|
+
return arr.findIndex(function (cur) {
|
869
|
+
return cur[prop] === value;
|
870
|
+
});
|
871
|
+
}
|
872
|
+
|
873
|
+
// use `find` + `indexOf` if `findIndex` isn't supported
|
874
|
+
var match = find(arr, function (obj) {
|
875
|
+
return obj[prop] === value;
|
876
|
+
});
|
877
|
+
return arr.indexOf(match);
|
878
|
+
}
|
879
|
+
|
880
|
+
/**
|
881
|
+
* Loop trough the list of modifiers and run them in order,
|
882
|
+
* each of them will then edit the data object.
|
883
|
+
* @method
|
884
|
+
* @memberof Popper.Utils
|
885
|
+
* @param {dataObject} data
|
886
|
+
* @param {Array} modifiers
|
887
|
+
* @param {String} ends - Optional modifier name used as stopper
|
888
|
+
* @returns {dataObject}
|
889
|
+
*/
|
890
|
+
function runModifiers(modifiers, data, ends) {
|
891
|
+
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
|
892
|
+
|
893
|
+
modifiersToRun.forEach(function (modifier) {
|
894
|
+
if (modifier['function']) {
|
895
|
+
// eslint-disable-line dot-notation
|
896
|
+
console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
|
897
|
+
}
|
898
|
+
var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
|
899
|
+
if (modifier.enabled && isFunction(fn)) {
|
900
|
+
// Add properties to offsets to make them a complete clientRect object
|
901
|
+
// we do this before each modifier to make sure the previous one doesn't
|
902
|
+
// mess with these values
|
903
|
+
data.offsets.popper = getClientRect(data.offsets.popper);
|
904
|
+
data.offsets.reference = getClientRect(data.offsets.reference);
|
905
|
+
|
906
|
+
data = fn(data, modifier);
|
907
|
+
}
|
908
|
+
});
|
909
|
+
|
910
|
+
return data;
|
911
|
+
}
|
912
|
+
|
913
|
+
/**
|
914
|
+
* Updates the position of the popper, computing the new offsets and applying
|
915
|
+
* the new style.<br />
|
916
|
+
* Prefer `scheduleUpdate` over `update` because of performance reasons.
|
917
|
+
* @method
|
918
|
+
* @memberof Popper
|
919
|
+
*/
|
920
|
+
function update() {
|
921
|
+
// if popper is destroyed, don't perform any further update
|
922
|
+
if (this.state.isDestroyed) {
|
923
|
+
return;
|
924
|
+
}
|
925
|
+
|
926
|
+
var data = {
|
927
|
+
instance: this,
|
928
|
+
styles: {},
|
929
|
+
arrowStyles: {},
|
930
|
+
attributes: {},
|
931
|
+
flipped: false,
|
932
|
+
offsets: {}
|
933
|
+
};
|
934
|
+
|
935
|
+
// compute reference element offsets
|
936
|
+
data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
|
937
|
+
|
938
|
+
// compute auto placement, store placement inside the data object,
|
939
|
+
// modifiers will be able to edit `placement` if needed
|
940
|
+
// and refer to originalPlacement to know the original value
|
941
|
+
data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
|
942
|
+
|
943
|
+
// store the computed placement inside `originalPlacement`
|
944
|
+
data.originalPlacement = data.placement;
|
945
|
+
|
946
|
+
data.positionFixed = this.options.positionFixed;
|
947
|
+
|
948
|
+
// compute the popper offsets
|
949
|
+
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
|
950
|
+
|
951
|
+
data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
|
952
|
+
|
953
|
+
// run the modifiers
|
954
|
+
data = runModifiers(this.modifiers, data);
|
955
|
+
|
956
|
+
// the first `update` will call `onCreate` callback
|
957
|
+
// the other ones will call `onUpdate` callback
|
958
|
+
if (!this.state.isCreated) {
|
959
|
+
this.state.isCreated = true;
|
960
|
+
this.options.onCreate(data);
|
961
|
+
} else {
|
962
|
+
this.options.onUpdate(data);
|
963
|
+
}
|
964
|
+
}
|
965
|
+
|
966
|
+
/**
|
967
|
+
* Helper used to know if the given modifier is enabled.
|
968
|
+
* @method
|
969
|
+
* @memberof Popper.Utils
|
970
|
+
* @returns {Boolean}
|
971
|
+
*/
|
972
|
+
function isModifierEnabled(modifiers, modifierName) {
|
973
|
+
return modifiers.some(function (_ref) {
|
974
|
+
var name = _ref.name,
|
975
|
+
enabled = _ref.enabled;
|
976
|
+
return enabled && name === modifierName;
|
977
|
+
});
|
978
|
+
}
|
979
|
+
|
980
|
+
/**
|
981
|
+
* Get the prefixed supported property name
|
982
|
+
* @method
|
983
|
+
* @memberof Popper.Utils
|
984
|
+
* @argument {String} property (camelCase)
|
985
|
+
* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
|
986
|
+
*/
|
987
|
+
function getSupportedPropertyName(property) {
|
988
|
+
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
|
989
|
+
var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
|
990
|
+
|
991
|
+
for (var i = 0; i < prefixes.length; i++) {
|
992
|
+
var prefix = prefixes[i];
|
993
|
+
var toCheck = prefix ? '' + prefix + upperProp : property;
|
994
|
+
if (typeof document.body.style[toCheck] !== 'undefined') {
|
995
|
+
return toCheck;
|
996
|
+
}
|
997
|
+
}
|
998
|
+
return null;
|
999
|
+
}
|
1000
|
+
|
1001
|
+
/**
|
1002
|
+
* Destroys the popper.
|
1003
|
+
* @method
|
1004
|
+
* @memberof Popper
|
1005
|
+
*/
|
1006
|
+
function destroy() {
|
1007
|
+
this.state.isDestroyed = true;
|
1008
|
+
|
1009
|
+
// touch DOM only if `applyStyle` modifier is enabled
|
1010
|
+
if (isModifierEnabled(this.modifiers, 'applyStyle')) {
|
1011
|
+
this.popper.removeAttribute('x-placement');
|
1012
|
+
this.popper.style.position = '';
|
1013
|
+
this.popper.style.top = '';
|
1014
|
+
this.popper.style.left = '';
|
1015
|
+
this.popper.style.right = '';
|
1016
|
+
this.popper.style.bottom = '';
|
1017
|
+
this.popper.style.willChange = '';
|
1018
|
+
this.popper.style[getSupportedPropertyName('transform')] = '';
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
this.disableEventListeners();
|
1022
|
+
|
1023
|
+
// remove the popper if user explicitly asked for the deletion on destroy
|
1024
|
+
// do not use `remove` because IE11 doesn't support it
|
1025
|
+
if (this.options.removeOnDestroy) {
|
1026
|
+
this.popper.parentNode.removeChild(this.popper);
|
1027
|
+
}
|
1028
|
+
return this;
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
/**
|
1032
|
+
* Get the window associated with the element
|
1033
|
+
* @argument {Element} element
|
1034
|
+
* @returns {Window}
|
1035
|
+
*/
|
1036
|
+
function getWindow(element) {
|
1037
|
+
var ownerDocument = element.ownerDocument;
|
1038
|
+
return ownerDocument ? ownerDocument.defaultView : window;
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
function attachToScrollParents(scrollParent, event, callback, scrollParents) {
|
1042
|
+
var isBody = scrollParent.nodeName === 'BODY';
|
1043
|
+
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
|
1044
|
+
target.addEventListener(event, callback, { passive: true });
|
1045
|
+
|
1046
|
+
if (!isBody) {
|
1047
|
+
attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
|
1048
|
+
}
|
1049
|
+
scrollParents.push(target);
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
/**
|
1053
|
+
* Setup needed event listeners used to update the popper position
|
1054
|
+
* @method
|
1055
|
+
* @memberof Popper.Utils
|
1056
|
+
* @private
|
1057
|
+
*/
|
1058
|
+
function setupEventListeners(reference, options, state, updateBound) {
|
1059
|
+
// Resize event listener on window
|
1060
|
+
state.updateBound = updateBound;
|
1061
|
+
getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
|
1062
|
+
|
1063
|
+
// Scroll event listener on scroll parents
|
1064
|
+
var scrollElement = getScrollParent(reference);
|
1065
|
+
attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
|
1066
|
+
state.scrollElement = scrollElement;
|
1067
|
+
state.eventsEnabled = true;
|
1068
|
+
|
1069
|
+
return state;
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
/**
|
1073
|
+
* It will add resize/scroll events and start recalculating
|
1074
|
+
* position of the popper element when they are triggered.
|
1075
|
+
* @method
|
1076
|
+
* @memberof Popper
|
1077
|
+
*/
|
1078
|
+
function enableEventListeners() {
|
1079
|
+
if (!this.state.eventsEnabled) {
|
1080
|
+
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
|
1081
|
+
}
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
/**
|
1085
|
+
* Remove event listeners used to update the popper position
|
1086
|
+
* @method
|
1087
|
+
* @memberof Popper.Utils
|
1088
|
+
* @private
|
1089
|
+
*/
|
1090
|
+
function removeEventListeners(reference, state) {
|
1091
|
+
// Remove resize event listener on window
|
1092
|
+
getWindow(reference).removeEventListener('resize', state.updateBound);
|
1093
|
+
|
1094
|
+
// Remove scroll event listener on scroll parents
|
1095
|
+
state.scrollParents.forEach(function (target) {
|
1096
|
+
target.removeEventListener('scroll', state.updateBound);
|
1097
|
+
});
|
1098
|
+
|
1099
|
+
// Reset state
|
1100
|
+
state.updateBound = null;
|
1101
|
+
state.scrollParents = [];
|
1102
|
+
state.scrollElement = null;
|
1103
|
+
state.eventsEnabled = false;
|
1104
|
+
return state;
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
/**
|
1108
|
+
* It will remove resize/scroll events and won't recalculate popper position
|
1109
|
+
* when they are triggered. It also won't trigger `onUpdate` callback anymore,
|
1110
|
+
* unless you call `update` method manually.
|
1111
|
+
* @method
|
1112
|
+
* @memberof Popper
|
1113
|
+
*/
|
1114
|
+
function disableEventListeners() {
|
1115
|
+
if (this.state.eventsEnabled) {
|
1116
|
+
cancelAnimationFrame(this.scheduleUpdate);
|
1117
|
+
this.state = removeEventListeners(this.reference, this.state);
|
1118
|
+
}
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
/**
|
1122
|
+
* Tells if a given input is a number
|
1123
|
+
* @method
|
1124
|
+
* @memberof Popper.Utils
|
1125
|
+
* @param {*} input to check
|
1126
|
+
* @return {Boolean}
|
1127
|
+
*/
|
1128
|
+
function isNumeric(n) {
|
1129
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
/**
|
1133
|
+
* Set the style to the given popper
|
1134
|
+
* @method
|
1135
|
+
* @memberof Popper.Utils
|
1136
|
+
* @argument {Element} element - Element to apply the style to
|
1137
|
+
* @argument {Object} styles
|
1138
|
+
* Object with a list of properties and values which will be applied to the element
|
1139
|
+
*/
|
1140
|
+
function setStyles(element, styles) {
|
1141
|
+
Object.keys(styles).forEach(function (prop) {
|
1142
|
+
var unit = '';
|
1143
|
+
// add unit if the value is numeric and is one of the following
|
1144
|
+
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
1145
|
+
unit = 'px';
|
1146
|
+
}
|
1147
|
+
element.style[prop] = styles[prop] + unit;
|
1148
|
+
});
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
/**
|
1152
|
+
* Set the attributes to the given popper
|
1153
|
+
* @method
|
1154
|
+
* @memberof Popper.Utils
|
1155
|
+
* @argument {Element} element - Element to apply the attributes to
|
1156
|
+
* @argument {Object} styles
|
1157
|
+
* Object with a list of properties and values which will be applied to the element
|
1158
|
+
*/
|
1159
|
+
function setAttributes(element, attributes) {
|
1160
|
+
Object.keys(attributes).forEach(function (prop) {
|
1161
|
+
var value = attributes[prop];
|
1162
|
+
if (value !== false) {
|
1163
|
+
element.setAttribute(prop, attributes[prop]);
|
1164
|
+
} else {
|
1165
|
+
element.removeAttribute(prop);
|
1166
|
+
}
|
1167
|
+
});
|
1168
|
+
}
|
1169
|
+
|
1170
|
+
/**
|
1171
|
+
* @function
|
1172
|
+
* @memberof Modifiers
|
1173
|
+
* @argument {Object} data - The data object generated by `update` method
|
1174
|
+
* @argument {Object} data.styles - List of style properties - values to apply to popper element
|
1175
|
+
* @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
|
1176
|
+
* @argument {Object} options - Modifiers configuration and options
|
1177
|
+
* @returns {Object} The same data object
|
1178
|
+
*/
|
1179
|
+
function applyStyle(data) {
|
1180
|
+
// any property present in `data.styles` will be applied to the popper,
|
1181
|
+
// in this way we can make the 3rd party modifiers add custom styles to it
|
1182
|
+
// Be aware, modifiers could override the properties defined in the previous
|
1183
|
+
// lines of this modifier!
|
1184
|
+
setStyles(data.instance.popper, data.styles);
|
1185
|
+
|
1186
|
+
// any property present in `data.attributes` will be applied to the popper,
|
1187
|
+
// they will be set as HTML attributes of the element
|
1188
|
+
setAttributes(data.instance.popper, data.attributes);
|
1189
|
+
|
1190
|
+
// if arrowElement is defined and arrowStyles has some properties
|
1191
|
+
if (data.arrowElement && Object.keys(data.arrowStyles).length) {
|
1192
|
+
setStyles(data.arrowElement, data.arrowStyles);
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
return data;
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
/**
|
1199
|
+
* Set the x-placement attribute before everything else because it could be used
|
1200
|
+
* to add margins to the popper margins needs to be calculated to get the
|
1201
|
+
* correct popper offsets.
|
1202
|
+
* @method
|
1203
|
+
* @memberof Popper.modifiers
|
1204
|
+
* @param {HTMLElement} reference - The reference element used to position the popper
|
1205
|
+
* @param {HTMLElement} popper - The HTML element used as popper
|
1206
|
+
* @param {Object} options - Popper.js options
|
1207
|
+
*/
|
1208
|
+
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
|
1209
|
+
// compute reference element offsets
|
1210
|
+
var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
|
1211
|
+
|
1212
|
+
// compute auto placement, store placement inside the data object,
|
1213
|
+
// modifiers will be able to edit `placement` if needed
|
1214
|
+
// and refer to originalPlacement to know the original value
|
1215
|
+
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
|
1216
|
+
|
1217
|
+
popper.setAttribute('x-placement', placement);
|
1218
|
+
|
1219
|
+
// Apply `position` to popper before anything else because
|
1220
|
+
// without the position applied we can't guarantee correct computations
|
1221
|
+
setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
|
1222
|
+
|
1223
|
+
return options;
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
/**
|
1227
|
+
* @function
|
1228
|
+
* @memberof Popper.Utils
|
1229
|
+
* @argument {Object} data - The data object generated by `update` method
|
1230
|
+
* @argument {Boolean} shouldRound - If the offsets should be rounded at all
|
1231
|
+
* @returns {Object} The popper's position offsets rounded
|
1232
|
+
*
|
1233
|
+
* The tale of pixel-perfect positioning. It's still not 100% perfect, but as
|
1234
|
+
* good as it can be within reason.
|
1235
|
+
* Discussion here: https://github.com/FezVrasta/popper.js/pull/715
|
1236
|
+
*
|
1237
|
+
* Low DPI screens cause a popper to be blurry if not using full pixels (Safari
|
1238
|
+
* as well on High DPI screens).
|
1239
|
+
*
|
1240
|
+
* Firefox prefers no rounding for positioning and does not have blurriness on
|
1241
|
+
* high DPI screens.
|
1242
|
+
*
|
1243
|
+
* Only horizontal placement and left/right values need to be considered.
|
1244
|
+
*/
|
1245
|
+
function getRoundedOffsets(data, shouldRound) {
|
1246
|
+
var _data$offsets = data.offsets,
|
1247
|
+
popper = _data$offsets.popper,
|
1248
|
+
reference = _data$offsets.reference;
|
1249
|
+
var round = Math.round,
|
1250
|
+
floor = Math.floor;
|
1251
|
+
|
1252
|
+
var noRound = function noRound(v) {
|
1253
|
+
return v;
|
1254
|
+
};
|
1255
|
+
|
1256
|
+
var referenceWidth = round(reference.width);
|
1257
|
+
var popperWidth = round(popper.width);
|
1258
|
+
|
1259
|
+
var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
|
1260
|
+
var isVariation = data.placement.indexOf('-') !== -1;
|
1261
|
+
var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
|
1262
|
+
var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
|
1263
|
+
|
1264
|
+
var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
|
1265
|
+
var verticalToInteger = !shouldRound ? noRound : round;
|
1266
|
+
|
1267
|
+
return {
|
1268
|
+
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
|
1269
|
+
top: verticalToInteger(popper.top),
|
1270
|
+
bottom: verticalToInteger(popper.bottom),
|
1271
|
+
right: horizontalToInteger(popper.right)
|
1272
|
+
};
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
|
1276
|
+
|
1277
|
+
/**
|
1278
|
+
* @function
|
1279
|
+
* @memberof Modifiers
|
1280
|
+
* @argument {Object} data - The data object generated by `update` method
|
1281
|
+
* @argument {Object} options - Modifiers configuration and options
|
1282
|
+
* @returns {Object} The data object, properly modified
|
1283
|
+
*/
|
1284
|
+
function computeStyle(data, options) {
|
1285
|
+
var x = options.x,
|
1286
|
+
y = options.y;
|
1287
|
+
var popper = data.offsets.popper;
|
1288
|
+
|
1289
|
+
// Remove this legacy support in Popper.js v2
|
1290
|
+
|
1291
|
+
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
|
1292
|
+
return modifier.name === 'applyStyle';
|
1293
|
+
}).gpuAcceleration;
|
1294
|
+
if (legacyGpuAccelerationOption !== undefined) {
|
1295
|
+
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
|
1296
|
+
}
|
1297
|
+
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
|
1298
|
+
|
1299
|
+
var offsetParent = getOffsetParent(data.instance.popper);
|
1300
|
+
var offsetParentRect = getBoundingClientRect(offsetParent);
|
1301
|
+
|
1302
|
+
// Styles
|
1303
|
+
var styles = {
|
1304
|
+
position: popper.position
|
1305
|
+
};
|
1306
|
+
|
1307
|
+
var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
|
1308
|
+
|
1309
|
+
var sideA = x === 'bottom' ? 'top' : 'bottom';
|
1310
|
+
var sideB = y === 'right' ? 'left' : 'right';
|
1311
|
+
|
1312
|
+
// if gpuAcceleration is set to `true` and transform is supported,
|
1313
|
+
// we use `translate3d` to apply the position to the popper we
|
1314
|
+
// automatically use the supported prefixed version if needed
|
1315
|
+
var prefixedProperty = getSupportedPropertyName('transform');
|
1316
|
+
|
1317
|
+
// now, let's make a step back and look at this code closely (wtf?)
|
1318
|
+
// If the content of the popper grows once it's been positioned, it
|
1319
|
+
// may happen that the popper gets misplaced because of the new content
|
1320
|
+
// overflowing its reference element
|
1321
|
+
// To avoid this problem, we provide two options (x and y), which allow
|
1322
|
+
// the consumer to define the offset origin.
|
1323
|
+
// If we position a popper on top of a reference element, we can set
|
1324
|
+
// `x` to `top` to make the popper grow towards its top instead of
|
1325
|
+
// its bottom.
|
1326
|
+
var left = void 0,
|
1327
|
+
top = void 0;
|
1328
|
+
if (sideA === 'bottom') {
|
1329
|
+
// when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
|
1330
|
+
// and not the bottom of the html element
|
1331
|
+
if (offsetParent.nodeName === 'HTML') {
|
1332
|
+
top = -offsetParent.clientHeight + offsets.bottom;
|
1333
|
+
} else {
|
1334
|
+
top = -offsetParentRect.height + offsets.bottom;
|
1335
|
+
}
|
1336
|
+
} else {
|
1337
|
+
top = offsets.top;
|
1338
|
+
}
|
1339
|
+
if (sideB === 'right') {
|
1340
|
+
if (offsetParent.nodeName === 'HTML') {
|
1341
|
+
left = -offsetParent.clientWidth + offsets.right;
|
1342
|
+
} else {
|
1343
|
+
left = -offsetParentRect.width + offsets.right;
|
1344
|
+
}
|
1345
|
+
} else {
|
1346
|
+
left = offsets.left;
|
1347
|
+
}
|
1348
|
+
if (gpuAcceleration && prefixedProperty) {
|
1349
|
+
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
1350
|
+
styles[sideA] = 0;
|
1351
|
+
styles[sideB] = 0;
|
1352
|
+
styles.willChange = 'transform';
|
1353
|
+
} else {
|
1354
|
+
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
|
1355
|
+
var invertTop = sideA === 'bottom' ? -1 : 1;
|
1356
|
+
var invertLeft = sideB === 'right' ? -1 : 1;
|
1357
|
+
styles[sideA] = top * invertTop;
|
1358
|
+
styles[sideB] = left * invertLeft;
|
1359
|
+
styles.willChange = sideA + ', ' + sideB;
|
1360
|
+
}
|
1361
|
+
|
1362
|
+
// Attributes
|
1363
|
+
var attributes = {
|
1364
|
+
'x-placement': data.placement
|
1365
|
+
};
|
1366
|
+
|
1367
|
+
// Update `data` attributes, styles and arrowStyles
|
1368
|
+
data.attributes = _extends({}, attributes, data.attributes);
|
1369
|
+
data.styles = _extends({}, styles, data.styles);
|
1370
|
+
data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
|
1371
|
+
|
1372
|
+
return data;
|
1373
|
+
}
|
1374
|
+
|
1375
|
+
/**
|
1376
|
+
* Helper used to know if the given modifier depends from another one.<br />
|
1377
|
+
* It checks if the needed modifier is listed and enabled.
|
1378
|
+
* @method
|
1379
|
+
* @memberof Popper.Utils
|
1380
|
+
* @param {Array} modifiers - list of modifiers
|
1381
|
+
* @param {String} requestingName - name of requesting modifier
|
1382
|
+
* @param {String} requestedName - name of requested modifier
|
1383
|
+
* @returns {Boolean}
|
1384
|
+
*/
|
1385
|
+
function isModifierRequired(modifiers, requestingName, requestedName) {
|
1386
|
+
var requesting = find(modifiers, function (_ref) {
|
1387
|
+
var name = _ref.name;
|
1388
|
+
return name === requestingName;
|
1389
|
+
});
|
1390
|
+
|
1391
|
+
var isRequired = !!requesting && modifiers.some(function (modifier) {
|
1392
|
+
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
|
1393
|
+
});
|
1394
|
+
|
1395
|
+
if (!isRequired) {
|
1396
|
+
var _requesting = '`' + requestingName + '`';
|
1397
|
+
var requested = '`' + requestedName + '`';
|
1398
|
+
console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
|
1399
|
+
}
|
1400
|
+
return isRequired;
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
/**
|
1404
|
+
* @function
|
1405
|
+
* @memberof Modifiers
|
1406
|
+
* @argument {Object} data - The data object generated by update method
|
1407
|
+
* @argument {Object} options - Modifiers configuration and options
|
1408
|
+
* @returns {Object} The data object, properly modified
|
1409
|
+
*/
|
1410
|
+
function arrow(data, options) {
|
1411
|
+
var _data$offsets$arrow;
|
1412
|
+
|
1413
|
+
// arrow depends on keepTogether in order to work
|
1414
|
+
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
|
1415
|
+
return data;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
var arrowElement = options.element;
|
1419
|
+
|
1420
|
+
// if arrowElement is a string, suppose it's a CSS selector
|
1421
|
+
if (typeof arrowElement === 'string') {
|
1422
|
+
arrowElement = data.instance.popper.querySelector(arrowElement);
|
1423
|
+
|
1424
|
+
// if arrowElement is not found, don't run the modifier
|
1425
|
+
if (!arrowElement) {
|
1426
|
+
return data;
|
1427
|
+
}
|
1428
|
+
} else {
|
1429
|
+
// if the arrowElement isn't a query selector we must check that the
|
1430
|
+
// provided DOM node is child of its popper node
|
1431
|
+
if (!data.instance.popper.contains(arrowElement)) {
|
1432
|
+
console.warn('WARNING: `arrow.element` must be child of its popper element!');
|
1433
|
+
return data;
|
1434
|
+
}
|
1435
|
+
}
|
1436
|
+
|
1437
|
+
var placement = data.placement.split('-')[0];
|
1438
|
+
var _data$offsets = data.offsets,
|
1439
|
+
popper = _data$offsets.popper,
|
1440
|
+
reference = _data$offsets.reference;
|
1441
|
+
|
1442
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
1443
|
+
|
1444
|
+
var len = isVertical ? 'height' : 'width';
|
1445
|
+
var sideCapitalized = isVertical ? 'Top' : 'Left';
|
1446
|
+
var side = sideCapitalized.toLowerCase();
|
1447
|
+
var altSide = isVertical ? 'left' : 'top';
|
1448
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
1449
|
+
var arrowElementSize = getOuterSizes(arrowElement)[len];
|
1450
|
+
|
1451
|
+
//
|
1452
|
+
// extends keepTogether behavior making sure the popper and its
|
1453
|
+
// reference have enough pixels in conjunction
|
1454
|
+
//
|
1455
|
+
|
1456
|
+
// top/left side
|
1457
|
+
if (reference[opSide] - arrowElementSize < popper[side]) {
|
1458
|
+
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
|
1459
|
+
}
|
1460
|
+
// bottom/right side
|
1461
|
+
if (reference[side] + arrowElementSize > popper[opSide]) {
|
1462
|
+
data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
|
1463
|
+
}
|
1464
|
+
data.offsets.popper = getClientRect(data.offsets.popper);
|
1465
|
+
|
1466
|
+
// compute center of the popper
|
1467
|
+
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
|
1468
|
+
|
1469
|
+
// Compute the sideValue using the updated popper offsets
|
1470
|
+
// take popper margin in account because we don't have this info available
|
1471
|
+
var css = getStyleComputedProperty(data.instance.popper);
|
1472
|
+
var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
|
1473
|
+
var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
|
1474
|
+
var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
|
1475
|
+
|
1476
|
+
// prevent arrowElement from being placed not contiguously to its popper
|
1477
|
+
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
|
1478
|
+
|
1479
|
+
data.arrowElement = arrowElement;
|
1480
|
+
data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
|
1481
|
+
|
1482
|
+
return data;
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
/**
|
1486
|
+
* Get the opposite placement variation of the given one
|
1487
|
+
* @method
|
1488
|
+
* @memberof Popper.Utils
|
1489
|
+
* @argument {String} placement variation
|
1490
|
+
* @returns {String} flipped placement variation
|
1491
|
+
*/
|
1492
|
+
function getOppositeVariation(variation) {
|
1493
|
+
if (variation === 'end') {
|
1494
|
+
return 'start';
|
1495
|
+
} else if (variation === 'start') {
|
1496
|
+
return 'end';
|
1497
|
+
}
|
1498
|
+
return variation;
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
/**
|
1502
|
+
* List of accepted placements to use as values of the `placement` option.<br />
|
1503
|
+
* Valid placements are:
|
1504
|
+
* - `auto`
|
1505
|
+
* - `top`
|
1506
|
+
* - `right`
|
1507
|
+
* - `bottom`
|
1508
|
+
* - `left`
|
1509
|
+
*
|
1510
|
+
* Each placement can have a variation from this list:
|
1511
|
+
* - `-start`
|
1512
|
+
* - `-end`
|
1513
|
+
*
|
1514
|
+
* Variations are interpreted easily if you think of them as the left to right
|
1515
|
+
* written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
|
1516
|
+
* is right.<br />
|
1517
|
+
* Vertically (`left` and `right`), `start` is top and `end` is bottom.
|
1518
|
+
*
|
1519
|
+
* Some valid examples are:
|
1520
|
+
* - `top-end` (on top of reference, right aligned)
|
1521
|
+
* - `right-start` (on right of reference, top aligned)
|
1522
|
+
* - `bottom` (on bottom, centered)
|
1523
|
+
* - `auto-end` (on the side with more space available, alignment depends by placement)
|
1524
|
+
*
|
1525
|
+
* @static
|
1526
|
+
* @type {Array}
|
1527
|
+
* @enum {String}
|
1528
|
+
* @readonly
|
1529
|
+
* @method placements
|
1530
|
+
* @memberof Popper
|
1531
|
+
*/
|
1532
|
+
var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
1533
|
+
|
1534
|
+
// Get rid of `auto` `auto-start` and `auto-end`
|
1535
|
+
var validPlacements = placements.slice(3);
|
1536
|
+
|
1537
|
+
/**
|
1538
|
+
* Given an initial placement, returns all the subsequent placements
|
1539
|
+
* clockwise (or counter-clockwise).
|
1540
|
+
*
|
1541
|
+
* @method
|
1542
|
+
* @memberof Popper.Utils
|
1543
|
+
* @argument {String} placement - A valid placement (it accepts variations)
|
1544
|
+
* @argument {Boolean} counter - Set to true to walk the placements counterclockwise
|
1545
|
+
* @returns {Array} placements including their variations
|
1546
|
+
*/
|
1547
|
+
function clockwise(placement) {
|
1548
|
+
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1549
|
+
|
1550
|
+
var index = validPlacements.indexOf(placement);
|
1551
|
+
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
|
1552
|
+
return counter ? arr.reverse() : arr;
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
var BEHAVIORS = {
|
1556
|
+
FLIP: 'flip',
|
1557
|
+
CLOCKWISE: 'clockwise',
|
1558
|
+
COUNTERCLOCKWISE: 'counterclockwise'
|
1559
|
+
};
|
1560
|
+
|
1561
|
+
/**
|
1562
|
+
* @function
|
1563
|
+
* @memberof Modifiers
|
1564
|
+
* @argument {Object} data - The data object generated by update method
|
1565
|
+
* @argument {Object} options - Modifiers configuration and options
|
1566
|
+
* @returns {Object} The data object, properly modified
|
1567
|
+
*/
|
1568
|
+
function flip(data, options) {
|
1569
|
+
// if `inner` modifier is enabled, we can't use the `flip` modifier
|
1570
|
+
if (isModifierEnabled(data.instance.modifiers, 'inner')) {
|
1571
|
+
return data;
|
1572
|
+
}
|
1573
|
+
|
1574
|
+
if (data.flipped && data.placement === data.originalPlacement) {
|
1575
|
+
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
1576
|
+
return data;
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
|
1580
|
+
|
1581
|
+
var placement = data.placement.split('-')[0];
|
1582
|
+
var placementOpposite = getOppositePlacement(placement);
|
1583
|
+
var variation = data.placement.split('-')[1] || '';
|
1584
|
+
|
1585
|
+
var flipOrder = [];
|
1586
|
+
|
1587
|
+
switch (options.behavior) {
|
1588
|
+
case BEHAVIORS.FLIP:
|
1589
|
+
flipOrder = [placement, placementOpposite];
|
1590
|
+
break;
|
1591
|
+
case BEHAVIORS.CLOCKWISE:
|
1592
|
+
flipOrder = clockwise(placement);
|
1593
|
+
break;
|
1594
|
+
case BEHAVIORS.COUNTERCLOCKWISE:
|
1595
|
+
flipOrder = clockwise(placement, true);
|
1596
|
+
break;
|
1597
|
+
default:
|
1598
|
+
flipOrder = options.behavior;
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
flipOrder.forEach(function (step, index) {
|
1602
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
1603
|
+
return data;
|
1604
|
+
}
|
1605
|
+
|
1606
|
+
placement = data.placement.split('-')[0];
|
1607
|
+
placementOpposite = getOppositePlacement(placement);
|
1608
|
+
|
1609
|
+
var popperOffsets = data.offsets.popper;
|
1610
|
+
var refOffsets = data.offsets.reference;
|
1611
|
+
|
1612
|
+
// using floor because the reference offsets may contain decimals we are not going to consider here
|
1613
|
+
var floor = Math.floor;
|
1614
|
+
var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
|
1615
|
+
|
1616
|
+
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
|
1617
|
+
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
|
1618
|
+
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
|
1619
|
+
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
|
1620
|
+
|
1621
|
+
var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
|
1622
|
+
|
1623
|
+
// flip the variation if required
|
1624
|
+
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
1625
|
+
|
1626
|
+
// flips variation if reference element overflows boundaries
|
1627
|
+
var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
|
1628
|
+
|
1629
|
+
// flips variation if popper content overflows boundaries
|
1630
|
+
var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
|
1631
|
+
|
1632
|
+
var flippedVariation = flippedVariationByRef || flippedVariationByContent;
|
1633
|
+
|
1634
|
+
if (overlapsRef || overflowsBoundaries || flippedVariation) {
|
1635
|
+
// this boolean to detect any flip loop
|
1636
|
+
data.flipped = true;
|
1637
|
+
|
1638
|
+
if (overlapsRef || overflowsBoundaries) {
|
1639
|
+
placement = flipOrder[index + 1];
|
1640
|
+
}
|
1641
|
+
|
1642
|
+
if (flippedVariation) {
|
1643
|
+
variation = getOppositeVariation(variation);
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
data.placement = placement + (variation ? '-' + variation : '');
|
1647
|
+
|
1648
|
+
// this object contains `position`, we want to preserve it along with
|
1649
|
+
// any additional property we may add in the future
|
1650
|
+
data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
|
1651
|
+
|
1652
|
+
data = runModifiers(data.instance.modifiers, data, 'flip');
|
1653
|
+
}
|
1654
|
+
});
|
1655
|
+
return data;
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
/**
|
1659
|
+
* @function
|
1660
|
+
* @memberof Modifiers
|
1661
|
+
* @argument {Object} data - The data object generated by update method
|
1662
|
+
* @argument {Object} options - Modifiers configuration and options
|
1663
|
+
* @returns {Object} The data object, properly modified
|
1664
|
+
*/
|
1665
|
+
function keepTogether(data) {
|
1666
|
+
var _data$offsets = data.offsets,
|
1667
|
+
popper = _data$offsets.popper,
|
1668
|
+
reference = _data$offsets.reference;
|
1669
|
+
|
1670
|
+
var placement = data.placement.split('-')[0];
|
1671
|
+
var floor = Math.floor;
|
1672
|
+
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
1673
|
+
var side = isVertical ? 'right' : 'bottom';
|
1674
|
+
var opSide = isVertical ? 'left' : 'top';
|
1675
|
+
var measurement = isVertical ? 'width' : 'height';
|
1676
|
+
|
1677
|
+
if (popper[side] < floor(reference[opSide])) {
|
1678
|
+
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
|
1679
|
+
}
|
1680
|
+
if (popper[opSide] > floor(reference[side])) {
|
1681
|
+
data.offsets.popper[opSide] = floor(reference[side]);
|
1682
|
+
}
|
1683
|
+
|
1684
|
+
return data;
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
/**
|
1688
|
+
* Converts a string containing value + unit into a px value number
|
1689
|
+
* @function
|
1690
|
+
* @memberof {modifiers~offset}
|
1691
|
+
* @private
|
1692
|
+
* @argument {String} str - Value + unit string
|
1693
|
+
* @argument {String} measurement - `height` or `width`
|
1694
|
+
* @argument {Object} popperOffsets
|
1695
|
+
* @argument {Object} referenceOffsets
|
1696
|
+
* @returns {Number|String}
|
1697
|
+
* Value in pixels, or original string if no values were extracted
|
1698
|
+
*/
|
1699
|
+
function toValue(str, measurement, popperOffsets, referenceOffsets) {
|
1700
|
+
// separate value from unit
|
1701
|
+
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
|
1702
|
+
var value = +split[1];
|
1703
|
+
var unit = split[2];
|
1704
|
+
|
1705
|
+
// If it's not a number it's an operator, I guess
|
1706
|
+
if (!value) {
|
1707
|
+
return str;
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
if (unit.indexOf('%') === 0) {
|
1711
|
+
var element = void 0;
|
1712
|
+
switch (unit) {
|
1713
|
+
case '%p':
|
1714
|
+
element = popperOffsets;
|
1715
|
+
break;
|
1716
|
+
case '%':
|
1717
|
+
case '%r':
|
1718
|
+
default:
|
1719
|
+
element = referenceOffsets;
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
var rect = getClientRect(element);
|
1723
|
+
return rect[measurement] / 100 * value;
|
1724
|
+
} else if (unit === 'vh' || unit === 'vw') {
|
1725
|
+
// if is a vh or vw, we calculate the size based on the viewport
|
1726
|
+
var size = void 0;
|
1727
|
+
if (unit === 'vh') {
|
1728
|
+
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
1729
|
+
} else {
|
1730
|
+
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
1731
|
+
}
|
1732
|
+
return size / 100 * value;
|
1733
|
+
} else {
|
1734
|
+
// if is an explicit pixel unit, we get rid of the unit and keep the value
|
1735
|
+
// if is an implicit unit, it's px, and we return just the value
|
1736
|
+
return value;
|
1737
|
+
}
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
/**
|
1741
|
+
* Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
|
1742
|
+
* @function
|
1743
|
+
* @memberof {modifiers~offset}
|
1744
|
+
* @private
|
1745
|
+
* @argument {String} offset
|
1746
|
+
* @argument {Object} popperOffsets
|
1747
|
+
* @argument {Object} referenceOffsets
|
1748
|
+
* @argument {String} basePlacement
|
1749
|
+
* @returns {Array} a two cells array with x and y offsets in numbers
|
1750
|
+
*/
|
1751
|
+
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
|
1752
|
+
var offsets = [0, 0];
|
1753
|
+
|
1754
|
+
// Use height if placement is left or right and index is 0 otherwise use width
|
1755
|
+
// in this way the first offset will use an axis and the second one
|
1756
|
+
// will use the other one
|
1757
|
+
var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
|
1758
|
+
|
1759
|
+
// Split the offset string to obtain a list of values and operands
|
1760
|
+
// The regex addresses values with the plus or minus sign in front (+10, -20, etc)
|
1761
|
+
var fragments = offset.split(/(\+|\-)/).map(function (frag) {
|
1762
|
+
return frag.trim();
|
1763
|
+
});
|
1764
|
+
|
1765
|
+
// Detect if the offset string contains a pair of values or a single one
|
1766
|
+
// they could be separated by comma or space
|
1767
|
+
var divider = fragments.indexOf(find(fragments, function (frag) {
|
1768
|
+
return frag.search(/,|\s/) !== -1;
|
1769
|
+
}));
|
1770
|
+
|
1771
|
+
if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
|
1772
|
+
console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
// If divider is found, we divide the list of values and operands to divide
|
1776
|
+
// them by ofset X and Y.
|
1777
|
+
var splitRegex = /\s*,\s*|\s+/;
|
1778
|
+
var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
|
1779
|
+
|
1780
|
+
// Convert the values with units to absolute pixels to allow our computations
|
1781
|
+
ops = ops.map(function (op, index) {
|
1782
|
+
// Most of the units rely on the orientation of the popper
|
1783
|
+
var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
|
1784
|
+
var mergeWithPrevious = false;
|
1785
|
+
return op
|
1786
|
+
// This aggregates any `+` or `-` sign that aren't considered operators
|
1787
|
+
// e.g.: 10 + +5 => [10, +, +5]
|
1788
|
+
.reduce(function (a, b) {
|
1789
|
+
if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
|
1790
|
+
a[a.length - 1] = b;
|
1791
|
+
mergeWithPrevious = true;
|
1792
|
+
return a;
|
1793
|
+
} else if (mergeWithPrevious) {
|
1794
|
+
a[a.length - 1] += b;
|
1795
|
+
mergeWithPrevious = false;
|
1796
|
+
return a;
|
1797
|
+
} else {
|
1798
|
+
return a.concat(b);
|
1799
|
+
}
|
1800
|
+
}, [])
|
1801
|
+
// Here we convert the string values into number values (in px)
|
1802
|
+
.map(function (str) {
|
1803
|
+
return toValue(str, measurement, popperOffsets, referenceOffsets);
|
1804
|
+
});
|
1805
|
+
});
|
1806
|
+
|
1807
|
+
// Loop trough the offsets arrays and execute the operations
|
1808
|
+
ops.forEach(function (op, index) {
|
1809
|
+
op.forEach(function (frag, index2) {
|
1810
|
+
if (isNumeric(frag)) {
|
1811
|
+
offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
|
1812
|
+
}
|
1813
|
+
});
|
1814
|
+
});
|
1815
|
+
return offsets;
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
/**
|
1819
|
+
* @function
|
1820
|
+
* @memberof Modifiers
|
1821
|
+
* @argument {Object} data - The data object generated by update method
|
1822
|
+
* @argument {Object} options - Modifiers configuration and options
|
1823
|
+
* @argument {Number|String} options.offset=0
|
1824
|
+
* The offset value as described in the modifier description
|
1825
|
+
* @returns {Object} The data object, properly modified
|
1826
|
+
*/
|
1827
|
+
function offset(data, _ref) {
|
1828
|
+
var offset = _ref.offset;
|
1829
|
+
var placement = data.placement,
|
1830
|
+
_data$offsets = data.offsets,
|
1831
|
+
popper = _data$offsets.popper,
|
1832
|
+
reference = _data$offsets.reference;
|
1833
|
+
|
1834
|
+
var basePlacement = placement.split('-')[0];
|
1835
|
+
|
1836
|
+
var offsets = void 0;
|
1837
|
+
if (isNumeric(+offset)) {
|
1838
|
+
offsets = [+offset, 0];
|
1839
|
+
} else {
|
1840
|
+
offsets = parseOffset(offset, popper, reference, basePlacement);
|
1841
|
+
}
|
1842
|
+
|
1843
|
+
if (basePlacement === 'left') {
|
1844
|
+
popper.top += offsets[0];
|
1845
|
+
popper.left -= offsets[1];
|
1846
|
+
} else if (basePlacement === 'right') {
|
1847
|
+
popper.top += offsets[0];
|
1848
|
+
popper.left += offsets[1];
|
1849
|
+
} else if (basePlacement === 'top') {
|
1850
|
+
popper.left += offsets[0];
|
1851
|
+
popper.top -= offsets[1];
|
1852
|
+
} else if (basePlacement === 'bottom') {
|
1853
|
+
popper.left += offsets[0];
|
1854
|
+
popper.top += offsets[1];
|
1855
|
+
}
|
1856
|
+
|
1857
|
+
data.popper = popper;
|
1858
|
+
return data;
|
1859
|
+
}
|
1860
|
+
|
1861
|
+
/**
|
1862
|
+
* @function
|
1863
|
+
* @memberof Modifiers
|
1864
|
+
* @argument {Object} data - The data object generated by `update` method
|
1865
|
+
* @argument {Object} options - Modifiers configuration and options
|
1866
|
+
* @returns {Object} The data object, properly modified
|
1867
|
+
*/
|
1868
|
+
function preventOverflow(data, options) {
|
1869
|
+
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
|
1870
|
+
|
1871
|
+
// If offsetParent is the reference element, we really want to
|
1872
|
+
// go one step up and use the next offsetParent as reference to
|
1873
|
+
// avoid to make this modifier completely useless and look like broken
|
1874
|
+
if (data.instance.reference === boundariesElement) {
|
1875
|
+
boundariesElement = getOffsetParent(boundariesElement);
|
1876
|
+
}
|
1877
|
+
|
1878
|
+
// NOTE: DOM access here
|
1879
|
+
// resets the popper's position so that the document size can be calculated excluding
|
1880
|
+
// the size of the popper element itself
|
1881
|
+
var transformProp = getSupportedPropertyName('transform');
|
1882
|
+
var popperStyles = data.instance.popper.style; // assignment to help minification
|
1883
|
+
var top = popperStyles.top,
|
1884
|
+
left = popperStyles.left,
|
1885
|
+
transform = popperStyles[transformProp];
|
1886
|
+
|
1887
|
+
popperStyles.top = '';
|
1888
|
+
popperStyles.left = '';
|
1889
|
+
popperStyles[transformProp] = '';
|
1890
|
+
|
1891
|
+
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
|
1892
|
+
|
1893
|
+
// NOTE: DOM access here
|
1894
|
+
// restores the original style properties after the offsets have been computed
|
1895
|
+
popperStyles.top = top;
|
1896
|
+
popperStyles.left = left;
|
1897
|
+
popperStyles[transformProp] = transform;
|
1898
|
+
|
1899
|
+
options.boundaries = boundaries;
|
1900
|
+
|
1901
|
+
var order = options.priority;
|
1902
|
+
var popper = data.offsets.popper;
|
1903
|
+
|
1904
|
+
var check = {
|
1905
|
+
primary: function primary(placement) {
|
1906
|
+
var value = popper[placement];
|
1907
|
+
if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
|
1908
|
+
value = Math.max(popper[placement], boundaries[placement]);
|
1909
|
+
}
|
1910
|
+
return defineProperty({}, placement, value);
|
1911
|
+
},
|
1912
|
+
secondary: function secondary(placement) {
|
1913
|
+
var mainSide = placement === 'right' ? 'left' : 'top';
|
1914
|
+
var value = popper[mainSide];
|
1915
|
+
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
|
1916
|
+
value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
|
1917
|
+
}
|
1918
|
+
return defineProperty({}, mainSide, value);
|
1919
|
+
}
|
1920
|
+
};
|
1921
|
+
|
1922
|
+
order.forEach(function (placement) {
|
1923
|
+
var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
|
1924
|
+
popper = _extends({}, popper, check[side](placement));
|
1925
|
+
});
|
1926
|
+
|
1927
|
+
data.offsets.popper = popper;
|
1928
|
+
|
1929
|
+
return data;
|
1930
|
+
}
|
1931
|
+
|
1932
|
+
/**
|
1933
|
+
* @function
|
1934
|
+
* @memberof Modifiers
|
1935
|
+
* @argument {Object} data - The data object generated by `update` method
|
1936
|
+
* @argument {Object} options - Modifiers configuration and options
|
1937
|
+
* @returns {Object} The data object, properly modified
|
1938
|
+
*/
|
1939
|
+
function shift(data) {
|
1940
|
+
var placement = data.placement;
|
1941
|
+
var basePlacement = placement.split('-')[0];
|
1942
|
+
var shiftvariation = placement.split('-')[1];
|
1943
|
+
|
1944
|
+
// if shift shiftvariation is specified, run the modifier
|
1945
|
+
if (shiftvariation) {
|
1946
|
+
var _data$offsets = data.offsets,
|
1947
|
+
reference = _data$offsets.reference,
|
1948
|
+
popper = _data$offsets.popper;
|
1949
|
+
|
1950
|
+
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
|
1951
|
+
var side = isVertical ? 'left' : 'top';
|
1952
|
+
var measurement = isVertical ? 'width' : 'height';
|
1953
|
+
|
1954
|
+
var shiftOffsets = {
|
1955
|
+
start: defineProperty({}, side, reference[side]),
|
1956
|
+
end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
|
1957
|
+
};
|
1958
|
+
|
1959
|
+
data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
return data;
|
1963
|
+
}
|
1964
|
+
|
1965
|
+
/**
|
1966
|
+
* @function
|
1967
|
+
* @memberof Modifiers
|
1968
|
+
* @argument {Object} data - The data object generated by update method
|
1969
|
+
* @argument {Object} options - Modifiers configuration and options
|
1970
|
+
* @returns {Object} The data object, properly modified
|
1971
|
+
*/
|
1972
|
+
function hide(data) {
|
1973
|
+
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
|
1974
|
+
return data;
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
var refRect = data.offsets.reference;
|
1978
|
+
var bound = find(data.instance.modifiers, function (modifier) {
|
1979
|
+
return modifier.name === 'preventOverflow';
|
1980
|
+
}).boundaries;
|
1981
|
+
|
1982
|
+
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
|
1983
|
+
// Avoid unnecessary DOM access if visibility hasn't changed
|
1984
|
+
if (data.hide === true) {
|
1985
|
+
return data;
|
1986
|
+
}
|
1987
|
+
|
1988
|
+
data.hide = true;
|
1989
|
+
data.attributes['x-out-of-boundaries'] = '';
|
1990
|
+
} else {
|
1991
|
+
// Avoid unnecessary DOM access if visibility hasn't changed
|
1992
|
+
if (data.hide === false) {
|
1993
|
+
return data;
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
data.hide = false;
|
1997
|
+
data.attributes['x-out-of-boundaries'] = false;
|
1998
|
+
}
|
1999
|
+
|
2000
|
+
return data;
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
/**
|
2004
|
+
* @function
|
2005
|
+
* @memberof Modifiers
|
2006
|
+
* @argument {Object} data - The data object generated by `update` method
|
2007
|
+
* @argument {Object} options - Modifiers configuration and options
|
2008
|
+
* @returns {Object} The data object, properly modified
|
2009
|
+
*/
|
2010
|
+
function inner(data) {
|
2011
|
+
var placement = data.placement;
|
2012
|
+
var basePlacement = placement.split('-')[0];
|
2013
|
+
var _data$offsets = data.offsets,
|
2014
|
+
popper = _data$offsets.popper,
|
2015
|
+
reference = _data$offsets.reference;
|
2016
|
+
|
2017
|
+
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
|
2018
|
+
|
2019
|
+
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
|
2020
|
+
|
2021
|
+
popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
|
2022
|
+
|
2023
|
+
data.placement = getOppositePlacement(placement);
|
2024
|
+
data.offsets.popper = getClientRect(popper);
|
2025
|
+
|
2026
|
+
return data;
|
2027
|
+
}
|
2028
|
+
|
2029
|
+
/**
|
2030
|
+
* Modifier function, each modifier can have a function of this type assigned
|
2031
|
+
* to its `fn` property.<br />
|
2032
|
+
* These functions will be called on each update, this means that you must
|
2033
|
+
* make sure they are performant enough to avoid performance bottlenecks.
|
2034
|
+
*
|
2035
|
+
* @function ModifierFn
|
2036
|
+
* @argument {dataObject} data - The data object generated by `update` method
|
2037
|
+
* @argument {Object} options - Modifiers configuration and options
|
2038
|
+
* @returns {dataObject} The data object, properly modified
|
2039
|
+
*/
|
2040
|
+
|
2041
|
+
/**
|
2042
|
+
* Modifiers are plugins used to alter the behavior of your poppers.<br />
|
2043
|
+
* Popper.js uses a set of 9 modifiers to provide all the basic functionalities
|
2044
|
+
* needed by the library.
|
2045
|
+
*
|
2046
|
+
* Usually you don't want to override the `order`, `fn` and `onLoad` props.
|
2047
|
+
* All the other properties are configurations that could be tweaked.
|
2048
|
+
* @namespace modifiers
|
2049
|
+
*/
|
2050
|
+
var modifiers = {
|
2051
|
+
/**
|
2052
|
+
* Modifier used to shift the popper on the start or end of its reference
|
2053
|
+
* element.<br />
|
2054
|
+
* It will read the variation of the `placement` property.<br />
|
2055
|
+
* It can be one either `-end` or `-start`.
|
2056
|
+
* @memberof modifiers
|
2057
|
+
* @inner
|
2058
|
+
*/
|
2059
|
+
shift: {
|
2060
|
+
/** @prop {number} order=100 - Index used to define the order of execution */
|
2061
|
+
order: 100,
|
2062
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2063
|
+
enabled: true,
|
2064
|
+
/** @prop {ModifierFn} */
|
2065
|
+
fn: shift
|
2066
|
+
},
|
2067
|
+
|
2068
|
+
/**
|
2069
|
+
* The `offset` modifier can shift your popper on both its axis.
|
2070
|
+
*
|
2071
|
+
* It accepts the following units:
|
2072
|
+
* - `px` or unit-less, interpreted as pixels
|
2073
|
+
* - `%` or `%r`, percentage relative to the length of the reference element
|
2074
|
+
* - `%p`, percentage relative to the length of the popper element
|
2075
|
+
* - `vw`, CSS viewport width unit
|
2076
|
+
* - `vh`, CSS viewport height unit
|
2077
|
+
*
|
2078
|
+
* For length is intended the main axis relative to the placement of the popper.<br />
|
2079
|
+
* This means that if the placement is `top` or `bottom`, the length will be the
|
2080
|
+
* `width`. In case of `left` or `right`, it will be the `height`.
|
2081
|
+
*
|
2082
|
+
* You can provide a single value (as `Number` or `String`), or a pair of values
|
2083
|
+
* as `String` divided by a comma or one (or more) white spaces.<br />
|
2084
|
+
* The latter is a deprecated method because it leads to confusion and will be
|
2085
|
+
* removed in v2.<br />
|
2086
|
+
* Additionally, it accepts additions and subtractions between different units.
|
2087
|
+
* Note that multiplications and divisions aren't supported.
|
2088
|
+
*
|
2089
|
+
* Valid examples are:
|
2090
|
+
* ```
|
2091
|
+
* 10
|
2092
|
+
* '10%'
|
2093
|
+
* '10, 10'
|
2094
|
+
* '10%, 10'
|
2095
|
+
* '10 + 10%'
|
2096
|
+
* '10 - 5vh + 3%'
|
2097
|
+
* '-10px + 5vh, 5px - 6%'
|
2098
|
+
* ```
|
2099
|
+
* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
|
2100
|
+
* > with their reference element, unfortunately, you will have to disable the `flip` modifier.
|
2101
|
+
* > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
|
2102
|
+
*
|
2103
|
+
* @memberof modifiers
|
2104
|
+
* @inner
|
2105
|
+
*/
|
2106
|
+
offset: {
|
2107
|
+
/** @prop {number} order=200 - Index used to define the order of execution */
|
2108
|
+
order: 200,
|
2109
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2110
|
+
enabled: true,
|
2111
|
+
/** @prop {ModifierFn} */
|
2112
|
+
fn: offset,
|
2113
|
+
/** @prop {Number|String} offset=0
|
2114
|
+
* The offset value as described in the modifier description
|
2115
|
+
*/
|
2116
|
+
offset: 0
|
2117
|
+
},
|
2118
|
+
|
2119
|
+
/**
|
2120
|
+
* Modifier used to prevent the popper from being positioned outside the boundary.
|
2121
|
+
*
|
2122
|
+
* A scenario exists where the reference itself is not within the boundaries.<br />
|
2123
|
+
* We can say it has "escaped the boundaries" — or just "escaped".<br />
|
2124
|
+
* In this case we need to decide whether the popper should either:
|
2125
|
+
*
|
2126
|
+
* - detach from the reference and remain "trapped" in the boundaries, or
|
2127
|
+
* - if it should ignore the boundary and "escape with its reference"
|
2128
|
+
*
|
2129
|
+
* When `escapeWithReference` is set to`true` and reference is completely
|
2130
|
+
* outside its boundaries, the popper will overflow (or completely leave)
|
2131
|
+
* the boundaries in order to remain attached to the edge of the reference.
|
2132
|
+
*
|
2133
|
+
* @memberof modifiers
|
2134
|
+
* @inner
|
2135
|
+
*/
|
2136
|
+
preventOverflow: {
|
2137
|
+
/** @prop {number} order=300 - Index used to define the order of execution */
|
2138
|
+
order: 300,
|
2139
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2140
|
+
enabled: true,
|
2141
|
+
/** @prop {ModifierFn} */
|
2142
|
+
fn: preventOverflow,
|
2143
|
+
/**
|
2144
|
+
* @prop {Array} [priority=['left','right','top','bottom']]
|
2145
|
+
* Popper will try to prevent overflow following these priorities by default,
|
2146
|
+
* then, it could overflow on the left and on top of the `boundariesElement`
|
2147
|
+
*/
|
2148
|
+
priority: ['left', 'right', 'top', 'bottom'],
|
2149
|
+
/**
|
2150
|
+
* @prop {number} padding=5
|
2151
|
+
* Amount of pixel used to define a minimum distance between the boundaries
|
2152
|
+
* and the popper. This makes sure the popper always has a little padding
|
2153
|
+
* between the edges of its container
|
2154
|
+
*/
|
2155
|
+
padding: 5,
|
2156
|
+
/**
|
2157
|
+
* @prop {String|HTMLElement} boundariesElement='scrollParent'
|
2158
|
+
* Boundaries used by the modifier. Can be `scrollParent`, `window`,
|
2159
|
+
* `viewport` or any DOM element.
|
2160
|
+
*/
|
2161
|
+
boundariesElement: 'scrollParent'
|
2162
|
+
},
|
2163
|
+
|
2164
|
+
/**
|
2165
|
+
* Modifier used to make sure the reference and its popper stay near each other
|
2166
|
+
* without leaving any gap between the two. Especially useful when the arrow is
|
2167
|
+
* enabled and you want to ensure that it points to its reference element.
|
2168
|
+
* It cares only about the first axis. You can still have poppers with margin
|
2169
|
+
* between the popper and its reference element.
|
2170
|
+
* @memberof modifiers
|
2171
|
+
* @inner
|
2172
|
+
*/
|
2173
|
+
keepTogether: {
|
2174
|
+
/** @prop {number} order=400 - Index used to define the order of execution */
|
2175
|
+
order: 400,
|
2176
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2177
|
+
enabled: true,
|
2178
|
+
/** @prop {ModifierFn} */
|
2179
|
+
fn: keepTogether
|
2180
|
+
},
|
2181
|
+
|
2182
|
+
/**
|
2183
|
+
* This modifier is used to move the `arrowElement` of the popper to make
|
2184
|
+
* sure it is positioned between the reference element and its popper element.
|
2185
|
+
* It will read the outer size of the `arrowElement` node to detect how many
|
2186
|
+
* pixels of conjunction are needed.
|
2187
|
+
*
|
2188
|
+
* It has no effect if no `arrowElement` is provided.
|
2189
|
+
* @memberof modifiers
|
2190
|
+
* @inner
|
2191
|
+
*/
|
2192
|
+
arrow: {
|
2193
|
+
/** @prop {number} order=500 - Index used to define the order of execution */
|
2194
|
+
order: 500,
|
2195
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2196
|
+
enabled: true,
|
2197
|
+
/** @prop {ModifierFn} */
|
2198
|
+
fn: arrow,
|
2199
|
+
/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
|
2200
|
+
element: '[x-arrow]'
|
2201
|
+
},
|
2202
|
+
|
2203
|
+
/**
|
2204
|
+
* Modifier used to flip the popper's placement when it starts to overlap its
|
2205
|
+
* reference element.
|
2206
|
+
*
|
2207
|
+
* Requires the `preventOverflow` modifier before it in order to work.
|
2208
|
+
*
|
2209
|
+
* **NOTE:** this modifier will interrupt the current update cycle and will
|
2210
|
+
* restart it if it detects the need to flip the placement.
|
2211
|
+
* @memberof modifiers
|
2212
|
+
* @inner
|
2213
|
+
*/
|
2214
|
+
flip: {
|
2215
|
+
/** @prop {number} order=600 - Index used to define the order of execution */
|
2216
|
+
order: 600,
|
2217
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2218
|
+
enabled: true,
|
2219
|
+
/** @prop {ModifierFn} */
|
2220
|
+
fn: flip,
|
2221
|
+
/**
|
2222
|
+
* @prop {String|Array} behavior='flip'
|
2223
|
+
* The behavior used to change the popper's placement. It can be one of
|
2224
|
+
* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
|
2225
|
+
* placements (with optional variations)
|
2226
|
+
*/
|
2227
|
+
behavior: 'flip',
|
2228
|
+
/**
|
2229
|
+
* @prop {number} padding=5
|
2230
|
+
* The popper will flip if it hits the edges of the `boundariesElement`
|
2231
|
+
*/
|
2232
|
+
padding: 5,
|
2233
|
+
/**
|
2234
|
+
* @prop {String|HTMLElement} boundariesElement='viewport'
|
2235
|
+
* The element which will define the boundaries of the popper position.
|
2236
|
+
* The popper will never be placed outside of the defined boundaries
|
2237
|
+
* (except if `keepTogether` is enabled)
|
2238
|
+
*/
|
2239
|
+
boundariesElement: 'viewport',
|
2240
|
+
/**
|
2241
|
+
* @prop {Boolean} flipVariations=false
|
2242
|
+
* The popper will switch placement variation between `-start` and `-end` when
|
2243
|
+
* the reference element overlaps its boundaries.
|
2244
|
+
*
|
2245
|
+
* The original placement should have a set variation.
|
2246
|
+
*/
|
2247
|
+
flipVariations: false,
|
2248
|
+
/**
|
2249
|
+
* @prop {Boolean} flipVariationsByContent=false
|
2250
|
+
* The popper will switch placement variation between `-start` and `-end` when
|
2251
|
+
* the popper element overlaps its reference boundaries.
|
2252
|
+
*
|
2253
|
+
* The original placement should have a set variation.
|
2254
|
+
*/
|
2255
|
+
flipVariationsByContent: false
|
2256
|
+
},
|
2257
|
+
|
2258
|
+
/**
|
2259
|
+
* Modifier used to make the popper flow toward the inner of the reference element.
|
2260
|
+
* By default, when this modifier is disabled, the popper will be placed outside
|
2261
|
+
* the reference element.
|
2262
|
+
* @memberof modifiers
|
2263
|
+
* @inner
|
2264
|
+
*/
|
2265
|
+
inner: {
|
2266
|
+
/** @prop {number} order=700 - Index used to define the order of execution */
|
2267
|
+
order: 700,
|
2268
|
+
/** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
|
2269
|
+
enabled: false,
|
2270
|
+
/** @prop {ModifierFn} */
|
2271
|
+
fn: inner
|
2272
|
+
},
|
2273
|
+
|
2274
|
+
/**
|
2275
|
+
* Modifier used to hide the popper when its reference element is outside of the
|
2276
|
+
* popper boundaries. It will set a `x-out-of-boundaries` attribute which can
|
2277
|
+
* be used to hide with a CSS selector the popper when its reference is
|
2278
|
+
* out of boundaries.
|
2279
|
+
*
|
2280
|
+
* Requires the `preventOverflow` modifier before it in order to work.
|
2281
|
+
* @memberof modifiers
|
2282
|
+
* @inner
|
2283
|
+
*/
|
2284
|
+
hide: {
|
2285
|
+
/** @prop {number} order=800 - Index used to define the order of execution */
|
2286
|
+
order: 800,
|
2287
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2288
|
+
enabled: true,
|
2289
|
+
/** @prop {ModifierFn} */
|
2290
|
+
fn: hide
|
2291
|
+
},
|
2292
|
+
|
2293
|
+
/**
|
2294
|
+
* Computes the style that will be applied to the popper element to gets
|
2295
|
+
* properly positioned.
|
2296
|
+
*
|
2297
|
+
* Note that this modifier will not touch the DOM, it just prepares the styles
|
2298
|
+
* so that `applyStyle` modifier can apply it. This separation is useful
|
2299
|
+
* in case you need to replace `applyStyle` with a custom implementation.
|
2300
|
+
*
|
2301
|
+
* This modifier has `850` as `order` value to maintain backward compatibility
|
2302
|
+
* with previous versions of Popper.js. Expect the modifiers ordering method
|
2303
|
+
* to change in future major versions of the library.
|
2304
|
+
*
|
2305
|
+
* @memberof modifiers
|
2306
|
+
* @inner
|
2307
|
+
*/
|
2308
|
+
computeStyle: {
|
2309
|
+
/** @prop {number} order=850 - Index used to define the order of execution */
|
2310
|
+
order: 850,
|
2311
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2312
|
+
enabled: true,
|
2313
|
+
/** @prop {ModifierFn} */
|
2314
|
+
fn: computeStyle,
|
2315
|
+
/**
|
2316
|
+
* @prop {Boolean} gpuAcceleration=true
|
2317
|
+
* If true, it uses the CSS 3D transformation to position the popper.
|
2318
|
+
* Otherwise, it will use the `top` and `left` properties
|
2319
|
+
*/
|
2320
|
+
gpuAcceleration: true,
|
2321
|
+
/**
|
2322
|
+
* @prop {string} [x='bottom']
|
2323
|
+
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
|
2324
|
+
* Change this if your popper should grow in a direction different from `bottom`
|
2325
|
+
*/
|
2326
|
+
x: 'bottom',
|
2327
|
+
/**
|
2328
|
+
* @prop {string} [x='left']
|
2329
|
+
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
|
2330
|
+
* Change this if your popper should grow in a direction different from `right`
|
2331
|
+
*/
|
2332
|
+
y: 'right'
|
2333
|
+
},
|
2334
|
+
|
2335
|
+
/**
|
2336
|
+
* Applies the computed styles to the popper element.
|
2337
|
+
*
|
2338
|
+
* All the DOM manipulations are limited to this modifier. This is useful in case
|
2339
|
+
* you want to integrate Popper.js inside a framework or view library and you
|
2340
|
+
* want to delegate all the DOM manipulations to it.
|
2341
|
+
*
|
2342
|
+
* Note that if you disable this modifier, you must make sure the popper element
|
2343
|
+
* has its position set to `absolute` before Popper.js can do its work!
|
2344
|
+
*
|
2345
|
+
* Just disable this modifier and define your own to achieve the desired effect.
|
2346
|
+
*
|
2347
|
+
* @memberof modifiers
|
2348
|
+
* @inner
|
2349
|
+
*/
|
2350
|
+
applyStyle: {
|
2351
|
+
/** @prop {number} order=900 - Index used to define the order of execution */
|
2352
|
+
order: 900,
|
2353
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2354
|
+
enabled: true,
|
2355
|
+
/** @prop {ModifierFn} */
|
2356
|
+
fn: applyStyle,
|
2357
|
+
/** @prop {Function} */
|
2358
|
+
onLoad: applyStyleOnLoad,
|
2359
|
+
/**
|
2360
|
+
* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
|
2361
|
+
* @prop {Boolean} gpuAcceleration=true
|
2362
|
+
* If true, it uses the CSS 3D transformation to position the popper.
|
2363
|
+
* Otherwise, it will use the `top` and `left` properties
|
2364
|
+
*/
|
2365
|
+
gpuAcceleration: undefined
|
2366
|
+
}
|
2367
|
+
};
|
2368
|
+
|
2369
|
+
/**
|
2370
|
+
* The `dataObject` is an object containing all the information used by Popper.js.
|
2371
|
+
* This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
|
2372
|
+
* @name dataObject
|
2373
|
+
* @property {Object} data.instance The Popper.js instance
|
2374
|
+
* @property {String} data.placement Placement applied to popper
|
2375
|
+
* @property {String} data.originalPlacement Placement originally defined on init
|
2376
|
+
* @property {Boolean} data.flipped True if popper has been flipped by flip modifier
|
2377
|
+
* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
|
2378
|
+
* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
|
2379
|
+
* @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
|
2380
|
+
* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
|
2381
|
+
* @property {Object} data.boundaries Offsets of the popper boundaries
|
2382
|
+
* @property {Object} data.offsets The measurements of popper, reference and arrow elements
|
2383
|
+
* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
|
2384
|
+
* @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
|
2385
|
+
* @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
|
2386
|
+
*/
|
2387
|
+
|
2388
|
+
/**
|
2389
|
+
* Default options provided to Popper.js constructor.<br />
|
2390
|
+
* These can be overridden using the `options` argument of Popper.js.<br />
|
2391
|
+
* To override an option, simply pass an object with the same
|
2392
|
+
* structure of the `options` object, as the 3rd argument. For example:
|
2393
|
+
* ```
|
2394
|
+
* new Popper(ref, pop, {
|
2395
|
+
* modifiers: {
|
2396
|
+
* preventOverflow: { enabled: false }
|
2397
|
+
* }
|
2398
|
+
* })
|
2399
|
+
* ```
|
2400
|
+
* @type {Object}
|
2401
|
+
* @static
|
2402
|
+
* @memberof Popper
|
2403
|
+
*/
|
2404
|
+
var Defaults = {
|
2405
|
+
/**
|
2406
|
+
* Popper's placement.
|
2407
|
+
* @prop {Popper.placements} placement='bottom'
|
2408
|
+
*/
|
2409
|
+
placement: 'bottom',
|
2410
|
+
|
2411
|
+
/**
|
2412
|
+
* Set this to true if you want popper to position it self in 'fixed' mode
|
2413
|
+
* @prop {Boolean} positionFixed=false
|
2414
|
+
*/
|
2415
|
+
positionFixed: false,
|
2416
|
+
|
2417
|
+
/**
|
2418
|
+
* Whether events (resize, scroll) are initially enabled.
|
2419
|
+
* @prop {Boolean} eventsEnabled=true
|
2420
|
+
*/
|
2421
|
+
eventsEnabled: true,
|
2422
|
+
|
2423
|
+
/**
|
2424
|
+
* Set to true if you want to automatically remove the popper when
|
2425
|
+
* you call the `destroy` method.
|
2426
|
+
* @prop {Boolean} removeOnDestroy=false
|
2427
|
+
*/
|
2428
|
+
removeOnDestroy: false,
|
2429
|
+
|
2430
|
+
/**
|
2431
|
+
* Callback called when the popper is created.<br />
|
2432
|
+
* By default, it is set to no-op.<br />
|
2433
|
+
* Access Popper.js instance with `data.instance`.
|
2434
|
+
* @prop {onCreate}
|
2435
|
+
*/
|
2436
|
+
onCreate: function onCreate() {},
|
2437
|
+
|
2438
|
+
/**
|
2439
|
+
* Callback called when the popper is updated. This callback is not called
|
2440
|
+
* on the initialization/creation of the popper, but only on subsequent
|
2441
|
+
* updates.<br />
|
2442
|
+
* By default, it is set to no-op.<br />
|
2443
|
+
* Access Popper.js instance with `data.instance`.
|
2444
|
+
* @prop {onUpdate}
|
2445
|
+
*/
|
2446
|
+
onUpdate: function onUpdate() {},
|
2447
|
+
|
2448
|
+
/**
|
2449
|
+
* List of modifiers used to modify the offsets before they are applied to the popper.
|
2450
|
+
* They provide most of the functionalities of Popper.js.
|
2451
|
+
* @prop {modifiers}
|
2452
|
+
*/
|
2453
|
+
modifiers: modifiers
|
2454
|
+
};
|
2455
|
+
|
2456
|
+
/**
|
2457
|
+
* @callback onCreate
|
2458
|
+
* @param {dataObject} data
|
2459
|
+
*/
|
2460
|
+
|
2461
|
+
/**
|
2462
|
+
* @callback onUpdate
|
2463
|
+
* @param {dataObject} data
|
2464
|
+
*/
|
2465
|
+
|
2466
|
+
// Utils
|
2467
|
+
// Methods
|
2468
|
+
var Popper = function () {
|
2469
|
+
/**
|
2470
|
+
* Creates a new Popper.js instance.
|
2471
|
+
* @class Popper
|
2472
|
+
* @param {Element|referenceObject} reference - The reference element used to position the popper
|
2473
|
+
* @param {Element} popper - The HTML / XML element used as the popper
|
2474
|
+
* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
|
2475
|
+
* @return {Object} instance - The generated Popper.js instance
|
2476
|
+
*/
|
2477
|
+
function Popper(reference, popper) {
|
2478
|
+
var _this = this;
|
2479
|
+
|
2480
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
2481
|
+
classCallCheck(this, Popper);
|
2482
|
+
|
2483
|
+
this.scheduleUpdate = function () {
|
2484
|
+
return requestAnimationFrame(_this.update);
|
2485
|
+
};
|
2486
|
+
|
2487
|
+
// make update() debounced, so that it only runs at most once-per-tick
|
2488
|
+
this.update = debounce(this.update.bind(this));
|
2489
|
+
|
2490
|
+
// with {} we create a new object with the options inside it
|
2491
|
+
this.options = _extends({}, Popper.Defaults, options);
|
2492
|
+
|
2493
|
+
// init state
|
2494
|
+
this.state = {
|
2495
|
+
isDestroyed: false,
|
2496
|
+
isCreated: false,
|
2497
|
+
scrollParents: []
|
2498
|
+
};
|
2499
|
+
|
2500
|
+
// get reference and popper elements (allow jQuery wrappers)
|
2501
|
+
this.reference = reference && reference.jquery ? reference[0] : reference;
|
2502
|
+
this.popper = popper && popper.jquery ? popper[0] : popper;
|
2503
|
+
|
2504
|
+
// Deep merge modifiers options
|
2505
|
+
this.options.modifiers = {};
|
2506
|
+
Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
|
2507
|
+
_this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
|
2508
|
+
});
|
2509
|
+
|
2510
|
+
// Refactoring modifiers' list (Object => Array)
|
2511
|
+
this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
|
2512
|
+
return _extends({
|
2513
|
+
name: name
|
2514
|
+
}, _this.options.modifiers[name]);
|
2515
|
+
})
|
2516
|
+
// sort the modifiers by order
|
2517
|
+
.sort(function (a, b) {
|
2518
|
+
return a.order - b.order;
|
2519
|
+
});
|
2520
|
+
|
2521
|
+
// modifiers have the ability to execute arbitrary code when Popper.js get inited
|
2522
|
+
// such code is executed in the same order of its modifier
|
2523
|
+
// they could add new properties to their options configuration
|
2524
|
+
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
|
2525
|
+
this.modifiers.forEach(function (modifierOptions) {
|
2526
|
+
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
|
2527
|
+
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
|
2528
|
+
}
|
2529
|
+
});
|
2530
|
+
|
2531
|
+
// fire the first update to position the popper in the right place
|
2532
|
+
this.update();
|
2533
|
+
|
2534
|
+
var eventsEnabled = this.options.eventsEnabled;
|
2535
|
+
if (eventsEnabled) {
|
2536
|
+
// setup event listeners, they will take care of update the position in specific situations
|
2537
|
+
this.enableEventListeners();
|
2538
|
+
}
|
2539
|
+
|
2540
|
+
this.state.eventsEnabled = eventsEnabled;
|
2541
|
+
}
|
2542
|
+
|
2543
|
+
// We can't use class properties because they don't get listed in the
|
2544
|
+
// class prototype and break stuff like Sinon stubs
|
2545
|
+
|
2546
|
+
|
2547
|
+
createClass(Popper, [{
|
2548
|
+
key: 'update',
|
2549
|
+
value: function update$$1() {
|
2550
|
+
return update.call(this);
|
2551
|
+
}
|
2552
|
+
}, {
|
2553
|
+
key: 'destroy',
|
2554
|
+
value: function destroy$$1() {
|
2555
|
+
return destroy.call(this);
|
2556
|
+
}
|
2557
|
+
}, {
|
2558
|
+
key: 'enableEventListeners',
|
2559
|
+
value: function enableEventListeners$$1() {
|
2560
|
+
return enableEventListeners.call(this);
|
2561
|
+
}
|
2562
|
+
}, {
|
2563
|
+
key: 'disableEventListeners',
|
2564
|
+
value: function disableEventListeners$$1() {
|
2565
|
+
return disableEventListeners.call(this);
|
2566
|
+
}
|
2567
|
+
|
2568
|
+
/**
|
2569
|
+
* Schedules an update. It will run on the next UI update available.
|
2570
|
+
* @method scheduleUpdate
|
2571
|
+
* @memberof Popper
|
2572
|
+
*/
|
2573
|
+
|
2574
|
+
|
2575
|
+
/**
|
2576
|
+
* Collection of utilities useful when writing custom modifiers.
|
2577
|
+
* Starting from version 1.7, this method is available only if you
|
2578
|
+
* include `popper-utils.js` before `popper.js`.
|
2579
|
+
*
|
2580
|
+
* **DEPRECATION**: This way to access PopperUtils is deprecated
|
2581
|
+
* and will be removed in v2! Use the PopperUtils module directly instead.
|
2582
|
+
* Due to the high instability of the methods contained in Utils, we can't
|
2583
|
+
* guarantee them to follow semver. Use them at your own risk!
|
2584
|
+
* @static
|
2585
|
+
* @private
|
2586
|
+
* @type {Object}
|
2587
|
+
* @deprecated since version 1.8
|
2588
|
+
* @member Utils
|
2589
|
+
* @memberof Popper
|
2590
|
+
*/
|
2591
|
+
|
2592
|
+
}]);
|
2593
|
+
return Popper;
|
2594
|
+
}();
|
2595
|
+
|
2596
|
+
/**
|
2597
|
+
* The `referenceObject` is an object that provides an interface compatible with Popper.js
|
2598
|
+
* and lets you use it as replacement of a real DOM node.<br />
|
2599
|
+
* You can use this method to position a popper relatively to a set of coordinates
|
2600
|
+
* in case you don't have a DOM node to use as reference.
|
2601
|
+
*
|
2602
|
+
* ```
|
2603
|
+
* new Popper(referenceObject, popperNode);
|
2604
|
+
* ```
|
2605
|
+
*
|
2606
|
+
* NB: This feature isn't supported in Internet Explorer 10.
|
2607
|
+
* @name referenceObject
|
2608
|
+
* @property {Function} data.getBoundingClientRect
|
2609
|
+
* A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
|
2610
|
+
* @property {number} data.clientWidth
|
2611
|
+
* An ES6 getter that will return the width of the virtual reference element.
|
2612
|
+
* @property {number} data.clientHeight
|
2613
|
+
* An ES6 getter that will return the height of the virtual reference element.
|
2614
|
+
*/
|
2615
|
+
|
2616
|
+
|
2617
|
+
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
|
2618
|
+
Popper.placements = placements;
|
2619
|
+
Popper.Defaults = Defaults;
|
2620
|
+
|
2621
|
+
return Popper;
|
2622
|
+
|
2623
|
+
})));
|