Skip to content

Commit

Permalink
chore: removed legacy logic and added autoupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
preda-bogdan committed Feb 14, 2023
1 parent dbc4e7b commit 102657c
Show file tree
Hide file tree
Showing 48 changed files with 265 additions and 2,810 deletions.
104 changes: 15 additions & 89 deletions globals/migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,24 @@
* @return array
*/
function neve_get_button_appearance_default( $button = 'button' ) {
$new_skin = neve_is_new_skin();
if ( $new_skin ) {
if ( $button !== 'button' ) {
return [
'type' => 'outline',
'background' => '',
'backgroundHover' => '',
'text' => 'var(--nv-primary-accent)',
'textHover' => 'var(--nv-primary-accent)',
'borderRadius' => [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'borderWidth' => [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'useShadow' => false,
'shadowColor' => 'rgba(0,0,0,0.5)',
'shadowProperties' => [
'blur' => 5,
'width' => 0,
'height' => 0,
],
'useShadowHover' => false,
'shadowColorHover' => 'rgba(0,0,0,0.5)',
'shadowPropertiesHover' => [
'blur' => 5,
'width' => 0,
'height' => 0,
],
];
}

if ( $button !== 'button' ) {
return [
'type' => 'fill',
'background' => 'var(--nv-primary-accent)',
'backgroundHover' => 'var(--nv-primary-accent)',
'text' => '#fff',
'textHover' => '#fff',
'type' => 'outline',
'background' => '',
'backgroundHover' => '',
'text' => 'var(--nv-primary-accent)',
'textHover' => 'var(--nv-primary-accent)',
'borderRadius' => [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'borderWidth' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'useShadow' => false,
'shadowColor' => 'rgba(0,0,0,0.5)',
Expand All @@ -86,12 +49,12 @@ function neve_get_button_appearance_default( $button = 'button' ) {
];
}

$defaults = [
return [
'type' => 'fill',
'background' => '',
'backgroundHover' => '',
'text' => '',
'textHover' => '',
'background' => 'var(--nv-primary-accent)',
'backgroundHover' => 'var(--nv-primary-accent)',
'text' => '#fff',
'textHover' => '#fff',
'borderRadius' => [
'top' => 3,
'right' => 3,
Expand Down Expand Up @@ -119,43 +82,6 @@ function neve_get_button_appearance_default( $button = 'button' ) {
'height' => 0,
],
];
if ( $button === 'secondary_button' ) {
$defaults['type'] = 'outline';
$defaults['text'] = get_theme_mod( 'neve_secondary_button_color' ) ? get_theme_mod( 'neve_secondary_button_color' ) : 'var(--nv-text-color)';
$defaults['textHover'] = get_theme_mod( 'neve_secondary_button_hover_color' ) ? get_theme_mod( 'neve_secondary_button_hover_color' ) : 'var(--nv-text-color)';
$defaults['borderRadius'] = get_theme_mod( 'neve_secondary_button_border_radius' ) ? get_theme_mod( 'neve_secondary_button_border_radius' ) : [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
];
$defaults['useShadow'] = get_theme_mod( 'neve_secondary_button_use_shadow' ) ? get_theme_mod( 'neve_secondary_button_use_shadow' ) : $defaults['useShadow'];
$defaults['shadowColor'] = get_theme_mod( 'neve_secondary_button_shadow_color' ) ? get_theme_mod( 'neve_secondary_button_shadow_color' ) : $defaults['shadowColor'];
$defaults['shadowProperties'] = get_theme_mod( 'neve_secondary_button_shadow_properties' ) ? get_theme_mod( 'neve_secondary_button_shadow_properties' ) : $defaults['shadowProperties'];
$defaults['useShadowHover'] = get_theme_mod( 'neve_secondary_button_use_shadow_hover' ) ? get_theme_mod( 'neve_secondary_button_use_shadow_hover' ) : $defaults['useShadowHover'];
$defaults['shadowColorHover'] = get_theme_mod( 'neve_secondary_button_shadow_color_hover' ) ? get_theme_mod( 'neve_secondary_button_shadow_color_hover' ) : $defaults['shadowColorHover'];
$defaults['shadowPropertiesHover'] = get_theme_mod( 'neve_secondary_button_shadow_properties_hover' ) ? get_theme_mod( 'neve_secondary_button_shadow_properties_hover' ) : $defaults['shadowPropertiesHover'];

return $defaults;
}
$defaults['background'] = get_theme_mod( 'neve_button_color' ) ? get_theme_mod( 'neve_button_color' ) : 'var(--nv-primary-accent)';
$defaults['backgroundHover'] = get_theme_mod( 'neve_button_hover_color' ) ? get_theme_mod( 'neve_button_hover_color' ) : 'var(--nv-primary-accent)';
$defaults['text'] = get_theme_mod( 'neve_button_text_color' ) ? get_theme_mod( 'neve_button_text_color' ) : '#ffffff';
$defaults['textHover'] = get_theme_mod( 'neve_button_hover_text_color' ) ? get_theme_mod( 'neve_button_hover_text_color' ) : '#ffffff';
$defaults['borderRadius'] = get_theme_mod( 'neve_button_border_radius' ) ? get_theme_mod( 'neve_button_border_radius' ) : [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
];
$defaults['useShadow'] = get_theme_mod( 'neve_button_use_shadow' ) ? get_theme_mod( 'neve_button_use_shadow' ) : $defaults['useShadow'];
$defaults['shadowColor'] = get_theme_mod( 'neve_button_shadow_color' ) ? get_theme_mod( 'neve_button_shadow_color' ) : $defaults['shadowColor'];
$defaults['shadowProperties'] = get_theme_mod( 'neve_button_shadow_properties' ) ? get_theme_mod( 'neve_button_shadow_properties' ) : $defaults['shadowProperties'];
$defaults['useShadowHover'] = get_theme_mod( 'neve_button_use_shadow_hover' ) ? get_theme_mod( 'neve_button_use_shadow_hover' ) : $defaults['useShadowHover'];
$defaults['shadowColorHover'] = get_theme_mod( 'neve_button_shadow_color_hover' ) ? get_theme_mod( 'neve_button_shadow_color_hover' ) : $defaults['shadowColorHover'];
$defaults['shadowPropertiesHover'] = get_theme_mod( 'neve_button_shadow_properties_hover' ) ? get_theme_mod( 'neve_button_shadow_properties_hover' ) : $defaults['shadowPropertiesHover'];

return $defaults;
}

/**
Expand Down
77 changes: 14 additions & 63 deletions globals/utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,86 +438,37 @@ function neve_external_link( $link, $text = '', $echo = false ) {
* @return array
*/
function neve_get_global_colors_default( $migrated = false ) {
if ( neve_is_new_skin() ) {
return [
'activePalette' => 'base',
'palettes' => [
'base' => [
'name' => __( 'Base', 'neve' ),
'allowDeletion' => false,
'colors' => [
'nv-primary-accent' => '#2f5aae',
'nv-secondary-accent' => '#2f5aae',
'nv-site-bg' => '#ffffff',
'nv-light-bg' => '#f4f5f7',
'nv-dark-bg' => '#121212',
'nv-text-color' => '#272626',
'nv-text-dark-bg' => '#ffffff',
'nv-c-1' => '#9463ae',
'nv-c-2' => '#be574b',
],
],
'darkMode' => [
'name' => __( 'Dark Mode', 'neve' ),
'allowDeletion' => false,
'colors' => [
'nv-primary-accent' => '#00c2ff',
'nv-secondary-accent' => '#00c2ff',
'nv-site-bg' => '#121212',
'nv-light-bg' => '#1a1a1a',
'nv-dark-bg' => '#000000',
'nv-text-color' => '#ffffff',
'nv-text-dark-bg' => '#ffffff',
'nv-c-1' => '#198754',
'nv-c-2' => '#be574b',
],
],
],
];
}

$old_link_color = get_theme_mod( 'neve_link_color', '#0366d6' );
$old_link_hover_color = get_theme_mod( 'neve_link_hover_color', '#0e509a' );
$old_text_color = get_theme_mod( 'neve_text_color', '#393939' );

// We use a static var to avoid calling get_theme_mod multiple times due to the filter used to alter the value.
static $old_bg_color;
if ( ! isset( $old_bg_color ) ) {
$old_bg_color = '#' . get_theme_mod( 'background_color', 'ffffff' );
}
add_filter( 'theme_mod_background_color', '__return_empty_string' );

return [
'activePalette' => 'base',
'palettes' => [
'base' => [
'name' => __( 'Base', 'neve' ),
'allowDeletion' => false,
'colors' => [
'nv-primary-accent' => $migrated ? $old_link_color : '#0366d6',
'nv-secondary-accent' => $migrated ? $old_link_hover_color : '#0e509a',
'nv-site-bg' => $migrated ? $old_bg_color : '#ffffff',
'nv-light-bg' => '#ededed',
'nv-dark-bg' => '#14171c',
'nv-text-color' => $migrated ? $old_text_color : '#393939',
'nv-primary-accent' => '#2f5aae',
'nv-secondary-accent' => '#2f5aae',
'nv-site-bg' => '#ffffff',
'nv-light-bg' => '#f4f5f7',
'nv-dark-bg' => '#121212',
'nv-text-color' => '#272626',
'nv-text-dark-bg' => '#ffffff',
'nv-c-1' => '#77b978',
'nv-c-2' => '#f37262',
'nv-c-1' => '#9463ae',
'nv-c-2' => '#be574b',
],
],
'darkMode' => [
'name' => __( 'Dark Mode', 'neve' ),
'allowDeletion' => false,
'colors' => [
'nv-primary-accent' => '#26bcdb',
'nv-secondary-accent' => '#1f90a6',
'nv-primary-accent' => '#00c2ff',
'nv-secondary-accent' => '#00c2ff',
'nv-site-bg' => '#121212',
'nv-light-bg' => '#1a1a1a',
'nv-dark-bg' => '#1a1a1a',
'nv-dark-bg' => '#000000',
'nv-text-color' => '#ffffff',
'nv-text-dark-bg' => 'rgba(255, 255, 255, 0.81)',
'nv-c-1' => '#77b978',
'nv-c-2' => '#f37262',
'nv-text-dark-bg' => '#ffffff',
'nv-c-1' => '#198754',
'nv-c-2' => '#be574b',
],
],
],
Expand Down
22 changes: 0 additions & 22 deletions grunt/cssmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,30 @@ module.exports = {
'assets/css/customizer-style-rtl.css',
],

'assets/css/mega-menu-legacy.min.css': [
'assets/css/mega-menu-legacy.css',
],
'assets/css/mega-menu.min.css': ['assets/css/mega-menu.css'],
'assets/css/mega-menu-rtl.min.css': [
'assets/css/mega-menu-rtl.css',
],
'assets/css/mega-menu-legacy-rtl.min.css': [
'assets/css/mega-menu-legacy-rtl.css',
],

'style-main-new-rtl.min.css': ['style-main-new-rtl.css'],
'assets/css/style-legacy-rtl.min.css': [
'assets/css/style-legacy-rtl.css',
],
'header-footer-grid/assets/css/style-rtl.min.css': [
'header-footer-grid/assets/css/style-rtl.css',
],
'header-footer-grid/assets/css/style.min.css': [
'header-footer-grid/assets/css/style.css',
],
'style-main-new.min.css': ['style-main-new.css'],
'assets/css/style-legacy.min.css': ['assets/css/style-legacy.css'],
'assets/css/customizer-preview.min.css': [
'assets/css/customizer-preview.css',
],
'assets/css/woocommerce.min.css': ['assets/css/woocommerce.css'],
'assets/css/woocommerce-rtl.min.css': [
'assets/css/woocommerce-rtl.css',
],
'assets/css/woocommerce-legacy.min.css': [
'assets/css/woocommerce-legacy.css',
],
'assets/css/woocommerce-legacy-rtl.min.css': [
'assets/css/woocommerce-legacy-rtl.css',
],
'assets/css/lifter.min.css': ['assets/css/lifter.css'],
'assets/css/lifter-legacy.min.css': [
'assets/css/lifter-legacy.css',
],
'assets/css/gutenberg-editor-style.min.css': [
'assets/css/gutenberg-editor-style.css',
],
'assets/css/gutenberg-editor-legacy-style.min.css': [
'assets/css/gutenberg-editor-legacy-style.css',
],
'assets/css/easy-digital-downloads.min.css': [
'assets/css/easy-digital-downloads.css',
],
Expand Down
24 changes: 0 additions & 24 deletions grunt/rtlcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ module.exports = {
ext,
src: ['style-main-new.css'],
},
styleLegacy: {
options,
expand: true,
cwd: './assets/css',
dest: './assets/css',
ext,
src: ['style-legacy.css'],
},
woocommerce: {
options,
expand: true,
Expand All @@ -57,14 +49,6 @@ module.exports = {
ext,
src: ['woocommerce.css'],
},
woocommerceLegacy: {
options,
expand: true,
cwd: './assets/css/',
dest: './assets/css/',
ext,
src: ['woocommerce-legacy.css'],
},
customizerStyle: {
options,
expand: true,
Expand All @@ -89,14 +73,6 @@ module.exports = {
ext,
src: ['mega-menu.css'],
},
megaMenuLegacy: {
options,
expand: true,
cwd: './assets/css/',
dest: './assets/css/',
ext,
src: ['mega-menu-legacy.css'],
},
hfg: {
options,
expand: true,
Expand Down
9 changes: 0 additions & 9 deletions grunt/sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,13 @@ module.exports = {
files: [
{
'style-main-new.css': 'assets/scss/style.scss',
'assets/css/style-legacy.css': 'assets/scss/style-legacy.scss',
'assets/css/customizer-preview.css':
'assets/scss/customizer-preview.scss',
'assets/css/mega-menu.css': 'assets/scss/mega-menu.scss',
'assets/css/mega-menu-legacy.css':
'assets/scss/mega-menu-legacy.scss',
'assets/css/woocommerce.css': 'assets/scss/woocommerce.scss',
'assets/css/woocommerce-legacy.css':
'assets/scss/woocommerce-legacy.scss',
'assets/css/lifter.css': 'assets/scss/lifter.scss',
'assets/css/lifter-legacy.css':
'assets/scss/lifter-legacy.scss',
'assets/css/gutenberg-editor-style.css':
'assets/scss/gutenberg-editor-style.scss',
'assets/css/gutenberg-editor-legacy-style.css':
'assets/scss/gutenberg-editor-legacy-style.scss',
'assets/css/easy-digital-downloads.css':
'assets/scss/easy-digital-downloads.scss',
},
Expand Down
Loading

0 comments on commit 102657c

Please sign in to comment.