Skip to content

Commit

Permalink
prep build 07/13
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Jul 13, 2024
2 parents e9a208e + 82a8c71 commit 565a260
Show file tree
Hide file tree
Showing 35 changed files with 1,451 additions and 1,391 deletions.
1,140 changes: 623 additions & 517 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@

.show-icon-labels {
.block-editor-patterns__grid-pagination {
flex-direction: column;
.block-editor-patterns__grid-pagination-previous,
.block-editor-patterns__grid-pagination-next {
flex-direction: column;
}
.components-button {
width: auto;
// Hide the button icons when labels are set to display...
Expand All @@ -42,22 +37,4 @@
}
}
}

@media screen and (min-width: $break-large) {
.block-editor-patterns__grid-pagination {
flex-direction: row;
.block-editor-patterns__grid-pagination-previous,
.block-editor-patterns__grid-pagination-next {
flex-direction: row;
}
}
}
}

.block-editor-block-patterns-list .block-editor-patterns__grid-pagination {
flex-direction: column;
.block-editor-patterns__grid-pagination-previous,
.block-editor-patterns__grid-pagination-next {
flex-direction: column;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default function ZoomOutToolbar( { clientId, rootClientId } ) {
<ToolbarButton
className="zoom-out-toolbar-button"
icon={ trash }
label="Delete"
label={ __( 'Delete' ) }
onClick={ () => {
removeBlock( clientId );
} }
Expand Down
62 changes: 44 additions & 18 deletions packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -291,34 +291,35 @@ $block-inserter-tabs-height: 44px;
}

.block-editor-inserter__category-panel {
background: $gray-100;
border-top: $border-width solid $gray-200;
box-shadow: $border-width $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
outline: 1px solid transparent; // Shown for Windows 10 High Contrast mode.
position: absolute;
top: -$border-width;
left: 0;
height: calc(100% + #{$border-width});
width: 100%;
padding: 0 $grid-unit-20;
display: flex;
flex-direction: column;
padding: 0 $grid-unit-20;

@include break-medium {
border-left: $border-width solid $gray-200;
padding: 0;
left: 100%;
width: 300px;
}

.block-editor-inserter__media-list,
.block-editor-block-patterns-list {
padding: 0 $grid-unit-30 $grid-unit-20;
position: absolute;
top: -$border-width;
height: calc(100% + #{$border-width});
background: $gray-100;
border-top: $border-width solid $gray-200;
box-shadow: $border-width $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.

.block-editor-inserter__media-list,
.block-editor-block-patterns-list {
padding: 0 $grid-unit-30 $grid-unit-20;
}
}
}

.block-editor-inserter__patterns-category-panel-header {
padding: $grid-unit-10 $grid-unit-30;
padding: $grid-unit-10 0;
@include break-medium {
padding: $grid-unit-10 $grid-unit-30;
}
}

.block-editor-inserter__patterns-category-no-results {
Expand Down Expand Up @@ -522,10 +523,15 @@ $block-inserter-tabs-height: 44px;
}

.block-editor-inserter__media-panel-search {
padding: $grid-unit-20 $grid-unit-30 $grid-unit-10;
margin-bottom: $grid-unit-20;
// TODO: Consider using the Theme component to automatically adapt to a gray background.
&:not(:focus-within) {
--wp-components-color-background: #{$white};
@include break-medium() {
margin-bottom: 0;
padding: $grid-unit-20 $grid-unit-30 $grid-unit-10;

&:not(:focus-within) {
--wp-components-color-background: #{$white};
}
}
}
}
Expand Down Expand Up @@ -698,3 +704,23 @@ $block-inserter-tabs-height: 44px;
}
}
}

.show-icon-labels {
@media (max-width: #{ ($break-large - 1) }) {
.block-editor-block-patterns-explorer .block-editor-patterns__grid-pagination {
flex-direction: column;
.block-editor-patterns__grid-pagination-previous,
.block-editor-patterns__grid-pagination-next {
flex-direction: column;
}
}
}

.block-editor-inserter__category-panel .block-editor-patterns__grid-pagination {
flex-direction: column;
.block-editor-patterns__grid-pagination-previous,
.block-editor-patterns__grid-pagination-next {
flex-direction: column;
}
}
}
27 changes: 10 additions & 17 deletions packages/block-library/src/query-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,22 @@ import {
useBlockProps,
Warning,
HeadingLevelDropdown,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { ToggleControl, PanelBody } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import { useArchiveLabel } from './use-archive-label';

const SUPPORTED_TYPES = [ 'archive', 'search' ];

export default function QueryTitleEdit( {
attributes: { type, level, textAlign, showPrefix, showSearchTerm },
setAttributes,
} ) {
const { archiveTypeTitle, archiveNameLabel } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
const {
__experimentalArchiveTitleNameLabel,
__experimentalArchiveTitleTypeLabel,
} = getSettings();
return {
archiveTypeTitle: __experimentalArchiveTitleTypeLabel,
archiveNameLabel: __experimentalArchiveTitleNameLabel,
};
} );
const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel();

const TagName = `h${ level }`;
const blockProps = useBlockProps( {
Expand All @@ -55,20 +48,20 @@ export default function QueryTitleEdit( {
let titleElement;
if ( type === 'archive' ) {
let title;
if ( archiveTypeTitle ) {
if ( archiveTypeLabel ) {
if ( showPrefix ) {
if ( archiveNameLabel ) {
title = sprintf(
/* translators: 1: Archive type title e.g: "Category", 2: Label of the archive e.g: "Shoes" */
__( '%1$s: %2$s' ),
archiveTypeTitle,
archiveTypeLabel,
archiveNameLabel
);
} else {
title = sprintf(
/* translators: %s: Archive type title e.g: "Category", "Tag"... */
__( '%s: Name' ),
archiveTypeTitle
archiveTypeLabel
);
}
} else if ( archiveNameLabel ) {
Expand All @@ -77,7 +70,7 @@ export default function QueryTitleEdit( {
title = sprintf(
/* translators: %s: Archive type title e.g: "Category", "Tag"... */
__( '%s name' ),
archiveTypeTitle
archiveTypeLabel
);
}
} else {
Expand Down
99 changes: 99 additions & 0 deletions packages/block-library/src/query-title/use-archive-label.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* WordPress dependencies
*/
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';

export function useArchiveLabel() {
const templateSlug = useSelect( ( select ) => {
// @wordpress/block-library should not depend on @wordpress/editor.
// Blocks can be loaded into a *non-post* block editor, so to avoid
// declaring @wordpress/editor as a dependency, we must access its
// store by string.
// The solution here is to split WP specific blocks from generic blocks.
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const { getCurrentPostId, getCurrentPostType, getCurrentTemplateId } =
select( 'core/editor' );
const currentPostType = getCurrentPostType();
const templateId =
getCurrentTemplateId() ||
( currentPostType === 'wp_template' ? getCurrentPostId() : null );

return templateId
? select( coreStore ).getEditedEntityRecord(
'postType',
'wp_template',
templateId
)?.slug
: null;
}, [] );
const taxonomyMatches = templateSlug?.match(
/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/
);
let taxonomy;
let term;
let isAuthor = false;
let authorSlug;
if ( taxonomyMatches ) {
// If is for a all taxonomies of a type
if ( taxonomyMatches[ 1 ] ) {
taxonomy = taxonomyMatches[ 2 ]
? taxonomyMatches[ 2 ]
: taxonomyMatches[ 1 ];
}
// If is for a all taxonomies of a type
else if ( taxonomyMatches[ 3 ] ) {
taxonomy = taxonomyMatches[ 6 ]
? taxonomyMatches[ 6 ]
: taxonomyMatches[ 4 ];
term = taxonomyMatches[ 7 ];
}
taxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;

//getTaxonomy( 'category' );
//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );
} else {
const authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );
if ( authorMatches ) {
isAuthor = true;
if ( authorMatches[ 2 ] ) {
authorSlug = authorMatches[ 2 ];
}
}
}
return useSelect(
( select ) => {
const { getEntityRecords, getTaxonomy, getAuthors } =
select( coreStore );
let archiveTypeLabel;
let archiveNameLabel;
if ( taxonomy ) {
archiveTypeLabel =
getTaxonomy( taxonomy )?.labels?.singular_name;
}
if ( term ) {
const records = getEntityRecords( 'taxonomy', taxonomy, {
slug: term,
per_page: 1,
} );
if ( records && records[ 0 ] ) {
archiveNameLabel = records[ 0 ].name;
}
}
if ( isAuthor ) {
archiveTypeLabel = 'Author';
if ( authorSlug ) {
const authorRecords = getAuthors( { slug: authorSlug } );
if ( authorRecords && authorRecords[ 0 ] ) {
archiveNameLabel = authorRecords[ 0 ].name;
}
}
}
return {
archiveTypeLabel,
archiveNameLabel,
};
},
[ authorSlug, isAuthor, taxonomy, term ]
);
}
2 changes: 1 addition & 1 deletion packages/block-library/src/social-link/icons/soundcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { Path, SVG } from '@wordpress/primitives';

export const SoundCloudIcon = () => (
<SVG width="24" height="24" viewBox="0 0 24 24" version="1.1">
<Path d="M8.9,16.1L9,14L8.9,9.5c0-0.1,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c0,0-0.1,0.1-0.1,0.1L8.3,14l0.1,2.1 c0,0.1,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1C8.8,16.3,8.9,16.3,8.9,16.1z M11.4,15.9l0.1-1.8L11.4,9c0-0.1,0-0.2-0.1-0.2 c0,0-0.1,0-0.1,0s-0.1,0-0.1,0c-0.1,0-0.1,0.1-0.1,0.2l0,0.1l-0.1,5c0,0,0,0.7,0.1,2v0c0,0.1,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.1 c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.1-0.2L11.4,15.9z M2.4,12.9L2.5,14l-0.2,1.1c0,0.1,0,0.1-0.1,0.1c0,0-0.1,0-0.1-0.1L2.1,14 l0.1-1.1C2.2,12.9,2.3,12.9,2.4,12.9C2.3,12.9,2.4,12.9,2.4,12.9z M3.1,12.2L3.3,14l-0.2,1.8c0,0.1,0,0.1-0.1,0.1 c-0.1,0-0.1,0-0.1-0.1L2.8,14L3,12.2C3,12.2,3,12.2,3.1,12.2C3.1,12.2,3.1,12.2,3.1,12.2z M3.9,11.9L4.1,14l-0.2,2.1 c0,0.1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7,9.5,9.7,9.6 L9.7,9.6z M10.6,9.8l0.1,4.3l-0.1,2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c0,0-0.1-0.1-0.1-0.2L10,14 l0.1-4.3c0-0.1,0-0.1,0.1-0.2c0,0,0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S10.6,9.7,10.6,9.8z M12.4,14l-0.1,2c0,0.1,0,0.1-0.1,0.2 c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2l-0.1-1l-0.1-1l0.1-5.5v0c0-0.1,0-0.2,0.1-0.2 c0.1,0,0.1-0.1,0.2-0.1c0,0,0.1,0,0.1,0c0.1,0,0.1,0.1,0.1,0.2L12.4,14z M22.1,13.9c0,0.7-0.2,1.3-0.7,1.7c-0.5,0.5-1.1,0.7-1.7,0.7 h-6.8c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V8.2c0-0.1,0.1-0.2,0.2-0.3c0.5-0.2,1-0.3,1.6-0.3c1.1,0,2.1,0.4,2.9,1.1 c0.8,0.8,1.3,1.7,1.4,2.8c0.3-0.1,0.6-0.2,1-0.2c0.7,0,1.3,0.2,1.7,0.7C21.8,12.6,22.1,13.2,22.1,13.9L22.1,13.9z" />
<Path d="M23.994 14.552a3.36 3.36 0 01-3.401 3.171h-8.176a.685.685 0 01-.679-.681V8.238a.749.749 0 01.452-.716S12.942 7 14.526 7a5.357 5.357 0 012.748.755 5.44 5.44 0 012.56 3.546c.282-.08.574-.12.868-.119a3.273 3.273 0 013.292 3.37zM10.718 8.795a.266.266 0 10-.528 0c-.224 2.96-.397 5.735 0 8.685a.265.265 0 00.528 0c.425-2.976.246-5.7 0-8.685zM9.066 9.82a.278.278 0 00-.553 0 33.183 33.183 0 000 7.663.278.278 0 00.55 0c.33-2.544.332-5.12.003-7.664zM7.406 9.56a.269.269 0 00-.535 0c-.253 2.7-.38 5.222 0 7.917a.266.266 0 10.531 0c.394-2.73.272-5.181.004-7.917zM5.754 10.331a.275.275 0 10-.55 0 28.035 28.035 0 000 7.155.272.272 0 00.54 0c.332-2.373.335-4.78.01-7.155zM4.087 12.12a.272.272 0 00-.544 0c-.393 1.843-.208 3.52.016 5.386a.26.26 0 00.512 0c.247-1.892.435-3.53.016-5.386zM2.433 11.838a.282.282 0 00-.56 0c-.349 1.882-.234 3.54.01 5.418.025.285.508.282.54 0 .269-1.907.394-3.517.01-5.418zM.762 12.76a.282.282 0 00-.56 0c-.32 1.264-.22 2.31.023 3.578a.262.262 0 00.521 0c.282-1.293.42-2.317.016-3.578z" />
</SVG>
);
2 changes: 1 addition & 1 deletion packages/commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@wordpress/keyboard-shortcuts": "file:../keyboard-shortcuts",
"@wordpress/private-apis": "file:../private-apis",
"clsx": "^2.1.1",
"cmdk": "^0.2.0"
"cmdk": "^1.0.0"
},
"peerDependencies": {
"react": "^18.0.0",
Expand Down
13 changes: 1 addition & 12 deletions packages/commands/src/components/command-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export function CommandMenu() {
);
const { open, close } = useDispatch( commandsStore );
const [ loaders, setLoaders ] = useState( {} );
const commandListRef = useRef();

useEffect( () => {
registerShortcut( {
Expand All @@ -206,16 +205,6 @@ export function CommandMenu() {
} );
}, [ registerShortcut ] );

// Temporary fix for the suggestions Listbox labeling.
// See https://github.com/pacocoursey/cmdk/issues/196
useEffect( () => {
commandListRef.current?.removeAttribute( 'aria-labelledby' );
commandListRef.current?.setAttribute(
'aria-label',
__( 'Command suggestions' )
);
}, [ commandListRef.current ] );

useShortcut(
'core/commands',
/** @type {import('react').KeyboardEventHandler} */
Expand Down Expand Up @@ -287,7 +276,7 @@ export function CommandMenu() {
/>
<Icon icon={ inputIcon } />
</div>
<Command.List ref={ commandListRef }>
<Command.List label={ __( 'Command suggestions' ) }>
{ search && ! isLoading && (
<Command.Empty>
{ __( 'No results found.' ) }
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- `CustomSelectControl`: switch to ariakit-based implementation ([#63258](https://github.com/WordPress/gutenberg/pull/63258)).
- `CustomSelectControlV2`: animate select popover appearance. ([#63343](https://github.com/WordPress/gutenberg/pull/63343))
- `CustomSelectControlV2`: do not flip popover if legacy adapter. ([#63357](https://github.com/WordPress/gutenberg/pull/63357)).
- `DropdownMenuV2`: invert animation direction. ([#63443](https://github.com/WordPress/gutenberg/pull/63443)).

### Enhancements

Expand Down
Loading

0 comments on commit 565a260

Please sign in to comment.