Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/trunk' into update/convert-fac…
Browse files Browse the repository at this point in the history
…tory.js-in-data-package-to-TS
  • Loading branch information
manzoorwanijk committed Nov 6, 2024
2 parents 4a2488c + 7ff7679 commit 78b4875
Show file tree
Hide file tree
Showing 177 changed files with 2,691 additions and 835 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ jobs:
- name: Gradle cache
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0

- name: AVD cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
arch: x86_64
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."
# AVD cache disabled as it caused emulator termination to hang indefinitely.
# https://github.com/ReactiveCircus/android-emulator-runner/issues/385
# - name: AVD cache
# uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-${{ matrix.api-level }}
#
# - name: Create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
# with:
# api-level: ${{ matrix.api-level }}
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# arch: x86_64
# profile: Nexus 6
# script: echo "Generated AVD snapshot for caching."

- name: Run tests
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
Expand Down
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7069.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7069

* https://github.com/WordPress/gutenberg/pull/63401
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7698.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7698

* https://github.com/WordPress/gutenberg/pull/66662
24 changes: 12 additions & 12 deletions lib/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ function gutenberg_register_typography_support( $block_type ) {
return;
}

$has_font_family_support = $typography_supports['__experimentalFontFamily'] ?? false;
$has_font_family_support = $typography_supports['fontFamily'] ?? false;
$has_font_size_support = $typography_supports['fontSize'] ?? false;
$has_font_style_support = $typography_supports['__experimentalFontStyle'] ?? false;
$has_font_weight_support = $typography_supports['__experimentalFontWeight'] ?? false;
$has_letter_spacing_support = $typography_supports['__experimentalLetterSpacing'] ?? false;
$has_font_style_support = $typography_supports['fontStyle'] ?? false;
$has_font_weight_support = $typography_supports['fontWeight'] ?? false;
$has_letter_spacing_support = $typography_supports['letterSpacing'] ?? false;
$has_line_height_support = $typography_supports['lineHeight'] ?? false;
$has_text_align_support = $typography_supports['textAlign'] ?? false;
$has_text_columns_support = $typography_supports['textColumns'] ?? false;
$has_text_decoration_support = $typography_supports['__experimentalTextDecoration'] ?? false;
$has_text_transform_support = $typography_supports['__experimentalTextTransform'] ?? false;
$has_text_decoration_support = $typography_supports['textDecoration'] ?? false;
$has_text_transform_support = $typography_supports['textTransform'] ?? false;
$has_writing_mode_support = $typography_supports['__experimentalWritingMode'] ?? false;

$has_typography_support = $has_font_family_support
Expand Down Expand Up @@ -91,16 +91,16 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) {
return array();
}

$has_font_family_support = $typography_supports['__experimentalFontFamily'] ?? false;
$has_font_family_support = $typography_supports['fontFamily'] ?? false;
$has_font_size_support = $typography_supports['fontSize'] ?? false;
$has_font_style_support = $typography_supports['__experimentalFontStyle'] ?? false;
$has_font_weight_support = $typography_supports['__experimentalFontWeight'] ?? false;
$has_letter_spacing_support = $typography_supports['__experimentalLetterSpacing'] ?? false;
$has_font_style_support = $typography_supports['fontStyle'] ?? false;
$has_font_weight_support = $typography_supports['fontWeight'] ?? false;
$has_letter_spacing_support = $typography_supports['letterSpacing'] ?? false;
$has_line_height_support = $typography_supports['lineHeight'] ?? false;
$has_text_align_support = $typography_supports['textAlign'] ?? false;
$has_text_columns_support = $typography_supports['textColumns'] ?? false;
$has_text_decoration_support = $typography_supports['__experimentalTextDecoration'] ?? false;
$has_text_transform_support = $typography_supports['__experimentalTextTransform'] ?? false;
$has_text_decoration_support = $typography_supports['textDecoration'] ?? false;
$has_text_transform_support = $typography_supports['textTransform'] ?? false;
$has_writing_mode_support = $typography_supports['__experimentalWritingMode'] ?? false;

// Whether to skip individual block support features.
Expand Down
8 changes: 2 additions & 6 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,18 +920,14 @@ public static function resolve_theme_file_uris( $theme_json ) {
return $theme_json;
}

$resolved_theme_json_data = array(
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
);
$resolved_theme_json_data = $theme_json->get_raw_data();

foreach ( $resolved_urls as $resolved_url ) {
$path = explode( '.', $resolved_url['target'] );
_wp_array_set( $resolved_theme_json_data, $path, $resolved_url['href'] );
}

$theme_json->merge( new WP_Theme_JSON_Gutenberg( $resolved_theme_json_data ) );

return $theme_json;
return new WP_Theme_JSON_Gutenberg( $resolved_theme_json_data );
}

/**
Expand Down
47 changes: 47 additions & 0 deletions lib/compat/wordpress-6.8/blocks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Temporary compatibility shims for block APIs present in Gutenberg.
*
* @package gutenberg
*/

/**
* Filters the block type arguments during registration to stabilize experimental block supports.
*
* This is a temporary compatibility shim as the approach in core is for this to be handled
* within the WP_Block_Type class rather than requiring a filter.
*
* @param array $args Array of arguments for registering a block type.
* @return array Array of arguments for registering a block type.
*/
function gutenberg_stabilize_experimental_block_supports( $args ) {
if ( empty( $args['supports']['typography'] ) ) {
return $args;
}

$experimental_typography_supports_to_stable = array(
'__experimentalFontFamily' => 'fontFamily',
'__experimentalFontStyle' => 'fontStyle',
'__experimentalFontWeight' => 'fontWeight',
'__experimentalLetterSpacing' => 'letterSpacing',
'__experimentalTextDecoration' => 'textDecoration',
'__experimentalTextTransform' => 'textTransform',
);

$current_typography_supports = $args['supports']['typography'];
$stable_typography_supports = array();

foreach ( $current_typography_supports as $key => $value ) {
if ( array_key_exists( $key, $experimental_typography_supports_to_stable ) ) {
$stable_typography_supports[ $experimental_typography_supports_to_stable[ $key ] ] = $value;
} else {
$stable_typography_supports[ $key ] = $value;
}
}

$args['supports']['typography'] = $stable_typography_supports;

return $args;
}

add_filter( 'register_block_type_args', 'gutenberg_stabilize_experimental_block_supports', PHP_INT_MAX, 1 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function gutenberg_is_experiment_enabled( $name ) {

// WordPress 6.8 compat.
require __DIR__ . '/compat/wordpress-6.8/preload.php';
require __DIR__ . '/compat/wordpress-6.8/blocks.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ When creating a new package, you need to provide at least the following. Package

This assumes that your code is located in the `src` folder and will be transpiled with `Babel`.

For packages that should ship as a WordPress script, include `wpScript: true` in the `package.json` file. This tells the build system to bundle the package for use as a WordPress script.
For production packages that will ship as a WordPress script, include `wpScript: true` in the `package.json` file. This tells the build system to bundle the package for use as a WordPress script.

For packages that should ship as a WordPress script module, include a `wpScriptModuleExports` field the `package.json` file. The value of this field can be a string to expose a single script module, or an object with a [shape like the standard `exports` object](https://nodejs.org/docs/latest-v20.x/api/packages.html#subpath-exports) to expose multiple script modules from a single package:
For production packages that will ship as a WordPress script module, include a `wpScriptModuleExports` field in the `package.json` file. The value of this field can be a string to expose a single script module, or an object with a [shape like the standard `exports` object](https://nodejs.org/docs/latest-v20.x/api/packages.html#subpath-exports) to expose multiple script modules from a single package:

```jsonc
{
Expand All @@ -64,7 +64,7 @@ When creating a new package, you need to provide at least the following. Package
}
```

Both `wpScript` and `wpScriptModuleExports` may be included if the package exposes both a script and a script module.
Both `wpScript` and `wpScriptModuleExports` may be included if the package exposes both a script and a script module. These fields are also essential when performing a license check for all their dependencies, because they trigger strict validation against compatibility with GPL v2. All remaining dependencies WordPress doesn't distribute but uses for development purposes can contain also a few other OSS compatible licenses.
1. `README.md` file containing at least:
- Package name
Expand Down
6 changes: 3 additions & 3 deletions packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"types": "build-types",
"wpScript": true,
"wpScriptModuleExports": "./build-module/module/index.js",
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/dom-ready": "*",
"@wordpress/i18n": "*"
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
4 changes: 2 additions & 2 deletions packages/annotations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/data": "*",
Expand All @@ -38,6 +39,5 @@
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
4 changes: 2 additions & 2 deletions packages/api-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
Expand All @@ -34,6 +35,5 @@
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
4 changes: 2 additions & 2 deletions packages/autop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
"@babel/runtime": "7.25.7"
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
4 changes: 2 additions & 2 deletions packages/blob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
"@babel/runtime": "7.25.7"
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
4 changes: 2 additions & 2 deletions packages/block-directory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/a11y": "*",
Expand Down Expand Up @@ -54,6 +55,5 @@
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
5 changes: 3 additions & 2 deletions packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"wpScript": true,
"sideEffects": [
"build-style/**",
"src/**/*.scss",
Expand Down Expand Up @@ -59,6 +60,7 @@
"@wordpress/keycodes": "*",
"@wordpress/notices": "*",
"@wordpress/preferences": "*",
"@wordpress/priority-queue": "*",
"@wordpress/private-apis": "*",
"@wordpress/rich-text": "*",
"@wordpress/style-engine": "*",
Expand Down Expand Up @@ -87,6 +89,5 @@
},
"publishConfig": {
"access": "public"
},
"wpScript": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ iframe[name="editor-canvas"] {
width: 100%;
height: 100%;
display: block;
background-color: transparent;
// Handles transitions between device previews
@include editor-canvas-resize-animation;
background-color: $gray-300;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
margin-bottom: 1.5em;
}

.components-base-control {
.components-base-control,
.components-radio-control {
&:where(:not(:last-child)) {
margin-bottom: $grid-unit-20;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { BlockPatternsList } from '@wordpress/block-editor';
const MyBlockPatternsList = () => (
<BlockPatternsList
blockPatterns={ shownBlockPatterns }
shownPatterns={ shownBlockPatterns }
onClickPattern={ onSelectBlockPattern }
/>
);
Expand All @@ -33,13 +32,6 @@ An array of block patterns that can be shown in the block patterns list.
- Type: `Array`
- Required: Yes

#### shownPatterns

An array of shown block patterns objects.

- Type: `Array`
- Required: Yes

#### onClickPattern

The performed event after a click on a block pattern. In most cases, the pattern is inserted in the block editor.
Expand Down
Loading

0 comments on commit 78b4875

Please sign in to comment.