wordpress update 6.6.2

This commit is contained in:
Tony Volpe
2024-09-10 12:45:50 -04:00
parent daa614524b
commit 44b413346f
46 changed files with 309 additions and 174 deletions
+80 -43
View File
@@ -1574,9 +1574,7 @@ const CSSSelector_1 = __webpack_require__(3467);
const prefixWrapCSSRule = (cssRule, nested, ignoredSelectors, prefixSelector, prefixRootTags) => {
// Check each rule to see if it exactly matches our prefix selector, when
// this happens, don't try to prefix that selector.
const rules = cssRule.selector
.split(",")
.filter((selector) => !(0, CSSSelector_1.cssRuleMatchesPrefixSelector)({ selector: selector }, prefixSelector));
const rules = cssRule.selectors.filter((selector) => !(0, CSSSelector_1.cssRuleMatchesPrefixSelector)({ selector: selector }, prefixSelector));
if (rules.length === 0) {
return;
}
@@ -10465,6 +10463,11 @@ const {
const STORE_NAME = 'core/block-editor';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
@@ -10472,6 +10475,36 @@ const STORE_NAME = 'core/block-editor';
const withRootClientIdOptionKey = Symbol('withRootClientId');
const parsedPatternCache = new WeakMap();
function parsePattern(pattern) {
const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
__unstableSkipMigrationLogs: true
});
if (blocks.length === 1) {
blocks[0].attributes = {
...blocks[0].attributes,
metadata: {
...(blocks[0].attributes.metadata || {}),
categories: pattern.categories,
patternName: pattern.name,
name: blocks[0].attributes.metadata?.name || pattern.title
}
};
}
return {
...pattern,
blocks
};
}
function getParsedPattern(pattern) {
let parsedPattern = parsedPatternCache.get(pattern);
if (parsedPattern) {
return parsedPattern;
}
parsedPattern = parsePattern(pattern);
parsedPatternCache.set(pattern, parsedPattern);
return parsedPattern;
}
const checkAllowList = (list, item, defaultResult = null) => {
if (typeof list === 'boolean') {
return list;
@@ -11056,23 +11089,22 @@ const getInserterMediaCategories = (0,external_wp_data_namespaceObject.createSel
*/
const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => {
const {
getAllPatterns,
__experimentalGetParsedPattern
getAllPatterns
} = unlock(select(STORE_NAME));
const patterns = getAllPatterns();
const {
allowedBlockTypes
} = getSettings(state);
return patterns.some(({
name,
inserter = true
}) => {
return patterns.some(pattern => {
const {
inserter = true
} = pattern;
if (!inserter) {
return false;
}
const {
blocks
} = __experimentalGetParsedPattern(name);
} = getParsedPattern(pattern);
return checkAllowListRecursive(blocks, allowedBlockTypes) && blocks.every(({
name: blockName
}) => canInsertBlockType(state, blockName, rootClientId));
@@ -13179,30 +13211,10 @@ function __experimentalGetDirectInsertBlock(state, rootClientId = null) {
});
return getDirectInsertBlock(state, rootClientId);
}
const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, patternName) => {
const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, patternName) => {
const pattern = unlock(select(STORE_NAME)).getPatternBySlug(patternName);
if (!pattern) {
return null;
}
const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
__unstableSkipMigrationLogs: true
});
if (blocks.length === 1) {
blocks[0].attributes = {
...blocks[0].attributes,
metadata: {
...(blocks[0].attributes.metadata || {}),
categories: pattern.categories,
patternName: pattern.name,
name: blocks[0].attributes.metadata?.name || pattern.title
}
};
}
return {
...pattern,
blocks
};
}, (state, patternName) => [unlock(select(STORE_NAME)).getPatternBySlug(patternName)]));
return pattern ? getParsedPattern(pattern) : null;
});
const getAllowedPatternsDependants = select => (state, rootClientId) => [...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(state, rootClientId)];
/**
@@ -13216,8 +13228,7 @@ const getAllowedPatternsDependants = select => (state, rootClientId) => [...getA
const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
return (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => {
const {
getAllPatterns,
__experimentalGetParsedPattern: getParsedPattern
getAllPatterns
} = unlock(select(STORE_NAME));
const patterns = getAllPatterns();
const {
@@ -13225,9 +13236,7 @@ const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.cre
} = getSettings(state);
const parsedPatterns = patterns.filter(({
inserter = true
}) => !!inserter).map(({
name
}) => getParsedPattern(name));
}) => !!inserter).map(getParsedPattern);
const availableParsedPatterns = parsedPatterns.filter(({
blocks
}) => checkAllowListRecursive(blocks, allowedBlockTypes));
@@ -34098,7 +34107,7 @@ function getLayoutStyles({
// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.
combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ''})` : `:where(${selector}.${className}${spacingStyle?.selector || ''})`;
} else {
combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `.${className}${spacingStyle?.selector || ''}` : `${selector}-${className}${spacingStyle?.selector || ''}`;
combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ''}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ''}`;
}
ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
}
@@ -34163,7 +34172,10 @@ const getNodesWithStyles = (tree, blockSelectors) => {
if (styles) {
nodes.push({
styles,
selector: ROOT_BLOCK_SELECTOR
selector: ROOT_BLOCK_SELECTOR,
// Root selector (body) styles should not be wrapped in `:root where()` to keep
// specificity at (0,0,1) and maintain backwards compatibility.
skipSelectorWrapper: true
});
}
Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => {
@@ -34614,10 +34626,16 @@ function updateConfigWithSeparator(config) {
}
function processCSSNesting(css, blockSelector) {
let processedCSS = '';
if (!css || css.trim() === '') {
return processedCSS;
}
// Split CSS nested rules.
const parts = css.split('&');
parts.forEach(part => {
if (!part || part.trim() === '') {
return;
}
const isRootCss = !part.includes('{');
if (isRootCss) {
// If the part doesn't contain braces, it applies to the root level.
@@ -34629,8 +34647,27 @@ function processCSSNesting(css, blockSelector) {
return;
}
const [nestedSelector, cssValue] = splittedPart;
const combinedSelector = nestedSelector.startsWith(' ') ? scopeSelector(blockSelector, nestedSelector) : appendToSelector(blockSelector, nestedSelector);
processedCSS += `:root :where(${combinedSelector}){${cssValue.trim()}}`;
// Handle pseudo elements such as ::before, ::after, etc. Regex will also
// capture any leading combinator such as >, +, or ~, as well as spaces.
// This allows pseudo elements as descendants e.g. `.parent ::before`.
const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/);
const pseudoPart = matches ? matches[1] : '';
const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, '').trim() : nestedSelector.trim();
let combinedSelector;
if (withoutPseudoElement === '') {
// Only contained a pseudo element to use the block selector to form
// the final `:root :where()` selector.
combinedSelector = blockSelector;
} else {
// If the nested selector is a descendant of the block scope it with the
// block selector. Otherwise append it to the block selector.
combinedSelector = nestedSelector.startsWith(' ') ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement);
}
// Build final rule, re-adding any pseudo element outside the `:where()`
// to maintain valid CSS selector.
processedCSS += `:root :where(${combinedSelector})${pseudoPart}{${cssValue.trim()}}`;
}
});
return processedCSS;
@@ -38494,7 +38531,7 @@ function createBlockCompleter() {
prioritizedBlocks: getBlockListSettings(_rootClientId)?.prioritizedInserterBlocks
};
}, []);
const [items, categories, collections] = use_block_types_state(rootClientId, block_noop);
const [items, categories, collections] = use_block_types_state(rootClientId, block_noop, true);
const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(items, categories, collections, filterValue) : orderInserterBlockItems(orderBy(items, 'frecency', 'desc'), prioritizedBlocks);
return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, SHOWN_BLOCK_TYPES);
File diff suppressed because one or more lines are too long
+8 -17
View File
@@ -2557,8 +2557,8 @@ function usePaddingAppender() {
const {
defaultView
} = ownerDocument;
const paddingBottom = defaultView.parseInt(defaultView.getComputedStyle(node).paddingBottom, 10);
if (!paddingBottom) {
const pseudoHeight = defaultView.parseInt(defaultView.getComputedStyle(node, ':after').height, 10);
if (!pseudoHeight) {
return;
}
@@ -2571,20 +2571,15 @@ function usePaddingAppender() {
if (event.clientY < lastChildRect.bottom) {
return;
}
event.preventDefault();
event.stopPropagation();
const blockOrder = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder('');
const lastBlockClientId = blockOrder[blockOrder.length - 1];
// Do nothing when only default block appender is present.
if (!lastBlockClientId) {
return;
}
const lastBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(lastBlockClientId);
const {
selectBlock,
insertDefaultBlock
} = registry.dispatch(external_wp_blockEditor_namespaceObject.store);
if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(lastBlock)) {
if (lastBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(lastBlock)) {
selectBlock(lastBlockClientId);
} else {
insertDefaultBlock();
@@ -2701,7 +2696,6 @@ function useEditorStyles() {
hasThemeStyleSupport,
editorSettings,
isZoomedOutView,
hasMetaBoxes,
renderingMode,
postType
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
@@ -2717,7 +2711,6 @@ function useEditorStyles() {
hasThemeStyleSupport: select(store).isFeatureActive('themeStyles'),
editorSettings: select(external_wp_editor_namespaceObject.store).getEditorSettings(),
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
hasMetaBoxes: select(store).hasMetaBoxes(),
renderingMode: getRenderingMode(),
postType: _postType
};
@@ -2747,13 +2740,11 @@ function useEditorStyles() {
}
const baseStyles = hasThemeStyles ? (_editorSettings$style3 = editorSettings.styles) !== null && _editorSettings$style3 !== void 0 ? _editorSettings$style3 : [] : defaultEditorStyles;
// Add a constant padding for the typewriter effect. When typing at the
// bottom, there needs to be room to scroll up.
if (!isZoomedOutView && !hasMetaBoxes && renderingMode === 'post-only' && !DESIGN_POST_TYPES.includes(postType)) {
// Add a space for the typewriter effect. When typing in the last block,
// there needs to be room to scroll up.
if (!isZoomedOutView && renderingMode === 'post-only' && !DESIGN_POST_TYPES.includes(postType)) {
return [...baseStyles, {
// Should override global styles padding, so ensure 0-1-0
// specificity.
css: ':root :where(body){padding-bottom: 40vh}'
css: ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}'
}];
}
return baseStyles;
File diff suppressed because one or more lines are too long
+5 -2
View File
@@ -25133,6 +25133,9 @@ function bulk_actions_ActionWithModal({
const onCloseModal = (0,external_wp_element_namespaceObject.useCallback)(() => {
setActionWithModal(undefined);
}, [setActionWithModal]);
if (!eligibleItems.length) {
return null;
}
const label = typeof action.label === 'string' ? action.label : action.label(selectedItems);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: !hideModalHeader ? label : undefined,
@@ -35575,7 +35578,7 @@ function usePostTypeArchiveMenuItems() {
// `icon` is the `menu_icon` property of a post type. We
// only handle `dashicons` for now, even if the `menu_icon`
// also supports urls and svg as values.
icon: postType.icon?.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive,
icon: typeof postType.icon === 'string' && postType.icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive,
templatePrefix: 'archive'
};
}) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]);
@@ -35653,7 +35656,7 @@ const usePostTypeMenuItems = onClickMenuItem => {
// `icon` is the `menu_icon` property of a post type. We
// only handle `dashicons` for now, even if the `menu_icon`
// also supports urls and svg as values.
icon: icon?.startsWith('dashicons-') ? icon.slice(10) : library_post,
icon: typeof icon === 'string' && icon.startsWith('dashicons-') ? icon.slice(10) : library_post,
templatePrefix: templatePrefixes[slug]
};
const hasEntities = postTypesInfo?.[slug]?.hasEntities;
File diff suppressed because one or more lines are too long
+8 -5
View File
@@ -5946,7 +5946,7 @@ const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(
// `icon` is the `menu_icon` property of a post type. We
// only handle `dashicons` for now, even if the `menu_icon`
// also supports urls and svg as values.
if (postTypeEntity?.icon?.startsWith('dashicons-')) {
if (typeof postTypeEntity?.icon === 'string' && postTypeEntity.icon.startsWith('dashicons-')) {
return postTypeEntity.icon.slice(10);
}
return library_page;
@@ -26000,12 +26000,14 @@ function usePostActions({
postTypeObject,
resource,
cachedCanUserResolvers,
userCanCreatePostType
userCanCreatePostType,
isBlockBasedTheme
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getPostType,
getCachedResolvers,
canUser
canUser,
getCurrentTheme
} = select(external_wp_coreData_namespaceObject.store);
const _postTypeObject = getPostType(postType);
const _resource = _postTypeObject?.rest_base || '';
@@ -26013,7 +26015,8 @@ function usePostActions({
postTypeObject: _postTypeObject,
resource: _resource,
cachedCanUserResolvers: getCachedResolvers()?.canUser,
userCanCreatePostType: canUser('create', _resource)
userCanCreatePostType: canUser('create', _resource),
isBlockBasedTheme: getCurrentTheme()?.is_block_theme
};
}, [postType]);
const trashPostActionForPostType = useTrashPostAction(resource);
@@ -26029,7 +26032,7 @@ function usePostActions({
if (!isLoaded) {
return [];
}
let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, false ? 0 : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, isPattern && exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostActionForPostType, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType].filter(Boolean);
let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, false ? 0 : false, isTemplateOrTemplatePart && userCanCreatePostType && isBlockBasedTheme && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, isPattern && exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostActionForPostType, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType].filter(Boolean);
// 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.
File diff suppressed because one or more lines are too long