mirror of
https://ghproxy.net/https://github.com/AlxMedia/magaziner.git
synced 2025-08-28 09:43:30 +08:00
Update to Kirki 4.0.22
This commit is contained in:
parent
2b6ac38550
commit
78edeb1b25
492 changed files with 29668 additions and 39884 deletions
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
...require( '@wordpress/prettier-config' ),
|
||||
};
|
2
functions/kirki/packages/kirki-framework/module-tooltips/dist/control.css
vendored
Normal file
2
functions/kirki/packages/kirki-framework/module-tooltips/dist/control.css
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.kirki-tooltip-wrapper{position:relative;z-index:5}.kirki-tooltip-wrapper .tooltip-trigger{left:3px;position:relative;text-decoration:none;top:0}.kirki-tooltip-wrapper .tooltip-trigger:hover+.tooltip-content{bottom:32px;opacity:1;visibility:visible;z-index:99999}.kirki-tooltip-wrapper .tooltip-trigger .dashicons{font-size:18px;height:18px;width:18px}.kirki-tooltip-wrapper .tooltip-content{background:#000;border-radius:3px;bottom:29px;color:#fff;font-size:13px;height:fit-content;left:0;line-height:1.4em;min-width:275px;opacity:0;padding:7px;position:absolute;transition:all .2s linear;visibility:hidden;width:100%;z-index:-1}.kirki-tooltip-wrapper .tooltip-content a{color:#00a0d2}
|
||||
/*# sourceMappingURL=control.css.map */
|
2
functions/kirki/packages/kirki-framework/module-tooltips/dist/control.js
vendored
Normal file
2
functions/kirki/packages/kirki-framework/module-tooltips/dist/control.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
!function(){function t(t){_.each(kirkiTooltips,(function(n){if(n.id===t.id&&!t.container.find(".tooltip-content").length){var i=document.querySelector("#customize-control-"+n.id+" .customize-control-title");if(i){i.classList.add("kirki-tooltip-wrapper");var o='<span class="tooltip-content">'+n.content+"</span>",e=jQuery(i);jQuery('<span class="tooltip-trigger"><span class="dashicons dashicons-editor-help"></span></span>').appendTo(e),jQuery(o).appendTo(e)}}}))}jQuery(document).ready((function(){var n=[];wp.customize.control.each((function(i){n.includes(i.section())||n.push(i.section()),wp.customize.section(i.section(),(function(n){n.expanded()||wp.customize.settings.autofocus.control===i.id?t(i):n.expanded.bind((function(n){n&&t(i)}))}))})),jQuery("head").append(jQuery('<style class="kirki-tooltip-inline-styles"></style>'));var i=jQuery(".kirki-tooltip-inline-styles"),o=jQuery(".wp-full-overlay-sidebar-content");n.forEach((function(t){wp.customize.section(t,(function(t){t.expanded.bind((function(n){n&&(t.contentContainer[0].scrollHeight>o.height()?i.html(".kirki-tooltip-wrapper span.tooltip-content {min-width: 258px;}"):i.empty())}))}))}))}))}();
|
||||
//# sourceMappingURL=control.js.map
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* Injects tooltips to controls when the 'tooltip' argument is used.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Modules
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Module;
|
||||
|
||||
use Kirki\URL;
|
||||
|
||||
/**
|
||||
* Adds the tooltips.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Tooltips {
|
||||
|
||||
/**
|
||||
* An array containing field identifieds and their tooltips.
|
||||
*
|
||||
* @access private
|
||||
* @since 1.0
|
||||
* @var array
|
||||
*/
|
||||
private $tooltips_content = [];
|
||||
|
||||
/**
|
||||
* The class constructor
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
add_action( 'customize_controls_print_footer_scripts', [ $this, 'customize_controls_print_footer_scripts' ] );
|
||||
add_filter( 'kirki_field_add_control_args', [ $this, 'filter_control_args' ], 10, 2 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*/
|
||||
public function customize_controls_print_footer_scripts() {
|
||||
|
||||
wp_enqueue_style( 'kirki-tooltip', URL::get_from_path( dirname( __DIR__ ) . '/dist/control.css' ), [], '1.0.10' );
|
||||
|
||||
wp_enqueue_script( 'kirki-tooltip', URL::get_from_path( dirname( __DIR__ ) . '/dist/control.js' ), [ 'jquery' ], '1.0.10', false );
|
||||
wp_localize_script( 'kirki-tooltip', 'kirkiTooltips', $this->tooltips_content );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter control args.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @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 ( isset( $args['tooltip'] ) && $args['tooltip'] ) {
|
||||
$this->tooltips_content[ $args['settings'] ] = [
|
||||
'id' => sanitize_key( $args['settings'] ),
|
||||
'content' => wp_kses_post( $args['tooltip'] ),
|
||||
];
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
import './control.scss';
|
||||
|
||||
/* global kirkiTooltips */
|
||||
function kirkiTooltipAdd( control ) {
|
||||
_.each( kirkiTooltips, function ( tooltip ) {
|
||||
if ( tooltip.id !== control.id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( control.container.find( '.tooltip-content' ).length ) return;
|
||||
|
||||
const target = document.querySelector(
|
||||
'#customize-control-' + tooltip.id + ' .customize-control-title'
|
||||
);
|
||||
|
||||
if ( ! target ) return;
|
||||
target.classList.add( 'kirki-tooltip-wrapper' );
|
||||
|
||||
// Build the tooltip trigger.
|
||||
const trigger =
|
||||
'<span class="tooltip-trigger"><span class="dashicons dashicons-editor-help"></span></span>';
|
||||
|
||||
// Build the tooltip content.
|
||||
const content =
|
||||
'<span class="tooltip-content">' + tooltip.content + '</span>';
|
||||
|
||||
const $target = jQuery( target );
|
||||
|
||||
// Append the trigger & content next to the control's title.
|
||||
jQuery( trigger ).appendTo( $target );
|
||||
jQuery( content ).appendTo( $target );
|
||||
} );
|
||||
}
|
||||
|
||||
jQuery( document ).ready( function () {
|
||||
let sectionNames = [];
|
||||
|
||||
wp.customize.control.each( function ( control ) {
|
||||
if ( ! sectionNames.includes( control.section() ) ) {
|
||||
sectionNames.push( control.section() );
|
||||
}
|
||||
|
||||
wp.customize.section( control.section(), function ( section ) {
|
||||
if (
|
||||
section.expanded() ||
|
||||
wp.customize.settings.autofocus.control === control.id
|
||||
) {
|
||||
kirkiTooltipAdd( control );
|
||||
} else {
|
||||
section.expanded.bind( function ( expanded ) {
|
||||
if ( expanded ) {
|
||||
kirkiTooltipAdd( control );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
jQuery( 'head' ).append(
|
||||
jQuery( '<style class="kirki-tooltip-inline-styles"></style>' )
|
||||
);
|
||||
|
||||
const $tooltipStyleEl = jQuery( '.kirki-tooltip-inline-styles' );
|
||||
const $sidebarOverlay = jQuery( '.wp-full-overlay-sidebar-content' );
|
||||
|
||||
sectionNames.forEach( function ( sectionName ) {
|
||||
wp.customize.section( sectionName, function ( section ) {
|
||||
section.expanded.bind( function ( expanded ) {
|
||||
if ( expanded ) {
|
||||
if (
|
||||
section.contentContainer[0].scrollHeight >
|
||||
$sidebarOverlay.height()
|
||||
) {
|
||||
$tooltipStyleEl.html(
|
||||
'.kirki-tooltip-wrapper span.tooltip-content {min-width: 258px;}'
|
||||
);
|
||||
} else {
|
||||
$tooltipStyleEl.empty();
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
} );
|
Loading…
Add table
Add a link
Reference in a new issue