Skip to content

Commit

Permalink
آپدیت ورژن جدید
Browse files Browse the repository at this point in the history
  • Loading branch information
amin30000 committed Jun 25, 2023
1 parent 22f49da commit 66bcf36
Show file tree
Hide file tree
Showing 551 changed files with 86,090 additions and 5,089 deletions.
25 changes: 25 additions & 0 deletions css/_forms.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// General form mixins and styles.

@mixin ame-visually-hide-input {
//Hide an input like a radio or a checkbox but leave it interactive.
position: absolute;
left: -9999em;
overflow: hidden;
clip: rect(0, 0, 0, 0);
margin: -1px;
}

$invalidColor: #d63638; //Matches the Theme Customizer.

@mixin ame-invalid-input-styles {
select, input {
&:invalid, &.ame-has-validation-errors {
border-color: $invalidColor;

//Override the box shadow that WordPress adds on focus.
&:focus {
box-shadow: 0 0 0 1px $invalidColor;
}
}
}
}
2 changes: 1 addition & 1 deletion css/_input-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: flex;
flex-wrap: wrap;

> :not(:first-child) {
.ame-input-group-secondary, > :not(:first-child) {
margin-left: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
Expand Down
72 changes: 2 additions & 70 deletions css/menu-editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/menu-editor.css.map

Large diffs are not rendered by default.

83 changes: 7 additions & 76 deletions css/menu-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@import "boxes";
@import "input-group";
@import "forms";

#ws_menu_editor {
min-width: 780px;
Expand Down Expand Up @@ -1055,78 +1056,6 @@ $iconFontColor: #85888c;
Menu color picker
*************************************/

#ws-ame-menu-color-settings {
background: white;
display: none;
}

#ame-menu-color-list {
height: 500px;
overflow-y: auto;
}

.ame-menu-color-column {
min-width: 460px;
}

.ame-menu-color-name {
display: inline-block;
vertical-align: top;
padding-top: 2px;

line-height: 1.3;
font-size: 14px;
font-weight: 600;

min-width: 180px;
}

.ame-color-option {
padding: 10px 0;

.wp-picker-container {
display: inline-block;
}
}

.ame-advanced-menu-color {
display: none;
}

#ws-ame-apply-colors-to-all {
display: block;
float: left;
margin-left: 5px;
}

/* Color presets */
#ame-color-preset-container {
padding: 0 8px 8px 8px;

margin-left: -8px;
margin-right: -8px;
margin-bottom: 4px;

border-bottom: 1px solid #eee;
}

#ame-menu-color-presets {
width: 290px;
margin-right: 5px;
}

#ws-ame-save-color-preset {
/*margin-right: 5px;*/
}

a#ws-ame-delete-color-preset {
color: #A00;
text-decoration: none;
}
a#ws-ame-delete-color-preset:hover {
color: #F00;
}

/* Color scheme display in the editor widget. */

$colorFieldWidth: 190px;
Expand Down Expand Up @@ -1941,10 +1870,12 @@ $userSelectionPanelPadding: 10px;
}

//And in other boxes.
.ws_ame_custom_postbox .ws_tooltip_trigger .dashicons {
font-size: 18px;
height: 18px;
vertical-align: bottom;
.ws_ame_custom_postbox, .postbox {
.ws_tooltip_trigger .dashicons {
font-size: 18px;
height: 18px;
vertical-align: bottom;
}
}

.ws_tooltip_trigger.ame-warning-tooltip {
Expand Down
133 changes: 133 additions & 0 deletions customizables/Builders/BaseElementBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?php

namespace YahnisElsts\AdminMenuEditor\Customizable\Builders;

use YahnisElsts\AdminMenuEditor\Customizable\Controls\UiElement;

/**
* @template ElementClass of UiElement
*/
abstract class BaseElementBuilder implements ElementBuilder {
/**
* @var array
*/
protected $params = array();

/**
* @var class-string<ElementClass>
*/
protected $elementClass;

/**
* @param class-string<\YahnisElsts\AdminMenuEditor\Customizable\Controls\UiElement> $elementClass
* @param array $params
*/
protected function __construct($elementClass, $params = array()) {
$this->elementClass = $elementClass;
$this->params = $params;
}

protected static function buildItems($items, $preserveKeys = false) {
$results = array();
foreach ($items as $key => $item) {
if ( is_array($item) ) {
//Flatten nested arrays of buildable things.
$results = array_merge($results, self::buildItems($item, $preserveKeys));
continue;
}

if ( $item instanceof ElementBuilder ) {
$item = $item->build();
} elseif ( !($item instanceof UiElement) ) {
$typeString = is_object($item) ? get_class($item) : gettype($item);
throw new \InvalidArgumentException(
'Invalid item type for an element builder: ' . $typeString
);
}

if ( $preserveKeys ) {
$results[$key] = $item;
} else {
$results[] = $item;
}
}
return $results;
}

public function id($string) {
$this->params['id'] = $string;
return $this;
}

public function getCustomId() {
return isset($this->params['id']) ? $this->params['id'] : null;
}

/**
* @param string|callable $textOrCallback
* @return $this
*/
public function description($textOrCallback) {
$this->params['description'] = $textOrCallback;
return $this;
}

public function classes(...$cssClassNames) {
return $this->addItemsToArrayParam('classes', $cssClassNames);
}

/**
* Add CSS class names if their values are truthy.
*
* @param array<string,mixed> $classEnabled ['class-a' => true, 'class-b' => false, ...]
* @return $this
*/
public function conditionalClasses($classEnabled) {
return $this->classes(...array_keys(array_filter($classEnabled)));
}

public function styles($propertyPairs) {
return $this->addItemsToArrayParam('style', $propertyPairs);
}

/**
* @param string $paramName
* @param $items
* @return $this
*/
protected function addItemsToArrayParam($paramName, $items) {
if ( !isset($this->params[$paramName]) ) {
$this->params[$paramName] = array();
}
$this->params[$paramName] = array_merge($this->params[$paramName], (array)$items);
return $this;
}

/**
* Set one or more parameters for the element.
*
* Will overwrite any existing parameters with the same name.
*
* @param array<string,mixed> $additionalParams
* @return $this
*/
public function params($additionalParams) {
$this->params = array_merge($this->params, $additionalParams);
return $this;
}

/**
* Render the element only if the condition evaluates to true.
*
* @param bool|callable $condition
*/
public function onlyIf($condition) {
$this->params['renderCondition'] = $condition;
return $this;
}

/**
* @return ElementClass
*/
abstract public function build();
}
26 changes: 26 additions & 0 deletions customizables/Builders/CodeEditorBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace YahnisElsts\AdminMenuEditor\Customizable\Builders;

use YahnisElsts\AdminMenuEditor\Customizable\Controls;

class CodeEditorBuilder extends ControlBuilder {
public function __construct($settings = array(), $params = array()) {
parent::__construct(Controls\CodeEditor::class, $settings, $params);
}

public function cssMode() {
$this->params['mimeType'] = 'text/css';
return $this;
}

public function jsMode() {
$this->params['mimeType'] = 'application/javascript';
return $this;
}

public function htmlMode() {
$this->params['mimeType'] = 'text/html';
return $this;
}
}
Loading

0 comments on commit 66bcf36

Please sign in to comment.