Skip to content

Commit

Permalink
prep build 08/18
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Aug 17, 2024
2 parents 15d66cf + 8169dfd commit e5e25cf
Show file tree
Hide file tree
Showing 371 changed files with 7,575 additions and 2,761 deletions.
32 changes: 31 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ module.exports = {
},
},
{
// Temporary rules until we're ready to officially deprecate the bottom margins.
files: [ 'packages/*/src/**/*.[tj]s?(x)' ],
excludedFiles: [
'packages/components/src/**/@(test|stories)/**',
Expand All @@ -289,9 +288,12 @@ module.exports = {
'error',
...restrictedSyntax,
...restrictedSyntaxComponents,
// Temporary rules until we're ready to officially deprecate the bottom margins.
...[
'BaseControl',
'CheckboxControl',
'ComboboxControl',
'DimensionControl',
'FocalPointPicker',
'RangeControl',
'SearchControl',
Expand All @@ -307,6 +309,34 @@ module.exports = {
componentName +
' should have the `__nextHasNoMarginBottom` prop to opt-in to the new margin-free styles.',
} ) ),
// Temporary rules until we're ready to officially default to the new size.
...[
'BorderBoxControl',
'BorderControl',
'ComboboxControl',
'CustomSelectControl',
'DimensionControl',
'FontSizePicker',
'NumberControl',
'RangeControl',
'ToggleGroupControl',
].map( ( componentName ) => ( {
// Falsy `__next40pxDefaultSize` without a non-default `size` prop.
selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"][value.expression.value!=false])):not(:has(JSXAttribute[name.name="size"][value.value!="default"]))`,
message:
componentName +
' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
} ) ),
// Temporary rules until all existing components have the `__next40pxDefaultSize` prop.
...[ 'SelectControl', 'TextControl' ].map(
( componentName ) => ( {
// Not strict. Allows pre-existing __next40pxDefaultSize={ false } usage until they are all manually updated.
selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"])):not(:has(JSXAttribute[name.name="size"]))`,
message:
componentName +
' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
} )
),
],
},
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/props-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
# You cannot filter this event for PR comments only.
# However, the logic below does short-circuit the workflow for issues.
issue_comment:
type:
types:
- created
# This event will run everytime a new PR review is initially submitted.
pull_request_review:
Expand Down
3 changes: 3 additions & 0 deletions backport-changelog/6.6/7145.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7145

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

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

* https://github.com/WordPress/gutenberg/pull/64128
* https://github.com/WordPress/gutenberg/pull/64192
* https://github.com/WordPress/gutenberg/pull/64328
5 changes: 5 additions & 0 deletions backport-changelog/6.7/7179.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
https://github.com/WordPress/wordpress-develop/pull/7179

* https://github.com/WordPress/gutenberg/pull/64401
* https://github.com/WordPress/gutenberg/pull/64459
* https://github.com/WordPress/gutenberg/pull/64477
5 changes: 3 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
== Changelog ==

= 19.0.0-rc.1 =

= 19.0.0 =

## Changelog

Expand Down Expand Up @@ -368,6 +367,8 @@ The following contributors merged PRs in this release:
@aaronrobertshaw @adamsilverstein @afercia @akasunil @Aljullu @amitraj2203 @andrewserong @carolinan @cbravobernal @Chrico @ciampo @creativecoder @DaniGuardiola @DAreRodz @djcowan @ellatrix @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @kebbet @kmanijak @Mamaduka @matiasbenedetto @meteorlxy @mikachan @mirka @mtias @ndiego @noisysocks @oandregal @ramonjd @richtabor @Rishit30G @ryanwelcher @SantosGuillamot @scruffian @shail-mehta @simison @stokesman @t-hamano @talldan @tomdevisser @tomjn @tyxla @up1512001 @wzieba @youknowriad




= 18.9.0 =

## Changelog
Expand Down
2 changes: 1 addition & 1 deletion docs/explanations/architecture/modularity.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function MyApp() {

```php
// myplugin.php
// Example of script registration dependending on the "components" and "element packages.
// Example of script registration depending on the "components" and "element packages.
wp_register_script( 'myscript', 'pathtomyscript.js', array ('wp-components', "react" ) );
```

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/fundamentals/block-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The [example block](https://github.com/WordPress/block-development-examples/tree

## Dynamic render markup

In dynamic blocks, where the font-end markup is rendered server-side, you can utilize the [`get_block_wrapper_attributes()`](https://developer.wordpress.org/reference/functions/get_block_wrapper_attributes/) function to output the necessary classes and attributes just like you would use `useBlockProps.save()` in the `save` function. (See [example](https://github.com/WordPress/block-development-examples/blob/f68640f42d993f0866d1879f67c73910285ca114/plugins/block-dynamic-rendering-64756b/src/render.php#L11))
In dynamic blocks, where the front-end markup is rendered server-side, you can utilize the [`get_block_wrapper_attributes()`](https://developer.wordpress.org/reference/functions/get_block_wrapper_attributes/) function to output the necessary classes and attributes just like you would use `useBlockProps.save()` in the `save` function. (See [example](https://github.com/WordPress/block-development-examples/blob/f68640f42d993f0866d1879f67c73910285ca114/plugins/block-dynamic-rendering-64756b/src/render.php#L11))

```php
<p <?php echo get_block_wrapper_attributes(); ?>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Dynamic blocks, which we'll explore in the following section, can specify an ini
For a practical demonstration of how this works, refer to the [Building your first block](/docs/getting-started/tutorial.md) tutorial. Specifically, the [Adding static rendering](/docs/getting-started/tutorial.md#adding-static-rendering) section illustrates how a block can have both a saved HTML structure and dynamic rendering capabilities.

<div class="callout callout-info">
WordPress provides mechanisms like the <a href="https://developer.wordpress.org/reference/functions/render_block/"><code>render_block</code></a> are the <code>$render_callback</code> function to alter the saved HTML of a block before it appears on the front end. These tools offer developers the capability to customize block output dynamically, catering to complex and interactive user experiences.
WordPress provides mechanisms like the <a href="https://developer.wordpress.org/reference/functions/render_block/"><code>render_block</code></a> and the <a href="https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/creating-dynamic-blocks/"><code>render_callback</code></a> function to alter the saved HTML of a block before it appears on the front end. These tools offer developers the capability to customize block output dynamically, catering to complex and interactive user experiences.
</div>

Additional examples of WordPress blocks that use static rendering, meaning their output is fixed at the time of saving and doesn't rely on server-side processing, include:
Expand Down
6 changes: 6 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,12 @@
"markdown_source": "../packages/components/src/combobox-control/README.md",
"parent": "components"
},
{
"title": "Composite",
"slug": "composite",
"markdown_source": "../packages/components/src/composite/README.md",
"parent": "components"
},
{
"title": "ConfirmDialog",
"slug": "confirm-dialog",
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Ju

- **Name:** core/quote
- **Category:** text
- **Supports:** anchor, background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Supports:** align (full, left, right, wide), anchor, background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** citation, textAlign, value

## Read More
Expand Down
8 changes: 4 additions & 4 deletions docs/reference-guides/filters/block-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ The following PHP filters are available to change the output of a block on the f

### `render_block`

Filters the font-end content of any block. This filter has no impact on the behavior of blocks in the Editor.
Filters the front-end content of any block. This filter has no impact on the behavior of blocks in the Editor.

The callback function for this filter receives three parameters:

- `$block_content` (`string`): The block content.
- `block` (`array`): The full block, including name and attributes.
- `$block` (`array`): The full block, including name and attributes.
- `$instance` (`WP_Block`): The block instance.

In the following example, the class `example-class` is added to all Paragraph blocks on the front end. Here the [HTML API](https://make.wordpress.org/core/2023/03/07/introducing-the-html-api-in-wordpress-6-2/) is used to easily add the class instead of relying on regex.
Expand Down Expand Up @@ -172,12 +172,12 @@ add_filter( 'render_block', 'example_add_custom_class_to_paragraph_block', 10, 2

### `render_block_{namespace/block}`

Filters the font-end content of the defined block. This is just a simpler form of `render_block` when you only need to modify a specific block type.
Filters the front-end content of the defined block. This is just a simpler form of `render_block` when you only need to modify a specific block type.

The callback function for this filter receives three parameters:

- `$block_content` (`string`): The block content.
- `block` (`array`): The full block, including name and attributes.
- `$block` (`array`): The full block, including name and attributes.
- `$instance` (`WP_Block`): The block instance.

In the following example, the class `example-class` is added to all Paragraph blocks on the front end. Notice that compared to the `render_block` example above, you no longer need to check the block type before modifying the content. Again, the [HTML API](https://make.wordpress.org/core/2023/03/07/introducing-the-html-api-in-wordpress-6-2/) is used instead of regex.
Expand Down
51 changes: 49 additions & 2 deletions docs/reference-guides/interactivity-api/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ Actions are just regular JavaScript functions. Usually triggered by the `data-wp
```ts
const { state, actions } = store("myPlugin", {
actions: {
selectItem: (id?: number) => {
selectItem: ( id ) => {
const context = getContext();
// `id` is optional here, so this action can be used in a directive.
state.selected = id || context.id;
Expand Down Expand Up @@ -1152,7 +1152,7 @@ store('mySliderPlugin', {
## Server functions
The Interactivity API comes with handy functions on the PHP part. Apart from [setting the store via server](#on-the-server-side), there is also a function to get and set Interactivity related config variables.
The Interactivity API comes with handy functions that allow you to initialize and reference configuration options on the server. This is necessary to feed the initial data that the Server Directive Processing will use to modify the HTML markup before it's send to the browser. It is also a great way to leverage many of WordPress's APIs, like nonces, AJAX, and translations.
### wp_interactivity_config
Expand Down Expand Up @@ -1181,6 +1181,53 @@ This config can be retrieved on the client:
const { showLikeButton } = getConfig();
```
### wp_interactivity_state
`wp_interactivity_state` allows the initialization of the global state on the server, which will be used to process the directives on the server and then will be merged with any global state defined in the client.
Initializing the global state on the server also allows you to use many critical WordPress APIs, including [AJAX](https://developer.wordpress.org/plugins/javascript/ajax/), or [nonces](https://developer.wordpress.org/plugins/javascript/enqueuing/#nonce).
The `wp_interactivity_state` function receives two arguments, a string with the namespace that will be used as a reference and an associative array containing the values.
Here is an example of passing the WP Admin AJAX endpoint with a nonce.
```php
// render.php

wp_interactivity_state(
'myPlugin',
array(
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'myPlugin_nonce' ),
),
);
```
```js
// view.js

const { state } = store( 'myPlugin', {
actions: {
*doSomething() {
try {
const formData = new FormData();
formData.append( 'action', 'do_something' );
formData.append( '_ajax_nonce', state.nonce );

const data = yield fetch( state.ajaxUrl, {
method: 'POST',
body: formData,
} ).then( ( response ) => response.json() );
console.log( 'Server data!', data );
} catch ( e ) {
// Something went wrong!
}
},
},
}
);
```
### wp_interactivity_process_directives
`wp_interactivity_process_directives` returns the updated HTML after the directives have been processed.
Expand Down
9 changes: 2 additions & 7 deletions docs/reference-guides/slotfills/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ export default function PostSummary( { onActionPerformed } ) {
const { isRemovedPostStatusPanel } = useSelect( ( select ) => {
// We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do
// not use isEditorPanelEnabled since this panel should not be disabled through the UI.
const { isEditorPanelRemoved, getCurrentPostType } =
const { isEditorPanelRemoved } =
select( editorStore );
return {
isRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),
postType: getCurrentPostType(),
};
}, [] );

Expand All @@ -85,11 +84,7 @@ export default function PostSummary( { onActionPerformed } ) {
<>
<VStack spacing={ 4 }>
<PostCardPanel
actions={
<PostActions
onActionPerformed={ onActionPerformed }
/>
}
onActionPerformed={ onActionPerformed }
/>
<PostFeaturedImagePanel withPanelBody={ false } />
<PostExcerptPanel />
Expand Down
2 changes: 1 addition & 1 deletion lib/block-supports/background.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function gutenberg_render_background_support( $block_content, $block ) {
$background_styles['backgroundSize'] = $background_styles['backgroundSize'] ?? 'cover';
// If the background size is set to `contain` and no position is set, set the position to `center`.
if ( 'contain' === $background_styles['backgroundSize'] && ! $background_styles['backgroundPosition'] ) {
$background_styles['backgroundPosition'] = 'center';
$background_styles['backgroundPosition'] = '50% 50%';
}
}

Expand Down
Loading

0 comments on commit e5e25cf

Please sign in to comment.