first commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Boolean_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Number_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
|
||||
use Elementor\Modules\Interactions\Presets;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Animation_Config_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'config-v2';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'replay' => Boolean_Prop_Type::make()->meta( 'pro', true )->description( 'Whether to replay the animation' ),
|
||||
'easing' => String_Prop_Type::make()->meta( 'enum', Presets::easing_options() )->default( Presets::DEFAULT_EASING )->meta( 'pro', Presets::ADDITIONAL_EASING )->description( 'The easing function to use for the animation' ),
|
||||
'relativeTo' => String_Prop_Type::make()->meta( 'pro', true )->description( 'The container scope used by scroll-based interactions' ),
|
||||
'repeat' => String_Prop_Type::make()->meta( 'enum', Presets::REPEAT_OPTIONS )->default( Presets::DEFAULT_REPEAT )->meta( 'pro', true )->description( 'Repeat mode for interactions that can run multiple times' ),
|
||||
'times' => Number_Prop_Type::make()->meta( 'pro', true )->description( 'Total number of times to play when repeat mode is "times"' ),
|
||||
'start' => Size_Prop_Type::make()->units( '%' )->default_unit( '%' )->meta( 'pro', true )->description( 'The start to use for the animation' ),
|
||||
'end' => Size_Prop_Type::make()->units( '%' )->default_unit( '%' )->meta( 'pro', true )->description( 'The end to use for the animation' ),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
|
||||
use Elementor\Modules\Interactions\Presets;
|
||||
use Elementor\Modules\Interactions\Utils\Prop_Shape_Filter_For_Pro;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Animation_Preset_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'animation-preset-props';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'effect' => String_Prop_Type::make()->meta( 'enum', Presets::effects_options() )->meta( 'pro', Presets::ADDITIONAL_EFFECTS )->description( 'The effect to use for the animation' ),
|
||||
'type' => String_Prop_Type::make()->meta( 'enum', Presets::TYPES )->description( 'The type to use for the animation' ),
|
||||
'direction' => String_Prop_Type::make()->meta( 'enum', Presets::DIRECTIONS )->description( 'The direction to use for the animation' ),
|
||||
'timing_config' => Timing_Config_Prop_Type::make()->description( 'The timing config to use for the animation' ),
|
||||
'config' => Animation_Config_Prop_Type::make()->description( 'The config to use for the animation' ),
|
||||
'custom_effect' => Custom_Effect_Prop_Type::make()->meta( 'pro', true ),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Custom_Effect_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'custom-effect';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'keyframes' => Keyframes_Prop_Type::make()->required(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Array_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Contracts\Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Excluded_Breakpoints_Prop_Type extends Array_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'excluded-breakpoints';
|
||||
}
|
||||
|
||||
protected function define_item_type(): Prop_Type {
|
||||
return String_Prop_Type::make();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Interaction_Breakpoints_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'interaction-breakpoints';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'excluded' => Excluded_Breakpoints_Prop_Type::make()->description( 'The excluded breakpoints' ),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
|
||||
use Elementor\Modules\Interactions\Presets;
|
||||
use Elementor\Modules\Interactions\Utils\Prop_Shape_Filter_For_Pro;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Interaction_Item_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'interaction-item';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'interaction_id' => String_Prop_Type::make()->description( 'The interaction id to use for the animation' ),
|
||||
'trigger' => String_Prop_Type::make()->meta( 'enum', Presets::triggers_options() )->meta( 'pro', Presets::ADDITIONAL_TRIGGERS )->description( 'The trigger to use for the animation' ),
|
||||
'animation' => Animation_Preset_Prop_Type::make()->description( 'The animation to use for the interaction' ),
|
||||
'breakpoints' => Interaction_Breakpoints_Prop_Type::make()->description( 'The breakpoints to use for the animation' ),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\Styles\Size_Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Keyframe_Stop_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'keyframe-stop';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'stop' => Size_Prop_Type::make()
|
||||
->default_unit( Size_Constants::UNIT_PERCENT )
|
||||
->required(),
|
||||
'settings' => Keyframe_Stop_Settings_Prop_Type::make()
|
||||
->required(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Transform\Functions\Transform_Move_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Transform\Functions\Transform_Rotate_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Transform\Functions\Transform_Scale_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Transform\Functions\Transform_Skew_Prop_Type;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Keyframe_Stop_Settings_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'keyframe-stop-settings';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'opacity' => Size_Prop_Type::make(),
|
||||
'move' => Transform_Move_Prop_Type::make(),
|
||||
'rotate' => Transform_Rotate_Prop_Type::make(),
|
||||
'scale' => Transform_Scale_Prop_Type::make(),
|
||||
'skew' => Transform_Skew_Prop_Type::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function validate_value( $value ): bool {
|
||||
if ( ! is_array( $value ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$allowed_keys = array_keys( $this->get_shape() );
|
||||
$value_keys = array_keys( $value );
|
||||
|
||||
if ( array_diff( $value_keys, $allowed_keys ) !== [] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::validate_value( $value );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Array_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Contracts\Prop_Type;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Keyframes_Prop_Type extends Array_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'keyframes';
|
||||
}
|
||||
|
||||
protected function define_item_type(): Prop_Type {
|
||||
return Keyframe_Stop_Prop_Type::make();
|
||||
}
|
||||
|
||||
protected function validate_value( $value ): bool {
|
||||
$is_empty_array = empty( $value ) && is_array( $value );
|
||||
|
||||
if ( $is_empty_array ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::validate_value( $value );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
|
||||
use Elementor\Modules\AtomicWidgets\Styles\Size_Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Time_Size_Prop_Type extends Size_Prop_Type {
|
||||
public static function make() {
|
||||
return parent::make()->units( Size_Constants::time() )->default_unit( Size_Constants::UNIT_MILLI_SECOND );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Interactions\Props;
|
||||
|
||||
use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Timing_Config_Prop_Type extends Object_Prop_Type {
|
||||
public static function get_key(): string {
|
||||
return 'timing-config';
|
||||
}
|
||||
|
||||
protected function define_shape(): array {
|
||||
return [
|
||||
'duration' => Time_Size_Prop_Type::make()->description( 'The duration to use for the animation' ),
|
||||
'delay' => Time_Size_Prop_Type::make()->description( 'The delay to use for the animation' ),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user