PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.0-beta1
Elementor Website Builder – more than just a page builder v3.34.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | modules/atomic-widgets/styles/style-states.php +3 -52 4.1.0-dev3 → 3.34.0-beta1 View file →
@@ -5,68 +5,28 @@
5 5 class Style_States {
6 6 const HOVER = 'hover';
7 7 const ACTIVE = 'active';
8 8 const FOCUS = 'focus';
9 - const FOCUS_VISIBLE = 'focus-visible';
10 - const CHECKED = 'checked';
11 9
12 10 const SELECTED = 'e--selected';
13 11
14 - private static function get_pseudo_states(): array {
12 + public static function get_pseudo_states(): array {
15 13 return [
16 14 self::HOVER,
17 15 self::ACTIVE,
18 16 self::FOCUS,
19 - self::FOCUS_VISIBLE,
20 - self::CHECKED,
21 17 ];
22 18 }
23 19
24 - private static function get_class_states(): array {
20 + public static function get_class_states(): array {
25 21 return [
26 22 self::SELECTED,
27 23 ];
28 24 }
29 25
30 - private static function get_additional_states_map(): array {
31 - return [
32 - self::HOVER => [ self::FOCUS_VISIBLE ],
33 - ];
34 - }
35 -
36 - public static function get_selector_with_state( string $base_selector, string $state ): string {
37 - $additional_states = self::get_additional_states( $state );
38 - $all_states = [ $state, ...$additional_states ];
39 -
40 - foreach ( $all_states as $current_state ) {
41 - $selector_strings[] = $base_selector . self::get_state_selector( $current_state );
42 - }
43 -
44 - return implode( ',', $selector_strings );
45 - }
46 -
47 - public static function get_additional_states( string $state ): array {
48 - return self::get_additional_states_map()[ $state ] ?? [];
49 - }
50 -
51 - public static function get_state_selector( string $state ): string {
52 - if ( self::is_class_state( $state ) ) {
53 - return '.' . $state;
54 - }
55 -
56 - if ( self::is_pseudo_state( $state ) ) {
57 - return ':' . $state;
58 - }
59 -
60 - return $state;
61 - }
62 -
63 -
64 26 public static function get_valid_states(): array {
65 27 return [
66 - ...array_filter( self::get_pseudo_states(), function ( $state ) {
67 - return ! in_array( $state, self::get_additional_states_map()[ $state ] ?? [], true );
68 - } ),
28 + ...self::get_pseudo_states(),
69 29 ...self::get_class_states(),
70 30 null,
71 31 ];
72 32 }
@@ -91,17 +51,8 @@
91 51 return [
92 52 'selected' => [
93 53 'name' => 'selected',
94 54 'value' => self::SELECTED,
95 - ],
96 - ];
97 - }
98 -
99 - public static function get_pseudo_states_map(): array {
100 - return [
101 - 'checked' => [
102 - 'name' => 'checked',
103 - 'value' => self::CHECKED,
104 55 ],
105 56 ];
106 57 }
107 58 }