Update to Kirki 4.0.22

This commit is contained in:
AlxMedia 2022-03-15 14:29:17 +01:00
parent 2b6ac38550
commit 78edeb1b25
492 changed files with 29668 additions and 39884 deletions

View file

@ -0,0 +1,2 @@
.customize-control-kirki-toggle .kirki-toggle{align-items:flex-start;display:flex;justify-content:space-between}.customize-control-kirki-toggle .kirki-toggle .kirki-control-label{width:80%}.customize-control-kirki-toggle .kirki-toggle .kirki-control-form{text-align:right;width:20%}.customize-control-kirki-toggle .kirki-toggle .kirki-toggle-switch-label{width:100%}.customize-control-kirki-toggle .kirki-toggle .kirki-toggle-switch-label:before{right:0}.customize-control-kirki-toggle .kirki-toggle .kirki-toggle-switch-label:after{right:18px}.customize-control-kirki-switch .kirki-switch .kirki-toggle-switch-label{padding:10px 0 12px 44px;text-align:left}.customize-control-kirki-switch .kirki-switch .kirki-toggle-switch-label:after,.customize-control-kirki-switch .kirki-switch .kirki-toggle-switch-label:before{left:0}.customize-control-kirki-switch .kirki-switch .toggle-off,.customize-control-kirki-switch .kirki-switch .toggle-on{bottom:-2px;padding-left:5px;position:relative}.customize-control-kirki-switch .kirki-switch .toggle-on{color:#0073aa;display:none}.customize-control-kirki-switch .kirki-switch .toggle-off{color:#82878c;display:inline-block}.kirki-toggle-switch-label{cursor:pointer;display:inline-block;position:relative}.kirki-toggle-switch-label:after,.kirki-toggle-switch-label:before{box-sizing:border-box;content:"";margin:0;outline:0;position:absolute;top:50%;transform:translate3d(0,-50%,0);transition:all .35s cubic-bezier(0,.95,.38,.98),background-color .15s ease}.kirki-toggle-switch-label:before{background-color:#b4b9be;border:1px solid #b4b9be;border-radius:8px;height:14px;width:37px}.kirki-toggle-switch-label:after{background-color:#999;border:1px solid rgba(0,0,0,.1);border-radius:50%;height:22px;width:22px}.kirki-toggle-switch-input{opacity:0}.kirki-toggle-switch-input:checked+.kirki-toggle-switch-label:after{background-color:#0073aa;transform:translate3d(100%,-50%,0)}.kirki-toggle-switch-input:checked+.kirki-toggle-switch-label .toggle-on{display:inline-block}.kirki-toggle-switch-input:checked+.kirki-toggle-switch-label .toggle-off{display:none}
/*# sourceMappingURL=control.css.map */

View file

@ -0,0 +1,2 @@
!function(){var i={initKirkiControl:function(i){(i=i||this).container.on("change","input",(function(){i.setting.set(jQuery(this).is(":checked"))}))}};wp.customize.controlConstructor["kirki-checkbox"]=wp.customize.kirkiDynamicControl.extend(i),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend(i),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend(i)}();
//# sourceMappingURL=control.js.map

View file

@ -0,0 +1,90 @@
<?php
/**
* Customizer Control: checkbox.
*
* Creates a new custom control.
* Custom controls contains all background-related options.
*
* @package kirki-framework/control-checkbox
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
namespace Kirki\Control;
use Kirki\Control\Base;
use Kirki\URL;
/**
* Adds a checkbox control.
*
* @since 1.0
*/
class Checkbox extends Base {
/**
* The control type.
*
* @access public
* @since 1.0
* @var string
*/
public $type = 'kirki-checkbox';
/**
* The control version.
*
* @static
* @access public
* @since 1.0
* @var string
*/
public static $control_ver = '1.0.3';
/**
* Enqueue control related scripts/styles.
*
* @access public
* @since 1.0
* @return void
*/
public function enqueue() {
parent::enqueue();
// Enqueue the script.
wp_enqueue_script( 'kirki-control-checkbox', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false );
// Enqueue the style.
wp_enqueue_style( 'kirki-control-checkbox-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*
* @access protected
* @since 1.0
* @return void
*/
protected function content_template() {
?>
<input
id="_customize-input-{{ data.id }}"
type="checkbox"
value="{{ data.value }}"
{{{ data.link }}}
<# if ( data.description ) { #>aria-describedby="_customize-description-{{ data.id }}"<# } #>
<# if ( data.value ) { #>checked="checked"<# } #>
/>
<label for="_customize-input-{{ data.id }}">{{{ data.label }}}</label>
<# if ( data.description ) { #>
<span id="_customize-description-{{ data.id }}" class="description customize-control-description">{{{ data.description }}}</span>
<# } #>
<?php
}
}

View file

@ -0,0 +1,134 @@
<?php
/**
* Customizer Control: switch.
*
* @package kirki-framework/checkbox
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
namespace Kirki\Control;
use Kirki\Control\Base;
use Kirki\URL;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Switch control (modified checkbox).
*
* @since 1.0
*/
class Checkbox_Switch extends Base {
/**
* The control type.
*
* @access public
* @since 1.0
* @var string
*/
public $type = 'kirki-switch';
/**
* The control version.
*
* @static
* @access public
* @since 1.0
* @var string
*/
public static $control_ver = '1.0.3';
/**
* Enqueue control related scripts/styles.
*
* @access public
* @since 1.0
* @return void
*/
public function enqueue() {
parent::enqueue();
// Enqueue the script.
wp_enqueue_script( 'kirki-control-checkbox', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false );
// Enqueue the style.
wp_enqueue_style( 'kirki-control-checkbox-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
}
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @since 3.4.0
*/
public function to_json() {
// Get the basics from the parent class.
parent::to_json();
$this->json['checkboxType'] = str_ireplace( 'kirki-', '', $this->type );
$this->json['defaultChoices'] = [
'on' => __( 'On', 'kirki' ),
'off' => __( 'Off', 'kirki' ),
];
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*
* @access protected
* @since 1.0
* @return void
*/
protected function content_template() {
?>
<div class="kirki-{{ data.checkboxType }}-control kirki-{{ data.checkboxType }}">
<# if ( data.label || data.description ) { #>
<div class="kirki-control-label">
<# if ( data.label ) { #>
<label class="customize-control-title" for="kirki_{{ data.checkboxType }}_{{ data.id }}">
{{{ data.label }}}
</label>
<# } #>
<# if ( data.description ) { #>
<span class="description customize-control-description">{{{ data.description }}}</span>
<# } #>
</div>
<# } #>
<div class="kirki-control-form">
<input class="screen-reader-text kirki-toggle-switch-input" {{{ data.inputAttrs }}} name="kirki_{{ data.checkboxType }}_{{ data.id }}" id="kirki_{{ data.checkboxType }}_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( '1' == data.value ) { #> checked<# } #> />
<label class="kirki-toggle-switch-label" for="kirki_{{ data.checkboxType }}_{{ data.id }}">
<# if ('switch' === data.checkboxType) { #>
<span class="toggle-on">
<# data.choices.on = data.choices.on || data.defaultChoices.on #>
{{ data.choices.on }}
</span>
<span class="toggle-off">
<# data.choices.off = data.choices.off || data.defaultChoices.off #>
{{ data.choices.off }}
</span>
<# } #>
</label>
</div>
</div>
<?php
}
}

View file

@ -0,0 +1,34 @@
<?php
/**
* Customizer Control: toggle.
*
* @package kirki-framework/checkbox
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
namespace Kirki\Control;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Switch control (modified checkbox).
*
* @since 1.0
*/
class Checkbox_Toggle extends Checkbox_Switch {
/**
* The control type.
*
* @access public
* @since 1.0
* @var string
*/
public $type = 'kirki-toggle';
}

View file

@ -0,0 +1,99 @@
<?php
/**
* Override field methods
*
* @package kirki-framework/checkbox
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
namespace Kirki\Field;
use Kirki\Field;
/**
* Field overrides.
*
* @since 1.0
*/
class Checkbox extends Field {
/**
* The field type.
*
* @access public
* @since 1.0
* @var string
*/
public $type = 'kirki-checkbox';
/**
* The control class-name.
*
* @access protected
* @since 0.1
* @var string
*/
protected $control_class = '\Kirki\Control\Checkbox';
/**
* Whether we should register the control class for JS-templating or not.
*
* @access protected
* @since 0.1
* @var bool
*/
protected $control_has_js_template = true;
/**
* Filter arguments before creating the setting.
*
* @access public
* @since 0.1
* @param array $args The field arguments.
* @param WP_Customize_Manager $wp_customize The customizer instance.
* @return array
*/
public function filter_setting_args( $args, $wp_customize ) {
if ( $args['settings'] === $this->args['settings'] ) {
$args = parent::filter_setting_args( $args, $wp_customize );
// Set the sanitize-callback if none is defined.
if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
$args['sanitize_callback'] = function( $value ) {
return ( '0' === $value || 'false' === $value ) ? false : (bool) $value;
};
}
$args['default'] = isset( $args['default'] ) ? $args['default'] : false;
// Make sure the default is formatted as boolean.
$args['default'] = (bool) ( 1 === $args['default'] || '1' === $args['default'] || true === $args['default'] || 'true' === $args['default'] || 'on' === $args['default'] );
}
return $args;
}
/**
* Filter arguments before creating the control.
*
* @access public
* @since 0.1
* @param array $args The field arguments.
* @param WP_Customize_Manager $wp_customize The customizer instance.
* @return array
*/
public function filter_control_args( $args, $wp_customize ) {
if ( $args['settings'] === $this->args['settings'] ) {
$args = parent::filter_control_args( $args, $wp_customize );
$args['type'] = 'kirki-checkbox';
}
return $args;
}
}

View file

@ -0,0 +1,57 @@
<?php
/**
* Override field methods
*
* @package kirki-framework/checkbox
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 1.0
*/
namespace Kirki\Field;
/**
* Field overrides.
*
* @since 1.0
*/
class Checkbox_Switch extends Checkbox {
/**
* The field type.
*
* @access public
* @since 1.0
* @var string
*/
public $type = 'kirki-switch';
/**
* The control class-name.
*
* @access protected
* @since 0.1
* @var string
*/
protected $control_class = '\Kirki\Control\Checkbox_Switch';
/**
* Filter arguments before creating the control.
*
* @access public
* @since 0.1
* @param array $args The field arguments.
* @param WP_Customize_Manager $wp_customize The customizer instance.
* @return array
*/
public function filter_control_args( $args, $wp_customize ) {
if ( $args['settings'] === $this->args['settings'] ) {
$args = parent::filter_control_args( $args, $wp_customize );
$args['type'] = 'kirki-switch';
}
return $args;
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* Override field methods
*
* @package kirki-framework/checkbox
* @since 1.0
*/
namespace Kirki\Field;
/**
* Field overrides.
*
* @since 1.0
*/
class Checkbox_Toggle extends Checkbox {
/**
* The field type.
*
* @access public
* @since 1.0
* @var string
*/
public $type = 'kirki-toggle';
/**
* The control class-name.
*
* @access protected
* @since 0.1
* @var string
*/
protected $control_class = '\Kirki\Control\Checkbox_Toggle';
/**
* Filter arguments before creating the control.
*
* @access public
* @since 0.1
* @param array $args The field arguments.
* @param WP_Customize_Manager $wp_customize The customizer instance.
* @return array
*/
public function filter_control_args( $args, $wp_customize ) {
if ( $args['settings'] === $this->args['settings'] ) {
$args = parent::filter_control_args( $args, $wp_customize );
$args['type'] = 'kirki-toggle';
}
return $args;
}
}