| @@ -3,14 +3,11 @@ | ||
| 3 | 3 | namespace Elementor\Modules\Variables\Classes; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Modules\AtomicWidgets\PropTypes\Base\Array_Prop_Type; |
| 6 | 6 | use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type; |
| 7 | -use Elementor\Modules\AtomicWidgets\PropTypes\Grid_Track_Size_Prop_Type; | |
| 8 | 7 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 9 | 8 | use Elementor\Modules\AtomicWidgets\PropTypes\Union_Prop_Type; |
| 10 | -use Elementor\Modules\AtomicWidgets\Styles\Size_Constants; | |
| 11 | 9 | use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type; |
| 12 | -use Elementor\Utils as ElementorUtils; | |
| 13 | 10 | |
| 14 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | 12 | exit; // Exit if accessed directly. |
| 16 | 13 | } |
| @@ -15,33 +12,30 @@ | ||
| 15 | 12 | exit; // Exit if accessed directly. |
| 16 | 13 | } |
| 17 | 14 | |
| 18 | 15 | class Size_Style_Schema { |
| 19 | - private const PRO_VERSION_FOR_GRID_TRACK_VARIABLES = '4.2'; | |
| 16 | + private $blacklist = [ | |
| 17 | + 'box-shadow', | |
| 18 | + 'filter', | |
| 19 | + 'backdrop-filter', | |
| 20 | + 'transform', | |
| 21 | + 'transition', | |
| 22 | + ]; | |
| 20 | 23 | |
| 21 | - private $units_to_skip = []; | |
| 22 | - | |
| 23 | - public function __construct() { | |
| 24 | - $this->units_to_skip = [ | |
| 25 | - ...Size_Constants::angle(), | |
| 26 | - ...Size_Constants::time(), | |
| 27 | - ]; | |
| 28 | - } | |
| 29 | - | |
| 30 | - private function skip_by_units( Size_Prop_Type $size_prop_type ) { | |
| 31 | - $settings = $size_prop_type->get_settings(); | |
| 32 | - | |
| 33 | - if ( ! array_key_exists( 'available_units', $settings ) ) { | |
| 34 | - return false; | |
| 24 | + private function ignore( $css_property ): bool { | |
| 25 | + if ( in_array( $css_property, $this->blacklist, true ) ) { | |
| 26 | + return true; | |
| 35 | 27 | } |
| 36 | 28 | |
| 37 | - $available_units = $settings['available_units']; | |
| 38 | - | |
| 39 | - return count( array_intersect( $available_units, $this->units_to_skip ) ) > 0; | |
| 29 | + return false; | |
| 40 | 30 | } |
| 41 | 31 | |
| 42 | 32 | public function augment( array $schema ): array { |
| 43 | 33 | foreach ( $schema as $css_property => $prop_type ) { |
| 34 | + if ( $this->ignore( $css_property ) ) { | |
| 35 | + continue; | |
| 36 | + } | |
| 37 | + | |
| 44 | 38 | $schema[ $css_property ] = $this->update( $prop_type ); |
| 45 | 39 | } |
| 46 | 40 | |
| 47 | 41 | return $schema; |
| @@ -66,27 +60,11 @@ | ||
| 66 | 60 | |
| 67 | 61 | return $prop_type; |
| 68 | 62 | } |
| 69 | 63 | |
| 70 | - private function update_size( Size_Prop_Type $size_prop_type ) { | |
| 71 | - if ( $this->skip_by_units( $size_prop_type ) ) { | |
| 72 | - return $size_prop_type; | |
| 73 | - } | |
| 74 | - | |
| 75 | - if ( | |
| 76 | - $size_prop_type instanceof Grid_Track_Size_Prop_Type | |
| 77 | - && ! $this->is_grid_track_variables_supported_by_pro() | |
| 78 | - ) { | |
| 79 | - return $size_prop_type; | |
| 80 | - } | |
| 81 | - | |
| 64 | + private function update_size( Size_Prop_Type $size_prop_type ): Union_Prop_Type { | |
| 82 | 65 | return Union_Prop_Type::create_from( $size_prop_type ) |
| 83 | 66 | ->add_prop_type( Size_Variable_Prop_Type::make() ); |
| 84 | - } | |
| 85 | - | |
| 86 | - private function is_grid_track_variables_supported_by_pro(): bool { | |
| 87 | - return ElementorUtils::has_pro() | |
| 88 | - && version_compare( ELEMENTOR_PRO_VERSION, self::PRO_VERSION_FOR_GRID_TRACK_VARIABLES, '>=' ); | |
| 89 | 67 | } |
| 90 | 68 | |
| 91 | 69 | private function update_array( Array_Prop_Type $array_prop_type ): Array_Prop_Type { |
| 92 | 70 | return $array_prop_type->set_item_type( |