Skip to content

Commit

Permalink
Merge branch 'trunk' into update/enqueue-scripts-to-use-plugins-url
Browse files Browse the repository at this point in the history
  • Loading branch information
SohamPatel46 authored Dec 19, 2024
2 parents fe7e81e + c446d8c commit eba1933
Show file tree
Hide file tree
Showing 38 changed files with 214 additions and 119 deletions.
4 changes: 2 additions & 2 deletions plugins/auto-sizes/auto-sizes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Improves responsive images with better sizes calculations and auto-sizes for lazy-loaded images.
* Requires at least: 6.6
* Requires PHP: 7.2
* Version: 1.3.0
* Version: 1.4.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand All @@ -25,7 +25,7 @@
return;
}

define( 'IMAGE_AUTO_SIZES_VERSION', '1.3.0' );
define( 'IMAGE_AUTO_SIZES_VERSION', '1.4.0' );

require_once __DIR__ . '/includes/auto-sizes.php';
require_once __DIR__ . '/includes/improve-calculate-sizes.php';
Expand Down
2 changes: 1 addition & 1 deletion plugins/auto-sizes/includes/auto-sizes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Functionality to implement auto-sizes for lazy loaded images.
*
* @package auto-sizes
* @since n.e.x.t
* @since 1.4.0
*/

/**
Expand Down
12 changes: 6 additions & 6 deletions plugins/auto-sizes/includes/improve-calculate-sizes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* Functionality to improve the calculation of image `sizes` attributes.
*
* @package auto-sizes
* @since n.e.x.t
* @since 1.4.0
*/

/**
* Primes attachment into the cache with a single database query.
*
* @since n.e.x.t
* @since 1.4.0
*
* @param string|mixed $content The HTML content.
* @return string The HTML content.
Expand Down Expand Up @@ -130,7 +130,7 @@ function auto_sizes_filter_image_tag( $content, array $parsed_block, WP_Block $b
/**
* Modifies the sizes attribute of an image based on layout context.
*
* @since n.e.x.t
* @since 1.4.0
*
* @param int $id The image attachment post ID.
* @param string|array{int, int} $size Image size name or array of width and height.
Expand Down Expand Up @@ -228,7 +228,7 @@ function auto_sizes_calculate_better_sizes( int $id, $size, string $align, int $
/**
* Retrieves the layout width for an alignment defined in theme.json.
*
* @since n.e.x.t
* @since 1.4.0
*
* @param string $alignment The alignment value.
* @return string The alignment width based.
Expand All @@ -248,7 +248,7 @@ function auto_sizes_get_layout_width( string $alignment ): string {
/**
* Filters the context keys that a block type uses.
*
* @since n.e.x.t
* @since 1.4.0
*
* @param string[] $uses_context Array of registered uses context for a block type.
* @param WP_Block_Type $block_type The full block type object.
Expand All @@ -271,7 +271,7 @@ function auto_sizes_filter_uses_context( array $uses_context, WP_Block_Type $blo
/**
* Modifies the block context during rendering to blocks.
*
* @since n.e.x.t
* @since 1.4.0
*
* @param array<string, mixed> $context Current block context.
* @param array<string, mixed> $block The block being rendered.
Expand Down
19 changes: 18 additions & 1 deletion plugins/auto-sizes/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 1.3.0
Stable tag: 1.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, images, auto-sizes
Expand Down Expand Up @@ -52,6 +52,23 @@ Contributions are always welcome! Learn more about how to get involved in the [C

== Changelog ==

= 1.4.0 =

**Features**

* Accurate Sizes: Incorporate layout constraints in image sizes calculations. ([1738](https://github.com/WordPress/performance/pull/1738))

**Enhancements**

* Accurate sizes: Pass parent alignment context to images. ([1701](https://github.com/WordPress/performance/pull/1701))
* Accurate sizes: Reorganize file structure by feature. ([1699](https://github.com/WordPress/performance/pull/1699))
* Accurate sizes: Support relative alignment widths. ([1737](https://github.com/WordPress/performance/pull/1737))
* Remove `auto_sizes_get_layout_settings()`. ([1743](https://github.com/WordPress/performance/pull/1743))

**Bug Fixes**

* Accurate sizes: Disable layout calculations for classic themes. ([1744](https://github.com/WordPress/performance/pull/1744))

= 1.3.0 =

**Enhancements**
Expand Down
19 changes: 11 additions & 8 deletions plugins/dominant-color-images/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function dominant_color_render_generator(): void {
* to apply background color based on the dominant color for attachment previews
* in the WordPress admin interface.
*
* @since n.e.x.t
* @since 1.2.0
*/
function dominant_color_admin_inline_style(): void {
$handle = 'dominant-color-admin-styles';
Expand All @@ -213,7 +213,7 @@ function dominant_color_admin_inline_style(): void {
* the attachment template. It adds attributes for dominant color and transparency
* to the template, allowing these properties to be displayed in the media library.
*
* @since n.e.x.t
* @since 1.2.0
* @see wp_print_media_templates()
*/
function dominant_color_admin_script(): void {
Expand Down Expand Up @@ -249,17 +249,20 @@ function dominant_color_admin_script(): void {
* the dominant color and transparency of the image. It modifies the response array to include
* these additional properties, which can be used in the media library interface.
*
* @since n.e.x.t
* @since 1.2.0
*
* @param array<mixed>|mixed $response The current response array for the attachment.
* @param WP_Post $attachment The attachment post object.
* @param array<mixed> $meta The attachment metadata.
* @return array<mixed> The modified response array with added dominant color and transparency information.
* @param array<string, mixed>|mixed $response The current response array for the attachment.
* @param WP_Post $attachment The attachment post object.
* @param array<string, mixed>|false $meta The attachment metadata.
* @return array<string, mixed> The modified response array with added dominant color and transparency information.
*/
function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, array $meta ): array {
function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, $meta ): array {
if ( ! is_array( $response ) ) {
$response = array();
}
if ( ! is_array( $meta ) ) {
return $response;
}

$response['dominantColor'] = '';
if (
Expand Down
4 changes: 2 additions & 2 deletions plugins/dominant-color-images/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Displays placeholders based on an image's dominant color while the image is loading.
* Requires at least: 6.6
* Requires PHP: 7.2
* Version: 1.1.2
* Version: 1.2.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand All @@ -25,7 +25,7 @@
return;
}

define( 'DOMINANT_COLOR_IMAGES_VERSION', '1.1.2' );
define( 'DOMINANT_COLOR_IMAGES_VERSION', '1.2.0' );

require_once __DIR__ . '/helper.php';
require_once __DIR__ . '/hooks.php';
8 changes: 7 additions & 1 deletion plugins/dominant-color-images/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 1.1.2
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, images, dominant color
Expand Down Expand Up @@ -47,6 +47,12 @@ Contributions are always welcome! Learn more about how to get involved in the [C

== Changelog ==

= 1.2.0 =

**Enhancements**

* Enhance admin media UI with dominant color support. ([1719](https://github.com/WordPress/performance/pull/1719))

= 1.1.2 =

**Enhancements**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private function is_embed_wrapper( OD_HTML_Tag_Processor $processor ): bool {
* Otherwise, if the embed is not in any initial viewport, it will add lazy-loading logic.
*
* @since 0.2.0
* @since n.e.x.t Adds preconnect links for each viewport group and skips if the element is not in the viewport for that group.
* @since 0.4.0 Adds preconnect links for each viewport group and skips if the element is not in the viewport for that group.
*
* @param OD_Tag_Visitor_Context $context Tag visitor context.
* @return bool Whether the tag should be tracked in URL Metrics.
Expand Down
2 changes: 1 addition & 1 deletion plugins/embed-optimizer/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function embed_optimizer_render_generator(): void {
/**
* Gets the path to a script or stylesheet.
*
* @since n.e.x.t
* @since 0.4.0
*
* @param string $src_path Source path, relative to plugin root.
* @param string|null $min_path Minified path. If not supplied, then '.min' is injected before the file extension in the source path.
Expand Down
4 changes: 2 additions & 2 deletions plugins/embed-optimizer/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Optimizes the performance of embeds through lazy-loading, preconnecting, and reserving space to reduce layout shifts.
* Requires at least: 6.6
* Requires PHP: 7.2
* Version: 0.3.0
* Version: 0.4.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand Down Expand Up @@ -70,7 +70,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
}
)(
'embed_optimizer_pending_plugin',
'0.3.0',
'0.4.0',
static function ( string $version ): void {
if ( defined( 'EMBED_OPTIMIZER_VERSION' ) ) {
return;
Expand Down
9 changes: 8 additions & 1 deletion plugins/embed-optimizer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 0.3.0
Stable tag: 0.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, embeds
Expand Down Expand Up @@ -67,6 +67,13 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= 0.4.0 =

**Enhancements**

* Incorporate media queries into preconnect links to account for whether embeds are in viewport. ([1654](https://github.com/WordPress/performance/pull/1654))
* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))

= 0.3.0 =

**Enhancements**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ final class Image_Prioritizer_Background_Image_Styled_Tag_Visitor extends Image_
/**
* Class name used to indicate a background image which is lazy-loaded.
*
* @since n.e.x.t
* @since 0.3.0
* @var string
*/
const LAZY_BG_IMAGE_CLASS_NAME = 'od-lazy-bg-image';

/**
* Whether the lazy-loading script and stylesheet have been added.
*
* @since n.e.x.t
* @since 0.3.0
* @var bool
*/
private $added_lazy_assets = false;

/**
* Tuples of URL Metric group and the common LCP element external background image.
*
* @since n.e.x.t
* @since 0.3.0
* @var array<array{OD_URL_Metric_Group, LcpElementExternalBackgroundImage}>
*/
private $group_common_lcp_element_external_background_images;
Expand Down Expand Up @@ -99,7 +99,7 @@ public function __invoke( OD_Tag_Visitor_Context $context ): bool {
/**
* Gets the common LCP element external background image for a URL Metric group.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_URL_Metric_Group $group Group.
* @return LcpElementExternalBackgroundImage|null
Expand Down Expand Up @@ -135,7 +135,7 @@ private function get_common_lcp_element_external_background_image( OD_URL_Metric
/**
* Maybe preloads external background image.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_Tag_Visitor_Context $context Context.
*/
Expand Down Expand Up @@ -182,7 +182,7 @@ private function maybe_preload_external_lcp_background_image( OD_Tag_Visitor_Con
/**
* Adds an image preload link for the group.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_Link_Collection $link_collection Link collection.
* @param OD_URL_Metric_Group $group URL Metric group.
Expand All @@ -205,7 +205,7 @@ private function add_image_preload_link( OD_Link_Collection $link_collection, OD
/**
* Optimizes an element with a background image based on whether it is displayed in any initial viewport.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_Tag_Visitor_Context $context Tag visitor context, with the cursor currently at block with a background image.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class Image_Prioritizer_Img_Tag_Visitor extends Image_Prioritizer_Tag_Visi
* Visits a tag.
*
* @since 0.1.0
* @since n.e.x.t Separate the processing of IMG and PICTURE elements.
* @since 0.3.0 Separate the processing of IMG and PICTURE elements.
*
* @param OD_Tag_Visitor_Context $context Tag visitor context.
* @return bool Whether the tag should be tracked in URL Metrics.
Expand All @@ -46,7 +46,7 @@ public function __invoke( OD_Tag_Visitor_Context $context ): bool {
/**
* Process an IMG element.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_HTML_Tag_Processor $processor HTML tag processor.
* @param OD_Tag_Visitor_Context $context Tag visitor context.
Expand Down Expand Up @@ -183,7 +183,7 @@ private function process_img( OD_HTML_Tag_Processor $processor, OD_Tag_Visitor_C
/**
* Process a PICTURE element.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_HTML_Tag_Processor $processor HTML tag processor.
* @param OD_Tag_Visitor_Context $context Tag visitor context.
Expand Down Expand Up @@ -283,7 +283,7 @@ private function process_picture( OD_HTML_Tag_Processor $processor, OD_Tag_Visit
* Returns null if the src attribute is not a string (i.e. src was used as a boolean attribute was used), if it
* it has an empty string value after trimming, or if it is a data: URL.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_HTML_Tag_Processor $processor Processor.
* @param 'src'|'srcset' $attribute_name Attribute name.
Expand All @@ -304,7 +304,7 @@ private function get_valid_src( OD_HTML_Tag_Processor $processor, string $attrib
/**
* Adds a LINK with the supplied attributes for each viewport group when the provided XPath is the LCP element.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_Tag_Visitor_Context $context Tag visitor context.
* @param string $xpath XPath of the element.
Expand Down Expand Up @@ -351,7 +351,7 @@ static function ( $attribute_value ) {
/**
* Gets the parent tag name.
*
* @since n.e.x.t
* @since 0.3.0
*
* @param OD_Tag_Visitor_Context $context Tag visitor context.
* @return string|null The parent tag name or null if not found.
Expand Down
Loading

0 comments on commit eba1933

Please sign in to comment.