Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/full-page-navigation-server-state
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Aug 21, 2024
2 parents d7f9ba2 + e6ecb4d commit fb5fa24
Show file tree
Hide file tree
Showing 709 changed files with 14,916 additions and 4,665 deletions.
47 changes: 45 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,25 +278,29 @@ 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)/**',
'packages/*/src/**/@(test|stories)/**',
'**/*.@(native|ios|android).js',
],
rules: {
'no-restricted-syntax': [
'error',
...restrictedSyntax,
...restrictedSyntaxComponents,
// Temporary rules until we're ready to officially deprecate the bottom margins.
...[
'BaseControl',
'CheckboxControl',
'ComboboxControl',
'DimensionControl',
'FocalPointPicker',
'RangeControl',
'SearchControl',
'SelectControl',
'TextControl',
'TextareaControl',
'ToggleControl',
'ToggleGroupControl',
'TreeSelect',
].map( ( componentName ) => ( {
Expand All @@ -305,6 +309,45 @@ 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',
'FontAppearanceControl',
'FontFamilyControl',
'FontSizePicker',
'FormTokenField',
'InputControl',
'LineHeightControl',
'NumberControl',
'RangeControl',
'TextControl',
'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.',
} ) ),
{
// Falsy `__next40pxDefaultSize` without a `render` prop.
selector:
'JSXOpeningElement[name.name="FormFileUpload"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"][value.expression.value!=false])):not(:has(JSXAttribute[name.name="render"]))',
message:
'FormFileUpload should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
},
// Temporary rules until all existing components have the `__next40pxDefaultSize` prop.
...[ 'SelectControl' ].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
5 changes: 5 additions & 0 deletions backport-changelog/6.7/7137.md
Original file line number Diff line number Diff line change
@@ -0,0 +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
369 changes: 369 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/contributors/code/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ The final step is to write a release post on [make.wordpress.org/core](https://m

> The plugin was published to the WordPress.org plugin directory but the workflow failed.
This has happened ocassionally, see [this one](https://github.com/WordPress/gutenberg/actions/runs/6955409957/job/18924124118) for example.
This has happened occasionally, see [this one](https://github.com/WordPress/gutenberg/actions/runs/6955409957/job/18924124118) for example.

It's important to check that:

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
1 change: 1 addition & 0 deletions docs/getting-started/devenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Refer to the [Get started with `wp-env`](/docs/getting-started/devenv/get-starte
This list is not exhaustive, but here are several additional options to choose from if you prefer not to use `wp-env`:

- [Local](https://localwp.com/)
- [WP Studio](https://developer.wordpress.com/studio/)
- [XAMPP](https://www.apachefriends.org/)
- [MAMP](https://www.mamp.info/en/mamp/mac/)
- [Varying Vagrant Vagrants](https://varyingvagrantvagrants.org/) (VVV)
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ And a `style.css` file to load on the frontend:

The files will automatically be enqueued when specified in the block.json.

<div class="callout callout-info">

If you are using `@wordpress/scripts` you will need to import your stylesheet within your corresponding JavaScript file in order for `@wordpress/scripts` to process the stylesheet.

Example:

- In `edit.js` you would place `import './editor.scss';`
- In `index.js` you would place `import './style.scss';`
- In `view.js` you would place `import './view.scss';` (interactive block template)
</div>

**Note:** If you have multiple files to include, you can use standard `wp_enqueue_style` functions like any other plugin or theme. You will want to use the following hooks for the block editor:

- `enqueue_block_editor_assets` - to load only in editor view
Expand Down
30 changes: 30 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,30 @@
"markdown_source": "../docs/reference-guides/interactivity-api/README.md",
"parent": "reference-guides"
},
{
"title": "Core Concepts",
"slug": "core-concepts",
"markdown_source": "../docs/reference-guides/interactivity-api/core-concepts/README.md",
"parent": "interactivity-api"
},
{
"title": "The Reactive and Declarative mindset",
"slug": "the-reactive-and-declarative-mindset",
"markdown_source": "../docs/reference-guides/interactivity-api/core-concepts/the-reactive-and-declarative-mindset.md",
"parent": "core-concepts"
},
{
"title": "Understanding global state, local context and derived state",
"slug": "undestanding-global-state-local-context-and-derived-state",
"markdown_source": "../docs/reference-guides/interactivity-api/core-concepts/undestanding-global-state-local-context-and-derived-state.md",
"parent": "core-concepts"
},
{
"title": "Server-side rendering: Processing directives on the server",
"slug": "server-side-rendering",
"markdown_source": "../docs/reference-guides/interactivity-api/core-concepts/server-side-rendering.md",
"parent": "core-concepts"
},
{
"title": "Quick start guide",
"slug": "iapi-quick-start-guide",
Expand Down Expand Up @@ -767,6 +791,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
4 changes: 2 additions & 2 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ An individual item within a list. ([Source](https://github.com/WordPress/gutenbe
- **Category:** text
- **Parent:** core/list
- **Allowed Blocks:** core/list
- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight), ~~className~~
- **Supports:** anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight), ~~className~~
- **Attributes:** content, placeholder

## Login/out
Expand Down 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
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Namespace: `core`.

### Dynamically generated selectors
## Dynamically generated selectors

There are a number of user-friendly selectors that are wrappers of the more generic `getEntityRecord` and `getEntityRecords` that can be used to retrieve information for the various entities.

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
Loading

0 comments on commit fb5fa24

Please sign in to comment.