Fix File
•
/
home
/
sportsfe...
/
httpdocs
/
clone
/
wp-inclu...
/
js
/
dist
•
File:
block-library.js
•
Content:
name: 'core/list-item', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('The Cheshire Cat.') } }, { name: 'core/list-item', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('The Mad Hatter.') } }, { name: 'core/list-item', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('The Queen of Hearts.') } }] }, transforms: list_transforms, edit: list_edit_Edit, save: list_save_save, deprecated: list_deprecated }; const list_init = () => initBlock({ name: list_name, metadata: list_metadata, settings: list_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-item.js /** * WordPress dependencies */ const listItem = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 11v1.5h8V11h-8zm-6-1c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); /* harmony default export */ const list_item = (listItem); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-indent-rtl.js /** * WordPress dependencies */ const formatIndentRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM20.0303 9.03033L17.0607 12L20.0303 14.9697L18.9697 16.0303L15.4697 12.5303L14.9393 12L15.4697 11.4697L18.9697 7.96967L20.0303 9.03033Z" }) }); /* harmony default export */ const format_indent_rtl = (formatIndentRTL); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-indent.js /** * WordPress dependencies */ const formatIndent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z" }) }); /* harmony default export */ const format_indent = (formatIndent); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-indent-list-item.js /** * WordPress dependencies */ function useIndentListItem(clientId) { const { replaceBlocks, selectionChange, multiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { getBlock, getPreviousBlockClientId, getSelectionStart, getSelectionEnd, hasMultiSelection, getMultiSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); return (0,external_wp_element_namespaceObject.useCallback)(() => { const _hasMultiSelection = hasMultiSelection(); const clientIds = _hasMultiSelection ? getMultiSelectedBlockClientIds() : [clientId]; const clonedBlocks = clientIds.map(_clientId => (0,external_wp_blocks_namespaceObject.cloneBlock)(getBlock(_clientId))); const previousSiblingId = getPreviousBlockClientId(clientId); const newListItem = (0,external_wp_blocks_namespaceObject.cloneBlock)(getBlock(previousSiblingId)); // If the sibling has no innerBlocks, create a new `list` block. if (!newListItem.innerBlocks?.length) { newListItem.innerBlocks = [(0,external_wp_blocks_namespaceObject.createBlock)('core/list')]; } // A list item usually has one `list`, but it's possible to have // more. So we need to preserve the previous `list` blocks and // merge the new blocks to the last `list`. newListItem.innerBlocks[newListItem.innerBlocks.length - 1].innerBlocks.push(...clonedBlocks); // We get the selection start/end here, because when // we replace blocks, the selection is updated too. const selectionStart = getSelectionStart(); const selectionEnd = getSelectionEnd(); // Replace the previous sibling of the block being indented and the indented blocks, // with a new block whose attributes are equal to the ones of the previous sibling and // whose descendants are the children of the previous sibling, followed by the indented blocks. replaceBlocks([previousSiblingId, ...clientIds], [newListItem]); if (!_hasMultiSelection) { selectionChange(clonedBlocks[0].clientId, selectionEnd.attributeKey, selectionEnd.clientId === selectionStart.clientId ? selectionStart.offset : selectionEnd.offset, selectionEnd.offset); } else { multiSelect(clonedBlocks[0].clientId, clonedBlocks[clonedBlocks.length - 1].clientId); } return true; }, [clientId]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-outdent-list-item.js /** * WordPress dependencies */ function useOutdentListItem() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { moveBlocksToPosition, removeBlock, insertBlock, updateBlockListSettings } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { getBlockRootClientId, getBlockName, getBlockOrder, getBlockIndex, getSelectedBlockClientIds, getBlock, getBlockListSettings } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); function getParentListItemId(id) { const listId = getBlockRootClientId(id); const parentListItemId = getBlockRootClientId(listId); if (!parentListItemId) { return; } if (getBlockName(parentListItemId) !== 'core/list-item') { return; } return parentListItemId; } return (0,external_wp_element_namespaceObject.useCallback)((clientIds = getSelectedBlockClientIds()) => { if (!Array.isArray(clientIds)) { clientIds = [clientIds]; } if (!clientIds.length) { return; } const firstClientId = clientIds[0]; // Can't outdent if it's not a list item. if (getBlockName(firstClientId) !== 'core/list-item') { return; } const parentListItemId = getParentListItemId(firstClientId); // Can't outdent if it's at the top level. if (!parentListItemId) { return; } const parentListId = getBlockRootClientId(firstClientId); const lastClientId = clientIds[clientIds.length - 1]; const order = getBlockOrder(parentListId); const followingListItems = order.slice(getBlockIndex(lastClientId) + 1); registry.batch(() => { if (followingListItems.length) { let nestedListId = getBlockOrder(firstClientId)[0]; if (!nestedListId) { const nestedListBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(getBlock(parentListId), {}, []); nestedListId = nestedListBlock.clientId; insertBlock(nestedListBlock, 0, firstClientId, false); // Immediately update the block list settings, otherwise // blocks can't be moved here due to canInsert checks. updateBlockListSettings(nestedListId, getBlockListSettings(parentListId)); } moveBlocksToPosition(followingListItems, parentListId, nestedListId); } moveBlocksToPosition(clientIds, parentListId, getBlockRootClientId(parentListItemId), getBlockIndex(parentListItemId) + 1); if (!getBlockOrder(parentListId).length) { const shouldSelectParent = false; removeBlock(parentListId, shouldSelectParent); } }); return true; }, []); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-enter.js /** * WordPress dependencies */ /** * Internal dependencies */ function use_enter_useEnter(props) { const { replaceBlocks, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { getBlock, getBlockRootClientId, getBlockIndex, getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); propsRef.current = props; const outdentListItem = useOutdentListItem(); return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { function onKeyDown(event) { if (event.defaultPrevented || event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { return; } const { content, clientId } = propsRef.current; if (content.length) { return; } event.preventDefault(); const canOutdent = getBlockName(getBlockRootClientId(getBlockRootClientId(propsRef.current.clientId))) === 'core/list-item'; if (canOutdent) { outdentListItem(); return; } // Here we are in top level list so we need to split. const topParentListBlock = getBlock(getBlockRootClientId(clientId)); const blockIndex = getBlockIndex(clientId); const head = (0,external_wp_blocks_namespaceObject.cloneBlock)({ ...topParentListBlock, innerBlocks: topParentListBlock.innerBlocks.slice(0, blockIndex) }); const middle = (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()); // Last list item might contain a `list` block innerBlock // In that case append remaining innerBlocks blocks. const after = [...(topParentListBlock.innerBlocks[blockIndex].innerBlocks[0]?.innerBlocks || []), ...topParentListBlock.innerBlocks.slice(blockIndex + 1)]; const tail = after.length ? [(0,external_wp_blocks_namespaceObject.cloneBlock)({ ...topParentListBlock, innerBlocks: after })] : []; replaceBlocks(topParentListBlock.clientId, [head, middle, ...tail], 1); // We manually change the selection here because we are replacing // a different block than the selected one. selectionChange(middle.clientId); } element.addEventListener('keydown', onKeyDown); return () => { element.removeEventListener('keydown', onKeyDown); }; }, []); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-space.js /** * WordPress dependencies */ /** * Internal dependencies */ function useSpace(clientId) { const { getSelectionStart, getSelectionEnd, getBlockIndex } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const indentListItem = useIndentListItem(clientId); const outdentListItem = useOutdentListItem(); return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { function onKeyDown(event) { const { keyCode, shiftKey, altKey, metaKey, ctrlKey } = event; if (event.defaultPrevented || keyCode !== external_wp_keycodes_namespaceObject.SPACE && keyCode !== external_wp_keycodes_namespaceObject.TAB || // Only override when no modifiers are pressed. altKey || metaKey || ctrlKey) { return; } const selectionStart = getSelectionStart(); const selectionEnd = getSelectionEnd(); if (selectionStart.offset === 0 && selectionEnd.offset === 0) { if (shiftKey) { // Note that backspace behaviour in defined in onMerge. if (keyCode === external_wp_keycodes_namespaceObject.TAB) { if (outdentListItem()) { event.preventDefault(); } } } else if (getBlockIndex(clientId) !== 0) { if (indentListItem()) { event.preventDefault(); } } } } element.addEventListener('keydown', onKeyDown); return () => { element.removeEventListener('keydown', onKeyDown); }; }, [clientId, indentListItem]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-merge.js /** * WordPress dependencies */ /** * Internal dependencies */ function useMerge(clientId, onMerge) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getPreviousBlockClientId, getNextBlockClientId, getBlockOrder, getBlockRootClientId, getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const { mergeBlocks, moveBlocksToPosition } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const outdentListItem = useOutdentListItem(); function getTrailingId(id) { const order = getBlockOrder(id); if (!order.length) { return id; } return getTrailingId(order[order.length - 1]); } function getParentListItemId(id) { const listId = getBlockRootClientId(id); const parentListItemId = getBlockRootClientId(listId); if (!parentListItemId) { return; } if (getBlockName(parentListItemId) !== 'core/list-item') { return; } return parentListItemId; } /** * Return the next list item with respect to the given list item. If none, * return the next list item of the parent list item if it exists. * * @param {string} id A list item client ID. * @return {string?} The client ID of the next list item. */ function _getNextId(id) { const next = getNextBlockClientId(id); if (next) { return next; } const parentListItemId = getParentListItemId(id); if (!parentListItemId) { return; } return _getNextId(parentListItemId); } /** * Given a client ID, return the client ID of the list item on the next * line, regardless of indentation level. * * @param {string} id The client ID of the current list item. * @return {string?} The client ID of the next list item. */ function getNextId(id) { const order = getBlockOrder(id); // If the list item does not have a nested list, return the next list // item. if (!order.length) { return _getNextId(id); } // Get the first list item in the nested list. return getBlockOrder(order[0])[0]; } return forward => { function mergeWithNested(clientIdA, clientIdB) { registry.batch(() => { // When merging a sub list item with a higher next list item, we // also need to move any nested list items. Check if there's a // listed list, and append its nested list items to the current // list. const [nestedListClientId] = getBlockOrder(clientIdB); if (nestedListClientId) { // If we are merging with the previous list item, and the // previous list item does not have nested list, move the // nested list to the previous list item. if (getPreviousBlockClientId(clientIdB) === clientIdA && !getBlockOrder(clientIdA).length) { moveBlocksToPosition([nestedListClientId], clientIdB, clientIdA); } else { moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(clientIdA)); } } mergeBlocks(clientIdA, clientIdB); }); } if (forward) { const nextBlockClientId = getNextId(clientId); if (!nextBlockClientId) { onMerge(forward); return; } if (getParentListItemId(nextBlockClientId)) { outdentListItem(nextBlockClientId); } else { mergeWithNested(clientId, nextBlockClientId); } } else { // Merging is only done from the top level. For lowel levels, the // list item is outdented instead. const previousBlockClientId = getPreviousBlockClientId(clientId); if (getParentListItemId(clientId)) { outdentListItem(clientId); } else if (previousBlockClientId) { const trailingId = getTrailingId(previousBlockClientId); mergeWithNested(trailingId, clientId); } else { onMerge(forward); } } }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ function edit_IndentUI({ clientId }) { const indentListItem = useIndentListItem(clientId); const outdentListItem = useOutdentListItem(); const { canIndent, canOutdent } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockIndex, getBlockRootClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); return { canIndent: getBlockIndex(clientId) > 0, canOutdent: getBlockName(getBlockRootClientId(getBlockRootClientId(clientId))) === 'core/list-item' }; }, [clientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_outdent_rtl : format_outdent, title: (0,external_wp_i18n_namespaceObject.__)('Outdent'), describedBy: (0,external_wp_i18n_namespaceObject.__)('Outdent list item'), disabled: !canOutdent, onClick: () => outdentListItem() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_indent_rtl : format_indent, title: (0,external_wp_i18n_namespaceObject.__)('Indent'), describedBy: (0,external_wp_i18n_namespaceObject.__)('Indent list item'), isDisabled: !canIndent, onClick: () => indentListItem() })] }); } function ListItemEdit({ attributes, setAttributes, clientId, mergeBlocks }) { const { placeholder, content } = attributes; const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, { renderAppender: false, __unstableDisableDropZone: true }); const useEnterRef = use_enter_useEnter({ content, clientId }); const useSpaceRef = useSpace(clientId); const onMerge = useMerge(clientId, mergeBlocks); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { ...innerBlocksProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([useEnterRef, useSpaceRef]), identifier: "content", tagName: "div", onChange: nextContent => setAttributes({ content: nextContent }), value: content, "aria-label": (0,external_wp_i18n_namespaceObject.__)('List text'), placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('List'), onMerge: onMerge }), innerBlocksProps.children] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "block", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(edit_IndentUI, { clientId: clientId }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/save.js /** * WordPress dependencies */ function list_item_save_save({ attributes }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save(), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: attributes.content }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {})] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/transforms.js /** * WordPress dependencies */ const list_item_transforms_transforms = { to: [{ type: 'block', blocks: ['core/paragraph'], transform: (attributes, innerBlocks = []) => [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', attributes), ...innerBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block))] }] }; /* harmony default export */ const list_item_transforms = (list_item_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const list_item_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/list-item", title: "List item", category: "text", parent: ["core/list"], allowedBlocks: ["core/list"], description: "Create a list item.", textdomain: "default", attributes: { placeholder: { type: "string" }, content: { type: "rich-text", source: "rich-text", selector: "li", __experimentalRole: "content" } }, supports: { className: false, __experimentalSelector: ".wp-block-list > li", splitting: true, spacing: { margin: true, padding: true, __experimentalDefaultControls: { margin: false, padding: false } }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } } }; const { name: list_item_name } = list_item_metadata; const list_item_settings = { icon: list_item, edit: ListItemEdit, save: list_item_save_save, merge(attributes, attributesToMerge) { return { ...attributes, content: attributes.content + attributesToMerge.content }; }, transforms: list_item_transforms, [unlock(external_wp_blockEditor_namespaceObject.privateApis).requiresWrapperOnCopy]: true }; const list_item_init = () => initBlock({ name: list_item_name, metadata: list_item_metadata, settings: list_item_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/login.js /** * WordPress dependencies */ const login = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 14.5l1.1 1.1 3-3 .5-.5-.6-.6-3-3-1 1 1.7 1.7H5v1.5h7.7L11 14.5zM16.8 5h-7c-1.1 0-2 .9-2 2v1.5h1.5V7c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v10c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5v-1.5H7.8V17c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z" }) }); /* harmony default export */ const library_login = (login); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/loginout/edit.js /** * WordPress dependencies */ function LoginOutEdit({ attributes, setAttributes }) { const { displayLoginAsForm, redirectToCurrent } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display login as form'), checked: displayLoginAsForm, onChange: () => setAttributes({ displayLoginAsForm: !displayLoginAsForm }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Redirect to current URL'), checked: redirectToCurrent, onChange: () => setAttributes({ redirectToCurrent: !redirectToCurrent }) })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: 'logged-in' }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: "#login-pseudo-link", children: (0,external_wp_i18n_namespaceObject.__)('Log out') }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/loginout/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const loginout_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/loginout", title: "Login/out", category: "theme", description: "Show login & logout links.", keywords: ["login", "logout", "form"], textdomain: "default", attributes: { displayLoginAsForm: { type: "boolean", "default": false }, redirectToCurrent: { type: "boolean", "default": true } }, supports: { className: true, spacing: { margin: true, padding: true, __experimentalDefaultControls: { margin: false, padding: false } }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } } }; const { name: loginout_name } = loginout_metadata; const loginout_settings = { icon: library_login, edit: LoginOutEdit }; const loginout_init = () => initBlock({ name: loginout_name, metadata: loginout_metadata, settings: loginout_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media-and-text.js /** * WordPress dependencies */ const mediaAndText = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3 6v11.5h8V6H3Zm11 3h7V7.5h-7V9Zm7 3.5h-7V11h7v1.5ZM14 16h7v-1.5h-7V16Z" }) }); /* harmony default export */ const media_and_text = (mediaAndText); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/constants.js /** * WordPress dependencies */ const DEFAULT_MEDIA_SIZE_SLUG = 'full'; const WIDTH_CONSTRAINT_PERCENTAGE = 15; const media_text_constants_LINK_DESTINATION_MEDIA = 'media'; const media_text_constants_LINK_DESTINATION_ATTACHMENT = 'attachment'; const constants_TEMPLATE = [['core/paragraph', { placeholder: (0,external_wp_i18n_namespaceObject._x)('Content…', 'content placeholder') }]]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/deprecated.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const v1ToV5ImageFillStyles = (url, focalPoint) => { return url ? { backgroundImage: `url(${url})`, backgroundPosition: focalPoint ? `${focalPoint.x * 100}% ${focalPoint.y * 100}%` : `50% 50%` } : {}; }; const v6ImageFillStyles = (url, focalPoint) => { return url ? { backgroundImage: `url(${url})`, backgroundPosition: focalPoint ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : `50% 50%` } : {}; }; const DEFAULT_MEDIA_WIDTH = 50; const noop = () => {}; const media_text_deprecated_migrateCustomColors = attributes => { if (!attributes.customBackgroundColor) { return attributes; } const style = { color: { background: attributes.customBackgroundColor } }; const { customBackgroundColor, ...restAttributes } = attributes; return { ...restAttributes, style }; }; // After align attribute's default was updated this function explicitly sets // the align value for deprecated blocks to the `wide` value which was default // for their versions of this block. const migrateDefaultAlign = attributes => { if (attributes.align) { return attributes; } return { ...attributes, align: 'wide' }; }; const v0Attributes = { align: { type: 'string', default: 'wide' }, mediaAlt: { type: 'string', source: 'attribute', selector: 'figure img', attribute: 'alt', default: '' }, mediaPosition: { type: 'string', default: 'left' }, mediaId: { type: 'number' }, mediaType: { type: 'string' }, mediaWidth: { type: 'number', default: 50 }, isStackedOnMobile: { type: 'boolean', default: false } }; const v4ToV5BlockAttributes = { ...v0Attributes, isStackedOnMobile: { type: 'boolean', default: true }, mediaUrl: { type: 'string', source: 'attribute', selector: 'figure video,figure img', attribute: 'src' }, mediaLink: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'target' }, href: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'href' }, rel: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'class' }, mediaSizeSlug: { type: 'string' }, verticalAlignment: { type: 'string' }, imageFill: { type: 'boolean' }, focalPoint: { type: 'object' } }; const v6Attributes = { ...v4ToV5BlockAttributes, mediaAlt: { type: 'string', source: 'attribute', selector: 'figure img', attribute: 'alt', default: '', __experimentalRole: 'content' }, mediaId: { type: 'number', __experimentalRole: 'content' }, mediaUrl: { type: 'string', source: 'attribute', selector: 'figure video,figure img', attribute: 'src', __experimentalRole: 'content' }, href: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'href', __experimentalRole: 'content' }, mediaType: { type: 'string', __experimentalRole: 'content' } }; const v4ToV5Supports = { anchor: true, align: ['wide', 'full'], html: false, color: { gradients: true, link: true } }; const v6Supports = { ...v4ToV5Supports, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } } }; // Version with wide as the default alignment. // See: https://github.com/WordPress/gutenberg/pull/48404 const media_text_deprecated_v6 = { attributes: v6Attributes, supports: v6Supports, save({ attributes }) { const { isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth, mediaId, verticalAlignment, imageFill, focalPoint, linkClass, href, linkTarget, rel } = attributes; const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; const newRel = !rel ? undefined : rel; const imageClasses = dist_clsx({ [`wp-image-${mediaId}`]: mediaId && mediaType === 'image', [`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image' }); let image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt, className: imageClasses || null }); if (href) { image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }); } const mediaTypeRenders = { image: () => image, video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const backgroundStyles = imageFill ? v6ImageFillStyles(mediaUrl, focalPoint) : {}; let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { gridTemplateColumns }; if ('right' === mediaPosition) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) })] }); }, migrate: migrateDefaultAlign, isEligible(attributes, innerBlocks, { block }) { const { attributes: finalizedAttributes } = block; // When the align attribute defaults to none, valid block markup should // not contain any alignment CSS class. Unfortunately, this // deprecation's version of the block won't be invalidated due to the // alignwide class still being in the markup. That is because the custom // CSS classname support picks it up and adds it to the className // attribute. At the time of parsing, the className attribute won't // contain the alignwide class, hence the need to check the finalized // block attributes. return attributes.align === undefined && !!finalizedAttributes.className?.includes('alignwide'); } }; // Version with non-rounded background position attribute for focal point. // See: https://github.com/WordPress/gutenberg/pull/33915 const media_text_deprecated_v5 = { attributes: v4ToV5BlockAttributes, supports: v4ToV5Supports, save({ attributes }) { const { isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth, mediaId, verticalAlignment, imageFill, focalPoint, linkClass, href, linkTarget, rel } = attributes; const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; const newRel = !rel ? undefined : rel; const imageClasses = dist_clsx({ [`wp-image-${mediaId}`]: mediaId && mediaType === 'image', [`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image' }); let image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt, className: imageClasses || null }); if (href) { image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }); } const mediaTypeRenders = { image: () => image, video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {}; let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { gridTemplateColumns }; if ('right' === mediaPosition) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) })] }); }, migrate: migrateDefaultAlign }; // Version with CSS grid // See: https://github.com/WordPress/gutenberg/pull/40806 const media_text_deprecated_v4 = { attributes: v4ToV5BlockAttributes, supports: v4ToV5Supports, save({ attributes }) { const { isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth, mediaId, verticalAlignment, imageFill, focalPoint, linkClass, href, linkTarget, rel } = attributes; const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; const newRel = !rel ? undefined : rel; const imageClasses = dist_clsx({ [`wp-image-${mediaId}`]: mediaId && mediaType === 'image', [`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image' }); let image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt, className: imageClasses || null }); if (href) { image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }); } const mediaTypeRenders = { image: () => image, video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {}; let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { gridTemplateColumns }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) })] }); }, migrate: migrateDefaultAlign }; // Version with ad-hoc color attributes // See: https://github.com/WordPress/gutenberg/pull/21169 const media_text_deprecated_v3 = { attributes: { ...v0Attributes, isStackedOnMobile: { type: 'boolean', default: true }, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, mediaLink: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'target' }, href: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'href' }, rel: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure a', attribute: 'class' }, verticalAlignment: { type: 'string' }, imageFill: { type: 'boolean' }, focalPoint: { type: 'object' } }, migrate: (0,external_wp_compose_namespaceObject.compose)(media_text_deprecated_migrateCustomColors, migrateDefaultAlign), save({ attributes }) { const { backgroundColor, customBackgroundColor, isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth, mediaId, verticalAlignment, imageFill, focalPoint, linkClass, href, linkTarget, rel } = attributes; const newRel = !rel ? undefined : rel; let image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt, className: mediaId && mediaType === 'image' ? `wp-image-${mediaId}` : null }); if (href) { image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }); } const mediaTypeRenders = { image: () => image, video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor); const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, 'has-background': backgroundClass || customBackgroundColor, [backgroundClass]: backgroundClass, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {}; let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, gridTemplateColumns }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, style: style, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-media-text__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) })] }); } }; // Version with stack on mobile off by default // See: https://github.com/WordPress/gutenberg/pull/14364 const media_text_deprecated_v2 = { attributes: { ...v0Attributes, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, mediaUrl: { type: 'string', source: 'attribute', selector: 'figure video,figure img', attribute: 'src' }, verticalAlignment: { type: 'string' }, imageFill: { type: 'boolean' }, focalPoint: { type: 'object' } }, migrate: (0,external_wp_compose_namespaceObject.compose)(media_text_deprecated_migrateCustomColors, migrateDefaultAlign), save({ attributes }) { const { backgroundColor, customBackgroundColor, isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth, mediaId, verticalAlignment, imageFill, focalPoint } = attributes; const mediaTypeRenders = { image: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt, className: mediaId && mediaType === 'image' ? `wp-image-${mediaId}` : null }), video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor); const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, [backgroundClass]: backgroundClass, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {}; let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, gridTemplateColumns }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, style: style, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-media-text__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) })] }); } }; // Version without the wp-image-#### class on image // See: https://github.com/WordPress/gutenberg/pull/11922 const media_text_deprecated_v1 = { attributes: { ...v0Attributes, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, mediaUrl: { type: 'string', source: 'attribute', selector: 'figure video,figure img', attribute: 'src' } }, migrate: migrateDefaultAlign, save({ attributes }) { const { backgroundColor, customBackgroundColor, isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth } = attributes; const mediaTypeRenders = { image: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt }), video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor); const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, [backgroundClass]: backgroundClass, 'is-stacked-on-mobile': isStackedOnMobile }); let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, gridTemplateColumns }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: className, style: style, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", children: (mediaTypeRenders[mediaType] || noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-media-text__content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) })] }); } }; /* harmony default export */ const media_text_deprecated = ([media_text_deprecated_v6, media_text_deprecated_v5, media_text_deprecated_v4, media_text_deprecated_v3, media_text_deprecated_v2, media_text_deprecated_v1]); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pull-left.js /** * WordPress dependencies */ const pullLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 18h6V6H4v12zm9-9.5V10h7V8.5h-7zm0 7h7V14h-7v1.5z" }) }); /* harmony default export */ const pull_left = (pullLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pull-right.js /** * WordPress dependencies */ const pullRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14 6v12h6V6h-6zM4 10h7V8.5H4V10zm0 5.5h7V14H4v1.5z" }) }); /* harmony default export */ const pull_right = (pullRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js /** * WordPress dependencies */ const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" })] }); /* harmony default export */ const library_media = (media); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/media-container.js /** * External dependencies */ /** * WordPress dependencies */ /** * Constants */ const media_container_ALLOWED_MEDIA_TYPES = ['image', 'video']; const media_container_noop = () => {}; function imageFillStyles(url, focalPoint) { return url ? { backgroundImage: `url(${url})`, backgroundPosition: focalPoint ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : `50% 50%` } : {}; } const ResizableBoxContainer = (0,external_wp_element_namespaceObject.forwardRef)(({ isSelected, isStackedOnMobile, ...props }, ref) => { const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { ref: ref, showHandle: isSelected && (!isMobile || !isStackedOnMobile), ...props }); }); function ToolbarEditButton({ mediaId, mediaUrl, onSelectMedia, toggleUseFeaturedImage, useFeaturedImage, featuredImageURL }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, { mediaId: mediaId, mediaUrl: useFeaturedImage && featuredImageURL ? featuredImageURL : mediaUrl, allowedTypes: media_container_ALLOWED_MEDIA_TYPES, accept: "image/*,video/*", onSelect: onSelectMedia, onToggleFeaturedImage: toggleUseFeaturedImage, useFeaturedImage: useFeaturedImage }) }); } function PlaceholderContainer({ className, mediaUrl, onSelectMedia, toggleUseFeaturedImage }) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const onUploadError = message => { createErrorNotice(message, { type: 'snackbar' }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_media }), labels: { title: (0,external_wp_i18n_namespaceObject.__)('Media area') }, className: className, onSelect: onSelectMedia, accept: "image/*,video/*", onToggleFeaturedImage: toggleUseFeaturedImage, allowedTypes: media_container_ALLOWED_MEDIA_TYPES, onError: onUploadError, disableMediaButtons: mediaUrl }); } function MediaContainer(props, ref) { const { className, commitWidthChange, focalPoint, imageFill, isSelected, isStackedOnMobile, mediaAlt, mediaId, mediaPosition, mediaType, mediaUrl, mediaWidth, onSelectMedia, onWidthChange, enableResize, toggleUseFeaturedImage, useFeaturedImage, featuredImageURL, featuredImageAlt } = props; const isTemporaryMedia = !mediaId && (0,external_wp_blob_namespaceObject.isBlobURL)(mediaUrl); const { toggleSelection } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); if (mediaUrl || featuredImageURL || useFeaturedImage) { const onResizeStart = () => { toggleSelection(false); }; const onResize = (event, direction, elt) => { onWidthChange(parseInt(elt.style.width)); }; const onResizeStop = (event, direction, elt) => { toggleSelection(true); commitWidthChange(parseInt(elt.style.width)); }; const enablePositions = { right: enableResize && mediaPosition === 'left', left: enableResize && mediaPosition === 'right' }; const backgroundStyles = mediaType === 'image' && imageFill ? imageFillStyles(mediaUrl || featuredImageURL, focalPoint) : {}; const mediaTypeRenderers = { image: () => useFeaturedImage && featuredImageURL ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: featuredImageURL, alt: featuredImageAlt }) : mediaUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt }), video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ResizableBoxContainer, { as: "figure", className: dist_clsx(className, 'editor-media-container__resizer', { 'is-transient': isTemporaryMedia }), style: backgroundStyles, size: { width: mediaWidth + '%' }, minWidth: "10%", maxWidth: "100%", enable: enablePositions, onResizeStart: onResizeStart, onResize: onResize, onResizeStop: onResizeStop, axis: "x", isSelected: isSelected, isStackedOnMobile: isStackedOnMobile, ref: ref, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ToolbarEditButton, { onSelectMedia: onSelectMedia, mediaUrl: useFeaturedImage && featuredImageURL ? featuredImageURL : mediaUrl, mediaId: mediaId, toggleUseFeaturedImage: toggleUseFeaturedImage, useFeaturedImage: useFeaturedImage }), (mediaTypeRenderers[mediaType] || media_container_noop)(), isTemporaryMedia && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !useFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderContainer, { ...props }), !featuredImageURL && useFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { className: "wp-block-media-text--placeholder-image", withIllustration: true })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderContainer, { ...props }); } /* harmony default export */ const media_container = ((0,external_wp_element_namespaceObject.forwardRef)(MediaContainer)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const { ResolutionTool: edit_ResolutionTool } = unlock(external_wp_blockEditor_namespaceObject.privateApis); // this limits the resize to a safe zone to avoid making broken layouts const applyWidthConstraints = width => Math.max(WIDTH_CONSTRAINT_PERCENTAGE, Math.min(width, 100 - WIDTH_CONSTRAINT_PERCENTAGE)); function getImageSourceUrlBySizeSlug(image, slug) { // eslint-disable-next-line camelcase return image?.media_details?.sizes?.[slug]?.source_url; } function edit_attributesFromMedia({ attributes: { linkDestination, href }, setAttributes }) { return media => { if (!media || !media.url) { setAttributes({ mediaAlt: undefined, mediaId: undefined, mediaType: undefined, mediaUrl: undefined, mediaLink: undefined, href: undefined, focalPoint: undefined }); return; } if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { media.type = (0,external_wp_blob_namespaceObject.getBlobTypeByURL)(media.url); } let mediaType; let src; // For media selections originated from a file upload. if (media.media_type) { if (media.media_type === 'image') { mediaType = 'image'; } else { // only images and videos are accepted so if the media_type is not an image we can assume it is a video. // video contain the media type of 'file' in the object returned from the rest api. mediaType = 'video'; } } else { // For media selections originated from existing files in the media library. mediaType = media.type; } if (mediaType === 'image') { // Try the "large" size URL, falling back to the "full" size URL below. src = media.sizes?.large?.url || // eslint-disable-next-line camelcase media.media_details?.sizes?.large?.source_url; } let newHref = href; if (linkDestination === media_text_constants_LINK_DESTINATION_MEDIA) { // Update the media link. newHref = media.url; } // Check if the image is linked to the attachment page. if (linkDestination === media_text_constants_LINK_DESTINATION_ATTACHMENT) { // Update the media link. newHref = media.link; } setAttributes({ mediaAlt: media.alt, mediaId: media.id, mediaType, mediaUrl: src || media.url, mediaLink: media.link || undefined, href: newHref, focalPoint: undefined }); }; } function MediaTextEdit({ attributes, isSelected, setAttributes, context: { postId, postType } }) { const { focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaPosition, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment, allowedBlocks, useFeaturedImage } = attributes; const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; const [featuredImage] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'featured_media', postId); const featuredImageMedia = (0,external_wp_data_namespaceObject.useSelect)(select => featuredImage && select(external_wp_coreData_namespaceObject.store).getMedia(featuredImage, { context: 'view' }), [featuredImage]); const featuredImageURL = useFeaturedImage ? featuredImageMedia?.source_url : ''; const featuredImageAlt = useFeaturedImage ? featuredImageMedia?.alt_text : ''; const toggleUseFeaturedImage = () => { setAttributes({ imageFill: false, mediaType: 'image', mediaId: undefined, mediaUrl: undefined, mediaAlt: undefined, mediaLink: undefined, linkDestination: undefined, linkTarget: undefined, linkClass: undefined, rel: undefined, href: undefined, useFeaturedImage: !useFeaturedImage }); }; const { imageSizes, image } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); return { image: mediaId && isSelected ? select(external_wp_coreData_namespaceObject.store).getMedia(mediaId, { context: 'view' }) : null, imageSizes: getSettings()?.imageSizes }; }, [isSelected, mediaId]); const refMediaContainer = (0,external_wp_element_namespaceObject.useRef)(); const imperativeFocalPointPreview = value => { const { style } = refMediaContainer.current.resizable; const { x, y } = value; style.backgroundPosition = `${x * 100}% ${y * 100}%`; }; const [temporaryMediaWidth, setTemporaryMediaWidth] = (0,external_wp_element_namespaceObject.useState)(null); const onSelectMedia = edit_attributesFromMedia({ attributes, setAttributes }); const onSetHref = props => { setAttributes(props); }; const onWidthChange = width => { setTemporaryMediaWidth(applyWidthConstraints(width)); }; const commitWidthChange = width => { setAttributes({ mediaWidth: applyWidthConstraints(width) }); setTemporaryMediaWidth(null); }; const classNames = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, 'is-selected': isSelected, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const widthString = `${temporaryMediaWidth || mediaWidth}%`; const gridTemplateColumns = 'right' === mediaPosition ? `1fr ${widthString}` : `${widthString} 1fr`; const style = { gridTemplateColumns, msGridColumns: gridTemplateColumns }; const onMediaAltChange = newMediaAlt => { setAttributes({ mediaAlt: newMediaAlt }); }; const onVerticalAlignmentChange = alignment => { setAttributes({ verticalAlignment: alignment }); }; const imageSizeOptions = imageSizes.filter(({ slug }) => getImageSourceUrlBySizeSlug(image, slug)).map(({ name, slug }) => ({ value: slug, label: name })); const updateImage = newMediaSizeSlug => { const newUrl = getImageSourceUrlBySizeSlug(image, newMediaSizeSlug); if (!newUrl) { return null; } setAttributes({ mediaUrl: newUrl, mediaSizeSlug: newMediaSizeSlug }); }; const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const mediaTextGeneralSettings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Settings'), resetAll: () => { setAttributes({ isStackedOnMobile: true, imageFill: false, mediaAlt: '', focalPoint: undefined, mediaWidth: 50, mediaSizeSlug: undefined }); }, dropdownMenuProps: dropdownMenuProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Media width'), isShownByDefault: true, hasValue: () => mediaWidth !== 50, onDeselect: () => setAttributes({ mediaWidth: 50 }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Media width'), value: temporaryMediaWidth || mediaWidth, onChange: commitWidthChange, min: WIDTH_CONSTRAINT_PERCENTAGE, max: 100 - WIDTH_CONSTRAINT_PERCENTAGE }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Stack on mobile'), isShownByDefault: true, hasValue: () => !isStackedOnMobile, onDeselect: () => setAttributes({ isStackedOnMobile: true }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Stack on mobile'), checked: isStackedOnMobile, onChange: () => setAttributes({ isStackedOnMobile: !isStackedOnMobile }) }) }), mediaType === 'image' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Crop image to fill'), isShownByDefault: true, hasValue: () => !!imageFill, onDeselect: () => setAttributes({ imageFill: false }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Crop image to fill'), checked: !!imageFill, onChange: () => setAttributes({ imageFill: !imageFill }) }) }), imageFill && (mediaUrl || featuredImageURL) && mediaType === 'image' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Focal point'), isShownByDefault: true, hasValue: () => !!focalPoint, onDeselect: () => setAttributes({ focalPoint: undefined }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FocalPointPicker, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Focal point'), url: useFeaturedImage && featuredImageURL ? featuredImageURL : mediaUrl, value: focalPoint, onChange: value => setAttributes({ focalPoint: value }), onDragStart: imperativeFocalPointPreview, onDrag: imperativeFocalPointPreview }) }), mediaType === 'image' && mediaUrl && !useFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'), isShownByDefault: true, hasValue: () => !!mediaAlt, onDeselect: () => setAttributes({ mediaAlt: '' }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'), value: mediaAlt, onChange: onMediaAltChange, help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. (0,external_wp_i18n_namespaceObject.__)('https://www.w3.org/WAI/tutorials/images/decision-tree/'), children: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')] }) }) }), mediaType === 'image' && !useFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(edit_ResolutionTool, { value: mediaSizeSlug, options: imageSizeOptions, onChange: updateImage })] }); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: classNames, style }); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({ className: 'wp-block-media-text__content' }, { template: constants_TEMPLATE, allowedBlocks }); const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: mediaTextGeneralSettings }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "block", children: [blockEditingMode === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockVerticalAlignmentControl, { onChange: onVerticalAlignmentChange, value: verticalAlignment }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: pull_left, title: (0,external_wp_i18n_namespaceObject.__)('Show media on left'), isActive: mediaPosition === 'left', onClick: () => setAttributes({ mediaPosition: 'left' }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: pull_right, title: (0,external_wp_i18n_namespaceObject.__)('Show media on right'), isActive: mediaPosition === 'right', onClick: () => setAttributes({ mediaPosition: 'right' }) })] }), mediaType === 'image' && !useFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalImageURLInputUI, { url: href || '', onChangeUrl: onSetHref, linkDestination: linkDestination, mediaType: mediaType, mediaUrl: image && image.source_url, mediaLink: image && image.link, linkTarget: linkTarget, linkClass: linkClass, rel: rel })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...blockProps, children: [mediaPosition === 'right' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_container, { className: "wp-block-media-text__media", onSelectMedia: onSelectMedia, onWidthChange: onWidthChange, commitWidthChange: commitWidthChange, ref: refMediaContainer, enableResize: blockEditingMode === 'default', toggleUseFeaturedImage: toggleUseFeaturedImage, focalPoint, imageFill, isSelected, isStackedOnMobile, mediaAlt, mediaId, mediaPosition, mediaType, mediaUrl, mediaWidth, useFeaturedImage, featuredImageURL, featuredImageAlt }), mediaPosition !== 'right' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps })] })] }); } /* harmony default export */ const media_text_edit = (MediaTextEdit); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/save.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const save_DEFAULT_MEDIA_WIDTH = 50; const save_noop = () => {}; function media_text_save_save({ attributes }) { const { isStackedOnMobile, mediaAlt, mediaPosition, mediaType, mediaUrl, mediaWidth, mediaId, verticalAlignment, imageFill, focalPoint, linkClass, href, linkTarget, rel } = attributes; const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; const newRel = !rel ? undefined : rel; const imageClasses = dist_clsx({ [`wp-image-${mediaId}`]: mediaId && mediaType === 'image', [`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image' }); let image = mediaUrl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: mediaUrl, alt: mediaAlt, className: imageClasses || null }) : null; if (href) { image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }); } const mediaTypeRenders = { image: () => image, video: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("video", { controls: true, src: mediaUrl }) }; const className = dist_clsx({ 'has-media-on-the-right': 'right' === mediaPosition, 'is-stacked-on-mobile': isStackedOnMobile, [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, 'is-image-fill': imageFill }); const backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; let gridTemplateColumns; if (mediaWidth !== save_DEFAULT_MEDIA_WIDTH) { gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; } const style = { gridTemplateColumns }; if ('right' === mediaPosition) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || save_noop)() })] }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, style }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "wp-block-media-text__media", style: backgroundStyles, children: (mediaTypeRenders[mediaType] || save_noop)() }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({ className: 'wp-block-media-text__content' }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/transforms.js /** * WordPress dependencies */ const media_text_transforms_transforms = { from: [{ type: 'block', blocks: ['core/image'], transform: ({ alt, url, id, anchor }) => (0,external_wp_blocks_namespaceObject.createBlock)('core/media-text', { mediaAlt: alt, mediaId: id, mediaUrl: url, mediaType: 'image', anchor }) }, { type: 'block', blocks: ['core/video'], transform: ({ src, id, anchor }) => (0,external_wp_blocks_namespaceObject.createBlock)('core/media-text', { mediaId: id, mediaUrl: src, mediaType: 'video', anchor }) }, { type: 'block', blocks: ['core/cover'], transform: ({ align, alt, anchor, backgroundType, customGradient, customOverlayColor, gradient, id, overlayColor, style, textColor, url }, innerBlocks) => { let additionalAttributes = {}; if (customGradient) { additionalAttributes = { style: { color: { gradient: customGradient } } }; } else if (customOverlayColor) { additionalAttributes = { style: { color: { background: customOverlayColor } } }; } // Maintain custom text color block support value. if (style?.color?.text) { additionalAttributes.style = { color: { ...additionalAttributes.style?.color, text: style.color.text } }; } return (0,external_wp_blocks_namespaceObject.createBlock)('core/media-text', { align, anchor, backgroundColor: overlayColor, gradient, mediaAlt: alt, mediaId: id, mediaType: backgroundType, mediaUrl: url, textColor, ...additionalAttributes }, innerBlocks); } }], to: [{ type: 'block', blocks: ['core/image'], isMatch: ({ mediaType, mediaUrl }) => { return !mediaUrl || mediaType === 'image'; }, transform: ({ mediaAlt, mediaId, mediaUrl, anchor }) => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { alt: mediaAlt, id: mediaId, url: mediaUrl, anchor }); } }, { type: 'block', blocks: ['core/video'], isMatch: ({ mediaType, mediaUrl }) => { return !mediaUrl || mediaType === 'video'; }, transform: ({ mediaId, mediaUrl, anchor }) => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/video', { id: mediaId, src: mediaUrl, anchor }); } }, { type: 'block', blocks: ['core/cover'], transform: ({ align, anchor, backgroundColor, focalPoint, gradient, mediaAlt, mediaId, mediaType, mediaUrl, style, textColor }, innerBlocks) => { const additionalAttributes = {}; // Migrate the background styles or gradient to Cover's custom // gradient and overlay properties. if (style?.color?.gradient) { additionalAttributes.customGradient = style.color.gradient; } else if (style?.color?.background) { additionalAttributes.customOverlayColor = style.color.background; } // Maintain custom text color support style. if (style?.color?.text) { additionalAttributes.style = { color: { text: style.color.text } }; } const coverAttributes = { align, alt: mediaAlt, anchor, backgroundType: mediaType, dimRatio: !!mediaUrl ? 50 : 100, focalPoint, gradient, id: mediaId, overlayColor: backgroundColor, textColor, url: mediaUrl, ...additionalAttributes }; return (0,external_wp_blocks_namespaceObject.createBlock)('core/cover', coverAttributes, innerBlocks); } }] }; /* harmony default export */ const media_text_transforms = (media_text_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const media_text_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/media-text", title: "Media & Text", category: "media", description: "Set media and words side-by-side for a richer layout.", keywords: ["image", "video"], textdomain: "default", attributes: { align: { type: "string", "default": "none" }, mediaAlt: { type: "string", source: "attribute", selector: "figure img", attribute: "alt", "default": "", __experimentalRole: "content" }, mediaPosition: { type: "string", "default": "left" }, mediaId: { type: "number", __experimentalRole: "content" }, mediaUrl: { type: "string", source: "attribute", selector: "figure video,figure img", attribute: "src", __experimentalRole: "content" }, mediaLink: { type: "string" }, linkDestination: { type: "string" }, linkTarget: { type: "string", source: "attribute", selector: "figure a", attribute: "target" }, href: { type: "string", source: "attribute", selector: "figure a", attribute: "href", __experimentalRole: "content" }, rel: { type: "string", source: "attribute", selector: "figure a", attribute: "rel" }, linkClass: { type: "string", source: "attribute", selector: "figure a", attribute: "class" }, mediaType: { type: "string", __experimentalRole: "content" }, mediaWidth: { type: "number", "default": 50 }, mediaSizeSlug: { type: "string" }, isStackedOnMobile: { type: "boolean", "default": true }, verticalAlignment: { type: "string" }, imageFill: { type: "boolean" }, focalPoint: { type: "object" }, allowedBlocks: { type: "array" }, useFeaturedImage: { type: "boolean", "default": false } }, usesContext: ["postId", "postType"], supports: { anchor: true, align: ["wide", "full"], html: false, color: { gradients: true, heading: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-media-text-editor", style: "wp-block-media-text" }; const { name: media_text_name } = media_text_metadata; const media_text_settings = { icon: media_and_text, example: { viewportWidth: 601, // Columns collapse "@media (max-width: 600px)". attributes: { mediaType: 'image', mediaUrl: 'https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.jpg' }, innerBlocks: [{ name: 'core/paragraph', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('The wren<br>Earns his living<br>Noiselessly.') } }, { name: 'core/paragraph', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('— Kobayashi Issa (一茶)') } }] }, transforms: media_text_transforms, edit: media_text_edit, save: media_text_save_save, deprecated: media_text_deprecated }; const media_text_init = () => initBlock({ name: media_text_name, metadata: media_text_metadata, settings: media_text_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/edit.js /** * WordPress dependencies */ function MissingBlockWarning({ attributes, convertToHTML, clientId }) { const { originalName, originalUndelimitedContent } = attributes; const hasContent = !!originalUndelimitedContent; const { hasFreeformBlock, hasHTMLBlock } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canInsertBlockType, getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); return { hasFreeformBlock: canInsertBlockType('core/freeform', getBlockRootClientId(clientId)), hasHTMLBlock: canInsertBlockType('core/html', getBlockRootClientId(clientId)) }; }, [clientId]); const actions = []; let messageHTML; const convertToHtmlButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: convertToHTML, variant: "primary", children: (0,external_wp_i18n_namespaceObject.__)('Keep as HTML') }, "convert"); if (hasContent && !hasFreeformBlock && !originalName) { if (hasHTMLBlock) { messageHTML = (0,external_wp_i18n_namespaceObject.__)('It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.'); actions.push(convertToHtmlButton); } else { messageHTML = (0,external_wp_i18n_namespaceObject.__)('It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.'); } } else if (hasContent && hasHTMLBlock) { messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the "%s" block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.'), originalName); actions.push(convertToHtmlButton); } else { messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.'), originalName); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: 'has-warning' }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { actions: actions, children: messageHTML }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(originalUndelimitedContent) })] }); } const MissingEdit = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { clientId, attributes }) => { const { replaceBlock } = dispatch(external_wp_blockEditor_namespaceObject.store); return { convertToHTML() { replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { content: attributes.originalUndelimitedContent })); } }; })(MissingBlockWarning); /* harmony default export */ const missing_edit = (MissingEdit); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/save.js /** * WordPress dependencies */ function missing_save_save({ attributes }) { // Preserve the missing block's content. return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: attributes.originalContent }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const missing_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/missing", title: "Unsupported", category: "text", description: "Your site doesn\u2019t include support for this block.", textdomain: "default", attributes: { originalName: { type: "string" }, originalUndelimitedContent: { type: "string" }, originalContent: { type: "string", source: "raw" } }, supports: { className: false, customClassName: false, inserter: false, html: false, reusable: false, interactivity: { clientNavigation: true } } }; const { name: missing_name } = missing_metadata; const missing_settings = { name: missing_name, __experimentalLabel(attributes, { context }) { if (context === 'accessibility') { const { originalName } = attributes; const originalBlockType = originalName ? (0,external_wp_blocks_namespaceObject.getBlockType)(originalName) : undefined; if (originalBlockType) { return originalBlockType.settings.title || originalName; } return ''; } }, edit: missing_edit, save: missing_save_save }; const missing_init = () => initBlock({ name: missing_name, metadata: missing_metadata, settings: missing_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more.js /** * WordPress dependencies */ const more = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 9v1.5h16V9H4zm12 5.5h4V13h-4v1.5zm-6 0h4V13h-4v1.5zm-6 0h4V13H4v1.5z" }) }); /* harmony default export */ const library_more = (more); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/edit.js /** * WordPress dependencies */ const DEFAULT_TEXT = (0,external_wp_i18n_namespaceObject.__)('Read more'); function MoreEdit({ attributes: { customText, noTeaser }, insertBlocksAfter, setAttributes }) { const onChangeInput = event => { setAttributes({ customText: event.target.value }); }; const onKeyDown = ({ keyCode }) => { if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { insertBlocksAfter([(0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())]); } }; const getHideExcerptHelp = checked => checked ? (0,external_wp_i18n_namespaceObject.__)('The excerpt is hidden.') : (0,external_wp_i18n_namespaceObject.__)('The excerpt is visible.'); const toggleHideExcerpt = () => setAttributes({ noTeaser: !noTeaser }); const style = { width: `${(customText ? customText : DEFAULT_TEXT).length + 1.2}em` }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Hide the excerpt on the full content page'), checked: !!noTeaser, onChange: toggleHideExcerpt, help: getHideExcerptHelp }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)(), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { "aria-label": (0,external_wp_i18n_namespaceObject.__)('“Read more” link text'), type: "text", value: customText, placeholder: DEFAULT_TEXT, onChange: onChangeInput, onKeyDown: onKeyDown, style: style }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/save.js /** * WordPress dependencies */ function more_save_save({ attributes: { customText, noTeaser } }) { const moreTag = customText ? `<!--more ${customText}-->` : '<!--more-->'; const noTeaserTag = noTeaser ? '<!--noteaser-->' : ''; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: [moreTag, noTeaserTag].filter(Boolean).join('\n') }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/transforms.js /** * WordPress dependencies */ const more_transforms_transforms = { from: [{ type: 'raw', schema: { 'wp-block': { attributes: ['data-block'] } }, isMatch: node => node.dataset && node.dataset.block === 'core/more', transform(node) { const { customText, noTeaser } = node.dataset; const attrs = {}; // Don't copy unless defined and not an empty string. if (customText) { attrs.customText = customText; } // Special handling for boolean. if (noTeaser === '') { attrs.noTeaser = true; } return (0,external_wp_blocks_namespaceObject.createBlock)('core/more', attrs); } }] }; /* harmony default export */ const more_transforms = (more_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const more_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/more", title: "More", category: "design", description: "Content before this block will be shown in the excerpt on your archives page.", keywords: ["read more"], textdomain: "default", attributes: { customText: { type: "string", "default": "" }, noTeaser: { type: "boolean", "default": false } }, supports: { customClassName: false, className: false, html: false, multiple: false, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-more-editor" }; const { name: more_name } = more_metadata; const more_settings = { icon: library_more, example: {}, __experimentalLabel(attributes, { context }) { const customName = attributes?.metadata?.name; if (context === 'list-view' && customName) { return customName; } if (context === 'accessibility') { return attributes.customText; } }, transforms: more_transforms, edit: MoreEdit, save: more_save_save }; const more_init = () => initBlock({ name: more_name, metadata: more_metadata, settings: more_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js /** * WordPress dependencies */ const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); /* harmony default export */ const library_navigation = (navigation); ;// CONCATENATED MODULE: external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifiying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js /** * WordPress dependencies */ const close_close = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" }) }); /* harmony default export */ const library_close = (close_close); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/constants.js const constants_DEFAULT_BLOCK = { name: 'core/navigation-link' }; const PRIORITIZED_INSERTER_BLOCKS = ['core/navigation-link/page', 'core/navigation-link']; // These parameters must be kept aligned with those in // lib/compat/wordpress-6.3/navigation-block-preloading.php // and // edit-site/src/components/sidebar-navigation-screen-navigation-menus/constants.js const PRELOADED_NAVIGATION_MENUS_QUERY = { per_page: 100, status: ['publish', 'draft'], order: 'desc', orderby: 'date' }; const SELECT_NAVIGATION_MENUS_ARGS = ['postType', 'wp_navigation', PRELOADED_NAVIGATION_MENUS_QUERY]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/use-navigation-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function useNavigationMenu(ref) { const permissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('navigation', ref); const { navigationMenu, isNavigationMenuResolved, isNavigationMenuMissing } = (0,external_wp_data_namespaceObject.useSelect)(select => { return selectExistingMenu(select, ref); }, [ref]); const { // Can the user create navigation menus? canCreate: canCreateNavigationMenus, // Can the user update the specific navigation menu with the given post ID? canUpdate: canUpdateNavigationMenu, // Can the user delete the specific navigation menu with the given post ID? canDelete: canDeleteNavigationMenu, isResolving: isResolvingPermissions, hasResolved: hasResolvedPermissions } = permissions; const { records: navigationMenus, isResolving: isResolvingNavigationMenus, hasResolved: hasResolvedNavigationMenus } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', `wp_navigation`, PRELOADED_NAVIGATION_MENUS_QUERY); const canSwitchNavigationMenu = ref ? navigationMenus?.length > 1 : navigationMenus?.length > 0; return { navigationMenu, isNavigationMenuResolved, isNavigationMenuMissing, navigationMenus, isResolvingNavigationMenus, hasResolvedNavigationMenus, canSwitchNavigationMenu, canUserCreateNavigationMenus: canCreateNavigationMenus, isResolvingCanUserCreateNavigationMenus: isResolvingPermissions, hasResolvedCanUserCreateNavigationMenus: hasResolvedPermissions, canUserUpdateNavigationMenu: canUpdateNavigationMenu, hasResolvedCanUserUpdateNavigationMenu: ref ? hasResolvedPermissions : undefined, canUserDeleteNavigationMenu: canDeleteNavigationMenu, hasResolvedCanUserDeleteNavigationMenu: ref ? hasResolvedPermissions : undefined }; } function selectExistingMenu(select, ref) { if (!ref) { return { isNavigationMenuResolved: false, isNavigationMenuMissing: true }; } const { getEntityRecord, getEditedEntityRecord, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); const args = ['postType', 'wp_navigation', ref]; const navigationMenu = getEntityRecord(...args); const editedNavigationMenu = getEditedEntityRecord(...args); const hasResolvedNavigationMenu = hasFinishedResolution('getEditedEntityRecord', args); // Only published Navigation posts are considered valid. // Draft Navigation posts are valid only on the editor, // requiring a post update to publish to show in frontend. // To achieve that, index.php must reflect this validation only for published. const isNavigationMenuPublishedOrDraft = editedNavigationMenu.status === 'publish' || editedNavigationMenu.status === 'draft'; return { isNavigationMenuResolved: hasResolvedNavigationMenu, isNavigationMenuMissing: hasResolvedNavigationMenu && (!navigationMenu || !isNavigationMenuPublishedOrDraft), // getEditedEntityRecord will return the post regardless of status. // Therefore if the found post is not published then we should ignore it. navigationMenu: isNavigationMenuPublishedOrDraft ? editedNavigationMenu : null }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/use-navigation-entities.js /** * WordPress dependencies */ /** * @typedef {Object} NavigationEntitiesData * @property {Array|undefined} pages - a collection of WP Post entity objects of post type "Page". * @property {boolean} isResolvingPages - indicates whether the request to fetch pages is currently resolving. * @property {boolean} hasResolvedPages - indicates whether the request to fetch pages has finished resolving. * @property {Array|undefined} menus - a collection of Menu entity objects. * @property {boolean} isResolvingMenus - indicates whether the request to fetch menus is currently resolving. * @property {boolean} hasResolvedMenus - indicates whether the request to fetch menus has finished resolving. * @property {Array|undefined} menusItems - a collection of Menu Item entity objects for the current menuId. * @property {boolean} hasResolvedMenuItems - indicates whether the request to fetch menuItems has finished resolving. * @property {boolean} hasPages - indicates whether there is currently any data for pages. * @property {boolean} hasMenus - indicates whether there is currently any data for menus. */ /** * Manages fetching and resolution state for all entities required * for the Navigation block. * * @param {number} menuId the menu for which to retrieve menuItem data. * @return { NavigationEntitiesData } the entity data. */ function useNavigationEntities(menuId) { const { records: menus, isResolving: isResolvingMenus, hasResolved: hasResolvedMenus } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'menu', { per_page: -1, context: 'view' }); const { records: pages, isResolving: isResolvingPages, hasResolved: hasResolvedPages } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'page', { parent: 0, order: 'asc', orderby: 'id', per_page: -1, context: 'view' }); const { records: menuItems, hasResolved: hasResolvedMenuItems } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'menuItem', { menus: menuId, per_page: -1, context: 'view' }, { enabled: !!menuId }); return { pages, isResolvingPages, hasResolvedPages, hasPages: !!(hasResolvedPages && pages?.length), menus, isResolvingMenus, hasResolvedMenus, hasMenus: !!(hasResolvedMenus && menus?.length), menuItems, hasResolvedMenuItems }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/placeholder/placeholder-preview.js /** * WordPress dependencies */ const PlaceholderPreview = ({ isVisible = true }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": !isVisible ? true : undefined, className: "wp-block-navigation-placeholder__preview", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-navigation-placeholder__actions__indicator", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_navigation }), (0,external_wp_i18n_namespaceObject.__)('Navigation')] }) }); }; /* harmony default export */ const placeholder_preview = (PlaceholderPreview); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/navigation-menu-selector.js /** * WordPress dependencies */ /** * Internal dependencies */ function buildMenuLabel(title, id, status) { if (!title) { /* translators: %s is the index of the menu in the list of menus. */ return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id); } if (status === 'publish') { return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title); } return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.). (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status); } function NavigationMenuSelector({ currentMenuId, onSelectNavigationMenu, onSelectClassicMenu, onCreateNew, actionLabel, createNavigationMenuIsSuccess, createNavigationMenuIsError }) { /* translators: %s: The name of a menu. */ const createActionLabel = (0,external_wp_i18n_namespaceObject.__)("Create from '%s'"); const [isUpdatingMenuRef, setIsUpdatingMenuRef] = (0,external_wp_element_namespaceObject.useState)(false); actionLabel = actionLabel || createActionLabel; const { menus: classicMenus } = useNavigationEntities(); const { navigationMenus, isResolvingNavigationMenus, hasResolvedNavigationMenus, canUserCreateNavigationMenus, canSwitchNavigationMenu } = useNavigationMenu(); const [currentTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title'); const menuChoices = (0,external_wp_element_namespaceObject.useMemo)(() => { return navigationMenus?.map(({ id, title, status }, index) => { const label = buildMenuLabel(title?.rendered, index + 1, status); return { value: id, label, ariaLabel: (0,external_wp_i18n_namespaceObject.sprintf)(actionLabel, label), disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus }; }) || []; }, [navigationMenus, actionLabel, isResolvingNavigationMenus, hasResolvedNavigationMenus, isUpdatingMenuRef]); const hasNavigationMenus = !!navigationMenus?.length; const hasClassicMenus = !!classicMenus?.length; const showNavigationMenus = !!canSwitchNavigationMenu; const showClassicMenus = !!canUserCreateNavigationMenus; const noMenuSelected = hasNavigationMenus && !currentMenuId; const noBlockMenus = !hasNavigationMenus && hasResolvedNavigationMenus; const menuUnavailable = hasResolvedNavigationMenus && currentMenuId === null; let selectorLabel = ''; if (isResolvingNavigationMenus) { selectorLabel = (0,external_wp_i18n_namespaceObject.__)('Loading…'); } else if (noMenuSelected || noBlockMenus || menuUnavailable) { // Note: classic Menus may be available. selectorLabel = (0,external_wp_i18n_namespaceObject.__)('Choose or create a Navigation Menu'); } else { // Current Menu's title. selectorLabel = currentTitle; } (0,external_wp_element_namespaceObject.useEffect)(() => { if (isUpdatingMenuRef && (createNavigationMenuIsSuccess || createNavigationMenuIsError)) { setIsUpdatingMenuRef(false); } }, [hasResolvedNavigationMenus, createNavigationMenuIsSuccess, canUserCreateNavigationMenus, createNavigationMenuIsError, isUpdatingMenuRef, menuUnavailable, noBlockMenus, noMenuSelected]); const NavigationMenuSelectorDropdown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { label: selectorLabel, icon: more_vertical, toggleProps: { size: 'small' }, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [showNavigationMenus && hasNavigationMenus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Menus'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { value: currentMenuId, onSelect: menuId => { onSelectNavigationMenu(menuId); onClose(); }, choices: menuChoices }) }), showClassicMenus && hasClassicMenus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Import Classic Menus'), children: classicMenus?.map(menu => { const label = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menu.name); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: async () => { setIsUpdatingMenuRef(true); await onSelectClassicMenu(menu); setIsUpdatingMenuRef(false); onClose(); }, "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(createActionLabel, label), disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus, children: label }, menu.id); }) }), canUserCreateNavigationMenus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Tools'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: async () => { setIsUpdatingMenuRef(true); await onCreateNew(); setIsUpdatingMenuRef(false); onClose(); }, disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus, children: (0,external_wp_i18n_namespaceObject.__)('Create new Menu') }) })] }) }); return NavigationMenuSelectorDropdown; } /* harmony default export */ const navigation_menu_selector = (NavigationMenuSelector); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/placeholder/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function NavigationPlaceholder({ isSelected, currentMenuId, clientId, canUserCreateNavigationMenus = false, isResolvingCanUserCreateNavigationMenus, onSelectNavigationMenu, onSelectClassicMenu, onCreateEmpty }) { const { isResolvingMenus, hasResolvedMenus } = useNavigationEntities(); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isSelected) { return; } if (isResolvingMenus) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Loading navigation block setup options…')); } if (hasResolvedMenus) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Navigation block setup options ready.')); } }, [hasResolvedMenus, isResolvingMenus, isSelected]); const isResolvingActions = isResolvingMenus && isResolvingCanUserCreateNavigationMenus; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Placeholder, { className: "wp-block-navigation-placeholder", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(placeholder_preview, { isVisible: !isSelected }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": !isSelected ? true : undefined, className: "wp-block-navigation-placeholder__controls", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-navigation-placeholder__actions", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-navigation-placeholder__actions__indicator", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_navigation }), " ", (0,external_wp_i18n_namespaceObject.__)('Navigation')] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), isResolvingActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigation_menu_selector, { currentMenuId: currentMenuId, clientId: clientId, onSelectNavigationMenu: onSelectNavigationMenu, onSelectClassicMenu: onSelectClassicMenu }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), canUserCreateNavigationMenus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: onCreateEmpty, children: (0,external_wp_i18n_namespaceObject.__)('Start empty') })] }) })] }) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/menu.js /** * WordPress dependencies */ const menu = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z" }) }); /* harmony default export */ const library_menu = (menu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/overlay-menu-icon.js /** * WordPress dependencies */ function OverlayMenuIcon({ icon }) { if (icon === 'menu') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_menu }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", "aria-hidden": "true", focusable: "false", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Rect, { x: "4", y: "7.5", width: "16", height: "1.5" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Rect, { x: "4", y: "15", width: "16", height: "1.5" })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/responsive-wrapper.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ResponsiveWrapper({ children, id, isOpen, isResponsive, onToggle, isHiddenByDefault, overlayBackgroundColor, overlayTextColor, hasIcon, icon }) { if (!isResponsive) { return children; } const responsiveContainerClasses = dist_clsx('wp-block-navigation__responsive-container', { 'has-text-color': !!overlayTextColor.color || !!overlayTextColor?.class, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', overlayTextColor?.slug)]: !!overlayTextColor?.slug, 'has-background': !!overlayBackgroundColor.color || overlayBackgroundColor?.class, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayBackgroundColor?.slug)]: !!overlayBackgroundColor?.slug, 'is-menu-open': isOpen, 'hidden-by-default': isHiddenByDefault }); const styles = { color: !overlayTextColor?.slug && overlayTextColor?.color, backgroundColor: !overlayBackgroundColor?.slug && overlayBackgroundColor?.color && overlayBackgroundColor.color }; const openButtonClasses = dist_clsx('wp-block-navigation__responsive-container-open', { 'always-shown': isHiddenByDefault }); const modalId = `${id}-modal`; const dialogProps = { className: 'wp-block-navigation__responsive-dialog', ...(isOpen && { role: 'dialog', 'aria-modal': true, 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Menu') }) }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { "aria-haspopup": "true", "aria-label": hasIcon && (0,external_wp_i18n_namespaceObject.__)('Open menu'), className: openButtonClasses, onClick: () => onToggle(true), children: [hasIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverlayMenuIcon, { icon: icon }), !hasIcon && (0,external_wp_i18n_namespaceObject.__)('Menu')] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: responsiveContainerClasses, style: styles, id: modalId, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-navigation__responsive-close", tabIndex: "-1", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...dialogProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { className: "wp-block-navigation__responsive-container-close", "aria-label": hasIcon && (0,external_wp_i18n_namespaceObject.__)('Close menu'), onClick: () => onToggle(false), children: [hasIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_close }), !hasIcon && (0,external_wp_i18n_namespaceObject.__)('Close')] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-navigation__responsive-container-content", id: `${modalId}-content`, children: children })] }) }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/inner-blocks.js /** * WordPress dependencies */ /** * Internal dependencies */ function NavigationInnerBlocks({ clientId, hasCustomPlaceholder, orientation, templateLock }) { const { isImmediateParentOfSelectedBlock, selectedBlockHasChildren, isSelected } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockCount, hasSelectedInnerBlock, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); const selectedBlockId = getSelectedBlockClientId(); return { isImmediateParentOfSelectedBlock: hasSelectedInnerBlock(clientId, false), selectedBlockHasChildren: !!getBlockCount(selectedBlockId), // This prop is already available but computing it here ensures it's // fresh compared to isImmediateParentOfSelectedBlock. isSelected: selectedBlockId === clientId }; }, [clientId]); const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', 'wp_navigation'); // When the block is selected itself or has a top level item selected that // doesn't itself have children, show the standard appender. Else show no // appender. const parentOrChildHasSelection = isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren; const placeholder = (0,external_wp_element_namespaceObject.useMemo)(() => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(placeholder_preview, {}), []); const hasMenuItems = !!blocks?.length; // If there is a `ref` attribute pointing to a `wp_navigation` but // that menu has no **items** (i.e. empty) then show a placeholder. // The block must also be selected else the placeholder will display // alongside the appender. const showPlaceholder = !hasCustomPlaceholder && !hasMenuItems && !isSelected; const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({ className: 'wp-block-navigation__container' }, { value: blocks, onInput, onChange, prioritizedInserterBlocks: PRIORITIZED_INSERTER_BLOCKS, defaultBlock: constants_DEFAULT_BLOCK, directInsert: true, orientation, templateLock, // As an exception to other blocks which feature nesting, show // the block appender even when a child block is selected. // This should be a temporary fix, to be replaced by improvements to // the sibling inserter. // See https://github.com/WordPress/gutenberg/issues/37572. renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren || // Show the appender while dragging to allow inserting element between item and the appender. parentOrChildHasSelection ? external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender : false, placeholder: showPlaceholder ? placeholder : undefined, __experimentalCaptureToolbars: true, __unstableDisableLayoutClassNames: true }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/navigation-menu-name-control.js /** * WordPress dependencies */ function NavigationMenuNameControl() { const [title, updateTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Menu name'), value: title, onChange: updateTitle }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/are-blocks-dirty.js function areBlocksDirty(originalBlocks, blocks) { return !isDeepEqual(originalBlocks, blocks, (prop, x) => { // Skip inner blocks of page list during comparison as they // are **always** controlled and may be updated async due to // syncing with entity records. Left unchecked this would // inadvertently trigger the dirty state. if (x?.name === 'core/page-list' && prop === 'innerBlocks') { return true; } }); } /** * Conditionally compares two candidates for deep equality. * Provides an option to skip a given property of an object during comparison. * * @param {*} x 1st candidate for comparison * @param {*} y 2nd candidate for comparison * @param {Function|undefined} shouldSkip a function which can be used to skip a given property of an object. * @return {boolean} whether the two candidates are deeply equal. */ const isDeepEqual = (x, y, shouldSkip) => { if (x === y) { return true; } else if (typeof x === 'object' && x !== null && x !== undefined && typeof y === 'object' && y !== null && y !== undefined) { if (Object.keys(x).length !== Object.keys(y).length) { return false; } for (const prop in x) { if (y.hasOwnProperty(prop)) { // Afford skipping a given property of an object. if (shouldSkip && shouldSkip(prop, x)) { return true; } if (!isDeepEqual(x[prop], y[prop], shouldSkip)) { return false; } } else { return false; } } return true; } return false; }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/unsaved-inner-blocks.js /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_OBJECT = {}; function UnsavedInnerBlocks({ blocks, createNavigationMenu, hasSelection }) { const originalBlocks = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { // Initially store the uncontrolled inner blocks for // dirty state comparison. if (!originalBlocks?.current) { originalBlocks.current = blocks; } }, [blocks]); // If the current inner blocks are different from the original inner blocks // from the post content then the user has made changes to the inner blocks. // At this point the inner blocks can be considered "dirty". // Note: referential equality is not sufficient for comparison as the inner blocks // of the page list are controlled and may be updated async due to syncing with // entity records. As a result we need to perform a deep equality check skipping // the page list's inner blocks. const innerBlocksAreDirty = areBlocksDirty(originalBlocks?.current, blocks); // The block will be disabled in a block preview, use this as a way of // avoiding the side-effects of this component for block previews. const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({ className: 'wp-block-navigation__container' }, { renderAppender: hasSelection ? undefined : false, defaultBlock: constants_DEFAULT_BLOCK, directInsert: true }); const { isSaving, hasResolvedAllNavigationMenus } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (isDisabled) { return EMPTY_OBJECT; } const { hasFinishedResolution, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); return { isSaving: isSavingEntityRecord('postType', 'wp_navigation'), hasResolvedAllNavigationMenus: hasFinishedResolution('getEntityRecords', SELECT_NAVIGATION_MENUS_ARGS) }; }, [isDisabled]); // Automatically save the uncontrolled blocks. (0,external_wp_element_namespaceObject.useEffect)(() => { // The block will be disabled when used in a BlockPreview. // In this case avoid automatic creation of a wp_navigation post. // Otherwise the user will be spammed with lots of menus! // // Also ensure other navigation menus have loaded so an // accurate name can be created. // // Don't try saving when another save is already // in progress. // // And finally only create the menu when the block is selected, // which is an indication they want to start editing. if (isDisabled || isSaving || !hasResolvedAllNavigationMenus || !hasSelection || !innerBlocksAreDirty) { return; } createNavigationMenu(null, blocks); }, [blocks, createNavigationMenu, isDisabled, isSaving, hasResolvedAllNavigationMenus, innerBlocksAreDirty, hasSelection]); const Wrapper = isSaving ? external_wp_components_namespaceObject.Disabled : 'div'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { ...innerBlocksProps }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/navigation-menu-delete-control.js /** * WordPress dependencies */ function NavigationMenuDeleteControl({ onDelete }) { const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_namespaceObject.useState)(false); const id = (0,external_wp_coreData_namespaceObject.useEntityId)('postType', 'wp_navigation'); const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "wp-block-navigation-delete-menu-button", variant: "secondary", isDestructive: true, onClick: () => { setIsConfirmDialogVisible(true); }, children: (0,external_wp_i18n_namespaceObject.__)('Delete menu') }), isConfirmDialogVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { isOpen: true, onConfirm: () => { deleteEntityRecord('postType', 'wp_navigation', id, { force: true }); onDelete(); }, onCancel: () => { setIsConfirmDialogVisible(false); }, confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Delete'), children: (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this Navigation Menu?') })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-navigation-notice.js /** * WordPress dependencies */ function useNavigationNotice({ name, message = '' } = {}) { const noticeRef = (0,external_wp_element_namespaceObject.useRef)(); const { createWarningNotice, removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const showNotice = (0,external_wp_element_namespaceObject.useCallback)(customMsg => { if (noticeRef.current) { return; } noticeRef.current = name; createWarningNotice(customMsg || message, { id: noticeRef.current, type: 'snackbar' }); }, [noticeRef, createWarningNotice, message, name]); const hideNotice = (0,external_wp_element_namespaceObject.useCallback)(() => { if (!noticeRef.current) { return; } removeNotice(noticeRef.current); noticeRef.current = null; }, [noticeRef, removeNotice]); return [showNotice, hideNotice]; } /* harmony default export */ const use_navigation_notice = (useNavigationNotice); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/overlay-menu-preview.js /** * WordPress dependencies */ /** * Internal dependencies */ function OverlayMenuPreview({ setAttributes, hasIcon, icon }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Show icon button'), help: (0,external_wp_i18n_namespaceObject.__)('Configure the visual appearance of the button that toggles the overlay menu.'), onChange: value => setAttributes({ hasIcon: value }), checked: hasIcon }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Icon'), value: icon, onChange: value => setAttributes({ icon: value }), isBlock: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "handle", "aria-label": (0,external_wp_i18n_namespaceObject.__)('handle'), label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverlayMenuIcon, { icon: "handle" }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "menu", "aria-label": (0,external_wp_i18n_namespaceObject.__)('menu'), label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverlayMenuIcon, { icon: "menu" }) })] })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/menu-items-to-blocks.js /** * WordPress dependencies */ /** * Convert a flat menu item structure to a nested blocks structure. * * @param {Object[]} menuItems An array of menu items. * * @return {WPBlock[]} An array of blocks. */ function menuItemsToBlocks(menuItems) { if (!menuItems) { return null; } const menuTree = createDataTree(menuItems); const blocks = mapMenuItemsToBlocks(menuTree); return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.navigation.__unstableMenuItemsToBlocks', blocks, menuItems); } /** * A recursive function that maps menu item nodes to blocks. * * @param {WPNavMenuItem[]} menuItems An array of WPNavMenuItem items. * @param {number} level An integer representing the nesting level. * @return {Object} Object containing innerBlocks and mapping. */ function mapMenuItemsToBlocks(menuItems, level = 0) { let mapping = {}; // The menuItem should be in menu_order sort order. const sortedItems = [...menuItems].sort((a, b) => a.menu_order - b.menu_order); const innerBlocks = sortedItems.map(menuItem => { if (menuItem.type === 'block') { const [block] = (0,external_wp_blocks_namespaceObject.parse)(menuItem.content.raw); if (!block) { return (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', { content: menuItem.content }); } return block; } const blockType = menuItem.children?.length ? 'core/navigation-submenu' : 'core/navigation-link'; const attributes = menuItemToBlockAttributes(menuItem, blockType, level); // If there are children recurse to build those nested blocks. const { innerBlocks: nestedBlocks = [], // alias to avoid shadowing mapping: nestedMapping = {} // alias to avoid shadowing } = menuItem.children?.length ? mapMenuItemsToBlocks(menuItem.children, level + 1) : {}; // Update parent mapping with nested mapping. mapping = { ...mapping, ...nestedMapping }; // Create block with nested "innerBlocks". const block = (0,external_wp_blocks_namespaceObject.createBlock)(blockType, attributes, nestedBlocks); // Create mapping for menuItem -> block. mapping[menuItem.id] = block.clientId; return block; }); return { innerBlocks, mapping }; } /** * A WP nav_menu_item object. * For more documentation on the individual fields present on a menu item please see: * https://core.trac.wordpress.org/browser/tags/5.7.1/src/wp-includes/nav-menu.php#L789 * * @typedef WPNavMenuItem * * @property {Object} title stores the raw and rendered versions of the title/label for this menu item. * @property {Array} xfn the XFN relationships expressed in the link of this menu item. * @property {Array} classes the HTML class attributes for this menu item. * @property {string} attr_title the HTML title attribute for this menu item. * @property {string} object The type of object originally represented, such as 'category', 'post', or 'attachment'. * @property {string} object_id The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. * @property {string} description The description of this menu item. * @property {string} url The URL to which this menu item points. * @property {string} type The family of objects originally represented, such as 'post_type' or 'taxonomy'. * @property {string} target The target attribute of the link element for this menu item. */ /** * Convert block attributes to menu item. * * @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes. * @param {string} blockType The block type. * @param {number} level An integer representing the nesting level. * @return {Object} the block attributes converted from the WPNavMenuItem item. */ function menuItemToBlockAttributes({ title: menuItemTitleField, xfn, classes, // eslint-disable-next-line camelcase attr_title, object, // eslint-disable-next-line camelcase object_id, description, url, type: menuItemTypeField, target }, blockType, level) { // For historical reasons, the `core/navigation-link` variation type is `tag` // whereas WP Core expects `post_tag` as the `object` type. // To avoid writing a block migration we perform a conversion here. // See also inverse equivalent in `blockAttributesToMenuItem`. if (object && object === 'post_tag') { object = 'tag'; } return { label: menuItemTitleField?.rendered || '', ...(object?.length && { type: object }), kind: menuItemTypeField?.replace('_', '-') || 'custom', url: url || '', ...(xfn?.length && xfn.join(' ').trim() && { rel: xfn.join(' ').trim() }), ...(classes?.length && classes.join(' ').trim() && { className: classes.join(' ').trim() }), /* eslint-disable camelcase */ ...(attr_title?.length && { title: attr_title }), ...(object_id && 'custom' !== object && { id: object_id }), /* eslint-enable camelcase */ ...(description?.length && { description }), ...(target === '_blank' && { opensInNewTab: true }), ...(blockType === 'core/navigation-submenu' && { isTopLevelItem: level === 0 }), ...(blockType === 'core/navigation-link' && { isTopLevelLink: level === 0 }) }; } /** * Creates a nested, hierarchical tree representation from unstructured data that * has an inherent relationship defined between individual items. * * For example, by default, each element in the dataset should have an `id` and * `parent` property where the `parent` property indicates a relationship between * the current item and another item with a matching `id` properties. * * This is useful for building linked lists of data from flat data structures. * * @param {Array} dataset linked data to be rearranged into a hierarchical tree based on relational fields. * @param {string} id the property which uniquely identifies each entry within the array. * @param {*} relation the property which identifies how the current item is related to other items in the data (if at all). * @return {Array} a nested array of parent/child relationships */ function createDataTree(dataset, id = 'id', relation = 'parent') { const hashTable = Object.create(null); const dataTree = []; for (const data of dataset) { hashTable[data[id]] = { ...data, children: [] }; if (data[relation]) { hashTable[data[relation]] = hashTable[data[relation]] || {}; hashTable[data[relation]].children = hashTable[data[relation]].children || []; hashTable[data[relation]].children.push(hashTable[data[id]]); } else { dataTree.push(hashTable[data[id]]); } } return dataTree; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ const CLASSIC_MENU_CONVERSION_SUCCESS = 'success'; const CLASSIC_MENU_CONVERSION_ERROR = 'error'; const CLASSIC_MENU_CONVERSION_PENDING = 'pending'; const CLASSIC_MENU_CONVERSION_IDLE = 'idle'; // This is needed to ensure that multiple components using this hook // do not import the same classic menu twice. let classicMenuBeingConvertedId = null; function useConvertClassicToBlockMenu(createNavigationMenu, { throwOnError = false } = {}) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const [status, setStatus] = (0,external_wp_element_namespaceObject.useState)(CLASSIC_MENU_CONVERSION_IDLE); const [error, setError] = (0,external_wp_element_namespaceObject.useState)(null); const convertClassicMenuToBlockMenu = (0,external_wp_element_namespaceObject.useCallback)(async (menuId, menuName, postStatus = 'publish') => { let navigationMenu; let classicMenuItems; // 1. Fetch the classic Menu items. try { classicMenuItems = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getMenuItems({ menus: menuId, per_page: -1, context: 'view' }); } catch (err) { throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of a menu (e.g. Header navigation). (0,external_wp_i18n_namespaceObject.__)(`Unable to fetch classic menu "%s" from API.`), menuName), { cause: err }); } // Handle offline response which resolves to `null`. if (classicMenuItems === null) { throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of a menu (e.g. Header navigation). (0,external_wp_i18n_namespaceObject.__)(`Unable to fetch classic menu "%s" from API.`), menuName)); } // 2. Convert the classic items into blocks. const { innerBlocks } = menuItemsToBlocks(classicMenuItems); // 3. Create the `wp_navigation` Post with the blocks. try { navigationMenu = await createNavigationMenu(menuName, innerBlocks, postStatus); /** * Immediately trigger editEntityRecord to change the wp_navigation post status to 'publish'. * This status change causes the menu to be displayed on the front of the site and sets the post state to be "dirty". * The problem being solved is if saveEditedEntityRecord was used here, the menu would be updated on the frontend and the editor _automatically_, * without user interaction. * If the user abandons the site editor without saving, there would still be a wp_navigation post created as draft. */ await editEntityRecord('postType', 'wp_navigation', navigationMenu.id, { status: 'publish' }, { throwOnError: true }); } catch (err) { throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of a menu (e.g. Header navigation). (0,external_wp_i18n_namespaceObject.__)(`Unable to create Navigation Menu "%s".`), menuName), { cause: err }); } return navigationMenu; }, [createNavigationMenu, editEntityRecord, registry]); const convert = (0,external_wp_element_namespaceObject.useCallback)(async (menuId, menuName, postStatus) => { // Check whether this classic menu is being imported already. if (classicMenuBeingConvertedId === menuId) { return; } // Set the ID for the currently importing classic menu. classicMenuBeingConvertedId = menuId; if (!menuId || !menuName) { setError('Unable to convert menu. Missing menu details.'); setStatus(CLASSIC_MENU_CONVERSION_ERROR); return; } setStatus(CLASSIC_MENU_CONVERSION_PENDING); setError(null); return await convertClassicMenuToBlockMenu(menuId, menuName, postStatus).then(navigationMenu => { setStatus(CLASSIC_MENU_CONVERSION_SUCCESS); // Reset the ID for the currently importing classic menu. classicMenuBeingConvertedId = null; return navigationMenu; }).catch(err => { setError(err?.message); // Reset the ID for the currently importing classic menu. setStatus(CLASSIC_MENU_CONVERSION_ERROR); // Reset the ID for the currently importing classic menu. classicMenuBeingConvertedId = null; // Rethrow error for debugging. if (throwOnError) { throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of a menu (e.g. Header navigation). (0,external_wp_i18n_namespaceObject.__)(`Unable to create Navigation Menu "%s".`), menuName), { cause: err }); } }); }, [convertClassicMenuToBlockMenu, throwOnError]); return { convert, status, error }; } /* harmony default export */ const use_convert_classic_menu_to_block_menu = (useConvertClassicToBlockMenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/utils/create-template-part-id.js /** * Generates a template part Id based on slug and theme inputs. * * @param {string} theme the template part's theme. * @param {string} slug the template part's slug * @return {string|null} the template part's Id. */ function createTemplatePartId(theme, slug) { return theme && slug ? theme + '//' + slug : null; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/use-template-part-area-label.js /** * WordPress dependencies */ /** * Internal dependencies */ // TODO: this util should perhaps be refactored somewhere like core-data. function useTemplatePartAreaLabel(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { // Use the lack of a clientId as an opportunity to bypass the rest // of this hook. if (!clientId) { return; } const { getBlock, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store); const withAscendingResults = true; const parentTemplatePartClientIds = getBlockParentsByBlockName(clientId, 'core/template-part', withAscendingResults); if (!parentTemplatePartClientIds?.length) { return; } // FIXME: @wordpress/block-library should not depend on @wordpress/editor. // Blocks can be loaded into a *non-post* block editor. // This code is lifted from this file: // packages/block-library/src/template-part/edit/advanced-controls.js /* eslint-disable @wordpress/data-no-store-string-literals */ const definedAreas = select('core/editor').__experimentalGetDefaultTemplatePartAreas(); /* eslint-enable @wordpress/data-no-store-string-literals */ const { getCurrentTheme, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); for (const templatePartClientId of parentTemplatePartClientIds) { const templatePartBlock = getBlock(templatePartClientId); // The 'area' usually isn't stored on the block, but instead // on the entity. const { theme = getCurrentTheme()?.stylesheet, slug } = templatePartBlock.attributes; const templatePartEntityId = createTemplatePartId(theme, slug); const templatePartEntity = getEditedEntityRecord('postType', 'wp_template_part', templatePartEntityId); // Look up the `label` for the area in the defined areas so // that an internationalized label can be used. if (templatePartEntity?.area) { return definedAreas.find(definedArea => definedArea.area !== 'uncategorized' && definedArea.area === templatePartEntity.area)?.label; } } }, [clientId]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-generate-default-navigation-title.js /** * WordPress dependencies */ /** * Internal dependencies */ const DRAFT_MENU_PARAMS = ['postType', 'wp_navigation', { status: 'draft', per_page: -1 }]; const PUBLISHED_MENU_PARAMS = ['postType', 'wp_navigation', { per_page: -1, status: 'publish' }]; function useGenerateDefaultNavigationTitle(clientId) { // The block will be disabled in a block preview, use this as a way of // avoiding the side-effects of this component for block previews. const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context); // Because we can't conditionally call hooks, pass an undefined client id // arg to bypass the expensive `useTemplateArea` code. The hook will return // early. const area = useTemplatePartAreaLabel(isDisabled ? undefined : clientId); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); return (0,external_wp_element_namespaceObject.useCallback)(async () => { // Ensure other navigation menus have loaded so an // accurate name can be created. if (isDisabled) { return ''; } const { getEntityRecords } = registry.resolveSelect(external_wp_coreData_namespaceObject.store); const [draftNavigationMenus, navigationMenus] = await Promise.all([getEntityRecords(...DRAFT_MENU_PARAMS), getEntityRecords(...PUBLISHED_MENU_PARAMS)]); const title = area ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of a menu (e.g. Header navigation). (0,external_wp_i18n_namespaceObject.__)('%s navigation'), area) : // translators: 'navigation' as in website navigation. (0,external_wp_i18n_namespaceObject.__)('Navigation'); // Determine how many menus start with the automatic title. const matchingMenuTitleCount = [...draftNavigationMenus, ...navigationMenus].reduce((count, menu) => menu?.title?.raw?.startsWith(title) ? count + 1 : count, 0); // Append a number to the end of the title if a menu with // the same name exists. const titleWithCount = matchingMenuTitleCount > 0 ? `${title} ${matchingMenuTitleCount + 1}` : title; return titleWithCount || ''; }, [isDisabled, area, registry]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-create-navigation-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ const CREATE_NAVIGATION_MENU_SUCCESS = 'success'; const CREATE_NAVIGATION_MENU_ERROR = 'error'; const CREATE_NAVIGATION_MENU_PENDING = 'pending'; const CREATE_NAVIGATION_MENU_IDLE = 'idle'; function useCreateNavigationMenu(clientId) { const [status, setStatus] = (0,external_wp_element_namespaceObject.useState)(CREATE_NAVIGATION_MENU_IDLE); const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(null); const [error, setError] = (0,external_wp_element_namespaceObject.useState)(null); const { saveEntityRecord, editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const generateDefaultTitle = useGenerateDefaultNavigationTitle(clientId); // This callback uses data from the two placeholder steps and only creates // a new navigation menu when the user completes the final step. const create = (0,external_wp_element_namespaceObject.useCallback)(async (title = null, blocks = [], postStatus) => { // Guard against creating Navigations without a title. // Note you can pass no title, but if one is passed it must be // a string otherwise the title may end up being empty. if (title && typeof title !== 'string') { setError('Invalid title supplied when creating Navigation Menu.'); setStatus(CREATE_NAVIGATION_MENU_ERROR); throw new Error(`Value of supplied title argument was not a string.`); } setStatus(CREATE_NAVIGATION_MENU_PENDING); setValue(null); setError(null); if (!title) { title = await generateDefaultTitle().catch(err => { setError(err?.message); setStatus(CREATE_NAVIGATION_MENU_ERROR); throw new Error('Failed to create title when saving new Navigation Menu.', { cause: err }); }); } const record = { title, content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), status: postStatus }; // Return affords ability to await on this function directly return saveEntityRecord('postType', 'wp_navigation', record).then(response => { setValue(response); setStatus(CREATE_NAVIGATION_MENU_SUCCESS); // Set the status to publish so that the Navigation block // shows up in the multi entity save flow. if (postStatus !== 'publish') { editEntityRecord('postType', 'wp_navigation', response.id, { status: 'publish' }); } return response; }).catch(err => { setError(err?.message); setStatus(CREATE_NAVIGATION_MENU_ERROR); throw new Error('Unable to save new Navigation Menu', { cause: err }); }); }, [saveEntityRecord, editEntityRecord, generateDefaultTitle]); return { create, status, value, error, isIdle: status === CREATE_NAVIGATION_MENU_IDLE, isPending: status === CREATE_NAVIGATION_MENU_PENDING, isSuccess: status === CREATE_NAVIGATION_MENU_SUCCESS, isError: status === CREATE_NAVIGATION_MENU_ERROR }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-inner-blocks.js /** * WordPress dependencies */ const use_inner_blocks_EMPTY_ARRAY = []; function useInnerBlocks(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlock, getBlocks, hasSelectedInnerBlock } = select(external_wp_blockEditor_namespaceObject.store); // This relies on the fact that `getBlock` won't return controlled // inner blocks, while `getBlocks` does. It might be more stable to // introduce a selector like `getUncontrolledInnerBlocks`, just in // case `getBlock` is fixed. const _uncontrolledInnerBlocks = getBlock(clientId).innerBlocks; const _hasUncontrolledInnerBlocks = !!_uncontrolledInnerBlocks?.length; const _controlledInnerBlocks = _hasUncontrolledInnerBlocks ? use_inner_blocks_EMPTY_ARRAY : getBlocks(clientId); return { innerBlocks: _hasUncontrolledInnerBlocks ? _uncontrolledInnerBlocks : _controlledInnerBlocks, hasUncontrolledInnerBlocks: _hasUncontrolledInnerBlocks, uncontrolledInnerBlocks: _uncontrolledInnerBlocks, controlledInnerBlocks: _controlledInnerBlocks, isInnerBlockSelected: hasSelectedInnerBlock(clientId, true) }; }, [clientId]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/utils.js /** * External dependencies */ function getComputedStyle(node) { return node.ownerDocument.defaultView.getComputedStyle(node); } function detectColors(colorsDetectionElement, setColor, setBackground) { if (!colorsDetectionElement) { return; } setColor(getComputedStyle(colorsDetectionElement).color); let backgroundColorNode = colorsDetectionElement; let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { backgroundColorNode = backgroundColorNode.parentNode; backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; } setBackground(backgroundColor); } /** * Determine the colors for a menu. * * Order of priority is: * 1: Overlay custom colors (if submenu) * 2: Overlay theme colors (if submenu) * 3: Custom colors * 4: Theme colors * 5: Global styles * * @param {Object} context * @param {boolean} isSubMenu */ function getColors(context, isSubMenu) { const { textColor, customTextColor, backgroundColor, customBackgroundColor, overlayTextColor, customOverlayTextColor, overlayBackgroundColor, customOverlayBackgroundColor, style } = context; const colors = {}; if (isSubMenu && !!customOverlayTextColor) { colors.customTextColor = customOverlayTextColor; } else if (isSubMenu && !!overlayTextColor) { colors.textColor = overlayTextColor; } else if (!!customTextColor) { colors.customTextColor = customTextColor; } else if (!!textColor) { colors.textColor = textColor; } else if (!!style?.color?.text) { colors.customTextColor = style.color.text; } if (isSubMenu && !!customOverlayBackgroundColor) { colors.customBackgroundColor = customOverlayBackgroundColor; } else if (isSubMenu && !!overlayBackgroundColor) { colors.backgroundColor = overlayBackgroundColor; } else if (!!customBackgroundColor) { colors.customBackgroundColor = customBackgroundColor; } else if (!!backgroundColor) { colors.backgroundColor = backgroundColor; } else if (!!style?.color?.background) { colors.customTextColor = style.color.background; } return colors; } function getNavigationChildBlockProps(innerBlocksColors) { return { className: dist_clsx('wp-block-navigation__submenu-container', { 'has-text-color': !!(innerBlocksColors.textColor || innerBlocksColors.customTextColor), [`has-${innerBlocksColors.textColor}-color`]: !!innerBlocksColors.textColor, 'has-background': !!(innerBlocksColors.backgroundColor || innerBlocksColors.customBackgroundColor), [`has-${innerBlocksColors.backgroundColor}-background-color`]: !!innerBlocksColors.backgroundColor }), style: { color: innerBlocksColors.customTextColor, backgroundColor: innerBlocksColors.customBackgroundColor } }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/manage-menus-button.js /** * WordPress dependencies */ const ManageMenusButton = ({ className = '', disabled, isMenuItem = false }) => { let ComponentName = external_wp_components_namespaceObject.Button; if (isMenuItem) { ComponentName = external_wp_components_namespaceObject.MenuItem; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentName, { variant: "link", disabled: disabled, className: className, href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { post_type: 'wp_navigation' }), children: (0,external_wp_i18n_namespaceObject.__)('Manage menus') }); }; /* harmony default export */ const manage_menus_button = (ManageMenusButton); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/deleted-navigation-warning.js /** * WordPress dependencies */ function DeletedNavigationWarning({ onCreateNew }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'), { button: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: onCreateNew, variant: "link" }) }) }); } /* harmony default export */ const deleted_navigation_warning = (DeletedNavigationWarning); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-submenu.js /** * WordPress dependencies */ const addSubmenu = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M2 12c0 3.6 2.4 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.5 0-4.5-1.5-4.5-4s2-4.5 4.5-4.5h3.5V6H8c-3.6 0-6 2.4-6 6zm19.5-1h-8v1.5h8V11zm0 5h-8v1.5h8V16zm0-10h-8v1.5h8V6z" }) }); /* harmony default export */ const add_submenu = (addSubmenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js /** * WordPress dependencies */ const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); /* harmony default export */ const chevron_up = (chevronUp); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js /** * WordPress dependencies */ const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); /* harmony default export */ const chevron_down = (chevronDown); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/leaf-more-menu.js /** * WordPress dependencies */ const POPOVER_PROPS = { className: 'block-editor-block-settings-menu__popover', placement: 'bottom-start' }; const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = ['core/navigation-link', 'core/navigation-submenu']; function AddSubmenuItem({ block, onClose, expandedState, expand, setInsertedBlock }) { const { insertBlock, replaceBlock, replaceInnerBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const clientId = block.clientId; const isDisabled = !BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU.includes(block.name); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: add_submenu, disabled: isDisabled, onClick: () => { const updateSelectionOnInsert = false; const newLink = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); if (block.name === 'core/navigation-submenu') { insertBlock(newLink, block.innerBlocks.length, clientId, updateSelectionOnInsert); } else { // Convert to a submenu if the block currently isn't one. const newSubmenu = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', block.attributes, block.innerBlocks); // The following must happen as two independent actions. // Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds // selector to determine which block is "active". As the UX needs the newLink to be // the "active" block it must be the last block to be inserted. // Therefore the Submenu is first created and **then** the newLink is inserted // thus ensuring it is the last inserted block. replaceBlock(clientId, newSubmenu); replaceInnerBlocks(newSubmenu.clientId, [newLink], updateSelectionOnInsert); } // This call sets the local List View state for the "last inserted block". // This is required for the Nav Block to determine whether or not to display // the Link UI for this new block. setInsertedBlock(newLink); if (!expandedState[block.clientId]) { expand(block.clientId); } onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Add submenu link') }); } function LeafMoreMenu(props) { const { block } = props; const { clientId } = block; const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })); const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); return getBlockRootClientId(clientId); }, [clientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), className: "block-editor-block-settings-menu", popoverProps: POPOVER_PROPS, noIcons: true, ...props, children: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: chevron_up, onClick: () => { moveBlocksUp([clientId], rootClientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Move up') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { icon: chevron_down, onClick: () => { moveBlocksDown([clientId], rootClientId); onClose(); }, children: (0,external_wp_i18n_namespaceObject.__)('Move down') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddSubmenuItem, { block: block, onClose: onClose, expanded: true, expandedState: props.expandedState, expand: props.expand, setInsertedBlock: props.setInsertedBlock })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { removeBlocks([clientId], false); onClose(); }, children: removeLabel }) })] }) }); } ;// CONCATENATED MODULE: external ["wp","escapeHtml"] const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/update-attributes.js /** * WordPress dependencies */ /** * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind */ /** * Navigation Link Block Attributes * * @typedef {Object} WPNavigationLinkBlockAttributes * * @property {string} [label] Link text. * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status. * @property {string} [type] The type such as post, page, tag, category and other custom types. * @property {string} [rel] The relationship of the linked URL. * @property {number} [id] A post or term id. * @property {boolean} [opensInNewTab] Sets link target to _blank when true. * @property {string} [url] Link href. * @property {string} [title] Link title attribute. */ /** * Link Control onChange handler that updates block attributes when a setting is changed. * * @param {Object} updatedValue New block attributes to update. * @param {Function} setAttributes Block attribute update function. * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes. */ const updateAttributes = (updatedValue = {}, setAttributes, blockAttributes = {}) => { const { label: originalLabel = '', kind: originalKind = '', type: originalType = '' } = blockAttributes; const { title: newLabel = '', // the title of any provided Post. url: newUrl = '', opensInNewTab, id, kind: newKind = originalKind, type: newType = originalType } = updatedValue; const newLabelWithoutHttp = newLabel.replace(/http(s?):\/\//gi, ''); const newUrlWithoutHttp = newUrl.replace(/http(s?):\/\//gi, ''); const useNewLabel = newLabel && newLabel !== originalLabel && // LinkControl without the title field relies // on the check below. Specifically, it assumes that // the URL is the same as a title. // This logic a) looks suspicious and b) should really // live in the LinkControl and not here. It's a great // candidate for future refactoring. newLabelWithoutHttp !== newUrlWithoutHttp; // Unfortunately this causes the escaping model to be inverted. // The escaped content is stored in the block attributes (and ultimately in the database), // and then the raw data is "recovered" when outputting into the DOM. // It would be preferable to store the **raw** data in the block attributes and escape it in JS. // Why? Because there isn't one way to escape data. Depending on the context, you need to do // different transforms. It doesn't make sense to me to choose one of them for the purposes of storage. // See also: // - https://github.com/WordPress/gutenberg/pull/41063 // - https://github.com/WordPress/gutenberg/pull/18617. const label = useNewLabel ? (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(newLabel) : originalLabel || (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(newUrlWithoutHttp); // In https://github.com/WordPress/gutenberg/pull/24670 we decided to use "tag" in favor of "post_tag" const type = newType === 'post_tag' ? 'tag' : newType.replace('-', '_'); const isBuiltInType = ['post', 'page', 'tag', 'category'].indexOf(type) > -1; const isCustomLink = !newKind && !isBuiltInType || newKind === 'custom'; const kind = isCustomLink ? 'custom' : newKind; setAttributes({ // Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string. ...(newUrl && { url: encodeURI((0,external_wp_url_namespaceObject.safeDecodeURI)(newUrl)) }), ...(label && { label }), ...(undefined !== opensInNewTab && { opensInNewTab }), ...(id && Number.isInteger(id) && { id }), ...(kind && { kind }), ...(type && type !== 'URL' && { type }) }); }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js /** * WordPress dependencies */ const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); /* harmony default export */ const chevron_left_small = (chevronLeftSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/link-ui.js /** * WordPress dependencies */ /** * Internal dependencies */ const { PrivateQuickInserter: QuickInserter } = unlock(external_wp_blockEditor_namespaceObject.privateApis); /** * Given the Link block's type attribute, return the query params to give to * /wp/v2/search. * * @param {string} type Link block's type attribute. * @param {string} kind Link block's entity of kind (post-type|taxonomy) * @return {{ type?: string, subtype?: string }} Search query params. */ function getSuggestionsQuery(type, kind) { switch (type) { case 'post': case 'page': return { type: 'post', subtype: type }; case 'category': return { type: 'term', subtype: 'category' }; case 'tag': return { type: 'term', subtype: 'post_tag' }; case 'post_format': return { type: 'post-format' }; default: if (kind === 'taxonomy') { return { type: 'term', subtype: type }; } if (kind === 'post-type') { return { type: 'post', subtype: type }; } return { // for custom link which has no type // always show pages as initial suggestions initialSuggestionsSearchOptions: { type: 'post', subtype: 'page', perPage: 20 } }; } } function LinkUIBlockInserter({ clientId, onBack, onSelectBlock }) { const { rootBlockClientId } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); return { rootBlockClientId: getBlockRootClientId(clientId) }; }, [clientId]); const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); const dialogTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, `link-ui-block-inserter__title`); const dialogDescritionId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, `link-ui-block-inserter__description`); if (!clientId) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "link-ui-block-inserter", role: "dialog", "aria-labelledby": dialogTitleId, "aria-describedby": dialogDescritionId, ref: focusOnMountRef, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.VisuallyHidden, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { id: dialogTitleId, children: (0,external_wp_i18n_namespaceObject.__)('Add block') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { id: dialogDescritionId, children: (0,external_wp_i18n_namespaceObject.__)('Choose a block to add to your Navigation.') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "link-ui-block-inserter__back", icon: chevron_left_small, onClick: e => { e.preventDefault(); onBack(); }, size: "small", children: (0,external_wp_i18n_namespaceObject.__)('Back') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(QuickInserter, { rootClientId: rootBlockClientId, clientId: clientId, isAppender: false, prioritizePatterns: false, selectBlockOnInsert: true, hasSearch: false, onSelect: onSelectBlock })] }); } function UnforwardedLinkUI(props, ref) { const [addingBlock, setAddingBlock] = (0,external_wp_element_namespaceObject.useState)(false); const [focusAddBlockButton, setFocusAddBlockButton] = (0,external_wp_element_namespaceObject.useState)(false); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const pagesPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('pages'); const postsPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('posts'); async function handleCreate(pageTitle) { const postType = props.link.type || 'page'; const page = await saveEntityRecord('postType', postType, { title: pageTitle, status: 'draft' }); return { id: page.id, type: postType, // Make `title` property consistent with that in `fetchLinkSuggestions` where the `rendered` title (containing HTML entities) // is also being decoded. By being consistent in both locations we avoid having to branch in the rendering output code. // Ideally in the future we will update both APIs to utilise the "raw" form of the title which is better suited to edit contexts. // e.g. // - title.raw = "Yes & No" // - title.rendered = "Yes & No" // - decodeEntities( title.rendered ) = "Yes & No" // See: // - https://github.com/WordPress/gutenberg/pull/41063 // - https://github.com/WordPress/gutenberg/blob/a1e1fdc0e6278457e9f4fc0b31ac6d2095f5450b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js#L212-L218 title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(page.title.rendered), url: page.link, kind: 'post-type' }; } const { label, url, opensInNewTab, type, kind } = props.link; let userCanCreate = false; if (!type || type === 'page') { userCanCreate = pagesPermissions.canCreate; } else if (type === 'post') { userCanCreate = postsPermissions.canCreate; } // Memoize link value to avoid overriding the LinkControl's internal state. // This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407. const link = (0,external_wp_element_namespaceObject.useMemo)(() => ({ url, opensInNewTab, title: label && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label) }), [label, opensInNewTab, url]); const dialogTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkUI, `link-ui-link-control__title`); const dialogDescritionId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkUI, `link-ui-link-control__description`); // Selecting a block should close the popover and also remove the (previously) automatically inserted // link block so that the newly selected block can be inserted in its place. const { onClose: onSelectBlock } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover, { ref: ref, placement: "bottom", onClose: props.onClose, anchor: props.anchor, shift: true, children: [!addingBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "dialog", "aria-labelledby": dialogTitleId, "aria-describedby": dialogDescritionId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.VisuallyHidden, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { id: dialogTitleId, children: (0,external_wp_i18n_namespaceObject.__)('Add link') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { id: dialogDescritionId, children: (0,external_wp_i18n_namespaceObject.__)('Search for and add a link to your Navigation.') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, { hasTextControl: true, hasRichPreviews: true, value: link, showInitialSuggestions: true, withCreateSuggestion: userCanCreate, createSuggestion: handleCreate, createSuggestionButtonText: searchTerm => { let format; if (type === 'post') { /* translators: %s: search term. */ format = (0,external_wp_i18n_namespaceObject.__)('Create draft post: <mark>%s</mark>'); } else { /* translators: %s: search term. */ format = (0,external_wp_i18n_namespaceObject.__)('Create draft page: <mark>%s</mark>'); } return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(format, searchTerm), { mark: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) }); }, noDirectEntry: !!type, noURLSuggestion: !!type, suggestionsQuery: getSuggestionsQuery(type, kind), onChange: props.onChange, onRemove: props.onRemove, onCancel: props.onCancel, renderControlBottom: () => !link?.url?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkUITools, { focusAddBlockButton: focusAddBlockButton, setAddingBlock: () => { setAddingBlock(true); setFocusAddBlockButton(false); } }) })] }), addingBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkUIBlockInserter, { clientId: props.clientId, onBack: () => { setAddingBlock(false); setFocusAddBlockButton(true); }, onSelectBlock: onSelectBlock })] }); } const LinkUI = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedLinkUI); const LinkUITools = ({ setAddingBlock, focusAddBlockButton }) => { const blockInserterAriaRole = 'listbox'; const addBlockButtonRef = (0,external_wp_element_namespaceObject.useRef)(); // Focus the add block button when the popover is opened. (0,external_wp_element_namespaceObject.useEffect)(() => { if (focusAddBlockButton) { addBlockButtonRef.current?.focus(); } }, [focusAddBlockButton]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "link-ui-tools", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ref: addBlockButtonRef, icon: library_plus, onClick: e => { e.preventDefault(); setAddingBlock(true); }, "aria-haspopup": blockInserterAriaRole, children: (0,external_wp_i18n_namespaceObject.__)('Add block') }) }); }; /* harmony default export */ const link_ui = ((/* unused pure expression or super */ null && (LinkUITools))); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/menu-inspector-controls.js /** * WordPress dependencies */ /** * Internal dependencies */ /* translators: %s: The name of a menu. */ const actionLabel = (0,external_wp_i18n_namespaceObject.__)("Switch to '%s'"); const BLOCKS_WITH_LINK_UI_SUPPORT = ['core/navigation-link', 'core/navigation-submenu']; const { PrivateListView } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function AdditionalBlockContent({ block, insertedBlock, setInsertedBlock }) { const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const supportsLinkControls = BLOCKS_WITH_LINK_UI_SUPPORT?.includes(insertedBlock?.name); const blockWasJustInserted = insertedBlock?.clientId === block.clientId; const showLinkControls = supportsLinkControls && blockWasJustInserted; if (!showLinkControls) { return null; } const setInsertedBlockAttributes = _insertedBlockClientId => _updatedAttributes => { if (!_insertedBlockClientId) { return; } updateBlockAttributes(_insertedBlockClientId, _updatedAttributes); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkUI, { clientId: insertedBlock?.clientId, link: insertedBlock?.attributes, onClose: () => { setInsertedBlock(null); }, onChange: updatedValue => { updateAttributes(updatedValue, setInsertedBlockAttributes(insertedBlock?.clientId), insertedBlock?.attributes); setInsertedBlock(null); }, onCancel: () => { setInsertedBlock(null); } }); } const MainContent = ({ clientId, currentMenuId, isLoading, isNavigationMenuMissing, onCreateNew }) => { const hasChildren = (0,external_wp_data_namespaceObject.useSelect)(select => { return !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(clientId); }, [clientId]); const { navigationMenu } = useNavigationMenu(currentMenuId); if (currentMenuId && isNavigationMenuMissing) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(deleted_navigation_warning, { onCreateNew: onCreateNew }); } if (isLoading) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); } const description = navigationMenu ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of a menu. */ (0,external_wp_i18n_namespaceObject.__)('Structure for Navigation Menu: %s'), navigationMenu?.title || (0,external_wp_i18n_namespaceObject.__)('Untitled menu')) : (0,external_wp_i18n_namespaceObject.__)('You have not yet created any menus. Displaying a list of your Pages'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-navigation__menu-inspector-controls", children: [!hasChildren && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "wp-block-navigation__menu-inspector-controls__empty-message", children: (0,external_wp_i18n_namespaceObject.__)('This Navigation Menu is empty.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { rootClientId: clientId, isExpanded: true, description: description, showAppender: true, blockSettingsMenu: LeafMoreMenu, additionalBlockContent: AdditionalBlockContent })] }); }; const MenuInspectorControls = props => { const { createNavigationMenuIsSuccess, createNavigationMenuIsError, currentMenuId = null, onCreateNew, onSelectClassicMenu, onSelectNavigationMenu, isManageMenusButtonDisabled, blockEditingMode } = props; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "list", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: null, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "wp-block-navigation-off-canvas-editor__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { className: "wp-block-navigation-off-canvas-editor__title", level: 2, children: (0,external_wp_i18n_namespaceObject.__)('Menu') }), blockEditingMode === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigation_menu_selector, { currentMenuId: currentMenuId, onSelectClassicMenu: onSelectClassicMenu, onSelectNavigationMenu: onSelectNavigationMenu, onCreateNew: onCreateNew, createNavigationMenuIsSuccess: createNavigationMenuIsSuccess, createNavigationMenuIsError: createNavigationMenuIsError, actionLabel: actionLabel, isManageMenusButtonDisabled: isManageMenusButtonDisabled })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MainContent, { ...props })] }) }); }; /* harmony default export */ const menu_inspector_controls = (MenuInspectorControls); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/accessible-description.js /** * WordPress dependencies */ function AccessibleDescription({ id, children }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { id: id, className: "wp-block-navigation__description", children: children }) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/accessible-menu-description.js /** * WordPress dependencies */ /** * Internal dependencies */ function AccessibleMenuDescription({ id }) { const [menuTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title'); /* translators: %s: Title of a Navigation Menu post. */ const description = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)(`Navigation Menu: "%s"`), menuTitle); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AccessibleDescription, { id: id, children: description }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ColorTools({ textColor, setTextColor, backgroundColor, setBackgroundColor, overlayTextColor, setOverlayTextColor, overlayBackgroundColor, setOverlayBackgroundColor, clientId, navRef }) { const [detectedBackgroundColor, setDetectedBackgroundColor] = (0,external_wp_element_namespaceObject.useState)(); const [detectedColor, setDetectedColor] = (0,external_wp_element_namespaceObject.useState)(); const [detectedOverlayBackgroundColor, setDetectedOverlayBackgroundColor] = (0,external_wp_element_namespaceObject.useState)(); const [detectedOverlayColor, setDetectedOverlayColor] = (0,external_wp_element_namespaceObject.useState)(); // Turn on contrast checker for web only since it's not supported on mobile yet. const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === 'web'; (0,external_wp_element_namespaceObject.useEffect)(() => { if (!enableContrastChecking) { return; } detectColors(navRef.current, setDetectedColor, setDetectedBackgroundColor); const subMenuElement = navRef.current?.querySelector('[data-type="core/navigation-submenu"] [data-type="core/navigation-link"]'); if (!subMenuElement) { return; } // Only detect submenu overlay colors if they have previously been explicitly set. // This avoids the contrast checker from reporting on inherited submenu colors and // showing the contrast warning twice. if (overlayTextColor.color || overlayBackgroundColor.color) { detectColors(subMenuElement, setDetectedOverlayColor, setDetectedOverlayBackgroundColor); } }, [enableContrastChecking, overlayTextColor.color, overlayBackgroundColor.color, navRef]); const colorGradientSettings = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)(); if (!colorGradientSettings.hasColorsOrGradients) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, { __experimentalIsRenderedInSidebar: true, settings: [{ colorValue: textColor.color, label: (0,external_wp_i18n_namespaceObject.__)('Text'), onColorChange: setTextColor, resetAllFilter: () => setTextColor() }, { colorValue: backgroundColor.color, label: (0,external_wp_i18n_namespaceObject.__)('Background'), onColorChange: setBackgroundColor, resetAllFilter: () => setBackgroundColor() }, { colorValue: overlayTextColor.color, label: (0,external_wp_i18n_namespaceObject.__)('Submenu & overlay text'), onColorChange: setOverlayTextColor, resetAllFilter: () => setOverlayTextColor() }, { colorValue: overlayBackgroundColor.color, label: (0,external_wp_i18n_namespaceObject.__)('Submenu & overlay background'), onColorChange: setOverlayBackgroundColor, resetAllFilter: () => setOverlayBackgroundColor() }], panelId: clientId, ...colorGradientSettings, gradients: [], disableCustomGradients: true }), enableContrastChecking && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ContrastChecker, { backgroundColor: detectedBackgroundColor, textColor: detectedColor }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ContrastChecker, { backgroundColor: detectedOverlayBackgroundColor, textColor: detectedOverlayColor })] })] }); } function Navigation({ attributes, setAttributes, clientId, isSelected, className, backgroundColor, setBackgroundColor, textColor, setTextColor, overlayBackgroundColor, setOverlayBackgroundColor, overlayTextColor, setOverlayTextColor, // These props are used by the navigation editor to override specific // navigation block settings. hasSubmenuIndicatorSetting = true, customPlaceholder: CustomPlaceholder = null, __unstableLayoutClassNames: layoutClassNames }) { const { openSubmenusOnClick, overlayMenu, showSubmenuIcon, templateLock, layout: { justifyContent, orientation = 'horizontal', flexWrap = 'wrap' } = {}, hasIcon, icon = 'handle' } = attributes; const ref = attributes.ref; const setRef = (0,external_wp_element_namespaceObject.useCallback)(postId => { setAttributes({ ref: postId }); }, [setAttributes]); const recursionId = `navigationMenu/${ref}`; const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(recursionId); const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); // Preload classic menus, so that they don't suddenly pop-in when viewing // the Select Menu dropdown. const { menus: classicMenus } = useNavigationEntities(); const [showNavigationMenuStatusNotice, hideNavigationMenuStatusNotice] = use_navigation_notice({ name: 'block-library/core/navigation/status' }); const [showClassicMenuConversionNotice, hideClassicMenuConversionNotice] = use_navigation_notice({ name: 'block-library/core/navigation/classic-menu-conversion' }); const [showNavigationMenuPermissionsNotice, hideNavigationMenuPermissionsNotice] = use_navigation_notice({ name: 'block-library/core/navigation/permissions/update' }); const { create: createNavigationMenu, status: createNavigationMenuStatus, error: createNavigationMenuError, value: createNavigationMenuPost, isPending: isCreatingNavigationMenu, isSuccess: createNavigationMenuIsSuccess, isError: createNavigationMenuIsError } = useCreateNavigationMenu(clientId); const createUntitledEmptyNavigationMenu = async () => { await createNavigationMenu(''); }; const { hasUncontrolledInnerBlocks, uncontrolledInnerBlocks, isInnerBlockSelected, innerBlocks } = useInnerBlocks(clientId); const hasSubmenus = !!innerBlocks.find(block => block.name === 'core/navigation-submenu'); const { replaceInnerBlocks, selectBlock, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const [isResponsiveMenuOpen, setResponsiveMenuVisibility] = (0,external_wp_element_namespaceObject.useState)(false); const [overlayMenuPreview, setOverlayMenuPreview] = (0,external_wp_element_namespaceObject.useState)(false); const { hasResolvedNavigationMenus, isNavigationMenuResolved, isNavigationMenuMissing, canUserUpdateNavigationMenu, hasResolvedCanUserUpdateNavigationMenu, canUserDeleteNavigationMenu, hasResolvedCanUserDeleteNavigationMenu, canUserCreateNavigationMenus, isResolvingCanUserCreateNavigationMenus, hasResolvedCanUserCreateNavigationMenus } = useNavigationMenu(ref); const navMenuResolvedButMissing = hasResolvedNavigationMenus && isNavigationMenuMissing; const { convert: convertClassicMenu, status: classicMenuConversionStatus, error: classicMenuConversionError } = use_convert_classic_menu_to_block_menu(createNavigationMenu); const isConvertingClassicMenu = classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING; const handleUpdateMenu = (0,external_wp_element_namespaceObject.useCallback)((menuId, options = { focusNavigationBlock: false }) => { const { focusNavigationBlock } = options; setRef(menuId); if (focusNavigationBlock) { selectBlock(clientId); } }, [selectBlock, clientId, setRef]); const isEntityAvailable = !isNavigationMenuMissing && isNavigationMenuResolved; // If the block has inner blocks, but no menu id, then these blocks are either: // - inserted via a pattern. // - inserted directly via Code View (or otherwise). // - from an older version of navigation block added before the block used a wp_navigation entity. // Consider this state as 'unsaved' and offer an uncontrolled version of inner blocks, // that automatically saves the menu as an entity when changes are made to the inner blocks. const hasUnsavedBlocks = hasUncontrolledInnerBlocks && !isEntityAvailable; const { getNavigationFallbackId } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store)); const navigationFallbackId = !(ref || hasUnsavedBlocks) ? getNavigationFallbackId() : null; (0,external_wp_element_namespaceObject.useEffect)(() => { // If: // - there is an existing menu, OR // - there are existing (uncontrolled) inner blocks // ...then don't request a fallback menu. if (ref || hasUnsavedBlocks || !navigationFallbackId) { return; } /** * This fallback displays (both in editor and on front) * The fallback should not request a save (entity dirty state) * nor to be undoable, hence why it is marked as non persistent */ __unstableMarkNextChangeAsNotPersistent(); setRef(navigationFallbackId); }, [ref, setRef, hasUnsavedBlocks, navigationFallbackId, __unstableMarkNextChangeAsNotPersistent]); const navRef = (0,external_wp_element_namespaceObject.useRef)(); // The standard HTML5 tag for the block wrapper. const TagName = 'nav'; // "placeholder" shown if: // - there is no ref attribute pointing to a Navigation Post. // - there is no classic menu conversion process in progress. // - there is no menu creation process in progress. // - there are no uncontrolled blocks. const isPlaceholder = !ref && !isCreatingNavigationMenu && !isConvertingClassicMenu && hasResolvedNavigationMenus && classicMenus?.length === 0 && !hasUncontrolledInnerBlocks; // "loading" state: // - there is a menu creation process in progress. // - there is a classic menu conversion process in progress. // OR: // - there is a ref attribute pointing to a Navigation Post // - the Navigation Post isn't available (hasn't resolved) yet. const isLoading = !hasResolvedNavigationMenus || isCreatingNavigationMenu || isConvertingClassicMenu || !!(ref && !isEntityAvailable && !isConvertingClassicMenu); const textDecoration = attributes.style?.typography?.textDecoration; const hasBlockOverlay = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__unstableHasActiveBlockOverlayActive(clientId), [clientId]); const isResponsive = 'never' !== overlayMenu; const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ ref: navRef, className: dist_clsx(className, { 'items-justified-right': justifyContent === 'right', 'items-justified-space-between': justifyContent === 'space-between', 'items-justified-left': justifyContent === 'left', 'items-justified-center': justifyContent === 'center', 'is-vertical': orientation === 'vertical', 'no-wrap': flexWrap === 'nowrap', 'is-responsive': isResponsive, 'has-text-color': !!textColor.color || !!textColor?.class, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor?.slug)]: !!textColor?.slug, 'has-background': !!backgroundColor.color || backgroundColor.class, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor?.slug)]: !!backgroundColor?.slug, [`has-text-decoration-${textDecoration}`]: textDecoration, 'block-editor-block-content-overlay': hasBlockOverlay }, layoutClassNames), style: { color: !textColor?.slug && textColor?.color, backgroundColor: !backgroundColor?.slug && backgroundColor?.color } }); const onSelectClassicMenu = async classicMenu => { return convertClassicMenu(classicMenu.id, classicMenu.name, 'draft'); }; const onSelectNavigationMenu = menuId => { handleUpdateMenu(menuId); }; (0,external_wp_element_namespaceObject.useEffect)(() => { hideNavigationMenuStatusNotice(); if (isCreatingNavigationMenu) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)(`Creating Navigation Menu.`)); } if (createNavigationMenuIsSuccess) { handleUpdateMenu(createNavigationMenuPost?.id, { focusNavigationBlock: true }); showNavigationMenuStatusNotice((0,external_wp_i18n_namespaceObject.__)(`Navigation Menu successfully created.`)); } if (createNavigationMenuIsError) { showNavigationMenuStatusNotice((0,external_wp_i18n_namespaceObject.__)('Failed to create Navigation Menu.')); } }, [createNavigationMenuStatus, createNavigationMenuError, createNavigationMenuPost?.id, createNavigationMenuIsError, createNavigationMenuIsSuccess, isCreatingNavigationMenu, handleUpdateMenu, hideNavigationMenuStatusNotice, showNavigationMenuStatusNotice]); (0,external_wp_element_namespaceObject.useEffect)(() => { hideClassicMenuConversionNotice(); if (classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Classic menu importing.')); } if (classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_SUCCESS) { showClassicMenuConversionNotice((0,external_wp_i18n_namespaceObject.__)('Classic menu imported successfully.')); handleUpdateMenu(createNavigationMenuPost?.id, { focusNavigationBlock: true }); } if (classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_ERROR) { showClassicMenuConversionNotice((0,external_wp_i18n_namespaceObject.__)('Classic menu import failed.')); } }, [classicMenuConversionStatus, classicMenuConversionError, hideClassicMenuConversionNotice, showClassicMenuConversionNotice, createNavigationMenuPost?.id, handleUpdateMenu]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isSelected && !isInnerBlockSelected) { hideNavigationMenuPermissionsNotice(); } if (isSelected || isInnerBlockSelected) { if (ref && !navMenuResolvedButMissing && hasResolvedCanUserUpdateNavigationMenu && !canUserUpdateNavigationMenu) { showNavigationMenuPermissionsNotice((0,external_wp_i18n_namespaceObject.__)('You do not have permission to edit this Menu. Any changes made will not be saved.')); } if (!ref && hasResolvedCanUserCreateNavigationMenus && !canUserCreateNavigationMenus) { showNavigationMenuPermissionsNotice((0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Navigation Menus.')); } } }, [isSelected, isInnerBlockSelected, canUserUpdateNavigationMenu, hasResolvedCanUserUpdateNavigationMenu, canUserCreateNavigationMenus, hasResolvedCanUserCreateNavigationMenus, ref, hideNavigationMenuPermissionsNotice, showNavigationMenuPermissionsNotice, navMenuResolvedButMissing]); const hasManagePermissions = canUserCreateNavigationMenus || canUserUpdateNavigationMenu; const overlayMenuPreviewClasses = dist_clsx('wp-block-navigation__overlay-menu-preview', { open: overlayMenuPreview }); const submenuAccessibilityNotice = !showSubmenuIcon && !openSubmenusOnClick ? (0,external_wp_i18n_namespaceObject.__)('The current menu options offer reduced accessibility for users and are not recommended. Enabling either "Open on Click" or "Show arrow" offers enhanced accessibility by allowing keyboard users to browse submenus selectively.') : ''; const isFirstRender = (0,external_wp_element_namespaceObject.useRef)(true); // Don't speak on first render. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isFirstRender.current && submenuAccessibilityNotice) { (0,external_wp_a11y_namespaceObject.speak)(submenuAccessibilityNotice); } isFirstRender.current = false; }, [submenuAccessibilityNotice]); const overlayMenuPreviewId = (0,external_wp_compose_namespaceObject.useInstanceId)(OverlayMenuPreview, `overlay-menu-preview`); const stylingInspectorControls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: hasSubmenuIndicatorSetting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Display'), children: [isResponsive && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { className: overlayMenuPreviewClasses, onClick: () => { setOverlayMenuPreview(!overlayMenuPreview); }, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Overlay menu controls'), "aria-controls": overlayMenuPreviewId, "aria-expanded": overlayMenuPreview, children: [hasIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverlayMenuIcon, { icon: icon }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_close })] }), !hasIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: (0,external_wp_i18n_namespaceObject.__)('Menu') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: (0,external_wp_i18n_namespaceObject.__)('Close') })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { id: overlayMenuPreviewId, children: overlayMenuPreview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverlayMenuPreview, { setAttributes: setAttributes, hasIcon: hasIcon, icon: icon, hidden: !overlayMenuPreview }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: (0,external_wp_i18n_namespaceObject.__)('Overlay Menu') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Configure overlay menu'), value: overlayMenu, help: (0,external_wp_i18n_namespaceObject.__)('Collapses the navigation options in a menu icon opening an overlay.'), onChange: value => setAttributes({ overlayMenu: value }), isBlock: true, hideLabelFromVision: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "never", label: (0,external_wp_i18n_namespaceObject.__)('Off') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "mobile", label: (0,external_wp_i18n_namespaceObject.__)('Mobile') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { value: "always", label: (0,external_wp_i18n_namespaceObject.__)('Always') })] }), hasSubmenus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: (0,external_wp_i18n_namespaceObject.__)('Submenus') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, checked: openSubmenusOnClick, onChange: value => { setAttributes({ openSubmenusOnClick: value, ...(value && { showSubmenuIcon: true }) // Make sure arrows are shown when we toggle this on. }); }, label: (0,external_wp_i18n_namespaceObject.__)('Open on click') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, checked: showSubmenuIcon, onChange: value => { setAttributes({ showSubmenuIcon: value }); }, disabled: attributes.openSubmenusOnClick, label: (0,external_wp_i18n_namespaceObject.__)('Show arrow') }), submenuAccessibilityNotice && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { spokenMessage: null, status: "warning", isDismissible: false, children: submenuAccessibilityNotice }) })] })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "color", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorTools, { textColor: textColor, setTextColor: setTextColor, backgroundColor: backgroundColor, setBackgroundColor: setBackgroundColor, overlayTextColor: overlayTextColor, setOverlayTextColor: setOverlayTextColor, overlayBackgroundColor: overlayBackgroundColor, setOverlayBackgroundColor: setOverlayBackgroundColor, clientId: clientId, navRef: navRef }) })] }); const accessibleDescriptionId = `${clientId}-desc`; const isManageMenusButtonDisabled = !hasManagePermissions || !hasResolvedNavigationMenus; if (hasUnsavedBlocks && !isCreatingNavigationMenu) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(TagName, { ...blockProps, "aria-describedby": !isPlaceholder ? accessibleDescriptionId : undefined, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AccessibleDescription, { id: accessibleDescriptionId, children: (0,external_wp_i18n_namespaceObject.__)('Unsaved Navigation Menu.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_inspector_controls, { clientId: clientId, createNavigationMenuIsSuccess: createNavigationMenuIsSuccess, createNavigationMenuIsError: createNavigationMenuIsError, currentMenuId: ref, isNavigationMenuMissing: isNavigationMenuMissing, isManageMenusButtonDisabled: isManageMenusButtonDisabled, onCreateNew: createUntitledEmptyNavigationMenu, onSelectClassicMenu: onSelectClassicMenu, onSelectNavigationMenu: onSelectNavigationMenu, isLoading: isLoading, blockEditingMode: blockEditingMode }), blockEditingMode === 'default' && stylingInspectorControls, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResponsiveWrapper, { id: clientId, onToggle: setResponsiveMenuVisibility, isOpen: isResponsiveMenuOpen, hasIcon: hasIcon, icon: icon, isResponsive: isResponsive, isHiddenByDefault: 'always' === overlayMenu, overlayBackgroundColor: overlayBackgroundColor, overlayTextColor: overlayTextColor, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnsavedInnerBlocks, { createNavigationMenu: createNavigationMenu, blocks: uncontrolledInnerBlocks, hasSelection: isSelected || isInnerBlockSelected }) })] }); } // Show a warning if the selected menu is no longer available. // TODO - the user should be able to select a new one? if (ref && isNavigationMenuMissing) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(TagName, { ...blockProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_inspector_controls, { clientId: clientId, createNavigationMenuIsSuccess: createNavigationMenuIsSuccess, createNavigationMenuIsError: createNavigationMenuIsError, currentMenuId: ref, isNavigationMenuMissing: isNavigationMenuMissing, isManageMenusButtonDisabled: isManageMenusButtonDisabled, onCreateNew: createUntitledEmptyNavigationMenu, onSelectClassicMenu: onSelectClassicMenu, onSelectNavigationMenu: onSelectNavigationMenu, isLoading: isLoading, blockEditingMode: blockEditingMode }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(deleted_navigation_warning, { onCreateNew: createUntitledEmptyNavigationMenu })] }); } if (isEntityAvailable && hasAlreadyRendered) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { children: (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.') }) }); } const PlaceholderComponent = CustomPlaceholder ? CustomPlaceholder : NavigationPlaceholder; /** * Historically the navigation block has supported custom placeholders. * Even though the current UX tries as hard as possible not to * end up in a placeholder state, the block continues to support * this extensibility point, via a CustomPlaceholder. * When CustomPlaceholder is present it becomes the default fallback * for an empty navigation block, instead of the default fallbacks. * */ if (isPlaceholder && CustomPlaceholder) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderComponent, { isSelected: isSelected, currentMenuId: ref, clientId: clientId, canUserCreateNavigationMenus: canUserCreateNavigationMenus, isResolvingCanUserCreateNavigationMenus: isResolvingCanUserCreateNavigationMenus, onSelectNavigationMenu: onSelectNavigationMenu, onSelectClassicMenu: onSelectClassicMenu, onCreateEmpty: createUntitledEmptyNavigationMenu }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { kind: "postType", type: "wp_navigation", id: ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.RecursionProvider, { uniqueId: recursionId, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu_inspector_controls, { clientId: clientId, createNavigationMenuIsSuccess: createNavigationMenuIsSuccess, createNavigationMenuIsError: createNavigationMenuIsError, currentMenuId: ref, isNavigationMenuMissing: isNavigationMenuMissing, isManageMenusButtonDisabled: isManageMenusButtonDisabled, onCreateNew: createUntitledEmptyNavigationMenu, onSelectClassicMenu: onSelectClassicMenu, onSelectNavigationMenu: onSelectNavigationMenu, isLoading: isLoading, blockEditingMode: blockEditingMode }), blockEditingMode === 'default' && stylingInspectorControls, blockEditingMode === 'default' && isEntityAvailable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "advanced", children: [hasResolvedCanUserUpdateNavigationMenu && canUserUpdateNavigationMenu && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuNameControl, {}), hasResolvedCanUserDeleteNavigationMenu && canUserDeleteNavigationMenu && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuDeleteControl, { onDelete: () => { replaceInnerBlocks(clientId, []); showNavigationMenuStatusNotice((0,external_wp_i18n_namespaceObject.__)('Navigation Menu successfully deleted.')); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(manage_menus_button, { disabled: isManageMenusButtonDisabled, className: "wp-block-navigation-manage-menus-button" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(TagName, { ...blockProps, "aria-describedby": !isPlaceholder && !isLoading ? accessibleDescriptionId : undefined, children: [isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-navigation__loading-indicator-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "wp-block-navigation__loading-indicator" }) }), !isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AccessibleMenuDescription, { id: accessibleDescriptionId }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResponsiveWrapper, { id: clientId, onToggle: setResponsiveMenuVisibility, hasIcon: hasIcon, icon: icon, isOpen: isResponsiveMenuOpen, isResponsive: isResponsive, isHiddenByDefault: 'always' === overlayMenu, overlayBackgroundColor: overlayBackgroundColor, overlayTextColor: overlayTextColor, children: isEntityAvailable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationInnerBlocks, { clientId: clientId, hasCustomPlaceholder: !!CustomPlaceholder, templateLock: templateLock, orientation: orientation }) })] })] })] }) }); } /* harmony default export */ const navigation_edit = ((0,external_wp_blockEditor_namespaceObject.withColors)({ textColor: 'color' }, { backgroundColor: 'color' }, { overlayBackgroundColor: 'color' }, { overlayTextColor: 'color' })(Navigation)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/save.js /** * WordPress dependencies */ function navigation_save_save({ attributes }) { if (attributes.ref) { // Avoid rendering inner blocks when a ref is defined. // When this id is defined the inner blocks are loaded from the // `wp_navigation` entity rather than the hard-coded block html. return; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/deprecated.js /** * WordPress dependencies */ /** * Internal dependencies */ const TYPOGRAPHY_PRESET_DEPRECATION_MAP = { fontStyle: 'var:preset|font-style|', fontWeight: 'var:preset|font-weight|', textDecoration: 'var:preset|text-decoration|', textTransform: 'var:preset|text-transform|' }; const migrateIdToRef = ({ navigationMenuId, ...attributes }) => { return { ...attributes, ref: navigationMenuId }; }; const deprecated_migrateWithLayout = attributes => { if (!!attributes.layout) { return attributes; } const { itemsJustification, orientation, ...updatedAttributes } = attributes; if (itemsJustification || orientation) { Object.assign(updatedAttributes, { layout: { type: 'flex', ...(itemsJustification && { justifyContent: itemsJustification }), ...(orientation && { orientation }) } }); } return updatedAttributes; }; const navigation_deprecated_v6 = { attributes: { navigationMenuId: { type: 'number' }, textColor: { type: 'string' }, customTextColor: { type: 'string' }, rgbTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, rgbBackgroundColor: { type: 'string' }, showSubmenuIcon: { type: 'boolean', default: true }, openSubmenusOnClick: { type: 'boolean', default: false }, overlayMenu: { type: 'string', default: 'mobile' }, __unstableLocation: { type: 'string' }, overlayBackgroundColor: { type: 'string' }, customOverlayBackgroundColor: { type: 'string' }, overlayTextColor: { type: 'string' }, customOverlayTextColor: { type: 'string' } }, supports: { align: ['wide', 'full'], anchor: true, html: false, inserter: true, typography: { fontSize: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalTextTransform: true, __experimentalFontFamily: true, __experimentalTextDecoration: true, __experimentalDefaultControls: { fontSize: true } }, spacing: { blockGap: true, units: ['px', 'em', 'rem', 'vh', 'vw'], __experimentalDefaultControls: { blockGap: true } }, layout: { allowSwitching: false, allowInheriting: false, default: { type: 'flex' } } }, save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); }, isEligible: ({ navigationMenuId }) => !!navigationMenuId, migrate: migrateIdToRef }; const navigation_deprecated_v5 = { attributes: { navigationMenuId: { type: 'number' }, orientation: { type: 'string', default: 'horizontal' }, textColor: { type: 'string' }, customTextColor: { type: 'string' }, rgbTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, rgbBackgroundColor: { type: 'string' }, itemsJustification: { type: 'string' }, showSubmenuIcon: { type: 'boolean', default: true }, openSubmenusOnClick: { type: 'boolean', default: false }, overlayMenu: { type: 'string', default: 'never' }, __unstableLocation: { type: 'string' }, overlayBackgroundColor: { type: 'string' }, customOverlayBackgroundColor: { type: 'string' }, overlayTextColor: { type: 'string' }, customOverlayTextColor: { type: 'string' } }, supports: { align: ['wide', 'full'], anchor: true, html: false, inserter: true, typography: { fontSize: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalTextTransform: true, __experimentalFontFamily: true, __experimentalTextDecoration: true, __experimentalDefaultControls: { fontSize: true } }, spacing: { blockGap: true, units: ['px', 'em', 'rem', 'vh', 'vw'], __experimentalDefaultControls: { blockGap: true } } }, save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); }, isEligible: ({ itemsJustification, orientation }) => !!itemsJustification || !!orientation, migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout) }; const navigation_deprecated_v4 = { attributes: { orientation: { type: 'string', default: 'horizontal' }, textColor: { type: 'string' }, customTextColor: { type: 'string' }, rgbTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, rgbBackgroundColor: { type: 'string' }, itemsJustification: { type: 'string' }, showSubmenuIcon: { type: 'boolean', default: true }, openSubmenusOnClick: { type: 'boolean', default: false }, overlayMenu: { type: 'string', default: 'never' }, __unstableLocation: { type: 'string' }, overlayBackgroundColor: { type: 'string' }, customOverlayBackgroundColor: { type: 'string' }, overlayTextColor: { type: 'string' }, customOverlayTextColor: { type: 'string' } }, supports: { align: ['wide', 'full'], anchor: true, html: false, inserter: true, typography: { fontSize: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalTextTransform: true, __experimentalFontFamily: true, __experimentalTextDecoration: true }, spacing: { blockGap: true, units: ['px', 'em', 'rem', 'vh', 'vw'], __experimentalDefaultControls: { blockGap: true } } }, save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); }, migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout, migrate_font_family), isEligible({ style }) { return style?.typography?.fontFamily; } }; const migrateIsResponsive = function (attributes) { delete attributes.isResponsive; return { ...attributes, overlayMenu: 'mobile' }; }; const migrateTypographyPresets = function (attributes) { var _attributes$style$typ; return { ...attributes, style: { ...attributes.style, typography: Object.fromEntries(Object.entries((_attributes$style$typ = attributes.style.typography) !== null && _attributes$style$typ !== void 0 ? _attributes$style$typ : {}).map(([key, value]) => { const prefix = TYPOGRAPHY_PRESET_DEPRECATION_MAP[key]; if (prefix && value.startsWith(prefix)) { const newValue = value.slice(prefix.length); if ('textDecoration' === key && 'strikethrough' === newValue) { return [key, 'line-through']; } return [key, newValue]; } return [key, value]; })) } }; }; const navigation_deprecated_deprecated = [navigation_deprecated_v6, navigation_deprecated_v5, navigation_deprecated_v4, // Remove `isResponsive` attribute. { attributes: { orientation: { type: 'string', default: 'horizontal' }, textColor: { type: 'string' }, customTextColor: { type: 'string' }, rgbTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, rgbBackgroundColor: { type: 'string' }, itemsJustification: { type: 'string' }, showSubmenuIcon: { type: 'boolean', default: true }, openSubmenusOnClick: { type: 'boolean', default: false }, isResponsive: { type: 'boolean', default: 'false' }, __unstableLocation: { type: 'string' }, overlayBackgroundColor: { type: 'string' }, customOverlayBackgroundColor: { type: 'string' }, overlayTextColor: { type: 'string' }, customOverlayTextColor: { type: 'string' } }, supports: { align: ['wide', 'full'], anchor: true, html: false, inserter: true, typography: { fontSize: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalTextTransform: true, __experimentalFontFamily: true, __experimentalTextDecoration: true } }, isEligible(attributes) { return attributes.isResponsive; }, migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout, migrate_font_family, migrateIsResponsive), save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } }, { attributes: { orientation: { type: 'string' }, textColor: { type: 'string' }, customTextColor: { type: 'string' }, rgbTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, rgbBackgroundColor: { type: 'string' }, itemsJustification: { type: 'string' }, showSubmenuIcon: { type: 'boolean', default: true } }, supports: { align: ['wide', 'full'], anchor: true, html: false, inserter: true, fontSize: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalTextTransform: true, color: true, __experimentalFontFamily: true, __experimentalTextDecoration: true }, save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); }, isEligible(attributes) { if (!attributes.style || !attributes.style.typography) { return false; } for (const styleAttribute in TYPOGRAPHY_PRESET_DEPRECATION_MAP) { const attributeValue = attributes.style.typography[styleAttribute]; if (attributeValue && attributeValue.startsWith(TYPOGRAPHY_PRESET_DEPRECATION_MAP[styleAttribute])) { return true; } } return false; }, migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout, migrate_font_family, migrateTypographyPresets) }, { attributes: { className: { type: 'string' }, textColor: { type: 'string' }, rgbTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, rgbBackgroundColor: { type: 'string' }, fontSize: { type: 'string' }, customFontSize: { type: 'number' }, itemsJustification: { type: 'string' }, showSubmenuIcon: { type: 'boolean' } }, isEligible(attribute) { return attribute.rgbTextColor || attribute.rgbBackgroundColor; }, supports: { align: ['wide', 'full'], anchor: true, html: false, inserter: true }, migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, attributes => { const { rgbTextColor, rgbBackgroundColor, ...restAttributes } = attributes; return { ...restAttributes, customTextColor: attributes.textColor ? undefined : attributes.rgbTextColor, customBackgroundColor: attributes.backgroundColor ? undefined : attributes.rgbBackgroundColor }; }), save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } }]; /* harmony default export */ const navigation_deprecated = (navigation_deprecated_deprecated); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const navigation_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/navigation", title: "Navigation", category: "theme", allowedBlocks: ["core/navigation-link", "core/search", "core/social-links", "core/page-list", "core/spacer", "core/home-link", "core/site-title", "core/site-logo", "core/navigation-submenu", "core/loginout", "core/buttons"], description: "A collection of blocks that allow visitors to get around your site.", keywords: ["menu", "navigation", "links"], textdomain: "default", attributes: { ref: { type: "number" }, textColor: { type: "string" }, customTextColor: { type: "string" }, rgbTextColor: { type: "string" }, backgroundColor: { type: "string" }, customBackgroundColor: { type: "string" }, rgbBackgroundColor: { type: "string" }, showSubmenuIcon: { type: "boolean", "default": true }, openSubmenusOnClick: { type: "boolean", "default": false }, overlayMenu: { type: "string", "default": "mobile" }, icon: { type: "string", "default": "handle" }, hasIcon: { type: "boolean", "default": true }, __unstableLocation: { type: "string" }, overlayBackgroundColor: { type: "string" }, customOverlayBackgroundColor: { type: "string" }, overlayTextColor: { type: "string" }, customOverlayTextColor: { type: "string" }, maxNestingLevel: { type: "number", "default": 5 }, templateLock: { type: ["string", "boolean"], "enum": ["all", "insert", "contentOnly", false] } }, providesContext: { textColor: "textColor", customTextColor: "customTextColor", backgroundColor: "backgroundColor", customBackgroundColor: "customBackgroundColor", overlayTextColor: "overlayTextColor", customOverlayTextColor: "customOverlayTextColor", overlayBackgroundColor: "overlayBackgroundColor", customOverlayBackgroundColor: "customOverlayBackgroundColor", fontSize: "fontSize", customFontSize: "customFontSize", showSubmenuIcon: "showSubmenuIcon", openSubmenusOnClick: "openSubmenusOnClick", style: "style", maxNestingLevel: "maxNestingLevel" }, supports: { align: ["wide", "full"], ariaLabel: true, html: false, inserter: true, typography: { fontSize: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalTextTransform: true, __experimentalFontFamily: true, __experimentalLetterSpacing: true, __experimentalTextDecoration: true, __experimentalSkipSerialization: ["textDecoration"], __experimentalDefaultControls: { fontSize: true } }, spacing: { blockGap: true, units: ["px", "em", "rem", "vh", "vw"], __experimentalDefaultControls: { blockGap: true } }, layout: { allowSwitching: false, allowInheriting: false, allowVerticalAlignment: false, allowSizingOnChildren: true, "default": { type: "flex" } }, interactivity: true, renaming: false }, editorStyle: "wp-block-navigation-editor", style: "wp-block-navigation" }; const { name: navigation_name } = navigation_metadata; const navigation_settings = { icon: library_navigation, example: { attributes: { overlayMenu: 'never' }, innerBlocks: [{ name: 'core/navigation-link', attributes: { // translators: 'Home' as in a website's home page. label: (0,external_wp_i18n_namespaceObject.__)('Home'), url: 'https://make.wordpress.org/' } }, { name: 'core/navigation-link', attributes: { // translators: 'About' as in a website's about page. label: (0,external_wp_i18n_namespaceObject.__)('About'), url: 'https://make.wordpress.org/' } }, { name: 'core/navigation-link', attributes: { // translators: 'Contact' as in a website's contact page. label: (0,external_wp_i18n_namespaceObject.__)('Contact'), url: 'https://make.wordpress.org/' } }] }, edit: navigation_edit, save: navigation_save_save, deprecated: navigation_deprecated }; const navigation_init = () => initBlock({ name: navigation_name, metadata: navigation_metadata, settings: navigation_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/custom-link.js /** * WordPress dependencies */ const customLink = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5 14.5h-1V16h1c2.2 0 4-1.8 4-4s-1.8-4-4-4h-1v1.5h1c1.4 0 2.5 1.1 2.5 2.5s-1.1 2.5-2.5 2.5zm-4 1.5v-1.5h-1C6.1 14.5 5 13.4 5 12s1.1-2.5 2.5-2.5h1V8h-1c-2.2 0-4 1.8-4 4s1.8 4 4 4h1zm-1-3.2h5v-1.5h-5v1.5zM18 4H9c-1.1 0-2 .9-2 2v.5h1.5V6c0-.3.2-.5.5-.5h9c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5v-.5H7v.5c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z" }) }); /* harmony default export */ const custom_link = (customLink); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const navigation_link_edit_DEFAULT_BLOCK = { name: 'core/navigation-link' }; /** * A React hook to determine if it's dragging within the target element. * * @typedef {import('@wordpress/element').RefObject} RefObject * * @param {RefObject<HTMLElement>} elementRef The target elementRef object. * * @return {boolean} Is dragging within the target element. */ const useIsDraggingWithin = elementRef => { const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const { ownerDocument } = elementRef.current; function handleDragStart(event) { // Check the first time when the dragging starts. handleDragEnter(event); } // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape. function handleDragEnd() { setIsDraggingWithin(false); } function handleDragEnter(event) { // Check if the current target is inside the item element. if (elementRef.current.contains(event.target)) { setIsDraggingWithin(true); } else { setIsDraggingWithin(false); } } // Bind these events to the document to catch all drag events. // Ideally, we can also use `event.relatedTarget`, but sadly that // doesn't work in Safari. ownerDocument.addEventListener('dragstart', handleDragStart); ownerDocument.addEventListener('dragend', handleDragEnd); ownerDocument.addEventListener('dragenter', handleDragEnter); return () => { ownerDocument.removeEventListener('dragstart', handleDragStart); ownerDocument.removeEventListener('dragend', handleDragEnd); ownerDocument.removeEventListener('dragenter', handleDragEnter); }; }, [elementRef]); return isDraggingWithin; }; const useIsInvalidLink = (kind, type, id) => { const isPostType = kind === 'post-type' || type === 'post' || type === 'page'; const hasId = Number.isInteger(id); const postStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!isPostType) { return null; } const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); return getEntityRecord('postType', type, id)?.status; }, [isPostType, type, id]); // Check Navigation Link validity if: // 1. Link is 'post-type'. // 2. It has an id. // 3. It's neither null, nor undefined, as valid items might be either of those while loading. // If those conditions are met, check if // 1. The post status is published. // 2. The Navigation Link item has no label. // If either of those is true, invalidate. const isInvalid = isPostType && hasId && postStatus && 'trash' === postStatus; const isDraft = 'draft' === postStatus; return [isInvalid, isDraft]; }; function getMissingText(type) { let missingText = ''; switch (type) { case 'post': /* translators: label for missing post in navigation link block */ missingText = (0,external_wp_i18n_namespaceObject.__)('Select post'); break; case 'page': /* translators: label for missing page in navigation link block */ missingText = (0,external_wp_i18n_namespaceObject.__)('Select page'); break; case 'category': /* translators: label for missing category in navigation link block */ missingText = (0,external_wp_i18n_namespaceObject.__)('Select category'); break; case 'tag': /* translators: label for missing tag in navigation link block */ missingText = (0,external_wp_i18n_namespaceObject.__)('Select tag'); break; default: /* translators: label for missing values in navigation link block */ missingText = (0,external_wp_i18n_namespaceObject.__)('Add link'); } return missingText; } /* * Warning, this duplicated in * packages/block-library/src/navigation-submenu/edit.js * Consider reuseing this components for both blocks. */ function Controls({ attributes, setAttributes, setIsLabelFieldFocused }) { const { label, url, description, title, rel } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: label ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label) : '', onChange: labelValue => { setAttributes({ label: labelValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Text'), autoComplete: "off", onFocus: () => setIsLabelFieldFocused(true), onBlur: () => setIsLabelFieldFocused(false) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: url ? (0,external_wp_url_namespaceObject.safeDecodeURI)(url) : '', onChange: urlValue => { updateAttributes({ url: urlValue }, setAttributes, attributes); }, label: (0,external_wp_i18n_namespaceObject.__)('Link'), autoComplete: "off" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { __nextHasNoMarginBottom: true, value: description || '', onChange: descriptionValue => { setAttributes({ description: descriptionValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Description'), help: (0,external_wp_i18n_namespaceObject.__)('The description will be displayed in the menu if the current theme supports it.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: title || '', onChange: titleValue => { setAttributes({ title: titleValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'), autoComplete: "off", help: (0,external_wp_i18n_namespaceObject.__)('Additional information to help clarify the purpose of the link.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: rel || '', onChange: relValue => { setAttributes({ rel: relValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Rel attribute'), autoComplete: "off", help: (0,external_wp_i18n_namespaceObject.__)('The relationship of the linked URL as space-separated link types.') })] }); } function NavigationLinkEdit({ attributes, isSelected, setAttributes, insertBlocksAfter, mergeBlocks, onReplace, context, clientId }) { const { id, label, type, url, description, kind } = attributes; const [isInvalid, isDraft] = useIsInvalidLink(kind, type, id); const { maxNestingLevel } = context; const { replaceBlock, __unstableMarkNextChangeAsNotPersistent, selectBlock, selectPreviousBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); // Have the link editing ui open on mount when lacking a url and selected. const [isLinkOpen, setIsLinkOpen] = (0,external_wp_element_namespaceObject.useState)(isSelected && !url); // Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text) const [openedBy, setOpenedBy] = (0,external_wp_element_namespaceObject.useState)(null); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const listItemRef = (0,external_wp_element_namespaceObject.useRef)(null); const isDraggingWithin = useIsDraggingWithin(listItemRef); const itemLabelPlaceholder = (0,external_wp_i18n_namespaceObject.__)('Add label…'); const ref = (0,external_wp_element_namespaceObject.useRef)(); const linkUIref = (0,external_wp_element_namespaceObject.useRef)(); const prevUrl = (0,external_wp_compose_namespaceObject.usePrevious)(url); // Change the label using inspector causes rich text to change focus on firefox. // This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text. const [isLabelFieldFocused, setIsLabelFieldFocused] = (0,external_wp_element_namespaceObject.useState)(false); const { isAtMaxNesting, isTopLevelLink, isParentOfSelectedBlock, hasChildren } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockCount, getBlockName, getBlockRootClientId, hasSelectedInnerBlock, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store); return { isAtMaxNesting: getBlockParentsByBlockName(clientId, ['core/navigation-link', 'core/navigation-submenu']).length >= maxNestingLevel, isTopLevelLink: getBlockName(getBlockRootClientId(clientId)) === 'core/navigation', isParentOfSelectedBlock: hasSelectedInnerBlock(clientId, true), hasChildren: !!getBlockCount(clientId) }; }, [clientId, maxNestingLevel]); const { getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); /** * Transform to submenu block. */ const transformToSubmenu = () => { let innerBlocks = getBlocks(clientId); if (innerBlocks.length === 0) { innerBlocks = [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link')]; selectBlock(innerBlocks[0].clientId); } const newSubmenu = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', attributes, innerBlocks); replaceBlock(clientId, newSubmenu); }; (0,external_wp_element_namespaceObject.useEffect)(() => { // If block has inner blocks, transform to Submenu. if (hasChildren) { // This side-effect should not create an undo level as those should // only be created via user interactions. __unstableMarkNextChangeAsNotPersistent(); transformToSubmenu(); } }, [hasChildren]); // If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text. (0,external_wp_element_namespaceObject.useEffect)(() => { // We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL if (!prevUrl && url && isLinkOpen && (0,external_wp_url_namespaceObject.isURL)((0,external_wp_url_namespaceObject.prependHTTP)(label)) && /^.+\.[a-z]+/.test(label)) { // Focus and select the label text. selectLabelText(); } }, [prevUrl, url, isLinkOpen, label]); /** * Focus the Link label text and select it. */ function selectLabelText() { ref.current.focus(); const { ownerDocument } = ref.current; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); const range = ownerDocument.createRange(); // Get the range of the current ref contents so we can add this range to the selection. range.selectNodeContents(ref.current); selection.removeAllRanges(); selection.addRange(range); } /** * Removes the current link if set. */ function removeLink() { // Reset all attributes that comprise the link. // It is critical that all attributes are reset // to their default values otherwise this may // in advertently trigger side effects because // the values will have "changed". setAttributes({ url: undefined, label: undefined, id: undefined, kind: undefined, type: undefined, opensInNewTab: false }); // Close the link editing UI. setIsLinkOpen(false); } const { textColor, customTextColor, backgroundColor, customBackgroundColor } = getColors(context, !isTopLevelLink); function onKeyDown(event) { if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'k')) { // Required to prevent the command center from opening, // as it shares the CMD+K shortcut. // See https://github.com/WordPress/gutenberg/pull/59845. event.preventDefault(); // If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover event.stopPropagation(); setIsLinkOpen(true); setOpenedBy(ref.current); } } const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, listItemRef]), className: dist_clsx('wp-block-navigation-item', { 'is-editing': isSelected || isParentOfSelectedBlock, 'is-dragging-within': isDraggingWithin, 'has-link': !!url, 'has-child': hasChildren, 'has-text-color': !!textColor || !!customTextColor, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor)]: !!textColor, 'has-background': !!backgroundColor || customBackgroundColor, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor)]: !!backgroundColor }), style: { color: !textColor && customTextColor, backgroundColor: !backgroundColor && customBackgroundColor }, onKeyDown }); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({ ...blockProps, className: 'remove-outline' // Remove the outline from the inner blocks container. }, { defaultBlock: navigation_link_edit_DEFAULT_BLOCK, directInsert: true, renderAppender: false }); if (!url || isInvalid || isDraft) { blockProps.onClick = () => { setIsLinkOpen(true); setOpenedBy(ref.current); }; } const classes = dist_clsx('wp-block-navigation-item__content', { 'wp-block-navigation-link__placeholder': !url || isInvalid || isDraft }); const missingText = getMissingText(type); /* translators: Whether the navigation link is Invalid or a Draft. */ const placeholderText = `(${isInvalid ? (0,external_wp_i18n_namespaceObject.__)('Invalid') : (0,external_wp_i18n_namespaceObject.__)('Draft')})`; const tooltipText = isInvalid || isDraft ? (0,external_wp_i18n_namespaceObject.__)('This item has been deleted, or is a draft') : (0,external_wp_i18n_namespaceObject.__)('This item is missing a link'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { name: "link", icon: library_link, title: (0,external_wp_i18n_namespaceObject.__)('Link'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k'), onClick: event => { setIsLinkOpen(true); setOpenedBy(event.currentTarget); } }), !isAtMaxNesting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { name: "submenu", icon: add_submenu, title: (0,external_wp_i18n_namespaceObject.__)('Add submenu'), onClick: transformToSubmenu })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Controls, { attributes: attributes, setAttributes: setAttributes, setIsLabelFieldFocused: setIsLabelFieldFocused }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...blockProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { className: classes, children: [!url ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-navigation-link__placeholder-text", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tooltipText, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: missingText }) }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!isInvalid && !isDraft && !isLabelFieldFocused && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { ref: ref, identifier: "label", className: "wp-block-navigation-item__label", value: label, onChange: labelValue => setAttributes({ label: labelValue }), onMerge: mergeBlocks, onReplace: onReplace, __unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link')), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigation link text'), placeholder: itemLabelPlaceholder, withoutInteractiveFormatting: true, allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'] }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "wp-block-navigation-item__description", children: description })] }), (isInvalid || isDraft || isLabelFieldFocused) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-navigation-link__placeholder-text wp-block-navigation-link__label", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tooltipText, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigation link text'), children: // Some attributes are stored in an escaped form. It's a legacy issue. // Ideally they would be stored in a raw, unescaped form. // Unescape is used here to "recover" the escaped characters // so they display without encoding. // See `updateAttributes` for more details. `${(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(label)} ${isInvalid || isDraft ? placeholderText : ''}`.trim() }) }) })] }), isLinkOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkUI, { ref: linkUIref, clientId: clientId, link: attributes, onClose: () => { // If there is no link then remove the auto-inserted block. // This avoids empty blocks which can provided a poor UX. if (!url) { // Fixes https://github.com/WordPress/gutenberg/issues/61361 // There's a chance we're closing due to the user selecting the browse all button. // Only move focus if the focus is still within the popover ui. If it's not within // the popover, it's because something has taken the focus from the popover, and // we don't want to steal it back. if (linkUIref.current.contains(window.document.activeElement)) { // Select the previous block to keep focus nearby selectPreviousBlock(clientId, true); } // Remove the link. onReplace([]); return; } setIsLinkOpen(false); if (openedBy) { openedBy.focus(); setOpenedBy(null); } else if (ref.current) { // select the ref when adding a new link ref.current.focus(); } else { // Fallback selectPreviousBlock(clientId, true); } }, anchor: popoverAnchor, onRemove: removeLink, onChange: updatedValue => { updateAttributes(updatedValue, setAttributes, attributes); } })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps })] })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/save.js /** * WordPress dependencies */ function navigation_link_save_save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js /** * WordPress dependencies */ const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })] }); /* harmony default export */ const library_page = (page); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js /** * WordPress dependencies */ const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) }); /* harmony default export */ const library_tag = (tag); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/custom-post-type.js /** * WordPress dependencies */ const customPostType = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z" }) }); /* harmony default export */ const custom_post_type = (customPostType); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/hooks.js /** * WordPress dependencies */ function getIcon(variationName) { switch (variationName) { case 'post': return post_list; case 'page': return library_page; case 'tag': return library_tag; case 'category': return library_category; default: return custom_post_type; } } function enhanceNavigationLinkVariations(settings, name) { if (name !== 'core/navigation-link') { return settings; } // Otherwise decorate server passed variations with an icon and isActive function. if (settings.variations) { const isActive = (blockAttributes, variationAttributes) => { return blockAttributes.type === variationAttributes.type; }; const variations = settings.variations.map(variation => { return { ...variation, ...(!variation.icon && { icon: getIcon(variation.name) }), ...(!variation.isActive && { isActive }) }; }); return { ...settings, variations }; } return settings; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/transforms.js /** * WordPress dependencies */ const navigation_link_transforms_transforms = { from: [{ type: 'block', blocks: ['core/site-logo'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }, { type: 'block', blocks: ['core/spacer'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }, { type: 'block', blocks: ['core/home-link'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }, { type: 'block', blocks: ['core/social-links'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }, { type: 'block', blocks: ['core/search'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }, { type: 'block', blocks: ['core/page-list'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }, { type: 'block', blocks: ['core/buttons'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link'); } }], to: [{ type: 'block', blocks: ['core/navigation-submenu'], transform: (attributes, innerBlocks) => (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', attributes, innerBlocks) }, { type: 'block', blocks: ['core/spacer'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/spacer'); } }, { type: 'block', blocks: ['core/site-logo'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/site-logo'); } }, { type: 'block', blocks: ['core/home-link'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/home-link'); } }, { type: 'block', blocks: ['core/social-links'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/social-links'); } }, { type: 'block', blocks: ['core/search'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/search', { showLabel: false, buttonUseIcon: true, buttonPosition: 'button-inside' }); } }, { type: 'block', blocks: ['core/page-list'], transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/page-list'); } }, { type: 'block', blocks: ['core/buttons'], transform: ({ label, url, rel, title, opensInNewTab }) => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/buttons', {}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/button', { text: label, url, rel, title, linkTarget: opensInNewTab ? '_blank' : undefined })]); } }] }; /* harmony default export */ const navigation_link_transforms = (navigation_link_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const navigation_link_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/navigation-link", title: "Custom Link", category: "design", parent: ["core/navigation"], allowedBlocks: ["core/navigation-link", "core/navigation-submenu", "core/page-list"], description: "Add a page, link, or another item to your navigation.", textdomain: "default", attributes: { label: { type: "string" }, type: { type: "string" }, description: { type: "string" }, rel: { type: "string" }, id: { type: "number" }, opensInNewTab: { type: "boolean", "default": false }, url: { type: "string" }, title: { type: "string" }, kind: { type: "string" }, isTopLevelLink: { type: "boolean" } }, usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "maxNestingLevel", "style"], supports: { reusable: false, html: false, __experimentalSlashInserter: true, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, renaming: false, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-navigation-link-editor", style: "wp-block-navigation-link" }; const { name: navigation_link_name } = navigation_link_metadata; const navigation_link_settings = { icon: custom_link, __experimentalLabel: ({ label }) => label, merge(leftAttributes, { label: rightLabel = '' }) { return { ...leftAttributes, label: leftAttributes.label + rightLabel }; }, edit: NavigationLinkEdit, save: navigation_link_save_save, example: { attributes: { label: (0,external_wp_i18n_namespaceObject._x)('Example Link', 'navigation link preview example'), url: 'https://example.com' } }, deprecated: [{ isEligible(attributes) { return attributes.nofollow; }, attributes: { label: { type: 'string' }, type: { type: 'string' }, nofollow: { type: 'boolean' }, description: { type: 'string' }, id: { type: 'number' }, opensInNewTab: { type: 'boolean', default: false }, url: { type: 'string' } }, migrate({ nofollow, ...rest }) { return { rel: nofollow ? 'nofollow' : '', ...rest }; }, save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } }], transforms: navigation_link_transforms }; const navigation_link_init = () => { (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/navigation-link', enhanceNavigationLinkVariations); return initBlock({ name: navigation_link_name, metadata: navigation_link_metadata, settings: navigation_link_settings }); }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/remove-submenu.js /** * WordPress dependencies */ const removeSubmenu = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "m13.955 20.748 8-17.5-.91-.416L19.597 6H13.5v1.5h5.411l-1.6 3.5H13.5v1.5h3.126l-1.6 3.5H13.5l.028 1.5h.812l-1.295 2.832.91.416ZM17.675 16l-.686 1.5h4.539L21.5 16h-3.825Zm2.286-5-.686 1.5H21.5V11h-1.54ZM2 12c0 3.58 2.42 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.48 0-4.5-1.52-4.5-4S5.52 7.5 8 7.5h3.5V6H8c-3.58 0-6 2.42-6 6Z" }) }); /* harmony default export */ const remove_submenu = (removeSubmenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/icons.js /** * WordPress dependencies */ const ItemSubmenuIcon = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M1.50002 4L6.00002 8L10.5 4", strokeWidth: "1.5" }) }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ALLOWED_BLOCKS = ['core/navigation-link', 'core/navigation-submenu', 'core/page-list']; const navigation_submenu_edit_DEFAULT_BLOCK = { name: 'core/navigation-link' }; /** * A React hook to determine if it's dragging within the target element. * * @typedef {import('@wordpress/element').RefObject} RefObject * * @param {RefObject<HTMLElement>} elementRef The target elementRef object. * * @return {boolean} Is dragging within the target element. */ const edit_useIsDraggingWithin = elementRef => { const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const { ownerDocument } = elementRef.current; function handleDragStart(event) { // Check the first time when the dragging starts. handleDragEnter(event); } // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape. function handleDragEnd() { setIsDraggingWithin(false); } function handleDragEnter(event) { // Check if the current target is inside the item element. if (elementRef.current.contains(event.target)) { setIsDraggingWithin(true); } else { setIsDraggingWithin(false); } } // Bind these events to the document to catch all drag events. // Ideally, we can also use `event.relatedTarget`, but sadly that // doesn't work in Safari. ownerDocument.addEventListener('dragstart', handleDragStart); ownerDocument.addEventListener('dragend', handleDragEnd); ownerDocument.addEventListener('dragenter', handleDragEnter); return () => { ownerDocument.removeEventListener('dragstart', handleDragStart); ownerDocument.removeEventListener('dragend', handleDragEnd); ownerDocument.removeEventListener('dragenter', handleDragEnter); }; }, []); return isDraggingWithin; }; /** * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind */ /** * Navigation Link Block Attributes * * @typedef {Object} WPNavigationLinkBlockAttributes * * @property {string} [label] Link text. * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status. * @property {string} [type] The type such as post, page, tag, category and other custom types. * @property {string} [rel] The relationship of the linked URL. * @property {number} [id] A post or term id. * @property {boolean} [opensInNewTab] Sets link target to _blank when true. * @property {string} [url] Link href. * @property {string} [title] Link title attribute. */ function NavigationSubmenuEdit({ attributes, isSelected, setAttributes, mergeBlocks, onReplace, context, clientId }) { const { label, type, url, description, rel, title } = attributes; const { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context; const { __unstableMarkNextChangeAsNotPersistent, replaceBlock, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const [isLinkOpen, setIsLinkOpen] = (0,external_wp_element_namespaceObject.useState)(false); // Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text) const [openedBy, setOpenedBy] = (0,external_wp_element_namespaceObject.useState)(null); // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); const listItemRef = (0,external_wp_element_namespaceObject.useRef)(null); const isDraggingWithin = edit_useIsDraggingWithin(listItemRef); const itemLabelPlaceholder = (0,external_wp_i18n_namespaceObject.__)('Add text…'); const ref = (0,external_wp_element_namespaceObject.useRef)(); const pagesPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('pages'); const postsPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('posts'); const { parentCount, isParentOfSelectedBlock, isImmediateParentOfSelectedBlock, hasChildren, selectedBlockHasChildren, onlyDescendantIsEmptyLink } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { hasSelectedInnerBlock, getSelectedBlockClientId, getBlockParentsByBlockName, getBlock, getBlockCount, getBlockOrder } = select(external_wp_blockEditor_namespaceObject.store); let _onlyDescendantIsEmptyLink; const selectedBlockId = getSelectedBlockClientId(); const selectedBlockChildren = getBlockOrder(selectedBlockId); // Check for a single descendant in the submenu. If that block // is a link block in a "placeholder" state with no label then // we can consider as an "empty" link. if (selectedBlockChildren?.length === 1) { const singleBlock = getBlock(selectedBlockChildren[0]); _onlyDescendantIsEmptyLink = singleBlock?.name === 'core/navigation-link' && !singleBlock?.attributes?.label; } return { parentCount: getBlockParentsByBlockName(clientId, 'core/navigation-submenu').length, isParentOfSelectedBlock: hasSelectedInnerBlock(clientId, true), isImmediateParentOfSelectedBlock: hasSelectedInnerBlock(clientId, false), hasChildren: !!getBlockCount(clientId), selectedBlockHasChildren: !!selectedBlockChildren?.length, onlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink }; }, [clientId]); const prevHasChildren = (0,external_wp_compose_namespaceObject.usePrevious)(hasChildren); // Show the LinkControl on mount if the URL is empty // ( When adding a new menu item) // This can't be done in the useState call because it conflicts // with the autofocus behavior of the BlockListBlock component. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!openSubmenusOnClick && !url) { setIsLinkOpen(true); } }, []); /** * The hook shouldn't be necessary but due to a focus loss happening * when selecting a suggestion in the link popover, we force close on block unselection. */ (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isSelected) { setIsLinkOpen(false); } }, [isSelected]); // If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text. (0,external_wp_element_namespaceObject.useEffect)(() => { if (isLinkOpen && url) { // Does this look like a URL and have something TLD-ish? if ((0,external_wp_url_namespaceObject.isURL)((0,external_wp_url_namespaceObject.prependHTTP)(label)) && /^.+\.[a-z]+/.test(label)) { // Focus and select the label text. selectLabelText(); } } }, [url]); /** * Focus the Link label text and select it. */ function selectLabelText() { ref.current.focus(); const { ownerDocument } = ref.current; const { defaultView } = ownerDocument; const selection = defaultView.getSelection(); const range = ownerDocument.createRange(); // Get the range of the current ref contents so we can add this range to the selection. range.selectNodeContents(ref.current); selection.removeAllRanges(); selection.addRange(range); } let userCanCreate = false; if (!type || type === 'page') { userCanCreate = pagesPermissions.canCreate; } else if (type === 'post') { userCanCreate = postsPermissions.canCreate; } const { textColor, customTextColor, backgroundColor, customBackgroundColor } = getColors(context, parentCount > 0); function onKeyDown(event) { if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'k')) { // Required to prevent the command center from opening, // as it shares the CMD+K shortcut. // See https://github.com/WordPress/gutenberg/pull/59845. event.preventDefault(); // If we don't stop propogation, this event bubbles up to the parent submenu item event.stopPropagation(); setIsLinkOpen(true); setOpenedBy(ref.current); } } const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, listItemRef]), className: dist_clsx('wp-block-navigation-item', { 'is-editing': isSelected || isParentOfSelectedBlock, 'is-dragging-within': isDraggingWithin, 'has-link': !!url, 'has-child': hasChildren, 'has-text-color': !!textColor || !!customTextColor, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor)]: !!textColor, 'has-background': !!backgroundColor || customBackgroundColor, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor)]: !!backgroundColor, 'open-on-click': openSubmenusOnClick }), style: { color: !textColor && customTextColor, backgroundColor: !backgroundColor && customBackgroundColor }, onKeyDown }); // Always use overlay colors for submenus. const innerBlocksColors = getColors(context, true); const allowedBlocks = parentCount >= maxNestingLevel ? ALLOWED_BLOCKS.filter(blockName => blockName !== 'core/navigation-submenu') : ALLOWED_BLOCKS; const navigationChildBlockProps = getNavigationChildBlockProps(innerBlocksColors); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(navigationChildBlockProps, { allowedBlocks, defaultBlock: navigation_submenu_edit_DEFAULT_BLOCK, directInsert: true, // Ensure block toolbar is not too far removed from item // being edited. // see: https://github.com/WordPress/gutenberg/pull/34615. __experimentalCaptureToolbars: true, renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren || // Show the appender while dragging to allow inserting element between item and the appender. hasChildren ? external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender : false }); const ParentElement = openSubmenusOnClick ? 'button' : 'a'; function transformToLink() { const newLinkBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', attributes); replaceBlock(clientId, newLinkBlock); } (0,external_wp_element_namespaceObject.useEffect)(() => { // If block becomes empty, transform to Navigation Link. if (!hasChildren && prevHasChildren) { // This side-effect should not create an undo level as those should // only be created via user interactions. __unstableMarkNextChangeAsNotPersistent(); transformToLink(); } }, [hasChildren, prevHasChildren]); const canConvertToLink = !selectedBlockHasChildren || onlyDescendantIsEmptyLink; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [!openSubmenusOnClick && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { name: "link", icon: library_link, title: (0,external_wp_i18n_namespaceObject.__)('Link'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k'), onClick: event => { setIsLinkOpen(true); setOpenedBy(event.currentTarget); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { name: "revert", icon: remove_submenu, title: (0,external_wp_i18n_namespaceObject.__)('Convert to Link'), onClick: transformToLink, className: "wp-block-navigation__submenu__revert", isDisabled: !canConvertToLink })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: label || '', onChange: labelValue => { setAttributes({ label: labelValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Text'), autoComplete: "off" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: url || '', onChange: urlValue => { setAttributes({ url: urlValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Link'), autoComplete: "off" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { __nextHasNoMarginBottom: true, value: description || '', onChange: descriptionValue => { setAttributes({ description: descriptionValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Description'), help: (0,external_wp_i18n_namespaceObject.__)('The description will be displayed in the menu if the current theme supports it.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: title || '', onChange: titleValue => { setAttributes({ title: titleValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'), autoComplete: "off", help: (0,external_wp_i18n_namespaceObject.__)('Additional information to help clarify the purpose of the link.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, value: rel || '', onChange: relValue => { setAttributes({ rel: relValue }); }, label: (0,external_wp_i18n_namespaceObject.__)('Rel attribute'), autoComplete: "off", help: (0,external_wp_i18n_namespaceObject.__)('The relationship of the linked URL as space-separated link types.') })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...blockProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ParentElement, { className: "wp-block-navigation-item__content", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { ref: ref, identifier: "label", className: "wp-block-navigation-item__label", value: label, onChange: labelValue => setAttributes({ label: labelValue }), onMerge: mergeBlocks, onReplace: onReplace, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigation link text'), placeholder: itemLabelPlaceholder, withoutInteractiveFormatting: true, allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'], onClick: () => { if (!openSubmenusOnClick && !url) { setIsLinkOpen(true); setOpenedBy(ref.current); } } }), !openSubmenusOnClick && isLinkOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkUI, { clientId: clientId, link: attributes, onClose: () => { setIsLinkOpen(false); if (openedBy) { openedBy.focus(); setOpenedBy(null); } else { selectBlock(clientId); } }, anchor: popoverAnchor, hasCreateSuggestion: userCanCreate, onRemove: () => { setAttributes({ url: '' }); (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive'); }, onChange: updatedValue => { updateAttributes(updatedValue, setAttributes, attributes); } })] }), (showSubmenuIcon || openSubmenusOnClick) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "wp-block-navigation__submenu-icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemSubmenuIcon, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps })] })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/save.js /** * WordPress dependencies */ function navigation_submenu_save_save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/transforms.js /** * WordPress dependencies */ const navigation_submenu_transforms_transforms = { to: [{ type: 'block', blocks: ['core/navigation-link'], isMatch: (attributes, block) => block?.innerBlocks?.length === 0, transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', attributes) }, { type: 'block', blocks: ['core/spacer'], isMatch: (attributes, block) => block?.innerBlocks?.length === 0, transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/spacer'); } }, { type: 'block', blocks: ['core/site-logo'], isMatch: (attributes, block) => block?.innerBlocks?.length === 0, transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/site-logo'); } }, { type: 'block', blocks: ['core/home-link'], isMatch: (attributes, block) => block?.innerBlocks?.length === 0, transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/home-link'); } }, { type: 'block', blocks: ['core/social-links'], isMatch: (attributes, block) => block?.innerBlocks?.length === 0, transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/social-links'); } }, { type: 'block', blocks: ['core/search'], isMatch: (attributes, block) => block?.innerBlocks?.length === 0, transform: () => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/search'); } }] }; /* harmony default export */ const navigation_submenu_transforms = (navigation_submenu_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const navigation_submenu_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/navigation-submenu", title: "Submenu", category: "design", parent: ["core/navigation"], description: "Add a submenu to your navigation.", textdomain: "default", attributes: { label: { type: "string" }, type: { type: "string" }, description: { type: "string" }, rel: { type: "string" }, id: { type: "number" }, opensInNewTab: { type: "boolean", "default": false }, url: { type: "string" }, title: { type: "string" }, kind: { type: "string" }, isTopLevelItem: { type: "boolean" } }, usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "maxNestingLevel", "openSubmenusOnClick", "style"], supports: { reusable: false, html: false, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-navigation-submenu-editor", style: "wp-block-navigation-submenu" }; const { name: navigation_submenu_name } = navigation_submenu_metadata; const navigation_submenu_settings = { icon: ({ context }) => { if (context === 'list-view') { return library_page; } return add_submenu; }, __experimentalLabel(attributes, { context }) { const { label } = attributes; const customName = attributes?.metadata?.name; // In the list view, use the block's menu label as the label. // If the menu label is empty, fall back to the default label. if (context === 'list-view' && (customName || label)) { return attributes?.metadata?.name || label; } return label; }, edit: NavigationSubmenuEdit, save: navigation_submenu_save_save, transforms: navigation_submenu_transforms }; const navigation_submenu_init = () => initBlock({ name: navigation_submenu_name, metadata: navigation_submenu_metadata, settings: navigation_submenu_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page-break.js /** * WordPress dependencies */ const pageBreak = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 9V6a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v3H8V6a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v3h1.5Zm0 6.5V18a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-2.5H8V18a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-2.5h1.5ZM4 13h16v-1.5H4V13Z" }) }); /* harmony default export */ const page_break = (pageBreak); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/edit.js /** * WordPress dependencies */ function NextPageEdit() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)(), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: (0,external_wp_i18n_namespaceObject.__)('Page break') }) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/save.js /** * WordPress dependencies */ function nextpage_save_save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: '<!--nextpage-->' }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/transforms.js /** * WordPress dependencies */ const nextpage_transforms_transforms = { from: [{ type: 'raw', schema: { 'wp-block': { attributes: ['data-block'] } }, isMatch: node => node.dataset && node.dataset.block === 'core/nextpage', transform() { return (0,external_wp_blocks_namespaceObject.createBlock)('core/nextpage', {}); } }] }; /* harmony default export */ const nextpage_transforms = (nextpage_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const nextpage_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/nextpage", title: "Page Break", category: "design", description: "Separate your content into a multi-page experience.", keywords: ["next page", "pagination"], parent: ["core/post-content"], textdomain: "default", supports: { customClassName: false, className: false, html: false, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-nextpage-editor" }; const { name: nextpage_name } = nextpage_metadata; const nextpage_settings = { icon: page_break, example: {}, transforms: nextpage_transforms, edit: NextPageEdit, save: nextpage_save_save }; const nextpage_init = () => initBlock({ name: nextpage_name, metadata: nextpage_metadata, settings: nextpage_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pattern/recursion-detector.js /** * THIS MODULE IS INTENTIONALLY KEPT WITHIN THE PATTERN BLOCK'S SOURCE. * * This is because this approach for preventing infinite loops due to * recursively rendering blocks is specific to the way that the `core/pattern` * block behaves in the editor. Any other block types that deal with recursion * SHOULD USE THE STANDARD METHOD for avoiding loops: * * @see https://github.com/WordPress/gutenberg/pull/31455 * @see packages/block-editor/src/components/recursion-provider/README.md */ /** * WordPress dependencies */ /** * Naming is hard. * * @see useParsePatternDependencies * * @type {WeakMap<Object, Function>} */ const cachedParsers = new WeakMap(); /** * Hook used by PatternEdit to parse block patterns. It returns a function that * takes a pattern and returns nothing but throws an error if the pattern is * recursive. * * @example * ```js * const parsePatternDependencies = useParsePatternDependencies(); * parsePatternDependencies( selectedPattern ); * ``` * * @see parsePatternDependencies * * @return {Function} A function to parse block patterns. */ function useParsePatternDependencies() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); // Instead of caching maps, go straight to the point and cache bound // functions. Each of those functions is bound to a different Map that will // keep track of patterns in the context of the given registry. if (!cachedParsers.has(registry)) { const deps = new Map(); cachedParsers.set(registry, parsePatternDependencies.bind(null, deps)); } return cachedParsers.get(registry); } /** * Parse a given pattern and traverse its contents to detect any subsequent * patterns on which it may depend. Such occurrences will be added to an * internal dependency graph. If a circular dependency is detected, an * error will be thrown. * * EXPORTED FOR TESTING PURPOSES ONLY. * * @param {Map<string, Set<string>>} deps Map of pattern dependencies. * @param {Object} pattern Pattern. * @param {string} pattern.name Pattern name. * @param {Array} pattern.blocks Pattern's block list. * * @throws {Error} If a circular dependency is detected. */ function parsePatternDependencies(deps, { name, blocks }) { const queue = [...blocks]; while (queue.length) { const block = queue.shift(); for (const innerBlock of (_block$innerBlocks = block.innerBlocks) !== null && _block$innerBlocks !== void 0 ? _block$innerBlocks : []) { var _block$innerBlocks; queue.unshift(innerBlock); } if (block.name === 'core/pattern') { registerDependency(deps, name, block.attributes.slug); } } } /** * Declare that pattern `a` depends on pattern `b`. If a circular * dependency is detected, an error will be thrown. * * EXPORTED FOR TESTING PURPOSES ONLY. * * @param {Map<string, Set<string>>} deps Map of pattern dependencies. * @param {string} a Slug for pattern A. * @param {string} b Slug for pattern B. * * @throws {Error} If a circular dependency is detected. */ function registerDependency(deps, a, b) { if (!deps.has(a)) { deps.set(a, new Set()); } deps.get(a).add(b); if (hasCycle(deps, a)) { throw new TypeError(`Pattern ${a} has a circular dependency and cannot be rendered.`); } } /** * Determine if a given pattern has circular dependencies on other patterns. * This will be determined by running a depth-first search on the current state * of the graph represented by `patternDependencies`. * * @param {Map<string, Set<string>>} deps Map of pattern dependencies. * @param {string} slug Pattern slug. * @param {Set<string>} [visitedNodes] Set to track visited nodes in the graph. * @param {Set<string>} [currentPath] Set to track and backtrack graph paths. * @return {boolean} Whether any cycle was found. */ function hasCycle(deps, slug, visitedNodes = new Set(), currentPath = new Set()) { var _deps$get; visitedNodes.add(slug); currentPath.add(slug); const dependencies = (_deps$get = deps.get(slug)) !== null && _deps$get !== void 0 ? _deps$get : new Set(); for (const dependency of dependencies) { if (!visitedNodes.has(dependency)) { if (hasCycle(deps, dependency, visitedNodes, currentPath)) { return true; } } else if (currentPath.has(dependency)) { return true; } } // Remove the current node from the current path when backtracking currentPath.delete(slug); return false; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pattern/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ const PatternEdit = ({ attributes, clientId }) => { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const selectedPattern = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetParsedPattern(attributes.slug), [attributes.slug]); const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.stylesheet, []); const { replaceBlocks, setBlockEditingMode, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { getBlockRootClientId, getBlockEditingMode } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const [hasRecursionError, setHasRecursionError] = (0,external_wp_element_namespaceObject.useState)(false); const parsePatternDependencies = useParsePatternDependencies(); // Duplicated in packages/editor/src/components/start-template-options/index.js. function injectThemeAttributeInBlockTemplateContent(block) { if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) { block.innerBlocks = block.innerBlocks.map(innerBlock => { if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) { innerBlock.attributes.theme = currentThemeStylesheet; } return innerBlock; }); } if (block.name === 'core/template-part' && block.attributes.theme === undefined) { block.attributes.theme = currentThemeStylesheet; } return block; } // Run this effect when the component loads. // This adds the Pattern's contents to the post. // This change won't be saved. // It will continue to pull from the pattern file unless changes are made to its respective template part. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!hasRecursionError && selectedPattern?.blocks) { try { parsePatternDependencies(selectedPattern); } catch (error) { setHasRecursionError(true); return; } // We batch updates to block list settings to avoid triggering cascading renders // for each container block included in a tree and optimize initial render. // Since the above uses microtasks, we need to use a microtask here as well, // because nested pattern blocks cannot be inserted if the parent block supports // inner blocks but doesn't have blockSettings in the state. window.queueMicrotask(() => { const rootClientId = getBlockRootClientId(clientId); // Clone blocks from the pattern before insertion to ensure they receive // distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628. const clonedBlocks = selectedPattern.blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(injectThemeAttributeInBlockTemplateContent(block))); // If the pattern has a single block and categories, we should add the // categories of the pattern to the block's metadata. if (clonedBlocks.length === 1 && selectedPattern.categories?.length > 0) { clonedBlocks[0].attributes = { ...clonedBlocks[0].attributes, metadata: { ...clonedBlocks[0].attributes.metadata, categories: selectedPattern.categories, patternName: selectedPattern.name, name: clonedBlocks[0].attributes.metadata.name || selectedPattern.title } }; } const rootEditingMode = getBlockEditingMode(rootClientId); registry.batch(() => { // Temporarily set the root block to default mode to allow replacing the pattern. // This could happen when the page is disabling edits of non-content blocks. __unstableMarkNextChangeAsNotPersistent(); setBlockEditingMode(rootClientId, 'default'); __unstableMarkNextChangeAsNotPersistent(); replaceBlocks(clientId, clonedBlocks); // Restore the root block's original mode. __unstableMarkNextChangeAsNotPersistent(); setBlockEditingMode(rootClientId, rootEditingMode); }); }); } }, [clientId, hasRecursionError, selectedPattern, __unstableMarkNextChangeAsNotPersistent, replaceBlocks, getBlockEditingMode, setBlockEditingMode, getBlockRootClientId]); const props = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(); if (hasRecursionError) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: A warning in which %s is the name of a pattern. (0,external_wp_i18n_namespaceObject.__)('Pattern "%s" cannot be rendered inside itself.'), selectedPattern?.name) }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props }); }; /* harmony default export */ const pattern_edit = (PatternEdit); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pattern/index.js /** * Internal dependencies */ const pattern_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/pattern", title: "Pattern placeholder", category: "theme", description: "Show a block pattern.", supports: { html: false, inserter: false, renaming: false, interactivity: { clientNavigation: true } }, textdomain: "default", attributes: { slug: { type: "string" } } }; const { name: pattern_name } = pattern_metadata; const pattern_settings = { edit: pattern_edit }; const pattern_init = () => initBlock({ name: pattern_name, metadata: pattern_metadata, settings: pattern_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js /** * WordPress dependencies */ const pages = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" })] }); /* harmony default export */ const library_pages = (pages); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/use-convert-to-navigation-links.js /** * WordPress dependencies */ /** * Converts an array of pages into a nested array of navigation link blocks. * * @param {Array} pages An array of pages. * * @return {Array} A nested array of navigation link blocks. */ function createNavigationLinks(pages = []) { const linkMap = {}; const navigationLinks = []; pages.forEach(({ id, title, link: url, type, parent }) => { var _linkMap$id$innerBloc; // See if a placeholder exists. This is created if children appear before parents in list. const innerBlocks = (_linkMap$id$innerBloc = linkMap[id]?.innerBlocks) !== null && _linkMap$id$innerBloc !== void 0 ? _linkMap$id$innerBloc : []; linkMap[id] = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', { id, label: title.rendered, url, type, kind: 'post-type' }, innerBlocks); if (!parent) { navigationLinks.push(linkMap[id]); } else { if (!linkMap[parent]) { // Use a placeholder if the child appears before parent in list. linkMap[parent] = { innerBlocks: [] }; } // Although these variables are not referenced, they are needed to store the innerBlocks in memory. const parentLinkInnerBlocks = linkMap[parent].innerBlocks; parentLinkInnerBlocks.push(linkMap[id]); } }); return navigationLinks; } /** * Finds a navigation link block by id, recursively. * It might be possible to make this a more generic helper function. * * @param {Array} navigationLinks An array of navigation link blocks. * @param {number} id The id of the navigation link to find. * * @return {Object|null} The navigation link block with the given id. */ function findNavigationLinkById(navigationLinks, id) { for (const navigationLink of navigationLinks) { // Is this the link we're looking for? if (navigationLink.attributes.id === id) { return navigationLink; } // If not does it have innerBlocks? if (navigationLink.innerBlocks && navigationLink.innerBlocks.length) { const foundNavigationLink = findNavigationLinkById(navigationLink.innerBlocks, id); if (foundNavigationLink) { return foundNavigationLink; } } } return null; } function convertToNavigationLinks(pages = [], parentPageID = null) { let navigationLinks = createNavigationLinks(pages); // If a parent page ID is provided, only return the children of that page. if (parentPageID) { const parentPage = findNavigationLinkById(navigationLinks, parentPageID); if (parentPage && parentPage.innerBlocks) { navigationLinks = parentPage.innerBlocks; } } // Transform all links with innerBlocks into Submenus. This can't be done // sooner because page objects have no information on their children. const transformSubmenus = listOfLinks => { listOfLinks.forEach((block, index, listOfLinksArray) => { const { attributes, innerBlocks } = block; if (innerBlocks.length !== 0) { transformSubmenus(innerBlocks); const transformedBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', attributes, innerBlocks); listOfLinksArray[index] = transformedBlock; } }); }; transformSubmenus(navigationLinks); return navigationLinks; } function useConvertToNavigationLinks({ clientId, pages, parentClientId, parentPageID }) { const { replaceBlock, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return () => { const navigationLinks = convertToNavigationLinks(pages, parentPageID); // Replace the Page List block with the Navigation Links. replaceBlock(clientId, navigationLinks); // Select the Navigation block to reveal the changes. selectBlock(parentClientId); }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/convert-to-links-modal.js /** * WordPress dependencies */ const convertDescription = (0,external_wp_i18n_namespaceObject.__)("This Navigation Menu displays your website's pages. Editing it will enable you to add, delete, or reorder pages. However, new pages will no longer be added automatically."); function ConvertToLinksModal({ onClick, onClose, disabled }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { onRequestClose: onClose, title: (0,external_wp_i18n_namespaceObject.__)('Edit Page List'), className: "wp-block-page-list-modal", aria: { describedby: (0,external_wp_compose_namespaceObject.useInstanceId)(ConvertToLinksModal, 'wp-block-page-list-modal__description') }, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { id: (0,external_wp_compose_namespaceObject.useInstanceId)(ConvertToLinksModal, 'wp-block-page-list-modal__description'), children: convertDescription }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "wp-block-page-list-modal-buttons", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: onClose, children: (0,external_wp_i18n_namespaceObject.__)('Cancel') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", __experimentalIsFocusable: true, disabled: disabled, onClick: onClick, children: (0,external_wp_i18n_namespaceObject.__)('Edit') })] })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // We only show the edit option when page count is <= MAX_PAGE_COUNT // Performance of Navigation Links is not good past this value. const MAX_PAGE_COUNT = 100; const NOOP = () => {}; function BlockContent({ blockProps, innerBlocksProps, hasResolvedPages, blockList, pages, parentPageID }) { if (!hasResolvedPages) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-page-list__loading-indicator-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "wp-block-page-list__loading-indicator" }) }) }); } if (pages === null) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.') }) }); } if (pages.length === 0) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "info", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.') }) }); } if (blockList.length === 0) { const parentPageDetails = pages.find(page => page.id === parentPageID); if (parentPageDetails?.title?.rendered) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { children: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Page title. (0,external_wp_i18n_namespaceObject.__)('Page List: "%s" page has no children.'), parentPageDetails.title.rendered) }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.') }) }); } if (pages.length > 0) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { ...innerBlocksProps }); } } function PageListEdit({ context, clientId, attributes, setAttributes }) { const { parentPageID } = attributes; const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false); const openModal = (0,external_wp_element_namespaceObject.useCallback)(() => setOpen(true), []); const closeModal = () => setOpen(false); const { records: pages, hasResolved: hasResolvedPages } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'page', { per_page: MAX_PAGE_COUNT, _fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'], // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent // sort. orderby: 'menu_order', order: 'asc' }); const allowConvertToLinks = 'showSubmenuIcon' in context && pages?.length > 0 && pages?.length <= MAX_PAGE_COUNT; const pagesByParentId = (0,external_wp_element_namespaceObject.useMemo)(() => { if (pages === null) { return new Map(); } // TODO: Once the REST API supports passing multiple values to // 'orderby', this can be removed. // https://core.trac.wordpress.org/ticket/39037 const sortedPages = pages.sort((a, b) => { if (a.menu_order === b.menu_order) { return a.title.rendered.localeCompare(b.title.rendered); } return a.menu_order - b.menu_order; }); return sortedPages.reduce((accumulator, page) => { const { parent } = page; if (accumulator.has(parent)) { accumulator.get(parent).push(page); } else { accumulator.set(parent, [page]); } return accumulator; }, new Map()); }, [pages]); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: dist_clsx('wp-block-page-list', { 'has-text-color': !!context.textColor, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', context.textColor)]: !!context.textColor, 'has-background': !!context.backgroundColor, [(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', context.backgroundColor)]: !!context.backgroundColor }), style: { ...context.style?.color } }); const pagesTree = (0,external_wp_element_namespaceObject.useMemo)(function makePagesTree(parentId = 0, level = 0) { const childPages = pagesByParentId.get(parentId); if (!childPages?.length) { return []; } return childPages.reduce((tree, page) => { const hasChildren = pagesByParentId.has(page.id); const item = { value: page.id, label: '— '.repeat(level) + page.title.rendered, rawName: page.title.rendered }; tree.push(item); if (hasChildren) { tree.push(...makePagesTree(page.id, level + 1)); } return tree; }, []); }, [pagesByParentId]); const blockList = (0,external_wp_element_namespaceObject.useMemo)(function getBlockList(parentId = parentPageID) { const childPages = pagesByParentId.get(parentId); if (!childPages?.length) { return []; } return childPages.reduce((template, page) => { const hasChildren = pagesByParentId.has(page.id); const pageProps = { id: page.id, label: // translators: displayed when a page has an empty title. page.title?.rendered?.trim() !== '' ? page.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'), title: page.title?.rendered, link: page.url, hasChildren }; let item = null; const children = getBlockList(page.id); item = (0,external_wp_blocks_namespaceObject.createBlock)('core/page-list-item', pageProps, children); template.push(item); return template; }, []); }, [pagesByParentId, parentPageID]); const { isNested, hasSelectedChild, parentClientId, hasDraggedChild, isChildOfNavigation } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockParentsByBlockName, hasSelectedInnerBlock, hasDraggedInnerBlock } = select(external_wp_blockEditor_namespaceObject.store); const blockParents = getBlockParentsByBlockName(clientId, 'core/navigation-submenu', true); const navigationBlockParents = getBlockParentsByBlockName(clientId, 'core/navigation', true); return { isNested: blockParents.length > 0, isChildOfNavigation: navigationBlockParents.length > 0, hasSelectedChild: hasSelectedInnerBlock(clientId, true), hasDraggedChild: hasDraggedInnerBlock(clientId, true), parentClientId: navigationBlockParents[0] }; }, [clientId]); const convertToNavigationLinks = useConvertToNavigationLinks({ clientId, pages, parentClientId, parentPageID }); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, { renderAppender: false, __unstableDisableDropZone: true, templateLock: isChildOfNavigation ? false : 'all', onInput: NOOP, onChange: NOOP, value: blockList }); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasSelectedChild || hasDraggedChild) { openModal(); selectBlock(parentClientId); } }, [hasSelectedChild, hasDraggedChild, parentClientId, selectBlock, openModal]); (0,external_wp_element_namespaceObject.useEffect)(() => { setAttributes({ isNested }); }, [isNested, setAttributes]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: [pagesTree.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { __next40pxDefaultSize: true, className: "editor-page-attributes__parent", label: (0,external_wp_i18n_namespaceObject.__)('Parent'), value: parentPageID, options: pagesTree, onChange: value => setAttributes({ parentPageID: value !== null && value !== void 0 ? value : 0 }), help: (0,external_wp_i18n_namespaceObject.__)('Choose a page to show only its subpages.') }) }), allowConvertToLinks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Edit this menu'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: convertDescription }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", __experimentalIsFocusable: true, disabled: !hasResolvedPages, onClick: convertToNavigationLinks, children: (0,external_wp_i18n_namespaceObject.__)('Edit') })] })] }), allowConvertToLinks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { title: (0,external_wp_i18n_namespaceObject.__)('Edit'), onClick: openModal, children: (0,external_wp_i18n_namespaceObject.__)('Edit') }) }), isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToLinksModal, { onClick: convertToNavigationLinks, onClose: closeModal, disabled: !hasResolvedPages })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContent, { blockProps: blockProps, innerBlocksProps: innerBlocksProps, hasResolvedPages: hasResolvedPages, blockList: blockList, pages: pages, parentPageID: parentPageID })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const page_list_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/page-list", title: "Page List", category: "widgets", allowedBlocks: ["core/page-list-item"], description: "Display a list of all pages.", keywords: ["menu", "navigation"], textdomain: "default", attributes: { parentPageID: { type: "integer", "default": 0 }, isNested: { type: "boolean", "default": false } }, usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "style", "openSubmenusOnClick"], supports: { reusable: false, html: false, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-page-list-editor", style: "wp-block-page-list" }; const { name: page_list_name } = page_list_metadata; const page_list_settings = { icon: library_pages, example: {}, edit: PageListEdit }; const page_list_init = () => initBlock({ name: page_list_name, metadata: page_list_metadata, settings: page_list_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/icons.js /** * WordPress dependencies */ const icons_ItemSubmenuIcon = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M1.50002 4L6.00002 8L10.5 4", strokeWidth: "1.5" }) }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list-item/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function useFrontPageId() { return (0,external_wp_data_namespaceObject.useSelect)(select => { const canReadSettings = select(external_wp_coreData_namespaceObject.store).canUser('read', 'settings'); if (!canReadSettings) { return undefined; } const site = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site'); return site?.show_on_front === 'page' && site?.page_on_front; }, []); } function PageListItemEdit({ context, attributes }) { const { id, label, link, hasChildren, title } = attributes; const isNavigationChild = ('showSubmenuIcon' in context); const frontPageId = useFrontPageId(); const innerBlocksColors = getColors(context, true); const navigationChildBlockProps = getNavigationChildBlockProps(innerBlocksColors); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(navigationChildBlockProps, { className: 'wp-block-pages-list__item' }); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: dist_clsx('wp-block-pages-list__item', { 'has-child': hasChildren, 'wp-block-navigation-item': isNavigationChild, 'open-on-click': context.openSubmenusOnClick, 'open-on-hover-click': !context.openSubmenusOnClick && context.showSubmenuIcon, 'menu-item-home': id === frontPageId }), children: [hasChildren && context.openSubmenusOnClick ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { type: "button", className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle", "aria-expanded": "false", children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(label) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_ItemSubmenuIcon, {}) })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: dist_clsx('wp-block-pages-list__item__link', { 'wp-block-navigation-item__content': isNavigationChild }), href: link, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) }), hasChildren && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!context.openSubmenusOnClick && context.showSubmenuIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon", "aria-expanded": "false", type: "button", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icons_ItemSubmenuIcon, {}) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { ...innerBlocksProps })] })] }, id); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list-item/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const page_list_item_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/page-list-item", title: "Page List Item", category: "widgets", parent: ["core/page-list"], description: "Displays a page inside a list of all pages.", keywords: ["page", "menu", "navigation"], textdomain: "default", attributes: { id: { type: "number" }, label: { type: "string" }, title: { type: "string" }, link: { type: "string" }, hasChildren: { type: "boolean" } }, usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "style", "openSubmenusOnClick"], supports: { reusable: false, html: false, lock: false, inserter: false, __experimentalToolbar: false, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-page-list-editor", style: "wp-block-page-list" }; const { name: page_list_item_name } = page_list_item_metadata; const page_list_item_settings = { __experimentalLabel: ({ label }) => label, icon: library_page, example: {}, edit: PageListItemEdit }; const page_list_item_init = () => initBlock({ name: page_list_item_name, metadata: page_list_item_metadata, settings: page_list_item_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/paragraph.js /** * WordPress dependencies */ const paragraph = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z" }) }); /* harmony default export */ const library_paragraph = (paragraph); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/deprecated.js /** * External dependencies */ /** * WordPress dependencies */ const deprecated_supports = { className: false }; const paragraph_deprecated_blockAttributes = { align: { type: 'string' }, content: { type: 'string', source: 'html', selector: 'p', default: '' }, dropCap: { type: 'boolean', default: false }, placeholder: { type: 'string' }, textColor: { type: 'string' }, backgroundColor: { type: 'string' }, fontSize: { type: 'string' }, direction: { type: 'string', enum: ['ltr', 'rtl'] }, style: { type: 'object' } }; const migrateCustomColorsAndFontSizes = attributes => { if (!attributes.customTextColor && !attributes.customBackgroundColor && !attributes.customFontSize) { return attributes; } const style = {}; if (attributes.customTextColor || attributes.customBackgroundColor) { style.color = {}; } if (attributes.customTextColor) { style.color.text = attributes.customTextColor; } if (attributes.customBackgroundColor) { style.color.background = attributes.customBackgroundColor; } if (attributes.customFontSize) { style.typography = { fontSize: attributes.customFontSize }; } const { customTextColor, customBackgroundColor, customFontSize, ...restAttributes } = attributes; return { ...restAttributes, style }; }; const { style, ...restBlockAttributes } = paragraph_deprecated_blockAttributes; const paragraph_deprecated_deprecated = [ // Version without drop cap on aligned text. { supports: deprecated_supports, attributes: { ...restBlockAttributes, customTextColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, customFontSize: { type: 'number' } }, save({ attributes }) { const { align, content, dropCap, direction } = attributes; const className = dist_clsx({ 'has-drop-cap': align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap, [`has-text-align-${align}`]: align }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className, dir: direction }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: content }) }); } }, { supports: deprecated_supports, attributes: { ...restBlockAttributes, customTextColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, customFontSize: { type: 'number' }
•
Search:
•
Replace:
1
2
3
4
5
6
7
Function
Edit by line
Download
Information
Rename
Copy
Move
Delete
Chmod
List