Skip to content

Commit

Permalink
prep build 01/02
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Jan 2, 2023
2 parents e7b1866 + 6f6ace0 commit 5bcb24d
Show file tree
Hide file tree
Showing 241 changed files with 903 additions and 296 deletions.
66 changes: 66 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,71 @@
== Changelog ==

= 14.8.4 =



## Changelog

### Various

- Fixes an issue where gutenberg bundled `theme.json` was not utilized. ([46810](https://github.com/WordPress/gutenberg/pull/46810)) This meant that Gutenberg features newer than the WordPress `theme.json` file were unavailable in 14.8.

## Contributors

The following contributors merged PRs in this release:

@madhusudhand


= 14.8.3 =



## Changelog

### Bug Fixes

#### Plugin
Fixes compatibility with WordPress 6.0.x. This includes the following PRs:
- #46579
- #46750
- #46806
- #46809

Broadly, this needed to include the two refactors of the Theme_JSON compatibility files, along with two fixes switching `wp_*` and `gutenberg_*` function variants as needed.

## Contributors

The following contributors were involved with this release:

@geriux @Mamaduka @oandregal @noahtallen


= 14.8.2 =



## Changelog

### Bug Fixes

#### Block Editor
- rich-text: Fix bug where bare tag name format types could not be registered. ([46798](https://github.com/WordPress/gutenberg/pull/46798))


## First time contributors

The following PRs were merged by first time contributors:



## Contributors

The following contributors merged PRs in this release:

@davilera


= 14.8.1 =

## Changelog
Expand Down
2 changes: 2 additions & 0 deletions docs/reference-guides/block-api/block-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ _Note:_

`register_block_pattern_category()` should be called from a handler attached to the init hook.

The category will not show under Patterns unless a pattern has been assigned to that category.

```php
function my_plugin_register_my_pattern_categories() {
register_block_pattern_category( ... );
Expand Down
10 changes: 10 additions & 0 deletions docs/reference-guides/theme-json-reference/theme-json-living.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ Settings related to borders.

---

### shadow

Settings related to shadows.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| palette | array | | name, shadow, slug |

---

### color

Settings related to colors.
Expand Down
17 changes: 15 additions & 2 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes).
* This is a low-level API that may need to do breaking changes. Please,
* use get_global_settings, get_global_styles, and get_global_stylesheet instead.
* use gutenberg_get_global_settings, gutenberg_get_global_styles, and gutenberg_get_global_stylesheet instead.
*
* @access private
*/
Expand Down Expand Up @@ -117,6 +117,15 @@ class WP_Theme_JSON_Gutenberg {
* @var array
*/
const PRESETS_METADATA = array(
array(
'path' => array( 'shadow', 'palette' ),
'prevent_override' => array( 'shadow', 'defaultPalette' ),
'use_default_names' => false,
'value_key' => 'shadow',
'css_vars' => '--wp--preset--shadow--$slug',
'classes' => array(),
'properties' => array( 'box-shadow' ),
),
array(
'path' => array( 'color', 'palette' ),
'prevent_override' => array( 'color', 'defaultPalette' ),
Expand Down Expand Up @@ -333,6 +342,10 @@ class WP_Theme_JSON_Gutenberg {
'style' => null,
'width' => null,
),
'shadow' => array(
'palette' => null,
'defaultPalette' => null,
),
'color' => array(
'background' => null,
'custom' => null,
Expand Down Expand Up @@ -1806,7 +1819,7 @@ protected static function compute_style_properties( $styles, $settings = array()
* Values that already have a clamp() function will not pass the test,
* and therefore the original $value will be returned.
*/
$value = wp_get_typography_font_size_value( array( 'size' => $value ) );
$value = gutenberg_get_typography_font_size_value( array( 'size' => $value ) );
}

$declarations[] = array(
Expand Down
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes).
* This is a low-level API that may need to do breaking changes. Please,
* use get_global_settings, get_global_styles, and get_global_stylesheet instead.
* use gutenberg_get_global_settings, gutenberg_get_global_styles, and gutenberg_get_global_stylesheet instead.
*
* @access private
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,55 @@ private function validate_custom_css( $css ) {
}
return true;
}

/**
* Returns the given theme global styles config.
* Duplicated from core.
* The only change is that we call WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( 'theme' ) instead of WP_Theme_JSON_Resolver::get_merged_data( 'theme' ).
*
* @since 6.2.0
*
* @param WP_REST_Request $request The request instance.
* @return WP_REST_Response|WP_Error
*/
public function get_theme_item( $request ) {
if ( get_stylesheet() !== $request['stylesheet'] ) {
// This endpoint only supports the active theme for now.
return new WP_Error(
'rest_theme_not_found',
__( 'Theme not found.', 'gutenberg' ),
array( 'status' => 404 )
);
}

$theme = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( 'theme' );
$data = array();
$fields = $this->get_fields_for_response( $request );

if ( rest_is_field_included( 'settings', $fields ) ) {
$data['settings'] = $theme->get_settings();
}

if ( rest_is_field_included( 'styles', $fields ) ) {
$raw_data = $theme->get_raw_data();
$data['styles'] = isset( $raw_data['styles'] ) ? $raw_data['styles'] : array();
}

$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );

$response = rest_ensure_response( $data );

if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
$links = array(
'self' => array(
'href' => rest_url( sprintf( '%s/%s/themes/%s', $this->namespace, $this->rest_base, $request['stylesheet'] ) ),
),
);
$response->add_links( $links );
}

return $response;
}
}
9 changes: 5 additions & 4 deletions lib/compat/wordpress-6.2/get-global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ function wp_theme_has_theme_json_clean_cache() {
* Returns the stylesheet resulting of merging core, theme, and user data.
*
* @param array $types Types of styles to load. Optional.
* It accepts 'variables', 'styles', 'presets', 'custom-css' as values.
* If empty, it'll load all for themes with theme.json support
* and only [ 'variables', 'presets' ] for themes without theme.json support.
* It accepts as values: 'variables', 'presets', 'styles', 'base-layout-styles, and 'custom-css'.
* If empty, it'll load the following:
* - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'.
* - for temes with theme.json: 'variables', 'presets', 'styles', 'custom-css'.
*
* @return string Stylesheet.
*/
Expand All @@ -85,7 +86,7 @@ function gutenberg_get_global_stylesheet( $types = array() ) {
if ( empty( $types ) && ! $supports_theme_json ) {
$types = array( 'variables', 'presets', 'base-layout-styles' );
} elseif ( empty( $types ) ) {
$types = array( 'variables', 'styles', 'presets', 'custom-css' );
$types = array( 'variables', 'presets', 'styles', 'custom-css' );
}

/*
Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/block-editor-settings-mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function gutenberg_get_block_editor_settings_mobile( $settings ) {
'mobile' === $_GET['context']
) {
if ( wp_theme_has_theme_json() ) {
$settings['__experimentalStyles'] = gutenberg_get_global_styles();
$settings['__experimentalStyles'] = wp_get_global_styles();
}

// To tell mobile that the site uses quote v2 (inner blocks).
Expand Down
41 changes: 35 additions & 6 deletions lib/experimental/html/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,9 +1059,19 @@ private function parse_next_attribute() {
return true;
}

/**
* > There must never be two or more attributes on
* > the same start tag whose names are an ASCII
* > case-insensitive match for each other.
* - HTML 5 spec
*
* @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2:ascii-case-insensitive
*/
$comparable_name = strtolower( $attribute_name );

// If an attribute is listed many times, only use the first declaration and ignore the rest.
if ( ! array_key_exists( $attribute_name, $this->attributes ) ) {
$this->attributes[ $attribute_name ] = new WP_HTML_Attribute_Token(
if ( ! array_key_exists( $comparable_name, $this->attributes ) ) {
$this->attributes[ $comparable_name ] = new WP_HTML_Attribute_Token(
$attribute_name,
$value_start,
$value_length,
Expand All @@ -1071,7 +1081,7 @@ private function parse_next_attribute() {
);
}

return $this->attributes[ $attribute_name ];
return $this->attributes[ $comparable_name ];
}

/**
Expand Down Expand Up @@ -1529,7 +1539,17 @@ public function set_attribute( $name, $value ) {
$updated_attribute = "{$name}=\"{$escaped_new_value}\"";
}

if ( isset( $this->attributes[ $name ] ) ) {
/**
* > There must never be two or more attributes on
* > the same start tag whose names are an ASCII
* > case-insensitive match for each other.
* - HTML 5 spec
*
* @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2:ascii-case-insensitive
*/
$comparable_name = strtolower( $name );

if ( isset( $this->attributes[ $comparable_name ] ) ) {
/*
* Update an existing attribute.
*
Expand All @@ -1541,7 +1561,7 @@ public function set_attribute( $name, $value ) {
*
* Result: <div id="new"/>
*/
$existing_attribute = $this->attributes[ $name ];
$existing_attribute = $this->attributes[ $comparable_name ];
$this->attribute_updates[ $name ] = new WP_HTML_Text_Replacement(
$existing_attribute->start,
$existing_attribute->end,
Expand All @@ -1559,7 +1579,7 @@ public function set_attribute( $name, $value ) {
*
* Result: <div id="new"/>
*/
$this->attribute_updates[ $name ] = new WP_HTML_Text_Replacement(
$this->attribute_updates[ $comparable_name ] = new WP_HTML_Text_Replacement(
$this->tag_name_starts_at + $this->tag_name_length,
$this->tag_name_starts_at + $this->tag_name_length,
' ' . $updated_attribute
Expand All @@ -1575,6 +1595,15 @@ public function set_attribute( $name, $value ) {
* @param string $name The attribute name to remove.
*/
public function remove_attribute( $name ) {
/**
* > There must never be two or more attributes on
* > the same start tag whose names are an ASCII
* > case-insensitive match for each other.
* - HTML 5 spec
*
* @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2:ascii-case-insensitive
*/
$name = strtolower( $name );
if ( $this->is_closing_tag || ! isset( $this->attributes[ $name ] ) ) {
return false;
}
Expand Down
14 changes: 14 additions & 0 deletions lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@
],
"text": true
},
"shadow": {
"palette": [
{
"name": "Natural",
"slug": "natural",
"shadow": "0 .2rem .3rem 0 rgba(0,0,0, 0.3), 0 .5rem .6rem 0 rgba(0,0,0, 0.4)"
},
{
"name": "Sharp",
"slug": "sharp",
"shadow": ".5rem .5rem 0 0 rgba(0,0,0, 0.4)"
}
]
},
"layout": {
"definitions": {
"default": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
"version": "14.8.1",
"version": "14.9.0-rc.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
4 changes: 4 additions & 0 deletions packages/a11y/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 3.24.0 (2023-01-02)

## 3.23.0 (2022-12-14)

## 3.22.0 (2022-11-16)

## 3.21.0 (2022-11-02)
Expand Down
2 changes: 1 addition & 1 deletion packages/a11y/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/a11y",
"version": "3.22.0",
"version": "3.24.0",
"description": "Accessibility (a11y) utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
4 changes: 4 additions & 0 deletions packages/annotations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 2.24.0 (2023-01-02)

## 2.23.0 (2022-12-14)

## 2.22.0 (2022-11-16)

## 2.21.0 (2022-11-02)
Expand Down
2 changes: 1 addition & 1 deletion packages/annotations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/annotations",
"version": "2.22.0",
"version": "2.24.0",
"description": "Annotate content in the Gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
Loading

0 comments on commit 5bcb24d

Please sign in to comment.