workarea-haven_theme 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +16 -0
- data/.eslintignore +1 -0
- data/.eslintrc +25 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +60 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +3 -0
- data/.scss-lint.yml +192 -0
- data/.stylelintrc.json +8 -0
- data/CHANGELOG.md +1847 -0
- data/Gemfile +24 -0
- data/README.md +199 -0
- data/Rakefile +60 -0
- data/app/assets/fonts/workarea/storefront/hind/hind_bold_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/hind/hind_bold_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/hind/hind_regular_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/hind/hind_regular_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_bold_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_bold_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_bolditalic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_bolditalic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_italic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_italic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_regular_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/lora/lora_regular_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_bold_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_bold_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_bolditalic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_bolditalic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_italic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_italic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_regular_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/muli/muli_regular_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_bold_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_bold_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_bolditalic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_bolditalic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_italic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_italic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_regular_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/playfair_display/playfairdisplay_regular_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_300.woff +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_300.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_500.woff +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_500.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_700.woff +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_700.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_regular.woff +0 -0
- data/app/assets/fonts/workarea/storefront/poppins/poppins_regular.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/pt_serif/pt_serif_700.woff +0 -0
- data/app/assets/fonts/workarea/storefront/pt_serif/pt_serif_700.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/pt_serif/pt_serif_regular.woff +0 -0
- data/app/assets/fonts/workarea/storefront/pt_serif/pt_serif_regular.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/roboto/roboto_bold_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/roboto/roboto_bold_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/roboto/roboto_italic_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/roboto/roboto_italic_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/roboto/roboto_regular_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/roboto/roboto_regular_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/source_serif_pro/source_serif_pro_bold_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/source_serif_pro/source_serif_pro_bold_webfont.woff2 +0 -0
- data/app/assets/fonts/workarea/storefront/source_serif_pro/source_serif_pro_regular_webfont.woff +0 -0
- data/app/assets/fonts/workarea/storefront/source_serif_pro/source_serif_pro_regular_webfont.woff2 +0 -0
- data/app/assets/images/workarea/core/product_placeholder.jpg +0 -0
- data/app/assets/images/workarea/storefront/dialog_close.svg +1 -0
- data/app/assets/images/workarea/storefront/favicon.ico +0 -0
- data/app/assets/images/workarea/storefront/icons/account.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/arrow_down.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/arrow_left.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/arrow_right.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/arrow_up.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/cart.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/checkmark.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/email.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/empty_star.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/eye.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/facebook.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/half_star.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/lock.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/long_arrow.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/menu.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/minus.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/plus.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/search.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/share.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/twitter.svg +1 -0
- data/app/assets/images/workarea/storefront/icons/x.svg +1 -0
- data/app/assets/images/workarea/storefront/logo.png +0 -0
- data/app/assets/images/workarea/storefront/style_guide_product.jpg +0 -0
- data/app/assets/images/workarea/storefront/style_guide_product_retina.jpg +0 -0
- data/app/assets/javascripts/workarea/storefront/haven_theme/config.js +44 -0
- data/app/assets/javascripts/workarea/storefront/modules/address_region_fields.js +93 -0
- data/app/assets/javascripts/workarea/storefront/modules/checkout_primary_payments.js +130 -0
- data/app/assets/javascripts/workarea/storefront/modules/expandable_filters.js +50 -0
- data/app/assets/javascripts/workarea/storefront/modules/mobile_filter_buttons.js +89 -0
- data/app/assets/javascripts/workarea/storefront/modules/mobile_nav_button.js +104 -0
- data/app/assets/javascripts/workarea/storefront/modules/product_detail_tabs.js +59 -0
- data/app/assets/javascripts/workarea/storefront/modules/quantity_control.js +56 -0
- data/app/assets/javascripts/workarea/storefront/modules/search_buttons.js +56 -0
- data/app/assets/javascripts/workarea/storefront/modules/toggle_class_button.js +43 -0
- data/app/assets/javascripts/workarea/storefront/modules/user_welcome_placeholder.js +38 -0
- data/app/assets/javascripts/workarea/storefront/reviews/modules/product_reviews_sort_menus.js +82 -0
- data/app/assets/javascripts/workarea/storefront/reviews/templates/sort_by_property.jst.ejs +13 -0
- data/app/assets/javascripts/workarea/storefront/templates/back_to_top_button.jst.ejs +3 -0
- data/app/assets/javascripts/workarea/storefront/templates/log_out_link.jst.ejs +1 -0
- data/app/assets/javascripts/workarea/storefront/templates/mobile_filters_nav_close_button.jst.ejs +3 -0
- data/app/assets/javascripts/workarea/storefront/templates/optional_field_prompt.jst.ejs +8 -0
- data/app/assets/javascripts/workarea/storefront/templates/saved_addresses_property.jst.ejs +23 -0
- data/app/assets/javascripts/workarea/storefront/templates/ui_menu_item.jst.ejs +9 -0
- data/app/assets/javascripts/workarea/storefront/templates/user_welcome.jst.ejs +7 -0
- data/app/assets/stylesheets/haven_theme/.keep +0 -0
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_autocomplete.scss +13 -0
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_dialog.scss +168 -0
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_menu.scss +133 -0
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_state_focus.scss +7 -0
- data/app/assets/stylesheets/jquery_ui/storefront/_ui_widget_overlay.scss +15 -0
- data/app/assets/stylesheets/workarea/product_badges/components/_badges.scss +83 -0
- data/app/assets/stylesheets/workarea/product_grid_content/components/_product_grid_cell_content_block.scss +32 -0
- data/app/assets/stylesheets/workarea/storefront/base/_forms.scss +224 -0
- data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_entry.scss +127 -0
- data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_entry_summary.scss +166 -0
- data/app/assets/stylesheets/workarea/storefront/blog/components/_blog_index.scss +25 -0
- data/app/assets/stylesheets/workarea/storefront/blog/components/_featured_entry_content_block.scss +9 -0
- data/app/assets/stylesheets/workarea/storefront/components/_account_menu.scss +50 -0
- data/app/assets/stylesheets/workarea/storefront/components/_add_to_cart.scss +51 -0
- data/app/assets/stylesheets/workarea/storefront/components/_back_to_top_button.scss +30 -0
- data/app/assets/stylesheets/workarea/storefront/components/_box.scss +44 -0
- data/app/assets/stylesheets/workarea/storefront/components/_breadcrumbs.scss +53 -0
- data/app/assets/stylesheets/workarea/storefront/components/_button.scss +153 -0
- data/app/assets/stylesheets/workarea/storefront/components/_button_property.scss +46 -0
- data/app/assets/stylesheets/workarea/storefront/components/_cart.scss +85 -0
- data/app/assets/stylesheets/workarea/storefront/components/_category_summary_content_block.scss +27 -0
- data/app/assets/stylesheets/workarea/storefront/components/_checkout_addresses.scss +21 -0
- data/app/assets/stylesheets/workarea/storefront/components/_checkout_confirmation.scss +57 -0
- data/app/assets/stylesheets/workarea/storefront/components/_checkout_payment.scss +80 -0
- data/app/assets/stylesheets/workarea/storefront/components/_checkout_progress.scss +149 -0
- data/app/assets/stylesheets/workarea/storefront/components/_checkout_shipping.scss +15 -0
- data/app/assets/stylesheets/workarea/storefront/components/_checkout_step_summary.scss +81 -0
- data/app/assets/stylesheets/workarea/storefront/components/_color_box.scss +83 -0
- data/app/assets/stylesheets/workarea/storefront/components/_content_block.scss +56 -0
- data/app/assets/stylesheets/workarea/storefront/components/_data_card.scss +70 -0
- data/app/assets/stylesheets/workarea/storefront/components/_divider_content_block.scss +39 -0
- data/app/assets/stylesheets/workarea/storefront/components/_email_signup.scss +61 -0
- data/app/assets/stylesheets/workarea/storefront/components/_email_signup_view.scss +18 -0
- data/app/assets/stylesheets/workarea/storefront/components/_hero_content_block.scss +77 -0
- data/app/assets/stylesheets/workarea/storefront/components/_image_and_text_content_block.scss +29 -0
- data/app/assets/stylesheets/workarea/storefront/components/_image_content_block.scss +16 -0
- data/app/assets/stylesheets/workarea/storefront/components/_image_group_content_block.scss +9 -0
- data/app/assets/stylesheets/workarea/storefront/components/_loading.scss +92 -0
- data/app/assets/stylesheets/workarea/storefront/components/_login.scss +47 -0
- data/app/assets/stylesheets/workarea/storefront/components/_mobile_filters.scss +51 -0
- data/app/assets/stylesheets/workarea/storefront/components/_mobile_filters_nav.scss +42 -0
- data/app/assets/stylesheets/workarea/storefront/components/_mobile_nav.scss +120 -0
- data/app/assets/stylesheets/workarea/storefront/components/_option_button.scss +48 -0
- data/app/assets/stylesheets/workarea/storefront/components/_order_details.scss +55 -0
- data/app/assets/stylesheets/workarea/storefront/components/_order_summary.scss +34 -0
- data/app/assets/stylesheets/workarea/storefront/components/_overlay.scss +20 -0
- data/app/assets/stylesheets/workarea/storefront/components/_page_content.scss +96 -0
- data/app/assets/stylesheets/workarea/storefront/components/_page_footer.scss +53 -0
- data/app/assets/stylesheets/workarea/storefront/components/_page_header.scss +208 -0
- data/app/assets/stylesheets/workarea/storefront/components/_pagination.scss +12 -0
- data/app/assets/stylesheets/workarea/storefront/components/_payment_icon.scss +37 -0
- data/app/assets/stylesheets/workarea/storefront/components/_personalized_recommendations_content_block.scss +19 -0
- data/app/assets/stylesheets/workarea/storefront/components/_primary_nav.scss +75 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_detail_container.scss +177 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_details.scss +105 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_insights_content_block.scss +22 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_list.scss +186 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_list_content_block.scss +22 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_media.scss +70 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_prices.scss +82 -0
- data/app/assets/stylesheets/workarea/storefront/components/_product_summary.scss +104 -0
- data/app/assets/stylesheets/workarea/storefront/components/_property.scss +71 -0
- data/app/assets/stylesheets/workarea/storefront/components/_quantity_control.scss +101 -0
- data/app/assets/stylesheets/workarea/storefront/components/_quote_content_block.scss +42 -0
- data/app/assets/stylesheets/workarea/storefront/components/_recent_views.scss +46 -0
- data/app/assets/stylesheets/workarea/storefront/components/_recommendations.scss +31 -0
- data/app/assets/stylesheets/workarea/storefront/components/_result_filters.scss.erb +203 -0
- data/app/assets/stylesheets/workarea/storefront/components/_search.scss +64 -0
- data/app/assets/stylesheets/workarea/storefront/components/_search_no_results.scss +34 -0
- data/app/assets/stylesheets/workarea/storefront/components/_secondary_nav.scss +58 -0
- data/app/assets/stylesheets/workarea/storefront/components/_social_networks_content_block.scss +46 -0
- data/app/assets/stylesheets/workarea/storefront/components/_svg_icon.scss +80 -0
- data/app/assets/stylesheets/workarea/storefront/components/_table.scss +57 -0
- data/app/assets/stylesheets/workarea/storefront/components/_taxonomy_content_block.scss +138 -0
- data/app/assets/stylesheets/workarea/storefront/components/_text_box.scss +82 -0
- data/app/assets/stylesheets/workarea/storefront/components/_text_content_block.scss +5 -0
- data/app/assets/stylesheets/workarea/storefront/components/_value.scss +85 -0
- data/app/assets/stylesheets/workarea/storefront/components/_video_and_text_content_block.scss +42 -0
- data/app/assets/stylesheets/workarea/storefront/content_search/components/_search_autocomplete.scss +20 -0
- data/app/assets/stylesheets/workarea/storefront/email/_settings.scss +23 -0
- data/app/assets/stylesheets/workarea/storefront/generic/_fonts.scss.erb +11 -0
- data/app/assets/stylesheets/workarea/storefront/objects/_content_wrapper.scss +19 -0
- data/app/assets/stylesheets/workarea/storefront/package_products/components/_product_detail_packaged_products.scss +29 -0
- data/app/assets/stylesheets/workarea/storefront/product_quickview/components/_quickview_button.scss +22 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_rating.scss +41 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_reviews.scss +93 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_reviews_aggregate.scss +54 -0
- data/app/assets/stylesheets/workarea/storefront/reviews/components/_write_review.scss +65 -0
- data/app/assets/stylesheets/workarea/storefront/search_autocomplete/components/_search_autocomplete.scss +56 -0
- data/app/assets/stylesheets/workarea/storefront/settings/_colors.scss.erb +17 -0
- data/app/assets/stylesheets/workarea/storefront/settings/_font_families.scss.erb +6 -0
- data/app/assets/stylesheets/workarea/storefront/settings/_global.scss +36 -0
- data/app/assets/stylesheets/workarea/storefront/settings/_typography.scss +19 -0
- data/app/assets/stylesheets/workarea/storefront/settings/_z_indexes.scss +39 -0
- data/app/assets/stylesheets/workarea/storefront/share/components/_share_buttons.scss +139 -0
- data/app/assets/stylesheets/workarea/storefront/slick_slider/components/_slick_slider.scss +140 -0
- data/app/assets/stylesheets/workarea/storefront/swatches/components/_swatch_facet.scss +37 -0
- data/app/assets/stylesheets/workarea/storefront/swatches/components/_swatch_options.scss +79 -0
- data/app/assets/stylesheets/workarea/storefront/theme/_style_guide.scss +9 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/color_schemes/_haven_color_scheme.scss +276 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/color_schemes/_lagoon_color_scheme.scss +279 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_hind.scss +21 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_lora.scss +37 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_muli.scss +37 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_playfair_display.scss +37 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_poppins.scss +40 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_pt_serif.scss +22 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_roboto.scss +29 -0
- data/app/assets/stylesheets/workarea/storefront/theme_config/fonts/_source_serif_pro.scss +21 -0
- data/app/assets/stylesheets/workarea/storefront/tools/_focus_ring.scss +22 -0
- data/app/assets/stylesheets/workarea/storefront/tools/_full_bleed_container.scss +15 -0
- data/app/assets/stylesheets/workarea/storefront/typography/_headings.scss +144 -0
- data/app/assets/stylesheets/workarea/storefront/typography/_links.scss +47 -0
- data/app/assets/stylesheets/workarea/storefront/typography/_text.scss +45 -0
- data/app/assets/stylesheets/workarea/styled_selects/components/_styled_select.scss +64 -0
- data/app/helpers/workarea/storefront/applied_facets_helper.rb +30 -0
- data/app/helpers/workarea/storefront/haven_blog_helper.rb +12 -0
- data/app/helpers/workarea/storefront/haven_swatches_helper.rb +24 -0
- data/app/helpers/workarea/storefront/product_media_slider_helper.rb +37 -0
- data/app/helpers/workarea/storefront/product_retina_image_srcset_helper.rb +9 -0
- data/app/seeds/workarea/haven_categories_seeds.rb +42 -0
- data/app/seeds/workarea/haven_demo_product_seeds.rb +94 -0
- data/app/seeds/workarea/theme_layout_content_seeds.rb +59 -0
- data/app/view_models/workarea/storefront/blog_entry_view_model.decorator +11 -0
- data/app/view_models/workarea/storefront/cart_content.rb +19 -0
- data/app/view_models/workarea/storefront/cart_view_model.decorator +7 -0
- data/app/view_models/workarea/storefront/content_blocks/hero_view_model.decorator +19 -0
- data/app/view_models/workarea/storefront/content_blocks/product_grid_cell_view_model.decorator +11 -0
- data/app/view_models/workarea/storefront/product_view_model.decorator +19 -0
- data/app/views/layouts/workarea/storefront/application.html.haml +194 -0
- data/app/views/layouts/workarea/storefront/checkout.html.haml +82 -0
- data/app/views/workarea/storefront/blog_comments/index.html.haml +29 -0
- data/app/views/workarea/storefront/blog_entries/_summary.html.haml +32 -0
- data/app/views/workarea/storefront/blog_entries/show.html.haml +84 -0
- data/app/views/workarea/storefront/blogs/_blog_navigation.html.haml +9 -0
- data/app/views/workarea/storefront/blogs/index.html.haml +25 -0
- data/app/views/workarea/storefront/blogs/show.html.haml +31 -0
- data/app/views/workarea/storefront/cart_items/create.html.haml +76 -0
- data/app/views/workarea/storefront/cart_items/package.html.haml +64 -0
- data/app/views/workarea/storefront/carts/_pricing.html.haml +12 -0
- data/app/views/workarea/storefront/carts/show.html.haml +172 -0
- data/app/views/workarea/storefront/categories/show.html.haml +131 -0
- data/app/views/workarea/storefront/checkouts/_checkout_progress.html.haml +26 -0
- data/app/views/workarea/storefront/checkouts/_gift_card_payment.html.haml +34 -0
- data/app/views/workarea/storefront/checkouts/_summary.html.haml +175 -0
- data/app/views/workarea/storefront/checkouts/addresses.html.haml +56 -0
- data/app/views/workarea/storefront/checkouts/confirmation.html.haml +56 -0
- data/app/views/workarea/storefront/checkouts/payment.html.haml +110 -0
- data/app/views/workarea/storefront/content_blocks/_blog_entry.html.haml +5 -0
- data/app/views/workarea/storefront/content_blocks/_category_summary.html.haml +16 -0
- data/app/views/workarea/storefront/content_blocks/_hero.html.haml +3 -0
- data/app/views/workarea/storefront/content_blocks/_product_grid_cell.html.haml +25 -0
- data/app/views/workarea/storefront/content_blocks/_product_insights.html.haml +12 -0
- data/app/views/workarea/storefront/content_blocks/_product_list.html.haml +12 -0
- data/app/views/workarea/storefront/content_blocks/_social_networks.html.haml +17 -0
- data/app/views/workarea/storefront/content_blocks/_taxonomy.html.haml +27 -0
- data/app/views/workarea/storefront/content_blocks/_three_column_taxonomy.html.haml +28 -0
- data/app/views/workarea/storefront/content_blocks/_two_column_taxonomy.html.haml +28 -0
- data/app/views/workarea/storefront/email_signups/_form.html.haml +9 -0
- data/app/views/workarea/storefront/email_signups/show.html.haml +8 -0
- data/app/views/workarea/storefront/facets/_applied.html.haml +13 -0
- data/app/views/workarea/storefront/facets/_range.html.haml +15 -0
- data/app/views/workarea/storefront/facets/_swatches.html.haml +16 -0
- data/app/views/workarea/storefront/facets/_terms.html.haml +15 -0
- data/app/views/workarea/storefront/menus/show.html.haml +10 -0
- data/app/views/workarea/storefront/orders/_details.haml +143 -0
- data/app/views/workarea/storefront/orders/_summary.html.haml +75 -0
- data/app/views/workarea/storefront/orders/index.html.haml +47 -0
- data/app/views/workarea/storefront/orders/show.html.haml +19 -0
- data/app/views/workarea/storefront/products/_media.html.haml +42 -0
- data/app/views/workarea/storefront/products/_pricing.html.haml +34 -0
- data/app/views/workarea/storefront/products/_rating.html.haml +9 -0
- data/app/views/workarea/storefront/products/_reviews.html.haml +34 -0
- data/app/views/workarea/storefront/products/_reviews_aggregate.html.haml +13 -0
- data/app/views/workarea/storefront/products/_summary.html.haml +16 -0
- data/app/views/workarea/storefront/products/_swatch_summary.html.haml +20 -0
- data/app/views/workarea/storefront/products/_video_thumbnail.html.haml +11 -0
- data/app/views/workarea/storefront/products/package_show.html.haml +50 -0
- data/app/views/workarea/storefront/products/show.html.haml +95 -0
- data/app/views/workarea/storefront/products/templates/_family.html.haml +28 -0
- data/app/views/workarea/storefront/products/templates/_generic.html.haml +57 -0
- data/app/views/workarea/storefront/products/templates/_gift_card.html.haml +68 -0
- data/app/views/workarea/storefront/products/templates/_option_selects.html.haml +59 -0
- data/app/views/workarea/storefront/products/templates/_option_thumbnails.html.haml +66 -0
- data/app/views/workarea/storefront/products/templates/_package.html.haml +22 -0
- data/app/views/workarea/storefront/products/templates/_swatches.html.haml +72 -0
- data/app/views/workarea/storefront/recent_views/show.html.haml +21 -0
- data/app/views/workarea/storefront/recommendations/show.html.haml +13 -0
- data/app/views/workarea/storefront/reviews/new.html.haml +71 -0
- data/app/views/workarea/storefront/searches/autocomplete.html.haml +35 -0
- data/app/views/workarea/storefront/searches/content.html.haml +72 -0
- data/app/views/workarea/storefront/searches/no_results.html.haml +33 -0
- data/app/views/workarea/storefront/searches/show.html.haml +118 -0
- data/app/views/workarea/storefront/shared/_address_fields.html.haml +99 -0
- data/app/views/workarea/storefront/shared/_left_navigation.html.haml +26 -0
- data/app/views/workarea/storefront/shares/_share_buttons.html.haml +19 -0
- data/app/views/workarea/storefront/shares/new.html.haml +53 -0
- data/app/views/workarea/storefront/style_guides/components/_button.html.haml +100 -0
- data/app/views/workarea/storefront/style_guides/components/_data_card.html.haml +218 -0
- data/app/views/workarea/storefront/style_guides/components/_mobile_filters.html.haml +146 -0
- data/app/views/workarea/storefront/style_guides/components/_personalized_recommendations_content_block.html.haml +34 -0
- data/app/views/workarea/storefront/style_guides/components/_product_insights_content_block.html.haml +34 -0
- data/app/views/workarea/storefront/style_guides/components/_product_list.html.haml +222 -0
- data/app/views/workarea/storefront/style_guides/components/_product_list_content_block.html.haml +34 -0
- data/app/views/workarea/storefront/style_guides/components/_product_summary.html.haml +47 -0
- data/app/views/workarea/storefront/style_guides/components/_property.html.haml +93 -0
- data/app/views/workarea/storefront/style_guides/components/_recommendations.html.haml +43 -0
- data/app/views/workarea/storefront/style_guides/components/_social_networks_content_block.html.haml +20 -0
- data/app/views/workarea/storefront/style_guides/components/_svg_icon.html.haml +76 -0
- data/app/views/workarea/storefront/style_guides/components/_value.html.haml +90 -0
- data/app/views/workarea/storefront/style_guides/settings/_color_variables.html.haml +90 -0
- data/app/views/workarea/storefront/style_guides/settings/color_schemes/_haven_color_scheme.html.haml +8 -0
- data/app/views/workarea/storefront/style_guides/settings/color_schemes/_lagoon_color_scheme.html.haml +8 -0
- data/app/views/workarea/storefront/style_guides/typography/_fonts.html.haml +13 -0
- data/app/views/workarea/storefront/style_guides/typography/_headings.html.haml +53 -0
- data/app/views/workarea/storefront/style_guides/typography/_links.html.haml +27 -0
- data/app/views/workarea/storefront/style_guides/typography/_text.html.haml +27 -0
- data/app/views/workarea/storefront/users/_haven_current_user.json.jbuilder +1 -0
- data/app/views/workarea/storefront/users/accounts/edit.html.haml +48 -0
- data/app/views/workarea/storefront/users/accounts/show.html.haml +119 -0
- data/app/views/workarea/storefront/users/addresses/edit.html.haml +24 -0
- data/app/views/workarea/storefront/users/addresses/new.html.haml +24 -0
- data/app/views/workarea/storefront/users/credit_cards/edit.html.haml +71 -0
- data/app/views/workarea/storefront/users/credit_cards/new.html.haml +66 -0
- data/app/views/workarea/storefront/users/logins/new.html.haml +60 -0
- data/app/views/workarea/storefront/users/orders/_summary.html.haml +25 -0
- data/app/views/workarea/storefront/users/orders/index.html.haml +23 -0
- data/app/views/workarea/storefront/users/orders/show.html.haml +22 -0
- data/app/views/workarea/storefront/users/passwords/change.html.haml +25 -0
- data/app/views/workarea/storefront/users/passwords/edit.html.haml +16 -0
- data/app/views/workarea/storefront/users/passwords/new.html.haml +27 -0
- data/bin/rails +20 -0
- data/browserslist +3 -0
- data/config/initializers/appends.rb +94 -0
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/content_block_types.rb +95 -0
- data/config/initializers/dragonfly.rb +74 -0
- data/config/initializers/seeds.rb +3 -0
- data/config/initializers/theme.rb +68 -0
- data/config/initializers/workarea.rb +3 -0
- data/config/locales/en.yml +63 -0
- data/data/content_assets/product_grid_content_2_cell_background.jpg +0 -0
- data/data/content_assets/product_grid_content_background.jpg +0 -0
- data/data/content_assets/taxonomy_content_image.jpg +0 -0
- data/data/workarea/images/products/Clock.jpg +0 -0
- data/data/workarea/images/products/Headphones.jpg +0 -0
- data/data/workarea/images/products/Scissors.jpg +0 -0
- data/data/workarea/images/products/bookends.jpg +0 -0
- data/data/workarea/images/products/camera.jpg +0 -0
- data/data/workarea/images/products/coffee.jpg +0 -0
- data/data/workarea/images/products/lamp1.jpg +0 -0
- data/data/workarea/images/products/lamp2.png +0 -0
- data/data/workarea/images/products/lamp3.jpg +0 -0
- data/data/workarea/images/products/pen.jpg +0 -0
- data/data/workarea/images/products/plant.jpg +0 -0
- data/data/workarea/images/products/plant2.jpg +0 -0
- data/data/workarea/images/products/table.jpg +0 -0
- data/data/workarea/images/products/table2.jpg +0 -0
- data/data/workarea/images/products/table3.jpg +0 -0
- data/lib/tasks/haven_theme_tasks.rake +20 -0
- data/lib/workarea/haven_theme.rb +30 -0
- data/lib/workarea/haven_theme/engine.rb +17 -0
- data/lib/workarea/haven_theme/version.rb +5 -0
- data/package.json +9 -0
- data/public/screenshots/account.png +0 -0
- data/public/screenshots/blog.png +0 -0
- data/public/screenshots/blog_entry.png +0 -0
- data/public/screenshots/cart.png +0 -0
- data/public/screenshots/category_page.png +0 -0
- data/public/screenshots/checkout.png +0 -0
- data/public/screenshots/full_screen_search.png +0 -0
- data/public/screenshots/product_detail_page.png +0 -0
- data/script/admin_ci +9 -0
- data/script/ci +11 -0
- data/script/core_ci +9 -0
- data/script/plugins_ci +9 -0
- data/script/storefront_ci +9 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +38 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +28 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +91 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +32 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/package.json +5 -0
- data/test/integration/workarea/storefront/swatches_integration_test.decorator +28 -0
- data/test/system/workarea/admin/guest_browsing_system_test.decorator +38 -0
- data/test/system/workarea/storefront/analytics_system_test.decorator +71 -0
- data/test/system/workarea/storefront/blog_system_test.decorator +26 -0
- data/test/system/workarea/storefront/cart_content_system_test.rb +60 -0
- data/test/system/workarea/storefront/categories_system_test.decorator +188 -0
- data/test/system/workarea/storefront/categories_with_packages_system_test.decorator +94 -0
- data/test/system/workarea/storefront/content_system_test.decorator +21 -0
- data/test/system/workarea/storefront/digital_products_system_test.decorator +58 -0
- data/test/system/workarea/storefront/discounting_system_test.decorator +141 -0
- data/test/system/workarea/storefront/gift_cards_system_test.decorator +224 -0
- data/test/system/workarea/storefront/guest_checkout_system_test.decorator +100 -0
- data/test/system/workarea/storefront/hover_zoom_test.decorator +12 -0
- data/test/system/workarea/storefront/logged_in_checkout_system_test.decorator +90 -0
- data/test/system/workarea/storefront/login_system_test.decorator +94 -0
- data/test/system/workarea/storefront/navigation_system_test.decorator +28 -0
- data/test/system/workarea/storefront/no_js_system_test.decorator +76 -0
- data/test/system/workarea/storefront/passwords_system_test.decorator +59 -0
- data/test/system/workarea/storefront/product_videos_system_test.decorator +28 -0
- data/test/system/workarea/storefront/products_system_test.decorator +14 -0
- data/test/system/workarea/storefront/review_system_test.decorator +34 -0
- data/test/system/workarea/storefront/search_autocomplete_system_test.decorator +46 -0
- data/test/system/workarea/storefront/search_system_test.decorator +105 -0
- data/test/system/workarea/storefront/sharing_system_test.decorator +50 -0
- data/test/system/workarea/storefront/store_credit_system_test.decorator +125 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +10 -0
- data/test/view_models/workarea/storefront/content_blocks/product_insights_view_model_test.decorator +41 -0
- data/vendor/assets/javascripts/polyfills/stickyfill.js +520 -0
- data/workarea-haven_theme.gemspec +39 -0
- metadata +789 -0
@@ -0,0 +1,520 @@
|
|
1
|
+
/*!
|
2
|
+
* Stickyfill – `position: sticky` polyfill
|
3
|
+
* v. 2.0.5 | https://github.com/wilddeer/stickyfill
|
4
|
+
* MIT License
|
5
|
+
*/
|
6
|
+
|
7
|
+
; (function (window, document) {
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
/*
|
11
|
+
* 1. Check if the browser supports `position: sticky` natively or is too old to run the polyfill.
|
12
|
+
* If either of these is the case set `seppuku` flag. It will be checked later to disable key features
|
13
|
+
* of the polyfill, but the API will remain functional to avoid breaking things.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
17
|
+
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19
|
+
|
20
|
+
var seppuku = false;
|
21
|
+
|
22
|
+
// The polyfill cant’t function properly without `getComputedStyle`.
|
23
|
+
if (!window.getComputedStyle) seppuku = true;
|
24
|
+
// Dont’t get in a way if the browser supports `position: sticky` natively.
|
25
|
+
else {
|
26
|
+
var testNode = document.createElement('div');
|
27
|
+
|
28
|
+
if (['', '-webkit-', '-moz-', '-ms-'].some(function (prefix) {
|
29
|
+
try {
|
30
|
+
testNode.style.position = prefix + 'sticky';
|
31
|
+
} catch (e) { }
|
32
|
+
|
33
|
+
return testNode.style.position != '';
|
34
|
+
})) seppuku = true;
|
35
|
+
}
|
36
|
+
|
37
|
+
/*
|
38
|
+
* 2. “Global” vars used across the polyfill
|
39
|
+
*/
|
40
|
+
|
41
|
+
// Check if Shadow Root constructor exists to make further checks simpler
|
42
|
+
var shadowRootExists = typeof ShadowRoot !== 'undefined';
|
43
|
+
|
44
|
+
// Last saved scroll position
|
45
|
+
var scroll = {
|
46
|
+
top: null,
|
47
|
+
left: null
|
48
|
+
};
|
49
|
+
|
50
|
+
// Array of created Sticky instances
|
51
|
+
var stickies = [];
|
52
|
+
|
53
|
+
/*
|
54
|
+
* 3. Utility functions
|
55
|
+
*/
|
56
|
+
function extend(targetObj, sourceObject) {
|
57
|
+
for (var key in sourceObject) {
|
58
|
+
if (sourceObject.hasOwnProperty(key)) {
|
59
|
+
targetObj[key] = sourceObject[key];
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
function parseNumeric(val) {
|
65
|
+
return parseFloat(val) || 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
function getDocOffsetTop(node) {
|
69
|
+
var docOffsetTop = 0;
|
70
|
+
|
71
|
+
while (node) {
|
72
|
+
docOffsetTop += node.offsetTop;
|
73
|
+
node = node.offsetParent;
|
74
|
+
}
|
75
|
+
|
76
|
+
return docOffsetTop;
|
77
|
+
}
|
78
|
+
|
79
|
+
/*
|
80
|
+
* 4. Sticky class
|
81
|
+
*/
|
82
|
+
|
83
|
+
var Sticky = function () {
|
84
|
+
function Sticky(node) {
|
85
|
+
_classCallCheck(this, Sticky);
|
86
|
+
|
87
|
+
if (!(node instanceof HTMLElement)) throw new Error('First argument must be HTMLElement');
|
88
|
+
if (stickies.some(function (sticky) {
|
89
|
+
return sticky._node === node;
|
90
|
+
})) throw new Error('Stickyfill is already applied to this node');
|
91
|
+
|
92
|
+
this._node = node;
|
93
|
+
this._stickyMode = null;
|
94
|
+
this._active = false;
|
95
|
+
|
96
|
+
stickies.push(this);
|
97
|
+
|
98
|
+
this.refresh();
|
99
|
+
}
|
100
|
+
|
101
|
+
_createClass(Sticky, [{
|
102
|
+
key: 'refresh',
|
103
|
+
value: function refresh() {
|
104
|
+
if (seppuku || this._removed) return;
|
105
|
+
if (this._active) this._deactivate();
|
106
|
+
|
107
|
+
var node = this._node;
|
108
|
+
|
109
|
+
/*
|
110
|
+
* 1. Save node computed props
|
111
|
+
*/
|
112
|
+
var nodeComputedStyle = getComputedStyle(node);
|
113
|
+
var nodeComputedProps = {
|
114
|
+
top: nodeComputedStyle.top,
|
115
|
+
display: nodeComputedStyle.display,
|
116
|
+
marginTop: nodeComputedStyle.marginTop,
|
117
|
+
marginBottom: nodeComputedStyle.marginBottom,
|
118
|
+
marginLeft: nodeComputedStyle.marginLeft,
|
119
|
+
marginRight: nodeComputedStyle.marginRight,
|
120
|
+
cssFloat: nodeComputedStyle.cssFloat
|
121
|
+
};
|
122
|
+
|
123
|
+
/*
|
124
|
+
* 2. Check if the node can be activated
|
125
|
+
*/
|
126
|
+
if (isNaN(parseFloat(nodeComputedProps.top)) || nodeComputedProps.display == 'table-cell' || nodeComputedProps.display == 'none') return;
|
127
|
+
|
128
|
+
this._active = true;
|
129
|
+
|
130
|
+
/*
|
131
|
+
* 3. Get necessary node parameters
|
132
|
+
*/
|
133
|
+
var referenceNode = node.parentNode;
|
134
|
+
var parentNode = shadowRootExists && referenceNode instanceof ShadowRoot ? referenceNode.host : referenceNode;
|
135
|
+
var nodeWinOffset = node.getBoundingClientRect();
|
136
|
+
var parentWinOffset = parentNode.getBoundingClientRect();
|
137
|
+
var parentComputedStyle = getComputedStyle(parentNode);
|
138
|
+
|
139
|
+
this._parent = {
|
140
|
+
node: parentNode,
|
141
|
+
styles: {
|
142
|
+
position: parentNode.style.position
|
143
|
+
},
|
144
|
+
offsetHeight: parentNode.offsetHeight
|
145
|
+
};
|
146
|
+
this._offsetToWindow = {
|
147
|
+
left: nodeWinOffset.left,
|
148
|
+
right: document.documentElement.clientWidth - nodeWinOffset.right
|
149
|
+
};
|
150
|
+
this._offsetToParent = {
|
151
|
+
top: nodeWinOffset.top - parentWinOffset.top - parseNumeric(parentComputedStyle.borderTopWidth),
|
152
|
+
left: nodeWinOffset.left - parentWinOffset.left - parseNumeric(parentComputedStyle.borderLeftWidth),
|
153
|
+
right: -nodeWinOffset.right + parentWinOffset.right - parseNumeric(parentComputedStyle.borderRightWidth)
|
154
|
+
};
|
155
|
+
this._styles = {
|
156
|
+
position: node.style.position,
|
157
|
+
top: node.style.top,
|
158
|
+
bottom: node.style.bottom,
|
159
|
+
left: node.style.left,
|
160
|
+
right: node.style.right,
|
161
|
+
width: node.style.width,
|
162
|
+
marginTop: node.style.marginTop,
|
163
|
+
marginLeft: node.style.marginLeft,
|
164
|
+
marginRight: node.style.marginRight
|
165
|
+
};
|
166
|
+
|
167
|
+
var nodeTopValue = parseNumeric(nodeComputedProps.top);
|
168
|
+
this._limits = {
|
169
|
+
start: nodeWinOffset.top + window.pageYOffset - nodeTopValue,
|
170
|
+
end: parentWinOffset.top + window.pageYOffset + parentNode.offsetHeight - parseNumeric(parentComputedStyle.borderBottomWidth) - node.offsetHeight - nodeTopValue - parseNumeric(nodeComputedProps.marginBottom)
|
171
|
+
};
|
172
|
+
|
173
|
+
/*
|
174
|
+
* 4. Ensure that the node will be positioned relatively to the parent node
|
175
|
+
*/
|
176
|
+
var parentPosition = parentComputedStyle.position;
|
177
|
+
|
178
|
+
if (parentPosition != 'absolute' && parentPosition != 'relative') {
|
179
|
+
parentNode.style.position = 'relative';
|
180
|
+
}
|
181
|
+
|
182
|
+
/*
|
183
|
+
* 5. Recalc node position.
|
184
|
+
* It’s important to do this before clone injection to avoid scrolling bug in Chrome.
|
185
|
+
*/
|
186
|
+
this._recalcPosition();
|
187
|
+
|
188
|
+
/*
|
189
|
+
* 6. Create a clone
|
190
|
+
*/
|
191
|
+
var clone = this._clone = {};
|
192
|
+
clone.node = document.createElement('div');
|
193
|
+
|
194
|
+
// Apply styles to the clone
|
195
|
+
extend(clone.node.style, {
|
196
|
+
width: nodeWinOffset.right - nodeWinOffset.left + 'px',
|
197
|
+
height: nodeWinOffset.bottom - nodeWinOffset.top + 'px',
|
198
|
+
marginTop: nodeComputedProps.marginTop,
|
199
|
+
marginBottom: nodeComputedProps.marginBottom,
|
200
|
+
marginLeft: nodeComputedProps.marginLeft,
|
201
|
+
marginRight: nodeComputedProps.marginRight,
|
202
|
+
cssFloat: nodeComputedProps.cssFloat,
|
203
|
+
padding: 0,
|
204
|
+
border: 0,
|
205
|
+
borderSpacing: 0,
|
206
|
+
fontSize: '1em',
|
207
|
+
position: 'static'
|
208
|
+
});
|
209
|
+
|
210
|
+
referenceNode.insertBefore(clone.node, node);
|
211
|
+
clone.docOffsetTop = getDocOffsetTop(clone.node);
|
212
|
+
}
|
213
|
+
}, {
|
214
|
+
key: '_recalcPosition',
|
215
|
+
value: function _recalcPosition() {
|
216
|
+
if (!this._active || this._removed) return;
|
217
|
+
|
218
|
+
var stickyMode = scroll.top <= this._limits.start ? 'start' : scroll.top >= this._limits.end ? 'end' : 'middle';
|
219
|
+
|
220
|
+
if (this._stickyMode == stickyMode) return;
|
221
|
+
|
222
|
+
switch (stickyMode) {
|
223
|
+
case 'start':
|
224
|
+
extend(this._node.style, {
|
225
|
+
position: 'absolute',
|
226
|
+
left: this._offsetToParent.left + 'px',
|
227
|
+
right: this._offsetToParent.right + 'px',
|
228
|
+
top: this._offsetToParent.top + 'px',
|
229
|
+
bottom: 'auto',
|
230
|
+
width: 'auto',
|
231
|
+
marginLeft: 0,
|
232
|
+
marginRight: 0,
|
233
|
+
marginTop: 0
|
234
|
+
});
|
235
|
+
break;
|
236
|
+
|
237
|
+
case 'middle':
|
238
|
+
extend(this._node.style, {
|
239
|
+
position: 'fixed',
|
240
|
+
left: this._offsetToWindow.left + 'px',
|
241
|
+
right: this._offsetToWindow.right + 'px',
|
242
|
+
top: this._styles.top,
|
243
|
+
bottom: 'auto',
|
244
|
+
width: 'auto',
|
245
|
+
marginLeft: 0,
|
246
|
+
marginRight: 0,
|
247
|
+
marginTop: 0
|
248
|
+
});
|
249
|
+
break;
|
250
|
+
|
251
|
+
case 'end':
|
252
|
+
extend(this._node.style, {
|
253
|
+
position: 'absolute',
|
254
|
+
left: this._offsetToParent.left + 'px',
|
255
|
+
right: this._offsetToParent.right + 'px',
|
256
|
+
top: 'auto',
|
257
|
+
bottom: 0,
|
258
|
+
width: 'auto',
|
259
|
+
marginLeft: 0,
|
260
|
+
marginRight: 0
|
261
|
+
});
|
262
|
+
break;
|
263
|
+
}
|
264
|
+
|
265
|
+
this._stickyMode = stickyMode;
|
266
|
+
}
|
267
|
+
}, {
|
268
|
+
key: '_fastCheck',
|
269
|
+
value: function _fastCheck() {
|
270
|
+
if (!this._active || this._removed) return;
|
271
|
+
|
272
|
+
if (Math.abs(getDocOffsetTop(this._clone.node) - this._clone.docOffsetTop) > 1 || Math.abs(this._parent.node.offsetHeight - this._parent.offsetHeight) > 1) this.refresh();
|
273
|
+
}
|
274
|
+
}, {
|
275
|
+
key: '_deactivate',
|
276
|
+
value: function _deactivate() {
|
277
|
+
var _this = this;
|
278
|
+
|
279
|
+
if (!this._active || this._removed) return;
|
280
|
+
|
281
|
+
this._clone.node.parentNode.removeChild(this._clone.node);
|
282
|
+
delete this._clone;
|
283
|
+
|
284
|
+
extend(this._node.style, this._styles);
|
285
|
+
delete this._styles;
|
286
|
+
|
287
|
+
// Check whether element’s parent node is used by other stickies.
|
288
|
+
// If not, restore parent node’s styles.
|
289
|
+
if (!stickies.some(function (sticky) {
|
290
|
+
return sticky !== _this && sticky._parent && sticky._parent.node === _this._parent.node;
|
291
|
+
})) {
|
292
|
+
extend(this._parent.node.style, this._parent.styles);
|
293
|
+
}
|
294
|
+
delete this._parent;
|
295
|
+
|
296
|
+
this._stickyMode = null;
|
297
|
+
this._active = false;
|
298
|
+
|
299
|
+
delete this._offsetToWindow;
|
300
|
+
delete this._offsetToParent;
|
301
|
+
delete this._limits;
|
302
|
+
}
|
303
|
+
}, {
|
304
|
+
key: 'remove',
|
305
|
+
value: function remove() {
|
306
|
+
var _this2 = this;
|
307
|
+
|
308
|
+
this._deactivate();
|
309
|
+
|
310
|
+
stickies.some(function (sticky, index) {
|
311
|
+
if (sticky._node === _this2._node) {
|
312
|
+
stickies.splice(index, 1);
|
313
|
+
return true;
|
314
|
+
}
|
315
|
+
});
|
316
|
+
|
317
|
+
this._removed = true;
|
318
|
+
}
|
319
|
+
}]);
|
320
|
+
|
321
|
+
return Sticky;
|
322
|
+
}();
|
323
|
+
|
324
|
+
/*
|
325
|
+
* 5. Stickyfill API
|
326
|
+
*/
|
327
|
+
|
328
|
+
|
329
|
+
var Stickyfill = {
|
330
|
+
stickies: stickies,
|
331
|
+
Sticky: Sticky,
|
332
|
+
|
333
|
+
addOne: function addOne(node) {
|
334
|
+
// Check whether it’s a node
|
335
|
+
if (!(node instanceof HTMLElement)) {
|
336
|
+
// Maybe it’s a node list of some sort?
|
337
|
+
// Take first node from the list then
|
338
|
+
if (node.length && node[0]) node = node[0]; else return;
|
339
|
+
}
|
340
|
+
|
341
|
+
// Check if Stickyfill is already applied to the node
|
342
|
+
// and return existing sticky
|
343
|
+
for (var i = 0; i < stickies.length; i++) {
|
344
|
+
if (stickies[i]._node === node) return stickies[i];
|
345
|
+
}
|
346
|
+
|
347
|
+
// Create and return new sticky
|
348
|
+
return new Sticky(node);
|
349
|
+
},
|
350
|
+
add: function add(nodeList) {
|
351
|
+
// If it’s a node make an array of one node
|
352
|
+
if (nodeList instanceof HTMLElement) nodeList = [nodeList];
|
353
|
+
// Check if the argument is an iterable of some sort
|
354
|
+
if (!nodeList.length) return;
|
355
|
+
|
356
|
+
// Add every element as a sticky and return an array of created Sticky instances
|
357
|
+
var addedStickies = [];
|
358
|
+
|
359
|
+
var _loop = function _loop(i) {
|
360
|
+
var node = nodeList[i];
|
361
|
+
|
362
|
+
// If it’s not an HTMLElement – create an empty element to preserve 1-to-1
|
363
|
+
// correlation with input list
|
364
|
+
if (!(node instanceof HTMLElement)) {
|
365
|
+
addedStickies.push(void 0);
|
366
|
+
return 'continue';
|
367
|
+
}
|
368
|
+
|
369
|
+
// If Stickyfill is already applied to the node
|
370
|
+
// add existing sticky
|
371
|
+
if (stickies.some(function (sticky) {
|
372
|
+
if (sticky._node === node) {
|
373
|
+
addedStickies.push(sticky);
|
374
|
+
return true;
|
375
|
+
}
|
376
|
+
})) return 'continue';
|
377
|
+
|
378
|
+
// Create and add new sticky
|
379
|
+
addedStickies.push(new Sticky(node));
|
380
|
+
};
|
381
|
+
|
382
|
+
for (var i = 0; i < nodeList.length; i++) {
|
383
|
+
var _ret = _loop(i);
|
384
|
+
|
385
|
+
if (_ret === 'continue') continue;
|
386
|
+
}
|
387
|
+
|
388
|
+
return addedStickies;
|
389
|
+
},
|
390
|
+
refreshAll: function refreshAll() {
|
391
|
+
stickies.forEach(function (sticky) {
|
392
|
+
return sticky.refresh();
|
393
|
+
});
|
394
|
+
},
|
395
|
+
removeOne: function removeOne(node) {
|
396
|
+
// Check whether it’s a node
|
397
|
+
if (!(node instanceof HTMLElement)) {
|
398
|
+
// Maybe it’s a node list of some sort?
|
399
|
+
// Take first node from the list then
|
400
|
+
if (node.length && node[0]) node = node[0]; else return;
|
401
|
+
}
|
402
|
+
|
403
|
+
// Remove the stickies bound to the nodes in the list
|
404
|
+
stickies.some(function (sticky) {
|
405
|
+
if (sticky._node === node) {
|
406
|
+
sticky.remove();
|
407
|
+
return true;
|
408
|
+
}
|
409
|
+
});
|
410
|
+
},
|
411
|
+
remove: function remove(nodeList) {
|
412
|
+
// If it’s a node make an array of one node
|
413
|
+
if (nodeList instanceof HTMLElement) nodeList = [nodeList];
|
414
|
+
// Check if the argument is an iterable of some sort
|
415
|
+
if (!nodeList.length) return;
|
416
|
+
|
417
|
+
// Remove the stickies bound to the nodes in the list
|
418
|
+
|
419
|
+
var _loop2 = function _loop2(i) {
|
420
|
+
var node = nodeList[i];
|
421
|
+
|
422
|
+
stickies.some(function (sticky) {
|
423
|
+
if (sticky._node === node) {
|
424
|
+
sticky.remove();
|
425
|
+
return true;
|
426
|
+
}
|
427
|
+
});
|
428
|
+
};
|
429
|
+
|
430
|
+
for (var i = 0; i < nodeList.length; i++) {
|
431
|
+
_loop2(i);
|
432
|
+
}
|
433
|
+
},
|
434
|
+
removeAll: function removeAll() {
|
435
|
+
while (stickies.length) {
|
436
|
+
stickies[0].remove();
|
437
|
+
}
|
438
|
+
}
|
439
|
+
};
|
440
|
+
|
441
|
+
/*
|
442
|
+
* 6. Setup events (unless the polyfill was disabled)
|
443
|
+
*/
|
444
|
+
function init() {
|
445
|
+
// Watch for scroll position changes and trigger recalc/refresh if needed
|
446
|
+
function checkScroll() {
|
447
|
+
if (window.pageXOffset != scroll.left) {
|
448
|
+
scroll.top = window.pageYOffset;
|
449
|
+
scroll.left = window.pageXOffset;
|
450
|
+
|
451
|
+
Stickyfill.refreshAll();
|
452
|
+
} else if (window.pageYOffset != scroll.top) {
|
453
|
+
scroll.top = window.pageYOffset;
|
454
|
+
scroll.left = window.pageXOffset;
|
455
|
+
|
456
|
+
// recalc position for all stickies
|
457
|
+
stickies.forEach(function (sticky) {
|
458
|
+
return sticky._recalcPosition();
|
459
|
+
});
|
460
|
+
}
|
461
|
+
}
|
462
|
+
|
463
|
+
checkScroll();
|
464
|
+
window.addEventListener('scroll', checkScroll);
|
465
|
+
|
466
|
+
// Watch for window resizes and device orientation changes and trigger refresh
|
467
|
+
window.addEventListener('resize', Stickyfill.refreshAll);
|
468
|
+
window.addEventListener('orientationchange', Stickyfill.refreshAll);
|
469
|
+
|
470
|
+
//Fast dirty check for layout changes every 500ms
|
471
|
+
var fastCheckTimer = void 0;
|
472
|
+
|
473
|
+
function startFastCheckTimer() {
|
474
|
+
fastCheckTimer = setInterval(function () {
|
475
|
+
stickies.forEach(function (sticky) {
|
476
|
+
return sticky._fastCheck();
|
477
|
+
});
|
478
|
+
}, 500);
|
479
|
+
}
|
480
|
+
|
481
|
+
function stopFastCheckTimer() {
|
482
|
+
clearInterval(fastCheckTimer);
|
483
|
+
}
|
484
|
+
|
485
|
+
var docHiddenKey = void 0;
|
486
|
+
var visibilityChangeEventName = void 0;
|
487
|
+
|
488
|
+
if ('hidden' in document) {
|
489
|
+
docHiddenKey = 'hidden';
|
490
|
+
visibilityChangeEventName = 'visibilitychange';
|
491
|
+
} else if ('webkitHidden' in document) {
|
492
|
+
docHiddenKey = 'webkitHidden';
|
493
|
+
visibilityChangeEventName = 'webkitvisibilitychange';
|
494
|
+
}
|
495
|
+
|
496
|
+
if (visibilityChangeEventName) {
|
497
|
+
if (!document[docHiddenKey]) startFastCheckTimer();
|
498
|
+
|
499
|
+
document.addEventListener(visibilityChangeEventName, function () {
|
500
|
+
if (document[docHiddenKey]) {
|
501
|
+
stopFastCheckTimer();
|
502
|
+
} else {
|
503
|
+
startFastCheckTimer();
|
504
|
+
}
|
505
|
+
});
|
506
|
+
} else startFastCheckTimer();
|
507
|
+
}
|
508
|
+
|
509
|
+
if (!seppuku) init();
|
510
|
+
|
511
|
+
/*
|
512
|
+
* 7. Expose Stickyfill
|
513
|
+
*/
|
514
|
+
if (typeof module != 'undefined' && module.exports) {
|
515
|
+
module.exports = Stickyfill;
|
516
|
+
} else {
|
517
|
+
window.Stickyfill = Stickyfill;
|
518
|
+
}
|
519
|
+
|
520
|
+
})(window, document);
|