From 9d4123cee1867ee7199b06bdc92d40611f547ecc Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 14:54:07 -0500 Subject: Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/. --- .../assets/js/minified/customizer-preview.min.js | 1 + .../assets/js/unminified/customizer-preview.js | 128 ++++++++++++++ .../class-astra-mobile-trigger-loader.php | 54 ++++++ .../mobile-trigger/class-astra-mobile-trigger.php | 44 +++++ .../mobile-trigger/dynamic-css/dynamic.css.php | 184 +++++++++++++++++++++ 5 files changed, 411 insertions(+) create mode 100644 inc/builder/type/header/mobile-trigger/assets/js/minified/customizer-preview.min.js create mode 100644 inc/builder/type/header/mobile-trigger/assets/js/unminified/customizer-preview.js create mode 100644 inc/builder/type/header/mobile-trigger/class-astra-mobile-trigger-loader.php create mode 100644 inc/builder/type/header/mobile-trigger/class-astra-mobile-trigger.php create mode 100644 inc/builder/type/header/mobile-trigger/dynamic-css/dynamic.css.php (limited to 'inc/builder/type/header/mobile-trigger') diff --git a/inc/builder/type/header/mobile-trigger/assets/js/minified/customizer-preview.min.js b/inc/builder/type/header/mobile-trigger/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..40c6536 --- /dev/null +++ b/inc/builder/type/header/mobile-trigger/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(){var i=astraBuilderPreview.tablet_break_point||768,a=astraBuilderPreview.mobile_break_point||544;astra_css("astra-settings[mobile-header-toggle-btn-color]","fill",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg'),astra_css("astra-settings[mobile-header-toggle-btn-color]","color",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-wrap .mobile-menu'),astra_css("astra-settings[mobile-header-toggle-icon-size]","width",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg',"px"),astra_css("astra-settings[mobile-header-toggle-icon-size]","height",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg',"px"),astra_css("astra-settings[mobile-header-toggle-btn-bg-color]","background",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.ast-mobile-menu-trigger-fill'),wp.customize("astra-settings[mobile-header-toggle-btn-border-size]",function(t){t.bind(function(t){var e='[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.main-header-menu-toggle {';e+="border-top-width:"+t.top+"px;",e+="border-right-width:"+t.right+"px;",e+="border-left-width:"+t.left+"px;",e+="border-bottom-width:"+t.bottom+"px;",e+="} ",astra_add_dynamic_css("astra-settings[mobile-header-toggle-btn-border-size]",e)})}),astra_css("astra-settings[mobile-header-toggle-border-radius]","border-radius",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.main-header-menu-toggle',"px"),astra_css("astra-settings[mobile-header-toggle-border-color]","border-color",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.ast-mobile-menu-trigger-outline, [data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.ast-mobile-menu-trigger-fill'),wp.customize("astra-settings[section-header-mobile-trigger-margin]",function(t){t.bind(function(t){var e,o;""==t.desktop.bottom&&""==t.desktop.top&&""==t.desktop.left&&""==t.desktop.right&&""==t.tablet.bottom&&""==t.tablet.top&&""==t.tablet.left&&""==t.tablet.right&&""==t.mobile.bottom&&""==t.mobile.top&&""==t.mobile.left&&""==t.mobile.right||(o="",o+=(e='[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.main-header-menu-toggle')+" {",o+="margin-left: "+t.desktop.left+t["desktop-unit"]+";",o+="margin-right: "+t.desktop.right+t["desktop-unit"]+";",o+="margin-top: "+t.desktop.top+t["desktop-unit"]+";",o+="margin-bottom: "+t.desktop.bottom+t["desktop-unit"]+";",o+="} ",o+="@media (max-width: "+i+"px) {",o+=e+" {",o+="margin-left: "+t.tablet.left+t["tablet-unit"]+";",o+="margin-right: "+t.tablet.right+t["tablet-unit"]+";",o+="margin-top: "+t.tablet.top+t["desktop-unit"]+";",o+="margin-bottom: "+t.tablet.bottom+t["desktop-unit"]+";",o+="} ",o+="} ",o+="@media (max-width: "+a+"px) {",o+=e+" {",o+="margin-left: "+t.mobile.left+t["mobile-unit"]+";",o+="margin-right: "+t.mobile.right+t["mobile-unit"]+";",o+="margin-top: "+t.mobile.top+t["desktop-unit"]+";",o+="margin-bottom: "+t.mobile.bottom+t["desktop-unit"]+";",o+="} ",o+="} ",astra_add_dynamic_css("header-mobile-trigger-margin",o))})}),astra_css("astra-settings[mobile-header-label-font-size]","font-size",'[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-wrap .mobile-menu',"px")}(jQuery); \ No newline at end of file diff --git a/inc/builder/type/header/mobile-trigger/assets/js/unminified/customizer-preview.js b/inc/builder/type/header/mobile-trigger/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..16c2454 --- /dev/null +++ b/inc/builder/type/header/mobile-trigger/assets/js/unminified/customizer-preview.js @@ -0,0 +1,128 @@ +/** + * This file adds some LIVE to the Customizer live preview. To leverage + * this, set your custom settings to 'postMessage' and then add your handling + * here. Your javascript should grab settings from customizer controls, and + * then make any necessary changes to the page using jQuery. + * + * @package Astra + * @since 3.0.0 + */ + +( function( $ ) { + + var tablet_break_point = astraBuilderPreview.tablet_break_point || 768, + mobile_break_point = astraBuilderPreview.mobile_break_point || 544; + + // Trigger Icon Color. + astra_css( + 'astra-settings[mobile-header-toggle-btn-color]', + 'fill', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg' + ); + + // Trigger Label Color. + astra_css( + 'astra-settings[mobile-header-toggle-btn-color]', + 'color', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-wrap .mobile-menu' + ); + + // Trigger Icon Width. + astra_css( + 'astra-settings[mobile-header-toggle-icon-size]', + 'width', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg', + 'px' + ); + + // Trigger Icon Height. + astra_css( + 'astra-settings[mobile-header-toggle-icon-size]', + 'height', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg', + 'px' + ); + + // Trigger Button Background Color. + astra_css( + 'astra-settings[mobile-header-toggle-btn-bg-color]', + 'background', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.ast-mobile-menu-trigger-fill' + ); + + // Border Size for Trigger Button. + wp.customize( 'astra-settings[mobile-header-toggle-btn-border-size]', function( setting ) { + setting.bind( function( border ) { + var dynamicStyle = '[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.main-header-menu-toggle {'; + dynamicStyle += 'border-top-width:' + border.top + 'px;'; + dynamicStyle += 'border-right-width:' + border.right + 'px;'; + dynamicStyle += 'border-left-width:' + border.left + 'px;'; + dynamicStyle += 'border-bottom-width:' + border.bottom + 'px;'; + dynamicStyle += '} '; + astra_add_dynamic_css( 'astra-settings[mobile-header-toggle-btn-border-size]', dynamicStyle ); + } ); + } ); + + // Border Radius. + astra_css( + 'astra-settings[mobile-header-toggle-border-radius]', + 'border-radius', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.main-header-menu-toggle', + 'px' + ); + + // Border Color. + astra_css( + 'astra-settings[mobile-header-toggle-border-color]', + 'border-color', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.ast-mobile-menu-trigger-outline, [data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.ast-mobile-menu-trigger-fill' + ); + + // Margin. + wp.customize( 'astra-settings[section-header-mobile-trigger' + '-margin]', function( value ) { + value.bind( function( margin ) { + if( + margin.desktop.bottom != '' || margin.desktop.top != '' || margin.desktop.left != '' || margin.desktop.right != '' || + margin.tablet.bottom != '' || margin.tablet.top != '' || margin.tablet.left != '' || margin.tablet.right != '' || + margin.mobile.bottom != '' || margin.mobile.top != '' || margin.mobile.left != '' || margin.mobile.right != '' + ) { + var selector = '[data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle.main-header-menu-toggle'; + var dynamicStyle = ''; + dynamicStyle += selector + ' {'; + dynamicStyle += 'margin-left: ' + margin['desktop']['left'] + margin['desktop-unit'] + ';'; + dynamicStyle += 'margin-right: ' + margin['desktop']['right'] + margin['desktop-unit'] + ';'; + dynamicStyle += 'margin-top: ' + margin['desktop']['top'] + margin['desktop-unit'] + ';'; + dynamicStyle += 'margin-bottom: ' + margin['desktop']['bottom'] + margin['desktop-unit'] + ';'; + dynamicStyle += '} '; + + dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; + dynamicStyle += selector + ' {'; + dynamicStyle += 'margin-left: ' + margin['tablet']['left'] + margin['tablet-unit'] + ';'; + dynamicStyle += 'margin-right: ' + margin['tablet']['right'] + margin['tablet-unit'] + ';'; + dynamicStyle += 'margin-top: ' + margin['tablet']['top'] + margin['desktop-unit'] + ';'; + dynamicStyle += 'margin-bottom: ' + margin['tablet']['bottom'] + margin['desktop-unit'] + ';'; + dynamicStyle += '} '; + dynamicStyle += '} '; + + dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; + dynamicStyle += selector + ' {'; + dynamicStyle += 'margin-left: ' + margin['mobile']['left'] + margin['mobile-unit'] + ';'; + dynamicStyle += 'margin-right: ' + margin['mobile']['right'] + margin['mobile-unit'] + ';'; + dynamicStyle += 'margin-top: ' + margin['mobile']['top'] + margin['desktop-unit'] + ';'; + dynamicStyle += 'margin-bottom: ' + margin['mobile']['bottom'] + margin['desktop-unit'] + ';'; + dynamicStyle += '} '; + dynamicStyle += '} '; + astra_add_dynamic_css( 'header-mobile-trigger-margin', dynamicStyle ); + } + } ); + } ); + + // Trigger Typography. + astra_css( + 'astra-settings[mobile-header-label-font-size]', + 'font-size', + '[data-section="section-header-mobile-trigger"] .ast-button-wrap .mobile-menu-wrap .mobile-menu', + 'px' + ); + +} )( jQuery ); diff --git a/inc/builder/type/header/mobile-trigger/class-astra-mobile-trigger-loader.php b/inc/builder/type/header/mobile-trigger/class-astra-mobile-trigger-loader.php new file mode 100644 index 0000000..ccfcba1 --- /dev/null +++ b/inc/builder/type/header/mobile-trigger/class-astra-mobile-trigger-loader.php @@ -0,0 +1,54 @@ + array( + 'width' => astra_get_css_value( $icon_size, 'px' ), + 'height' => astra_get_css_value( $icon_size, 'px' ), + 'fill' => $icon_color, + ), + $selector . ' .ast-button-wrap .mobile-menu-wrap .mobile-menu' => array( + // Color. + 'color' => $icon_color, + + // Typography. + 'font-size' => astra_get_css_value( $font_size, 'px' ), + ), + $margin_selector => array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ), + ), + ); + + // Execute all cases in customizer preview. + $is_customizer = false; + if ( is_customize_preview() ) { + $is_customizer = true; + } + switch ( $style ) { + case 'minimal': // phpcs:ignore PSR2.ControlStructures.SwitchDeclaration.TerminatingComment + $css_output_minimal = array( + $selector . ' .ast-button-wrap .ast-mobile-menu-trigger-minimal' => array( + // Color & Border. + 'color' => esc_attr( $icon_color ), + 'border' => 'none', + 'background' => 'transparent', + ), + ); + $dynamic_css .= astra_parse_css( $css_output_minimal ); + if ( false === $is_customizer ) { + break; + } + + case 'fill': // phpcs:ignore PSR2.ControlStructures.SwitchDeclaration.TerminatingComment + $css_output_fill = array( + $selector . ' .ast-button-wrap .ast-mobile-menu-trigger-fill' => array( + // Color & Border. + 'color' => esc_attr( $icon_color ), + 'border' => 'none', + 'background' => esc_attr( $trigger_bg ), + 'border-radius' => astra_get_css_value( $trigger_border_radius, 'px' ), + ), + ); + $dynamic_css .= astra_parse_css( $css_output_fill ); + if ( false === $is_customizer ) { + break; + } + + case 'outline': // phpcs:ignore PSR2.ControlStructures.SwitchDeclaration.TerminatingComment + $css_output_outline = array( + $selector . ' .ast-button-wrap .ast-mobile-menu-trigger-outline' => array( + 'background' => 'transparent', + 'color' => esc_attr( $icon_color ), + 'border-top-width' => astra_get_css_value( $trigger_border_width_top, 'px' ), + 'border-bottom-width' => astra_get_css_value( $trigger_border_width_bottom, 'px' ), + 'border-right-width' => astra_get_css_value( $trigger_border_width_right, 'px' ), + 'border-left-width' => astra_get_css_value( $trigger_border_width_left, 'px' ), + 'border-style' => 'solid', + 'border-color' => $trigger_border_color, + 'border-radius' => astra_get_css_value( $trigger_border_radius, 'px' ), + ), + ); + $dynamic_css .= astra_parse_css( $css_output_outline ); + if ( false === $is_customizer ) { + break; + } + + default: + $dynamic_css .= ''; + break; + + } + + // Tablet CSS. + $css_output_tablet = array( + + $margin_selector => array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ), + ), + ); + + // Mobile CSS. + $css_output_mobile = array( + + $margin_selector => array( + // Margin CSS. + 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ), + 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ), + 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ), + 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ), + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output ); + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + + $dynamic_css .= $css_output; + + return $dynamic_css; +} -- cgit v1.2.3-60-g2f50