PluginProbe
Elementor Website Builder – more than just a page builder / 3.33.0-beta1
Elementor Website Builder – more than just a page builder v3.33.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/size-constants.php +50 -174 4.0.9 → 3.33.0-beta1 View file →
@@ -12,242 +12,118 @@
12 12 const UNIT_EM = 'em';
13 13 const UNIT_REM = 'rem';
14 14 const UNIT_VW = 'vw';
15 15 const UNIT_VH = 'vh';
16 - const UNIT_CH = 'ch';
17 - const UNIT_VMIN = 'vmin';
18 - const UNIT_VMAX = 'vmax';
16 + const UNIT_AUTO = 'auto';
17 + const UNIT_CUSTOM = 'custom';
19 18 const UNIT_SECOND = 's';
20 19 const UNIT_MILLI_SECOND = 'ms';
21 - const UNIT_DEG = 'deg';
22 - const UNIT_RAD = 'rad';
23 - const UNIT_GRAD = 'grad';
24 - const UNIT_TURN = 'turn';
25 - const UNIT_AUTO = 'auto';
26 - const UNIT_CUSTOM = 'custom';
20 + const UNIT_ANGLE_DEG = 'deg';
27 21
28 - const DEFAULT_UNIT = self::UNIT_PX;
29 -
30 - private const LENGTH_UNITS = [
22 + const LENGTH_UNITS = [
31 23 self::UNIT_PX,
32 24 self::UNIT_EM,
33 25 self::UNIT_REM,
34 26 self::UNIT_VW,
35 27 self::UNIT_VH,
36 - self::UNIT_CH,
37 28 ];
38 29
39 - private const TIME_UNITS = [
40 - self::UNIT_MILLI_SECOND,
41 - self::UNIT_SECOND,
42 - ];
30 + const TIME_UNITS = [ self::UNIT_SECOND, self::UNIT_MILLI_SECOND ];
31 + const EXTENDED_UNITS = [ self::UNIT_AUTO, self::UNIT_CUSTOM ];
32 + const VIEWPORT_MIN_MAX_UNITS = [ 'vmin', 'vmax' ];
33 + const ANGLE_UNITS = [ self::UNIT_ANGLE_DEG, 'rad', 'grad', 'turn' ];
43 34
44 - private const ANGLE_UNITS = [
45 - self::UNIT_DEG,
46 - self::UNIT_RAD,
47 - self::UNIT_GRAD,
48 - self::UNIT_TURN,
49 - ];
50 -
51 - private const EXTENDED_UNITS = [
52 - self::UNIT_AUTO,
53 - self::UNIT_CUSTOM,
54 - ];
55 -
56 - private const VIEWPORT_MIN_MAX_UNITS = [
57 - self::UNIT_VMIN,
58 - self::UNIT_VMAX,
59 - ];
60 -
61 - private const NUMERIC_UNITS = [
62 - ...self::LENGTH_UNITS,
63 - self::UNIT_PERCENT,
64 - self::UNIT_CUSTOM,
65 - ];
66 -
67 - private static function presets(): array {
68 - return [
69 - 'layout' => self::NUMERIC_UNITS,
70 - 'spacing' => self::NUMERIC_UNITS,
71 - 'position' => self::NUMERIC_UNITS,
72 - 'typography' => self::NUMERIC_UNITS,
73 - 'border' => self::NUMERIC_UNITS,
74 - 'box_shadow' => self::NUMERIC_UNITS,
75 - 'transform' => self::NUMERIC_UNITS,
76 -
77 - 'spacing_margin' => self::standard_units(),
78 -
79 - 'anchor_offset' => [
80 - ...self::LENGTH_UNITS,
81 - self::UNIT_CUSTOM,
82 - ],
83 -
84 - 'stroke_width' => [
85 - self::UNIT_PX,
86 - self::UNIT_EM,
87 - self::UNIT_REM,
88 - self::UNIT_CUSTOM,
89 - ],
90 -
91 - 'transition' => [
92 - ...self::TIME_UNITS,
93 - self::UNIT_CUSTOM,
94 - ],
95 -
96 - 'opacity' => [
97 - self::UNIT_PERCENT,
98 - self::UNIT_CUSTOM,
99 - ],
100 -
101 - 'rotate' => [
102 - ...self::ANGLE_UNITS,
103 - self::UNIT_CUSTOM,
104 - ],
105 -
106 - 'drop_shadow' => [
107 - ...self::LENGTH_UNITS,
108 - self::UNIT_CUSTOM,
109 - ],
110 -
111 - 'blur_filter' => [
112 - ...self::LENGTH_UNITS,
113 - self::UNIT_CUSTOM,
114 - ],
115 -
116 - 'intensity_filter' => [
117 - self::UNIT_PERCENT,
118 - self::UNIT_CUSTOM,
119 - ],
120 -
121 - 'color_tone_filter' => [
122 - self::UNIT_PERCENT,
123 - self::UNIT_CUSTOM,
124 - ],
125 -
126 - 'hue_rotate_filter' => [
127 - ...self::ANGLE_UNITS,
128 - self::UNIT_CUSTOM,
129 - ],
130 - ];
35 + public static function all_supported_units(): array {
36 + return array_merge(
37 + self::all(),
38 + self::ANGLE_UNITS,
39 + self::TIME_UNITS,
40 + self::EXTENDED_UNITS,
41 + self::VIEWPORT_MIN_MAX_UNITS,
42 + );
131 43 }
132 44
133 - public static function standard_units(): array {
45 + public static function all(): array {
134 46 return [
135 47 ...self::LENGTH_UNITS,
136 48 self::UNIT_PERCENT,
137 49 self::UNIT_AUTO,
138 - self::UNIT_CUSTOM,
139 50 ];
140 51 }
141 52
142 - public static function all_supported_units(): array {
143 - return [
144 - ...self::LENGTH_UNITS,
145 - ...self::TIME_UNITS,
146 - ...self::ANGLE_UNITS,
147 - ...self::EXTENDED_UNITS,
148 - ...self::VIEWPORT_MIN_MAX_UNITS,
149 - self::UNIT_PERCENT,
150 - ];
53 + private static function units_without_auto(): array {
54 + return [ ...self::LENGTH_UNITS, self::UNIT_PERCENT ];
151 55 }
152 56
153 - public static function grouped_units(): array {
154 - return [
155 - 'length' => self::LENGTH_UNITS,
156 - 'angle' => self::ANGLE_UNITS,
157 - 'time' => self::TIME_UNITS,
158 - 'extended_units' => self::EXTENDED_UNITS,
159 - ];
57 + public static function layout() {
58 + return self::units_without_auto();
160 59 }
161 60
162 - private static function by_group( string $group ): array {
163 - $groups = self::grouped_units();
164 -
165 - return $groups[ $group ] ?? [];
166 - }
167 -
168 - public static function get_preset( string $name ): array {
169 - $presets = self::presets();
170 -
171 - return $presets[ $name ] ?? [];
172 - }
173 -
174 - public static function length(): array {
175 - return self::by_group( 'length' );
176 - }
177 -
178 - public static function time(): array {
179 - return self::by_group( 'time' );
180 - }
181 -
182 - public static function layout(): array {
183 - return self::get_preset( 'layout' );
184 - }
185 -
186 - public static function spacing_margin(): array {
187 - return self::get_preset( 'spacing_margin' );
188 - }
189 -
190 61 public static function spacing(): array {
191 - return self::get_preset( 'spacing' );
62 + return self::units_without_auto();
192 63 }
193 64
194 65 public static function position(): array {
195 - return self::get_preset( 'position' );
66 + return self::units_without_auto();
196 67 }
197 68
198 - public static function anchor_offset(): array {
199 - return self::get_preset( 'anchor_offset' );
69 + public static function anchor_offset() {
70 + return self::LENGTH_UNITS;
200 71 }
201 72
202 73 public static function typography(): array {
203 - return self::get_preset( 'typography' );
74 + return self::units_without_auto();
204 75 }
205 76
206 - public static function stroke_width(): array {
207 - return self::get_preset( 'stroke_width' );
77 + public static function stroke_width() {
78 + return [
79 + self::UNIT_PX,
80 + self::UNIT_EM,
81 + self::UNIT_REM,
82 + ];
208 83 }
209 84
210 - public static function transition(): array {
211 - return self::get_preset( 'transition' );
85 + public static function transition() {
86 + return self::TIME_UNITS;
212 87 }
213 88
214 89 public static function border(): array {
215 - return self::get_preset( 'border' );
90 + return self::units_without_auto();
216 91 }
217 92
93 +
218 94 public static function opacity(): array {
219 - return self::get_preset( 'opacity' );
95 + return [ self::UNIT_PERCENT ];
220 96 }
221 97
222 98 public static function box_shadow(): array {
223 - return self::get_preset( 'box_shadow' );
99 + return self::units_without_auto();
224 100 }
225 101
226 102 public static function rotate(): array {
227 - return self::get_preset( 'rotate' );
103 + return self::ANGLE_UNITS;
228 104 }
229 105
230 106 public static function transform(): array {
231 - return self::get_preset( 'transform' );
107 + return self::units_without_auto();
232 108 }
233 109
234 - public static function drop_shadow(): array {
235 - return self::get_preset( 'drop_shadow' );
110 + public static function drop_shadow() {
111 + return self::LENGTH_UNITS;
236 112 }
237 113
238 - public static function blur_filter(): array {
239 - return self::get_preset( 'blur_filter' );
114 + public static function blur_filter() {
115 + return self::LENGTH_UNITS;
240 116 }
241 117
242 - public static function intensity_filter(): array {
243 - return self::get_preset( 'intensity_filter' );
118 + public static function intensity_filter() {
119 + return [ self::UNIT_PERCENT ];
244 120 }
245 121
246 - public static function color_tone_filter(): array {
247 - return self::get_preset( 'color_tone_filter' );
122 + public static function color_tone_filter() {
123 + return [ self::UNIT_PERCENT ];
248 124 }
249 125
250 - public static function hue_rotate_filter(): array {
251 - return self::get_preset( 'hue_rotate_filter' );
126 + public static function hue_rotate_filter() {
127 + return self::ANGLE_UNITS;
252 128 }
253 129 }