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