| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\AtomicWidgets\Styles; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; // Exit if accessed directly. |
| 7 |
} |
| 8 |
|
| 9 |
class Size_Constants { |
| 10 |
const UNIT_PX = 'px'; |
| 11 |
const UNIT_PERCENT = '%'; |
| 12 |
const UNIT_EM = 'em'; |
| 13 |
const UNIT_REM = 'rem'; |
| 14 |
const UNIT_VW = 'vw'; |
| 15 |
const UNIT_VH = 'vh'; |
| 16 |
const UNIT_CH = 'ch'; |
| 17 |
const UNIT_AUTO = 'auto'; |
| 18 |
const UNIT_CUSTOM = 'custom'; |
| 19 |
const UNIT_SECOND = 's'; |
| 20 |
const UNIT_MILLI_SECOND = 'ms'; |
| 21 |
const UNIT_ANGLE_DEG = 'deg'; |
| 22 |
|
| 23 |
const DEFAULT_UNIT = self::UNIT_PX; |
| 24 |
|
| 25 |
const LENGTH_UNITS = [ |
| 26 |
self::UNIT_PX, |
| 27 |
self::UNIT_EM, |
| 28 |
self::UNIT_REM, |
| 29 |
self::UNIT_VW, |
| 30 |
self::UNIT_VH, |
| 31 |
self::UNIT_CH, |
| 32 |
]; |
| 33 |
|
| 34 |
const TIME_UNITS = [ self::UNIT_SECOND, self::UNIT_MILLI_SECOND ]; |
| 35 |
const EXTENDED_UNITS = [ self::UNIT_AUTO, self::UNIT_CUSTOM ]; |
| 36 |
const VIEWPORT_MIN_MAX_UNITS = [ 'vmin', 'vmax' ]; |
| 37 |
const ANGLE_UNITS = [ self::UNIT_ANGLE_DEG, 'rad', 'grad', 'turn' ]; |
| 38 |
|
| 39 |
public static function all_supported_units(): array { |
| 40 |
return array_merge( |
| 41 |
self::all(), |
| 42 |
self::ANGLE_UNITS, |
| 43 |
self::TIME_UNITS, |
| 44 |
self::EXTENDED_UNITS, |
| 45 |
self::VIEWPORT_MIN_MAX_UNITS, |
| 46 |
); |
| 47 |
} |
| 48 |
|
| 49 |
public static function all(): array { |
| 50 |
return [ |
| 51 |
...self::LENGTH_UNITS, |
| 52 |
self::UNIT_PERCENT, |
| 53 |
self::UNIT_AUTO, |
| 54 |
self::UNIT_CUSTOM, |
| 55 |
]; |
| 56 |
} |
| 57 |
|
| 58 |
private static function units_without_auto(): array { |
| 59 |
return [ ...self::LENGTH_UNITS, self::UNIT_PERCENT, self::UNIT_CUSTOM ]; |
| 60 |
} |
| 61 |
|
| 62 |
public static function layout(): array { |
| 63 |
return self::units_without_auto(); |
| 64 |
} |
| 65 |
|
| 66 |
public static function spacing_margin() { |
| 67 |
return self::all(); |
| 68 |
} |
| 69 |
|
| 70 |
public static function spacing(): array { |
| 71 |
return self::units_without_auto(); |
| 72 |
} |
| 73 |
|
| 74 |
public static function position(): array { |
| 75 |
return self::units_without_auto(); |
| 76 |
} |
| 77 |
|
| 78 |
public static function anchor_offset(): array { |
| 79 |
return [ ...self::LENGTH_UNITS, self::UNIT_CUSTOM ]; |
| 80 |
} |
| 81 |
|
| 82 |
public static function typography(): array { |
| 83 |
return self::units_without_auto(); |
| 84 |
} |
| 85 |
|
| 86 |
public static function stroke_width(): array { |
| 87 |
return [ |
| 88 |
self::UNIT_PX, |
| 89 |
self::UNIT_EM, |
| 90 |
self::UNIT_REM, |
| 91 |
self::UNIT_CUSTOM, |
| 92 |
]; |
| 93 |
} |
| 94 |
|
| 95 |
public static function transition(): array { |
| 96 |
return [ ...self::TIME_UNITS, self::UNIT_CUSTOM ]; |
| 97 |
} |
| 98 |
|
| 99 |
public static function border(): array { |
| 100 |
return self::units_without_auto(); |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
public static function opacity(): array { |
| 105 |
return [ self::UNIT_PERCENT, self::UNIT_CUSTOM ]; |
| 106 |
} |
| 107 |
|
| 108 |
public static function box_shadow(): array { |
| 109 |
return self::units_without_auto(); |
| 110 |
} |
| 111 |
|
| 112 |
public static function rotate(): array { |
| 113 |
return [ ...self::ANGLE_UNITS, self::UNIT_CUSTOM ]; |
| 114 |
} |
| 115 |
|
| 116 |
public static function transform(): array { |
| 117 |
return self::units_without_auto(); |
| 118 |
} |
| 119 |
|
| 120 |
public static function drop_shadow(): array { |
| 121 |
return [ ...self::LENGTH_UNITS, self::UNIT_CUSTOM ]; |
| 122 |
} |
| 123 |
|
| 124 |
public static function blur_filter(): array { |
| 125 |
return [ ...self::LENGTH_UNITS, self::UNIT_CUSTOM ]; |
| 126 |
} |
| 127 |
|
| 128 |
public static function intensity_filter(): array { |
| 129 |
return [ self::UNIT_PERCENT, self::UNIT_CUSTOM ]; |
| 130 |
} |
| 131 |
|
| 132 |
public static function color_tone_filter(): array { |
| 133 |
return [ self::UNIT_PERCENT, self::UNIT_CUSTOM ]; |
| 134 |
} |
| 135 |
|
| 136 |
public static function hue_rotate_filter(): array { |
| 137 |
return [ ...self::ANGLE_UNITS, self::UNIT_CUSTOM ]; |
| 138 |
} |
| 139 |
} |
| 140 |
|