From 53c2a57c3a4b78932a7e2b9cd5272f16712afce2 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Fri, 29 Jul 2022 02:29:10 +0530 Subject: [PATCH 01/19] [WiP] Animation Optimization --- composer.json | 3 +- composer.lock | 55 ++++++- inc/class-base-css.php | 274 ++++++++++++++++++++++++++++++++- inc/class-blocks-animation.php | 1 - 4 files changed, 328 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index c9c1390a4..bf98861aa 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,7 @@ "codeinwp/themeisle-sdk": "^3.1", "masterminds/html5": "^2.7", "tubalmartin/cssmin": "^4.1", - "wptt/webfont-loader": "^1.1" + "wptt/webfont-loader": "^1.1", + "sabberworm/php-css-parser": "^8.4" } } diff --git a/composer.lock b/composer.lock index f09d80356..199414e61 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f64b6cbffd5da90c359fafb3b08b5659", + "content-hash": "7560a83ace286e5ab63de5fe6ca00321", "packages": [ { "name": "codeinwp/themeisle-sdk", @@ -115,6 +115,59 @@ }, "time": "2021-07-01T14:25:37+00:00" }, + { + "name": "sabberworm/php-css-parser", + "version": "8.4.0", + "source": { + "type": "git", + "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=5.6.20" + }, + "require-dev": { + "codacy/coverage": "^1.4", + "phpunit/phpunit": "^4.8.36" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" + }, + "type": "library", + "autoload": { + "psr-4": { + "Sabberworm\\CSS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Schweikert" + } + ], + "description": "Parser for CSS Files written in PHP", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "keywords": [ + "css", + "parser", + "stylesheet" + ], + "support": { + "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues", + "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.4.0" + }, + "time": "2021-12-11T13:40:54+00:00" + }, { "name": "tubalmartin/cssmin", "version": "v4.1.1", diff --git a/inc/class-base-css.php b/inc/class-base-css.php index e81883820..9a64e3fe1 100644 --- a/inc/class-base-css.php +++ b/inc/class-base-css.php @@ -7,6 +7,12 @@ namespace ThemeIsle\GutenbergBlocks; +use Sabberworm\CSS\Parser; +use Sabberworm\CSS\OutputFormat; +use Sabberworm\CSS\RuleSet\DeclarationBlock; +use Sabberworm\CSS\CSSList\AtRuleBlockList; +use Sabberworm\CSS\CSSList\KeyFrame; + /** * Class Base_CSS */ @@ -267,12 +273,13 @@ public function get_reusable_block_css( $post_id ) { * Cycle thorugh Static Blocks * * @param array $blocks List of blocks. + * @param bool $animations To check for animations or not. * * @return string Style. * @since 1.3.0 * @access public */ - public function cycle_through_static_blocks( $blocks ) { + public function cycle_through_static_blocks( $blocks, $animations = true ) { $style = ''; foreach ( $blocks as $block ) { foreach ( self::$blocks_classes as $classname ) { @@ -292,13 +299,276 @@ public function cycle_through_static_blocks( $blocks ) { } if ( isset( $block['innerBlocks'] ) && ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) ) { - $style .= $this->cycle_through_static_blocks( $block['innerBlocks'] ); + $style .= $this->cycle_through_static_blocks( $block['innerBlocks'], false ); } } + if ( class_exists( '\ThemeIsle\GutenbergBlocks\Blocks_Animation' ) && get_option( 'themeisle_blocks_settings_blocks_animation', true ) ) { + $style .= $this->get_animation_css( $blocks ); + } + return $style; } + /** + * Get Animation CSS + * + * @param array $blocks List of blocks. + * + * @return string CSS. + * @since 2.0.10 + * @access public + */ + public function get_animation_css( $blocks ) { + $style = ''; + $classes = $this->get_animation_classes( $blocks ); + + if ( 0 === count( $classes ) ) { + return $style; + } + + $prepared_classes = array( ':root' ); + + foreach ( $classes as $class ) { + array_push( $prepared_classes, '.' . $class, '.animated.' . $class ); + } + + $classes = $prepared_classes; + + $content = get_transient( 'otter_animations_parsed' ); + + if ( false === $content ) { + $parser = null; + if ( function_exists( 'wpcom_vip_file_get_contents' ) ) { + $parser = new Parser( wpcom_vip_file_get_contents( OTTER_BLOCKS_PATH . '/build/animation/index.css' ) ); + } else { + $parser = new Parser( file_get_contents( OTTER_BLOCKS_PATH . '/build/animation/index.css' ) ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown + } + + $content = $parser->parse()->getContents(); + + set_transient( 'otter_animations_parsed', $content, MONTH_IN_SECONDS ); + } + + $format = OutputFormat::createCompact(); + + foreach ( $content as $rule ) { + if ( $rule instanceof DeclarationBlock ) { + foreach ( $rule->getSelectors() as $selector ) { + if ( in_array( $selector, $classes ) ) { + $style .= $rule->render( $format ); + } + } + continue; + } + + /* + * This is used to get the reduced-motion animation styles. + */ + if ( $rule instanceof AtRuleBlockList ) { + if ( false === in_array( $rule->atRuleArgs(), array( '(prefers-reduced-motion:reduce),print', 'screen' ) ) ) { + continue; + } + + $style .= $rule->render( $format ); + } + + /* + * This is used to get actual animation which is a @keyframe. + */ + if ( $rule instanceof KeyFrame ) { + if ( in_array( '.' . $rule->getAnimationName(), $classes ) ) { + $style .= $rule->render( $format ); + } + continue; + } + } + + return $style; + } + + /** + * Get Animation Classes + * + * @param array $blocks List of blocks. + * + * @return array CSS classes. + * @since 2.0.10 + * @access public + */ + public function get_animation_classes( $blocks ) { + $classes = array(); + + $allowed_classes = array( + 'animated', + 'bounce', + 'flash', + 'pulse', + 'rubberBand', + 'shakeX', + 'shakeY', + 'headShake', + 'swing', + 'tada', + 'wobble', + 'jello', + 'heartBeat', + 'hinge', + 'jackInTheBox', + 'backInDown', + 'backInLeft', + 'backInRight', + 'backInUp', + 'backOutDown', + 'backOutLeft', + 'backOutRight', + 'backOutUp', + 'bounceIn', + 'bounceInDown', + 'bounceInLeft', + 'bounceInRight', + 'bounceInUp', + 'bounceOut', + 'bounceOutDown', + 'bounceOutLeft', + 'bounceOutRight', + 'bounceOutUp', + 'fadeIn', + 'fadeInDown', + 'fadeInDownBig', + 'fadeInLeft', + 'fadeInLeftBig', + 'fadeInRight', + 'fadeInRightBig', + 'fadeInUp', + 'fadeInTopLeft', + 'fadeInTopRight', + 'fadeInBottomLeft', + 'fadeInBottomRight', + 'fadeOut', + 'fadeOutDown', + 'fadeOutDownBig', + 'fadeOutLeft', + 'fadeOutLeftBig', + 'fadeOutRight', + 'fadeOutRightBig', + 'fadeOutUp', + 'fadeOutUpBig', + 'fadeOutTopLeft', + 'fadeOutTopRight', + 'fadeOutBottomRight', + 'fadeOutBottomLeft', + 'flip', + 'flipInX', + 'flipInY', + 'flipOutX', + 'flipOutY', + 'lightSpeedInRight', + 'lightSpeedInLeft', + 'lightSpeedOutRight', + 'lightSpeedOutLeft', + 'rotateIn', + 'rotateInDownLeft', + 'rotateInDownRight', + 'rotateInUpLeft', + 'rotateInUpRight', + 'rotateOut', + 'rotateOutDownLeft', + 'rotateOutDownRight', + 'rotateOutUpLeft', + 'rotateOutUpRight', + 'slideInDown', + 'slideInLeft', + 'slideInRight', + 'slideInUp', + 'slideOutDown', + 'slideOutLeft', + 'slideOutRight', + 'slideOutUp', + 'zoomIn', + 'zoomInDown', + 'zoomInLeft', + 'zoomInRight', + 'zoomInUp', + 'zoomOut', + 'zoomOutDown', + 'zoomOutLeft', + 'zoomOutRight', + 'zoomOutUp', + 'rollIn', + 'rollOut', + 'backOutDown', + 'backOutLeft', + 'backOutRight', + 'backOutUp', + 'bounceOut', + 'bounceOutDown', + 'bounceOutLeft', + 'bounceOutRight', + 'bounceOutUp', + 'fadeOut', + 'fadeOutDown', + 'fadeOutDownBig', + 'fadeOutLeft', + 'fadeOutLeftBig', + 'fadeOutRight', + 'fadeOutRightBig', + 'fadeOutUp', + 'fadeOutUpBig', + 'fadeOutTopLeft', + 'fadeOutTopRight', + 'fadeOutBottomRight', + 'fadeOutBottomLeft', + 'flipOutX', + 'flipOutY', + 'lightSpeedOutRight', + 'lightSpeedOutLeft', + 'rotateOut', + 'rotateOutDownLeft', + 'rotateOutDownRight', + 'rotateOutUpLeft', + 'rotateOutUpRight', + 'slideOutDown', + 'slideOutLeft', + 'slideOutRight', + 'slideOutUp', + 'zoomOut', + 'zoomOutDown', + 'zoomOutLeft', + 'zoomOutRight', + 'zoomOutUp', + 'rollOut', + 'delay-100ms', + 'delay-200ms', + 'delay-500ms', + 'delay-1s', + 'delay-2s', + 'delay-3s', + 'delay-4s', + 'delay-5s', + 'slow', + 'slower', + 'fast', + 'faster', + ); + + foreach ( $blocks as $block ) { + if ( isset( $block['attrs']['className'] ) && ! empty( $block['attrs']['className'] ) ) { + if ( preg_match( '/\banimated\b/', $block['attrs']['className'] ) ) { + $classes = array_merge( $classes, explode( ' ', trim( $block['attrs']['className'] ) ) ); + } + } + + if ( isset( $block['innerBlocks'] ) && ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) ) { + $classes = array_merge( $classes, $this->get_animation_classes( $block['innerBlocks'] ) ); + } + } + + $classes = array_intersect( array_unique( $classes ), $allowed_classes ); + + return $classes; + } + /** * Cycle thorugh Global Styles * diff --git a/inc/class-blocks-animation.php b/inc/class-blocks-animation.php index 3a167c5b0..8cd055c18 100644 --- a/inc/class-blocks-animation.php +++ b/inc/class-blocks-animation.php @@ -126,7 +126,6 @@ public function enqueue_block_frontend_assets() { * @since 2.0.5 */ public function frontend_load( $block_content, $block ) { - if ( ! self::$can_load_frontend ) { return $block_content; } From dd5a2da8bb5557d6cd46401c1e7cee1a68437773 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Fri, 29 Jul 2022 02:44:55 +0530 Subject: [PATCH 02/19] Minor changes --- inc/class-base-css.php | 2 +- src/css/editor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/class-base-css.php b/inc/class-base-css.php index 9a64e3fe1..a3b5c6d75 100644 --- a/inc/class-base-css.php +++ b/inc/class-base-css.php @@ -303,7 +303,7 @@ public function cycle_through_static_blocks( $blocks, $animations = true ) { } } - if ( class_exists( '\ThemeIsle\GutenbergBlocks\Blocks_Animation' ) && get_option( 'themeisle_blocks_settings_blocks_animation', true ) ) { + if ( true === $animations && class_exists( '\ThemeIsle\GutenbergBlocks\Blocks_Animation' ) && get_option( 'themeisle_blocks_settings_blocks_animation', true ) ) { $style .= $this->get_animation_css( $blocks ); } diff --git a/src/css/editor.js b/src/css/editor.js index c4ec29c28..20b9900e3 100644 --- a/src/css/editor.js +++ b/src/css/editor.js @@ -140,7 +140,7 @@ const CSSEditor = ({ From 9d48b109aa6137a9813d4e4afb77b3c03752b67a Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Fri, 29 Jul 2022 02:46:29 +0530 Subject: [PATCH 03/19] Minor changes --- inc/class-base-css.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/class-base-css.php b/inc/class-base-css.php index a3b5c6d75..5aea51701 100644 --- a/inc/class-base-css.php +++ b/inc/class-base-css.php @@ -371,6 +371,7 @@ public function get_animation_css( $blocks ) { } $style .= $rule->render( $format ); + continue; } /* From b300b30049dd4cff017b440dd5c006526cd91a8a Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Sat, 30 Jul 2022 00:48:24 +0530 Subject: [PATCH 04/19] Don't run Animations function unless needed --- inc/class-base-css.php | 13 +++++++++---- inc/css/class-block-frontend.php | 9 ++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/inc/class-base-css.php b/inc/class-base-css.php index 5aea51701..31a989071 100644 --- a/inc/class-base-css.php +++ b/inc/class-base-css.php @@ -213,7 +213,9 @@ public function get_blocks_css( $post_id ) { return; } - return $this->cycle_through_static_blocks( $blocks ); + $animations = boolval( preg_match( '/\banimated\b/', $content ) ); + + return $this->cycle_through_static_blocks( $blocks, $animations ); } } @@ -241,7 +243,9 @@ public function get_widgets_css() { return; } - return $this->cycle_through_static_blocks( $blocks ); + $animations = boolval( preg_match( '/\banimated\b/', $content ) ); + + return $this->cycle_through_static_blocks( $blocks, $animations ); } } @@ -264,9 +268,10 @@ public function get_reusable_block_css( $post_id ) { return; } - $blocks = parse_blocks( $reusable_block->post_content ); + $blocks = parse_blocks( $reusable_block->post_content ); + $animations = boolval( preg_match( '/\banimated\b/', $content ) ); - return $this->cycle_through_static_blocks( $blocks ); + return $this->cycle_through_static_blocks( $blocks, $animations ); } /** diff --git a/inc/css/class-block-frontend.php b/inc/css/class-block-frontend.php index 63b2ffbec..849f8a89f 100644 --- a/inc/css/class-block-frontend.php +++ b/inc/css/class-block-frontend.php @@ -484,7 +484,9 @@ public function get_page_css_inline( $post_id ) { return ''; } - $css = $this->cycle_through_blocks( $blocks ); + $animations = boolval( preg_match( '/\banimated\b/', $content ) ); + + $css = $this->cycle_through_blocks( $blocks, $animations ); } return $css; @@ -494,14 +496,15 @@ public function get_page_css_inline( $post_id ) { * Cycle thorugh Blocks * * @param array $blocks List of blocks. + * @param bool $animations To check for animations or not. * * @return string Block styles. * @since 1.3.0 * @access public */ - public function cycle_through_blocks( $blocks ) { + public function cycle_through_blocks( $blocks, $animations ) { $style = ''; - $style .= $this->cycle_through_static_blocks( $blocks ); + $style .= $this->cycle_through_static_blocks( $blocks, $animations ); $style .= $this->cycle_through_reusable_blocks( $blocks ); return $style; From c1345eb73486bfd29374ec46a547987135628a50 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Sat, 30 Jul 2022 01:50:59 +0530 Subject: [PATCH 05/19] Add option to toggle animation optimization off --- inc/class-base-css.php | 2 +- inc/class-blocks-animation.php | 20 ++++++++++++-------- inc/class-main.php | 3 ++- inc/plugins/class-options-settings.php | 11 +++++++++++ src/dashboard/components/pages/Dashboard.js | 10 ++++++++++ 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/inc/class-base-css.php b/inc/class-base-css.php index 31a989071..813e2b171 100644 --- a/inc/class-base-css.php +++ b/inc/class-base-css.php @@ -308,7 +308,7 @@ public function cycle_through_static_blocks( $blocks, $animations = true ) { } } - if ( true === $animations && class_exists( '\ThemeIsle\GutenbergBlocks\Blocks_Animation' ) && get_option( 'themeisle_blocks_settings_blocks_animation', true ) ) { + if ( true === $animations && class_exists( '\ThemeIsle\GutenbergBlocks\Blocks_Animation' ) && get_option( 'themeisle_blocks_settings_blocks_animation', true ) && get_option( 'themeisle_blocks_settings_optimize_animations_css', true ) ) { $style .= $this->get_animation_css( $blocks ); } diff --git a/inc/class-blocks-animation.php b/inc/class-blocks-animation.php index 8cd055c18..d447de473 100644 --- a/inc/class-blocks-animation.php +++ b/inc/class-blocks-animation.php @@ -126,19 +126,23 @@ public function enqueue_block_frontend_assets() { * @since 2.0.5 */ public function frontend_load( $block_content, $block ) { + $asset_file = include BLOCKS_ANIMATION_PATH . '/build/animation/frontend.asset.php'; + + wp_register_style( + 'otter-animation', + BLOCKS_ANIMATION_URL . 'build/animation/index.css', + array(), + $asset_file['version'] + ); + if ( ! self::$can_load_frontend ) { return $block_content; } if ( ! self::$scripts_loaded['animation'] && strpos( $block_content, 'animated' ) ) { - $asset_file = include BLOCKS_ANIMATION_PATH . '/build/animation/frontend.asset.php'; - - wp_enqueue_style( - 'otter-animation', - BLOCKS_ANIMATION_URL . 'build/animation/index.css', - array(), - $asset_file['version'] - ); + if ( ! defined( 'OTTER_BLOCKS_VERSION' ) || ( defined( 'OTTER_BLOCKS_VERSION' ) && ! get_option( 'themeisle_blocks_settings_optimize_animations_css', true ) ) ) { + wp_enqueue_style( 'otter-animation' ); + } wp_enqueue_script( 'otter-animation-frontend', diff --git a/inc/class-main.php b/inc/class-main.php index 1d81bda88..941686429 100644 --- a/inc/class-main.php +++ b/inc/class-main.php @@ -270,7 +270,8 @@ public function fix_mime_type_json_svg( $data = null, $file = null, $filename = public function after_update_migration() { $db_version = get_option( 'themeisle_blocks_db_version' ); - if ( version_compare( $db_version, OTTER_BLOCKS_VERSION, '<' ) ) { + // We don't want to regenerate CSS everytime so only do it for versions where it's really needed. + if ( version_compare( $db_version, '2.0.10', '<' ) ) { Dashboard_Server::regenerate_styles(); } diff --git a/inc/plugins/class-options-settings.php b/inc/plugins/class-options-settings.php index 82f8f91e0..dafbe3121 100644 --- a/inc/plugins/class-options-settings.php +++ b/inc/plugins/class-options-settings.php @@ -79,6 +79,17 @@ public function register_settings() { ) ); + register_setting( + 'themeisle_blocks_settings', + 'themeisle_blocks_settings_optimize_animations_css', + array( + 'type' => 'boolean', + 'description' => __( 'Optimize Animations CSS.', 'otter-blocks' ), + 'show_in_rest' => true, + 'default' => true, + ) + ); + register_setting( 'themeisle_blocks_settings', 'otter_blocks_logger_flag', diff --git a/src/dashboard/components/pages/Dashboard.js b/src/dashboard/components/pages/Dashboard.js index 4f3631ff1..f6d6eba97 100644 --- a/src/dashboard/components/pages/Dashboard.js +++ b/src/dashboard/components/pages/Dashboard.js @@ -107,6 +107,16 @@ const Dashboard = ({ /> + + updateOption( 'themeisle_blocks_settings_optimize_animations_css', ! Boolean( getOption( 'themeisle_blocks_settings_optimize_animations_css' ) ) ) } + /> + + Date: Mon, 1 Aug 2022 16:38:22 +0530 Subject: [PATCH 06/19] Move all styles to footer --- inc/css/class-block-frontend.php | 43 +++++++++----------------------- src/animation/editor.scss | 15 ++++++----- 2 files changed, 19 insertions(+), 39 deletions(-) diff --git a/inc/css/class-block-frontend.php b/inc/css/class-block-frontend.php index 849f8a89f..a904ed567 100644 --- a/inc/css/class-block-frontend.php +++ b/inc/css/class-block-frontend.php @@ -242,7 +242,7 @@ function ( $content ) use ( $id ) { return $content; } - $this->enqueue_styles( $post_id, true ); + $this->enqueue_styles( $post_id ); $this->enqueue_google_fonts( $post_id ); return $content; @@ -253,15 +253,13 @@ function ( $content ) use ( $id ) { /** * Enqueue CSS file * - * @param int $post_id Post id. - * @param bool $footer IN footer. + * @param int $post_id Post id. * * @since 1.3.0 * @access public */ - public function enqueue_styles( $post_id = '', $footer = false ) { - $post_id = $post_id ? $post_id : get_the_ID(); - $location = 'wp_head'; + public function enqueue_styles( $post_id = '' ) { + $post_id = $post_id ? $post_id : get_the_ID(); if ( ! function_exists( 'has_blocks' ) ) { return; @@ -271,10 +269,6 @@ public function enqueue_styles( $post_id = '', $footer = false ) { return; } - if ( $footer ) { - $location = 'wp_footer'; - } - if ( is_preview() ) { add_action( $location, @@ -292,7 +286,7 @@ function () use ( $post_id ) { } add_action( - $location, + 'wp_footer', function () use ( $post_id ) { return $this->get_post_css( $post_id ); } @@ -310,7 +304,7 @@ function () use ( $post_id ) { $blocks = parse_blocks( $content ); if ( is_array( $blocks ) || ! empty( $blocks ) ) { - $this->enqueue_reusable_styles( $blocks, $footer ); + $this->enqueue_reusable_styles( $blocks ); } $total_inline_limit = 20000; @@ -321,7 +315,7 @@ function () use ( $post_id ) { $file_path = $basedir . $file_name; $file_size = filesize( $file_path ); - if ( $footer && $this->total_inline_size + $file_size < $total_inline_limit ) { + if ( $this->total_inline_size + $file_size < $total_inline_limit ) { add_action( 'wp_footer', function () use ( $post_id ) { @@ -333,22 +327,10 @@ function () use ( $post_id ) { return; } - if ( $footer ) { - add_action( - 'wp_footer', - function () use ( $post_id, $file_name, $file_url, $file_path ) { - wp_enqueue_style( 'otter-' . $file_name, $file_url, array( 'otter-blocks' ), OTTER_BLOCKS_VERSION ); - } - ); - - return; - } - add_action( - 'wp_enqueue_scripts', + 'wp_footer', function () use ( $post_id, $file_name, $file_url, $file_path ) { wp_enqueue_style( 'otter-' . $file_name, $file_url, array( 'otter-blocks' ), OTTER_BLOCKS_VERSION ); - wp_style_add_data( 'otter-' . $file_name, 'path', $file_path ); } ); } @@ -357,19 +339,18 @@ function () use ( $post_id, $file_name, $file_url, $file_path ) { * Enqueue CSS file for Reusable Blocks * * @param array $blocks List of blocks. - * @param bool $footer Should we load on footer. * * @since 1.3.0 * @access public */ - public function enqueue_reusable_styles( $blocks, $footer = false ) { + public function enqueue_reusable_styles( $blocks ) { foreach ( $blocks as $block ) { if ( 'core/block' === $block['blockName'] && ! empty( $block['attrs']['ref'] ) ) { - $this->enqueue_styles( $block['attrs']['ref'], $footer ); + $this->enqueue_styles( $block['attrs']['ref'] ); } if ( isset( $block['innerBlocks'] ) && ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] ) ) { - $this->enqueue_reusable_styles( $block['innerBlocks'], $footer ); + $this->enqueue_reusable_styles( $block['innerBlocks'] ); } } } @@ -609,7 +590,7 @@ public function enqueue_assets() { foreach ( $posts as $post ) { $class = Registration::instance(); $class->enqueue_dependencies( $post ); - $this->enqueue_styles( $post, true ); + $this->enqueue_styles( $post ); } } } diff --git a/src/animation/editor.scss b/src/animation/editor.scss index 1d1a07aad..b20180aeb 100644 --- a/src/animation/editor.scss +++ b/src/animation/editor.scss @@ -124,14 +124,13 @@ content: '|'; color: #2E3D48; animation: 1s blink step-end infinite; - } +} - @keyframes blink { +@keyframes blink { from, to { - color: transparent; - } + color: transparent; + } 50% { - color: black; - } - } - + color: black; + } +} From 7c1ef348806fd2a579a3c16caa2caa6d18e7f8a8 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Mon, 1 Aug 2022 17:08:56 +0530 Subject: [PATCH 07/19] Load all custom CSS in footer --- inc/css/class-block-frontend.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/inc/css/class-block-frontend.php b/inc/css/class-block-frontend.php index a904ed567..017ea9831 100644 --- a/inc/css/class-block-frontend.php +++ b/inc/css/class-block-frontend.php @@ -55,8 +55,8 @@ public function init() { add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_google_fonts' ), 19 ); add_action( 'wp_head', array( $this, 'enqueue_google_fonts_backward' ), 19 ); add_filter( 'get_the_excerpt', array( $this, 'get_excerpt_end' ), 20 ); - add_action( 'wp_head', array( $this, 'enqueue_widgets_css' ) ); - add_action( 'wp_head', array( $this, 'enqueue_assets' ) ); + add_action( 'wp_footer', array( $this, 'enqueue_widgets_css' ) ); + add_action( 'wp_footer', array( $this, 'enqueue_assets' ) ); add_action( 'wp_footer', array( $this, 'enqueue_global_styles' ) ); } @@ -307,30 +307,15 @@ function () use ( $post_id ) { $this->enqueue_reusable_styles( $blocks ); } - $total_inline_limit = 20000; - $total_inline_limit = apply_filters( 'styles_inline_size_limit', 20000 ); - $wp_upload_dir = wp_upload_dir( null, false ); $basedir = $wp_upload_dir['basedir'] . '/themeisle-gutenberg/'; $file_path = $basedir . $file_name; - $file_size = filesize( $file_path ); - - if ( $this->total_inline_size + $file_size < $total_inline_limit ) { - add_action( - 'wp_footer', - function () use ( $post_id ) { - return $this->get_post_css( $post_id ); - } - ); - - $this->total_inline_size += (int) $file_size; - return; - } add_action( 'wp_footer', - function () use ( $post_id, $file_name, $file_url, $file_path ) { + function () use ( $file_name, $file_url, $file_path ) { wp_enqueue_style( 'otter-' . $file_name, $file_url, array( 'otter-blocks' ), OTTER_BLOCKS_VERSION ); + wp_style_add_data( 'otter-' . $file_name, 'path', $file_path ); } ); } From 470f84bbcfe3ee5f481bbb7b97fef35750b100d3 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Mon, 1 Aug 2022 18:10:02 +0530 Subject: [PATCH 08/19] Remove more styles from main file --- inc/render/class-masonry-variant.php | 6 ++++-- src/animation/editor.scss | 16 -------------- src/animation/frontend/typing/index.js | 29 ++++++++++++++++++++++++++ src/blocks/frontend/sticky/index.js | 18 ++++++++++++++++ src/blocks/style.scss | 19 ----------------- 5 files changed, 51 insertions(+), 37 deletions(-) diff --git a/inc/render/class-masonry-variant.php b/inc/render/class-masonry-variant.php index 66a5e8f47..fdaf2c09c 100644 --- a/inc/render/class-masonry-variant.php +++ b/inc/render/class-masonry-variant.php @@ -46,7 +46,7 @@ public function render_blocks( $block_content, $block ) { ); wp_script_add_data( 'macy', 'async', true ); - + + wp_enqueue_script( 'otter-masonry', OTTER_BLOCKS_URL . 'build/blocks/masonry.js', @@ -62,7 +62,9 @@ public function render_blocks( $block_content, $block ) { $margin = isset( $block['attrs']['margin'] ) ? $block['attrs']['margin'] : 10; - $block_content = '
' . $block_content . '
'; + $style = ''; + + $block_content = $style . '
' . $block_content . '
'; return $block_content; } diff --git a/src/animation/editor.scss b/src/animation/editor.scss index b20180aeb..959abfcf3 100644 --- a/src/animation/editor.scss +++ b/src/animation/editor.scss @@ -118,19 +118,3 @@ top: 16px; } } - -.o-anim-typing-caret::after { - font-weight: 100; - content: '|'; - color: #2E3D48; - animation: 1s blink step-end infinite; -} - -@keyframes blink { - from, to { - color: transparent; - } - 50% { - color: black; - } -} diff --git a/src/animation/frontend/typing/index.js b/src/animation/frontend/typing/index.js index f8e44a365..b250f1225 100644 --- a/src/animation/frontend/typing/index.js +++ b/src/animation/frontend/typing/index.js @@ -105,9 +105,38 @@ domReady( () => { threshold: [ 0.6 ] }; + let styles = ` + .o-anim-typing-caret::after { + font-weight: 100; + content: '|'; + color: #2E3D48; + animation: 1s blink step-end infinite; + } + + @keyframes blink { + from, to { + color: transparent; + } + 50% { + color: black; + } + } + `; + + styles = styles.replace( /(\r\n|\n|\r|\t)/gm, '' ); + + let hasStyles = false; + setTimeout( () => { const anims = document.querySelectorAll( 'o-anim-typing' ); anims.forEach( ( elem ) => { + if ( ! hasStyles ) { + const styleSheet = document.createElement( 'style' ); + styleSheet.innerText = styles; + document.head.appendChild( styleSheet ); + hasStyles = true; + } + const startTyping = initTyping( elem ); const observer = new IntersectionObserver( ( entries ) => { entries.forEach( entry => { diff --git a/src/blocks/frontend/sticky/index.js b/src/blocks/frontend/sticky/index.js index 46aede48b..2c606871d 100644 --- a/src/blocks/frontend/sticky/index.js +++ b/src/blocks/frontend/sticky/index.js @@ -446,8 +446,26 @@ domReady( () => { const elems = document.querySelectorAll( '.o-sticky' ); const observer = createObserver(); + let styles = ` + .o-is-sticky { + position: fixed; + z-index: 9999; + } + `; + + styles = styles.replace( /(\r\n|\n|\r|\t)/gm, '' ); + + let hasStyles = false; + detectLoading( () => { elems.forEach( ( elem ) => { + if ( ! hasStyles ) { + const styleSheet = document.createElement( 'style' ); + styleSheet.innerText = styles; + document.head.appendChild( styleSheet ); + hasStyles = true; + } + const config = getConfigOptions( elem ); const container = getStickyContainer( elem, config.scope ); diff --git a/src/blocks/style.scss b/src/blocks/style.scss index f76dc42b2..f9c554d9a 100644 --- a/src/blocks/style.scss +++ b/src/blocks/style.scss @@ -1,13 +1,3 @@ -.otter-masonry { - .blocks-gallery-grid { - .blocks-gallery-item { - img { - width: 100%; - } - } - } -} - .wp-block-themeisle-blocks-woo-comparison { .nv-ct-layout-row { tbody { @@ -21,12 +11,3 @@ } } } - -.o-is-sticky { - position: fixed; - z-index: 9999; -} - -.o-woocommerce-builder .woocommerce-product-gallery { - width: 100% !important; -} From 34e098e3538523bc056faceff2d0f91909354e98 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Mon, 1 Aug 2022 18:55:18 +0530 Subject: [PATCH 09/19] Don't load FA menu stylesheet unless needed --- inc/class-registration.php | 4 ++++ src/blocks/plugins/menu-icons/index.js | 1 - src/blocks/plugins/menu-icons/{style.scss => inline.scss} | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) rename src/blocks/plugins/menu-icons/{style.scss => inline.scss} (78%) diff --git a/inc/class-registration.php b/inc/class-registration.php index f590e4627..7e4a824b7 100644 --- a/inc/class-registration.php +++ b/inc/class-registration.php @@ -815,6 +815,10 @@ public function subscribe_fa( $block_content, $block ) { if ( isset( $block['attrs']['className'] ) && strpos( $block['attrs']['className'], 'fa-' ) !== false ) { self::$is_fa_loaded = true; + // See the src/blocks/plugins/menu-icons/inline.css file for where this comes from. + $styles = '.fab.wp-block-navigation-item,.far.wp-block-navigation-item,.fas.wp-block-navigation-item{-moz-osx-font-smoothing:inherit;-webkit-font-smoothing:inherit;font-weight:inherit}.fab.wp-block-navigation-item:before,.far.wp-block-navigation-item:before,.fas.wp-block-navigation-item:before{font-family:Font Awesome\ 5 Free;margin-right:5px}.fab.wp-block-navigation-item:before,.far.wp-block-navigation-item:before{font-weight:400;padding-right:5px}.fas.wp-block-navigation-item:before{font-weight:900;padding-right:5px}.fab.wp-block-navigation-item:before{font-family:Font Awesome\ 5 Brands}'; + + wp_add_inline_style( 'font-awesome-5', $styles ); return $block_content; } } diff --git a/src/blocks/plugins/menu-icons/index.js b/src/blocks/plugins/menu-icons/index.js index 87f6a5a9f..03f1ab0ff 100644 --- a/src/blocks/plugins/menu-icons/index.js +++ b/src/blocks/plugins/menu-icons/index.js @@ -23,7 +23,6 @@ import { addFilter } from '@wordpress/hooks'; /** * Internal dependencies. */ -import './style.scss'; import './editor.scss'; const IconPickerControl = lazy( () => import( '../../components/icon-picker-control/toolbar.js' ) ); diff --git a/src/blocks/plugins/menu-icons/style.scss b/src/blocks/plugins/menu-icons/inline.scss similarity index 78% rename from src/blocks/plugins/menu-icons/style.scss rename to src/blocks/plugins/menu-icons/inline.scss index 3ce22ffbe..aa44afeb0 100644 --- a/src/blocks/plugins/menu-icons/style.scss +++ b/src/blocks/plugins/menu-icons/inline.scss @@ -1,3 +1,7 @@ +// +// Notice: This CSS is added inline in the class-registration.php file using `wp_add_inline_style( 'font-awesome-5', $styles );` function. +// + .fas, .fab, .far { From acbdb8227065af45514db44b4e444186b4bd3326 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Mon, 1 Aug 2022 18:59:46 +0530 Subject: [PATCH 10/19] Goodbye to all the styles when Otter blocks not being used --- inc/class-registration.php | 4 ---- .../inc/render/class-woo-comparison-block.php | 1 + src/blocks/index.js | 1 - src/blocks/style.scss | 13 ------------- 4 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 src/blocks/style.scss diff --git a/inc/class-registration.php b/inc/class-registration.php index 7e4a824b7..69000279f 100644 --- a/inc/class-registration.php +++ b/inc/class-registration.php @@ -281,10 +281,6 @@ public function enqueue_block_assets() { return; } - $asset_file = include OTTER_BLOCKS_PATH . '/build/blocks/blocks.asset.php'; - wp_enqueue_style( 'otter-blocks', OTTER_BLOCKS_URL . 'build/blocks/blocks.css', [], $asset_file['version'] ); - wp_style_add_data( 'otter-blocks', 'path', OTTER_BLOCKS_PATH . '/build/blocks/blocks.css' ); - if ( is_singular() ) { $this->enqueue_dependencies(); } else { diff --git a/plugins/otter-pro/inc/render/class-woo-comparison-block.php b/plugins/otter-pro/inc/render/class-woo-comparison-block.php index 88fd651a2..12910c00e 100644 --- a/plugins/otter-pro/inc/render/class-woo-comparison-block.php +++ b/plugins/otter-pro/inc/render/class-woo-comparison-block.php @@ -108,6 +108,7 @@ public function render( $attributes ) { $output = '
'; $output .= ob_get_contents(); $output .= '
'; + $output .= ''; ob_end_clean(); return $output; } diff --git a/src/blocks/index.js b/src/blocks/index.js index 89774e4e1..8e212ffe8 100644 --- a/src/blocks/index.js +++ b/src/blocks/index.js @@ -14,7 +14,6 @@ import { addFilter } from '@wordpress/hooks'; /** * Internal dependencies */ -import './style.scss'; import './editor.scss'; import { otterIcon, diff --git a/src/blocks/style.scss b/src/blocks/style.scss deleted file mode 100644 index f9c554d9a..000000000 --- a/src/blocks/style.scss +++ /dev/null @@ -1,13 +0,0 @@ -.wp-block-themeisle-blocks-woo-comparison { - .nv-ct-layout-row { - tbody { - tr { - td { - &:first-child { - border-left: 1px solid var(--border-color); - } - } - } - } - } -} From c4adbe46d4beae096289b43551da25ac4b78e8e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 23:09:28 +0000 Subject: [PATCH 11/19] chore(deps): bump @wordpress/icons from 9.3.0 to 9.5.0 Bumps [@wordpress/icons](https://github.com/WordPress/gutenberg/tree/HEAD/packages/icons) from 9.3.0 to 9.5.0. - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/icons/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/icons@9.5.0/packages/icons) --- updated-dependencies: - dependency-name: "@wordpress/icons" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 60 ++++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3fccd74af..b32248301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4852,6 +4852,7 @@ "version": "4.10.0", "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.10.0.tgz", "integrity": "sha512-Ddi5nwd8/zPDITo2PCm30ffKxvbOEpW8krXzffnTace7TaqGzz7QuX6yOVdm6xXx3KZH/AADYPzCwthJKbKGEg==", + "dev": true, "requires": { "@babel/runtime": "^7.16.0", "@types/react": "^17.0.37", @@ -4866,12 +4867,21 @@ "version": "2.12.0", "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.12.0.tgz", "integrity": "sha512-kuLtqEOHSIu53+HwHjCiz8THXhnhqFwsfFgr4gkZmv4n4NxLmGsMV2kMMZlRjWbTUSP0YN7Dix4uHx8JWlIRGg==", + "dev": true, "requires": { "@babel/runtime": "^7.16.0" } } } }, + "@wordpress/escape-html": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.14.0.tgz", + "integrity": "sha512-y8wlJuT2ze6bf6a/vW6T1hnUxm8WD8CERYU133NpiNeQV3GJffw2tGimhasHwhN7hCfH1iPkY4od5RkclHxnRw==", + "requires": { + "@babel/runtime": "^7.16.0" + } + }, "@wordpress/eslint-plugin": { "version": "12.2.0", "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-12.2.0.tgz", @@ -4971,13 +4981,29 @@ } }, "@wordpress/icons": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.3.0.tgz", - "integrity": "sha512-O07rhQ8H+9QbzeEi3Juf02aVow0Nm/jFFYwquh2mjmwCwqH0nmNi6l+iVipYGvaJUsHBfPnvL7ulD6udQI/9mQ==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.5.0.tgz", + "integrity": "sha512-nwjLoNt7wSQbtz//XkE3zdNY9HRlakAWq0ttauWpV6NwI/Wiz6Bm1+l4v15olWnOh2akikGfc8UFO5M0ZmbQqw==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.10.0", - "@wordpress/primitives": "^3.10.0" + "@wordpress/element": "^4.12.0", + "@wordpress/primitives": "^3.12.0" + }, + "dependencies": { + "@wordpress/element": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.12.0.tgz", + "integrity": "sha512-QdpqJpdspuqV5qLmoETjZB/kTVqL/wIRJrvfEXJ4ozgIrf9zQaxgiFxwImJ35oXH7HR1iRBd/YBRer/fC93oYw==", + "requires": { + "@babel/runtime": "^7.16.0", + "@types/react": "^17.0.37", + "@types/react-dom": "^17.0.11", + "@wordpress/escape-html": "^2.14.0", + "lodash": "^4.17.21", + "react": "^17.0.2", + "react-dom": "^17.0.2" + } + } } }, "@wordpress/jest-console": { @@ -5396,13 +5422,29 @@ "dev": true }, "@wordpress/primitives": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.10.0.tgz", - "integrity": "sha512-Wv11uj0ygb34KEaJHIjyqGrA9QRp3XWaIuW/elkwcl6qBDTmaeAy+hizDh6XVpLp7RaxkAj+dhBhTaH4yT79Kg==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.12.0.tgz", + "integrity": "sha512-/mlWDw9JFFrptAQz6ur9ui9sqFfBbDI79Bm4rJdas0vRxBfUhMNUPKybjCaN/zmalnD1c1lLHuyaOW2ryT1Ivw==", "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.10.0", + "@wordpress/element": "^4.12.0", "classnames": "^2.3.1" + }, + "dependencies": { + "@wordpress/element": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.12.0.tgz", + "integrity": "sha512-QdpqJpdspuqV5qLmoETjZB/kTVqL/wIRJrvfEXJ4ozgIrf9zQaxgiFxwImJ35oXH7HR1iRBd/YBRer/fC93oYw==", + "requires": { + "@babel/runtime": "^7.16.0", + "@types/react": "^17.0.37", + "@types/react-dom": "^17.0.11", + "@wordpress/escape-html": "^2.14.0", + "lodash": "^4.17.21", + "react": "^17.0.2", + "react-dom": "^17.0.2" + } + } } }, "@wordpress/priority-queue": { diff --git a/package.json b/package.json index f9f011f65..4a21f15dd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "lasttranslator": "Themeisle Translate Team " }, "dependencies": { - "@wordpress/icons": "^9.3.0", + "@wordpress/icons": "^9.5.0", "array-move": "^3.0.1", "classnames": "^2.3.1", "currency-symbol-map": "^5.0.1", From dece5a921b5df3dceb2704feae457122a0f9280e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 23:11:57 +0000 Subject: [PATCH 12/19] chore(deps-dev): bump @wordpress/dom-ready from 3.12.0 to 3.14.0 Bumps [@wordpress/dom-ready](https://github.com/WordPress/gutenberg/tree/HEAD/packages/dom-ready) from 3.12.0 to 3.14.0. - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/dom-ready/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/dom-ready@3.14.0/packages/dom-ready) --- updated-dependencies: - dependency-name: "@wordpress/dom-ready" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3fccd74af..94e2a10a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4840,9 +4840,9 @@ } }, "@wordpress/dom-ready": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-3.12.0.tgz", - "integrity": "sha512-+IzRp/Vo2TkBQ72C9t/PETXbyPJPgr9DZmhbaYz8/RuTq/E5GcHPfEkKgjXNhDjOVxtjUb3Ut03EioGI6XFpAg==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom-ready/-/dom-ready-3.14.0.tgz", + "integrity": "sha512-EftNWZlWN17ghjvCfuCnl/kSl1UdfgnOk92hASI2A+vRE8vsHvdx/d+/jZ9sC6I3QIGE7y1OVAnpWdQpC9m6lg==", "dev": true, "requires": { "@babel/runtime": "^7.16.0" diff --git a/package.json b/package.json index f9f011f65..49f8eb91a 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@wordpress/components": "^19.14.0", "@wordpress/compose": "^5.10.0", "@wordpress/data": "^6.12.0", - "@wordpress/dom-ready": "^3.12.0", + "@wordpress/dom-ready": "^3.14.0", "@wordpress/element": "^4.10.0", "@wordpress/scripts": "^22.5.0", "conventional-changelog-simple-preset": "^1.0.20", From 73340d54f7bb5d227b37326a82f828b2131cdbf4 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Tue, 2 Aug 2022 17:46:19 +0530 Subject: [PATCH 13/19] Minor changes --- inc/class-main.php | 3 +-- inc/css/class-block-frontend.php | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/inc/class-main.php b/inc/class-main.php index 2a9fcf56a..c6b7db1bf 100644 --- a/inc/class-main.php +++ b/inc/class-main.php @@ -270,8 +270,7 @@ public function fix_mime_type_json_svg( $data = null, $file = null, $filename = public function after_update_migration() { $db_version = get_option( 'themeisle_blocks_db_version', 0 ); - // We don't want to regenerate CSS everytime so only do it for versions where it's really needed. - if ( version_compare( $db_version, '2.0.10', '<' ) ) { + if ( version_compare( $db_version, OTTER_BLOCKS_VERSION, '<' ) ) { Dashboard_Server::regenerate_styles(); } diff --git a/inc/css/class-block-frontend.php b/inc/css/class-block-frontend.php index 017ea9831..11686ab40 100644 --- a/inc/css/class-block-frontend.php +++ b/inc/css/class-block-frontend.php @@ -56,7 +56,7 @@ public function init() { add_action( 'wp_head', array( $this, 'enqueue_google_fonts_backward' ), 19 ); add_filter( 'get_the_excerpt', array( $this, 'get_excerpt_end' ), 20 ); add_action( 'wp_footer', array( $this, 'enqueue_widgets_css' ) ); - add_action( 'wp_footer', array( $this, 'enqueue_assets' ) ); + add_action( 'wp_head', array( $this, 'enqueue_assets' ) ); add_action( 'wp_footer', array( $this, 'enqueue_global_styles' ) ); } @@ -271,7 +271,7 @@ public function enqueue_styles( $post_id = '' ) { if ( is_preview() ) { add_action( - $location, + 'wp_footer', function () use ( $post_id ) { return $this->get_post_css( $post_id ); } @@ -307,15 +307,30 @@ function () use ( $post_id ) { $this->enqueue_reusable_styles( $blocks ); } + $total_inline_limit = 20000; + $total_inline_limit = apply_filters( 'styles_inline_size_limit', 20000 ); + $wp_upload_dir = wp_upload_dir( null, false ); $basedir = $wp_upload_dir['basedir'] . '/themeisle-gutenberg/'; $file_path = $basedir . $file_name; + $file_size = filesize( $file_path ); + + if ( $this->total_inline_size + $file_size < $total_inline_limit ) { + add_action( + 'wp_footer', + function () use ( $post_id ) { + return $this->get_post_css( $post_id ); + } + ); + + $this->total_inline_size += (int) $file_size; + return; + } add_action( 'wp_footer', function () use ( $file_name, $file_url, $file_path ) { - wp_enqueue_style( 'otter-' . $file_name, $file_url, array( 'otter-blocks' ), OTTER_BLOCKS_VERSION ); - wp_style_add_data( 'otter-' . $file_name, 'path', $file_path ); + wp_enqueue_style( 'otter-' . $file_name, $file_url, array(), OTTER_BLOCKS_VERSION ); } ); } @@ -538,7 +553,7 @@ public function enqueue_widgets_css() { $file_name = basename( $file_url ); $file_path = $basedir . $file_name; - wp_enqueue_style( 'otter-widgets', $file_url, array( 'otter-blocks' ), OTTER_BLOCKS_VERSION ); + wp_enqueue_style( 'otter-widgets', $file_url, array(), OTTER_BLOCKS_VERSION ); wp_style_add_data( 'otter-widgets', 'path', $file_path ); } From f76ded694b6d52aa4a62480c7b7718065232c2e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 21:45:09 +0000 Subject: [PATCH 14/19] chore(deps-dev): bump @wordpress/components and @types/wordpress__components Bumps [@wordpress/components](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components) and [@types/wordpress__components](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/wordpress__components). These dependencies needed to be updated together. Updates `@wordpress/components` from 19.14.0 to 19.16.0 - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/components/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/components@19.16.0/packages/components) Updates `@types/wordpress__components` from 19.10.0 to 19.10.1 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/wordpress__components) --- updated-dependencies: - dependency-name: "@wordpress/components" dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: "@types/wordpress__components" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 313 ++++++++++++++++++++-------------------------- package.json | 4 +- 2 files changed, 135 insertions(+), 182 deletions(-) diff --git a/package-lock.json b/package-lock.json index 446e2df0e..f31594f49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3331,9 +3331,9 @@ } }, "@types/wordpress__components": { - "version": "19.10.0", - "resolved": "https://registry.npmjs.org/@types/wordpress__components/-/wordpress__components-19.10.0.tgz", - "integrity": "sha512-hnJHwYJfjUSJ79ompvBmGWsJdP/P4OGv1Yz2fuFXHYLS7k2eNba31cy51sI/q7+czSb6wG+Y5cssxNcA3Nrxbg==", + "version": "19.10.1", + "resolved": "https://registry.npmjs.org/@types/wordpress__components/-/wordpress__components-19.10.1.tgz", + "integrity": "sha512-zD+lrwMkh8ttnUQb6EUYZ55q6QGIwqqg0SfD8xX0kdinx/1KMKMUgInMkiVQ8ky56BIzADiYH3+A0Pdh76GAxw==", "dev": true, "requires": { "@types/react": "*", @@ -3767,14 +3767,14 @@ } }, "@wordpress/a11y": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-3.12.0.tgz", - "integrity": "sha512-Fu+flXsHwSiQ4fjzTHEVTdKoOzpY8wtQ6YMFZbpIolaAC/I5j1dKHgBAQvHsFyBlg6fHrx0FZV6Xr4DgfW6daA==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-3.14.0.tgz", + "integrity": "sha512-njZSjcgxuRHBaJKlu1sOyQxPxXEECD+RBV+pzlW4ivf3zzImcFfUk+WP7BXwfS48f88VfCevfNkGtiB5Cz3v6A==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/dom-ready": "^3.12.0", - "@wordpress/i18n": "^4.12.0" + "@wordpress/dom-ready": "^3.14.0", + "@wordpress/i18n": "^4.14.0" } }, "@wordpress/api-fetch": { @@ -4460,9 +4460,9 @@ "dev": true }, "@wordpress/components": { - "version": "19.14.0", - "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-19.14.0.tgz", - "integrity": "sha512-3RfCCqmgDJ52HW9rSi/EZoxeNdqvqVa3xIoMCN9v9I2BZzRNr+HHvGWIQDL4k3vDd7CcNFlzgZO1zeo3qhxPJg==", + "version": "19.16.0", + "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-19.16.0.tgz", + "integrity": "sha512-7GYIIBGD8Z0xaCw6k6qiWMTMQt8y01IvvKGgzoLYyoZqPwGyPK4DjCJVcILNHOivkI8mi+da3vq1ku9IkMNrPg==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", @@ -4474,21 +4474,21 @@ "@emotion/utils": "1.0.0", "@floating-ui/react-dom": "0.6.3", "@use-gesture/react": "^10.2.6", - "@wordpress/a11y": "^3.12.0", - "@wordpress/compose": "^5.10.0", - "@wordpress/date": "^4.12.0", - "@wordpress/deprecated": "^3.12.0", - "@wordpress/dom": "^3.12.0", - "@wordpress/element": "^4.10.0", - "@wordpress/escape-html": "^2.12.0", - "@wordpress/hooks": "^3.12.0", - "@wordpress/i18n": "^4.12.0", - "@wordpress/icons": "^9.3.0", - "@wordpress/is-shallow-equal": "^4.12.0", - "@wordpress/keycodes": "^3.12.0", - "@wordpress/primitives": "^3.10.0", - "@wordpress/rich-text": "^5.10.0", - "@wordpress/warning": "^2.12.0", + "@wordpress/a11y": "^3.14.0", + "@wordpress/compose": "^5.12.0", + "@wordpress/date": "^4.14.0", + "@wordpress/deprecated": "^3.14.0", + "@wordpress/dom": "^3.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/escape-html": "^2.14.0", + "@wordpress/hooks": "^3.14.0", + "@wordpress/i18n": "^4.14.0", + "@wordpress/icons": "^9.5.0", + "@wordpress/is-shallow-equal": "^4.14.0", + "@wordpress/keycodes": "^3.14.0", + "@wordpress/primitives": "^3.12.0", + "@wordpress/rich-text": "^5.12.0", + "@wordpress/warning": "^2.14.0", "classnames": "^2.3.1", "colord": "^2.7.0", "dom-scroll-into-view": "^1.2.1", @@ -4513,84 +4513,55 @@ "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==", "dev": true }, - "@wordpress/deprecated": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.12.0.tgz", - "integrity": "sha512-sep+c2jFwAZ4HTtPgIbNLC0YTz3q9gCH3A82XwY/krkvxhNk3g+mXxPUI2dUoxp7RAeeckqDtKosPvvpqUZWiQ==", + "@wordpress/compose": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-5.12.0.tgz", + "integrity": "sha512-ohK+uxazOqWWZ2BUyVFeNDy5/RJasfsnrs00f9O0BohaGUM4bp5daEnYHPMdjUpvzRTDEviiX0IMIEnc97N+JQ==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.12.0" + "@types/lodash": "^4.14.172", + "@types/mousetrap": "^1.6.8", + "@wordpress/deprecated": "^3.14.0", + "@wordpress/dom": "^3.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/is-shallow-equal": "^4.14.0", + "@wordpress/keycodes": "^3.14.0", + "@wordpress/priority-queue": "^2.14.0", + "clipboard": "^2.0.8", + "lodash": "^4.17.21", + "mousetrap": "^1.6.5", + "use-memo-one": "^1.1.1" } }, "@wordpress/element": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.10.0.tgz", - "integrity": "sha512-Ddi5nwd8/zPDITo2PCm30ffKxvbOEpW8krXzffnTace7TaqGzz7QuX6yOVdm6xXx3KZH/AADYPzCwthJKbKGEg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.12.0.tgz", + "integrity": "sha512-QdpqJpdspuqV5qLmoETjZB/kTVqL/wIRJrvfEXJ4ozgIrf9zQaxgiFxwImJ35oXH7HR1iRBd/YBRer/fC93oYw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.12.0", + "@wordpress/escape-html": "^2.14.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2" } }, - "@wordpress/escape-html": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.12.0.tgz", - "integrity": "sha512-kuLtqEOHSIu53+HwHjCiz8THXhnhqFwsfFgr4gkZmv4n4NxLmGsMV2kMMZlRjWbTUSP0YN7Dix4uHx8JWlIRGg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/hooks": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.12.0.tgz", - "integrity": "sha512-DTf2VLBfrbuNQvBvz2m5Nbn44KEA4tHjo+1cIeDCZAuqBAKmeBGmJZA76lDs5Qu5nqfaixcOmfeVBEr29npJNg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/icons": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.3.0.tgz", - "integrity": "sha512-O07rhQ8H+9QbzeEi3Juf02aVow0Nm/jFFYwquh2mjmwCwqH0nmNi6l+iVipYGvaJUsHBfPnvL7ulD6udQI/9mQ==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.10.0", - "@wordpress/primitives": "^3.10.0" - } - }, - "@wordpress/is-shallow-equal": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.12.0.tgz", - "integrity": "sha512-jlpHXPLJw0mG13bcbZIJwOd1DQozJ5+fbkkKA2JeTO5d5PXs44Rw6EYdGMLUU97B44UxIwVbaui7tJGOvzF8Dw==", + "@wordpress/priority-queue": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.14.0.tgz", + "integrity": "sha512-dXPsHqZQsI2xZ4WGq90iZLHliThbJI6+BF76YksLLYccaUW1LTzkQiEmub2pwdf9liMq/xocN07HdxMiI7HcRw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0" } }, - "@wordpress/primitives": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.10.0.tgz", - "integrity": "sha512-Wv11uj0ygb34KEaJHIjyqGrA9QRp3XWaIuW/elkwcl6qBDTmaeAy+hizDh6XVpLp7RaxkAj+dhBhTaH4yT79Kg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.10.0", - "classnames": "^2.3.1" - } - }, "@wordpress/warning": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.12.0.tgz", - "integrity": "sha512-Xus/47T/F5yNjyuJEwBR8A1YSBppS1A8G+zD0Gt5Rn8x/4PAe1b2il8eoW8YIdHAFVM0PpZuWRhmN4f1y8mG7w==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/warning/-/warning-2.14.0.tgz", + "integrity": "sha512-qlfSTGkS6ei366OEPNe54DG0O3D/Ta1d4Xalx8Crgxm8xygncuxuuefWKAnnwgXfzsO4d4gs29hnTEzIMIaGcA==", "dev": true }, "dom-scroll-into-view": { @@ -4798,9 +4769,9 @@ } }, "@wordpress/date": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/date/-/date-4.12.0.tgz", - "integrity": "sha512-WorVLXLjfzfwI7dv9shd+sirym7nsJYAdh82gEJqSb+sY3qabyiPSnTMcfWgN7j+0/jJP9dXFV81hG+DRJgIEQ==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/date/-/date-4.14.0.tgz", + "integrity": "sha512-HrYZX7pY2yJjsaeAv11aQRqoF2rtVmhoG1X44gL3ddA4kcFBqeBMngKS6WunsS7z/x5lunWv7Kr0iIv05vh6Vw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", @@ -4819,19 +4790,19 @@ } }, "@wordpress/deprecated": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.8.0.tgz", - "integrity": "sha512-ObZz2XjYEL/M0izpqvwxwidHZi1uZvGDwhOgvNwCpqfJiN1rA5F0GAVByDu2iOBBw49pSDK/DUn4m0umKoyeCA==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.14.0.tgz", + "integrity": "sha512-Nvx2/sLjzeIcIAJTBwmYxJ1yKkWd+yfZze1bByPkhndo+y0ImNap3NUrl+inOgtNbZiVkj9QafmaCwaogjp9xQ==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.8.0" + "@wordpress/hooks": "^3.14.0" } }, "@wordpress/dom": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.12.0.tgz", - "integrity": "sha512-OliLqayM41MwfsCzLAg6wZWKnO28fLX50igGODVm5qtZUQMBDNhz3sX0T1OpB7P+UFOx/KffAkuk6HNi2NXKTQ==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.14.0.tgz", + "integrity": "sha512-U31BuODuyXsllErsURVITJNXdJGmoZoRWwnREOlxLfKZymmFFnNWvSJRqrB2ZLnUMc/qwQoX27LoK76CRl5vzQ==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", @@ -4937,9 +4908,9 @@ } }, "@wordpress/hooks": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.8.0.tgz", - "integrity": "sha512-PSBFYs7pH6BFcIuUUX6TQThSVSWtFpcYTfyIRVz26FsptRbCOXUzxHVKc5ofawTmcrOPyvAeDpEiVGJ1UOm8Lw==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.14.0.tgz", + "integrity": "sha512-bcQXql4A1VI6gnTdNzMjdHLGTpnf8oWOQ1r8B8fcvtOF3dKictxJPobarWxFbtVTQoegizZT/lPCMoLsnVJpug==", "dev": true, "requires": { "@babel/runtime": "^7.16.0" @@ -4955,29 +4926,18 @@ } }, "@wordpress/i18n": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.12.0.tgz", - "integrity": "sha512-UTccrAOZ03nszzlG74G+ZkMR/kK0PoS1fqFa8NRFAhHneYadJOnsgCCd5YgDAsN+tAKA6QM7RPmpQMwujvIbzA==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.14.0.tgz", + "integrity": "sha512-46ryvPbh139RkLXQt8oey4aCcWo6HRKb1NLVHU4a4kJ4HRD/HLhAeTHKAMiZFWTg+QC1HZC32vGdEikqrpnlzQ==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.12.0", + "@wordpress/hooks": "^3.14.0", "gettext-parser": "^1.3.1", "lodash": "^4.17.21", "memize": "^1.1.0", "sprintf-js": "^1.1.1", "tannin": "^1.2.0" - }, - "dependencies": { - "@wordpress/hooks": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.12.0.tgz", - "integrity": "sha512-DTf2VLBfrbuNQvBvz2m5Nbn44KEA4tHjo+1cIeDCZAuqBAKmeBGmJZA76lDs5Qu5nqfaixcOmfeVBEr29npJNg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - } } }, "@wordpress/icons": { @@ -5006,6 +4966,15 @@ } } }, + "@wordpress/is-shallow-equal": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.14.0.tgz", + "integrity": "sha512-FVpuU3GmvZFvjcuIKcraNH46vEZzz+FCpujjqCzcyWNGUsg7wpfGNVoDWs5LWFA4EELHL2+p8Ff9RZX237b5Kg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.16.0" + } + }, "@wordpress/jest-console": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@wordpress/jest-console/-/jest-console-5.0.2.tgz", @@ -5204,13 +5173,13 @@ } }, "@wordpress/keycodes": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.12.0.tgz", - "integrity": "sha512-wZQa8T2rgJnoJHG9Bmp0E1WNQOKK6awf0elnzEKs8UleauDKHJIMdiILq74bNz3SptVKkehdCsa8wpE9HuB8Kw==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.14.0.tgz", + "integrity": "sha512-hUHRMCWil4eKauzCWtYSry8i1wxa1cegUqjZ3OASzefZvCrMv6TNuRXohp+hNLWGWWMbP0I2Pcrd0WuGcmlSqg==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.12.0", + "@wordpress/i18n": "^4.14.0", "lodash": "^4.17.21" } }, @@ -5469,110 +5438,94 @@ } }, "@wordpress/rich-text": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/rich-text/-/rich-text-5.10.0.tgz", - "integrity": "sha512-9FZbW8/d083IM4pt8Uq89Idn4iFkkXvwLPcKs8QSr5wIjSbGMuCfnKF9UzWC70Hs4dIfIWHxdLiWzQ1+zi9ljw==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/rich-text/-/rich-text-5.12.0.tgz", + "integrity": "sha512-iL9jUF0LJweGCh4SZMB+CLMENUGktgPYHv0tSaX/EjA/Ph80Grz8ah2PH8fQUH4349Zc/+AGXgn/6cUzdvD0WA==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/a11y": "^3.12.0", - "@wordpress/compose": "^5.10.0", - "@wordpress/data": "^6.12.0", - "@wordpress/element": "^4.10.0", - "@wordpress/escape-html": "^2.12.0", - "@wordpress/i18n": "^4.12.0", - "@wordpress/keycodes": "^3.12.0", + "@wordpress/a11y": "^3.14.0", + "@wordpress/compose": "^5.12.0", + "@wordpress/data": "^6.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/escape-html": "^2.14.0", + "@wordpress/i18n": "^4.14.0", + "@wordpress/keycodes": "^3.14.0", "lodash": "^4.17.21", "memize": "^1.1.0", "rememo": "^4.0.0" }, "dependencies": { - "@wordpress/data": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-6.12.0.tgz", - "integrity": "sha512-fnMfbYoGl3GqP7tDaArtRRizQznnh6cVT+tAZV8aDBICNkQ8za7BY+HcxEpviNb+JbHJJk6VEclaLjYhR3jLCQ==", + "@wordpress/compose": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-5.12.0.tgz", + "integrity": "sha512-ohK+uxazOqWWZ2BUyVFeNDy5/RJasfsnrs00f9O0BohaGUM4bp5daEnYHPMdjUpvzRTDEviiX0IMIEnc97N+JQ==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/compose": "^5.10.0", - "@wordpress/deprecated": "^3.12.0", - "@wordpress/element": "^4.10.0", - "@wordpress/is-shallow-equal": "^4.12.0", - "@wordpress/priority-queue": "^2.12.0", - "@wordpress/redux-routine": "^4.12.0", - "equivalent-key-map": "^0.2.2", - "is-promise": "^4.0.0", + "@types/lodash": "^4.14.172", + "@types/mousetrap": "^1.6.8", + "@wordpress/deprecated": "^3.14.0", + "@wordpress/dom": "^3.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/is-shallow-equal": "^4.14.0", + "@wordpress/keycodes": "^3.14.0", + "@wordpress/priority-queue": "^2.14.0", + "clipboard": "^2.0.8", "lodash": "^4.17.21", - "redux": "^4.1.2", - "turbo-combine-reducers": "^1.0.2", + "mousetrap": "^1.6.5", "use-memo-one": "^1.1.1" } }, - "@wordpress/deprecated": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.12.0.tgz", - "integrity": "sha512-sep+c2jFwAZ4HTtPgIbNLC0YTz3q9gCH3A82XwY/krkvxhNk3g+mXxPUI2dUoxp7RAeeckqDtKosPvvpqUZWiQ==", + "@wordpress/data": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-6.14.0.tgz", + "integrity": "sha512-m0SazQ6zlxRcm8iBcB/K06S4iCW+EZ1EXoEXILoaQ3AC2Kyibs262n/SSer8MRpPuwwOkpvS0ANgubT3MN/0SA==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.12.0" + "@wordpress/compose": "^5.12.0", + "@wordpress/deprecated": "^3.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/is-shallow-equal": "^4.14.0", + "@wordpress/priority-queue": "^2.14.0", + "@wordpress/redux-routine": "^4.14.0", + "equivalent-key-map": "^0.2.2", + "is-promise": "^4.0.0", + "lodash": "^4.17.21", + "redux": "^4.1.2", + "turbo-combine-reducers": "^1.0.2", + "use-memo-one": "^1.1.1" } }, "@wordpress/element": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.10.0.tgz", - "integrity": "sha512-Ddi5nwd8/zPDITo2PCm30ffKxvbOEpW8krXzffnTace7TaqGzz7QuX6yOVdm6xXx3KZH/AADYPzCwthJKbKGEg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.12.0.tgz", + "integrity": "sha512-QdpqJpdspuqV5qLmoETjZB/kTVqL/wIRJrvfEXJ4ozgIrf9zQaxgiFxwImJ35oXH7HR1iRBd/YBRer/fC93oYw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.12.0", + "@wordpress/escape-html": "^2.14.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2" } }, - "@wordpress/escape-html": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.12.0.tgz", - "integrity": "sha512-kuLtqEOHSIu53+HwHjCiz8THXhnhqFwsfFgr4gkZmv4n4NxLmGsMV2kMMZlRjWbTUSP0YN7Dix4uHx8JWlIRGg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/hooks": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.12.0.tgz", - "integrity": "sha512-DTf2VLBfrbuNQvBvz2m5Nbn44KEA4tHjo+1cIeDCZAuqBAKmeBGmJZA76lDs5Qu5nqfaixcOmfeVBEr29npJNg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/is-shallow-equal": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.12.0.tgz", - "integrity": "sha512-jlpHXPLJw0mG13bcbZIJwOd1DQozJ5+fbkkKA2JeTO5d5PXs44Rw6EYdGMLUU97B44UxIwVbaui7tJGOvzF8Dw==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - }, "@wordpress/priority-queue": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.12.0.tgz", - "integrity": "sha512-W/Foka//VcqY1D8fYXUE196tCm4ExH4qo6HFNyQU0VAwMI0ypKH+b9wgybfC7e+Hj2lTFZQVQOJgsGE/qZiufw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.14.0.tgz", + "integrity": "sha512-dXPsHqZQsI2xZ4WGq90iZLHliThbJI6+BF76YksLLYccaUW1LTzkQiEmub2pwdf9liMq/xocN07HdxMiI7HcRw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0" } }, "@wordpress/redux-routine": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.12.0.tgz", - "integrity": "sha512-PLheKMgvYcbOiQzwGQfpbdA04DGWTE08LSrkgM5VWJT8hcoS/RIWvxNph3MXSPx1lXLhN6d0CqjOSkuDI/xbfw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.14.0.tgz", + "integrity": "sha512-vgjR7i+2r69Dp16d11KTVdHEcQTjk7eq6SaUtva3YKs3s2e5CTjDcQKEafSzwWQo5OyHK+wkwnnIsjZ3He9anA==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", diff --git a/package.json b/package.json index 2cf6736dc..c5fde6757 100644 --- a/package.json +++ b/package.json @@ -56,9 +56,9 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "@types/wordpress__block-editor": "^7.0.0", - "@types/wordpress__components": "^19.10.0", + "@types/wordpress__components": "^19.10.1", "@wordpress/block-editor": "^9.4.0", - "@wordpress/components": "^19.14.0", + "@wordpress/components": "^19.16.0", "@wordpress/compose": "^5.10.0", "@wordpress/data": "^6.12.0", "@wordpress/dom-ready": "^3.14.0", From 680cd4edfcffadfd3a75794cba7308864da1e911 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 21:45:26 +0000 Subject: [PATCH 15/19] chore(deps-dev): bump @wordpress/data from 6.12.0 to 6.14.0 Bumps [@wordpress/data](https://github.com/WordPress/gutenberg/tree/HEAD/packages/data) from 6.12.0 to 6.14.0. - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/data/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/data@6.14.0/packages/data) --- updated-dependencies: - dependency-name: "@wordpress/data" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 123 ++++++++++++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 87 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 446e2df0e..d42b8b203 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4723,18 +4723,18 @@ } }, "@wordpress/data": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-6.12.0.tgz", - "integrity": "sha512-fnMfbYoGl3GqP7tDaArtRRizQznnh6cVT+tAZV8aDBICNkQ8za7BY+HcxEpviNb+JbHJJk6VEclaLjYhR3jLCQ==", + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-6.14.0.tgz", + "integrity": "sha512-m0SazQ6zlxRcm8iBcB/K06S4iCW+EZ1EXoEXILoaQ3AC2Kyibs262n/SSer8MRpPuwwOkpvS0ANgubT3MN/0SA==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/compose": "^5.10.0", - "@wordpress/deprecated": "^3.12.0", - "@wordpress/element": "^4.10.0", - "@wordpress/is-shallow-equal": "^4.12.0", - "@wordpress/priority-queue": "^2.12.0", - "@wordpress/redux-routine": "^4.12.0", + "@wordpress/compose": "^5.12.0", + "@wordpress/deprecated": "^3.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/is-shallow-equal": "^4.14.0", + "@wordpress/priority-queue": "^2.14.0", + "@wordpress/redux-routine": "^4.14.0", "equivalent-key-map": "^0.2.2", "is-promise": "^4.0.0", "lodash": "^4.17.21", @@ -4743,56 +4743,96 @@ "use-memo-one": "^1.1.1" }, "dependencies": { + "@wordpress/compose": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-5.12.0.tgz", + "integrity": "sha512-ohK+uxazOqWWZ2BUyVFeNDy5/RJasfsnrs00f9O0BohaGUM4bp5daEnYHPMdjUpvzRTDEviiX0IMIEnc97N+JQ==", + "dev": true, + "requires": { + "@babel/runtime": "^7.16.0", + "@types/lodash": "^4.14.172", + "@types/mousetrap": "^1.6.8", + "@wordpress/deprecated": "^3.14.0", + "@wordpress/dom": "^3.14.0", + "@wordpress/element": "^4.12.0", + "@wordpress/is-shallow-equal": "^4.14.0", + "@wordpress/keycodes": "^3.14.0", + "@wordpress/priority-queue": "^2.14.0", + "clipboard": "^2.0.8", + "lodash": "^4.17.21", + "mousetrap": "^1.6.5", + "use-memo-one": "^1.1.1" + } + }, "@wordpress/deprecated": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.12.0.tgz", - "integrity": "sha512-sep+c2jFwAZ4HTtPgIbNLC0YTz3q9gCH3A82XwY/krkvxhNk3g+mXxPUI2dUoxp7RAeeckqDtKosPvvpqUZWiQ==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.14.0.tgz", + "integrity": "sha512-Nvx2/sLjzeIcIAJTBwmYxJ1yKkWd+yfZze1bByPkhndo+y0ImNap3NUrl+inOgtNbZiVkj9QafmaCwaogjp9xQ==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.12.0" + "@wordpress/hooks": "^3.14.0" + } + }, + "@wordpress/dom": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.14.0.tgz", + "integrity": "sha512-U31BuODuyXsllErsURVITJNXdJGmoZoRWwnREOlxLfKZymmFFnNWvSJRqrB2ZLnUMc/qwQoX27LoK76CRl5vzQ==", + "dev": true, + "requires": { + "@babel/runtime": "^7.16.0", + "@wordpress/deprecated": "^3.8.0", + "lodash": "^4.17.21" } }, "@wordpress/element": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.10.0.tgz", - "integrity": "sha512-Ddi5nwd8/zPDITo2PCm30ffKxvbOEpW8krXzffnTace7TaqGzz7QuX6yOVdm6xXx3KZH/AADYPzCwthJKbKGEg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.12.0.tgz", + "integrity": "sha512-QdpqJpdspuqV5qLmoETjZB/kTVqL/wIRJrvfEXJ4ozgIrf9zQaxgiFxwImJ35oXH7HR1iRBd/YBRer/fC93oYw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.12.0", + "@wordpress/escape-html": "^2.14.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2" } }, - "@wordpress/escape-html": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.12.0.tgz", - "integrity": "sha512-kuLtqEOHSIu53+HwHjCiz8THXhnhqFwsfFgr4gkZmv4n4NxLmGsMV2kMMZlRjWbTUSP0YN7Dix4uHx8JWlIRGg==", + "@wordpress/hooks": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.14.0.tgz", + "integrity": "sha512-bcQXql4A1VI6gnTdNzMjdHLGTpnf8oWOQ1r8B8fcvtOF3dKictxJPobarWxFbtVTQoegizZT/lPCMoLsnVJpug==", "dev": true, "requires": { "@babel/runtime": "^7.16.0" } }, - "@wordpress/hooks": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.12.0.tgz", - "integrity": "sha512-DTf2VLBfrbuNQvBvz2m5Nbn44KEA4tHjo+1cIeDCZAuqBAKmeBGmJZA76lDs5Qu5nqfaixcOmfeVBEr29npJNg==", + "@wordpress/i18n": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.14.0.tgz", + "integrity": "sha512-46ryvPbh139RkLXQt8oey4aCcWo6HRKb1NLVHU4a4kJ4HRD/HLhAeTHKAMiZFWTg+QC1HZC32vGdEikqrpnlzQ==", "dev": true, "requires": { - "@babel/runtime": "^7.16.0" + "@babel/runtime": "^7.16.0", + "@wordpress/hooks": "^3.14.0", + "gettext-parser": "^1.3.1", + "lodash": "^4.17.21", + "memize": "^1.1.0", + "sprintf-js": "^1.1.1", + "tannin": "^1.2.0" } }, - "@wordpress/is-shallow-equal": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.12.0.tgz", - "integrity": "sha512-jlpHXPLJw0mG13bcbZIJwOd1DQozJ5+fbkkKA2JeTO5d5PXs44Rw6EYdGMLUU97B44UxIwVbaui7tJGOvzF8Dw==", + "@wordpress/keycodes": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/keycodes/-/keycodes-3.14.0.tgz", + "integrity": "sha512-hUHRMCWil4eKauzCWtYSry8i1wxa1cegUqjZ3OASzefZvCrMv6TNuRXohp+hNLWGWWMbP0I2Pcrd0WuGcmlSqg==", "dev": true, "requires": { - "@babel/runtime": "^7.16.0" + "@babel/runtime": "^7.16.0", + "@wordpress/i18n": "^4.14.0", + "lodash": "^4.17.21" } } } @@ -5006,6 +5046,15 @@ } } }, + "@wordpress/is-shallow-equal": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.14.0.tgz", + "integrity": "sha512-FVpuU3GmvZFvjcuIKcraNH46vEZzz+FCpujjqCzcyWNGUsg7wpfGNVoDWs5LWFA4EELHL2+p8Ff9RZX237b5Kg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.16.0" + } + }, "@wordpress/jest-console": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@wordpress/jest-console/-/jest-console-5.0.2.tgz", @@ -5448,18 +5497,18 @@ } }, "@wordpress/priority-queue": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.12.0.tgz", - "integrity": "sha512-W/Foka//VcqY1D8fYXUE196tCm4ExH4qo6HFNyQU0VAwMI0ypKH+b9wgybfC7e+Hj2lTFZQVQOJgsGE/qZiufw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/priority-queue/-/priority-queue-2.14.0.tgz", + "integrity": "sha512-dXPsHqZQsI2xZ4WGq90iZLHliThbJI6+BF76YksLLYccaUW1LTzkQiEmub2pwdf9liMq/xocN07HdxMiI7HcRw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0" } }, "@wordpress/redux-routine": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.12.0.tgz", - "integrity": "sha512-PLheKMgvYcbOiQzwGQfpbdA04DGWTE08LSrkgM5VWJT8hcoS/RIWvxNph3MXSPx1lXLhN6d0CqjOSkuDI/xbfw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@wordpress/redux-routine/-/redux-routine-4.14.0.tgz", + "integrity": "sha512-vgjR7i+2r69Dp16d11KTVdHEcQTjk7eq6SaUtva3YKs3s2e5CTjDcQKEafSzwWQo5OyHK+wkwnnIsjZ3He9anA==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", diff --git a/package.json b/package.json index 2cf6736dc..73478b7cc 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@wordpress/block-editor": "^9.4.0", "@wordpress/components": "^19.14.0", "@wordpress/compose": "^5.10.0", - "@wordpress/data": "^6.12.0", + "@wordpress/data": "^6.14.0", "@wordpress/dom-ready": "^3.14.0", "@wordpress/element": "^4.10.0", "@wordpress/scripts": "^22.5.0", From a673b758bd6039e778c0f81f66d901a8bf94fe0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 21:47:16 +0000 Subject: [PATCH 16/19] chore(deps-dev): bump @wordpress/element from 4.10.0 to 4.12.0 Bumps [@wordpress/element](https://github.com/WordPress/gutenberg/tree/HEAD/packages/element) from 4.10.0 to 4.12.0. - [Release notes](https://github.com/WordPress/gutenberg/releases) - [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/element/CHANGELOG.md) - [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/element@4.12.0/packages/element) --- updated-dependencies: - dependency-name: "@wordpress/element" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 19 ++++--------------- package.json | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 446e2df0e..e94dbbd41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4849,29 +4849,18 @@ } }, "@wordpress/element": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.10.0.tgz", - "integrity": "sha512-Ddi5nwd8/zPDITo2PCm30ffKxvbOEpW8krXzffnTace7TaqGzz7QuX6yOVdm6xXx3KZH/AADYPzCwthJKbKGEg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.12.0.tgz", + "integrity": "sha512-QdpqJpdspuqV5qLmoETjZB/kTVqL/wIRJrvfEXJ4ozgIrf9zQaxgiFxwImJ35oXH7HR1iRBd/YBRer/fC93oYw==", "dev": true, "requires": { "@babel/runtime": "^7.16.0", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.12.0", + "@wordpress/escape-html": "^2.14.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2" - }, - "dependencies": { - "@wordpress/escape-html": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-2.12.0.tgz", - "integrity": "sha512-kuLtqEOHSIu53+HwHjCiz8THXhnhqFwsfFgr4gkZmv4n4NxLmGsMV2kMMZlRjWbTUSP0YN7Dix4uHx8JWlIRGg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.16.0" - } - } } }, "@wordpress/escape-html": { diff --git a/package.json b/package.json index 2cf6736dc..3b48fe5e3 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "@wordpress/compose": "^5.10.0", "@wordpress/data": "^6.12.0", "@wordpress/dom-ready": "^3.14.0", - "@wordpress/element": "^4.10.0", + "@wordpress/element": "^4.12.0", "@wordpress/scripts": "^22.5.0", "conventional-changelog-simple-preset": "^1.0.20", "eslint-config-wordpress": "^2.0.0", From c2cefb627ae4d09f871011c48a8a88edc1e0b56e Mon Sep 17 00:00:00 2001 From: Soare Robert Daniel Date: Wed, 3 Aug 2022 15:07:30 +0300 Subject: [PATCH 17/19] fix: value inheritance & cleaning --- src/blocks/blocks/section/column/inspector.js | 19 ++++++++++--------- .../blocks/section/columns/inspector.js | 16 ++++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/blocks/blocks/section/column/inspector.js b/src/blocks/blocks/section/column/inspector.js index 300b6eb90..1a40ca272 100644 --- a/src/blocks/blocks/section/column/inspector.js +++ b/src/blocks/blocks/section/column/inspector.js @@ -39,7 +39,7 @@ import ResponsiveControl from '../../../components/responsive-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import ControlPanelControl from '../../../components/control-panel-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject } from '../../../helpers/helper-functions.js'; +import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; /** * @@ -90,13 +90,14 @@ const Inspector = ({ }; const getPadding = () => { + console.log({ getView }); switch ( getView ) { case 'Desktop': return getValue( 'padding' ); case 'Tablet': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ) ); + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ) ); case 'Mobile': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ); + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ); default: return undefined; } @@ -111,9 +112,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ padding: value }); case 'Tablet': - return setAttributes({ paddingTablet: value }); + return setAttributes({ paddingTablet: removeBoxDefaultValues( value, attributes.padding ) }); case 'Mobile': - return setAttributes({ paddingMobile: value }); + return setAttributes({ paddingMobile: removeBoxDefaultValues( value, { ...attributes.padding, ...attributes.paddingTablet }) }); default: return undefined; } @@ -137,9 +138,9 @@ const Inspector = ({ case 'Desktop': return getValue( 'margin' ); case 'Tablet': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ) ); case 'Mobile': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); default: return undefined; } @@ -154,9 +155,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ margin: value }); case 'Tablet': - return setAttributes({ marginTablet: value }); + return setAttributes({ marginTablet: removeBoxDefaultValues( value, attributes.margin ) }); case 'Mobile': - return setAttributes({ marginMobile: value }); + return setAttributes({ marginMobile: removeBoxDefaultValues( value, { ...attributes.margin, ...attributes.marginTablet }) }); default: return undefined; } diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js index e54d156ae..f237ce93e 100644 --- a/src/blocks/blocks/section/columns/inspector.js +++ b/src/blocks/blocks/section/columns/inspector.js @@ -131,9 +131,9 @@ const Inspector = ({ case 'Desktop': return getValue( 'padding' ); case 'Tablet': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ) ); + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ) ); case 'Mobile': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ) ; + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ) ; default: return undefined; } @@ -148,9 +148,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ padding: value }); case 'Tablet': - return setAttributes({ paddingTablet: value }); + return setAttributes({ paddingTablet: removeBoxDefaultValues( value, attributes.padding ) }); case 'Mobile': - return setAttributes({ paddingMobile: value }); + return setAttributes({ paddingMobile: removeBoxDefaultValues( value, { ...attributes.padding, ...attributes.paddingTablet }) }); default: return undefined; } @@ -174,9 +174,9 @@ const Inspector = ({ case 'Desktop': return getValue( 'margin' ); case 'Tablet': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ) ); case 'Mobile': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); default: return undefined; } @@ -197,9 +197,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ margin: value }); case 'Tablet': - return setAttributes({ marginTablet: value }); + return setAttributes({ marginTablet: removeBoxDefaultValues( value, attributes.margin ) }); case 'Mobile': - return setAttributes({ marginMobile: value }); + return setAttributes({ marginMobile: removeBoxDefaultValues( value, { ...attributes.margin, ...attributes.marginTablet }) }); default: return undefined; } From 29484c7777dfae4580df2e357b1f79ba43ffc725 Mon Sep 17 00:00:00 2001 From: Soare Robert Daniel Date: Thu, 4 Aug 2022 10:24:26 +0300 Subject: [PATCH 18/19] feat: add missing import --- src/blocks/blocks/section/columns/inspector.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js index f237ce93e..a446fa967 100644 --- a/src/blocks/blocks/section/columns/inspector.js +++ b/src/blocks/blocks/section/columns/inspector.js @@ -44,7 +44,7 @@ import ControlPanelControl from '../../../components/control-panel-control/index import HTMLAnchorControl from '../../../components/html-anchor-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject } from '../../../helpers/helper-functions.js'; +import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; import ToogleGroupControl from '../../../components/toogle-group-control/index.js'; /** @@ -187,8 +187,6 @@ const Inspector = ({ value = undefined; } - console.log( value ); - if ( 'object' === typeof value ) { value = Object.fromEntries( Object.entries( value ).filter( ([ _, v ]) => null !== v ) ); } From 2c02f4c0987204dbd18e7c8e0ee2447c6ee7efb3 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Thu, 4 Aug 2022 22:01:24 +0530 Subject: [PATCH 19/19] Minor fixes --- inc/class-pro.php | 4 ++++ src/blocks/blocks/section/column/inspector.js | 6 ++++-- src/blocks/blocks/section/columns/inspector.js | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/inc/class-pro.php b/inc/class-pro.php index 833c8a32b..af010a25b 100644 --- a/inc/class-pro.php +++ b/inc/class-pro.php @@ -107,6 +107,10 @@ public static function get_docs_url() { public static function should_show_upsell() { $show_upsell = false; + if ( defined( 'OTTER_PRO_VERSION' ) ) { + return $show_upsell; + } + $installed = get_option( 'otter_blocks_install' ); $notifications = get_option( 'themeisle_blocks_settings_notifications', array() ); diff --git a/src/blocks/blocks/section/column/inspector.js b/src/blocks/blocks/section/column/inspector.js index 1a40ca272..ab0ef2b87 100644 --- a/src/blocks/blocks/section/column/inspector.js +++ b/src/blocks/blocks/section/column/inspector.js @@ -39,7 +39,10 @@ import ResponsiveControl from '../../../components/responsive-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import ControlPanelControl from '../../../components/control-panel-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; +import { + isNullObject, + removeBoxDefaultValues +} from '../../../helpers/helper-functions.js'; /** * @@ -90,7 +93,6 @@ const Inspector = ({ }; const getPadding = () => { - console.log({ getView }); switch ( getView ) { case 'Desktop': return getValue( 'padding' ); diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js index a446fa967..9bb5c08e9 100644 --- a/src/blocks/blocks/section/columns/inspector.js +++ b/src/blocks/blocks/section/columns/inspector.js @@ -44,7 +44,10 @@ import ControlPanelControl from '../../../components/control-panel-control/index import HTMLAnchorControl from '../../../components/html-anchor-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; +import { + isNullObject, + removeBoxDefaultValues +} from '../../../helpers/helper-functions.js'; import ToogleGroupControl from '../../../components/toogle-group-control/index.js'; /**