From 2c5421de469f5bd694ff99e5bbc31b64cd1302b0 Mon Sep 17 00:00:00 2001
From: Ramon
Date: Sun, 24 Nov 2024 18:45:17 +1100
Subject: [PATCH 001/384] Style panel: use correct revisions count (#67180)
* For the styles panel, send the correct recordCount via optional prop to the footer component.
This allows us to remove the globalstyle record selector.
* Implement feedback
Co-authored-by: ramonjd
Co-authored-by: afercia
---
.../index.js | 18 +++++++++++---
.../index.js | 24 +++++++------------
2 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
index 3dec3f0a7b2eb5..51833443d8d85c 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
@@ -23,6 +23,7 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
export default function SidebarNavigationScreenDetailsFooter( {
record,
+ revisionsCount,
...otherProps
} ) {
/*
@@ -34,9 +35,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
const hrefProps = {};
const lastRevisionId =
record?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;
- const revisionsCount =
- record?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;
- // Enable the revisions link if there is a last revision and there are more than one revisions.
+
+ // Use incoming prop first, then the record's version history, if available.
+ revisionsCount =
+ revisionsCount ||
+ record?._links?.[ 'version-history' ]?.[ 0 ]?.count ||
+ 0;
+
+ /*
+ * Enable the revisions link if there is a last revision and there is more than one revision.
+ * This link is used for theme assets, e.g., templates, which have no database record until they're edited.
+ * For these files there's only a "revision" after they're edited twice,
+ * which means the revision.php page won't display a proper diff.
+ * See: https://github.com/WordPress/gutenberg/issues/49164.
+ */
if ( lastRevisionId && revisionsCount > 1 ) {
hrefProps.href = addQueryArgs( 'revision.php', {
revision: record?._links[ 'predecessor-version' ][ 0 ].id,
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
index 3dc93ff4d4df63..772b15aec2a294 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
@@ -48,24 +48,15 @@ export function SidebarNavigationItemGlobalStyles( props ) {
export default function SidebarNavigationScreenGlobalStyles() {
const history = useHistory();
const { params } = useLocation();
- const { revisions, isLoading: isLoadingRevisions } =
- useGlobalStylesRevisions();
+ const {
+ revisions,
+ isLoading: isLoadingRevisions,
+ revisionsCount,
+ } = useGlobalStylesRevisions();
const { openGeneralSidebar } = useDispatch( editSiteStore );
const { setEditorCanvasContainerView } = unlock(
useDispatch( editSiteStore )
);
- const { revisionsCount } = useSelect( ( select ) => {
- const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
- select( coreStore );
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
- const globalStyles = globalStylesId
- ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
- : undefined;
- return {
- revisionsCount:
- globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,
- };
- }, [] );
const { set: setPreference } = useDispatch( preferencesStore );
const openGlobalStyles = useCallback( async () => {
@@ -95,10 +86,10 @@ export default function SidebarNavigationScreenGlobalStyles() {
}, [ openGlobalStyles, setEditorCanvasContainerView ] );
// If there are no revisions, do not render a footer.
- const hasRevisions = revisionsCount > 0;
const modifiedDateTime = revisions?.[ 0 ]?.modified;
const shouldShowGlobalStylesFooter =
- hasRevisions && ! isLoadingRevisions && modifiedDateTime;
+ revisionsCount > 0 && ! isLoadingRevisions && modifiedDateTime;
+
return (
<>
)
From 5513d7aecf085a7858cae0492acf213d65a436f6 Mon Sep 17 00:00:00 2001
From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
Date: Mon, 25 Nov 2024 13:28:01 +1000
Subject: [PATCH 002/384] Block Supports: Extend stabilization to common
experimental block support flags (#67018)
Co-authored-by: aaronrobertshaw
Co-authored-by: tellthemachines
Co-authored-by: ramonjd
---
backport-changelog/6.8/7069.md | 1 +
docs/explanations/architecture/styles.md | 16 +-
lib/compat/wordpress-6.8/blocks.php | 139 +++---
packages/block-editor/src/hooks/border.js | 10 +-
packages/block-editor/src/hooks/color.js | 2 +-
packages/block-editor/src/hooks/dimensions.js | 4 +-
packages/block-editor/src/hooks/style.js | 18 +-
packages/block-editor/src/hooks/test/style.js | 3 +-
packages/block-editor/src/hooks/typography.js | 2 +-
packages/block-editor/src/hooks/utils.js | 2 +-
packages/blocks/src/api/constants.js | 12 +-
.../blocks/src/store/process-block-type.js | 192 ++++++---
.../src/store/test/process-block-type.js | 395 ++++++++++--------
.../components/global-styles/screen-block.js | 5 +-
packages/server-side-render/README.md | 2 +-
phpunit/block-supports/border-test.php | 173 +++++++-
16 files changed, 638 insertions(+), 338 deletions(-)
diff --git a/backport-changelog/6.8/7069.md b/backport-changelog/6.8/7069.md
index 8b4ad69db02e75..69edbde58902d1 100644
--- a/backport-changelog/6.8/7069.md
+++ b/backport-changelog/6.8/7069.md
@@ -2,3 +2,4 @@ https://github.com/WordPress/wordpress-develop/pull/7069
* https://github.com/WordPress/gutenberg/pull/63401
* https://github.com/WordPress/gutenberg/pull/66918
+* https://github.com/WordPress/gutenberg/pull/67018
diff --git a/docs/explanations/architecture/styles.md b/docs/explanations/architecture/styles.md
index 68f09f04d21d32..5f5e73d1372f7b 100644
--- a/docs/explanations/architecture/styles.md
+++ b/docs/explanations/architecture/styles.md
@@ -37,8 +37,10 @@ The user may change the state of this block by applying different styles: a text
After some user modifications to the block, the initial markup may become something like this:
```html
-
+
```
This is what we refer to as "user-provided block styles", also know as "local styles" or "serialized styles". Essentially, each tool (font size, color, etc) ends up adding some classes and/or inline styles to the block markup. The CSS styling for these classes is part of the block, global, or theme stylesheets.
@@ -123,7 +125,7 @@ The block supports API only serializes the font size value to the wrapper, resul
This is an active area of work you can follow [in the tracking issue](https://github.com/WordPress/gutenberg/issues/38167). The linked proposal is exploring a different way to serialize the user changes: instead of each block support serializing its own data (for example, classes such as `has-small-font-size`, `has-green-color`) the idea is the block would get a single class instead (for example, `wp-style-UUID`) and the CSS styling for that class will be generated in the server by WordPress.
-While work continues in that proposal, there's an escape hatch, an experimental option block authors can use. Any block support can skip the serialization to HTML markup by using `__experimentalSkipSerialization`. For example:
+While work continues in that proposal, there's an escape hatch, an experimental option block authors can use. Any block support can skip the serialization to HTML markup by using `skipSerialization`. For example:
```json
{
@@ -132,7 +134,7 @@ While work continues in that proposal, there's an escape hatch, an experimental
"supports": {
"typography": {
"fontSize": true,
- "__experimentalSkipSerialization": true
+ "skipSerialization": true
}
}
}
@@ -140,7 +142,7 @@ While work continues in that proposal, there's an escape hatch, an experimental
This means that the typography block support will do all of the things (create a UI control, bind the block attribute to the control, etc) except serializing the user values into the HTML markup. The classes and inline styles will not be automatically applied to the wrapper and it is the block author's responsibility to implement this in the `edit`, `save`, and `render_callback` functions. See [this issue](https://github.com/WordPress/gutenberg/issues/28913) for examples of how it was done for some blocks provided by WordPress.
-Note that, if `__experimentalSkipSerialization` is enabled for a group (typography, color, spacing) it affects _all_ block supports within this group. In the example above _all_ the properties within the `typography` group will be affected (e.g. `fontSize`, `lineHeight`, `fontFamily` .etc).
+Note that, if `skipSerialization` is enabled for a group (typography, color, spacing) it affects _all_ block supports within this group. In the example above _all_ the properties within the `typography` group will be affected (e.g. `fontSize`, `lineHeight`, `fontFamily` .etc).
To enable for a _single_ property only, you may use an array to declare which properties are to be skipped. In the example below, only `fontSize` will skip serialization, leaving other items within the `typography` group (e.g. `lineHeight`, `fontFamily` .etc) unaffected.
@@ -152,7 +154,7 @@ To enable for a _single_ property only, you may use an array to declare which pr
"typography": {
"fontSize": true,
"lineHeight": true,
- "__experimentalSkipSerialization": [ "fontSize" ]
+ "skipSerialization": [ "fontSize" ]
}
}
}
@@ -473,7 +475,7 @@ If blocks do this, they need to be registered in the server using the `block.jso
Every chunk of styles can only use a single selector.
-This is particularly relevant if the block is using `__experimentalSkipSerialization` to serialize the different style properties to different nodes other than the wrapper. See "Current limitations of blocks supports" for more.
+This is particularly relevant if the block is using `skipSerialization` to serialize the different style properties to different nodes other than the wrapper. See "Current limitations of blocks supports" for more.
#### 3. **Only a single property per block**
diff --git a/lib/compat/wordpress-6.8/blocks.php b/lib/compat/wordpress-6.8/blocks.php
index 0b7031403b1918..4d4bdee2bb393b 100644
--- a/lib/compat/wordpress-6.8/blocks.php
+++ b/lib/compat/wordpress-6.8/blocks.php
@@ -20,8 +20,13 @@ function gutenberg_stabilize_experimental_block_supports( $args ) {
return $args;
}
- $experimental_to_stable_keys = array(
- 'typography' => array(
+ $experimental_supports_map = array( '__experimentalBorder' => 'border' );
+ $common_experimental_properties = array(
+ '__experimentalDefaultControls' => 'defaultControls',
+ '__experimentalSkipSerialization' => 'skipSerialization',
+ );
+ $experimental_support_properties = array(
+ 'typography' => array(
'__experimentalFontFamily' => 'fontFamily',
'__experimentalFontStyle' => 'fontStyle',
'__experimentalFontWeight' => 'fontWeight',
@@ -29,68 +34,108 @@ function gutenberg_stabilize_experimental_block_supports( $args ) {
'__experimentalTextDecoration' => 'textDecoration',
'__experimentalTextTransform' => 'textTransform',
),
- '__experimentalBorder' => 'border',
);
+ $done = array();
$updated_supports = array();
foreach ( $args['supports'] as $support => $config ) {
- // Add the support's config as is when it's not in need of stabilization.
- if ( empty( $experimental_to_stable_keys[ $support ] ) ) {
+ /*
+ * If this support config has already been stabilized, skip it.
+ * A stable support key occurring after an experimental key, gets
+ * stabilized then so that the two configs can be merged effectively.
+ */
+ if ( isset( $done[ $support ] ) ) {
+ continue;
+ }
+
+ $stable_support_key = $experimental_supports_map[ $support ] ?? $support;
+
+ /*
+ * Use the support's config as is when it's not in need of stabilization.
+ *
+ * A support does not need stabilization if:
+ * - The support key doesn't need stabilization AND
+ * - Either:
+ * - The config isn't an array, so can't have experimental properties OR
+ * - The config is an array but has no experimental properties to stabilize.
+ */
+ if ( $support === $stable_support_key &&
+ ( ! is_array( $config ) ||
+ ( ! isset( $experimental_support_properties[ $stable_support_key ] ) &&
+ empty( array_intersect_key( $common_experimental_properties, $config ) )
+ )
+ )
+ ) {
$updated_supports[ $support ] = $config;
continue;
}
- // Stabilize the support's key if needed e.g. __experimentalBorder => border.
- if ( is_string( $experimental_to_stable_keys[ $support ] ) ) {
- $stabilized_key = $experimental_to_stable_keys[ $support ];
+ $stabilize_config = function ( $unstable_config, $stable_support_key ) use ( $experimental_support_properties, $common_experimental_properties ) {
+ $stable_config = array();
+ foreach ( $unstable_config as $key => $value ) {
+ // Get stable key from support-specific map, common properties map, or keep original.
+ $stable_key = $experimental_support_properties[ $stable_support_key ][ $key ] ??
+ $common_experimental_properties[ $key ] ??
+ $key;
+
+ $stable_config[ $stable_key ] = $value;
- // If there is no stabilized key present, use the experimental config as is.
- if ( ! array_key_exists( $stabilized_key, $args['supports'] ) ) {
- $updated_supports[ $stabilized_key ] = $config;
- continue;
+ /*
+ * The `__experimentalSkipSerialization` key needs to be kept until
+ * WP 6.8 becomes the minimum supported version. This is due to the
+ * core `wp_should_skip_block_supports_serialization` function only
+ * checking for `__experimentalSkipSerialization` in earlier versions.
+ */
+ if ( '__experimentalSkipSerialization' === $key || 'skipSerialization' === $key ) {
+ $stable_config['__experimentalSkipSerialization'] = $value;
+ }
}
+ return $stable_config;
+ };
- /*
- * Determine the order of keys, so the last defined can be preferred.
- *
- * The reason for preferring the last defined key is that after filters
- * are applied, the last inserted key is likely the most up-to-date value.
- * We cannot determine with certainty which value was "last modified" so
- * the insertion order is the best guess. The extreme edge case of multiple
- * filters tweaking the same support property will become less over time as
- * extenders migrate existing blocks and plugins to stable keys.
- */
+ // Stabilize the config value.
+ $stable_config = is_array( $config ) ? $stabilize_config( $config, $stable_support_key ) : $config;
+
+ /*
+ * If a plugin overrides the support config with the `register_block_type_args`
+ * filter, both experimental and stable configs may be present. In that case,
+ * use the order keys are defined in to determine the final value.
+ * - If config is an array, merge the arrays in their order of definition.
+ * - If config is not an array, use the value defined last.
+ *
+ * The reason for preferring the last defined key is that after filters
+ * are applied, the last inserted key is likely the most up-to-date value.
+ * We cannot determine with certainty which value was "last modified" so
+ * the insertion order is the best guess. The extreme edge case of multiple
+ * filters tweaking the same support property will become less over time as
+ * extenders migrate existing blocks and plugins to stable keys.
+ */
+ if ( $support !== $stable_support_key && isset( $args['supports'][ $stable_support_key ] ) ) {
$key_positions = array_flip( array_keys( $args['supports'] ) );
- $experimental_index = $key_positions[ $support ] ?? -1;
- $stabilized_index = $key_positions[ $stabilized_key ] ?? -1;
- $experimental_first = $experimental_index < $stabilized_index;
+ $experimental_first =
+ ( $key_positions[ $support ] ?? PHP_INT_MAX ) <
+ ( $key_positions[ $stable_support_key ] ?? PHP_INT_MAX );
- // Update support config, prefer the last defined value.
- if ( is_array( $config ) ) {
- $updated_supports[ $stabilized_key ] = $experimental_first
- ? array_merge( $config, $args['supports'][ $stabilized_key ] )
- : array_merge( $args['supports'][ $stabilized_key ], $config );
+ if ( is_array( $args['supports'][ $stable_support_key ] ) ) {
+ /*
+ * To merge the alternative support config effectively, it also needs to be
+ * stabilized before merging to keep stabilized and experimental flags in
+ * sync.
+ */
+ $args['supports'][ $stable_support_key ] = $stabilize_config( $args['supports'][ $stable_support_key ], $stable_support_key );
+ $stable_config = $experimental_first
+ ? array_merge( $stable_config, $args['supports'][ $stable_support_key ] )
+ : array_merge( $args['supports'][ $stable_support_key ], $stable_config );
+ // Prevents reprocessing this support as it was merged above.
+ $done[ $stable_support_key ] = true;
} else {
- $updated_supports[ $stabilized_key ] = $experimental_first
- ? $args['supports'][ $stabilized_key ]
- : $config;
+ $stable_config = $experimental_first
+ ? $args['supports'][ $stable_support_key ]
+ : $stable_config;
}
-
- continue;
}
- // Stabilize individual support feature keys e.g. __experimentalFontFamily => fontFamily.
- if ( is_array( $experimental_to_stable_keys[ $support ] ) ) {
- $stable_support_config = array();
- foreach ( $config as $key => $value ) {
- if ( array_key_exists( $key, $experimental_to_stable_keys[ $support ] ) ) {
- $stable_support_config[ $experimental_to_stable_keys[ $support ][ $key ] ] = $value;
- } else {
- $stable_support_config[ $key ] = $value;
- }
- }
- $updated_supports[ $support ] = $stable_support_config;
- }
+ $updated_supports[ $stable_support_key ] = $stable_config;
}
$args['supports'] = $updated_supports;
diff --git a/packages/block-editor/src/hooks/border.js b/packages/block-editor/src/hooks/border.js
index 4500444685befa..14b3dbf7669b3a 100644
--- a/packages/block-editor/src/hooks/border.js
+++ b/packages/block-editor/src/hooks/border.js
@@ -161,14 +161,8 @@ export function BorderPanel( { clientId, name, setAttributes, settings } ) {
}
const defaultControls = {
- ...getBlockSupport( name, [
- BORDER_SUPPORT_KEY,
- '__experimentalDefaultControls',
- ] ),
- ...getBlockSupport( name, [
- SHADOW_SUPPORT_KEY,
- '__experimentalDefaultControls',
- ] ),
+ ...getBlockSupport( name, [ BORDER_SUPPORT_KEY, 'defaultControls' ] ),
+ ...getBlockSupport( name, [ SHADOW_SUPPORT_KEY, 'defaultControls' ] ),
};
return (
diff --git a/packages/block-editor/src/hooks/color.js b/packages/block-editor/src/hooks/color.js
index ef8984c9367853..2fecc10a311984 100644
--- a/packages/block-editor/src/hooks/color.js
+++ b/packages/block-editor/src/hooks/color.js
@@ -290,7 +290,7 @@ export function ColorEdit( { clientId, name, setAttributes, settings } ) {
const defaultControls = getBlockSupport( name, [
COLOR_SUPPORT_KEY,
- '__experimentalDefaultControls',
+ 'defaultControls',
] );
const enableContrastChecking =
diff --git a/packages/block-editor/src/hooks/dimensions.js b/packages/block-editor/src/hooks/dimensions.js
index ffa4048b7740e3..c98cc34e4272c8 100644
--- a/packages/block-editor/src/hooks/dimensions.js
+++ b/packages/block-editor/src/hooks/dimensions.js
@@ -88,11 +88,11 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
const defaultDimensionsControls = getBlockSupport( name, [
DIMENSIONS_SUPPORT_KEY,
- '__experimentalDefaultControls',
+ 'defaultControls',
] );
const defaultSpacingControls = getBlockSupport( name, [
SPACING_SUPPORT_KEY,
- '__experimentalDefaultControls',
+ 'defaultControls',
] );
const defaultControls = {
...defaultDimensionsControls,
diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js
index 998d13cfd22247..db2acd01665b60 100644
--- a/packages/block-editor/src/hooks/style.js
+++ b/packages/block-editor/src/hooks/style.js
@@ -98,22 +98,16 @@ function addAttribute( settings ) {
* @type {Record}
*/
const skipSerializationPathsEdit = {
- [ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],
- [ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
- COLOR_SUPPORT_KEY,
- ],
- [ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
+ [ `${ BORDER_SUPPORT_KEY }.skipSerialization` ]: [ 'border' ],
+ [ `${ COLOR_SUPPORT_KEY }.skipSerialization` ]: [ COLOR_SUPPORT_KEY ],
+ [ `${ TYPOGRAPHY_SUPPORT_KEY }.skipSerialization` ]: [
TYPOGRAPHY_SUPPORT_KEY,
],
- [ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
+ [ `${ DIMENSIONS_SUPPORT_KEY }.skipSerialization` ]: [
DIMENSIONS_SUPPORT_KEY,
],
- [ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
- SPACING_SUPPORT_KEY,
- ],
- [ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
- SHADOW_SUPPORT_KEY,
- ],
+ [ `${ SPACING_SUPPORT_KEY }.skipSerialization` ]: [ SPACING_SUPPORT_KEY ],
+ [ `${ SHADOW_SUPPORT_KEY }.skipSerialization` ]: [ SHADOW_SUPPORT_KEY ],
};
/**
diff --git a/packages/block-editor/src/hooks/test/style.js b/packages/block-editor/src/hooks/test/style.js
index 2cfe299b8c8d91..40e7169194b82e 100644
--- a/packages/block-editor/src/hooks/test/style.js
+++ b/packages/block-editor/src/hooks/test/style.js
@@ -133,8 +133,7 @@ describe( 'addSaveProps', () => {
const applySkipSerialization = ( features ) => {
const updatedSettings = { ...blockSettings };
Object.keys( features ).forEach( ( key ) => {
- updatedSettings.supports[ key ].__experimentalSkipSerialization =
- features[ key ];
+ updatedSettings.supports[ key ].skipSerialization = features[ key ];
} );
return updatedSettings;
};
diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js
index ab9a464fe5efbc..160894eac4e610 100644
--- a/packages/block-editor/src/hooks/typography.js
+++ b/packages/block-editor/src/hooks/typography.js
@@ -133,7 +133,7 @@ export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
const defaultControls = getBlockSupport( name, [
TYPOGRAPHY_SUPPORT_KEY,
- '__experimentalDefaultControls',
+ 'defaultControls',
] );
return (
diff --git a/packages/block-editor/src/hooks/utils.js b/packages/block-editor/src/hooks/utils.js
index 4334f70b9d13bf..ac6e55efe4d3bd 100644
--- a/packages/block-editor/src/hooks/utils.js
+++ b/packages/block-editor/src/hooks/utils.js
@@ -124,7 +124,7 @@ export function shouldSkipSerialization(
feature
) {
const support = getBlockSupport( blockNameOrType, featureSet );
- const skipSerialization = support?.__experimentalSkipSerialization;
+ const skipSerialization = support?.skipSerialization;
if ( Array.isArray( skipSerialization ) ) {
return skipSerialization.includes( feature );
diff --git a/packages/blocks/src/api/constants.js b/packages/blocks/src/api/constants.js
index 8ea32d591adb32..aaf6558c47bada 100644
--- a/packages/blocks/src/api/constants.js
+++ b/packages/blocks/src/api/constants.js
@@ -298,7 +298,16 @@ export const __EXPERIMENTAL_PATHS_WITH_OVERRIDE = {
'spacing.spacingSizes': true,
};
-export const EXPERIMENTAL_TO_STABLE_KEYS = {
+export const EXPERIMENTAL_SUPPORTS_MAP = {
+ __experimentalBorder: 'border',
+};
+
+export const COMMON_EXPERIMENTAL_PROPERTIES = {
+ __experimentalDefaultControls: 'defaultControls',
+ __experimentalSkipSerialization: 'skipSerialization',
+};
+
+export const EXPERIMENTAL_SUPPORT_PROPERTIES = {
typography: {
__experimentalFontFamily: 'fontFamily',
__experimentalFontStyle: 'fontStyle',
@@ -307,5 +316,4 @@ export const EXPERIMENTAL_TO_STABLE_KEYS = {
__experimentalTextDecoration: 'textDecoration',
__experimentalTextTransform: 'textTransform',
},
- __experimentalBorder: 'border',
};
diff --git a/packages/blocks/src/store/process-block-type.js b/packages/blocks/src/store/process-block-type.js
index bd7e5ab43800f0..0ca28a3c3e2070 100644
--- a/packages/blocks/src/store/process-block-type.js
+++ b/packages/blocks/src/store/process-block-type.js
@@ -18,7 +18,9 @@ import { isValidIcon, normalizeIconObject, omit } from '../api/utils';
import {
BLOCK_ICON_DEFAULT,
DEPRECATED_ENTRY_KEYS,
- EXPERIMENTAL_TO_STABLE_KEYS,
+ EXPERIMENTAL_SUPPORTS_MAP,
+ COMMON_EXPERIMENTAL_PROPERTIES,
+ EXPERIMENTAL_SUPPORT_PROPERTIES,
} from '../api/constants';
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
@@ -66,81 +68,149 @@ function mergeBlockVariations(
return result;
}
+/**
+ * Stabilizes a block support configuration by converting experimental properties
+ * to their stable equivalents.
+ *
+ * @param {Object} unstableConfig The support configuration to stabilize.
+ * @param {string} stableSupportKey The stable support key for looking up properties.
+ * @return {Object} The stabilized support configuration.
+ */
+function stabilizeSupportConfig( unstableConfig, stableSupportKey ) {
+ const stableConfig = {};
+ for ( const [ key, value ] of Object.entries( unstableConfig ) ) {
+ // Get stable key from support-specific map, common properties map, or keep original.
+ const stableKey =
+ EXPERIMENTAL_SUPPORT_PROPERTIES[ stableSupportKey ]?.[ key ] ??
+ COMMON_EXPERIMENTAL_PROPERTIES[ key ] ??
+ key;
+
+ stableConfig[ stableKey ] = value;
+
+ /*
+ * The `__experimentalSkipSerialization` key needs to be kept until
+ * WP 6.8 becomes the minimum supported version. This is due to the
+ * core `wp_should_skip_block_supports_serialization` function only
+ * checking for `__experimentalSkipSerialization` in earlier versions.
+ */
+ if (
+ key === '__experimentalSkipSerialization' ||
+ key === 'skipSerialization'
+ ) {
+ stableConfig.__experimentalSkipSerialization = value;
+ }
+ }
+ return stableConfig;
+}
+
+/**
+ * Stabilizes experimental block supports by converting experimental keys and properties
+ * to their stable equivalents.
+ *
+ * @param {Object|undefined} rawSupports The block supports configuration to stabilize.
+ * @return {Object|undefined} The stabilized block supports configuration.
+ */
function stabilizeSupports( rawSupports ) {
if ( ! rawSupports ) {
return rawSupports;
}
- // Create a new object to avoid mutating the original. This ensures that
- // custom block plugins that rely on immutable supports are not affected.
- // See: https://github.com/WordPress/gutenberg/pull/66849#issuecomment-2463614281
+ /*
+ * Create a new object to avoid mutating the original. This ensures that
+ * custom block plugins that rely on immutable supports are not affected.
+ * See: https://github.com/WordPress/gutenberg/pull/66849#issuecomment-2463614281
+ */
const newSupports = {};
+ const done = {};
for ( const [ support, config ] of Object.entries( rawSupports ) ) {
- // Add the support's config as is when it's not in need of stabilization.
- if ( ! EXPERIMENTAL_TO_STABLE_KEYS[ support ] ) {
- newSupports[ support ] = config;
+ /*
+ * If this support config has already been stabilized, skip it.
+ * A stable support key occurring after an experimental key, gets
+ * stabilized then so that the two configs can be merged effectively.
+ */
+ if ( done[ support ] ) {
continue;
}
- // Stabilize the support's key if needed e.g. __experimentalBorder => border.
- if ( typeof EXPERIMENTAL_TO_STABLE_KEYS[ support ] === 'string' ) {
- const stabilizedKey = EXPERIMENTAL_TO_STABLE_KEYS[ support ];
-
- // If there is no stabilized key present, use the experimental config as is.
- if ( ! Object.hasOwn( rawSupports, stabilizedKey ) ) {
- newSupports[ stabilizedKey ] = config;
- continue;
- }
-
- /*
- * Determine the order of keys, so the last defined can be preferred.
- *
- * The reason for preferring the last defined key is that after filters
- * are applied, the last inserted key is likely the most up-to-date value.
- * We cannot determine with certainty which value was "last modified" so
- * the insertion order is the best guess. The extreme edge case of multiple
- * filters tweaking the same support property will become less over time as
- * extenders migrate existing blocks and plugins to stable keys.
- */
- const entries = Object.entries( rawSupports );
- const experimentalIndex = entries.findIndex(
- ( [ key ] ) => key === support
- );
- const stabilizedIndex = entries.findIndex(
- ( [ key ] ) => key === stabilizedKey
- );
-
- // Update support config, prefer the last defined value.
- if ( typeof config === 'object' && config !== null ) {
- newSupports[ stabilizedKey ] =
- experimentalIndex < stabilizedIndex
- ? { ...config, ...rawSupports[ stabilizedKey ] }
- : { ...rawSupports[ stabilizedKey ], ...config };
- } else {
- newSupports[ stabilizedKey ] =
- experimentalIndex < stabilizedIndex
- ? rawSupports[ stabilizedKey ]
- : config;
- }
+ const stableSupportKey =
+ EXPERIMENTAL_SUPPORTS_MAP[ support ] ?? support;
+
+ /*
+ * Use the support's config as is when it's not in need of stabilization.
+ * A support does not need stabilization if:
+ * - The support key doesn't need stabilization AND
+ * - Either:
+ * - The config isn't an object, so can't have experimental properties OR
+ * - The config is an object but has no experimental properties to stabilize.
+ */
+ if (
+ support === stableSupportKey &&
+ ( ! isPlainObject( config ) ||
+ ( ! EXPERIMENTAL_SUPPORT_PROPERTIES[ stableSupportKey ] &&
+ Object.keys( config ).every(
+ ( key ) => ! COMMON_EXPERIMENTAL_PROPERTIES[ key ]
+ ) ) )
+ ) {
+ newSupports[ support ] = config;
continue;
}
- // Stabilize individual support feature keys
- // e.g. __experimentalFontFamily => fontFamily.
- const featureStabilizationRequired =
- typeof EXPERIMENTAL_TO_STABLE_KEYS[ support ] === 'object' &&
- EXPERIMENTAL_TO_STABLE_KEYS[ support ] !== null;
- const hasConfig = typeof config === 'object' && config !== null;
-
- if ( featureStabilizationRequired && hasConfig ) {
- const stableConfig = {};
- for ( const [ key, value ] of Object.entries( config ) ) {
- const stableKey =
- EXPERIMENTAL_TO_STABLE_KEYS[ support ][ key ] || key;
- stableConfig[ stableKey ] = value;
+ // Stabilize the config value.
+ const stableConfig = isPlainObject( config )
+ ? stabilizeSupportConfig( config, stableSupportKey )
+ : config;
+
+ /*
+ * If a plugin overrides the support config with the `blocks.registerBlockType`
+ * filter, both experimental and stable configs may be present. In that case,
+ * use the order keys are defined in to determine the final value.
+ * - If config is an array, merge the arrays in their order of definition.
+ * - If config is not an array, use the value defined last.
+ *
+ * The reason for preferring the last defined key is that after filters
+ * are applied, the last inserted key is likely the most up-to-date value.
+ * We cannot determine with certainty which value was "last modified" so
+ * the insertion order is the best guess. The extreme edge case of multiple
+ * filters tweaking the same support property will become less over time as
+ * extenders migrate existing blocks and plugins to stable keys.
+ */
+ if (
+ support !== stableSupportKey &&
+ Object.hasOwn( rawSupports, stableSupportKey )
+ ) {
+ const keyPositions = Object.keys( rawSupports ).reduce(
+ ( acc, key, index ) => {
+ acc[ key ] = index;
+ return acc;
+ },
+ {}
+ );
+ const experimentalFirst =
+ ( keyPositions[ support ] ?? Number.MAX_VALUE ) <
+ ( keyPositions[ stableSupportKey ] ?? Number.MAX_VALUE );
+
+ if ( isPlainObject( rawSupports[ stableSupportKey ] ) ) {
+ /*
+ * To merge the alternative support config effectively, it also needs to be
+ * stabilized before merging to keep stabilized and experimental flags in sync.
+ */
+ rawSupports[ stableSupportKey ] = stabilizeSupportConfig(
+ rawSupports[ stableSupportKey ],
+ stableSupportKey
+ );
+ newSupports[ stableSupportKey ] = experimentalFirst
+ ? { ...stableConfig, ...rawSupports[ stableSupportKey ] }
+ : { ...rawSupports[ stableSupportKey ], ...stableConfig };
+ // Prevents reprocessing this support as it was merged above.
+ done[ stableSupportKey ] = true;
+ } else {
+ newSupports[ stableSupportKey ] = experimentalFirst
+ ? rawSupports[ stableSupportKey ]
+ : stableConfig;
}
- newSupports[ support ] = stableConfig;
+ } else {
+ newSupports[ stableSupportKey ] = stableConfig;
}
}
diff --git a/packages/blocks/src/store/test/process-block-type.js b/packages/blocks/src/store/test/process-block-type.js
index c7f487a95301d0..82b2c1ad3080d7 100644
--- a/packages/blocks/src/store/test/process-block-type.js
+++ b/packages/blocks/src/store/test/process-block-type.js
@@ -26,7 +26,7 @@ describe( 'processBlockType', () => {
removeFilter( 'blocks.registerBlockType', 'test/filterSupports' );
} );
- it( 'should return the block type with stabilized supports', () => {
+ it( 'should stabilize experimental block supports', () => {
const blockSettings = {
...baseBlockSettings,
supports: {
@@ -66,7 +66,7 @@ describe( 'processBlockType', () => {
blockSettings
)( { select } );
- expect( processedBlockType.supports ).toEqual( {
+ expect( processedBlockType.supports ).toMatchObject( {
typography: {
fontSize: true,
lineHeight: true,
@@ -77,7 +77,7 @@ describe( 'processBlockType', () => {
textTransform: true,
textDecoration: true,
__experimentalWritingMode: true,
- __experimentalDefaultControls: {
+ defaultControls: {
fontSize: true,
fontAppearance: true,
textTransform: true,
@@ -88,79 +88,7 @@ describe( 'processBlockType', () => {
radius: true,
style: true,
width: true,
- __experimentalDefaultControls: {
- color: true,
- radius: true,
- style: true,
- width: true,
- },
- },
- } );
- } );
-
- it( 'should return the block type with stable supports', () => {
- const blockSettings = {
- ...baseBlockSettings,
- supports: {
- typography: {
- fontSize: true,
- lineHeight: true,
- fontFamily: true,
- fontStyle: true,
- fontWeight: true,
- letterSpacing: true,
- textTransform: true,
- textDecoration: true,
- __experimentalWritingMode: true,
- __experimentalDefaultControls: {
- fontSize: true,
- fontAppearance: true,
- textTransform: true,
- },
- },
- __experimentalBorder: {
- color: true,
- radius: true,
- style: true,
- width: true,
- __experimentalDefaultControls: {
- color: true,
- radius: true,
- style: true,
- width: true,
- },
- },
- },
- };
-
- const processedBlockType = processBlockType(
- 'test/block',
- blockSettings
- )( { select } );
-
- expect( processedBlockType.supports ).toEqual( {
- typography: {
- fontSize: true,
- lineHeight: true,
- fontFamily: true,
- fontStyle: true,
- fontWeight: true,
- letterSpacing: true,
- textTransform: true,
- textDecoration: true,
- __experimentalWritingMode: true,
- __experimentalDefaultControls: {
- fontSize: true,
- fontAppearance: true,
- textTransform: true,
- },
- },
- border: {
- color: true,
- radius: true,
- style: true,
- width: true,
- __experimentalDefaultControls: {
+ defaultControls: {
color: true,
radius: true,
style: true,
@@ -227,7 +155,7 @@ describe( 'processBlockType', () => {
blockSettings
)( { select } );
- expect( processedBlockType.supports ).toEqual( {
+ expect( processedBlockType.supports ).toMatchObject( {
typography: {
fontSize: true,
lineHeight: true,
@@ -238,7 +166,7 @@ describe( 'processBlockType', () => {
textTransform: true,
textDecoration: true,
__experimentalWritingMode: true,
- __experimentalDefaultControls: {
+ defaultControls: {
fontSize: true,
fontAppearance: true,
textTransform: true,
@@ -249,7 +177,7 @@ describe( 'processBlockType', () => {
radius: false,
style: true,
width: true,
- __experimentalDefaultControls: {
+ defaultControls: {
color: true,
radius: true,
style: true,
@@ -259,8 +187,8 @@ describe( 'processBlockType', () => {
} );
} );
- it( 'should stabilize experimental supports within block deprecations', () => {
- const blockSettings = {
+ describe( 'block deprecations', () => {
+ const deprecatedBlockSettings = {
...baseBlockSettings,
supports: {
typography: {
@@ -321,145 +249,242 @@ describe( 'processBlockType', () => {
],
};
- // Freeze the deprecated block object and its supports so that the original is not mutated.
- // This ensures the test covers a regression where the original object was mutated.
- // See: https://github.com/WordPress/gutenberg/pull/63401#discussion_r1832394335.
- Object.freeze( blockSettings.deprecated[ 0 ] );
- Object.freeze( blockSettings.deprecated[ 0 ].supports );
+ beforeEach( () => {
+ // Freeze the deprecated block object and its supports so that the original is not mutated.
+ Object.freeze( deprecatedBlockSettings.deprecated[ 0 ] );
+ Object.freeze( deprecatedBlockSettings.deprecated[ 0 ].supports );
+ } );
+
+ it( 'should stabilize experimental supports', () => {
+ const processedBlockType = processBlockType(
+ 'test/block',
+ deprecatedBlockSettings
+ )( { select } );
+
+ expect( processedBlockType.deprecated[ 0 ].supports ).toMatchObject(
+ {
+ typography: {
+ fontFamily: true,
+ fontStyle: true,
+ fontWeight: true,
+ letterSpacing: true,
+ textTransform: true,
+ textDecoration: true,
+ __experimentalWritingMode: true,
+ },
+ border: {
+ color: true,
+ radius: true,
+ style: true,
+ width: true,
+ defaultControls: {
+ color: true,
+ radius: true,
+ style: true,
+ width: true,
+ },
+ },
+ }
+ );
+ } );
+
+ it( 'should reapply transformations after supports are filtered', () => {
+ addFilter(
+ 'blocks.registerBlockType',
+ 'test/filterSupports',
+ ( settings, name ) => {
+ if (
+ name === 'test/block' &&
+ settings.supports.typography
+ ) {
+ settings.supports.typography.__experimentalFontFamily = false;
+ settings.supports.typography.__experimentalFontStyle = false;
+ settings.supports.typography.__experimentalFontWeight = false;
+ settings.supports.__experimentalBorder = {
+ radius: false,
+ };
+ }
+ return settings;
+ }
+ );
+
+ const processedBlockType = processBlockType(
+ 'test/block',
+ deprecatedBlockSettings
+ )( { select } );
+
+ expect( processedBlockType.deprecated[ 0 ].supports ).toMatchObject(
+ {
+ typography: {
+ fontFamily: false,
+ fontStyle: false,
+ fontWeight: false,
+ letterSpacing: true,
+ textTransform: true,
+ textDecoration: true,
+ __experimentalWritingMode: true,
+ },
+ border: {
+ color: true,
+ radius: false,
+ style: true,
+ width: true,
+ defaultControls: {
+ color: true,
+ radius: true,
+ style: true,
+ width: true,
+ },
+ },
+ }
+ );
+ } );
+ } );
+
+ it( 'should stabilize common experimental properties across all supports', () => {
+ const blockSettings = {
+ ...baseBlockSettings,
+ supports: {
+ typography: {
+ fontSize: true,
+ __experimentalDefaultControls: {
+ fontSize: true,
+ },
+ __experimentalSkipSerialization: true,
+ },
+ spacing: {
+ padding: true,
+ __experimentalDefaultControls: {
+ padding: true,
+ },
+ __experimentalSkipSerialization: true,
+ },
+ },
+ };
const processedBlockType = processBlockType(
'test/block',
blockSettings
)( { select } );
- expect( processedBlockType.deprecated[ 0 ].supports ).toEqual( {
+ expect( processedBlockType.supports ).toMatchObject( {
typography: {
- fontFamily: true,
- fontStyle: true,
- fontWeight: true,
- letterSpacing: true,
- textTransform: true,
- textDecoration: true,
- __experimentalWritingMode: true,
+ fontSize: true,
+ defaultControls: {
+ fontSize: true,
+ },
+ skipSerialization: true,
+ __experimentalSkipSerialization: true,
},
- border: {
- color: true,
- radius: true,
- style: true,
- width: true,
- __experimentalDefaultControls: {
- color: true,
- radius: true,
- style: true,
- width: true,
+ spacing: {
+ padding: true,
+ defaultControls: {
+ padding: true,
},
+ skipSerialization: true,
+ __experimentalSkipSerialization: true,
},
} );
} );
- it( 'should reapply transformations after supports are filtered within block deprecations', () => {
+ it( 'should merge experimental and stable keys in order of definition', () => {
const blockSettings = {
...baseBlockSettings,
supports: {
- typography: {
- fontSize: true,
- lineHeight: true,
- fontFamily: true,
- fontStyle: true,
- fontWeight: true,
- letterSpacing: true,
- textTransform: true,
- textDecoration: true,
- __experimentalWritingMode: true,
- __experimentalDefaultControls: {
- fontSize: true,
- fontAppearance: true,
- textTransform: true,
- },
+ __experimentalBorder: {
+ color: true,
+ radius: false,
},
border: {
- color: true,
- radius: true,
+ color: false,
style: true,
- width: true,
- __experimentalDefaultControls: {
- color: true,
- radius: true,
- style: true,
- width: true,
- },
},
},
- deprecated: [
- {
- supports: {
- typography: {
- __experimentalFontFamily: true,
- __experimentalFontStyle: true,
- __experimentalFontWeight: true,
- __experimentalLetterSpacing: true,
- __experimentalTextTransform: true,
- __experimentalTextDecoration: true,
- __experimentalWritingMode: true,
- },
- __experimentalBorder: {
- color: true,
- radius: true,
- style: true,
- width: true,
- __experimentalDefaultControls: {
- color: true,
- radius: true,
- style: true,
- width: true,
- },
- },
- },
- },
- ],
};
- addFilter(
- 'blocks.registerBlockType',
- 'test/filterSupports',
- ( settings, name ) => {
- if ( name === 'test/block' && settings.supports.typography ) {
- settings.supports.typography.__experimentalFontFamily = false;
- settings.supports.typography.__experimentalFontStyle = false;
- settings.supports.typography.__experimentalFontWeight = false;
- settings.supports.__experimentalBorder = { radius: false };
- }
- return settings;
- }
- );
-
const processedBlockType = processBlockType(
'test/block',
blockSettings
)( { select } );
- expect( processedBlockType.deprecated[ 0 ].supports ).toEqual( {
- typography: {
- fontFamily: false,
- fontStyle: false,
- fontWeight: false,
- letterSpacing: true,
- textTransform: true,
- textDecoration: true,
- __experimentalWritingMode: true,
+ expect( processedBlockType.supports ).toMatchObject( {
+ border: {
+ color: false,
+ radius: false,
+ style: true,
},
+ } );
+
+ const reversedSettings = {
+ ...baseBlockSettings,
+ supports: {
+ border: {
+ color: false,
+ style: true,
+ },
+ __experimentalBorder: {
+ color: true,
+ radius: false,
+ },
+ },
+ };
+
+ const reversedProcessedType = processBlockType(
+ 'test/block',
+ reversedSettings
+ )( { select } );
+
+ expect( reversedProcessedType.supports ).toMatchObject( {
border: {
color: true,
radius: false,
style: true,
- width: true,
- __experimentalDefaultControls: {
- color: true,
- radius: true,
- style: true,
- width: true,
+ },
+ } );
+ } );
+
+ it( 'should handle non-object config values', () => {
+ const blockSettings = {
+ ...baseBlockSettings,
+ supports: {
+ __experimentalBorder: true,
+ border: false,
+ },
+ };
+
+ const processedBlockType = processBlockType(
+ 'test/block',
+ blockSettings
+ )( { select } );
+
+ expect( processedBlockType.supports ).toMatchObject( {
+ border: false,
+ } );
+ } );
+
+ it( 'should not modify supports that do not need stabilization', () => {
+ const blockSettings = {
+ ...baseBlockSettings,
+ supports: {
+ align: true,
+ spacing: {
+ padding: true,
+ margin: true,
},
},
+ };
+
+ const processedBlockType = processBlockType(
+ 'test/block',
+ blockSettings
+ )( { select } );
+
+ expect( processedBlockType.supports ).toMatchObject( {
+ align: true,
+ spacing: {
+ padding: true,
+ margin: true,
+ },
} );
} );
} );
diff --git a/packages/edit-site/src/components/global-styles/screen-block.js b/packages/edit-site/src/components/global-styles/screen-block.js
index 64f49574b6b03b..347d3cd1bc0a73 100644
--- a/packages/edit-site/src/components/global-styles/screen-block.js
+++ b/packages/edit-site/src/components/global-styles/screen-block.js
@@ -113,9 +113,8 @@ function ScreenBlock( { name, variation } ) {
if (
settingsForBlockElement?.spacing?.blockGap &&
blockType?.supports?.spacing?.blockGap &&
- ( blockType?.supports?.spacing?.__experimentalSkipSerialization ===
- true ||
- blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
+ ( blockType?.supports?.spacing?.skipSerialization === true ||
+ blockType?.supports?.spacing?.skipSerialization?.some?.(
( spacingType ) => spacingType === 'blockGap'
) )
) {
diff --git a/packages/server-side-render/README.md b/packages/server-side-render/README.md
index ba6fae302ca0a8..ef7cd9bf0189c1 100644
--- a/packages/server-side-render/README.md
+++ b/packages/server-side-render/README.md
@@ -79,7 +79,7 @@ add_filter( 'rest_endpoints', 'add_rest_method');
### skipBlockSupportAttributes
-Remove attributes and style properties applied by the block supports. This prevents duplication of styles in the block wrapper and the `ServerSideRender` components. Even if certain features skip serialization to HTML markup by `__experimentalSkipSerialization`, all attributes and style properties are removed.
+Remove attributes and style properties applied by the block supports. This prevents duplication of styles in the block wrapper and the `ServerSideRender` components. Even if certain features skip serialization to HTML markup by `skipSerialization`, all attributes and style properties are removed.
- Type: `Boolean`
- Required: No
diff --git a/phpunit/block-supports/border-test.php b/phpunit/block-supports/border-test.php
index 0c320f24ebe4f2..6ec43b369d9a2a 100644
--- a/phpunit/block-supports/border-test.php
+++ b/phpunit/block-supports/border-test.php
@@ -128,11 +128,11 @@ public function test_flat_border_with_skipped_serialization() {
'test/flat-border-with-skipped-serialization',
array(
'__experimentalBorder' => array(
- 'color' => true,
- 'radius' => true,
- 'width' => true,
- 'style' => true,
- '__experimentalSkipSerialization' => true,
+ 'color' => true,
+ 'radius' => true,
+ 'width' => true,
+ 'style' => true,
+ 'skipSerialization' => true,
),
)
);
@@ -567,4 +567,167 @@ public function test_should_apply_stabilized_border_supports() {
$this->assertSame( $expected, $actual );
}
+
+ /**
+ * Tests that experimental border support configuration gets stabilized correctly.
+ */
+ public function test_should_stabilize_border_supports() {
+ $block_type_args = array(
+ 'supports' => array(
+ '__experimentalBorder' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ '__experimentalSkipSerialization' => true,
+ '__experimentalDefaultControls' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ ),
+ ),
+ ),
+ );
+
+ $actual = gutenberg_stabilize_experimental_block_supports( $block_type_args );
+ $expected = array(
+ 'supports' => array(
+ 'border' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ 'skipSerialization' => true,
+ // Has to be kept due to core's `wp_should_skip_block_supports_serialization` only checking the experimental flag until 6.8.
+ '__experimentalSkipSerialization' => true,
+ 'defaultControls' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ ),
+ ),
+ ),
+ );
+
+ $this->assertSame( $expected, $actual, 'Stabilized border block support config does not match.' );
+ }
+
+ /**
+ * Tests the merging of border support configuration when stabilizing
+ * experimental config. Due to the ability to filter block type args, plugins
+ * or themes could filter using outdated experimental keys. While not every
+ * permutation of filtering can be covered, the majority of use cases are
+ * served best by merging configs based on the order they were defined if possible.
+ */
+ public function test_should_stabilize_border_supports_using_order_based_merge() {
+ $experimental_border_config = array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ '__experimentalSkipSerialization' => true,
+ '__experimentalDefaultControls' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ ),
+
+ /*
+ * The following simulates theme/plugin filtering using `__experimentalBorder`
+ * key but stable serialization and default control keys.
+ */
+ 'skipSerialization' => false,
+ 'defaultControls' => array(
+ 'color' => true,
+ 'radius' => false,
+ 'style' => true,
+ 'width' => true,
+ ),
+ );
+ $stable_border_config = array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => false,
+ 'width' => true,
+ 'skipSerialization' => false,
+ 'defaultControls' => array(
+ 'color' => true,
+ 'radius' => false,
+ 'style' => false,
+ 'width' => true,
+ ),
+
+ /*
+ * The following simulates theme/plugin filtering using stable `border` key
+ * but experimental serialization and default control keys.
+ */
+ '__experimentalSkipSerialization' => true,
+ '__experimentalDefaultControls' => array(
+ 'color' => false,
+ 'radius' => false,
+ 'style' => false,
+ 'width' => false,
+ ),
+ );
+
+ $experimental_first_args = array(
+ 'supports' => array(
+ '__experimentalBorder' => $experimental_border_config,
+ 'border' => $stable_border_config,
+ ),
+ );
+
+ $actual = gutenberg_stabilize_experimental_block_supports( $experimental_first_args );
+ $expected = array(
+ 'supports' => array(
+ 'border' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => false,
+ 'width' => true,
+ 'skipSerialization' => true,
+ '__experimentalSkipSerialization' => true,
+ 'defaultControls' => array(
+ 'color' => false,
+ 'radius' => false,
+ 'style' => false,
+ 'width' => false,
+ ),
+
+ ),
+ ),
+ );
+ $this->assertSame( $expected, $actual, 'Merged stabilized border block support config does not match when experimental keys are first.' );
+
+ $stable_first_args = array(
+ 'supports' => array(
+ 'border' => $stable_border_config,
+ '__experimentalBorder' => $experimental_border_config,
+ ),
+ );
+
+ $actual = gutenberg_stabilize_experimental_block_supports( $stable_first_args );
+ $expected = array(
+ 'supports' => array(
+ 'border' => array(
+ 'color' => true,
+ 'radius' => true,
+ 'style' => true,
+ 'width' => true,
+ 'skipSerialization' => false,
+ '__experimentalSkipSerialization' => false,
+ 'defaultControls' => array(
+ 'color' => true,
+ 'radius' => false,
+ 'style' => true,
+ 'width' => true,
+ ),
+ ),
+ ),
+ );
+ $this->assertSame( $expected, $actual, 'Merged stabilized border block support config does not match when stable keys are first.' );
+ }
}
From 0a6751c21a208677f46d1dd536d10e95d4ce11d1 Mon Sep 17 00:00:00 2001
From: Daniel Richards
Date: Mon, 25 Nov 2024 16:21:30 +0800
Subject: [PATCH 003/384] Fix block mover clickable area (#67261)
Unlinked contributors: maximebj.
Co-authored-by: talldan
Co-authored-by: ramonjd
---
packages/block-editor/src/components/block-mover/style.scss | 3 +++
1 file changed, 3 insertions(+)
diff --git a/packages/block-editor/src/components/block-mover/style.scss b/packages/block-editor/src/components/block-mover/style.scss
index c58ac9f19673fc..7d23c0f1e5a988 100644
--- a/packages/block-editor/src/components/block-mover/style.scss
+++ b/packages/block-editor/src/components/block-mover/style.scss
@@ -71,6 +71,9 @@
// Specificity is necessary to override block toolbar button styles.
.components-button.block-editor-block-mover-button {
+ // Prevent the SVGs inside the button from overflowing the button.
+ overflow: hidden;
+
// Focus and toggle pseudo elements.
&::before {
content: "";
From 8fa8506a2a33e35badc672a5ed68e2e503dfa200 Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Mon, 25 Nov 2024 12:26:46 +0400
Subject: [PATCH 004/384] Paragraph: Update condition for rendering Drop Cap
for a selected block (#67111)
Co-authored-by: Mamaduka
Co-authored-by: youknowriad
---
packages/block-library/src/paragraph/edit.js | 37 +++++++++++---------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/packages/block-library/src/paragraph/edit.js b/packages/block-library/src/paragraph/edit.js
index b0dc5ab255af78..d32b4e8d5eca02 100644
--- a/packages/block-library/src/paragraph/edit.js
+++ b/packages/block-library/src/paragraph/edit.js
@@ -70,22 +70,24 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
}
return (
- !! dropCap }
- label={ __( 'Drop cap' ) }
- onDeselect={ () => setAttributes( { dropCap: undefined } ) }
- resetAllFilter={ () => ( { dropCap: undefined } ) }
- panelId={ clientId }
- >
-
+ !! dropCap }
label={ __( 'Drop cap' ) }
- checked={ !! dropCap }
- onChange={ () => setAttributes( { dropCap: ! dropCap } ) }
- help={ helpText }
- disabled={ hasDropCapDisabled( align ) }
- />
-
+ onDeselect={ () => setAttributes( { dropCap: undefined } ) }
+ resetAllFilter={ () => ( { dropCap: undefined } ) }
+ panelId={ clientId }
+ >
+ setAttributes( { dropCap: ! dropCap } ) }
+ help={ helpText }
+ disabled={ hasDropCapDisabled( align ) }
+ />
+
+
);
}
@@ -96,6 +98,7 @@ function ParagraphBlock( {
onRemove,
setAttributes,
clientId,
+ isSelected: isSingleSelected,
} ) {
const { align, content, direction, dropCap, placeholder } = attributes;
const blockProps = useBlockProps( {
@@ -131,13 +134,13 @@ function ParagraphBlock( {
/>
) }
-
+ { isSingleSelected && (
-
+ ) }
Date: Mon, 25 Nov 2024 09:55:14 +0100
Subject: [PATCH 005/384] =?UTF-8?q?=F0=9F=A7=B9=20remove=20obsolete=20rich?=
=?UTF-8?q?=20text=20css=20(#67264)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: ellatrix
Co-authored-by: Mamaduka
---
packages/block-editor/src/components/rich-text/content.scss | 6 ------
1 file changed, 6 deletions(-)
diff --git a/packages/block-editor/src/components/rich-text/content.scss b/packages/block-editor/src/components/rich-text/content.scss
index 6f118479fc6b03..28dcd931a7f5db 100644
--- a/packages/block-editor/src/components/rich-text/content.scss
+++ b/packages/block-editor/src/components/rich-text/content.scss
@@ -20,12 +20,6 @@
}
}
-.block-editor-rich-text__editable {
- > p:first-child {
- margin-top: 0;
- }
-}
-
// Captions may have lighter (gray) text, or be shown on a range of different background luminosites.
// To ensure legibility, we increase the default placeholder opacity to ensure contrast.
figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before {
From 66d117fb7dc22a4f7a95956b8d0fe3be81c7885d Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Mon, 25 Nov 2024 13:23:51 +0400
Subject: [PATCH 006/384] Edit Post: Refactor 'MetaBoxVisibility' component
(#67265)
Co-authored-by: Mamaduka
Co-authored-by: ntsekouras
---
.../meta-boxes/meta-box-visibility.js | 37 +++++++------------
1 file changed, 14 insertions(+), 23 deletions(-)
diff --git a/packages/edit-post/src/components/meta-boxes/meta-box-visibility.js b/packages/edit-post/src/components/meta-boxes/meta-box-visibility.js
index 26b69d37f00210..07060afa31dea5 100644
--- a/packages/edit-post/src/components/meta-boxes/meta-box-visibility.js
+++ b/packages/edit-post/src/components/meta-boxes/meta-box-visibility.js
@@ -1,24 +1,21 @@
/**
* WordPress dependencies
*/
-import { Component } from '@wordpress/element';
-import { withSelect } from '@wordpress/data';
+import { useEffect } from '@wordpress/element';
+import { useSelect } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
-class MetaBoxVisibility extends Component {
- componentDidMount() {
- this.updateDOM();
- }
-
- componentDidUpdate( prevProps ) {
- if ( this.props.isVisible !== prevProps.isVisible ) {
- this.updateDOM();
- }
- }
-
- updateDOM() {
- const { id, isVisible } = this.props;
+export default function MetaBoxVisibility( { id } ) {
+ const isVisible = useSelect(
+ ( select ) => {
+ return select( editorStore ).isEditorPanelEnabled(
+ `meta-box-${ id }`
+ );
+ },
+ [ id ]
+ );
+ useEffect( () => {
const element = document.getElementById( id );
if ( ! element ) {
return;
@@ -29,13 +26,7 @@ class MetaBoxVisibility extends Component {
} else {
element.classList.add( 'is-hidden' );
}
- }
+ }, [ id, isVisible ] );
- render() {
- return null;
- }
+ return null;
}
-
-export default withSelect( ( select, { id } ) => ( {
- isVisible: select( editorStore ).isEditorPanelEnabled( `meta-box-${ id }` ),
-} ) )( MetaBoxVisibility );
From 7e7ce3c0135351e5847d51e349e6b5c6885ee9ac Mon Sep 17 00:00:00 2001
From: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Date: Mon, 25 Nov 2024 18:25:48 +0900
Subject: [PATCH 007/384] Site Editor Sidebar: Fixed focus/hover style for
navigation item buttons (#67251)
Co-authored-by: t-hamano
Co-authored-by: talldan
Co-authored-by: jasmussen
---
.../sidebar-navigation-screen-navigation-menus/style.scss | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss
index 334e90e93c42ce..544aad5075aec0 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss
@@ -27,6 +27,14 @@
color: $white;
}
}
+
+ .block-editor-list-view-block__menu {
+ color: $gray-600;
+ &:hover,
+ &:focus {
+ color: $white;
+ }
+ }
}
.edit-site-sidebar-navigation-screen-navigation-menus__loading.components-spinner {
From 7e9e53d0581e8f21ad029fb3ffd03f43680326b1 Mon Sep 17 00:00:00 2001
From: Manzoor Wani
Date: Mon, 25 Nov 2024 02:11:31 -0800
Subject: [PATCH 008/384] Fix TS types for the editor package (#67196)
* Replace the wrong Component type with React Node/Element
* Replace the wrong Component type with React Node/Element
* Fix the optional params for store actions
* Replace the deprecated JSX.Element with React.ReactNode
* Update docs
* Fix children prop for multiple components
---
.../reference-guides/data/data-core-editor.md | 11 +-
packages/editor/README.md | 192 +++++++++---------
.../plugin-block-settings-menu-item.js | 2 +-
.../components/collab-sidebar/add-comment.js | 2 +-
.../collab-sidebar/comment-author-info.js | 2 +-
.../components/collab-sidebar/comment-form.js | 2 +-
.../src/components/collab-sidebar/comments.js | 4 +-
.../src/components/document-bar/index.js | 2 +-
.../src/components/document-outline/check.js | 6 +-
.../src/components/document-outline/index.js | 2 +-
.../src/components/editor-history/redo.js | 2 +-
.../src/components/editor-history/undo.js | 2 +-
.../src/components/editor-notices/index.js | 2 +-
.../src/components/editor-snackbars/index.js | 2 +-
.../components/entities-saved-states/index.js | 4 +-
.../src/components/page-attributes/check.js | 6 +-
.../src/components/page-attributes/order.js | 2 +-
.../src/components/page-attributes/panel.js | 2 +-
.../src/components/page-attributes/parent.js | 2 +-
.../plugin-document-setting-panel/index.js | 4 +-
.../components/plugin-more-menu-item/index.js | 3 +-
.../plugin-post-publish-panel/index.js | 4 +-
.../plugin-post-status-info/index.js | 8 +-
.../plugin-pre-publish-panel/index.js | 4 +-
.../plugin-preview-menu-item/index.js | 3 +-
.../plugin-sidebar-more-menu-item/index.js | 4 +-
.../src/components/plugin-sidebar/index.js | 1 +
.../src/components/post-author/check.js | 6 +-
.../src/components/post-author/index.js | 2 +-
.../src/components/post-author/panel.js | 2 +-
.../src/components/post-comments/index.js | 2 +-
.../src/components/post-discussion/panel.js | 2 +-
.../src/components/post-excerpt/check.js | 6 +-
.../src/components/post-excerpt/panel.js | 2 +-
.../src/components/post-excerpt/plugin.js | 8 +-
.../components/post-featured-image/check.js | 6 +-
.../components/post-featured-image/panel.js | 2 +-
.../src/components/post-format/check.js | 20 +-
.../src/components/post-format/index.js | 2 +-
.../src/components/post-format/panel.js | 2 +-
.../components/post-last-revision/check.js | 6 +-
.../components/post-last-revision/index.js | 2 +-
.../components/post-last-revision/panel.js | 2 +-
.../src/components/post-locked-modal/index.js | 2 +-
.../components/post-pending-status/check.js | 6 +-
.../components/post-pending-status/index.js | 2 +-
.../components/post-preview-button/index.js | 2 +-
.../src/components/post-schedule/check.js | 6 +-
.../src/components/post-schedule/index.js | 2 +-
.../src/components/post-schedule/label.js | 2 +-
.../src/components/post-schedule/panel.js | 2 +-
.../editor/src/components/post-slug/check.js | 6 +-
.../editor/src/components/post-slug/index.js | 2 +-
.../src/components/post-sticky/check.js | 6 +-
.../src/components/post-sticky/index.js | 2 +-
.../post-switch-to-draft-button/index.js | 2 +-
.../src/components/post-sync-status/index.js | 2 +-
.../src/components/post-taxonomies/check.js | 6 +-
.../post-taxonomies/flat-term-selector.js | 2 +-
.../src/components/post-taxonomies/panel.js | 27 +--
.../components/post-template/classic-theme.js | 4 +-
.../src/components/post-template/panel.js | 2 +-
.../src/components/post-text-editor/index.js | 2 +-
.../editor/src/components/post-title/index.js | 2 +-
.../components/post-title/post-title-raw.js | 2 +-
.../editor/src/components/post-trash/check.js | 6 +-
.../editor/src/components/post-trash/index.js | 2 +-
.../post-type-support-check/index.js | 12 +-
.../editor/src/components/post-url/check.js | 6 +-
.../editor/src/components/post-url/index.js | 2 +-
.../editor/src/components/post-url/label.js | 2 +-
.../editor/src/components/post-url/panel.js | 2 +-
.../src/components/post-visibility/check.js | 2 +-
.../src/components/post-visibility/index.js | 2 +-
.../editor/src/components/provider/index.js | 2 +-
.../src/components/table-of-contents/index.js | 2 +-
.../components/theme-support-check/index.js | 8 +-
.../src/components/time-to-read/index.js | 2 +-
.../unsaved-changes-warning/index.js | 2 +-
.../editor/src/components/word-count/index.js | 2 +-
packages/editor/src/store/actions.js | 19 +-
81 files changed, 260 insertions(+), 256 deletions(-)
diff --git a/docs/reference-guides/data/data-core-editor.md b/docs/reference-guides/data/data-core-editor.md
index 9567d8e4b954fa..44078ab284e94f 100644
--- a/docs/reference-guides/data/data-core-editor.md
+++ b/docs/reference-guides/data/data-core-editor.md
@@ -1148,7 +1148,8 @@ Action that autosaves the current post. This includes server-side autosaving (de
_Parameters_
-- _options_ `Object?`: Extra flags to identify the autosave.
+- _options_ `[Object]`: Extra flags to identify the autosave.
+- _options.local_ `[boolean]`: Whether to perform a local autosave.
### clearSelectedBlock
@@ -1204,7 +1205,7 @@ const getFeaturedMediaUrl = useSelect( ( select ) => {
_Parameters_
- _edits_ `Object`: Post attributes to edit.
-- _options_ `Object`: Options for the edit.
+- _options_ `[Object]`: Options for the edit.
_Returns_
@@ -1417,7 +1418,7 @@ Returns an action object used to signal that the blocks have been updated.
_Parameters_
- _blocks_ `Array`: Block Array.
-- _options_ `?Object`: Optional options.
+- _options_ `[Object]`: Optional options.
### resetPost
@@ -1431,7 +1432,7 @@ Action for saving the current post in the editor.
_Parameters_
-- _options_ `Object`:
+- _options_ `[Object]`:
### selectBlock
@@ -1519,7 +1520,7 @@ _Parameters_
- _post_ `Object`: Post object.
- _edits_ `Object`: Initial edited attributes object.
-- _template_ `Array?`: Block Template.
+- _template_ `[Array]`: Block Template.
### setupEditorState
diff --git a/packages/editor/README.md b/packages/editor/README.md
index bc00e15c8fb892..ac655bd1c99d8c 100644
--- a/packages/editor/README.md
+++ b/packages/editor/README.md
@@ -270,7 +270,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered DocumentBar component.
+- `React.ReactNode`: The rendered DocumentBar component.
### DocumentOutline
@@ -284,7 +284,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### DocumentOutlineCheck
@@ -293,11 +293,11 @@ Component check if there are any headings (core/heading blocks) present in the d
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactElement`: Children to be rendered.
_Returns_
-- `Component|null`: The component to be rendered or null if there are headings.
+- `React.ReactElement`: The component to be rendered or null if there are headings.
### EditorHistoryRedo
@@ -310,7 +310,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### EditorHistoryUndo
@@ -323,7 +323,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### EditorKeyboardShortcuts
@@ -351,7 +351,7 @@ _Usage_
_Returns_
-- `JSX.Element`: The rendered EditorNotices component.
+- `React.ReactNode`: The rendered EditorNotices component.
### EditorProvider
@@ -383,7 +383,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered EditorProvider component.
+- `React.ReactNode`: The rendered EditorProvider component.
### EditorSnackbars
@@ -391,7 +391,7 @@ Renders the editor snackbars component.
_Returns_
-- `JSX.Element`: The rendered component.
+- `React.ReactNode`: The rendered component.
### EntitiesSavedStates
@@ -405,7 +405,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered component.
+- `React.ReactNode`: The rendered component.
### ErrorBoundary
@@ -523,11 +523,11 @@ Wrapper component that renders its children only if the post type supports page
_Parameters_
- _props_ `Object`: - The component props.
-- _props.children_ `Element`: - The child components to render.
+- _props.children_ `React.ReactElement`: - The child components to render.
_Returns_
-- `Component|null`: The rendered child components or null if page attributes are not supported.
+- `React.ReactElement`: The rendered child components or null if page attributes are not supported.
### PageAttributesOrder
@@ -535,7 +535,7 @@ Renders the Page Attributes Order component. A number input in an editor interfa
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PageAttributesPanel
@@ -543,7 +543,7 @@ Renders the Page Attributes Panel component.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PageAttributesParent
@@ -551,7 +551,7 @@ Renders the Page Attributes Parent component. A dropdown menu in an editor inter
_Returns_
-- `Component|null`: The component to be rendered. Return null if post type is not hierarchical.
+- `React.ReactNode`: The component to be rendered. Return null if post type is not hierarchical.
### PageTemplate
@@ -561,7 +561,7 @@ The dropdown menu includes a button for toggling the menu, a list of available t
_Returns_
-- `JSX.Element`: The rendered ClassicThemeControl component.
+- `React.ReactNode`: The rendered ClassicThemeControl component.
### PanelColorSettings
@@ -627,7 +627,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PluginDocumentSettingPanel
@@ -684,11 +684,11 @@ _Parameters_
- _props.className_ `[string]`: An optional class name added to the row.
- _props.title_ `[string]`: The title of the panel
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
-- _props.children_ `Element`: Children to be rendered
+- _props.children_ `React.ReactNode`: Children to be rendered
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The component to be rendered.
### PluginMoreMenuItem
@@ -738,6 +738,7 @@ const MyButtonMoreMenuItem = () => (
_Parameters_
- _props_ `Object`: Component properties.
+- _props.children_ `[React.ReactNode]`: Children to be rendered.
- _props.href_ `[string]`: When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
- _props.onClick_ `[Function]`: The callback function to be executed when the user clicks the menu item.
@@ -745,7 +746,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PluginPostPublishPanel
@@ -776,11 +777,11 @@ _Parameters_
- _props.title_ `[string]`: Title displayed at the top of the panel.
- _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
-- _props.children_ `Element`: Children to be rendered
+- _props.children_ `React.ReactNode`: Children to be rendered
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PluginPostStatusInfo
@@ -820,11 +821,11 @@ _Parameters_
- _props_ `Object`: Component properties.
- _props.className_ `[string]`: An optional class name added to the row.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactNode`: Children to be rendered.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PluginPrePublishPanel
@@ -855,11 +856,11 @@ _Parameters_
- _props.title_ `[string]`: Title displayed at the top of the panel.
- _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
-- _props.children_ `Element`: Children to be rendered
+- _props.children_ `React.ReactNode`: Children to be rendered
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PluginPreviewMenuItem
@@ -889,6 +890,7 @@ registerPlugin( 'external-preview-menu-item', {
_Parameters_
- _props_ `Object`: Component properties.
+- _props.children_ `[React.ReactNode]`: Children to be rendered.
- _props.href_ `[string]`: When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.
- _props.icon_ `[WPBlockTypeIconRender]`: The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.
- _props.onClick_ `[Function]`: The callback function to be executed when the user clicks the menu item.
@@ -896,7 +898,7 @@ _Parameters_
_Returns_
-- `Component`: The rendered menu item component.
+- `React.ReactNode`: The rendered menu item component.
### PluginSidebar
@@ -953,6 +955,7 @@ _Parameters_
- _props_ `Object`: Element props.
- _props.name_ `string`: A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
+- _props.children_ `[React.ReactNode]`: Children to be rendered.
- _props.className_ `[string]`: An optional class name added to the sidebar body.
- _props.title_ `string`: Title displayed at the top of the sidebar.
- _props.isPinnable_ `[boolean]`: Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
@@ -999,11 +1002,12 @@ _Parameters_
- _props_ `Object`: Component props.
- _props.target_ `string`: A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
+- _props.children_ `[React.ReactNode]`: Children to be rendered.
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostAuthor
@@ -1011,7 +1015,7 @@ Renders the component for selecting the post author.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostAuthorCheck
@@ -1020,11 +1024,11 @@ Wrapper component that renders its children only if the post type supports the a
_Parameters_
- _props_ `Object`: The component props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactNode`: Children to be rendered.
_Returns_
-- `Component|null`: The component to be rendered. Return `null` if the post type doesn't supports the author or if there are no authors available.
+- `React.ReactNode`: The component to be rendered. Return `null` if the post type doesn't supports the author or if there are no authors available.
### PostAuthorPanel
@@ -1032,7 +1036,7 @@ Renders the Post Author Panel component.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostComments
@@ -1040,7 +1044,7 @@ A form for managing comment status.
_Returns_
-- `JSX.Element`: The rendered PostComments component.
+- `React.ReactNode`: The rendered PostComments component.
### PostDiscussionPanel
@@ -1048,7 +1052,7 @@ This component allows to update comment and pingback settings for the current po
_Returns_
-- `JSX.Element|null`: The rendered PostDiscussionPanel component.
+- `React.ReactNode`: The rendered PostDiscussionPanel component.
### PostExcerpt
@@ -1067,11 +1071,11 @@ Component for checking if the post type supports the excerpt field.
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactNode`: Children to be rendered.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostExcerptPanel
@@ -1079,7 +1083,7 @@ Is rendered if the post type supports excerpts and allows editing the excerpt.
_Returns_
-- `JSX.Element`: The rendered PostExcerptPanel component.
+- `React.ReactNode`: The rendered PostExcerptPanel component.
### PostFeaturedImage
@@ -1108,11 +1112,11 @@ Wrapper component that renders its children only if the post type supports a fea
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactNode`: Children to be rendered.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostFeaturedImagePanel
@@ -1125,7 +1129,7 @@ _Parameters_
_Returns_
-- `Component|null`: The component to be rendered. Return Null if the editor panel is disabled for featured image.
+- `React.ReactNode`: The component to be rendered. Return Null if the editor panel is disabled for featured image.
### PostFormat
@@ -1139,7 +1143,7 @@ _Usage_
_Returns_
-- `JSX.Element`: The rendered PostFormat component.
+- `React.ReactNode`: The rendered PostFormat component.
### PostFormatCheck
@@ -1148,11 +1152,11 @@ Component check if there are any post formats.
_Parameters_
- _props_ `Object`: The component props.
-- _props.children_ `Element`: The child elements to render.
+- _props.children_ `React.ReactNode`: The child elements to render.
_Returns_
-- `Component|null`: The rendered component or null if post formats are disabled.
+- `React.ReactNode`: The rendered component or null if post formats are disabled.
### PostLastRevision
@@ -1160,7 +1164,7 @@ Renders the component for displaying the last revision of a post.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostLastRevisionCheck
@@ -1169,11 +1173,11 @@ Wrapper component that renders its children if the post has more than one revisi
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactNode`: Children to be rendered.
_Returns_
-- `Component|null`: Rendered child components if post has more than one revision, otherwise null.
+- `React.ReactNode`: Rendered child components if post has more than one revision, otherwise null.
### PostLastRevisionPanel
@@ -1181,7 +1185,7 @@ Renders the panel for displaying the last revision of a post.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostLockedModal
@@ -1189,7 +1193,7 @@ A modal component that is displayed when a post is locked for editing by another
_Returns_
-- `JSX.Element|null`: The rendered PostLockedModal component.
+- `React.ReactNode`: The rendered PostLockedModal component.
### PostPendingStatus
@@ -1197,7 +1201,7 @@ A component for displaying and toggling the pending status of a post.
_Returns_
-- `JSX.Element`: The rendered component.
+- `React.ReactNode`: The rendered component.
### PostPendingStatusCheck
@@ -1206,11 +1210,11 @@ This component checks the publishing status of the current post. If the post is
_Parameters_
- _props_ `Object`: Component properties.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactElement`: Children to be rendered.
_Returns_
-- `JSX.Element|null`: The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
+- `React.ReactElement`: The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
### PostPingbacks
@@ -1231,7 +1235,7 @@ _Parameters_
_Returns_
-- `JSX.Element|null`: The rendered button component.
+- `React.ReactNode`: The rendered button component.
### PostPublishButton
@@ -1273,7 +1277,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostScheduleCheck
@@ -1282,11 +1286,11 @@ Wrapper component that renders its children only if post has a publish action.
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactElement`: Children to be rendered.
_Returns_
-- `Component`: - The component to be rendered or null if there is no publish action.
+- `React.ReactElement`: - The component to be rendered or null if there is no publish action.
### PostScheduleLabel
@@ -1298,7 +1302,7 @@ _Parameters_
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostSchedulePanel
@@ -1306,7 +1310,7 @@ Renders the Post Schedule Panel component.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostSlug
@@ -1314,7 +1318,7 @@ Renders the PostSlug component. It provide a control for editing the post slug.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostSlugCheck
@@ -1323,11 +1327,11 @@ Wrapper component that renders its children only if the post type supports the s
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactNode`: Children to be rendered.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostSticky
@@ -1335,7 +1339,7 @@ Renders the PostSticky component. It provides a checkbox control for the sticky
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactNode`: The rendered component.
### PostStickyCheck
@@ -1344,11 +1348,11 @@ Wrapper component that renders its children only if post has a sticky action.
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered.
+- _props.children_ `React.ReactElement`: Children to be rendered.
_Returns_
-- `Component`: The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
+- `React.ReactElement`: The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
### PostSwitchToDraftButton
@@ -1356,7 +1360,7 @@ Renders a button component that allows the user to switch a post to draft status
_Returns_
-- `JSX.Element`: The rendered component.
+- `React.ReactNode`: The rendered component.
### PostSyncStatus
@@ -1364,7 +1368,7 @@ Renders the sync status of a post.
_Returns_
-- `JSX.Element|null`: The rendered sync status component.
+- `React.ReactNode`: The rendered sync status component.
### PostTaxonomies
@@ -1386,11 +1390,11 @@ Renders the children components only if the current post type has taxonomies.
_Parameters_
- _props_ `Object`: The component props.
-- _props.children_ `Element`: The children components to render.
+- _props.children_ `React.ReactNode`: The children components to render.
_Returns_
-- `Component|null`: The rendered children components or null if the current post type has no taxonomies.
+- `React.ReactElement`: The rendered children components or null if the current post type has no taxonomies.
### PostTaxonomiesFlatTermSelector
@@ -1404,7 +1408,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered flat term selector component.
+- `React.ReactNode`: The rendered flat term selector component.
### PostTaxonomiesHierarchicalTermSelector
@@ -1421,17 +1425,11 @@ _Returns_
### PostTaxonomiesPanel
-Renders a panel for a specific taxonomy.
-
-_Parameters_
-
-- _props_ `Object`: The component props.
-- _props.taxonomy_ `Object`: The taxonomy object.
-- _props.children_ `Element`: The child components.
+Component that renders the post taxonomies panel.
_Returns_
-- `Component`: The rendered taxonomy panel.
+- `React.ReactNode`: The rendered component.
### PostTemplatePanel
@@ -1439,7 +1437,7 @@ Displays the template controls based on the current editor settings and user per
_Returns_
-- `JSX.Element|null`: The rendered PostTemplatePanel component.
+- `React.ReactNode`: The rendered PostTemplatePanel component.
### PostTextEditor
@@ -1447,7 +1445,7 @@ Displays the Post Text Editor along with content in Visual and Text mode.
_Returns_
-- `JSX.Element|null`: The rendered PostTextEditor component.
+- `React.ReactNode`: The rendered PostTextEditor component.
### PostTitle
@@ -1460,7 +1458,7 @@ _Parameters_
_Returns_
-- `Component`: The rendered PostTitle component.
+- `React.ReactNode`: The rendered PostTitle component.
### PostTitleRaw
@@ -1476,7 +1474,7 @@ _Parameters_
_Returns_
-- `JSX.Element|null`: The rendered PostTrash component.
+- `React.ReactNode`: The rendered PostTrash component.
### PostTrashCheck
@@ -1485,11 +1483,11 @@ Wrapper component that renders its children only if the post can trashed.
_Parameters_
- _props_ `Object`: - The component props.
-- _props.children_ `Element`: - The child components to render.
+- _props.children_ `React.ReactEl`: - The child components to render.
_Returns_
-- `Component|null`: The rendered child components or null if the post can not trashed.
+- `React.ReactElement`: The rendered child components or null if the post can not trashed.
### PostTypeSupportCheck
@@ -1498,12 +1496,12 @@ A component which renders its own children only if the current editor post type
_Parameters_
- _props_ `Object`: Props.
-- _props.children_ `Element`: Children to be rendered if post type supports.
+- _props.children_ `React.ReactElement`: Children to be rendered if post type supports.
- _props.supportKeys_ `(string|string[])`: String or string array of keys to test.
_Returns_
-- `Component`: The component to be rendered.
+- `React.ReactElement`: The component to be rendered.
### PostURL
@@ -1521,7 +1519,7 @@ _Parameters_
_Returns_
-- `Component`: The rendered PostURL component.
+- `React.ReactNode`: The rendered PostURL component.
### PostURLCheck
@@ -1530,11 +1528,11 @@ Check if the post URL is valid and visible.
_Parameters_
- _props_ `Object`: The component props.
-- _props.children_ `Element`: The child components.
+- _props.children_ `React.ReactElement`: The child components.
_Returns_
-- `Component|null`: The child components if the post URL is valid and visible, otherwise null.
+- `React.ReactElement`: The child components if the post URL is valid and visible, otherwise null.
### PostURLLabel
@@ -1542,7 +1540,7 @@ Represents a label component for a post URL.
_Returns_
-- `Component`: The PostURLLabel component.
+- `React.ReactNode`: The PostURLLabel component.
### PostURLPanel
@@ -1550,7 +1548,7 @@ Renders the `PostURLPanel` component.
_Returns_
-- `JSX.Element`: The rendered PostURLPanel component.
+- `React.ReactNode`: The rendered PostURLPanel component.
### PostVisibility
@@ -1563,7 +1561,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered component.
+- `React.ReactNode`: The rendered component.
### PostVisibilityCheck
@@ -1576,7 +1574,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered component.
+- `React.ReactNode`: The rendered component.
### PostVisibilityLabel
@@ -1663,7 +1661,7 @@ _Parameters_
_Returns_
-- `JSX.Element`: The rendered table of contents component.
+- `React.ReactNode`: The rendered table of contents component.
### TextEditorGlobalKeyboardShortcuts
@@ -1678,12 +1676,12 @@ Checks if the current theme supports specific features and renders the children
_Parameters_
- _props_ `Object`: The component props.
-- _props.children_ `Element`: The children to render if the theme supports the specified features.
+- _props.children_ `React.ReactElement`: The children to render if the theme supports the specified features.
- _props.supportKeys_ `string|string[]`: The key(s) of the theme support(s) to check.
_Returns_
-- `JSX.Element|null`: The rendered children if the theme supports the specified features, otherwise null.
+- `React.ReactElement`: The rendered children if the theme supports the specified features, otherwise null.
### TimeToRead
@@ -1691,7 +1689,7 @@ Component for showing Time To Read in Content.
_Returns_
-- `JSX.Element`: The rendered TimeToRead component.
+- `React.ReactNode`: The rendered TimeToRead component.
### transformStyles
@@ -1727,7 +1725,7 @@ Warns the user if there are unsaved changes before leaving the editor. Compatibl
_Returns_
-- `Component`: The component.
+- `React.ReactNode`: The component.
### URLInput
@@ -1814,7 +1812,7 @@ Renders the word count of the post content.
_Returns_
-- `JSX.Element|null`: The rendered WordCount component.
+- `React.ReactNode`: The rendered WordCount component.
### WritingFlow
diff --git a/packages/editor/src/components/block-settings-menu/plugin-block-settings-menu-item.js b/packages/editor/src/components/block-settings-menu/plugin-block-settings-menu-item.js
index 59c9e9c32d4a4b..df1e75d2d0e8b5 100644
--- a/packages/editor/src/components/block-settings-menu/plugin-block-settings-menu-item.js
+++ b/packages/editor/src/components/block-settings-menu/plugin-block-settings-menu-item.js
@@ -76,7 +76,7 @@ const shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
const PluginBlockSettingsMenuItem = ( {
allowedBlocks,
diff --git a/packages/editor/src/components/collab-sidebar/add-comment.js b/packages/editor/src/components/collab-sidebar/add-comment.js
index fce47e821e2065..2330017ac5db53 100644
--- a/packages/editor/src/components/collab-sidebar/add-comment.js
+++ b/packages/editor/src/components/collab-sidebar/add-comment.js
@@ -22,7 +22,7 @@ import CommentForm from './comment-form';
* @param {Function} props.onSubmit - A callback function to be called when the user submits a comment.
* @param {boolean} props.showCommentBoard - The function to edit the comment.
* @param {Function} props.setShowCommentBoard - The function to delete the comment.
- * @return {JSX.Element} The rendered comment input UI.
+ * @return {React.ReactNode} The rendered comment input UI.
*/
export function AddComment( {
onSubmit,
diff --git a/packages/editor/src/components/collab-sidebar/comment-author-info.js b/packages/editor/src/components/collab-sidebar/comment-author-info.js
index 89d09a2b52261f..d8b5f72a2fc25f 100644
--- a/packages/editor/src/components/collab-sidebar/comment-author-info.js
+++ b/packages/editor/src/components/collab-sidebar/comment-author-info.js
@@ -16,7 +16,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
* @param {string} props.name - Name of the author.
* @param {string} props.date - Date of the comment.
*
- * @return {JSX.Element} The JSX element representing the author's information.
+ * @return {React.ReactNode} The JSX element representing the author's information.
*/
function CommentAuthorInfo( { avatar, name, date } ) {
const dateSettings = getDateSettings();
diff --git a/packages/editor/src/components/collab-sidebar/comment-form.js b/packages/editor/src/components/collab-sidebar/comment-form.js
index 28622f9f52a6f8..052fd3cdd26568 100644
--- a/packages/editor/src/components/collab-sidebar/comment-form.js
+++ b/packages/editor/src/components/collab-sidebar/comment-form.js
@@ -22,7 +22,7 @@ import { sanitizeCommentString } from './utils';
* @param {Function} props.onCancel - The function to call when canceling the comment update.
* @param {Object} props.thread - The comment thread object.
* @param {string} props.submitButtonText - The text to display on the submit button.
- * @return {JSX.Element} The CommentForm component.
+ * @return {React.ReactNode} The CommentForm component.
*/
function CommentForm( { onSubmit, onCancel, thread, submitButtonText } ) {
const [ inputComment, setInputComment ] = useState(
diff --git a/packages/editor/src/components/collab-sidebar/comments.js b/packages/editor/src/components/collab-sidebar/comments.js
index 808ea0acf04b31..7a03068787c81e 100644
--- a/packages/editor/src/components/collab-sidebar/comments.js
+++ b/packages/editor/src/components/collab-sidebar/comments.js
@@ -35,7 +35,7 @@ import CommentForm from './comment-form';
* @param {Function} props.onAddReply - The function to add a reply to a comment.
* @param {Function} props.onCommentDelete - The function to delete a comment.
* @param {Function} props.onCommentResolve - The function to mark a comment as resolved.
- * @return {JSX.Element} The rendered Comments component.
+ * @return {React.ReactNode} The rendered Comments component.
*/
export function Comments( {
threads,
@@ -270,7 +270,7 @@ export function Comments( {
* @param {Function} props.onDelete - The function to delete the comment.
* @param {Function} props.onReply - The function to reply to the comment.
* @param {string} props.status - The status of the comment.
- * @return {JSX.Element} The rendered comment header.
+ * @return {React.ReactNode} The rendered comment header.
*/
function CommentHeader( {
thread,
diff --git a/packages/editor/src/components/document-bar/index.js b/packages/editor/src/components/document-bar/index.js
index 30990379fe6301..9fffba941a4355 100644
--- a/packages/editor/src/components/document-bar/index.js
+++ b/packages/editor/src/components/document-bar/index.js
@@ -49,7 +49,7 @@ const MotionButton = motion( Button );
* @param {IconType} props.icon An icon for the document, no default.
* (A default icon indicating the document post type is no longer used.)
*
- * @return {JSX.Element} The rendered DocumentBar component.
+ * @return {React.ReactNode} The rendered DocumentBar component.
*/
export default function DocumentBar( props ) {
const {
diff --git a/packages/editor/src/components/document-outline/check.js b/packages/editor/src/components/document-outline/check.js
index d0676aa9037ffe..87864cbb34a369 100644
--- a/packages/editor/src/components/document-outline/check.js
+++ b/packages/editor/src/components/document-outline/check.js
@@ -7,10 +7,10 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
/**
* Component check if there are any headings (core/heading blocks) present in the document.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactElement} props.children Children to be rendered.
*
- * @return {Component|null} The component to be rendered or null if there are headings.
+ * @return {React.ReactElement} The component to be rendered or null if there are headings.
*/
export default function DocumentOutlineCheck( { children } ) {
const hasHeadings = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/document-outline/index.js b/packages/editor/src/components/document-outline/index.js
index c5e59837362092..89f853798296ae 100644
--- a/packages/editor/src/components/document-outline/index.js
+++ b/packages/editor/src/components/document-outline/index.js
@@ -106,7 +106,7 @@ const isEmptyHeading = ( heading ) =>
* @param {Function} props.onSelect Function to be called when an outline item is selected
* @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function DocumentOutline( {
onSelect,
diff --git a/packages/editor/src/components/editor-history/redo.js b/packages/editor/src/components/editor-history/redo.js
index 46a263bb89926b..b2b20555f30544 100644
--- a/packages/editor/src/components/editor-history/redo.js
+++ b/packages/editor/src/components/editor-history/redo.js
@@ -50,6 +50,6 @@ function EditorHistoryRedo( props, ref ) {
* @param {Object} props - Props.
* @param {Ref} ref - Forwarded ref.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default forwardRef( EditorHistoryRedo );
diff --git a/packages/editor/src/components/editor-history/undo.js b/packages/editor/src/components/editor-history/undo.js
index 6ba6055706e993..fe8cce72c4197e 100644
--- a/packages/editor/src/components/editor-history/undo.js
+++ b/packages/editor/src/components/editor-history/undo.js
@@ -46,6 +46,6 @@ function EditorHistoryUndo( props, ref ) {
* @param {Object} props - Props.
* @param {Ref} ref - Forwarded ref.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default forwardRef( EditorHistoryUndo );
diff --git a/packages/editor/src/components/editor-notices/index.js b/packages/editor/src/components/editor-notices/index.js
index 28341bfda3f236..5f095ef1a813c6 100644
--- a/packages/editor/src/components/editor-notices/index.js
+++ b/packages/editor/src/components/editor-notices/index.js
@@ -18,7 +18,7 @@ import TemplateValidationNotice from '../template-validation-notice';
*
* ```
*
- * @return {JSX.Element} The rendered EditorNotices component.
+ * @return {React.ReactNode} The rendered EditorNotices component.
*/
export function EditorNotices() {
const { notices } = useSelect(
diff --git a/packages/editor/src/components/editor-snackbars/index.js b/packages/editor/src/components/editor-snackbars/index.js
index 6530e1ec7ea902..9b781ee60dcaa5 100644
--- a/packages/editor/src/components/editor-snackbars/index.js
+++ b/packages/editor/src/components/editor-snackbars/index.js
@@ -11,7 +11,7 @@ const MAX_VISIBLE_NOTICES = -3;
/**
* Renders the editor snackbars component.
*
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export default function EditorSnackbars() {
const notices = useSelect(
diff --git a/packages/editor/src/components/entities-saved-states/index.js b/packages/editor/src/components/entities-saved-states/index.js
index 849bd2d0d71c8c..ea05bca522941b 100644
--- a/packages/editor/src/components/entities-saved-states/index.js
+++ b/packages/editor/src/components/entities-saved-states/index.js
@@ -33,7 +33,7 @@ function identity( values ) {
* @param {Function} props.close The function to close the dialog.
* @param {Function} props.renderDialog The function to render the dialog.
*
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export default function EntitiesSavedStates( {
close,
@@ -64,7 +64,7 @@ export default function EntitiesSavedStates( {
* @param {Function} props.setUnselectedEntities Function to set unselected entities.
* @param {Array} props.unselectedEntities Array of unselected entities.
*
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export function EntitiesSavedStatesExtensible( {
additionalPrompt = undefined,
diff --git a/packages/editor/src/components/page-attributes/check.js b/packages/editor/src/components/page-attributes/check.js
index bed2b1a353842a..3c08a3d8e53514 100644
--- a/packages/editor/src/components/page-attributes/check.js
+++ b/packages/editor/src/components/page-attributes/check.js
@@ -12,10 +12,10 @@ import { store as editorStore } from '../../store';
/**
* Wrapper component that renders its children only if the post type supports page attributes.
*
- * @param {Object} props - The component props.
- * @param {Element} props.children - The child components to render.
+ * @param {Object} props - The component props.
+ * @param {React.ReactElement} props.children - The child components to render.
*
- * @return {Component|null} The rendered child components or null if page attributes are not supported.
+ * @return {React.ReactElement} The rendered child components or null if page attributes are not supported.
*/
export function PageAttributesCheck( { children } ) {
const supportsPageAttributes = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/page-attributes/order.js b/packages/editor/src/components/page-attributes/order.js
index c5f02c71b613d4..04c6ce186a9701 100644
--- a/packages/editor/src/components/page-attributes/order.js
+++ b/packages/editor/src/components/page-attributes/order.js
@@ -59,7 +59,7 @@ function PageAttributesOrder() {
* for setting the order of a given page.
* The component is now not used in core but was kept for backward compatibility.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PageAttributesOrderWithChecks() {
return (
diff --git a/packages/editor/src/components/page-attributes/panel.js b/packages/editor/src/components/page-attributes/panel.js
index 7fcaf4b90d9ffe..8ecf7f1642f718 100644
--- a/packages/editor/src/components/page-attributes/panel.js
+++ b/packages/editor/src/components/page-attributes/panel.js
@@ -33,7 +33,7 @@ function AttributesPanel() {
/**
* Renders the Page Attributes Panel component.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PageAttributesPanel() {
return (
diff --git a/packages/editor/src/components/page-attributes/parent.js b/packages/editor/src/components/page-attributes/parent.js
index 17395589cd313b..bd2861766c334a 100644
--- a/packages/editor/src/components/page-attributes/parent.js
+++ b/packages/editor/src/components/page-attributes/parent.js
@@ -56,7 +56,7 @@ export const getItemPriority = ( name, searchValue ) => {
* Renders the Page Attributes Parent component. A dropdown menu in an editor interface
* for selecting the parent page of a given page.
*
- * @return {Component|null} The component to be rendered. Return null if post type is not hierarchical.
+ * @return {React.ReactNode} The component to be rendered. Return null if post type is not hierarchical.
*/
export function PageAttributesParent() {
const { editPost } = useDispatch( editorStore );
diff --git a/packages/editor/src/components/plugin-document-setting-panel/index.js b/packages/editor/src/components/plugin-document-setting-panel/index.js
index 7466acffc0c4b1..6408d82fe7e118 100644
--- a/packages/editor/src/components/plugin-document-setting-panel/index.js
+++ b/packages/editor/src/components/plugin-document-setting-panel/index.js
@@ -22,7 +22,7 @@ const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
* @param {string} [props.className] An optional class name added to the row.
* @param {string} [props.title] The title of the panel
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
- * @param {Element} props.children Children to be rendered
+ * @param {React.ReactNode} props.children Children to be rendered
*
* @example
* ```js
@@ -64,7 +64,7 @@ const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
* registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The component to be rendered.
*/
const PluginDocumentSettingPanel = ( {
name,
diff --git a/packages/editor/src/components/plugin-more-menu-item/index.js b/packages/editor/src/components/plugin-more-menu-item/index.js
index 28173c24ebcefa..1d8e124b03e604 100644
--- a/packages/editor/src/components/plugin-more-menu-item/index.js
+++ b/packages/editor/src/components/plugin-more-menu-item/index.js
@@ -10,6 +10,7 @@ import { ActionItem } from '@wordpress/interface';
* The text within the component appears as the menu item label.
*
* @param {Object} props Component properties.
+ * @param {React.ReactNode} [props.children] Children to be rendered.
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
@@ -59,7 +60,7 @@ import { ActionItem } from '@wordpress/interface';
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PluginMoreMenuItem( props ) {
const context = usePluginContext();
diff --git a/packages/editor/src/components/plugin-post-publish-panel/index.js b/packages/editor/src/components/plugin-post-publish-panel/index.js
index 086045b1c1fee1..b93f0a15c237f5 100644
--- a/packages/editor/src/components/plugin-post-publish-panel/index.js
+++ b/packages/editor/src/components/plugin-post-publish-panel/index.js
@@ -15,7 +15,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPostPublishPanel' );
* @param {string} [props.title] Title displayed at the top of the panel.
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
- * @param {Element} props.children Children to be rendered
+ * @param {React.ReactNode} props.children Children to be rendered
*
* @example
* ```jsx
@@ -34,7 +34,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPostPublishPanel' );
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
const PluginPostPublishPanel = ( {
children,
diff --git a/packages/editor/src/components/plugin-post-status-info/index.js b/packages/editor/src/components/plugin-post-status-info/index.js
index a4a216b78ae78b..f9f3293047ddd3 100644
--- a/packages/editor/src/components/plugin-post-status-info/index.js
+++ b/packages/editor/src/components/plugin-post-status-info/index.js
@@ -14,9 +14,9 @@ const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
* It should be noted that this is named and implemented around the function it serves
* and not its location, which may change in future iterations.
*
- * @param {Object} props Component properties.
- * @param {string} [props.className] An optional class name added to the row.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Component properties.
+ * @param {string} [props.className] An optional class name added to the row.
+ * @param {React.ReactNode} props.children Children to be rendered.
*
* @example
* ```js
@@ -50,7 +50,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
const PluginPostStatusInfo = ( { children, className } ) => (
diff --git a/packages/editor/src/components/plugin-pre-publish-panel/index.js b/packages/editor/src/components/plugin-pre-publish-panel/index.js
index c9f556dc534a80..412af36c5176e0 100644
--- a/packages/editor/src/components/plugin-pre-publish-panel/index.js
+++ b/packages/editor/src/components/plugin-pre-publish-panel/index.js
@@ -18,7 +18,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
* icon slug string, or an SVG WP element, to be rendered when
* the sidebar is pinned to toolbar.
- * @param {Element} props.children Children to be rendered
+ * @param {React.ReactNode} props.children Children to be rendered
*
* @example
* ```jsx
@@ -37,7 +37,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
const PluginPrePublishPanel = ( {
children,
diff --git a/packages/editor/src/components/plugin-preview-menu-item/index.js b/packages/editor/src/components/plugin-preview-menu-item/index.js
index 8038da04595aae..949f02808a7b03 100644
--- a/packages/editor/src/components/plugin-preview-menu-item/index.js
+++ b/packages/editor/src/components/plugin-preview-menu-item/index.js
@@ -10,6 +10,7 @@ import { ActionItem } from '@wordpress/interface';
* The text within the component appears as the menu item label.
*
* @param {Object} props Component properties.
+ * @param {React.ReactNode} [props.children] Children to be rendered.
* @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.
* @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item.
@@ -38,7 +39,7 @@ import { ActionItem } from '@wordpress/interface';
* } );
* ```
*
- * @return {Component} The rendered menu item component.
+ * @return {React.ReactNode} The rendered menu item component.
*/
export default function PluginPreviewMenuItem( props ) {
const context = usePluginContext();
diff --git a/packages/editor/src/components/plugin-sidebar-more-menu-item/index.js b/packages/editor/src/components/plugin-sidebar-more-menu-item/index.js
index 0d7695c9abfe12..379a0720dc8a91 100644
--- a/packages/editor/src/components/plugin-sidebar-more-menu-item/index.js
+++ b/packages/editor/src/components/plugin-sidebar-more-menu-item/index.js
@@ -10,6 +10,7 @@ import { ComplementaryAreaMoreMenuItem } from '@wordpress/interface';
*
* @param {Object} props Component props.
* @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
+ * @param {React.ReactNode} [props.children] Children to be rendered.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
*
* @example
@@ -48,9 +49,8 @@ import { ComplementaryAreaMoreMenuItem } from '@wordpress/interface';
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
-
export default function PluginSidebarMoreMenuItem( props ) {
return (
{
diff --git a/packages/editor/src/components/post-author/panel.js b/packages/editor/src/components/post-author/panel.js
index 6c6a51918902dc..5a413aedac09cf 100644
--- a/packages/editor/src/components/post-author/panel.js
+++ b/packages/editor/src/components/post-author/panel.js
@@ -39,7 +39,7 @@ function PostAuthorToggle( { isOpen, onClick } ) {
/**
* Renders the Post Author Panel component.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export function PostAuthor() {
// Use internal state instead of a ref to make sure that the component
diff --git a/packages/editor/src/components/post-comments/index.js b/packages/editor/src/components/post-comments/index.js
index 1d331811b46b26..6e69f9bce4f838 100644
--- a/packages/editor/src/components/post-comments/index.js
+++ b/packages/editor/src/components/post-comments/index.js
@@ -61,6 +61,6 @@ function PostComments() {
/**
* A form for managing comment status.
*
- * @return {JSX.Element} The rendered PostComments component.
+ * @return {React.ReactNode} The rendered PostComments component.
*/
export default PostComments;
diff --git a/packages/editor/src/components/post-discussion/panel.js b/packages/editor/src/components/post-discussion/panel.js
index c539791d404dec..280ab11b0447e7 100644
--- a/packages/editor/src/components/post-discussion/panel.js
+++ b/packages/editor/src/components/post-discussion/panel.js
@@ -93,7 +93,7 @@ function PostDiscussionToggle( { isOpen, onClick } ) {
* checks whether the current post has support for the
* above and if the `discussion-panel` panel is enabled.
*
- * @return {JSX.Element|null} The rendered PostDiscussionPanel component.
+ * @return {React.ReactNode} The rendered PostDiscussionPanel component.
*/
export default function PostDiscussionPanel() {
const { isEnabled } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-excerpt/check.js b/packages/editor/src/components/post-excerpt/check.js
index 77436ecfed218a..c518d90e424a9b 100644
--- a/packages/editor/src/components/post-excerpt/check.js
+++ b/packages/editor/src/components/post-excerpt/check.js
@@ -6,10 +6,10 @@ import PostTypeSupportCheck from '../post-type-support-check';
/**
* Component for checking if the post type supports the excerpt field.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactNode} props.children Children to be rendered.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
function PostExcerptCheck( { children } ) {
return (
diff --git a/packages/editor/src/components/post-excerpt/panel.js b/packages/editor/src/components/post-excerpt/panel.js
index 9c09796f467040..d4f2b27126c7c1 100644
--- a/packages/editor/src/components/post-excerpt/panel.js
+++ b/packages/editor/src/components/post-excerpt/panel.js
@@ -83,7 +83,7 @@ function ExcerptPanel() {
/**
* Is rendered if the post type supports excerpts and allows editing the excerpt.
*
- * @return {JSX.Element} The rendered PostExcerptPanel component.
+ * @return {React.ReactNode} The rendered PostExcerptPanel component.
*/
export default function PostExcerptPanel() {
return (
diff --git a/packages/editor/src/components/post-excerpt/plugin.js b/packages/editor/src/components/post-excerpt/plugin.js
index 64861162a0f637..50c494c01cb6d8 100644
--- a/packages/editor/src/components/post-excerpt/plugin.js
+++ b/packages/editor/src/components/post-excerpt/plugin.js
@@ -12,9 +12,9 @@ const { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );
/**
* Renders a post excerpt panel in the post sidebar.
*
- * @param {Object} props Component properties.
- * @param {string} [props.className] An optional class name added to the row.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Component properties.
+ * @param {string} [props.className] An optional class name added to the row.
+ * @param {React.ReactNode} props.children Children to be rendered.
*
* @example
* ```js
@@ -46,7 +46,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );
* );
* ```
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
const PluginPostExcerpt = ( { children, className } ) => {
return (
diff --git a/packages/editor/src/components/post-featured-image/check.js b/packages/editor/src/components/post-featured-image/check.js
index 823559f766bc35..700a3b8edfd032 100644
--- a/packages/editor/src/components/post-featured-image/check.js
+++ b/packages/editor/src/components/post-featured-image/check.js
@@ -8,10 +8,10 @@ import ThemeSupportCheck from '../theme-support-check';
* Wrapper component that renders its children only if the post type supports a featured image
* and the theme supports post thumbnails.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactNode} props.children Children to be rendered.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
function PostFeaturedImageCheck( { children } ) {
return (
diff --git a/packages/editor/src/components/post-featured-image/panel.js b/packages/editor/src/components/post-featured-image/panel.js
index dd2a1527152ddf..8621b2eb886337 100644
--- a/packages/editor/src/components/post-featured-image/panel.js
+++ b/packages/editor/src/components/post-featured-image/panel.js
@@ -21,7 +21,7 @@ const PANEL_NAME = 'featured-image';
* @param {Object} props Props.
* @param {boolean} props.withPanelBody Whether to include the panel body. Default true.
*
- * @return {Component|null} The component to be rendered.
+ * @return {React.ReactNode} The component to be rendered.
* Return Null if the editor panel is disabled for featured image.
*/
export default function PostFeaturedImagePanel( { withPanelBody = true } ) {
diff --git a/packages/editor/src/components/post-format/check.js b/packages/editor/src/components/post-format/check.js
index 35729770b93c40..fe791862e1cebb 100644
--- a/packages/editor/src/components/post-format/check.js
+++ b/packages/editor/src/components/post-format/check.js
@@ -9,7 +9,15 @@ import { useSelect } from '@wordpress/data';
import PostTypeSupportCheck from '../post-type-support-check';
import { store as editorStore } from '../../store';
-function PostFormatCheck( { children } ) {
+/**
+ * Component check if there are any post formats.
+ *
+ * @param {Object} props The component props.
+ * @param {React.ReactNode} props.children The child elements to render.
+ *
+ * @return {React.ReactNode} The rendered component or null if post formats are disabled.
+ */
+export default function PostFormatCheck( { children } ) {
const disablePostFormats = useSelect(
( select ) =>
select( editorStore ).getEditorSettings().disablePostFormats,
@@ -26,13 +34,3 @@ function PostFormatCheck( { children } ) {
);
}
-
-/**
- * Component check if there are any post formats.
- *
- * @param {Object} props The component props.
- * @param {Element} props.children The child elements to render.
- *
- * @return {Component|null} The rendered component or null if post formats are disabled.
- */
-export default PostFormatCheck;
diff --git a/packages/editor/src/components/post-format/index.js b/packages/editor/src/components/post-format/index.js
index 8f7423239600f2..d98720cd6fa93f 100644
--- a/packages/editor/src/components/post-format/index.js
+++ b/packages/editor/src/components/post-format/index.js
@@ -46,7 +46,7 @@ export const POST_FORMATS = [
*
* ```
*
- * @return {JSX.Element} The rendered PostFormat component.
+ * @return {React.ReactNode} The rendered PostFormat component.
*/
export default function PostFormat() {
const instanceId = useInstanceId( PostFormat );
diff --git a/packages/editor/src/components/post-format/panel.js b/packages/editor/src/components/post-format/panel.js
index faaf88b785a4b2..18704eda6fc448 100644
--- a/packages/editor/src/components/post-format/panel.js
+++ b/packages/editor/src/components/post-format/panel.js
@@ -18,7 +18,7 @@ import { store as editorStore } from '../../store';
/**
* Renders the Post Author Panel component.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
function PostFormat() {
const { postFormat } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-last-revision/check.js b/packages/editor/src/components/post-last-revision/check.js
index c570f5e42cdc32..cb3c655e1b7cc3 100644
--- a/packages/editor/src/components/post-last-revision/check.js
+++ b/packages/editor/src/components/post-last-revision/check.js
@@ -12,10 +12,10 @@ import { store as editorStore } from '../../store';
/**
* Wrapper component that renders its children if the post has more than one revision.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactNode} props.children Children to be rendered.
*
- * @return {Component|null} Rendered child components if post has more than one revision, otherwise null.
+ * @return {React.ReactNode} Rendered child components if post has more than one revision, otherwise null.
*/
function PostLastRevisionCheck( { children } ) {
const { lastRevisionId, revisionsCount } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-last-revision/index.js b/packages/editor/src/components/post-last-revision/index.js
index fd68f9703cb4e2..ac25e6cb8f30d6 100644
--- a/packages/editor/src/components/post-last-revision/index.js
+++ b/packages/editor/src/components/post-last-revision/index.js
@@ -28,7 +28,7 @@ function usePostLastRevisionInfo() {
/**
* Renders the component for displaying the last revision of a post.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
function PostLastRevision() {
const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
diff --git a/packages/editor/src/components/post-last-revision/panel.js b/packages/editor/src/components/post-last-revision/panel.js
index e87475cc2b34e9..55a3ba571c4b0a 100644
--- a/packages/editor/src/components/post-last-revision/panel.js
+++ b/packages/editor/src/components/post-last-revision/panel.js
@@ -12,7 +12,7 @@ import PostLastRevisionCheck from './check';
/**
* Renders the panel for displaying the last revision of a post.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
function PostLastRevisionPanel() {
return (
diff --git a/packages/editor/src/components/post-locked-modal/index.js b/packages/editor/src/components/post-locked-modal/index.js
index 7bfa2d23fd9808..16cff5af976841 100644
--- a/packages/editor/src/components/post-locked-modal/index.js
+++ b/packages/editor/src/components/post-locked-modal/index.js
@@ -24,7 +24,7 @@ import { store as editorStore } from '../../store';
* A modal component that is displayed when a post is locked for editing by another user.
* The modal provides information about the lock status and options to take over or exit the editor.
*
- * @return {JSX.Element|null} The rendered PostLockedModal component.
+ * @return {React.ReactNode} The rendered PostLockedModal component.
*/
export default function PostLockedModal() {
const instanceId = useInstanceId( PostLockedModal );
diff --git a/packages/editor/src/components/post-pending-status/check.js b/packages/editor/src/components/post-pending-status/check.js
index 7a4ff5195041c6..9f407d8c8cd82a 100644
--- a/packages/editor/src/components/post-pending-status/check.js
+++ b/packages/editor/src/components/post-pending-status/check.js
@@ -13,10 +13,10 @@ import { store as editorStore } from '../../store';
* If the post is already published or the user doesn't have the
* capability to publish, it returns null.
*
- * @param {Object} props Component properties.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Component properties.
+ * @param {React.ReactElement} props.children Children to be rendered.
*
- * @return {JSX.Element|null} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
+ * @return {React.ReactElement} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
*/
export function PostPendingStatusCheck( { children } ) {
const { hasPublishAction, isPublished } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-pending-status/index.js b/packages/editor/src/components/post-pending-status/index.js
index 8363ebc715891b..352570c44a6630 100644
--- a/packages/editor/src/components/post-pending-status/index.js
+++ b/packages/editor/src/components/post-pending-status/index.js
@@ -14,7 +14,7 @@ import { store as editorStore } from '../../store';
/**
* A component for displaying and toggling the pending status of a post.
*
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export function PostPendingStatus() {
const status = useSelect(
diff --git a/packages/editor/src/components/post-preview-button/index.js b/packages/editor/src/components/post-preview-button/index.js
index d57143cd355d80..d1755f96b68615 100644
--- a/packages/editor/src/components/post-preview-button/index.js
+++ b/packages/editor/src/components/post-preview-button/index.js
@@ -112,7 +112,7 @@ function writeInterstitialMessage( targetDocument ) {
* @param {string} props.role The role attribute for the button.
* @param {Function} props.onPreview The callback function for preview event.
*
- * @return {JSX.Element|null} The rendered button component.
+ * @return {React.ReactNode} The rendered button component.
*/
export default function PostPreviewButton( {
className,
diff --git a/packages/editor/src/components/post-schedule/check.js b/packages/editor/src/components/post-schedule/check.js
index 28456b90371cc3..32526a977f94fa 100644
--- a/packages/editor/src/components/post-schedule/check.js
+++ b/packages/editor/src/components/post-schedule/check.js
@@ -11,10 +11,10 @@ import { store as editorStore } from '../../store';
/**
* Wrapper component that renders its children only if post has a publish action.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactElement} props.children Children to be rendered.
*
- * @return {Component} - The component to be rendered or null if there is no publish action.
+ * @return {React.ReactElement} - The component to be rendered or null if there is no publish action.
*/
export default function PostScheduleCheck( { children } ) {
const hasPublishAction = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-schedule/index.js b/packages/editor/src/components/post-schedule/index.js
index 94387ed4267fa9..c9b017bcfa80df 100644
--- a/packages/editor/src/components/post-schedule/index.js
+++ b/packages/editor/src/components/post-schedule/index.js
@@ -27,7 +27,7 @@ const { PrivatePublishDateTimePicker } = unlock( blockEditorPrivateApis );
* @param {Object} props Props.
* @param {Function} props.onClose Function to close the component.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostSchedule( props ) {
return (
diff --git a/packages/editor/src/components/post-schedule/label.js b/packages/editor/src/components/post-schedule/label.js
index f6cf3811db7916..2b8819747e7e0c 100644
--- a/packages/editor/src/components/post-schedule/label.js
+++ b/packages/editor/src/components/post-schedule/label.js
@@ -15,7 +15,7 @@ import { store as editorStore } from '../../store';
*
* @param {Object} props Props.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostScheduleLabel( props ) {
return usePostScheduleLabel( props );
diff --git a/packages/editor/src/components/post-schedule/panel.js b/packages/editor/src/components/post-schedule/panel.js
index 5d63da5e30c910..fd453a4667417f 100644
--- a/packages/editor/src/components/post-schedule/panel.js
+++ b/packages/editor/src/components/post-schedule/panel.js
@@ -31,7 +31,7 @@ const DESIGN_POST_TYPES = [
/**
* Renders the Post Schedule Panel component.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostSchedulePanel() {
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
diff --git a/packages/editor/src/components/post-slug/check.js b/packages/editor/src/components/post-slug/check.js
index 86bf04814c934d..8ca7078a1a9e24 100644
--- a/packages/editor/src/components/post-slug/check.js
+++ b/packages/editor/src/components/post-slug/check.js
@@ -6,10 +6,10 @@ import PostTypeSupportCheck from '../post-type-support-check';
/**
* Wrapper component that renders its children only if the post type supports the slug.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactNode} props.children Children to be rendered.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostSlugCheck( { children } ) {
return (
diff --git a/packages/editor/src/components/post-slug/index.js b/packages/editor/src/components/post-slug/index.js
index 1a4f8e93d7565c..afff7f361ea428 100644
--- a/packages/editor/src/components/post-slug/index.js
+++ b/packages/editor/src/components/post-slug/index.js
@@ -62,7 +62,7 @@ function PostSlugControl() {
/**
* Renders the PostSlug component. It provide a control for editing the post slug.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostSlug() {
return (
diff --git a/packages/editor/src/components/post-sticky/check.js b/packages/editor/src/components/post-sticky/check.js
index f504effca82c6b..ede5c22f3c3e32 100644
--- a/packages/editor/src/components/post-sticky/check.js
+++ b/packages/editor/src/components/post-sticky/check.js
@@ -11,10 +11,10 @@ import { store as editorStore } from '../../store';
/**
* Wrapper component that renders its children only if post has a sticky action.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered.
+ * @param {Object} props Props.
+ * @param {React.ReactElement} props.children Children to be rendered.
*
- * @return {Component} The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
+ * @return {React.ReactElement} The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
*/
export default function PostStickyCheck( { children } ) {
const { hasStickyAction, postType } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-sticky/index.js b/packages/editor/src/components/post-sticky/index.js
index 43a4bea98de26e..6f5b914cb2f352 100644
--- a/packages/editor/src/components/post-sticky/index.js
+++ b/packages/editor/src/components/post-sticky/index.js
@@ -14,7 +14,7 @@ import { store as editorStore } from '../../store';
/**
* Renders the PostSticky component. It provides a checkbox control for the sticky post feature.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostSticky() {
const postSticky = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-switch-to-draft-button/index.js b/packages/editor/src/components/post-switch-to-draft-button/index.js
index a743c7a2991ffb..6a41e1fad597a2 100644
--- a/packages/editor/src/components/post-switch-to-draft-button/index.js
+++ b/packages/editor/src/components/post-switch-to-draft-button/index.js
@@ -18,7 +18,7 @@ import { store as editorStore } from '../../store';
/**
* Renders a button component that allows the user to switch a post to draft status.
*
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostSwitchToDraftButton() {
deprecated( 'wp.editor.PostSwitchToDraftButton', {
diff --git a/packages/editor/src/components/post-sync-status/index.js b/packages/editor/src/components/post-sync-status/index.js
index d3e2a1a5522e89..5f965c01503f5c 100644
--- a/packages/editor/src/components/post-sync-status/index.js
+++ b/packages/editor/src/components/post-sync-status/index.js
@@ -13,7 +13,7 @@ import { store as editorStore } from '../../store';
/**
* Renders the sync status of a post.
*
- * @return {JSX.Element|null} The rendered sync status component.
+ * @return {React.ReactNode} The rendered sync status component.
*/
export default function PostSyncStatus() {
const { syncStatus, postType } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-taxonomies/check.js b/packages/editor/src/components/post-taxonomies/check.js
index 401b1adad7cad4..ce3db319ae2e8a 100644
--- a/packages/editor/src/components/post-taxonomies/check.js
+++ b/packages/editor/src/components/post-taxonomies/check.js
@@ -12,10 +12,10 @@ import { store as editorStore } from '../../store';
/**
* Renders the children components only if the current post type has taxonomies.
*
- * @param {Object} props The component props.
- * @param {Element} props.children The children components to render.
+ * @param {Object} props The component props.
+ * @param {React.ReactNode} props.children The children components to render.
*
- * @return {Component|null} The rendered children components or null if the current post type has no taxonomies.
+ * @return {React.ReactElement} The rendered children components or null if the current post type has no taxonomies.
*/
export default function PostTaxonomiesCheck( { children } ) {
const hasTaxonomies = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-taxonomies/flat-term-selector.js b/packages/editor/src/components/post-taxonomies/flat-term-selector.js
index cd9377766af503..890175534c8b4a 100644
--- a/packages/editor/src/components/post-taxonomies/flat-term-selector.js
+++ b/packages/editor/src/components/post-taxonomies/flat-term-selector.js
@@ -71,7 +71,7 @@ const Wrapper = ( { children, __nextHasNoMarginBottom } ) =>
* @param {string} props.slug The slug of the taxonomy.
* @param {boolean} props.__nextHasNoMarginBottom Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 7.0. (The prop can be safely removed once this happens.)
*
- * @return {JSX.Element} The rendered flat term selector component.
+ * @return {React.ReactNode} The rendered flat term selector component.
*/
export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
const [ values, setValues ] = useState( [] );
diff --git a/packages/editor/src/components/post-taxonomies/panel.js b/packages/editor/src/components/post-taxonomies/panel.js
index 760626f984db36..f75fa74cc3d2e9 100644
--- a/packages/editor/src/components/post-taxonomies/panel.js
+++ b/packages/editor/src/components/post-taxonomies/panel.js
@@ -11,6 +11,15 @@ import { store as editorStore } from '../../store';
import PostTaxonomiesForm from './index';
import PostTaxonomiesCheck from './check';
+/**
+ * Renders a panel for a specific taxonomy.
+ *
+ * @param {Object} props The component props.
+ * @param {Object} props.taxonomy The taxonomy object.
+ * @param {React.ReactNode} props.children The child components.
+ *
+ * @return {React.ReactNode} The rendered taxonomy panel.
+ */
function TaxonomyPanel( { taxonomy, children } ) {
const slug = taxonomy?.slug;
const panelName = slug ? `taxonomy-panel-${ slug }` : '';
@@ -47,7 +56,12 @@ function TaxonomyPanel( { taxonomy, children } ) {
);
}
-function PostTaxonomies() {
+/**
+ * Component that renders the post taxonomies panel.
+ *
+ * @return {React.ReactNode} The rendered component.
+ */
+export default function PostTaxonomies() {
return (
);
}
-
-/**
- * Renders a panel for a specific taxonomy.
- *
- * @param {Object} props The component props.
- * @param {Object} props.taxonomy The taxonomy object.
- * @param {Element} props.children The child components.
- *
- * @return {Component} The rendered taxonomy panel.
- */
-export default PostTaxonomies;
diff --git a/packages/editor/src/components/post-template/classic-theme.js b/packages/editor/src/components/post-template/classic-theme.js
index 4a65a9b4c75636..4345e06211c661 100644
--- a/packages/editor/src/components/post-template/classic-theme.js
+++ b/packages/editor/src/components/post-template/classic-theme.js
@@ -63,7 +63,7 @@ function PostTemplateToggle( { isOpen, onClick } ) {
* @param {Object} props The component props.
* @param {Function} props.onClose The function to close the dropdown.
*
- * @return {JSX.Element} The rendered dropdown content.
+ * @return {React.ReactNode} The rendered dropdown content.
*/
function PostTemplateDropdownContent( { onClose } ) {
const allowSwitchingTemplate = useAllowSwitchingTemplates();
@@ -235,6 +235,6 @@ function ClassicThemeControl() {
*
* The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.
*
- * @return {JSX.Element} The rendered ClassicThemeControl component.
+ * @return {React.ReactNode} The rendered ClassicThemeControl component.
*/
export default ClassicThemeControl;
diff --git a/packages/editor/src/components/post-template/panel.js b/packages/editor/src/components/post-template/panel.js
index b5f0d34197c686..903612ef11ed15 100644
--- a/packages/editor/src/components/post-template/panel.js
+++ b/packages/editor/src/components/post-template/panel.js
@@ -16,7 +16,7 @@ import PostPanelRow from '../post-panel-row';
/**
* Displays the template controls based on the current editor settings and user permissions.
*
- * @return {JSX.Element|null} The rendered PostTemplatePanel component.
+ * @return {React.ReactNode} The rendered PostTemplatePanel component.
*/
export default function PostTemplatePanel() {
const { templateId, isBlockTheme } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-text-editor/index.js b/packages/editor/src/components/post-text-editor/index.js
index c3dc61a0b4a2ef..0ae569c3e15301 100644
--- a/packages/editor/src/components/post-text-editor/index.js
+++ b/packages/editor/src/components/post-text-editor/index.js
@@ -22,7 +22,7 @@ import { store as editorStore } from '../../store';
/**
* Displays the Post Text Editor along with content in Visual and Text mode.
*
- * @return {JSX.Element|null} The rendered PostTextEditor component.
+ * @return {React.ReactNode} The rendered PostTextEditor component.
*/
export default function PostTextEditor() {
const instanceId = useInstanceId( PostTextEditor );
diff --git a/packages/editor/src/components/post-title/index.js b/packages/editor/src/components/post-title/index.js
index 7fc79eaeddffb5..090beb57f6170e 100644
--- a/packages/editor/src/components/post-title/index.js
+++ b/packages/editor/src/components/post-title/index.js
@@ -193,7 +193,7 @@ const PostTitle = forwardRef( ( _, forwardedRef ) => {
* @param {Object} _ Unused parameter.
* @param {Element} forwardedRef Forwarded ref for the component.
*
- * @return {Component} The rendered PostTitle component.
+ * @return {React.ReactNode} The rendered PostTitle component.
*/
export default forwardRef( ( _, forwardedRef ) => (
diff --git a/packages/editor/src/components/post-title/post-title-raw.js b/packages/editor/src/components/post-title/post-title-raw.js
index 66c944b45871ab..9beba1068f8ef7 100644
--- a/packages/editor/src/components/post-title/post-title-raw.js
+++ b/packages/editor/src/components/post-title/post-title-raw.js
@@ -26,7 +26,7 @@ import usePostTitle from './use-post-title';
* @param {Object} _ Unused parameter.
* @param {Element} forwardedRef Reference to the component's DOM node.
*
- * @return {Component} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
function PostTitleRaw( _, forwardedRef ) {
const { placeholder } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-trash/check.js b/packages/editor/src/components/post-trash/check.js
index 7edc7c0f18c273..893d46ef9a0867 100644
--- a/packages/editor/src/components/post-trash/check.js
+++ b/packages/editor/src/components/post-trash/check.js
@@ -13,10 +13,10 @@ import { GLOBAL_POST_TYPES } from '../../store/constants';
/**
* Wrapper component that renders its children only if the post can trashed.
*
- * @param {Object} props - The component props.
- * @param {Element} props.children - The child components to render.
+ * @param {Object} props - The component props.
+ * @param {React.ReactEl} props.children - The child components to render.
*
- * @return {Component|null} The rendered child components or null if the post can not trashed.
+ * @return {React.ReactElement} The rendered child components or null if the post can not trashed.
*/
export default function PostTrashCheck( { children } ) {
const { canTrashPost } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-trash/index.js b/packages/editor/src/components/post-trash/index.js
index 743512e9efd7d4..2d3dd8bcb0c4b3 100644
--- a/packages/editor/src/components/post-trash/index.js
+++ b/packages/editor/src/components/post-trash/index.js
@@ -19,7 +19,7 @@ import PostTrashCheck from './check';
* Displays the Post Trash Button and Confirm Dialog in the Editor.
*
* @param {?{onActionPerformed: Object}} An object containing the onActionPerformed function.
- * @return {JSX.Element|null} The rendered PostTrash component.
+ * @return {React.ReactNode} The rendered PostTrash component.
*/
export default function PostTrash( { onActionPerformed } ) {
const registry = useRegistry();
diff --git a/packages/editor/src/components/post-type-support-check/index.js b/packages/editor/src/components/post-type-support-check/index.js
index 613fda8eb82da3..f04aea84b0e411 100644
--- a/packages/editor/src/components/post-type-support-check/index.js
+++ b/packages/editor/src/components/post-type-support-check/index.js
@@ -13,13 +13,13 @@ import { store as editorStore } from '../../store';
* A component which renders its own children only if the current editor post
* type supports one of the given `supportKeys` prop.
*
- * @param {Object} props Props.
- * @param {Element} props.children Children to be rendered if post
- * type supports.
- * @param {(string|string[])} props.supportKeys String or string array of keys
- * to test.
+ * @param {Object} props Props.
+ * @param {React.ReactElement} props.children Children to be rendered if post
+ * type supports.
+ * @param {(string|string[])} props.supportKeys String or string array of keys
+ * to test.
*
- * @return {Component} The component to be rendered.
+ * @return {React.ReactElement} The component to be rendered.
*/
function PostTypeSupportCheck( { children, supportKeys } ) {
const postType = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-url/check.js b/packages/editor/src/components/post-url/check.js
index 7eb390472bdd7d..a80d829de23221 100644
--- a/packages/editor/src/components/post-url/check.js
+++ b/packages/editor/src/components/post-url/check.js
@@ -12,10 +12,10 @@ import { store as editorStore } from '../../store';
/**
* Check if the post URL is valid and visible.
*
- * @param {Object} props The component props.
- * @param {Element} props.children The child components.
+ * @param {Object} props The component props.
+ * @param {React.ReactElement} props.children The child components.
*
- * @return {Component|null} The child components if the post URL is valid and visible, otherwise null.
+ * @return {React.ReactElement} The child components if the post URL is valid and visible, otherwise null.
*/
export default function PostURLCheck( { children } ) {
const isVisible = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-url/index.js b/packages/editor/src/components/post-url/index.js
index f03bdd59752a83..c72ca5825f6fe6 100644
--- a/packages/editor/src/components/post-url/index.js
+++ b/packages/editor/src/components/post-url/index.js
@@ -34,7 +34,7 @@ import { store as editorStore } from '../../store';
*
* @param {Function} onClose Callback function to be executed when the popover is closed.
*
- * @return {Component} The rendered PostURL component.
+ * @return {React.ReactNode} The rendered PostURL component.
*/
export default function PostURL( { onClose } ) {
const {
diff --git a/packages/editor/src/components/post-url/label.js b/packages/editor/src/components/post-url/label.js
index 4f03e2bce0d05f..277cc6cfc715d3 100644
--- a/packages/editor/src/components/post-url/label.js
+++ b/packages/editor/src/components/post-url/label.js
@@ -12,7 +12,7 @@ import { store as editorStore } from '../../store';
/**
* Represents a label component for a post URL.
*
- * @return {Component} The PostURLLabel component.
+ * @return {React.ReactNode} The PostURLLabel component.
*/
export default function PostURLLabel() {
return usePostURLLabel();
diff --git a/packages/editor/src/components/post-url/panel.js b/packages/editor/src/components/post-url/panel.js
index 786a12cb8e6b54..97eaa8ccb77f8d 100644
--- a/packages/editor/src/components/post-url/panel.js
+++ b/packages/editor/src/components/post-url/panel.js
@@ -19,7 +19,7 @@ import { store as editorStore } from '../../store';
/**
* Renders the `PostURLPanel` component.
*
- * @return {JSX.Element} The rendered PostURLPanel component.
+ * @return {React.ReactNode} The rendered PostURLPanel component.
*/
export default function PostURLPanel() {
const { isFrontPage } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-visibility/check.js b/packages/editor/src/components/post-visibility/check.js
index 19a241ae1110ae..ea04a6b739617a 100644
--- a/packages/editor/src/components/post-visibility/check.js
+++ b/packages/editor/src/components/post-visibility/check.js
@@ -15,7 +15,7 @@ import { store as editorStore } from '../../store';
* @param {Object} props The component props.
* @param {Function} props.render Function to render the component.
* Receives an object with a `canEdit` property.
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostVisibilityCheck( { render } ) {
const canEdit = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/post-visibility/index.js b/packages/editor/src/components/post-visibility/index.js
index e47f2acd664434..3eb0c157c337ca 100644
--- a/packages/editor/src/components/post-visibility/index.js
+++ b/packages/editor/src/components/post-visibility/index.js
@@ -22,7 +22,7 @@ import { store as editorStore } from '../../store';
*
* @param {Object} props The component props.
* @param {Function} props.onClose Function to call when the popover is closed.
- * @return {JSX.Element} The rendered component.
+ * @return {React.ReactNode} The rendered component.
*/
export default function PostVisibility( { onClose } ) {
const instanceId = useInstanceId( PostVisibility );
diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js
index 6c05e5b58235b3..996e9e68954591 100644
--- a/packages/editor/src/components/provider/index.js
+++ b/packages/editor/src/components/provider/index.js
@@ -411,7 +411,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
*
* ```
*
- * @return {JSX.Element} The rendered EditorProvider component.
+ * @return {React.ReactNode} The rendered EditorProvider component.
*/
export function EditorProvider( props ) {
return (
diff --git a/packages/editor/src/components/table-of-contents/index.js b/packages/editor/src/components/table-of-contents/index.js
index 6fd83557b13ab7..47de10b66ebdd1 100644
--- a/packages/editor/src/components/table-of-contents/index.js
+++ b/packages/editor/src/components/table-of-contents/index.js
@@ -61,6 +61,6 @@ function TableOfContents(
* @param {boolean} props.repositionDropdown Whether to reposition the dropdown.
* @param {Element.ref} ref The component's ref.
*
- * @return {JSX.Element} The rendered table of contents component.
+ * @return {React.ReactNode} The rendered table of contents component.
*/
export default forwardRef( TableOfContents );
diff --git a/packages/editor/src/components/theme-support-check/index.js b/packages/editor/src/components/theme-support-check/index.js
index 78fbde809a7088..1f29370d32199c 100644
--- a/packages/editor/src/components/theme-support-check/index.js
+++ b/packages/editor/src/components/theme-support-check/index.js
@@ -12,11 +12,11 @@ import { store as editorStore } from '../../store';
/**
* Checks if the current theme supports specific features and renders the children if supported.
*
- * @param {Object} props The component props.
- * @param {Element} props.children The children to render if the theme supports the specified features.
- * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.
+ * @param {Object} props The component props.
+ * @param {React.ReactElement} props.children The children to render if the theme supports the specified features.
+ * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.
*
- * @return {JSX.Element|null} The rendered children if the theme supports the specified features, otherwise null.
+ * @return {React.ReactElement} The rendered children if the theme supports the specified features, otherwise null.
*/
export default function ThemeSupportCheck( { children, supportKeys } ) {
const { postType, themeSupports } = useSelect( ( select ) => {
diff --git a/packages/editor/src/components/time-to-read/index.js b/packages/editor/src/components/time-to-read/index.js
index 5d748abc3049cb..21891273991a2c 100644
--- a/packages/editor/src/components/time-to-read/index.js
+++ b/packages/editor/src/components/time-to-read/index.js
@@ -23,7 +23,7 @@ const AVERAGE_READING_RATE = 189;
/**
* Component for showing Time To Read in Content.
*
- * @return {JSX.Element} The rendered TimeToRead component.
+ * @return {React.ReactNode} The rendered TimeToRead component.
*/
export default function TimeToRead() {
const content = useSelect(
diff --git a/packages/editor/src/components/unsaved-changes-warning/index.js b/packages/editor/src/components/unsaved-changes-warning/index.js
index 49e2b7edf1f293..d04b1f36abcbb3 100644
--- a/packages/editor/src/components/unsaved-changes-warning/index.js
+++ b/packages/editor/src/components/unsaved-changes-warning/index.js
@@ -10,7 +10,7 @@ import { store as coreStore } from '@wordpress/core-data';
* Warns the user if there are unsaved changes before leaving the editor.
* Compatible with Post Editor and Site Editor.
*
- * @return {Component} The component.
+ * @return {React.ReactNode} The component.
*/
export default function UnsavedChangesWarning() {
const { __experimentalGetDirtyEntityRecords } = useSelect( coreStore );
diff --git a/packages/editor/src/components/word-count/index.js b/packages/editor/src/components/word-count/index.js
index aab562b46b89ff..31eb4d6bfd8c35 100644
--- a/packages/editor/src/components/word-count/index.js
+++ b/packages/editor/src/components/word-count/index.js
@@ -13,7 +13,7 @@ import { store as editorStore } from '../../store';
/**
* Renders the word count of the post content.
*
- * @return {JSX.Element|null} The rendered WordCount component.
+ * @return {React.ReactNode} The rendered WordCount component.
*/
export default function WordCount() {
const content = useSelect(
diff --git a/packages/editor/src/store/actions.js b/packages/editor/src/store/actions.js
index 4942e50322e06e..9d0de08718cd2b 100644
--- a/packages/editor/src/store/actions.js
+++ b/packages/editor/src/store/actions.js
@@ -35,9 +35,9 @@ import { unlock } from '../lock-unlock';
* Returns an action generator used in signalling that editor has initialized with
* the specified post object and editor settings.
*
- * @param {Object} post Post object.
- * @param {Object} edits Initial edited attributes object.
- * @param {Array?} template Block Template.
+ * @param {Object} post Post object.
+ * @param {Object} edits Initial edited attributes object.
+ * @param {Array} [template] Block Template.
*/
export const setupEditor =
( post, edits, template ) =>
@@ -157,8 +157,8 @@ export function setEditedPost( postType, postId ) {
* Returns an action object used in signalling that attributes of the post have
* been edited.
*
- * @param {Object} edits Post attributes to edit.
- * @param {Object} options Options for the edit.
+ * @param {Object} edits Post attributes to edit.
+ * @param {Object} [options] Options for the edit.
*
* @example
* ```js
@@ -195,7 +195,7 @@ export const editPost =
/**
* Action for saving the current post in the editor.
*
- * @param {Object} options
+ * @param {Object} [options]
*/
export const savePost =
( options = {} ) =>
@@ -375,7 +375,8 @@ export const trashPost =
* autosaving (e.g. on the Web, the post might be committed to Session
* Storage).
*
- * @param {Object?} options Extra flags to identify the autosave.
+ * @param {Object} [options] Extra flags to identify the autosave.
+ * @param {boolean} [options.local] Whether to perform a local autosave.
*/
export const autosave =
( { local = false, ...options } = {} ) =>
@@ -598,8 +599,8 @@ export function unlockPostAutosaving( lockName ) {
/**
* Returns an action object used to signal that the blocks have been updated.
*
- * @param {Array} blocks Block Array.
- * @param {?Object} options Optional options.
+ * @param {Array} blocks Block Array.
+ * @param {Object} [options] Optional options.
*/
export const resetEditorBlocks =
( blocks, options = {} ) =>
From 21ee975dbc831588cecda74af7a93dedb615448b Mon Sep 17 00:00:00 2001
From: Sukhendu Sekhar Guria
Date: Mon, 25 Nov 2024 15:44:12 +0530
Subject: [PATCH 009/384] Fix: Preserve Display Preview State in File Block
(#67263)
Co-authored-by: Sukhendu2002
Co-authored-by: Mamaduka
Co-authored-by: MadtownLems
---
packages/block-library/src/file/edit.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/block-library/src/file/edit.js b/packages/block-library/src/file/edit.js
index 937eb3d28eb192..838b807507d314 100644
--- a/packages/block-library/src/file/edit.js
+++ b/packages/block-library/src/file/edit.js
@@ -128,15 +128,21 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
}
const isPdf = newMedia.url.endsWith( '.pdf' );
+ const pdfAttributes = {
+ displayPreview: isPdf
+ ? attributes.displayPreview ?? true
+ : undefined,
+ previewHeight: isPdf ? attributes.previewHeight ?? 600 : undefined,
+ };
+
setAttributes( {
href: newMedia.url,
fileName: newMedia.title,
textLinkHref: newMedia.url,
id: newMedia.id,
- displayPreview: isPdf ? true : undefined,
- previewHeight: isPdf ? 600 : undefined,
fileId: `wp-block-file--media-${ clientId }`,
blob: undefined,
+ ...pdfAttributes,
} );
setTemporaryURL();
}
From a6a04bebfb96f47df6c1f238c0fe63233d6dd3f5 Mon Sep 17 00:00:00 2001
From: Bernie Reiter <96308+ockham@users.noreply.github.com>
Date: Mon, 25 Nov 2024 11:20:51 +0100
Subject: [PATCH 010/384] Terms: Respect order specified by register_taxonomy()
(#67154)
It is possible to supply a default set of `args` to `register_taxonomy()` which will be used when querying a list of terms -- for example, `orderby` in order to specify how the resulting list of terms should be sorted. This commit makes it so that the list of terms returned by the Terms REST API controller respects that order.
Co-authored-by: ockham
Co-authored-by: jsnajdr
---
backport-changelog/6.8/7848.md | 3 +++
lib/compat/wordpress-6.8/rest-api.php | 29 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 backport-changelog/6.8/7848.md
diff --git a/backport-changelog/6.8/7848.md b/backport-changelog/6.8/7848.md
new file mode 100644
index 00000000000000..84600eb4847cdb
--- /dev/null
+++ b/backport-changelog/6.8/7848.md
@@ -0,0 +1,3 @@
+https://github.com/WordPress/wordpress-develop/pull/7848
+
+* https://github.com/WordPress/gutenberg/pull/67154
diff --git a/lib/compat/wordpress-6.8/rest-api.php b/lib/compat/wordpress-6.8/rest-api.php
index da1b657cda0783..080e4003f57b38 100644
--- a/lib/compat/wordpress-6.8/rest-api.php
+++ b/lib/compat/wordpress-6.8/rest-api.php
@@ -20,3 +20,32 @@ function gutenberg_add_post_type_rendering_mode() {
}
}
add_action( 'rest_api_init', 'gutenberg_add_post_type_rendering_mode' );
+
+// When querying terms for a given taxonomy in the REST API, respect the default
+// query arguments set for that taxonomy upon registration.
+function gutenberg_respect_taxonomy_default_args_in_rest_api( $args ) {
+ // If a `post` argument is provided, the Terms controller will use
+ // `wp_get_object_terms`, which respects the default query arguments,
+ // so we don't need to do anything.
+ if ( ! empty( $args['post'] ) ) {
+ return $args;
+ }
+
+ $t = get_taxonomy( $args['taxonomy'] );
+ if ( isset( $t->args ) && is_array( $t->args ) ) {
+ $args = array_merge( $args, $t->args );
+ }
+ return $args;
+}
+add_action(
+ 'registered_taxonomy',
+ function ( $taxonomy ) {
+ add_filter( "rest_{$taxonomy}_query", 'gutenberg_respect_taxonomy_default_args_in_rest_api' );
+ }
+);
+add_action(
+ 'unregistered_taxonomy',
+ function ( $taxonomy ) {
+ remove_filter( "rest_{$taxonomy}_query", 'gutenberg_respect_taxonomy_default_args_in_rest_api' );
+ }
+);
From 814bb4e380293ab79704682a067ff980d24c6a8c Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Mon, 25 Nov 2024 14:45:29 +0400
Subject: [PATCH 011/384] Editor: Update focus return handler for the Featured
Image (#67236)
Co-authored-by: Mamaduka
Co-authored-by: afercia
---
.../components/post-featured-image/index.js | 30 +++++++++----------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/packages/editor/src/components/post-featured-image/index.js b/packages/editor/src/components/post-featured-image/index.js
index 46a194f311a5e7..acf366506cc41e 100644
--- a/packages/editor/src/components/post-featured-image/index.js
+++ b/packages/editor/src/components/post-featured-image/index.js
@@ -18,7 +18,7 @@ import {
Notice,
} from '@wordpress/components';
import { isBlobURL } from '@wordpress/blob';
-import { useState, useRef, useEffect } from '@wordpress/element';
+import { useState, useRef } from '@wordpress/element';
import { compose } from '@wordpress/compose';
import { useSelect, withDispatch, withSelect } from '@wordpress/data';
import {
@@ -102,17 +102,10 @@ function PostFeaturedImage( {
noticeOperations,
isRequestingFeaturedImageMedia,
} ) {
- const toggleRef = useRef();
+ const returnsFocusRef = useRef( false );
const [ isLoading, setIsLoading ] = useState( false );
const { getSettings } = useSelect( blockEditorStore );
const { mediaSourceUrl } = getMediaDetails( media, currentPostId );
- const toggleFocusTimerRef = useRef();
-
- useEffect( () => {
- return () => {
- clearTimeout( toggleFocusTimerRef.current );
- };
- }, [] );
function onDropFiles( filesList ) {
getSettings().mediaUpload( {
@@ -164,6 +157,13 @@ function PostFeaturedImage( {
);
}
+ function returnFocus( node ) {
+ if ( returnsFocusRef.current && node ) {
+ node.focus();
+ returnsFocusRef.current = false;
+ }
+ }
+
const isMissingMedia =
! isRequestingFeaturedImageMedia && !! featuredImageId && ! media;
@@ -203,7 +203,7 @@ function PostFeaturedImage( {
) : (
{
onRemoveImage();
- // The toggle button is rendered conditionally, we need
- // to wait it is rendered before moving focus to it.
- toggleFocusTimerRef.current =
- setTimeout( () => {
- toggleRef.current?.focus();
- } );
+ // Signal that the toggle button should be focused,
+ // when it is rendered. Can't focus it directly here
+ // because it's rendered conditionally.
+ returnsFocusRef.current = true;
} }
variant={
isMissingMedia
From 2be64e4c26fc606a1f4bcc625c7c79d9dcef5cac Mon Sep 17 00:00:00 2001
From: Jarda Snajdr
Date: Mon, 25 Nov 2024 11:55:56 +0100
Subject: [PATCH 012/384] Components: remove createPrivateSlotFill function
(#67238)
* Components: remove createPrivateSlotFill function
* Add changelog entry
* Update documentation
* Better jsdoc for deprecated __unstableName
Co-authored-by: jsnajdr
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: aaronrobertshaw
Co-authored-by: Mamaduka
Co-authored-by: youknowriad
---
.../src/components/block-controls/slot.js | 8 ++--
.../components/block-info-slot-fill/index.js | 6 +--
.../position-controls-panel.js | 4 +-
.../use-inspector-controls-tabs.js | 20 ++++-----
.../src/components/inspector-controls/slot.js | 10 +++--
packages/components/CHANGELOG.md | 1 +
packages/components/src/private-apis.ts | 2 -
packages/components/src/slot-fill/README.md | 41 ++++++++++++-------
packages/components/src/slot-fill/index.tsx | 12 +++---
.../editor-canvas-container/index.js | 2 +-
.../editor-interface/content-slot-fill.js | 13 ++----
11 files changed, 61 insertions(+), 58 deletions(-)
diff --git a/packages/block-editor/src/components/block-controls/slot.js b/packages/block-editor/src/components/block-controls/slot.js
index ad800b49ab40db..9548b3e5cb0de8 100644
--- a/packages/block-editor/src/components/block-controls/slot.js
+++ b/packages/block-editor/src/components/block-controls/slot.js
@@ -31,9 +31,10 @@ export default function BlockControlsSlot( { group = 'default', ...props } ) {
[ toolbarState, contextState ]
);
- const Slot = groups[ group ]?.Slot;
- const fills = useSlotFills( Slot?.__unstableName );
- if ( ! Slot ) {
+ const slotFill = groups[ group ];
+ const fills = useSlotFills( slotFill.name );
+
+ if ( ! slotFill ) {
warning( `Unknown BlockControls group "${ group }" provided.` );
return null;
}
@@ -42,6 +43,7 @@ export default function BlockControlsSlot( { group = 'default', ...props } ) {
return null;
}
+ const { Slot } = slotFill;
const slot = ;
if ( group === 'default' ) {
diff --git a/packages/block-editor/src/components/block-info-slot-fill/index.js b/packages/block-editor/src/components/block-info-slot-fill/index.js
index 8c9503313d754c..3592fc0424329b 100644
--- a/packages/block-editor/src/components/block-info-slot-fill/index.js
+++ b/packages/block-editor/src/components/block-info-slot-fill/index.js
@@ -1,19 +1,17 @@
/**
* WordPress dependencies
*/
-import { privateApis as componentsPrivateApis } from '@wordpress/components';
+import { createSlotFill } from '@wordpress/components';
/**
* Internal dependencies
*/
-import { unlock } from '../../lock-unlock';
import {
useBlockEditContext,
mayDisplayControlsKey,
} from '../block-edit/context';
-const { createPrivateSlotFill } = unlock( componentsPrivateApis );
-const { Fill, Slot } = createPrivateSlotFill( 'BlockInformation' );
+const { Fill, Slot } = createSlotFill( Symbol( 'BlockInformation' ) );
const BlockInfo = ( props ) => {
const context = useBlockEditContext();
diff --git a/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js b/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js
index 9a3670b5deb286..42a8597227dee9 100644
--- a/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js
+++ b/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js
@@ -53,9 +53,7 @@ const PositionControlsPanel = () => {
};
const PositionControls = () => {
- const fills = useSlotFills(
- InspectorControlsGroups.position.Slot.__unstableName
- );
+ const fills = useSlotFills( InspectorControlsGroups.position.name );
const hasFills = Boolean( fills && fills.length );
if ( ! hasFills ) {
diff --git a/packages/block-editor/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js b/packages/block-editor/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js
index 6a80d47f024816..c0655f4d85f3f4 100644
--- a/packages/block-editor/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js
+++ b/packages/block-editor/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js
@@ -46,18 +46,18 @@ export default function useInspectorControlsTabs( blockName ) {
// List View Tab: If there are any fills for the list group add that tab.
const listViewDisabled = useIsListViewTabDisabled( blockName );
- const listFills = useSlotFills( listGroup.Slot.__unstableName );
+ const listFills = useSlotFills( listGroup.name );
const hasListFills = ! listViewDisabled && !! listFills && listFills.length;
// Styles Tab: Add this tab if there are any fills for block supports
// e.g. border, color, spacing, typography, etc.
const styleFills = [
- ...( useSlotFills( borderGroup.Slot.__unstableName ) || [] ),
- ...( useSlotFills( colorGroup.Slot.__unstableName ) || [] ),
- ...( useSlotFills( dimensionsGroup.Slot.__unstableName ) || [] ),
- ...( useSlotFills( stylesGroup.Slot.__unstableName ) || [] ),
- ...( useSlotFills( typographyGroup.Slot.__unstableName ) || [] ),
- ...( useSlotFills( effectsGroup.Slot.__unstableName ) || [] ),
+ ...( useSlotFills( borderGroup.name ) || [] ),
+ ...( useSlotFills( colorGroup.name ) || [] ),
+ ...( useSlotFills( dimensionsGroup.name ) || [] ),
+ ...( useSlotFills( stylesGroup.name ) || [] ),
+ ...( useSlotFills( typographyGroup.name ) || [] ),
+ ...( useSlotFills( effectsGroup.name ) || [] ),
];
const hasStyleFills = styleFills.length;
@@ -67,12 +67,12 @@ export default function useInspectorControlsTabs( blockName ) {
// the advanced controls slot as well to ensure they are rendered.
const advancedFills = [
...( useSlotFills( InspectorAdvancedControls.slotName ) || [] ),
- ...( useSlotFills( bindingsGroup.Slot.__unstableName ) || [] ),
+ ...( useSlotFills( bindingsGroup.name ) || [] ),
];
const settingsFills = [
- ...( useSlotFills( defaultGroup.Slot.__unstableName ) || [] ),
- ...( useSlotFills( positionGroup.Slot.__unstableName ) || [] ),
+ ...( useSlotFills( defaultGroup.name ) || [] ),
+ ...( useSlotFills( positionGroup.name ) || [] ),
...( hasListFills && hasStyleFills > 1 ? advancedFills : [] ),
];
diff --git a/packages/block-editor/src/components/inspector-controls/slot.js b/packages/block-editor/src/components/inspector-controls/slot.js
index cc32b1c88480ed..5c18dbd1f86bb8 100644
--- a/packages/block-editor/src/components/inspector-controls/slot.js
+++ b/packages/block-editor/src/components/inspector-controls/slot.js
@@ -34,14 +34,14 @@ export default function InspectorControlsSlot( {
);
group = __experimentalGroup;
}
- const Slot = groups[ group ]?.Slot;
- const fills = useSlotFills( Slot?.__unstableName );
+ const slotFill = groups[ group ];
+ const fills = useSlotFills( slotFill?.name );
const motionContextValue = useContext( MotionContext );
const computedFillProps = useMemo(
() => ( {
- ...( fillProps ?? {} ),
+ ...fillProps,
forwardedContext: [
...( fillProps?.forwardedContext ?? [] ),
[ MotionContext.Provider, { value: motionContextValue } ],
@@ -50,7 +50,7 @@ export default function InspectorControlsSlot( {
[ motionContextValue, fillProps ]
);
- if ( ! Slot ) {
+ if ( ! slotFill ) {
warning( `Unknown InspectorControls group "${ group }" provided.` );
return null;
}
@@ -59,6 +59,8 @@ export default function InspectorControlsSlot( {
return null;
}
+ const { Slot } = slotFill;
+
if ( label ) {
return (
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 564d9fcc683618..bcb9bfe3c013e4 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -30,6 +30,7 @@
### Experimental
- `SlotFill`: Remove registration API methods from return value of `__experimentalUseSlot` ([#67070](https://github.com/WordPress/gutenberg/pull/67070)).
+- `SlotFill`: Remove the `createPrivateSlotFill` private API ([#67238](https://github.com/WordPress/gutenberg/pull/67238)).
### Internal
diff --git a/packages/components/src/private-apis.ts b/packages/components/src/private-apis.ts
index bea16b719a463d..2ced100dc576be 100644
--- a/packages/components/src/private-apis.ts
+++ b/packages/components/src/private-apis.ts
@@ -2,7 +2,6 @@
* Internal dependencies
*/
import { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';
-import { createPrivateSlotFill } from './slot-fill';
import { Menu } from './menu';
import { ComponentsContext } from './context/context-system-provider';
import Theme from './theme';
@@ -13,7 +12,6 @@ import { lock } from './lock-unlock';
export const privateApis = {};
lock( privateApis, {
__experimentalPopoverLegacyPositionToPlacement,
- createPrivateSlotFill,
ComponentsContext,
Tabs,
Theme,
diff --git a/packages/components/src/slot-fill/README.md b/packages/components/src/slot-fill/README.md
index 9059566deefdf4..3f14b9ccde9eeb 100644
--- a/packages/components/src/slot-fill/README.md
+++ b/packages/components/src/slot-fill/README.md
@@ -1,18 +1,18 @@
-# Slot Fill
+# Slot/Fill
-Slot and Fill are a pair of components which enable developers to render elsewhere in a React element tree, a pattern often referred to as "portal" rendering. It is a pattern for component extensibility, where a single Slot may be occupied by an indeterminate number of Fills elsewhere in the application.
+`Slot` and `Fill` are a pair of components which enable developers to render React UI elsewhere in a React element tree, a pattern often referred to as "portal" rendering. It is a pattern for component extensibility, where a single `Slot` may be occupied by multiple `Fill`s rendered in different parts of the application.
-Slot Fill is heavily inspired by the [`react-slot-fill` library](https://github.com/camwest/react-slot-fill), but uses React's own portal rendering API.
+Slot/Fill was originally inspired by the [`react-slot-fill` library](https://github.com/camwest/react-slot-fill).
## Usage
-At the root of your application, you must render a `SlotFillProvider` which coordinates Slot and Fill rendering.
+At the root of your application, you must render a `SlotFillProvider` which coordinates `Slot` and `Fill` rendering.
-Then, render a Slot component anywhere in your application, giving it a name.
+Then, render a `Slot` component anywhere in your application, giving it a `name`. The `name` is either a `string` or a symbol. Symbol names are useful for slots that are supposed to be private, accessible only to clients that have access to the symbol value.
-Any Fill will automatically occupy this Slot space, even if rendered elsewhere in the application.
+Any `Fill` will render its UI in this `Slot` space, even if rendered elsewhere in the application.
-You can either use the Fill component directly, or a wrapper component type as in the below example to abstract the slot name from consumer awareness.
+You can either use the `Fill` component directly, or create a wrapper component (as in the following example) to hide the slot name from the consumer.
```jsx
import {
@@ -43,7 +43,7 @@ const MySlotFillProvider = () => {
};
```
-There is also `createSlotFill` helper method which was created to simplify the process of matching the corresponding `Slot` and `Fill` components:
+There is also the `createSlotFill` helper method which was created to simplify the process of matching the corresponding `Slot` and `Fill` components:
```jsx
const { Fill, Slot } = createSlotFill( 'Toolbar' );
@@ -59,18 +59,27 @@ const Toolbar = () => (
## Props
-The `SlotFillProvider` component does not accept any props.
+The `SlotFillProvider` component does not accept any props (except `children`).
Both `Slot` and `Fill` accept a `name` string prop, where a `Slot` with a given `name` will render the `children` of any associated `Fill`s.
-`Slot` accepts a `bubblesVirtually` prop which changes the event bubbling behaviour:
+`Slot` accepts a `bubblesVirtually` prop which changes the method how the `Fill` children are rendered. With `bubblesVirtually`, the `Fill` is rendered using a React portal. That affects the event bubbling and React context propagation behaviour:
-- By default, events will bubble to their parents on the DOM hierarchy (native event bubbling)
-- If `bubblesVirtually` is set to true, events will bubble to their virtual parent in the React elements hierarchy instead.
+### `bubblesVirtually=false`
-`Slot` with `bubblesVirtually` set to true also accept optional `className` and `style` props to add to the slot container.
+- events will bubble to their parents on the DOM hierarchy (native event bubbling)
+- the React elements inside the `Fill` will be rendered with React context of the `Slot`
+- renders the `Fill` elements directly, inside a `Fragment`, with no wrapper DOM element
-`Slot` **without** `bubblesVirtually` accepts an optional `children` function prop, which takes `fills` as a param. It allows you to perform additional processing and wrap `fills` conditionally.
+### `bubblesVirtually=true`
+
+- events will bubble to their virtual (React) parent in the React elements hierarchy
+- the React elements inside the `Fill` will keep the React context of the `Fill` and its parents
+- renders a wrapper DOM element inside which the `Fill` elements are rendered (used as an argument for React `createPortal`)
+
+`Slot` with `bubblesVirtually=true` renders a wrapper DOM element (a `div` by default) and accepts additional props that customize this element, like `className` or `style`. You can also replace the `div` with another element by passing an `as` prop.
+
+`Slot` **without** `bubblesVirtually` accepts an optional `children` prop, which is a function that receives `fills` array as a param. It allows you to perform additional processing: render a placeholder when there are no fills, or render a wrapper only when there are fills.
_Example_:
@@ -90,7 +99,9 @@ const Toolbar = ( { isMobile } ) => (
);
```
-Props can also be passed from a `Slot` to a `Fill` by using the prop `fillProps` on the `Slot`:
+Additional information (props) can also be passed from a `Slot` to a `Fill` by a combination of:
+1. Adding a `fillProps` prop to the `Slot`.
+2. Passing a function as `children` to the `Fill`. This function will receive the `fillProps` as an argument.
```jsx
const { Fill, Slot } = createSlotFill( 'Toolbar' );
diff --git a/packages/components/src/slot-fill/index.tsx b/packages/components/src/slot-fill/index.tsx
index 03ed33a67f13b6..caf97091b67ac8 100644
--- a/packages/components/src/slot-fill/index.tsx
+++ b/packages/components/src/slot-fill/index.tsx
@@ -84,17 +84,15 @@ export function createSlotFill( key: SlotKey ) {
props: DistributiveOmit< SlotComponentProps, 'name' >
) => ;
SlotComponent.displayName = `${ baseName }Slot`;
+ /**
+ * @deprecated 6.8.0
+ * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.
+ */
SlotComponent.__unstableName = key;
return {
+ name: key,
Fill: FillComponent,
Slot: SlotComponent,
};
}
-
-export const createPrivateSlotFill = ( name: string ) => {
- const privateKey = Symbol( name );
- const privateSlotFill = createSlotFill( privateKey );
-
- return { privateKey, ...privateSlotFill };
-};
diff --git a/packages/edit-site/src/components/editor-canvas-container/index.js b/packages/edit-site/src/components/editor-canvas-container/index.js
index ac1083e69abd7e..050d2e19585cc4 100644
--- a/packages/edit-site/src/components/editor-canvas-container/index.js
+++ b/packages/edit-site/src/components/editor-canvas-container/index.js
@@ -141,7 +141,7 @@ function EditorCanvasContainer( {
}
function useHasEditorCanvasContainer() {
- const fills = useSlotFills( EditorContentSlotFill.privateKey );
+ const fills = useSlotFills( EditorContentSlotFill.name );
return !! fills?.length;
}
diff --git a/packages/editor/src/components/editor-interface/content-slot-fill.js b/packages/editor/src/components/editor-interface/content-slot-fill.js
index 1aab394e87230f..ce1070b30da802 100644
--- a/packages/editor/src/components/editor-interface/content-slot-fill.js
+++ b/packages/editor/src/components/editor-interface/content-slot-fill.js
@@ -1,15 +1,10 @@
/**
* WordPress dependencies
*/
-import { privateApis as componentsPrivateApis } from '@wordpress/components';
+import { createSlotFill } from '@wordpress/components';
-/**
- * Internal dependencies
- */
-import { unlock } from '../../lock-unlock';
-
-const { createPrivateSlotFill } = unlock( componentsPrivateApis );
-const SLOT_FILL_NAME = 'EditCanvasContainerSlot';
-const EditorContentSlotFill = createPrivateSlotFill( SLOT_FILL_NAME );
+const EditorContentSlotFill = createSlotFill(
+ Symbol( 'EditCanvasContainerSlot' )
+);
export default EditorContentSlotFill;
From 010cf1afa2f55d4e82b7b3a77d41a39522abfe01 Mon Sep 17 00:00:00 2001
From: Nik Tsekouras
Date: Mon, 25 Nov 2024 14:43:23 +0200
Subject: [PATCH 013/384] DataViews: Add density option to `table` layout
(#67170)
Unlinked contributors: annchichi.
Co-authored-by: ntsekouras
Co-authored-by: jameskoster
Co-authored-by: rogermattic
Co-authored-by: oandregal
Co-authored-by: youknowriad
Co-authored-by: mtias
Co-authored-by: mcsf
---
.../src/components/dataviews-context/index.ts | 2 -
.../src/components/dataviews-layout/index.tsx | 2 -
.../dataviews-view-config/index.tsx | 30 ++-------
.../src/components/dataviews/index.tsx | 4 --
.../src/dataviews-layouts/grid/index.tsx | 10 ++-
...ity-picker.tsx => preview-size-picker.tsx} | 65 +++++++++++--------
.../dataviews/src/dataviews-layouts/index.ts | 4 ++
.../table/density-picker.tsx | 57 ++++++++++++++++
.../src/dataviews-layouts/table/index.tsx | 8 ++-
.../src/dataviews-layouts/table/style.scss | 32 +++++++++
packages/dataviews/src/types.ts | 13 +++-
.../src/components/page-templates/style.scss | 1 +
.../src/fields/featured-image/style.scss | 7 +-
13 files changed, 168 insertions(+), 67 deletions(-)
rename packages/dataviews/src/dataviews-layouts/grid/{density-picker.tsx => preview-size-picker.tsx} (56%)
create mode 100644 packages/dataviews/src/dataviews-layouts/table/density-picker.tsx
diff --git a/packages/dataviews/src/components/dataviews-context/index.ts b/packages/dataviews/src/components/dataviews-context/index.ts
index 87acade73bc819..19f6b4178b7b55 100644
--- a/packages/dataviews/src/components/dataviews-context/index.ts
+++ b/packages/dataviews/src/components/dataviews-context/index.ts
@@ -28,7 +28,6 @@ type DataViewsContextType< Item > = {
getItemId: ( item: Item ) => string;
onClickItem: ( item: Item ) => void;
isItemClickable: ( item: Item ) => boolean;
- density: number;
};
const DataViewsContext = createContext< DataViewsContextType< any > >( {
@@ -47,7 +46,6 @@ const DataViewsContext = createContext< DataViewsContextType< any > >( {
getItemId: ( item ) => item.id,
onClickItem: () => {},
isItemClickable: () => false,
- density: 0,
} );
export default DataViewsContext;
diff --git a/packages/dataviews/src/components/dataviews-layout/index.tsx b/packages/dataviews/src/components/dataviews-layout/index.tsx
index 4ef0125b1f64b5..ebc251eae36a7a 100644
--- a/packages/dataviews/src/components/dataviews-layout/index.tsx
+++ b/packages/dataviews/src/components/dataviews-layout/index.tsx
@@ -27,7 +27,6 @@ export default function DataViewsLayout() {
selection,
onChangeSelection,
setOpenedFilter,
- density,
onClickItem,
isItemClickable,
} = useContext( DataViewsContext );
@@ -49,7 +48,6 @@ export default function DataViewsLayout() {
onClickItem={ onClickItem }
isItemClickable={ isItemClickable }
view={ view }
- density={ density }
/>
);
}
diff --git a/packages/dataviews/src/components/dataviews-view-config/index.tsx b/packages/dataviews/src/components/dataviews-view-config/index.tsx
index c8b26c51275891..f13670f27cdab7 100644
--- a/packages/dataviews/src/components/dataviews-view-config/index.tsx
+++ b/packages/dataviews/src/components/dataviews-view-config/index.tsx
@@ -35,7 +35,6 @@ import { useInstanceId } from '@wordpress/compose';
*/
import {
SORTING_DIRECTIONS,
- LAYOUT_GRID,
LAYOUT_TABLE,
sortIcons,
sortLabels,
@@ -49,7 +48,6 @@ import {
import type { SupportedLayouts, View, Field } from '../../types';
import DataViewsContext from '../dataviews-context';
import { unlock } from '../../lock-unlock';
-import DensityPicker from '../../dataviews-layouts/grid/density-picker';
const { Menu } = unlock( componentsPrivateApis );
@@ -512,19 +510,15 @@ function SettingsSection( {
);
}
-function DataviewsViewConfigDropdown( {
- density,
- setDensity,
-}: {
- density: number;
- setDensity: React.Dispatch< React.SetStateAction< number > >;
-} ) {
+function DataviewsViewConfigDropdown() {
const { view } = useContext( DataViewsContext );
const popoverId = useInstanceId(
_DataViewsViewConfig,
'dataviews-view-config-dropdown'
);
-
+ const activeLayout = VIEW_LAYOUTS.find(
+ ( layout ) => layout.type === view.type
+ );
return (
- { view.type === LAYOUT_GRID && (
-
+ { !! activeLayout?.viewConfigOptions && (
+
) }
@@ -570,21 +561,14 @@ function DataviewsViewConfigDropdown( {
}
function _DataViewsViewConfig( {
- density,
- setDensity,
defaultLayouts = { list: {}, grid: {}, table: {} },
}: {
- density: number;
- setDensity: React.Dispatch< React.SetStateAction< number > >;
defaultLayouts?: SupportedLayouts;
} ) {
return (
<>
-
+
>
);
}
diff --git a/packages/dataviews/src/components/dataviews/index.tsx b/packages/dataviews/src/components/dataviews/index.tsx
index 3e8224e61bc5d5..ee6073f40bf3d8 100644
--- a/packages/dataviews/src/components/dataviews/index.tsx
+++ b/packages/dataviews/src/components/dataviews/index.tsx
@@ -75,7 +75,6 @@ export default function DataViews< Item >( {
header,
}: DataViewsProps< Item > ) {
const [ selectionState, setSelectionState ] = useState< string[] >( [] );
- const [ density, setDensity ] = useState< number >( 0 );
const isUncontrolled =
selectionProperty === undefined || onChangeSelection === undefined;
const selection = isUncontrolled ? selectionState : selectionProperty;
@@ -119,7 +118,6 @@ export default function DataViews< Item >( {
getItemId,
isItemClickable,
onClickItem,
- density,
} }
>
@@ -151,8 +149,6 @@ export default function DataViews< Item >( {
>
{ header }
diff --git a/packages/dataviews/src/dataviews-layouts/grid/index.tsx b/packages/dataviews/src/dataviews-layouts/grid/index.tsx
index e218172b7900aa..2a09fb68efab82 100644
--- a/packages/dataviews/src/dataviews-layouts/grid/index.tsx
+++ b/packages/dataviews/src/dataviews-layouts/grid/index.tsx
@@ -25,6 +25,7 @@ import { useHasAPossibleBulkAction } from '../../components/dataviews-bulk-actio
import type { Action, NormalizedField, ViewGridProps } from '../../types';
import type { SetSelection } from '../../private-types';
import getClickableItemProps from '../utils/get-clickable-item-props';
+import { useUpdatedPreviewSizeOnViewportChange } from './preview-size-picker';
interface GridItemProps< Item > {
selection: string[];
@@ -192,7 +193,6 @@ export default function ViewGrid< Item >( {
isItemClickable,
selection,
view,
- density,
}: ViewGridProps< Item > ) {
const mediaField = fields.find(
( field ) => field.id === view.layout?.mediaField
@@ -223,8 +223,12 @@ export default function ViewGrid< Item >( {
{ visibleFields: [], badgeFields: [] }
);
const hasData = !! data?.length;
- const gridStyle = density
- ? { gridTemplateColumns: `repeat(${ density }, minmax(0, 1fr))` }
+ const updatedPreviewSize = useUpdatedPreviewSizeOnViewportChange();
+ const usedPreviewSize = updatedPreviewSize || view.layout?.previewSize;
+ const gridStyle = usedPreviewSize
+ ? {
+ gridTemplateColumns: `repeat(${ usedPreviewSize }, minmax(0, 1fr))`,
+ }
: {};
return (
<>
diff --git a/packages/dataviews/src/dataviews-layouts/grid/density-picker.tsx b/packages/dataviews/src/dataviews-layouts/grid/preview-size-picker.tsx
similarity index 56%
rename from packages/dataviews/src/dataviews-layouts/grid/density-picker.tsx
rename to packages/dataviews/src/dataviews-layouts/grid/preview-size-picker.tsx
index 34ddf6c3fe52f3..b48c6422bd6b37 100644
--- a/packages/dataviews/src/dataviews-layouts/grid/density-picker.tsx
+++ b/packages/dataviews/src/dataviews-layouts/grid/preview-size-picker.tsx
@@ -4,7 +4,13 @@
import { RangeControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useViewportMatch } from '@wordpress/compose';
-import { useEffect, useMemo } from '@wordpress/element';
+import { useMemo, useContext } from '@wordpress/element';
+
+/**
+ * Internal dependencies
+ */
+import DataViewsContext from '../../components/dataviews-context';
+import type { ViewGrid } from '../../types';
const viewportBreaks = {
xhuge: { min: 3, max: 6, default: 5 },
@@ -39,31 +45,32 @@ function useViewPortBreakpoint() {
return null;
}
-export default function DensityPicker( {
- density,
- setDensity,
-}: {
- density: number;
- setDensity: React.Dispatch< React.SetStateAction< number > >;
-} ) {
+export function useUpdatedPreviewSizeOnViewportChange() {
+ const viewport = useViewPortBreakpoint();
+ const view = useContext( DataViewsContext ).view as ViewGrid;
+ return useMemo( () => {
+ const previewSize = view.layout?.previewSize;
+ let newPreviewSize;
+ if ( ! viewport || ! previewSize ) {
+ return;
+ }
+ const breakValues = viewportBreaks[ viewport ];
+ if ( previewSize < breakValues.min ) {
+ newPreviewSize = breakValues.min;
+ }
+ if ( previewSize > breakValues.max ) {
+ newPreviewSize = breakValues.max;
+ }
+ return newPreviewSize;
+ }, [ viewport, view ] );
+}
+
+export default function PreviewSizePicker() {
const viewport = useViewPortBreakpoint();
- useEffect( () => {
- setDensity( ( _density ) => {
- if ( ! viewport || ! _density ) {
- return 0;
- }
- const breakValues = viewportBreaks[ viewport ];
- if ( _density < breakValues.min ) {
- return breakValues.min;
- }
- if ( _density > breakValues.max ) {
- return breakValues.max;
- }
- return _density;
- } );
- }, [ setDensity, viewport ] );
+ const context = useContext( DataViewsContext );
+ const view = context.view as ViewGrid;
const breakValues = viewportBreaks[ viewport || 'mobile' ];
- const densityToUse = density || breakValues.default;
+ const previewSizeToUse = view.layout?.previewSize || breakValues.default;
const marks = useMemo(
() =>
@@ -88,13 +95,19 @@ export default function DensityPicker( {
__next40pxDefaultSize
showTooltip={ false }
label={ __( 'Preview size' ) }
- value={ breakValues.max + breakValues.min - densityToUse }
+ value={ breakValues.max + breakValues.min - previewSizeToUse }
marks={ marks }
min={ breakValues.min }
max={ breakValues.max }
withInputField={ false }
onChange={ ( value = 0 ) => {
- setDensity( breakValues.max + breakValues.min - value );
+ context.onChangeView( {
+ ...view,
+ layout: {
+ ...view.layout,
+ previewSize: breakValues.max + breakValues.min - value,
+ },
+ } );
} }
step={ 1 }
/>
diff --git a/packages/dataviews/src/dataviews-layouts/index.ts b/packages/dataviews/src/dataviews-layouts/index.ts
index eece17d0f4f10c..7abdd1eb459328 100644
--- a/packages/dataviews/src/dataviews-layouts/index.ts
+++ b/packages/dataviews/src/dataviews-layouts/index.ts
@@ -17,6 +17,8 @@ import ViewGrid from './grid';
import ViewList from './list';
import { LAYOUT_GRID, LAYOUT_LIST, LAYOUT_TABLE } from '../constants';
import type { View, Field } from '../types';
+import PreviewSizePicker from './grid/preview-size-picker';
+import DensityPicker from './table/density-picker';
export const VIEW_LAYOUTS = [
{
@@ -24,12 +26,14 @@ export const VIEW_LAYOUTS = [
label: __( 'Table' ),
component: ViewTable,
icon: blockTable,
+ viewConfigOptions: DensityPicker,
},
{
type: LAYOUT_GRID,
label: __( 'Grid' ),
component: ViewGrid,
icon: category,
+ viewConfigOptions: PreviewSizePicker,
},
{
type: LAYOUT_LIST,
diff --git a/packages/dataviews/src/dataviews-layouts/table/density-picker.tsx b/packages/dataviews/src/dataviews-layouts/table/density-picker.tsx
new file mode 100644
index 00000000000000..6d3d31aeb7345e
--- /dev/null
+++ b/packages/dataviews/src/dataviews-layouts/table/density-picker.tsx
@@ -0,0 +1,57 @@
+/**
+ * WordPress dependencies
+ */
+import {
+ __experimentalToggleGroupControl as ToggleGroupControl,
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
+} from '@wordpress/components';
+import { __, _x } from '@wordpress/i18n';
+import { useContext } from '@wordpress/element';
+
+/**
+ * Internal dependencies
+ */
+import DataViewsContext from '../../components/dataviews-context';
+import type { ViewTable, Density } from '../../types';
+
+export default function DensityPicker() {
+ const context = useContext( DataViewsContext );
+ const view = context.view as ViewTable;
+ return (
+
{
+ context.onChangeView( {
+ ...view,
+ layout: {
+ ...view.layout,
+ density: value as Density,
+ },
+ } );
+ } }
+ isBlock
+ >
+
+
+
+
+ );
+}
diff --git a/packages/dataviews/src/dataviews-layouts/table/index.tsx b/packages/dataviews/src/dataviews-layouts/table/index.tsx
index db76d24b53bfa3..7f93a4c14a7ddc 100644
--- a/packages/dataviews/src/dataviews-layouts/table/index.tsx
+++ b/packages/dataviews/src/dataviews-layouts/table/index.tsx
@@ -332,7 +332,13 @@ function ViewTable< Item >( {
return (
<>
diff --git a/packages/dataviews/src/dataviews-layouts/table/style.scss b/packages/dataviews/src/dataviews-layouts/table/style.scss
index ea2c614e4339df..3bbb045c73a9d9 100644
--- a/packages/dataviews/src/dataviews-layouts/table/style.scss
+++ b/packages/dataviews/src/dataviews-layouts/table/style.scss
@@ -169,6 +169,38 @@
opacity: 1;
}
}
+
+ // Density style overrides.
+ &.has-compact-density {
+ thead {
+ th {
+ &:has(.dataviews-view-table-header-button):not(:first-child) {
+ padding-left: 0;
+ }
+ }
+ }
+ td,
+ th {
+ padding: $grid-unit-05 $grid-unit-10;
+ }
+ }
+
+ &.has-comfortable-density {
+ td,
+ th {
+ padding: $grid-unit-20 $grid-unit-15;
+ }
+ }
+
+ &.has-compact-density,
+ &.has-comfortable-density {
+ td,
+ th {
+ &.dataviews-view-table__checkbox-column {
+ padding-right: 0;
+ }
+ }
+ }
}
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
diff --git a/packages/dataviews/src/types.ts b/packages/dataviews/src/types.ts
index 8c4276f2541ecc..861dc53404f914 100644
--- a/packages/dataviews/src/types.ts
+++ b/packages/dataviews/src/types.ts
@@ -329,6 +329,8 @@ export interface ColumnStyle {
minWidth?: string | number;
}
+export type Density = 'compact' | 'balanced' | 'comfortable';
+
export interface ViewTable extends ViewBase {
type: 'table';
@@ -347,6 +349,11 @@ export interface ViewTable extends ViewBase {
* The styles for the columns.
*/
styles?: Record< string, ColumnStyle >;
+
+ /**
+ * The density of the view.
+ */
+ density?: Density;
};
}
@@ -389,6 +396,11 @@ export interface ViewGrid extends ViewBase {
* The fields to use as badge fields.
*/
badgeFields?: string[];
+
+ /**
+ * The preview size of the grid.
+ */
+ previewSize?: number;
};
}
@@ -501,7 +513,6 @@ export interface ViewBaseProps< Item > {
onClickItem: ( item: Item ) => void;
isItemClickable: ( item: Item ) => boolean;
view: View;
- density: number;
}
export interface ViewTableProps< Item > extends ViewBaseProps< Item > {
diff --git a/packages/edit-site/src/components/page-templates/style.scss b/packages/edit-site/src/components/page-templates/style.scss
index 6a753921f6f40a..4432cf6bec4923 100644
--- a/packages/edit-site/src/components/page-templates/style.scss
+++ b/packages/edit-site/src/components/page-templates/style.scss
@@ -60,6 +60,7 @@
.dataviews-view-table & {
margin-bottom: $grid-unit-10;
+ display: block;
}
}
diff --git a/packages/fields/src/fields/featured-image/style.scss b/packages/fields/src/fields/featured-image/style.scss
index 46d37960199ead..918f69172f3023 100644
--- a/packages/fields/src/fields/featured-image/style.scss
+++ b/packages/fields/src/fields/featured-image/style.scss
@@ -83,13 +83,10 @@ fieldset.fields-controls__featured-image {
}
.dataviews-view-table__cell-content-wrapper {
- .fields-controls__featured-image-image {
- width: 32px;
- height: 32px;
- }
-
+ .fields-controls__featured-image-image,
.fields-controls__featured-image-placeholder {
width: 32px;
height: 32px;
+ display: block;
}
}
From 29f0c351dfe87241c026829d1774db6216aa04cd Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Mon, 25 Nov 2024 23:40:50 +0900
Subject: [PATCH 014/384] Storybook: Restore stable components back into
categories (#67216)
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
.../src/custom-select-control/stories/index.story.tsx | 3 ++-
packages/components/src/dropdown-menu/stories/index.story.tsx | 3 ++-
packages/components/src/menu-group/stories/index.story.tsx | 3 ++-
packages/components/src/menu-item/stories/index.story.tsx | 3 ++-
.../components/src/menu-items-choice/stories/index.story.tsx | 3 ++-
packages/components/src/text-control/stories/index.story.tsx | 3 ++-
6 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/packages/components/src/custom-select-control/stories/index.story.tsx b/packages/components/src/custom-select-control/stories/index.story.tsx
index 836fc540c6d1ed..7c743de58d202d 100644
--- a/packages/components/src/custom-select-control/stories/index.story.tsx
+++ b/packages/components/src/custom-select-control/stories/index.story.tsx
@@ -14,8 +14,9 @@ import { useState } from '@wordpress/element';
import CustomSelectControl from '..';
const meta: Meta< typeof CustomSelectControl > = {
- title: 'Components/CustomSelectControl',
+ title: 'Components/Selection & Input/Common/CustomSelectControl',
component: CustomSelectControl,
+ id: 'components-customselectcontrol',
argTypes: {
onChange: { control: { type: null } },
value: { control: { type: null } },
diff --git a/packages/components/src/dropdown-menu/stories/index.story.tsx b/packages/components/src/dropdown-menu/stories/index.story.tsx
index dd4907bd0b96b1..8c13a0b57dbda6 100644
--- a/packages/components/src/dropdown-menu/stories/index.story.tsx
+++ b/packages/components/src/dropdown-menu/stories/index.story.tsx
@@ -23,8 +23,9 @@ import {
} from '@wordpress/icons';
const meta: Meta< typeof DropdownMenu > = {
- title: 'Components/DropdownMenu',
+ title: 'Components/Actions/DropdownMenu',
component: DropdownMenu,
+ id: 'components-dropdownmenu',
parameters: {
actions: { argTypesRegex: '^on.*' },
controls: { expanded: true },
diff --git a/packages/components/src/menu-group/stories/index.story.tsx b/packages/components/src/menu-group/stories/index.story.tsx
index 7cb9004b45a8c2..f53cbbf5b7b0a0 100644
--- a/packages/components/src/menu-group/stories/index.story.tsx
+++ b/packages/components/src/menu-group/stories/index.story.tsx
@@ -16,8 +16,9 @@ import MenuItemsChoice from '../../menu-items-choice';
import type { Meta, StoryFn } from '@storybook/react';
const meta: Meta< typeof MenuGroup > = {
- title: 'Components/MenuGroup',
+ title: 'Components/Actions/MenuGroup',
component: MenuGroup,
+ id: 'components-menugroup',
argTypes: {
children: { control: { type: null } },
},
diff --git a/packages/components/src/menu-item/stories/index.story.tsx b/packages/components/src/menu-item/stories/index.story.tsx
index 763ee6e96be922..24c592b66f3aea 100644
--- a/packages/components/src/menu-item/stories/index.story.tsx
+++ b/packages/components/src/menu-item/stories/index.story.tsx
@@ -17,7 +17,8 @@ import Shortcut from '../../shortcut';
const meta: Meta< typeof MenuItem > = {
component: MenuItem,
- title: 'Components/MenuItem',
+ title: 'Components/Actions/MenuItem',
+ id: 'components-menuitem',
argTypes: {
children: { control: { type: null } },
icon: {
diff --git a/packages/components/src/menu-items-choice/stories/index.story.tsx b/packages/components/src/menu-items-choice/stories/index.story.tsx
index 02e76158981e8e..f4a14054e8f27f 100644
--- a/packages/components/src/menu-items-choice/stories/index.story.tsx
+++ b/packages/components/src/menu-items-choice/stories/index.story.tsx
@@ -16,7 +16,8 @@ import MenuGroup from '../../menu-group';
const meta: Meta< typeof MenuItemsChoice > = {
component: MenuItemsChoice,
- title: 'Components/MenuItemsChoice',
+ title: 'Components/Actions/MenuItemsChoice',
+ id: 'components-menuitemschoice',
argTypes: {
onHover: { action: 'onHover' },
onSelect: { action: 'onSelect' },
diff --git a/packages/components/src/text-control/stories/index.story.tsx b/packages/components/src/text-control/stories/index.story.tsx
index 948eca84a634c7..481ae714f0ce2f 100644
--- a/packages/components/src/text-control/stories/index.story.tsx
+++ b/packages/components/src/text-control/stories/index.story.tsx
@@ -15,7 +15,8 @@ import TextControl from '..';
const meta: Meta< typeof TextControl > = {
component: TextControl,
- title: 'Components/TextControl',
+ title: 'Components/Selection & Input/Common/TextControl',
+ id: 'components-textcontrol',
argTypes: {
help: { control: { type: 'text' } },
label: { control: { type: 'text' } },
From dfc716aa09172d8abb493f7047f9baa581ba38fc Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Mon, 25 Nov 2024 23:43:12 +0900
Subject: [PATCH 015/384] GradientPicker: Auto-generate readme (#67250)
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
.../components/src/gradient-picker/README.md | 176 +++++++++++-------
.../src/gradient-picker/docs-manifest.json | 5 +
.../components/src/gradient-picker/index.tsx | 64 +++----
.../components/src/gradient-picker/types.ts | 8 +-
4 files changed, 147 insertions(+), 106 deletions(-)
create mode 100644 packages/components/src/gradient-picker/docs-manifest.json
diff --git a/packages/components/src/gradient-picker/README.md b/packages/components/src/gradient-picker/README.md
index 815b3d8eb5dd75..a8ee9d990c5c2a 100644
--- a/packages/components/src/gradient-picker/README.md
+++ b/packages/components/src/gradient-picker/README.md
@@ -1,110 +1,148 @@
# GradientPicker
-GradientPicker is a React component that renders a color gradient picker to define a multi step gradient. There's either a _linear_ or a _radial_ type available.
+
-![gradient-picker](https://user-images.githubusercontent.com/881729/147505438-3818c4c7-65b5-4394-b97b-af903c62adce.png)
+See the WordPress Storybook for more detailed, interactive documentation.
-## Usage
-
-Render a GradientPicker.
+GradientPicker is a React component that renders a color gradient picker to
+define a multi step gradient. There's either a _linear_ or a _radial_ type
+available.
```jsx
import { useState } from 'react';
import { GradientPicker } from '@wordpress/components';
-const myGradientPicker = () => {
- const [ gradient, setGradient ] = useState( null );
-
- return (
- setGradient( currentGradient ) }
- gradients={ [
- {
- name: 'JShine',
- gradient:
- 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
- slug: 'jshine',
- },
- {
- name: 'Moonlit Asteroid',
- gradient:
- 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
- slug: 'moonlit-asteroid',
- },
- {
- name: 'Rastafarie',
- gradient:
- 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
- slug: 'rastafari',
- },
- ] }
- />
- );
+const MyGradientPicker = () => {
+ const [ gradient, setGradient ] = useState( null );
+
+ return (
+ setGradient( currentGradient ) }
+ gradients={ [
+ {
+ name: 'JShine',
+ gradient:
+ 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
+ slug: 'jshine',
+ },
+ {
+ name: 'Moonlit Asteroid',
+ gradient:
+ 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
+ slug: 'moonlit-asteroid',
+ },
+ {
+ name: 'Rastafarie',
+ gradient:
+ 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
+ slug: 'rastafari',
+ },
+ ] }
+ />
+ );
};
```
-
## Props
-The component accepts the following props:
+### `__experimentalIsRenderedInSidebar`
-### `className`: `string`
+Whether this is rendered in the sidebar.
-The class name added to the wrapper.
+ - Type: `boolean`
+ - Required: No
+ - Default: `false`
-- Required: No
+### `asButtons`
-### `value`: `string`
+Whether the control should present as a set of buttons,
+each with its own tab stop.
-The current value of the gradient. Pass a css gradient like `linear-gradient(90deg, rgb(6, 147, 227) 0%, rgb(155, 81, 224) 100%)`. Optionally pass in a `null` value to specify no gradient is currently selected.
+ - Type: `boolean`
+ - Required: No
+ - Default: `false`
-- Required: No
-- Default: `linear-gradient(90deg, rgb(6, 147, 227) 0%, rgb(155, 81, 224) 100%)`
+### `aria-label`
-### `onChange`: `( currentGradient: string | undefined ) => void`
+A label to identify the purpose of the control.
-The function called when a new gradient has been defined. It is passed the `currentGradient` as an argument.
+ - Type: `string`
+ - Required: No
-- Required: Yes
+### `aria-labelledby`
-### `gradients`: `GradientsProp[]`
+An ID of an element to provide a label for the control.
-An array of objects of predefined gradients displayed above the gradient selector.
+ - Type: `string`
+ - Required: No
+
+### `className`
+
+The class name added to the wrapper.
-- Required: No
-- Default: `[]`
+ - Type: `string`
+ - Required: No
-### `clearable`: `boolean`
+### `clearable`
Whether the palette should have a clearing button or not.
-- Required: No
-- Default: true
+ - Type: `boolean`
+ - Required: No
+ - Default: `true`
+
+### `disableCustomGradients`
+
+If true, the gradient picker will not be displayed and only defined
+gradients from `gradients` will be shown.
+
+ - Type: `boolean`
+ - Required: No
+ - Default: `false`
+
+### `gradients`
+
+An array of objects as predefined gradients displayed above the gradient
+selector. Alternatively, if there are multiple sets (or 'origins') of
+gradients, you can pass an array of objects each with a `name` and a
+`gradients` array which will in turn contain the predefined gradient objects.
+
+ - Type: `GradientsProp`
+ - Required: No
+ - Default: `[]`
-### `disableCustomGradients`: `boolean`
+### `headingLevel`
-If true, the gradient picker will not be displayed and only defined gradients from `gradients` are available.
+The heading level. Only applies in cases where gradients are provided
+from multiple origins (i.e. when the array passed as the `gradients` prop
+contains two or more items).
-- Required: No
-- Default: false
+ - Type: `1 | 2 | 3 | 4 | 5 | 6 | "1" | "2" | "3" | "4" | ...`
+ - Required: No
+ - Default: `2`
-### `headingLevel`: `1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'`
+### `loop`
-The heading level. Only applies in cases where gradients are provided from multiple origins (ie. when the array passed as the `gradients` prop contains two or more items).
+Prevents keyboard interaction from wrapping around.
+Only used when `asButtons` is not true.
-- Required: No
-- Default: `2`
+ - Type: `boolean`
+ - Required: No
+ - Default: `true`
-### `asButtons`: `boolean`
+### `onChange`
-Whether the control should present as a set of buttons, each with its own tab stop.
+The function called when a new gradient has been defined. It is passed to
+the `currentGradient` as an argument.
-- Required: No
-- Default: `false`
+ - Type: `(currentGradient: string) => void`
+ - Required: Yes
-### `loop`: `boolean`
+### `value`
-Prevents keyboard interaction from wrapping around. Only used when `asButtons` is not true.
+The current value of the gradient. Pass a css gradient string (See default value for example).
+Optionally pass in a `null` value to specify no gradient is currently selected.
-- Required: No
-- Default: `true`
+ - Type: `string`
+ - Required: No
+ - Default: `'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'`
diff --git a/packages/components/src/gradient-picker/docs-manifest.json b/packages/components/src/gradient-picker/docs-manifest.json
new file mode 100644
index 00000000000000..6bea56ccc678c6
--- /dev/null
+++ b/packages/components/src/gradient-picker/docs-manifest.json
@@ -0,0 +1,5 @@
+{
+ "$schema": "../../schemas/docs-manifest.json",
+ "displayName": "GradientPicker",
+ "filePath": "./index.tsx"
+}
diff --git a/packages/components/src/gradient-picker/index.tsx b/packages/components/src/gradient-picker/index.tsx
index f0607badd1b03a..124a89c7e016e1 100644
--- a/packages/components/src/gradient-picker/index.tsx
+++ b/packages/components/src/gradient-picker/index.tsx
@@ -166,44 +166,44 @@ function Component( props: PickerProps< any > ) {
}
/**
- * GradientPicker is a React component that renders a color gradient picker to
+ * GradientPicker is a React component that renders a color gradient picker to
* define a multi step gradient. There's either a _linear_ or a _radial_ type
* available.
*
* ```jsx
- *import { GradientPicker } from '@wordpress/components';
- *import { useState } from '@wordpress/element';
+ * import { useState } from 'react';
+ * import { GradientPicker } from '@wordpress/components';
*
- *const myGradientPicker = () => {
- * const [ gradient, setGradient ] = useState( null );
+ * const MyGradientPicker = () => {
+ * const [ gradient, setGradient ] = useState( null );
*
- * return (
- * setGradient( currentGradient ) }
- * gradients={ [
- * {
- * name: 'JShine',
- * gradient:
- * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
- * slug: 'jshine',
- * },
- * {
- * name: 'Moonlit Asteroid',
- * gradient:
- * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
- * slug: 'moonlit-asteroid',
- * },
- * {
- * name: 'Rastafarie',
- * gradient:
- * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
- * slug: 'rastafari',
- * },
- * ] }
- * />
- * );
- *};
+ * return (
+ * setGradient( currentGradient ) }
+ * gradients={ [
+ * {
+ * name: 'JShine',
+ * gradient:
+ * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
+ * slug: 'jshine',
+ * },
+ * {
+ * name: 'Moonlit Asteroid',
+ * gradient:
+ * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
+ * slug: 'moonlit-asteroid',
+ * },
+ * {
+ * name: 'Rastafarie',
+ * gradient:
+ * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
+ * slug: 'rastafari',
+ * },
+ * ] }
+ * />
+ * );
+ * };
*```
*
*/
diff --git a/packages/components/src/gradient-picker/types.ts b/packages/components/src/gradient-picker/types.ts
index b563653e33e4c4..8ac2c6de9f2cf3 100644
--- a/packages/components/src/gradient-picker/types.ts
+++ b/packages/components/src/gradient-picker/types.ts
@@ -36,7 +36,7 @@ type GradientPickerBaseProps = {
clearable?: boolean;
/**
* The heading level. Only applies in cases where gradients are provided
- * from multiple origins (ie. when the array passed as the `gradients` prop
+ * from multiple origins (i.e. when the array passed as the `gradients` prop
* contains two or more items).
*
* @default 2
@@ -58,19 +58,17 @@ type GradientPickerBaseProps = {
loop?: boolean;
} & (
| {
+ // TODO: [#54055] Either this or `aria-labelledby` should be required
/**
* A label to identify the purpose of the control.
- *
- * @todo [#54055] Either this or `aria-labelledby` should be required
*/
'aria-label'?: string;
'aria-labelledby'?: never;
}
| {
+ // TODO: [#54055] Either this or `aria-label` should be required
/**
* An ID of an element to provide a label for the control.
- *
- * @todo [#54055] Either this or `aria-label` should be required
*/
'aria-labelledby'?: string;
'aria-label'?: never;
From e27e5e446a2ba68f3e06963c9e68c9521580cebc Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Mon, 25 Nov 2024 23:56:29 +0900
Subject: [PATCH 016/384] Autocomplete: Increase option height (#67214)
* Autocomplete: Increase option height
* Add changelog
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/CHANGELOG.md | 1 +
packages/components/src/autocomplete/autocompleter-ui.tsx | 1 +
2 files changed, 2 insertions(+)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index bcb9bfe3c013e4..29e746c905f8d4 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -26,6 +26,7 @@
### Enhancements
- `ColorPicker`: Update sizes of color format select and copy button ([#67093](https://github.com/WordPress/gutenberg/pull/67093)).
+- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).
### Experimental
diff --git a/packages/components/src/autocomplete/autocompleter-ui.tsx b/packages/components/src/autocomplete/autocompleter-ui.tsx
index 69105f6c9d3b44..dbbbe724113d7c 100644
--- a/packages/components/src/autocomplete/autocompleter-ui.tsx
+++ b/packages/components/src/autocomplete/autocompleter-ui.tsx
@@ -57,6 +57,7 @@ function ListBox( {
key={ option.key }
id={ `components-autocomplete-item-${ instanceId }-${ option.key }` }
role="option"
+ __next40pxDefaultSize
aria-selected={ index === selectedIndex }
accessibleWhenDisabled
disabled={ option.isDisabled }
From b76d9f0311019c7d866ce1d9db92140e483887bd Mon Sep 17 00:00:00 2001
From: Ella <4710635+ellatrix@users.noreply.github.com>
Date: Mon, 25 Nov 2024 16:12:44 +0100
Subject: [PATCH 017/384] Rich text: preserve comments (#62128)
Co-authored-by: ellatrix
Co-authored-by: lysyjan
Co-authored-by: youknowriad
Co-authored-by: RolfKyburz
Co-authored-by: strarsis
Co-authored-by: danielbachhuber
---
.../src/components/rich-text/content.scss | 19 +++++--
packages/rich-text/src/create.js | 28 ++++++++++
.../src/test/__snapshots__/to-dom.js.snap | 30 +++++++++++
packages/rich-text/src/test/helpers/index.js | 52 +++++++++++++++++++
packages/rich-text/src/to-dom.js | 12 +++--
packages/rich-text/src/to-html-string.js | 9 ++++
packages/rich-text/src/to-tree.js | 15 +++++-
7 files changed, 157 insertions(+), 8 deletions(-)
diff --git a/packages/block-editor/src/components/rich-text/content.scss b/packages/block-editor/src/components/rich-text/content.scss
index 28dcd931a7f5db..67e14b0882d7ef 100644
--- a/packages/block-editor/src/components/rich-text/content.scss
+++ b/packages/block-editor/src/components/rich-text/content.scss
@@ -13,10 +13,6 @@
&:focus {
// Removes outline added by the browser.
outline: none;
-
- [data-rich-text-format-boundary] {
- border-radius: $radius-small;
- }
}
}
@@ -34,3 +30,18 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
background: rgb(255, 255, 0);
}
}
+
+[data-rich-text-comment],
+[data-rich-text-format-boundary] {
+ border-radius: $radius-small;
+}
+
+[data-rich-text-comment] {
+ background-color: currentColor;
+
+ span {
+ filter: invert(100%);
+ color: currentColor;
+ padding: 0 2px;
+ }
+}
diff --git a/packages/rich-text/src/create.js b/packages/rich-text/src/create.js
index 898bdfa73b330e..d683836d9e2fa8 100644
--- a/packages/rich-text/src/create.js
+++ b/packages/rich-text/src/create.js
@@ -469,6 +469,34 @@ function createFromElement( { element, range, isEditableTree } ) {
continue;
}
+ if (
+ node.nodeType === node.COMMENT_NODE ||
+ ( node.nodeType === node.ELEMENT_NODE &&
+ node.tagName === 'SPAN' &&
+ node.hasAttribute( 'data-rich-text-comment' ) )
+ ) {
+ const value = {
+ formats: [ , ],
+ replacements: [
+ {
+ type: '#comment',
+ attributes: {
+ 'data-rich-text-comment':
+ node.nodeType === node.COMMENT_NODE
+ ? node.nodeValue
+ : node.getAttribute(
+ 'data-rich-text-comment'
+ ),
+ },
+ },
+ ],
+ text: OBJECT_REPLACEMENT_CHARACTER,
+ };
+ accumulateSelection( accumulator, node, range, value );
+ mergePair( accumulator, value );
+ continue;
+ }
+
if ( node.nodeType !== node.ELEMENT_NODE ) {
continue;
}
diff --git a/packages/rich-text/src/test/__snapshots__/to-dom.js.snap b/packages/rich-text/src/test/__snapshots__/to-dom.js.snap
index 0daf48aa9a1c36..0e2ac57bea3704 100644
--- a/packages/rich-text/src/test/__snapshots__/to-dom.js.snap
+++ b/packages/rich-text/src/test/__snapshots__/to-dom.js.snap
@@ -272,6 +272,21 @@ exports[`recordToDom should not error with overlapping formats (2) 1`] = `
+
+
+
+ comment
+
+
+
+
🍒
@@ -289,6 +304,21 @@ exports[`recordToDom should preserve emoji in formatting 1`] = `
+
+
+
+ /funky
+
+
+
+
test test
diff --git a/packages/rich-text/src/test/helpers/index.js b/packages/rich-text/src/test/helpers/index.js
index f246ab956db3a7..7658ede7e37737 100644
--- a/packages/rich-text/src/test/helpers/index.js
+++ b/packages/rich-text/src/test/helpers/index.js
@@ -551,6 +551,58 @@ export const spec = [
text: '\ufffc',
},
},
+ {
+ description: 'should preserve comments',
+ html: '',
+ createRange: ( element ) => ( {
+ startOffset: 0,
+ startContainer: element,
+ endOffset: 1,
+ endContainer: element,
+ } ),
+ startPath: [ 0, 0 ],
+ endPath: [ 2, 0 ],
+ record: {
+ start: 0,
+ end: 1,
+ formats: [ , ],
+ replacements: [
+ {
+ attributes: {
+ 'data-rich-text-comment': 'comment',
+ },
+ type: '#comment',
+ },
+ ],
+ text: '\ufffc',
+ },
+ },
+ {
+ description: 'should preserve funky comments',
+ html: '/funky>',
+ createRange: ( element ) => ( {
+ startOffset: 0,
+ startContainer: element,
+ endOffset: 1,
+ endContainer: element,
+ } ),
+ startPath: [ 0, 0 ],
+ endPath: [ 2, 0 ],
+ record: {
+ start: 0,
+ end: 1,
+ formats: [ , ],
+ replacements: [
+ {
+ attributes: {
+ 'data-rich-text-comment': '/funky',
+ },
+ type: '#comment',
+ },
+ ],
+ text: '\ufffc',
+ },
+ },
];
export const specWithRegistration = [
diff --git a/packages/rich-text/src/to-dom.js b/packages/rich-text/src/to-dom.js
index e7288e4ba16332..ac8308c7274b58 100644
--- a/packages/rich-text/src/to-dom.js
+++ b/packages/rich-text/src/to-dom.js
@@ -68,10 +68,16 @@ function append( element, child ) {
const { type, attributes } = child;
if ( type ) {
- child = element.ownerDocument.createElement( type );
+ if ( type === '#comment' ) {
+ child = element.ownerDocument.createComment(
+ attributes[ 'data-rich-text-comment' ]
+ );
+ } else {
+ child = element.ownerDocument.createElement( type );
- for ( const key in attributes ) {
- child.setAttribute( key, attributes[ key ] );
+ for ( const key in attributes ) {
+ child.setAttribute( key, attributes[ key ] );
+ }
}
}
diff --git a/packages/rich-text/src/to-html-string.js b/packages/rich-text/src/to-html-string.js
index f770dfdefc128a..a4c12b4c47f00d 100644
--- a/packages/rich-text/src/to-html-string.js
+++ b/packages/rich-text/src/to-html-string.js
@@ -88,6 +88,15 @@ function remove( object ) {
}
function createElementHTML( { type, attributes, object, children } ) {
+ if ( type === '#comment' ) {
+ // We can't restore the original comment delimiters, because once parsed
+ // into DOM nodes, we don't have the information. But in the future we
+ // could allow comment handlers to specify custom delimiters, for
+ // example `{comment-content}>` for Bits, where `comment-content`
+ // would be `/{bit-name}` or `__{translatable-string}` (TBD).
+ return ``;
+ }
+
let attributeString = '';
for ( const key in attributes ) {
diff --git a/packages/rich-text/src/to-tree.js b/packages/rich-text/src/to-tree.js
index 46671c951bc09d..0e3caad4f70c83 100644
--- a/packages/rich-text/src/to-tree.js
+++ b/packages/rich-text/src/to-tree.js
@@ -229,7 +229,20 @@ export function toTree( {
const { type, attributes, innerHTML } = replacement;
const formatType = getFormatType( type );
- if ( ! isEditableTree && type === 'script' ) {
+ if ( isEditableTree && type === '#comment' ) {
+ pointer = append( getParent( pointer ), {
+ type: 'span',
+ attributes: {
+ contenteditable: 'false',
+ 'data-rich-text-comment':
+ attributes[ 'data-rich-text-comment' ],
+ },
+ } );
+ append(
+ append( pointer, { type: 'span' } ),
+ attributes[ 'data-rich-text-comment' ].trim()
+ );
+ } else if ( ! isEditableTree && type === 'script' ) {
pointer = append(
getParent( pointer ),
fromFormat( {
From 2215a045c3e3fb9c1bd65abbf1c2a53b2887c513 Mon Sep 17 00:00:00 2001
From: Alex Lende
Date: Mon, 25 Nov 2024 11:20:06 -0600
Subject: [PATCH 018/384] Zoom in/out to correct location (#67126)
Co-authored-by: jeryj
Co-authored-by: ajlende
Co-authored-by: stokesman
Co-authored-by: ndiego
Co-authored-by: richtabor
Co-authored-by: draganescu
Co-authored-by: colorful-tones
Co-authored-by: getdave
Co-authored-by: priethor
Co-authored-by: annezazu
Co-authored-by: ellatrix
Co-authored-by: cbravobernal
---
.../src/components/iframe/content.scss | 19 +-
.../src/components/iframe/index.js | 231 ++++++++++++++----
test/e2e/specs/site-editor/zoom-out.spec.js | 168 +++++++++++++
3 files changed, 371 insertions(+), 47 deletions(-)
diff --git a/packages/block-editor/src/components/iframe/content.scss b/packages/block-editor/src/components/iframe/content.scss
index 596c177eab2f32..5e390800719949 100644
--- a/packages/block-editor/src/components/iframe/content.scss
+++ b/packages/block-editor/src/components/iframe/content.scss
@@ -7,13 +7,26 @@
// We don't want to animate the transform of the translateX because it is used
// to "center" the canvas. Leaving it on causes the canvas to slide around in
// odd ways.
- @include editor-canvas-resize-animation(transform 0s, scale 0s, padding 0s);
+ @include editor-canvas-resize-animation( transform 0s, scale 0s, padding 0s, translate 0s);
&.zoom-out-animation {
- // we only want to animate the scaling when entering zoom out. When sidebars
+ $scroll-top: var(--wp-block-editor-iframe-zoom-out-scroll-top, 0);
+ $scroll-top-next: var(--wp-block-editor-iframe-zoom-out-scroll-top-next, 0);
+
+ position: fixed;
+ left: 0;
+ right: 0;
+ top: calc(-1 * #{$scroll-top});
+ bottom: 0;
+ translate: 0 calc(#{$scroll-top} - #{$scroll-top-next});
+ // Force preserving a scrollbar gutter as scrollbar-gutter isn't supported in all browsers yet,
+ // and removing the scrollbar causes the content to shift.
+ overflow-y: scroll;
+
+ // We only want to animate the scaling when entering zoom out. When sidebars
// are toggled, the resizing of the iframe handles scaling the canvas as well,
// and the doubled animations cause very odd animations.
- @include editor-canvas-resize-animation(transform 0s);
+ @include editor-canvas-resize-animation( transform 0s, top 0s, bottom 0s, right 0s, left 0s );
}
}
diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js
index 76d2e09dfb7a30..f8b7c25084e38d 100644
--- a/packages/block-editor/src/components/iframe/index.js
+++ b/packages/block-editor/src/components/iframe/index.js
@@ -20,6 +20,7 @@ import {
useMergeRefs,
useRefEffect,
useDisabled,
+ useReducedMotion,
} from '@wordpress/compose';
import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';
import { useSelect } from '@wordpress/data';
@@ -121,6 +122,7 @@ function Iframe( {
};
}, [] );
const { styles = '', scripts = '' } = resolvedAssets;
+ /** @type {[Document, import('react').Dispatch]} */
const [ iframeDocument, setIframeDocument ] = useState();
const initialContainerWidthRef = useRef( 0 );
const [ bodyClasses, setBodyClasses ] = useState( [] );
@@ -130,6 +132,7 @@ function Iframe( {
useResizeObserver();
const [ containerResizeListener, { width: containerWidth } ] =
useResizeObserver();
+ const prefersReducedMotion = useReducedMotion();
const setRef = useRefEffect( ( node ) => {
node._load = () => {
@@ -268,6 +271,19 @@ function Iframe( {
containerWidth
);
+ const frameSizeValue = parseInt( frameSize );
+
+ const maxWidth = 750;
+ const scaleValue =
+ scale === 'auto-scaled'
+ ? ( Math.min( containerWidth, maxWidth ) - frameSizeValue * 2 ) /
+ scaleContainerWidth
+ : scale;
+
+ const prevScaleRef = useRef( scaleValue );
+ const prevFrameSizeRef = useRef( frameSizeValue );
+ const prevClientHeightRef = useRef( /* Initialized in the useEffect. */ );
+
const disabledRef = useDisabled( { isDisabled: ! readonly } );
const bodyRef = useMergeRefs( [
useBubbleEvents( iframeDocument ),
@@ -320,47 +336,176 @@ function Iframe( {
useEffect( () => cleanup, [ cleanup ] );
- const zoomOutAnimationClassnameRef = useRef( null );
-
- // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
- // that controls settings the CSS variables, but then we would need to do more work to ensure we're
- // only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large
- // number of dependencies.
useEffect( () => {
- if ( ! iframeDocument || ! isZoomedOut ) {
+ if (
+ ! iframeDocument ||
+ // HACK: Checking if isZoomedOut differs from prevIsZoomedOut here
+ // instead of the dependency array to appease the linter.
+ ( scaleValue === 1 ) === ( prevScaleRef.current === 1 )
+ ) {
return;
}
- const handleZoomOutAnimationClassname = () => {
- clearTimeout( zoomOutAnimationClassnameRef.current );
+ // Unscaled height of the current iframe container.
+ const clientHeight = iframeDocument.documentElement.clientHeight;
+
+ // Scaled height of the current iframe content.
+ const scrollHeight = iframeDocument.documentElement.scrollHeight;
+
+ // Previous scale value.
+ const prevScale = prevScaleRef.current;
+
+ // Unscaled size of the previous padding around the iframe content.
+ const prevFrameSize = prevFrameSizeRef.current;
+
+ // Unscaled height of the previous iframe container.
+ const prevClientHeight = prevClientHeightRef.current ?? clientHeight;
+
+ // We can't trust the set value from contentHeight, as it was measured
+ // before the zoom out mode was changed. After zoom out mode is changed,
+ // appenders may appear or disappear, so we need to get the height from
+ // the iframe at this point when we're about to animate the zoom out.
+ // The iframe scrollTop, scrollHeight, and clientHeight will all be
+ // accurate. The client height also does change when the zoom out mode
+ // is toggled, as the bottom bar about selecting the template is
+ // added/removed when toggling zoom out mode.
+ const scrollTop = iframeDocument.documentElement.scrollTop;
+
+ // Step 0: Start with the current scrollTop.
+ let scrollTopNext = scrollTop;
+
+ // Step 1: Undo the effects of the previous scale and frame around the
+ // midpoint of the visible area.
+ scrollTopNext =
+ ( scrollTopNext + prevClientHeight / 2 - prevFrameSize ) /
+ prevScale -
+ prevClientHeight / 2;
+
+ // Step 2: Apply the new scale and frame around the midpoint of the
+ // visible area.
+ scrollTopNext =
+ ( scrollTopNext + clientHeight / 2 ) * scaleValue +
+ frameSizeValue -
+ clientHeight / 2;
+
+ // Step 3: Handle an edge case so that you scroll to the top of the
+ // iframe if the top of the iframe content is visible in the container.
+ // The same edge case for the bottom is skipped because changing content
+ // makes calculating it impossible.
+ scrollTopNext = scrollTop <= prevFrameSize ? 0 : scrollTopNext;
+
+ // This is the scrollTop value if you are scrolled to the bottom of the
+ // iframe. We can't just let the browser handle it because we need to
+ // animate the scaling.
+ const maxScrollTop =
+ scrollHeight * ( scaleValue / prevScale ) +
+ frameSizeValue * 2 -
+ clientHeight;
+
+ // Step 4: Clamp the scrollTopNext between the minimum and maximum
+ // possible scrollTop positions. Round the value to avoid subpixel
+ // truncation by the browser which sometimes causes a 1px error.
+ scrollTopNext = Math.round(
+ Math.min(
+ Math.max( 0, scrollTopNext ),
+ Math.max( 0, maxScrollTop )
+ )
+ );
- iframeDocument.documentElement.classList.add(
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top',
+ `${ scrollTop }px`
+ );
+
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top-next',
+ `${ scrollTopNext }px`
+ );
+
+ iframeDocument.documentElement.classList.add( 'zoom-out-animation' );
+
+ function onZoomOutTransitionEnd() {
+ // Remove the position fixed for the animation.
+ iframeDocument.documentElement.classList.remove(
'zoom-out-animation'
);
- zoomOutAnimationClassnameRef.current = setTimeout( () => {
- iframeDocument.documentElement.classList.remove(
- 'zoom-out-animation'
+ // Update previous values.
+ prevClientHeightRef.current = clientHeight;
+ prevFrameSizeRef.current = frameSizeValue;
+ prevScaleRef.current = scaleValue;
+
+ // Set the final scroll position that was just animated to.
+ // Disable reason: Eslint isn't smart enough to know that this is a
+ // DOM element. https://github.com/facebook/react/issues/31483
+ // eslint-disable-next-line react-compiler/react-compiler
+ iframeDocument.documentElement.scrollTop = scrollTopNext;
+ }
+
+ let raf;
+ if ( prefersReducedMotion ) {
+ // Hack: Wait for the window values to recalculate.
+ raf = iframeDocument.defaultView.requestAnimationFrame(
+ onZoomOutTransitionEnd
+ );
+ } else {
+ iframeDocument.documentElement.addEventListener(
+ 'transitionend',
+ onZoomOutTransitionEnd,
+ { once: true }
+ );
+ }
+
+ return () => {
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top-next'
+ );
+ iframeDocument.documentElement.classList.remove(
+ 'zoom-out-animation'
+ );
+ if ( prefersReducedMotion ) {
+ iframeDocument.defaultView.cancelAnimationFrame( raf );
+ } else {
+ iframeDocument.documentElement.removeEventListener(
+ 'transitionend',
+ onZoomOutTransitionEnd
);
- }, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss
+ }
};
+ }, [ iframeDocument, scaleValue, frameSizeValue, prefersReducedMotion ] );
- handleZoomOutAnimationClassname();
- iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
+ // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
+ // that controls settings the CSS variables, but then we would need to do more work to ensure we're
+ // only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large
+ // number of dependencies.
+ useEffect( () => {
+ if ( ! iframeDocument ) {
+ return;
+ }
- return () => {
- handleZoomOutAnimationClassname();
+ if ( isZoomedOut ) {
+ iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
+ } else {
+ // HACK: Since we can't remove this in the cleanup, we need to do it here.
iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
+ }
+
+ return () => {
+ // HACK: Skipping cleanup because it causes issues with the zoom out
+ // animation. More refactoring is needed to fix this properly.
+ // iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
};
}, [ iframeDocument, isZoomedOut ] );
// Calculate the scaling and CSS variables for the zoom out canvas
useEffect( () => {
- if ( ! iframeDocument || ! isZoomedOut ) {
+ if ( ! iframeDocument ) {
return;
}
- const maxWidth = 750;
// Note: When we initialize the zoom out when the canvas is smaller (sidebars open),
// initialContainerWidthRef will be smaller than the full page, and reflow will happen
// when the canvas area becomes larger due to sidebars closing. This is a known but
@@ -371,11 +516,7 @@ function Iframe( {
// but calc( 100px / 2px ) is not.
iframeDocument.documentElement.style.setProperty(
'--wp-block-editor-iframe-zoom-out-scale',
- scale === 'auto-scaled'
- ? ( Math.min( containerWidth, maxWidth ) -
- parseInt( frameSize ) * 2 ) /
- scaleContainerWidth
- : scale
+ scaleValue
);
// frameSize has to be a px value for the scaling and frame size to be computed correctly.
@@ -401,27 +542,29 @@ function Iframe( {
);
return () => {
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-scale'
- );
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-frame-size'
- );
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-content-height'
- );
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-inner-height'
- );
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-container-width'
- );
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-scale-container-width'
- );
+ // HACK: Skipping cleanup because it causes issues with the zoom out
+ // animation. More refactoring is needed to fix this properly.
+ // iframeDocument.documentElement.style.removeProperty(
+ // '--wp-block-editor-iframe-zoom-out-scale'
+ // );
+ // iframeDocument.documentElement.style.removeProperty(
+ // '--wp-block-editor-iframe-zoom-out-frame-size'
+ // );
+ // iframeDocument.documentElement.style.removeProperty(
+ // '--wp-block-editor-iframe-zoom-out-content-height'
+ // );
+ // iframeDocument.documentElement.style.removeProperty(
+ // '--wp-block-editor-iframe-zoom-out-inner-height'
+ // );
+ // iframeDocument.documentElement.style.removeProperty(
+ // '--wp-block-editor-iframe-zoom-out-container-width'
+ // );
+ // iframeDocument.documentElement.style.removeProperty(
+ // '--wp-block-editor-iframe-zoom-out-scale-container-width'
+ // );
};
}, [
- scale,
+ scaleValue,
frameSize,
iframeDocument,
iframeWindowInnerHeight,
diff --git a/test/e2e/specs/site-editor/zoom-out.spec.js b/test/e2e/specs/site-editor/zoom-out.spec.js
index 464bd4a4a4efad..e698a94b7cf0dc 100644
--- a/test/e2e/specs/site-editor/zoom-out.spec.js
+++ b/test/e2e/specs/site-editor/zoom-out.spec.js
@@ -3,6 +3,63 @@
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
+const EDITOR_ZOOM_OUT_CONTENT = `
+
+
+
First Section Start
+
+
+
+
First Section Center
+
+
+
+
First Section End
+
+
+
+
+
+
Second Section Start
+
+
+
+
Second Section Center
+
+
+
+
Second Section End
+
+
+
+
+
+
Third Section Start
+
+
+
+
Third Section Center
+
+
+
+
Third Section End
+
+
+
+
+
+
Fourth Section Start
+
+
+
+
Fourth Section Center
+
+
+
+
Fourth Section End
+
+`;
+
test.describe( 'Zoom Out', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyfour' );
@@ -47,4 +104,115 @@ test.describe( 'Zoom Out', () => {
expect( htmlRect.y + paddingTop ).toBeGreaterThan( iframeRect.y );
expect( htmlRect.x ).toBeGreaterThan( iframeRect.x );
} );
+
+ test( 'Toggling zoom state should keep content centered', async ( {
+ page,
+ editor,
+ } ) => {
+ // Add some patterns into the page.
+ await editor.setContent( EDITOR_ZOOM_OUT_CONTENT );
+ // Find the scroll container element
+ await page.evaluate( () => {
+ const { activeElement } =
+ document.activeElement?.contentDocument ?? document;
+ window.scrollContainer =
+ window.wp.dom.getScrollContainer( activeElement );
+ return window.scrollContainer;
+ } );
+
+ // Test: Test from top of page (scrollTop 0)
+ // Enter Zoom Out
+ await page.getByRole( 'button', { name: 'Zoom Out' } ).click();
+
+ const scrollTopZoomed = await page.evaluate( () => {
+ return window.scrollContainer.scrollTop;
+ } );
+
+ expect( scrollTopZoomed ).toBe( 0 );
+
+ // Exit Zoom Out
+ await page.getByRole( 'button', { name: 'Zoom Out' } ).click();
+
+ const scrollTopNoZoom = await page.evaluate( () => {
+ return window.scrollContainer.scrollTop;
+ } );
+
+ expect( scrollTopNoZoom ).toBe( 0 );
+
+ // Test: Should center the scroll position when zooming out/in
+ const firstSectionEnd = editor.canvas.locator(
+ 'text=First Section End'
+ );
+ const secondSectionStart = editor.canvas.locator(
+ 'text=Second Section Start'
+ );
+ const secondSectionCenter = editor.canvas.locator(
+ 'text=Second Section Center'
+ );
+ const secondSectionEnd = editor.canvas.locator(
+ 'text=Second Section End'
+ );
+ const thirdSectionStart = editor.canvas.locator(
+ 'text=Third Section Start'
+ );
+ const thirdSectionCenter = editor.canvas.locator(
+ 'text=Third Section Center'
+ );
+ const thirdSectionEnd = editor.canvas.locator(
+ 'text=Third Section End'
+ );
+ const fourthSectionStart = editor.canvas.locator(
+ 'text=Fourth Section Start'
+ );
+
+ // Test for second section
+ // Playwright scrolls it to the center of the viewport, so this is what we scroll to.
+ await secondSectionCenter.scrollIntoViewIfNeeded();
+
+ // Because the text is spread with a group height of 100vh, they should both be visible.
+ await expect( firstSectionEnd ).not.toBeInViewport();
+ await expect( secondSectionStart ).toBeInViewport();
+ await expect( secondSectionEnd ).toBeInViewport();
+ await expect( thirdSectionStart ).not.toBeInViewport();
+
+ // After zooming, if we zoomed out with the correct central point, they should both still be visible when toggling zoom out state
+ // Enter Zoom Out
+ await page.getByRole( 'button', { name: 'Zoom Out' } ).click();
+ await expect( firstSectionEnd ).toBeInViewport();
+ await expect( secondSectionStart ).toBeInViewport();
+ await expect( secondSectionEnd ).toBeInViewport();
+ await expect( thirdSectionStart ).toBeInViewport();
+
+ // Exit Zoom Out
+ await page.getByRole( 'button', { name: 'Zoom Out' } ).click();
+ await expect( firstSectionEnd ).not.toBeInViewport();
+ await expect( secondSectionStart ).toBeInViewport();
+ await expect( secondSectionEnd ).toBeInViewport();
+ await expect( thirdSectionStart ).not.toBeInViewport();
+
+ // Test for third section
+ // Playwright scrolls it to the center of the viewport, so this is what we scroll to.
+ await thirdSectionCenter.scrollIntoViewIfNeeded();
+
+ // Because the text is spread with a group height of 100vh, they should both be visible.
+ await expect( secondSectionEnd ).not.toBeInViewport();
+ await expect( thirdSectionStart ).toBeInViewport();
+ await expect( thirdSectionEnd ).toBeInViewport();
+ await expect( fourthSectionStart ).not.toBeInViewport();
+
+ // After zooming, if we zoomed out with the correct central point, they should both still be visible when toggling zoom out state
+ // Enter Zoom Out
+ await page.getByRole( 'button', { name: 'Zoom Out' } ).click();
+ await expect( secondSectionEnd ).toBeInViewport();
+ await expect( thirdSectionStart ).toBeInViewport();
+ await expect( thirdSectionEnd ).toBeInViewport();
+ await expect( fourthSectionStart ).toBeInViewport();
+
+ // Exit Zoom Out
+ await page.getByRole( 'button', { name: 'Zoom Out' } ).click();
+ await expect( secondSectionEnd ).not.toBeInViewport();
+ await expect( thirdSectionStart ).toBeInViewport();
+ await expect( thirdSectionEnd ).toBeInViewport();
+ await expect( fourthSectionStart ).not.toBeInViewport();
+ } );
} );
From 98b3ec03395836887ba3327cf9a16b279296b6c4 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Tue, 26 Nov 2024 03:07:57 +0900
Subject: [PATCH 019/384] BorderBoxControl: Suppress redundant warnings for
deprecated 36px size (#67213)
* BorderControl: Add support for warning suppression
* BorderBoxControl: Suppress redundant warnings for deprecated 36px size
* Add changelog
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/CHANGELOG.md | 1 +
.../border-box-control-split-controls/component.tsx | 1 +
.../border-box-control/border-box-control/component.tsx | 1 +
.../components/src/border-control/border-control/hook.ts | 2 ++
packages/components/src/border-control/types.ts | 7 +++++++
5 files changed, 12 insertions(+)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 29e746c905f8d4..ad7896f99f570e 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -38,6 +38,7 @@
- `SlotFill`: fix dependencies of `Fill` registration effects ([#67071](https://github.com/WordPress/gutenberg/pull/67071)).
- `SlotFill`: rewrite the `Slot` component from class component to functional ([#67153](https://github.com/WordPress/gutenberg/pull/67153)).
- `Menu.ItemHelpText`: Fix text wrapping to prevent unintended word breaks ([#67011](https://github.com/WordPress/gutenberg/pull/67011)).
+- `BorderBoxControl`: Suppress redundant warnings for deprecated 36px size ([#67213](https://github.com/WordPress/gutenberg/pull/67213)).
## 28.12.0 (2024-11-16)
diff --git a/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx b/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx
index 8f125cdb8f9261..0c887ab5f701c3 100644
--- a/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx
+++ b/packages/components/src/border-box-control/border-box-control-split-controls/component.tsx
@@ -67,6 +67,7 @@ const BorderBoxControlSplitControls = (
isCompact: true,
__experimentalIsRenderedInSidebar,
size,
+ __shouldNotWarnDeprecated36pxSize: true,
};
const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );
diff --git a/packages/components/src/border-box-control/border-box-control/component.tsx b/packages/components/src/border-box-control/border-box-control/component.tsx
index d2d77adc69eb89..0e84c7b56ee483 100644
--- a/packages/components/src/border-box-control/border-box-control/component.tsx
+++ b/packages/components/src/border-box-control/border-box-control/component.tsx
@@ -118,6 +118,7 @@ const UnconnectedBorderBoxControl = (
__experimentalIsRenderedInSidebar={
__experimentalIsRenderedInSidebar
}
+ __shouldNotWarnDeprecated36pxSize
size={ size }
/>
) : (
diff --git a/packages/components/src/border-control/border-control/hook.ts b/packages/components/src/border-control/border-control/hook.ts
index 67af7ce42416c3..9b0f064c51921f 100644
--- a/packages/components/src/border-control/border-control/hook.ts
+++ b/packages/components/src/border-control/border-control/hook.ts
@@ -38,6 +38,7 @@ export function useBorderControl(
width,
__experimentalIsRenderedInSidebar = false,
__next40pxDefaultSize,
+ __shouldNotWarnDeprecated36pxSize,
...otherProps
} = useContextSystem( props, 'BorderControl' );
@@ -45,6 +46,7 @@ export function useBorderControl(
componentName: 'BorderControl',
__next40pxDefaultSize,
size,
+ __shouldNotWarnDeprecated36pxSize,
} );
const computedSize =
diff --git a/packages/components/src/border-control/types.ts b/packages/components/src/border-control/types.ts
index 8ab614907684d2..ecd3f67c9be08d 100644
--- a/packages/components/src/border-control/types.ts
+++ b/packages/components/src/border-control/types.ts
@@ -116,6 +116,13 @@ export type BorderControlProps = ColorProps &
* @default false
*/
__next40pxDefaultSize?: boolean;
+ /**
+ * Do not throw a warning for the deprecated 36px default size.
+ * For internal components of other components that already throw the warning.
+ *
+ * @ignore
+ */
+ __shouldNotWarnDeprecated36pxSize?: boolean;
};
export type DropdownProps = ColorProps &
From 338161387c660ac3b16eba9aa973a066d8db0aa4 Mon Sep 17 00:00:00 2001
From: Vipul Gupta <55375170+vipul0425@users.noreply.github.com>
Date: Tue, 26 Nov 2024 03:08:03 +0530
Subject: [PATCH 020/384] Feat: Adds the deprecation warning for 36px default
size in range control. (#66721)
* feat: Adds the deprecation warning for range control.
* docs: Adds deprecation changelog.
* feat: Suppress the redundant warnings.
* refactor: Supress redundant warnings.
---------
Co-authored-by: vipul0425
Co-authored-by: mirka <0mirka00@git.wordpress.org>
---
packages/components/CHANGELOG.md | 1 +
.../src/border-control/border-control/component.tsx | 1 +
.../components/src/box-control/all-input-control.tsx | 1 +
.../src/box-control/axial-input-controls.tsx | 1 +
.../components/src/box-control/input-controls.tsx | 1 +
packages/components/src/font-size-picker/index.tsx | 1 +
packages/components/src/range-control/README.md | 7 ++++---
packages/components/src/range-control/index.tsx | 11 +++++++++++
.../src/range-control/stories/index.story.tsx | 7 +++++++
packages/components/src/range-control/test/index.tsx | 8 +++++++-
packages/components/src/range-control/types.ts | 7 +++++++
11 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index ad7896f99f570e..9f547859fa5a99 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -9,6 +9,7 @@
- `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)).
- `ComboboxControl`: Deprecate 36px default size ([#66900](https://github.com/WordPress/gutenberg/pull/66900)).
- `ToggleGroupControl`: Deprecate 36px default size ([#66747](https://github.com/WordPress/gutenberg/pull/66747)).
+- `RangeControl`: Deprecate 36px default size ([#66721](https://github.com/WordPress/gutenberg/pull/66721)).
### Bug Fixes
diff --git a/packages/components/src/border-control/border-control/component.tsx b/packages/components/src/border-control/border-control/component.tsx
index 31eeb166a2d60f..2ba338c2bb30cb 100644
--- a/packages/components/src/border-control/border-control/component.tsx
+++ b/packages/components/src/border-control/border-control/component.tsx
@@ -122,6 +122,7 @@ const UnconnectedBorderControl = (
value={ widthValue || undefined }
withInputField={ false }
__next40pxDefaultSize={ __next40pxDefaultSize }
+ __shouldNotWarnDeprecated36pxSize
/>
) }
diff --git a/packages/components/src/box-control/all-input-control.tsx b/packages/components/src/box-control/all-input-control.tsx
index e9166ff7f692e8..057cf3c15d8c38 100644
--- a/packages/components/src/box-control/all-input-control.tsx
+++ b/packages/components/src/box-control/all-input-control.tsx
@@ -91,6 +91,7 @@ export default function AllInputControl( {
{
const [ columns, setColumns ] = useState( 2 );
- return(
+ return (
setColumns( value ) }
@@ -153,7 +154,6 @@ Disables the `input`, preventing new values from being applied.
- Required: No
- Platform: Web
-
### `help`: `string|Element`
If this property is added, a help text will be generated using help property as the content.
@@ -165,7 +165,7 @@ If this property is added, a help text will be generated using help property as
Provides control over whether the label will only be visible to screen readers.
-- Required: No
+- Required: No
### `icon`: `string`
@@ -334,6 +334,7 @@ The minimum amount by which `value` changes. It is also a factor in validation a
- Required: No
- Platform: Web
+
### `trackColor`: `CSSProperties[ 'color' ]`
CSS color string to customize the track element's background.
diff --git a/packages/components/src/range-control/index.tsx b/packages/components/src/range-control/index.tsx
index c9fbdc0055c855..916571c3ee0e05 100644
--- a/packages/components/src/range-control/index.tsx
+++ b/packages/components/src/range-control/index.tsx
@@ -38,6 +38,7 @@ import {
import type { RangeControlProps } from './types';
import type { WordPressComponentProps } from '../context';
import { space } from '../utils/space';
+import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';
const noop = () => {};
@@ -96,6 +97,7 @@ function UnforwardedRangeControl(
trackColor,
value: valueProp,
withInputField = true,
+ __shouldNotWarnDeprecated36pxSize,
...otherProps
} = props;
@@ -229,6 +231,14 @@ function UnforwardedRangeControl(
[ isRTL() ? 'right' : 'left' ]: fillValueOffset,
};
+ // Add default size deprecation warning.
+ maybeWarnDeprecated36pxSize( {
+ componentName: 'RangeControl',
+ __next40pxDefaultSize,
+ size: undefined,
+ __shouldNotWarnDeprecated36pxSize,
+ } );
+
return (
= ( { onChange, ...args } ) => {
export const Default: StoryFn< typeof RangeControl > = Template.bind( {} );
Default.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
help: 'Please select how transparent you would like this.',
initialPosition: 50,
label: 'Opacity',
@@ -107,6 +108,7 @@ export const WithAnyStep: StoryFn< typeof RangeControl > = ( {
};
WithAnyStep.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
label: 'Brightness',
step: 'any',
};
@@ -171,6 +173,7 @@ export const WithIntegerStepAndMarks: StoryFn< typeof RangeControl > =
WithIntegerStepAndMarks.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
label: 'Integer Step',
marks: marksBase,
max: 10,
@@ -188,6 +191,7 @@ export const WithDecimalStepAndMarks: StoryFn< typeof RangeControl > =
WithDecimalStepAndMarks.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
marks: [
...marksBase,
{ value: 3.5, label: '3.5' },
@@ -208,6 +212,7 @@ export const WithNegativeMinimumAndMarks: StoryFn< typeof RangeControl > =
WithNegativeMinimumAndMarks.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
marks: marksWithNegatives,
max: 10,
min: -10,
@@ -224,6 +229,7 @@ export const WithNegativeRangeAndMarks: StoryFn< typeof RangeControl > =
WithNegativeRangeAndMarks.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
marks: marksWithNegatives,
max: -1,
min: -10,
@@ -240,6 +246,7 @@ export const WithAnyStepAndMarks: StoryFn< typeof RangeControl > =
WithAnyStepAndMarks.args = {
__nextHasNoMarginBottom: true,
+ __next40pxDefaultSize: true,
marks: marksBase,
max: 10,
min: 0,
diff --git a/packages/components/src/range-control/test/index.tsx b/packages/components/src/range-control/test/index.tsx
index 3ce741867d0dbc..3d2db30eea186f 100644
--- a/packages/components/src/range-control/test/index.tsx
+++ b/packages/components/src/range-control/test/index.tsx
@@ -18,7 +18,13 @@ const fireChangeEvent = ( input: HTMLInputElement, value?: number | string ) =>
const RangeControl = (
props: React.ComponentProps< typeof _RangeControl >
) => {
- return <_RangeControl { ...props } __nextHasNoMarginBottom />;
+ return (
+ <_RangeControl
+ { ...props }
+ __nextHasNoMarginBottom
+ __next40pxDefaultSize
+ />
+ );
};
describe( 'RangeControl', () => {
diff --git a/packages/components/src/range-control/types.ts b/packages/components/src/range-control/types.ts
index a427ab4f942af6..e4792296f83144 100644
--- a/packages/components/src/range-control/types.ts
+++ b/packages/components/src/range-control/types.ts
@@ -233,6 +233,13 @@ export type RangeControlProps = Pick<
* @default true
*/
withInputField?: boolean;
+ /**
+ * Do not throw a warning for the deprecated 36px default size.
+ * For internal components of other components that already throw the warning.
+ *
+ * @ignore
+ */
+ __shouldNotWarnDeprecated36pxSize?: boolean;
};
export type RailProps = MarksProps & {
From 08d8b8661a602ce42742b9f7e71ca42c389ee169 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Tue, 26 Nov 2024 07:10:45 +0900
Subject: [PATCH 021/384] ComboboxControl: Update reset button size (#67215)
* ComboboxControl: Update reset button size
* Add changelog
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/CHANGELOG.md | 1 +
.../components/src/combobox-control/index.tsx | 24 +++++++++----------
.../src/combobox-control/style.scss | 6 -----
3 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 9f547859fa5a99..81e325c8d9b3ff 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -27,6 +27,7 @@
### Enhancements
- `ColorPicker`: Update sizes of color format select and copy button ([#67093](https://github.com/WordPress/gutenberg/pull/67093)).
+- `ComboboxControl`: Update reset button size ([#67215](https://github.com/WordPress/gutenberg/pull/67215)).
- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).
### Experimental
diff --git a/packages/components/src/combobox-control/index.tsx b/packages/components/src/combobox-control/index.tsx
index 86fa4f4467318c..28510c8653d02e 100644
--- a/packages/components/src/combobox-control/index.tsx
+++ b/packages/components/src/combobox-control/index.tsx
@@ -26,7 +26,7 @@ import TokenInput from '../form-token-field/token-input';
import SuggestionsList from '../form-token-field/suggestions-list';
import BaseControl from '../base-control';
import Button from '../button';
-import { FlexBlock, FlexItem } from '../flex';
+import { FlexBlock } from '../flex';
import withFocusOutside from '../higher-order/with-focus-outside';
import { useControlledValue } from '../utils/hooks';
import { normalizeTextString } from '../utils/strings';
@@ -363,18 +363,16 @@ function ComboboxControl( props: ComboboxControlProps ) {
/>
{ allowReset && (
-
-
-
+
) }
{ isExpanded && (
diff --git a/packages/components/src/combobox-control/style.scss b/packages/components/src/combobox-control/style.scss
index 8bd4c2fb156a9f..c8fd8a168c0fb7 100644
--- a/packages/components/src/combobox-control/style.scss
+++ b/packages/components/src/combobox-control/style.scss
@@ -38,9 +38,3 @@ input.components-combobox-control__input[type="text"] {
}
}
-.components-combobox-control__reset.components-button {
- display: flex;
- height: $grid-unit-20;
- min-width: $grid-unit-20;
- padding: 0;
-}
From 9b0e2d96679ab6c82033946bead9521529e6b29a Mon Sep 17 00:00:00 2001
From: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Date: Tue, 26 Nov 2024 12:50:39 +0900
Subject: [PATCH 022/384] Block Manager: Make it a private component in the
block editor package (#67255)
* Block Manager: Make it a private component in the block editor package
* Move style import statement
Co-authored-by: t-hamano
Co-authored-by: ramonjd
Co-authored-by: youknowriad
---
packages/base-styles/_z-index.scss | 4 +--
.../src/components/block-manager/category.js | 6 ++--
.../src/components/block-manager/checklist.js | 10 +++++--
.../src/components/block-manager/index.js | 10 +++----
.../src/components/block-manager/style.scss | 28 +++++++++----------
packages/block-editor/src/private-apis.js | 2 ++
packages/block-editor/src/style.scss | 1 +
.../preferences-modal/block-visibility.js | 4 ++-
packages/editor/src/style.scss | 1 -
9 files changed, 37 insertions(+), 29 deletions(-)
rename packages/{editor => block-editor}/src/components/block-manager/category.js (91%)
rename packages/{editor => block-editor}/src/components/block-manager/checklist.js (75%)
rename packages/{editor => block-editor}/src/components/block-manager/index.js (92%)
rename packages/{editor => block-editor}/src/components/block-manager/style.scss (65%)
diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss
index e4d6ce4ce1b1c9..167af583ed9ddb 100644
--- a/packages/base-styles/_z-index.scss
+++ b/packages/base-styles/_z-index.scss
@@ -165,9 +165,9 @@ $z-layers: (
".components-resizable-box__corner-handle": 2,
// Make sure block manager sticky category titles appear above the options
- ".editor-block-manager__category-title": 1,
+ ".block-editor-block-manager__category-title": 1,
// And block manager sticky disabled block count is higher still
- ".editor-block-manager__disabled-blocks-count": 2,
+ ".block-editor-block-manager__disabled-blocks-count": 2,
// Needs to appear below other color circular picker related UI elements.
".components-circular-option-picker__option-wrapper::before": -1,
diff --git a/packages/editor/src/components/block-manager/category.js b/packages/block-editor/src/components/block-manager/category.js
similarity index 91%
rename from packages/editor/src/components/block-manager/category.js
rename to packages/block-editor/src/components/block-manager/category.js
index 341584fee03b96..79d5896b4502e4 100644
--- a/packages/editor/src/components/block-manager/category.js
+++ b/packages/block-editor/src/components/block-manager/category.js
@@ -71,7 +71,7 @@ function BlockManagerCategory( {
)
);
- const titleId = 'editor-block-manager__category-title-' + instanceId;
+ const titleId = 'block-editor-block-manager__category-title-' + instanceId;
const isAllChecked = checkedBlockNames.length === blockTypes.length;
const isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;
@@ -80,13 +80,13 @@ function BlockManagerCategory( {
{ title } }
/>
diff --git a/packages/editor/src/components/block-manager/checklist.js b/packages/block-editor/src/components/block-manager/checklist.js
similarity index 75%
rename from packages/editor/src/components/block-manager/checklist.js
rename to packages/block-editor/src/components/block-manager/checklist.js
index 2839e2c9e14c14..d5456a14355efb 100644
--- a/packages/editor/src/components/block-manager/checklist.js
+++ b/packages/block-editor/src/components/block-manager/checklist.js
@@ -1,16 +1,20 @@
/**
* WordPress dependencies
*/
-import { BlockIcon } from '@wordpress/block-editor';
import { CheckboxControl } from '@wordpress/components';
+/**
+ * Internal dependencies
+ */
+import BlockIcon from '../block-icon';
+
function BlockTypesChecklist( { blockTypes, value, onItemChange } ) {
return (
-
+
{ blockTypes.map( ( blockType ) => (
+
{ !! numberOfHiddenBlocks && (
-
+
{ sprintf(
/* translators: %d: number of blocks. */
_n(
@@ -88,16 +88,16 @@ export default function BlockManager( {
placeholder={ __( 'Search for a block' ) }
value={ search }
onChange={ ( nextSearch ) => setSearch( nextSearch ) }
- className="editor-block-manager__search"
+ className="block-editor-block-manager__search"
/>
{ filteredBlockTypes.length === 0 && (
-
+
{ __( 'No blocks found.' ) }
) }
diff --git a/packages/editor/src/components/block-manager/style.scss b/packages/block-editor/src/components/block-manager/style.scss
similarity index 65%
rename from packages/editor/src/components/block-manager/style.scss
rename to packages/block-editor/src/components/block-manager/style.scss
index 411ee9faf34f75..d72c682dcbb5d5 100644
--- a/packages/editor/src/components/block-manager/style.scss
+++ b/packages/block-editor/src/components/block-manager/style.scss
@@ -1,14 +1,14 @@
-.editor-block-manager__no-results {
+.block-editor-block-manager__no-results {
font-style: italic;
padding: $grid-unit-30 0;
text-align: center;
}
-.editor-block-manager__search {
+.block-editor-block-manager__search {
margin: $grid-unit-20 0;
}
-.editor-block-manager__disabled-blocks-count {
+.block-editor-block-manager__disabled-blocks-count {
border: $border-width solid $gray-300;
border-width: $border-width 0;
// Cover up horizontal areas off the sides of the box rectangle
@@ -19,10 +19,10 @@
position: sticky;
// When sticking, tuck the top border beneath the modal header border
top: ($grid-unit-05 + 1) * -1;
- z-index: z-index(".editor-block-manager__disabled-blocks-count");
+ z-index: z-index(".block-editor-block-manager__disabled-blocks-count");
// Stick the category titles to the bottom
- ~ .editor-block-manager__results .editor-block-manager__category-title {
+ ~ .block-editor-block-manager__results .block-editor-block-manager__category-title {
top: $grid-unit-40 - 1;
}
.is-link {
@@ -30,32 +30,32 @@
}
}
-.editor-block-manager__category {
+.block-editor-block-manager__category {
margin: 0 0 $grid-unit-30 0;
}
-.editor-block-manager__category-title {
+.block-editor-block-manager__category-title {
position: sticky;
top: - $grid-unit-05; // Offsets the top padding on the modal content container
padding: $grid-unit-20 0;
background-color: $white;
- z-index: z-index(".editor-block-manager__category-title");
+ z-index: z-index(".block-editor-block-manager__category-title");
.components-checkbox-control__label {
font-weight: 600;
}
}
-.editor-block-manager__checklist {
+.block-editor-block-manager__checklist {
margin-top: 0;
}
-.editor-block-manager__category-title,
-.editor-block-manager__checklist-item {
+.block-editor-block-manager__category-title,
+.block-editor-block-manager__checklist-item {
border-bottom: 1px solid $gray-300;
}
-.editor-block-manager__checklist-item {
+.block-editor-block-manager__checklist-item {
display: flex;
justify-content: space-between;
align-items: center;
@@ -72,11 +72,11 @@
}
}
-.editor-block-manager__results {
+.block-editor-block-manager__results {
border-top: $border-width solid $gray-300;
}
// Remove the top border from results when adjacent to the disabled block count
-.editor-block-manager__disabled-blocks-count + .editor-block-manager__results {
+.block-editor-block-manager__disabled-blocks-count + .block-editor-block-manager__results {
border-top-width: 0;
}
diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js
index 5067317e3f2465..0faee244e387c2 100644
--- a/packages/block-editor/src/private-apis.js
+++ b/packages/block-editor/src/private-apis.js
@@ -18,6 +18,7 @@ import { useHasBlockToolbar } from './components/block-toolbar/use-has-block-too
import { cleanEmptyObject } from './hooks/utils';
import BlockQuickNavigation from './components/block-quick-navigation';
import { LayoutStyle } from './components/block-list/layout';
+import BlockManager from './components/block-manager';
import { BlockRemovalWarningModal } from './components/block-removal-warning-modal';
import {
setBackgroundStyleDefaults,
@@ -71,6 +72,7 @@ lock( privateApis, {
cleanEmptyObject,
BlockQuickNavigation,
LayoutStyle,
+ BlockManager,
BlockRemovalWarningModal,
useLayoutClasses,
useLayoutStyles,
diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss
index 512169351fe1fb..213498c797aee4 100644
--- a/packages/block-editor/src/style.scss
+++ b/packages/block-editor/src/style.scss
@@ -10,6 +10,7 @@
@import "./components/block-card/style.scss";
@import "./components/block-compare/style.scss";
@import "./components/block-draggable/style.scss";
+@import "./components/block-manager/style.scss";
@import "./components/block-mover/style.scss";
@import "./components/block-navigation/style.scss";
@import "./components/block-patterns-list/style.scss";
diff --git a/packages/editor/src/components/preferences-modal/block-visibility.js b/packages/editor/src/components/preferences-modal/block-visibility.js
index 49d6888c5dbfe2..8726b114d97480 100644
--- a/packages/editor/src/components/preferences-modal/block-visibility.js
+++ b/packages/editor/src/components/preferences-modal/block-visibility.js
@@ -5,13 +5,15 @@ import { useSelect, useDispatch } from '@wordpress/data';
import { store as preferencesStore } from '@wordpress/preferences';
import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
import { useMemo } from '@wordpress/element';
+import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';
-import BlockManager from '../block-manager';
+
+const { BlockManager } = unlock( blockEditorPrivateApis );
export default function BlockVisibility() {
const { showBlockTypes, hideBlockTypes } = unlock(
diff --git a/packages/editor/src/style.scss b/packages/editor/src/style.scss
index b62ccd2c8ac71d..88d722867d009b 100644
--- a/packages/editor/src/style.scss
+++ b/packages/editor/src/style.scss
@@ -1,7 +1,6 @@
@import "../../interface/src/style.scss";
@import "./components/autocompleters/style.scss";
-@import "./components/block-manager/style.scss";
@import "./components/collab-sidebar/style.scss";
@import "./components/collapsible-block-toolbar/style.scss";
@import "./components/create-template-part-modal/style.scss";
From e34948762abf749844eb349c1312753057f57fb9 Mon Sep 17 00:00:00 2001
From: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Date: Tue, 26 Nov 2024 16:32:42 +0900
Subject: [PATCH 023/384] Dashicons: Remove non-existent icons from type
(#67235)
* Dashicons: Remove non-existent icons from type
* Update changelog
Co-authored-by: t-hamano
Co-authored-by: mirka <0mirka00@git.wordpress.org>
---
packages/components/CHANGELOG.md | 1 +
packages/components/src/dashicon/types.ts | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 81e325c8d9b3ff..23e791645a20c8 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -23,6 +23,7 @@
- `FormFileUpload`: Prevent HEIC and HEIF files from being uploaded on Safari ([#67139](https://github.com/WordPress/gutenberg/pull/67139)).
- `Composite.Hover`: Restore functionality ([#67212](https://github.com/WordPress/gutenberg/pull/67212)).
- `Composite.Typeahead`: Restore functionality ([#67212](https://github.com/WordPress/gutenberg/pull/67212)).
+- `Dashicons`: Remove non-existent icons from type ([#67235](https://github.com/WordPress/gutenberg/pull/67235)).
### Enhancements
diff --git a/packages/components/src/dashicon/types.ts b/packages/components/src/dashicon/types.ts
index eeee9c2d40a19d..a4a4f5156aff5f 100644
--- a/packages/components/src/dashicon/types.ts
+++ b/packages/components/src/dashicon/types.ts
@@ -219,7 +219,6 @@ export type IconKey =
| 'insert-before'
| 'insert'
| 'instagram'
- | 'keyboard-hide'
| 'laptop'
| 'layout'
| 'leftright'
@@ -266,7 +265,6 @@ export type IconKey =
| 'playlist-audio'
| 'playlist-video'
| 'plus-alt'
- | 'plus-light'
| 'plus'
| 'portfolio'
| 'post-status'
From 99c6478b0c8582d334d2d26e6303db61828da092 Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Tue, 26 Nov 2024 12:22:00 +0400
Subject: [PATCH 024/384] Edit Post: Remove unused 'hasHistory' flag (#67293)
Co-authored-by: Mamaduka
Co-authored-by: talldan
---
packages/edit-post/src/components/browser-url/index.js | 5 ++---
packages/edit-post/src/components/layout/index.js | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/packages/edit-post/src/components/browser-url/index.js b/packages/edit-post/src/components/browser-url/index.js
index 12292cb8447217..00492afbdc2624 100644
--- a/packages/edit-post/src/components/browser-url/index.js
+++ b/packages/edit-post/src/components/browser-url/index.js
@@ -27,14 +27,13 @@ export class BrowserURL extends Component {
}
componentDidUpdate( prevProps ) {
- const { postId, postStatus, hasHistory } = this.props;
+ const { postId, postStatus } = this.props;
const { historyId } = this.state;
if (
( postId !== prevProps.postId || postId !== historyId ) &&
postStatus !== 'auto-draft' &&
- postId &&
- ! hasHistory
+ postId
) {
this.setBrowserURL( postId );
}
diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js
index aec14eab989f03..5dcbfa2c82cea1 100644
--- a/packages/edit-post/src/components/layout/index.js
+++ b/packages/edit-post/src/components/layout/index.js
@@ -392,7 +392,6 @@ function Layout( {
showIconLabels,
isDistractionFree,
showMetaBoxes,
- hasHistory,
isWelcomeGuideVisible,
templateId,
enablePaddingAppender,
@@ -595,7 +594,7 @@ function Layout( {
-
+
From 3f6b883c04397264229588c7f4d8c040cbd5e8e5 Mon Sep 17 00:00:00 2001
From: Andrea Fercia
Date: Tue, 26 Nov 2024 09:25:10 +0100
Subject: [PATCH 025/384] Improve accessibility and consistency of the 'Last
modified' Revisions button. (#66606)
* Improve accessibility and consistency of the Revisions button.
* Simplify revisions button and add count.
* Remove no longer used stylesheet import.
* Simplify revisions count retrieval by using useGlobalStylesRevisions.
* Adjust after 67180.
* Remove duplicate import after rebase.
Co-authored-by: afercia
Co-authored-by: ramonjd
Co-authored-by: t-hamano
Co-authored-by: up1512001
---
.../index.js | 47 +++++--------------
.../style.scss | 4 --
.../index.js | 40 ----------------
...r-navigation-screen-details-panel-label.js | 14 ------
...bar-navigation-screen-details-panel-row.js | 31 ------------
...r-navigation-screen-details-panel-value.js | 14 ------
.../style.scss | 26 ----------
.../index.js | 3 +-
.../sidebar-navigation-screen/style.scss | 9 +++-
packages/edit-site/src/style.scss | 1 -
10 files changed, 20 insertions(+), 169 deletions(-)
delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-details-panel/index.js
delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js
delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js
delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js
delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-details-panel/style.scss
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
index 51833443d8d85c..f7e5f8bbec34de 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
@@ -1,24 +1,14 @@
/**
* WordPress dependencies
*/
-import { __, sprintf } from '@wordpress/i18n';
-import { humanTimeDiff } from '@wordpress/date';
-import { createInterpolateElement } from '@wordpress/element';
+import { _n, sprintf } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';
-import {
- Icon,
- __experimentalItemGroup as ItemGroup,
-} from '@wordpress/components';
+import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
import { backup } from '@wordpress/icons';
/**
* Internal dependencies
*/
-import {
- SidebarNavigationScreenDetailsPanelRow,
- SidebarNavigationScreenDetailsPanelLabel,
- SidebarNavigationScreenDetailsPanelValue,
-} from '../sidebar-navigation-screen-details-panel';
import SidebarNavigationItem from '../sidebar-navigation-item';
export default function SidebarNavigationScreenDetailsFooter( {
@@ -56,33 +46,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
hrefProps.as = 'a';
}
return (
-
+
-
-
- { __( 'Last modified' ) }
-
-
- { createInterpolateElement(
- sprintf(
- /* translators: %s: is the relative time when the post was last modified. */
- __( '%s ' ),
- humanTimeDiff( record.modified )
- ),
- {
- time: ,
- }
- ) }
-
-
-
+ { sprintf(
+ /* translators: %d: Number of Styles revisions. */
+ _n( '%d Revision', '%d Revisions', revisionsCount ),
+ revisionsCount
+ ) }
);
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/style.scss
index 866a36c02174d3..0b48d451129662 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/style.scss
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-details-footer/style.scss
@@ -5,8 +5,4 @@
div.edit-site-sidebar-navigation-item.components-item[aria-current] {
background: none;
}
- .edit-site-sidebar-navigation-screen-details-footer__icon {
- margin-left: auto;
- fill: $gray-600;
- }
}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/index.js
deleted file mode 100644
index 7d7a3932c99473..00000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/index.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * WordPress dependencies
- */
-import {
- __experimentalVStack as VStack,
- __experimentalHeading as Heading,
-} from '@wordpress/components';
-
-/**
- * Internal dependencies
- */
-import SidebarNavigationScreenDetailsPanelLabel from './sidebar-navigation-screen-details-panel-label';
-import SidebarNavigationScreenDetailsPanelRow from './sidebar-navigation-screen-details-panel-row';
-import SidebarNavigationScreenDetailsPanelValue from './sidebar-navigation-screen-details-panel-value';
-
-function SidebarNavigationScreenDetailsPanel( { title, children, spacing } ) {
- return (
-
- { title && (
-
- { title }
-
- ) }
- { children }
-
- );
-}
-
-export {
- SidebarNavigationScreenDetailsPanel,
- SidebarNavigationScreenDetailsPanelRow,
- SidebarNavigationScreenDetailsPanelLabel,
- SidebarNavigationScreenDetailsPanelValue,
-};
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js b/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js
deleted file mode 100644
index 157eecd557519c..00000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __experimentalText as Text } from '@wordpress/components';
-
-export default function SidebarNavigationScreenDetailsPanelLabel( {
- children,
-} ) {
- return (
-
- { children }
-
- );
-}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js b/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js
deleted file mode 100644
index 1c7f9abafdf503..00000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * External dependencies
- */
-import clsx from 'clsx';
-
-/**
- * WordPress dependencies
- */
-import { __experimentalHStack as HStack } from '@wordpress/components';
-
-export default function SidebarNavigationScreenDetailsPanelRow( {
- label,
- children,
- className,
- ...extraProps
-} ) {
- return (
-
- { children }
-
- );
-}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js b/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js
deleted file mode 100644
index 80e8ba8cf1d538..00000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __experimentalText as Text } from '@wordpress/components';
-
-export default function SidebarNavigationScreenDetailsPanelValue( {
- children,
-} ) {
- return (
-
- { children }
-
- );
-}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/style.scss
deleted file mode 100644
index 2757ce5a620c58..00000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-details-panel/style.scss
+++ /dev/null
@@ -1,26 +0,0 @@
-.edit-site-sidebar-navigation-details-screen-panel {
- margin: $grid-unit-30 0;
-
- &:last-of-type {
- margin-bottom: 0;
- }
-
- .edit-site-sidebar-navigation-details-screen-panel__heading {
- color: $gray-400;
- text-transform: uppercase;
- font-weight: 500;
- font-size: 11px;
- padding: 0;
- margin-bottom: 0;
- }
-}
-
-.edit-site-sidebar-navigation-details-screen-panel__label.edit-site-sidebar-navigation-details-screen-panel__label {
- color: $gray-600;
- width: 100px;
- flex-shrink: 0;
-}
-
-.edit-site-sidebar-navigation-details-screen-panel__value.edit-site-sidebar-navigation-details-screen-panel__value {
- color: $gray-200;
-}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
index 772b15aec2a294..72671714479ac0 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
@@ -86,9 +86,8 @@ export default function SidebarNavigationScreenGlobalStyles() {
}, [ openGlobalStyles, setEditorCanvasContainerView ] );
// If there are no revisions, do not render a footer.
- const modifiedDateTime = revisions?.[ 0 ]?.modified;
const shouldShowGlobalStylesFooter =
- revisionsCount > 0 && ! isLoadingRevisions && modifiedDateTime;
+ !! revisionsCount && ! isLoadingRevisions;
return (
<>
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
index 1d57472f7e9f94..959115e0fac8ca 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
+++ b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
@@ -18,7 +18,7 @@
.edit-site-sidebar-navigation-screen__content {
padding: 0 $grid-unit-20;
- .components-item-group {
+ .edit-site-sidebar-navigation-screen-details-footer {
margin-left: -$grid-unit-20;
margin-right: -$grid-unit-20;
}
@@ -127,9 +127,14 @@
bottom: 0;
background-color: $gray-900;
gap: 0;
- padding: $grid-unit-20 0;
+ padding: $grid-unit-10 $grid-unit-20;
margin: $grid-unit-20 0 0;
border-top: 1px solid $gray-800;
+
+ .components-item-group {
+ margin-left: -$grid-unit-20;
+ margin-right: -$grid-unit-20;
+ }
}
/* In general style overrides are discouraged.
diff --git a/packages/edit-site/src/style.scss b/packages/edit-site/src/style.scss
index 63ad8244a7c95e..dce945a48ee700 100644
--- a/packages/edit-site/src/style.scss
+++ b/packages/edit-site/src/style.scss
@@ -20,7 +20,6 @@
@import "./components/sidebar-navigation-screen/style.scss";
@import "./components/sidebar-navigation-screen-details-footer/style.scss";
@import "./components/sidebar-navigation-screen-navigation-menu/style.scss";
-@import "components/sidebar-navigation-screen-details-panel/style.scss";
@import "./components/sidebar-navigation-screen-patterns/style.scss";
@import "./components/sidebar-dataviews/style.scss";
@import "./components/site-hub/style.scss";
From 726d86a201f0ee19d99a62fd9f4558aa6aa72431 Mon Sep 17 00:00:00 2001
From: Benni <109149472+benniledl@users.noreply.github.com>
Date: Tue, 26 Nov 2024 09:37:22 +0100
Subject: [PATCH 026/384] Add WordPress 6.7.1 version to "Versions in
WordPress" documentation (#67298)
Co-authored-by: benniledl
Co-authored-by: fabiankaegy
---
docs/contributors/versions-in-wordpress.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/contributors/versions-in-wordpress.md b/docs/contributors/versions-in-wordpress.md
index 4ba7b34da15552..c2be7e3fa4e884 100644
--- a/docs/contributors/versions-in-wordpress.md
+++ b/docs/contributors/versions-in-wordpress.md
@@ -6,6 +6,7 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre
| Gutenberg Versions | WordPress Version |
| ------------------ | ----------------- |
+| 18.6-19.3 | 6.7.1 |
| 18.6-19.3 | 6.7 |
| 17.8-18.5 | 6.6.2 |
| 17.8-18.5 | 6.6.1 |
From f7a4f3f054e99e204b76393293fc4775b9596313 Mon Sep 17 00:00:00 2001
From: Luigi Teschio
Date: Tue, 26 Nov 2024 09:58:08 +0100
Subject: [PATCH 027/384] Move default template types and template part areas
to REST API (#66459)
* move default template types and template part areas to REST API
* fix logic
* fix E2E test
* move default template types and template part areas to REST API
* fix error
* remove not necessary file
* fix naming
* remove duplicate code
* remove duplicated code
* improve logic
* fix naming
* fix unit test
* update doc
* add unit test for getTemplateInfo function
* restore not necessary changes
* fix e2e test
* remove not necessary variable
* replace add_action with add_filter
* improve readibility code
* make getTemplateInfo private
* make templateAreas optional
* add default_template_part_areas and default_template_types
* move code to rest-api.php file
* remove not used import
---
lib/compat/wordpress-6.8/preload.php | 2 +
lib/compat/wordpress-6.8/rest-api.php | 38 +++
.../use-template-part-area-label.js | 20 +-
.../template-part/edit/advanced-controls.js | 26 +-
.../edit/utils/get-template-part-icon.js | 20 ++
.../src/template-part/edit/utils/hooks.js | 9 +-
.../src/template-part/variations.js | 20 +-
packages/core-data/src/entities.js | 2 +
.../src/components/add-new-template/utils.js | 4 +-
.../src/components/editor/use-editor-title.js | 21 +-
.../src/components/page-patterns/header.js | 5 +-
.../components/page-patterns/use-patterns.js | 12 +-
.../use-template-part-areas.js | 8 +-
packages/edit-site/src/index.js | 14 +-
.../create-template-part-modal/index.js | 5 +-
.../src/components/document-bar/index.js | 13 +-
.../entity-record-item.js | 16 +-
.../src/components/post-card-panel/index.js | 23 +-
packages/editor/src/private-apis.js | 3 +-
.../editor/src/store/private-selectors.js | 16 +-
packages/editor/src/store/selectors.js | 142 +++++-----
packages/editor/src/store/test/selectors.js | 255 ------------------
.../editor/src/utils/get-template-info.js | 52 ++++
.../src/utils/test/get-template-info.js | 224 +++++++++++++++
24 files changed, 535 insertions(+), 415 deletions(-)
create mode 100644 packages/block-library/src/template-part/edit/utils/get-template-part-icon.js
create mode 100644 packages/editor/src/utils/get-template-info.js
create mode 100644 packages/editor/src/utils/test/get-template-info.js
diff --git a/lib/compat/wordpress-6.8/preload.php b/lib/compat/wordpress-6.8/preload.php
index aabe0d4fb574cc..ae6c738c6627c5 100644
--- a/lib/compat/wordpress-6.8/preload.php
+++ b/lib/compat/wordpress-6.8/preload.php
@@ -32,6 +32,8 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
'site_logo',
'timezone_string',
'url',
+ 'default_template_part_areas',
+ 'default_template_types',
)
);
$paths[] = '/wp/v2/templates/lookup?slug=front-page';
diff --git a/lib/compat/wordpress-6.8/rest-api.php b/lib/compat/wordpress-6.8/rest-api.php
index 080e4003f57b38..b94e42d5f2ccd0 100644
--- a/lib/compat/wordpress-6.8/rest-api.php
+++ b/lib/compat/wordpress-6.8/rest-api.php
@@ -49,3 +49,41 @@ function ( $taxonomy ) {
remove_filter( "rest_{$taxonomy}_query", 'gutenberg_respect_taxonomy_default_args_in_rest_api' );
}
);
+
+/**
+ * Adds the default template part areas to the REST API index.
+ *
+ * This function exposes the default template part areas through the WordPress REST API.
+ * Note: This function backports into the wp-includes/rest-api/class-wp-rest-server.php file.
+ *
+ * @param WP_REST_Response $response REST API response.
+ * @return WP_REST_Response Modified REST API response with default template part areas.
+ */
+function gutenberg_add_default_template_part_areas_to_index( WP_REST_Response $response ) {
+ $response->data['default_template_part_areas'] = get_allowed_block_template_part_areas();
+ return $response;
+}
+
+add_filter( 'rest_index', 'gutenberg_add_default_template_part_areas_to_index' );
+
+/**
+ * Adds the default template types to the REST API index.
+ *
+ * This function exposes the default template types through the WordPress REST API.
+ * Note: This function backports into the wp-includes/rest-api/class-wp-rest-server.php file.
+ *
+ * @param WP_REST_Response $response REST API response.
+ * @return WP_REST_Response Modified REST API response with default template part areas.
+ */
+function gutenberg_add_default_template_types_to_index( WP_REST_Response $response ) {
+ $indexed_template_types = array();
+ foreach ( get_default_block_template_types() as $slug => $template_type ) {
+ $template_type['slug'] = (string) $slug;
+ $indexed_template_types[] = $template_type;
+ }
+
+ $response->data['default_template_types'] = $indexed_template_types;
+ return $response;
+}
+
+add_filter( 'rest_index', 'gutenberg_add_default_template_types_to_index' );
diff --git a/packages/block-library/src/navigation/use-template-part-area-label.js b/packages/block-library/src/navigation/use-template-part-area-label.js
index 48763a38ac62d1..7b4d514975e113 100644
--- a/packages/block-library/src/navigation/use-template-part-area-label.js
+++ b/packages/block-library/src/navigation/use-template-part-area-label.js
@@ -11,6 +11,7 @@ import { useSelect } from '@wordpress/data';
// TODO: this util should perhaps be refactored somewhere like core-data.
import { createTemplatePartId } from '../template-part/edit/utils/create-template-part-id';
+import { getTemplatePartIcon } from '../template-part/edit/utils/get-template-part-icon';
export default function useTemplatePartAreaLabel( clientId ) {
return useSelect(
@@ -35,16 +36,15 @@ export default function useTemplatePartAreaLabel( clientId ) {
return;
}
- // FIXME: @wordpress/block-library should not depend on @wordpress/editor.
- // Blocks can be loaded into a *non-post* block editor.
- // This code is lifted from this file:
- // packages/block-library/src/template-part/edit/advanced-controls.js
- /* eslint-disable @wordpress/data-no-store-string-literals */
- const definedAreas =
- select(
- 'core/editor'
- ).__experimentalGetDefaultTemplatePartAreas();
- /* eslint-enable @wordpress/data-no-store-string-literals */
+ const defaultTemplatePartAreas =
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [];
+
+ const definedAreas = defaultTemplatePartAreas.map( ( item ) => ( {
+ ...item,
+ icon: getTemplatePartIcon( item.icon ),
+ } ) );
+
const { getCurrentTheme, getEditedEntityRecord } =
select( coreStore );
diff --git a/packages/block-library/src/template-part/edit/advanced-controls.js b/packages/block-library/src/template-part/edit/advanced-controls.js
index 3c319a7ec0fe73..04c6d3387346ac 100644
--- a/packages/block-library/src/template-part/edit/advanced-controls.js
+++ b/packages/block-library/src/template-part/edit/advanced-controls.js
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
-import { useEntityProp } from '@wordpress/core-data';
+import { useEntityProp, store as coreStore } from '@wordpress/core-data';
import { SelectControl, TextControl } from '@wordpress/components';
import { sprintf, __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
@@ -54,19 +54,19 @@ export function TemplatePartAdvancedControls( {
templatePartId
);
- const definedAreas = useSelect( ( select ) => {
- // FIXME: @wordpress/block-library should not depend on @wordpress/editor.
- // Blocks can be loaded into a *non-post* block editor.
- /* eslint-disable-next-line @wordpress/data-no-store-string-literals */
- return select(
- 'core/editor'
- ).__experimentalGetDefaultTemplatePartAreas();
- }, [] );
+ const defaultTemplatePartAreas = useSelect(
+ ( select ) =>
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [],
+ []
+ );
- const areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {
- label,
- value: _area,
- } ) );
+ const areaOptions = defaultTemplatePartAreas.map(
+ ( { label, area: _area } ) => ( {
+ label,
+ value: _area,
+ } )
+ );
return (
<>
diff --git a/packages/block-library/src/template-part/edit/utils/get-template-part-icon.js b/packages/block-library/src/template-part/edit/utils/get-template-part-icon.js
new file mode 100644
index 00000000000000..bb13a8840c9458
--- /dev/null
+++ b/packages/block-library/src/template-part/edit/utils/get-template-part-icon.js
@@ -0,0 +1,20 @@
+/**
+ * WordPress dependencies
+ */
+import {
+ header as headerIcon,
+ footer as footerIcon,
+ sidebar as sidebarIcon,
+ symbolFilled as symbolFilledIcon,
+} from '@wordpress/icons';
+
+export const getTemplatePartIcon = ( iconName ) => {
+ if ( 'header' === iconName ) {
+ return headerIcon;
+ } else if ( 'footer' === iconName ) {
+ return footerIcon;
+ } else if ( 'sidebar' === iconName ) {
+ return sidebarIcon;
+ }
+ return symbolFilledIcon;
+};
diff --git a/packages/block-library/src/template-part/edit/utils/hooks.js b/packages/block-library/src/template-part/edit/utils/hooks.js
index 39daa4080c8160..c71327db0290c4 100644
--- a/packages/block-library/src/template-part/edit/utils/hooks.js
+++ b/packages/block-library/src/template-part/edit/utils/hooks.js
@@ -136,14 +136,9 @@ export function useCreateTemplatePartFromBlocks( area, setAttributes ) {
export function useTemplatePartArea( area ) {
return useSelect(
( select ) => {
- // FIXME: @wordpress/block-library should not depend on @wordpress/editor.
- // Blocks can be loaded into a *non-post* block editor.
- /* eslint-disable @wordpress/data-no-store-string-literals */
const definedAreas =
- select(
- 'core/editor'
- ).__experimentalGetDefaultTemplatePartAreas();
- /* eslint-enable @wordpress/data-no-store-string-literals */
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [];
const selectedArea = definedAreas.find(
( definedArea ) => definedArea.area === area
diff --git a/packages/block-library/src/template-part/variations.js b/packages/block-library/src/template-part/variations.js
index acd8af13508ba9..6f62057bec33dd 100644
--- a/packages/block-library/src/template-part/variations.js
+++ b/packages/block-library/src/template-part/variations.js
@@ -3,23 +3,11 @@
*/
import { store as coreDataStore } from '@wordpress/core-data';
import { select } from '@wordpress/data';
-import {
- header as headerIcon,
- footer as footerIcon,
- sidebar as sidebarIcon,
- symbolFilled as symbolFilledIcon,
-} from '@wordpress/icons';
-function getTemplatePartIcon( iconName ) {
- if ( 'header' === iconName ) {
- return headerIcon;
- } else if ( 'footer' === iconName ) {
- return footerIcon;
- } else if ( 'sidebar' === iconName ) {
- return sidebarIcon;
- }
- return symbolFilledIcon;
-}
+/**
+ * Internal dependencies
+ */
+import { getTemplatePartIcon } from './edit/utils/get-template-part-icon';
export function enhanceTemplatePartVariations( settings, name ) {
if ( name !== 'core/template-part' ) {
diff --git a/packages/core-data/src/entities.js b/packages/core-data/src/entities.js
index 3c10676750a2ab..2730cdf3d64bf4 100644
--- a/packages/core-data/src/entities.js
+++ b/packages/core-data/src/entities.js
@@ -31,6 +31,8 @@ export const rootEntitiesConfig = [
'site_icon_url',
'site_logo',
'timezone_string',
+ 'default_template_part_areas',
+ 'default_template_types',
'url',
].join( ',' ),
},
diff --git a/packages/edit-site/src/components/add-new-template/utils.js b/packages/edit-site/src/components/add-new-template/utils.js
index e3e2faf9457926..759f3f478cadaf 100644
--- a/packages/edit-site/src/components/add-new-template/utils.js
+++ b/packages/edit-site/src/components/add-new-template/utils.js
@@ -3,7 +3,6 @@
*/
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
-import { store as editorStore } from '@wordpress/editor';
import { decodeEntities } from '@wordpress/html-entities';
import { useMemo, useCallback } from '@wordpress/element';
import { __, _x, sprintf } from '@wordpress/i18n';
@@ -69,7 +68,8 @@ export const useExistingTemplates = () => {
export const useDefaultTemplateTypes = () => {
return useSelect(
( select ) =>
- select( editorStore ).__experimentalGetDefaultTemplateTypes(),
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_types || [],
[]
);
};
diff --git a/packages/edit-site/src/components/editor/use-editor-title.js b/packages/edit-site/src/components/editor/use-editor-title.js
index 2ad4e94ccc3e80..727b190117e02a 100644
--- a/packages/edit-site/src/components/editor/use-editor-title.js
+++ b/packages/edit-site/src/components/editor/use-editor-title.js
@@ -4,33 +4,46 @@
import { _x, sprintf } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
-import { store as editorStore } from '@wordpress/editor';
import { decodeEntities } from '@wordpress/html-entities';
+import { privateApis as editorPrivateApis } from '@wordpress/editor';
/**
* Internal dependencies
*/
import useTitle from '../routes/use-title';
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
+import { unlock } from '../../lock-unlock';
+
+const { getTemplateInfo } = unlock( editorPrivateApis );
function useEditorTitle( postType, postId ) {
const { title, isLoaded } = useSelect(
( select ) => {
const { getEditedEntityRecord, hasFinishedResolution } =
select( coreStore );
- const { __experimentalGetTemplateInfo: getTemplateInfo } =
- select( editorStore );
+
const _record = getEditedEntityRecord(
'postType',
postType,
postId
);
+
+ const { default_template_types: templateTypes = [] } =
+ select( coreStore ).getEntityRecord(
+ 'root',
+ '__unstableBase'
+ ) ?? {};
+
+ const templateInfo = getTemplateInfo( {
+ template: _record,
+ templateTypes,
+ } );
+
const _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [
'postType',
postType,
postId,
] );
- const templateInfo = getTemplateInfo( _record );
return {
title: templateInfo.title,
diff --git a/packages/edit-site/src/components/page-patterns/header.js b/packages/edit-site/src/components/page-patterns/header.js
index 641dc577cb7fe0..0d3763aec62c1a 100644
--- a/packages/edit-site/src/components/page-patterns/header.js
+++ b/packages/edit-site/src/components/page-patterns/header.js
@@ -9,7 +9,7 @@ import {
__experimentalText as Text,
__experimentalVStack as VStack,
} from '@wordpress/components';
-import { store as editorStore } from '@wordpress/editor';
+import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
import { moreVertical } from '@wordpress/icons';
@@ -32,7 +32,8 @@ export default function PatternsHeader( {
const { patternCategories } = usePatternCategories();
const templatePartAreas = useSelect(
( select ) =>
- select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [],
[]
);
diff --git a/packages/edit-site/src/components/page-patterns/use-patterns.js b/packages/edit-site/src/components/page-patterns/use-patterns.js
index e226298857c4da..3b3e33d5650e63 100644
--- a/packages/edit-site/src/components/page-patterns/use-patterns.js
+++ b/packages/edit-site/src/components/page-patterns/use-patterns.js
@@ -4,7 +4,6 @@
import { parse } from '@wordpress/blocks';
import { useSelect, createSelector } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
-import { store as editorStore } from '@wordpress/editor';
import { useMemo } from '@wordpress/element';
/**
@@ -28,8 +27,7 @@ const selectTemplateParts = createSelector(
( select, categoryId, search = '' ) => {
const { getEntityRecords, isResolving: isResolvingSelector } =
select( coreStore );
- const { __experimentalGetDefaultTemplatePartAreas } =
- select( editorStore );
+
const query = { per_page: -1 };
const templateParts =
getEntityRecords( 'postType', TEMPLATE_PART_POST_TYPE, query ) ??
@@ -38,7 +36,10 @@ const selectTemplateParts = createSelector(
// In the case where a custom template part area has been removed we need
// the current list of areas to cross check against so orphaned template
// parts can be treated as uncategorized.
- const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
+ const knownAreas =
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [];
+
const templatePartAreas = knownAreas.map( ( area ) => area.area );
const templatePartHasCategory = ( item, category ) => {
@@ -78,7 +79,8 @@ const selectTemplateParts = createSelector(
TEMPLATE_PART_POST_TYPE,
{ per_page: -1 },
] ),
- select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas,
]
);
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
index 77cbf87b3d439e..6a67a8f8a30fb9 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
@@ -1,9 +1,8 @@
/**
* WordPress dependencies
*/
-import { useEntityRecords } from '@wordpress/core-data';
+import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
-import { store as editorStore } from '@wordpress/editor';
/**
* Internal dependencies
@@ -18,7 +17,8 @@ const useTemplatePartsGroupedByArea = ( items ) => {
const templatePartAreas = useSelect(
( select ) =>
- select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [],
[]
);
@@ -43,7 +43,7 @@ const useTemplatePartsGroupedByArea = ( items ) => {
const key = accumulator[ item.area ]
? item.area
: TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
- accumulator[ key ].templateParts.push( item );
+ accumulator[ key ]?.templateParts?.push( item );
return accumulator;
}, knownAreas );
diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js
index 7f124e6b5f7ac6..b96ce5cb67f5e1 100644
--- a/packages/edit-site/src/index.js
+++ b/packages/edit-site/src/index.js
@@ -10,10 +10,7 @@ import {
import { dispatch } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { createRoot, StrictMode } from '@wordpress/element';
-import {
- store as editorStore,
- privateApis as editorPrivateApis,
-} from '@wordpress/editor';
+import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { store as preferencesStore } from '@wordpress/preferences';
import {
registerLegacyWidgetBlock,
@@ -88,15 +85,6 @@ export function initializeEditor( id, settings ) {
dispatch( editSiteStore ).updateSettings( settings );
- // Keep the defaultTemplateTypes in the core/editor settings too,
- // so that they can be selected with core/editor selectors in any editor.
- // This is needed because edit-site doesn't initialize with EditorProvider,
- // which internally uses updateEditorSettings as well.
- dispatch( editorStore ).updateEditorSettings( {
- defaultTemplateTypes: settings.defaultTemplateTypes,
- defaultTemplatePartAreas: settings.defaultTemplatePartAreas,
- } );
-
// Prevent the default browser action for files dropped outside of dropzones.
window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );
diff --git a/packages/editor/src/components/create-template-part-modal/index.js b/packages/editor/src/components/create-template-part-modal/index.js
index 5d594cd646cc10..660439ded2300f 100644
--- a/packages/editor/src/components/create-template-part-modal/index.js
+++ b/packages/editor/src/components/create-template-part-modal/index.js
@@ -27,7 +27,6 @@ import { serialize } from '@wordpress/blocks';
/**
* Internal dependencies
*/
-import { store as editorStore } from '../../store';
import {
TEMPLATE_PART_POST_TYPE,
TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
@@ -81,9 +80,11 @@ export function CreateTemplatePartModalContents( {
const templatePartAreas = useSelect(
( select ) =>
- select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [],
[]
);
+
async function createTemplatePart() {
if ( ! title || isSubmitting ) {
return;
diff --git a/packages/editor/src/components/document-bar/index.js b/packages/editor/src/components/document-bar/index.js
index 9fffba941a4355..7b94a6fbeb3be9 100644
--- a/packages/editor/src/components/document-bar/index.js
+++ b/packages/editor/src/components/document-bar/index.js
@@ -29,6 +29,7 @@ import { decodeEntities } from '@wordpress/html-entities';
import { TEMPLATE_POST_TYPES } from '../../store/constants';
import { store as editorStore } from '../../store';
import usePageTypeBadge from '../../utils/pageTypeBadge';
+import { getTemplateInfo } from '../../utils/get-template-info';
/** @typedef {import("@wordpress/components").IconType} IconType */
@@ -65,9 +66,9 @@ export default function DocumentBar( props ) {
getCurrentPostType,
getCurrentPostId,
getEditorSettings,
- __experimentalGetTemplateInfo: getTemplateInfo,
getRenderingMode,
} = select( editorStore );
+
const {
getEditedEntityRecord,
getPostType,
@@ -80,7 +81,15 @@ export default function DocumentBar( props ) {
_postType,
_postId
);
- const _templateInfo = getTemplateInfo( _document );
+
+ const { default_template_types: templateTypes = [] } =
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' ) ??
+ {};
+
+ const _templateInfo = getTemplateInfo( {
+ templateTypes,
+ template: _document,
+ } );
const _postTypeLabel = getPostType( _postType )?.labels?.singular_name;
return {
diff --git a/packages/editor/src/components/entities-saved-states/entity-record-item.js b/packages/editor/src/components/entities-saved-states/entity-record-item.js
index ca9fb2e0b169c3..e8219c4cca7ae1 100644
--- a/packages/editor/src/components/entities-saved-states/entity-record-item.js
+++ b/packages/editor/src/components/entities-saved-states/entity-record-item.js
@@ -12,6 +12,7 @@ import { decodeEntities } from '@wordpress/html-entities';
*/
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';
+import { getTemplateInfo } from '../../utils/get-template-info';
export default function EntityRecordItem( { record, checked, onChange } ) {
const { name, kind, title, key } = record;
@@ -33,11 +34,18 @@ export default function EntityRecordItem( { record, checked, onChange } ) {
name,
key
);
+
+ const { default_template_types: templateTypes = [] } =
+ select( coreStore ).getEntityRecord(
+ 'root',
+ '__unstableBase'
+ ) ?? {};
+
return {
- entityRecordTitle:
- select( editorStore ).__experimentalGetTemplateInfo(
- template
- ).title,
+ entityRecordTitle: getTemplateInfo( {
+ template,
+ templateTypes,
+ } ).title,
hasPostMetaChanges: unlock(
select( editorStore )
).hasPostMetaChanges( name, key ),
diff --git a/packages/editor/src/components/post-card-panel/index.js b/packages/editor/src/components/post-card-panel/index.js
index 410b8cfd4447d9..8fcca6c6bd6d40 100644
--- a/packages/editor/src/components/post-card-panel/index.js
+++ b/packages/editor/src/components/post-card-panel/index.js
@@ -22,6 +22,7 @@ import {
import { unlock } from '../../lock-unlock';
import PostActions from '../post-actions';
import usePageTypeBadge from '../../utils/pageTypeBadge';
+import { getTemplateInfo } from '../../utils/get-template-info';
export default function PostCardPanel( {
postType,
@@ -30,17 +31,29 @@ export default function PostCardPanel( {
} ) {
const { title, icon } = useSelect(
( select ) => {
- const { __experimentalGetTemplateInfo } = select( editorStore );
const { getEditedEntityRecord } = select( coreStore );
const _record = getEditedEntityRecord(
'postType',
postType,
postId
);
- const _templateInfo =
- [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(
- postType
- ) && __experimentalGetTemplateInfo( _record );
+
+ const { default_template_types: templateTypes = [] } =
+ select( coreStore ).getEntityRecord(
+ 'root',
+ '__unstableBase'
+ ) ?? {};
+
+ const _templateInfo = [
+ TEMPLATE_POST_TYPE,
+ TEMPLATE_PART_POST_TYPE,
+ ].includes( postType )
+ ? getTemplateInfo( {
+ template: _record,
+ templateTypes,
+ } )
+ : {};
+
return {
title: _templateInfo?.title || _record?.title,
icon: unlock( select( editorStore ) ).getPostIcon( postType, {
diff --git a/packages/editor/src/private-apis.js b/packages/editor/src/private-apis.js
index b49b2a69a3bf2b..2699858b3164f6 100644
--- a/packages/editor/src/private-apis.js
+++ b/packages/editor/src/private-apis.js
@@ -25,6 +25,7 @@ import {
GlobalStylesProvider,
} from './components/global-styles-provider';
import { registerCoreBlockBindingsSources } from './bindings/api';
+import { getTemplateInfo } from './utils/get-template-info';
const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
@@ -46,7 +47,7 @@ lock( privateApis, {
ViewMoreMenuGroup,
ResizableEditor,
registerCoreBlockBindingsSources,
-
+ getTemplateInfo,
// This is a temporary private API while we're updating the site editor to use EditorProvider.
interfaceStore,
...remainingInterfaceApis,
diff --git a/packages/editor/src/store/private-selectors.js b/packages/editor/src/store/private-selectors.js
index 9af0512c19dbdd..56fa6728371489 100644
--- a/packages/editor/src/store/private-selectors.js
+++ b/packages/editor/src/store/private-selectors.js
@@ -20,11 +20,7 @@ import { store as coreStore } from '@wordpress/core-data';
/**
* Internal dependencies
*/
-import {
- getRenderingMode,
- getCurrentPost,
- __experimentalGetDefaultTemplatePartAreas,
-} from './selectors';
+import { getRenderingMode, getCurrentPost } from './selectors';
import {
getEntityActions as _getEntityActions,
getEntityFields as _getEntityFields,
@@ -102,9 +98,13 @@ export const getPostIcon = createRegistrySelector(
postType === 'wp_template'
) {
return (
- __experimentalGetDefaultTemplatePartAreas( state ).find(
- ( item ) => options.area === item.area
- )?.icon || layout
+ (
+ select( coreStore ).getEntityRecord(
+ 'root',
+ '__unstableBase'
+ )?.default_template_part_areas || []
+ ).find( ( item ) => options.area === item.area )?.icon ||
+ layout
);
}
if ( CARD_ICONS[ postType ] ) {
diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js
index db452be5c17abb..c17e80f771ea36 100644
--- a/packages/editor/src/store/selectors.js
+++ b/packages/editor/src/store/selectors.js
@@ -12,7 +12,6 @@ import { addQueryArgs, cleanForSlug } from '@wordpress/url';
import { createSelector, createRegistrySelector } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { Platform } from '@wordpress/element';
-import { layout } from '@wordpress/icons';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { store as coreStore } from '@wordpress/core-data';
import { store as preferencesStore } from '@wordpress/preferences';
@@ -29,6 +28,7 @@ import {
import { getPostRawValue } from './reducer';
import { getTemplatePartIcon } from '../utils/get-template-part-icon';
import { unlock } from '../lock-unlock';
+import { getTemplateInfo } from '../utils/get-template-info';
/**
* Shared reference to an empty object for cases where it is important to avoid
@@ -1702,16 +1702,20 @@ export const getBlockListSettings = getBlockEditorSelector(
'getBlockListSettings'
);
-/**
- * Returns the default template types.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} The template types.
- */
-export function __experimentalGetDefaultTemplateTypes( state ) {
- return getEditorSettings( state )?.defaultTemplateTypes;
-}
+export const __experimentalGetDefaultTemplateTypes = createRegistrySelector(
+ ( select ) => () => {
+ deprecated(
+ "select('core/editor').__experimentalGetDefaultTemplateTypes",
+ {
+ since: '6.7',
+ alternative:
+ "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_types",
+ }
+ );
+ return select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_types;
+ }
+);
/**
* Returns the default template part areas.
@@ -1720,15 +1724,26 @@ export function __experimentalGetDefaultTemplateTypes( state ) {
*
* @return {Array} The template part areas.
*/
-export const __experimentalGetDefaultTemplatePartAreas = createSelector(
- ( state ) => {
- const areas =
- getEditorSettings( state )?.defaultTemplatePartAreas ?? [];
- return areas.map( ( item ) => {
- return { ...item, icon: getTemplatePartIcon( item.icon ) };
- } );
- },
- ( state ) => [ getEditorSettings( state )?.defaultTemplatePartAreas ]
+export const __experimentalGetDefaultTemplatePartAreas = createRegistrySelector(
+ ( select ) =>
+ createSelector( () => {
+ deprecated(
+ "select('core/editor').__experimentalGetDefaultTemplatePartAreas",
+ {
+ since: '6.7',
+ alternative:
+ "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_part_areas",
+ }
+ );
+
+ const areas =
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [];
+
+ return areas.map( ( item ) => {
+ return { ...item, icon: getTemplatePartIcon( item.icon ) };
+ } );
+ } )
);
/**
@@ -1739,20 +1754,30 @@ export const __experimentalGetDefaultTemplatePartAreas = createSelector(
*
* @return {Object} The template type.
*/
-export const __experimentalGetDefaultTemplateType = createSelector(
- ( state, slug ) => {
- const templateTypes = __experimentalGetDefaultTemplateTypes( state );
- if ( ! templateTypes ) {
- return EMPTY_OBJECT;
- }
+export const __experimentalGetDefaultTemplateType = createRegistrySelector(
+ ( select ) =>
+ createSelector( ( state, slug ) => {
+ deprecated(
+ "select('core/editor').__experimentalGetDefaultTemplateType",
+ {
+ since: '6.7',
+ }
+ );
+ const templateTypes = select( coreStore ).getEntityRecord(
+ 'root',
+ '__unstableBase'
+ )?.default_template_types;
+
+ if ( ! templateTypes ) {
+ return EMPTY_OBJECT;
+ }
- return (
- Object.values( templateTypes ).find(
- ( type ) => type.slug === slug
- ) ?? EMPTY_OBJECT
- );
- },
- ( state ) => [ __experimentalGetDefaultTemplateTypes( state ) ]
+ return (
+ Object.values( templateTypes ).find(
+ ( type ) => type.slug === slug
+ ) ?? EMPTY_OBJECT
+ );
+ } )
);
/**
@@ -1763,38 +1788,31 @@ export const __experimentalGetDefaultTemplateType = createSelector(
* @param {Object} template The template for which we need information.
* @return {Object} Information about the template, including title, description, and icon.
*/
-export const __experimentalGetTemplateInfo = createSelector(
- ( state, template ) => {
- if ( ! template ) {
- return EMPTY_OBJECT;
- }
+export const __experimentalGetTemplateInfo = createRegistrySelector(
+ ( select ) =>
+ createSelector( ( state, template ) => {
+ deprecated( "select('core/editor').__experimentalGetTemplateInfo", {
+ since: '6.7',
+ } );
- const { description, slug, title, area } = template;
- const { title: defaultTitle, description: defaultDescription } =
- __experimentalGetDefaultTemplateType( state, slug );
+ if ( ! template ) {
+ return EMPTY_OBJECT;
+ }
- const templateTitle =
- typeof title === 'string' ? title : title?.rendered;
- const templateDescription =
- typeof description === 'string' ? description : description?.raw;
- const templateIcon =
- __experimentalGetDefaultTemplatePartAreas( state ).find(
- ( item ) => area === item.area
- )?.icon || layout;
+ const templateTypes =
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_types || [];
- return {
- title:
- templateTitle && templateTitle !== slug
- ? templateTitle
- : defaultTitle || slug,
- description: templateDescription || defaultDescription,
- icon: templateIcon,
- };
- },
- ( state ) => [
- __experimentalGetDefaultTemplateTypes( state ),
- __experimentalGetDefaultTemplatePartAreas( state ),
- ]
+ const templateAreas =
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
+ ?.default_template_part_areas || [];
+
+ return getTemplateInfo( {
+ template,
+ templateAreas,
+ templateTypes,
+ } );
+ } )
);
/**
diff --git a/packages/editor/src/store/test/selectors.js b/packages/editor/src/store/test/selectors.js
index 1de25604ebd7e3..2a36fabcd2ec97 100644
--- a/packages/editor/src/store/test/selectors.js
+++ b/packages/editor/src/store/test/selectors.js
@@ -16,7 +16,6 @@ import {
getBlockTypes,
} from '@wordpress/blocks';
import { RawHTML } from '@wordpress/element';
-import { layout, footer, header } from '@wordpress/icons';
/**
* Internal dependencies
@@ -188,43 +187,11 @@ const {
isPostAutosavingLocked,
canUserUseUnfilteredHTML,
getPostTypeLabel,
- __experimentalGetDefaultTemplateType,
- __experimentalGetDefaultTemplateTypes,
- __experimentalGetTemplateInfo,
- __experimentalGetDefaultTemplatePartAreas,
isEditorPanelRemoved,
isInserterOpened,
isListViewOpened,
} = selectors;
-const defaultTemplateTypes = [
- {
- title: 'Default (Index)',
- description: 'Main template',
- slug: 'index',
- },
- {
- title: '404 (Not Found)',
- description: 'Applied when content cannot be found',
- slug: '404',
- },
-];
-
-const defaultTemplatePartAreas = [
- {
- area: 'header',
- label: 'Header',
- description: 'Some description of a header',
- icon: 'header',
- },
- {
- area: 'footer',
- label: 'Footer',
- description: 'Some description of a footer',
- icon: 'footer',
- },
-];
-
describe( 'selectors', () => {
let cachedSelectors;
@@ -2766,228 +2733,6 @@ describe( 'selectors', () => {
} );
} );
- describe( '__experimentalGetDefaultTemplateTypes', () => {
- const state = { editorSettings: { defaultTemplateTypes } };
-
- it( 'returns undefined if there are no default template types', () => {
- const emptyState = { editorSettings: {} };
- expect(
- __experimentalGetDefaultTemplateTypes( emptyState )
- ).toBeUndefined();
- } );
-
- it( 'returns a list of default template types if present in state', () => {
- expect(
- __experimentalGetDefaultTemplateTypes( state )
- ).toHaveLength( 2 );
- } );
- } );
-
- describe( '__experimentalGetDefaultTemplatePartAreas', () => {
- const state = { editorSettings: { defaultTemplatePartAreas } };
-
- it( 'returns empty array if there are no default template part areas', () => {
- const emptyState = { editorSettings: {} };
- expect(
- __experimentalGetDefaultTemplatePartAreas( emptyState )
- ).toHaveLength( 0 );
- } );
-
- it( 'returns a list of default template part areas if present in state', () => {
- expect(
- __experimentalGetDefaultTemplatePartAreas( state )
- ).toHaveLength( 2 );
- } );
-
- it( 'assigns an icon to each area', () => {
- const templatePartAreas =
- __experimentalGetDefaultTemplatePartAreas( state );
- templatePartAreas.forEach( ( area ) =>
- expect( area.icon ).not.toBeNull()
- );
- } );
- } );
-
- describe( '__experimentalGetDefaultTemplateType', () => {
- const state = { editorSettings: { defaultTemplateTypes } };
-
- it( 'returns an empty object if there are no default template types', () => {
- const emptyState = { editorSettings: {} };
- expect(
- __experimentalGetDefaultTemplateType( emptyState, 'slug' )
- ).toEqual( {} );
- } );
-
- it( 'returns an empty object if the requested slug is not found', () => {
- expect(
- __experimentalGetDefaultTemplateType( state, 'foobar' )
- ).toEqual( {} );
- } );
-
- it( 'returns the requested default template type', () => {
- expect(
- __experimentalGetDefaultTemplateType( state, 'index' )
- ).toEqual( {
- title: 'Default (Index)',
- description: 'Main template',
- slug: 'index',
- } );
- } );
-
- it( 'returns the requested default template type even when the slug is numeric', () => {
- expect(
- __experimentalGetDefaultTemplateType( state, '404' )
- ).toEqual( {
- title: '404 (Not Found)',
- description: 'Applied when content cannot be found',
- slug: '404',
- } );
- } );
- } );
-
- describe( '__experimentalGetTemplateInfo', () => {
- const state = {
- editorSettings: { defaultTemplateTypes, defaultTemplatePartAreas },
- };
-
- it( 'should return an empty object if no template is passed', () => {
- expect( __experimentalGetTemplateInfo( state, null ) ).toEqual(
- {}
- );
- expect( __experimentalGetTemplateInfo( state, undefined ) ).toEqual(
- {}
- );
- expect( __experimentalGetTemplateInfo( state, false ) ).toEqual(
- {}
- );
- } );
-
- it( 'should return the default title if none is defined on the template', () => {
- expect(
- __experimentalGetTemplateInfo( state, { slug: 'index' } ).title
- ).toEqual( 'Default (Index)' );
- } );
-
- it( 'should return the rendered title if defined on the template', () => {
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'index',
- title: { rendered: 'test title' },
- } ).title
- ).toEqual( 'test title' );
- } );
-
- it( 'should return the slug if no title is found', () => {
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'not a real template',
- } ).title
- ).toEqual( 'not a real template' );
- } );
-
- it( 'should return the default description if none is defined on the template', () => {
- expect(
- __experimentalGetTemplateInfo( state, { slug: 'index' } )
- .description
- ).toEqual( 'Main template' );
- } );
-
- it( 'should return the raw excerpt as description if defined on the template', () => {
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'index',
- description: { raw: 'test description' },
- } ).description
- ).toEqual( 'test description' );
- } );
-
- it( 'should return a title, description, and icon', () => {
- expect(
- __experimentalGetTemplateInfo( state, { slug: 'index' } )
- ).toEqual( {
- title: 'Default (Index)',
- description: 'Main template',
- icon: layout,
- } );
-
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'index',
- title: { rendered: 'test title' },
- } )
- ).toEqual( {
- title: 'test title',
- description: 'Main template',
- icon: layout,
- } );
-
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'index',
- description: { raw: 'test description' },
- } )
- ).toEqual( {
- title: 'Default (Index)',
- description: 'test description',
- icon: layout,
- } );
-
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'index',
- title: { rendered: 'test title' },
- description: { raw: 'test description' },
- } )
- ).toEqual( {
- title: 'test title',
- description: 'test description',
- icon: layout,
- } );
- } );
-
- it( 'should return correct icon based on area', () => {
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'template part, area = uncategorized',
- area: 'uncategorized',
- } )
- ).toEqual( {
- title: 'template part, area = uncategorized',
- icon: layout,
- } );
-
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'template part, area = invalid',
- area: 'invalid',
- } )
- ).toEqual( {
- title: 'template part, area = invalid',
- icon: layout,
- } );
-
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'template part, area = header',
- area: 'header',
- } )
- ).toEqual( {
- title: 'template part, area = header',
- icon: header,
- } );
-
- expect(
- __experimentalGetTemplateInfo( state, {
- slug: 'template part, area = footer',
- area: 'footer',
- } )
- ).toEqual( {
- title: 'template part, area = footer',
- icon: footer,
- } );
- } );
- } );
-
describe( 'getPostTypeLabel', () => {
it( 'should return the correct label for the current post type', () => {
const postTypes = [
diff --git a/packages/editor/src/utils/get-template-info.js b/packages/editor/src/utils/get-template-info.js
new file mode 100644
index 00000000000000..bc84c06c9399d4
--- /dev/null
+++ b/packages/editor/src/utils/get-template-info.js
@@ -0,0 +1,52 @@
+/**
+ * WordPress dependencies
+ */
+import { layout } from '@wordpress/icons';
+/**
+ * Internal dependencies
+ */
+import { getTemplatePartIcon } from './get-template-part-icon';
+const EMPTY_OBJECT = {};
+
+/**
+ * Helper function to retrieve the corresponding template info for a given template.
+ * @param {Object} params
+ * @param {Array} params.templateTypes
+ * @param {Array} [params.templateAreas]
+ * @param {Object} params.template
+ */
+export const getTemplateInfo = ( params ) => {
+ if ( ! params ) {
+ return EMPTY_OBJECT;
+ }
+
+ const { templateTypes, templateAreas, template } = params;
+
+ const { description, slug, title, area } = template;
+
+ const { title: defaultTitle, description: defaultDescription } =
+ Object.values( templateTypes ).find( ( type ) => type.slug === slug ) ??
+ EMPTY_OBJECT;
+
+ const templateTitle = typeof title === 'string' ? title : title?.rendered;
+ const templateDescription =
+ typeof description === 'string' ? description : description?.raw;
+
+ const templateAreasWithIcon = templateAreas?.map( ( item ) => ( {
+ ...item,
+ icon: getTemplatePartIcon( item.icon ),
+ } ) );
+
+ const templateIcon =
+ templateAreasWithIcon?.find( ( item ) => area === item.area )?.icon ||
+ layout;
+
+ return {
+ title:
+ templateTitle && templateTitle !== slug
+ ? templateTitle
+ : defaultTitle || slug,
+ description: templateDescription || defaultDescription,
+ icon: templateIcon,
+ };
+};
diff --git a/packages/editor/src/utils/test/get-template-info.js b/packages/editor/src/utils/test/get-template-info.js
new file mode 100644
index 00000000000000..d0ffe15aa902ad
--- /dev/null
+++ b/packages/editor/src/utils/test/get-template-info.js
@@ -0,0 +1,224 @@
+/**
+ * WordPress dependencies
+ */
+import { footer, header, layout } from '@wordpress/icons';
+/**
+ * Internal dependencies
+ */
+import { getTemplateInfo } from '../get-template-info';
+
+describe( '__experimentalGetTemplateInfo', () => {
+ const defaultTemplateTypes = [
+ {
+ title: 'Default (Index)',
+ description: 'Main template',
+ slug: 'index',
+ },
+ {
+ title: '404 (Not Found)',
+ description: 'Applied when content cannot be found',
+ slug: '404',
+ },
+ ];
+
+ const defaultTemplatePartAreas = [
+ {
+ area: 'header',
+ label: 'Header',
+ description: 'Some description of a header',
+ icon: 'header',
+ },
+ {
+ area: 'footer',
+ label: 'Footer',
+ description: 'Some description of a footer',
+ icon: 'footer',
+ },
+ ];
+
+ it( 'should return an empty object if no template is passed', () => {
+ expect( getTemplateInfo( undefined ) ).toEqual( {} );
+ expect( getTemplateInfo( null ) ).toEqual( {} );
+ expect( getTemplateInfo( false ) ).toEqual( {} );
+ } );
+
+ it( 'should return the default title if none is defined on the template', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ },
+ } ).title
+ ).toEqual( 'Default (Index)' );
+ } );
+
+ it( 'should return the rendered title if defined on the template', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ title: { rendered: 'test title' },
+ },
+ } ).title
+ ).toEqual( 'test title' );
+ } );
+
+ it( 'should return the slug if no title is found', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'not a real template',
+ },
+ } ).title
+ ).toEqual( 'not a real template' );
+ } );
+
+ it( 'should return the default description if none is defined on the template', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ },
+ } ).description
+ ).toEqual( 'Main template' );
+ } );
+
+ it( 'should return the raw excerpt as description if defined on the template', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ description: { raw: 'test description' },
+ },
+ } ).description
+ ).toEqual( 'test description' );
+ } );
+
+ it( 'should return a title, description, and icon', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: { slug: 'index' },
+ } )
+ ).toEqual( {
+ title: 'Default (Index)',
+ description: 'Main template',
+ icon: layout,
+ } );
+
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ title: { rendered: 'test title' },
+ },
+ } )
+ ).toEqual( {
+ title: 'test title',
+ description: 'Main template',
+ icon: layout,
+ } );
+
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ description: { raw: 'test description' },
+ },
+ } )
+ ).toEqual( {
+ title: 'Default (Index)',
+ description: 'test description',
+ icon: layout,
+ } );
+
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'index',
+ title: { rendered: 'test title' },
+ description: { raw: 'test description' },
+ },
+ } )
+ ).toEqual( {
+ title: 'test title',
+ description: 'test description',
+ icon: layout,
+ } );
+ } );
+
+ it( 'should return correct icon based on area', () => {
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'template part, area = uncategorized',
+ area: 'uncategorized',
+ },
+ } )
+ ).toEqual( {
+ title: 'template part, area = uncategorized',
+ icon: layout,
+ } );
+
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'template part, area = invalid',
+ area: 'invalid',
+ },
+ } )
+ ).toEqual( {
+ title: 'template part, area = invalid',
+ icon: layout,
+ } );
+
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'template part, area = header',
+ area: 'header',
+ },
+ } )
+ ).toEqual( {
+ title: 'template part, area = header',
+ icon: header,
+ } );
+
+ expect(
+ getTemplateInfo( {
+ templateAreas: defaultTemplatePartAreas,
+ templateTypes: defaultTemplateTypes,
+ template: {
+ slug: 'template part, area = footer',
+ area: 'footer',
+ },
+ } )
+ ).toEqual( {
+ title: 'template part, area = footer',
+ icon: footer,
+ } );
+ } );
+} );
From ddd239ab921f51835938b10aacd33bd933cccd1f Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Tue, 26 Nov 2024 14:02:36 +0400
Subject: [PATCH 028/384] Block Editor: Correctly mark Block Comment SlotFills
private (#67271)
* Block Editor: Correctly mark Block Comment SlotFills private
* Drop '__unstable' prefix
* Simplify private API exports
Co-authored-by: Mamaduka
Co-authored-by: jsnajdr
---
.../block-settings-menu/block-settings-dropdown.js | 4 ++--
.../src/components/block-settings-menu/index.js | 4 ++--
.../src/components/collab/block-comment-icon-slot.js | 8 ++------
.../components/collab/block-comment-icon-toolbar-slot.js | 8 +++-----
packages/block-editor/src/private-apis.js | 8 ++++----
.../components/collab-sidebar/comment-button-toolbar.js | 6 +++---
.../src/components/collab-sidebar/comment-button.js | 6 +++---
7 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js
index 5b5360cc48a8fe..a0bbb6c708fea1 100644
--- a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js
+++ b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js
@@ -19,7 +19,7 @@ import { pipe, useCopyToClipboard } from '@wordpress/compose';
* Internal dependencies
*/
import BlockActions from '../block-actions';
-import __unstableCommentIconFill from '../../components/collab/block-comment-icon-slot';
+import CommentIconSlotFill from '../../components/collab/block-comment-icon-slot';
import BlockHTMLConvertButton from './block-html-convert-button';
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
import BlockSettingsMenuControls from '../block-settings-menu-controls';
@@ -295,7 +295,7 @@ export function BlockSettingsDropdown( {
>
) }
- <__unstableCommentIconFill.Slot
+
diff --git a/packages/block-editor/src/components/block-settings-menu/index.js b/packages/block-editor/src/components/block-settings-menu/index.js
index 50e8abe09d018b..1b96f30e130386 100644
--- a/packages/block-editor/src/components/block-settings-menu/index.js
+++ b/packages/block-editor/src/components/block-settings-menu/index.js
@@ -7,12 +7,12 @@ import { ToolbarGroup, ToolbarItem } from '@wordpress/components';
* Internal dependencies
*/
import BlockSettingsDropdown from './block-settings-dropdown';
-import __unstableCommentIconToolbarFill from '../../components/collab/block-comment-icon-toolbar-slot';
+import CommentIconToolbarSlotFill from '../../components/collab/block-comment-icon-toolbar-slot';
export function BlockSettingsMenu( { clientIds, ...props } ) {
return (
- <__unstableCommentIconToolbarFill.Slot />
+
{ ( toggleProps ) => (
diff --git a/packages/block-editor/src/components/collab/block-comment-icon-slot.js b/packages/block-editor/src/components/collab/block-comment-icon-slot.js
index 600db904b28741..bcf8c5f5ff0c5b 100644
--- a/packages/block-editor/src/components/collab/block-comment-icon-slot.js
+++ b/packages/block-editor/src/components/collab/block-comment-icon-slot.js
@@ -3,10 +3,6 @@
*/
import { createSlotFill } from '@wordpress/components';
-const { Fill: __unstableCommentIconFill, Slot } = createSlotFill(
- '__unstableCommentIconFill'
-);
+const CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );
-__unstableCommentIconFill.Slot = Slot;
-
-export default __unstableCommentIconFill;
+export default CommentIconSlotFill;
diff --git a/packages/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js b/packages/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js
index dd84b284f082ae..056b9a2623262f 100644
--- a/packages/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js
+++ b/packages/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js
@@ -3,10 +3,8 @@
*/
import { createSlotFill } from '@wordpress/components';
-const { Fill: __unstableCommentIconToolbarFill, Slot } = createSlotFill(
- '__unstableCommentIconToolbarFill'
+const CommentIconToolbarSlotFill = createSlotFill(
+ Symbol( 'CommentIconToolbarSlotFill' )
);
-__unstableCommentIconToolbarFill.Slot = Slot;
-
-export default __unstableCommentIconToolbarFill;
+export default CommentIconToolbarSlotFill;
diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js
index 0faee244e387c2..2ca185823f15e1 100644
--- a/packages/block-editor/src/private-apis.js
+++ b/packages/block-editor/src/private-apis.js
@@ -49,8 +49,8 @@ import { PrivatePublishDateTimePicker } from './components/publish-date-time-pic
import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
import useBlockDisplayTitle from './components/block-title/use-block-display-title';
import TabbedSidebar from './components/tabbed-sidebar';
-import __unstableCommentIconFill from './components/collab/block-comment-icon-slot';
-import __unstableCommentIconToolbarFill from './components/collab/block-comment-icon-toolbar-slot';
+import CommentIconSlotFill from './components/collab/block-comment-icon-slot';
+import CommentIconToolbarSlotFill from './components/collab/block-comment-icon-toolbar-slot';
/**
* Private @wordpress/block-editor APIs.
*/
@@ -97,6 +97,6 @@ lock( privateApis, {
__unstableBlockStyleVariationOverridesWithConfig,
setBackgroundStyleDefaults,
sectionRootClientIdKey,
- __unstableCommentIconFill,
- __unstableCommentIconToolbarFill,
+ CommentIconSlotFill,
+ CommentIconToolbarSlotFill,
} );
diff --git a/packages/editor/src/components/collab-sidebar/comment-button-toolbar.js b/packages/editor/src/components/collab-sidebar/comment-button-toolbar.js
index 2e378a7eaabab0..b673ee87fe86ce 100644
--- a/packages/editor/src/components/collab-sidebar/comment-button-toolbar.js
+++ b/packages/editor/src/components/collab-sidebar/comment-button-toolbar.js
@@ -11,18 +11,18 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
*/
import { unlock } from '../../lock-unlock';
-const { __unstableCommentIconToolbarFill } = unlock( blockEditorPrivateApis );
+const { CommentIconToolbarSlotFill } = unlock( blockEditorPrivateApis );
const AddCommentToolbarButton = ( { onClick } ) => {
return (
- <__unstableCommentIconToolbarFill>
+
-
+
);
};
diff --git a/packages/editor/src/components/collab-sidebar/comment-button.js b/packages/editor/src/components/collab-sidebar/comment-button.js
index 3b020661816660..373ee0becd92df 100644
--- a/packages/editor/src/components/collab-sidebar/comment-button.js
+++ b/packages/editor/src/components/collab-sidebar/comment-button.js
@@ -12,11 +12,11 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
*/
import { unlock } from '../../lock-unlock';
-const { __unstableCommentIconFill } = unlock( blockEditorPrivateApis );
+const { CommentIconSlotFill } = unlock( blockEditorPrivateApis );
const AddCommentButton = ( { onClick } ) => {
return (
- <__unstableCommentIconFill>
+
{
>
{ _x( 'Comment', 'Add comment button' ) }
-
+
);
};
From 514b670054cac6b84d44b606af3973649ba3354b Mon Sep 17 00:00:00 2001
From: dhruvang21 <105810308+dhruvang21@users.noreply.github.com>
Date: Tue, 26 Nov 2024 15:58:03 +0530
Subject: [PATCH 029/384] Query Loop block: remove 'add new post' prompt in the
sidebar (#67189)
Co-authored-by: dhruvang21
Co-authored-by: ntsekouras
Co-authored-by: t-hamano
Co-authored-by: aaronrobertshaw
Co-authored-by: annezazu
---
.../components/block-info-slot-fill/index.js | 25 ---------------
.../src/components/block-inspector/index.js | 2 --
packages/block-editor/src/private-apis.js | 2 --
.../create-new-post-link.js | 32 -------------------
.../query/edit/inspector-controls/index.js | 10 ------
packages/block-library/src/query/editor.scss | 4 ---
6 files changed, 75 deletions(-)
delete mode 100644 packages/block-editor/src/components/block-info-slot-fill/index.js
delete mode 100644 packages/block-library/src/query/edit/inspector-controls/create-new-post-link.js
diff --git a/packages/block-editor/src/components/block-info-slot-fill/index.js b/packages/block-editor/src/components/block-info-slot-fill/index.js
deleted file mode 100644
index 3592fc0424329b..00000000000000
--- a/packages/block-editor/src/components/block-info-slot-fill/index.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { createSlotFill } from '@wordpress/components';
-
-/**
- * Internal dependencies
- */
-import {
- useBlockEditContext,
- mayDisplayControlsKey,
-} from '../block-edit/context';
-
-const { Fill, Slot } = createSlotFill( Symbol( 'BlockInformation' ) );
-
-const BlockInfo = ( props ) => {
- const context = useBlockEditContext();
- if ( ! context[ mayDisplayControlsKey ] ) {
- return null;
- }
- return ;
-};
-BlockInfo.Slot = ( props ) => ;
-
-export default BlockInfo;
diff --git a/packages/block-editor/src/components/block-inspector/index.js b/packages/block-editor/src/components/block-inspector/index.js
index 475d4f6a4b8c2e..450a370b5c212a 100644
--- a/packages/block-editor/src/components/block-inspector/index.js
+++ b/packages/block-editor/src/components/block-inspector/index.js
@@ -26,7 +26,6 @@ import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-c
import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
import PositionControls from '../inspector-controls-tabs/position-controls-panel';
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
-import BlockInfo from '../block-info-slot-fill';
import BlockQuickNavigation from '../block-quick-navigation';
import { useBorderPanelLabel } from '../../hooks/border';
@@ -253,7 +252,6 @@ const BlockInspectorSingleBlock = ( {
className={ blockInformation.isSynced && 'is-synced' }
/>
-
{ showTabs && (
{
- const newPostUrl = addQueryArgs( 'post-new.php', {
- post_type: postType,
- } );
-
- const addNewItemLabel = useSelect(
- ( select ) => {
- const { getPostType } = select( coreStore );
- return getPostType( postType )?.labels?.add_new_item;
- },
- [ postType ]
- );
- return (
-
- { createInterpolateElement(
- '
' + addNewItemLabel + ' ',
- // eslint-disable-next-line jsx-a11y/anchor-has-content
- { a:
}
- ) }
-
- );
-};
-
-export default CreateNewPostLink;
diff --git a/packages/block-library/src/query/edit/inspector-controls/index.js b/packages/block-library/src/query/edit/inspector-controls/index.js
index 7d5745e190c9a7..0ae4b052b57873 100644
--- a/packages/block-library/src/query/edit/inspector-controls/index.js
+++ b/packages/block-library/src/query/edit/inspector-controls/index.js
@@ -15,7 +15,6 @@ import {
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { __ } from '@wordpress/i18n';
-import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { debounce } from '@wordpress/compose';
import { useEffect, useState, useCallback } from '@wordpress/element';
@@ -28,11 +27,9 @@ import ParentControl from './parent-control';
import { TaxonomyControls } from './taxonomy-controls';
import FormatControls from './format-controls';
import StickyControl from './sticky-control';
-import CreateNewPostLink from './create-new-post-link';
import PerPageControl from './per-page-control';
import OffsetControl from './offset-controls';
import PagesControl from './pages-control';
-import { unlock } from '../../../lock-unlock';
import {
usePostTypes,
useIsPostTypeHierarchical,
@@ -42,8 +39,6 @@ import {
} from '../../utils';
import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
-const { BlockInfo } = unlock( blockEditorPrivateApis );
-
export default function QueryInspectorControls( props ) {
const { attributes, setQuery, setDisplayLayout, isSingular } = props;
const { query, displayLayout } = attributes;
@@ -191,11 +186,6 @@ export default function QueryInspectorControls( props ) {
return (
<>
- { !! postType && (
-
-
-
- ) }
{ showSettingsPanel && (
{ showInheritControl && (
diff --git a/packages/block-library/src/query/editor.scss b/packages/block-library/src/query/editor.scss
index b86eae0cbf65a8..da863bff0b5da6 100644
--- a/packages/block-library/src/query/editor.scss
+++ b/packages/block-library/src/query/editor.scss
@@ -6,10 +6,6 @@
}
}
-.wp-block-query__create-new-link {
- padding: 0 $grid-unit-20 $grid-unit-20 52px;
-}
-
.block-library-query__pattern-selection-content .block-editor-block-patterns-list {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
From d2c2ed8a8bac9d5b3af1876be471c6d5aaad8d7b Mon Sep 17 00:00:00 2001
From: Luigi Teschio
Date: Tue, 26 Nov 2024 11:53:07 +0100
Subject: [PATCH 030/384] Editor: Fix deprecation version for template
selectors
Co-authored-by: gigitux
Co-authored-by: Mamaduka
Co-authored-by: oandregal
---
packages/editor/src/store/selectors.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js
index c17e80f771ea36..a090fee0abd641 100644
--- a/packages/editor/src/store/selectors.js
+++ b/packages/editor/src/store/selectors.js
@@ -1707,7 +1707,7 @@ export const __experimentalGetDefaultTemplateTypes = createRegistrySelector(
deprecated(
"select('core/editor').__experimentalGetDefaultTemplateTypes",
{
- since: '6.7',
+ since: '6.8',
alternative:
"select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_types",
}
@@ -1730,7 +1730,7 @@ export const __experimentalGetDefaultTemplatePartAreas = createRegistrySelector(
deprecated(
"select('core/editor').__experimentalGetDefaultTemplatePartAreas",
{
- since: '6.7',
+ since: '6.8',
alternative:
"select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_part_areas",
}
@@ -1760,7 +1760,7 @@ export const __experimentalGetDefaultTemplateType = createRegistrySelector(
deprecated(
"select('core/editor').__experimentalGetDefaultTemplateType",
{
- since: '6.7',
+ since: '6.8',
}
);
const templateTypes = select( coreStore ).getEntityRecord(
@@ -1792,7 +1792,7 @@ export const __experimentalGetTemplateInfo = createRegistrySelector(
( select ) =>
createSelector( ( state, template ) => {
deprecated( "select('core/editor').__experimentalGetTemplateInfo", {
- since: '6.7',
+ since: '6.8',
} );
if ( ! template ) {
From 94071077510763cb060de59d8758adef1216fae7 Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Tue, 26 Nov 2024 17:23:52 +0400
Subject: [PATCH 031/384] Block Editor: Add success notices for image editing
(#67312)
* Block Editor: Add success notices for image editing
* Fix translators comment
Co-authored-by: Mamaduka
Co-authored-by: ntsekouras
Co-authored-by: ajlende
---
.../components/image-editor/use-save-image.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/packages/block-editor/src/components/image-editor/use-save-image.js b/packages/block-editor/src/components/image-editor/use-save-image.js
index 094ce1600545b5..676f74b9ab6a68 100644
--- a/packages/block-editor/src/components/image-editor/use-save-image.js
+++ b/packages/block-editor/src/components/image-editor/use-save-image.js
@@ -10,6 +10,12 @@ import { __, sprintf } from '@wordpress/i18n';
import { store as noticesStore } from '@wordpress/notices';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
+const messages = {
+ crop: __( 'Image cropped.' ),
+ rotate: __( 'Image rotated.' ),
+ cropAndRotate: __( 'Image cropped and rotated.' ),
+};
+
export default function useSaveImage( {
crop,
rotation,
@@ -18,7 +24,8 @@ export default function useSaveImage( {
onSaveImage,
onFinishEditing,
} ) {
- const { createErrorNotice } = useDispatch( noticesStore );
+ const { createErrorNotice, createSuccessNotice } =
+ useDispatch( noticesStore );
const [ isInProgress, setIsInProgress ] = useState( false );
const cancel = useCallback( () => {
@@ -61,6 +68,9 @@ export default function useSaveImage( {
return;
}
+ const modifierType =
+ modifiers.length === 1 ? modifiers[ 0 ].type : 'cropAndRotate';
+
apiFetch( {
path: `/wp/v2/media/${ id }/edit`,
method: 'POST',
@@ -71,11 +81,14 @@ export default function useSaveImage( {
id: response.id,
url: response.source_url,
} );
+ createSuccessNotice( messages[ modifierType ], {
+ type: 'snackbar',
+ } );
} )
.catch( ( error ) => {
createErrorNotice(
sprintf(
- /* translators: 1. Error message */
+ /* translators: %s: Error message. */
__( 'Could not edit image. %s' ),
stripHTML( error.message )
),
@@ -96,6 +109,7 @@ export default function useSaveImage( {
url,
onSaveImage,
createErrorNotice,
+ createSuccessNotice,
onFinishEditing,
] );
From 9ee20a821a69271dcada656b3df49a8266c66fe2 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Tue, 26 Nov 2024 22:28:30 +0900
Subject: [PATCH 032/384] CustomGradientPicker: Prepare `Button`s for 40px
default size (#67286)
* CustomGradientPicker: Prepare `Button`s for 40px default size
* Add changelog
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/CHANGELOG.md | 1 +
.../src/custom-gradient-picker/gradient-bar/control-points.tsx | 2 ++
packages/components/src/custom-gradient-picker/style.scss | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 23e791645a20c8..44351656af3bd8 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -42,6 +42,7 @@
- `SlotFill`: rewrite the `Slot` component from class component to functional ([#67153](https://github.com/WordPress/gutenberg/pull/67153)).
- `Menu.ItemHelpText`: Fix text wrapping to prevent unintended word breaks ([#67011](https://github.com/WordPress/gutenberg/pull/67011)).
- `BorderBoxControl`: Suppress redundant warnings for deprecated 36px size ([#67213](https://github.com/WordPress/gutenberg/pull/67213)).
+- `CustomGradientPicker`: Prepare `Button`s for 40px default size ([#67286](https://github.com/WordPress/gutenberg/pull/67286)).
## 28.12.0 (2024-11-16)
diff --git a/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx b/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx
index 3911e21e0f9348..d68ee7502e1f63 100644
--- a/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx
+++ b/packages/components/src/custom-gradient-picker/gradient-bar/control-points.tsx
@@ -66,6 +66,7 @@ function ControlPointButton( {
aria-describedby={ descriptionId }
aria-haspopup="true"
aria-expanded={ isOpen }
+ __next40pxDefaultSize
className={ clsx(
'components-custom-gradient-picker__control-point-button',
{
@@ -349,6 +350,7 @@ function InsertPoint( {
} }
renderToggle={ ( { isOpen, onToggle } ) => (
{
diff --git a/packages/components/src/custom-gradient-picker/style.scss b/packages/components/src/custom-gradient-picker/style.scss
index fea18f340951e5..b9f2bee9dbe4eb 100644
--- a/packages/components/src/custom-gradient-picker/style.scss
+++ b/packages/components/src/custom-gradient-picker/style.scss
@@ -47,7 +47,7 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
// Same size as the .components-custom-gradient-picker__control-point-dropdown parent
height: inherit;
width: inherit;
- min-width: $grid-unit-20;
+ min-width: $grid-unit-20 !important;
border-radius: $radius-round;
background: $white;
From 6cc603585ebb52958e57f144952e3fa152c97fb7 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Tue, 26 Nov 2024 22:43:37 +0900
Subject: [PATCH 033/384] Icon: Auto-generate readme (#67282)
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/src/icon/README.md | 87 +++++--------------
.../components/src/icon/docs-manifest.json | 5 ++
packages/components/src/icon/index.tsx | 41 ++++++---
3 files changed, 55 insertions(+), 78 deletions(-)
create mode 100644 packages/components/src/icon/docs-manifest.json
diff --git a/packages/components/src/icon/README.md b/packages/components/src/icon/README.md
index 5e78f029f169f7..63d52c1fd20b13 100644
--- a/packages/components/src/icon/README.md
+++ b/packages/components/src/icon/README.md
@@ -1,82 +1,39 @@
# Icon
-Allows you to render a raw icon without any initial styling or wrappers.
+
-## Usage
+See the WordPress Storybook for more detailed, interactive documentation.
-#### With a Dashicon
+Renders a raw icon without any initial styling or wrappers.
```jsx
-import { Icon } from '@wordpress/components';
+import { wordpress } from '@wordpress/icons';
-const MyIcon = () => ;
+
```
-
-#### With a function
-
-```jsx
-import { Icon } from '@wordpress/components';
-
-const MyIcon = () => (
- (
-
-
-
- ) }
- />
-);
-```
-
-#### With a Component
-
-```jsx
-import { MyIconComponent } from '../my-icon-component';
-import { Icon } from '@wordpress/components';
-
-const MyIcon = () => ;
-```
-
-#### With an SVG
-
-```jsx
-import { Icon } from '@wordpress/components';
-
-const MyIcon = () => (
-
-
-
- }
- />
-);
-```
-
-#### Specifying a className
-
-```jsx
-import { Icon } from '@wordpress/components';
-
-const MyIcon = () => ;
-```
-
## Props
-The component accepts the following props. Any additional props are passed through to the underlying icon element.
+### `icon`
-### icon
+The icon to render. In most cases, you should use an icon from
+[the `@wordpress/icons` package](https://wordpress.github.io/gutenberg/?path=/story/icons-icon--library).
-The icon to render. Supported values are: Dashicons (specified as strings), functions, Component instances and `null`.
+Other supported values are: component instances, functions,
+[Dashicons](https://developer.wordpress.org/resource/dashicons/)
+(specified as strings), and `null`.
-- Type: `String|Function|Component|null`
-- Required: No
-- Default: `null`
+The `size` value, as well as any other additional props, will be passed through.
-### size
+ - Type: `IconType`
+ - Required: No
+ - Default: `null`
+
+### `size`
The size (width and height) of the icon.
-- Type: `Number`
-- Required: No
-- Default: `20` when a Dashicon is rendered, `24` for all other icons.
+Defaults to `20` when `icon` is a string (i.e. a Dashicon id), otherwise `24`.
+
+ - Type: `number`
+ - Required: No
+ - Default: `'string' === typeof icon ? 20 : 24`
diff --git a/packages/components/src/icon/docs-manifest.json b/packages/components/src/icon/docs-manifest.json
new file mode 100644
index 00000000000000..4794049a3eb6ce
--- /dev/null
+++ b/packages/components/src/icon/docs-manifest.json
@@ -0,0 +1,5 @@
+{
+ "$schema": "../../schemas/docs-manifest.json",
+ "displayName": "Icon",
+ "filePath": "./index.tsx"
+}
diff --git a/packages/components/src/icon/index.tsx b/packages/components/src/icon/index.tsx
index 3fbf4d18c5a00e..283b9cd179cd1c 100644
--- a/packages/components/src/icon/index.tsx
+++ b/packages/components/src/icon/index.tsx
@@ -25,10 +25,22 @@ export type IconType =
| ( ( props: { size?: number } ) => JSX.Element )
| JSX.Element;
-interface BaseProps {
+type AdditionalProps< T > = T extends ComponentType< infer U >
+ ? U
+ : T extends DashiconIconKey
+ ? SVGProps< SVGSVGElement >
+ : {};
+
+export type Props = {
/**
- * The icon to render. Supported values are: Dashicons (specified as
- * strings), functions, Component instances and `null`.
+ * The icon to render. In most cases, you should use an icon from
+ * [the `@wordpress/icons` package](https://wordpress.github.io/gutenberg/?path=/story/icons-icon--library).
+ *
+ * Other supported values are: component instances, functions,
+ * [Dashicons](https://developer.wordpress.org/resource/dashicons/)
+ * (specified as strings), and `null`.
+ *
+ * The `size` value, as well as any other additional props, will be passed through.
*
* @default null
*/
@@ -36,19 +48,22 @@ interface BaseProps {
/**
* The size (width and height) of the icon.
*
- * @default `20` when a Dashicon is rendered, `24` for all other icons.
+ * Defaults to `20` when `icon` is a string (i.e. a Dashicon id), otherwise `24`.
+ *
+ * @default `'string' === typeof icon ? 20 : 24`.
*/
size?: number;
-}
-
-type AdditionalProps< T > = T extends ComponentType< infer U >
- ? U
- : T extends DashiconIconKey
- ? SVGProps< SVGSVGElement >
- : {};
-
-export type Props = BaseProps & AdditionalProps< IconType >;
+} & AdditionalProps< IconType >;
+/**
+ * Renders a raw icon without any initial styling or wrappers.
+ *
+ * ```jsx
+ * import { wordpress } from '@wordpress/icons';
+ *
+ *
+ * ```
+ */
function Icon( {
icon = null,
size = 'string' === typeof icon ? 20 : 24,
From 4c30b00b3567313c6c49cd2e85dd35af254be097 Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Tue, 26 Nov 2024 20:19:55 +0400
Subject: [PATCH 034/384] Block Editor: Add notice action to revert image to
original after cropping (#67314)
Co-authored-by: Mamaduka
Co-authored-by: ntsekouras
Co-authored-by: jasmussen
Co-authored-by: ellatrix
Co-authored-by: annezazu
---
.../src/components/image-editor/use-save-image.js | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/packages/block-editor/src/components/image-editor/use-save-image.js b/packages/block-editor/src/components/image-editor/use-save-image.js
index 676f74b9ab6a68..980ac9b8b1123c 100644
--- a/packages/block-editor/src/components/image-editor/use-save-image.js
+++ b/packages/block-editor/src/components/image-editor/use-save-image.js
@@ -83,6 +83,17 @@ export default function useSaveImage( {
} );
createSuccessNotice( messages[ modifierType ], {
type: 'snackbar',
+ actions: [
+ {
+ label: __( 'Undo' ),
+ onClick: () => {
+ onSaveImage( {
+ id,
+ url,
+ } );
+ },
+ },
+ ],
} );
} )
.catch( ( error ) => {
From 6d90ad40569a94027ea38213a75c99305bd775d3 Mon Sep 17 00:00:00 2001
From: Luigi Teschio
Date: Tue, 26 Nov 2024 17:43:51 +0100
Subject: [PATCH 035/384] Add #7895 Core Backport PR to the changelog (#67319)
---
backport-changelog/6.8/7895.md | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 backport-changelog/6.8/7895.md
diff --git a/backport-changelog/6.8/7895.md b/backport-changelog/6.8/7895.md
new file mode 100644
index 00000000000000..4750ab545ada3b
--- /dev/null
+++ b/backport-changelog/6.8/7895.md
@@ -0,0 +1,3 @@
+https://github.com/WordPress/wordpress-develop/pull/7895
+
+* https://github.com/WordPress/gutenberg/pull/66459
From de7b09b2faa72d462736bf562962540450982522 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Wed, 27 Nov 2024 01:46:43 +0900
Subject: [PATCH 036/384] Icon: Improve `icon` prop usage docs in Storybook
(#67280)
* Icon: Improve `icon` prop usage docs in Storybook
* Fixup
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
.../src/icon/stories/index.story.tsx | 58 ++++++++++++++++---
1 file changed, 50 insertions(+), 8 deletions(-)
diff --git a/packages/components/src/icon/stories/index.story.tsx b/packages/components/src/icon/stories/index.story.tsx
index 7d61be8df7f3ce..d1eabf2e98b771 100644
--- a/packages/components/src/icon/stories/index.story.tsx
+++ b/packages/components/src/icon/stories/index.story.tsx
@@ -47,26 +47,68 @@ FillColor.args = {
...Default.args,
};
+/**
+ * When `icon` is a function, it will be passed the `size` prop and any other additional props.
+ */
export const WithAFunction = Template.bind( {} );
WithAFunction.args = {
...Default.args,
- icon: () => (
-
-
-
+ icon: ( { size }: { size?: number } ) => (
+
),
};
+WithAFunction.parameters = {
+ docs: {
+ source: {
+ code: `
+ (
+
+ ) }
+/>
+ `,
+ },
+ },
+};
-const MyIconComponent = () => (
-
+const MyIconComponent = ( { size }: { size?: number } ) => (
+
);
+/**
+ * When `icon` is a component, it will be passed the `size` prop and any other additional props.
+ */
export const WithAComponent = Template.bind( {} );
WithAComponent.args = {
...Default.args,
- icon: MyIconComponent,
+ icon: ,
+};
+WithAComponent.parameters = {
+ docs: {
+ source: {
+ code: `
+const MyIconComponent = ( { size } ) => (
+
+
+
+);
+
+ } />
+ `,
+ },
+ },
};
export const WithAnSVG = Template.bind( {} );
@@ -80,7 +122,7 @@ WithAnSVG.args = {
};
/**
- * Although it's preferred to use icons from the `@wordpress/icons` package, Dashicons are still supported,
+ * Although it's preferred to use icons from the `@wordpress/icons` package, [Dashicons](https://developer.wordpress.org/resource/dashicons/) are still supported,
* as long as you are in a context where the Dashicons stylesheet is loaded. To simulate that here,
* use the Global CSS Injector in the Storybook toolbar at the top and select the "WordPress" preset.
*/
From 8c34d9103cfff2b16839af188a890d01d2a18bac Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Wed, 27 Nov 2024 02:00:29 +0900
Subject: [PATCH 037/384] CircularOptionPicker: Update Button sizes (#67285)
* CircularOptionPicker: Update Button sizes
* Add changelog
* Update snapshot
* Fixup changelog
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
.../color-palette/test/__snapshots__/control.js.snap | 4 ++--
packages/components/CHANGELOG.md | 1 +
.../circular-option-picker/circular-option-picker-actions.tsx | 1 +
.../circular-option-picker/circular-option-picker-option.tsx | 1 +
packages/components/src/circular-option-picker/style.scss | 4 ++--
5 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/packages/block-editor/src/components/color-palette/test/__snapshots__/control.js.snap b/packages/block-editor/src/components/color-palette/test/__snapshots__/control.js.snap
index 3c4cef664a3103..14196a221304bc 100644
--- a/packages/block-editor/src/components/color-palette/test/__snapshots__/control.js.snap
+++ b/packages/block-editor/src/components/color-palette/test/__snapshots__/control.js.snap
@@ -219,7 +219,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
Clear
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 44351656af3bd8..c9b09c40350232 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -30,6 +30,7 @@
- `ColorPicker`: Update sizes of color format select and copy button ([#67093](https://github.com/WordPress/gutenberg/pull/67093)).
- `ComboboxControl`: Update reset button size ([#67215](https://github.com/WordPress/gutenberg/pull/67215)).
- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).
+- `CircularOptionPicker`: Update `Button` sizes to be ready for 40px default size ([#67285](https://github.com/WordPress/gutenberg/pull/67285)).
### Experimental
diff --git a/packages/components/src/circular-option-picker/circular-option-picker-actions.tsx b/packages/components/src/circular-option-picker/circular-option-picker-actions.tsx
index 4cf4d6f95da383..339c614e4ca45d 100644
--- a/packages/components/src/circular-option-picker/circular-option-picker-actions.tsx
+++ b/packages/components/src/circular-option-picker/circular-option-picker-actions.tsx
@@ -47,6 +47,7 @@ export function ButtonAction( {
}: WordPressComponentProps< ButtonAsButtonProps, 'button', false > ) {
return (
Date: Wed, 27 Nov 2024 04:24:11 +0900
Subject: [PATCH 038/384] Components contributing guide: Fix relative links
(#67323)
* Components contributing guide: Fix relative links
* Fix broken image
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/CONTRIBUTING.md | 32 ++++++++++++++---------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/packages/components/CONTRIBUTING.md b/packages/components/CONTRIBUTING.md
index 8af8bbf801edfe..fd97fe912b2be8 100644
--- a/packages/components/CONTRIBUTING.md
+++ b/packages/components/CONTRIBUTING.md
@@ -2,7 +2,7 @@
Thank you for taking the time to contribute.
-The following is a set of guidelines for contributing to the `@wordpress/components` package to be considered in addition to the general ones described in our [Contributing Policy](/CONTRIBUTING.md).
+The following is a set of guidelines for contributing to the `@wordpress/components` package to be considered in addition to the general ones described in our [Contributing Policy](https://github.com/WordPress/gutenberg/blob/HEAD/CONTRIBUTING.md).
This set of guidelines should apply especially to newly introduced components. In fact, while these guidelines should also be retroactively applied to existing components, it is sometimes impossible to do so for legacy/compatibility reasons.
@@ -36,7 +36,7 @@ To determine if a component should be added, ask yourself:
Here’s a flowchart that can help determine if a new component is necessary:
-[![New component flowchart](https://wordpress.org/gutenberg/files/2019/07/New_component_flowchart.png)](https://coggle.it/diagram/WtUSrld3uAYZHsn-/t/new-ui-component/992b38cbe685d897b4aec6d0dd93cc4b47c06e0d4484eeb0d7d9a47fb2c48d94)
+![New component flowchart](https://wordpress.org/gutenberg/files/2019/07/New_component_flowchart.png)
### First steps
@@ -95,12 +95,12 @@ In these situations, one possible approach is to "soft-deprecate" a given legacy
2. Updating all places in Gutenberg that use that API.
3. Adding deprecation warnings (only after the previous point is completed, otherwise the Browser Console will be polluted by all those warnings and some e2e tests may fail).
-When adding new components or new props to existing components, it's recommended to create a [private version](/packages/private-apis/README.md)) of the component until the changes are stable enough to be exposed as part of the public API.
+When adding new components or new props to existing components, it's recommended to create a [private version](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-private-apis/) of the component until the changes are stable enough to be exposed as part of the public API.
### Learn more
-- [How to preserve backward compatibility for a React Component](/docs/contributors/code/backward-compatibility.md#how-to-preserve-backward-compatibility-for-a-react-component)
-- [Experimental and Unstable APIs](/docs/contributors/code/coding-guidelines.md#legacy-experimental-apis-plugin-only-apis-and-private-apis)
+- [How to preserve backward compatibility for a React Component](https://developer.wordpress.org/block-editor/contributors/code/backward-compatibility/#how-to-preserve-backward-compatibility-for-a-react-component)
+- [Experimental and Unstable APIs](https://developer.wordpress.org/block-editor/contributors/code/coding-guidelines/#legacy-experimental-apis-plugin-only-apis-and-private-apis)
- [Deprecating styles](#deprecating-styles)
## Context
-See examples for this section for the [ItemGroup](/packages/components/src/item-group/item-group/README.md#context) and [`Card`](/packages/components/src/card/card/README.md#context) components.
+See examples for this section for the [ItemGroup](https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/item-group/item-group/README.md#context) and [`Card`](https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/card/card#context) components.
````
## Folder structure
From 9b908539b23b310fa31a085794c9b1b17c1d2df5 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Wed, 27 Nov 2024 05:28:18 +0900
Subject: [PATCH 039/384] BoxControl: Auto-generate readme (#67284)
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/src/box-control/README.md | 139 ++++++++++--------
.../src/box-control/docs-manifest.json | 5 +
packages/components/src/box-control/index.tsx | 26 ++--
packages/components/src/box-control/types.ts | 2 +
4 files changed, 99 insertions(+), 73 deletions(-)
create mode 100644 packages/components/src/box-control/docs-manifest.json
diff --git a/packages/components/src/box-control/README.md b/packages/components/src/box-control/README.md
index 77176b49eeb6d8..ddadf938798ee9 100644
--- a/packages/components/src/box-control/README.md
+++ b/packages/components/src/box-control/README.md
@@ -1,106 +1,125 @@
# BoxControl
-A control that lets users set values for top, right, bottom, and left. Can be used as an input control for values like `padding` or `margin`.
+
-## Usage
+See the WordPress Storybook for more detailed, interactive documentation.
+
+A control that lets users set values for top, right, bottom, and left. Can be
+used as an input control for values like `padding` or `margin`.
```jsx
import { useState } from 'react';
import { BoxControl } from '@wordpress/components';
function Example() {
- const [ values, setValues ] = useState( {
- top: '50px',
- left: '10%',
- right: '10%',
- bottom: '50px',
- } );
-
- return (
- setValues( nextValues ) }
- />
- );
-}
+ const [ values, setValues ] = useState( {
+ top: '50px',
+ left: '10%',
+ right: '10%',
+ bottom: '50px',
+ } );
+
+ return (
+
+ );
+};
```
-
## Props
-### `allowReset`: `boolean`
+### `__next40pxDefaultSize`
+
+Start opting into the larger default height that will become the default size in a future version.
+
+ - Type: `boolean`
+ - Required: No
+ - Default: `false`
+
+### `allowReset`
If this property is true, a button to reset the box control is rendered.
-- Required: No
-- Default: `true`
+ - Type: `boolean`
+ - Required: No
+ - Default: `true`
-### `splitOnAxis`: `boolean`
+### `id`
-If this property is true, when the box control is unlinked, vertical and horizontal controls can be used instead of updating individual sides.
+The id to use as a base for the unique HTML id attribute of the control.
-- Required: No
-- Default: `false`
+ - Type: `string`
+ - Required: No
-### `inputProps`: `object`
+### `inputProps`
-Props for the internal [UnitControl](../unit-control) components.
+Props for the internal `UnitControl` components.
-- Required: No
-- Default: `{ min: 0 }`
+ - Type: `UnitControlPassthroughProps`
+ - Required: No
+ - Default: `{
+ min: 0,
+ }`
-### `label`: `string`
+### `label`
Heading label for the control.
-- Required: No
-- Default: `__( 'Box Control' )`
+ - Type: `string`
+ - Required: No
+ - Default: `__( 'Box Control' )`
-### `onChange`: `(next: BoxControlValue) => void`
+### `onChange`
A callback function when an input value changes.
-- Required: Yes
+ - Type: `(next: BoxControlValue) => void`
+ - Required: No
+ - Default: `() => {}`
-### `resetValues`: `object`
+### `resetValues`
The `top`, `right`, `bottom`, and `left` box dimension values to use when the control is reset.
-- Required: No
-- Default: `{ top: undefined, right: undefined, bottom: undefined, left: undefined }`
-
-### `sides`: `string[]`
-
-Collection of sides to allow control of. If omitted or empty, all sides will be available. Allowed values are "top", "right", "bottom", "left", "vertical", and "horizontal".
-
-- Required: No
-
-### `units`: `WPUnitControlUnit[]`
-
-Collection of available units which are compatible with [UnitControl](../unit-control).
+ - Type: `BoxControlValue`
+ - Required: No
+ - Default: `{
+ top: undefined,
+ right: undefined,
+ bottom: undefined,
+ left: undefined,
+ }`
-- Required: No
+### `sides`
-### `values`: `object`
+Collection of sides to allow control of. If omitted or empty, all sides will be available.
-The `top`, `right`, `bottom`, and `left` box dimension values.
+Allowed values are "top", "right", "bottom", "left", "vertical", and "horizontal".
-- Required: No
+ - Type: `readonly (keyof BoxControlValue | "horizontal" | "vertical")[]`
+ - Required: No
-### `onMouseOver`: `function`
+### `splitOnAxis`
-A handler for onMouseOver events.
+If this property is true, when the box control is unlinked, vertical and horizontal controls
+can be used instead of updating individual sides.
-- Required: No
+ - Type: `boolean`
+ - Required: No
+ - Default: `false`
-### `onMouseOut`: `function`
+### `units`
-A handler for onMouseOut events.
+Available units to select from.
-- Required: No
+ - Type: `WPUnitControlUnit[]`
+ - Required: No
+ - Default: `CSS_UNITS`
-### `__next40pxDefaultSize`: `boolean`
+### `values`
-Start opting into the larger default size that will become the default size in a future version.
+The current values of the control, expressed as an object of `top`, `right`, `bottom`, and `left` values.
-- Required: No
-- Default: `false`
+ - Type: `BoxControlValue`
+ - Required: No
diff --git a/packages/components/src/box-control/docs-manifest.json b/packages/components/src/box-control/docs-manifest.json
new file mode 100644
index 00000000000000..c506e7a9e27eef
--- /dev/null
+++ b/packages/components/src/box-control/docs-manifest.json
@@ -0,0 +1,5 @@
+{
+ "$schema": "../../schemas/docs-manifest.json",
+ "displayName": "BoxControl",
+ "filePath": "./index.tsx"
+}
diff --git a/packages/components/src/box-control/index.tsx b/packages/components/src/box-control/index.tsx
index 41e95aa88bea37..7f822f5f70e124 100644
--- a/packages/components/src/box-control/index.tsx
+++ b/packages/components/src/box-control/index.tsx
@@ -51,23 +51,23 @@ function useUniqueId( idProp?: string ) {
* used as an input control for values like `padding` or `margin`.
*
* ```jsx
+ * import { useState } from 'react';
* import { BoxControl } from '@wordpress/components';
- * import { useState } from '@wordpress/element';
*
* function Example() {
- * const [ values, setValues ] = useState( {
- * top: '50px',
- * left: '10%',
- * right: '10%',
- * bottom: '50px',
- * } );
+ * const [ values, setValues ] = useState( {
+ * top: '50px',
+ * left: '10%',
+ * right: '10%',
+ * bottom: '50px',
+ * } );
*
- * return (
- * setValues( nextValues ) }
- * />
- * );
+ * return (
+ *
+ * );
* };
* ```
*/
diff --git a/packages/components/src/box-control/types.ts b/packages/components/src/box-control/types.ts
index 5f4071aeed88a7..2a47abbf11001e 100644
--- a/packages/components/src/box-control/types.ts
+++ b/packages/components/src/box-control/types.ts
@@ -58,6 +58,8 @@ export type BoxControlProps = Pick<
resetValues?: BoxControlValue;
/**
* Collection of sides to allow control of. If omitted or empty, all sides will be available.
+ *
+ * Allowed values are "top", "right", "bottom", "left", "vertical", and "horizontal".
*/
sides?: readonly ( keyof BoxControlValue | 'horizontal' | 'vertical' )[];
/**
From eadf2dda88e69176c9d577ed7cd197a3da9197a2 Mon Sep 17 00:00:00 2001
From: Jerry Jones
Date: Tue, 26 Nov 2024 14:33:09 -0600
Subject: [PATCH 040/384] Add useScaleCanvas: Web Animations API for zoom
in/out animation (#66917)
* Move code into useScaleCanvas that isn't necessary in iframe index
* Use Web Animations API for zoom in/out
* Add reverse animation if zoom state is toggled quickly
* Use transitionTo and transitionFrom refs to manage start and end points of transition
---------
Co-authored-by: Alex Lende
---
packages/base-styles/_animations.scss | 5 -
.../src/components/block-canvas/style.scss | 3 +-
.../src/components/iframe/content.scss | 75 ++-
.../src/components/iframe/index.js | 326 +-----------
.../src/components/iframe/use-scale-canvas.js | 468 ++++++++++++++++++
5 files changed, 517 insertions(+), 360 deletions(-)
create mode 100644 packages/block-editor/src/components/iframe/use-scale-canvas.js
diff --git a/packages/base-styles/_animations.scss b/packages/base-styles/_animations.scss
index ae5de9a803008c..e5bbf863757356 100644
--- a/packages/base-styles/_animations.scss
+++ b/packages/base-styles/_animations.scss
@@ -41,8 +41,3 @@
@warn "The `edit-post__fade-in-animation` mixin is deprecated. Use `animation__fade-in` instead.";
@include animation__fade-in($speed, $delay);
}
-
-@mixin editor-canvas-resize-animation($additional-transition-rules...) {
- transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), $additional-transition-rules;
- @include reduce-motion("transition");
-}
diff --git a/packages/block-editor/src/components/block-canvas/style.scss b/packages/block-editor/src/components/block-canvas/style.scss
index 8f6064de0b615c..ea54646e64a59a 100644
--- a/packages/block-editor/src/components/block-canvas/style.scss
+++ b/packages/block-editor/src/components/block-canvas/style.scss
@@ -4,6 +4,7 @@ iframe[name="editor-canvas"] {
height: 100%;
display: block;
// Handles transitions between device previews
- @include editor-canvas-resize-animation;
+ transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
+ @include reduce-motion("transition");
background-color: $gray-300;
}
diff --git a/packages/block-editor/src/components/iframe/content.scss b/packages/block-editor/src/components/iframe/content.scss
index 5e390800719949..9b02716671de77 100644
--- a/packages/block-editor/src/components/iframe/content.scss
+++ b/packages/block-editor/src/components/iframe/content.scss
@@ -4,10 +4,8 @@
.block-editor-iframe__html {
transform-origin: top center;
- // We don't want to animate the transform of the translateX because it is used
- // to "center" the canvas. Leaving it on causes the canvas to slide around in
- // odd ways.
- @include editor-canvas-resize-animation( transform 0s, scale 0s, padding 0s, translate 0s);
+ // Prevents a flash of background color change when entering/exiting zoom out
+ transition: background-color 400ms;
&.zoom-out-animation {
$scroll-top: var(--wp-block-editor-iframe-zoom-out-scroll-top, 0);
@@ -18,53 +16,48 @@
right: 0;
top: calc(-1 * #{$scroll-top});
bottom: 0;
- translate: 0 calc(#{$scroll-top} - #{$scroll-top-next});
// Force preserving a scrollbar gutter as scrollbar-gutter isn't supported in all browsers yet,
// and removing the scrollbar causes the content to shift.
overflow-y: scroll;
-
- // We only want to animate the scaling when entering zoom out. When sidebars
- // are toggled, the resizing of the iframe handles scaling the canvas as well,
- // and the doubled animations cause very odd animations.
- @include editor-canvas-resize-animation( transform 0s, top 0s, bottom 0s, right 0s, left 0s );
}
-}
-.block-editor-iframe__html.is-zoomed-out {
- $scale: var(--wp-block-editor-iframe-zoom-out-scale);
- $frame-size: var(--wp-block-editor-iframe-zoom-out-frame-size);
- $inner-height: var(--wp-block-editor-iframe-zoom-out-inner-height);
- $content-height: var(--wp-block-editor-iframe-zoom-out-content-height);
- $scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width);
- $container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
- // Apply an X translation to center the scaled content within the available space.
- transform: translateX(calc((#{$scale-container-width} - #{$container-width}) / 2 / #{$scale}));
- scale: #{$scale};
- background-color: $gray-300;
+ &.is-zoomed-out {
+ $scale: var(--wp-block-editor-iframe-zoom-out-scale, 1);
+ $frame-size: var(--wp-block-editor-iframe-zoom-out-frame-size, 0);
+ $inner-height: var(--wp-block-editor-iframe-zoom-out-inner-height);
+ $content-height: var(--wp-block-editor-iframe-zoom-out-content-height);
+ $scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width);
+ $container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
+ // Apply an X translation to center the scaled content within the available space.
+ transform: translateX(calc((#{$scale-container-width} - #{$container-width}) / 2 / #{$scale}));
+ scale: $scale;
+ background-color: $gray-300;
- // Chrome seems to respect that transform scale shouldn't affect the layout size of the element,
- // so we need to adjust the height of the content to match the scale by using negative margins.
- $extra-content-height: calc(#{$content-height} * (1 - #{$scale}));
- $total-frame-height: calc(2 * #{$frame-size} / #{$scale});
- $total-height: calc(#{$extra-content-height} + #{$total-frame-height} + 2px);
- margin-bottom: calc(-1 * #{$total-height});
- // Add the top/bottom frame size. We use scaling to account for the left/right, as
- // the padding left/right causes the contents to reflow, which breaks the 1:1 scaling
- // of the content.
- padding-top: calc(#{$frame-size} / #{$scale});
- padding-bottom: calc(#{$frame-size} / #{$scale});
+ // Chrome seems to respect that transform scale shouldn't affect the layout size of the element,
+ // so we need to adjust the height of the content to match the scale by using negative margins.
+ $extra-content-height: calc(#{$content-height} * (1 - #{$scale}));
+ $total-frame-height: calc(2 * #{$frame-size} / #{$scale});
+ $total-height: calc(#{$extra-content-height} + #{$total-frame-height} + 2px);
+ margin-bottom: calc(-1 * #{$total-height});
- body {
- min-height: calc((#{$inner-height} - #{$total-frame-height}) / #{$scale});
+ // Add the top/bottom frame size. We use scaling to account for the left/right, as
+ // the padding left/right causes the contents to reflow, which breaks the 1:1 scaling
+ // of the content.
+ padding-top: calc(#{$frame-size} / #{$scale});
+ padding-bottom: calc(#{$frame-size} / #{$scale});
- > .is-root-container:not(.wp-block-post-content) {
- flex: 1;
- display: flex;
- flex-direction: column;
- height: 100%;
+ body {
+ min-height: calc((#{$inner-height} - #{$total-frame-height}) / #{$scale});
- > main {
+ > .is-root-container:not(.wp-block-post-content) {
flex: 1;
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+
+ > main {
+ flex: 1;
+ }
}
}
}
diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js
index f8b7c25084e38d..751e940dd166cc 100644
--- a/packages/block-editor/src/components/iframe/index.js
+++ b/packages/block-editor/src/components/iframe/index.js
@@ -12,16 +12,9 @@ import {
forwardRef,
useMemo,
useEffect,
- useRef,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
-import {
- useResizeObserver,
- useMergeRefs,
- useRefEffect,
- useDisabled,
- useReducedMotion,
-} from '@wordpress/compose';
+import { useMergeRefs, useRefEffect, useDisabled } from '@wordpress/compose';
import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';
import { useSelect } from '@wordpress/data';
@@ -31,6 +24,7 @@ import { useSelect } from '@wordpress/data';
import { useBlockSelectionClearer } from '../block-selection-clearer';
import { useWritingFlow } from '../writing-flow';
import { getCompatibilityStyles } from './get-compatibility-styles';
+import { useScaleCanvas } from './use-scale-canvas';
import { store as blockEditorStore } from '../../store';
function bubbleEvent( event, Constructor, frame ) {
@@ -124,15 +118,9 @@ function Iframe( {
const { styles = '', scripts = '' } = resolvedAssets;
/** @type {[Document, import('react').Dispatch]} */
const [ iframeDocument, setIframeDocument ] = useState();
- const initialContainerWidthRef = useRef( 0 );
const [ bodyClasses, setBodyClasses ] = useState( [] );
const clearerRef = useBlockSelectionClearer();
const [ before, writingFlowRef, after ] = useWritingFlow();
- const [ contentResizeListener, { height: contentHeight } ] =
- useResizeObserver();
- const [ containerResizeListener, { width: containerWidth } ] =
- useResizeObserver();
- const prefersReducedMotion = useReducedMotion();
const setRef = useRefEffect( ( node ) => {
node._load = () => {
@@ -228,61 +216,16 @@ function Iframe( {
};
}, [] );
- const [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();
-
- const iframeResizeRef = useRefEffect( ( node ) => {
- const nodeWindow = node.ownerDocument.defaultView;
-
- setIframeWindowInnerHeight( nodeWindow.innerHeight );
- const onResize = () => {
- setIframeWindowInnerHeight( nodeWindow.innerHeight );
- };
- nodeWindow.addEventListener( 'resize', onResize );
- return () => {
- nodeWindow.removeEventListener( 'resize', onResize );
- };
- }, [] );
-
- const [ windowInnerWidth, setWindowInnerWidth ] = useState();
-
- const windowResizeRef = useRefEffect( ( node ) => {
- const nodeWindow = node.ownerDocument.defaultView;
-
- setWindowInnerWidth( nodeWindow.innerWidth );
- const onResize = () => {
- setWindowInnerWidth( nodeWindow.innerWidth );
- };
- nodeWindow.addEventListener( 'resize', onResize );
- return () => {
- nodeWindow.removeEventListener( 'resize', onResize );
- };
- }, [] );
-
- const isZoomedOut = scale !== 1;
-
- useEffect( () => {
- if ( ! isZoomedOut ) {
- initialContainerWidthRef.current = containerWidth;
- }
- }, [ containerWidth, isZoomedOut ] );
-
- const scaleContainerWidth = Math.max(
- initialContainerWidthRef.current,
- containerWidth
- );
-
- const frameSizeValue = parseInt( frameSize );
-
- const maxWidth = 750;
- const scaleValue =
- scale === 'auto-scaled'
- ? ( Math.min( containerWidth, maxWidth ) - frameSizeValue * 2 ) /
- scaleContainerWidth
- : scale;
-
- const prevScaleRef = useRef( scaleValue );
- const prevFrameSizeRef = useRef( frameSizeValue );
- const prevClientHeightRef = useRef( /* Initialized in the useEffect. */ );
+ const {
+ contentResizeListener,
+ containerResizeListener,
+ isZoomedOut,
+ scaleContainerWidth,
+ } = useScaleCanvas( {
+ scale,
+ frameSize: parseInt( frameSize ),
+ iframeDocument,
+ } );
const disabledRef = useDisabled( { isDisabled: ! readonly } );
const bodyRef = useMergeRefs( [
@@ -291,10 +234,6 @@ function Iframe( {
clearerRef,
writingFlowRef,
disabledRef,
- // Avoid resize listeners when not needed, these will trigger
- // unnecessary re-renders when animating the iframe width, or when
- // expanding preview iframes.
- isZoomedOut ? iframeResizeRef : null,
] );
// Correct doctype is required to enable rendering in standards
@@ -336,245 +275,6 @@ function Iframe( {
useEffect( () => cleanup, [ cleanup ] );
- useEffect( () => {
- if (
- ! iframeDocument ||
- // HACK: Checking if isZoomedOut differs from prevIsZoomedOut here
- // instead of the dependency array to appease the linter.
- ( scaleValue === 1 ) === ( prevScaleRef.current === 1 )
- ) {
- return;
- }
-
- // Unscaled height of the current iframe container.
- const clientHeight = iframeDocument.documentElement.clientHeight;
-
- // Scaled height of the current iframe content.
- const scrollHeight = iframeDocument.documentElement.scrollHeight;
-
- // Previous scale value.
- const prevScale = prevScaleRef.current;
-
- // Unscaled size of the previous padding around the iframe content.
- const prevFrameSize = prevFrameSizeRef.current;
-
- // Unscaled height of the previous iframe container.
- const prevClientHeight = prevClientHeightRef.current ?? clientHeight;
-
- // We can't trust the set value from contentHeight, as it was measured
- // before the zoom out mode was changed. After zoom out mode is changed,
- // appenders may appear or disappear, so we need to get the height from
- // the iframe at this point when we're about to animate the zoom out.
- // The iframe scrollTop, scrollHeight, and clientHeight will all be
- // accurate. The client height also does change when the zoom out mode
- // is toggled, as the bottom bar about selecting the template is
- // added/removed when toggling zoom out mode.
- const scrollTop = iframeDocument.documentElement.scrollTop;
-
- // Step 0: Start with the current scrollTop.
- let scrollTopNext = scrollTop;
-
- // Step 1: Undo the effects of the previous scale and frame around the
- // midpoint of the visible area.
- scrollTopNext =
- ( scrollTopNext + prevClientHeight / 2 - prevFrameSize ) /
- prevScale -
- prevClientHeight / 2;
-
- // Step 2: Apply the new scale and frame around the midpoint of the
- // visible area.
- scrollTopNext =
- ( scrollTopNext + clientHeight / 2 ) * scaleValue +
- frameSizeValue -
- clientHeight / 2;
-
- // Step 3: Handle an edge case so that you scroll to the top of the
- // iframe if the top of the iframe content is visible in the container.
- // The same edge case for the bottom is skipped because changing content
- // makes calculating it impossible.
- scrollTopNext = scrollTop <= prevFrameSize ? 0 : scrollTopNext;
-
- // This is the scrollTop value if you are scrolled to the bottom of the
- // iframe. We can't just let the browser handle it because we need to
- // animate the scaling.
- const maxScrollTop =
- scrollHeight * ( scaleValue / prevScale ) +
- frameSizeValue * 2 -
- clientHeight;
-
- // Step 4: Clamp the scrollTopNext between the minimum and maximum
- // possible scrollTop positions. Round the value to avoid subpixel
- // truncation by the browser which sometimes causes a 1px error.
- scrollTopNext = Math.round(
- Math.min(
- Math.max( 0, scrollTopNext ),
- Math.max( 0, maxScrollTop )
- )
- );
-
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-scroll-top',
- `${ scrollTop }px`
- );
-
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-scroll-top-next',
- `${ scrollTopNext }px`
- );
-
- iframeDocument.documentElement.classList.add( 'zoom-out-animation' );
-
- function onZoomOutTransitionEnd() {
- // Remove the position fixed for the animation.
- iframeDocument.documentElement.classList.remove(
- 'zoom-out-animation'
- );
-
- // Update previous values.
- prevClientHeightRef.current = clientHeight;
- prevFrameSizeRef.current = frameSizeValue;
- prevScaleRef.current = scaleValue;
-
- // Set the final scroll position that was just animated to.
- // Disable reason: Eslint isn't smart enough to know that this is a
- // DOM element. https://github.com/facebook/react/issues/31483
- // eslint-disable-next-line react-compiler/react-compiler
- iframeDocument.documentElement.scrollTop = scrollTopNext;
- }
-
- let raf;
- if ( prefersReducedMotion ) {
- // Hack: Wait for the window values to recalculate.
- raf = iframeDocument.defaultView.requestAnimationFrame(
- onZoomOutTransitionEnd
- );
- } else {
- iframeDocument.documentElement.addEventListener(
- 'transitionend',
- onZoomOutTransitionEnd,
- { once: true }
- );
- }
-
- return () => {
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-scroll-top'
- );
- iframeDocument.documentElement.style.removeProperty(
- '--wp-block-editor-iframe-zoom-out-scroll-top-next'
- );
- iframeDocument.documentElement.classList.remove(
- 'zoom-out-animation'
- );
- if ( prefersReducedMotion ) {
- iframeDocument.defaultView.cancelAnimationFrame( raf );
- } else {
- iframeDocument.documentElement.removeEventListener(
- 'transitionend',
- onZoomOutTransitionEnd
- );
- }
- };
- }, [ iframeDocument, scaleValue, frameSizeValue, prefersReducedMotion ] );
-
- // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
- // that controls settings the CSS variables, but then we would need to do more work to ensure we're
- // only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large
- // number of dependencies.
- useEffect( () => {
- if ( ! iframeDocument ) {
- return;
- }
-
- if ( isZoomedOut ) {
- iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
- } else {
- // HACK: Since we can't remove this in the cleanup, we need to do it here.
- iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
- }
-
- return () => {
- // HACK: Skipping cleanup because it causes issues with the zoom out
- // animation. More refactoring is needed to fix this properly.
- // iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
- };
- }, [ iframeDocument, isZoomedOut ] );
-
- // Calculate the scaling and CSS variables for the zoom out canvas
- useEffect( () => {
- if ( ! iframeDocument ) {
- return;
- }
-
- // Note: When we initialize the zoom out when the canvas is smaller (sidebars open),
- // initialContainerWidthRef will be smaller than the full page, and reflow will happen
- // when the canvas area becomes larger due to sidebars closing. This is a known but
- // minor divergence for now.
-
- // This scaling calculation has to happen within the JS because CSS calc() can
- // only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid
- // but calc( 100px / 2px ) is not.
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-scale',
- scaleValue
- );
-
- // frameSize has to be a px value for the scaling and frame size to be computed correctly.
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-frame-size',
- typeof frameSize === 'number' ? `${ frameSize }px` : frameSize
- );
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-content-height',
- `${ contentHeight }px`
- );
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-inner-height',
- `${ iframeWindowInnerHeight }px`
- );
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-container-width',
- `${ containerWidth }px`
- );
- iframeDocument.documentElement.style.setProperty(
- '--wp-block-editor-iframe-zoom-out-scale-container-width',
- `${ scaleContainerWidth }px`
- );
-
- return () => {
- // HACK: Skipping cleanup because it causes issues with the zoom out
- // animation. More refactoring is needed to fix this properly.
- // iframeDocument.documentElement.style.removeProperty(
- // '--wp-block-editor-iframe-zoom-out-scale'
- // );
- // iframeDocument.documentElement.style.removeProperty(
- // '--wp-block-editor-iframe-zoom-out-frame-size'
- // );
- // iframeDocument.documentElement.style.removeProperty(
- // '--wp-block-editor-iframe-zoom-out-content-height'
- // );
- // iframeDocument.documentElement.style.removeProperty(
- // '--wp-block-editor-iframe-zoom-out-inner-height'
- // );
- // iframeDocument.documentElement.style.removeProperty(
- // '--wp-block-editor-iframe-zoom-out-container-width'
- // );
- // iframeDocument.documentElement.style.removeProperty(
- // '--wp-block-editor-iframe-zoom-out-scale-container-width'
- // );
- };
- }, [
- scaleValue,
- frameSize,
- iframeDocument,
- iframeWindowInnerHeight,
- contentHeight,
- containerWidth,
- windowInnerWidth,
- isZoomedOut,
- scaleContainerWidth,
- ] );
-
// Make sure to not render the before and after focusable div elements in view
// mode. They're only needed to capture focus in edit mode.
const shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;
@@ -654,7 +354,7 @@ function Iframe( {
);
return (
-
+
{ containerResizeListener }
{
+ if ( ! isZoomedOut ) {
+ initialContainerWidthRef.current = containerWidth;
+ }
+ }, [ containerWidth, isZoomedOut ] );
+
+ const scaleContainerWidth = Math.max(
+ initialContainerWidthRef.current,
+ containerWidth
+ );
+
+ const scaleValue = isAutoScaled
+ ? calculateScale( {
+ frameSize,
+ containerWidth,
+ maxContainerWidth,
+ scaleContainerWidth,
+ } )
+ : scale;
+
+ /**
+ * The starting transition state for the zoom out animation.
+ * @type {import('react').RefObject
}
+ */
+ const transitionFromRef = useRef( {
+ scaleValue,
+ frameSize,
+ clientHeight: 0,
+ scrollTop: 0,
+ scrollHeight: 0,
+ } );
+
+ /**
+ * The ending transition state for the zoom out animation.
+ * @type {import('react').RefObject}
+ */
+ const transitionToRef = useRef( {
+ scaleValue,
+ frameSize,
+ clientHeight: 0,
+ scrollTop: 0,
+ scrollHeight: 0,
+ } );
+
+ /**
+ * Start the zoom out animation. This sets the necessary CSS variables
+ * for animating the canvas and returns the Animation object.
+ *
+ * @return {Animation} The animation object for the zoom out animation.
+ */
+ const startZoomOutAnimation = useCallback( () => {
+ const { scrollTop } = transitionFromRef.current;
+ const { scrollTop: scrollTopNext } = transitionToRef.current;
+
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top',
+ `${ scrollTop }px`
+ );
+
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top-next',
+ `${ scrollTopNext }px`
+ );
+
+ iframeDocument.documentElement.classList.add( 'zoom-out-animation' );
+
+ return iframeDocument.documentElement.animate(
+ getAnimationKeyframes(
+ transitionFromRef.current,
+ transitionToRef.current
+ ),
+ {
+ easing: 'cubic-bezier(0.46, 0.03, 0.52, 0.96)',
+ duration: 400,
+ }
+ );
+ }, [ iframeDocument ] );
+
+ /**
+ * Callback when the zoom out animation is finished.
+ * - Cleans up animations refs.
+ * - Adds final CSS vars for scale and frame size to preserve the state.
+ * - Removes the 'zoom-out-animation' class (which has the fixed positioning).
+ * - Sets the final scroll position after the canvas is no longer in fixed position.
+ * - Removes CSS vars related to the animation.
+ * - Sets the transitionFrom to the transitionTo state to be ready for the next animation.
+ */
+ const finishZoomOutAnimation = useCallback( () => {
+ startAnimationRef.current = false;
+ animationRef.current = null;
+
+ // Add our final scale and frame size now that the animation is done.
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scale',
+ transitionToRef.current.scaleValue
+ );
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-frame-size',
+ `${ transitionToRef.current.frameSize }px`
+ );
+
+ iframeDocument.documentElement.classList.remove( 'zoom-out-animation' );
+
+ // Set the final scroll position that was just animated to.
+ // Disable reason: Eslint isn't smart enough to know that this is a
+ // DOM element. https://github.com/facebook/react/issues/31483
+ // eslint-disable-next-line react-compiler/react-compiler
+ iframeDocument.documentElement.scrollTop =
+ transitionToRef.current.scrollTop;
+
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-scroll-top-next'
+ );
+
+ // Update previous values.
+ transitionFromRef.current = transitionToRef.current;
+ }, [ iframeDocument ] );
+
+ /**
+ * Runs when zoom out mode is toggled, and sets the startAnimation flag
+ * so the animation will start when the next useEffect runs. We _only_
+ * want to animate when the zoom out mode is toggled, not when the scale
+ * changes due to the container resizing.
+ */
+ useEffect( () => {
+ if ( ! iframeDocument ) {
+ return;
+ }
+
+ if ( isZoomedOut ) {
+ iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
+ }
+
+ startAnimationRef.current = true;
+
+ return () => {
+ iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
+ };
+ }, [ iframeDocument, isZoomedOut ] );
+
+ /**
+ * This handles:
+ * 1. Setting the correct scale and vars of the canvas when zoomed out
+ * 2. If zoom out mode has been toggled, runs the animation of zooming in/out
+ */
+ useEffect( () => {
+ if ( ! iframeDocument ) {
+ return;
+ }
+
+ // We need to update the appropriate scale to exit from. If sidebars have been opened since setting the
+ // original scale, we will snap to a much smaller scale due to the scale container immediately changing sizes when exiting.
+ if ( isAutoScaled && transitionFromRef.current.scaleValue !== 1 ) {
+ // We use containerWidth as the divisor, as scaleContainerWidth will always match the containerWidth when
+ // exiting.
+ transitionFromRef.current.scaleValue = calculateScale( {
+ frameSize: transitionFromRef.current.frameSize,
+ containerWidth,
+ maxContainerWidth,
+ scaleContainerWidth: containerWidth,
+ } );
+ }
+
+ // If we are not going to animate the transition, set the scale and frame size directly.
+ // If we are animating, these values will be set when the animation is finished.
+ // Example: Opening sidebars that reduce the scale of the canvas, but we don't want to
+ // animate the transition.
+ if ( ! startAnimationRef.current ) {
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scale',
+ scaleValue
+ );
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-frame-size',
+ `${ frameSize }px`
+ );
+ }
+
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-content-height',
+ `${ contentHeight }px`
+ );
+
+ const clientHeight = iframeDocument.documentElement.clientHeight;
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-inner-height',
+ `${ clientHeight }px`
+ );
+
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-container-width',
+ `${ containerWidth }px`
+ );
+ iframeDocument.documentElement.style.setProperty(
+ '--wp-block-editor-iframe-zoom-out-scale-container-width',
+ `${ scaleContainerWidth }px`
+ );
+
+ /**
+ * Handle the zoom out animation:
+ *
+ * - Get the current scrollTop position.
+ * - Calculate where the same scroll position is after scaling.
+ * - Apply fixed positioning to the canvas with a transform offset
+ * to keep the canvas centered.
+ * - Animate the scale and padding to the new scale and frame size.
+ * - After the animation is complete, remove the fixed positioning
+ * and set the scroll position that keeps everything centered.
+ */
+ if ( startAnimationRef.current ) {
+ // Don't allow a new transition to start again unless it was started by the zoom out mode changing.
+ startAnimationRef.current = false;
+
+ /**
+ * If we already have an animation running, reverse it.
+ */
+ if ( animationRef.current ) {
+ animationRef.current.reverse();
+ // Swap the transition to/from refs so that we set the correct values when
+ // finishZoomOutAnimation runs.
+ const tempTransitionFrom = transitionFromRef.current;
+ const tempTransitionTo = transitionToRef.current;
+ transitionFromRef.current = tempTransitionTo;
+ transitionToRef.current = tempTransitionFrom;
+ } else {
+ /**
+ * Start a new zoom animation.
+ */
+
+ // We can't trust the set value from contentHeight, as it was measured
+ // before the zoom out mode was changed. After zoom out mode is changed,
+ // appenders may appear or disappear, so we need to get the height from
+ // the iframe at this point when we're about to animate the zoom out.
+ // The iframe scrollTop, scrollHeight, and clientHeight will all be
+ // the most accurate.
+ transitionFromRef.current.clientHeight =
+ transitionFromRef.current.clientHeight ?? clientHeight;
+ transitionFromRef.current.scrollTop =
+ iframeDocument.documentElement.scrollTop;
+ transitionFromRef.current.scrollHeight =
+ iframeDocument.documentElement.scrollHeight;
+
+ transitionToRef.current = {
+ scaleValue,
+ frameSize,
+ clientHeight,
+ };
+ transitionToRef.current.scrollTop = computeScrollTopNext(
+ transitionFromRef.current,
+ transitionToRef.current
+ );
+
+ animationRef.current = startZoomOutAnimation();
+
+ // If the user prefers reduced motion, finish the animation immediately and set the final state.
+ if ( prefersReducedMotion ) {
+ finishZoomOutAnimation();
+ } else {
+ animationRef.current.onfinish = finishZoomOutAnimation;
+ }
+ }
+ }
+
+ return () => {
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-scale'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-frame-size'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-content-height'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-inner-height'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-container-width'
+ );
+ iframeDocument.documentElement.style.removeProperty(
+ '--wp-block-editor-iframe-zoom-out-scale-container-width'
+ );
+ };
+ }, [
+ startZoomOutAnimation,
+ finishZoomOutAnimation,
+ prefersReducedMotion,
+ isAutoScaled,
+ scaleValue,
+ frameSize,
+ iframeDocument,
+ contentHeight,
+ containerWidth,
+ maxContainerWidth,
+ scaleContainerWidth,
+ ] );
+
+ return {
+ isZoomedOut,
+ scaleContainerWidth,
+ contentResizeListener,
+ containerResizeListener,
+ };
+}
From ee17975f5cdbd62211c933d1db6854ac467a03d3 Mon Sep 17 00:00:00 2001
From: Nick Diego
Date: Wed, 27 Nov 2024 02:21:05 -0600
Subject: [PATCH 041/384] Social Link: Add contentOnly editing support (#66622)
Co-authored-by: ndiego
Co-authored-by: talldan
---
.../block-library/src/social-link/block.json | 6 ++-
.../block-library/src/social-link/edit.js | 40 +++++++++++++++++++
.../block-library/src/social-link/editor.scss | 5 +++
3 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/packages/block-library/src/social-link/block.json b/packages/block-library/src/social-link/block.json
index 37e8376f22ff09..667fd74b208f29 100644
--- a/packages/block-library/src/social-link/block.json
+++ b/packages/block-library/src/social-link/block.json
@@ -9,13 +9,15 @@
"textdomain": "default",
"attributes": {
"url": {
- "type": "string"
+ "type": "string",
+ "role": "content"
},
"service": {
"type": "string"
},
"label": {
- "type": "string"
+ "type": "string",
+ "role": "content"
},
"rel": {
"type": "string"
diff --git a/packages/block-library/src/social-link/edit.js b/packages/block-library/src/social-link/edit.js
index 14b0f11334a091..91f1e4170b33dd 100644
--- a/packages/block-library/src/social-link/edit.js
+++ b/packages/block-library/src/social-link/edit.js
@@ -10,18 +10,22 @@ import { DELETE, BACKSPACE, ENTER } from '@wordpress/keycodes';
import { useDispatch } from '@wordpress/data';
import {
+ BlockControls,
InspectorControls,
URLPopover,
URLInput,
+ useBlockEditingMode,
useBlockProps,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { useState, useRef } from '@wordpress/element';
import {
Button,
+ Dropdown,
PanelBody,
PanelRow,
TextControl,
+ ToolbarButton,
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
} from '@wordpress/components';
import { useMergeRefs } from '@wordpress/compose';
@@ -130,6 +134,7 @@ const SocialLinkEdit = ( {
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
+ const isContentOnlyMode = useBlockEditingMode() === 'contentOnly';
const IconComponent = getIconBySite( service );
const socialLinkName = getNameBySite( service );
@@ -154,6 +159,41 @@ const SocialLinkEdit = ( {
return (
<>
+ { isContentOnlyMode && showLabels && (
+ // Add an extra control to modify the label attribute when content only mode is active.
+ // With content only mode active, the inspector is hidden, so users need another way
+ // to edit this attribute.
+
+ (
+
+ { __( 'Text' ) }
+
+ ) }
+ renderContent={ () => (
+
+ setAttributes( { label: value } )
+ }
+ placeholder={ socialLinkName }
+ />
+ ) }
+ />
+
+ ) }
diff --git a/packages/block-library/src/social-link/editor.scss b/packages/block-library/src/social-link/editor.scss
index 2e93c9447cca8d..d61cf7c1a7cf56 100644
--- a/packages/block-library/src/social-link/editor.scss
+++ b/packages/block-library/src/social-link/editor.scss
@@ -38,3 +38,8 @@
:root :where(.wp-block-social-links.is-style-logos-only .wp-social-link button) {
padding: 0;
}
+
+.wp-block-social-link__toolbar_content_text {
+ // Corresponds to the size of the text control input in the block inspector.
+ width: 250px;
+}
From 0f6ab5d720aa70e5982e61a3bc8e3a31b0974ac9 Mon Sep 17 00:00:00 2001
From: dhruvang21 <105810308+dhruvang21@users.noreply.github.com>
Date: Wed, 27 Nov 2024 14:02:10 +0530
Subject: [PATCH 042/384] Try dark toolbar for the write mode (#66116)
Co-authored-by: dhruvang21
Co-authored-by: richtabor
Co-authored-by: youknowriad
Co-authored-by: draganescu
Co-authored-by: jameskoster
Co-authored-by: getdave
Co-authored-by: jasmussen
Co-authored-by: hanneslsm
---
.../src/components/block-toolbar/index.js | 8 ++++
.../src/components/block-tools/style.scss | 39 +++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/packages/block-editor/src/components/block-toolbar/index.js b/packages/block-editor/src/components/block-toolbar/index.js
index ea068d8126526c..63b2f6ad7f9a03 100644
--- a/packages/block-editor/src/components/block-toolbar/index.js
+++ b/packages/block-editor/src/components/block-toolbar/index.js
@@ -74,6 +74,8 @@ export function PrivateBlockToolbar( {
showGroupButtons,
showLockButtons,
showSwitchSectionStyleButton,
+ hasFixedToolbar,
+ isNavigationMode,
} = useSelect( ( select ) => {
const {
getBlockName,
@@ -85,8 +87,10 @@ export function PrivateBlockToolbar( {
getBlockAttributes,
getBlockParentsByBlockName,
getTemplateLock,
+ getSettings,
getParentSectionBlock,
isZoomOut,
+ isNavigationMode: _isNavigationMode,
} = unlock( select( blockEditorStore ) );
const selectedBlockClientIds = getSelectedBlockClientIds();
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
@@ -119,6 +123,7 @@ export function PrivateBlockToolbar( {
const _hasTemplateLock = selectedBlockClientIds.some(
( id ) => getTemplateLock( id ) === 'contentOnly'
);
+
return {
blockClientId: selectedBlockClientId,
blockClientIds: selectedBlockClientIds,
@@ -144,6 +149,8 @@ export function PrivateBlockToolbar( {
showGroupButtons: ! isZoomOut(),
showLockButtons: ! isZoomOut(),
showSwitchSectionStyleButton: isZoomOut(),
+ hasFixedToolbar: getSettings().hasFixedToolbar,
+ isNavigationMode: _isNavigationMode(),
};
}, [] );
@@ -170,6 +177,7 @@ export function PrivateBlockToolbar( {
// Shifts the toolbar to make room for the parent block selector.
const classes = clsx( 'block-editor-block-contextual-toolbar', {
'has-parent': showParentSelector,
+ 'is-inverted-toolbar': isNavigationMode && ! hasFixedToolbar,
} );
const innerClasses = clsx( 'block-editor-block-toolbar', {
diff --git a/packages/block-editor/src/components/block-tools/style.scss b/packages/block-editor/src/components/block-tools/style.scss
index b553d42668cf38..0ed9c138519d29 100644
--- a/packages/block-editor/src/components/block-tools/style.scss
+++ b/packages/block-editor/src/components/block-tools/style.scss
@@ -139,6 +139,45 @@
border-right-color: $gray-900;
}
+ .is-inverted-toolbar {
+ background-color: $gray-900;
+ color: $gray-100;
+
+ &.block-editor-block-contextual-toolbar {
+ border-color: $gray-800;
+ }
+
+ button {
+ color: $gray-300;
+
+ &:hover {
+ color: $white;
+ }
+
+ &:focus::before {
+ box-shadow: inset 0 0 0 1px $gray-900, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
+ }
+ }
+
+ .block-editor-block-parent-selector .block-editor-block-parent-selector__button {
+ border-color: $gray-800;
+ background-color: $gray-900;
+ }
+
+ .block-editor-block-switcher__toggle {
+ color: $gray-100;
+ }
+
+ .components-toolbar-group,
+ .components-toolbar {
+ border-right-color: $gray-800 !important;
+ }
+
+ .is-pressed {
+ color: var(--wp-admin-theme-color);
+ }
+ }
+
// Hide the block toolbar if the insertion point is shown.
&.is-insertion-point-visible {
visibility: hidden;
From 9904fd31d955bd9a75dc9005230310737939e90b Mon Sep 17 00:00:00 2001
From: Gutenberg Repository Automation
Date: Wed, 27 Nov 2024 10:18:41 +0000
Subject: [PATCH 043/384] Bump plugin version to 19.8.0-rc.1
---
gutenberg.php | 2 +-
package-lock.json | 4 ++--
package.json | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gutenberg.php b/gutenberg.php
index 3e4d6941b5a0f3..40c4e86fbb1bf5 100644
--- a/gutenberg.php
+++ b/gutenberg.php
@@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.6
* Requires PHP: 7.2
- * Version: 19.7.0
+ * Version: 19.8.0-rc.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
diff --git a/package-lock.json b/package-lock.json
index 1fc9131a33c8c3..7ff4ea41dc618e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "gutenberg",
- "version": "19.7.0",
+ "version": "19.8.0-rc.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gutenberg",
- "version": "19.7.0",
+ "version": "19.8.0-rc.1",
"hasInstallScript": true,
"license": "GPL-2.0-or-later",
"workspaces": [
diff --git a/package.json b/package.json
index 41102f867f0e22..53192f9af71b17 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "19.7.0",
+ "version": "19.8.0-rc.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
From 738d5bf9fdf7429a484835d2f9462bc448de1f59 Mon Sep 17 00:00:00 2001
From: Jorge Costa
Date: Wed, 27 Nov 2024 10:24:15 +0000
Subject: [PATCH 044/384] Fix: Duplicate template part refers to original name
instead of duplicated name. (#67329)
Co-authored-by: jorgefilipecosta
---
.../src/dataviews/actions/duplicate-template-part.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/packages/editor/src/dataviews/actions/duplicate-template-part.tsx b/packages/editor/src/dataviews/actions/duplicate-template-part.tsx
index 95e7e6bb672fcc..5f576ecdb58639 100644
--- a/packages/editor/src/dataviews/actions/duplicate-template-part.tsx
+++ b/packages/editor/src/dataviews/actions/duplicate-template-part.tsx
@@ -15,7 +15,7 @@ import type { Action } from '@wordpress/dataviews';
import { TEMPLATE_PART_POST_TYPE } from '../../store/constants';
import { CreateTemplatePartModalContents } from '../../components/create-template-part-modal';
import { getItemTitle } from './utils';
-import type { TemplatePart } from '../types';
+import type { Post, TemplatePart } from '../types';
const duplicateTemplatePart: Action< TemplatePart > = {
id: 'duplicate-template-part',
@@ -38,12 +38,12 @@ const duplicateTemplatePart: Action< TemplatePart > = {
);
}, [ item.content, item.blocks ] );
const { createSuccessNotice } = useDispatch( noticesStore );
- function onTemplatePartSuccess() {
+ function onTemplatePartSuccess( templatePart: Post ) {
createSuccessNotice(
sprintf(
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
_x( '"%s" duplicated.', 'template part' ),
- getItemTitle( item )
+ getItemTitle( templatePart )
),
{ type: 'snackbar', id: 'edit-site-patterns-success' }
);
From 14adfdb96499700e7096561042e0e073df241859 Mon Sep 17 00:00:00 2001
From: Riad Benguella
Date: Wed, 27 Nov 2024 11:29:09 +0100
Subject: [PATCH 045/384] DataViews: WP Specific build (#66825)
Co-authored-by: youknowriad
Co-authored-by: sirreal
Co-authored-by: luisherranz
Co-authored-by: jsnajdr
Co-authored-by: louwie17
Co-authored-by: ntsekouras
Co-authored-by: Tropicalista
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: manzoorwanijk
---
.gitignore | 1 +
package-lock.json | 1 +
package.json | 4 ++-
packages/dataviews/README.md | 2 ++
packages/dataviews/build.js | 33 +++++++++++++++++++
packages/dataviews/package.json | 17 ++++++++++
.../lib/util.js | 1 +
tools/webpack/packages.js | 1 +
8 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 packages/dataviews/build.js
diff --git a/.gitignore b/.gitignore
index 4cd1d9706b7370..1d75f9f429d869 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ build
build-module
build-style
build-types
+build-wp
node_modules
gutenberg.zip
coverage
diff --git a/package-lock.json b/package-lock.json
index 7ff4ea41dc618e..7e19737654b9aa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -84,6 +84,7 @@
"cssnano": "6.0.1",
"deep-freeze": "0.0.1",
"equivalent-key-map": "0.2.2",
+ "esbuild": "0.18.20",
"escape-html": "1.0.3",
"eslint-import-resolver-node": "0.3.4",
"eslint-plugin-eslint-comments": "3.1.2",
diff --git a/package.json b/package.json
index 53192f9af71b17..3ddcb981f6f6f7 100644
--- a/package.json
+++ b/package.json
@@ -93,6 +93,7 @@
"cssnano": "6.0.1",
"deep-freeze": "0.0.1",
"equivalent-key-map": "0.2.2",
+ "esbuild": "0.18.20",
"escape-html": "1.0.3",
"eslint-import-resolver-node": "0.3.4",
"eslint-plugin-eslint-comments": "3.1.2",
@@ -177,9 +178,10 @@
"build:package-types": "node ./bin/packages/validate-typescript-version.js && ( tsc --build || ( echo 'tsc failed. Try cleaning up first: `npm run clean:package-types`'; exit 1 ) ) && node ./bin/packages/check-build-type-declaration-files.js",
"prebuild:packages": "npm run clean:packages && npm run --if-present --workspaces build",
"build:packages": "npm run --silent build:package-types && node ./bin/packages/build.js",
+ "postbuild:packages": " npm run --if-present --workspaces build:wp",
"build:plugin-zip": "bash ./bin/build-plugin-zip.sh",
"clean:package-types": "tsc --build --clean && rimraf \"./packages/*/build-types\"",
- "clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"",
+ "clean:packages": "rimraf \"./packages/*/@(build|build-module|build-wp|build-style)\"",
"component-usage-stats": "node ./node_modules/react-scanner/bin/react-scanner -c ./react-scanner.config.js",
"dev": "cross-env NODE_ENV=development npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev:packages": "cross-env NODE_ENV=development concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"",
diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md
index 92426bf1e1f838..04b8a40ff3fa7e 100644
--- a/packages/dataviews/README.md
+++ b/packages/dataviews/README.md
@@ -17,6 +17,8 @@ npm install @wordpress/dataviews --save
+**Important note** If you're trying to use the `DataViews` component in a WordPress plugin or theme and you're building your scripts using the `@wordpress/scripts` package, you need to import the components from `@wordpress/dataviews/wp` instead of `@wordpress/dataviews`.
+
### Usage
The `DataViews` component receives data and some other configuration to render the dataset. It'll call the `onChangeView` callback every time the user has interacted with the dataset in some way (sorted, filtered, changed layout, etc.):
diff --git a/packages/dataviews/build.js b/packages/dataviews/build.js
new file mode 100644
index 00000000000000..582826d18c1847
--- /dev/null
+++ b/packages/dataviews/build.js
@@ -0,0 +1,33 @@
+/**
+ * External dependencies
+ */
+// eslint-disable-next-line import/no-extraneous-dependencies
+const esbuild = require( 'esbuild' );
+
+const wpExternals = {
+ name: 'wordpress-externals',
+ setup( build ) {
+ build.onResolve( { filter: /^@wordpress\// }, () => {
+ // Bundle wordpress packages
+ return { external: false };
+ } );
+ build.onResolve( { filter: /^\.[\.\/]/ }, () => {
+ // Bundle relative paths
+ return { external: false };
+ } );
+ build.onResolve( { filter: /.+/ }, ( args ) => {
+ // Mark everything else as external
+ return { path: args.path, external: true };
+ } );
+ },
+};
+
+esbuild.build( {
+ entryPoints: [ 'src/index.ts' ],
+ bundle: true,
+ outdir: 'build-wp',
+ plugins: [ wpExternals ],
+ jsx: 'automatic',
+ logLevel: 'info',
+ format: 'esm',
+} );
diff --git a/packages/dataviews/package.json b/packages/dataviews/package.json
index 80cfbf24be5651..06b13d1697a99b 100644
--- a/packages/dataviews/package.json
+++ b/packages/dataviews/package.json
@@ -24,6 +24,20 @@
},
"main": "build/index.js",
"module": "build-module/index.js",
+ "exports": {
+ ".": {
+ "types": "./build-types/index.d.ts",
+ "import": "./build-module/index.js"
+ },
+ "./wp": {
+ "types": "./build-types/index.d.ts",
+ "default": "./build-wp/index.js"
+ },
+ "./package.json": {
+ "default": "./package.json"
+ },
+ "./build-style/": "./build-style/"
+ },
"react-native": "src/index",
"wpScript": true,
"types": "build-types",
@@ -48,5 +62,8 @@
},
"publishConfig": {
"access": "public"
+ },
+ "scripts": {
+ "build:wp": "node build"
}
}
diff --git a/packages/dependency-extraction-webpack-plugin/lib/util.js b/packages/dependency-extraction-webpack-plugin/lib/util.js
index cc999860244760..49b16986cda814 100644
--- a/packages/dependency-extraction-webpack-plugin/lib/util.js
+++ b/packages/dependency-extraction-webpack-plugin/lib/util.js
@@ -5,6 +5,7 @@ const WORDPRESS_NAMESPACE = '@wordpress/';
// !!
const BUNDLED_PACKAGES = [
'@wordpress/dataviews',
+ '@wordpress/dataviews/wp',
'@wordpress/icons',
'@wordpress/interface',
'@wordpress/sync',
diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js
index 1dc396a4d75a15..4459cc063d0016 100644
--- a/tools/webpack/packages.js
+++ b/tools/webpack/packages.js
@@ -36,6 +36,7 @@ const WORDPRESS_NAMESPACE = '@wordpress/';
// !!
const BUNDLED_PACKAGES = [
'@wordpress/dataviews',
+ '@wordpress/dataviews/wp',
'@wordpress/icons',
'@wordpress/interface',
'@wordpress/sync',
From b9b422bfe4f334f05d81115d8b6a7ccacbdb2150 Mon Sep 17 00:00:00 2001
From: Gutenberg Repository Automation
Date: Wed, 27 Nov 2024 10:45:28 +0000
Subject: [PATCH 046/384] Update Changelog for 19.8.0-rc.1
---
changelog.txt | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 248 insertions(+)
diff --git a/changelog.txt b/changelog.txt
index 1a6b45a37fc7cf..bf13c6b273e9b6 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,253 @@
== Changelog ==
+= 19.8.0-rc.1 =
+
+
+## Changelog
+
+### Enhancements
+
+#### Block Library
+- Details block: Use summary content as default label. ([67217](https://github.com/WordPress/gutenberg/pull/67217))
+- Make social icon navigation one arrow keypress. ([64883](https://github.com/WordPress/gutenberg/pull/64883))
+- Page List : Add border and spacing support. ([66385](https://github.com/WordPress/gutenberg/pull/66385))
+- Query Loop block: Remove 'add new post' prompt in the sidebar. ([67189](https://github.com/WordPress/gutenberg/pull/67189))
+- Query block: Update Enhanced Pagination help text. ([67173](https://github.com/WordPress/gutenberg/pull/67173))
+- Social Link: Add contentOnly editing support. ([66622](https://github.com/WordPress/gutenberg/pull/66622))
+
+#### Components
+- Autocomplete: Increase option height. ([67214](https://github.com/WordPress/gutenberg/pull/67214))
+- CircularOptionPicker: Update Button sizes. ([67285](https://github.com/WordPress/gutenberg/pull/67285))
+- ColorPalette: Disable `Clear` button if there's no color value. ([67108](https://github.com/WordPress/gutenberg/pull/67108))
+- ColorPicker: Update sizes of format select and copy button. ([67093](https://github.com/WordPress/gutenberg/pull/67093))
+- ComboboxControl: Update reset button size. ([67215](https://github.com/WordPress/gutenberg/pull/67215))
+
+#### DataViews
+- Add density option to `table` layout. ([67170](https://github.com/WordPress/gutenberg/pull/67170))
+- DataForm: Enable fields to declare a different layout. ([66531](https://github.com/WordPress/gutenberg/pull/66531))
+- DataViews list layout: Hide actions menu when there is only one action and is primary. ([67015](https://github.com/WordPress/gutenberg/pull/67015))
+- DataViews table layout: Hide actions menu when there is only one action and is primary. ([67020](https://github.com/WordPress/gutenberg/pull/67020))
+- Reduce the size of action button in Grid layout. ([67032](https://github.com/WordPress/gutenberg/pull/67032))
+- DataViews: Allow register/unregister fields. ([67175](https://github.com/WordPress/gutenberg/pull/67175))
+
+#### Global Styles
+- Block Supports: Extend stabilization to common experimental block support flags. ([67018](https://github.com/WordPress/gutenberg/pull/67018))
+- Borders: Stabilize border block supports within block processing. ([66918](https://github.com/WordPress/gutenberg/pull/66918))
+- Site Editor > Styles: Open styles inspector when clicking preview canvas. ([66996](https://github.com/WordPress/gutenberg/pull/66996))
+
+#### Media
+- Block Editor: Add notice action to revert image to original after cropping. ([67314](https://github.com/WordPress/gutenberg/pull/67314))
+- Block Editor: Add success notices for image editing. ([67312](https://github.com/WordPress/gutenberg/pull/67312))
+
+#### REST API
+- Feature: Set editor rendering mode by post type. ([62304](https://github.com/WordPress/gutenberg/pull/62304))
+- Terms: Respect order specified by register_taxonomy(). ([67154](https://github.com/WordPress/gutenberg/pull/67154))
+
+#### Zoom Out
+- Leave help text regardless of zoom state. ([67132](https://github.com/WordPress/gutenberg/pull/67132))
+- Preserve footer template bar in zoom out. ([67135](https://github.com/WordPress/gutenberg/pull/67135))
+- Add section styles switch button in block toolbar in zoom out mode. ([67140](https://github.com/WordPress/gutenberg/pull/67140))
+
+#### Post Editor
+- Move default template types and template part areas to REST API. ([66459](https://github.com/WordPress/gutenberg/pull/66459))
+- Move `usePostFields` to `wordpress/editor` package. ([67024](https://github.com/WordPress/gutenberg/pull/67024))
+
+#### Site Editor
+- Blocks: Adds check for parent before showing convert to pattern button. ([66158](https://github.com/WordPress/gutenberg/pull/66158))
+- Try dark toolbar for the write mode. ([66116](https://github.com/WordPress/gutenberg/pull/66116))
+
+#### Design Tools
+- Heading: Hide border controls by default. ([67105](https://github.com/WordPress/gutenberg/pull/67105))
+- Font family preview in the font family picker. ([67118](https://github.com/WordPress/gutenberg/pull/67118))
+
+### Bug Fixes
+
+
+
+
+#### Block Library
+- Fix block mover clickable area. ([67261](https://github.com/WordPress/gutenberg/pull/67261))
+- Fix dropping media from inserter into Cover block. ([67056](https://github.com/WordPress/gutenberg/pull/67056))
+- Fix: Preserve Display Preview State in File Block. ([67263](https://github.com/WordPress/gutenberg/pull/67263))
+- Paragraph: Update condition for rendering Drop Cap for a selected block. ([67111](https://github.com/WordPress/gutenberg/pull/67111))
+- RSS block: Check for description field before rendering excerpt. ([66985](https://github.com/WordPress/gutenberg/pull/66985))
+- Resolve search block button text overlapping issue. ([66868](https://github.com/WordPress/gutenberg/pull/66868))
+- Social Links: Fix font family and weight inconsistency in editor. ([67204](https://github.com/WordPress/gutenberg/pull/67204))
+
+#### Components
+- Composite: Restore `Hover` and `Typeahead` functionality. ([67212](https://github.com/WordPress/gutenberg/pull/67212))
+- Menu.ItemHelpText: Better line breaking. ([67011](https://github.com/WordPress/gutenberg/pull/67011))
+- SlotFill: Fix a bug with storing stale fillProps. ([67000](https://github.com/WordPress/gutenberg/pull/67000))
+- Storybook: Fix DataViews layout. ([66999](https://github.com/WordPress/gutenberg/pull/66999))
+- `FormFileUpload`: Prevent HEIC and HEIF files from always being uploaded on Safari. ([67139](https://github.com/WordPress/gutenberg/pull/67139))
+
+#### Block Editor
+- Add all color palettes to select from editor panel. ([65148](https://github.com/WordPress/gutenberg/pull/65148))
+- Correctly mark Block Comment SlotFills private. ([67271](https://github.com/WordPress/gutenberg/pull/67271))
+- Fix media placeholder to only activate for media objects. ([66986](https://github.com/WordPress/gutenberg/pull/66986))
+- Rich text: Preserve comments. ([62128](https://github.com/WordPress/gutenberg/pull/62128))
+- Fix TS types for the editor package. ([67196](https://github.com/WordPress/gutenberg/pull/67196))
+- PostTitle: Exit early when post type doesn't support titles. ([67086](https://github.com/WordPress/gutenberg/pull/67086))
+
+#### Global Styles
+- Avoid zooming out when browsing styles if the preview mode is active. ([67190](https://github.com/WordPress/gutenberg/pull/67190))
+- Remove styles from blocks' previews. ([67144](https://github.com/WordPress/gutenberg/pull/67144))
+- Style panel: Use correct revisions count. ([67180](https://github.com/WordPress/gutenberg/pull/67180))
+- Theme JSON: Include block style variations in path only output of get_block_nodes. ([66948](https://github.com/WordPress/gutenberg/pull/66948))
+- Fix: Logic for Highlight/text-color format availability. ([65530](https://github.com/WordPress/gutenberg/pull/65530))
+- Fix complex variation selectors when using selectors API. ([67061](https://github.com/WordPress/gutenberg/pull/67061))
+#### Site Editor
+- Prevent Pre-Publish Panel from Displaying Incorrect Information After Navigating away. ([67010](https://github.com/WordPress/gutenberg/pull/67010))
+- Site Editor Sidebar: Fixed focus/hover style for navigation item buttons. ([67251](https://github.com/WordPress/gutenberg/pull/67251))
+- Site Hub: Fix height in mobile layout. ([67110](https://github.com/WordPress/gutenberg/pull/67110))
+- Site Editor: Styles: Fix inspector opening. ([67004](https://github.com/WordPress/gutenberg/pull/67004))
+- Improve accessibility and consistency of the 'Last modified' Revisions button. ([66606](https://github.com/WordPress/gutenberg/pull/66606))
+- Remove styles from examples. ([67098](https://github.com/WordPress/gutenberg/pull/67098))
+- Editor: Correctly select post title support in 'DocumentOutline'. ([67109](https://github.com/WordPress/gutenberg/pull/67109))
+
+
+#### DataViews
+- Fix action visibility logic. ([67197](https://github.com/WordPress/gutenberg/pull/67197))
+- Fix primary field misalignment in grid layout. ([66995](https://github.com/WordPress/gutenberg/pull/66995))
+- Fix spacing when combining combined fields. ([67226](https://github.com/WordPress/gutenberg/pull/67226))
+
+#### Zoom Out
+- Zoom In/Out to correct canvas location. ([66917](https://github.com/WordPress/gutenberg/pull/66917))
+- Zoom in/out to correct location. ([67126](https://github.com/WordPress/gutenberg/pull/67126))
+- Zoom Out: Disable zooming out when Distraction Free mode is activated. ([67028](https://github.com/WordPress/gutenberg/pull/67028))
+
+#### Layout
+- Allow flex justification controls to be disabled at the block level. ([67059](https://github.com/WordPress/gutenberg/pull/67059))
+- Show vertical alignment toolbar with allowSwitching enabled. ([67022](https://github.com/WordPress/gutenberg/pull/67022))
+
+#### Patterns
+- Fix: JavaScript error when pattern category is unregistered. ([67063](https://github.com/WordPress/gutenberg/pull/67063))
+- Block Locking: Remove edit locking for Synced Patterns. ([67021](https://github.com/WordPress/gutenberg/pull/67021))
+
+### Accessibility
+
+#### Components
+- ColorPicker: Add accessible label for copy button. ([67094](https://github.com/WordPress/gutenberg/pull/67094))
+- Modal: Increase size of the Close button. ([66792](https://github.com/WordPress/gutenberg/pull/66792))
+- DataViews: Fix focus loss when removing all filters or resetting. ([67003](https://github.com/WordPress/gutenberg/pull/67003))
+
+#### Block Library
+- Improve accessibility of the video track editor. ([66832](https://github.com/WordPress/gutenberg/pull/66832))
+- Navigation: Fix 'ariaLabel' block support. ([66943](https://github.com/WordPress/gutenberg/pull/66943))
+
+#### Post Editor
+- Improve the featured image UI when it cannot retrieve the image file and data. ([66936](https://github.com/WordPress/gutenberg/pull/66936))
+
+### Experiments
+
+- Inline Commenting: Update placement of reply input and add author info header. ([66580](https://github.com/WordPress/gutenberg/pull/66580))
+- Place "Write mode" functionality behind a Gutenberg experiment. ([67008](https://github.com/WordPress/gutenberg/pull/67008))
+
+### Documentation
+
+- Add documentation about required Core changes when updating minimum WordPress version. ([67167](https://github.com/WordPress/gutenberg/pull/67167))
+- BoxControl: Auto-generate readme. ([67284](https://github.com/WordPress/gutenberg/pull/67284))
+- Components contributing guide: Fix relative links. ([67323](https://github.com/WordPress/gutenberg/pull/67323))
+- DataViews: Reorganize documentation for actions. ([67159](https://github.com/WordPress/gutenberg/pull/67159))
+- Docs: Correct `@return` type in `block_core_query_disable_enhanced_pagination()`. ([67128](https://github.com/WordPress/gutenberg/pull/67128))
+- Feat: Storybook: Improve component organisation - Layout Category - Issue #66275. ([66659](https://github.com/WordPress/gutenberg/pull/66659))
+- Feat: Storybook: Improve component organisation - Selection & Input Category - Issue #66275. ([66635](https://github.com/WordPress/gutenberg/pull/66635))
+- GradientPicker: Auto-generate readme. ([67250](https://github.com/WordPress/gutenberg/pull/67250))
+- Icon: Auto-generate readme. ([67282](https://github.com/WordPress/gutenberg/pull/67282))
+- Icon: Improve `icon` prop usage documentation in Storybook. ([67280](https://github.com/WordPress/gutenberg/pull/67280))
+- Storybook: Restore stable components back into categories. ([67216](https://github.com/WordPress/gutenberg/pull/67216))
+- Update BlockMover Stories and README. ([66519](https://github.com/WordPress/gutenberg/pull/66519))
+- Update custom store readme to use thunks instead of controls. ([67006](https://github.com/WordPress/gutenberg/pull/67006))
+- Update versions-in-wordpress.md. ([67298](https://github.com/WordPress/gutenberg/pull/67298))
+
+### Code Quality
+
+- ESLint: Enable `eslint-plugin-react-compiler`. ([61788](https://github.com/WordPress/gutenberg/pull/61788))
+- Extract selectors from useResolveEditedEntity hook. ([67031](https://github.com/WordPress/gutenberg/pull/67031))
+- Pattern: Remove backward compatibility code for WordPress < 6.4. ([67131](https://github.com/WordPress/gutenberg/pull/67131))
+- Post fields: Move `author` from `edit-site` to `fields` package. ([66939](https://github.com/WordPress/gutenberg/pull/66939))
+- Posts DataViews: Refactor the router to use route registration. ([67160](https://github.com/WordPress/gutenberg/pull/67160))
+- Comments controller: Fix issue where comments are allowed when closed. ([66976](https://github.com/WordPress/gutenberg/pull/66976))
+- Fix fatal error in in_array call in post_type_default_rendering_mode. ([67225](https://github.com/WordPress/gutenberg/pull/67225))
+- Data: Add changelog for Redux update. ([66968](https://github.com/WordPress/gutenberg/pull/66968))
+
+#### Components
+- BorderBoxControl: Suppress redundant warnings for deprecated 36px size. ([67213](https://github.com/WordPress/gutenberg/pull/67213))
+- ComboboxControl : Deprecate 36px default size. ([66900](https://github.com/WordPress/gutenberg/pull/66900))
+- CustomGradientPicker: Prepare `Button`s for 40px default size. ([67286](https://github.com/WordPress/gutenberg/pull/67286))
+- Dashicons: Remove non-existent icons from type. ([67235](https://github.com/WordPress/gutenberg/pull/67235))
+- DimensionControl: Deprecate 36px default size. ([66705](https://github.com/WordPress/gutenberg/pull/66705))
+- Feat: Adds the deprecation warning for 36px default size in range control. ([66721](https://github.com/WordPress/gutenberg/pull/66721))
+- FontSizePicker : Deprecate 36px default size. ([66920](https://github.com/WordPress/gutenberg/pull/66920))
+- Remove createPrivateSlotFill function. ([67238](https://github.com/WordPress/gutenberg/pull/67238))
+- SlotFill: Fix dependencies of registration effects, deduplicate code. ([67071](https://github.com/WordPress/gutenberg/pull/67071))
+- SlotFill: Remove registration API from useSlot result. ([67070](https://github.com/WordPress/gutenberg/pull/67070))
+- SlotFill: Rewrite base Slot to functional, unify rerenderable refs. ([67153](https://github.com/WordPress/gutenberg/pull/67153))
+- TextControl: Deprecate 36px default size. ([66745](https://github.com/WordPress/gutenberg/pull/66745))
+- ToggleGroupControl : Deprecate 36px default size. ([66747](https://github.com/WordPress/gutenberg/pull/66747))
+
+#### Post Editor
+- ESLint: Bump `eslint-plugin-react-compiler` to latest beta. ([67106](https://github.com/WordPress/gutenberg/pull/67106))
+- Edit Post: Refactor 'MetaBoxVisibility' component. ([67265](https://github.com/WordPress/gutenberg/pull/67265))
+- Edit Post: Remove unused 'hasHistory' flag. ([67293](https://github.com/WordPress/gutenberg/pull/67293))
+- Editor: Update focus return handler for the Featured Image. ([67236](https://github.com/WordPress/gutenberg/pull/67236))
+- Make `BlockManager` component reusable. ([67052](https://github.com/WordPress/gutenberg/pull/67052))
+- Preferences: Use hooks instead of HoC in 'EnableCustomFieldsOption'. ([67023](https://github.com/WordPress/gutenberg/pull/67023))
+- Preferences: Use hooks instead of HoC in 'EnablePanelOption'. ([66994](https://github.com/WordPress/gutenberg/pull/66994))
+- Preferences: Use hooks instead of HoC in 'EnablePublishSidebarOption'. ([67002](https://github.com/WordPress/gutenberg/pull/67002))
+
+#### Block Library
+- Fix React Compiler error for shortcuts. ([67019](https://github.com/WordPress/gutenberg/pull/67019))
+- Home Link: Remove label attribute synchronization. ([67151](https://github.com/WordPress/gutenberg/pull/67151))
+- Use rems for Nav overlay left padding. ([67168](https://github.com/WordPress/gutenberg/pull/67168))
+- useBlockNameForPatterns: Refactor as a single useSelect call. ([67171](https://github.com/WordPress/gutenberg/pull/67171))
+- Navigation Block: Remove obsolete Block Hooks filters. ([64676](https://github.com/WordPress/gutenberg/pull/64676))
+- [mini] 🧹 remove obsolete rich text css. ([67264](https://github.com/WordPress/gutenberg/pull/67264))
+
+#### Global Styles
+- Don't call store actions during the render. ([67146](https://github.com/WordPress/gutenberg/pull/67146))
+- Edit Site: Fix settings mutation in `ScreenBlock`. ([67085](https://github.com/WordPress/gutenberg/pull/67085))
+- Remove unused 'Fragment' import. ([67104](https://github.com/WordPress/gutenberg/pull/67104))
+
+#### Block Editor
+- Block Manager: Make it a private component in the block editor package. ([67255](https://github.com/WordPress/gutenberg/pull/67255))
+- Inserter: Set initial active tab ID during render. ([67103](https://github.com/WordPress/gutenberg/pull/67103))
+
+#### Site Editor
+- Deprecate edited entity state. ([66965](https://github.com/WordPress/gutenberg/pull/66965))
+- Remove redundant style-edit route. ([67057](https://github.com/WordPress/gutenberg/pull/67057))
+
+### Tools
+
+#### Testing
+- Fix ESLint Jest reporting entire body of the test function rather than the identifier. ([67222](https://github.com/WordPress/gutenberg/pull/67222))
+- Fix typo in use-block-sync tests. ([67145](https://github.com/WordPress/gutenberg/pull/67145))
+- Migrate Gradle wrapper validation action. ([66602](https://github.com/WordPress/gutenberg/pull/66602))
+
+#### Plugin
+- Bump minimum required WordPress version to 6.6. ([67117](https://github.com/WordPress/gutenberg/pull/67117))
+- Add #7895 Core Backport PR to the changelog. ([67319](https://github.com/WordPress/gutenberg/pull/67319))
+- WP Scripts: Revert changes that inline CSS imports early in the build process. ([66975](https://github.com/WordPress/gutenberg/pull/66975))
+
+## First-time contributors
+
+The following PRs were merged by first-time contributors:
+
+- @AKSHAT2802: Add all color palettes to select from editor panel. ([65148](https://github.com/WordPress/gutenberg/pull/65148))
+- @benazeer-ben: Page List : Add border and spacing support. ([66385](https://github.com/WordPress/gutenberg/pull/66385))
+- @himanshupathak95: Menu.ItemHelpText: Better line breaking. ([67011](https://github.com/WordPress/gutenberg/pull/67011))
+- @SainathPoojary: Social Links: Fix font family and weight inconsistency in editor. ([67204](https://github.com/WordPress/gutenberg/pull/67204))
+- @sarthaknagoshe2002: Prevent Pre-Publish Panel from Displaying Incorrect Information After Navigating away. ([67010](https://github.com/WordPress/gutenberg/pull/67010))
+- @Sukhendu2002: Fix: Preserve Display Preview State in File Block. ([67263](https://github.com/WordPress/gutenberg/pull/67263))
+
+
+## Contributors
+
+The following contributors merged PRs in this release:
+
+@aaronrobertshaw @afercia @ajlende @akasunil @AKSHAT2802 @benazeer-ben @benniledl @carolinan @cbravobernal @desrosj @dhruvang21 @dougwollison @ellatrix @getdave @gigitux @gziolo @hbhalodia @himanshupathak95 @Infinite-Null @jeryj @jsnajdr @juanfra @louwie17 @Mamaduka @manzoorwanijk @matiasbenedetto @mcsf @michalczaplinski @miminari @mirka @ndiego @ntsekouras @oandregal @ockham @PARTHVATALIYA @ramonjd @SainathPoojary @SantosGuillamot @sarthaknagoshe2002 @snehapatil2001 @Soean @Sukhendu2002 @t-hamano @talldan @tellthemachines @TylerB24890 @tyxla @up1512001 @vipul0425 @yogeshbhutkar @youknowriad
+
+
= 19.7.0 =
## Changelog
From d82e1349d8581790febf2fdda7d1ca04d99cb18f Mon Sep 17 00:00:00 2001
From: Gutenberg Repository Automation
Date: Wed, 27 Nov 2024 10:41:47 +0000
Subject: [PATCH 047/384] Update changelog files
---
packages/a11y/CHANGELOG.md | 2 ++
packages/a11y/package.json | 2 +-
packages/annotations/CHANGELOG.md | 2 ++
packages/annotations/package.json | 2 +-
packages/api-fetch/CHANGELOG.md | 2 ++
packages/api-fetch/package.json | 2 +-
packages/autop/CHANGELOG.md | 2 ++
packages/autop/package.json | 2 +-
packages/babel-plugin-import-jsx-pragma/CHANGELOG.md | 2 ++
packages/babel-plugin-import-jsx-pragma/package.json | 2 +-
packages/babel-plugin-makepot/CHANGELOG.md | 2 ++
packages/babel-plugin-makepot/package.json | 2 +-
packages/babel-preset-default/CHANGELOG.md | 2 ++
packages/babel-preset-default/package.json | 2 +-
packages/base-styles/CHANGELOG.md | 2 ++
packages/base-styles/package.json | 2 +-
packages/blob/CHANGELOG.md | 2 ++
packages/blob/package.json | 2 +-
packages/block-directory/CHANGELOG.md | 2 ++
packages/block-directory/package.json | 2 +-
packages/block-editor/CHANGELOG.md | 2 ++
packages/block-editor/package.json | 2 +-
packages/block-library/CHANGELOG.md | 2 ++
packages/block-library/package.json | 2 +-
packages/block-serialization-default-parser/CHANGELOG.md | 2 ++
packages/block-serialization-default-parser/package.json | 2 +-
packages/block-serialization-spec-parser/CHANGELOG.md | 2 ++
packages/block-serialization-spec-parser/package.json | 2 +-
packages/blocks/CHANGELOG.md | 2 ++
packages/blocks/package.json | 2 +-
packages/browserslist-config/CHANGELOG.md | 2 ++
packages/browserslist-config/package.json | 2 +-
packages/commands/CHANGELOG.md | 2 ++
packages/commands/package.json | 2 +-
packages/components/CHANGELOG.md | 2 ++
packages/components/package.json | 2 +-
packages/compose/CHANGELOG.md | 2 ++
packages/compose/package.json | 2 +-
packages/core-commands/CHANGELOG.md | 2 ++
packages/core-commands/package.json | 2 +-
packages/core-data/CHANGELOG.md | 2 ++
packages/core-data/package.json | 2 +-
packages/create-block-interactive-template/package.json | 2 +-
packages/create-block-tutorial-template/CHANGELOG.md | 2 ++
packages/create-block-tutorial-template/package.json | 2 +-
packages/create-block/CHANGELOG.md | 2 ++
packages/create-block/package.json | 2 +-
packages/customize-widgets/CHANGELOG.md | 2 ++
packages/customize-widgets/package.json | 2 +-
packages/data-controls/CHANGELOG.md | 2 ++
packages/data-controls/package.json | 2 +-
packages/data/CHANGELOG.md | 2 ++
packages/data/package.json | 2 +-
packages/dataviews/CHANGELOG.md | 2 ++
packages/dataviews/package.json | 2 +-
packages/date/CHANGELOG.md | 2 ++
packages/date/package.json | 2 +-
packages/dependency-extraction-webpack-plugin/CHANGELOG.md | 2 ++
packages/dependency-extraction-webpack-plugin/package.json | 2 +-
packages/deprecated/CHANGELOG.md | 2 ++
packages/deprecated/package.json | 2 +-
packages/docgen/CHANGELOG.md | 2 ++
packages/docgen/package.json | 2 +-
packages/dom-ready/CHANGELOG.md | 2 ++
packages/dom-ready/package.json | 2 +-
packages/dom/CHANGELOG.md | 2 ++
packages/dom/package.json | 2 +-
packages/e2e-test-utils-playwright/CHANGELOG.md | 2 ++
packages/e2e-test-utils-playwright/package.json | 2 +-
packages/e2e-test-utils/CHANGELOG.md | 2 ++
packages/e2e-test-utils/package.json | 2 +-
packages/e2e-tests/CHANGELOG.md | 2 ++
packages/e2e-tests/package.json | 2 +-
packages/edit-post/CHANGELOG.md | 2 ++
packages/edit-post/package.json | 2 +-
packages/edit-site/CHANGELOG.md | 2 ++
packages/edit-site/package.json | 2 +-
packages/edit-widgets/CHANGELOG.md | 2 ++
packages/edit-widgets/package.json | 2 +-
packages/editor/CHANGELOG.md | 2 ++
packages/editor/package.json | 2 +-
packages/element/CHANGELOG.md | 2 ++
packages/element/package.json | 2 +-
packages/env/CHANGELOG.md | 2 ++
packages/env/package.json | 2 +-
packages/escape-html/CHANGELOG.md | 2 ++
packages/escape-html/package.json | 2 +-
packages/eslint-plugin/CHANGELOG.md | 2 ++
packages/eslint-plugin/package.json | 2 +-
packages/fields/CHANGELOG.md | 2 ++
packages/fields/package.json | 2 +-
packages/format-library/CHANGELOG.md | 2 ++
packages/format-library/package.json | 2 +-
packages/hooks/CHANGELOG.md | 2 ++
packages/hooks/package.json | 2 +-
packages/html-entities/CHANGELOG.md | 2 ++
packages/html-entities/package.json | 2 +-
packages/i18n/CHANGELOG.md | 2 ++
packages/i18n/package.json | 2 +-
packages/icons/CHANGELOG.md | 2 ++
packages/icons/package.json | 2 +-
packages/interactivity-router/CHANGELOG.md | 2 ++
packages/interactivity-router/package.json | 2 +-
packages/interactivity/CHANGELOG.md | 2 ++
packages/interactivity/package.json | 2 +-
packages/interface/CHANGELOG.md | 2 ++
packages/interface/package.json | 2 +-
packages/is-shallow-equal/CHANGELOG.md | 2 ++
packages/is-shallow-equal/package.json | 2 +-
packages/jest-console/CHANGELOG.md | 2 ++
packages/jest-console/package.json | 2 +-
packages/jest-preset-default/CHANGELOG.md | 2 ++
packages/jest-preset-default/package.json | 2 +-
packages/jest-puppeteer-axe/CHANGELOG.md | 2 ++
packages/jest-puppeteer-axe/package.json | 2 +-
packages/keyboard-shortcuts/CHANGELOG.md | 2 ++
packages/keyboard-shortcuts/package.json | 2 +-
packages/keycodes/CHANGELOG.md | 2 ++
packages/keycodes/package.json | 2 +-
packages/lazy-import/CHANGELOG.md | 2 ++
packages/lazy-import/package.json | 2 +-
packages/list-reusable-blocks/CHANGELOG.md | 2 ++
packages/list-reusable-blocks/package.json | 2 +-
packages/media-utils/CHANGELOG.md | 2 ++
packages/media-utils/package.json | 2 +-
packages/notices/CHANGELOG.md | 2 ++
packages/notices/package.json | 2 +-
packages/npm-package-json-lint-config/CHANGELOG.md | 2 ++
packages/npm-package-json-lint-config/package.json | 2 +-
packages/nux/CHANGELOG.md | 2 ++
packages/nux/package.json | 2 +-
packages/patterns/CHANGELOG.md | 2 ++
packages/patterns/package.json | 2 +-
packages/plugins/CHANGELOG.md | 2 ++
packages/plugins/package.json | 2 +-
packages/postcss-plugins-preset/CHANGELOG.md | 2 ++
packages/postcss-plugins-preset/package.json | 2 +-
packages/postcss-themes/CHANGELOG.md | 2 ++
packages/postcss-themes/package.json | 2 +-
packages/preferences-persistence/CHANGELOG.md | 2 ++
packages/preferences-persistence/package.json | 2 +-
packages/preferences/CHANGELOG.md | 2 ++
packages/preferences/package.json | 2 +-
packages/prettier-config/CHANGELOG.md | 2 ++
packages/prettier-config/package.json | 2 +-
packages/primitives/CHANGELOG.md | 2 ++
packages/primitives/package.json | 2 +-
packages/priority-queue/CHANGELOG.md | 2 ++
packages/priority-queue/package.json | 2 +-
packages/private-apis/CHANGELOG.md | 2 ++
packages/private-apis/package.json | 2 +-
packages/project-management-automation/CHANGELOG.md | 2 ++
packages/project-management-automation/package.json | 2 +-
packages/react-i18n/CHANGELOG.md | 2 ++
packages/react-i18n/package.json | 2 +-
packages/readable-js-assets-webpack-plugin/CHANGELOG.md | 2 ++
packages/readable-js-assets-webpack-plugin/package.json | 2 +-
packages/redux-routine/CHANGELOG.md | 2 ++
packages/redux-routine/package.json | 2 +-
packages/reusable-blocks/CHANGELOG.md | 2 ++
packages/reusable-blocks/package.json | 2 +-
packages/rich-text/CHANGELOG.md | 2 ++
packages/rich-text/package.json | 2 +-
packages/router/CHANGELOG.md | 2 ++
packages/router/package.json | 2 +-
packages/scripts/CHANGELOG.md | 2 ++
packages/scripts/package.json | 2 +-
packages/server-side-render/CHANGELOG.md | 2 ++
packages/server-side-render/package.json | 2 +-
packages/shortcode/CHANGELOG.md | 2 ++
packages/shortcode/package.json | 2 +-
packages/style-engine/CHANGELOG.md | 2 ++
packages/style-engine/package.json | 2 +-
packages/stylelint-config/CHANGELOG.md | 2 ++
packages/stylelint-config/package.json | 2 +-
packages/sync/CHANGELOG.md | 2 ++
packages/sync/package.json | 2 +-
packages/token-list/CHANGELOG.md | 2 ++
packages/token-list/package.json | 2 +-
packages/undo-manager/CHANGELOG.md | 2 ++
packages/undo-manager/package.json | 2 +-
packages/url/CHANGELOG.md | 2 ++
packages/url/package.json | 2 +-
packages/viewport/CHANGELOG.md | 2 ++
packages/viewport/package.json | 2 +-
packages/warning/CHANGELOG.md | 2 ++
packages/warning/package.json | 2 +-
packages/widgets/CHANGELOG.md | 2 ++
packages/widgets/package.json | 2 +-
packages/wordcount/CHANGELOG.md | 2 ++
packages/wordcount/package.json | 2 +-
191 files changed, 286 insertions(+), 96 deletions(-)
diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md
index dfd1e62906f9f4..57b52651acc787 100644
--- a/packages/a11y/CHANGELOG.md
+++ b/packages/a11y/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/a11y/package.json b/packages/a11y/package.json
index 1fcffd9cdfe69f..2ad91f1131b941 100644
--- a/packages/a11y/package.json
+++ b/packages/a11y/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/a11y",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Accessibility (a11y) utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md
index 07e9267e5b04c5..64bf565f8dd52b 100644
--- a/packages/annotations/CHANGELOG.md
+++ b/packages/annotations/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.13.0 (2024-11-27)
+
## 3.12.0 (2024-11-16)
## 3.11.0 (2024-10-30)
diff --git a/packages/annotations/package.json b/packages/annotations/package.json
index 269c16d159e9f6..4c3c849fe7178a 100644
--- a/packages/annotations/package.json
+++ b/packages/annotations/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/annotations",
- "version": "3.12.0",
+ "version": "3.13.0-prerelease",
"description": "Annotate content in the Gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md
index e2ba79548592ec..da4df186a8cd2f 100644
--- a/packages/api-fetch/CHANGELOG.md
+++ b/packages/api-fetch/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.13.0 (2024-11-27)
+
## 7.12.0 (2024-11-16)
## 7.11.0 (2024-10-30)
diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json
index 07d90568dc9413..8e8909c54f543b 100644
--- a/packages/api-fetch/package.json
+++ b/packages/api-fetch/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/api-fetch",
- "version": "7.12.0",
+ "version": "7.13.0-prerelease",
"description": "Utility to make WordPress REST API requests.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/autop/CHANGELOG.md b/packages/autop/CHANGELOG.md
index dd9879ca23b746..caec56341262a1 100644
--- a/packages/autop/CHANGELOG.md
+++ b/packages/autop/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/autop/package.json b/packages/autop/package.json
index 60b7102850020a..5a77142235ad77 100644
--- a/packages/autop/package.json
+++ b/packages/autop/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/autop",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "WordPress's automatic paragraph functions `autop` and `removep`.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md
index 38a36491fe9a81..b7030c3e4140a7 100644
--- a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md
+++ b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json
index 231886784bd3f0..60583b94327a51 100644
--- a/packages/babel-plugin-import-jsx-pragma/package.json
+++ b/packages/babel-plugin-import-jsx-pragma/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-plugin-import-jsx-pragma",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-plugin-makepot/CHANGELOG.md b/packages/babel-plugin-makepot/CHANGELOG.md
index 1e22ee8b4eabb4..00efceb28c075d 100644
--- a/packages/babel-plugin-makepot/CHANGELOG.md
+++ b/packages/babel-plugin-makepot/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json
index 4f18f8556d68dd..30c91ac1b58da6 100644
--- a/packages/babel-plugin-makepot/package.json
+++ b/packages/babel-plugin-makepot/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-plugin-makepot",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "WordPress Babel internationalization (i18n) plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md
index 8cce12417d2e26..4f5ef33b51298b 100644
--- a/packages/babel-preset-default/CHANGELOG.md
+++ b/packages/babel-preset-default/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 8.13.0 (2024-11-27)
+
## 8.12.0 (2024-11-16)
## 8.11.0 (2024-10-30)
diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json
index b305500dc20795..44057a5f6171af 100644
--- a/packages/babel-preset-default/package.json
+++ b/packages/babel-preset-default/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-preset-default",
- "version": "8.12.0",
+ "version": "8.13.0-prerelease",
"description": "Default Babel preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md
index 67fdcfa2424530..196c6573d7b872 100644
--- a/packages/base-styles/CHANGELOG.md
+++ b/packages/base-styles/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json
index bcdb19206b39e9..21667917ac7fe1 100644
--- a/packages/base-styles/package.json
+++ b/packages/base-styles/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/base-styles",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Base SCSS utilities and variables for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md
index 2edfa51064106f..2d518db27bb40a 100644
--- a/packages/blob/CHANGELOG.md
+++ b/packages/blob/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/blob/package.json b/packages/blob/package.json
index 2134bcd21e9346..d72f180e4b8bf6 100644
--- a/packages/blob/package.json
+++ b/packages/blob/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blob",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Blob utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-directory/CHANGELOG.md b/packages/block-directory/CHANGELOG.md
index 37b6b6b3ece40a..ff4fac035eaa06 100644
--- a/packages/block-directory/CHANGELOG.md
+++ b/packages/block-directory/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json
index a005e5be7cd60b..efc6a16ed3798e 100644
--- a/packages/block-directory/package.json
+++ b/packages/block-directory/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-directory",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Extend editor with block directory features to search, download and install blocks.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md
index 3c1e63c75c75ff..87dc0459bfb715 100644
--- a/packages/block-editor/CHANGELOG.md
+++ b/packages/block-editor/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 14.8.0 (2024-11-27)
+
## 14.7.0 (2024-11-16)
## 14.6.0 (2024-10-30)
diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json
index 031b34933691a3..608f079366e614 100644
--- a/packages/block-editor/package.json
+++ b/packages/block-editor/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-editor",
- "version": "14.7.0",
+ "version": "14.8.0-prerelease",
"description": "Generic block editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md
index cab58f72ff70ee..47986f12e0fb54 100644
--- a/packages/block-library/CHANGELOG.md
+++ b/packages/block-library/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 9.13.0 (2024-11-27)
+
## 9.12.0 (2024-11-16)
## 9.11.0 (2024-10-30)
diff --git a/packages/block-library/package.json b/packages/block-library/package.json
index e507ef36367268..c16a61ac32ec13 100644
--- a/packages/block-library/package.json
+++ b/packages/block-library/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-library",
- "version": "9.12.0",
+ "version": "9.13.0-prerelease",
"description": "Block library for the WordPress editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-serialization-default-parser/CHANGELOG.md b/packages/block-serialization-default-parser/CHANGELOG.md
index 5542b052e1037a..c7b27f7760d14d 100644
--- a/packages/block-serialization-default-parser/CHANGELOG.md
+++ b/packages/block-serialization-default-parser/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/block-serialization-default-parser/package.json b/packages/block-serialization-default-parser/package.json
index a448804ae9ba8c..a8d0084d43f0a8 100644
--- a/packages/block-serialization-default-parser/package.json
+++ b/packages/block-serialization-default-parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-serialization-default-parser",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Block serialization specification parser for WordPress posts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-serialization-spec-parser/CHANGELOG.md b/packages/block-serialization-spec-parser/CHANGELOG.md
index 3ff70ac28cc19b..b23ec04a39a21e 100644
--- a/packages/block-serialization-spec-parser/CHANGELOG.md
+++ b/packages/block-serialization-spec-parser/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json
index 30aa5679a7c01a..04e657055a8587 100644
--- a/packages/block-serialization-spec-parser/package.json
+++ b/packages/block-serialization-spec-parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-serialization-spec-parser",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Block serialization specification parser for WordPress posts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md
index 216918b44c0b80..0fd1b8af928abd 100644
--- a/packages/blocks/CHANGELOG.md
+++ b/packages/blocks/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 14.2.0 (2024-11-27)
+
## 14.1.0 (2024-11-16)
## 14.0.0 (2024-10-30)
diff --git a/packages/blocks/package.json b/packages/blocks/package.json
index 15102734ff34f1..51d80302c4f184 100644
--- a/packages/blocks/package.json
+++ b/packages/blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blocks",
- "version": "14.1.0",
+ "version": "14.2.0-prerelease",
"description": "Block API for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/browserslist-config/CHANGELOG.md b/packages/browserslist-config/CHANGELOG.md
index 64a49c04621840..aa13654936f3dc 100644
--- a/packages/browserslist-config/CHANGELOG.md
+++ b/packages/browserslist-config/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json
index f5b60a9bb7e783..bc1051eb99524b 100644
--- a/packages/browserslist-config/package.json
+++ b/packages/browserslist-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/browserslist-config",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "WordPress Browserslist shared configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/commands/CHANGELOG.md b/packages/commands/CHANGELOG.md
index e1e995f9710aeb..40ce6d4fc65cfa 100644
--- a/packages/commands/CHANGELOG.md
+++ b/packages/commands/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/commands/package.json b/packages/commands/package.json
index 0f252c5e90ade3..5d6732a6c4b80e 100644
--- a/packages/commands/package.json
+++ b/packages/commands/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/commands",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "Handles the commands menu.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index c9b09c40350232..feff5ddc975356 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 28.13.0 (2024-11-27)
+
### Deprecations
- `DimensionControl`: Deprecate 36px default size ([#66705](https://github.com/WordPress/gutenberg/pull/66705)).
diff --git a/packages/components/package.json b/packages/components/package.json
index b297b31e544f98..2a3978e4193734 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/components",
- "version": "28.12.0",
+ "version": "28.13.0-prerelease",
"description": "UI components for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/compose/CHANGELOG.md b/packages/compose/CHANGELOG.md
index 897ea34a88ae7f..739a5f8831cb35 100644
--- a/packages/compose/CHANGELOG.md
+++ b/packages/compose/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.13.0 (2024-11-27)
+
## 7.12.0 (2024-11-16)
## 7.11.0 (2024-10-30)
diff --git a/packages/compose/package.json b/packages/compose/package.json
index 596a50405ad476..bb84c5c16267fe 100644
--- a/packages/compose/package.json
+++ b/packages/compose/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/compose",
- "version": "7.12.0",
+ "version": "7.13.0-prerelease",
"description": "WordPress higher-order components (HOCs).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/core-commands/CHANGELOG.md b/packages/core-commands/CHANGELOG.md
index 8928305ce32e57..af0a385fa6275c 100644
--- a/packages/core-commands/CHANGELOG.md
+++ b/packages/core-commands/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/core-commands/package.json b/packages/core-commands/package.json
index 172431aa3d0913..9d21b1ba3b68eb 100644
--- a/packages/core-commands/package.json
+++ b/packages/core-commands/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/core-commands",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "WordPress core reusable commands.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/core-data/CHANGELOG.md b/packages/core-data/CHANGELOG.md
index d2744383594baa..35b1ab8e2957ed 100644
--- a/packages/core-data/CHANGELOG.md
+++ b/packages/core-data/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.13.0 (2024-11-27)
+
## 7.12.0 (2024-11-16)
## 7.11.0 (2024-10-30)
diff --git a/packages/core-data/package.json b/packages/core-data/package.json
index 66a52adfe1ce92..78fc7076a8d020 100644
--- a/packages/core-data/package.json
+++ b/packages/core-data/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/core-data",
- "version": "7.12.0",
+ "version": "7.13.0-prerelease",
"description": "Access to and manipulation of core WordPress entities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/create-block-interactive-template/package.json b/packages/create-block-interactive-template/package.json
index 94e5f3b3ed4e0b..9cb957186c7f73 100644
--- a/packages/create-block-interactive-template/package.json
+++ b/packages/create-block-interactive-template/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/create-block-interactive-template",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "Template for @wordpress/create-block to create interactive blocks with the Interactivity API.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/create-block-tutorial-template/CHANGELOG.md b/packages/create-block-tutorial-template/CHANGELOG.md
index 9a9e8e8d7b1ab6..f219c74dceca6b 100644
--- a/packages/create-block-tutorial-template/CHANGELOG.md
+++ b/packages/create-block-tutorial-template/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json
index 31c91064ddbaa6..c291096222b427 100644
--- a/packages/create-block-tutorial-template/package.json
+++ b/packages/create-block-tutorial-template/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/create-block-tutorial-template",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "This is a template for @wordpress/create-block that creates an example 'Copyright Date' block. This block is used in the official WordPress block development Quick Start Guide.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md
index 075386562f3841..e6c4a2ee166d60 100644
--- a/packages/create-block/CHANGELOG.md
+++ b/packages/create-block/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.56.0 (2024-11-27)
+
## 4.55.0 (2024-11-16)
## 4.54.0 (2024-10-30)
diff --git a/packages/create-block/package.json b/packages/create-block/package.json
index edee3d421de957..53d34f8c3109d9 100644
--- a/packages/create-block/package.json
+++ b/packages/create-block/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/create-block",
- "version": "4.55.0",
+ "version": "4.56.0-prerelease",
"description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/customize-widgets/CHANGELOG.md b/packages/customize-widgets/CHANGELOG.md
index 41c9f2257f0a4d..6b6735c6fadd9c 100644
--- a/packages/customize-widgets/CHANGELOG.md
+++ b/packages/customize-widgets/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json
index 9c1e117d2145e8..c482fdd813dd03 100644
--- a/packages/customize-widgets/package.json
+++ b/packages/customize-widgets/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/customize-widgets",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Widgets blocks in Customizer Module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/data-controls/CHANGELOG.md b/packages/data-controls/CHANGELOG.md
index 5b5c2e179f8bd3..92eb6f83394213 100644
--- a/packages/data-controls/CHANGELOG.md
+++ b/packages/data-controls/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json
index 0977dbb27f988c..9a7a560bdac51f 100644
--- a/packages/data-controls/package.json
+++ b/packages/data-controls/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/data-controls",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "A set of common controls for the @wordpress/data api.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/data/CHANGELOG.md b/packages/data/CHANGELOG.md
index 0537039794505f..89bee010837e26 100644
--- a/packages/data/CHANGELOG.md
+++ b/packages/data/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 10.13.0 (2024-11-27)
+
### Enhancements
- Upgrade `redux` dependency to `^5.0.1` ([#66966](https://github.com/WordPress/gutenberg/pull/66966))
diff --git a/packages/data/package.json b/packages/data/package.json
index e325b82357b955..ff68d293c2ac7b 100644
--- a/packages/data/package.json
+++ b/packages/data/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/data",
- "version": "10.12.0",
+ "version": "10.13.0-prerelease",
"description": "Data module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dataviews/CHANGELOG.md b/packages/dataviews/CHANGELOG.md
index 7fdcdf2808e812..72f08b987a3868 100644
--- a/packages/dataviews/CHANGELOG.md
+++ b/packages/dataviews/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.9.0 (2024-11-27)
+
### Bug Fixes
- Fix focus loss when removing all filters or resetting ([#67003](https://github.com/WordPress/gutenberg/pull/67003)).
diff --git a/packages/dataviews/package.json b/packages/dataviews/package.json
index 06b13d1697a99b..b57ead3e54ea9b 100644
--- a/packages/dataviews/package.json
+++ b/packages/dataviews/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dataviews",
- "version": "4.8.0",
+ "version": "4.9.0-prerelease",
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/date/CHANGELOG.md b/packages/date/CHANGELOG.md
index a385b61dc17281..21ddf975064034 100644
--- a/packages/date/CHANGELOG.md
+++ b/packages/date/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/date/package.json b/packages/date/package.json
index 0d98f3954d92d0..b3b7332bb8bf14 100644
--- a/packages/date/package.json
+++ b/packages/date/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/date",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Date module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md
index ee79a75513b996..4784e2105f6fb1 100644
--- a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md
+++ b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/dependency-extraction-webpack-plugin/package.json b/packages/dependency-extraction-webpack-plugin/package.json
index f168f379aa819d..8387d658d5aac9 100644
--- a/packages/dependency-extraction-webpack-plugin/package.json
+++ b/packages/dependency-extraction-webpack-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dependency-extraction-webpack-plugin",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "Extract WordPress script dependencies from webpack bundles.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/deprecated/CHANGELOG.md b/packages/deprecated/CHANGELOG.md
index 861aaa9ad69f25..3ec1c350bc2d0d 100644
--- a/packages/deprecated/CHANGELOG.md
+++ b/packages/deprecated/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/deprecated/package.json b/packages/deprecated/package.json
index 11d351d17acb49..df43ff9f0639f5 100644
--- a/packages/deprecated/package.json
+++ b/packages/deprecated/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/deprecated",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Deprecation utility for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/docgen/CHANGELOG.md b/packages/docgen/CHANGELOG.md
index 7c92855715e325..ea879d77247ac2 100644
--- a/packages/docgen/CHANGELOG.md
+++ b/packages/docgen/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/docgen/package.json b/packages/docgen/package.json
index f9df5281bd5259..e5ec91f0dedf08 100644
--- a/packages/docgen/package.json
+++ b/packages/docgen/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/docgen",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "Autogenerate public API documentation from exports and JSDoc comments.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dom-ready/CHANGELOG.md b/packages/dom-ready/CHANGELOG.md
index 2b6647faa8332b..27499bdb048a1c 100644
--- a/packages/dom-ready/CHANGELOG.md
+++ b/packages/dom-ready/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json
index 7302df37787ca5..5ddc5085fa901a 100644
--- a/packages/dom-ready/package.json
+++ b/packages/dom-ready/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dom-ready",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Execute callback after the DOM is loaded.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dom/CHANGELOG.md b/packages/dom/CHANGELOG.md
index f44165f23fd515..0ce2a24565d0d5 100644
--- a/packages/dom/CHANGELOG.md
+++ b/packages/dom/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/dom/package.json b/packages/dom/package.json
index a717c1ee0b9a5d..1bf549364796ca 100644
--- a/packages/dom/package.json
+++ b/packages/dom/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dom",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "DOM utilities module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/e2e-test-utils-playwright/CHANGELOG.md b/packages/e2e-test-utils-playwright/CHANGELOG.md
index 968963de3b79d8..b1a35757f7496a 100644
--- a/packages/e2e-test-utils-playwright/CHANGELOG.md
+++ b/packages/e2e-test-utils-playwright/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/e2e-test-utils-playwright/package.json b/packages/e2e-test-utils-playwright/package.json
index 43ef469ac88471..3bca976c076b74 100644
--- a/packages/e2e-test-utils-playwright/package.json
+++ b/packages/e2e-test-utils-playwright/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/e2e-test-utils-playwright",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "End-To-End (E2E) test utils for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/e2e-test-utils/CHANGELOG.md b/packages/e2e-test-utils/CHANGELOG.md
index 1974f72e3fb215..24f73664bd7dcc 100644
--- a/packages/e2e-test-utils/CHANGELOG.md
+++ b/packages/e2e-test-utils/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 11.13.0 (2024-11-27)
+
## 11.12.0 (2024-11-16)
## 11.11.0 (2024-10-30)
diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json
index ee7a4deaa2ee94..7663ab163c2619 100644
--- a/packages/e2e-test-utils/package.json
+++ b/packages/e2e-test-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/e2e-test-utils",
- "version": "11.12.0",
+ "version": "11.13.0-prerelease",
"description": "End-To-End (E2E) test utils for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/e2e-tests/CHANGELOG.md b/packages/e2e-tests/CHANGELOG.md
index e6f405a0d21115..0148f8b0a51ddb 100644
--- a/packages/e2e-tests/CHANGELOG.md
+++ b/packages/e2e-tests/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 8.13.0 (2024-11-27)
+
## 8.12.0 (2024-11-16)
## 8.11.0 (2024-10-30)
diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json
index ee87ea8430654d..3ef68396fc1ce5 100644
--- a/packages/e2e-tests/package.json
+++ b/packages/e2e-tests/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/e2e-tests",
- "version": "8.12.0",
+ "version": "8.13.0-prerelease",
"description": "End-To-End (E2E) tests for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-post/CHANGELOG.md b/packages/edit-post/CHANGELOG.md
index 56f37b13ae6225..47933552311d10 100644
--- a/packages/edit-post/CHANGELOG.md
+++ b/packages/edit-post/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 8.13.0 (2024-11-27)
+
## 8.12.0 (2024-11-16)
## 8.11.0 (2024-10-30)
diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json
index ba2bdea38bbe43..bd8c5731ef7ccd 100644
--- a/packages/edit-post/package.json
+++ b/packages/edit-post/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-post",
- "version": "8.12.0",
+ "version": "8.13.0-prerelease",
"description": "Edit Post module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-site/CHANGELOG.md b/packages/edit-site/CHANGELOG.md
index 0c90c024b0cd99..7143b40a59a1b4 100644
--- a/packages/edit-site/CHANGELOG.md
+++ b/packages/edit-site/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json
index 11ce70b876bc45..dd814ed7861eb3 100644
--- a/packages/edit-site/package.json
+++ b/packages/edit-site/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-site",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "Edit Site Page module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-widgets/CHANGELOG.md b/packages/edit-widgets/CHANGELOG.md
index 22d109562d768c..f4b11636858dcd 100644
--- a/packages/edit-widgets/CHANGELOG.md
+++ b/packages/edit-widgets/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json
index 4ed1124314f2cf..07ec66e1b8b2f3 100644
--- a/packages/edit-widgets/package.json
+++ b/packages/edit-widgets/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-widgets",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "Widgets Page module for WordPress..",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md
index 37f46d1d74ccb5..5c00b30fbe96d3 100644
--- a/packages/editor/CHANGELOG.md
+++ b/packages/editor/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 14.13.0 (2024-11-27)
+
## 14.12.0 (2024-11-16)
## 14.11.0 (2024-10-30)
diff --git a/packages/editor/package.json b/packages/editor/package.json
index 77399238a9f46b..a5fa747b43d9c6 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/editor",
- "version": "14.12.0",
+ "version": "14.13.0-prerelease",
"description": "Enhanced block editor for WordPress posts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/element/CHANGELOG.md b/packages/element/CHANGELOG.md
index 00eccb7e5ec532..50fc6e21756b92 100644
--- a/packages/element/CHANGELOG.md
+++ b/packages/element/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/element/package.json b/packages/element/package.json
index 6a4ede84b1062d..3e34c6b0ca63af 100644
--- a/packages/element/package.json
+++ b/packages/element/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/element",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "Element React module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/env/CHANGELOG.md b/packages/env/CHANGELOG.md
index 181adb034b6b19..651d6b285e1bd6 100644
--- a/packages/env/CHANGELOG.md
+++ b/packages/env/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 10.13.0 (2024-11-27)
+
## 10.12.0 (2024-11-16)
## 10.11.0 (2024-10-30)
diff --git a/packages/env/package.json b/packages/env/package.json
index d1c3b192baf894..ebb26e21340160 100644
--- a/packages/env/package.json
+++ b/packages/env/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/env",
- "version": "10.12.0",
+ "version": "10.13.0-prerelease",
"description": "A zero-config, self contained local WordPress environment for development and testing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/escape-html/CHANGELOG.md b/packages/escape-html/CHANGELOG.md
index 40ad50dc4997d8..d1eff0c72fed56 100644
--- a/packages/escape-html/CHANGELOG.md
+++ b/packages/escape-html/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.13.0 (2024-11-27)
+
## 3.12.0 (2024-11-16)
## 3.11.0 (2024-10-30)
diff --git a/packages/escape-html/package.json b/packages/escape-html/package.json
index 688c10e638a96c..13ebb4793ed127 100644
--- a/packages/escape-html/package.json
+++ b/packages/escape-html/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/escape-html",
- "version": "3.12.0",
+ "version": "3.13.0-prerelease",
"description": "Escape HTML utils.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md
index 75a8828629b85d..91b517249b597a 100644
--- a/packages/eslint-plugin/CHANGELOG.md
+++ b/packages/eslint-plugin/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 21.6.0 (2024-11-27)
+
## 21.5.0 (2024-11-16)
## 21.4.0 (2024-10-30)
diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json
index 0e8880f0941234..246da0479393b8 100644
--- a/packages/eslint-plugin/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/eslint-plugin",
- "version": "21.5.0",
+ "version": "21.6.0-prerelease",
"description": "ESLint plugin for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/fields/CHANGELOG.md b/packages/fields/CHANGELOG.md
index a2eba51228fbdd..c567ae42058bf5 100644
--- a/packages/fields/CHANGELOG.md
+++ b/packages/fields/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 0.5.0 (2024-11-27)
+
## 0.4.0 (2024-11-16)
## 0.3.0 (2024-10-30)
diff --git a/packages/fields/package.json b/packages/fields/package.json
index 8c9509b06c5885..3e73fe3bb753aa 100644
--- a/packages/fields/package.json
+++ b/packages/fields/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/fields",
- "version": "0.4.0",
+ "version": "0.5.0-prerelease",
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/format-library/CHANGELOG.md b/packages/format-library/CHANGELOG.md
index 257b13656210b0..99c174ca029c62 100644
--- a/packages/format-library/CHANGELOG.md
+++ b/packages/format-library/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/format-library/package.json b/packages/format-library/package.json
index ee1dd8efd1fe95..06271e0c9c360a 100644
--- a/packages/format-library/package.json
+++ b/packages/format-library/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/format-library",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Format library for the WordPress editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/hooks/CHANGELOG.md b/packages/hooks/CHANGELOG.md
index be3f8c7cf6b415..be18dab3225a2b 100644
--- a/packages/hooks/CHANGELOG.md
+++ b/packages/hooks/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/hooks/package.json b/packages/hooks/package.json
index 0bfc0700070e2d..7aea26efdc7b35 100644
--- a/packages/hooks/package.json
+++ b/packages/hooks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/hooks",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "WordPress hooks library.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/html-entities/CHANGELOG.md b/packages/html-entities/CHANGELOG.md
index bcba1ced9d91c7..98b3b3c483325e 100644
--- a/packages/html-entities/CHANGELOG.md
+++ b/packages/html-entities/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json
index f8f88b883be146..4e17fab9045782 100644
--- a/packages/html-entities/package.json
+++ b/packages/html-entities/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/html-entities",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "HTML entity utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/i18n/CHANGELOG.md b/packages/i18n/CHANGELOG.md
index fd5f8e1003e326..b1d94cde634c0d 100644
--- a/packages/i18n/CHANGELOG.md
+++ b/packages/i18n/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/i18n/package.json b/packages/i18n/package.json
index ed4b25aa0fb8fc..8d86bb1d90368c 100644
--- a/packages/i18n/package.json
+++ b/packages/i18n/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/i18n",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "WordPress internationalization (i18n) library.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/icons/CHANGELOG.md b/packages/icons/CHANGELOG.md
index 484b26e96c90d9..84263e1135ac4d 100644
--- a/packages/icons/CHANGELOG.md
+++ b/packages/icons/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 10.13.0 (2024-11-27)
+
## 10.12.0 (2024-11-16)
## 10.11.0 (2024-10-30)
diff --git a/packages/icons/package.json b/packages/icons/package.json
index 40ddb309066e25..3df43cb209b437 100644
--- a/packages/icons/package.json
+++ b/packages/icons/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/icons",
- "version": "10.12.0",
+ "version": "10.13.0-prerelease",
"description": "WordPress Icons package, based on dashicon.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/interactivity-router/CHANGELOG.md b/packages/interactivity-router/CHANGELOG.md
index ed23e6c73dea4e..b79850dc7fe545 100644
--- a/packages/interactivity-router/CHANGELOG.md
+++ b/packages/interactivity-router/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/interactivity-router/package.json b/packages/interactivity-router/package.json
index d750edb2cd9c28..67cc0704f51603 100644
--- a/packages/interactivity-router/package.json
+++ b/packages/interactivity-router/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/interactivity-router",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "Package that exposes state and actions from the `core/router` store, part of the Interactivity API.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/interactivity/CHANGELOG.md b/packages/interactivity/CHANGELOG.md
index 8167177b663d43..587d14440d8116 100644
--- a/packages/interactivity/CHANGELOG.md
+++ b/packages/interactivity/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
### Bug Fixes
diff --git a/packages/interactivity/package.json b/packages/interactivity/package.json
index e82d74c5735302..6382a789dc2b8b 100644
--- a/packages/interactivity/package.json
+++ b/packages/interactivity/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/interactivity",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "Package that provides a standard and simple way to handle the frontend interactivity of Gutenberg blocks.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/interface/CHANGELOG.md b/packages/interface/CHANGELOG.md
index aa1f96414d46b1..56b01075257331 100644
--- a/packages/interface/CHANGELOG.md
+++ b/packages/interface/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 8.2.0 (2024-11-27)
+
## 8.1.0 (2024-11-16)
## 8.0.0 (2024-10-30)
diff --git a/packages/interface/package.json b/packages/interface/package.json
index 6d286e2e259e90..a1c552f01781ce 100644
--- a/packages/interface/package.json
+++ b/packages/interface/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/interface",
- "version": "8.1.0",
+ "version": "8.2.0-prerelease",
"description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/is-shallow-equal/CHANGELOG.md b/packages/is-shallow-equal/CHANGELOG.md
index ea56df508bdbdf..6308dd484c728a 100644
--- a/packages/is-shallow-equal/CHANGELOG.md
+++ b/packages/is-shallow-equal/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json
index 5bc028c2f58902..0490fb9c04495b 100644
--- a/packages/is-shallow-equal/package.json
+++ b/packages/is-shallow-equal/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/is-shallow-equal",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Test for shallow equality between two objects or arrays.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/jest-console/CHANGELOG.md b/packages/jest-console/CHANGELOG.md
index 777d4271418b9c..67f41af5c7e3f2 100644
--- a/packages/jest-console/CHANGELOG.md
+++ b/packages/jest-console/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 8.13.0 (2024-11-27)
+
## 8.12.0 (2024-11-16)
## 8.11.0 (2024-10-30)
diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json
index f0c6cdea73f461..0615e9ed9ea4f3 100644
--- a/packages/jest-console/package.json
+++ b/packages/jest-console/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/jest-console",
- "version": "8.12.0",
+ "version": "8.13.0-prerelease",
"description": "Custom Jest matchers for the Console object.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/jest-preset-default/CHANGELOG.md b/packages/jest-preset-default/CHANGELOG.md
index a5b7d79336636c..d98552ff45f716 100644
--- a/packages/jest-preset-default/CHANGELOG.md
+++ b/packages/jest-preset-default/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 12.13.0 (2024-11-27)
+
## 12.12.0 (2024-11-16)
## 12.11.0 (2024-10-30)
diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json
index 4050f4fce430f2..9a1367224c3e90 100644
--- a/packages/jest-preset-default/package.json
+++ b/packages/jest-preset-default/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/jest-preset-default",
- "version": "12.12.0",
+ "version": "12.13.0-prerelease",
"description": "Default Jest preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/jest-puppeteer-axe/CHANGELOG.md b/packages/jest-puppeteer-axe/CHANGELOG.md
index c0459e401925c6..d54c3a57804f08 100644
--- a/packages/jest-puppeteer-axe/CHANGELOG.md
+++ b/packages/jest-puppeteer-axe/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.13.0 (2024-11-27)
+
## 7.12.0 (2024-11-16)
## 7.11.0 (2024-10-30)
diff --git a/packages/jest-puppeteer-axe/package.json b/packages/jest-puppeteer-axe/package.json
index 928f427348e690..40595cdfa290b2 100644
--- a/packages/jest-puppeteer-axe/package.json
+++ b/packages/jest-puppeteer-axe/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/jest-puppeteer-axe",
- "version": "7.12.0",
+ "version": "7.13.0-prerelease",
"description": "Axe API integration with Jest and Puppeteer.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/keyboard-shortcuts/CHANGELOG.md b/packages/keyboard-shortcuts/CHANGELOG.md
index cbc9dc62deeb5c..67daf5426b3272 100644
--- a/packages/keyboard-shortcuts/CHANGELOG.md
+++ b/packages/keyboard-shortcuts/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json
index a98a64cb433251..73c794a087c67c 100644
--- a/packages/keyboard-shortcuts/package.json
+++ b/packages/keyboard-shortcuts/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/keyboard-shortcuts",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Handling keyboard shortcuts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/keycodes/CHANGELOG.md b/packages/keycodes/CHANGELOG.md
index d3b43c523ee8a3..46ce387d6d058b 100644
--- a/packages/keycodes/CHANGELOG.md
+++ b/packages/keycodes/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json
index c4720262af6bb4..e2e69f291ce1e5 100644
--- a/packages/keycodes/package.json
+++ b/packages/keycodes/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/keycodes",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/lazy-import/CHANGELOG.md b/packages/lazy-import/CHANGELOG.md
index 96e04c125b974e..d5cff8b39af07f 100644
--- a/packages/lazy-import/CHANGELOG.md
+++ b/packages/lazy-import/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/lazy-import/package.json b/packages/lazy-import/package.json
index e6b989891b351b..cf4cddb73c8623 100644
--- a/packages/lazy-import/package.json
+++ b/packages/lazy-import/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/lazy-import",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "Lazily import a module, installing it automatically if missing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/list-reusable-blocks/CHANGELOG.md b/packages/list-reusable-blocks/CHANGELOG.md
index cee7a2eb5a8671..59b8fa9500fde7 100644
--- a/packages/list-reusable-blocks/CHANGELOG.md
+++ b/packages/list-reusable-blocks/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json
index 6db0f8d1da903d..7707592782bcf6 100644
--- a/packages/list-reusable-blocks/package.json
+++ b/packages/list-reusable-blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/list-reusable-blocks",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Adding Export/Import support to the reusable blocks listing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/media-utils/CHANGELOG.md b/packages/media-utils/CHANGELOG.md
index c4dd4f860c4690..2cfcbaa4b2e8ba 100644
--- a/packages/media-utils/CHANGELOG.md
+++ b/packages/media-utils/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json
index d0b05f580d45cf..33ab27a6b98d76 100644
--- a/packages/media-utils/package.json
+++ b/packages/media-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/media-utils",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "WordPress Media Upload Utils.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/notices/CHANGELOG.md b/packages/notices/CHANGELOG.md
index f721b22243aa87..68c4ef7f85ab5d 100644
--- a/packages/notices/CHANGELOG.md
+++ b/packages/notices/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/notices/package.json b/packages/notices/package.json
index 2f0369dede9bb0..a19276cf0e2c01 100644
--- a/packages/notices/package.json
+++ b/packages/notices/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/notices",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "State management for notices.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/npm-package-json-lint-config/CHANGELOG.md b/packages/npm-package-json-lint-config/CHANGELOG.md
index c9addbd4214c64..132f6ffccdd23c 100644
--- a/packages/npm-package-json-lint-config/CHANGELOG.md
+++ b/packages/npm-package-json-lint-config/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
### Enhancement
diff --git a/packages/npm-package-json-lint-config/package.json b/packages/npm-package-json-lint-config/package.json
index 680a30bb096c9e..1acd0b7dcf74e5 100644
--- a/packages/npm-package-json-lint-config/package.json
+++ b/packages/npm-package-json-lint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/npm-package-json-lint-config",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "WordPress npm-package-json-lint shareable configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/nux/CHANGELOG.md b/packages/nux/CHANGELOG.md
index 91a372a1efd207..ddf1f9091471d0 100644
--- a/packages/nux/CHANGELOG.md
+++ b/packages/nux/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 9.13.0 (2024-11-27)
+
## 9.12.0 (2024-11-16)
## 9.11.0 (2024-10-30)
diff --git a/packages/nux/package.json b/packages/nux/package.json
index 836f1de781413e..612244b92944db 100644
--- a/packages/nux/package.json
+++ b/packages/nux/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/nux",
- "version": "9.12.0",
+ "version": "9.13.0-prerelease",
"description": "NUX (New User eXperience) module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/patterns/CHANGELOG.md b/packages/patterns/CHANGELOG.md
index c953ffc1b4d4ce..975065d0f2b423 100644
--- a/packages/patterns/CHANGELOG.md
+++ b/packages/patterns/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/patterns/package.json b/packages/patterns/package.json
index a556a4641f6bc7..42ee04848006b0 100644
--- a/packages/patterns/package.json
+++ b/packages/patterns/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/patterns",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "Management of user pattern editing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/plugins/CHANGELOG.md b/packages/plugins/CHANGELOG.md
index 34004f6295a36b..fc9199892ade1d 100644
--- a/packages/plugins/CHANGELOG.md
+++ b/packages/plugins/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.13.0 (2024-11-27)
+
## 7.12.0 (2024-11-16)
## 7.11.0 (2024-10-30)
diff --git a/packages/plugins/package.json b/packages/plugins/package.json
index 9bb45aea981082..2e1aeaf1c9b3ae 100644
--- a/packages/plugins/package.json
+++ b/packages/plugins/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/plugins",
- "version": "7.12.0",
+ "version": "7.13.0-prerelease",
"description": "Plugins module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/postcss-plugins-preset/CHANGELOG.md b/packages/postcss-plugins-preset/CHANGELOG.md
index 459193675cced1..e271d53cdc73f9 100644
--- a/packages/postcss-plugins-preset/CHANGELOG.md
+++ b/packages/postcss-plugins-preset/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json
index 0627cb489fca75..71802c5da439e0 100644
--- a/packages/postcss-plugins-preset/package.json
+++ b/packages/postcss-plugins-preset/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/postcss-plugins-preset",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "PostCSS sharable plugins preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/postcss-themes/CHANGELOG.md b/packages/postcss-themes/CHANGELOG.md
index 098507b753ea80..efdb8fb1aa808d 100644
--- a/packages/postcss-themes/CHANGELOG.md
+++ b/packages/postcss-themes/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/postcss-themes/package.json b/packages/postcss-themes/package.json
index e1b632925094f5..c6658889aeda4d 100644
--- a/packages/postcss-themes/package.json
+++ b/packages/postcss-themes/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/postcss-themes",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "PostCSS plugin to generate theme colors.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/preferences-persistence/CHANGELOG.md b/packages/preferences-persistence/CHANGELOG.md
index a2b8376a82735c..3f75a6bbf49c77 100644
--- a/packages/preferences-persistence/CHANGELOG.md
+++ b/packages/preferences-persistence/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/preferences-persistence/package.json b/packages/preferences-persistence/package.json
index 645e62c9307cb6..1e5ca3595e9c7b 100644
--- a/packages/preferences-persistence/package.json
+++ b/packages/preferences-persistence/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/preferences-persistence",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "Persistence utilities for `wordpress/preferences`.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/preferences/CHANGELOG.md b/packages/preferences/CHANGELOG.md
index 76e227f2d70043..8453a061cfdfa7 100644
--- a/packages/preferences/CHANGELOG.md
+++ b/packages/preferences/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/preferences/package.json b/packages/preferences/package.json
index e9f83170fe56b2..5a94f7c17281e3 100644
--- a/packages/preferences/package.json
+++ b/packages/preferences/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/preferences",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Utilities for managing WordPress preferences.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/prettier-config/CHANGELOG.md b/packages/prettier-config/CHANGELOG.md
index da352c8d8ddaf4..e15c0e2aad79fc 100644
--- a/packages/prettier-config/CHANGELOG.md
+++ b/packages/prettier-config/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json
index 5991d84b9ee7e9..47dec2d7a7aa06 100644
--- a/packages/prettier-config/package.json
+++ b/packages/prettier-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/prettier-config",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "WordPress Prettier shared configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/primitives/CHANGELOG.md b/packages/primitives/CHANGELOG.md
index 25bc2d4e3abcb1..29211c9586ede4 100644
--- a/packages/primitives/CHANGELOG.md
+++ b/packages/primitives/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/primitives/package.json b/packages/primitives/package.json
index 67bc8e84bd24e7..b1947e4d7516ec 100644
--- a/packages/primitives/package.json
+++ b/packages/primitives/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/primitives",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "WordPress cross-platform primitives.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/priority-queue/CHANGELOG.md b/packages/priority-queue/CHANGELOG.md
index dce047693d2957..5427d3d5ff7616 100644
--- a/packages/priority-queue/CHANGELOG.md
+++ b/packages/priority-queue/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.13.0 (2024-11-27)
+
## 3.12.0 (2024-11-16)
## 3.11.0 (2024-10-30)
diff --git a/packages/priority-queue/package.json b/packages/priority-queue/package.json
index e5487204dd2375..4fa445fc3194ef 100644
--- a/packages/priority-queue/package.json
+++ b/packages/priority-queue/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/priority-queue",
- "version": "3.12.0",
+ "version": "3.13.0-prerelease",
"description": "Generic browser priority queue.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/private-apis/CHANGELOG.md b/packages/private-apis/CHANGELOG.md
index 9e7c78b3d0fd1f..8792e587a83f16 100644
--- a/packages/private-apis/CHANGELOG.md
+++ b/packages/private-apis/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/private-apis/package.json b/packages/private-apis/package.json
index 928eef9465d9ca..bcfc6ad2a0d7ed 100644
--- a/packages/private-apis/package.json
+++ b/packages/private-apis/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/private-apis",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "Internal experimental APIs for WordPress core.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/project-management-automation/CHANGELOG.md b/packages/project-management-automation/CHANGELOG.md
index d2028220f71284..b6376be2fd6e0c 100644
--- a/packages/project-management-automation/CHANGELOG.md
+++ b/packages/project-management-automation/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/project-management-automation/package.json b/packages/project-management-automation/package.json
index 22638756014c6e..0058153a033250 100644
--- a/packages/project-management-automation/package.json
+++ b/packages/project-management-automation/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/project-management-automation",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "GitHub Action that implements various automation to assist with managing the Gutenberg GitHub repository.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/react-i18n/CHANGELOG.md b/packages/react-i18n/CHANGELOG.md
index d0991cdf756b33..ed872fe9cd145c 100644
--- a/packages/react-i18n/CHANGELOG.md
+++ b/packages/react-i18n/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json
index 236cd7d63be1b6..2ccfd22673aa91 100644
--- a/packages/react-i18n/package.json
+++ b/packages/react-i18n/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-i18n",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "React bindings for @wordpress/i18n.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/readable-js-assets-webpack-plugin/CHANGELOG.md b/packages/readable-js-assets-webpack-plugin/CHANGELOG.md
index 42b12846436e25..08912695e5a8a5 100644
--- a/packages/readable-js-assets-webpack-plugin/CHANGELOG.md
+++ b/packages/readable-js-assets-webpack-plugin/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.13.0 (2024-11-27)
+
## 3.12.0 (2024-11-16)
## 3.11.0 (2024-10-30)
diff --git a/packages/readable-js-assets-webpack-plugin/package.json b/packages/readable-js-assets-webpack-plugin/package.json
index dda4f7e0a51ffc..eb14986310c862 100644
--- a/packages/readable-js-assets-webpack-plugin/package.json
+++ b/packages/readable-js-assets-webpack-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/readable-js-assets-webpack-plugin",
- "version": "3.12.0",
+ "version": "3.13.0-prerelease",
"description": "Generate a readable JS file for each JS asset.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/redux-routine/CHANGELOG.md b/packages/redux-routine/CHANGELOG.md
index e32593e39a8289..afc65f590b5b66 100644
--- a/packages/redux-routine/CHANGELOG.md
+++ b/packages/redux-routine/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/redux-routine/package.json b/packages/redux-routine/package.json
index e4d3600c5db2eb..9704d2cf144bf2 100644
--- a/packages/redux-routine/package.json
+++ b/packages/redux-routine/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/redux-routine",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Redux middleware for generator coroutines.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/reusable-blocks/CHANGELOG.md b/packages/reusable-blocks/CHANGELOG.md
index e451948e16d364..83ee4e4c1add3f 100644
--- a/packages/reusable-blocks/CHANGELOG.md
+++ b/packages/reusable-blocks/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json
index 29309d1d99c9d4..1461aa747b46b8 100644
--- a/packages/reusable-blocks/package.json
+++ b/packages/reusable-blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/reusable-blocks",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "Reusable blocks utilities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/rich-text/CHANGELOG.md b/packages/rich-text/CHANGELOG.md
index 904894e9553c23..2239fbd11ceedc 100644
--- a/packages/rich-text/CHANGELOG.md
+++ b/packages/rich-text/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.13.0 (2024-11-27)
+
## 7.12.0 (2024-11-16)
## 7.11.0 (2024-10-30)
diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json
index 1f3fbfa26e513b..53e9296889ca84 100644
--- a/packages/rich-text/package.json
+++ b/packages/rich-text/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/rich-text",
- "version": "7.12.0",
+ "version": "7.13.0-prerelease",
"description": "Rich text value and manipulation API.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/router/CHANGELOG.md b/packages/router/CHANGELOG.md
index 7e65d08ea7a4b4..07ff407d8435ce 100644
--- a/packages/router/CHANGELOG.md
+++ b/packages/router/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/router/package.json b/packages/router/package.json
index 3ee25719134020..0b32d61b3464af 100644
--- a/packages/router/package.json
+++ b/packages/router/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/router",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "Router API for WordPress pages.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md
index 0decdaca528b2e..55143ae792ae5b 100644
--- a/packages/scripts/CHANGELOG.md
+++ b/packages/scripts/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 30.6.0 (2024-11-27)
+
## 30.5.1 (2024-11-18)
### Bug Fix
diff --git a/packages/scripts/package.json b/packages/scripts/package.json
index fa50f90362a6f0..17f0379de77ce1 100644
--- a/packages/scripts/package.json
+++ b/packages/scripts/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/scripts",
- "version": "30.5.1",
+ "version": "30.6.0-prerelease",
"description": "Collection of reusable scripts for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/server-side-render/CHANGELOG.md b/packages/server-side-render/CHANGELOG.md
index d334d34897a7e7..66a8d7c03136bf 100644
--- a/packages/server-side-render/CHANGELOG.md
+++ b/packages/server-side-render/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.13.0 (2024-11-27)
+
## 5.12.0 (2024-11-16)
## 5.11.0 (2024-10-30)
diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json
index 1e2d477840d720..e538f66985148d 100644
--- a/packages/server-side-render/package.json
+++ b/packages/server-side-render/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/server-side-render",
- "version": "5.12.0",
+ "version": "5.13.0-prerelease",
"description": "The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/shortcode/CHANGELOG.md b/packages/shortcode/CHANGELOG.md
index dd30fa01c08bd4..8ee4e9aa3168d1 100644
--- a/packages/shortcode/CHANGELOG.md
+++ b/packages/shortcode/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/shortcode/package.json b/packages/shortcode/package.json
index dde71b677e93f1..351b47dd4659dd 100644
--- a/packages/shortcode/package.json
+++ b/packages/shortcode/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/shortcode",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Shortcode module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/style-engine/CHANGELOG.md b/packages/style-engine/CHANGELOG.md
index 91ffb32099a230..768ea039f24f36 100644
--- a/packages/style-engine/CHANGELOG.md
+++ b/packages/style-engine/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.13.0 (2024-11-27)
+
## 2.12.0 (2024-11-16)
## 2.11.0 (2024-10-30)
diff --git a/packages/style-engine/package.json b/packages/style-engine/package.json
index ef7adbe720f6c0..fa8d19a506108f 100644
--- a/packages/style-engine/package.json
+++ b/packages/style-engine/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/style-engine",
- "version": "2.12.0",
+ "version": "2.13.0-prerelease",
"description": "A suite of parsers and compilers for WordPress styles.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/stylelint-config/CHANGELOG.md b/packages/stylelint-config/CHANGELOG.md
index 402ca7cf9de59a..5e6fa218da6f85 100644
--- a/packages/stylelint-config/CHANGELOG.md
+++ b/packages/stylelint-config/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 23.5.0 (2024-11-27)
+
## 23.4.0 (2024-11-16)
## 23.3.0 (2024-10-30)
diff --git a/packages/stylelint-config/package.json b/packages/stylelint-config/package.json
index 6aff6076c76f03..3b1e94372cc451 100644
--- a/packages/stylelint-config/package.json
+++ b/packages/stylelint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/stylelint-config",
- "version": "23.4.0",
+ "version": "23.5.0-prerelease",
"description": "stylelint config for WordPress development.",
"author": "The WordPress Contributors",
"license": "MIT",
diff --git a/packages/sync/CHANGELOG.md b/packages/sync/CHANGELOG.md
index 867e1fb2b3233b..b8ecad37f3f5d8 100644
--- a/packages/sync/CHANGELOG.md
+++ b/packages/sync/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/sync/package.json b/packages/sync/package.json
index 42c784ae13ac6a..714832322774ba 100644
--- a/packages/sync/package.json
+++ b/packages/sync/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/sync",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "Sync Data.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/token-list/CHANGELOG.md b/packages/token-list/CHANGELOG.md
index 2e72e21a44f646..0b72a43de88d4f 100644
--- a/packages/token-list/CHANGELOG.md
+++ b/packages/token-list/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.13.0 (2024-11-27)
+
## 3.12.0 (2024-11-16)
## 3.11.0 (2024-10-30)
diff --git a/packages/token-list/package.json b/packages/token-list/package.json
index 17837ccd5d1b70..0103c07e0e6ead 100644
--- a/packages/token-list/package.json
+++ b/packages/token-list/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/token-list",
- "version": "3.12.0",
+ "version": "3.13.0-prerelease",
"description": "Constructable, plain JavaScript DOMTokenList implementation, supporting non-browser runtimes.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/undo-manager/CHANGELOG.md b/packages/undo-manager/CHANGELOG.md
index d35ddd1b895925..e84658632a054d 100644
--- a/packages/undo-manager/CHANGELOG.md
+++ b/packages/undo-manager/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 1.13.0 (2024-11-27)
+
## 1.12.0 (2024-11-16)
## 1.11.0 (2024-10-30)
diff --git a/packages/undo-manager/package.json b/packages/undo-manager/package.json
index 99fa4c7f8a9bbc..8ebf45fc9df9ec 100644
--- a/packages/undo-manager/package.json
+++ b/packages/undo-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/undo-manager",
- "version": "1.12.0",
+ "version": "1.13.0-prerelease",
"description": "A small package to manage undo/redo.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/url/CHANGELOG.md b/packages/url/CHANGELOG.md
index 94fc29e83f98d7..e4273fc57f2e0f 100644
--- a/packages/url/CHANGELOG.md
+++ b/packages/url/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/url/package.json b/packages/url/package.json
index 0e237f4e95788e..6a4297a5084434 100644
--- a/packages/url/package.json
+++ b/packages/url/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/url",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "WordPress URL utilities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/viewport/CHANGELOG.md b/packages/viewport/CHANGELOG.md
index 78f0fa1c9292ce..faf1bd4b437f0d 100644
--- a/packages/viewport/CHANGELOG.md
+++ b/packages/viewport/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.13.0 (2024-11-27)
+
## 6.12.0 (2024-11-16)
## 6.11.0 (2024-10-30)
diff --git a/packages/viewport/package.json b/packages/viewport/package.json
index 548efa124f374e..8aadf2af898fb0 100644
--- a/packages/viewport/package.json
+++ b/packages/viewport/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/viewport",
- "version": "6.12.0",
+ "version": "6.13.0-prerelease",
"description": "Viewport module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/warning/CHANGELOG.md b/packages/warning/CHANGELOG.md
index 189af916a46a71..424ab1403506a6 100644
--- a/packages/warning/CHANGELOG.md
+++ b/packages/warning/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.13.0 (2024-11-27)
+
## 3.12.0 (2024-11-16)
## 3.11.0 (2024-10-30)
diff --git a/packages/warning/package.json b/packages/warning/package.json
index 3d6223ba47ff08..91c4bc5c591955 100644
--- a/packages/warning/package.json
+++ b/packages/warning/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/warning",
- "version": "3.12.0",
+ "version": "3.13.0-prerelease",
"description": "Warning utility for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/widgets/CHANGELOG.md b/packages/widgets/CHANGELOG.md
index 2c02849b6ceee4..b1c63a0ca7f4c2 100644
--- a/packages/widgets/CHANGELOG.md
+++ b/packages/widgets/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/widgets/package.json b/packages/widgets/package.json
index db712cd70d5449..d72c179a5ad419 100644
--- a/packages/widgets/package.json
+++ b/packages/widgets/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/widgets",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/wordcount/CHANGELOG.md b/packages/wordcount/CHANGELOG.md
index ef65ec41b00db9..f323aa3a810d7a 100644
--- a/packages/wordcount/CHANGELOG.md
+++ b/packages/wordcount/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.13.0 (2024-11-27)
+
## 4.12.0 (2024-11-16)
## 4.11.0 (2024-10-30)
diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json
index 637d935fc11e6c..f69f8e06219160 100644
--- a/packages/wordcount/package.json
+++ b/packages/wordcount/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/wordcount",
- "version": "4.12.0",
+ "version": "4.13.0-prerelease",
"description": "WordPress word count utility.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
From d02c4b4cec4923bb1d97327d997da4a9c8d7fe75 Mon Sep 17 00:00:00 2001
From: Gutenberg Repository Automation
Date: Wed, 27 Nov 2024 10:43:37 +0000
Subject: [PATCH 048/384] chore(release): publish
- @wordpress/a11y@4.13.0
- @wordpress/annotations@3.13.0
- @wordpress/api-fetch@7.13.0
- @wordpress/autop@4.13.0
- @wordpress/babel-plugin-import-jsx-pragma@5.13.0
- @wordpress/babel-plugin-makepot@6.13.0
- @wordpress/babel-preset-default@8.13.0
- @wordpress/base-styles@5.13.0
- @wordpress/blob@4.13.0
- @wordpress/block-directory@5.13.0
- @wordpress/block-editor@14.8.0
- @wordpress/block-library@9.13.0
- @wordpress/block-serialization-default-parser@5.13.0
- @wordpress/block-serialization-spec-parser@5.13.0
- @wordpress/blocks@14.2.0
- @wordpress/browserslist-config@6.13.0
- @wordpress/commands@1.13.0
- @wordpress/components@28.13.0
- @wordpress/compose@7.13.0
- @wordpress/core-commands@1.13.0
- @wordpress/core-data@7.13.0
- @wordpress/create-block@4.56.0
- @wordpress/create-block-interactive-template@2.13.0
- @wordpress/create-block-tutorial-template@4.13.0
- @wordpress/customize-widgets@5.13.0
- @wordpress/data@10.13.0
- @wordpress/data-controls@4.13.0
- @wordpress/dataviews@4.9.0
- @wordpress/date@5.13.0
- @wordpress/dependency-extraction-webpack-plugin@6.13.0
- @wordpress/deprecated@4.13.0
- @wordpress/docgen@2.13.0
- @wordpress/dom@4.13.0
- @wordpress/dom-ready@4.13.0
- @wordpress/e2e-test-utils@11.13.0
- @wordpress/e2e-test-utils-playwright@1.13.0
- @wordpress/e2e-tests@8.13.0
- @wordpress/edit-post@8.13.0
- @wordpress/edit-site@6.13.0
- @wordpress/edit-widgets@6.13.0
- @wordpress/editor@14.13.0
- @wordpress/element@6.13.0
- @wordpress/env@10.13.0
- @wordpress/escape-html@3.13.0
- @wordpress/eslint-plugin@21.6.0
- @wordpress/fields@0.5.0
- @wordpress/format-library@5.13.0
- @wordpress/hooks@4.13.0
- @wordpress/html-entities@4.13.0
- @wordpress/i18n@5.13.0
- @wordpress/icons@10.13.0
- @wordpress/interactivity@6.13.0
- @wordpress/interactivity-router@2.13.0
- @wordpress/interface@8.2.0
- @wordpress/is-shallow-equal@5.13.0
- @wordpress/jest-console@8.13.0
- @wordpress/jest-preset-default@12.13.0
- @wordpress/jest-puppeteer-axe@7.13.0
- @wordpress/keyboard-shortcuts@5.13.0
- @wordpress/keycodes@4.13.0
- @wordpress/lazy-import@2.13.0
- @wordpress/list-reusable-blocks@5.13.0
- @wordpress/media-utils@5.13.0
- @wordpress/notices@5.13.0
- @wordpress/npm-package-json-lint-config@5.13.0
- @wordpress/nux@9.13.0
- @wordpress/patterns@2.13.0
- @wordpress/plugins@7.13.0
- @wordpress/postcss-plugins-preset@5.13.0
- @wordpress/postcss-themes@6.13.0
- @wordpress/preferences@4.13.0
- @wordpress/preferences-persistence@2.13.0
- @wordpress/prettier-config@4.13.0
- @wordpress/primitives@4.13.0
- @wordpress/priority-queue@3.13.0
- @wordpress/private-apis@1.13.0
- @wordpress/project-management-automation@2.13.0
- @wordpress/react-i18n@4.13.0
- @wordpress/readable-js-assets-webpack-plugin@3.13.0
- @wordpress/redux-routine@5.13.0
- @wordpress/reusable-blocks@5.13.0
- @wordpress/rich-text@7.13.0
- @wordpress/router@1.13.0
- @wordpress/scripts@30.6.0
- @wordpress/server-side-render@5.13.0
- @wordpress/shortcode@4.13.0
- @wordpress/style-engine@2.13.0
- @wordpress/stylelint-config@23.5.0
- @wordpress/sync@1.13.0
- @wordpress/token-list@3.13.0
- @wordpress/undo-manager@1.13.0
- @wordpress/url@4.13.0
- @wordpress/viewport@6.13.0
- @wordpress/warning@3.13.0
- @wordpress/widgets@4.13.0
- @wordpress/wordcount@4.13.0
---
package-lock.json | 192 +++++++++---------
packages/a11y/package.json | 2 +-
packages/annotations/package.json | 2 +-
packages/api-fetch/package.json | 2 +-
packages/autop/package.json | 2 +-
.../package.json | 2 +-
packages/babel-plugin-makepot/package.json | 2 +-
packages/babel-preset-default/package.json | 2 +-
packages/base-styles/package.json | 2 +-
packages/blob/package.json | 2 +-
packages/block-directory/package.json | 2 +-
packages/block-editor/package.json | 2 +-
packages/block-library/package.json | 2 +-
.../package.json | 2 +-
.../package.json | 2 +-
packages/blocks/package.json | 2 +-
packages/browserslist-config/package.json | 2 +-
packages/commands/package.json | 2 +-
packages/components/package.json | 2 +-
packages/compose/package.json | 2 +-
packages/core-commands/package.json | 2 +-
packages/core-data/package.json | 2 +-
.../package.json | 2 +-
.../package.json | 2 +-
packages/create-block/package.json | 2 +-
packages/customize-widgets/package.json | 2 +-
packages/data-controls/package.json | 2 +-
packages/data/package.json | 2 +-
packages/dataviews/package.json | 2 +-
packages/date/package.json | 2 +-
.../package.json | 2 +-
packages/deprecated/package.json | 2 +-
packages/docgen/package.json | 2 +-
packages/dom-ready/package.json | 2 +-
packages/dom/package.json | 2 +-
.../e2e-test-utils-playwright/package.json | 2 +-
packages/e2e-test-utils/package.json | 2 +-
packages/e2e-tests/package.json | 2 +-
packages/edit-post/package.json | 2 +-
packages/edit-site/package.json | 2 +-
packages/edit-widgets/package.json | 2 +-
packages/editor/package.json | 2 +-
packages/element/package.json | 2 +-
packages/env/package.json | 2 +-
packages/escape-html/package.json | 2 +-
packages/eslint-plugin/package.json | 2 +-
packages/fields/package.json | 2 +-
packages/format-library/package.json | 2 +-
packages/hooks/package.json | 2 +-
packages/html-entities/package.json | 2 +-
packages/i18n/package.json | 2 +-
packages/icons/package.json | 2 +-
packages/interactivity-router/package.json | 2 +-
packages/interactivity/package.json | 2 +-
packages/interface/package.json | 2 +-
packages/is-shallow-equal/package.json | 2 +-
packages/jest-console/package.json | 2 +-
packages/jest-preset-default/package.json | 2 +-
packages/jest-puppeteer-axe/package.json | 2 +-
packages/keyboard-shortcuts/package.json | 2 +-
packages/keycodes/package.json | 2 +-
packages/lazy-import/package.json | 2 +-
packages/list-reusable-blocks/package.json | 2 +-
packages/media-utils/package.json | 2 +-
packages/notices/package.json | 2 +-
.../npm-package-json-lint-config/package.json | 2 +-
packages/nux/package.json | 2 +-
packages/patterns/package.json | 2 +-
packages/plugins/package.json | 2 +-
packages/postcss-plugins-preset/package.json | 2 +-
packages/postcss-themes/package.json | 2 +-
packages/preferences-persistence/package.json | 2 +-
packages/preferences/package.json | 2 +-
packages/prettier-config/package.json | 2 +-
packages/primitives/package.json | 2 +-
packages/priority-queue/package.json | 2 +-
packages/private-apis/package.json | 2 +-
.../package.json | 2 +-
packages/react-i18n/package.json | 2 +-
.../package.json | 2 +-
packages/redux-routine/package.json | 2 +-
packages/reusable-blocks/package.json | 2 +-
packages/rich-text/package.json | 2 +-
packages/router/package.json | 2 +-
packages/scripts/package.json | 2 +-
packages/server-side-render/package.json | 2 +-
packages/shortcode/package.json | 2 +-
packages/style-engine/package.json | 2 +-
packages/stylelint-config/package.json | 2 +-
packages/sync/package.json | 2 +-
packages/token-list/package.json | 2 +-
packages/undo-manager/package.json | 2 +-
packages/url/package.json | 2 +-
packages/viewport/package.json | 2 +-
packages/warning/package.json | 2 +-
packages/widgets/package.json | 2 +-
packages/wordcount/package.json | 2 +-
97 files changed, 192 insertions(+), 192 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 7e19737654b9aa..ccf779f2d67eab 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -51890,7 +51890,7 @@
},
"packages/a11y": {
"name": "@wordpress/a11y",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -51904,7 +51904,7 @@
},
"packages/annotations": {
"name": "@wordpress/annotations",
- "version": "3.12.0",
+ "version": "3.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -51932,7 +51932,7 @@
},
"packages/api-fetch": {
"name": "@wordpress/api-fetch",
- "version": "7.12.0",
+ "version": "7.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -51946,7 +51946,7 @@
},
"packages/autop": {
"name": "@wordpress/autop",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -51958,7 +51958,7 @@
},
"packages/babel-plugin-import-jsx-pragma": {
"name": "@wordpress/babel-plugin-import-jsx-pragma",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -51970,7 +51970,7 @@
},
"packages/babel-plugin-makepot": {
"name": "@wordpress/babel-plugin-makepot",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"deepmerge": "^4.3.0",
@@ -51987,7 +51987,7 @@
},
"packages/babel-preset-default": {
"name": "@wordpress/babel-preset-default",
- "version": "8.12.0",
+ "version": "8.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/core": "7.25.7",
@@ -53118,7 +53118,7 @@
},
"packages/base-styles": {
"name": "@wordpress/base-styles",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -53127,7 +53127,7 @@
},
"packages/blob": {
"name": "@wordpress/blob",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -53139,7 +53139,7 @@
},
"packages/block-directory": {
"name": "@wordpress/block-directory",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53175,7 +53175,7 @@
},
"packages/block-editor": {
"name": "@wordpress/block-editor",
- "version": "14.7.0",
+ "version": "14.8.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53275,7 +53275,7 @@
},
"packages/block-library": {
"name": "@wordpress/block-library",
- "version": "9.12.0",
+ "version": "9.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53341,7 +53341,7 @@
},
"packages/block-serialization-default-parser": {
"name": "@wordpress/block-serialization-default-parser",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -53353,7 +53353,7 @@
},
"packages/block-serialization-spec-parser": {
"name": "@wordpress/block-serialization-spec-parser",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"pegjs": "^0.10.0",
@@ -53366,7 +53366,7 @@
},
"packages/blocks": {
"name": "@wordpress/blocks",
- "version": "14.1.0",
+ "version": "14.2.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53420,7 +53420,7 @@
},
"packages/browserslist-config": {
"name": "@wordpress/browserslist-config",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -53429,7 +53429,7 @@
},
"packages/commands": {
"name": "@wordpress/commands",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53668,7 +53668,7 @@
},
"packages/components": {
"name": "@wordpress/components",
- "version": "28.12.0",
+ "version": "28.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@ariakit/react": "^0.4.10",
@@ -53789,7 +53789,7 @@
},
"packages/compose": {
"name": "@wordpress/compose",
- "version": "7.12.0",
+ "version": "7.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53826,7 +53826,7 @@
},
"packages/core-commands": {
"name": "@wordpress/core-commands",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53855,7 +53855,7 @@
},
"packages/core-data": {
"name": "@wordpress/core-data",
- "version": "7.12.0",
+ "version": "7.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53900,7 +53900,7 @@
},
"packages/create-block": {
"name": "@wordpress/create-block",
- "version": "4.55.0",
+ "version": "4.56.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/lazy-import": "*",
@@ -53927,7 +53927,7 @@
},
"packages/create-block-interactive-template": {
"name": "@wordpress/create-block-interactive-template",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -53936,7 +53936,7 @@
},
"packages/create-block-tutorial-template": {
"name": "@wordpress/create-block-tutorial-template",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -53945,7 +53945,7 @@
},
"packages/customize-widgets": {
"name": "@wordpress/customize-widgets",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -53984,7 +53984,7 @@
},
"packages/data": {
"name": "@wordpress/data",
- "version": "10.12.0",
+ "version": "10.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54013,7 +54013,7 @@
},
"packages/data-controls": {
"name": "@wordpress/data-controls",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54031,7 +54031,7 @@
},
"packages/dataviews": {
"name": "@wordpress/dataviews",
- "version": "4.8.0",
+ "version": "4.9.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@ariakit/react": "^0.4.10",
@@ -54088,7 +54088,7 @@
},
"packages/date": {
"name": "@wordpress/date",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54103,7 +54103,7 @@
},
"packages/dependency-extraction-webpack-plugin": {
"name": "@wordpress/dependency-extraction-webpack-plugin",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"json2php": "^0.0.7"
@@ -54118,7 +54118,7 @@
},
"packages/deprecated": {
"name": "@wordpress/deprecated",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54131,7 +54131,7 @@
},
"packages/docgen": {
"name": "@wordpress/docgen",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/core": "7.25.7",
@@ -54152,7 +54152,7 @@
},
"packages/dom": {
"name": "@wordpress/dom",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54165,7 +54165,7 @@
},
"packages/dom-ready": {
"name": "@wordpress/dom-ready",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -54177,7 +54177,7 @@
},
"packages/e2e-test-utils": {
"name": "@wordpress/e2e-test-utils",
- "version": "11.12.0",
+ "version": "11.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54199,7 +54199,7 @@
},
"packages/e2e-test-utils-playwright": {
"name": "@wordpress/e2e-test-utils-playwright",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"change-case": "^4.1.2",
@@ -54225,7 +54225,7 @@
},
"packages/e2e-tests": {
"name": "@wordpress/e2e-tests",
- "version": "8.12.0",
+ "version": "8.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/e2e-test-utils": "*",
@@ -54263,7 +54263,7 @@
},
"packages/edit-post": {
"name": "@wordpress/edit-post",
- "version": "8.12.0",
+ "version": "8.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54310,7 +54310,7 @@
},
"packages/edit-site": {
"name": "@wordpress/edit-site",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54372,7 +54372,7 @@
},
"packages/edit-widgets": {
"name": "@wordpress/edit-widgets",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54416,7 +54416,7 @@
},
"packages/editor": {
"name": "@wordpress/editor",
- "version": "14.12.0",
+ "version": "14.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54478,7 +54478,7 @@
},
"packages/element": {
"name": "@wordpress/element",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54497,7 +54497,7 @@
},
"packages/env": {
"name": "@wordpress/env",
- "version": "10.12.0",
+ "version": "10.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"chalk": "^4.0.0",
@@ -54628,7 +54628,7 @@
},
"packages/escape-html": {
"name": "@wordpress/escape-html",
- "version": "3.12.0",
+ "version": "3.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -54640,7 +54640,7 @@
},
"packages/eslint-plugin": {
"name": "@wordpress/eslint-plugin",
- "version": "21.5.0",
+ "version": "21.6.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/eslint-parser": "7.25.7",
@@ -54709,7 +54709,7 @@
},
"packages/fields": {
"name": "@wordpress/fields",
- "version": "0.4.0",
+ "version": "0.5.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54750,7 +54750,7 @@
},
"packages/format-library": {
"name": "@wordpress/format-library",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54778,7 +54778,7 @@
},
"packages/hooks": {
"name": "@wordpress/hooks",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -54790,7 +54790,7 @@
},
"packages/html-entities": {
"name": "@wordpress/html-entities",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -54802,7 +54802,7 @@
},
"packages/i18n": {
"name": "@wordpress/i18n",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54822,7 +54822,7 @@
},
"packages/icons": {
"name": "@wordpress/icons",
- "version": "10.12.0",
+ "version": "10.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54836,7 +54836,7 @@
},
"packages/interactivity": {
"name": "@wordpress/interactivity",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@preact/signals": "^1.3.0",
@@ -54849,7 +54849,7 @@
},
"packages/interactivity-router": {
"name": "@wordpress/interactivity-router",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/a11y": "*",
@@ -54862,7 +54862,7 @@
},
"packages/interface": {
"name": "@wordpress/interface",
- "version": "8.1.0",
+ "version": "8.2.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54890,7 +54890,7 @@
},
"packages/is-shallow-equal": {
"name": "@wordpress/is-shallow-equal",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -54902,7 +54902,7 @@
},
"packages/jest-console": {
"name": "@wordpress/jest-console",
- "version": "8.12.0",
+ "version": "8.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54918,7 +54918,7 @@
},
"packages/jest-preset-default": {
"name": "@wordpress/jest-preset-default",
- "version": "12.12.0",
+ "version": "12.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/jest-console": "*",
@@ -54935,7 +54935,7 @@
},
"packages/jest-puppeteer-axe": {
"name": "@wordpress/jest-puppeteer-axe",
- "version": "7.12.0",
+ "version": "7.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@axe-core/puppeteer": "^4.0.0",
@@ -54957,7 +54957,7 @@
},
"packages/keyboard-shortcuts": {
"name": "@wordpress/keyboard-shortcuts",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54975,7 +54975,7 @@
},
"packages/keycodes": {
"name": "@wordpress/keycodes",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -54988,7 +54988,7 @@
},
"packages/lazy-import": {
"name": "@wordpress/lazy-import",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"execa": "^4.0.2",
@@ -55002,7 +55002,7 @@
},
"packages/list-reusable-blocks": {
"name": "@wordpress/list-reusable-blocks",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55025,7 +55025,7 @@
},
"packages/media-utils": {
"name": "@wordpress/media-utils",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55042,7 +55042,7 @@
},
"packages/notices": {
"name": "@wordpress/notices",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55059,7 +55059,7 @@
},
"packages/npm-package-json-lint-config": {
"name": "@wordpress/npm-package-json-lint-config",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -55071,7 +55071,7 @@
},
"packages/nux": {
"name": "@wordpress/nux",
- "version": "9.12.0",
+ "version": "9.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55094,7 +55094,7 @@
},
"packages/patterns": {
"name": "@wordpress/patterns",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55124,7 +55124,7 @@
},
"packages/plugins": {
"name": "@wordpress/plugins",
- "version": "7.12.0",
+ "version": "7.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55148,7 +55148,7 @@
},
"packages/postcss-plugins-preset": {
"name": "@wordpress/postcss-plugins-preset",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/base-styles": "*",
@@ -55164,7 +55164,7 @@
},
"packages/postcss-themes": {
"name": "@wordpress/postcss-themes",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -55176,7 +55176,7 @@
},
"packages/preferences": {
"name": "@wordpress/preferences",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55202,7 +55202,7 @@
},
"packages/preferences-persistence": {
"name": "@wordpress/preferences-persistence",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55215,7 +55215,7 @@
},
"packages/prettier-config": {
"name": "@wordpress/prettier-config",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -55227,7 +55227,7 @@
},
"packages/primitives": {
"name": "@wordpress/primitives",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55244,7 +55244,7 @@
},
"packages/priority-queue": {
"name": "@wordpress/priority-queue",
- "version": "3.12.0",
+ "version": "3.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55257,7 +55257,7 @@
},
"packages/private-apis": {
"name": "@wordpress/private-apis",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -55269,7 +55269,7 @@
},
"packages/project-management-automation": {
"name": "@wordpress/project-management-automation",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@actions/core": "1.9.1",
@@ -55297,7 +55297,7 @@
},
"packages/react-i18n": {
"name": "@wordpress/react-i18n",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55453,7 +55453,7 @@
},
"packages/readable-js-assets-webpack-plugin": {
"name": "@wordpress/readable-js-assets-webpack-plugin",
- "version": "3.12.0",
+ "version": "3.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -55465,7 +55465,7 @@
},
"packages/redux-routine": {
"name": "@wordpress/redux-routine",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55508,7 +55508,7 @@
},
"packages/reusable-blocks": {
"name": "@wordpress/reusable-blocks",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55535,7 +55535,7 @@
},
"packages/rich-text": {
"name": "@wordpress/rich-text",
- "version": "7.12.0",
+ "version": "7.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55559,7 +55559,7 @@
},
"packages/router": {
"name": "@wordpress/router",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -55578,7 +55578,7 @@
},
"packages/scripts": {
"name": "@wordpress/scripts",
- "version": "30.5.1",
+ "version": "30.6.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/core": "7.25.7",
@@ -56011,7 +56011,7 @@
},
"packages/server-side-render": {
"name": "@wordpress/server-side-render",
- "version": "5.12.0",
+ "version": "5.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56037,7 +56037,7 @@
},
"packages/shortcode": {
"name": "@wordpress/shortcode",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56050,7 +56050,7 @@
},
"packages/style-engine": {
"name": "@wordpress/style-engine",
- "version": "2.12.0",
+ "version": "2.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56063,7 +56063,7 @@
},
"packages/stylelint-config": {
"name": "@wordpress/stylelint-config",
- "version": "23.4.0",
+ "version": "23.5.0",
"license": "MIT",
"dependencies": {
"@stylistic/stylelint-plugin": "^3.0.1",
@@ -56174,7 +56174,7 @@
},
"packages/sync": {
"name": "@wordpress/sync",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56195,7 +56195,7 @@
},
"packages/token-list": {
"name": "@wordpress/token-list",
- "version": "3.12.0",
+ "version": "3.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
@@ -56207,7 +56207,7 @@
},
"packages/undo-manager": {
"name": "@wordpress/undo-manager",
- "version": "1.12.0",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56220,7 +56220,7 @@
},
"packages/url": {
"name": "@wordpress/url",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56233,7 +56233,7 @@
},
"packages/viewport": {
"name": "@wordpress/viewport",
- "version": "6.12.0",
+ "version": "6.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56263,7 +56263,7 @@
},
"packages/warning": {
"name": "@wordpress/warning",
- "version": "3.12.0",
+ "version": "3.13.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18.12.0",
@@ -56272,7 +56272,7 @@
},
"packages/widgets": {
"name": "@wordpress/widgets",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -56300,7 +56300,7 @@
},
"packages/wordcount": {
"name": "@wordpress/wordcount",
- "version": "4.12.0",
+ "version": "4.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7"
diff --git a/packages/a11y/package.json b/packages/a11y/package.json
index 2ad91f1131b941..5eefe05954c797 100644
--- a/packages/a11y/package.json
+++ b/packages/a11y/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/a11y",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Accessibility (a11y) utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/annotations/package.json b/packages/annotations/package.json
index 4c3c849fe7178a..47d39c978fccd1 100644
--- a/packages/annotations/package.json
+++ b/packages/annotations/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/annotations",
- "version": "3.13.0-prerelease",
+ "version": "3.13.0",
"description": "Annotate content in the Gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json
index 8e8909c54f543b..432eabf6ec5a12 100644
--- a/packages/api-fetch/package.json
+++ b/packages/api-fetch/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/api-fetch",
- "version": "7.13.0-prerelease",
+ "version": "7.13.0",
"description": "Utility to make WordPress REST API requests.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/autop/package.json b/packages/autop/package.json
index 5a77142235ad77..bd48c84775d9ef 100644
--- a/packages/autop/package.json
+++ b/packages/autop/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/autop",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "WordPress's automatic paragraph functions `autop` and `removep`.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json
index 60583b94327a51..33244b4e7efb30 100644
--- a/packages/babel-plugin-import-jsx-pragma/package.json
+++ b/packages/babel-plugin-import-jsx-pragma/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-plugin-import-jsx-pragma",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json
index 30c91ac1b58da6..33d301545c4685 100644
--- a/packages/babel-plugin-makepot/package.json
+++ b/packages/babel-plugin-makepot/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-plugin-makepot",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "WordPress Babel internationalization (i18n) plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json
index 44057a5f6171af..afe1025d604a86 100644
--- a/packages/babel-preset-default/package.json
+++ b/packages/babel-preset-default/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-preset-default",
- "version": "8.13.0-prerelease",
+ "version": "8.13.0",
"description": "Default Babel preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json
index 21667917ac7fe1..2fc026a9ee72ab 100644
--- a/packages/base-styles/package.json
+++ b/packages/base-styles/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/base-styles",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Base SCSS utilities and variables for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/blob/package.json b/packages/blob/package.json
index d72f180e4b8bf6..4ecf6602400496 100644
--- a/packages/blob/package.json
+++ b/packages/blob/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blob",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Blob utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json
index efc6a16ed3798e..2fa0bf52ea126f 100644
--- a/packages/block-directory/package.json
+++ b/packages/block-directory/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-directory",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Extend editor with block directory features to search, download and install blocks.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json
index 608f079366e614..008e02355ac703 100644
--- a/packages/block-editor/package.json
+++ b/packages/block-editor/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-editor",
- "version": "14.8.0-prerelease",
+ "version": "14.8.0",
"description": "Generic block editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-library/package.json b/packages/block-library/package.json
index c16a61ac32ec13..77da5721abacb1 100644
--- a/packages/block-library/package.json
+++ b/packages/block-library/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-library",
- "version": "9.13.0-prerelease",
+ "version": "9.13.0",
"description": "Block library for the WordPress editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-serialization-default-parser/package.json b/packages/block-serialization-default-parser/package.json
index a8d0084d43f0a8..2ea349e5f94d23 100644
--- a/packages/block-serialization-default-parser/package.json
+++ b/packages/block-serialization-default-parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-serialization-default-parser",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Block serialization specification parser for WordPress posts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json
index 04e657055a8587..0e4c251a8e5f18 100644
--- a/packages/block-serialization-spec-parser/package.json
+++ b/packages/block-serialization-spec-parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-serialization-spec-parser",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Block serialization specification parser for WordPress posts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/blocks/package.json b/packages/blocks/package.json
index 51d80302c4f184..02f7784ac15aa6 100644
--- a/packages/blocks/package.json
+++ b/packages/blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blocks",
- "version": "14.2.0-prerelease",
+ "version": "14.2.0",
"description": "Block API for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json
index bc1051eb99524b..1c3a527226dfaf 100644
--- a/packages/browserslist-config/package.json
+++ b/packages/browserslist-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/browserslist-config",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "WordPress Browserslist shared configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/commands/package.json b/packages/commands/package.json
index 5d6732a6c4b80e..b28a7f89e6c3d2 100644
--- a/packages/commands/package.json
+++ b/packages/commands/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/commands",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "Handles the commands menu.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/components/package.json b/packages/components/package.json
index 2a3978e4193734..dc62f992c3bb29 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/components",
- "version": "28.13.0-prerelease",
+ "version": "28.13.0",
"description": "UI components for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/compose/package.json b/packages/compose/package.json
index bb84c5c16267fe..72c31dc744057e 100644
--- a/packages/compose/package.json
+++ b/packages/compose/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/compose",
- "version": "7.13.0-prerelease",
+ "version": "7.13.0",
"description": "WordPress higher-order components (HOCs).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/core-commands/package.json b/packages/core-commands/package.json
index 9d21b1ba3b68eb..2f2f4b0ffeb7fb 100644
--- a/packages/core-commands/package.json
+++ b/packages/core-commands/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/core-commands",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "WordPress core reusable commands.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/core-data/package.json b/packages/core-data/package.json
index 78fc7076a8d020..fe428aeb87288f 100644
--- a/packages/core-data/package.json
+++ b/packages/core-data/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/core-data",
- "version": "7.13.0-prerelease",
+ "version": "7.13.0",
"description": "Access to and manipulation of core WordPress entities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/create-block-interactive-template/package.json b/packages/create-block-interactive-template/package.json
index 9cb957186c7f73..8f59d685df91dd 100644
--- a/packages/create-block-interactive-template/package.json
+++ b/packages/create-block-interactive-template/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/create-block-interactive-template",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "Template for @wordpress/create-block to create interactive blocks with the Interactivity API.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json
index c291096222b427..b9f6991c2c153c 100644
--- a/packages/create-block-tutorial-template/package.json
+++ b/packages/create-block-tutorial-template/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/create-block-tutorial-template",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "This is a template for @wordpress/create-block that creates an example 'Copyright Date' block. This block is used in the official WordPress block development Quick Start Guide.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/create-block/package.json b/packages/create-block/package.json
index 53d34f8c3109d9..881ece8e138191 100644
--- a/packages/create-block/package.json
+++ b/packages/create-block/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/create-block",
- "version": "4.56.0-prerelease",
+ "version": "4.56.0",
"description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json
index c482fdd813dd03..4a14ac743b7249 100644
--- a/packages/customize-widgets/package.json
+++ b/packages/customize-widgets/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/customize-widgets",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Widgets blocks in Customizer Module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json
index 9a7a560bdac51f..6c4703321c6020 100644
--- a/packages/data-controls/package.json
+++ b/packages/data-controls/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/data-controls",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "A set of common controls for the @wordpress/data api.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/data/package.json b/packages/data/package.json
index ff68d293c2ac7b..ccb8f8591c0179 100644
--- a/packages/data/package.json
+++ b/packages/data/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/data",
- "version": "10.13.0-prerelease",
+ "version": "10.13.0",
"description": "Data module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dataviews/package.json b/packages/dataviews/package.json
index b57ead3e54ea9b..f4d42102731eb2 100644
--- a/packages/dataviews/package.json
+++ b/packages/dataviews/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dataviews",
- "version": "4.9.0-prerelease",
+ "version": "4.9.0",
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/date/package.json b/packages/date/package.json
index b3b7332bb8bf14..0a1052f13d95fc 100644
--- a/packages/date/package.json
+++ b/packages/date/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/date",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Date module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dependency-extraction-webpack-plugin/package.json b/packages/dependency-extraction-webpack-plugin/package.json
index 8387d658d5aac9..5738c18f55fff5 100644
--- a/packages/dependency-extraction-webpack-plugin/package.json
+++ b/packages/dependency-extraction-webpack-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dependency-extraction-webpack-plugin",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "Extract WordPress script dependencies from webpack bundles.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/deprecated/package.json b/packages/deprecated/package.json
index df43ff9f0639f5..0da22c081e83d4 100644
--- a/packages/deprecated/package.json
+++ b/packages/deprecated/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/deprecated",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Deprecation utility for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/docgen/package.json b/packages/docgen/package.json
index e5ec91f0dedf08..4b7c5e25efe15c 100644
--- a/packages/docgen/package.json
+++ b/packages/docgen/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/docgen",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "Autogenerate public API documentation from exports and JSDoc comments.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json
index 5ddc5085fa901a..d3aa36e6c6efe5 100644
--- a/packages/dom-ready/package.json
+++ b/packages/dom-ready/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dom-ready",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Execute callback after the DOM is loaded.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/dom/package.json b/packages/dom/package.json
index 1bf549364796ca..f2b96de10b5b61 100644
--- a/packages/dom/package.json
+++ b/packages/dom/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dom",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "DOM utilities module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/e2e-test-utils-playwright/package.json b/packages/e2e-test-utils-playwright/package.json
index 3bca976c076b74..ae91fa25e882d8 100644
--- a/packages/e2e-test-utils-playwright/package.json
+++ b/packages/e2e-test-utils-playwright/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/e2e-test-utils-playwright",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "End-To-End (E2E) test utils for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json
index 7663ab163c2619..9fcb70294e852d 100644
--- a/packages/e2e-test-utils/package.json
+++ b/packages/e2e-test-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/e2e-test-utils",
- "version": "11.13.0-prerelease",
+ "version": "11.13.0",
"description": "End-To-End (E2E) test utils for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json
index 3ef68396fc1ce5..62008860a8b290 100644
--- a/packages/e2e-tests/package.json
+++ b/packages/e2e-tests/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/e2e-tests",
- "version": "8.13.0-prerelease",
+ "version": "8.13.0",
"description": "End-To-End (E2E) tests for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json
index bd8c5731ef7ccd..aea81f0568fbe2 100644
--- a/packages/edit-post/package.json
+++ b/packages/edit-post/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-post",
- "version": "8.13.0-prerelease",
+ "version": "8.13.0",
"description": "Edit Post module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json
index dd814ed7861eb3..81a8164b1e1721 100644
--- a/packages/edit-site/package.json
+++ b/packages/edit-site/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-site",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "Edit Site Page module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json
index 07ec66e1b8b2f3..ed375f7430a1a4 100644
--- a/packages/edit-widgets/package.json
+++ b/packages/edit-widgets/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-widgets",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "Widgets Page module for WordPress..",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/editor/package.json b/packages/editor/package.json
index a5fa747b43d9c6..59d3caded3d322 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/editor",
- "version": "14.13.0-prerelease",
+ "version": "14.13.0",
"description": "Enhanced block editor for WordPress posts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/element/package.json b/packages/element/package.json
index 3e34c6b0ca63af..770d87ef021748 100644
--- a/packages/element/package.json
+++ b/packages/element/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/element",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "Element React module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/env/package.json b/packages/env/package.json
index ebb26e21340160..a0cf44e99fb2f9 100644
--- a/packages/env/package.json
+++ b/packages/env/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/env",
- "version": "10.13.0-prerelease",
+ "version": "10.13.0",
"description": "A zero-config, self contained local WordPress environment for development and testing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/escape-html/package.json b/packages/escape-html/package.json
index 13ebb4793ed127..12e9ae354defa3 100644
--- a/packages/escape-html/package.json
+++ b/packages/escape-html/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/escape-html",
- "version": "3.13.0-prerelease",
+ "version": "3.13.0",
"description": "Escape HTML utils.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json
index 246da0479393b8..64c0a422873d69 100644
--- a/packages/eslint-plugin/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/eslint-plugin",
- "version": "21.6.0-prerelease",
+ "version": "21.6.0",
"description": "ESLint plugin for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/fields/package.json b/packages/fields/package.json
index 3e73fe3bb753aa..eb60f448fc13e6 100644
--- a/packages/fields/package.json
+++ b/packages/fields/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/fields",
- "version": "0.5.0-prerelease",
+ "version": "0.5.0",
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/format-library/package.json b/packages/format-library/package.json
index 06271e0c9c360a..94efb550519ddc 100644
--- a/packages/format-library/package.json
+++ b/packages/format-library/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/format-library",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Format library for the WordPress editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/hooks/package.json b/packages/hooks/package.json
index 7aea26efdc7b35..c9e652d30d83e1 100644
--- a/packages/hooks/package.json
+++ b/packages/hooks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/hooks",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "WordPress hooks library.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json
index 4e17fab9045782..f99b2ca99e5fbe 100644
--- a/packages/html-entities/package.json
+++ b/packages/html-entities/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/html-entities",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "HTML entity utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/i18n/package.json b/packages/i18n/package.json
index 8d86bb1d90368c..71f6ea646a93af 100644
--- a/packages/i18n/package.json
+++ b/packages/i18n/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/i18n",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "WordPress internationalization (i18n) library.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/icons/package.json b/packages/icons/package.json
index 3df43cb209b437..fb00a4b8d27e8b 100644
--- a/packages/icons/package.json
+++ b/packages/icons/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/icons",
- "version": "10.13.0-prerelease",
+ "version": "10.13.0",
"description": "WordPress Icons package, based on dashicon.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/interactivity-router/package.json b/packages/interactivity-router/package.json
index 67cc0704f51603..30881e554e93f0 100644
--- a/packages/interactivity-router/package.json
+++ b/packages/interactivity-router/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/interactivity-router",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "Package that exposes state and actions from the `core/router` store, part of the Interactivity API.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/interactivity/package.json b/packages/interactivity/package.json
index 6382a789dc2b8b..90356de25b646a 100644
--- a/packages/interactivity/package.json
+++ b/packages/interactivity/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/interactivity",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "Package that provides a standard and simple way to handle the frontend interactivity of Gutenberg blocks.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/interface/package.json b/packages/interface/package.json
index a1c552f01781ce..2f3ada022dabe4 100644
--- a/packages/interface/package.json
+++ b/packages/interface/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/interface",
- "version": "8.2.0-prerelease",
+ "version": "8.2.0",
"description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json
index 0490fb9c04495b..bc987f67aca88e 100644
--- a/packages/is-shallow-equal/package.json
+++ b/packages/is-shallow-equal/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/is-shallow-equal",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Test for shallow equality between two objects or arrays.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json
index 0615e9ed9ea4f3..638ce7fa523238 100644
--- a/packages/jest-console/package.json
+++ b/packages/jest-console/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/jest-console",
- "version": "8.13.0-prerelease",
+ "version": "8.13.0",
"description": "Custom Jest matchers for the Console object.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json
index 9a1367224c3e90..659c0b78221519 100644
--- a/packages/jest-preset-default/package.json
+++ b/packages/jest-preset-default/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/jest-preset-default",
- "version": "12.13.0-prerelease",
+ "version": "12.13.0",
"description": "Default Jest preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/jest-puppeteer-axe/package.json b/packages/jest-puppeteer-axe/package.json
index 40595cdfa290b2..c94e1ba4defbde 100644
--- a/packages/jest-puppeteer-axe/package.json
+++ b/packages/jest-puppeteer-axe/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/jest-puppeteer-axe",
- "version": "7.13.0-prerelease",
+ "version": "7.13.0",
"description": "Axe API integration with Jest and Puppeteer.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json
index 73c794a087c67c..8510d99a6f8d14 100644
--- a/packages/keyboard-shortcuts/package.json
+++ b/packages/keyboard-shortcuts/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/keyboard-shortcuts",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Handling keyboard shortcuts.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json
index e2e69f291ce1e5..cc261f4eecf668 100644
--- a/packages/keycodes/package.json
+++ b/packages/keycodes/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/keycodes",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/lazy-import/package.json b/packages/lazy-import/package.json
index cf4cddb73c8623..f7bf8c7b0d3f3d 100644
--- a/packages/lazy-import/package.json
+++ b/packages/lazy-import/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/lazy-import",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "Lazily import a module, installing it automatically if missing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json
index 7707592782bcf6..31fd970e2d8da3 100644
--- a/packages/list-reusable-blocks/package.json
+++ b/packages/list-reusable-blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/list-reusable-blocks",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Adding Export/Import support to the reusable blocks listing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json
index 33ab27a6b98d76..3a2713eed4dacb 100644
--- a/packages/media-utils/package.json
+++ b/packages/media-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/media-utils",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "WordPress Media Upload Utils.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/notices/package.json b/packages/notices/package.json
index a19276cf0e2c01..7f0e0dc71532c1 100644
--- a/packages/notices/package.json
+++ b/packages/notices/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/notices",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "State management for notices.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/npm-package-json-lint-config/package.json b/packages/npm-package-json-lint-config/package.json
index 1acd0b7dcf74e5..4dda73b91d2ed2 100644
--- a/packages/npm-package-json-lint-config/package.json
+++ b/packages/npm-package-json-lint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/npm-package-json-lint-config",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "WordPress npm-package-json-lint shareable configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/nux/package.json b/packages/nux/package.json
index 612244b92944db..13a803af1ad447 100644
--- a/packages/nux/package.json
+++ b/packages/nux/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/nux",
- "version": "9.13.0-prerelease",
+ "version": "9.13.0",
"description": "NUX (New User eXperience) module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/patterns/package.json b/packages/patterns/package.json
index 42ee04848006b0..b0c6e81f1e2498 100644
--- a/packages/patterns/package.json
+++ b/packages/patterns/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/patterns",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "Management of user pattern editing.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/plugins/package.json b/packages/plugins/package.json
index 2e1aeaf1c9b3ae..97c0ac64259905 100644
--- a/packages/plugins/package.json
+++ b/packages/plugins/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/plugins",
- "version": "7.13.0-prerelease",
+ "version": "7.13.0",
"description": "Plugins module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json
index 71802c5da439e0..98c2de79108d66 100644
--- a/packages/postcss-plugins-preset/package.json
+++ b/packages/postcss-plugins-preset/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/postcss-plugins-preset",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "PostCSS sharable plugins preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/postcss-themes/package.json b/packages/postcss-themes/package.json
index c6658889aeda4d..c03da4d1f06a72 100644
--- a/packages/postcss-themes/package.json
+++ b/packages/postcss-themes/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/postcss-themes",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "PostCSS plugin to generate theme colors.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/preferences-persistence/package.json b/packages/preferences-persistence/package.json
index 1e5ca3595e9c7b..c9343b28b3e439 100644
--- a/packages/preferences-persistence/package.json
+++ b/packages/preferences-persistence/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/preferences-persistence",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "Persistence utilities for `wordpress/preferences`.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/preferences/package.json b/packages/preferences/package.json
index 5a94f7c17281e3..9c262dff51fbff 100644
--- a/packages/preferences/package.json
+++ b/packages/preferences/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/preferences",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Utilities for managing WordPress preferences.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json
index 47dec2d7a7aa06..45f7374e06fbf7 100644
--- a/packages/prettier-config/package.json
+++ b/packages/prettier-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/prettier-config",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "WordPress Prettier shared configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/primitives/package.json b/packages/primitives/package.json
index b1947e4d7516ec..1f024a64bce463 100644
--- a/packages/primitives/package.json
+++ b/packages/primitives/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/primitives",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "WordPress cross-platform primitives.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/priority-queue/package.json b/packages/priority-queue/package.json
index 4fa445fc3194ef..eb213ffe2d031a 100644
--- a/packages/priority-queue/package.json
+++ b/packages/priority-queue/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/priority-queue",
- "version": "3.13.0-prerelease",
+ "version": "3.13.0",
"description": "Generic browser priority queue.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/private-apis/package.json b/packages/private-apis/package.json
index bcfc6ad2a0d7ed..1436270e2c7f49 100644
--- a/packages/private-apis/package.json
+++ b/packages/private-apis/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/private-apis",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "Internal experimental APIs for WordPress core.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/project-management-automation/package.json b/packages/project-management-automation/package.json
index 0058153a033250..95c475c5689c24 100644
--- a/packages/project-management-automation/package.json
+++ b/packages/project-management-automation/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/project-management-automation",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "GitHub Action that implements various automation to assist with managing the Gutenberg GitHub repository.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json
index 2ccfd22673aa91..439596ec2b5d50 100644
--- a/packages/react-i18n/package.json
+++ b/packages/react-i18n/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-i18n",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "React bindings for @wordpress/i18n.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/readable-js-assets-webpack-plugin/package.json b/packages/readable-js-assets-webpack-plugin/package.json
index eb14986310c862..5fa231d98088db 100644
--- a/packages/readable-js-assets-webpack-plugin/package.json
+++ b/packages/readable-js-assets-webpack-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/readable-js-assets-webpack-plugin",
- "version": "3.13.0-prerelease",
+ "version": "3.13.0",
"description": "Generate a readable JS file for each JS asset.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/redux-routine/package.json b/packages/redux-routine/package.json
index 9704d2cf144bf2..4946cdf6dcaada 100644
--- a/packages/redux-routine/package.json
+++ b/packages/redux-routine/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/redux-routine",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Redux middleware for generator coroutines.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json
index 1461aa747b46b8..b56837df1d34c5 100644
--- a/packages/reusable-blocks/package.json
+++ b/packages/reusable-blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/reusable-blocks",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "Reusable blocks utilities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json
index 53e9296889ca84..99637e6023799e 100644
--- a/packages/rich-text/package.json
+++ b/packages/rich-text/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/rich-text",
- "version": "7.13.0-prerelease",
+ "version": "7.13.0",
"description": "Rich text value and manipulation API.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/router/package.json b/packages/router/package.json
index 0b32d61b3464af..26b4f29df04f60 100644
--- a/packages/router/package.json
+++ b/packages/router/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/router",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "Router API for WordPress pages.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/scripts/package.json b/packages/scripts/package.json
index 17f0379de77ce1..f3e6b325f6d3be 100644
--- a/packages/scripts/package.json
+++ b/packages/scripts/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/scripts",
- "version": "30.6.0-prerelease",
+ "version": "30.6.0",
"description": "Collection of reusable scripts for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json
index e538f66985148d..d2cd9aa93d2cef 100644
--- a/packages/server-side-render/package.json
+++ b/packages/server-side-render/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/server-side-render",
- "version": "5.13.0-prerelease",
+ "version": "5.13.0",
"description": "The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/shortcode/package.json b/packages/shortcode/package.json
index 351b47dd4659dd..f87fe06d9bb421 100644
--- a/packages/shortcode/package.json
+++ b/packages/shortcode/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/shortcode",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Shortcode module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/style-engine/package.json b/packages/style-engine/package.json
index fa8d19a506108f..bec29df32f7628 100644
--- a/packages/style-engine/package.json
+++ b/packages/style-engine/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/style-engine",
- "version": "2.13.0-prerelease",
+ "version": "2.13.0",
"description": "A suite of parsers and compilers for WordPress styles.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/stylelint-config/package.json b/packages/stylelint-config/package.json
index 3b1e94372cc451..0c35601e9c5353 100644
--- a/packages/stylelint-config/package.json
+++ b/packages/stylelint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/stylelint-config",
- "version": "23.5.0-prerelease",
+ "version": "23.5.0",
"description": "stylelint config for WordPress development.",
"author": "The WordPress Contributors",
"license": "MIT",
diff --git a/packages/sync/package.json b/packages/sync/package.json
index 714832322774ba..042e1544199296 100644
--- a/packages/sync/package.json
+++ b/packages/sync/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/sync",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "Sync Data.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/token-list/package.json b/packages/token-list/package.json
index 0103c07e0e6ead..50fe379c1a08e0 100644
--- a/packages/token-list/package.json
+++ b/packages/token-list/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/token-list",
- "version": "3.13.0-prerelease",
+ "version": "3.13.0",
"description": "Constructable, plain JavaScript DOMTokenList implementation, supporting non-browser runtimes.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/undo-manager/package.json b/packages/undo-manager/package.json
index 8ebf45fc9df9ec..5046d9591a8c08 100644
--- a/packages/undo-manager/package.json
+++ b/packages/undo-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/undo-manager",
- "version": "1.13.0-prerelease",
+ "version": "1.13.0",
"description": "A small package to manage undo/redo.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/url/package.json b/packages/url/package.json
index 6a4297a5084434..8e3fc0dc140cd8 100644
--- a/packages/url/package.json
+++ b/packages/url/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/url",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "WordPress URL utilities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/viewport/package.json b/packages/viewport/package.json
index 8aadf2af898fb0..a3d15a587645c9 100644
--- a/packages/viewport/package.json
+++ b/packages/viewport/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/viewport",
- "version": "6.13.0-prerelease",
+ "version": "6.13.0",
"description": "Viewport module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/warning/package.json b/packages/warning/package.json
index 91c4bc5c591955..e41b9205d6d374 100644
--- a/packages/warning/package.json
+++ b/packages/warning/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/warning",
- "version": "3.13.0-prerelease",
+ "version": "3.13.0",
"description": "Warning utility for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/widgets/package.json b/packages/widgets/package.json
index d72c179a5ad419..0ab7fe138cf513 100644
--- a/packages/widgets/package.json
+++ b/packages/widgets/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/widgets",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json
index f69f8e06219160..e4e7efbba33256 100644
--- a/packages/wordcount/package.json
+++ b/packages/wordcount/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/wordcount",
- "version": "4.13.0-prerelease",
+ "version": "4.13.0",
"description": "WordPress word count utility.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
From 758b750ee3347cba4f1d334d1ab378387657f837 Mon Sep 17 00:00:00 2001
From: Riad Benguella
Date: Wed, 27 Nov 2024 12:24:10 +0100
Subject: [PATCH 049/384] Site Editor: Unify layout with posts dataviews
(#67162)
Co-authored-by: youknowriad
Co-authored-by: ntsekouras
---
.../edit-site/src/components/app/index.js | 19 ++++---------------
.../edit-site/src/components/layout/index.js | 17 +++++++++++++++--
.../src/components/posts-app/index.js | 14 +++-----------
3 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/packages/edit-site/src/components/app/index.js b/packages/edit-site/src/components/app/index.js
index 3588565fcb3c17..7e4c50d7d00f09 100644
--- a/packages/edit-site/src/components/app/index.js
+++ b/packages/edit-site/src/components/app/index.js
@@ -1,11 +1,6 @@
/**
* WordPress dependencies
*/
-import { SlotFillProvider } from '@wordpress/components';
-import {
- UnsavedChangesWarning,
- privateApis as editorPrivateApis,
-} from '@wordpress/editor';
import { store as noticesStore } from '@wordpress/notices';
import { useDispatch } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
@@ -23,7 +18,6 @@ import useSetCommandContext from '../../hooks/commands/use-set-command-context';
import { useRegisterSiteEditorRoutes } from '../site-editor-routes';
const { RouterProvider } = unlock( routerPrivateApis );
-const { GlobalStylesProvider } = unlock( editorPrivateApis );
function AppLayout() {
useCommonCommands();
@@ -50,14 +44,9 @@ export default function App() {
}
return (
-
-
-
-
-
-
-
-
-
+
+
+
+
);
}
diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js
index cbc0a4661bf3e7..47ff65aa2ac678 100644
--- a/packages/edit-site/src/components/layout/index.js
+++ b/packages/edit-site/src/components/layout/index.js
@@ -10,6 +10,7 @@ import {
__unstableMotion as motion,
__unstableAnimatePresence as AnimatePresence,
__unstableUseNavigateRegions as useNavigateRegions,
+ SlotFillProvider,
} from '@wordpress/components';
import {
useReducedMotion,
@@ -23,6 +24,7 @@ import { CommandMenu } from '@wordpress/commands';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import {
EditorSnackbars,
+ UnsavedChangesWarning,
privateApis as editorPrivateApis,
} from '@wordpress/editor';
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
@@ -44,12 +46,12 @@ import SavePanel from '../save-panel';
const { useCommands } = unlock( coreCommandsPrivateApis );
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
-const { NavigableRegion } = unlock( editorPrivateApis );
+const { NavigableRegion, GlobalStylesProvider } = unlock( editorPrivateApis );
const { useLocation } = unlock( routerPrivateApis );
const ANIMATION_DURATION = 0.3;
-export default function Layout( { route } ) {
+function Layout( { route } ) {
const { params } = useLocation();
const { canvas = 'view' } = params;
useCommands();
@@ -78,6 +80,7 @@ export default function Layout( { route } ) {
return (
<>
+
{ canvas === 'view' && }
);
}
+
+export default function LayoutWithGlobalStylesProvider( props ) {
+ return (
+
+
+
+
+
+ );
+}
diff --git a/packages/edit-site/src/components/posts-app/index.js b/packages/edit-site/src/components/posts-app/index.js
index 72e5b1eb997498..e6eb90c1680019 100644
--- a/packages/edit-site/src/components/posts-app/index.js
+++ b/packages/edit-site/src/components/posts-app/index.js
@@ -1,10 +1,6 @@
/**
* WordPress dependencies
*/
-import {
- UnsavedChangesWarning,
- privateApis as editorPrivateApis,
-} from '@wordpress/editor';
import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
@@ -16,7 +12,6 @@ import { unlock } from '../../lock-unlock';
import useActiveRoute from '../layout/router';
const { RouterProvider } = unlock( routerPrivateApis );
-const { GlobalStylesProvider } = unlock( editorPrivateApis );
function PostsLayout() {
useRegisterPostsAppRoutes();
@@ -26,11 +21,8 @@ function PostsLayout() {
export default function PostsApp() {
return (
-
-
-
-
-
-
+
+
+
);
}
From 443ce894391a0e07738661c5b3d4af4e34c47616 Mon Sep 17 00:00:00 2001
From: Benazeer Hassan <66269472+benazeer-ben@users.noreply.github.com>
Date: Wed, 27 Nov 2024 19:06:10 +0530
Subject: [PATCH 050/384] Site editor: style the selected template pattern
(#65917)
* Updated code to set active pattern and its styling
* Fixes for linting issues on updated files
* Updated code based on the first round feedback points
* Modification to highlight active iitem on focus
* Removed local/session storage
* Changes applied from drafted PR
* Changes applied from drafted PR
* Updated with new style changes
* Linting Fix
* Updated code to set active pattern and its styling
* Fixes for linting issues on updated files
* Updated code based on the first round feedback points
* Modification to highlight active iitem on focus
* Removed local/session storage
* Changes applied from drafted PR
* Changes applied from drafted PR
* Updated with new style changes
* Linting Fix
* Fix spacing
---------
Co-authored-by: benazeer-ben
Co-authored-by: ciampo
Co-authored-by: ntsekouras
Co-authored-by: t-hamano
Co-authored-by: jasmussen
Co-authored-by: patil-vipul
Co-authored-by: juanfra
---
.../components/block-patterns-list/index.js | 13 +++++++++++-
.../components/block-patterns-list/style.scss | 21 ++++++++++++++-----
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/packages/block-editor/src/components/block-patterns-list/index.js b/packages/block-editor/src/components/block-patterns-list/index.js
index 8128e89418f45a..0c7e54c3c62b24 100644
--- a/packages/block-editor/src/components/block-patterns-list/index.js
+++ b/packages/block-editor/src/components/block-patterns-list/index.js
@@ -41,6 +41,7 @@ function BlockPattern( {
onHover,
showTitlesAsTooltip,
category,
+ isSelected,
} ) {
const [ isDragging, setIsDragging ] = useState( false );
const { blocks, viewportWidth } = pattern;
@@ -114,6 +115,7 @@ function BlockPattern( {
pattern.type ===
INSERTER_PATTERN_TYPES.user &&
! pattern.syncStatus,
+ 'is-selected': isSelected,
}
) }
/>
@@ -192,6 +194,7 @@ function BlockPatternsList(
ref
) {
const [ activeCompositeId, setActiveCompositeId ] = useState( undefined );
+ const [ activePattern, setActivePattern ] = useState( null ); // State to track active pattern
useEffect( () => {
// Reset the active composite item whenever the available patterns change,
@@ -201,6 +204,11 @@ function BlockPatternsList(
setActiveCompositeId( firstCompositeItemId );
}, [ blockPatterns ] );
+ const handleClickPattern = ( pattern, blocks ) => {
+ setActivePattern( pattern.name );
+ onClickPattern( pattern, blocks );
+ };
+
return (
) ) }
{ pagingProps && }
diff --git a/packages/block-editor/src/components/block-patterns-list/style.scss b/packages/block-editor/src/components/block-patterns-list/style.scss
index c46bb49b9a9016..8b1b0b54c9b1a0 100644
--- a/packages/block-editor/src/components/block-patterns-list/style.scss
+++ b/packages/block-editor/src/components/block-patterns-list/style.scss
@@ -44,19 +44,29 @@
outline: $border-width solid rgba($black, 0.1);
outline-offset: -$border-width;
border-radius: $radius-medium;
+
+ transition: outline 0.1s linear;
+ @include reduce-motion("transition");
}
}
- &:hover:not(:focus) .block-editor-block-preview__container::after {
+ // Selected
+ &.is-selected .block-editor-block-preview__container::after {
+ outline-color: $gray-900;
+ outline-width: var(--wp-admin-border-width-focus);
+ outline-offset: calc(-1 * var(--wp-admin-border-width-focus));
+ }
+
+ // Hover state
+ &:hover .block-editor-block-preview__container::after {
outline-color: rgba($black, 0.3);
}
- &:focus .block-editor-block-preview__container::after {
+ // Focused state
+ &[data-focus-visible] .block-editor-block-preview__container::after {
outline-color: var(--wp-admin-theme-color);
outline-width: var(--wp-admin-border-width-focus);
- outline-offset: calc((-1 * var(--wp-admin-border-width-focus)));
- transition: outline 0.1s linear;
- @include reduce-motion("transition");
+ outline-offset: calc(-1 * var(--wp-admin-border-width-focus));
}
.block-editor-patterns__pattern-details:not(:empty) {
@@ -68,6 +78,7 @@
.block-editor-patterns__pattern-icon-wrapper {
min-width: 24px;
height: 24px;
+
.block-editor-patterns__pattern-icon {
fill: var(--wp-block-synced-color);
}
From 78fffa7ff0e2c19ac2891633f251f6470dae045b Mon Sep 17 00:00:00 2001
From: Andrei Draganescu
Date: Wed, 27 Nov 2024 16:23:20 +0200
Subject: [PATCH 051/384] keep only copy, duplicate and delete in the more menu
(#67279)
Co-authored-by: draganescu
Co-authored-by: getdave
Co-authored-by: ellatrix
Co-authored-by: richtabor
Co-authored-by: annezazu
---
.../block-settings-menu-controls/index.js | 3 ++-
.../block-settings-dropdown.js | 7 ++++++-
.../editor/src/components/provider/index.js | 20 ++++++++++++++++---
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/packages/block-editor/src/components/block-settings-menu-controls/index.js b/packages/block-editor/src/components/block-settings-menu-controls/index.js
index 4ebce4172e9b37..b0755be4c26297 100644
--- a/packages/block-editor/src/components/block-settings-menu-controls/index.js
+++ b/packages/block-editor/src/components/block-settings-menu-controls/index.js
@@ -55,7 +55,8 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
const convertToGroupButtonProps =
useConvertToGroupButtonProps( selectedClientIds );
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
- const showConvertToGroupButton = isGroupable || isUngroupable;
+ const showConvertToGroupButton =
+ ( isGroupable || isUngroupable ) && ! isContentOnly;
return (
{
const {
@@ -74,6 +76,7 @@ export function BlockSettingsDropdown( {
getBlockAttributes,
getOpenedBlockSettingsMenu,
getBlockEditingMode,
+ isZoomOut: _isZoomOut,
} = unlock( select( blockEditorStore ) );
const { getActiveBlockVariation } = select( blocksStore );
@@ -98,10 +101,12 @@ export function BlockSettingsDropdown( {
openedBlockSettingsMenu: getOpenedBlockSettingsMenu(),
isContentOnly:
getBlockEditingMode( firstBlockClientId ) === 'contentOnly',
+ isZoomOut: _isZoomOut(),
};
},
[ firstBlockClientId ]
);
+
const { getBlockOrder, getSelectedBlockClientIds } =
useSelect( blockEditorStore );
@@ -248,7 +253,7 @@ export function BlockSettingsDropdown( {
clientId={ firstBlockClientId }
/>
) }
- { ! isContentOnly && (
+ { ( ! isContentOnly || isZoomOut ) && (
{
+ const { isZoomOut: _isZoomOut } = unlock(
+ select( blockEditorStore )
+ );
+
+ return _isZoomOut();
+ } );
+
const shouldRenderTemplate = !! template && mode !== 'post-only';
const rootLevelPost = shouldRenderTemplate ? template : post;
const defaultBlockContext = useMemo( () => {
@@ -357,9 +367,13 @@ export const ExperimentalEditorProvider = withRegistryProvider(
{ children }
{ ! settings.isPreviewMode && (
<>
-
-
-
+ { ! isZoomOut && (
+ <>
+
+
+
+ >
+ ) }
{ mode === 'template-locked' && (
) }
From f8140c4fcc8db2d6078ad76fd433c79df3543860 Mon Sep 17 00:00:00 2001
From: Ella <4710635+ellatrix@users.noreply.github.com>
Date: Wed, 27 Nov 2024 15:58:58 +0100
Subject: [PATCH 052/384] Drag and drop: fix drop zones on block drag (#67317)
Co-authored-by: ellatrix
Co-authored-by: tellthemachines
Co-authored-by: ramonjd
---
.../inserter-draggable-blocks/index.js | 48 +++++++----------
.../src/components/media-placeholder/index.js | 53 +++++++++----------
packages/components/CHANGELOG.md | 1 +
packages/components/src/drop-zone/index.tsx | 45 ++++++++--------
packages/components/src/drop-zone/types.ts | 5 ++
test/e2e/specs/editor/blocks/image.spec.js | 23 ++++----
6 files changed, 84 insertions(+), 91 deletions(-)
diff --git a/packages/block-editor/src/components/inserter-draggable-blocks/index.js b/packages/block-editor/src/components/inserter-draggable-blocks/index.js
index 0e1aaadc72e67b..ebef6304937aa7 100644
--- a/packages/block-editor/src/components/inserter-draggable-blocks/index.js
+++ b/packages/block-editor/src/components/inserter-draggable-blocks/index.js
@@ -2,12 +2,9 @@
* WordPress dependencies
*/
import { Draggable } from '@wordpress/components';
-import {
- createBlock,
- serialize,
- store as blocksStore,
-} from '@wordpress/blocks';
+import { createBlock, store as blocksStore } from '@wordpress/blocks';
import { useDispatch, useSelect } from '@wordpress/data';
+import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
@@ -24,20 +21,6 @@ const InserterDraggableBlocks = ( {
children,
pattern,
} ) => {
- const transferData = {
- type: 'inserter',
- blocks,
- };
-
- const blocksContainMedia =
- blocks.filter(
- ( block ) =>
- ( block.name === 'core/image' ||
- block.name === 'core/audio' ||
- block.name === 'core/video' ) &&
- ( block.attributes.url || block.attributes.src )
- ).length > 0;
-
const blockTypeIcon = useSelect(
( select ) => {
const { getBlockType } = select( blocksStore );
@@ -52,6 +35,13 @@ const InserterDraggableBlocks = ( {
useDispatch( blockEditorStore )
);
+ const patternBlock = useMemo( () => {
+ return pattern?.type === INSERTER_PATTERN_TYPES.user &&
+ pattern?.syncStatus !== 'unsynced'
+ ? [ createBlock( 'core/block', { ref: pattern.id } ) ]
+ : undefined;
+ }, [ pattern?.type, pattern?.syncStatus, pattern?.id ] );
+
if ( ! isEnabled ) {
return children( {
draggable: false,
@@ -60,21 +50,21 @@ const InserterDraggableBlocks = ( {
} );
}
+ const draggableBlocks = patternBlock ?? blocks;
return (
{
startDragging();
- const parsedBlocks =
- pattern?.type === INSERTER_PATTERN_TYPES.user &&
- pattern?.syncStatus !== 'unsynced'
- ? [ createBlock( 'core/block', { ref: pattern.id } ) ]
- : blocks;
- event.dataTransfer.setData(
- blocksContainMedia ? 'default' : 'text/html',
- serialize( parsedBlocks )
- );
+ for ( const block of draggableBlocks ) {
+ const type = `wp-block:${ block.name }`;
+ // This will fill in the dataTransfer.types array so that
+ // the drop zone can check if the draggable is eligible.
+ // Unfortuantely, on drag start, we don't have access to the
+ // actual data, only the data keys/types.
+ event.dataTransfer.items.add( '', type );
+ }
} }
onDragEnd={ () => {
stopDragging();
diff --git a/packages/block-editor/src/components/media-placeholder/index.js b/packages/block-editor/src/components/media-placeholder/index.js
index e7b6c836468f02..0cbc6c8c26203f 100644
--- a/packages/block-editor/src/components/media-placeholder/index.js
+++ b/packages/block-editor/src/components/media-placeholder/index.js
@@ -19,7 +19,6 @@ import { __ } from '@wordpress/i18n';
import { useState, useEffect } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { keyboardReturn } from '@wordpress/icons';
-import { pasteHandler } from '@wordpress/blocks';
import deprecated from '@wordpress/deprecated';
/**
@@ -29,6 +28,7 @@ import MediaUpload from '../media-upload';
import MediaUploadCheck from '../media-upload/check';
import URLPopover from '../url-popover';
import { store as blockEditorStore } from '../../store';
+import { parseDropEvent } from '../use-on-block-drop';
const noop = () => {};
@@ -229,30 +229,15 @@ export function MediaPlaceholder( {
} );
};
- async function handleBlocksDrop( blocks ) {
- if ( ! blocks || ! Array.isArray( blocks ) ) {
- return;
- }
+ async function handleBlocksDrop( event ) {
+ const { blocks } = parseDropEvent( event );
- function recursivelyFindMediaFromBlocks( _blocks ) {
- return _blocks.flatMap( ( block ) =>
- ( block.name === 'core/image' ||
- block.name === 'core/audio' ||
- block.name === 'core/video' ) &&
- ( block.attributes.url || block.attributes.src )
- ? [ block ]
- : recursivelyFindMediaFromBlocks( block.innerBlocks )
- );
- }
-
- const mediaBlocks = recursivelyFindMediaFromBlocks( blocks );
-
- if ( ! mediaBlocks.length ) {
+ if ( ! blocks?.length ) {
return;
}
const uploadedMediaList = await Promise.all(
- mediaBlocks.map( ( block ) => {
+ blocks.map( ( block ) => {
const blockType = block.name.split( '/' )[ 1 ];
if ( block.attributes.id ) {
block.attributes.type = blockType;
@@ -292,13 +277,6 @@ export function MediaPlaceholder( {
}
}
- async function onDrop( event ) {
- const blocks = pasteHandler( {
- HTML: event.dataTransfer?.getData( 'default' ),
- } );
- return await handleBlocksDrop( blocks );
- }
-
const onUpload = ( event ) => {
onFilesUpload( event.target.files );
};
@@ -385,7 +363,26 @@ export function MediaPlaceholder( {
return null;
}
- return ;
+ return (
+ {
+ const prefix = 'wp-block:core/';
+ const types = [];
+ for ( const type of dataTransfer.types ) {
+ if ( type.startsWith( prefix ) ) {
+ types.push( type.slice( prefix.length ) );
+ }
+ }
+ return (
+ types.every( ( type ) =>
+ allowedTypes.includes( type )
+ ) && ( multiple ? true : types.length === 1 )
+ );
+ } }
+ />
+ );
};
const renderCancelLink = () => {
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index feff5ddc975356..a780f8f139d3e7 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -32,6 +32,7 @@
- `ColorPicker`: Update sizes of color format select and copy button ([#67093](https://github.com/WordPress/gutenberg/pull/67093)).
- `ComboboxControl`: Update reset button size ([#67215](https://github.com/WordPress/gutenberg/pull/67215)).
- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).
+- `DropZone`: Add `isEligible` prop to allow customizing whether the drop zone should activate ([#67317](https://github.com/WordPress/gutenberg/pull/67317)).
- `CircularOptionPicker`: Update `Button` sizes to be ready for 40px default size ([#67285](https://github.com/WordPress/gutenberg/pull/67285)).
### Experimental
diff --git a/packages/components/src/drop-zone/index.tsx b/packages/components/src/drop-zone/index.tsx
index b1bd0199e877d8..dd8b97149a0598 100644
--- a/packages/components/src/drop-zone/index.tsx
+++ b/packages/components/src/drop-zone/index.tsx
@@ -15,7 +15,7 @@ import { __experimentalUseDropZone as useDropZone } from '@wordpress/compose';
/**
* Internal dependencies
*/
-import type { DropType, DropZoneProps } from './types';
+import type { DropZoneProps } from './types';
import type { WordPressComponentProps } from '../context';
/**
@@ -47,19 +47,22 @@ export function DropZoneComponent( {
onFilesDrop,
onHTMLDrop,
onDrop,
+ isEligible = () => true,
...restProps
}: WordPressComponentProps< DropZoneProps, 'div', false > ) {
const [ isDraggingOverDocument, setIsDraggingOverDocument ] =
useState< boolean >();
const [ isDraggingOverElement, setIsDraggingOverElement ] =
useState< boolean >();
- const [ type, setType ] = useState< DropType >();
+ const [ isActive, setIsActive ] = useState< boolean >();
const ref = useDropZone( {
onDrop( event ) {
- const files = event.dataTransfer
- ? getFilesFromDataTransfer( event.dataTransfer )
- : [];
- const html = event.dataTransfer?.getData( 'text/html' );
+ if ( ! event.dataTransfer ) {
+ return;
+ }
+
+ const files = getFilesFromDataTransfer( event.dataTransfer );
+ const html = event.dataTransfer.getData( 'text/html' );
/**
* From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
@@ -76,32 +79,31 @@ export function DropZoneComponent( {
onDragStart( event ) {
setIsDraggingOverDocument( true );
- let _type: DropType = 'default';
+ if ( ! event.dataTransfer ) {
+ return;
+ }
/**
* From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
* The order of the checks is important to recognize the HTML drop.
*/
- if ( event.dataTransfer?.types.includes( 'text/html' ) ) {
- _type = 'html';
+ if ( event.dataTransfer.types.includes( 'text/html' ) ) {
+ setIsActive( !! onHTMLDrop );
} else if (
// Check for the types because sometimes the files themselves
// are only available on drop.
- event.dataTransfer?.types.includes( 'Files' ) ||
- ( event.dataTransfer
- ? getFilesFromDataTransfer( event.dataTransfer )
- : []
- ).length > 0
+ event.dataTransfer.types.includes( 'Files' ) ||
+ getFilesFromDataTransfer( event.dataTransfer ).length > 0
) {
- _type = 'file';
+ setIsActive( !! onFilesDrop );
+ } else {
+ setIsActive( !! onDrop && isEligible( event.dataTransfer ) );
}
-
- setType( _type );
},
onDragEnd() {
setIsDraggingOverElement( false );
setIsDraggingOverDocument( false );
- setType( undefined );
+ setIsActive( undefined );
},
onDragEnter() {
setIsDraggingOverElement( true );
@@ -112,14 +114,9 @@ export function DropZoneComponent( {
} );
const classes = clsx( 'components-drop-zone', className, {
- 'is-active':
- ( isDraggingOverDocument || isDraggingOverElement ) &&
- ( ( type === 'file' && onFilesDrop ) ||
- ( type === 'html' && onHTMLDrop ) ||
- ( type === 'default' && onDrop ) ),
+ 'is-active': isActive,
'is-dragging-over-document': isDraggingOverDocument,
'is-dragging-over-element': isDraggingOverElement,
- [ `is-dragging-${ type }` ]: !! type,
} );
return (
diff --git a/packages/components/src/drop-zone/types.ts b/packages/components/src/drop-zone/types.ts
index 3982889a4f3eac..503f400bc4be45 100644
--- a/packages/components/src/drop-zone/types.ts
+++ b/packages/components/src/drop-zone/types.ts
@@ -26,4 +26,9 @@ export type DropZoneProps = {
* It receives the HTML being dropped as an argument.
*/
onHTMLDrop?: ( html: string ) => void;
+ /**
+ * A function to determine if the drop zone is eligible to handle the drop
+ * data transfer items.
+ */
+ isEligible?: ( dataTransfer: DataTransfer ) => boolean;
};
diff --git a/test/e2e/specs/editor/blocks/image.spec.js b/test/e2e/specs/editor/blocks/image.spec.js
index b2195f2c676885..d3cddd9c3a51cd 100644
--- a/test/e2e/specs/editor/blocks/image.spec.js
+++ b/test/e2e/specs/editor/blocks/image.spec.js
@@ -528,14 +528,13 @@ test.describe( 'Image', () => {
name: 'Block: Image',
} );
- const html = `
-
-
- "Cat" by tomhouslay is licensed under CC BY-NC 2.0 .
-
- `;
-
- await page.evaluate( ( _html ) => {
+ await page.evaluate( () => {
+ const { createBlock } = window.wp.blocks;
+ const block = createBlock( 'core/image', {
+ url: 'https://live.staticflickr.com/3894/14962688165_04759a8b03_b.jpg',
+ alt: 'Cat',
+ caption: `"Cat" by tomhouslay is licensed under CC BY-NC 2.0 .`,
+ } );
const dummy = document.createElement( 'div' );
dummy.style.width = '10px';
dummy.style.height = '10px';
@@ -545,13 +544,17 @@ test.describe( 'Image', () => {
dummy.style.left = 0;
dummy.draggable = 'true';
dummy.addEventListener( 'dragstart', ( event ) => {
- event.dataTransfer.setData( 'default', _html );
+ event.dataTransfer.setData(
+ 'wp-blocks',
+ JSON.stringify( { blocks: [ block ] } )
+ );
+ event.dataTransfer.setData( 'wp-block:core/image', '' );
setTimeout( () => {
dummy.remove();
}, 0 );
} );
document.body.appendChild( dummy );
- }, html );
+ } );
await page.mouse.move( 0, 0 );
await page.mouse.down();
From 8dd99aaeba86ed65ab3e301a5179acd9d6ef8304 Mon Sep 17 00:00:00 2001
From: Mayank Tripathi <70465598+Mayank-Tripathi32@users.noreply.github.com>
Date: Wed, 27 Nov 2024 22:14:18 +0530
Subject: [PATCH 053/384] Fix: Header layout spacing in Firefox (#67074)
Co-authored-by: jorgefilipecosta
Co-authored-by: Mayank-Tripathi32
Co-authored-by: SainathPoojary
Co-authored-by: maddisondesigns
---
packages/editor/src/components/header/style.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/editor/src/components/header/style.scss b/packages/editor/src/components/header/style.scss
index d12c01506a052c..4cbbe992e63fdb 100644
--- a/packages/editor/src/components/header/style.scss
+++ b/packages/editor/src/components/header/style.scss
@@ -7,7 +7,7 @@
&:has(> .editor-header__center) {
grid-template: auto / $header-height min-content 1fr min-content $header-height;
@include break-medium {
- grid-template: auto / $header-height minmax(min-content, 1fr) 2fr minmax(min-content, 1fr) $header-height;
+ grid-template: auto / $header-height minmax(min-content, 2fr) 2.5fr minmax(min-content, 2fr) $header-height;
}
}
@include break-mobile {
From 6781982c80cbc025308500a1f54ae31792ebdc24 Mon Sep 17 00:00:00 2001
From: Lena Morita
Date: Thu, 28 Nov 2024 03:18:38 +0900
Subject: [PATCH 054/384] DuotonePicker: Simplify Button styles (#66641)
* DuotonePicker: Simplify Button styles
* Add changelog
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla
---
packages/components/CHANGELOG.md | 1 +
.../duotone-picker/color-list-picker/index.tsx | 16 ++++++++--------
.../duotone-picker/color-list-picker/style.scss | 6 ------
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index a780f8f139d3e7..be930515f16659 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -34,6 +34,7 @@
- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).
- `DropZone`: Add `isEligible` prop to allow customizing whether the drop zone should activate ([#67317](https://github.com/WordPress/gutenberg/pull/67317)).
- `CircularOptionPicker`: Update `Button` sizes to be ready for 40px default size ([#67285](https://github.com/WordPress/gutenberg/pull/67285)).
+- `DuotonePicker`: Simplify Button styles ([#66641](https://github.com/WordPress/gutenberg/pull/66641)).
### Experimental
diff --git a/packages/components/src/duotone-picker/color-list-picker/index.tsx b/packages/components/src/duotone-picker/color-list-picker/index.tsx
index bd009c5db1d7d4..e3925b7d064fdc 100644
--- a/packages/components/src/duotone-picker/color-list-picker/index.tsx
+++ b/packages/components/src/duotone-picker/color-list-picker/index.tsx
@@ -12,7 +12,6 @@ import Button from '../../button';
import ColorPalette from '../../color-palette';
import ColorIndicator from '../../color-indicator';
import Icon from '../../icon';
-import { HStack } from '../../h-stack';
import type { ColorListPickerProps, ColorOptionProps } from './types';
import { useInstanceId } from '@wordpress/compose';
@@ -32,23 +31,24 @@ function ColorOption( {
return (
<>
setIsOpen( ( prev ) => ! prev ) }
aria-expanded={ isOpen }
aria-controls={ contentId }
- >
-
- { value ? (
+ icon={
+ value ? (
) : (
- ) }
- { label }
-
-
+ )
+ }
+ text={ label }
+ />
Date: Wed, 27 Nov 2024 20:27:28 +0100
Subject: [PATCH 055/384] Remove fallback for `context.postType` (#67345)
Co-authored-by: SantosGuillamot
---
packages/editor/src/bindings/post-meta.js | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/packages/editor/src/bindings/post-meta.js b/packages/editor/src/bindings/post-meta.js
index a3602ce7d62076..fcd068ac21d8ab 100644
--- a/packages/editor/src/bindings/post-meta.js
+++ b/packages/editor/src/bindings/post-meta.js
@@ -108,11 +108,8 @@ export default {
return false;
}
- const postType =
- context?.postType || select( editorStore ).getCurrentPostType();
-
- // Check that editing is happening in the post editor and not a template.
- if ( postType === 'wp_template' ) {
+ // Lock editing when `postType` is not defined.
+ if ( ! context?.postType ) {
return false;
}
From d9eb6d9a6d64650f08ee68792b88f914de62cda1 Mon Sep 17 00:00:00 2001
From: Bernie Reiter <96308+ockham@users.noreply.github.com>
Date: Wed, 27 Nov 2024 20:35:22 +0100
Subject: [PATCH 056/384] Navigation block: Remove more obsolete Block Hooks
helpers (#67193)
- `block_core_navigation_remove_serialized_parent_block` was `replaced by remove_serialized_parent_block`.
- `apply_block_hooks_to_content` has been part of WP Core since 6.6, so we don't need to check for its existence anymore.
Co-authored-by: ockham
Co-authored-by: draganescu
---
.../block-library/src/navigation/index.php | 31 ++-----------------
1 file changed, 2 insertions(+), 29 deletions(-)
diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php
index ae3b9620a33584..68b23aceeced65 100644
--- a/packages/block-library/src/navigation/index.php
+++ b/packages/block-library/src/navigation/index.php
@@ -1436,20 +1436,6 @@ function block_core_navigation_get_most_recently_published_navigation() {
return null;
}
-/**
- * Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks.
- *
- * @since 6.5.0
- *
- * @param string $serialized_block The serialized markup of a block and its inner blocks.
- * @return string
- */
-function block_core_navigation_remove_serialized_parent_block( $serialized_block ) {
- $start = strpos( $serialized_block, '-->' ) + strlen( '-->' );
- $end = strrpos( $serialized_block, '
+ Pattern Overrides
+
+
+ Post Meta Binding
+
+
+ No Overrides or Binding
+
+ `;
+
+ const { id } = await requestUtils.createBlock( {
+ title: 'Pattern',
+ content,
+ status: 'publish',
+ } );
+
+ await admin.visitSiteEditor( {
+ postId: 'emptytheme//index',
+ postType: 'wp_template',
+ canvas: 'edit',
+ } );
+
+ await editor.setContent( '' );
+
+ await editor.insertBlock( {
+ name: 'core/block',
+ attributes: { ref: id },
+ } );
+
+ const patternBlock = editor.canvas.getByRole( 'document', {
+ name: 'Block: Pattern',
+ } );
+ const paragraphs = editor.canvas.getByRole( 'document', {
+ name: 'Block: Paragraph',
+ } );
+ const blockWithOverrides = paragraphs.filter( {
+ hasText: 'Pattern Overrides',
+ } );
+ const blockWithBindings = paragraphs.filter( {
+ hasText: 'Post Meta Binding',
+ } );
+ const blockWithoutOverridesOrBindings = paragraphs.filter( {
+ hasText: 'No Overrides or Binding',
+ } );
+
+ await test.step( 'Zoomed in / Design mode', async () => {
+ await editor.switchEditorTool( 'Design' );
+ // In zoomed in and design mode the pattern block and child blocks
+ // with bindings are editable.
+ await expect( patternBlock ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithOverrides ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+
+ await test.step( 'Zoomed in / Write mode - pattern as a section', async () => {
+ await editor.switchEditorTool( 'Write' );
+ // The pattern block is still editable as a section.
+ await expect( patternBlock ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ // Child blocks of the pattern with bindings are editable.
+ await expect( blockWithOverrides ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+
+ await test.step( 'Zoomed out / Write mode - pattern as a section', async () => {
+ await page.getByLabel( 'Zoom Out' ).click();
+ // In zoomed out only the pattern block is editable, as in this scenario it's a section.
+ await expect( patternBlock ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithOverrides ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+
+ await test.step( 'Zoomed out / Design mode - pattern as a section', async () => {
+ await editor.switchEditorTool( 'Design' );
+ // In zoomed out only the pattern block is editable, as in this scenario it's a section.
+ await expect( patternBlock ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithOverrides ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+
+ // Zoom out and group the pattern.
+ await page.getByLabel( 'Zoom Out' ).click();
+ await editor.selectBlocks( patternBlock );
+ await editor.clickBlockOptionsMenuItem( 'Group' );
+
+ await test.step( 'Zoomed in / Write mode - pattern nested in a section', async () => {
+ await editor.switchEditorTool( 'Write' );
+ // The pattern block is not inert as it has editable content, but it shouldn't be selectable.
+ // TODO: find a way to test that the block is not selectable.
+ await expect( patternBlock ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ // Child blocks of the pattern are editable as normal.
+ await expect( blockWithOverrides ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).not.toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+
+ await test.step( 'Zoomed out / Write mode - pattern nested in a section', async () => {
+ await page.getByLabel( 'Zoom Out' ).click();
+ // None of the pattern is editable in zoomed out when nested in a section.
+ await expect( patternBlock ).toHaveAttribute( 'inert', 'true' );
+ await expect( blockWithOverrides ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+
+ await test.step( 'Zoomed out / Design mode - pattern nested in a section', async () => {
+ await editor.switchEditorTool( 'Design' );
+ // None of the pattern is editable in zoomed out when nested in a section.
+ await expect( patternBlock ).toHaveAttribute( 'inert', 'true' );
+ await expect( blockWithOverrides ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ await expect( blockWithoutOverridesOrBindings ).toHaveAttribute(
+ 'inert',
+ 'true'
+ );
+ } );
+ } );
+
+ test( 'disables editing of nested patterns', async ( {
+ page,
+ admin,
+ requestUtils,
+ editor,
+ } ) => {
+ const paragraphName = 'Editable paragraph';
+ const headingName = 'Editable heading';
+ const innerPattern = await requestUtils.createBlock( {
+ title: 'Inner Pattern',
+ content: `
+ Inner paragraph
+ `,
+ status: 'publish',
+ } );
+ const outerPattern = await requestUtils.createBlock( {
+ title: 'Outer Pattern',
+ content: `
+ Outer heading
+
+ `,
+ status: 'publish',
+ } );
+
+ await admin.createNewPost();
+
+ await editor.insertBlock( {
+ name: 'core/block',
+ attributes: { ref: outerPattern.id },
+ } );
+
+ // Make an edit to the outer pattern heading.
+ await editor.canvas
+ .getByRole( 'document', { name: 'Block: Heading' } )
+ .fill( 'Outer heading (edited)' );
+
+ const postId = await editor.publishPost();
+
+ // Check the pattern has the correct attributes.
+ await expect.poll( editor.getBlocks ).toMatchObject( [
+ {
+ name: 'core/block',
+ attributes: {
+ ref: outerPattern.id,
+ content: {
+ [ headingName ]: {
+ content: 'Outer heading (edited)',
+ },
+ },
+ },
+ innerBlocks: [],
+ },
+ ] );
+ // Check it renders correctly.
+ const headingBlock = editor.canvas.getByRole( 'document', {
+ name: 'Block: Heading',
+ } );
+ const paragraphBlock = editor.canvas.getByRole( 'document', {
+ name: 'Block: Paragraph',
+ } );
+ await expect( headingBlock ).toHaveText( 'Outer heading (edited)' );
+ await expect( headingBlock ).not.toHaveAttribute( 'inert', 'true' );
+ await expect( paragraphBlock ).toHaveText(
+ 'Inner paragraph (edited)'
+ );
+ await expect( paragraphBlock ).toHaveAttribute( 'inert', 'true' );
+
+ // Edit the outer pattern.
+ await editor.selectBlocks(
+ editor.canvas
+ .getByRole( 'document', { name: 'Block: Pattern' } )
+ .first()
+ );
+ await editor.showBlockToolbar();
+ await page
+ .getByRole( 'toolbar', { name: 'Block tools' } )
+ .getByRole( 'button', { name: 'Edit original' } )
+ .click();
+
+ // The inner paragraph should be editable in the pattern focus mode.
+ await editor.selectBlocks(
+ editor.canvas
+ .getByRole( 'document', { name: 'Block: Pattern' } )
+ .first()
+ );
+ await expect(
+ editor.canvas.getByRole( 'document', {
+ name: 'Block: Paragraph',
+ } ),
+ 'The inner paragraph should be editable'
+ ).not.toHaveAttribute( 'inert', 'true' );
+
+ // Visit the post on the frontend.
+ await page.goto( `/?p=${ postId }` );
+
+ await expect(
+ page.getByRole( 'heading', { level: 2 } )
+ ).toHaveText( 'Outer heading (edited)' );
+ await expect(
+ page.getByText( 'Inner paragraph (edited)' )
+ ).toBeVisible();
+ } );
+ } );
+
test( 'retains override values when converting a pattern block to regular blocks', async ( {
page,
admin,
@@ -425,107 +740,6 @@ test.describe( 'Pattern Overrides', () => {
await expect( buttonLink ).toHaveAttribute( 'rel', /^\s*nofollow\s*$/ );
} );
- test( 'disables editing of nested patterns', async ( {
- page,
- admin,
- requestUtils,
- editor,
- } ) => {
- const paragraphName = 'Editable paragraph';
- const headingName = 'Editable heading';
- const innerPattern = await requestUtils.createBlock( {
- title: 'Inner Pattern',
- content: `
-Inner paragraph
-`,
- status: 'publish',
- } );
- const outerPattern = await requestUtils.createBlock( {
- title: 'Outer Pattern',
- content: `
-Outer heading
-
-`,
- status: 'publish',
- } );
-
- await admin.createNewPost();
-
- await editor.insertBlock( {
- name: 'core/block',
- attributes: { ref: outerPattern.id },
- } );
-
- // Make an edit to the outer pattern heading.
- await editor.canvas
- .getByRole( 'document', { name: 'Block: Heading' } )
- .fill( 'Outer heading (edited)' );
-
- const postId = await editor.publishPost();
-
- // Check the pattern has the correct attributes.
- await expect.poll( editor.getBlocks ).toMatchObject( [
- {
- name: 'core/block',
- attributes: {
- ref: outerPattern.id,
- content: {
- [ headingName ]: {
- content: 'Outer heading (edited)',
- },
- },
- },
- innerBlocks: [],
- },
- ] );
- // Check it renders correctly.
- const headingBlock = editor.canvas.getByRole( 'document', {
- name: 'Block: Heading',
- } );
- const paragraphBlock = editor.canvas.getByRole( 'document', {
- name: 'Block: Paragraph',
- } );
- await expect( headingBlock ).toHaveText( 'Outer heading (edited)' );
- await expect( headingBlock ).not.toHaveAttribute( 'inert', 'true' );
- await expect( paragraphBlock ).toHaveText( 'Inner paragraph (edited)' );
- await expect( paragraphBlock ).toHaveAttribute( 'inert', 'true' );
-
- // Edit the outer pattern.
- await editor.selectBlocks(
- editor.canvas
- .getByRole( 'document', { name: 'Block: Pattern' } )
- .first()
- );
- await editor.showBlockToolbar();
- await page
- .getByRole( 'toolbar', { name: 'Block tools' } )
- .getByRole( 'button', { name: 'Edit original' } )
- .click();
-
- // The inner paragraph should be editable in the pattern focus mode.
- await editor.selectBlocks(
- editor.canvas
- .getByRole( 'document', { name: 'Block: Pattern' } )
- .first()
- );
- await expect(
- editor.canvas.getByRole( 'document', {
- name: 'Block: Paragraph',
- } ),
- 'The inner paragraph should be editable'
- ).not.toHaveAttribute( 'inert', 'true' );
-
- // Visit the post on the frontend.
- await page.goto( `/?p=${ postId }` );
-
- await expect( page.getByRole( 'heading', { level: 2 } ) ).toHaveText(
- 'Outer heading (edited)'
- );
- await expect(
- page.getByText( 'Inner paragraph (edited)' )
- ).toBeVisible();
- } );
-
test( 'resets overrides after clicking the reset button', async ( {
page,
admin,
From 2f6ef277f3c9f875f8294c387727249ecd0defa0 Mon Sep 17 00:00:00 2001
From: Daniel Richards
Date: Thu, 28 Nov 2024 14:23:17 +0800
Subject: [PATCH 062/384] Remove use of `contentOnly` block editing mode for
synced patterns (#67364)
* Remove use of `contentOnly` block editing mode for synced patterns
* Update unit tests
----
Co-authored-by: talldan
---
packages/block-editor/src/store/reducer.js | 2 +-
packages/block-editor/src/store/test/reducer.js | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/packages/block-editor/src/store/reducer.js b/packages/block-editor/src/store/reducer.js
index 1e09ec98f005ab..edae9c392c37de 100644
--- a/packages/block-editor/src/store/reducer.js
+++ b/packages/block-editor/src/store/reducer.js
@@ -2355,7 +2355,7 @@ function getDerivedBlockEditingModesForTree(
return;
}
- derivedBlockEditingModes.set( clientId, 'contentOnly' );
+ // Else do nothing, use the default block editing mode.
return;
}
diff --git a/packages/block-editor/src/store/test/reducer.js b/packages/block-editor/src/store/test/reducer.js
index b539afde9e0258..dd1665d6736ada 100644
--- a/packages/block-editor/src/store/test/reducer.js
+++ b/packages/block-editor/src/store/test/reducer.js
@@ -3828,7 +3828,6 @@ describe( 'state', () => {
expect( initialState.derivedBlockEditingModes ).toEqual(
new Map(
Object.entries( {
- 'root-pattern': 'contentOnly',
'pattern-paragraph': 'disabled',
'pattern-group': 'disabled',
'pattern-paragraph-with-overrides': 'contentOnly',
@@ -3883,7 +3882,6 @@ describe( 'state', () => {
expect( derivedBlockEditingModes ).toEqual(
new Map(
Object.entries( {
- 'root-pattern': 'contentOnly', // Pattern and section.
'pattern-paragraph': 'disabled',
'pattern-group': 'disabled',
'pattern-paragraph-with-overrides': 'contentOnly', // Pattern child with bindings.
@@ -3903,7 +3901,7 @@ describe( 'state', () => {
'paragraph-1': 'contentOnly', // Content block in section.
'group-2': 'disabled',
'paragraph-2': 'contentOnly', // Content block in section.
- 'root-pattern': 'contentOnly', // Pattern and section.
+ 'root-pattern': 'contentOnly', // Section.
'pattern-paragraph': 'disabled',
'pattern-group': 'disabled',
'pattern-paragraph-with-overrides': 'contentOnly', // Pattern child with bindings.
From c9a5cab0e2e9063054ed4f299bde734a242e3794 Mon Sep 17 00:00:00 2001
From: Riad Benguella
Date: Thu, 28 Nov 2024 08:51:04 +0100
Subject: [PATCH 063/384] Site Editor: Use path based routing instead of query
args and site-editor.php routes (#67199)
Co-authored-by: youknowriad
Co-authored-by: jsnajdr
Co-authored-by: tyxla
---
backport-changelog/6.8/7903.md | 3 +
lib/compat/wordpress-6.8/site-editor.php | 124 ++++++++++
lib/experimental/posts/load.php | 12 -
lib/load.php | 1 +
package-lock.json | 10 +-
.../src/admin-navigation-commands.js | 6 +-
.../src/site-editor-navigation-commands.js | 143 ++++++------
.../src/components/add-new-pattern/index.js | 26 +--
.../src/components/add-new-template/index.js | 8 +-
.../edit-site/src/components/app/index.js | 40 +++-
.../block-editor/use-editor-iframe-props.js | 9 +-
.../use-navigate-to-entity-record.js | 4 +-
.../block-editor/use-site-editor-settings.js | 12 +-
.../src/components/dataviews-actions/index.js | 6 +-
.../edit-site/src/components/editor/index.js | 93 +++++---
.../editor/use-resolve-edited-entity.js | 19 +-
.../components/global-styles-sidebar/index.js | 8 +-
.../edit-site/src/components/layout/index.js | 7 +-
.../edit-site/src/components/layout/router.js | 86 -------
.../delete-category-menu-item.js | 7 +-
.../src/components/page-patterns/fields.js | 23 +-
.../src/components/page-patterns/index.js | 30 +--
.../src/components/page-templates/fields.js | 19 +-
.../src/components/page-templates/index.js | 31 +--
.../src/components/post-list/index.js | 78 ++++---
.../src/components/posts-app-routes/home.js | 36 ---
.../src/components/posts-app-routes/index.js | 17 +-
.../{posts-edit.js => post-item.js} | 14 +-
.../posts-list-view-quick-edit.js | 52 -----
.../posts-app-routes/posts-list-view.js | 40 ----
.../posts-app-routes/posts-view-quick-edit.js | 49 ----
.../components/posts-app-routes/posts-view.js | 35 ---
.../src/components/posts-app-routes/posts.js | 66 ++++++
.../src/components/posts-app/index.js | 17 +-
.../src/components/resizable-frame/index.js | 13 +-
.../edit-site/src/components/routes/link.js | 68 ------
.../src/components/save-panel/index.js | 4 +-
.../sidebar-dataviews/add-new-view.js | 18 +-
.../sidebar-dataviews/dataview-item.js | 13 +-
.../src/components/sidebar-dataviews/index.js | 4 +-
.../sidebar-global-styles-wrapper/index.js | 54 ++---
.../sidebar-navigation-item/index.js | 12 +-
.../index.js | 26 +--
.../sidebar-navigation-screen-main/index.js | 13 +-
.../more-menu.js | 8 +-
.../use-navigation-menu-handlers.js | 4 +-
.../index.js | 12 +-
.../leaf-more-menu.js | 30 +--
.../category-item.js | 25 +-
.../index.js | 7 +-
.../content.js | 41 ++--
.../index.js | 15 +-
.../sidebar-navigation-screen/index.js | 4 +-
.../site-editor-routes/home-edit.js | 17 --
.../{home-view.js => home.js} | 9 +-
.../components/site-editor-routes/index.js | 56 ++---
.../site-editor-routes/navigation-edit.js | 22 --
.../navigation-item-edit.js | 26 ---
.../navigation-item-view.js | 25 --
.../site-editor-routes/navigation-item.js | 39 ++++
.../site-editor-routes/navigation-view.js | 21 --
.../site-editor-routes/navigation.js | 34 +++
.../{pages-edit.js => page-item.js} | 20 +-
.../pages-list-view-quick-edit.js | 56 -----
.../site-editor-routes/pages-list-view.js | 44 ----
.../pages-view-quick-edit.js | 53 -----
.../site-editor-routes/pages-view.js | 39 ----
.../components/site-editor-routes/pages.js | 66 ++++++
.../site-editor-routes/pattern-item.js | 15 ++
.../site-editor-routes/patterns-edit.js | 24 --
.../site-editor-routes/patterns-view.js | 22 --
.../components/site-editor-routes/patterns.js | 15 ++
.../{styles-view.js => styles.js} | 14 +-
.../site-editor-routes/template-item.js | 15 ++
.../site-editor-routes/template-part-item.js | 15 ++
.../site-editor-routes/templates-edit.js | 22 --
.../site-editor-routes/templates-list-view.js | 28 ---
.../site-editor-routes/templates-view.js | 22 --
.../site-editor-routes/templates.js | 45 ++++
.../src/components/site-hub/index.js | 9 +-
.../src/hooks/commands/use-common-commands.js | 86 ++-----
.../hooks/commands/use-set-command-context.js | 4 +-
.../edit-site/src/store/private-actions.js | 7 +
packages/edit-site/src/store/reducer.js | 2 +
.../src/utils/is-previewing-theme.js | 4 +-
.../edit-site/src/utils/use-activate-theme.js | 7 +-
packages/router/package.json | 4 +-
packages/router/src/history.ts | 99 --------
packages/router/src/link.tsx | 55 +++++
packages/router/src/private-apis.ts | 3 +
packages/router/src/router.tsx | 220 +++++++++++++++++-
packages/router/tsconfig.json | 5 +-
.../editor/various/pattern-overrides.spec.js | 12 +-
.../specs/site-editor/browser-history.spec.js | 4 +-
.../specs/site-editor/command-center.spec.js | 2 +-
.../specs/site-editor/hybrid-theme.spec.js | 2 +-
.../site-editor-url-navigation.spec.js | 4 +-
97 files changed, 1249 insertions(+), 1546 deletions(-)
create mode 100644 backport-changelog/6.8/7903.md
create mode 100644 lib/compat/wordpress-6.8/site-editor.php
delete mode 100644 packages/edit-site/src/components/layout/router.js
delete mode 100644 packages/edit-site/src/components/posts-app-routes/home.js
rename packages/edit-site/src/components/posts-app-routes/{posts-edit.js => post-item.js} (62%)
delete mode 100644 packages/edit-site/src/components/posts-app-routes/posts-list-view-quick-edit.js
delete mode 100644 packages/edit-site/src/components/posts-app-routes/posts-list-view.js
delete mode 100644 packages/edit-site/src/components/posts-app-routes/posts-view-quick-edit.js
delete mode 100644 packages/edit-site/src/components/posts-app-routes/posts-view.js
create mode 100644 packages/edit-site/src/components/posts-app-routes/posts.js
delete mode 100644 packages/edit-site/src/components/routes/link.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/home-edit.js
rename packages/edit-site/src/components/site-editor-routes/{home-view.js => home.js} (66%)
delete mode 100644 packages/edit-site/src/components/site-editor-routes/navigation-edit.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/navigation-item-edit.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/navigation-item-view.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/navigation-item.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/navigation-view.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/navigation.js
rename packages/edit-site/src/components/site-editor-routes/{pages-edit.js => page-item.js} (54%)
delete mode 100644 packages/edit-site/src/components/site-editor-routes/pages-list-view-quick-edit.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/pages-list-view.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/pages-view-quick-edit.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/pages-view.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/pages.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/pattern-item.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/patterns-edit.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/patterns-view.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/patterns.js
rename packages/edit-site/src/components/site-editor-routes/{styles-view.js => styles.js} (58%)
create mode 100644 packages/edit-site/src/components/site-editor-routes/template-item.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/template-part-item.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/templates-edit.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/templates-list-view.js
delete mode 100644 packages/edit-site/src/components/site-editor-routes/templates-view.js
create mode 100644 packages/edit-site/src/components/site-editor-routes/templates.js
delete mode 100644 packages/router/src/history.ts
create mode 100644 packages/router/src/link.tsx
diff --git a/backport-changelog/6.8/7903.md b/backport-changelog/6.8/7903.md
new file mode 100644
index 00000000000000..cb20d8d2dd2b1b
--- /dev/null
+++ b/backport-changelog/6.8/7903.md
@@ -0,0 +1,3 @@
+https://github.com/WordPress/wordpress-develop/pull/7903
+
+* https://github.com/WordPress/gutenberg/pull/67199
diff --git a/lib/compat/wordpress-6.8/site-editor.php b/lib/compat/wordpress-6.8/site-editor.php
new file mode 100644
index 00000000000000..cde108830b1d2c
--- /dev/null
+++ b/lib/compat/wordpress-6.8/site-editor.php
@@ -0,0 +1,124 @@
+ '/wp_navigation/' . $_REQUEST['postId'] ), remove_query_arg( array( 'postType', 'postId' ) ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_navigation' === $_REQUEST['postType'] && empty( $_REQUEST['postId'] ) ) {
+ return add_query_arg( array( 'p' => '/navigation' ), remove_query_arg( 'postType' ) );
+ }
+
+ if ( isset( $_REQUEST['path'] ) && '/wp_global_styles' === $_REQUEST['path'] ) {
+ return add_query_arg( array( 'p' => '/styles' ), remove_query_arg( 'path' ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'page' === $_REQUEST['postType'] && ( empty( $_REQUEST['canvas'] ) || empty( $_REQUEST['postId'] ) ) ) {
+ return add_query_arg( array( 'p' => '/page' ), remove_query_arg( 'postType' ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'page' === $_REQUEST['postType'] && ! empty( $_REQUEST['postId'] ) ) {
+ return add_query_arg( array( 'p' => '/page/' . $_REQUEST['postId'] ), remove_query_arg( array( 'postType', 'postId' ) ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_template' === $_REQUEST['postType'] && ( empty( $_REQUEST['canvas'] ) || empty( $_REQUEST['postId'] ) ) ) {
+ return add_query_arg( array( 'p' => '/template' ), remove_query_arg( 'postType' ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_template' === $_REQUEST['postType'] && ! empty( $_REQUEST['postId'] ) ) {
+ return add_query_arg( array( 'p' => '/wp_template/' . $_REQUEST['postId'] ), remove_query_arg( array( 'postType', 'postId' ) ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_block' === $_REQUEST['postType'] && ( empty( $_REQUEST['canvas'] ) || empty( $_REQUEST['postId'] ) ) ) {
+ return add_query_arg( array( 'p' => '/pattern' ), remove_query_arg( 'postType' ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_block' === $_REQUEST['postType'] && ! empty( $_REQUEST['postId'] ) ) {
+ return add_query_arg( array( 'p' => '/wp_block/' . $_REQUEST['postId'] ), remove_query_arg( array( 'postType', 'postId' ) ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_template_part' === $_REQUEST['postType'] && ( empty( $_REQUEST['canvas'] ) || empty( $_REQUEST['postId'] ) ) ) {
+ return add_query_arg( array( 'p' => '/pattern' ) );
+ }
+
+ if ( isset( $_REQUEST['postType'] ) && 'wp_template_part' === $_REQUEST['postType'] && ! empty( $_REQUEST['postId'] ) ) {
+ return add_query_arg( array( 'p' => '/wp_template_part/' . $_REQUEST['postId'] ), remove_query_arg( array( 'postType', 'postId' ) ) );
+ }
+
+ // The following redirects are for backward compatibility with the old site editor URLs.
+ if ( isset( $_REQUEST['path'] ) && '/wp_template_part/all' === $_REQUEST['path'] ) {
+ return add_query_arg(
+ array(
+ 'p' => '/pattern',
+ 'postType' => 'wp_template_part',
+ ),
+ remove_query_arg( 'path' )
+ );
+ }
+
+ if ( isset( $_REQUEST['path'] ) && '/page' === $_REQUEST['path'] ) {
+ return add_query_arg( array( 'p' => '/page' ), remove_query_arg( 'path' ) );
+ }
+
+ if ( isset( $_REQUEST['path'] ) && '/wp_template' === $_REQUEST['path'] ) {
+ return add_query_arg( array( 'p' => '/template' ), remove_query_arg( 'path' ) );
+ }
+
+ if ( isset( $_REQUEST['path'] ) && '/patterns' === $_REQUEST['path'] ) {
+ return add_query_arg( array( 'p' => '/pattern' ), remove_query_arg( 'path' ) );
+ }
+
+ if ( isset( $_REQUEST['path'] ) && '/navigation' === $_REQUEST['path'] ) {
+ return add_query_arg( array( 'p' => '/navigation' ), remove_query_arg( 'path' ) );
+ }
+
+ return add_query_arg( array( 'p' => '/' ) );
+}
+
+function gutenberg_redirect_site_editor_deprecated_urls() {
+ $redirection = gutenberg_get_site_editor_redirection();
+ if ( false !== $redirection ) {
+ wp_redirect( $redirection, 301 );
+ exit;
+ }
+}
+add_action( 'admin_init', 'gutenberg_redirect_site_editor_deprecated_urls' );
+
+/**
+ * Filter the `wp_die_handler` to allow access to the Site Editor's new pages page
+ * for Classic themes.
+ *
+ * site-editor.php's access is forbidden for hybrid/classic themes and only allowed with some very special query args (some very special pages like template parts...).
+ * The only way to disable this protection since we're changing the urls in Gutenberg is to override the wp_die_handler.
+ *
+ * @param callable $default_handler The default handler.
+ * @return callable The default handler or a custom handler.
+ */
+function gutenberg_styles_wp_die_handler( $default_handler ) {
+ if ( ! wp_is_block_theme() && str_contains( $_SERVER['REQUEST_URI'], 'site-editor.php' ) && isset( $_GET['p'] ) ) {
+ return '__return_false';
+ }
+ return $default_handler;
+}
+add_filter( 'wp_die_handler', 'gutenberg_styles_wp_die_handler' );
diff --git a/lib/experimental/posts/load.php b/lib/experimental/posts/load.php
index 7321392b11a25d..699534f1886f52 100644
--- a/lib/experimental/posts/load.php
+++ b/lib/experimental/posts/load.php
@@ -69,18 +69,6 @@ function gutenberg_posts_dashboard() {
echo '
';
}
-/**
- * Redirects to the new posts dashboard page and adds the postType query arg.
- */
-function gutenberg_add_post_type_arg() {
- global $pagenow;
- if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'gutenberg-posts-dashboard' === $_GET['page'] && empty( $_GET['postType'] ) ) {
- wp_redirect( admin_url( '/admin.php?page=gutenberg-posts-dashboard&postType=post' ) );
- exit;
- }
-}
-add_action( 'admin_init', 'gutenberg_add_post_type_arg' );
-
/**
* Replaces the default posts menu item with the new posts dashboard.
*/
diff --git a/lib/load.php b/lib/load.php
index 85d1c7e3292b50..97c5404a3a3ead 100644
--- a/lib/load.php
+++ b/lib/load.php
@@ -98,6 +98,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.8/blocks.php';
require __DIR__ . '/compat/wordpress-6.8/functions.php';
require __DIR__ . '/compat/wordpress-6.8/post.php';
+require __DIR__ . '/compat/wordpress-6.8/site-editor.php';
// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
diff --git a/package-lock.json b/package-lock.json
index ccf779f2d67eab..dc0c18f3b6ac5e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -44492,6 +44492,12 @@
"node": ">=10.0.0"
}
},
+ "node_modules/route-recognizer": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/route-recognizer/-/route-recognizer-0.3.4.tgz",
+ "integrity": "sha512-2+MhsfPhvauN1O8KaXpXAOfR/fwe8dnUXVM+xw7yt40lJRfPVQxV6yryZm0cgRvAj5fMF/mdRZbL2ptwbs5i2g==",
+ "license": "MIT"
+ },
"node_modules/rrweb-cssom": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz",
@@ -55563,10 +55569,12 @@
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "7.25.7",
+ "@wordpress/compose": "*",
"@wordpress/element": "*",
"@wordpress/private-apis": "*",
"@wordpress/url": "*",
- "history": "^5.3.0"
+ "history": "^5.3.0",
+ "route-recognizer": "^0.3.4"
},
"engines": {
"node": ">=18.12.0",
diff --git a/packages/core-commands/src/admin-navigation-commands.js b/packages/core-commands/src/admin-navigation-commands.js
index 8a8167bb29b820..f82faa05baae4c 100644
--- a/packages/core-commands/src/admin-navigation-commands.js
+++ b/packages/core-commands/src/admin-navigation-commands.js
@@ -44,11 +44,7 @@ const getAddNewPageCommand = () =>
}
);
if ( page?.id ) {
- history.push( {
- postId: page.id,
- postType: 'page',
- canvas: 'edit',
- } );
+ history.navigate( `/page/${ page.id }?canvas=edit` );
}
} catch ( error ) {
const errorMessage =
diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js
index 2785d809d41e03..c1b12a84d4d61a 100644
--- a/packages/core-commands/src/site-editor-navigation-commands.js
+++ b/packages/core-commands/src/site-editor-navigation-commands.js
@@ -136,19 +136,18 @@ const getNavigationCommandLoaderPerPostType = ( postType ) =>
return {
...command,
callback: ( { close } ) => {
- const args = {
- postType,
- postId: record.id,
- canvas: 'edit',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate(
+ `/${ postType }/${ record.id }?canvas=edit`
+ );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: `/${ postType }/${ record.id }`,
+ canvas: 'edit',
+ }
+ );
}
close();
},
@@ -220,19 +219,18 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
: __( '(no title)' ),
icon: icons[ templateType ],
callback: ( { close } ) => {
- const args = {
- postType: templateType,
- postId: record.id,
- canvas: 'edit',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate(
+ `/${ templateType }/${ record.id }?canvas=edit`
+ );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: `/${ templateType }/${ record.id }`,
+ canvas: 'edit',
+ }
+ );
}
close();
},
@@ -249,18 +247,19 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
label: __( 'Template parts' ),
icon: symbolFilled,
callback: ( { close } ) => {
- const args = {
- postType: 'wp_template_part',
- categoryId: 'all-parts',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate(
+ '/pattern?postType=wp_template_part&categoryId=all-parts'
+ );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: '/pattern',
+ postType: 'wp_template_part',
+ categoryId: 'all-parts',
+ }
+ );
}
close();
},
@@ -303,17 +302,15 @@ const getSiteEditorBasicNavigationCommands = () =>
label: __( 'Navigation' ),
icon: navigation,
callback: ( { close } ) => {
- const args = {
- postType: 'wp_navigation',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate( '/navigation' );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: '/navigation',
+ }
+ );
}
close();
},
@@ -324,17 +321,15 @@ const getSiteEditorBasicNavigationCommands = () =>
label: __( 'Styles' ),
icon: styles,
callback: ( { close } ) => {
- const args = {
- path: '/wp_global_styles',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate( '/styles' );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: '/styles',
+ }
+ );
}
close();
},
@@ -345,17 +340,15 @@ const getSiteEditorBasicNavigationCommands = () =>
label: __( 'Pages' ),
icon: page,
callback: ( { close } ) => {
- const args = {
- postType: 'page',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate( '/page' );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: '/page',
+ }
+ );
}
close();
},
@@ -366,17 +359,15 @@ const getSiteEditorBasicNavigationCommands = () =>
label: __( 'Templates' ),
icon: layout,
callback: ( { close } ) => {
- const args = {
- postType: 'wp_template',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate( '/template' );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: '/template',
+ }
+ );
}
close();
},
@@ -389,17 +380,15 @@ const getSiteEditorBasicNavigationCommands = () =>
icon: symbol,
callback: ( { close } ) => {
if ( canCreateTemplate ) {
- const args = {
- postType: 'wp_block',
- };
- const targetUrl = addQueryArgs(
- 'site-editor.php',
- args
- );
if ( isSiteEditor ) {
- history.push( args );
+ history.navigate( '/pattern' );
} else {
- document.location = targetUrl;
+ document.location = addQueryArgs(
+ 'site-editor.php',
+ {
+ p: '/pattern',
+ }
+ );
}
close();
} else {
diff --git a/packages/edit-site/src/components/add-new-pattern/index.js b/packages/edit-site/src/components/add-new-pattern/index.js
index bb9e53da6a5660..63452691c1c373 100644
--- a/packages/edit-site/src/components/add-new-pattern/index.js
+++ b/packages/edit-site/src/components/add-new-pattern/index.js
@@ -69,23 +69,16 @@ export default function AddNewPattern() {
function handleCreatePattern( { pattern } ) {
setShowPatternModal( false );
-
- history.push( {
- postId: pattern.id,
- postType: PATTERN_TYPES.user,
- canvas: 'edit',
- } );
+ history.navigate(
+ `/${ PATTERN_TYPES.user }/${ pattern.id }?canvas=edit`
+ );
}
function handleCreateTemplatePart( templatePart ) {
setShowTemplatePartModal( false );
-
- // Navigate to the created template part editor.
- history.push( {
- postId: templatePart.id,
- postType: TEMPLATE_PART_POST_TYPE,
- canvas: 'edit',
- } );
+ history.navigate(
+ `/${ TEMPLATE_PART_POST_TYPE }/${ templatePart.id }?canvas=edit`
+ );
}
function handleError() {
@@ -203,10 +196,9 @@ export default function AddNewPattern() {
! currentCategoryId &&
categoryId !== 'my-patterns'
) {
- history.push( {
- postType: PATTERN_TYPES.user,
- categoryId: PATTERN_DEFAULT_CATEGORY,
- } );
+ history.navigate(
+ `/pattern?categoryId=${ PATTERN_DEFAULT_CATEGORY }`
+ );
}
createSuccessNotice(
diff --git a/packages/edit-site/src/components/add-new-template/index.js b/packages/edit-site/src/components/add-new-template/index.js
index 1a2d9ea727fa85..5f06ecae6824ae 100644
--- a/packages/edit-site/src/components/add-new-template/index.js
+++ b/packages/edit-site/src/components/add-new-template/index.js
@@ -203,11 +203,9 @@ function NewTemplateModal( { onClose } ) {
);
// Navigate to the created template editor.
- history.push( {
- postId: newTemplate.id,
- postType: TEMPLATE_POST_TYPE,
- canvas: 'edit',
- } );
+ history.navigate(
+ `/${ TEMPLATE_POST_TYPE }/${ newTemplate.id }?canvas=edit`
+ );
createSuccessNotice(
sprintf(
diff --git a/packages/edit-site/src/components/app/index.js b/packages/edit-site/src/components/app/index.js
index 7e4c50d7d00f09..cf13e7baf1b738 100644
--- a/packages/edit-site/src/components/app/index.js
+++ b/packages/edit-site/src/components/app/index.js
@@ -2,35 +2,41 @@
* WordPress dependencies
*/
import { store as noticesStore } from '@wordpress/notices';
-import { useDispatch } from '@wordpress/data';
+import { useDispatch, useSelect } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
import { PluginArea } from '@wordpress/plugins';
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { useCallback } from '@wordpress/element';
/**
* Internal dependencies
*/
import Layout from '../layout';
import { unlock } from '../../lock-unlock';
+import { store as editSiteStore } from '../../store';
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
-import useActiveRoute from '../layout/router';
import useSetCommandContext from '../../hooks/commands/use-set-command-context';
import { useRegisterSiteEditorRoutes } from '../site-editor-routes';
+import {
+ currentlyPreviewingTheme,
+ isPreviewingTheme,
+} from '../../utils/is-previewing-theme';
const { RouterProvider } = unlock( routerPrivateApis );
function AppLayout() {
useCommonCommands();
useSetCommandContext();
- useRegisterSiteEditorRoutes();
- const route = useActiveRoute();
- return ;
+ return ;
}
export default function App() {
+ useRegisterSiteEditorRoutes();
const { createErrorNotice } = useDispatch( noticesStore );
-
+ const routes = useSelect( ( select ) => {
+ return unlock( select( editSiteStore ) ).getRoutes();
+ }, [] );
function onPluginAreaError( name ) {
createErrorNotice(
sprintf(
@@ -42,9 +48,29 @@ export default function App() {
)
);
}
+ const beforeNavigate = useCallback( ( { path, query } ) => {
+ if ( ! isPreviewingTheme() ) {
+ return { path, query };
+ }
+
+ return {
+ path,
+ query: {
+ ...query,
+ wp_theme_preview:
+ 'wp_theme_preview' in query
+ ? query.wp_theme_preview
+ : currentlyPreviewingTheme(),
+ },
+ };
+ }, [] );
return (
-
+
diff --git a/packages/edit-site/src/components/block-editor/use-editor-iframe-props.js b/packages/edit-site/src/components/block-editor/use-editor-iframe-props.js
index 7c88fee0d5b727..1c70c85aed08d3 100644
--- a/packages/edit-site/src/components/block-editor/use-editor-iframe-props.js
+++ b/packages/edit-site/src/components/block-editor/use-editor-iframe-props.js
@@ -12,6 +12,7 @@ import { useState, useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { store as editorStore } from '@wordpress/editor';
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -21,9 +22,9 @@ import { unlock } from '../../lock-unlock';
const { useLocation, useHistory } = unlock( routerPrivateApis );
export default function useEditorIframeProps() {
- const { params } = useLocation();
+ const { query, path } = useLocation();
const history = useHistory();
- const { canvas = 'view' } = params;
+ const { canvas = 'view' } = query;
const currentPostIsTrashed = useSelect( ( select ) => {
return (
select( editorStore ).getCurrentPostAttribute( 'status' ) ===
@@ -55,13 +56,13 @@ export default function useEditorIframeProps() {
! currentPostIsTrashed
) {
event.preventDefault();
- history.push( { ...params, canvas: 'edit' }, undefined, {
+ history.navigate( addQueryArgs( path, { canvas: 'edit' } ), {
transition: 'canvas-mode-edit-transition',
} );
}
},
onClick: () =>
- history.push( { ...params, canvas: 'edit' }, undefined, {
+ history.navigate( addQueryArgs( path, { canvas: 'edit' } ), {
transition: 'canvas-mode-edit-transition',
} ),
onClickCapture: ( event ) => {
diff --git a/packages/edit-site/src/components/block-editor/use-navigate-to-entity-record.js b/packages/edit-site/src/components/block-editor/use-navigate-to-entity-record.js
index 120b15b8551d3d..8cc7fdaefe2d98 100644
--- a/packages/edit-site/src/components/block-editor/use-navigate-to-entity-record.js
+++ b/packages/edit-site/src/components/block-editor/use-navigate-to-entity-record.js
@@ -16,7 +16,9 @@ export default function useNavigateToEntityRecord() {
const onNavigateToEntityRecord = useCallback(
( params ) => {
- history.push( { ...params, focusMode: true, canvas: 'edit' } );
+ history.navigate(
+ `/${ params.postType }/${ params.id }?canvas=edit&focusMode=true`
+ );
},
[ history ]
);
diff --git a/packages/edit-site/src/components/block-editor/use-site-editor-settings.js b/packages/edit-site/src/components/block-editor/use-site-editor-settings.js
index 186f4aacf79232..d37987dc3dc420 100644
--- a/packages/edit-site/src/components/block-editor/use-site-editor-settings.js
+++ b/packages/edit-site/src/components/block-editor/use-site-editor-settings.js
@@ -22,11 +22,11 @@ function useNavigateToPreviousEntityRecord() {
const history = useHistory();
const goBack = useMemo( () => {
const isFocusMode =
- location.params.focusMode ||
- ( location.params.postId &&
- FOCUSABLE_ENTITIES.includes( location.params.postType ) );
+ location.query.focusMode ||
+ ( location?.params?.postId &&
+ FOCUSABLE_ENTITIES.includes( location?.params?.postType ) );
const didComeFromEditorCanvas =
- previousLocation?.params.canvas === 'edit';
+ previousLocation?.query.canvas === 'edit';
const showBackButton = isFocusMode && didComeFromEditorCanvas;
return showBackButton ? () => history.back() : undefined;
// `previousLocation` changes when the component updates for any reason, not
@@ -37,8 +37,8 @@ function useNavigateToPreviousEntityRecord() {
}
export function useSpecificEditorSettings() {
- const { params } = useLocation();
- const { canvas = 'view' } = params;
+ const { query } = useLocation();
+ const { canvas = 'view' } = query;
const onNavigateToEntityRecord = useNavigateToEntityRecord();
const { settings } = useSelect( ( select ) => {
const { getSettings } = select( editSiteStore );
diff --git a/packages/edit-site/src/components/dataviews-actions/index.js b/packages/edit-site/src/components/dataviews-actions/index.js
index 09b7597c6cb341..0a7b20c712c820 100644
--- a/packages/edit-site/src/components/dataviews-actions/index.js
+++ b/packages/edit-site/src/components/dataviews-actions/index.js
@@ -31,11 +31,7 @@ export const useEditPostAction = () => {
},
callback( items ) {
const post = items[ 0 ];
- history.push( {
- postId: post.id,
- postType: post.type,
- canvas: 'edit',
- } );
+ history.navigate( `/${ post.type }/${ post.id }?canvas=edit` );
},
} ),
[ history ]
diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js
index 1d115dca7518df..c045bafd8a6839 100644
--- a/packages/edit-site/src/components/editor/index.js
+++ b/packages/edit-site/src/components/editor/index.js
@@ -54,6 +54,7 @@ import {
useResolveEditedEntity,
useSyncDeprecatedEntityIntoState,
} from './use-resolve-edited-entity';
+import { addQueryArgs } from '@wordpress/url';
const { Editor, BackButton } = unlock( editorPrivateApis );
const { useHistory, useLocation } = unlock( routerPrivateApis );
@@ -83,10 +84,44 @@ const siteIconVariants = {
},
};
+function getListPathForPostType( postType ) {
+ switch ( postType ) {
+ case 'navigation':
+ return '/navigation';
+ case 'wp_block':
+ return '/pattern?postType=wp_block';
+ case 'wp_template_part':
+ return '/pattern?postType=wp_template_part';
+ case 'wp_template':
+ return '/template';
+ case 'page':
+ return '/page';
+ case 'post':
+ return '/';
+ }
+ throw 'Unknown post type';
+}
+
+function getNavigationPath( location, postType ) {
+ const { path, name } = location;
+ if (
+ [
+ 'pattern-item',
+ 'template-part-item',
+ 'page-item',
+ 'template-item',
+ 'post-item',
+ ].includes( name )
+ ) {
+ return getListPathForPostType( postType );
+ }
+ return addQueryArgs( path, { canvas: undefined } );
+}
+
export default function EditSiteEditor( { isPostsList = false } ) {
const disableMotion = useReducedMotion();
- const { params } = useLocation();
- const { canvas = 'view' } = params;
+ const location = useLocation();
+ const { canvas = 'view' } = location.query;
const isLoading = useIsSiteEditorLoading();
useAdaptEditorToCanvas( canvas );
const entity = useResolveEditedEntity();
@@ -157,9 +192,11 @@ export default function EditSiteEditor( { isPostsList = false } ) {
case 'move-to-trash':
case 'delete-post':
{
- history.push( {
- postType: items[ 0 ].type,
- } );
+ history.navigate(
+ getListPathForPostType(
+ postWithTemplate ? context.postType : postType
+ )
+ );
}
break;
case 'duplicate-post':
@@ -182,11 +219,9 @@ export default function EditSiteEditor( { isPostsList = false } ) {
{
label: __( 'Edit' ),
onClick: () => {
- history.push( {
- postId: newItem.id,
- postType: newItem.type,
- canvas: 'edit',
- } );
+ history.navigate(
+ `/${ newItem.type }/${ newItem.id }?canvas=edit`
+ );
},
},
],
@@ -196,7 +231,13 @@ export default function EditSiteEditor( { isPostsList = false } ) {
break;
}
},
- [ history, createSuccessNotice ]
+ [
+ postType,
+ context?.postType,
+ postWithTemplate,
+ history,
+ createSuccessNotice,
+ ]
);
// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.
@@ -268,26 +309,20 @@ export default function EditSiteEditor( { isPostsList = false } ) {
// come here through `posts list` and are in focus mode editing a template, template part etc..
if (
isPostsList &&
- params?.focusMode
+ location.query?.focusMode
) {
- history.push(
- {
- page: 'gutenberg-posts-dashboard',
- postType: 'post',
- },
- undefined,
- {
- transition:
- 'canvas-mode-view-transition',
- }
- );
+ history.navigate( '/', {
+ transition:
+ 'canvas-mode-view-transition',
+ } );
} else {
- history.push(
- {
- ...params,
- canvas: undefined,
- },
- undefined,
+ history.navigate(
+ getNavigationPath(
+ location,
+ postWithTemplate
+ ? context.postType
+ : postType
+ ),
{
transition:
'canvas-mode-view-transition',
diff --git a/packages/edit-site/src/components/editor/use-resolve-edited-entity.js b/packages/edit-site/src/components/editor/use-resolve-edited-entity.js
index 4f873738704141..8da076f9f00b71 100644
--- a/packages/edit-site/src/components/editor/use-resolve-edited-entity.js
+++ b/packages/edit-site/src/components/editor/use-resolve-edited-entity.js
@@ -30,8 +30,23 @@ const postTypesWithoutParentTemplate = [
const authorizedPostTypes = [ 'page', 'post' ];
export function useResolveEditedEntity() {
- const { params = {} } = useLocation();
- const { postId, postType } = params;
+ const { name, params = {}, query } = useLocation();
+ const { postId = query?.postId } = params; // Fallback to query param for postId for list view routes.
+ let postType;
+ if ( name === 'navigation-item' ) {
+ postType = NAVIGATION_POST_TYPE;
+ } else if ( name === 'pattern-item' ) {
+ postType = PATTERN_TYPES.user;
+ } else if ( name === 'template-part-item' ) {
+ postType = TEMPLATE_PART_POST_TYPE;
+ } else if ( name === 'template-item' || name === 'templates' ) {
+ postType = TEMPLATE_POST_TYPE;
+ } else if ( name === 'page-item' || name === 'pages' ) {
+ postType = 'page';
+ } else if ( name === 'post-item' || name === 'posts' ) {
+ postType = 'post';
+ }
+
const homePage = useSelect( ( select ) => {
const { getHomePage } = unlock( select( coreDataStore ) );
return getHomePage();
diff --git a/packages/edit-site/src/components/global-styles-sidebar/index.js b/packages/edit-site/src/components/global-styles-sidebar/index.js
index d46346b50dae37..02a29dac5c0b7d 100644
--- a/packages/edit-site/src/components/global-styles-sidebar/index.js
+++ b/packages/edit-site/src/components/global-styles-sidebar/index.js
@@ -28,8 +28,8 @@ const { interfaceStore } = unlock( editorPrivateApis );
const { useLocation } = unlock( routerPrivateApis );
export default function GlobalStylesSidebar() {
- const { params } = useLocation();
- const { canvas = 'view', path } = params;
+ const { query } = useLocation();
+ const { canvas = 'view', name } = query;
const {
shouldClearCanvasContainerView,
isStyleBookOpened,
@@ -133,14 +133,14 @@ export default function GlobalStylesSidebar() {
const previousActiveAreaRef = useRef( null );
useEffect( () => {
- if ( path?.startsWith( '/wp_global_styles' ) && canvas === 'edit' ) {
+ if ( name === 'styles' && canvas === 'edit' ) {
previousActiveAreaRef.current =
getActiveComplementaryArea( 'core' );
enableComplementaryArea( 'core', 'edit-site/global-styles' );
} else if ( previousActiveAreaRef.current ) {
enableComplementaryArea( 'core', previousActiveAreaRef.current );
}
- }, [ path, enableComplementaryArea, canvas, getActiveComplementaryArea ] );
+ }, [ name, enableComplementaryArea, canvas, getActiveComplementaryArea ] );
return (
{
- const { postType, path, categoryType, ...rest } = params;
-
- if ( path === '/wp_template_part/all' ) {
- history.replace( { postType: TEMPLATE_PART_POST_TYPE } );
- }
-
- if ( path === '/page' ) {
- history.replace( {
- postType: 'page',
- ...rest,
- } );
- }
-
- if ( path === '/wp_template' ) {
- history.replace( {
- postType: TEMPLATE_POST_TYPE,
- ...rest,
- } );
- }
-
- if ( path === '/patterns' ) {
- history.replace( {
- postType:
- categoryType === TEMPLATE_PART_POST_TYPE
- ? TEMPLATE_PART_POST_TYPE
- : PATTERN_TYPES.user,
- ...rest,
- } );
- }
-
- if ( path === '/navigation' ) {
- history.replace( {
- postType: NAVIGATION_POST_TYPE,
- ...rest,
- } );
- }
- }, [ history, params ] );
-}
-
-export default function useActiveRoute() {
- const { params } = useLocation();
- useRedirectOldPaths();
- const routes = useSelect( ( select ) => {
- return unlock( select( editSiteStore ) ).getRoutes();
- }, [] );
- return useMemo( () => {
- const matchedRoute = routes.find( ( route ) => route.match( params ) );
- if ( ! matchedRoute ) {
- return {
- key: 404,
- areas: {},
- widths: {},
- };
- }
-
- return {
- name: matchedRoute.name,
- areas: matchedRoute.areas,
- widths: matchedRoute.widths,
- };
- }, [ routes, params ] );
-}
diff --git a/packages/edit-site/src/components/page-patterns/delete-category-menu-item.js b/packages/edit-site/src/components/page-patterns/delete-category-menu-item.js
index d87737c55326c6..ca7bbf2fa73220 100644
--- a/packages/edit-site/src/components/page-patterns/delete-category-menu-item.js
+++ b/packages/edit-site/src/components/page-patterns/delete-category-menu-item.js
@@ -59,10 +59,9 @@ export default function DeleteCategoryMenuItem( { category, onClose } ) {
);
onClose?.();
- history.push( {
- postType: PATTERN_TYPES.user,
- categoryId: PATTERN_DEFAULT_CATEGORY,
- } );
+ history.navigate(
+ `/pattern?categoryId=${ PATTERN_DEFAULT_CATEGORY }`
+ );
} catch ( error ) {
const errorMessage =
error.message && error.code !== 'unknown_error'
diff --git a/packages/edit-site/src/components/page-patterns/fields.js b/packages/edit-site/src/components/page-patterns/fields.js
index e016dca6cd8557..60e37844b2edb1 100644
--- a/packages/edit-site/src/components/page-patterns/fields.js
+++ b/packages/edit-site/src/components/page-patterns/fields.js
@@ -21,6 +21,7 @@ import {
import { Icon, lockSmall } from '@wordpress/icons';
import { parse } from '@wordpress/blocks';
import { decodeEntities } from '@wordpress/html-entities';
+import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
* Internal dependencies
@@ -32,10 +33,10 @@ import {
OPERATOR_IS,
} from '../../utils/constants';
import { unlock } from '../../lock-unlock';
-import { useLink } from '../routes/link';
import { useAddedBy } from '../page-templates/hooks';
import { defaultGetTitle } from './search-items';
+const { useLink } = unlock( routerPrivateApis );
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
function PreviewWrapper( { item, onClick, ariaDescribedBy, children } ) {
@@ -59,11 +60,11 @@ function PreviewField( { item } ) {
const isUserPattern = item.type === PATTERN_TYPES.user;
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
- const { onClick } = useLink( {
- postType: item.type,
- postId: isUserPattern || isTemplatePart ? item.id : item.name,
- canvas: 'edit',
- } );
+ const { onClick } = useLink(
+ `/${ item.type }/${
+ isUserPattern || isTemplatePart ? item.id : item.name
+ }?canvas=edit`
+ );
const blocks = useMemo( () => {
return (
item.blocks ??
@@ -114,11 +115,11 @@ export const previewField = {
function TitleField( { item } ) {
const isUserPattern = item.type === PATTERN_TYPES.user;
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
- const { onClick } = useLink( {
- postType: item.type,
- postId: isUserPattern || isTemplatePart ? item.id : item.name,
- canvas: 'edit',
- } );
+ const { onClick } = useLink(
+ `/${ item.type }/${
+ isUserPattern || isTemplatePart ? item.id : item.name
+ }?canvas=edit`
+ );
const title = decodeEntities( defaultGetTitle( item ) );
return (
diff --git a/packages/edit-site/src/components/page-patterns/index.js b/packages/edit-site/src/components/page-patterns/index.js
index 69ebf66093806a..b6753334887573 100644
--- a/packages/edit-site/src/components/page-patterns/index.js
+++ b/packages/edit-site/src/components/page-patterns/index.js
@@ -72,17 +72,16 @@ const DEFAULT_VIEW = {
export default function DataviewsPatterns() {
const {
- params: { postType, categoryId: categoryIdFromURL },
+ query: { postType = 'wp_block', categoryId: categoryIdFromURL },
} = useLocation();
- const type = postType || PATTERN_TYPES.user;
const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
const [ view, setView ] = useState( DEFAULT_VIEW );
const previousCategoryId = usePrevious( categoryId );
- const previousPostType = usePrevious( type );
+ const previousPostType = usePrevious( postType );
const viewSyncStatus = view.filters?.find(
( { field } ) => field === 'sync-status'
)?.value;
- const { patterns, isResolving } = usePatterns( type, categoryId, {
+ const { patterns, isResolving } = usePatterns( postType, categoryId, {
search: view.search,
syncStatus: viewSyncStatus,
} );
@@ -108,9 +107,9 @@ export default function DataviewsPatterns() {
const fields = useMemo( () => {
const _fields = [ previewField, titleField ];
- if ( type === PATTERN_TYPES.user ) {
+ if ( postType === PATTERN_TYPES.user ) {
_fields.push( patternStatusField );
- } else if ( type === TEMPLATE_PART_POST_TYPE ) {
+ } else if ( postType === TEMPLATE_PART_POST_TYPE ) {
_fields.push( {
...templatePartAuthorField,
elements: authors,
@@ -118,24 +117,27 @@ export default function DataviewsPatterns() {
}
return _fields;
- }, [ type, authors ] );
+ }, [ postType, authors ] );
// Reset the page number when the category changes.
useEffect( () => {
- if ( previousCategoryId !== categoryId || previousPostType !== type ) {
+ if (
+ previousCategoryId !== categoryId ||
+ previousPostType !== postType
+ ) {
setView( ( prevView ) => ( { ...prevView, page: 1 } ) );
}
- }, [ categoryId, previousCategoryId, previousPostType, type ] );
+ }, [ categoryId, previousCategoryId, previousPostType, postType ] );
const { data, paginationInfo } = useMemo( () => {
// Search is managed server-side as well as filters for patterns.
// However, the author filter in template parts is done client-side.
const viewWithoutFilters = { ...view };
delete viewWithoutFilters.search;
- if ( type !== TEMPLATE_PART_POST_TYPE ) {
+ if ( postType !== TEMPLATE_PART_POST_TYPE ) {
viewWithoutFilters.filters = [];
}
return filterSortAndPaginate( patterns, viewWithoutFilters, fields );
- }, [ patterns, view, fields, type ] );
+ }, [ patterns, view, fields, postType ] );
const dataWithPermissions = useAugmentPatternsWithPermissions( data );
@@ -150,11 +152,11 @@ export default function DataviewsPatterns() {
const editAction = useEditPostAction();
const actions = useMemo( () => {
- if ( type === TEMPLATE_PART_POST_TYPE ) {
+ if ( postType === TEMPLATE_PART_POST_TYPE ) {
return [ editAction, ...templatePartActions ].filter( Boolean );
}
return [ editAction, ...patternActions ].filter( Boolean );
- }, [ editAction, type, templatePartActions, patternActions ] );
+ }, [ editAction, postType, templatePartActions, patternActions ] );
const id = useId();
const settings = usePatternSettings();
// Wrap everything in a block editor provider.
@@ -169,7 +171,7 @@ export default function DataviewsPatterns() {
>
diff --git a/packages/edit-site/src/components/page-templates/fields.js b/packages/edit-site/src/components/page-templates/fields.js
index 69e0596bf49d47..35d7b9714d5be1 100644
--- a/packages/edit-site/src/components/page-templates/fields.js
+++ b/packages/edit-site/src/components/page-templates/fields.js
@@ -16,16 +16,16 @@ import {
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { EditorProvider } from '@wordpress/editor';
+import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
* Internal dependencies
*/
-import { default as Link, useLink } from '../routes/link';
import { useAddedBy } from './hooks';
-
import usePatternSettings from '../page-patterns/use-pattern-settings';
import { unlock } from '../../lock-unlock';
+const { useLink, Link } = unlock( routerPrivateApis );
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
function PreviewField( { item } ) {
@@ -34,11 +34,7 @@ function PreviewField( { item } ) {
const blocks = useMemo( () => {
return parse( item.content.raw );
}, [ item.content.raw ] );
- const { onClick } = useLink( {
- postId: item.id,
- postType: item.type,
- canvas: 'edit',
- } );
+ const { onClick } = useLink( `/${ item.type }/${ item.id }?canvas=edit` );
const isEmpty = ! blocks?.length;
// Wrap everything in a block editor provider to ensure 'styles' that are needed
@@ -80,15 +76,8 @@ export const previewField = {
};
function TitleField( { item } ) {
- const linkProps = {
- params: {
- postId: item.id,
- postType: item.type,
- canvas: 'edit',
- },
- };
return (
-
+
{ decodeEntities( item.title?.rendered ) || __( '(no title)' ) }
);
diff --git a/packages/edit-site/src/components/page-templates/index.js b/packages/edit-site/src/components/page-templates/index.js
index ea026ca53566e8..828867e6f283de 100644
--- a/packages/edit-site/src/components/page-templates/index.js
+++ b/packages/edit-site/src/components/page-templates/index.js
@@ -7,6 +7,7 @@ import { privateApis as corePrivateApis } from '@wordpress/core-data';
import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
import { privateApis as routerPrivateApis } from '@wordpress/router';
import { privateApis as editorPrivateApis } from '@wordpress/editor';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -93,8 +94,8 @@ const DEFAULT_VIEW = {
};
export default function PageTemplates() {
- const { params } = useLocation();
- const { activeView = 'all', layout, postId } = params;
+ const { path, query } = useLocation();
+ const { activeView = 'all', layout, postId } = query;
const [ selection, setSelection ] = useState( [ postId ] );
const defaultView = useMemo( () => {
@@ -118,8 +119,10 @@ export default function PageTemplates() {
}, [ layout, activeView ] );
const [ view, setView ] = useState( defaultView );
useEffect( () => {
+ const usedType = layout ?? DEFAULT_VIEW.type;
setView( ( currentView ) => ( {
...currentView,
+ type: usedType,
filters:
activeView !== 'all'
? [
@@ -131,7 +134,7 @@ export default function PageTemplates() {
]
: [],
} ) );
- }, [ activeView ] );
+ }, [ activeView, layout ] );
const { records, isResolving: isLoadingData } =
useEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {
@@ -142,13 +145,14 @@ export default function PageTemplates() {
( items ) => {
setSelection( items );
if ( view?.type === LAYOUT_LIST ) {
- history.push( {
- ...params,
- postId: items.length === 1 ? items[ 0 ] : undefined,
- } );
+ history.navigate(
+ addQueryArgs( path, {
+ postId: items.length === 1 ? items[ 0 ] : undefined,
+ } )
+ );
}
},
- [ history, params, view?.type ]
+ [ history, path, view?.type ]
);
const authors = useMemo( () => {
@@ -195,15 +199,16 @@ export default function PageTemplates() {
const onChangeView = useCallback(
( newView ) => {
if ( newView.type !== view.type ) {
- history.push( {
- ...params,
- layout: newView.type,
- } );
+ history.navigate(
+ addQueryArgs( path, {
+ layout: newView.type,
+ } )
+ );
}
setView( newView );
},
- [ view.type, setView, history, params ]
+ [ view.type, setView, history, path ]
);
return (
diff --git a/packages/edit-site/src/components/post-list/index.js b/packages/edit-site/src/components/post-list/index.js
index 975809b2ad6106..d58ddbe50758c7 100644
--- a/packages/edit-site/src/components/post-list/index.js
+++ b/packages/edit-site/src/components/post-list/index.js
@@ -13,6 +13,8 @@ import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { __ } from '@wordpress/i18n';
import { drawerRight } from '@wordpress/icons';
+import { usePrevious } from '@wordpress/compose';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -31,7 +33,6 @@ import {
import AddNewPostModal from '../add-new-post';
import { unlock } from '../../lock-unlock';
import { useEditPostAction } from '../dataviews-actions';
-import { usePrevious } from '@wordpress/compose';
const { usePostActions, usePostFields } = unlock( editorPrivateApis );
const { useLocation, useHistory } = unlock( routerPrivateApis );
@@ -70,7 +71,8 @@ const getCustomView = ( editedEntityRecord ) => {
*/
function useView( postType ) {
const {
- params: { activeView = 'all', isCustom = 'false', layout },
+ path,
+ query: { activeView = 'all', isCustom = 'false', layout },
} = useLocation();
const history = useHistory();
@@ -112,16 +114,15 @@ function useView( postType ) {
const setViewWithUrlUpdate = useCallback(
( newView ) => {
- const { params } = history.getLocationWithParams();
-
- if ( newView.type === LAYOUT_LIST && ! params?.layout ) {
+ if ( newView.type === LAYOUT_LIST && ! layout ) {
// Skip updating the layout URL param if
// it is not present and the newView.type is LAYOUT_LIST.
- } else if ( newView.type !== params?.layout ) {
- history.push( {
- ...params,
- layout: newView.type,
- } );
+ } else if ( newView.type !== layout ) {
+ history.navigate(
+ addQueryArgs( path, {
+ layout: newView.type,
+ } )
+ );
}
setView( newView );
@@ -137,7 +138,14 @@ function useView( postType ) {
);
}
},
- [ history, isCustom, editEntityRecord, editedEntityRecord?.id ]
+ [
+ history,
+ isCustom,
+ editEntityRecord,
+ editedEntityRecord?.id,
+ layout,
+ path,
+ ]
);
// When layout URL param changes, update the view type
@@ -186,20 +194,20 @@ export default function PostList( { postType } ) {
quickEdit = false,
isCustom,
activeView = 'all',
- } = location.params;
+ } = location.query;
const [ selection, setSelection ] = useState( postId?.split( ',' ) ?? [] );
const onChangeSelection = useCallback(
( items ) => {
setSelection( items );
- const { params } = history.getLocationWithParams();
- if ( ( params.isCustom ?? 'false' ) === 'false' ) {
- history.push( {
- ...params,
- postId: items.join( ',' ),
- } );
+ if ( ( location.query.isCustom ?? 'false' ) === 'false' ) {
+ history.navigate(
+ addQueryArgs( location.path, {
+ postId: items.join( ',' ),
+ } )
+ );
}
},
- [ history ]
+ [ location.path, location.query.isCustom, history ]
);
const getActiveViewFilters = ( views, match ) => {
@@ -311,12 +319,13 @@ export default function PostList( { postType } ) {
useEffect( () => {
if ( postIdWasDeleted ) {
- history.push( {
- ...history.getLocationWithParams().params,
- postId: undefined,
- } );
+ history.navigate(
+ addQueryArgs( location.path, {
+ postId: undefined,
+ } )
+ );
}
- }, [ postIdWasDeleted, history ] );
+ }, [ history, postIdWasDeleted, location.path ] );
const paginationInfo = useMemo(
() => ( {
@@ -355,11 +364,7 @@ export default function PostList( { postType } ) {
const openModal = () => setShowAddPostModal( true );
const closeModal = () => setShowAddPostModal( false );
const handleNewPage = ( { type, id } ) => {
- history.push( {
- postId: id,
- postType: type,
- canvas: 'edit',
- } );
+ history.navigate( `/${ type }/${ id }?canvas=edit` );
closeModal();
};
@@ -401,11 +406,7 @@ export default function PostList( { postType } ) {
onChangeSelection={ onChangeSelection }
isItemClickable={ ( item ) => item.status !== 'trash' }
onClickItem={ ( { id } ) => {
- history.push( {
- postId: id,
- postType,
- canvas: 'edit',
- } );
+ history.navigate( `/${ postType }/${ id }?canvas=edit` );
} }
getItemId={ getItemId }
defaultLayouts={ defaultLayouts }
@@ -419,10 +420,11 @@ export default function PostList( { postType } ) {
icon={ drawerRight }
label={ __( 'Details' ) }
onClick={ () => {
- history.push( {
- ...location.params,
- quickEdit: quickEdit ? undefined : true,
- } );
+ history.navigate(
+ addQueryArgs( location.path, {
+ quickEdit: quickEdit ? undefined : true,
+ } )
+ );
} }
/>
)
diff --git a/packages/edit-site/src/components/posts-app-routes/home.js b/packages/edit-site/src/components/posts-app-routes/home.js
deleted file mode 100644
index ec99cbd8899f1d..00000000000000
--- a/packages/edit-site/src/components/posts-app-routes/home.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { privateApis as routerPrivateApis } from '@wordpress/router';
-
-/**
- * Internal dependencies
- */
-import Editor from '../editor';
-import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
-import { unlock } from '../../lock-unlock';
-
-const { useLocation } = unlock( routerPrivateApis );
-
-function HomeMobileView() {
- const { params = {} } = useLocation();
- const { canvas = 'view' } = params;
-
- return canvas === 'edit' ? (
-
- ) : (
-
- );
-}
-
-export const homeRoute = {
- name: 'home',
- match: () => {
- return true;
- },
- areas: {
- sidebar: ,
- preview: ,
- mobile: HomeMobileView,
- },
-};
diff --git a/packages/edit-site/src/components/posts-app-routes/index.js b/packages/edit-site/src/components/posts-app-routes/index.js
index e850bbd382200d..3919ea3930d073 100644
--- a/packages/edit-site/src/components/posts-app-routes/index.js
+++ b/packages/edit-site/src/components/posts-app-routes/index.js
@@ -9,21 +9,10 @@ import { useEffect } from '@wordpress/element';
*/
import { unlock } from '../../lock-unlock';
import { store as siteEditorStore } from '../../store';
-import { homeRoute } from './home';
-import { postsListViewQuickEditRoute } from './posts-list-view-quick-edit';
-import { postsListViewRoute } from './posts-list-view';
-import { postsViewQuickEditRoute } from './posts-view-quick-edit';
-import { postsViewRoute } from './posts-view';
-import { postsEditRoute } from './posts-edit';
+import { postsRoute } from './posts';
+import { postItemRoute } from './post-item';
-const routes = [
- postsListViewQuickEditRoute,
- postsListViewRoute,
- postsViewQuickEditRoute,
- postsViewRoute,
- postsEditRoute,
- homeRoute,
-];
+const routes = [ postItemRoute, postsRoute ];
export function useRegisterPostsAppRoutes() {
const registry = useRegistry();
diff --git a/packages/edit-site/src/components/posts-app-routes/posts-edit.js b/packages/edit-site/src/components/posts-app-routes/post-item.js
similarity index 62%
rename from packages/edit-site/src/components/posts-app-routes/posts-edit.js
rename to packages/edit-site/src/components/posts-app-routes/post-item.js
index d3958245595416..54131814f1ae22 100644
--- a/packages/edit-site/src/components/posts-app-routes/posts-edit.js
+++ b/packages/edit-site/src/components/posts-app-routes/post-item.js
@@ -6,25 +6,21 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
-import PostList from '../post-list';
+import Editor from '../editor';
import DataViewsSidebarContent from '../sidebar-dataviews';
import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import Editor from '../editor';
-export const postsEditRoute = {
- name: 'posts-edit',
- match: ( params ) => {
- return params.postType === 'post' && params.canvas === 'edit';
- },
+export const postItemRoute = {
+ name: 'post-item',
+ path: '/post/:postId',
areas: {
sidebar: (
}
+ content={ }
/>
),
- content: ,
mobile: ,
preview: ,
},
diff --git a/packages/edit-site/src/components/posts-app-routes/posts-list-view-quick-edit.js b/packages/edit-site/src/components/posts-app-routes/posts-list-view-quick-edit.js
deleted file mode 100644
index d2434b390ffd9f..00000000000000
--- a/packages/edit-site/src/components/posts-app-routes/posts-list-view-quick-edit.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-import { privateApis as routerPrivateApis } from '@wordpress/router';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import { unlock } from '../../lock-unlock';
-import { PostEdit } from '../post-edit';
-import Editor from '../editor';
-
-const { useLocation } = unlock( routerPrivateApis );
-
-function PostQuickEdit() {
- const { params } = useLocation();
- return ;
-}
-
-export const postsListViewQuickEditRoute = {
- name: 'posts-list-view-quick-edit',
- match: ( params ) => {
- return (
- params.isCustom !== 'true' &&
- ( params.layout ?? 'list' ) === 'list' &&
- !! params.quickEdit &&
- params.postType === 'post' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- mobile: ,
- preview: ,
- edit: ,
- },
- widths: {
- content: 380,
- edit: 380,
- },
-};
diff --git a/packages/edit-site/src/components/posts-app-routes/posts-list-view.js b/packages/edit-site/src/components/posts-app-routes/posts-list-view.js
deleted file mode 100644
index 68aa86c7fb2392..00000000000000
--- a/packages/edit-site/src/components/posts-app-routes/posts-list-view.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import Editor from '../editor';
-
-export const postsListViewRoute = {
- name: 'posts-list-view',
- match: ( params ) => {
- return (
- params.isCustom !== 'true' &&
- ( params.layout ?? 'list' ) === 'list' &&
- ! params.quickEdit &&
- params.postType === 'post' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- preview: ,
- mobile: ,
- },
- widths: {
- content: 380,
- },
-};
diff --git a/packages/edit-site/src/components/posts-app-routes/posts-view-quick-edit.js b/packages/edit-site/src/components/posts-app-routes/posts-view-quick-edit.js
deleted file mode 100644
index 52e6f9a2d26ef6..00000000000000
--- a/packages/edit-site/src/components/posts-app-routes/posts-view-quick-edit.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-import { privateApis as routerPrivateApis } from '@wordpress/router';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import { unlock } from '../../lock-unlock';
-import { PostEdit } from '../post-edit';
-
-const { useLocation } = unlock( routerPrivateApis );
-
-function PostQuickEdit() {
- const { params } = useLocation();
- return ;
-}
-
-export const postsViewQuickEditRoute = {
- name: 'posts-view-quick-edit',
- match: ( params ) => {
- return (
- ( params.isCustom === 'true' ||
- ( params.layout ?? 'list' ) !== 'list' ) &&
- !! params.quickEdit &&
- params.postType === 'post' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- mobile: ,
- edit: ,
- },
- widths: {
- edit: 380,
- },
-};
diff --git a/packages/edit-site/src/components/posts-app-routes/posts-view.js b/packages/edit-site/src/components/posts-app-routes/posts-view.js
deleted file mode 100644
index 6559991475d278..00000000000000
--- a/packages/edit-site/src/components/posts-app-routes/posts-view.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-
-export const postsViewRoute = {
- name: 'posts-view',
- match: ( params ) => {
- return (
- ( params.isCustom === 'true' ||
- ( params.layout ?? 'list' ) !== 'list' ) &&
- ! params.quickEdit &&
- params.postType === 'post' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/posts-app-routes/posts.js b/packages/edit-site/src/components/posts-app-routes/posts.js
new file mode 100644
index 00000000000000..80af8a75fbc800
--- /dev/null
+++ b/packages/edit-site/src/components/posts-app-routes/posts.js
@@ -0,0 +1,66 @@
+/**
+ * WordPress dependencies
+ */
+import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { __ } from '@wordpress/i18n';
+
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreen from '../sidebar-navigation-screen';
+import DataViewsSidebarContent from '../sidebar-dataviews';
+import PostList from '../post-list';
+import { unlock } from '../../lock-unlock';
+import { PostEdit } from '../post-edit';
+
+const { useLocation } = unlock( routerPrivateApis );
+
+function MobilePostsView() {
+ const { query = {} } = useLocation();
+ const { canvas = 'view' } = query;
+
+ return canvas === 'edit' ? : ;
+}
+
+export const postsRoute = {
+ name: 'posts',
+ path: '/',
+ areas: {
+ sidebar: (
+ }
+ />
+ ),
+ content: ,
+ preview( { query } ) {
+ const isListView =
+ ( query.layout === 'list' || ! query.layout ) &&
+ query.isCustom !== 'true';
+ return isListView ? : undefined;
+ },
+ mobile: ,
+ edit( { query } ) {
+ const hasQuickEdit =
+ ( query.layout ?? 'list' ) === 'list' && !! query.quickEdit;
+ return hasQuickEdit ? (
+
+ ) : undefined;
+ },
+ },
+ widths: {
+ content( { query } ) {
+ const isListView =
+ ( query.layout === 'list' || ! query.layout ) &&
+ query.isCustom !== 'true';
+ return isListView ? 380 : undefined;
+ },
+ edit( { query } ) {
+ const hasQuickEdit =
+ ( query.layout ?? 'list' ) === 'list' && !! query.quickEdit;
+ return hasQuickEdit ? 380 : undefined;
+ },
+ },
+};
diff --git a/packages/edit-site/src/components/posts-app/index.js b/packages/edit-site/src/components/posts-app/index.js
index e6eb90c1680019..ab8cfab99f7628 100644
--- a/packages/edit-site/src/components/posts-app/index.js
+++ b/packages/edit-site/src/components/posts-app/index.js
@@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { useSelect } from '@wordpress/data';
/**
* Internal dependencies
@@ -9,20 +10,18 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
import Layout from '../layout';
import { useRegisterPostsAppRoutes } from '../posts-app-routes';
import { unlock } from '../../lock-unlock';
-import useActiveRoute from '../layout/router';
+import { store as editSiteStore } from '../../store';
const { RouterProvider } = unlock( routerPrivateApis );
-function PostsLayout() {
- useRegisterPostsAppRoutes();
- const route = useActiveRoute();
- return ;
-}
-
export default function PostsApp() {
+ useRegisterPostsAppRoutes();
+ const routes = useSelect( ( select ) => {
+ return unlock( select( editSiteStore ) ).getRoutes();
+ }, [] );
return (
-
-
+
+
);
}
diff --git a/packages/edit-site/src/components/resizable-frame/index.js b/packages/edit-site/src/components/resizable-frame/index.js
index 95ccfe4fdd966f..99f650971112fb 100644
--- a/packages/edit-site/src/components/resizable-frame/index.js
+++ b/packages/edit-site/src/components/resizable-frame/index.js
@@ -20,6 +20,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
+import { addQueryArgs } from '@wordpress/url';
const { useLocation, useHistory } = unlock( routerPrivateApis );
@@ -88,8 +89,8 @@ function ResizableFrame( {
innerContentStyle,
} ) {
const history = useHistory();
- const { params } = useLocation();
- const { canvas = 'view' } = params;
+ const { path, query } = useLocation();
+ const { canvas = 'view' } = query;
const disableMotion = useReducedMotion();
const [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );
// The width of the resizable frame when a new resize gesture starts.
@@ -158,12 +159,10 @@ function ResizableFrame( {
setFrameSize( INITIAL_FRAME_SIZE );
} else {
// Trigger full screen if the frame is resized far enough to the left.
- history.push(
- {
- ...params,
+ history.navigate(
+ addQueryArgs( path, {
canvas: 'edit',
- },
- undefined,
+ } ),
{
transition: 'canvas-mode-edit-transition',
}
diff --git a/packages/edit-site/src/components/routes/link.js b/packages/edit-site/src/components/routes/link.js
deleted file mode 100644
index a34b37943a0799..00000000000000
--- a/packages/edit-site/src/components/routes/link.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';
-import { privateApis as routerPrivateApis } from '@wordpress/router';
-
-/**
- * Internal dependencies
- */
-import { unlock } from '../../lock-unlock';
-import {
- isPreviewingTheme,
- currentlyPreviewingTheme,
-} from '../../utils/is-previewing-theme';
-
-const { useHistory } = unlock( routerPrivateApis );
-
-export function useLink( params, state, shouldReplace = false ) {
- const history = useHistory();
- function onClick( event ) {
- event?.preventDefault();
-
- if ( shouldReplace ) {
- history.replace( params, state );
- } else {
- history.push( params, state );
- }
- }
-
- const currentArgs = getQueryArgs( window.location.href );
- const currentUrlWithoutArgs = removeQueryArgs(
- window.location.href,
- ...Object.keys( currentArgs )
- );
-
- let extraParams = {};
- if ( isPreviewingTheme() ) {
- extraParams = {
- wp_theme_preview: currentlyPreviewingTheme(),
- };
- }
-
- const newUrl = addQueryArgs( currentUrlWithoutArgs, {
- ...params,
- ...extraParams,
- } );
-
- return {
- href: newUrl,
- onClick,
- };
-}
-
-export default function Link( {
- params = {},
- state,
- replace: shouldReplace = false,
- children,
- ...props
-} ) {
- const { href, onClick } = useLink( params, state, shouldReplace );
-
- return (
-
- { children }
-
- );
-}
diff --git a/packages/edit-site/src/components/save-panel/index.js b/packages/edit-site/src/components/save-panel/index.js
index b77e5a9a1a10ba..81a0f99557df07 100644
--- a/packages/edit-site/src/components/save-panel/index.js
+++ b/packages/edit-site/src/components/save-panel/index.js
@@ -90,8 +90,8 @@ const _EntitiesSavedStates = ( { onClose, renderDialog = undefined } ) => {
};
export default function SavePanel() {
- const { params } = useLocation();
- const { canvas = 'view' } = params;
+ const { query } = useLocation();
+ const { canvas = 'view' } = query;
const { isSaveViewOpen, isDirty, isSaving } = useSelect( ( select ) => {
const {
__experimentalGetDirtyEntityRecords,
diff --git a/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js b/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js
index 62956ccd18960d..815de181a9dde0 100644
--- a/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js
+++ b/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js
@@ -14,6 +14,7 @@ import { store as coreStore } from '@wordpress/core-data';
import { useState } from '@wordpress/element';
import { plus } from '@wordpress/icons';
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -22,10 +23,11 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
import { useDefaultViews } from './default-views';
import { unlock } from '../../lock-unlock';
-const { useHistory } = unlock( routerPrivateApis );
+const { useLocation, useHistory } = unlock( routerPrivateApis );
function AddNewItemModalContent( { type, setIsAdding } ) {
const history = useHistory();
+ const { path } = useLocation();
const { saveEntityRecord } = useDispatch( coreStore );
const [ title, setTitle ] = useState( '' );
const [ isSaving, setIsSaving ] = useState( false );
@@ -64,14 +66,12 @@ function AddNewItemModalContent( { type, setIsAdding } ) {
content: JSON.stringify( defaultViews[ 0 ].view ),
}
);
- const {
- params: { postType },
- } = history.getLocationWithParams();
- history.push( {
- postType,
- activeView: savedRecord.id,
- isCustom: 'true',
- } );
+ history.navigate(
+ addQueryArgs( path, {
+ activeView: savedRecord.id,
+ isCustom: 'true',
+ } )
+ );
setIsSaving( false );
setIsAdding( false );
} }
diff --git a/packages/edit-site/src/components/sidebar-dataviews/dataview-item.js b/packages/edit-site/src/components/sidebar-dataviews/dataview-item.js
index 1e12d6706d81b5..b98f8b80938d68 100644
--- a/packages/edit-site/src/components/sidebar-dataviews/dataview-item.js
+++ b/packages/edit-site/src/components/sidebar-dataviews/dataview-item.js
@@ -9,11 +9,11 @@ import clsx from 'clsx';
import { privateApis as routerPrivateApis } from '@wordpress/router';
import { __experimentalHStack as HStack } from '@wordpress/components';
import { VIEW_LAYOUTS } from '@wordpress/dataviews';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
*/
-import { useLink } from '../routes/link';
import SidebarNavigationItem from '../sidebar-navigation-item';
import { unlock } from '../../lock-unlock';
const { useLocation } = unlock( routerPrivateApis );
@@ -28,9 +28,7 @@ export default function DataViewItem( {
isCustom,
suffix,
} ) {
- const {
- params: { postType },
- } = useLocation();
+ const { path } = useLocation();
const iconToUse =
icon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;
@@ -39,12 +37,11 @@ export default function DataViewItem( {
if ( activeView === 'all' ) {
activeView = undefined;
}
- const linkInfo = useLink( {
- postType,
+ const query = {
layout: type,
activeView,
isCustom: isCustom ? 'true' : undefined,
- } );
+ };
return (
{ title }
diff --git a/packages/edit-site/src/components/sidebar-dataviews/index.js b/packages/edit-site/src/components/sidebar-dataviews/index.js
index 86420c4eec1d1f..410767650c6f36 100644
--- a/packages/edit-site/src/components/sidebar-dataviews/index.js
+++ b/packages/edit-site/src/components/sidebar-dataviews/index.js
@@ -14,9 +14,9 @@ import CustomDataViewsList from './custom-dataviews-list';
const { useLocation } = unlock( routerPrivateApis );
-export default function DataViewsSidebarContent() {
+export default function DataViewsSidebarContent( { postType } ) {
const {
- params: { postType, activeView = 'all', isCustom = 'false' },
+ query: { activeView = 'all', isCustom = 'false' },
} = useLocation();
const defaultViews = useDefaultViews( { postType } );
if ( ! postType ) {
diff --git a/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js b/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js
index 342fb1b5db52d2..980f20c49821b0 100644
--- a/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js
+++ b/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js
@@ -9,6 +9,7 @@ import {
Button,
privateApis as componentsPrivateApis,
} from '@wordpress/components';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -21,7 +22,6 @@ import { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';
const { useLocation, useHistory } = unlock( routerPrivateApis );
const { Menu } = unlock( componentsPrivateApis );
-const GLOBAL_STYLES_PATH_PREFIX = '/wp_global_styles';
const GlobalStylesPageActions = ( {
isStyleBookOpened,
@@ -63,28 +63,23 @@ const GlobalStylesPageActions = ( {
};
export default function GlobalStylesUIWrapper() {
- const { params } = useLocation();
+ const { path, query } = useLocation();
const history = useHistory();
- const { canvas = 'view' } = params;
+ const { canvas = 'view' } = query;
const [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );
const isMobileViewport = useViewportMatch( 'medium', '<' );
- const pathWithPrefix = params.path;
- const [ path, onPathChange ] = useMemo( () => {
- const processedPath = pathWithPrefix.substring(
- GLOBAL_STYLES_PATH_PREFIX.length
- );
+ const [ section, onChangeSection ] = useMemo( () => {
return [
- processedPath ? processedPath : '/',
- ( newPath ) => {
- history.push( {
- path:
- ! newPath || newPath === '/'
- ? GLOBAL_STYLES_PATH_PREFIX
- : `${ GLOBAL_STYLES_PATH_PREFIX }${ newPath }`,
- } );
+ query.section ?? '/',
+ ( updatedSection ) => {
+ history.navigate(
+ addQueryArgs( path, {
+ section: updatedSection,
+ } )
+ );
},
];
- }, [ pathWithPrefix, history ] );
+ }, [ path, query.section, history ] );
return (
<>
@@ -100,7 +95,10 @@ export default function GlobalStylesUIWrapper() {
className="edit-site-styles"
title={ __( 'Styles' ) }
>
-
+
{ canvas === 'view' && isStyleBookOpened && (
{
if (
STYLE_BOOK_COLOR_GROUPS.find(
@@ -129,17 +123,17 @@ export default function GlobalStylesUIWrapper() {
)
) {
// Go to color palettes Global Styles.
- onPathChange( '/colors/palette' );
+ onChangeSection( '/colors/palette' );
return;
}
if ( blockName === 'typography' ) {
// Go to typography Global Styles.
- onPathChange( '/typography' );
+ onChangeSection( '/typography' );
return;
}
// Now go to the selected block.
- onPathChange(
+ onChangeSection(
`/blocks/${ encodeURIComponent( blockName ) }`
);
} }
diff --git a/packages/edit-site/src/components/sidebar-navigation-item/index.js b/packages/edit-site/src/components/sidebar-navigation-item/index.js
index 80f06d7e93133b..4bde94dcbbeb4d 100644
--- a/packages/edit-site/src/components/sidebar-navigation-item/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-item/index.js
@@ -22,7 +22,7 @@ import { useContext } from '@wordpress/element';
import { unlock } from '../../lock-unlock';
import { SidebarNavigationContext } from '../sidebar';
-const { useHistory } = unlock( routerPrivateApis );
+const { useHistory, useLink } = unlock( routerPrivateApis );
export default function SidebarNavigationItem( {
className,
@@ -30,7 +30,7 @@ export default function SidebarNavigationItem( {
withChevron = false,
suffix,
uid,
- params,
+ to,
onClick,
children,
...props
@@ -42,12 +42,13 @@ export default function SidebarNavigationItem( {
if ( onClick ) {
onClick( e );
navigate( 'forward' );
- } else if ( params ) {
+ } else if ( to ) {
e.preventDefault();
- history.push( params );
+ history.navigate( to );
navigate( 'forward', `[id="${ uid }"]` );
}
}
+ const linkProps = useLink( to );
return (
-
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
index 72671714479ac0..4023ba436b8659 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
@@ -7,6 +7,7 @@ import { store as coreStore } from '@wordpress/core-data';
import { useCallback } from '@wordpress/element';
import { store as preferencesStore } from '@wordpress/preferences';
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -22,7 +23,7 @@ import { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main'
const { useLocation, useHistory } = unlock( routerPrivateApis );
export function SidebarNavigationItemGlobalStyles( props ) {
- const { params } = useLocation();
+ const { name } = useLocation();
const hasGlobalStyleVariations = useSelect(
( select ) =>
!! select(
@@ -34,11 +35,9 @@ export function SidebarNavigationItemGlobalStyles( props ) {
return (
);
}
@@ -47,7 +46,7 @@ export function SidebarNavigationItemGlobalStyles( props ) {
export default function SidebarNavigationScreenGlobalStyles() {
const history = useHistory();
- const { params } = useLocation();
+ const { path } = useLocation();
const {
revisions,
isLoading: isLoadingRevisions,
@@ -60,21 +59,14 @@ export default function SidebarNavigationScreenGlobalStyles() {
const { set: setPreference } = useDispatch( preferencesStore );
const openGlobalStyles = useCallback( async () => {
- history.push(
- {
- ...params,
- canvas: 'edit',
- },
- undefined,
- {
- transition: 'canvas-mode-edit-transition',
- }
- );
+ history.navigate( addQueryArgs( path, { canvas: 'edit' } ), {
+ transition: 'canvas-mode-edit-transition',
+ } );
return Promise.all( [
setPreference( 'core', 'distractionFree', false ),
openGeneralSidebar( 'edit-site/global-styles' ),
] );
- }, [ history, params, openGeneralSidebar, setPreference ] );
+ }, [ path, history, openGeneralSidebar, setPreference ] );
const openRevisions = useCallback( async () => {
await openGlobalStyles();
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js
index 49e60d44047326..1db651631c53d4 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js
@@ -15,18 +15,13 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
import { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';
import { unlock } from '../../lock-unlock';
import { store as editSiteStore } from '../../store';
-import {
- NAVIGATION_POST_TYPE,
- TEMPLATE_POST_TYPE,
- PATTERN_TYPES,
-} from '../../utils/constants';
export function MainSidebarNavigationContent() {
return (
@@ -40,7 +35,7 @@ export function MainSidebarNavigationContent() {
@@ -48,7 +43,7 @@ export function MainSidebarNavigationContent() {
@@ -56,7 +51,7 @@ export function MainSidebarNavigationContent() {
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js
index 6b85e088817edf..a07167413ae119 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js
@@ -58,11 +58,9 @@ export default function ScreenNavigationMoreMenu( props ) {
{
- history.push( {
- postId: menuId,
- postType: 'wp_navigation',
- canvas: 'edit',
- } );
+ history.navigate(
+ `/wp_navigation/${ menuId }?canvas=edit`
+ );
} }
>
{ __( 'Edit' ) }
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
index 4a7e1deddc6d93..11635c6c6abb12 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
@@ -42,7 +42,7 @@ function useDeleteNavigationMenu() {
type: 'snackbar',
}
);
- history.push( { postType: 'wp_navigation' } );
+ history.navivate( '/navigation' );
} catch ( error ) {
createErrorNotice(
sprintf(
@@ -165,7 +165,7 @@ function useDuplicateNavigationMenu() {
createSuccessNotice( __( 'Duplicated Navigation Menu' ), {
type: 'snackbar',
} );
- history.push( { postType, postId: savedRecord.id } );
+ history.navigate( `/wp_navigation/${ savedRecord.id }` );
}
} catch ( error ) {
createErrorNotice(
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js
index ece549f57378b2..dc3dd879611843 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js
@@ -18,7 +18,6 @@ import { navigation } from '@wordpress/icons';
import SidebarNavigationScreen from '../sidebar-navigation-screen';
import SidebarNavigationItem from '../sidebar-navigation-item';
import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
-import { useLink } from '../routes/link';
import SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';
import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';
import { unlock } from '../../lock-unlock';
@@ -152,9 +151,10 @@ export function SidebarNavigationScreenWrapper( {
}
const NavMenuItem = ( { postId, ...props } ) => {
- const linkInfo = useLink( {
- postId,
- postType: 'wp_navigation',
- } );
- return ;
+ return (
+
+ );
};
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js
index 568ec291f9ed11..ba01faab0291ce 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js
@@ -20,10 +20,11 @@ const POPOVER_PROPS = {
*/
import { unlock } from '../../lock-unlock';
-const { useHistory } = unlock( routerPrivateApis );
+const { useHistory, useLocation } = unlock( routerPrivateApis );
export default function LeafMoreMenu( props ) {
const history = useHistory();
+ const { path } = useLocation();
const { block } = props;
const { clientId } = block;
const { moveBlocksDown, moveBlocksUp, removeBlocks } =
@@ -59,33 +60,20 @@ export default function LeafMoreMenu( props ) {
attributes.type &&
history
) {
- const { params } = history.getLocationWithParams();
- history.push(
+ history.navigate(
+ `/${ attributes.type }/${ attributes.id }?canvas=edit`,
{
- postType: attributes.type,
- postId: attributes.id,
- canvas: 'edit',
- },
- {
- backPath: params,
+ state: { backPath: path },
}
);
}
if ( name === 'core/page-list-item' && attributes.id && history ) {
- const { params } = history.getLocationWithParams();
- history.push(
- {
- postType: 'page',
- postId: attributes.id,
- canvas: 'edit',
- },
- {
- backPath: params,
- }
- );
+ history.navigate( `/page/${ attributes.id }?canvas=edit`, {
+ state: { backPath: path },
+ } );
}
},
- [ history ]
+ [ path, history ]
);
return (
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js
index 9c193304b99fc8..4e92af1d84f50e 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js
@@ -2,13 +2,6 @@
* Internal dependencies
*/
import SidebarNavigationItem from '../sidebar-navigation-item';
-import { useLink } from '../routes/link';
-import {
- TEMPLATE_PART_POST_TYPE,
- TEMPLATE_PART_ALL_AREAS_CATEGORY,
- PATTERN_DEFAULT_CATEGORY,
- PATTERN_TYPES,
-} from '../../utils/constants';
export default function CategoryItem( {
count,
@@ -18,28 +11,20 @@ export default function CategoryItem( {
label,
type,
} ) {
- const linkInfo = useLink( {
- categoryId:
- id !== TEMPLATE_PART_ALL_AREAS_CATEGORY &&
- id !== PATTERN_DEFAULT_CATEGORY
- ? id
- : undefined,
- postType:
- type === TEMPLATE_PART_POST_TYPE
- ? TEMPLATE_PART_POST_TYPE
- : PATTERN_TYPES.user,
- } );
-
if ( ! count ) {
return;
}
+ const queryArgs = [ `postType=${ type }` ];
+ if ( id ) {
+ queryArgs.push( `categoryId=${ id }` );
+ }
return (
{ count } }
aria-current={ isActive ? 'true' : undefined }
+ to={ `/pattern?${ queryArgs.join( '&' ) }` }
>
{ label }
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js
index eeec513cb99afb..d63389ad3be312 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js
@@ -104,12 +104,11 @@ function CategoriesGroup( {
export default function SidebarNavigationScreenPatterns( { backPath } ) {
const {
- params: { postType, categoryId },
+ query: { postType = 'wp_block', categoryId },
} = useLocation();
- const currentType = postType || PATTERN_TYPES.user;
const currentCategory =
categoryId ||
- ( currentType === PATTERN_TYPES.user
+ ( postType === PATTERN_TYPES.user
? PATTERN_DEFAULT_CATEGORY
: TEMPLATE_PART_ALL_AREAS_CATEGORY );
@@ -143,7 +142,7 @@ export default function SidebarNavigationScreenPatterns( { backPath } ) {
templatePartAreas={ templatePartAreas }
patternCategories={ patternCategories }
currentCategory={ currentCategory }
- currentType={ currentType }
+ currentType={ postType }
/>
>
) }
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js
index 5a07adf62d9b31..5d3819eac0ee3c 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js
@@ -4,35 +4,40 @@
import { useEntityRecords } from '@wordpress/core-data';
import { useMemo } from '@wordpress/element';
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
+import { __ } from '@wordpress/i18n';
+import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
* Internal dependencies
*/
-import DataViewItem from '../sidebar-dataviews/dataview-item';
+import SidebarNavigationItem from '../sidebar-navigation-item';
import { useAddedBy } from '../page-templates/hooks';
import { layout } from '@wordpress/icons';
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
+import { unlock } from '../../lock-unlock';
+
+const { useLocation } = unlock( routerPrivateApis );
const EMPTY_ARRAY = [];
function TemplateDataviewItem( { template, isActive } ) {
const { text, icon } = useAddedBy( template.type, template.id );
+
return (
-
+ aria-current={ isActive }
+ >
+ { text }
+
);
}
-export default function DataviewsTemplatesSidebarContent( {
- activeView,
- title,
-} ) {
+export default function DataviewsTemplatesSidebarContent() {
+ const {
+ query: { activeView = 'all' },
+ } = useLocation();
const { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {
per_page: -1,
} );
@@ -52,13 +57,13 @@ export default function DataviewsTemplatesSidebarContent( {
return (
-
+ aria-current={ activeView === 'all' }
+ >
+ { __( 'All templates' ) }
+
{ firstItemPerAuthorText.map( ( template ) => {
return (
- }
+ content={ }
/>
);
}
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/index.js b/packages/edit-site/src/components/sidebar-navigation-screen/index.js
index 0080964310525b..c6b3742a3fd8bc 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen/index.js
@@ -83,7 +83,7 @@ export default function SidebarNavigationScreen( {
{ ! isRoot && (
{
- history.push( backPath );
+ history.navigate( backPath );
navigate( 'back' );
} }
icon={ icon }
@@ -97,7 +97,7 @@ export default function SidebarNavigationScreen( {
label={
dashboardLinkText || __( 'Go to the Dashboard' )
}
- href={ dashboardLink || 'index.php' }
+ href={ dashboardLink }
/>
) }
{
- return params.canvas === 'edit';
- },
- areas: {
- sidebar: ,
- preview: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/home-view.js b/packages/edit-site/src/components/site-editor-routes/home.js
similarity index 66%
rename from packages/edit-site/src/components/site-editor-routes/home-view.js
rename to packages/edit-site/src/components/site-editor-routes/home.js
index 63d3d021e82083..3b6230e6b6c38d 100644
--- a/packages/edit-site/src/components/site-editor-routes/home-view.js
+++ b/packages/edit-site/src/components/site-editor-routes/home.js
@@ -4,13 +4,12 @@
import Editor from '../editor';
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
-export const homeViewRoute = {
- name: 'home-view',
- match: ( params ) => {
- return params.canvas !== 'edit';
- },
+export const homeRoute = {
+ name: 'home',
+ path: '/',
areas: {
sidebar: ,
preview: ,
+ mobile: ,
},
};
diff --git a/packages/edit-site/src/components/site-editor-routes/index.js b/packages/edit-site/src/components/site-editor-routes/index.js
index 4887436dc2ed16..bac2fa302b5cf5 100644
--- a/packages/edit-site/src/components/site-editor-routes/index.js
+++ b/packages/edit-site/src/components/site-editor-routes/index.js
@@ -9,42 +9,30 @@ import { useEffect } from '@wordpress/element';
*/
import { unlock } from '../../lock-unlock';
import { store as siteEditorStore } from '../../store';
-import { homeViewRoute } from './home-view';
-import { homeEditRoute } from './home-edit';
-import { navigationViewRoute } from './navigation-view';
-import { navigationEditRoute } from './navigation-edit';
-import { navigationItemEditRoute } from './navigation-item-edit';
-import { navigationItemViewRoute } from './navigation-item-view';
-import { stylesViewRoute } from './styles-view';
-import { patternsEditRoute } from './patterns-edit';
-import { patternsViewRoute } from './patterns-view';
-import { templatesEditRoute } from './templates-edit';
-import { templatesListViewRoute } from './templates-list-view';
-import { templatesViewRoute } from './templates-view';
-import { pagesViewRoute } from './pages-view';
-import { pagesEditRoute } from './pages-edit';
-import { pagesListViewRoute } from './pages-list-view';
-import { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';
-import { pagesViewQuickEditRoute } from './pages-view-quick-edit';
+import { homeRoute } from './home';
+import { stylesRoute } from './styles';
+import { navigationRoute } from './navigation';
+import { navigationItemRoute } from './navigation-item';
+import { patternsRoute } from './patterns';
+import { patternItemRoute } from './pattern-item';
+import { templatePartItemRoute } from './template-part-item';
+import { templatesRoute } from './templates';
+import { templateItemRoute } from './template-item';
+import { pagesRoute } from './pages';
+import { pageItemRoute } from './page-item';
const routes = [
- pagesListViewQuickEditRoute,
- pagesListViewRoute,
- pagesViewQuickEditRoute,
- pagesViewRoute,
- pagesEditRoute,
- templatesEditRoute,
- templatesListViewRoute,
- templatesViewRoute,
- patternsViewRoute,
- patternsEditRoute,
- stylesViewRoute,
- navigationItemViewRoute,
- navigationItemEditRoute,
- navigationViewRoute,
- navigationEditRoute,
- homeViewRoute,
- homeEditRoute,
+ pageItemRoute,
+ pagesRoute,
+ templateItemRoute,
+ templatesRoute,
+ templatePartItemRoute,
+ patternItemRoute,
+ patternsRoute,
+ navigationItemRoute,
+ navigationRoute,
+ stylesRoute,
+ homeRoute,
];
export function useRegisterSiteEditorRoutes() {
diff --git a/packages/edit-site/src/components/site-editor-routes/navigation-edit.js b/packages/edit-site/src/components/site-editor-routes/navigation-edit.js
deleted file mode 100644
index fdba963c41d0cb..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/navigation-edit.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Internal dependencies
- */
-import { NAVIGATION_POST_TYPE } from '../../utils/constants';
-import Editor from '../editor';
-import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
-
-export const navigationEditRoute = {
- name: 'navigation-edit',
- match: ( params ) => {
- return (
- params.postType === NAVIGATION_POST_TYPE &&
- ! params.postId &&
- params.canvas === 'edit'
- );
- },
- areas: {
- sidebar: ,
- preview: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/navigation-item-edit.js b/packages/edit-site/src/components/site-editor-routes/navigation-item-edit.js
deleted file mode 100644
index b03cdbd995ac7c..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/navigation-item-edit.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Internal dependencies
- */
-import { NAVIGATION_POST_TYPE } from '../../utils/constants';
-import Editor from '../editor';
-import SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';
-
-export const navigationItemEditRoute = {
- name: 'navigation-item-edit',
- match: ( params ) => {
- return (
- params.postType === NAVIGATION_POST_TYPE &&
- !! params.postId &&
- params.canvas === 'edit'
- );
- },
- areas: {
- sidebar: (
-
- ),
- preview: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/navigation-item-view.js b/packages/edit-site/src/components/site-editor-routes/navigation-item-view.js
deleted file mode 100644
index d04a03a8f9df38..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/navigation-item-view.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Internal dependencies
- */
-import { NAVIGATION_POST_TYPE } from '../../utils/constants';
-import Editor from '../editor';
-import SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';
-
-export const navigationItemViewRoute = {
- name: 'navigation-item-view',
- match: ( params ) => {
- return (
- params.postType === NAVIGATION_POST_TYPE &&
- !! params.postId &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
-
- ),
- preview: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/navigation-item.js b/packages/edit-site/src/components/site-editor-routes/navigation-item.js
new file mode 100644
index 00000000000000..76983d8ff8daa4
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/navigation-item.js
@@ -0,0 +1,39 @@
+/**
+ * WordPress dependencies
+ */
+import { privateApis as routerPrivateApis } from '@wordpress/router';
+
+/**
+ * Internal dependencies
+ */
+import { NAVIGATION_POST_TYPE } from '../../utils/constants';
+import Editor from '../editor';
+import SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';
+import { unlock } from '../../lock-unlock';
+
+const { useLocation } = unlock( routerPrivateApis );
+
+function MobileNavigationItemView() {
+ const { query = {} } = useLocation();
+ const { canvas = 'view' } = query;
+
+ return canvas === 'edit' ? (
+
+ ) : (
+
+ );
+}
+
+export const navigationItemRoute = {
+ name: 'navigation-item',
+ path: '/wp_navigation/:postId',
+ areas: {
+ sidebar: (
+
+ ),
+ preview: ,
+ mobile: ,
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/navigation-view.js b/packages/edit-site/src/components/site-editor-routes/navigation-view.js
deleted file mode 100644
index 59c38a2f1d099a..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/navigation-view.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Internal dependencies
- */
-import { NAVIGATION_POST_TYPE } from '../../utils/constants';
-import Editor from '../editor';
-import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
-
-export const navigationViewRoute = {
- name: 'navigation-view',
- match: ( params ) => {
- return (
- params.postType === NAVIGATION_POST_TYPE &&
- ! params.postId &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: ,
- preview: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/navigation.js b/packages/edit-site/src/components/site-editor-routes/navigation.js
new file mode 100644
index 00000000000000..4c435e78a495f2
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/navigation.js
@@ -0,0 +1,34 @@
+/**
+ * WordPress dependencies
+ */
+import { privateApis as routerPrivateApis } from '@wordpress/router';
+
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
+import { unlock } from '../../lock-unlock';
+
+const { useLocation } = unlock( routerPrivateApis );
+
+function MobileNavigationView() {
+ const { query = {} } = useLocation();
+ const { canvas = 'view' } = query;
+
+ return canvas === 'edit' ? (
+
+ ) : (
+
+ );
+}
+
+export const navigationRoute = {
+ name: 'navigation',
+ path: '/navigation',
+ areas: {
+ sidebar: ,
+ preview: ,
+ mobile: ,
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/pages-edit.js b/packages/edit-site/src/components/site-editor-routes/page-item.js
similarity index 54%
rename from packages/edit-site/src/components/site-editor-routes/pages-edit.js
rename to packages/edit-site/src/components/site-editor-routes/page-item.js
index ef4c7efbfb09c2..c20720316b10e0 100644
--- a/packages/edit-site/src/components/site-editor-routes/pages-edit.js
+++ b/packages/edit-site/src/components/site-editor-routes/page-item.js
@@ -6,29 +6,21 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
-import PostList from '../post-list';
+import Editor from '../editor';
import DataViewsSidebarContent from '../sidebar-dataviews';
import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import Editor from '../editor';
-function PageList() {
- return ;
-}
-
-export const pagesEditRoute = {
- name: 'pages-edit',
- match: ( params ) => {
- return params.postType === 'page' && params.canvas === 'edit';
- },
+export const pageItemRoute = {
+ name: 'page-item',
+ path: '/page/:postId',
areas: {
sidebar: (
}
+ backPath="/"
+ content={ }
/>
),
- content: ,
mobile: ,
preview: ,
},
diff --git a/packages/edit-site/src/components/site-editor-routes/pages-list-view-quick-edit.js b/packages/edit-site/src/components/site-editor-routes/pages-list-view-quick-edit.js
deleted file mode 100644
index 9eb33e05a99bb0..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/pages-list-view-quick-edit.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-import { privateApis as routerPrivateApis } from '@wordpress/router';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import { unlock } from '../../lock-unlock';
-import { PostEdit } from '../post-edit';
-import Editor from '../editor';
-
-const { useLocation } = unlock( routerPrivateApis );
-
-function PageList() {
- return ;
-}
-
-function PageQuickEdit() {
- const { params } = useLocation();
- return ;
-}
-
-export const pagesListViewQuickEditRoute = {
- name: 'pages-list-view-quick-edit',
- match: ( params ) => {
- return (
- params.isCustom !== 'true' &&
- ( params.layout ?? 'list' ) === 'list' &&
- !! params.quickEdit &&
- params.postType === 'page' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- mobile: ,
- preview: ,
- edit: ,
- },
- widths: {
- content: 380,
- edit: 380,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/pages-list-view.js b/packages/edit-site/src/components/site-editor-routes/pages-list-view.js
deleted file mode 100644
index 74b39848e83f2b..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/pages-list-view.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import Editor from '../editor';
-
-function PageList() {
- return ;
-}
-
-export const pagesListViewRoute = {
- name: 'pages-list-view',
- match: ( params ) => {
- return (
- params.isCustom !== 'true' &&
- ( params.layout ?? 'list' ) === 'list' &&
- ! params.quickEdit &&
- params.postType === 'page' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- preview: ,
- mobile: ,
- },
- widths: {
- content: 380,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/pages-view-quick-edit.js b/packages/edit-site/src/components/site-editor-routes/pages-view-quick-edit.js
deleted file mode 100644
index 907054364c8a93..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/pages-view-quick-edit.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-import { privateApis as routerPrivateApis } from '@wordpress/router';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import { unlock } from '../../lock-unlock';
-import { PostEdit } from '../post-edit';
-
-const { useLocation } = unlock( routerPrivateApis );
-
-function PageList() {
- return ;
-}
-
-function PageQuickEdit() {
- const { params } = useLocation();
- return ;
-}
-
-export const pagesViewQuickEditRoute = {
- name: 'pages-view-quick-edit',
- match: ( params ) => {
- return (
- ( params.isCustom === 'true' ||
- ( params.layout ?? 'list' ) !== 'list' ) &&
- !! params.quickEdit &&
- params.postType === 'page' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- mobile: ,
- edit: ,
- },
- widths: {
- edit: 380,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/pages-view.js b/packages/edit-site/src/components/site-editor-routes/pages-view.js
deleted file mode 100644
index df7e211022cacf..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/pages-view.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-
-/**
- * Internal dependencies
- */
-import PostList from '../post-list';
-import DataViewsSidebarContent from '../sidebar-dataviews';
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-
-function PageList() {
- return ;
-}
-
-export const pagesViewRoute = {
- name: 'pages-view',
- match: ( params ) => {
- return (
- ( params.isCustom === 'true' ||
- ( params.layout ?? 'list' ) !== 'list' ) &&
- ! params.quickEdit &&
- params.postType === 'page' &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: (
- }
- />
- ),
- content: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/pages.js b/packages/edit-site/src/components/site-editor-routes/pages.js
new file mode 100644
index 00000000000000..e8c55cd10307e1
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/pages.js
@@ -0,0 +1,66 @@
+/**
+ * WordPress dependencies
+ */
+import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { __ } from '@wordpress/i18n';
+
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreen from '../sidebar-navigation-screen';
+import DataViewsSidebarContent from '../sidebar-dataviews';
+import PostList from '../post-list';
+import { unlock } from '../../lock-unlock';
+import { PostEdit } from '../post-edit';
+
+const { useLocation } = unlock( routerPrivateApis );
+
+function MobilePagesView() {
+ const { query = {} } = useLocation();
+ const { canvas = 'view' } = query;
+
+ return canvas === 'edit' ? : ;
+}
+
+export const pagesRoute = {
+ name: 'pages',
+ path: '/page',
+ areas: {
+ sidebar: (
+ }
+ />
+ ),
+ content: ,
+ preview( { query } ) {
+ const isListView =
+ ( query.layout === 'list' || ! query.layout ) &&
+ query.isCustom !== 'true';
+ return isListView ? : undefined;
+ },
+ mobile: ,
+ edit( { query } ) {
+ const hasQuickEdit =
+ ( query.layout ?? 'list' ) === 'list' && !! query.quickEdit;
+ return hasQuickEdit ? (
+
+ ) : undefined;
+ },
+ },
+ widths: {
+ content( { query } ) {
+ const isListView =
+ ( query.layout === 'list' || ! query.layout ) &&
+ query.isCustom !== 'true';
+ return isListView ? 380 : undefined;
+ },
+ edit( { query } ) {
+ const hasQuickEdit =
+ ( query.layout ?? 'list' ) === 'list' && !! query.quickEdit;
+ return hasQuickEdit ? 380 : undefined;
+ },
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/pattern-item.js b/packages/edit-site/src/components/site-editor-routes/pattern-item.js
new file mode 100644
index 00000000000000..c4cbcf871f3686
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/pattern-item.js
@@ -0,0 +1,15 @@
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
+
+export const patternItemRoute = {
+ name: 'pattern-item',
+ path: '/wp_block/:postId',
+ areas: {
+ sidebar: ,
+ mobile: ,
+ preview: ,
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/patterns-edit.js b/packages/edit-site/src/components/site-editor-routes/patterns-edit.js
deleted file mode 100644
index eaf1fd68020181..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/patterns-edit.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Internal dependencies
- */
-import Editor from '../editor';
-import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
-import PagePatterns from '../page-patterns';
-import { PATTERN_TYPES, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
-
-export const patternsEditRoute = {
- name: 'patterns-edit',
- match: ( params ) => {
- return (
- [ TEMPLATE_PART_POST_TYPE, PATTERN_TYPES.user ].includes(
- params.postType
- ) && params.canvas === 'edit'
- );
- },
- areas: {
- sidebar: ,
- content: ,
- mobile: ,
- preview: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/patterns-view.js b/packages/edit-site/src/components/site-editor-routes/patterns-view.js
deleted file mode 100644
index 468f7f14abc139..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/patterns-view.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Internal dependencies
- */
-import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
-import PagePatterns from '../page-patterns';
-import { PATTERN_TYPES, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
-
-export const patternsViewRoute = {
- name: 'patterns-view',
- match: ( params ) => {
- return (
- [ TEMPLATE_PART_POST_TYPE, PATTERN_TYPES.user ].includes(
- params.postType
- ) && params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: ,
- content: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/patterns.js b/packages/edit-site/src/components/site-editor-routes/patterns.js
new file mode 100644
index 00000000000000..48207cfe1c1d2c
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/patterns.js
@@ -0,0 +1,15 @@
+/**
+ * Internal dependencies
+ */
+import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
+import PagePatterns from '../page-patterns';
+
+export const patternsRoute = {
+ name: 'patterns',
+ path: '/pattern',
+ areas: {
+ sidebar: ,
+ content: ,
+ mobile: ,
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/styles-view.js b/packages/edit-site/src/components/site-editor-routes/styles.js
similarity index 58%
rename from packages/edit-site/src/components/site-editor-routes/styles-view.js
rename to packages/edit-site/src/components/site-editor-routes/styles.js
index cc9411eb8144c0..17e4a3c064d023 100644
--- a/packages/edit-site/src/components/site-editor-routes/styles-view.js
+++ b/packages/edit-site/src/components/site-editor-routes/styles.js
@@ -5,18 +5,12 @@ import Editor from '../editor';
import SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';
import GlobalStylesUIWrapper from '../sidebar-global-styles-wrapper';
-export const stylesViewRoute = {
- name: 'styles-view',
- match: ( params ) => {
- return (
- params.path &&
- params.path.startsWith( '/wp_global_styles' ) &&
- params.canvas !== 'edit'
- );
- },
+export const stylesRoute = {
+ name: 'styles',
+ path: '/styles',
areas: {
content: ,
- sidebar: ,
+ sidebar: ,
preview: ,
mobile: ,
},
diff --git a/packages/edit-site/src/components/site-editor-routes/template-item.js b/packages/edit-site/src/components/site-editor-routes/template-item.js
new file mode 100644
index 00000000000000..8ad3ab2b699904
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/template-item.js
@@ -0,0 +1,15 @@
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
+
+export const templateItemRoute = {
+ name: 'template-item',
+ path: '/wp_template/*postId',
+ areas: {
+ sidebar: ,
+ mobile: ,
+ preview: ,
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/template-part-item.js b/packages/edit-site/src/components/site-editor-routes/template-part-item.js
new file mode 100644
index 00000000000000..a2b21cf23f808d
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/template-part-item.js
@@ -0,0 +1,15 @@
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
+
+export const templatePartItemRoute = {
+ name: 'template-part-item',
+ path: '/wp_template_part/*postId',
+ areas: {
+ sidebar: ,
+ mobile: ,
+ preview: ,
+ },
+};
diff --git a/packages/edit-site/src/components/site-editor-routes/templates-edit.js b/packages/edit-site/src/components/site-editor-routes/templates-edit.js
deleted file mode 100644
index 488e9decc1888c..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/templates-edit.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Internal dependencies
- */
-import { TEMPLATE_POST_TYPE } from '../../utils/constants';
-import PageTemplates from '../page-templates';
-import Editor from '../editor';
-import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
-
-export const templatesEditRoute = {
- name: 'templates-edit',
- match: ( params ) => {
- return (
- params.postType === TEMPLATE_POST_TYPE && params.canvas === 'edit'
- );
- },
- areas: {
- sidebar: ,
- content: ,
- mobile: ,
- preview: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/templates-list-view.js b/packages/edit-site/src/components/site-editor-routes/templates-list-view.js
deleted file mode 100644
index 7cdda1b13c0b47..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/templates-list-view.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Internal dependencies
- */
-import { TEMPLATE_POST_TYPE } from '../../utils/constants';
-import PageTemplates from '../page-templates';
-import Editor from '../editor';
-import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
-
-export const templatesListViewRoute = {
- name: 'templates-list-view',
- match: ( params ) => {
- return (
- params.isCustom !== 'true' &&
- params.layout === 'list' &&
- params.postType === TEMPLATE_POST_TYPE &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: ,
- content: ,
- mobile: ,
- preview: ,
- },
- widths: {
- content: 380,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/templates-view.js b/packages/edit-site/src/components/site-editor-routes/templates-view.js
deleted file mode 100644
index 40fd88c0e60a61..00000000000000
--- a/packages/edit-site/src/components/site-editor-routes/templates-view.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Internal dependencies
- */
-import { TEMPLATE_POST_TYPE } from '../../utils/constants';
-import PageTemplates from '../page-templates';
-import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
-
-export const templatesViewRoute = {
- name: 'templates-view',
- match: ( params ) => {
- return (
- ( params.isCustom === 'true' || params.layout !== 'list' ) &&
- params.postType === TEMPLATE_POST_TYPE &&
- params.canvas !== 'edit'
- );
- },
- areas: {
- sidebar: ,
- content: ,
- mobile: ,
- },
-};
diff --git a/packages/edit-site/src/components/site-editor-routes/templates.js b/packages/edit-site/src/components/site-editor-routes/templates.js
new file mode 100644
index 00000000000000..06ba07fcd06595
--- /dev/null
+++ b/packages/edit-site/src/components/site-editor-routes/templates.js
@@ -0,0 +1,45 @@
+/**
+ * WordPress dependencies
+ */
+import { privateApis as routerPrivateApis } from '@wordpress/router';
+
+/**
+ * Internal dependencies
+ */
+import Editor from '../editor';
+import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
+import { unlock } from '../../lock-unlock';
+import PageTemplates from '../page-templates';
+
+const { useLocation } = unlock( routerPrivateApis );
+
+function MobileTemplatesView() {
+ const { query = {} } = useLocation();
+ const { canvas = 'view' } = query;
+
+ return canvas === 'edit' ? (
+
+ ) : (
+
+ );
+}
+
+export const templatesRoute = {
+ name: 'templates',
+ path: '/template',
+ areas: {
+ sidebar: ,
+ content: ,
+ preview( { query } ) {
+ const isListView = query.layout === 'list';
+ return isListView ? : undefined;
+ },
+ mobile: ,
+ },
+ widths: {
+ content( { query } ) {
+ const isListView = query.layout === 'list';
+ return isListView ? 380 : undefined;
+ },
+ },
+};
diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js
index 9e57034bfe73aa..91324356d01975 100644
--- a/packages/edit-site/src/components/site-hub/index.js
+++ b/packages/edit-site/src/components/site-hub/index.js
@@ -39,8 +39,7 @@ const SiteHub = memo(
const { getEntityRecord } = select( coreStore );
const _site = getEntityRecord( 'root', 'site' );
return {
- dashboardLink:
- getSettings().__experimentalDashboardLink || 'index.php',
+ dashboardLink: getSettings().__experimentalDashboardLink,
homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
siteTitle:
! _site?.title && !! _site?.url
@@ -129,9 +128,7 @@ export const SiteHubMobile = memo(
select( coreStore );
const _site = getEntityRecord( 'root', 'site' );
return {
- dashboardLink:
- getSettings().__experimentalDashboardLink ||
- 'index.php',
+ dashboardLink: getSettings().__experimentalDashboardLink,
isBlockTheme: getCurrentTheme()?.is_block_theme,
homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
siteTitle:
@@ -170,7 +167,7 @@ export const SiteHubMobile = memo(
}
: {
onClick: () => {
- history.push( {} );
+ history.navigate( '/' );
navigate( 'back' );
},
label: __( 'Go to Site Editor' ),
diff --git a/packages/edit-site/src/hooks/commands/use-common-commands.js b/packages/edit-site/src/hooks/commands/use-common-commands.js
index 3e87f8721e116a..34ddae3e1af7a4 100644
--- a/packages/edit-site/src/hooks/commands/use-common-commands.js
+++ b/packages/edit-site/src/hooks/commands/use-common-commands.js
@@ -49,27 +49,17 @@ const getGlobalStylesOpenStylesCommands = () =>
label: __( 'Open styles' ),
callback: ( { close } ) => {
close();
- if ( ! params.postId ) {
- history.push( {
- path: '/wp_global_styles',
- canvas: 'edit',
+ if ( canvas !== 'edit' ) {
+ history.navigate( '/styles?canvas=edit', {
+ transition: 'canvas-mode-edit-transition',
} );
}
- if ( params.postId && canvas !== 'edit' ) {
- history.push(
- { ...params, canvas: 'edit' },
- undefined,
- {
- transition: 'canvas-mode-edit-transition',
- }
- );
- }
openGeneralSidebar( 'edit-site/global-styles' );
},
icon: styles,
},
];
- }, [ history, openGeneralSidebar, params, canvas, isBlockBasedTheme ] );
+ }, [ history, openGeneralSidebar, canvas, isBlockBasedTheme ] );
return {
isLoading: false,
@@ -100,24 +90,11 @@ const getGlobalStylesToggleWelcomeGuideCommands = () =>
label: __( 'Learn about styles' ),
callback: ( { close } ) => {
close();
- if ( ! params.postId ) {
- history.push( {
- path: '/wp_global_styles',
- canvas: 'edit',
+ if ( canvas !== 'edit' ) {
+ history.navigate( '/styles?canvas=edit', {
+ transition: 'canvas-mode-edit-transition',
} );
}
- if ( params.postId && canvas !== 'edit' ) {
- history.push(
- {
- ...params,
- canvas: 'edit',
- },
- undefined,
- {
- transition: 'canvas-mode-edit-transition',
- }
- );
- }
openGeneralSidebar( 'edit-site/global-styles' );
set( 'core/edit-site', 'welcomeGuideStyles', true );
// sometimes there's a focus loss that happens after some time
@@ -129,14 +106,7 @@ const getGlobalStylesToggleWelcomeGuideCommands = () =>
icon: help,
},
];
- }, [
- history,
- openGeneralSidebar,
- canvas,
- isBlockBasedTheme,
- set,
- params,
- ] );
+ }, [ history, openGeneralSidebar, canvas, isBlockBasedTheme, set ] );
return {
isLoading: false,
@@ -205,24 +175,11 @@ const getGlobalStylesOpenCssCommands = () =>
icon: brush,
callback: ( { close } ) => {
close();
- if ( ! params.postId ) {
- history.push( {
- path: '/wp_global_styles',
- canvas: 'edit',
+ if ( canvas !== 'edit' ) {
+ history.navigate( '/styles?canvas=edit', {
+ transition: 'canvas-mode-edit-transition',
} );
}
- if ( params.postId && canvas !== 'edit' ) {
- history.push(
- {
- ...params,
- canvas: 'edit',
- },
- undefined,
- {
- transition: 'canvas-mode-edit-transition',
- }
- );
- }
openGeneralSidebar( 'edit-site/global-styles' );
setEditorCanvasContainerView( 'global-styles-css' );
},
@@ -234,7 +191,6 @@ const getGlobalStylesOpenCssCommands = () =>
setEditorCanvasContainerView,
canEditCSS,
canvas,
- params,
] );
return {
isLoading: false,
@@ -272,24 +228,11 @@ const getGlobalStylesOpenRevisionsCommands = () =>
icon: backup,
callback: ( { close } ) => {
close();
- if ( ! params.postId ) {
- history.push( {
- path: '/wp_global_styles',
- canvas: 'edit',
+ if ( canvas !== 'edit' ) {
+ history.navigate( '/styles?canvas=edit', {
+ transition: 'canvas-mode-edit-transition',
} );
}
- if ( params.postId && canvas !== 'edit' ) {
- history.push(
- {
- ...params,
- canvas: 'edit',
- },
- undefined,
- {
- transition: 'canvas-mode-edit-transition',
- }
- );
- }
openGeneralSidebar( 'edit-site/global-styles' );
setEditorCanvasContainerView(
'global-styles-revisions'
@@ -303,7 +246,6 @@ const getGlobalStylesOpenRevisionsCommands = () =>
openGeneralSidebar,
setEditorCanvasContainerView,
canvas,
- params,
] );
return {
diff --git a/packages/edit-site/src/hooks/commands/use-set-command-context.js b/packages/edit-site/src/hooks/commands/use-set-command-context.js
index e27c4ca91582fd..6ecdf04989609b 100644
--- a/packages/edit-site/src/hooks/commands/use-set-command-context.js
+++ b/packages/edit-site/src/hooks/commands/use-set-command-context.js
@@ -19,8 +19,8 @@ const { useLocation } = unlock( routerPrivateApis );
* React hook used to set the correct command context based on the current state.
*/
export default function useSetCommandContext() {
- const { params } = useLocation();
- const { canvas = 'view' } = params;
+ const { query = {} } = useLocation();
+ const { canvas = 'view' } = query;
const hasBlockSelected = useSelect( ( select ) => {
return select( blockEditorStore ).getBlockSelectionStart();
}, [] );
diff --git a/packages/edit-site/src/store/private-actions.js b/packages/edit-site/src/store/private-actions.js
index 1db3873acedda2..9b16748049cd0e 100644
--- a/packages/edit-site/src/store/private-actions.js
+++ b/packages/edit-site/src/store/private-actions.js
@@ -18,3 +18,10 @@ export function registerRoute( route ) {
route,
};
}
+
+export function unregisterRoute( name ) {
+ return {
+ type: 'UNREGISTER_ROUTE',
+ name,
+ };
+}
diff --git a/packages/edit-site/src/store/reducer.js b/packages/edit-site/src/store/reducer.js
index 3ce067c25c1954..7ffb276a35da10 100644
--- a/packages/edit-site/src/store/reducer.js
+++ b/packages/edit-site/src/store/reducer.js
@@ -85,6 +85,8 @@ function routes( state = [], action ) {
switch ( action.type ) {
case 'REGISTER_ROUTE':
return [ ...state, action.route ];
+ case 'UNREGISTER_ROUTE':
+ return state.filter( ( route ) => route.name !== action.name );
}
return state;
diff --git a/packages/edit-site/src/utils/is-previewing-theme.js b/packages/edit-site/src/utils/is-previewing-theme.js
index 1a71c441f9925e..a4c830b4b60ad7 100644
--- a/packages/edit-site/src/utils/is-previewing-theme.js
+++ b/packages/edit-site/src/utils/is-previewing-theme.js
@@ -4,9 +4,7 @@
import { getQueryArg } from '@wordpress/url';
export function isPreviewingTheme() {
- return (
- getQueryArg( window.location.href, 'wp_theme_preview' ) !== undefined
- );
+ return !! getQueryArg( window.location.href, 'wp_theme_preview' );
}
export function currentlyPreviewingTheme() {
diff --git a/packages/edit-site/src/utils/use-activate-theme.js b/packages/edit-site/src/utils/use-activate-theme.js
index 0dafd88340ba75..447ea073053492 100644
--- a/packages/edit-site/src/utils/use-activate-theme.js
+++ b/packages/edit-site/src/utils/use-activate-theme.js
@@ -4,6 +4,7 @@
import { store as coreStore } from '@wordpress/core-data';
import { useDispatch } from '@wordpress/data';
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -14,7 +15,7 @@ import {
currentlyPreviewingTheme,
} from './is-previewing-theme';
-const { useHistory } = unlock( routerPrivateApis );
+const { useHistory, useLocation } = unlock( routerPrivateApis );
/**
* This should be refactored to use the REST API, once the REST API can activate themes.
@@ -23,6 +24,7 @@ const { useHistory } = unlock( routerPrivateApis );
*/
export function useActivateTheme() {
const history = useHistory();
+ const { path } = useLocation();
const { startResolution, finishResolution } = useDispatch( coreStore );
return async () => {
@@ -37,8 +39,7 @@ export function useActivateTheme() {
finishResolution( 'activateTheme' );
// Remove the wp_theme_preview query param: we've finished activating
// the queue and are switching to normal Site Editor.
- const { params } = history.getLocationWithParams();
- history.replace( { ...params, wp_theme_preview: undefined } );
+ history.navigate( addQueryArgs( path, { wp_theme_preview: '' } ) );
}
};
}
diff --git a/packages/router/package.json b/packages/router/package.json
index 26b4f29df04f60..66a64f4ddc5baa 100644
--- a/packages/router/package.json
+++ b/packages/router/package.json
@@ -29,10 +29,12 @@
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
+ "@wordpress/compose": "*",
"@wordpress/element": "*",
"@wordpress/private-apis": "*",
"@wordpress/url": "*",
- "history": "^5.3.0"
+ "history": "^5.3.0",
+ "route-recognizer": "^0.3.4"
},
"peerDependencies": {
"react": "^18.0.0"
diff --git a/packages/router/src/history.ts b/packages/router/src/history.ts
deleted file mode 100644
index 6cbef108eec206..00000000000000
--- a/packages/router/src/history.ts
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * External dependencies
- */
-import { createBrowserHistory, type BrowserHistory } from 'history';
-
-/**
- * WordPress dependencies
- */
-import { buildQueryString } from '@wordpress/url';
-
-export interface EnhancedHistory extends BrowserHistory {
- getLocationWithParams: () => Location;
-}
-
-interface PushOptions {
- transition?: string;
-}
-
-const history = createBrowserHistory();
-
-const originalHistoryPush = history.push;
-const originalHistoryReplace = history.replace;
-
-// Preserve the `wp_theme_preview` query parameter when navigating
-// around the Site Editor.
-// TODO: move this hack out of the router into Site Editor code.
-function preserveThemePreview( params: Record< string, any > ) {
- if ( params.hasOwnProperty( 'wp_theme_preview' ) ) {
- return params;
- }
- const currentSearch = new URLSearchParams( history.location.search );
- const currentThemePreview = currentSearch.get( 'wp_theme_preview' );
- if ( currentThemePreview === null ) {
- return params;
- }
- return { ...params, wp_theme_preview: currentThemePreview };
-}
-
-function push(
- params: Record< string, any >,
- state: Record< string, any >,
- options: PushOptions = {}
-) {
- const performPush = () => {
- const search = buildQueryString( preserveThemePreview( params ) );
- return originalHistoryPush.call( history, { search }, state );
- };
-
- /*
- * Skip transition in mobile, otherwise it crashes the browser.
- * See: https://github.com/WordPress/gutenberg/pull/63002.
- */
- const isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;
- if (
- ! isMediumOrBigger ||
- // @ts-expect-error
- ! document.startViewTransition ||
- ! options.transition
- ) {
- return performPush();
- }
- document.documentElement.classList.add( options.transition );
- // @ts-expect-error
- const transition = document.startViewTransition( () => performPush() );
- transition.finished.finally( () => {
- document.documentElement.classList.remove( options.transition ?? '' );
- } );
-}
-
-function replace(
- params: Record< string, any >,
- state: Record< string, any >
-) {
- const search = buildQueryString( preserveThemePreview( params ) );
- return originalHistoryReplace.call( history, { search }, state );
-}
-
-const locationMemo = new WeakMap();
-function getLocationWithParams() {
- const location = history.location;
- let locationWithParams = locationMemo.get( location );
- if ( ! locationWithParams ) {
- locationWithParams = {
- ...location,
- params: Object.fromEntries(
- new URLSearchParams( location.search )
- ),
- };
- locationMemo.set( location, locationWithParams );
- }
- return locationWithParams;
-}
-
-export default {
- ...history,
- push,
- replace,
- getLocationWithParams,
-};
diff --git a/packages/router/src/link.tsx b/packages/router/src/link.tsx
new file mode 100644
index 00000000000000..d312a9da144601
--- /dev/null
+++ b/packages/router/src/link.tsx
@@ -0,0 +1,55 @@
+/**
+ * WordPress dependencies
+ */
+import { useContext, useMemo } from '@wordpress/element';
+import { getQueryArgs, getPath, buildQueryString } from '@wordpress/url';
+
+/**
+ * Internal dependencies
+ */
+import { ConfigContext, type NavigationOptions, useHistory } from './router';
+
+export function useLink( to: string, options: NavigationOptions = {} ) {
+ const history = useHistory();
+ const { pathArg, beforeNavigate } = useContext( ConfigContext );
+ function onClick( event: React.SyntheticEvent< HTMLAnchorElement > ) {
+ event?.preventDefault();
+ history.navigate( to, options );
+ }
+ const query = getQueryArgs( to );
+ const path = getPath( 'http://domain.com/' + to ) ?? '';
+ const link = useMemo( () => {
+ return beforeNavigate
+ ? beforeNavigate( { path, query } )
+ : { path, query };
+ }, [ path, query, beforeNavigate ] );
+
+ const [ before ] = window.location.href.split( '?' );
+
+ return {
+ href: `${ before }?${ buildQueryString( {
+ [ pathArg ]: link.path,
+ ...link.query,
+ } ) }`,
+ onClick,
+ };
+}
+
+export function Link( {
+ to,
+ options,
+ children,
+ ...props
+}: {
+ to: string;
+ options?: NavigationOptions;
+ children: React.ReactNode;
+} ) {
+ const { href, onClick } = useLink( to, options );
+
+ return (
+
+ { children }
+
+ );
+}
diff --git a/packages/router/src/private-apis.ts b/packages/router/src/private-apis.ts
index 7b2945a24ab1a1..9ef316ed716cf4 100644
--- a/packages/router/src/private-apis.ts
+++ b/packages/router/src/private-apis.ts
@@ -2,6 +2,7 @@
* Internal dependencies
*/
import { useHistory, useLocation, RouterProvider } from './router';
+import { useLink, Link } from './link';
import { lock } from './lock-unlock';
export const privateApis = {};
@@ -9,4 +10,6 @@ lock( privateApis, {
useHistory,
useLocation,
RouterProvider,
+ useLink,
+ Link,
} );
diff --git a/packages/router/src/router.tsx b/packages/router/src/router.tsx
index 9a1d01aa5f8d88..ea0b218fa6a401 100644
--- a/packages/router/src/router.tsx
+++ b/packages/router/src/router.tsx
@@ -1,3 +1,9 @@
+/**
+ * External dependencies
+ */
+import RouteRecognizer from 'route-recognizer';
+import { createBrowserHistory } from 'history';
+
/**
* WordPress dependencies
*/
@@ -5,37 +11,227 @@ import {
createContext,
useContext,
useSyncExternalStore,
+ useMemo,
} from '@wordpress/element';
+import {
+ addQueryArgs,
+ getQueryArgs,
+ getPath,
+ buildQueryString,
+} from '@wordpress/url';
+import { useEvent } from '@wordpress/compose';
/**
* Internal dependencies
*/
-import history from './history';
-import type { EnhancedHistory } from './history';
+import type { ReactNode } from 'react';
+
+const history = createBrowserHistory();
+interface Route {
+ name: string;
+ path: string;
+ areas: Record< string, ReactNode >;
+ widths: Record< string, number >;
+}
+
+type LocationWithQuery = Location & {
+ query?: Record< string, any >;
+};
+
+interface Match {
+ name: string;
+ path: string;
+ areas: Record< string, ReactNode >;
+ widths: Record< string, number >;
+ query?: Record< string, any >;
+ params?: Record< string, any >;
+}
+
+export type BeforeNavigate = ( arg: {
+ path: string;
+ query: Record< string, any >;
+} ) => {
+ path: string;
+ query: Record< string, any >;
+};
+
+interface Config {
+ pathArg: string;
+ beforeNavigate?: BeforeNavigate;
+}
+
+export interface NavigationOptions {
+ transition?: string;
+ state?: Record< string, any >;
+}
-const RoutesContext = createContext< Location | null >( null );
-const HistoryContext = createContext< EnhancedHistory >( history );
+const RoutesContext = createContext< Match | null >( null );
+export const ConfigContext = createContext< Config >( { pathArg: 'p' } );
+
+const locationMemo = new WeakMap();
+function getLocationWithQuery() {
+ const location = history.location;
+ let locationWithQuery = locationMemo.get( location );
+ if ( ! locationWithQuery ) {
+ locationWithQuery = {
+ ...location,
+ query: Object.fromEntries( new URLSearchParams( location.search ) ),
+ };
+ locationMemo.set( location, locationWithQuery );
+ }
+ return locationWithQuery;
+}
export function useLocation() {
- return useContext( RoutesContext );
+ const context = useContext( RoutesContext );
+ if ( ! context ) {
+ throw new Error( 'useLocation must be used within a RouterProvider' );
+ }
+ return context;
}
export function useHistory() {
- return useContext( HistoryContext );
+ const { pathArg, beforeNavigate } = useContext( ConfigContext );
+
+ const navigate = useEvent(
+ async ( rawPath: string, options: NavigationOptions = {} ) => {
+ const query = getQueryArgs( rawPath );
+ const path = getPath( 'http://domain.com/' + rawPath ) ?? '';
+ const performPush = () => {
+ const result = beforeNavigate
+ ? beforeNavigate( { path, query } )
+ : { path, query };
+ return history.push(
+ {
+ search: buildQueryString( {
+ [ pathArg ]: result.path,
+ ...result.query,
+ } ),
+ },
+ options.state
+ );
+ };
+
+ /*
+ * Skip transition in mobile, otherwise it crashes the browser.
+ * See: https://github.com/WordPress/gutenberg/pull/63002.
+ */
+ const isMediumOrBigger =
+ window.matchMedia( '(min-width: 782px)' ).matches;
+ if (
+ ! isMediumOrBigger ||
+ // @ts-expect-error
+ ! document.startViewTransition ||
+ ! options.transition
+ ) {
+ performPush();
+ }
+
+ await new Promise< void >( ( resolve ) => {
+ const classname = options.transition ?? '';
+ document.documentElement.classList.add( classname );
+ // @ts-expect-error
+ const transition = document.startViewTransition( () =>
+ performPush()
+ );
+ transition.finished.finally( () => {
+ document.documentElement.classList.remove( classname );
+ resolve();
+ } );
+ } );
+ }
+ );
+
+ return useMemo(
+ () => ( {
+ navigate,
+ } ),
+ [ navigate ]
+ );
+}
+
+export default function useMatch(
+ location: LocationWithQuery,
+ matcher: RouteRecognizer,
+ pathArg: string
+): Match {
+ const { query: rawQuery = {} } = location;
+
+ return useMemo( () => {
+ const { [ pathArg ]: path = '/', ...query } = rawQuery;
+ const result = matcher.recognize( path )?.[ 0 ];
+ if ( ! result ) {
+ return {
+ name: '404',
+ path: addQueryArgs( path, query ),
+ areas: {},
+ widths: {},
+ query,
+ params: {},
+ };
+ }
+
+ const matchedRoute = result.handler as Route;
+ const resolveFunctions = ( record: Record< string, any > = {} ) => {
+ return Object.fromEntries(
+ Object.entries( record ).map( ( [ key, value ] ) => {
+ if ( typeof value === 'function' ) {
+ return [
+ key,
+ value( { query, params: result.params } ),
+ ];
+ }
+ return [ key, value ];
+ } )
+ );
+ };
+ return {
+ name: matchedRoute.name,
+ areas: resolveFunctions( matchedRoute.areas ),
+ widths: resolveFunctions( matchedRoute.widths ),
+ params: result.params,
+ query,
+ path: addQueryArgs( path, query ),
+ };
+ }, [ matcher, rawQuery, pathArg ] );
}
-export function RouterProvider( { children }: { children: React.ReactNode } ) {
+export function RouterProvider( {
+ routes,
+ pathArg,
+ beforeNavigate,
+ children,
+}: {
+ routes: Route[];
+ pathArg: string;
+ beforeNavigate?: BeforeNavigate;
+ children: React.ReactNode;
+} ) {
const location = useSyncExternalStore(
history.listen,
- history.getLocationWithParams,
- history.getLocationWithParams
+ getLocationWithQuery,
+ getLocationWithQuery
+ );
+ const matcher = useMemo( () => {
+ const ret = new RouteRecognizer();
+ routes.forEach( ( route ) => {
+ ret.add( [ { path: route.path, handler: route } ], {
+ as: route.name,
+ } );
+ } );
+ return ret;
+ }, [ routes ] );
+ const match = useMatch( location, matcher, pathArg );
+ const config = useMemo(
+ () => ( { beforeNavigate, pathArg } ),
+ [ beforeNavigate, pathArg ]
);
return (
-
-
+
+
{ children }
-
+
);
}
diff --git a/packages/router/tsconfig.json b/packages/router/tsconfig.json
index e4945eef8bac0c..8706b546ff304d 100644
--- a/packages/router/tsconfig.json
+++ b/packages/router/tsconfig.json
@@ -4,11 +4,10 @@
"compilerOptions": {
"rootDir": "src",
"declarationDir": "build-types",
- "types": [ "gutenberg-env" ],
- "allowJs": false,
- "checkJs": false
+ "types": [ "gutenberg-env" ]
},
"references": [
+ { "path": "../compose" },
{ "path": "../element" },
{ "path": "../private-apis" },
{ "path": "../url" }
diff --git a/test/e2e/specs/editor/various/pattern-overrides.spec.js b/test/e2e/specs/editor/various/pattern-overrides.spec.js
index 20eff4096cb1cc..7069b4cec258ab 100644
--- a/test/e2e/specs/editor/various/pattern-overrides.spec.js
+++ b/test/e2e/specs/editor/various/pattern-overrides.spec.js
@@ -128,7 +128,11 @@ test.describe( 'Pattern Overrides', () => {
page.getByRole( 'button', { name: 'Dismiss this notice' } )
).toBeVisible();
- patternId = new URL( page.url() ).searchParams.get( 'postId' );
+ patternId = await page.evaluate( () => {
+ return window.wp.data
+ .select( 'core/editor' )
+ .getCurrentPostId();
+ } );
} );
await test.step( 'Create a post and insert the pattern with overrides', async () => {
@@ -1207,7 +1211,11 @@ test.describe( 'Pattern Overrides', () => {
page.getByRole( 'button', { name: 'Dismiss this notice' } )
).toBeVisible();
- patternId = new URL( page.url() ).searchParams.get( 'postId' );
+ patternId = await page.evaluate( () => {
+ return window.wp.data
+ .select( 'core/editor' )
+ .getCurrentPostId();
+ } );
} );
await test.step( 'create a post and insert the pattern with synced values', async () => {
diff --git a/test/e2e/specs/site-editor/browser-history.spec.js b/test/e2e/specs/site-editor/browser-history.spec.js
index eaafb3aad1b3fd..a2326d10e3cc51 100644
--- a/test/e2e/specs/site-editor/browser-history.spec.js
+++ b/test/e2e/specs/site-editor/browser-history.spec.js
@@ -21,13 +21,13 @@ test.describe( 'Site editor browser history', () => {
await page.click( 'role=button[name="Templates"]' );
await page.getByRole( 'link', { name: 'Index' } ).click();
await expect( page ).toHaveURL(
- '/wp-admin/site-editor.php?postId=emptytheme%2F%2Findex&postType=wp_template&canvas=edit'
+ '/wp-admin/site-editor.php?p=%2Fwp_template%2Femptytheme%2F%2Findex&canvas=edit'
);
// Navigate back to the template list
await page.goBack();
await expect( page ).toHaveURL(
- '/wp-admin/site-editor.php?postType=wp_template'
+ '/wp-admin/site-editor.php?p=%2Ftemplate'
);
// Navigate back to the dashboard
diff --git a/test/e2e/specs/site-editor/command-center.spec.js b/test/e2e/specs/site-editor/command-center.spec.js
index 19318081aa171b..197a01c43c8b46 100644
--- a/test/e2e/specs/site-editor/command-center.spec.js
+++ b/test/e2e/specs/site-editor/command-center.spec.js
@@ -28,7 +28,7 @@ test.describe( 'Site editor command palette', () => {
await page.keyboard.type( 'new page' );
await page.getByRole( 'option', { name: 'Add new page' } ).click();
await expect( page ).toHaveURL(
- /\/wp-admin\/site-editor.php\?postId=(\d+)&postType=page&canvas=edit/
+ /\/wp-admin\/site-editor.php\?p=%2Fpage%2F(\d+)&canvas=edit/
);
await expect(
editor.canvas
diff --git a/test/e2e/specs/site-editor/hybrid-theme.spec.js b/test/e2e/specs/site-editor/hybrid-theme.spec.js
index b568aaf4445b5c..042cb1042cac22 100644
--- a/test/e2e/specs/site-editor/hybrid-theme.spec.js
+++ b/test/e2e/specs/site-editor/hybrid-theme.spec.js
@@ -33,7 +33,7 @@ test.describe( 'Hybrid theme', () => {
);
await expect( page ).toHaveURL(
- '/wp-admin/site-editor.php?postType=wp_template_part'
+ '/wp-admin/site-editor.php?p=%2Fpattern&postType=wp_template_part'
);
await expect(
diff --git a/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js b/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js
index f26fb8e13b8c3c..a0cc0af5463aed 100644
--- a/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js
+++ b/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js
@@ -44,7 +44,7 @@ test.describe( 'Site editor url navigation', () => {
.click();
await page.getByRole( 'option', { name: 'Demo' } ).click();
await expect( page ).toHaveURL(
- '/wp-admin/site-editor.php?postId=emptytheme%2F%2Fsingle-post-demo&postType=wp_template&canvas=edit'
+ '/wp-admin/site-editor.php?p=%2Fwp_template%2Femptytheme%2F%2Fsingle-post-demo&canvas=edit'
);
} );
@@ -63,7 +63,7 @@ test.describe( 'Site editor url navigation', () => {
await page.type( 'role=dialog >> role=textbox[name="Name"i]', 'Demo' );
await page.keyboard.press( 'Enter' );
await expect( page ).toHaveURL(
- '/wp-admin/site-editor.php?postId=emptytheme%2F%2Fdemo&postType=wp_template_part&canvas=edit'
+ '/wp-admin/site-editor.php?p=%2Fwp_template_part%2Femptytheme%2F%2Fdemo&canvas=edit'
);
} );
From b54d1fe5fe96b00d7f6455b4aaf40bb21ec43967 Mon Sep 17 00:00:00 2001
From: Andrea Fercia
Date: Thu, 28 Nov 2024 08:55:30 +0100
Subject: [PATCH 064/384] Fix Site editor navigation menu items alignment
visual regression. (#67321)
Co-authored-by: afercia
Co-authored-by: ramonjd
Co-authored-by: t-hamano
Co-authored-by: jameskoster
---
.../src/components/sidebar-navigation-screen/style.scss | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
index 959115e0fac8ca..1486e6b7258441 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
+++ b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
@@ -18,7 +18,7 @@
.edit-site-sidebar-navigation-screen__content {
padding: 0 $grid-unit-20;
- .edit-site-sidebar-navigation-screen-details-footer {
+ .components-item-group {
margin-left: -$grid-unit-20;
margin-right: -$grid-unit-20;
}
@@ -131,7 +131,7 @@
margin: $grid-unit-20 0 0;
border-top: 1px solid $gray-800;
- .components-item-group {
+ .edit-site-sidebar-navigation-screen-details-footer {
margin-left: -$grid-unit-20;
margin-right: -$grid-unit-20;
}
From d64cdabc6a1025ff579c90f4bb5b11aa54965e23 Mon Sep 17 00:00:00 2001
From: Grant Kinney
Date: Thu, 28 Nov 2024 03:35:18 -0600
Subject: [PATCH 065/384] Data Views: Add action for pages to set site homepage
(#65426)
* Adds basic action and modal to set page as homepage
* Adds permissions and settings checks to set as homepage action
* Adds proper description and handles unpublished pages
* Adds action to set homepage to show latest posts
* Doesn't show action if there's a front-page template
* Creates page for posts, when specified
* Refactors modal component
* Fixes issues from rebase
* Only show option on published pages
* Update snackbar wording
* Check item exists before running getItemTitle logic
* Make key optional on GetEntityRecord
* Remove some ts-ignore comments
* Add support for page_for_posts to Settings
* Remove some more ts-ignores
* Allow recordId to be optional
* Increase size of action modal
* Implement choose existing page option
* Fix number/string comparison
* Add initial e2e test
* Set post actions modal to medium
* Tweak ToggleGroupControl help text
* Fix initial test
* Remove extra useSiteSettings hook
* Allow setting draft pages to homepage
* Fix merge conflict
* Remove item check from getItemTitle
* Remove posts page options
* Don't show homepage option if selected page is the page for posts
* Reload actions list when site settings change
* Update tests
* Remove call to __experimentalGetTemplateForLink
* Update tests
* Remove item check in getItemTitle
* Use useSelect instead of select
* Remove PAGE_POST_TYPE constant
* Use saveEntityRecord instead of editEntityRecord
* Remove onSetLatestPostsHomepage option
* Remove select for site settings from isEligible
* Update post actions with site settings info
* Remove select for templates from isEligible
* Skip last test for now
* Restore whitespace
* Rename _select
* Remove sub-objects from additionalContext selectors
* Remove duplicate page_for_posts definition
* Fix page/post type error
* Remove additional groups within additionalContext
* Fix siteSettings in TitleView
* Move hasFrontPageTemplate check to private-actions
* Add JSDoc to setAsHomepage
* Refactor siteSettings in post-list
* Move homepage action to edit-site
* Revert unnecessary changes
* Move getItemTitle to edit-site utils
* Allow undefined on GetEntityRecord key
* Make it more clear that draft page will be published
* Update draft page wording
* Add set homepage action to post editor
* Attempt to fix build error
* Remove homepage action from edit-site
* Remove extra line
* Fix getting current homepage title
* Make key in getEntityRecord optional
* Use getHomePage selector
* Move canManageOptions and hasFrontPageTemplate to actions.js
* Make key optional in EntityRecordKey
* Remove undefined from getEntityRecord calls
* Update packages/editor/src/components/post-actions/actions.js
Co-authored-by: Dave Smith
* Update getEntityRecord key docs
* Refactor fetching currentHomePage
* Disable modal buttons if saving
* Store isPageDraft in useRef
* Fix lint error
* Remove onActionPerformed
* Fix current homepage test
* Remove duplicate getItemTitle function
* Update logic for shouldShowSetAsHomepageAction
* Swap order of list of actions
* Add comment about manual saveEntityRecord call
* Remove unnecessary space
* Remove temporary modalButtonLabel variable
* Combine draft and publish status tests
* Only allow action on pages with draft or publish status
* Remove handling of draft pages
* Move closeModal into finally block
* Refactor and remove renderModalBody
---------
Co-authored-by: Sarah Norris
Co-authored-by: Sarah Norris <1645628+mikachan@users.noreply.github.com>
Co-authored-by: Dave Smith
Co-authored-by: creativecoder
Co-authored-by: mikachan
Co-authored-by: ntsekouras
Co-authored-by: youknowriad
Co-authored-by: jsnajdr
Co-authored-by: ellatrix
Co-authored-by: oandregal
Co-authored-by: getdave
Co-authored-by: jameskoster
Co-authored-by: richtabor
Co-authored-by: ramonjd
Co-authored-by: jasmussen
Co-authored-by: mtias
---
docs/reference-guides/data/data-core.md | 2 +-
packages/core-data/README.md | 2 +-
packages/core-data/src/private-selectors.ts | 1 -
packages/core-data/src/selectors.ts | 8 +-
.../dataviews-item-actions/index.tsx | 2 +-
.../src/components/post-actions/actions.js | 39 +++-
.../src/components/post-actions/index.js | 2 +-
.../post-actions/set-as-homepage.js | 174 ++++++++++++++++++
packages/editor/src/dataviews/types.ts | 2 +-
packages/fields/src/actions/utils.ts | 2 +-
.../fields/src/fields/title/title-view.tsx | 7 +-
.../site-editor/homepage-settings.spec.js | 72 ++++++++
12 files changed, 296 insertions(+), 17 deletions(-)
create mode 100644 packages/editor/src/components/post-actions/set-as-homepage.js
create mode 100644 test/e2e/specs/site-editor/homepage-settings.spec.js
diff --git a/docs/reference-guides/data/data-core.md b/docs/reference-guides/data/data-core.md
index 474207aa20460f..199c29cd67dd2e 100644
--- a/docs/reference-guides/data/data-core.md
+++ b/docs/reference-guides/data/data-core.md
@@ -359,7 +359,7 @@ _Parameters_
- _state_ `State`: State tree
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
-- _key_ `EntityRecordKey`: Record's key
+- _key_ `EntityRecordKey`: Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included.
- _query_ `GetRecordsHttpQuery`: Optional query. If requesting specific fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]".
_Returns_
diff --git a/packages/core-data/README.md b/packages/core-data/README.md
index eb6980cdd4eea1..9549e6742d8cd8 100644
--- a/packages/core-data/README.md
+++ b/packages/core-data/README.md
@@ -581,7 +581,7 @@ _Parameters_
- _state_ `State`: State tree
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
-- _key_ `EntityRecordKey`: Record's key
+- _key_ `EntityRecordKey`: Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included.
- _query_ `GetRecordsHttpQuery`: Optional query. If requesting specific fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]".
_Returns_
diff --git a/packages/core-data/src/private-selectors.ts b/packages/core-data/src/private-selectors.ts
index 02fe152ed0abb6..77790512653065 100644
--- a/packages/core-data/src/private-selectors.ts
+++ b/packages/core-data/src/private-selectors.ts
@@ -151,7 +151,6 @@ export const getHomePage = createRegistrySelector( ( select ) =>
return { postType: 'wp_template', postId: frontPageTemplateId };
},
( state ) => [
- // @ts-expect-error
getEntityRecord( state, 'root', 'site' ),
getDefaultTemplateId( state, {
slug: 'front-page',
diff --git a/packages/core-data/src/selectors.ts b/packages/core-data/src/selectors.ts
index 7ea8c2f7f26d53..7f4b0d38846468 100644
--- a/packages/core-data/src/selectors.ts
+++ b/packages/core-data/src/selectors.ts
@@ -310,7 +310,7 @@ export interface GetEntityRecord {
state: State,
kind: string,
name: string,
- key: EntityRecordKey,
+ key?: EntityRecordKey,
query?: GetRecordsHttpQuery
): EntityRecord | undefined;
@@ -321,7 +321,7 @@ export interface GetEntityRecord {
>(
kind: string,
name: string,
- key: EntityRecordKey,
+ key?: EntityRecordKey,
query?: GetRecordsHttpQuery
) => EntityRecord | undefined;
__unstableNormalizeArgs?: ( args: EntityRecordArgs ) => EntityRecordArgs;
@@ -335,7 +335,7 @@ export interface GetEntityRecord {
* @param state State tree
* @param kind Entity kind.
* @param name Entity name.
- * @param key Record's key
+ * @param key Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included.
* @param query Optional query. If requesting specific
* fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]".
*
@@ -350,7 +350,7 @@ export const getEntityRecord = createSelector(
state: State,
kind: string,
name: string,
- key: EntityRecordKey,
+ key?: EntityRecordKey,
query?: GetRecordsHttpQuery
): EntityRecord | undefined => {
const queriedState =
diff --git a/packages/dataviews/src/components/dataviews-item-actions/index.tsx b/packages/dataviews/src/components/dataviews-item-actions/index.tsx
index 787cef4420acc0..b5eaac11bcd8d0 100644
--- a/packages/dataviews/src/components/dataviews-item-actions/index.tsx
+++ b/packages/dataviews/src/components/dataviews-item-actions/index.tsx
@@ -114,7 +114,7 @@ export function ActionModal< Item >( {
__experimentalHideHeader={ !! action.hideModalHeader }
onRequestClose={ closeModal ?? ( () => {} ) }
focusOnMount="firstContentElement"
- size="small"
+ size="medium"
overlayClassName={ `dataviews-action-modal dataviews-action-modal__${ kebabCase(
action.id
) }` }
diff --git a/packages/editor/src/components/post-actions/actions.js b/packages/editor/src/components/post-actions/actions.js
index 8dbe5b9dfcd5ad..1b6ff4fbe384b5 100644
--- a/packages/editor/src/components/post-actions/actions.js
+++ b/packages/editor/src/components/post-actions/actions.js
@@ -3,12 +3,14 @@
*/
import { useDispatch, useSelect } from '@wordpress/data';
import { useMemo, useEffect } from '@wordpress/element';
+import { store as coreStore } from '@wordpress/core-data';
/**
* Internal dependencies
*/
import { store as editorStore } from '../../store';
import { unlock } from '../../lock-unlock';
+import { useSetAsHomepageAction } from './set-as-homepage';
export function usePostActions( { postType, onActionPerformed, context } ) {
const { defaultActions } = useSelect(
@@ -21,19 +23,46 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
[ postType ]
);
+ const { canManageOptions, hasFrontPageTemplate } = useSelect(
+ ( select ) => {
+ const { getEntityRecords } = select( coreStore );
+ const templates = getEntityRecords( 'postType', 'wp_template', {
+ per_page: -1,
+ } );
+
+ return {
+ canManageOptions: select( coreStore ).canUser( 'update', {
+ kind: 'root',
+ name: 'site',
+ } ),
+ hasFrontPageTemplate: !! templates?.find(
+ ( template ) => template?.slug === 'front-page'
+ ),
+ };
+ }
+ );
+
+ const setAsHomepageAction = useSetAsHomepageAction();
+ const shouldShowSetAsHomepageAction =
+ canManageOptions && ! hasFrontPageTemplate;
+
const { registerPostTypeSchema } = unlock( useDispatch( editorStore ) );
useEffect( () => {
registerPostTypeSchema( postType );
}, [ registerPostTypeSchema, postType ] );
return useMemo( () => {
+ let actions = [
+ ...defaultActions,
+ shouldShowSetAsHomepageAction ? setAsHomepageAction : [],
+ ];
// Filter actions based on provided context. If not provided
// all actions are returned. We'll have a single entry for getting the actions
// and the consumer should provide the context to filter the actions, if needed.
// Actions should also provide the `context` they support, if it's specific, to
// compare with the provided context to get all the actions.
// Right now the only supported context is `list`.
- const actions = defaultActions.filter( ( action ) => {
+ actions = actions.filter( ( action ) => {
if ( ! action.context ) {
return true;
}
@@ -88,5 +117,11 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
}
return actions;
- }, [ defaultActions, onActionPerformed, context ] );
+ }, [
+ context,
+ defaultActions,
+ onActionPerformed,
+ setAsHomepageAction,
+ shouldShowSetAsHomepageAction,
+ ] );
}
diff --git a/packages/editor/src/components/post-actions/index.js b/packages/editor/src/components/post-actions/index.js
index 9f39b1f3305aeb..ab11b5e318b5a6 100644
--- a/packages/editor/src/components/post-actions/index.js
+++ b/packages/editor/src/components/post-actions/index.js
@@ -123,7 +123,7 @@ function ActionWithModal( { action, item, ActionTrigger, onClose } ) {
action.id
) }` }
focusOnMount="firstContentElement"
- size="small"
+ size="medium"
>
{
+ const [ item ] = items;
+ const pageTitle = getItemTitle( item );
+ const { showOnFront, currentHomePage, isSaving } = useSelect(
+ ( select ) => {
+ const { getEntityRecord, isSavingEntityRecord } =
+ select( coreStore );
+ const siteSettings = getEntityRecord( 'root', 'site' );
+ const currentHomePageItem = getEntityRecord(
+ 'postType',
+ 'page',
+ siteSettings?.page_on_front
+ );
+ return {
+ showOnFront: siteSettings?.show_on_front,
+ currentHomePage: currentHomePageItem,
+ isSaving: isSavingEntityRecord( 'root', 'site' ),
+ };
+ }
+ );
+ const currentHomePageTitle = currentHomePage
+ ? getItemTitle( currentHomePage )
+ : '';
+
+ const { saveEditedEntityRecord, saveEntityRecord } =
+ useDispatch( coreStore );
+ const { createSuccessNotice, createErrorNotice } =
+ useDispatch( noticesStore );
+
+ async function onSetPageAsHomepage( event ) {
+ event.preventDefault();
+
+ try {
+ // Save new home page settings.
+ await saveEditedEntityRecord( 'root', 'site', undefined, {
+ page_on_front: item.id,
+ show_on_front: 'page',
+ } );
+
+ // This second call to a save function is a workaround for a bug in
+ // `saveEditedEntityRecord`. This forces the root site settings to be updated.
+ // See https://github.com/WordPress/gutenberg/issues/67161.
+ await saveEntityRecord( 'root', 'site', {
+ page_on_front: item.id,
+ show_on_front: 'page',
+ } );
+
+ createSuccessNotice( __( 'Homepage updated' ), {
+ type: 'snackbar',
+ } );
+ } catch ( error ) {
+ const typedError = error;
+ const errorMessage =
+ typedError.message && typedError.code !== 'unknown_error'
+ ? typedError.message
+ : __( 'An error occurred while setting the homepage' );
+ createErrorNotice( errorMessage, { type: 'snackbar' } );
+ } finally {
+ closeModal?.();
+ }
+ }
+
+ const modalWarning =
+ 'posts' === showOnFront
+ ? __(
+ 'This will replace the current homepage which is set to display latest posts.'
+ )
+ : sprintf(
+ // translators: %s: title of the current home page.
+ __( 'This will replace the current homepage: "%s"' ),
+ currentHomePageTitle
+ );
+
+ const modalText = sprintf(
+ // translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message.
+ __( 'Set "%1$s" as the site homepage? %2$s' ),
+ pageTitle,
+ modalWarning
+ );
+
+ // translators: Button label to confirm setting the specified page as the homepage.
+ const modalButtonLabel = __( 'Set homepage' );
+
+ return (
+
+ );
+};
+
+export const useSetAsHomepageAction = () => {
+ const { pageOnFront, pageForPosts } = useSelect( ( select ) => {
+ const { getEntityRecord } = select( coreStore );
+ const siteSettings = getEntityRecord( 'root', 'site' );
+ return {
+ pageOnFront: siteSettings?.page_on_front,
+ pageForPosts: siteSettings?.page_for_posts,
+ };
+ } );
+
+ return useMemo(
+ () => ( {
+ id: 'set-as-homepage',
+ label: __( 'Set as homepage' ),
+ isEligible( post ) {
+ if ( post.status !== 'publish' ) {
+ return false;
+ }
+
+ if ( post.type !== 'page' ) {
+ return false;
+ }
+
+ // Don't show the action if the page is already set as the homepage.
+ if ( pageOnFront === post.id ) {
+ return false;
+ }
+
+ // Don't show the action if the page is already set as the page for posts.
+ if ( pageForPosts === post.id ) {
+ return false;
+ }
+
+ return true;
+ },
+ RenderModal: SetAsHomepageModal,
+ } ),
+ [ pageForPosts, pageOnFront ]
+ );
+};
diff --git a/packages/editor/src/dataviews/types.ts b/packages/editor/src/dataviews/types.ts
index 664c2dd417201c..4d27fc7dc4139d 100644
--- a/packages/editor/src/dataviews/types.ts
+++ b/packages/editor/src/dataviews/types.ts
@@ -1,5 +1,5 @@
type PostStatus =
- | 'published'
+ | 'publish'
| 'draft'
| 'pending'
| 'private'
diff --git a/packages/fields/src/actions/utils.ts b/packages/fields/src/actions/utils.ts
index 60d3d00e82766a..8f990fb1168fcc 100644
--- a/packages/fields/src/actions/utils.ts
+++ b/packages/fields/src/actions/utils.ts
@@ -30,7 +30,7 @@ export function isTemplateOrTemplatePart(
return p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;
}
-export function getItemTitle( item: Post ) {
+export function getItemTitle( item: Post ): string {
if ( typeof item.title === 'string' ) {
return decodeEntities( item.title );
}
diff --git a/packages/fields/src/fields/title/title-view.tsx b/packages/fields/src/fields/title/title-view.tsx
index c15ed96b89b73b..f6bf5fb1817d93 100644
--- a/packages/fields/src/fields/title/title-view.tsx
+++ b/packages/fields/src/fields/title/title-view.tsx
@@ -17,11 +17,10 @@ import { getItemTitle } from '../../actions/utils';
const TitleView = ( { item }: { item: BasePost } ) => {
const { frontPageId, postsPageId } = useSelect( ( select ) => {
const { getEntityRecord } = select( coreStore );
- const siteSettings: Settings | undefined = getEntityRecord(
+ const siteSettings = getEntityRecord(
'root',
- 'site',
- ''
- );
+ 'site'
+ ) as Partial< Settings >;
return {
frontPageId: siteSettings?.page_on_front,
postsPageId: siteSettings?.page_for_posts,
diff --git a/test/e2e/specs/site-editor/homepage-settings.spec.js b/test/e2e/specs/site-editor/homepage-settings.spec.js
new file mode 100644
index 00000000000000..d53130af23ac8b
--- /dev/null
+++ b/test/e2e/specs/site-editor/homepage-settings.spec.js
@@ -0,0 +1,72 @@
+/**
+ * WordPress dependencies
+ */
+const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
+
+test.describe( 'Homepage Settings via Editor', () => {
+ test.beforeAll( async ( { requestUtils } ) => {
+ await Promise.all( [ requestUtils.activateTheme( 'emptytheme' ) ] );
+ await requestUtils.createPage( {
+ title: 'Homepage',
+ status: 'publish',
+ } );
+ } );
+
+ test.beforeEach( async ( { admin, page } ) => {
+ await admin.visitSiteEditor();
+ await page.getByRole( 'button', { name: 'Pages' } ).click();
+ } );
+
+ test.afterAll( async ( { requestUtils } ) => {
+ await Promise.all( [
+ requestUtils.deleteAllPages(),
+ requestUtils.updateSiteSettings( {
+ show_on_front: 'posts',
+ page_on_front: 0,
+ page_for_posts: 0,
+ } ),
+ ] );
+ } );
+
+ test( 'should show "Set as homepage" action on pages with `publish` status', async ( {
+ page,
+ } ) => {
+ const samplePage = page
+ .getByRole( 'gridcell' )
+ .getByLabel( 'Homepage' );
+ const samplePageRow = page
+ .getByRole( 'row' )
+ .filter( { has: samplePage } );
+ await samplePageRow.hover();
+ await samplePageRow
+ .getByRole( 'button', {
+ name: 'Actions',
+ } )
+ .click();
+ await expect(
+ page.getByRole( 'menuitem', { name: 'Set as homepage' } )
+ ).toBeVisible();
+ } );
+
+ test( 'should not show "Set as homepage" action on current homepage', async ( {
+ page,
+ } ) => {
+ const samplePage = page
+ .getByRole( 'gridcell' )
+ .getByLabel( 'Homepage' );
+ const samplePageRow = page
+ .getByRole( 'row' )
+ .filter( { has: samplePage } );
+ await samplePageRow.click();
+ await samplePageRow
+ .getByRole( 'button', {
+ name: 'Actions',
+ } )
+ .click();
+ await page.getByRole( 'menuitem', { name: 'Set as homepage' } ).click();
+ await page.getByRole( 'button', { name: 'Set homepage' } ).click();
+ await expect(
+ page.getByRole( 'menuitem', { name: 'Set as homepage' } )
+ ).toBeHidden();
+ } );
+} );
From 2efb3a9f7c87dae155b71ad520ac5aa00f7490b4 Mon Sep 17 00:00:00 2001
From: Riad Benguella
Date: Thu, 28 Nov 2024 10:39:35 +0100
Subject: [PATCH 066/384] REST API: Support search_columns argument in the user
endpoint (#67330)
Co-authored-by: youknowriad
Co-authored-by: Mamaduka
Co-authored-by: ntsekouras
Co-authored-by: mreishus
Co-authored-by claudiulodro < claudiulodro@git.wordpress.org>
---
backport-changelog/6.8/7909.md | 3 +
.../class-gutenberg-rest-user-controller.php | 62 +++++++++++++++++++
lib/load.php | 1 +
.../src/components/post-author/constants.js | 2 +-
.../editor/src/components/post-author/hook.js | 1 +
5 files changed, 68 insertions(+), 1 deletion(-)
create mode 100644 backport-changelog/6.8/7909.md
create mode 100644 lib/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php
diff --git a/backport-changelog/6.8/7909.md b/backport-changelog/6.8/7909.md
new file mode 100644
index 00000000000000..32a441ef296a2d
--- /dev/null
+++ b/backport-changelog/6.8/7909.md
@@ -0,0 +1,3 @@
+https://github.com/WordPress/wordpress-develop/pull/7909
+
+* https://github.com/WordPress/gutenberg/pull/67330
diff --git a/lib/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php b/lib/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php
new file mode 100644
index 00000000000000..c1ecb8c86660cd
--- /dev/null
+++ b/lib/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php
@@ -0,0 +1,62 @@
+ array(),
+ 'description' => __( 'Array of column names to be searched.' ),
+ 'type' => 'array',
+ 'items' => array(
+ 'enum' => array( 'email', 'name', 'id', 'username', 'slug' ),
+ 'type' => 'string',
+ ),
+ );
+
+ return $query_params;
+}
+
+add_filter( 'rest_user_collection_params', 'gutenberg_add_search_columns_param', 10, 1 );
+
+/**
+ * Modify user query based on search_columns parameter
+ *
+ * @param array $prepared_args Array of arguments for WP_User_Query.
+ * @param WP_REST_Request $request The REST API request.
+ * @return array Modified arguments
+ */
+function gutenberg_modify_user_query_args( $prepared_args, $request ) {
+ if ( $request->get_param( 'search' ) && $request->get_param( 'search_columns' ) ) {
+ $search_columns = $request->get_param( 'search_columns' );
+
+ // Validate search columns
+ $valid_columns = isset( $prepared_args['search_columns'] )
+ ? $prepared_args['search_columns']
+ : array( 'ID', 'user_login', 'user_nicename', 'user_email', 'user_url', 'display_name' );
+ $search_columns_mapping = array(
+ 'id' => 'ID',
+ 'username' => 'user_login',
+ 'slug' => 'user_nicename',
+ 'email' => 'user_email',
+ 'name' => 'display_name',
+ );
+ $search_columns = array_map(
+ static function ( $column ) use ( $search_columns_mapping ) {
+ return $search_columns_mapping[ $column ];
+ },
+ $search_columns
+ );
+ $search_columns = array_intersect( $search_columns, $valid_columns );
+
+ if ( ! empty( $search_columns ) ) {
+ $prepared_args['search_columns'] = $search_columns;
+ }
+ }
+
+ return $prepared_args;
+}
+add_filter( 'rest_user_query', 'gutenberg_modify_user_query_args', 10, 2 );
diff --git a/lib/load.php b/lib/load.php
index 97c5404a3a3ead..26af78f3173c53 100644
--- a/lib/load.php
+++ b/lib/load.php
@@ -99,6 +99,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.8/functions.php';
require __DIR__ . '/compat/wordpress-6.8/post.php';
require __DIR__ . '/compat/wordpress-6.8/site-editor.php';
+require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php';
// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
diff --git a/packages/editor/src/components/post-author/constants.js b/packages/editor/src/components/post-author/constants.js
index 46bc2d46d1b086..517cbd9ea1dc8d 100644
--- a/packages/editor/src/components/post-author/constants.js
+++ b/packages/editor/src/components/post-author/constants.js
@@ -5,6 +5,6 @@ export const BASE_QUERY = {
export const AUTHORS_QUERY = {
who: 'authors',
- per_page: 50,
+ per_page: 100,
...BASE_QUERY,
};
diff --git a/packages/editor/src/components/post-author/hook.js b/packages/editor/src/components/post-author/hook.js
index 62830cf6ea60e6..f251eba79e1806 100644
--- a/packages/editor/src/components/post-author/hook.js
+++ b/packages/editor/src/components/post-author/hook.js
@@ -23,6 +23,7 @@ export function useAuthorsQuery( search ) {
if ( search ) {
query.search = search;
+ query.search_columns = [ 'name' ];
}
return {
From a48a414853b7f66606393dd311556e6bdda1aa62 Mon Sep 17 00:00:00 2001
From: Yogesh Bhutkar
Date: Thu, 28 Nov 2024 15:43:06 +0530
Subject: [PATCH 067/384] CommentsPagination: Set font-size to inherit for
pagination items (#67296)
* CommentsPagination: Set font-size to inherit for pagination items
* Remove extra spaces
---------
Co-authored-by: yogeshbhutkar
Co-authored-by: cbravobernal
---
packages/block-library/src/comments-pagination/editor.scss | 1 +
packages/block-library/src/comments-pagination/style.scss | 1 +
2 files changed, 2 insertions(+)
diff --git a/packages/block-library/src/comments-pagination/editor.scss b/packages/block-library/src/comments-pagination/editor.scss
index a875c9e0ee21ce..3cd99c632ee833 100644
--- a/packages/block-library/src/comments-pagination/editor.scss
+++ b/packages/block-library/src/comments-pagination/editor.scss
@@ -26,6 +26,7 @@ $pagination-margin: 0.5em;
margin-right: $pagination-margin;
margin-bottom: $pagination-margin;
+ font-size: inherit;
&:last-child {
/*rtl:ignore*/
margin-right: 0;
diff --git a/packages/block-library/src/comments-pagination/style.scss b/packages/block-library/src/comments-pagination/style.scss
index c6b5d9a0a29e91..2fb6e3dd2d48f4 100644
--- a/packages/block-library/src/comments-pagination/style.scss
+++ b/packages/block-library/src/comments-pagination/style.scss
@@ -8,6 +8,7 @@ $pagination-margin: 0.5em;
margin-right: $pagination-margin;
margin-bottom: $pagination-margin;
+ font-size: inherit;
&:last-child {
/*rtl:ignore*/
margin-right: 0;
From f414562bee98285ed512ac4f9dfd6ca0609fa6a6 Mon Sep 17 00:00:00 2001
From: Mario Santos <34552881+SantosGuillamot@users.noreply.github.com>
Date: Thu, 28 Nov 2024 11:54:14 +0100
Subject: [PATCH 068/384] Block Bindings: Remove client core sources
registration in widgets (#67349)
* Remove client core sources registration in widgets
* Remove dependencies
Co-authored-by: SantosGuillamot
Co-authored-by: ramonjd
Co-authored-by: talldan
Co-authored-by: gziolo
Co-authored-by: youknowriad
---
package-lock.json | 2 --
packages/customize-widgets/package.json | 1 -
packages/customize-widgets/src/index.js | 5 -----
packages/edit-widgets/package.json | 1 -
packages/edit-widgets/src/index.js | 5 -----
5 files changed, 14 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index dc0c18f3b6ac5e..80a64c6f7a04ba 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -53963,7 +53963,6 @@
"@wordpress/core-data": "*",
"@wordpress/data": "*",
"@wordpress/dom": "*",
- "@wordpress/editor": "*",
"@wordpress/element": "*",
"@wordpress/hooks": "*",
"@wordpress/i18n": "*",
@@ -54392,7 +54391,6 @@
"@wordpress/data": "*",
"@wordpress/deprecated": "*",
"@wordpress/dom": "*",
- "@wordpress/editor": "*",
"@wordpress/element": "*",
"@wordpress/hooks": "*",
"@wordpress/i18n": "*",
diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json
index 4a14ac743b7249..10c3b2dfb510d9 100644
--- a/packages/customize-widgets/package.json
+++ b/packages/customize-widgets/package.json
@@ -34,7 +34,6 @@
"@wordpress/core-data": "*",
"@wordpress/data": "*",
"@wordpress/dom": "*",
- "@wordpress/editor": "*",
"@wordpress/element": "*",
"@wordpress/hooks": "*",
"@wordpress/i18n": "*",
diff --git a/packages/customize-widgets/src/index.js b/packages/customize-widgets/src/index.js
index df96d645ee7007..5de010fa8bd37e 100644
--- a/packages/customize-widgets/src/index.js
+++ b/packages/customize-widgets/src/index.js
@@ -17,7 +17,6 @@ import {
store as blocksStore,
} from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
-import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { store as preferencesStore } from '@wordpress/preferences';
/**
@@ -27,7 +26,6 @@ import CustomizeWidgets from './components/customize-widgets';
import getSidebarSection from './controls/sidebar-section';
import getSidebarControl from './controls/sidebar-control';
import './filters';
-import { unlock } from './lock-unlock';
const { wp } = window;
@@ -39,8 +37,6 @@ const DISABLED_BLOCKS = [
];
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
-const { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );
-
/**
* Initializes the widgets block editor in the customizer.
*
@@ -64,7 +60,6 @@ export function initialize( editorName, blockEditorSettings ) {
);
} );
registerCoreBlocks( coreBlocks );
- registerCoreBlockBindingsSources();
registerLegacyWidgetBlock();
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json
index ed375f7430a1a4..0528348291481a 100644
--- a/packages/edit-widgets/package.json
+++ b/packages/edit-widgets/package.json
@@ -39,7 +39,6 @@
"@wordpress/data": "*",
"@wordpress/deprecated": "*",
"@wordpress/dom": "*",
- "@wordpress/editor": "*",
"@wordpress/element": "*",
"@wordpress/hooks": "*",
"@wordpress/i18n": "*",
diff --git a/packages/edit-widgets/src/index.js b/packages/edit-widgets/src/index.js
index 8788ee2b99ea1d..2f0ced0c09bd75 100644
--- a/packages/edit-widgets/src/index.js
+++ b/packages/edit-widgets/src/index.js
@@ -9,7 +9,6 @@ import {
} from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
-import { privateApis as editorPrivateApis } from '@wordpress/editor';
import { StrictMode, createRoot } from '@wordpress/element';
import {
registerCoreBlocks,
@@ -30,7 +29,6 @@ import { store as preferencesStore } from '@wordpress/preferences';
import './store';
import './filters';
import * as widgetArea from './blocks/widget-area';
-import { unlock } from './lock-unlock';
import Layout from './components/layout';
import {
ALLOW_REUSABLE_BLOCKS,
@@ -44,8 +42,6 @@ const disabledBlocks = [
...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),
];
-const { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );
-
/**
* Initializes the block editor in the widgets screen.
*
@@ -75,7 +71,6 @@ export function initializeEditor( id, settings ) {
dispatch( blocksStore ).reapplyBlockTypeFilters();
registerCoreBlocks( coreBlocks );
- registerCoreBlockBindingsSources();
registerLegacyWidgetBlock();
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
From c845cdad4b98b531d8e9924b36aeea2b01709b4f Mon Sep 17 00:00:00 2001
From: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
Date: Thu, 28 Nov 2024 14:17:30 +0200
Subject: [PATCH 069/384] Router: Fix addition and removal of empty classnames
(#67378)
* Router: Fix addition and removal of empty classnames
* Actually prevent transition
Co-authored-by: tyxla
Co-authored-by: youknowriad
Co-authored-by: jsnajdr
---
packages/router/src/router.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/router/src/router.tsx b/packages/router/src/router.tsx
index ea0b218fa6a401..34cc542c7b5737 100644
--- a/packages/router/src/router.tsx
+++ b/packages/router/src/router.tsx
@@ -125,6 +125,7 @@ export function useHistory() {
! options.transition
) {
performPush();
+ return;
}
await new Promise< void >( ( resolve ) => {
From 45d9528de2da7edb3a162d5df82fb646c067e052 Mon Sep 17 00:00:00 2001
From: Nik Tsekouras
Date: Thu, 28 Nov 2024 15:16:57 +0200
Subject: [PATCH 070/384] DataViews: Update `usePostFields` to accept postType
(#67380)
Co-authored-by: ntsekouras
Co-authored-by: youknowriad
Co-authored-by: oandregal
---
.../src/components/post-edit/index.js | 2 +-
.../src/components/post-list/index.js | 4 +++-
.../src/components/post-fields/index.ts | 8 ++++---
.../src/dataviews/store/private-actions.ts | 21 +++++++++----------
packages/editor/src/dataviews/types.ts | 3 +++
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/packages/edit-site/src/components/post-edit/index.js b/packages/edit-site/src/components/post-edit/index.js
index a7842f0feb3c2f..3e75ef71d1ac9b 100644
--- a/packages/edit-site/src/components/post-edit/index.js
+++ b/packages/edit-site/src/components/post-edit/index.js
@@ -49,7 +49,7 @@ function PostEditForm( { postType, postId } ) {
);
const [ multiEdits, setMultiEdits ] = useState( {} );
const { editEntityRecord } = useDispatch( coreDataStore );
- const { fields: _fields } = usePostFields();
+ const { fields: _fields } = usePostFields( { postType } );
const fields = useMemo(
() =>
_fields?.map( ( field ) => {
diff --git a/packages/edit-site/src/components/post-list/index.js b/packages/edit-site/src/components/post-list/index.js
index d58ddbe50758c7..200aa60ee17977 100644
--- a/packages/edit-site/src/components/post-list/index.js
+++ b/packages/edit-site/src/components/post-list/index.js
@@ -215,7 +215,9 @@ export default function PostList( { postType } ) {
return found?.filters ?? [];
};
- const { isLoading: isLoadingFields, fields: _fields } = usePostFields();
+ const { isLoading: isLoadingFields, fields: _fields } = usePostFields( {
+ postType,
+ } );
const fields = useMemo( () => {
const activeViewFilters = getActiveViewFilters(
defaultViews,
diff --git a/packages/editor/src/components/post-fields/index.ts b/packages/editor/src/components/post-fields/index.ts
index 41b61fe103a70f..d701bdef2284e6 100644
--- a/packages/editor/src/components/post-fields/index.ts
+++ b/packages/editor/src/components/post-fields/index.ts
@@ -23,9 +23,11 @@ interface Author {
name: string;
}
-function usePostFields(): UsePostFieldsReturn {
- const postType = 'page'; // TODO: this could be page or post (experimental).
-
+function usePostFields( {
+ postType,
+}: {
+ postType: string;
+} ): UsePostFieldsReturn {
const { registerPostTypeSchema } = unlock( useDispatch( editorStore ) );
useEffect( () => {
registerPostTypeSchema( postType );
diff --git a/packages/editor/src/dataviews/store/private-actions.ts b/packages/editor/src/dataviews/store/private-actions.ts
index 77ac131a8e2302..9e8d184e34d3a4 100644
--- a/packages/editor/src/dataviews/store/private-actions.ts
+++ b/packages/editor/src/dataviews/store/private-actions.ts
@@ -128,7 +128,7 @@ export const registerPostTypeSchema =
const actions = [
postTypeConfig.viewable ? viewPost : undefined,
- !! postTypeConfig?.supports?.revisions
+ !! postTypeConfig.supports?.revisions
? viewPostRevisions
: undefined,
// @ts-ignore
@@ -148,7 +148,7 @@ export const registerPostTypeSchema =
? duplicatePattern
: undefined,
postTypeConfig.supports?.title ? renamePost : undefined,
- postTypeConfig?.supports?.[ 'page-attributes' ]
+ postTypeConfig.supports?.[ 'page-attributes' ]
? reorderPage
: undefined,
postTypeConfig.slug === 'wp_block' ? exportPattern : undefined,
@@ -157,25 +157,24 @@ export const registerPostTypeSchema =
deletePost,
trashPost,
permanentlyDeletePost,
- ];
+ ].filter( Boolean );
const fields = [
- featuredImageField,
+ postTypeConfig.supports?.thumbnail &&
+ currentTheme?.[ 'theme-supports' ]?.[ 'post-thumbnails' ] &&
+ featuredImageField,
titleField,
- authorField,
+ postTypeConfig.supports?.author && authorField,
statusField,
dateField,
slugField,
- parentField,
- commentStatusField,
+ postTypeConfig.supports?.[ 'page-attributes' ] && parentField,
+ postTypeConfig.supports?.comments && commentStatusField,
passwordField,
- ];
+ ].filter( Boolean );
registry.batch( () => {
actions.forEach( ( action ) => {
- if ( ! action ) {
- return;
- }
unlock( registry.dispatch( editorStore ) ).registerEntityAction(
'postType',
postType,
diff --git a/packages/editor/src/dataviews/types.ts b/packages/editor/src/dataviews/types.ts
index 4d27fc7dc4139d..9549e6c4aa374d 100644
--- a/packages/editor/src/dataviews/types.ts
+++ b/packages/editor/src/dataviews/types.ts
@@ -78,6 +78,9 @@ export interface PostType {
'page-attributes'?: boolean;
title?: boolean;
revisions?: boolean;
+ thumbnail?: boolean;
+ comments?: boolean;
+ author?: boolean;
};
}
From daaa785b27c4124c7d39a7ee12bc2b4ce0359aa4 Mon Sep 17 00:00:00 2001
From: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
Date: Thu, 28 Nov 2024 16:05:14 +0200
Subject: [PATCH 071/384] Edit Site: Fix sidebar template author navigation
(#67382)
Co-authored-by: tyxla
Co-authored-by: youknowriad
---
.../sidebar-navigation-screen-templates-browse/content.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js
index 5d3819eac0ee3c..aad38959c73dcd 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js
@@ -6,6 +6,7 @@ import { useMemo } from '@wordpress/element';
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { privateApis as routerPrivateApis } from '@wordpress/router';
+import { addQueryArgs } from '@wordpress/url';
/**
* Internal dependencies
@@ -25,7 +26,7 @@ function TemplateDataviewItem( { template, isActive } ) {
return (
From 007daf07967134b15a09eb7b9f0e59f7ffa0584e Mon Sep 17 00:00:00 2001
From: Mario Santos <34552881+SantosGuillamot@users.noreply.github.com>
Date: Thu, 28 Nov 2024 15:29:40 +0100
Subject: [PATCH 072/384] Only pass `aria-label` when it is not empty (#67381)
Co-authored-by: SantosGuillamot
Co-authored-by: afercia
---
packages/block-library/src/navigation/index.php | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php
index 68b23aceeced65..9a56e399fcfecb 100644
--- a/packages/block-library/src/navigation/index.php
+++ b/packages/block-library/src/navigation/index.php
@@ -567,13 +567,14 @@ private static function get_nav_wrapper_attributes( $attributes, $inner_blocks )
$is_responsive_menu = static::is_responsive( $attributes );
$style = static::get_styles( $attributes );
$class = static::get_classes( $attributes );
- $wrapper_attributes = get_block_wrapper_attributes(
- array(
- 'class' => $class,
- 'style' => $style,
- 'aria-label' => $nav_menu_name,
- )
+ $extra_attributes = array(
+ 'class' => $class,
+ 'style' => $style,
);
+ if ( ! empty( $nav_menu_name ) ) {
+ $extra_attributes['aria-label'] = $nav_menu_name;
+ }
+ $wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );
if ( $is_responsive_menu ) {
$nav_element_directives = static::get_nav_element_directives( $is_interactive );
From 81327d1e18a724758eedbb461bde29dfd8b41b7f Mon Sep 17 00:00:00 2001
From: Marco Ciampini
Date: Thu, 28 Nov 2024 15:54:46 +0100
Subject: [PATCH 073/384] Update @ariakit/react to 0.4.13 (#65907)
* Remove all ariakit dependencies
* Re-add ariakit dependencies targeting latest version
* Remove focus-visible DropdownMenuV2 workaround
* Remove composite tabbable workaround
* CHANGELOG
* Remove Tabs workaround
---
Co-authored-by: ciampo
Co-authored-by: oandregal
Co-authored-by: tyxla
Co-authored-by: diegohaz
Co-authored-by: jsnajdr
Co-authored-by: t-hamano
---
package-lock.json | 82 ++++++++++++-------
package.json | 2 +-
packages/components/CHANGELOG.md | 6 +-
packages/components/package.json | 2 +-
packages/components/src/composite/item.tsx | 20 +----
.../components/src/menu/checkbox-item.tsx | 6 +-
packages/components/src/menu/item.tsx | 6 +-
packages/components/src/menu/radio-item.tsx | 6 +-
.../menu/use-temporary-focus-visible-fix.ts | 22 -----
packages/components/src/tabs/tab.tsx | 18 ----
packages/dataviews/package.json | 2 +-
11 files changed, 63 insertions(+), 109 deletions(-)
delete mode 100644 packages/components/src/menu/use-temporary-focus-visible-fix.ts
diff --git a/package-lock.json b/package-lock.json
index 80a64c6f7a04ba..58479ecfa2ed99 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,7 +16,7 @@
"@actions/core": "1.9.1",
"@actions/github": "5.0.0",
"@apidevtools/json-schema-ref-parser": "11.6.4",
- "@ariakit/test": "^0.4.2",
+ "@ariakit/test": "^0.4.5",
"@babel/core": "7.25.7",
"@babel/plugin-syntax-jsx": "7.25.7",
"@babel/runtime-corejs3": "7.25.7",
@@ -1432,18 +1432,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/@ariakit/core": {
- "version": "0.4.9",
- "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.4.9.tgz",
- "integrity": "sha512-nV0B/OTK/0iB+P9RC7fudznYZ8eR6rR1F912Zc54e3+wSW5RrRvNOiRxyMrgENidd4R7cCMDw77XJLSBLKgEPQ=="
- },
"node_modules/@ariakit/test": {
- "version": "0.4.2",
- "resolved": "https://registry.npmjs.org/@ariakit/test/-/test-0.4.2.tgz",
- "integrity": "sha512-WXAAiAyTaHV9klntOB81Y+YHyA5iGxy9wXCmjQOfYK5InsuIour+7TVXICUxn2NF0XD6j6OoEJbCVDJ2Y46xEA==",
+ "version": "0.4.5",
+ "resolved": "https://registry.npmjs.org/@ariakit/test/-/test-0.4.5.tgz",
+ "integrity": "sha512-dK9OtI8MeKfdtOiW1auDITnyaelq0O0aUTnolIqJj+RJd8LFai0gi7fQUgrun9CZHJ2wWsEad4vlviGfhfIIhQ==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "@ariakit/core": "0.4.9",
+ "@ariakit/core": "0.4.12",
"@testing-library/dom": "^8.0.0 || ^9.0.0 || ^10.0.0"
},
"peerDependencies": {
@@ -1463,6 +1459,13 @@
}
}
},
+ "node_modules/@ariakit/test/node_modules/@ariakit/core": {
+ "version": "0.4.12",
+ "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.4.12.tgz",
+ "integrity": "sha512-+NNpy88tdP/w9mOBPuDrMTbtapPbo/8yVIzpQB7TAmN0sPh/Cq3nU1f2KCTCIujPmwRvAcMSW9UHOlFmbKEPOA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@aw-web-design/x-default-browser": {
"version": "1.4.126",
"resolved": "https://registry.npmjs.org/@aw-web-design/x-default-browser/-/x-default-browser-1.4.126.tgz",
@@ -49340,9 +49343,10 @@
}
},
"node_modules/use-sync-external-store": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
- "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz",
+ "integrity": "sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==",
+ "license": "MIT",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
@@ -53677,7 +53681,7 @@
"version": "28.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
- "@ariakit/react": "^0.4.10",
+ "@ariakit/react": "^0.4.13",
"@babel/runtime": "7.25.7",
"@emotion/cache": "^11.7.1",
"@emotion/css": "^11.7.1",
@@ -53732,12 +53736,19 @@
"react-dom": "^18.0.0"
}
},
+ "packages/components/node_modules/@ariakit/core": {
+ "version": "0.4.12",
+ "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.4.12.tgz",
+ "integrity": "sha512-+NNpy88tdP/w9mOBPuDrMTbtapPbo/8yVIzpQB7TAmN0sPh/Cq3nU1f2KCTCIujPmwRvAcMSW9UHOlFmbKEPOA==",
+ "license": "MIT"
+ },
"packages/components/node_modules/@ariakit/react": {
- "version": "0.4.10",
- "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.4.10.tgz",
- "integrity": "sha512-c1+6sNLj57aAXrBZMCVGG+OXeFrPAG0TV1jT7oPJcN/KLRs3aCuO3CCJVep/eKepFzzK01kNRGYX3wPT1TXPNw==",
+ "version": "0.4.13",
+ "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.4.13.tgz",
+ "integrity": "sha512-pTGYgoqCojfyt2xNJ5VQhejxXwwtcP7VDDqcnnVChv7TA2TWWyYerJ5m4oxViI1pgeNqnHZwKlQ79ZipF7W2kQ==",
+ "license": "MIT",
"dependencies": {
- "@ariakit/react-core": "0.4.10"
+ "@ariakit/react-core": "0.4.13"
},
"funding": {
"type": "opencollective",
@@ -53749,11 +53760,12 @@
}
},
"packages/components/node_modules/@ariakit/react-core": {
- "version": "0.4.10",
- "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.4.10.tgz",
- "integrity": "sha512-r6DZmtHBmSoOj848+RpBwdZy/55YxPhMhfH14JIO2OLn1F6iSFkQwR7AAGpIrlYycWJFSF7KrQu50O+SSfFJdQ==",
+ "version": "0.4.13",
+ "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.4.13.tgz",
+ "integrity": "sha512-iIjQeupP9d0pOubOzX4a0UPXbhXbp0ZCduDpkv7+u/pYP/utk/YRECD0M/QpZr6YSeltmDiNxKjdyK8r9Yhv4Q==",
+ "license": "MIT",
"dependencies": {
- "@ariakit/core": "0.4.9",
+ "@ariakit/core": "0.4.12",
"@floating-ui/dom": "^1.0.0",
"use-sync-external-store": "^1.2.0"
},
@@ -54039,7 +54051,7 @@
"version": "4.9.0",
"license": "GPL-2.0-or-later",
"dependencies": {
- "@ariakit/react": "^0.4.10",
+ "@ariakit/react": "^0.4.13",
"@babel/runtime": "7.25.7",
"@wordpress/components": "*",
"@wordpress/compose": "*",
@@ -54061,12 +54073,19 @@
"react": "^18.0.0"
}
},
+ "packages/dataviews/node_modules/@ariakit/core": {
+ "version": "0.4.12",
+ "resolved": "https://registry.npmjs.org/@ariakit/core/-/core-0.4.12.tgz",
+ "integrity": "sha512-+NNpy88tdP/w9mOBPuDrMTbtapPbo/8yVIzpQB7TAmN0sPh/Cq3nU1f2KCTCIujPmwRvAcMSW9UHOlFmbKEPOA==",
+ "license": "MIT"
+ },
"packages/dataviews/node_modules/@ariakit/react": {
- "version": "0.4.10",
- "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.4.10.tgz",
- "integrity": "sha512-c1+6sNLj57aAXrBZMCVGG+OXeFrPAG0TV1jT7oPJcN/KLRs3aCuO3CCJVep/eKepFzzK01kNRGYX3wPT1TXPNw==",
+ "version": "0.4.13",
+ "resolved": "https://registry.npmjs.org/@ariakit/react/-/react-0.4.13.tgz",
+ "integrity": "sha512-pTGYgoqCojfyt2xNJ5VQhejxXwwtcP7VDDqcnnVChv7TA2TWWyYerJ5m4oxViI1pgeNqnHZwKlQ79ZipF7W2kQ==",
+ "license": "MIT",
"dependencies": {
- "@ariakit/react-core": "0.4.10"
+ "@ariakit/react-core": "0.4.13"
},
"funding": {
"type": "opencollective",
@@ -54078,11 +54097,12 @@
}
},
"packages/dataviews/node_modules/@ariakit/react-core": {
- "version": "0.4.10",
- "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.4.10.tgz",
- "integrity": "sha512-r6DZmtHBmSoOj848+RpBwdZy/55YxPhMhfH14JIO2OLn1F6iSFkQwR7AAGpIrlYycWJFSF7KrQu50O+SSfFJdQ==",
+ "version": "0.4.13",
+ "resolved": "https://registry.npmjs.org/@ariakit/react-core/-/react-core-0.4.13.tgz",
+ "integrity": "sha512-iIjQeupP9d0pOubOzX4a0UPXbhXbp0ZCduDpkv7+u/pYP/utk/YRECD0M/QpZr6YSeltmDiNxKjdyK8r9Yhv4Q==",
+ "license": "MIT",
"dependencies": {
- "@ariakit/core": "0.4.9",
+ "@ariakit/core": "0.4.12",
"@floating-ui/dom": "^1.0.0",
"use-sync-external-store": "^1.2.0"
},
diff --git a/package.json b/package.json
index 3ddcb981f6f6f7..84425dbd1cff21 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"@actions/core": "1.9.1",
"@actions/github": "5.0.0",
"@apidevtools/json-schema-ref-parser": "11.6.4",
- "@ariakit/test": "^0.4.2",
+ "@ariakit/test": "^0.4.5",
"@babel/core": "7.25.7",
"@babel/plugin-syntax-jsx": "7.25.7",
"@babel/runtime-corejs3": "7.25.7",
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index be930515f16659..937027ecdd1ea3 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Internal
+
+- Upgraded `@ariakit/react` (v0.4.13) and `@ariakit/test` (v0.4.5) ([#65907](https://github.com/WordPress/gutenberg/pull/65907)).
+
## 28.13.0 (2024-11-27)
### Deprecations
@@ -11,7 +15,7 @@
- `FontSizePicker`: Deprecate 36px default size ([#66920](https://github.com/WordPress/gutenberg/pull/66920)).
- `ComboboxControl`: Deprecate 36px default size ([#66900](https://github.com/WordPress/gutenberg/pull/66900)).
- `ToggleGroupControl`: Deprecate 36px default size ([#66747](https://github.com/WordPress/gutenberg/pull/66747)).
-- `RangeControl`: Deprecate 36px default size ([#66721](https://github.com/WordPress/gutenberg/pull/66721)).
+- `RangeControl`: Deprecate 36px default size ([#66721](https://github.com/WordPress/gutenberg/pull/66721)).
### Bug Fixes
diff --git a/packages/components/package.json b/packages/components/package.json
index dc62f992c3bb29..75f0d1eb1f2331 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -32,7 +32,7 @@
"src/**/*.scss"
],
"dependencies": {
- "@ariakit/react": "^0.4.10",
+ "@ariakit/react": "^0.4.13",
"@babel/runtime": "7.25.7",
"@emotion/cache": "^11.7.1",
"@emotion/css": "^11.7.1",
diff --git a/packages/components/src/composite/item.tsx b/packages/components/src/composite/item.tsx
index edbf0b92e039af..4a02f76039a5cf 100644
--- a/packages/components/src/composite/item.tsx
+++ b/packages/components/src/composite/item.tsx
@@ -26,23 +26,5 @@ export const CompositeItem = forwardRef<
// obfuscated to discourage its use outside of the component's internals.
const store = ( props.store ?? context.store ) as Ariakit.CompositeStore;
- // If the active item is not connected, Composite may end up in a state
- // where none of the items are tabbable. In this case, we force all items to
- // be tabbable, so that as soon as an item received focus, it becomes active
- // and Composite goes back to working as expected.
- const tabbable = Ariakit.useStoreState( store, ( state ) => {
- return (
- state?.activeId !== null &&
- ! store?.item( state?.activeId )?.element?.isConnected
- );
- } );
-
- return (
-
- );
+ return ;
} );
diff --git a/packages/components/src/menu/checkbox-item.tsx b/packages/components/src/menu/checkbox-item.tsx
index b9a9b8105e517e..182c27dfdee305 100644
--- a/packages/components/src/menu/checkbox-item.tsx
+++ b/packages/components/src/menu/checkbox-item.tsx
@@ -16,24 +16,20 @@ import type { WordPressComponentProps } from '../context';
import { MenuContext } from './context';
import type { MenuCheckboxItemProps } from './types';
import * as Styled from './styles';
-import { useTemporaryFocusVisibleFix } from './use-temporary-focus-visible-fix';
export const MenuCheckboxItem = forwardRef<
HTMLDivElement,
WordPressComponentProps< MenuCheckboxItemProps, 'div', false >
>( function MenuCheckboxItem(
- { suffix, children, onBlur, hideOnClick = false, ...props },
+ { suffix, children, hideOnClick = false, ...props },
ref
) {
- // TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
- const focusVisibleFixProps = useTemporaryFocusVisibleFix( { onBlur } );
const menuContext = useContext( MenuContext );
return (
>( function MenuItem(
- { prefix, suffix, children, onBlur, hideOnClick = true, ...props },
+ { prefix, suffix, children, hideOnClick = true, ...props },
ref
) {
- // TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
- const focusVisibleFixProps = useTemporaryFocusVisibleFix( { onBlur } );
const menuContext = useContext( MenuContext );
return (
@@ -29,18 +28,15 @@ export const MenuRadioItem = forwardRef<
HTMLDivElement,
WordPressComponentProps< MenuRadioItemProps, 'div', false >
>( function MenuRadioItem(
- { suffix, children, onBlur, hideOnClick = false, ...props },
+ { suffix, children, hideOnClick = false, ...props },
ref
) {
- // TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
- const focusVisibleFixProps = useTemporaryFocusVisibleFix( { onBlur } );
const menuContext = useContext( MenuContext );
return (
;
-} ) {
- const [ focusVisible, setFocusVisible ] = useState( false );
- return {
- 'data-focus-visible': focusVisible || undefined,
- onFocusVisible: () => {
- flushSync( () => setFocusVisible( true ) );
- },
- onBlur: ( ( event ) => {
- onBlurProp?.( event );
- setFocusVisible( false );
- } ) as React.FocusEventHandler< HTMLDivElement >,
- };
-}
diff --git a/packages/components/src/tabs/tab.tsx b/packages/components/src/tabs/tab.tsx
index 70f56e52ad2627..8226d0589f08c8 100644
--- a/packages/components/src/tabs/tab.tsx
+++ b/packages/components/src/tabs/tab.tsx
@@ -1,8 +1,3 @@
-/**
- * External dependencies
- */
-import * as Ariakit from '@ariakit/react';
-
/**
* WordPress dependencies
*/
@@ -29,18 +24,6 @@ export const Tab = forwardRef<
>( function Tab( { children, tabId, disabled, render, ...otherProps }, ref ) {
const { store, instanceId } = useTabsContext() ?? {};
- // If the active item is not connected, the tablist may end up in a state
- // where none of the tabs are tabbable. In this case, we force all tabs to
- // be tabbable, so that as soon as an item received focus, it becomes active
- // and Tablist goes back to working as expected.
- // eslint-disable-next-line @wordpress/no-unused-vars-before-return
- const tabbable = Ariakit.useStoreState( store, ( state ) => {
- return (
- state?.activeId !== null &&
- ! store?.item( state?.activeId )?.element?.isConnected
- );
- } );
-
if ( ! store ) {
warning( '`Tabs.Tab` must be wrapped in a `Tabs` component.' );
return null;
@@ -55,7 +38,6 @@ export const Tab = forwardRef<
id={ instancedTabId }
disabled={ disabled }
render={ render }
- tabbable={ tabbable }
{ ...otherProps }
>
{ children }
diff --git a/packages/dataviews/package.json b/packages/dataviews/package.json
index f4d42102731eb2..8fe2e04236725c 100644
--- a/packages/dataviews/package.json
+++ b/packages/dataviews/package.json
@@ -43,7 +43,7 @@
"types": "build-types",
"sideEffects": false,
"dependencies": {
- "@ariakit/react": "^0.4.10",
+ "@ariakit/react": "^0.4.13",
"@babel/runtime": "7.25.7",
"@wordpress/components": "*",
"@wordpress/compose": "*",
From a387fbbdf9fa468217944aa5b78fb6113c2ed63b Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Thu, 28 Nov 2024 19:17:37 +0400
Subject: [PATCH 074/384] Block Editor: Fix JS error in the 'useTabNav' hook
(#67102)
* Block Editor: Fix JS error in the 'useTabNav' hook
* Focus on canvas when there's no section root
Co-authored-by: Mamaduka
Co-authored-by: jeryj
Co-authored-by: getdave
---
.../src/components/writing-flow/use-tab-nav.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/packages/block-editor/src/components/writing-flow/use-tab-nav.js b/packages/block-editor/src/components/writing-flow/use-tab-nav.js
index 16a18358fb2ede..46c40d56fe96d9 100644
--- a/packages/block-editor/src/components/writing-flow/use-tab-nav.js
+++ b/packages/block-editor/src/components/writing-flow/use-tab-nav.js
@@ -35,6 +35,11 @@ export default function useTabNav() {
const noCaptureRef = useRef();
function onFocusCapture( event ) {
+ const canvasElement =
+ container.current.ownerDocument === event.target.ownerDocument
+ ? container.current
+ : container.current.ownerDocument.defaultView.frameElement;
+
// Do not capture incoming focus if set by us in WritingFlow.
if ( noCaptureRef.current ) {
noCaptureRef.current = null;
@@ -64,17 +69,15 @@ export default function useTabNav() {
.focus();
}
// If we don't have any section blocks, focus the section root.
- else {
+ else if ( sectionRootClientId ) {
container.current
.querySelector( `[data-block="${ sectionRootClientId }"]` )
.focus();
+ } else {
+ // If we don't have any section root, focus the canvas.
+ canvasElement.focus();
}
} else {
- const canvasElement =
- container.current.ownerDocument === event.target.ownerDocument
- ? container.current
- : container.current.ownerDocument.defaultView.frameElement;
-
const isBefore =
// eslint-disable-next-line no-bitwise
event.target.compareDocumentPosition( canvasElement ) &
From 5efeef9ae740d2aa51fa2493782773083b5363ee Mon Sep 17 00:00:00 2001
From: Manzoor Wani
Date: Thu, 28 Nov 2024 07:45:13 -0800
Subject: [PATCH 075/384] Convert lock unlock to generics (#66682)
* Convert lock unlock to generics
* Set object type from generic for unlock
* Fix types affected by updated signature of lock/unlock
* Improve signature
* Remove expected errors no longer needed
* Restore the type for component private APIs
Co-authored-by: manzoorwanijk
Co-authored-by: youknowriad
Co-authored-by: jsnajdr
---
packages/private-apis/src/implementation.ts | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/packages/private-apis/src/implementation.ts b/packages/private-apis/src/implementation.ts
index bae53bae8d158a..5a5fb3f39fa183 100644
--- a/packages/private-apis/src/implementation.ts
+++ b/packages/private-apis/src/implementation.ts
@@ -137,14 +137,16 @@ export const __dangerousOptInToUnstableAPIsOnlyForCoreModules = (
* @param object The object to bind the private data to.
* @param privateData The private data to bind to the object.
*/
-function lock( object: Record< symbol, WeakKey >, privateData: unknown ) {
+function lock( object: unknown, privateData: unknown ) {
if ( ! object ) {
throw new Error( 'Cannot lock an undefined object.' );
}
- if ( ! ( __private in object ) ) {
- object[ __private ] = {};
+ const _object = object as Record< symbol, WeakKey >;
+
+ if ( ! ( __private in _object ) ) {
+ _object[ __private ] = {};
}
- lockedData.set( object[ __private ], privateData );
+ lockedData.set( _object[ __private ], privateData );
}
/**
@@ -170,17 +172,19 @@ function lock( object: Record< symbol, WeakKey >, privateData: unknown ) {
* @param object The object to unlock the private data from.
* @return The private data bound to the object.
*/
-function unlock( object: Record< symbol, WeakKey > ) {
+function unlock< T = any >( object: unknown ): T {
if ( ! object ) {
throw new Error( 'Cannot unlock an undefined object.' );
}
- if ( ! ( __private in object ) ) {
+ const _object = object as Record< symbol, WeakKey >;
+
+ if ( ! ( __private in _object ) ) {
throw new Error(
'Cannot unlock an object that was not locked before. '
);
}
- return lockedData.get( object[ __private ] );
+ return lockedData.get( _object[ __private ] );
}
const lockedData = new WeakMap();
From db263fb38a7e6bd8bbf7d27cb189c13063979c90 Mon Sep 17 00:00:00 2001
From: George Mamadashvili
Date: Thu, 28 Nov 2024 20:24:44 +0400
Subject: [PATCH 076/384] Components: Fix the 'ClipboardButton' effect cleanup
(#67399)
Co-authored-by: Mamaduka
Co-authored-by: tyxla
---
packages/components/src/clipboard-button/index.tsx | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/packages/components/src/clipboard-button/index.tsx b/packages/components/src/clipboard-button/index.tsx
index 0bf7d177e251ef..492ab64b7290e2 100644
--- a/packages/components/src/clipboard-button/index.tsx
+++ b/packages/components/src/clipboard-button/index.tsx
@@ -45,9 +45,11 @@ export default function ClipboardButton( {
} );
useEffect( () => {
- if ( timeoutIdRef.current ) {
- clearTimeout( timeoutIdRef.current );
- }
+ return () => {
+ if ( timeoutIdRef.current ) {
+ clearTimeout( timeoutIdRef.current );
+ }
+ };
}, [] );
const classes = clsx( 'components-clipboard-button', className );
From 6a989b420b2dc809076f79985b976b0b400749e3 Mon Sep 17 00:00:00 2001
From: Riad Benguella