Skip to content

Commit

Permalink
Merge branch 'trunk' into gh/65889
Browse files Browse the repository at this point in the history
  • Loading branch information
up1512001 committed Nov 6, 2024
2 parents 8a24ce7 + 452d3b0 commit 8ebbc47
Show file tree
Hide file tree
Showing 133 changed files with 1,386 additions and 521 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
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ Return true if the current post has already been published.
_Parameters_
- _state_ `Object`: Global application state.
- _currentPost_ `Object?`: Explicit current post for bypassing registry selector.
- _currentPost_ `[Object]`: Explicit current post for bypassing registry selector.
_Returns_
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.

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 @@ -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
50 changes: 23 additions & 27 deletions packages/block-editor/src/components/block-patterns-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,14 @@ function BlockPattern( {
} }
onMouseLeave={ () => onHover?.( null ) }
>
<BlockPreview
blocks={ blocks }
viewportWidth={ viewportWidth }
/>
<BlockPreview.Async
placeholder={ <BlockPatternPlaceholder /> }
>
<BlockPreview
blocks={ blocks }
viewportWidth={ viewportWidth }
/>
</BlockPreview.Async>

{ showTitle && (
<HStack
Expand Down Expand Up @@ -187,7 +191,6 @@ function BlockPatternsList(
{
isDraggable,
blockPatterns,
shownPatterns,
onHover,
onClickPattern,
orientation,
Expand All @@ -205,11 +208,9 @@ function BlockPatternsList(
// Reset the active composite item whenever the available patterns change,
// to make sure that Composite widget can receive focus correctly when its
// composite items change. The first composite item will receive focus.
const firstCompositeItemId = blockPatterns.find( ( pattern ) =>
shownPatterns.includes( pattern )
)?.name;
const firstCompositeItemId = blockPatterns[ 0 ]?.name;
setActiveCompositeId( firstCompositeItemId );
}, [ shownPatterns, blockPatterns ] );
}, [ blockPatterns ] );

return (
<Composite
Expand All @@ -221,24 +222,19 @@ function BlockPatternsList(
aria-label={ label }
ref={ ref }
>
{ blockPatterns.map( ( pattern ) => {
const isShown = shownPatterns.includes( pattern );
return isShown ? (
<BlockPattern
key={ pattern.name }
id={ pattern.name }
pattern={ pattern }
onClick={ onClickPattern }
onHover={ onHover }
isDraggable={ isDraggable }
showTitle={ showTitle }
showTooltip={ showTitlesAsTooltip }
category={ category }
/>
) : (
<BlockPatternPlaceholder key={ pattern.name } />
);
} ) }
{ blockPatterns.map( ( pattern ) => (
<BlockPattern
key={ pattern.name }
id={ pattern.name }
pattern={ pattern }
onClick={ onClickPattern }
onHover={ onHover }
isDraggable={ isDraggable }
showTitle={ showTitle }
showTooltip={ showTitlesAsTooltip }
category={ category }
/>
) ) }
{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }
</Composite>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
*/
import blockLibraryStyles from '!!raw-loader!../../../../../block-library/build-style/style.css';

/**
* WordPress dependencies
*/
import { useAsyncList } from '@wordpress/compose';

/**
* Internal dependencies
*/
Expand All @@ -26,13 +21,9 @@ export default {

export const Default = {
render: function Template( props ) {
const shownPatterns = useAsyncList( props.blockPatterns );
return (
<ExperimentalBlockEditorProvider settings={ blockEditorSettings }>
<BlockPatternsList
shownPatterns={ shownPatterns }
{ ...props }
/>
<BlockPatternsList { ...props } />
</ExperimentalBlockEditorProvider>
);
},
Expand Down
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/block-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
*/
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
import usePopoverScroll from './use-popover-scroll';
import { rectUnion, getVisibleElementBounds } from '../../utils/dom';
import { rectUnion, getElementBounds } from '../../utils/dom';

const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;

Expand Down Expand Up @@ -90,10 +90,10 @@ function BlockPopover(
getBoundingClientRect() {
return lastSelectedElement
? rectUnion(
getVisibleElementBounds( selectedElement ),
getVisibleElementBounds( lastSelectedElement )
getElementBounds( selectedElement ),
getElementBounds( lastSelectedElement )
)
: getVisibleElementBounds( selectedElement );
: getElementBounds( selectedElement );
},
contextElement: selectedElement,
};
Expand Down
Loading

0 comments on commit 8ebbc47

Please sign in to comment.