first commit

This commit is contained in:
Roman Pyrih
2026-03-10 09:50:10 +01:00
commit 64c4a90405
7289 changed files with 2645777 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Base;
use JsonSerializable;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Atomic_Control_Base implements JsonSerializable {
private string $bind;
private $label = null;
private $description = null;
private $meta = null;
abstract public function get_type(): string;
abstract public function get_props(): array;
public static function bind_to( string $prop_name ) {
return new static( $prop_name );
}
protected function __construct( string $prop_name ) {
$this->bind = $prop_name;
}
public function get_bind() {
return $this->bind;
}
public function set_label( string $label ): self {
$this->label = html_entity_decode( $label );
return $this;
}
public function set_description( string $description ): self {
$this->description = html_entity_decode( $description );
return $this;
}
public function set_meta( $meta ): self {
$this->meta = $meta;
return $this;
}
public function jsonSerialize(): array {
return [
'type' => 'control',
'value' => [
'type' => $this->get_type(),
'bind' => $this->get_bind(),
'label' => $this->label,
'description' => $this->description,
'props' => $this->get_props(),
'meta' => $this->meta,
],
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Base;
use JsonSerializable;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Element_Control_Base implements JsonSerializable {
private $label = null;
private $meta = null;
abstract public function get_type(): string;
abstract public function get_props(): array;
public static function make(): self {
return new static();
}
public function set_label( string $label ): self {
$this->label = $label;
return $this;
}
public function get_label(): string {
return $this->label;
}
public function set_meta( $meta ): self {
$this->meta = $meta;
return $this;
}
public function get_meta(): array {
return $this->meta;
}
public function jsonSerialize(): array {
return [
'type' => 'element-control',
'value' => [
'label' => $this->get_label(),
'meta' => $this->get_meta(),
'type' => $this->get_type(),
'props' => $this->get_props(),
],
];
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls;
use JsonSerializable;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Section implements JsonSerializable {
private ?string $id = null;
private $label = null;
private $description = null;
private array $items = [];
public static function make(): self {
return new static();
}
public function set_id( string $id ): self {
$this->id = $id;
return $this;
}
public function get_id() {
return $this->id;
}
public function set_label( string $label ): self {
$this->label = html_entity_decode( $label );
return $this;
}
public function get_label(): ?string {
return $this->label;
}
public function set_description( string $description ): self {
$this->description = html_entity_decode( $description );
return $this;
}
public function set_items( array $items ): self {
$this->items = $items;
return $this;
}
public function add_item( $item ): self {
$this->items[] = $item;
return $this;
}
public function get_items() {
return $this->items;
}
public function jsonSerialize(): array {
return [
'type' => 'section',
'value' => [
'label' => $this->label,
'description' => $this->description,
'items' => $this->items,
],
];
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Date_Time_Control extends Atomic_Control_Base {
public function get_type(): string {
return 'date-time';
}
public function get_props(): array {
return [];
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types\Elements;
use Elementor\Modules\AtomicWidgets\Controls\Base\Element_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Tabs_Control extends Element_Control_Base {
public function get_type(): string {
return 'tabs';
}
public function get_props(): array {
return [];
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Html_Tag_Control extends Select_Control {
public function get_type(): string {
return 'html-tag';
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
use Elementor\Modules\AtomicWidgets\Utils\Image\Image_Sizes;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Image_Control extends Atomic_Control_Base {
public function get_type(): string {
return 'image';
}
public function get_props(): array {
return [
'sizes' => Image_Sizes::get_all(),
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Inline_Editing_Control extends Atomic_Control_Base {
private ?string $placeholder = null;
public function get_type(): string {
return 'inline-editing';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
];
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
use Elementor\Modules\AtomicWidgets\Query\Query_Builder_Factory as Query_Builder;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Link_Control extends Atomic_Control_Base {
private bool $allow_custom_values = true;
private int $minimum_input_length = 2;
private ?array $query_config = null;
private ?string $placeholder = null;
private ?string $aria_label = null;
public function get_type(): string {
return 'link';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function set_allow_custom_values( bool $allow_custom_values ): self {
$this->allow_custom_values = $allow_custom_values;
return $this;
}
public function set_query_config( $config ): self {
$this->query_config = $config;
return $this;
}
public function get_props(): array {
return [
'allowCustomValues' => $this->allow_custom_values,
'placeholder' => $this->placeholder,
'queryOptions' => Query_Builder::create( $this->query_config )->build(),
'minInputLength' => $this->minimum_input_length,
'ariaLabel' => 'Link URL',
];
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Number_Control extends Atomic_Control_Base {
private ?string $placeholder = null;
private ?int $max = null;
private ?int $min = null;
private ?int $step = null;
private ?bool $should_force_int = null;
public function get_type(): string {
return 'number';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function set_max( ?int $max ): self {
$this->max = $max;
return $this;
}
public function set_min( ?int $min ): self {
$this->min = $min;
return $this;
}
public function set_step( ?int $step ): self {
$this->step = $step;
return $this;
}
public function set_should_force_int( ?bool $should_force_int ): self {
$this->should_force_int = $should_force_int ?? false;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
'max' => $this->max,
'min' => $this->min,
'step' => $this->step,
'shouldForceInt' => $this->should_force_int,
];
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
use Elementor\Modules\AtomicWidgets\Query\Query_Builder_Factory as Query_Builder;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Query_Control extends Atomic_Control_Base {
private bool $allow_custom_values = true;
private int $minimum_input_length = 2;
private ?array $query_config = null;
private ?string $placeholder = null;
public function get_type(): string {
return 'query';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function set_allow_custom_values( bool $allow_custom_values ): self {
$this->allow_custom_values = $allow_custom_values;
return $this;
}
public function set_query_config( $config ): self {
$this->query_config = $config;
return $this;
}
public function get_props(): array {
return [
'allowCustomValues' => $this->allow_custom_values,
'placeholder' => $this->placeholder,
'queryOptions' => Query_Builder::create( $this->query_config )->build(),
'minInputLength' => $this->minimum_input_length,
];
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Repeatable_Control extends Atomic_Control_Base {
private string $child_control_type;
private object $child_control_props;
private bool $show_duplicate = true;
private bool $show_toggle = true;
private string $repeater_label;
private ?object $initial_values;
private ?string $pattern_label;
private ?string $placeholder;
private ?string $prop_key = '';
public function get_type(): string {
return 'repeatable';
}
public function set_child_control_type( $control_type ): self {
$this->child_control_type = $control_type;
return $this;
}
public function set_child_control_props( $control_props ): self {
$this->child_control_props = (object) $control_props;
return $this;
}
public function hide_duplicate(): self {
$this->show_duplicate = false;
return $this;
}
public function hide_toggle(): self {
$this->show_toggle = false;
return $this;
}
public function set_initialValues( $initial_values ): self {
$this->initial_values = (object) $initial_values;
return $this;
}
public function set_patternLabel( $pattern_label ): self {
$this->pattern_label = $pattern_label;
return $this;
}
public function set_repeaterLabel( string $label ): self {
$this->repeater_label = $label;
return $this;
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function set_prop_key( string $prop_key ): self {
$this->prop_key = $prop_key;
return $this;
}
public function get_props(): array {
return [
'childControlType' => $this->child_control_type,
'childControlProps' => $this->child_control_props,
'showDuplicate' => $this->show_duplicate,
'showToggle' => $this->show_toggle,
'initialValues' => $this->initial_values,
'patternLabel' => $this->pattern_label,
'repeaterLabel' => $this->repeater_label,
'placeholder' => $this->placeholder,
'propKey' => $this->prop_key,
];
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Select_Control extends Atomic_Control_Base {
private array $options = [];
private ?array $fallback_labels = null;
private ?string $collection_id = null;
private ?string $placeholder = null;
public function get_type(): string {
return 'select';
}
public function set_options( array $options ): self {
$this->options = $options;
return $this;
}
public function set_collection_id( string $collection_id ): self {
$this->collection_id = $collection_id;
return $this;
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function get_props(): array {
$props = [
'options' => $this->options,
'fallbackLabels' => $this->fallback_labels,
'placeholder' => $this->placeholder,
];
if ( $this->collection_id ) {
$props['collectionId'] = $this->collection_id;
}
return $props;
}
public function set_fallback_labels( array $fallback_labels ): self {
$this->fallback_labels = $fallback_labels;
return $this;
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Size_Control extends Atomic_Control_Base {
private ?string $placeholder = null;
private ?string $variant = 'length';
private ?array $units = null;
private ?string $default_unit = null;
private ?bool $disable_custom = false;
public function get_type(): string {
return 'size';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function set_variant( string $variant ): self {
$this->variant = $variant;
return $this;
}
public function set_units( array $units ): self {
$this->units = $units;
return $this;
}
public function set_default_unit( string $default_unit ): self {
$this->default_unit = $default_unit;
return $this;
}
public function set_disable_custom( bool $disable_custom ): self {
$this->disable_custom = $disable_custom;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
'variant' => $this->variant,
'units' => $this->units,
'defaultUnit' => $this->default_unit,
'disableCustom' => $this->disable_custom,
];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
use Elementor\Modules\AtomicWidgets\Utils\Image\Image_Sizes;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Svg_Control extends Atomic_Control_Base {
public function get_type(): string {
return 'svg-media';
}
public function get_props(): array {
return [
'type' => $this->get_type(),
];
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Switch_Control extends Atomic_Control_Base {
public function get_type(): string {
return 'switch';
}
public function get_props(): array {
return [];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Text_Control extends Atomic_Control_Base {
private ?string $placeholder = null;
public function get_type(): string {
return 'text';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = $placeholder;
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Textarea_Control extends Atomic_Control_Base {
private $placeholder = null;
public function get_type(): string {
return 'textarea';
}
public function set_placeholder( string $placeholder ): self {
$this->placeholder = html_entity_decode( $placeholder );
return $this;
}
public function get_props(): array {
return [
'placeholder' => $this->placeholder,
];
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace Elementor\Modules\AtomicWidgets\Controls\Types;
use Elementor\Modules\AtomicWidgets\Controls\Base\Atomic_Control_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Toggle_Control extends Atomic_Control_Base {
private array $options = [];
private bool $full_width = false;
private string $size = 'tiny';
private bool $exclusive = true;
private bool $convert_options = false;
public function get_type(): string {
return 'toggle';
}
public function add_options( array $control_options ): self {
$this->options = [];
foreach ( $control_options as $value => $config ) {
$this->options[] = [
'value' => $value,
'label' => $config['title'] ?? $value,
'icon' => $config['atomic-icon'] ?? null,
'showTooltip' => true,
'exclusive' => false,
];
}
return $this;
}
public function set_size( string $size ): self {
$allowed_sizes = [ 'tiny', 'small', 'medium', 'large' ];
if ( in_array( $size, $allowed_sizes, true ) ) {
$this->size = $size;
}
return $this;
}
public function set_exclusive( bool $exclusive ): self {
$this->exclusive = $exclusive;
return $this;
}
/**
* Whether to convert the v3 options to v4 compatible
*
* @param bool $convert_options
* @return $this
*/
public function set_convert_options( bool $convert_options ): self {
$this->convert_options = $convert_options;
return $this;
}
public function get_props(): array {
return [
'options' => $this->options,
'fullWidth' => $this->full_width,
'size' => $this->size,
'exclusive' => $this->exclusive,
'convertOptions' => $this->convert_options,
];
}
}