PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-beta1
Elementor Website Builder – more than just a page builder v3.28.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-schema.php +67 -228 4.0.9 → 3.28.0-beta1 View file →
@@ -1,11 +1,7 @@
1 1 <?php
2 -
3 2 namespace Elementor\Modules\AtomicWidgets\Styles;
4 3
5 -use Elementor\Modules\AtomicWidgets\DynamicTags\Dynamic_Prop_Types_Mapping;
6 -use Elementor\Modules\AtomicWidgets\PropTypes\Background_Image_Overlay_Prop_Type;
7 -use Elementor\Modules\AtomicWidgets\PropTypes\Background_Overlay_Prop_Type;
8 4 use Elementor\Modules\AtomicWidgets\PropTypes\Background_Prop_Type;
9 5 use Elementor\Modules\AtomicWidgets\PropTypes\Box_Shadow_Prop_Type;
10 6 use Elementor\Modules\AtomicWidgets\PropTypes\Border_Radius_Prop_Type;
11 7 use Elementor\Modules\AtomicWidgets\PropTypes\Border_Width_Prop_Type;
@@ -10,21 +6,15 @@
10 6 use Elementor\Modules\AtomicWidgets\PropTypes\Border_Radius_Prop_Type;
11 7 use Elementor\Modules\AtomicWidgets\PropTypes\Border_Width_Prop_Type;
12 8 use Elementor\Modules\AtomicWidgets\PropTypes\Color_Prop_Type;
13 9 use Elementor\Modules\AtomicWidgets\PropTypes\Dimensions_Prop_Type;
14 -use Elementor\Modules\AtomicWidgets\PropTypes\Filters\Backdrop_Filter_Prop_Type;
15 -use Elementor\Modules\AtomicWidgets\PropTypes\Filters\Filter_Prop_Type;
16 10 use Elementor\Modules\AtomicWidgets\PropTypes\Layout_Direction_Prop_Type;
17 -use Elementor\Modules\AtomicWidgets\PropTypes\Position_Prop_Type;
18 11 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Number_Prop_Type;
19 12 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
20 13 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
21 14 use Elementor\Modules\AtomicWidgets\PropTypes\Stroke_Prop_Type;
22 -use Elementor\Modules\AtomicWidgets\PropTypes\Transform\Transform_Prop_Type;
23 -use Elementor\Modules\AtomicWidgets\PropTypes\Transition_Prop_Type;
24 15 use Elementor\Modules\AtomicWidgets\PropTypes\Union_Prop_Type;
25 -use Elementor\Modules\AtomicWidgets\PropTypes\Flex_Prop_Type;
26 -use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager;
16 +use Elementor\Modules\AtomicWidgets\PropTypes\Gap_Prop_Type;
27 17
28 18 if ( ! defined( 'ABSPATH' ) ) {
29 19 exit; // Exit if accessed directly.
30 20 }
@@ -30,12 +20,8 @@
30 20 }
31 21
32 22 class Style_Schema {
33 23 public static function get() {
34 - return apply_filters( 'elementor/atomic-widgets/styles/schema', static::get_style_schema() );
35 - }
36 -
37 - public static function get_style_schema(): array {
38 24 return array_merge(
39 25 self::get_size_props(),
40 26 self::get_position_props(),
41 27 self::get_typography_props(),
@@ -44,75 +30,48 @@
44 30 self::get_background_props(),
45 31 self::get_effects_props(),
46 32 self::get_layout_props(),
47 33 self::get_alignment_props(),
48 - self::get_special_props(),
49 34 );
50 35 }
51 36
52 37 private static function get_size_props() {
53 38 return [
54 - 'width' => Size_Prop_Type::make()->description( 'The width of the element' ),
55 - 'height' => Size_Prop_Type::make()->description( 'The height of the element' ),
56 - 'min-width' => Size_Prop_Type::make()->description( 'The minimum width of the element' ),
57 - 'min-height' => Size_Prop_Type::make()->description( 'The minimum height of the element' ),
58 - 'max-width' => Size_Prop_Type::make()->description( 'The maximum width of the element' ),
59 - 'max-height' => Size_Prop_Type::make()->description( 'The maximum height of the element' ),
60 - 'overflow' => String_Prop_Type::make()->enum( [
39 + 'width' => Size_Prop_Type::make(),
40 + 'height' => Size_Prop_Type::make(),
41 + 'min-width' => Size_Prop_Type::make(),
42 + 'min-height' => Size_Prop_Type::make(),
43 + 'max-width' => Size_Prop_Type::make(),
44 + 'max-height' => Size_Prop_Type::make(),
45 + 'overflow' => String_Prop_Type::make()->enum([
61 46 'visible',
62 47 'hidden',
63 48 'auto',
64 - ] )->description( 'The overflow CSS property. CSS values: visible, hidden, auto' ),
65 - 'aspect-ratio' => String_Prop_Type::make()->description( 'Equivalent to CSS aspect-ration property' ),
66 - 'object-fit' => String_Prop_Type::make()->enum( [
67 - 'fill',
68 - 'cover',
69 - 'contain',
70 - 'none',
71 - 'scale-down',
72 - ] )->description( 'The object-fit CSS. CSS values: fill, cover, contain, none, scale-down' ),
73 - 'object-position' => Union_Prop_Type::make()
74 - ->add_prop_type( String_Prop_Type::make()->enum( Position_Prop_Type::get_position_enum_values() ) )
75 - ->add_prop_type( Position_Prop_Type::make() )
76 - ->set_dependencies(
77 - Dependency_Manager::make( Dependency_Manager::RELATION_AND )
78 - ->where( [
79 - 'operator' => 'ne',
80 - 'path' => [ 'object-fit' ],
81 - 'value' => 'fill',
82 - ] )
83 - ->where( [
84 - 'operator' => 'exists',
85 - 'path' => [ 'object-fit' ],
86 - ] )
87 - ->get()
88 - ),
49 + ]),
89 50 ];
90 51 }
91 52
92 53 private static function get_position_props() {
93 54 return [
94 - 'position' => String_Prop_Type::make()->enum( [
55 + 'position' => String_Prop_Type::make()->enum([
95 56 'static',
96 57 'relative',
97 58 'absolute',
98 59 'fixed',
99 60 'sticky',
100 - ] )->description( 'The CSS position property specifies the type of positioning method used for an element (static, relative, absolute, fixed, or sticky).' ),
101 - 'inset-block-start' => Size_Prop_Type::make()->description( 'Size PropType for the inset-block-start CSS property' ),
102 - 'inset-inline-end' => Size_Prop_Type::make()->description( 'Size PropType for the inset-inline-end CSS property' ),
103 - 'inset-block-end' => Size_Prop_Type::make()->description( 'Size PropType for the inset-block-end CSS property' ),
104 - 'inset-inline-start' => Size_Prop_Type::make()->description( 'Size PropType for the inset-inline-start CSS property' ),
105 - 'z-index' => Number_Prop_Type::make()
106 - ->description( 'The z-index CSS property sets the z-order of a positioned element and its descendants or flex items. It specifies the stack order of elements.' ),
107 - 'scroll-margin-top' => Size_Prop_Type::make()->units( Size_Constants::anchor_offset() ),
61 + ]),
62 + 'top' => Size_Prop_Type::make(),
63 + 'right' => Size_Prop_Type::make(),
64 + 'bottom' => Size_Prop_Type::make(),
65 + 'left' => Size_Prop_Type::make(),
66 + 'z-index' => Number_Prop_Type::make(),
108 67 ];
109 68 }
110 69
111 70 private static function get_typography_props() {
112 71 return [
113 - 'font-family' => String_Prop_Type::make()->description( 'The font family of the text content.' ),
114 - 'font-weight' => String_Prop_Type::make()->enum( [
72 + 'font-family' => String_Prop_Type::make(),
73 + 'font-weight' => String_Prop_Type::make()->enum([
115 74 '100',
116 75 '200',
117 76 '300',
118 77 '400',
@@ -124,98 +83,58 @@
124 83 'normal',
125 84 'bold',
126 85 'bolder',
127 86 'lighter',
128 - ] )
129 - ->description( 'The weight (or boldness) of the font. Values should match css font-weight specifications.' ),
130 - 'font-size' => Size_Prop_Type::make()->units( Size_Constants::typography() )->description( 'The font size in Size PropType Format' ),
131 - 'color' => Color_Prop_Type::make()
132 - ->description( 'The text color, specified as a hex code, rgb(a), hsl(a), or a standard css color name.' ),
133 - 'letter-spacing' => Size_Prop_Type::make()->units( Size_Constants::typography() )->description( 'The spacing between letters in Size PropType format' ),
134 - 'word-spacing' => Size_Prop_Type::make()->units( Size_Constants::typography() )->description( 'The spacing between words in Size PropType format' ),
135 - 'column-count' => Number_Prop_Type::make()->description( 'The number of columns the text content should be divided into.' ),
136 - 'column-gap' => Size_Prop_Type::make()
137 - ->set_dependencies(
138 - Dependency_Manager::make()
139 - ->where( [
140 - 'operator' => 'gte',
141 - 'path' => [ 'column-count' ],
142 - 'value' => 1,
143 - ] )
144 - ->get()
145 - ),
146 - 'line-height' => Size_Prop_Type::make()->units( Size_Constants::typography() )->description( 'The line height of the text content in Size PropType format' ),
147 - 'text-align' => String_Prop_Type::make()->enum( [
87 + ]),
88 + 'font-size' => Size_Prop_Type::make(),
89 + 'color' => Color_Prop_Type::make(),
90 + 'letter-spacing' => Size_Prop_Type::make(),
91 + 'word-spacing' => Size_Prop_Type::make(),
92 + 'line-height' => Size_Prop_Type::make(),
93 + 'text-align' => String_Prop_Type::make()->enum([
148 94 'start',
149 95 'center',
150 96 'end',
151 97 'justify',
152 - ] )
153 - ->description( 'The horizontal alignment of the text content. Allowed values: start, center, end, justify.' ),
154 - 'font-style' => String_Prop_Type::make()->enum( [
98 + ]),
99 + 'font-style' => String_Prop_Type::make()->enum([
155 100 'normal',
156 101 'italic',
157 102 'oblique',
158 - ] )
159 - ->description( 'The font style of the text content. CSS values: normal, italic, oblique' ),
103 + ]),
160 104 // TODO: validate text-decoration in more specific way [EDS-524]
161 - 'text-decoration' => String_Prop_Type::make()
162 - ->description( 'The text decoration style. CSS values like: none, underline, overline, line-through, blink, etc.' ),
163 - 'text-transform' => String_Prop_Type::make()->enum( [
105 + 'text-decoration' => String_Prop_Type::make(),
106 + 'text-transform' => String_Prop_Type::make()->enum([
164 107 'none',
165 108 'capitalize',
166 109 'uppercase',
167 110 'lowercase',
168 - ] )
169 - ->description( 'Controls the capitalization of text. CSS values: none, capitalize, uppercase, lowercase' ),
170 - 'direction' => String_Prop_Type::make()->enum( [
111 + ]),
112 + 'direction' => String_Prop_Type::make()->enum([
171 113 'ltr',
172 114 'rtl',
173 - ] )->description( 'The text direction. CSS values: ltr (left to right), rtl (right to left)' ),
174 - 'stroke' => Stroke_Prop_Type::make(),
175 - 'all' => String_Prop_Type::make()->enum( [
176 - 'initial',
177 - 'inherit',
178 - 'unset',
179 - 'revert',
180 - 'revert-layer',
181 - ] )->description( 'The all CSS property. CSS values: initial, inherit, unset, revert, revert-layer' ),
182 - 'cursor' => String_Prop_Type::make()->enum( [
183 - 'pointer',
184 - ] )
185 - ->description( 'The type of cursor to be displayed when pointing over the element. E.g., pointer.' ),
115 + ]),
116 + '-webkit-text-stroke' => Stroke_Prop_Type::make(),
186 117 ];
187 118 }
188 119
189 120 private static function get_spacing_props() {
190 121 return [
191 - 'padding' => Union_Prop_Type::make()
192 - ->add_prop_type( Dimensions_Prop_Type::make_with_units( Size_Constants::spacing() ) )
193 - ->add_prop_type(
194 - Size_Prop_Type::make()
195 - ->units( Size_Constants::spacing() )
196 - ->description( 'Padding css in Size PropType format' )
197 - ),
198 - 'margin' => Union_Prop_Type::make()
199 - ->add_prop_type( Dimensions_Prop_Type::make_with_units( Size_Constants::spacing_margin() ) )
200 - ->add_prop_type(
201 - Size_Prop_Type::make()
202 - ->units( Size_Constants::spacing_margin() )
203 - ->description( 'Margin css in Size PropType format' )
204 - ),
122 + 'padding' => Union_Prop_Type::make()->add_prop_type( Dimensions_Prop_Type::make() )->add_prop_type( Size_Prop_Type::make() ),
123 + 'margin' => Union_Prop_Type::make()->add_prop_type( Dimensions_Prop_Type::make() )->add_prop_type( Size_Prop_Type::make() ),
205 124 ];
206 125 }
207 126
208 127 private static function get_border_props() {
209 128 return [
210 - 'border-radius' => Union_Prop_Type::make()
211 - ->add_prop_type( Border_Radius_Prop_Type::make() )
212 - ->add_prop_type( Size_Prop_Type::make()->units( Size_Constants::border() ) ),
213 - 'border-width' => Union_Prop_Type::make()
214 - ->add_prop_type( Border_Width_Prop_Type::make() )
215 - ->add_prop_type( Size_Prop_Type::make()->units( Size_Constants::border() ) ),
216 - 'border-color' => Color_Prop_Type::make()->description( 'The border color, specified as a hex code, rgb(a), hsl(a), or a standard css color name.' ),
217 - 'border-style' => String_Prop_Type::make()->enum( [
129 + 'border-radius' => Union_Prop_Type::make()->add_prop_type(
130 + Size_Prop_Type::make()
131 + )->add_prop_type(
132 + Border_Radius_Prop_Type::make()
133 + ),
134 + 'border-width' => Union_Prop_Type::make()->add_prop_type( Size_Prop_Type::make() )->add_prop_type( Border_Width_Prop_Type::make() ),
135 + 'border-color' => Color_Prop_Type::make(),
136 + 'border-style' => String_Prop_Type::make()->enum([
218 137 'none',
219 138 'hidden',
220 139 'dotted',
221 140 'dashed',
@@ -224,77 +143,27 @@
224 143 'groove',
225 144 'ridge',
226 145 'inset',
227 146 'outset',
228 - ] )
229 - ->description( 'The border style in CSS values' ),
230 - 'outline-width' => Size_Prop_Type::make()
231 - ->units( Size_Constants::border() )
232 - ->description( 'The width of the outline in Size PropType format' ),
233 - 'outline-color' => Color_Prop_Type::make()->description( 'The color of the outline, specified as a hex code, rgb(a), hsl(a), or a standard css color name.' ),
234 - 'outline-style' => String_Prop_Type::make()->enum( [
235 - 'none',
236 - 'hidden',
237 - 'dotted',
238 - 'dashed',
239 - 'solid',
240 - 'double',
241 - 'groove',
242 - 'ridge',
243 - 'inset',
244 - 'outset',
245 - ] )->description( 'The outline style in CSS values' ),
246 - 'outline-offset' => Size_Prop_Type::make()->units( Size_Constants::border() )->description( 'The offset of the outline, specified as a length in Size PropType format' ),
247 -
147 + ]),
248 148 ];
249 149 }
250 150
251 151 private static function get_background_props() {
252 - // Background image overlay as an exception
253 - $background_prop_type = Background_Prop_Type::make();
254 - $bg_overlay_prop_type = $background_prop_type->get_shape_field( Background_Overlay_Prop_Type::get_key() );
255 - $bg_image_overlay_prop_type = $bg_overlay_prop_type->get_item_type()->get_prop_type( Background_Image_Overlay_Prop_Type::get_key() );
256 - Dynamic_Prop_Types_Mapping::make()->get_extended_schema( $bg_image_overlay_prop_type->get_shape() );
257 152 return [
258 - 'background' => $background_prop_type,
153 + 'background' => Background_Prop_Type::make(),
259 154 ];
260 155 }
261 156
262 157 private static function get_effects_props() {
263 158 return [
264 - 'mix-blend-mode' => String_Prop_Type::make()->enum( [
265 - 'normal',
266 - 'multiply',
267 - 'screen',
268 - 'overlay',
269 - 'darken',
270 - 'lighten',
271 - 'color-dodge',
272 - 'saturation',
273 - 'color',
274 - 'difference',
275 - 'exclusion',
276 - 'hue',
277 - 'luminosity',
278 - 'soft-light',
279 - 'hard-light',
280 - 'color-burn',
281 - ] )->description( 'Applied as mix-blend mode css effect.' ),
282 159 'box-shadow' => Box_Shadow_Prop_Type::make(),
283 - 'opacity' => Size_Prop_Type::make()
284 - ->description( 'The opacity of the element, specified as a percentage between 0 (fully transparent) and 100 (fully opaque).' )
285 - ->units( Size_Constants::opacity() )
286 - ->default_unit( Size_Constants::UNIT_PERCENT ),
287 - 'filter' => Filter_Prop_Type::make(),
288 - 'backdrop-filter' => Backdrop_Filter_Prop_Type::make(),
289 - 'transform' => Transform_Prop_Type::make(),
290 - 'transition' => Transition_Prop_Type::make(),
291 160 ];
292 161 }
293 162
294 163 private static function get_layout_props() {
295 164 return [
296 - 'display' => String_Prop_Type::make()->enum( [
165 + 'display' => String_Prop_Type::make()->enum([
297 166 'block',
298 167 'inline',
299 168 'inline-block',
300 169 'flex',
@@ -303,32 +172,32 @@
303 172 'inline-grid',
304 173 'flow-root',
305 174 'none',
306 175 'contents',
307 - ] )->description( 'The CSS display property defines the display behavior (the type of rendering box) of an element.' ),
308 - 'flex-direction' => String_Prop_Type::make()
309 - ->description( 'The direction of the contained items.' )
310 - ->enum( [
311 - 'row',
312 - 'row-reverse',
313 - 'column',
314 - 'column-reverse',
315 - ] ),
176 + ]),
177 + 'flex-direction' => String_Prop_Type::make()->enum([
178 + 'row',
179 + 'row-reverse',
180 + 'column',
181 + 'column-reverse',
182 + ]),
316 183 'gap' => Union_Prop_Type::make()
317 184 ->add_prop_type( Layout_Direction_Prop_Type::make() )
318 - ->add_prop_type( Size_Prop_Type::make()->units( Size_Constants::layout() ) ),
319 - 'flex-wrap' => String_Prop_Type::make()->enum( [
185 + ->add_prop_type( Size_Prop_Type::make() ),
186 + 'flex-wrap' => String_Prop_Type::make()->enum([
320 187 'wrap',
321 188 'nowrap',
322 189 'wrap-reverse',
323 - ] )->description( 'Specifies whether the flex items should wrap or not. CSS values: wrap, nowrap, wrap-reverse' ),
324 - 'flex' => Flex_Prop_Type::make(),
190 + ]),
191 + 'flex-grow' => Number_Prop_Type::make(),
192 + 'flex-shrink' => Number_Prop_Type::make(),
193 + 'flex-basis' => Size_Prop_Type::make(),
325 194 ];
326 195 }
327 196
328 197 private static function get_alignment_props() {
329 198 return [
330 - 'justify-content' => String_Prop_Type::make()->enum( [
199 + 'justify-content' => String_Prop_Type::make()->enum([
331 200 'center',
332 201 'start',
333 202 'end',
334 203 'flex-start',
@@ -339,11 +208,10 @@
339 208 'space-between',
340 209 'space-around',
341 210 'space-evenly',
342 211 'stretch',
343 - ] )
344 - ->description( 'Defines how the browser distributes space between and around content items along the main-axis of a flex container. CSS values: center, start, end, flex-start, flex-end, left, right, normal, space-between, space-around, space-evenly, stretch' ),
345 - 'justify-items' => String_Prop_Type::make()->enum( [
212 + ]),
213 + 'align-items' => String_Prop_Type::make()->enum([
346 214 'normal',
347 215 'stretch',
348 216 'center',
349 217 'start',
@@ -349,34 +217,13 @@
349 217 'start',
350 218 'end',
351 219 'flex-start',
352 220 'flex-end',
353 - 'left',
354 - 'right',
355 - 'anchor-center',
356 - ] )->description( 'Defines how the browser distributes space between and around content items along the inline axis of a grid container. CSS values: center, start, end, flex-start, flex-end, left, right' ),
357 - 'align-content' => String_Prop_Type::make()->enum( [
358 - 'center',
359 - 'start',
360 - 'end',
361 - 'space-between',
362 - 'space-around',
363 - 'space-evenly',
364 - ] )
365 - ->description( 'Aligns a flex container\'s lines within when there is extra space in the cross-axis. CSS values: center, start, end, space-between, space-around, space-evenly' ),
366 - 'align-items' => String_Prop_Type::make()->enum( [
367 - 'normal',
368 - 'stretch',
369 - 'center',
370 - 'start',
371 - 'end',
372 - 'flex-start',
373 - 'flex-end',
374 221 'self-start',
375 222 'self-end',
376 223 'anchor-center',
377 - ] )->description( 'Defines the default behavior for how flex items are laid out along the cross axis on the current line. CSS values: normal, stretch, center, start, end, flex-start, flex-end, self-start, self-end, anchor-center' ),
378 - 'align-self' => String_Prop_Type::make()->enum( [
224 + ]),
225 + 'align-self' => String_Prop_Type::make()->enum([
379 226 'auto',
380 227 'normal',
381 228 'center',
382 229 'start',
@@ -389,17 +236,9 @@
389 236 'baseline',
390 237 'first baseline',
391 238 'last baseline',
392 239 'stretch',
393 - ] )->description( 'Allows the default alignment (or the one specified by align-items) to be overridden for individual flex items. CSS values: auto, normal, center, start, end, self-start, self-end, flex-start, flex-end, anchor-center, baseline, first baseline, last baseline, stretch' ),
394 - 'order' => Number_Prop_Type::make()->description( 'Specifies the order of the flex items. Items with lower order values are displayed first.' ),
395 - ];
396 - }
397 -
398 - private static function get_special_props() {
399 - return [
400 - 'content' => String_Prop_Type::make()->description( 'The string content for pseudo-element content property' ),
401 - 'appearance' => String_Prop_Type::make()->enum( [ 'none', 'auto' ] )->description( 'The appearance of the element. CSS values: none, auto' ),
402 - 'clip-path' => String_Prop_Type::make()->description( 'The clip-path CSS property defines a shape to be used as clipping region.' ),
240 + ]),
241 + 'order' => Number_Prop_Type::make(),
403 242 ];
404 243 }
405 244 }