Skip to content

Commit

Permalink
prep build 2/10
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Feb 10, 2025
2 parents 3bb71a0 + c8cf3b9 commit 9782aa0
Show file tree
Hide file tree
Showing 31 changed files with 268 additions and 102 deletions.
18 changes: 9 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ updates:
labels:
- 'GitHub Actions'
- '[Type] Build Tooling'
ignore:
- dependency-name: 'actions/setup-java'
versions: ['*']
- dependency-name: 'gradle/*'
versions: ['*']
- dependency-name: 'reactivecircus/*'
versions: ['*']
- dependency-name: 'ruby/setup-ruby'
versions: ['*']
groups:
github-actions:
patterns:
- '*'
exclude-patterns:
- 'actions/setup-java'
- 'gradle/*'
- 'reactivecircus/*'
react-native:
patterns:
- 'actions/setup-java'
- 'gradle/*'
- 'reactivecircus/*'
3 changes: 3 additions & 0 deletions backport-changelog/6.8/8265.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/8265

* https://github.com/WordPress/gutenberg/pull/69057
19 changes: 17 additions & 2 deletions lib/compat/wordpress-6.8/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,30 @@ function gutenberg_update_ignored_hooked_blocks_postmeta( $post ) {
* Update Query `parents` argument validation for hierarchical post types.
* A zero is a valid parent ID for hierarchical post types. Used to display top-level items.
*
* Add new handler for `sticky` query argument.
*
* @param array $query The query vars.
* @param WP_Block $block Block instance.
* @return array The filtered query vars.
*/
function gutenberg_parents_query_vars_from_query_block( $query, $block ) {
function gutenberg_update_query_vars_from_query_block_6_8( $query, $block ) {
if ( ! empty( $block->context['query']['parents'] ) && is_post_type_hierarchical( $query['post_type'] ) ) {
$query['post_parent__in'] = array_unique( array_map( 'intval', $block->context['query']['parents'] ) );
}

if ( isset( $block->context['query']['sticky'] ) && ! empty( $block->context['query']['sticky'] ) ) {
if ( 'ignore' === $block->context['query']['sticky'] ) {
$sticky = get_option( 'sticky_posts' );

/**
* The core will set `post__not_in` because it asserts that any sticky value other than `only` is `exclude`.
* Let's override that while supporting any `post__not_in` values outside sticky post logic.
*/
$query['post__not_in'] = array_diff( $query['post__not_in'], ! empty( $sticky ) ? $sticky : array() );
$query['ignore_sticky_posts'] = 1;
}
}

return $query;
}
add_filter( 'query_loop_block_query_vars', 'gutenberg_parents_query_vars_from_query_block', 10, 2 );
add_filter( 'query_loop_block_query_vars', 'gutenberg_update_query_vars_from_query_block_6_8', 10, 2 );
2 changes: 2 additions & 0 deletions lib/experimental/navigation-theme-opt-in.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*
* @see https://core.trac.wordpress.org/ticket/50544
*
* @global WP_Customize_Manager $wp_customize
*
* @param int $menu_id ID of the updated menu.
* @param int $menu_item_db_id ID of the new menu item.
* @param array $args An array of arguments used to update/add the menu item.
Expand Down
5 changes: 5 additions & 0 deletions packages/babel-preset-default/polyfill-exclusions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ module.exports = [
//
// @see https://github.com/WordPress/gutenberg/pull/67230
/^es(next)?\.set\./,
// Remove Iterator feature polyfills.
// For the same reasoning as for Set exlusion above, we're excluding all iterator helper polyfills.
//
// @see https://github.com/WordPress/wordpress-develop/pull/8224#issuecomment-2636390007.
/^es(next)?\.iterator\./,
];
69 changes: 48 additions & 21 deletions packages/block-editor/src/components/global-styles/filters-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import clsx from 'clsx';
import {
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
__experimentalItemGroup as ItemGroup,
__experimentalItem as Item,
__experimentalHStack as HStack,
__experimentalZStack as ZStack,
__experimentalDropdownContentWrapper as DropdownContentWrapper,
Expand All @@ -21,9 +19,11 @@ import {
Dropdown,
Flex,
FlexItem,
Button,
} from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';
import { useCallback, useMemo } from '@wordpress/element';
import { useCallback, useMemo, useRef } from '@wordpress/element';
import { reset as resetIcon } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -117,6 +117,50 @@ const LabeledColorIndicator = ( { indicator, label } ) => (
</HStack>
);

const renderToggle =
( duotone, resetDuotone ) =>
( { onToggle, isOpen } ) => {
const duotoneButtonRef = useRef( undefined );

const toggleProps = {
onClick: onToggle,
className: clsx( { 'is-open': isOpen } ),
'aria-expanded': isOpen,
ref: duotoneButtonRef,
};

const removeButtonProps = {
onClick: () => {
if ( isOpen ) {
onToggle();
}
resetDuotone();
// Return focus to parent button.
duotoneButtonRef.current?.focus();
},
className: 'block-editor-panel-duotone-settings__reset',
label: __( 'Reset' ),
};

return (
<>
<Button __next40pxDefaultSize { ...toggleProps }>
<LabeledColorIndicator
indicator={ duotone }
label={ __( 'Duotone' ) }
/>
</Button>
{ duotone && (
<Button
size="small"
icon={ resetIcon }
{ ...removeButtonProps }
/>
) }
</>
);
};

export default function FiltersPanel( {
as: Wrapper = FiltersToolsPanel,
value,
Expand Down Expand Up @@ -182,24 +226,7 @@ export default function FiltersPanel( {
<Dropdown
popoverProps={ popoverProps }
className="block-editor-global-styles-filters-panel__dropdown"
renderToggle={ ( { onToggle, isOpen } ) => {
const toggleProps = {
onClick: onToggle,
className: clsx( { 'is-open': isOpen } ),
'aria-expanded': isOpen,
};

return (
<ItemGroup isBordered isSeparated>
<Item as="button" { ...toggleProps }>
<LabeledColorIndicator
indicator={ duotone }
label={ __( 'Duotone' ) }
/>
</Item>
</ItemGroup>
);
} }
renderToggle={ renderToggle( duotone, resetDuotone ) }
renderContent={ () => (
<DropdownContentWrapper paddingSize="small">
<MenuGroup label={ __( 'Duotone' ) }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
__next40pxDefaultSize
variant="tertiary"
onClick={ () => onShadowChange( undefined ) }
disabled={ ! shadow }
accessibleWhenDisabled
>
{ __( 'Clear' ) }
</Button>
Expand Down
27 changes: 27 additions & 0 deletions packages/block-editor/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
}
}

.block-editor-global-styles-filters-panel__dropdown {
border: 1px solid $gray-300;
border-radius: $radius-small;
}

// These styles are similar to the color palette.
.block-editor-global-styles__shadow-indicator {
appearance: none;
Expand Down Expand Up @@ -100,3 +105,25 @@
/*rtl:ignore*/
direction: ltr;
}

.block-editor-panel-duotone-settings__reset {
position: absolute;
right: 0;
top: $grid-unit;
margin: auto $grid-unit auto;
opacity: 0;
@media not (prefers-reduced-motion) {
transition: opacity 0.1s ease-in-out;
}

.block-editor-global-styles-filters-panel__dropdown:hover &,
&:focus,
&:hover {
opacity: 1;
}

@media (hover: none) {
// Show reset button on devices that do not support hover.
opacity: 1;
}
}
21 changes: 15 additions & 6 deletions packages/block-library/src/post-template/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,27 @@ export default function PostTemplateEdit( {
query.format = format;
}

// If sticky is not set, it will return all posts in the results.
// If sticky is set to `only`, it will limit the results to sticky posts only.
// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.
if ( sticky ) {
/*
* Handle cases where sticky is set to `exclude` or `only`.
* Which works as a `post__in/post__not_in` query for sticky posts.
*/
if ( sticky && sticky !== 'ignore' ) {
query.sticky = sticky === 'only';
}

if ( sticky === 'ignore' ) {
// Remove any leftover sticky query parameter.
delete query.sticky;
query.ignore_sticky = true;
}

// If `inherit` is truthy, adjust conditionally the query to create a better preview.
let currentPostType = postType;
if ( inherit ) {
// Change the post-type if needed.
if ( templateSlug?.startsWith( 'archive-' ) ) {
query.postType = templateSlug.replace( 'archive-', '' );
postType = query.postType;
currentPostType = query.postType;
} else if ( templateCategory ) {
query.categories = templateCategory[ 0 ]?.id;
} else if ( templateTag ) {
Expand All @@ -205,7 +214,7 @@ export default function PostTemplateEdit( {
}
// When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
const usedPostType = previewPostType || postType;
const usedPostType = previewPostType || currentPostType;
return {
posts: getEntityRecords( 'postType', usedPostType, {
...query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { __ } from '@wordpress/i18n';

const stickyOptions = [
{ label: __( 'Include' ), value: '' },
{ label: __( 'Ignore' ), value: 'ignore' },
{ label: __( 'Exclude' ), value: 'exclude' },
{ label: __( 'Only' ), value: 'only' },
];
Expand Down
11 changes: 7 additions & 4 deletions packages/editor/src/components/post-author/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ import { AUTHORS_QUERY } from './constants';
export default function PostAuthorCheck( { children } ) {
const { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {
const post = select( editorStore ).getCurrentPost();
const authors = select( coreStore ).getUsers( AUTHORS_QUERY );
const canAssignAuthor = post?._links?.[ 'wp:action-assign-author' ]
? true
: false;
return {
hasAssignAuthorAction:
post._links?.[ 'wp:action-assign-author' ] ?? false,
hasAuthors: authors?.length >= 1,
hasAssignAuthorAction: canAssignAuthor,
hasAuthors: canAssignAuthor
? select( coreStore ).getUsers( AUTHORS_QUERY )?.length >= 1
: false,
};
}, [] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ import { store as editorStore } from '../../store';
function MaybeCategoryPanel() {
const hasNoCategory = useSelect( ( select ) => {
const postType = select( editorStore ).getCurrentPostType();
const { canUser, getEntityRecord, getTaxonomy } = select( coreStore );
const categoriesTaxonomy = getTaxonomy( 'category' );
const { canUser, getEntityRecord } = select( coreStore );
const categoriesTaxonomy = getEntityRecord(
'root',
'taxonomy',
'category'
);
const defaultCategoryId = canUser( 'read', {
kind: 'root',
name: 'site',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ const TagsPanel = () => {
const MaybeTagsPanel = () => {
const { hasTags, isPostTypeSupported } = useSelect( ( select ) => {
const postType = select( editorStore ).getCurrentPostType();
const tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );
const tagsTaxonomy = select( coreStore ).getEntityRecord(
'root',
'taxonomy',
'post_tag'
);
const _isPostTypeSupported = tagsTaxonomy?.types?.includes( postType );
const areTagsFetched = tagsTaxonomy !== undefined;
const tags =
Expand Down
8 changes: 5 additions & 3 deletions packages/editor/src/components/post-taxonomies/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import { store as editorStore } from '../../store';
export default function PostTaxonomiesCheck( { children } ) {
const hasTaxonomies = useSelect( ( select ) => {
const postType = select( editorStore ).getCurrentPostType();
const taxonomies = select( coreStore ).getTaxonomies( {
per_page: -1,
} );
const taxonomies = select( coreStore ).getEntityRecords(
'root',
'taxonomy',
{ per_page: -1 }
);
return taxonomies?.some( ( taxonomy ) =>
taxonomy.types.includes( postType )
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
( select ) => {
const { getCurrentPost, getEditedPostAttribute } =
select( editorStore );
const { getEntityRecords, getTaxonomy, hasFinishedResolution } =
const { getEntityRecords, getEntityRecord, hasFinishedResolution } =
select( coreStore );
const post = getCurrentPost();
const _taxonomy = getTaxonomy( slug );
const _taxonomy = getEntityRecord( 'root', 'taxonomy', slug );
const _termIds = _taxonomy
? getEditedPostAttribute( _taxonomy.rest_base )
: EMPTY_ARRAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ export function HierarchicalTermSelector( { slug } ) {
( select ) => {
const { getCurrentPost, getEditedPostAttribute } =
select( editorStore );
const { getTaxonomy, getEntityRecords, isResolving } =
const { getEntityRecord, getEntityRecords, isResolving } =
select( coreStore );
const _taxonomy = getTaxonomy( slug );
const _taxonomy = getEntityRecord( 'root', 'taxonomy', slug );
const post = getCurrentPost();

return {
Expand Down
6 changes: 5 additions & 1 deletion packages/editor/src/components/post-taxonomies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export function PostTaxonomies( { taxonomyWrapper = identity } ) {
const { postType, taxonomies } = useSelect( ( select ) => {
return {
postType: select( editorStore ).getCurrentPostType(),
taxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),
taxonomies: select( coreStore ).getEntityRecords(
'root',
'taxonomy',
{ per_page: -1 }
),
};
}, [] );
const visibleTaxonomies = ( taxonomies ?? [] ).filter(
Expand Down
Loading

0 comments on commit 9782aa0

Please sign in to comment.