From ddfbdcc33538d6522d64e517ecd02f7952c28d6f Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 10 Jan 2025 12:48:56 +0400 Subject: [PATCH 1/6] Plugin: Remove ESLint rule for deprecated functions (#68590) Co-authored-by: Mamaduka Co-authored-by: fabiankaegy --- .eslintrc.js | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e5f42eea656b9..6626a55a762d1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,21 +4,6 @@ const glob = require( 'glob' ).sync; const { join } = require( 'path' ); -/** - * Internal dependencies - */ -const { version } = require( './package' ); - -/** - * Regular expression string matching a SemVer string with equal major/minor to - * the current package version. Used in identifying deprecations. - * - * @type {string} - */ -const majorMinorRegExp = - version.replace( /\.\d+$/, '' ).replace( /[\\^$.*+?()[\]{}|]/g, '\\$&' ) + - '(\\.\\d+)?'; - /** * The list of patterns matching files used only for development purposes. * @@ -92,14 +77,6 @@ const restrictedSyntax = [ 'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]', message: 'Path access on WordPress dependencies is not allowed.', }, - { - selector: - 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + - majorMinorRegExp + - '/]', - message: - 'Deprecated functions must be removed before releasing this version.', - }, { selector: 'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]', From 79234bd5b182a8be79129cb26db6b76a63daac0d Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 10 Jan 2025 13:50:25 +0400 Subject: [PATCH 2/6] Components: Fix icon condition for Badge (#68588) Co-authored-by: Mamaduka Co-authored-by: ciampo --- packages/components/src/badge/index.tsx | 55 +++++++++++++------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/packages/components/src/badge/index.tsx b/packages/components/src/badge/index.tsx index ee08003c3911d..e57be66db0a7a 100644 --- a/packages/components/src/badge/index.tsx +++ b/packages/components/src/badge/index.tsx @@ -15,45 +15,46 @@ import type { BadgeProps } from './types'; import type { WordPressComponentProps } from '../context'; import Icon from '../icon'; +/** + * Returns an icon based on the badge context. + * + * @return The corresponding icon for the provided context. + */ +function contextBasedIcon( intent: BadgeProps[ 'intent' ] = 'default' ) { + switch ( intent ) { + case 'info': + return info; + case 'success': + return published; + case 'warning': + return caution; + case 'error': + return error; + default: + return null; + } +} + function Badge( { className, intent = 'default', children, ...props }: WordPressComponentProps< BadgeProps, 'span', false > ) { - /** - * Returns an icon based on the badge context. - * - * @return The corresponding icon for the provided context. - */ - function contextBasedIcon() { - switch ( intent ) { - case 'info': - return info; - case 'success': - return published; - case 'warning': - return caution; - case 'error': - return error; - default: - return null; - } - } + const icon = contextBasedIcon( intent ); + const hasIcon = !! icon; return ( - { intent !== 'default' && ( + { hasIcon && ( Date: Fri, 10 Jan 2025 13:22:27 +0100 Subject: [PATCH 3/6] List View: Use badge component for block anchors (#68566) Co-authored-by: juanfra Co-authored-by: Mamaduka Co-authored-by: jameskoster --- .../src/components/list-view/block-select-button.js | 10 +++++----- .../block-editor/src/components/list-view/style.scss | 6 +----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/block-editor/src/components/list-view/block-select-button.js b/packages/block-editor/src/components/list-view/block-select-button.js index 3b21fd4a04e6d..3afbf3f5b5bc1 100644 --- a/packages/block-editor/src/components/list-view/block-select-button.js +++ b/packages/block-editor/src/components/list-view/block-select-button.js @@ -9,6 +9,7 @@ import clsx from 'clsx'; import { __experimentalHStack as HStack, __experimentalTruncate as Truncate, + privateApis as componentsPrivateApis, } from '@wordpress/components'; import { forwardRef } from '@wordpress/element'; import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons'; @@ -25,6 +26,8 @@ import ListViewExpander from './expander'; import { useBlockLock } from '../block-lock'; import useListViewImages from './use-list-view-images'; import { store as blockEditorStore } from '../../store'; +import { unlock } from '../../lock-unlock'; +const { Badge } = unlock( componentsPrivateApis ); function ListViewBlockSelectButton( { @@ -117,12 +120,9 @@ function ListViewBlockSelectButton( { blockInformation?.anchor && ( - + { blockInformation.anchor } - + ) } { isSticky && ( diff --git a/packages/block-editor/src/components/list-view/style.scss b/packages/block-editor/src/components/list-view/style.scss index b010fbf8e73de..138029262cd7f 100644 --- a/packages/block-editor/src/components/list-view/style.scss +++ b/packages/block-editor/src/components/list-view/style.scss @@ -408,15 +408,11 @@ position: absolute; right: 0; transform: translateY(-50%); - background: rgba($black, 0.1); - border-radius: $radius-x-small; - padding: 2px 6px; - max-width: 100%; - box-sizing: border-box; } &.is-selected .block-editor-list-view-block-select-button__anchor { background: rgba($black, 0.3); + color: $white; } .block-editor-list-view-block-select-button__lock, From 22fbc32ed55c239a0589595a08a6dae82e454c02 Mon Sep 17 00:00:00 2001 From: Yogesh Bhutkar Date: Fri, 10 Jan 2025 18:53:05 +0530 Subject: [PATCH 4/6] Navigation: Add clearable option for color tools in navigation edit (#68454) Co-authored-by: yogeshbhutkar Co-authored-by: Mayank-Tripathi32 Co-authored-by: hbhalodia Co-authored-by: t-hamano --- packages/block-library/src/navigation/edit/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index ae7dd60bd0c5b..a9722c0b4f070 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -142,24 +142,28 @@ function ColorTools( { label: __( 'Text' ), onColorChange: setTextColor, resetAllFilter: () => setTextColor(), + clearable: true, }, { colorValue: backgroundColor.color, label: __( 'Background' ), onColorChange: setBackgroundColor, resetAllFilter: () => setBackgroundColor(), + clearable: true, }, { colorValue: overlayTextColor.color, label: __( 'Submenu & overlay text' ), onColorChange: setOverlayTextColor, resetAllFilter: () => setOverlayTextColor(), + clearable: true, }, { colorValue: overlayBackgroundColor.color, label: __( 'Submenu & overlay background' ), onColorChange: setOverlayBackgroundColor, resetAllFilter: () => setOverlayBackgroundColor(), + clearable: true, }, ] } panelId={ clientId } From b2a83a36f7901f5df7df1b742549ee5c65b73dad Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:58:27 +0900 Subject: [PATCH 5/6] StoryBook: Fix error that could occur when loading compiled CSS (#68526) * Revert "fix: Fix media query and reduced motion error (#68464)" This reverts commit 921536e1fbddda54e518fb29e6904555c23452ae. * Add extension explicitly in import statements Co-authored-by: t-hamano Co-authored-by: ciampo Co-authored-by: tyxla --- packages/edit-site/src/components/layout/style.scss | 2 +- storybook/package-styles/block-editor-ltr.lazy.scss | 2 +- storybook/package-styles/block-editor-rtl.lazy.scss | 2 +- storybook/package-styles/block-library-ltr.lazy.scss | 6 +++--- storybook/package-styles/block-library-rtl.lazy.scss | 6 +++--- storybook/package-styles/components-ltr.lazy.scss | 2 +- storybook/package-styles/components-rtl.lazy.scss | 2 +- storybook/package-styles/dataviews-ltr.lazy.scss | 2 +- storybook/package-styles/dataviews-rtl.lazy.scss | 2 +- storybook/package-styles/edit-site-ltr.lazy.scss | 2 +- storybook/package-styles/edit-site-rtl.lazy.scss | 2 +- storybook/package-styles/format-library-ltr.lazy.scss | 2 +- storybook/package-styles/format-library-rtl.lazy.scss | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index 8d44015d52967..caf7dd78da4b3 100644 --- a/packages/edit-site/src/components/layout/style.scss +++ b/packages/edit-site/src/components/layout/style.scss @@ -118,7 +118,7 @@ // This ensure the radius work properly. overflow: hidden; - @media (prefers-reduced-motion: no-preference) { + @media not (prefers-reduced-motion) { transition: border-radius, box-shadow 0.4s; } diff --git a/storybook/package-styles/block-editor-ltr.lazy.scss b/storybook/package-styles/block-editor-ltr.lazy.scss index 4a84559461387..6e2cce4438268 100644 --- a/storybook/package-styles/block-editor-ltr.lazy.scss +++ b/storybook/package-styles/block-editor-ltr.lazy.scss @@ -1 +1 @@ -@import "../../packages/block-editor/build-style/style"; +@import "../../packages/block-editor/build-style/style.css"; diff --git a/storybook/package-styles/block-editor-rtl.lazy.scss b/storybook/package-styles/block-editor-rtl.lazy.scss index d8eacb3d25b58..8657d37518aba 100644 --- a/storybook/package-styles/block-editor-rtl.lazy.scss +++ b/storybook/package-styles/block-editor-rtl.lazy.scss @@ -1 +1 @@ -@import "../../packages/block-editor/build-style/style-rtl"; +@import "../../packages/block-editor/build-style/style-rtl.css"; diff --git a/storybook/package-styles/block-library-ltr.lazy.scss b/storybook/package-styles/block-library-ltr.lazy.scss index a5e373b1c061c..af63958aa4f2f 100644 --- a/storybook/package-styles/block-library-ltr.lazy.scss +++ b/storybook/package-styles/block-library-ltr.lazy.scss @@ -1,3 +1,3 @@ -@import "../../packages/block-library/build-style/style"; -@import "../../packages/block-library/build-style/theme"; -@import "../../packages/block-library/build-style/editor"; +@import "../../packages/block-library/build-style/style.css"; +@import "../../packages/block-library/build-style/theme.css"; +@import "../../packages/block-library/build-style/editor.css"; diff --git a/storybook/package-styles/block-library-rtl.lazy.scss b/storybook/package-styles/block-library-rtl.lazy.scss index de83f99738553..f472b81d72050 100644 --- a/storybook/package-styles/block-library-rtl.lazy.scss +++ b/storybook/package-styles/block-library-rtl.lazy.scss @@ -1,3 +1,3 @@ -@import "../../packages/block-library/build-style/style-rtl"; -@import "../../packages/block-library/build-style/theme-rtl"; -@import "../../packages/block-library/build-style/editor-rtl"; +@import "../../packages/block-library/build-style/style-rtl.css"; +@import "../../packages/block-library/build-style/theme-rtl.css"; +@import "../../packages/block-library/build-style/editor-rtl.css"; diff --git a/storybook/package-styles/components-ltr.lazy.scss b/storybook/package-styles/components-ltr.lazy.scss index e7891f25026c4..c9d2002e2aff7 100644 --- a/storybook/package-styles/components-ltr.lazy.scss +++ b/storybook/package-styles/components-ltr.lazy.scss @@ -1 +1 @@ -@import "../../packages/components/build-style/style"; +@import "../../packages/components/build-style/style.css"; diff --git a/storybook/package-styles/components-rtl.lazy.scss b/storybook/package-styles/components-rtl.lazy.scss index 6cba6edf353da..18eccbb8bd7c1 100644 --- a/storybook/package-styles/components-rtl.lazy.scss +++ b/storybook/package-styles/components-rtl.lazy.scss @@ -1 +1 @@ -@import "../../packages/components/build-style/style-rtl"; +@import "../../packages/components/build-style/style-rtl.css"; diff --git a/storybook/package-styles/dataviews-ltr.lazy.scss b/storybook/package-styles/dataviews-ltr.lazy.scss index b5e1aa042803a..02ed0c9779f80 100644 --- a/storybook/package-styles/dataviews-ltr.lazy.scss +++ b/storybook/package-styles/dataviews-ltr.lazy.scss @@ -1 +1 @@ -@import "../../packages/dataviews/build-style/style"; +@import "../../packages/dataviews/build-style/style.css"; diff --git a/storybook/package-styles/dataviews-rtl.lazy.scss b/storybook/package-styles/dataviews-rtl.lazy.scss index d97479a1a5658..f84964f93850d 100644 --- a/storybook/package-styles/dataviews-rtl.lazy.scss +++ b/storybook/package-styles/dataviews-rtl.lazy.scss @@ -1 +1 @@ -@import "../../packages/dataviews/build-style/style-rtl"; +@import "../../packages/dataviews/build-style/style-rtl.css"; diff --git a/storybook/package-styles/edit-site-ltr.lazy.scss b/storybook/package-styles/edit-site-ltr.lazy.scss index c704fe9d9530a..c650798e55485 100644 --- a/storybook/package-styles/edit-site-ltr.lazy.scss +++ b/storybook/package-styles/edit-site-ltr.lazy.scss @@ -1 +1 @@ -@import "../../packages/edit-site/build-style/style"; +@import "../../packages/edit-site/build-style/style.css"; diff --git a/storybook/package-styles/edit-site-rtl.lazy.scss b/storybook/package-styles/edit-site-rtl.lazy.scss index ae9ac27d6b51e..a1f44ec2f7c51 100644 --- a/storybook/package-styles/edit-site-rtl.lazy.scss +++ b/storybook/package-styles/edit-site-rtl.lazy.scss @@ -1 +1 @@ -@import "../../packages/edit-site/build-style/style-rtl"; +@import "../../packages/edit-site/build-style/style-rtl.css"; diff --git a/storybook/package-styles/format-library-ltr.lazy.scss b/storybook/package-styles/format-library-ltr.lazy.scss index 0f7db59c5d5df..7a7468769865d 100644 --- a/storybook/package-styles/format-library-ltr.lazy.scss +++ b/storybook/package-styles/format-library-ltr.lazy.scss @@ -1 +1 @@ -@import "../../packages/format-library/build-style/style"; +@import "../../packages/format-library/build-style/style.css"; diff --git a/storybook/package-styles/format-library-rtl.lazy.scss b/storybook/package-styles/format-library-rtl.lazy.scss index de2553bb5efa2..7d62ab7000b68 100644 --- a/storybook/package-styles/format-library-rtl.lazy.scss +++ b/storybook/package-styles/format-library-rtl.lazy.scss @@ -1 +1 @@ -@import "../../packages/format-library/build-style/style-rtl"; +@import "../../packages/format-library/build-style/style-rtl.css"; From d9e4df8a5af298083b7816b35b7f73ab657beb99 Mon Sep 17 00:00:00 2001 From: Eshaan Dabasiya <76681468+im3dabasia@users.noreply.github.com> Date: Fri, 10 Jan 2025 19:57:56 +0530 Subject: [PATCH 6/6] fix: Simplify the sprintf translations for percentage widths (#68587) Co-authored-by: im3dabasia Co-authored-by: t-hamano Co-authored-by: Mamaduka --- .../block-editor/src/components/image-size-control/index.js | 2 +- packages/block-library/src/button/edit.js | 2 +- packages/block-library/src/search/edit.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/image-size-control/index.js b/packages/block-editor/src/components/image-size-control/index.js index 3432e85728fd3..1cd2b51054e7e 100644 --- a/packages/block-editor/src/components/image-size-control/index.js +++ b/packages/block-editor/src/components/image-size-control/index.js @@ -139,7 +139,7 @@ export default function ImageSizeControl( { value={ scale } label={ sprintf( /* translators: Percentage value. */ - __( '%1$d%%' ), + __( '%d%%' ), scale ) } /> diff --git a/packages/block-library/src/button/edit.js b/packages/block-library/src/button/edit.js index 06e10f604650e..67e1218ca2f65 100644 --- a/packages/block-library/src/button/edit.js +++ b/packages/block-library/src/button/edit.js @@ -150,7 +150,7 @@ function WidthPanel( { selectedWidth, setAttributes } ) { value={ widthValue } label={ sprintf( /* translators: Percentage value. */ - __( '%1$d%%' ), + __( '%d%%' ), widthValue ) } /> diff --git a/packages/block-library/src/search/edit.js b/packages/block-library/src/search/edit.js index b4ac37220c816..ed8edf4a5aca8 100644 --- a/packages/block-library/src/search/edit.js +++ b/packages/block-library/src/search/edit.js @@ -472,7 +472,7 @@ export default function SearchEdit( { value={ widthValue } label={ sprintf( /* translators: Percentage value. */ - __( '%1$d%%' ), + __( '%d%%' ), widthValue ) } />