diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/js/dist/patterns.js --- a/wp/wp-includes/js/dist/patterns.js Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/js/dist/patterns.js Fri Sep 05 18:52:52 2025 +0200 @@ -60,9 +60,9 @@ isEditingPattern: () => (selectors_isEditingPattern) }); -;// CONCATENATED MODULE: external ["wp","data"] +;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/store/reducer.js +;// ./node_modules/@wordpress/patterns/build-module/store/reducer.js /** * WordPress dependencies */ @@ -80,13 +80,13 @@ isEditingPattern })); -;// CONCATENATED MODULE: external ["wp","blocks"] +;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; -;// CONCATENATED MODULE: external ["wp","coreData"] +;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; -;// CONCATENATED MODULE: external ["wp","blockEditor"] +;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/constants.js +;// ./node_modules/@wordpress/patterns/build-module/constants.js const PATTERN_TYPES = { theme: 'pattern', user: 'wp_block' @@ -108,7 +108,7 @@ }; const PATTERN_OVERRIDES_BINDING_SOURCE = 'core/pattern-overrides'; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/store/actions.js +;// ./node_modules/@wordpress/patterns/build-module/store/actions.js /** * WordPress dependencies */ @@ -191,7 +191,7 @@ delete metadata.bindings; // Use overridden values of the pattern block if they exist. if (existingOverrides?.[metadata.name]) { - // Iterate over each overriden attribute. + // Iterate over each overridden attribute. for (const [attributeName, value] of Object.entries(existingOverrides[metadata.name])) { // Skip if the attribute does not exist in the block type. if (!(0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.attributes[attributeName]) { @@ -226,13 +226,13 @@ }; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/store/constants.js +;// ./node_modules/@wordpress/patterns/build-module/store/constants.js /** * Module Constants */ const STORE_NAME = 'core/patterns'; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/store/selectors.js +;// ./node_modules/@wordpress/patterns/build-module/store/selectors.js /** * Returns true if pattern is in the editing state. * @@ -244,9 +244,9 @@ return state.isEditingPattern[clientId]; } -;// CONCATENATED MODULE: external ["wp","privateApis"] +;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/lock-unlock.js +;// ./node_modules/@wordpress/patterns/build-module/lock-unlock.js /** * WordPress dependencies */ @@ -256,7 +256,7 @@ unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/patterns'); -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/store/index.js +;// ./node_modules/@wordpress/patterns/build-module/store/index.js /** * WordPress dependencies */ @@ -296,13 +296,13 @@ unlock(store).registerPrivateActions(actions_namespaceObject); unlock(store).registerPrivateSelectors(selectors_namespaceObject); -;// CONCATENATED MODULE: external ["wp","components"] +;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; -;// CONCATENATED MODULE: external ["wp","element"] +;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; -;// CONCATENATED MODULE: external ["wp","i18n"] +;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/api/index.js +;// ./node_modules/@wordpress/patterns/build-module/api/index.js /** * Internal dependencies */ @@ -335,9 +335,9 @@ }); } -;// CONCATENATED MODULE: external "ReactJSXRuntime" +;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/overrides-panel.js +;// ./node_modules/@wordpress/patterns/build-module/components/overrides-panel.js /** * WordPress dependencies */ @@ -376,13 +376,13 @@ }); } -;// CONCATENATED MODULE: external ["wp","notices"] +;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; -;// CONCATENATED MODULE: external ["wp","compose"] +;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; -;// CONCATENATED MODULE: external ["wp","htmlEntities"] +;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/category-selector.js +;// ./node_modules/@wordpress/patterns/build-module/components/category-selector.js /** * WordPress dependencies */ @@ -434,7 +434,7 @@ }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/private-hooks.js +;// ./node_modules/@wordpress/patterns/build-module/private-hooks.js /** * WordPress dependencies */ @@ -529,7 +529,7 @@ }; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/create-pattern-modal.js +;// ./node_modules/@wordpress/patterns/build-module/components/create-pattern-modal.js /** * WordPress dependencies */ @@ -549,7 +549,6 @@ - function CreatePatternModal({ className = 'patterns-menu-items__convert-modal', modalTitle, @@ -560,6 +559,8 @@ title: modalTitle || defaultModalTitle, onRequestClose: restProps.onClose, overlayClassName: className, + focusOnMount: "firstContentElement", + size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, { ...restProps }) @@ -633,6 +634,7 @@ onChange: setCategoryTerms, categoryMap: categoryMap }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'), checked: syncType === PATTERN_SYNC_TYPES.full, @@ -662,7 +664,7 @@ }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/duplicate-pattern-modal.js +;// ./node_modules/@wordpress/patterns/build-module/components/duplicate-pattern-modal.js /** * WordPress dependencies */ @@ -680,9 +682,9 @@ function getTermLabels(pattern, categories) { // Theme patterns rely on core pattern categories. if (pattern.type !== PATTERN_TYPES.user) { - return categories.core?.filter(category => pattern.categories.includes(category.name)).map(category => category.label); + return categories.core?.filter(category => pattern.categories?.includes(category.name)).map(category => category.label); } - return categories.user?.filter(category => pattern.wp_pattern_category.includes(category.id)).map(category => category.label); + return categories.user?.filter(category => pattern.wp_pattern_category?.includes(category.id)).map(category => category.label); } function useDuplicatePatternProps({ pattern, @@ -709,14 +711,14 @@ defaultCategories: getTermLabels(pattern, categories), defaultSyncType: pattern.type !== PATTERN_TYPES.user // Theme patterns are unsynced by default. ? PATTERN_SYNC_TYPES.unsynced : pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full, - defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing pattern title */ - (0,external_wp_i18n_namespaceObject.__)('%s (Copy)'), typeof pattern.title === 'string' ? pattern.title : pattern.title.raw), + defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Existing pattern title */ + (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'pattern'), typeof pattern.title === 'string' ? pattern.title : pattern.title.raw), onSuccess: ({ pattern: newPattern }) => { createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The new pattern's title e.g. 'Call to action (copy)'. - (0,external_wp_i18n_namespaceObject.__)('"%s" duplicated.'), newPattern.title.raw), { + (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', 'pattern'), newPattern.title.raw), { type: 'snackbar', id: 'patterns-create' }); @@ -747,7 +749,7 @@ }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-modal.js +;// ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-modal.js /** * WordPress dependencies */ @@ -759,7 +761,6 @@ - function RenamePatternModal({ onClose, onError, @@ -818,6 +819,8 @@ title: (0,external_wp_i18n_namespaceObject.__)('Rename'), ...props, onRequestClose: onClose, + focusOnMount: "firstContentElement", + size: "small", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onRename, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { @@ -848,9 +851,9 @@ }); } -;// CONCATENATED MODULE: external ["wp","primitives"] +;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js +;// ./node_modules/@wordpress/icons/build-module/library/symbol.js /** * WordPress dependencies */ @@ -865,7 +868,7 @@ }); /* harmony default export */ const library_symbol = (symbol); -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/pattern-convert-button.js +;// ./node_modules/@wordpress/patterns/build-module/components/pattern-convert-button.js /** * WordPress dependencies */ @@ -896,8 +899,6 @@ * @return {import('react').ComponentType} The menu control or null. */ - - function PatternConvertButton({ clientIds, rootClientId, @@ -927,6 +928,15 @@ } = select(external_wp_blockEditor_namespaceObject.store); const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined); const blocks = (_getBlocksByClientId = getBlocksByClientId(clientIds)) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : []; + + // Check if the block has reusable support defined. + const hasReusableBlockSupport = blockName => { + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); + const hasParent = blockType && 'parent' in blockType; + + // If the block has a parent, check with false as default, otherwise with true. + return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'reusable', !hasParent); + }; const isReusable = blocks.length === 1 && blocks[0] && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]) && !!select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', blocks[0].attributes.ref); const _canConvert = // Hide when this is already a synced pattern. @@ -938,9 +948,13 @@ // Hide on invalid blocks. block.isValid && // Hide when block doesn't support being made into a pattern. - (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'reusable', true)) && + hasReusableBlockSupport(block.name)) && // Hide when current doesn't have permission to do that. - !!canUser('create', 'blocks'); + // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. + !!canUser('create', { + kind: 'postType', + name: 'wp_block' + }); return _canConvert; }, [clientIds, rootClientId]); const { @@ -993,9 +1007,9 @@ }); } -;// CONCATENATED MODULE: external ["wp","url"] +;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/patterns-manage-button.js +;// ./node_modules/@wordpress/patterns/build-module/components/patterns-manage-button.js /** * WordPress dependencies */ @@ -1013,8 +1027,6 @@ - - function PatternsManageButton({ clientId }) { @@ -1034,12 +1046,19 @@ const reusableBlock = getBlock(clientId); return { canRemove: canRemoveBlock(clientId), - isVisible: !!reusableBlock && (0,external_wp_blocks_namespaceObject.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref), + isVisible: !!reusableBlock && (0,external_wp_blocks_namespaceObject.isReusableBlock)(reusableBlock) && !!canUser('update', { + kind: 'postType', + name: 'wp_block', + id: reusableBlock.attributes.ref + }), innerBlockCount: getBlockCount(clientId), // The site editor and templates both check whether the user // has edit_theme_options capabilities. We can leverage that here // and omit the manage patterns link if the user can't access it. - managePatternsUrl: canUser('create', 'templates') ? (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { + managePatternsUrl: canUser('create', { + kind: 'postType', + name: 'wp_template' + }) ? (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { path: '/patterns' }) : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { post_type: 'wp_block' @@ -1067,7 +1086,7 @@ } /* harmony default export */ const patterns_manage_button = (PatternsManageButton); -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/index.js +;// ./node_modules/@wordpress/patterns/build-module/components/index.js /** * WordPress dependencies */ @@ -1079,8 +1098,6 @@ - - function PatternsMenuItems({ rootClientId }) { @@ -1100,9 +1117,9 @@ }); } -;// CONCATENATED MODULE: external ["wp","a11y"] +;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-category-modal.js +;// ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-category-modal.js /** * WordPress dependencies */ @@ -1120,7 +1137,6 @@ */ - function RenamePatternCategoryModal({ category, existingCategories, @@ -1253,7 +1269,7 @@ }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/allow-overrides-modal.js +;// ./node_modules/@wordpress/patterns/build-module/components/allow-overrides-modal.js /** * WordPress dependencies */ @@ -1262,7 +1278,6 @@ - function AllowOverridesModal({ placeholder, initialName = '', @@ -1274,7 +1289,7 @@ const isNameValid = !!editedBlockName.trim(); const handleSubmit = () => { if (editedBlockName !== initialName) { - const message = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */ + const message = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'), editedBlockName); // Must be assertive to immediately announce change. @@ -1375,7 +1390,7 @@ }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-controls.js +;// ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-controls.js /** * WordPress dependencies */ @@ -1390,26 +1405,6 @@ - - -function removeBindings(bindings) { - let updatedBindings = { - ...bindings - }; - delete updatedBindings.__default; - if (!Object.keys(updatedBindings).length) { - updatedBindings = undefined; - } - return updatedBindings; -} -function addBindings(bindings) { - return { - ...bindings, - __default: { - source: PATTERN_OVERRIDES_BINDING_SOURCE - } - }; -} function PatternOverridesControls({ attributes, setAttributes, @@ -1422,18 +1417,22 @@ const defaultBindings = attributes.metadata?.bindings?.__default; const hasOverrides = hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE; const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE; + const { + updateBlockBindings + } = (0,external_wp_blockEditor_namespaceObject.useBlockBindingsUtils)(); function updateBindings(isChecked, customName) { - const prevBindings = attributes?.metadata?.bindings; - const updatedBindings = isChecked ? addBindings(prevBindings) : removeBindings(prevBindings); - const updatedMetadata = { - ...attributes.metadata, - bindings: updatedBindings - }; if (customName) { - updatedMetadata.name = customName; + setAttributes({ + metadata: { + ...attributes.metadata, + name: customName + } + }); } - setAttributes({ - metadata: updatedMetadata + updateBlockBindings({ + __default: isChecked ? { + source: PATTERN_OVERRIDES_BINDING_SOURCE + } : undefined }); } @@ -1447,6 +1446,7 @@ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "advanced", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { + __nextHasNoMarginBottom: true, id: controlId, label: (0,external_wp_i18n_namespaceObject.__)('Overrides'), help: helpText, @@ -1463,7 +1463,7 @@ } }, disabled: !hasOverrides && hasUnsupportedImageAttributes, - __experimentalIsFocusable: true, + accessibleWhenDisabled: true, children: hasOverrides ? (0,external_wp_i18n_namespaceObject.__)('Disable overrides') : (0,external_wp_i18n_namespaceObject.__)('Enable overrides') }) }) @@ -1481,7 +1481,7 @@ } /* harmony default export */ const pattern_overrides_controls = (PatternOverridesControls); -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/reset-overrides-control.js +;// ./node_modules/@wordpress/patterns/build-module/components/reset-overrides-control.js /** * WordPress dependencies */ @@ -1494,7 +1494,7 @@ function ResetOverridesControl(props) { const name = props.attributes.metadata?.name; const registry = (0,external_wp_data_namespaceObject.useRegistry)(); - const isOverriden = (0,external_wp_data_namespaceObject.useSelect)(select => { + const isOverridden = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!name) { return; } @@ -1545,15 +1545,14 @@ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: onClick, - disabled: !isOverriden, - __experimentalIsFocusable: true, + disabled: !isOverridden, children: (0,external_wp_i18n_namespaceObject.__)('Reset') }) }) }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js +;// ./node_modules/@wordpress/icons/build-module/library/copy.js /** * WordPress dependencies */ @@ -1570,7 +1569,7 @@ }); /* harmony default export */ const library_copy = (copy); -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-block-controls.js +;// ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-block-controls.js /** * WordPress dependencies */ @@ -1588,7 +1587,6 @@ - const { useBlockDisplayTitle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); @@ -1631,7 +1629,7 @@ clientId: clientIds[0], maximumLength: 35 }); - const blockDescription = isSingleBlockSelected ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1s: The block type's name; %2s: The block's user-provided name (the same as the override name). */ + const blockDescription = isSingleBlockSelected ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */ (0,external_wp_i18n_namespaceObject.__)('This %1$s is editable using the "%2$s" override.'), firstBlockTitle.toLowerCase(), firstBlockName) : (0,external_wp_i18n_namespaceObject.__)('These blocks are editable using overrides.'); const descriptionId = (0,external_wp_element_namespaceObject.useId)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { @@ -1650,7 +1648,7 @@ }) }), toggleProps: { - describedBy: blockDescription, + description: blockDescription, ...toggleProps }, menuProps: { @@ -1695,7 +1693,7 @@ }) : null; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/private-apis.js +;// ./node_modules/@wordpress/patterns/build-module/private-apis.js /** * Internal dependencies */ @@ -1736,7 +1734,7 @@ PARTIAL_SYNCING_SUPPORTED_BLOCKS: PARTIAL_SYNCING_SUPPORTED_BLOCKS }); -;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/index.js +;// ./node_modules/@wordpress/patterns/build-module/index.js /** * Internal dependencies */