Plugin Directory

Changeset 2675077


Ignore:
Timestamp:
02/08/2022 02:34:02 PM (4 years ago)
Author:
codelessthemes
Message:

new kirki4 update

Location:
codeless-page-builder/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • codeless-page-builder/trunk/README.txt

    r2250484 r2675077  
    99Tested up to: 5.3.2
    1010Requires PHP: 7.0
    11 Stable tag: 1.0
    12 Version: 1.0
     11Stable tag: 1.1.0
     12Version: 1.1.0
    1313License: GPLv2 or later
    1414License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • codeless-page-builder/trunk/assets/css/kirki-styles.css

    r2250479 r2675077  
    3636}
    3737
    38 .customize-control-kirki-select > label{
     38.customize-control-kirki-react-select > label{
    3939    display:flex;
    4040    align-items:center;
    4141}
    4242
    43 .customize-control-kirki-select .customize-control-title{
     43.customize-control-kirki-react-select .customize-control-title{
    4444    min-width:160px;
    4545}
    4646
    47 .customize-control-kirki-select .select2-selection{
     47.customize-control-kirki-react-select .select2-selection{
    4848    border:none;
    4949}
    5050
    51 .customize-control-kirki-select .select2-selection__rendered{
     51.customize-control-kirki-react-select .select2-selection__rendered{
    5252    text-align:right;
    5353}
    5454
    55 .customize-control-kirki-select .select2-selection__rendered:focus, .customize-control-kirki-select .select2-selection--single:focus{
     55.customize-control-kirki-react-select .select2-selection__rendered:focus, .customize-control-kirki-react-select .select2-selection--single:focus{
    5656    border:none !important;
    5757    outline:none !important;
     
    601601}
    602602
    603 .customize-control-kirki-select .kirki-input-container label{
     603.customize-control-kirki-react-select .kirki-input-container label{
    604604  display:flex;
    605605  flex-wrap:wrap;
    606606}
    607 .customize-control-kirki-select.multiple-select .kirki-input-container label{
     607.customize-control-kirki-react-select.multiple-select .kirki-input-container label{
    608608  display:block !important;
    609609}
    610610
    611 .customize-control-kirki-select .kirki-input-container .select2-container{
     611.customize-control-kirki-react-select .kirki-input-container .select2-container{
    612612  flex:1;
    613613}
  • codeless-page-builder/trunk/assets/js/cl-builder.js

    r2250858 r2675077  
    48934893            data['name'] = model.get('fields')
    48944894            data['options'] = _.clone( model.get('params') );
     4895           
    48954896            wp.customize.preview.send('cl_show_options', data ); 
    48964897        },
     
    56525653   
    56535654    api.bind( 'preview-ready', function(){
    5654         if( ! _.isUndefined(window['CL_FRONT']) )
    5655             window['CL_FRONT'].config.$isCustomizer = true;
    5656 
    5657        
    5658         setTimeout(function(){
    5659             cl.build();
    5660            
    5661         }, 100);
     5655        api.preview.bind( 'active', function() {
     5656            wp.customize.preview.send('' );
     5657            if( ! _.isUndefined(window['CL_FRONT']) )
     5658                window['CL_FRONT'].config.$isCustomizer = true;
     5659
     5660           
     5661            setTimeout(function(){
     5662                cl.build();
     5663               
     5664            }, 100);
     5665        });
    56625666       
    56635667
  • codeless-page-builder/trunk/assets/js/cl-customize-pane.js

    r2250479 r2675077  
    200200   
    201201    self.activeElement = function(element){
    202        
     202        console.log('dakuu');
    203203        if( cl_kirki.element === false || cl_kirki.element.id !== element.id )
    204204            cl_kirki.initialize( element );
    205 
     205        console.log('mren');
    206206        var section = 'cl_codeless_page_builder';
    207207        if( element.header_element )
    208208            section = 'cl_codeless_header_builder';
    209209        setTimeout(function(){
     210            console.log(section);
    210211            api.section(section).expand();
    211212        }, 400);
     
    294295
    295296    api.bind( 'ready', function() {
     297       
    296298        self.init();       
    297 
     299       
    298300        if( typeof api( 'cl_page_content' ) !== 'undefined' && api( 'cl_page_content' ).get()['changeset'] != api.settings.changeset.uuid ){
    299301
     
    308310    });
    309311
     312    console.log('une daku punoj');
     313
    310314    return self;
    311315}( jQuery, wp.customize ) );
  • codeless-page-builder/trunk/assets/js/kirki-new.js

    r2250479 r2675077  
    11var api = wp.customize;
     2
     3function cl_validateCssValue( value ) {
     4
     5    var control = this,
     6        validUnits = [ 'fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax' ],
     7        numericValue,
     8        unit,
     9        multiples,
     10        multiplesValid = true;
     11
     12    // Whitelist values.
     13    if ( ! value || '' === value || 0 === value || '0' === value || 'auto' === value || 'inherit' === value || 'initial' === value ) {
     14        return true;
     15    }
     16
     17    // Skip checking if calc().
     18    if ( 0 <= value.indexOf( 'calc(' ) && 0 <= value.indexOf( ')' ) ) {
     19        return true;
     20    }
     21
     22    // Get the numeric value.
     23    numericValue = parseFloat( value );
     24
     25    // Get the unit
     26    unit = value.replace( numericValue, '' );
     27
     28    // Allow unitless.
     29    if ( ! unit ) {
     30        return true;
     31    }
     32
     33    // Check for multiple values.
     34    multiples = value.split( ' ' );
     35    if ( 2 <= multiples.length ) {
     36        multiples.forEach( function( item ) {
     37            if ( item && ! control.validateCssValue( item ) ) {
     38                multiplesValid = false;
     39            }
     40        });
     41
     42        return multiplesValid;
     43    }
     44
     45    // Check the validity of the numeric value and units.
     46    return ( ! isNaN( numericValue ) && -1 !== validUnits.indexOf( unit ) );
     47}
    248
    349wp.customize.controlConstructor['css_tool'] = wp.customize.kirkiDynamicControl.extend({
     
    1662                new_value = jQuery(this).val();
    1763           
    18             if ( false === kirki.util.validate.cssValue( new_value ) && new_value != '' ) {
     64            if ( false === cl_validateCssValue( new_value ) && new_value != '' ) {
    1965               
    2066                jQuery(this).addClass('invalid');
     
    3076                value[el] = new_value;
    3177                // Update the value in the customizer.
    32                 kirki.setting.set( control.id, value );
     78                control.setting.set( value );
    3379               
    3480               
     
    68114    setGalleryDataAndRenderContent: function(id) {
    69115        var control = this;
    70         var value = kirki.setting.get(control.id);
     116        var value = control.setting.get();
    71117
    72118        if( !_.isUndefined(value) && value.length ){
     
    138184            galleryPreSelectImages = function() {
    139185                var selection, ids, attachment, library;
     186               
    140187
    141188                library = control.frame.state().get( 'library' );
    142189                selection = control.frame.state().get( 'selection' );
    143190
    144                 ids = kirki.setting.get(control.id);
     191                ids = control.setting.get();
    145192                if( !_.isUndefined( ids ) && !_.isEmpty( ids ) )
    146193                    ids = ids.replace('__array__', '').replace( '__array__end__', '' ).split(',');
     
    171218            changeopt = function(){
    172219               
    173                 var value = kirki.setting.get(control.id);
     220                var value = control.setting.get();
    174221               
    175                 kirki.setting.set( control.id, '' );
    176                 kirki.setting.set( control.id, value );
     222                control.setting.set( '' );
     223                control.setting.set( value );
    177224            };
    178225
     
    202249
    203250            newValue = JSON.stringify(attachmentIds).replace('[', '__array__').replace(']', '__array__end__');
    204             kirki.setting.set( control.id, newValue );
     251            control.setting.set( newValue );
    205252            control.container.focus();
    206253            control.setGalleryDataAndRenderContent(fieldId);
     
    257304                    var newValue = JSON.stringify(selectedValues).replace('[', '__array__').replace(']', '__array__end__');
    258305
    259                     kirki.setting.set( control.id, newValue);
     306                    control.setting.set(newValue);
    260307                }
    261308            });
     
    370417           
    371418            // Custom for multiple select
    372             if( params_.type == 'kirki-select' && !_.isUndefined( params_.multiple ) && params_.multiple )
     419            if( params_.type == 'kirki-react-select' && !_.isUndefined( params_.multiple ) && params_.multiple )
    373420                control.container.addClass('multiple-select');
     421
     422            if( params_.type == 'kirki-slider' && !_.isUndefined( params_.choices ) ){
     423                params_.choices.max = parseInt(params_.choices.max)-1;
     424            }
     425
     426           
    374427
    375428            // Build Required List
     
    425478            } );
    426479
    427         if( params_.type == 'kirki-select' )
    428             return new api.controlConstructor['kirki-select']( key, {
     480        if( params_.type == 'kirki-react-select' )
     481            return new api.controlConstructor['kirki-react-select']( key, {
     482                params:params_
     483            } );
     484
     485        if( params_.type == 'kirki-react-colorful' )
     486            return new api.controlConstructor['kirki-react-colorful']( key, {
    429487                params:params_
    430488            } );
     
    448506
    449507    customParamsCheck: function( params, key ){
    450         if( params.type == 'kirki-color' ){
    451             if( _.isUndefined( params.choices ) )
    452                 params.choices = { alpha: true }
    453         }
    454 
     508       
     509        if( params.type == 'kirki-react-colorful' ){
     510            params.mode = 'alpha';
     511            params.choices = {};
     512            params.choices.formComponent = 'ChromePicker';
     513            params.choices.labelStyle = 'default'
     514            params.choices.swatches = ['#000000',
     515            '#ffffff',
     516            '#dd3333',
     517            '#dd9933',
     518            '#eeee22',
     519            '#81d742',
     520            '#1e73be',
     521            '#8224e3'];
     522            console.log(params);
     523        }
    455524        if( key == 'content' )
    456525            params.type = 'textarea';
     
    480549    reMapType: function( type ){
    481550        var reMap = {
    482             'color': 'kirki-color',
     551            'color': 'kirki-react-colorful',
    483552            'switch': 'kirki-switch',
    484             'select': 'kirki-select',
     553            'select': 'kirki-react-select',
    485554            'slider': 'kirki-slider',
    486             'inline_select': 'kirki-select',
     555            'inline_select': 'kirki-react-select',
    487556            'text' : 'text',
    488557            'inline_text' : 'text',
  • codeless-page-builder/trunk/config/cl-page-elements.php

    r2250479 r2675077  
    24292429                    'css_property' => 'line-height',
    24302430                    'choices'     => array(
    2431                         'min'  => '20',
     2431                        'min'  => '0',
    24322432                        'max'  => '100',
    24332433                        'step' => '1',
     
    28902890                        'min'  => '20',
    28912891                        'max'  => '200',
    2892                         'step' => '1',
     2892                        'step' => '10',
    28932893                        'suffix' => 'px'
    28942894                    ),
  • codeless-page-builder/trunk/include/core/cl-builder-base.php

    r2250479 r2675077  
    102102*/     
    103103        wp_enqueue_script( 'cl-lazyload', cl_asset_url('js/cl-lazyload.js') );
    104         wp_enqueue_script( 'cl-builder', cl_asset_url('js/cl-builder.js'), array('backbone', 'underscore', 'customize-preview', 'shortcode', 'jquery-ui-sortable', 'jquery-ui-droppable') );
     104        wp_enqueue_script( 'cl-builder', cl_asset_url('js/cl-builder.js'), array('jquery', 'wp-util', 'backbone', 'underscore', 'customize-preview', 'shortcode', 'jquery-ui-sortable', 'jquery-ui-droppable') );
    105105
    106106        wp_enqueue_script( 'cl-editor-exts', cl_asset_url('js/medium-editor/cl-editor-exts.js'));
     
    128128    function pane_init_enqueue(){
    129129        global $cl_builder;
    130         wp_enqueue_script( 'codeless-cssbox', cl_asset_url( 'js/kirki-new.js' ), array( 'kirki-script' ) );
     130
     131        // Enqueue the script.
     132        wp_enqueue_script( 'codeless-cssbox', cl_asset_url( 'js/kirki-new.js' ), array( 'kirki-control-base' ) );
    131133
    132134            wp_localize_script( 'codeless-cssbox', 'codelessPalettes', codeless_builder_generate_palettes() );
     
    136138                wp_localize_script( 'codeless-cssbox', 'codelessHeaderElementsMap', Cl_Builder_Mapper::getHeaderElements() );
    137139            }
    138         wp_enqueue_script( 'cl-customize-pane', cl_asset_url('js/cl-customize-pane.js'), array( 'customize-controls', 'jquery', 'codeless-cssbox' ) );
     140        wp_enqueue_script( 'cl-customize-pane', cl_asset_url('js/cl-customize-pane.js'), array( 'customize-controls', 'codeless-cssbox' ) );
    139141       
    140142
  • codeless-page-builder/trunk/include/core/cl-kirki-setup.php

    r2250479 r2675077  
    3939                'register_custom_types'
    4040            ) );
    41             add_filter( 'kirki/panel_types', array(
     41            add_filter( 'kirki_panel_types', array(
    4242                 &$this,
    4343                'load_custom_panel'
    4444            ) );
    45             add_filter( 'kirki/section_types', array(
     45            add_filter( 'kirki_section_types', array(
    4646                 &$this,
    4747                'load_custom_section'
     
    7979        public function register_custom_types() {
    8080            global $wp_customize;
     81            require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_panel.php' );
     82            require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_section.php' );
    8183            $wp_customize->register_panel_type( 'WP_Customize_Codeless_Panel' );
    8284            $wp_customize->register_section_type( 'WP_Customize_Codeless_Section' );
     
    8587       
    8688        public function load_custom_panel( $panels ) {
    87             require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_panel.php' );
     89           
    8890            $panels['codeless'] = 'WP_Customize_Codeless_Panel';
    8991            return $panels;
     
    9193       
    9294        public function load_custom_section( $sections ) {
    93             require_once cl_path_dir( 'KIRKI_SETUP', 'codeless_custom_section.php' );
     95           
    9496            $sections['codeless'] = 'WP_Customize_Codeless_Section';
    9597            return $sections;
  • codeless-page-builder/trunk/include/core/kirki-setup/codeless_controls.php

    r2250479 r2675077  
    306306    $wp_customize->register_control_type( 'Codeless_Controls_ClText_Control' );
    307307    $wp_customize->register_control_type( 'Codeless_Controls_ImageGallery_Control' );
     308
    308309});
     310
    309311?>
  • codeless-page-builder/trunk/include/core/kirki-setup/codeless_custom_panel.php

    r2250479 r2675077  
    99
    1010
    11 class WP_Customize_Codeless_Panel extends WP_Customize_Panel {
     11
     12class WP_Customize_Codeless_Panel extends \WP_Customize_Panel {
    1213
    1314    /**
  • codeless-page-builder/trunk/include/core/kirki-setup/codeless_custom_section.php

    r2250479 r2675077  
    11<?php
    22
    3 class WP_Customize_Codeless_Section extends WP_Customize_Section {
     3
     4if( class_exists( '\WP_Customize_Section' ) ){
     5class WP_Customize_Codeless_Section extends \WP_Customize_Section {
    46
    57        /**
     
    5153        }
    5254}
     55}
Note: See TracChangeset for help on using the changeset viewer.