} [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, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: onClose,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
accessibleWhenDisabled: 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:
// translators: displayed when a page has an empty title.
page.title?.rendered?.trim() !== '' ? page.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'),
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, {
__nextHasNoMarginBottom: true,
__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, {
__next40pxDefaultSize: true,
variant: "primary",
accessibleWhenDisabled: 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', {
kind: 'root',
name: 'site'
});
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'
}
},
migrate: migrateCustomColorsAndFontSizes,
save({
attributes
}) {
const {
align,
content,
dropCap,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor,
fontSize,
customFontSize,
direction
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const fontSizeClass = (0,external_wp_blockEditor_namespaceObject.getFontSizeClass)(fontSize);
const className = dist_clsx({
'has-text-color': textColor || customTextColor,
'has-background': backgroundColor || customBackgroundColor,
'has-drop-cap': dropCap,
[`has-text-align-${align}`]: align,
[fontSizeClass]: fontSizeClass,
[textClass]: textClass,
[backgroundClass]: backgroundClass
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
fontSize: fontSizeClass ? undefined : customFontSize
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
style: styles,
className: className ? className : undefined,
value: content,
dir: direction
});
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
customTextColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customFontSize: {
type: 'number'
}
},
migrate: migrateCustomColorsAndFontSizes,
save({
attributes
}) {
const {
align,
content,
dropCap,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor,
fontSize,
customFontSize,
direction
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const fontSizeClass = (0,external_wp_blockEditor_namespaceObject.getFontSizeClass)(fontSize);
const className = dist_clsx({
'has-text-color': textColor || customTextColor,
'has-background': backgroundColor || customBackgroundColor,
'has-drop-cap': dropCap,
[fontSizeClass]: fontSizeClass,
[textClass]: textClass,
[backgroundClass]: backgroundClass
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
fontSize: fontSizeClass ? undefined : customFontSize,
textAlign: align
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
style: styles,
className: className ? className : undefined,
value: content,
dir: direction
});
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
customTextColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customFontSize: {
type: 'number'
},
width: {
type: 'string'
}
},
migrate: migrateCustomColorsAndFontSizes,
save({
attributes
}) {
const {
width,
align,
content,
dropCap,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor,
fontSize,
customFontSize
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const fontSizeClass = fontSize && `is-${fontSize}-text`;
const className = dist_clsx({
[`align${width}`]: width,
'has-background': backgroundColor || customBackgroundColor,
'has-drop-cap': dropCap,
[fontSizeClass]: fontSizeClass,
[textClass]: textClass,
[backgroundClass]: backgroundClass
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
fontSize: fontSizeClass ? undefined : customFontSize,
textAlign: align
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
style: styles,
className: className ? className : undefined,
value: content
});
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
fontSize: {
type: 'number'
}
},
save({
attributes
}) {
const {
width,
align,
content,
dropCap,
backgroundColor,
textColor,
fontSize
} = attributes;
const className = dist_clsx({
[`align${width}`]: width,
'has-background': backgroundColor,
'has-drop-cap': dropCap
});
const styles = {
backgroundColor,
color: textColor,
fontSize,
textAlign: align
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
style: styles,
className: className ? className : undefined,
children: content
});
},
migrate(attributes) {
return migrateCustomColorsAndFontSizes({
...attributes,
customFontSize: Number.isFinite(attributes.fontSize) ? attributes.fontSize : undefined,
customTextColor: attributes.textColor && '#' === attributes.textColor[0] ? attributes.textColor : undefined,
customBackgroundColor: attributes.backgroundColor && '#' === attributes.backgroundColor[0] ? attributes.backgroundColor : undefined
});
}
}, {
supports: deprecated_supports,
attributes: {
...paragraph_deprecated_blockAttributes,
content: {
type: 'string',
source: 'html',
default: ''
}
},
save({
attributes
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, {
children: attributes.content
});
},
migrate(attributes) {
return attributes;
}
}];
/* harmony default export */ const paragraph_deprecated = (paragraph_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-ltr.js
/**
* WordPress dependencies
*/
const formatLtr = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z"
})
});
/* harmony default export */ const format_ltr = (formatLtr);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/use-enter.js
/**
* WordPress dependencies
*/
function useOnEnter(props) {
const {
batch
} = (0,external_wp_data_namespaceObject.useRegistry)();
const {
moveBlocksToPosition,
replaceInnerBlocks,
duplicateBlocks,
insertBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlockRootClientId,
getBlockIndex,
getBlockOrder,
getBlockName,
getBlock,
getNextBlockClientId,
canInsertBlockType
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const propsRef = (0,external_wp_element_namespaceObject.useRef)(props);
propsRef.current = props;
return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function onKeyDown(event) {
if (event.defaultPrevented) {
return;
}
if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
return;
}
const {
content,
clientId
} = propsRef.current;
// The paragraph should be empty.
if (content.length) {
return;
}
const wrapperClientId = getBlockRootClientId(clientId);
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(wrapperClientId), '__experimentalOnEnter', false)) {
return;
}
const order = getBlockOrder(wrapperClientId);
const position = order.indexOf(clientId);
// If it is the last block, exit.
if (position === order.length - 1) {
let newWrapperClientId = wrapperClientId;
while (!canInsertBlockType(getBlockName(clientId), getBlockRootClientId(newWrapperClientId))) {
newWrapperClientId = getBlockRootClientId(newWrapperClientId);
}
if (typeof newWrapperClientId === 'string') {
event.preventDefault();
moveBlocksToPosition([clientId], wrapperClientId, getBlockRootClientId(newWrapperClientId), getBlockIndex(newWrapperClientId) + 1);
}
return;
}
const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
if (!canInsertBlockType(defaultBlockName, getBlockRootClientId(wrapperClientId))) {
return;
}
event.preventDefault();
// If it is in the middle, split the block in two.
const wrapperBlock = getBlock(wrapperClientId);
batch(() => {
duplicateBlocks([wrapperClientId]);
const blockIndex = getBlockIndex(wrapperClientId);
replaceInnerBlocks(wrapperClientId, wrapperBlock.innerBlocks.slice(0, position));
replaceInnerBlocks(getNextBlockClientId(wrapperClientId), wrapperBlock.innerBlocks.slice(position + 1));
insertBlock((0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName), blockIndex + 1, getBlockRootClientId(wrapperClientId), true);
});
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ParagraphRTLControl({
direction,
setDirection
}) {
return (0,external_wp_i18n_namespaceObject.isRTL)() && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
icon: format_ltr,
title: (0,external_wp_i18n_namespaceObject._x)('Left to right', 'editor button'),
isActive: direction === 'ltr',
onClick: () => {
setDirection(direction === 'ltr' ? undefined : 'ltr');
}
});
}
function hasDropCapDisabled(align) {
return align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center';
}
function DropCapControl({
clientId,
attributes,
setAttributes
}) {
// Please do not add a useSelect call to the paragraph block unconditionally.
// Every useSelect added to a (frequently used) block will degrade load
// and type performance. By moving it within InspectorControls, the subscription is
// now only added for the selected block(s).
const [isDropCapFeatureEnabled] = (0,external_wp_blockEditor_namespaceObject.useSettings)('typography.dropCap');
if (!isDropCapFeatureEnabled) {
return null;
}
const {
align,
dropCap
} = attributes;
let helpText;
if (hasDropCapDisabled(align)) {
helpText = (0,external_wp_i18n_namespaceObject.__)('Not available for aligned text.');
} else if (dropCap) {
helpText = (0,external_wp_i18n_namespaceObject.__)('Showing large initial letter.');
} else {
helpText = (0,external_wp_i18n_namespaceObject.__)('Toggle to show a large initial letter.');
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!dropCap,
label: (0,external_wp_i18n_namespaceObject.__)('Drop cap'),
onDeselect: () => setAttributes({
dropCap: undefined
}),
resetAllFilter: () => ({
dropCap: undefined
}),
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Drop cap'),
checked: !!dropCap,
onChange: () => setAttributes({
dropCap: !dropCap
}),
help: helpText,
disabled: hasDropCapDisabled(align) ? true : false
})
});
}
function ParagraphBlock({
attributes,
mergeBlocks,
onReplace,
onRemove,
setAttributes,
clientId
}) {
const {
align,
content,
direction,
dropCap,
placeholder
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: useOnEnter({
clientId,
content
}),
className: dist_clsx({
'has-drop-cap': hasDropCapDisabled(align) ? false : dropCap,
[`has-text-align-${align}`]: align
}),
style: {
direction
}
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [blockEditingMode === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: align,
onChange: newAlign => setAttributes({
align: newAlign,
dropCap: hasDropCapDisabled(newAlign) ? false : dropCap
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParagraphRTLControl, {
direction: direction,
setDirection: newDirection => setAttributes({
direction: newDirection
})
})]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "typography",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropCapControl, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "content",
tagName: "p",
...blockProps,
value: content,
onChange: newContent => setAttributes({
content: newContent
}),
onMerge: mergeBlocks,
onReplace: onReplace,
onRemove: onRemove,
"aria-label": external_wp_blockEditor_namespaceObject.RichText.isEmpty(content) ? (0,external_wp_i18n_namespaceObject.__)('Empty block; start writing or type forward slash to choose a block') : (0,external_wp_i18n_namespaceObject.__)('Block: Paragraph'),
"data-empty": external_wp_blockEditor_namespaceObject.RichText.isEmpty(content),
placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block'),
"data-custom-placeholder": placeholder ? true : undefined,
__unstableEmbedURLOnPaste: true,
__unstableAllowPrefixTransformations: true
})]
});
}
/* harmony default export */ const paragraph_edit = (ParagraphBlock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function paragraph_save_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
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
name: transforms_name
} = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/paragraph",
title: "Paragraph",
category: "text",
description: "Start with the basic building block of all narrative.",
keywords: ["text"],
textdomain: "default",
attributes: {
align: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "p",
role: "content"
},
dropCap: {
type: "boolean",
"default": false
},
placeholder: {
type: "string"
},
direction: {
type: "string",
"enum": ["ltr", "rtl"]
}
},
supports: {
splitting: true,
anchor: true,
className: false,
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalSelector: "p",
__unstablePasteTextInline: true,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-paragraph-editor",
style: "wp-block-paragraph"
};
const paragraph_transforms_transforms = {
from: [{
type: 'raw',
// Paragraph is a fallback and should be matched last.
priority: 20,
selector: 'p',
schema: ({
phrasingContentSchema,
isPaste
}) => ({
p: {
children: phrasingContentSchema,
attributes: isPaste ? [] : ['style', 'id']
}
}),
transform(node) {
const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(transforms_name, node.outerHTML);
const {
textAlign
} = node.style || {};
if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
attributes.align = textAlign;
}
return (0,external_wp_blocks_namespaceObject.createBlock)(transforms_name, attributes);
}
}]
};
/* harmony default export */ const paragraph_transforms = (paragraph_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const paragraph_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/paragraph",
title: "Paragraph",
category: "text",
description: "Start with the basic building block of all narrative.",
keywords: ["text"],
textdomain: "default",
attributes: {
align: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "p",
role: "content"
},
dropCap: {
type: "boolean",
"default": false
},
placeholder: {
type: "string"
},
direction: {
type: "string",
"enum": ["ltr", "rtl"]
}
},
supports: {
splitting: true,
anchor: true,
className: false,
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalSelector: "p",
__unstablePasteTextInline: true,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-paragraph-editor",
style: "wp-block-paragraph"
};
const {
name: paragraph_name
} = paragraph_metadata;
const paragraph_settings = {
icon: library_paragraph,
example: {
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.')
}
},
__experimentalLabel(attributes, {
context
}) {
const customName = attributes?.metadata?.name;
if (context === 'list-view' && customName) {
return customName;
}
if (context === 'accessibility') {
if (customName) {
return customName;
}
const {
content
} = attributes;
return !content || content.length === 0 ? (0,external_wp_i18n_namespaceObject.__)('Empty') : content;
}
},
transforms: paragraph_transforms,
deprecated: paragraph_deprecated,
merge(attributes, attributesToMerge) {
return {
content: (attributes.content || '') + (attributesToMerge.content || '')
};
},
edit: paragraph_edit,
save: paragraph_save_save
};
const paragraph_init = () => initBlock({
name: paragraph_name,
metadata: paragraph_metadata,
settings: paragraph_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-author.js
/**
* WordPress dependencies
*/
const postAuthor = /*#__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: "M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z",
fillRule: "evenodd",
clipRule: "evenodd"
})
});
/* harmony default export */ const post_author = (postAuthor);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const minimumUsersForCombobox = 25;
const edit_AUTHORS_QUERY = {
who: 'authors',
per_page: 100
};
function PostAuthorEdit({
isSelected,
context: {
postType,
postId,
queryId
},
attributes,
setAttributes
}) {
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const {
authorId,
authorDetails,
authors
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser,
getUsers
} = select(external_wp_coreData_namespaceObject.store);
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorId: _authorId,
authorDetails: _authorId ? getUser(_authorId) : null,
authors: getUsers(edit_AUTHORS_QUERY)
};
}, [postType, postId]);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
textAlign,
showAvatar,
showBio,
byline,
isLink,
linkTarget
} = attributes;
const avatarSizes = [];
const authorName = authorDetails?.name || (0,external_wp_i18n_namespaceObject.__)('Post Author');
if (authorDetails?.avatar_urls) {
Object.keys(authorDetails.avatar_urls).forEach(size => {
avatarSizes.push({
value: size,
label: `${size} x ${size}`
});
});
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
const authorOptions = authors?.length ? authors.map(({
id,
name
}) => {
return {
value: id,
label: name
};
}) : [];
const handleSelect = nextAuthorId => {
editEntityRecord('postType', postType, postId, {
author: nextAuthorId
});
};
const showCombobox = authorOptions.length >= minimumUsersForCombobox;
const showAuthorControl = !!postId && !isDescendentOfQueryLoop && authorOptions.length > 0;
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, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4,
className: "wp-block-post-author__inspector-settings",
children: [showAuthorControl && (showCombobox && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
options: authorOptions,
value: authorId,
onChange: handleSelect,
allowReset: false
}) || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
value: authorId,
options: authorOptions,
onChange: handleSelect
})), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show avatar'),
checked: showAvatar,
onChange: () => setAttributes({
showAvatar: !showAvatar
})
}), showAvatar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Avatar size'),
value: attributes.avatarSize,
options: avatarSizes,
onChange: size => {
setAttributes({
avatarSize: Number(size)
});
}
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show bio'),
checked: showBio,
onChange: () => setAttributes({
showBio: !showBio
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link author name to author page'),
checked: isLink,
onChange: () => setAttributes({
isLink: !isLink
})
}), isLink && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
})]
})
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [showAvatar && authorDetails?.avatar_urls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "wp-block-post-author__avatar",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
width: attributes.avatarSize,
src: authorDetails.avatar_urls[attributes.avatarSize],
alt: authorDetails.name
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "wp-block-post-author__content",
children: [(!external_wp_blockEditor_namespaceObject.RichText.isEmpty(byline) || isSelected) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "byline",
className: "wp-block-post-author__byline",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Post author byline text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write byline…'),
value: byline,
onChange: value => setAttributes({
byline: value
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
className: "wp-block-post-author__name",
children: isLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: "#post-author-pseudo-link",
onClick: event => event.preventDefault(),
children: authorName
}) : authorName
}), showBio && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
className: "wp-block-post-author__bio",
dangerouslySetInnerHTML: {
__html: authorDetails?.description
}
})]
})]
})]
});
}
/* harmony default export */ const post_author_edit = (PostAuthorEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_author_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-author",
title: "Author",
category: "theme",
description: "Display post author details such as name, avatar, and bio.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
avatarSize: {
type: "number",
"default": 48
},
showAvatar: {
type: "boolean",
"default": true
},
showBio: {
type: "boolean"
},
byline: {
type: "string"
},
isLink: {
type: "boolean",
"default": false
},
linkTarget: {
type: "string",
"default": "_self"
}
},
usesContext: ["postType", "postId", "queryId"],
supports: {
html: false,
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
}
},
color: {
gradients: true,
link: true,
__experimentalDuotone: ".wp-block-post-author__avatar img",
__experimentalDefaultControls: {
background: true,
text: true
}
},
interactivity: {
clientNavigation: true
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
editorStyle: "wp-block-post-author-editor",
style: "wp-block-post-author"
};
const {
name: post_author_name
} = post_author_metadata;
const post_author_settings = {
icon: post_author,
example: {
viewportWidth: 350,
attributes: {
showBio: true,
byline: (0,external_wp_i18n_namespaceObject.__)('Posted by')
}
},
edit: post_author_edit
};
const post_author_init = () => initBlock({
name: post_author_name,
metadata: post_author_metadata,
settings: post_author_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-name/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostAuthorNameEdit({
context: {
postType,
postId
},
attributes: {
textAlign,
isLink,
linkTarget
},
setAttributes
}) {
const {
authorName
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser
} = select(external_wp_coreData_namespaceObject.store);
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorName: _authorId ? getUser(_authorId) : null
};
}, [postType, postId]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
const displayName = authorName?.name || (0,external_wp_i18n_namespaceObject.__)('Author Name');
const displayAuthor = isLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: "#author-pseudo-link",
onClick: event => event.preventDefault(),
className: "wp-block-post-author-name__link",
children: displayName
}) : displayName;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__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.__)('Link to author archive'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
})]
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [" ", displayAuthor, " "]
})]
});
}
/* harmony default export */ const post_author_name_edit = (PostAuthorNameEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-name/transforms.js
/**
* WordPress dependencies
*/
const post_author_name_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/post-author'],
transform: ({
textAlign
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-author-name', {
textAlign
})
}],
to: [{
type: 'block',
blocks: ['core/post-author'],
transform: ({
textAlign
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-author', {
textAlign
})
}]
};
/* harmony default export */ const post_author_name_transforms = (post_author_name_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-name/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_author_name_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-author-name",
title: "Author Name",
category: "theme",
description: "The author name.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
isLink: {
type: "boolean",
"default": false
},
linkTarget: {
type: "string",
"default": "_self"
}
},
usesContext: ["postType", "postId"],
example: {
viewportWidth: 350
},
supports: {
html: false,
spacing: {
margin: true,
padding: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
style: "wp-block-post-author-name"
};
const {
name: post_author_name_name
} = post_author_name_metadata;
const post_author_name_settings = {
icon: post_author,
transforms: post_author_name_transforms,
edit: post_author_name_edit
};
const post_author_name_init = () => initBlock({
name: post_author_name_name,
metadata: post_author_name_metadata,
settings: post_author_name_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-biography/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostAuthorBiographyEdit({
context: {
postType,
postId
},
attributes: {
textAlign
},
setAttributes
}) {
const {
authorDetails
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser
} = select(external_wp_coreData_namespaceObject.store);
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorDetails: _authorId ? getUser(_authorId) : null
};
}, [postType, postId]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
const displayAuthorBiography = authorDetails?.description || (0,external_wp_i18n_namespaceObject.__)('Author Biography');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
dangerouslySetInnerHTML: {
__html: displayAuthorBiography
}
})]
});
}
/* harmony default export */ const post_author_biography_edit = (PostAuthorBiographyEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-biography/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_author_biography_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-author-biography",
title: "Author Biography",
category: "theme",
description: "The author biography.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
usesContext: ["postType", "postId"],
example: {
viewportWidth: 350
},
supports: {
spacing: {
margin: true,
padding: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
style: "wp-block-post-author-biography"
};
const {
name: post_author_biography_name
} = post_author_biography_metadata;
const post_author_biography_settings = {
icon: post_author,
edit: post_author_biography_edit
};
const post_author_biography_init = () => initBlock({
name: post_author_biography_name,
metadata: post_author_biography_metadata,
settings: post_author_biography_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
/**
* WordPress dependencies
*/
const blockDefault = /*#__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: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
})
});
/* harmony default export */ const block_default = (blockDefault);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comment/edit.js
/**
* WordPress dependencies
*/
const post_comment_edit_TEMPLATE = [['core/avatar'], ['core/comment-author-name'], ['core/comment-date'], ['core/comment-content'], ['core/comment-reply-link'], ['core/comment-edit-link']];
function post_comment_edit_Edit({
attributes: {
commentId
},
setAttributes
}) {
const [commentIdInput, setCommentIdInput] = (0,external_wp_element_namespaceObject.useState)(commentId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: post_comment_edit_TEMPLATE
});
if (!commentId) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Placeholder, {
icon: block_default,
label: (0,external_wp_i18n_namespaceObject._x)('Post Comment', 'block title'),
instructions: (0,external_wp_i18n_namespaceObject.__)('To show a comment, input the comment ID.'),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
value: commentId,
onChange: val => setCommentIdInput(parseInt(val))
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
onClick: () => {
setAttributes({
commentId: commentIdInput
});
},
children: (0,external_wp_i18n_namespaceObject.__)('Save')
})]
})
});
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comment/save.js
/**
* WordPress dependencies
*/
function post_comment_save_save() {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comment/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comment_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/post-comment",
title: "Comment (deprecated)",
category: "theme",
allowedBlocks: ["core/avatar", "core/comment-author-name", "core/comment-content", "core/comment-date", "core/comment-edit-link", "core/comment-reply-link"],
description: "This block is deprecated. Please use the Comments block instead.",
textdomain: "default",
attributes: {
commentId: {
type: "number"
}
},
providesContext: {
commentId: "commentId"
},
supports: {
html: false,
inserter: false,
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_comment_name
} = post_comment_metadata;
const post_comment_settings = {
icon: library_comment,
edit: post_comment_edit_Edit,
save: post_comment_save_save
};
const post_comment_init = () => initBlock({
name: post_comment_name,
metadata: post_comment_metadata,
settings: post_comment_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-comments-count.js
/**
* WordPress dependencies
*/
const postCommentsCount = /*#__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 8H4v1.5h9V8zM4 4v1.5h16V4H4zm9 8H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1V13c0-.6-.4-1-1-1zm-2.2 6.6H7l1.6-2.2c.3-.4.5-.7.6-.9.1-.2.2-.4.2-.5 0-.2-.1-.3-.1-.4-.1-.1-.2-.1-.4-.1s-.4 0-.6.1c-.3.1-.5.3-.7.4l-.2.2-.2-1.2.1-.1c.3-.2.5-.3.8-.4.3-.1.6-.1.9-.1.3 0 .6.1.9.2.2.1.4.3.6.5.1.2.2.5.2.7 0 .3-.1.6-.2.9-.1.3-.4.7-.7 1.1l-.5.6h1.6v1.2z"
})
});
/* harmony default export */ const post_comments_count = (postCommentsCount);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-count/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostCommentsCountEdit({
attributes,
context,
setAttributes
}) {
const {
textAlign
} = attributes;
const {
postId
} = context;
const [commentsCount, setCommentsCount] = (0,external_wp_element_namespaceObject.useState)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!postId) {
return;
}
const currentPostId = postId;
external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/comments', {
post: postId
}),
parse: false
}).then(res => {
// Stale requests will have the `currentPostId` of an older closure.
if (currentPostId === postId) {
setCommentsCount(res.headers.get('X-WP-Total'));
}
});
}, [postId]);
const hasPostAndComments = postId && commentsCount !== undefined;
const blockStyles = {
...blockProps.style,
textDecoration: hasPostAndComments ? blockProps.style?.textDecoration : undefined
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
style: blockStyles,
children: hasPostAndComments ? commentsCount : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, {
children: (0,external_wp_i18n_namespaceObject.__)('Post Comments Count block: post not found.')
})
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-count/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comments_count_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/post-comments-count",
title: "Comments Count",
category: "theme",
description: "Display a post's comments count.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
usesContext: ["postId"],
supports: {
html: false,
color: {
gradients: 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
}
}
};
const {
name: post_comments_count_name
} = post_comments_count_metadata;
const post_comments_count_settings = {
icon: post_comments_count,
edit: PostCommentsCountEdit
};
const post_comments_count_init = () => initBlock({
name: post_comments_count_name,
metadata: post_comments_count_metadata,
settings: post_comments_count_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-comments-form.js
/**
* WordPress dependencies
*/
const postCommentsForm = /*#__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 8H4v1.5h9V8zM4 4v1.5h16V4H4zm9 8H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1V13c0-.6-.4-1-1-1zm-.5 6.6H6.7l-1.2 1.2v-6.3h7v5.1z"
})
});
/* harmony default export */ const post_comments_form = (postCommentsForm);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-form/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostCommentsFormEdit({
attributes,
context,
setAttributes
}) {
const {
textAlign
} = attributes;
const {
postId,
postType
} = context;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostCommentsFormEdit);
const instanceIdDesc = (0,external_wp_i18n_namespaceObject.sprintf)('comments-form-edit-%d-desc', instanceId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
}),
'aria-describedby': instanceIdDesc
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments_form_form, {
postId: postId,
postType: postType
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
id: instanceIdDesc,
children: (0,external_wp_i18n_namespaceObject.__)('Comments form disabled in editor.')
})]
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-form/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comments_form_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-comments-form",
title: "Comments Form",
category: "theme",
description: "Display a post's comments form.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
usesContext: ["postId", "postType"],
supports: {
html: false,
color: {
gradients: true,
heading: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
editorStyle: "wp-block-post-comments-form-editor",
style: ["wp-block-post-comments-form", "wp-block-buttons", "wp-block-button"]
};
const {
name: post_comments_form_name
} = post_comments_form_metadata;
const post_comments_form_settings = {
icon: post_comments_form,
edit: PostCommentsFormEdit
};
const post_comments_form_init = () => initBlock({
name: post_comments_form_name,
metadata: post_comments_form_metadata,
settings: post_comments_form_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostCommentsLinkEdit({
context,
attributes,
setAttributes
}) {
const {
textAlign
} = attributes;
const {
postType,
postId
} = context;
const [commentsCount, setCommentsCount] = (0,external_wp_element_namespaceObject.useState)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!postId) {
return;
}
const currentPostId = postId;
external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/comments', {
post: postId
}),
parse: false
}).then(res => {
// Stale requests will have the `currentPostId` of an older closure.
if (currentPostId === postId) {
setCommentsCount(res.headers.get('X-WP-Total'));
}
});
}, [postId]);
const post = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId), [postType, postId]);
if (!post) {
return null;
}
const {
link
} = post;
let commentsText;
if (commentsCount !== undefined) {
const commentsNumber = parseInt(commentsCount);
if (commentsNumber === 0) {
commentsText = (0,external_wp_i18n_namespaceObject.__)('No comments');
} else {
commentsText = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Number of comments */
(0,external_wp_i18n_namespaceObject._n)('%s comment', '%s comments', commentsNumber), commentsNumber.toLocaleString());
}
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
children: link && commentsText !== undefined ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: link + '#comments',
onClick: event => event.preventDefault(),
children: commentsText
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, {
children: (0,external_wp_i18n_namespaceObject.__)('Post Comments Link block: post not found.')
})
})]
});
}
/* harmony default export */ const post_comments_link_edit = (PostCommentsLinkEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comments_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/post-comments-link",
title: "Comments Link",
category: "theme",
description: "Displays the link to the current post comments.",
textdomain: "default",
usesContext: ["postType", "postId"],
attributes: {
textAlign: {
type: "string"
}
},
supports: {
html: false,
color: {
link: true,
text: false,
__experimentalDefaultControls: {
background: true,
link: 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
}
}
};
const {
name: post_comments_link_name
} = post_comments_link_metadata;
const post_comments_link_settings = {
edit: post_comments_link_edit,
icon: post_comments_count
};
const post_comments_link_init = () => initBlock({
name: post_comments_link_name,
metadata: post_comments_link_metadata,
settings: post_comments_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-content.js
/**
* WordPress dependencies
*/
const postContent = /*#__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 6h12V4.5H4V6Zm16 4.5H4V9h16v1.5ZM4 15h16v-1.5H4V15Zm0 4.5h16V18H4v1.5Z"
})
});
/* harmony default export */ const post_content = (postContent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-content/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ReadOnlyContent({
parentLayout,
layoutClassNames,
userCanEdit,
postType,
postId
}) {
const [,, content] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'content', postId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: layoutClassNames
});
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
return content?.raw ? (0,external_wp_blocks_namespaceObject.parse)(content.raw) : [];
}, [content?.raw]);
const blockPreviewProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBlockPreview)({
blocks,
props: blockProps,
layout: parentLayout
});
if (userCanEdit) {
/*
* Rendering the block preview using the raw content blocks allows for
* block support styles to be generated and applied by the editor.
*
* The preview using the raw blocks can only be presented to users with
* edit permissions for the post to prevent potential exposure of private
* block content.
*/
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockPreviewProps
});
}
return content?.protected ? /*#__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.__)('This content is password protected.')
})
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
dangerouslySetInnerHTML: {
__html: content?.rendered
}
});
}
function EditableContent({
context = {}
}) {
const {
postType,
postId
} = context;
const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType, {
id: postId
});
const entityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, postId);
}, [postType, postId]);
const hasInnerBlocks = !!entityRecord?.content?.raw || blocks?.length;
const initialInnerBlocks = [['core/paragraph']];
const props = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)((0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'entry-content'
}), {
value: blocks,
onInput,
onChange,
template: !hasInnerBlocks ? initialInnerBlocks : undefined
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...props
});
}
function Content(props) {
const {
context: {
queryId,
postType,
postId
} = {},
layoutClassNames
} = props;
const userCanEdit = useCanEditEntity('postType', postType, postId);
if (userCanEdit === undefined) {
return null;
}
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const isEditable = userCanEdit && !isDescendentOfQueryLoop;
return isEditable ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditableContent, {
...props
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ReadOnlyContent, {
parentLayout: props.parentLayout,
layoutClassNames: layoutClassNames,
userCanEdit: userCanEdit,
postType: postType,
postId: postId
});
}
function edit_Placeholder({
layoutClassNames
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: layoutClassNames
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('This is the Content block, it will display all the blocks in any single post or page.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('If there are any Custom Post Types registered at your site, the Content block can display the contents of those entries as well.')
})]
});
}
function RecursionError() {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
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.')
})
});
}
function PostContentEdit({
context,
__unstableLayoutClassNames: layoutClassNames,
__unstableParentLayout: parentLayout
}) {
const {
postId: contextPostId,
postType: contextPostType
} = context;
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(contextPostId);
if (contextPostId && contextPostType && hasAlreadyRendered) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RecursionError, {});
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: contextPostId,
children: contextPostId && contextPostType ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Content, {
context: context,
parentLayout: parentLayout,
layoutClassNames: layoutClassNames
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(edit_Placeholder, {
layoutClassNames: layoutClassNames
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-content/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_content_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-content",
title: "Content",
category: "theme",
description: "Displays the contents of a post or page.",
textdomain: "default",
usesContext: ["postId", "postType", "queryId"],
example: {
viewportWidth: 350
},
supports: {
align: ["wide", "full"],
html: false,
layout: true,
background: {
backgroundImage: true,
backgroundSize: true,
__experimentalDefaultControls: {
backgroundImage: true
}
},
dimensions: {
minHeight: true
},
spacing: {
blockGap: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: false,
text: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
}
},
style: "wp-block-post-content",
editorStyle: "wp-block-post-content-editor"
};
const {
name: post_content_name
} = post_content_metadata;
const post_content_settings = {
icon: post_content,
edit: PostContentEdit
};
const post_content_init = () => initBlock({
name: post_content_name,
metadata: post_content_metadata,
settings: post_content_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostDateEdit({
attributes: {
textAlign,
format,
isLink,
displayType
},
context: {
postId,
postType: postTypeSlug,
queryId
},
setAttributes
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign,
[`wp-block-post-date__modified-date`]: displayType === 'modified'
})
});
// 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);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
anchor: popoverAnchor
}), [popoverAnchor]);
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const dateSettings = (0,external_wp_date_namespaceObject.getSettings)();
const [siteFormat = dateSettings.formats.date] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'date_format');
const [siteTimeFormat = dateSettings.formats.time] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'time_format');
const [date, setDate] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postTypeSlug, displayType, postId);
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => postTypeSlug ? select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug) : null, [postTypeSlug]);
const dateLabel = displayType === 'date' ? (0,external_wp_i18n_namespaceObject.__)('Post Date') : (0,external_wp_i18n_namespaceObject.__)('Post Modified Date');
let postDate = date ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {
dateTime: (0,external_wp_date_namespaceObject.dateI18n)('c', date),
ref: setPopoverAnchor,
children: format === 'human-diff' ? (0,external_wp_date_namespaceObject.humanTimeDiff)(date) : (0,external_wp_date_namespaceObject.dateI18n)(format || siteFormat, date)
}) : dateLabel;
if (isLink && date) {
postDate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: "#post-date-pseudo-link",
onClick: event => event.preventDefault(),
children: postDate
});
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
}), date && displayType === 'date' && !isDescendentOfQueryLoop && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalPublishDateTimePicker, {
currentDate: date,
onChange: setDate,
is12Hour: is12HourFormat(siteTimeFormat),
onClose: onClose,
dateOrder: /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
(0,external_wp_i18n_namespaceObject._x)('dmy', 'date order')
}),
renderToggle: ({
isOpen,
onToggle
}) => {
const openOnArrowDown = event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
"aria-expanded": isOpen,
icon: library_edit,
title: (0,external_wp_i18n_namespaceObject.__)('Change Date'),
onClick: onToggle,
onKeyDown: openOnArrowDown
});
}
})
})]
}), /*#__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_blockEditor_namespaceObject.__experimentalDateFormatPicker, {
format: format,
defaultFormat: siteFormat,
onChange: nextFormat => setAttributes({
format: nextFormat
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: postType?.labels.singular_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Name of the post type e.g: "post".
(0,external_wp_i18n_namespaceObject.__)('Link to %s'), postType.labels.singular_name.toLowerCase()) : (0,external_wp_i18n_namespaceObject.__)('Link to post'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display last modified date'),
onChange: value => setAttributes({
displayType: value ? 'modified' : 'date'
}),
checked: displayType === 'modified',
help: (0,external_wp_i18n_namespaceObject.__)('Only shows if the post has been modified')
})]
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
children: postDate
})]
});
}
function is12HourFormat(format) {
// To know if the time format is a 12 hour time, look for any of the 12 hour
// format characters: 'a', 'A', 'g', and 'h'. The character must be
// unescaped, i.e. not preceded by a '\'. Coincidentally, 'aAgh' is how I
// feel when working with regular expressions.
// https://www.php.net/manual/en/datetime.format.php
return /(?:^|[^\\])[aAgh]/.test(format);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/deprecated.js
/**
* Internal dependencies
*/
const post_date_deprecated_v1 = {
attributes: {
textAlign: {
type: 'string'
},
format: {
type: 'string'
},
isLink: {
type: 'boolean',
default: false
}
},
supports: {
html: false,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const post_date_deprecated = ([post_date_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/variations.js
/**
* WordPress dependencies
*/
const post_date_variations_variations = [{
name: 'post-date-modified',
title: (0,external_wp_i18n_namespaceObject.__)('Modified Date'),
description: (0,external_wp_i18n_namespaceObject.__)("Display a post's last updated date."),
attributes: {
displayType: 'modified'
},
scope: ['block', 'inserter'],
isActive: blockAttributes => blockAttributes.displayType === 'modified',
icon: post_date
}];
/* harmony default export */ const post_date_variations = (post_date_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_date_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-date",
title: "Date",
category: "theme",
description: "Display the publish date for an entry such as a post or page.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
format: {
type: "string"
},
isLink: {
type: "boolean",
"default": false
},
displayType: {
type: "string",
"default": "date"
}
},
usesContext: ["postId", "postType", "queryId"],
example: {
viewportWidth: 350
},
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: 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
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
}
};
const {
name: post_date_name
} = post_date_metadata;
const post_date_settings = {
icon: post_date,
edit: PostDateEdit,
deprecated: post_date_deprecated,
variations: post_date_variations
};
const post_date_init = () => initBlock({
name: post_date_name,
metadata: post_date_metadata,
settings: post_date_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-excerpt.js
/**
* WordPress dependencies
*/
const postExcerpt = /*#__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: "M8.001 3.984V9.47c0 1.518-.98 2.5-2.499 2.5h-.5v-1.5h.5c.69 0 1-.31 1-1V6.984H4v-3h4.001ZM4 20h9v-1.5H4V20Zm16-4H4v-1.5h16V16ZM13.001 3.984V9.47c0 1.518-.98 2.5-2.499 2.5h-.5v-1.5h.5c.69 0 1-.31 1-1V6.984H9v-3h4.001Z"
})
});
/* harmony default export */ const post_excerpt = (postExcerpt);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-excerpt/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ELLIPSIS = '…';
function PostExcerptEditor({
attributes: {
textAlign,
moreText,
showMoreOnNewLine,
excerptLength
},
setAttributes,
isSelected,
context: {
postId,
postType,
queryId
}
}) {
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const userCanEdit = useCanEditEntity('postType', postType, postId);
const [rawExcerpt, setExcerpt, {
rendered: renderedExcerpt,
protected: isProtected
} = {}] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'excerpt', postId);
/**
* Check if the post type supports excerpts.
* Add an exception and return early for the "page" post type,
* which is registered without support for the excerpt UI,
* but supports saving the excerpt to the database.
* See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65
* Without this exception, users that have excerpts saved to the database will
* not be able to edit the excerpts.
*/
const postTypeSupportsExcerpts = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (postType === 'page') {
return true;
}
return !!select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.supports?.excerpt;
}, [postType]);
/**
* The excerpt is editable if:
* - The user can edit the post
* - It is not a descendent of a Query Loop block
* - The post type supports excerpts
*/
const isEditable = userCanEdit && !isDescendentOfQueryLoop && postTypeSupportsExcerpts;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
/**
* translators: If your word count is based on single characters (e.g. East Asian characters),
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
/**
* When excerpt is editable, strip the html tags from
* rendered excerpt. This will be used if the entity's
* excerpt has been produced from the content.
*/
const strippedRenderedExcerpt = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!renderedExcerpt) {
return '';
}
const document = new window.DOMParser().parseFromString(renderedExcerpt, 'text/html');
return document.body.textContent || document.body.innerText || '';
}, [renderedExcerpt]);
if (!postType || !postId) {
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.jsx)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('This block will display the excerpt.')
})
})]
});
}
if (isProtected && !userCanEdit) {
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.__)('The content is currently protected and does not have the available excerpt.')
})
});
}
const readMoreLink = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "moreText",
className: "wp-block-post-excerpt__more-link",
tagName: "a",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('“Read more” link text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add "read more" link text'),
value: moreText,
onChange: newMoreText => setAttributes({
moreText: newMoreText
}),
withoutInteractiveFormatting: true
});
const excerptClassName = dist_clsx('wp-block-post-excerpt__excerpt', {
'is-inline': !showMoreOnNewLine
});
/**
* The excerpt length setting needs to be applied to both
* the raw and the rendered excerpt depending on which is being used.
*/
const rawOrRenderedExcerpt = (rawExcerpt || strippedRenderedExcerpt).trim();
let trimmedExcerpt = '';
if (wordCountType === 'words') {
trimmedExcerpt = rawOrRenderedExcerpt.split(' ', excerptLength).join(' ');
} else if (wordCountType === 'characters_excluding_spaces') {
/*
* 1. Split the excerpt at the character limit,
* then join the substrings back into one string.
* 2. Count the number of spaces in the excerpt
* by comparing the lengths of the string with and without spaces.
* 3. Add the number to the length of the visible excerpt,
* so that the spaces are excluded from the word count.
*/
const excerptWithSpaces = rawOrRenderedExcerpt.split('', excerptLength).join('');
const numberOfSpaces = excerptWithSpaces.length - excerptWithSpaces.replaceAll(' ', '').length;
trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength + numberOfSpaces).join('');
} else if (wordCountType === 'characters_including_spaces') {
trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength).join('');
}
const isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;
const excerptContent = isEditable ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
className: excerptClassName,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Excerpt text'),
value: isSelected ? rawOrRenderedExcerpt : (!isTrimmed ? rawOrRenderedExcerpt : trimmedExcerpt + ELLIPSIS) || (0,external_wp_i18n_namespaceObject.__)('No excerpt found'),
onChange: setExcerpt,
tagName: "p"
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
className: excerptClassName,
children: !isTrimmed ? rawOrRenderedExcerpt || (0,external_wp_i18n_namespaceObject.__)('No excerpt found') : trimmedExcerpt + ELLIPSIS
});
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.jsx)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
})
}), /*#__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.__)('Show link on new line'),
checked: showMoreOnNewLine,
onChange: newShowMoreOnNewLine => setAttributes({
showMoreOnNewLine: newShowMoreOnNewLine
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Max number of words'),
value: excerptLength,
onChange: value => {
setAttributes({
excerptLength: value
});
},
min: "10",
max: "100"
})]
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [excerptContent, !showMoreOnNewLine && ' ', showMoreOnNewLine ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
className: "wp-block-post-excerpt__more-text",
children: readMoreLink
}) : readMoreLink]
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-excerpt/transforms.js
/**
* WordPress dependencies
*/
const post_excerpt_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/post-content'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-excerpt')
}],
to: [{
type: 'block',
blocks: ['core/post-content'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content')
}]
};
/* harmony default export */ const post_excerpt_transforms = (post_excerpt_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-excerpt/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_excerpt_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-excerpt",
title: "Excerpt",
category: "theme",
description: "Display the excerpt.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
moreText: {
type: "string"
},
showMoreOnNewLine: {
type: "boolean",
"default": true
},
excerptLength: {
type: "number",
"default": 55
}
},
usesContext: ["postId", "postType", "queryId"],
example: {
viewportWidth: 350
},
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: 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
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
editorStyle: "wp-block-post-excerpt-editor",
style: "wp-block-post-excerpt"
};
const {
name: post_excerpt_name
} = post_excerpt_metadata;
const post_excerpt_settings = {
icon: post_excerpt,
transforms: post_excerpt_transforms,
edit: PostExcerptEditor
};
const post_excerpt_init = () => initBlock({
name: post_excerpt_name,
metadata: post_excerpt_metadata,
settings: post_excerpt_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js
/**
* WordPress dependencies
*/
const postFeaturedImage = /*#__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: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z"
})
});
/* harmony default export */ const post_featured_image = (postFeaturedImage);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/dimension-controls.js
/**
* WordPress dependencies
*/
const SCALE_OPTIONS = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "cover",
label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for Image dimension control')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "contain",
label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for Image dimension control')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "fill",
label: (0,external_wp_i18n_namespaceObject._x)('Fill', 'Scale option for Image dimension control')
})]
});
const DEFAULT_SCALE = 'cover';
const DEFAULT_SIZE = 'full';
const scaleHelp = {
cover: (0,external_wp_i18n_namespaceObject.__)('Image is scaled and cropped to fill the entire space without being distorted.'),
contain: (0,external_wp_i18n_namespaceObject.__)('Image is scaled to fill the space without clipping nor distorting.'),
fill: (0,external_wp_i18n_namespaceObject.__)('Image will be stretched and distorted to completely fill the space.')
};
const DimensionControls = ({
clientId,
attributes: {
aspectRatio,
width,
height,
scale,
sizeSlug
},
setAttributes,
media
}) => {
const [availableUnits, defaultRatios, themeRatios, showDefaultRatios] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.units', 'dimensions.aspectRatios.default', 'dimensions.aspectRatios.theme', 'dimensions.defaultAspectRatios');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', '%', 'vw', 'em', 'rem']
});
const imageSizes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().imageSizes, []);
const imageSizeOptions = imageSizes.filter(({
slug
}) => {
return media?.media_details?.sizes?.[slug]?.source_url;
}).map(({
name,
slug
}) => ({
value: slug,
label: name
}));
const onDimensionChange = (dimension, nextValue) => {
const parsedValue = parseFloat(nextValue);
/**
* If we have no value set and we change the unit,
* we don't want to set the attribute, as it would
* end up having the unit as value without any number.
*/
if (isNaN(parsedValue) && nextValue) {
return;
}
setAttributes({
[dimension]: parsedValue < 0 ? '0' : nextValue
});
};
const scaleLabel = (0,external_wp_i18n_namespaceObject._x)('Scale', 'Image scaling options');
const showScaleControl = height || aspectRatio && aspectRatio !== 'auto';
const themeOptions = themeRatios?.map(({
name,
ratio
}) => ({
label: name,
value: ratio
}));
const defaultOptions = defaultRatios?.map(({
name,
ratio
}) => ({
label: name,
value: ratio
}));
const aspectRatioOptions = [{
label: (0,external_wp_i18n_namespaceObject._x)('Original', 'Aspect ratio option for dimensions control'),
value: 'auto'
}, ...(showDefaultRatios ? defaultOptions : []), ...(themeOptions ? themeOptions : [])];
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!aspectRatio,
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
onDeselect: () => setAttributes({
aspectRatio: undefined
}),
resetAllFilter: () => ({
aspectRatio: undefined
}),
isShownByDefault: true,
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
value: aspectRatio,
options: aspectRatioOptions,
onChange: nextAspectRatio => setAttributes({
aspectRatio: nextAspectRatio
})
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
hasValue: () => !!height,
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
onDeselect: () => setAttributes({
height: undefined
}),
resetAllFilter: () => ({
height: undefined
}),
isShownByDefault: true,
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
labelPosition: "top",
value: height || '',
min: 0,
onChange: nextHeight => onDimensionChange('height', nextHeight),
units: units
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
hasValue: () => !!width,
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
onDeselect: () => setAttributes({
width: undefined
}),
resetAllFilter: () => ({
width: undefined
}),
isShownByDefault: true,
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
labelPosition: "top",
value: width || '',
min: 0,
onChange: nextWidth => onDimensionChange('width', nextWidth),
units: units
})
}), showScaleControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!scale && scale !== DEFAULT_SCALE,
label: scaleLabel,
onDeselect: () => setAttributes({
scale: DEFAULT_SCALE
}),
resetAllFilter: () => ({
scale: DEFAULT_SCALE
}),
isShownByDefault: true,
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: scaleLabel,
value: scale,
help: scaleHelp[scale],
onChange: value => setAttributes({
scale: value
}),
isBlock: true,
children: SCALE_OPTIONS
})
}), !!imageSizeOptions.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!sizeSlug,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
onDeselect: () => setAttributes({
sizeSlug: undefined
}),
resetAllFilter: () => ({
sizeSlug: undefined
}),
isShownByDefault: false,
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
value: sizeSlug || DEFAULT_SIZE,
options: imageSizeOptions,
onChange: nextSizeSlug => setAttributes({
sizeSlug: nextSizeSlug
}),
help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.')
})
})]
});
};
/* harmony default export */ const dimension_controls = (DimensionControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/overlay-controls.js
/**
* WordPress dependencies
*/
const Overlay = ({
clientId,
attributes,
setAttributes,
overlayColor,
setOverlayColor
}) => {
const {
dimRatio
} = attributes;
const {
gradientValue,
setGradient
} = (0,external_wp_blockEditor_namespaceObject.__experimentalUseGradient)();
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: overlayColor.color,
gradientValue,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay'),
onColorChange: setOverlayColor,
onGradientChange: setGradient,
isShownByDefault: true,
resetAllFilter: () => ({
overlayColor: undefined,
customOverlayColor: undefined,
gradient: undefined,
customGradient: undefined
})
}],
panelId: clientId,
...colorGradientSettings
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => dimRatio !== undefined,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay opacity'),
onDeselect: () => setAttributes({
dimRatio: 0
}),
resetAllFilter: () => ({
dimRatio: 0
}),
isShownByDefault: true,
panelId: clientId,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay opacity'),
value: dimRatio,
onChange: newDimRatio => setAttributes({
dimRatio: newDimRatio
}),
min: 0,
max: 100,
step: 10,
required: true,
__next40pxDefaultSize: true
})
})]
});
};
/* harmony default export */ const overlay_controls = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_blockEditor_namespaceObject.withColors)({
overlayColor: 'background-color'
})])(Overlay));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/utils.js
/**
* Generates the opacity/dim class based on given number.
*
* @param {number} ratio Dim/opacity number.
*
* @return {string} Generated class.
*/
function utils_dimRatioToClass(ratio) {
return ratio === undefined ? null : 'has-background-dim-' + 10 * Math.round(ratio / 10);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/overlay.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const overlay_Overlay = ({
attributes,
overlayColor
}) => {
const {
dimRatio
} = attributes;
const {
gradientClass,
gradientValue
} = (0,external_wp_blockEditor_namespaceObject.__experimentalUseGradient)();
const colorGradientSettings = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const overlayStyles = {
backgroundColor: overlayColor.color,
backgroundImage: gradientValue,
...borderProps.style
};
if (!colorGradientSettings.hasColorsOrGradients || !dimRatio) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
"aria-hidden": "true",
className: dist_clsx('wp-block-post-featured-image__overlay', utils_dimRatioToClass(dimRatio), {
[overlayColor.class]: overlayColor.class,
'has-background-dim': dimRatio !== undefined,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}, borderProps.className),
style: overlayStyles
});
};
/* harmony default export */ const overlay = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_blockEditor_namespaceObject.withColors)({
overlayColor: 'background-color'
})])(overlay_Overlay));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_featured_image_edit_ALLOWED_MEDIA_TYPES = ['image'];
function getMediaSourceUrlBySizeSlug(media, slug) {
return media?.media_details?.sizes?.[slug]?.source_url || media?.source_url;
}
const disabledClickProps = {
onClick: event => event.preventDefault(),
'aria-disabled': true
};
function PostFeaturedImageEdit({
clientId,
attributes,
setAttributes,
context: {
postId,
postType: postTypeSlug,
queryId
}
}) {
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const {
isLink,
aspectRatio,
height,
width,
scale,
sizeSlug,
rel,
linkTarget,
useFirstImageFromPost
} = attributes;
const [temporaryURL, setTemporaryURL] = (0,external_wp_element_namespaceObject.useState)();
const [storedFeaturedImage, setFeaturedImage] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postTypeSlug, 'featured_media', postId);
// Fallback to post content if no featured image is set.
// This is needed for the "Use first image from post" option.
const [postContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postTypeSlug, 'content', postId);
const featuredImage = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (storedFeaturedImage) {
return storedFeaturedImage;
}
if (!useFirstImageFromPost) {
return;
}
const imageOpener = /).)*)?}\s+)?-->/.exec(postContent);
const imageId = imageOpener?.groups?.attrs && JSON.parse(imageOpener.groups.attrs)?.id;
return imageId;
}, [storedFeaturedImage, useFirstImageFromPost, postContent]);
const {
media,
postType,
postPermalink
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getMedia,
getPostType,
getEditedEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
return {
media: featuredImage && getMedia(featuredImage, {
context: 'view'
}),
postType: postTypeSlug && getPostType(postTypeSlug),
postPermalink: getEditedEntityRecord('postType', postTypeSlug, postId)?.link
};
}, [featuredImage, postTypeSlug, postId]);
const mediaUrl = getMediaSourceUrlBySizeSlug(media, sizeSlug);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style: {
width,
height,
aspectRatio
},
className: dist_clsx({
'is-transient': temporaryURL
})
});
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes);
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const placeholder = content => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
className: dist_clsx('block-editor-media-placeholder', borderProps.className),
withIllustration: true,
style: {
height: !!aspectRatio && '100%',
width: !!aspectRatio && '100%',
...borderProps.style,
...shadowProps.style
},
children: content
});
};
const onSelectImage = value => {
if (value?.id) {
setFeaturedImage(value.id);
}
if (value?.url && (0,external_wp_blob_namespaceObject.isBlobURL)(value.url)) {
setTemporaryURL(value.url);
}
};
// Reset temporary url when media is available.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (mediaUrl && temporaryURL) {
setTemporaryURL();
}
}, [mediaUrl, temporaryURL]);
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
setTemporaryURL();
};
const controls = blockEditingMode === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "color",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(overlay_controls, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "dimensions",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimension_controls, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes,
media: media
})
}), /*#__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: postType?.labels.singular_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Name of the post type e.g: "post".
(0,external_wp_i18n_namespaceObject.__)('Link to %s'), postType.labels.singular_name) : (0,external_wp_i18n_namespaceObject.__)('Link to post'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && /*#__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.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel,
onChange: newRel => setAttributes({
rel: newRel
})
})]
})]
})
})]
});
let image;
/**
* A Post Featured Image block should not have image replacement
* or upload options in the following cases:
* - Is placed in a Query Loop. This is a conscious decision to
* prevent content editing of different posts in Query Loop, and
* this could change in the future.
* - Is in a context where it does not have a postId (for example
* in a template or template part).
*/
if (!featuredImage && (isDescendentOfQueryLoop || !postId)) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [controls, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [!!isLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: postPermalink,
target: linkTarget,
...disabledClickProps,
children: placeholder()
}) : placeholder(), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(overlay, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId
})]
})]
});
}
const label = (0,external_wp_i18n_namespaceObject.__)('Add a featured image');
const imageStyles = {
...borderProps.style,
...shadowProps.style,
height: aspectRatio ? '100%' : height,
width: !!aspectRatio && '100%',
objectFit: !!(height || aspectRatio) && scale
};
/**
* When the post featured image block is placed in a context where:
* - It has a postId (for example in a single post)
* - It is not inside a query loop
* - It has no image assigned yet
* Then display the placeholder with the image upload option.
*/
if (!featuredImage && !temporaryURL) {
image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
onSelect: onSelectImage,
accept: "image/*",
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
onError: onUploadError,
placeholder: placeholder,
mediaLibraryButton: ({
open
}) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
icon: library_upload,
variant: "primary",
label: label,
showTooltip: true,
tooltipPosition: "top center",
onClick: () => {
open();
}
});
}
});
} else {
// We have a Featured image so show a Placeholder if is loading.
image = !media && !temporaryURL ? placeholder() : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
className: borderProps.className,
src: temporaryURL || mediaUrl,
alt: media && media?.alt_text ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The image's alt text.
(0,external_wp_i18n_namespaceObject.__)('Featured image: %s'), media.alt_text) : (0,external_wp_i18n_namespaceObject.__)('Featured image'),
style: imageStyles
}), temporaryURL && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})]
});
}
/**
* When the post featured image block:
* - Has an image assigned
* - Is not inside a query loop
* Then display the image and the image replacement option.
*/
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [!temporaryURL && controls, !!media && !isDescendentOfQueryLoop && /*#__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: featuredImage,
mediaURL: mediaUrl,
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
accept: "image/*",
onSelect: onSelectImage,
onError: onUploadError,
onReset: () => setFeaturedImage(0)
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", {
...blockProps,
children: [!!isLink ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: postPermalink,
target: linkTarget,
...disabledClickProps,
children: image
}) : image, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(overlay, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId
})]
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_featured_image_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-featured-image",
title: "Featured Image",
category: "theme",
description: "Display a post's featured image.",
textdomain: "default",
attributes: {
isLink: {
type: "boolean",
"default": false
},
aspectRatio: {
type: "string"
},
width: {
type: "string"
},
height: {
type: "string"
},
scale: {
type: "string",
"default": "cover"
},
sizeSlug: {
type: "string"
},
rel: {
type: "string",
attribute: "rel",
"default": ""
},
linkTarget: {
type: "string",
"default": "_self"
},
overlayColor: {
type: "string"
},
customOverlayColor: {
type: "string"
},
dimRatio: {
type: "number",
"default": 0
},
gradient: {
type: "string"
},
customGradient: {
type: "string"
},
useFirstImageFromPost: {
type: "boolean",
"default": false
}
},
usesContext: ["postId", "postType", "queryId"],
example: {
viewportWidth: 350
},
supports: {
align: ["left", "right", "center", "wide", "full"],
color: {
text: false,
background: false
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
},
filter: {
duotone: true
},
shadow: {
__experimentalSkipSerialization: true
},
html: false,
spacing: {
margin: true,
padding: true
},
interactivity: {
clientNavigation: true
}
},
selectors: {
border: ".wp-block-post-featured-image img, .wp-block-post-featured-image .block-editor-media-placeholder, .wp-block-post-featured-image .wp-block-post-featured-image__overlay",
shadow: ".wp-block-post-featured-image img, .wp-block-post-featured-image .components-placeholder",
filter: {
duotone: ".wp-block-post-featured-image img, .wp-block-post-featured-image .wp-block-post-featured-image__placeholder, .wp-block-post-featured-image .components-placeholder__illustration, .wp-block-post-featured-image .components-placeholder::before"
}
},
editorStyle: "wp-block-post-featured-image-editor",
style: "wp-block-post-featured-image"
};
const {
name: post_featured_image_name
} = post_featured_image_metadata;
const post_featured_image_settings = {
icon: post_featured_image,
edit: PostFeaturedImageEdit
};
const post_featured_image_init = () => initBlock({
name: post_featured_image_name,
metadata: post_featured_image_metadata,
settings: post_featured_image_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostNavigationLinkEdit({
context: {
postType
},
attributes: {
type,
label,
showTitle,
textAlign,
linkLabel,
arrow,
taxonomy
},
setAttributes
}) {
const isNext = type === 'next';
let placeholder = isNext ? (0,external_wp_i18n_namespaceObject.__)('Next') : (0,external_wp_i18n_namespaceObject.__)('Previous');
const arrowMap = {
none: '',
arrow: isNext ? '→' : '←',
chevron: isNext ? '»' : '«'
};
const displayArrow = arrowMap[arrow];
if (showTitle) {
placeholder = isNext ? /* translators: Label before for next and previous post. There is a space after the colon. */
(0,external_wp_i18n_namespaceObject.__)('Next: ') // eslint-disable-line @wordpress/i18n-no-flanking-whitespace
: /* translators: Label before for next and previous post. There is a space after the colon. */
(0,external_wp_i18n_namespaceObject.__)('Previous: '); // eslint-disable-line @wordpress/i18n-no-flanking-whitespace
}
const ariaLabel = isNext ? (0,external_wp_i18n_namespaceObject.__)('Next post') : (0,external_wp_i18n_namespaceObject.__)('Previous post');
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getTaxonomies
} = select(external_wp_coreData_namespaceObject.store);
const filteredTaxonomies = getTaxonomies({
type: postType,
per_page: -1
});
return filteredTaxonomies;
}, [postType]);
const getTaxonomyOptions = () => {
const selectOption = {
label: (0,external_wp_i18n_namespaceObject.__)('Unfiltered'),
value: ''
};
const taxonomyOptions = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(({
visibility
}) => !!visibility?.publicly_queryable).map(item => {
return {
value: item.slug,
label: item.name
};
});
return [selectOption, ...taxonomyOptions];
};
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, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display the title as a link'),
help: (0,external_wp_i18n_namespaceObject.__)('If you have entered a custom label, it will be prepended before the title.'),
checked: !!showTitle,
onChange: () => setAttributes({
showTitle: !showTitle
})
}), showTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Include the label as part of the link'),
checked: !!linkLabel,
onChange: () => setAttributes({
linkLabel: !linkLabel
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Arrow'),
value: arrow,
onChange: value => {
setAttributes({
arrow: value
});
},
help: (0,external_wp_i18n_namespaceObject.__)('A decorative arrow for the next and previous link.'),
isBlock: true,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "none",
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Arrow option for Next/Previous link')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "arrow",
label: (0,external_wp_i18n_namespaceObject._x)('Arrow', 'Arrow option for Next/Previous link')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "chevron",
label: (0,external_wp_i18n_namespaceObject._x)('Chevron', 'Arrow option for Next/Previous link')
})]
})]
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Filter by taxonomy'),
value: taxonomy,
options: getTaxonomyOptions(),
onChange: value => setAttributes({
taxonomy: value
}),
help: (0,external_wp_i18n_namespaceObject.__)('Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.')
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [!isNext && displayArrow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: `wp-block-post-navigation-link__arrow-previous is-arrow-${arrow}`,
children: displayArrow
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "a",
identifier: "label",
"aria-label": ariaLabel,
placeholder: placeholder,
value: label,
allowedFormats: ['core/bold', 'core/italic'],
onChange: newLabel => setAttributes({
label: newLabel
})
}), showTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: "#post-navigation-pseudo-link",
onClick: event => event.preventDefault(),
children: (0,external_wp_i18n_namespaceObject.__)('An example title')
}), isNext && displayArrow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: `wp-block-post-navigation-link__arrow-next is-arrow-${arrow}`,
"aria-hidden": true,
children: displayArrow
})]
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
/**
* WordPress dependencies
*/
const next = /*#__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: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"
})
});
/* harmony default export */ const library_next = (next);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js
/**
* WordPress dependencies
*/
const previous = /*#__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.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"
})
});
/* harmony default export */ const library_previous = (previous);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/variations.js
/**
* WordPress dependencies
*/
const post_navigation_link_variations_variations = [{
isDefault: true,
name: 'post-next',
title: (0,external_wp_i18n_namespaceObject.__)('Next post'),
description: (0,external_wp_i18n_namespaceObject.__)('Displays the post link that follows the current post.'),
icon: library_next,
attributes: {
type: 'next'
},
scope: ['inserter', 'transform']
}, {
name: 'post-previous',
title: (0,external_wp_i18n_namespaceObject.__)('Previous post'),
description: (0,external_wp_i18n_namespaceObject.__)('Displays the post link that precedes the current post.'),
icon: library_previous,
attributes: {
type: 'previous'
},
scope: ['inserter', 'transform']
}];
/**
* Add `isActive` function to all `post-navigation-link` variations, if not defined.
* `isActive` function is used to find a variation match from a created
* Block by providing its attributes.
*/
post_navigation_link_variations_variations.forEach(variation => {
if (variation.isActive) {
return;
}
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
});
/* harmony default export */ const post_navigation_link_variations = (post_navigation_link_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/index.js
/**
* Internal dependencies
*/
const post_navigation_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-navigation-link",
title: "Post Navigation Link",
category: "theme",
description: "Displays the next or previous post link that is adjacent to the current post.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
type: {
type: "string",
"default": "next"
},
label: {
type: "string"
},
showTitle: {
type: "boolean",
"default": false
},
linkLabel: {
type: "boolean",
"default": false
},
arrow: {
type: "string",
"default": "none"
},
taxonomy: {
type: "string",
"default": ""
}
},
usesContext: ["postType"],
supports: {
reusable: false,
html: false,
color: {
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-navigation-link"
};
const {
name: post_navigation_link_name
} = post_navigation_link_metadata;
const post_navigation_link_settings = {
edit: PostNavigationLinkEdit,
variations: post_navigation_link_variations
};
const post_navigation_link_init = () => initBlock({
name: post_navigation_link_name,
metadata: post_navigation_link_metadata,
settings: post_navigation_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const post_template_edit_TEMPLATE = [['core/post-title'], ['core/post-date'], ['core/post-excerpt']];
function PostTemplateInnerBlocks({
classList
}) {
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: dist_clsx('wp-block-post', classList)
}, {
template: post_template_edit_TEMPLATE,
__unstableDisableLayoutClassNames: true
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
...innerBlocksProps
});
}
function PostTemplateBlockPreview({
blocks,
blockContextId,
classList,
isHidden,
setActiveBlockContextId
}) {
const blockPreviewProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBlockPreview)({
blocks,
props: {
className: dist_clsx('wp-block-post', classList)
}
});
const handleOnClick = () => {
setActiveBlockContextId(blockContextId);
};
const style = {
display: isHidden ? 'none' : undefined
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
...blockPreviewProps,
tabIndex: 0
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
,
role: "button",
onClick: handleOnClick,
onKeyPress: handleOnClick,
style: style
});
}
const MemoizedPostTemplateBlockPreview = (0,external_wp_element_namespaceObject.memo)(PostTemplateBlockPreview);
function PostTemplateEdit({
setAttributes,
clientId,
context: {
query: {
perPage,
offset = 0,
postType,
order,
orderBy,
author,
search,
exclude,
sticky,
inherit,
taxQuery,
parents,
pages,
format,
// We gather extra query args to pass to the REST API call.
// This way extenders of Query Loop can add their own query args,
// and have accurate previews in the editor.
// Noting though that these args should either be supported by the
// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.
...restQueryArgs
} = {},
templateSlug,
previewPostType
},
attributes: {
layout
},
__unstableLayoutClassNames
}) {
const {
type: layoutType,
columnCount = 3
} = layout || {};
const [activeBlockContextId, setActiveBlockContextId] = (0,external_wp_element_namespaceObject.useState)();
const {
posts,
blocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecords,
getTaxonomies
} = select(external_wp_coreData_namespaceObject.store);
const {
getBlocks
} = select(external_wp_blockEditor_namespaceObject.store);
const templateCategory = inherit && templateSlug?.startsWith('category-') && getEntityRecords('taxonomy', 'category', {
context: 'view',
per_page: 1,
_fields: ['id'],
slug: templateSlug.replace('category-', '')
});
const query = {
offset: offset || 0,
order,
orderby: orderBy
};
// There is no need to build the taxQuery if we inherit.
if (taxQuery && !inherit) {
const taxonomies = getTaxonomies({
type: postType,
per_page: -1,
context: 'view'
});
// We have to build the tax query for the REST API and use as
// keys the taxonomies `rest_base` with the `term ids` as values.
const builtTaxQuery = Object.entries(taxQuery).reduce((accumulator, [taxonomySlug, terms]) => {
const taxonomy = taxonomies?.find(({
slug
}) => slug === taxonomySlug);
if (taxonomy?.rest_base) {
accumulator[taxonomy?.rest_base] = terms;
}
return accumulator;
}, {});
if (!!Object.keys(builtTaxQuery).length) {
Object.assign(query, builtTaxQuery);
}
}
if (perPage) {
query.per_page = perPage;
}
if (author) {
query.author = author;
}
if (search) {
query.search = search;
}
if (exclude?.length) {
query.exclude = exclude;
}
if (parents?.length) {
query.parent = parents;
}
if (format?.length) {
query.format = format;
}
// If sticky is not set, it will return all posts in the results.
// If sticky is set to `only`, it will limit the results to sticky posts only.
// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.
if (sticky) {
query.sticky = sticky === 'only';
}
// If `inherit` is truthy, adjust conditionally the query to create a better preview.
if (inherit) {
// Change the post-type if needed.
if (templateSlug?.startsWith('archive-')) {
query.postType = templateSlug.replace('archive-', '');
postType = query.postType;
} else if (templateCategory) {
query.categories = templateCategory[0]?.id;
}
}
// When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
const usedPostType = previewPostType || postType;
return {
posts: getEntityRecords('postType', usedPostType, {
...query,
...restQueryArgs
}),
blocks: getBlocks(clientId)
};
}, [perPage, offset, order, orderBy, clientId, author, search, postType, exclude, sticky, inherit, templateSlug, taxQuery, parents, format, restQueryArgs, previewPostType]);
const blockContexts = (0,external_wp_element_namespaceObject.useMemo)(() => posts?.map(post => {
var _post$class_list;
return {
postType: post.type,
postId: post.id,
classList: (_post$class_list = post.class_list) !== null && _post$class_list !== void 0 ? _post$class_list : ''
};
}), [posts]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx(__unstableLayoutClassNames, {
[`columns-${columnCount}`]: layoutType === 'grid' && columnCount // Ensure column count is flagged via classname for backwards compatibility.
})
});
if (!posts) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
...blockProps,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
});
}
if (!posts.length) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", {
...blockProps,
children: [" ", (0,external_wp_i18n_namespaceObject.__)('No results found.')]
});
}
const setDisplayLayout = newDisplayLayout => setAttributes({
layout: {
...layout,
...newDisplayLayout
}
});
const displayLayoutControls = [{
icon: library_list,
title: (0,external_wp_i18n_namespaceObject._x)('List view', 'Post template block display setting'),
onClick: () => setDisplayLayout({
type: 'default'
}),
isActive: layoutType === 'default' || layoutType === 'constrained'
}, {
icon: library_grid,
title: (0,external_wp_i18n_namespaceObject._x)('Grid view', 'Post template block display setting'),
onClick: () => setDisplayLayout({
type: 'grid',
columnCount
}),
isActive: layoutType === 'grid'
}];
// To avoid flicker when switching active block contexts, a preview is rendered
// for each block context, but the preview for the active block context is hidden.
// This ensures that when it is displayed again, the cached rendering of the
// block preview is used, instead of having to re-render the preview from scratch.
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.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
controls: displayLayoutControls
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
...blockProps,
children: blockContexts && blockContexts.map(blockContext => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
value: blockContext,
children: [blockContext.postId === (activeBlockContextId || blockContexts[0]?.postId) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateInnerBlocks, {
classList: blockContext.classList
}) : null, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedPostTemplateBlockPreview, {
blocks: blocks,
blockContextId: blockContext.postId,
classList: blockContext.classList,
setActiveBlockContextId: setActiveBlockContextId,
isHidden: blockContext.postId === (activeBlockContextId || blockContexts[0]?.postId)
})]
}, blockContext.postId))
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/save.js
/**
* WordPress dependencies
*/
function PostTemplateSave() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_template_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-template",
title: "Post Template",
category: "theme",
parent: ["core/query"],
description: "Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.",
textdomain: "default",
usesContext: ["queryId", "query", "displayLayout", "templateSlug", "previewPostType", "enhancedPagination"],
supports: {
reusable: false,
html: false,
align: ["wide", "full"],
layout: true,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
blockGap: {
__experimentalDefault: "1.25em"
},
__experimentalDefaultControls: {
blockGap: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-template",
editorStyle: "wp-block-post-template-editor"
};
const {
name: post_template_name
} = post_template_metadata;
const post_template_settings = {
icon: library_layout,
edit: PostTemplateEdit,
save: PostTemplateSave
};
const post_template_init = () => initBlock({
name: post_template_name,
metadata: post_template_metadata,
settings: post_template_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-categories.js
/**
* WordPress dependencies
*/
const postCategories = /*#__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: "M20 4H4v1.5h16V4zm-2 9h-3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm.5 5c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5v-3c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3zM4 9.5h9V8H4v1.5zM9 13H6c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm.5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-3c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3z",
fillRule: "evenodd",
clipRule: "evenodd"
})
});
/* harmony default export */ const post_categories = (postCategories);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/use-post-terms.js
/**
* WordPress dependencies
*/
const use_post_terms_EMPTY_ARRAY = [];
function usePostTerms({
postId,
term
}) {
const {
slug
} = term;
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const visible = term?.visibility?.publicly_queryable;
if (!visible) {
return {
postTerms: use_post_terms_EMPTY_ARRAY,
isLoading: false,
hasPostTerms: false
};
}
const {
getEntityRecords,
isResolving
} = select(external_wp_coreData_namespaceObject.store);
const taxonomyArgs = ['taxonomy', slug, {
post: postId,
per_page: -1,
context: 'view'
}];
const terms = getEntityRecords(...taxonomyArgs);
return {
postTerms: terms,
isLoading: isResolving('getEntityRecords', taxonomyArgs),
hasPostTerms: !!terms?.length
};
}, [postId, term?.visibility?.publicly_queryable, slug]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Allowed formats for the prefix and suffix fields.
const ALLOWED_FORMATS = ['core/bold', 'core/image', 'core/italic', 'core/link', 'core/strikethrough', 'core/text-color'];
function PostTermsEdit({
attributes,
clientId,
context,
isSelected,
setAttributes,
insertBlocksAfter
}) {
const {
term,
textAlign,
separator,
prefix,
suffix
} = attributes;
const {
postId,
postType
} = context;
const selectedTerm = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!term) {
return {};
}
const {
getTaxonomy
} = select(external_wp_coreData_namespaceObject.store);
const taxonomy = getTaxonomy(term);
return taxonomy?.visibility?.publicly_queryable ? taxonomy : {};
}, [term]);
const {
postTerms,
hasPostTerms,
isLoading
} = usePostTerms({
postId,
term: selectedTerm
});
const hasPost = postId && postType;
const blockInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(clientId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign,
[`taxonomy-${term}`]: term
})
});
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.jsx)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
autoComplete: "off",
label: (0,external_wp_i18n_namespaceObject.__)('Separator'),
value: separator || '',
onChange: nextValue => {
setAttributes({
separator: nextValue
});
},
help: (0,external_wp_i18n_namespaceObject.__)('Enter character(s) used to separate terms.')
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
...blockProps,
children: [isLoading && hasPost && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !isLoading && (isSelected || prefix) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "prefix",
allowedFormats: ALLOWED_FORMATS,
className: "wp-block-post-terms__prefix",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Prefix'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Prefix') + ' ',
value: prefix,
onChange: value => setAttributes({
prefix: value
}),
tagName: "span"
}), (!hasPost || !term) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
children: blockInformation.title
}), hasPost && !isLoading && hasPostTerms && postTerms.map(postTerm => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: postTerm.link,
onClick: event => event.preventDefault(),
children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTerm.name)
}, postTerm.id)).reduce((prev, curr) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [prev, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "wp-block-post-terms__separator",
children: separator || ' '
}), curr]
})), hasPost && !isLoading && !hasPostTerms && (selectedTerm?.labels?.no_terms || (0,external_wp_i18n_namespaceObject.__)('Term items not found.')), !isLoading && (isSelected || suffix) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "suffix",
allowedFormats: ALLOWED_FORMATS,
className: "wp-block-post-terms__suffix",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Suffix'),
placeholder: ' ' + (0,external_wp_i18n_namespaceObject.__)('Suffix'),
value: suffix,
onChange: value => setAttributes({
suffix: value
}),
tagName: "span",
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
})]
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-terms.js
/**
* WordPress dependencies
*/
const postTerms = /*#__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: "M8.1 12.3c.1.1.3.3.5.3.2.1.4.1.6.1.2 0 .4 0 .6-.1.2-.1.4-.2.5-.3l3-3c.3-.3.5-.7.5-1.1 0-.4-.2-.8-.5-1.1L9.7 3.5c-.1-.2-.3-.3-.5-.3H5c-.4 0-.8.4-.8.8v4.2c0 .2.1.4.2.5l3.7 3.6zM5.8 4.8h3.1l3.4 3.4v.1l-3 3 .5.5-.7-.5-3.3-3.4V4.8zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"
})
});
/* harmony default export */ const post_terms = (postTerms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/hooks.js
/**
* WordPress dependencies
*/
const variationIconMap = {
category: post_categories,
post_tag: post_terms
};
// We add `icons` to categories and tags. The remaining ones use
// the block's default icon.
function enhanceVariations(settings, name) {
if (name !== 'core/post-terms') {
return settings;
}
const variations = settings.variations.map(variation => {
var _variationIconMap$var;
return {
...variation,
...{
icon: (_variationIconMap$var = variationIconMap[variation.name]) !== null && _variationIconMap$var !== void 0 ? _variationIconMap$var : post_categories
}
};
});
return {
...settings,
variations
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_terms_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-terms",
title: "Post Terms",
category: "theme",
description: "Post terms.",
textdomain: "default",
attributes: {
term: {
type: "string"
},
textAlign: {
type: "string"
},
separator: {
type: "string",
"default": ", "
},
prefix: {
type: "string",
"default": ""
},
suffix: {
type: "string",
"default": ""
}
},
usesContext: ["postId", "postType"],
example: {
viewportWidth: 350
},
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: 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
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
style: "wp-block-post-terms"
};
const {
name: post_terms_name
} = post_terms_metadata;
const post_terms_settings = {
icon: post_categories,
edit: PostTermsEdit
};
const post_terms_init = () => {
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/template-part', enhanceVariations);
return initBlock({
name: post_terms_name,
metadata: post_terms_metadata,
settings: post_terms_settings
});
};
;// CONCATENATED MODULE: external ["wp","wordcount"]
const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Average reading rate - based on average taken from
* https://irisreading.com/average-reading-speed-in-various-languages/
* (Characters/minute used for Chinese rather than words).
*/
const AVERAGE_READING_RATE = 189;
function PostTimeToReadEdit({
attributes,
setAttributes,
context
}) {
const {
textAlign
} = attributes;
const {
postId,
postType
} = context;
const [contentStructure] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'content', postId);
const [blocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType, {
id: postId
});
const minutesToReadString = (0,external_wp_element_namespaceObject.useMemo)(() => {
// Replicates the logic found in getEditedPostContent().
let content;
if (contentStructure instanceof Function) {
content = contentStructure({
blocks
});
} else if (blocks) {
// If we have parsed blocks already, they should be our source of truth.
// Parsing applies block deprecations and legacy block conversions that
// unparsed content will not have.
content = (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks);
} else {
content = contentStructure;
}
/*
* translators: If your word count is based on single characters (e.g. East Asian characters),
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
const minutesToRead = Math.max(1, Math.round((0,external_wp_wordcount_namespaceObject.count)(content || '', wordCountType) / AVERAGE_READING_RATE));
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the number of minutes to read the post. */
(0,external_wp_i18n_namespaceObject._n)('%s minute', '%s minutes', minutesToRead), minutesToRead);
}, [contentStructure, blocks]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...blockProps,
children: minutesToReadString
})]
});
}
/* harmony default export */ const post_time_to_read_edit = (PostTimeToReadEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/icon.js
/**
* WordPress dependencies
*/
/* harmony default export */ const icon = (/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
d: "M12 3c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16.5c-4.1 0-7.5-3.4-7.5-7.5S7.9 4.5 12 4.5s7.5 3.4 7.5 7.5-3.4 7.5-7.5 7.5zM12 7l-1 5c0 .3.2.6.4.8l4.2 2.8-2.7-4.1L12 7z"
})
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/index.js
/**
* Internal dependencies
*/
const post_time_to_read_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/post-time-to-read",
title: "Time To Read",
category: "theme",
description: "Show minutes required to finish reading the post.",
textdomain: "default",
usesContext: ["postId", "postType"],
attributes: {
textAlign: {
type: "string"
}
},
supports: {
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
html: false,
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
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true
}
}
};
const {
name: post_time_to_read_name
} = post_time_to_read_metadata;
const post_time_to_read_settings = {
icon: icon,
edit: post_time_to_read_edit
};
const post_time_to_read_init = () => initBlock({
name: post_time_to_read_name,
metadata: post_time_to_read_metadata,
settings: post_time_to_read_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostTitleEdit({
attributes: {
level,
levelOptions,
textAlign,
isLink,
rel,
linkTarget
},
setAttributes,
context: {
postType,
postId,
queryId
},
insertBlocksAfter
}) {
const TagName = level === 0 ? 'p' : `h${level}`;
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const userCanEdit = (0,external_wp_data_namespaceObject.useSelect)(select => {
/**
* useCanEditEntity may trigger an OPTIONS request to the REST API
* via the canUser resolver. However, when the Post Title is a
* descendant of a Query Loop block, the title cannot be edited. In
* order to avoid these unnecessary requests, we call the hook
* without the proper data, resulting in returning early without
* making them.
*/
if (isDescendentOfQueryLoop) {
return false;
}
return select(external_wp_coreData_namespaceObject.store).canUser('update', {
kind: 'postType',
name: postType,
id: postId
});
}, [isDescendentOfQueryLoop, postType, postId]);
const [rawTitle = '', setTitle, fullTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'title', postId);
const [link] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'link', postId);
const onSplitAtEnd = () => {
insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()));
};
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
let titleElement = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, {
...blockProps,
children: (0,external_wp_i18n_namespaceObject.__)('Title')
});
if (postType && postId) {
titleElement = userCanEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.PlainText, {
tagName: TagName,
placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'),
value: rawTitle,
onChange: setTitle,
__experimentalVersion: 2,
__unstableOnSplitAtEnd: onSplitAtEnd,
...blockProps
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, {
...blockProps,
dangerouslySetInnerHTML: {
__html: fullTitle?.rendered
}
});
}
if (isLink && postType && postId) {
titleElement = userCanEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, {
...blockProps,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.PlainText, {
tagName: "a",
href: link,
target: linkTarget,
rel: rel,
placeholder: !rawTitle.length ? (0,external_wp_i18n_namespaceObject.__)('No title') : null,
value: rawTitle,
onChange: setTitle,
__experimentalVersion: 2,
__unstableOnSplitAtEnd: onSplitAtEnd
})
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, {
...blockProps,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: link,
target: linkTarget,
rel: rel,
onClick: event => event.preventDefault(),
dangerouslySetInnerHTML: {
__html: fullTitle?.rendered
}
})
});
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [blockEditingMode === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
value: level,
options: levelOptions,
onChange: newLevel => setAttributes({
level: newLevel
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})]
}), /*#__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.__)('Make title a link'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && /*#__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.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel,
onChange: newRel => setAttributes({
rel: newRel
})
})]
})]
})
})]
}), titleElement]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/deprecated.js
/**
* Internal dependencies
*/
const post_title_deprecated_v1 = {
attributes: {
textAlign: {
type: 'string'
},
level: {
type: 'number',
default: 2
},
isLink: {
type: 'boolean',
default: false
},
rel: {
type: 'string',
attribute: 'rel',
default: ''
},
linkTarget: {
type: 'string',
default: '_self'
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true
},
spacing: {
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const post_title_deprecated = ([post_title_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_title_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-title",
title: "Title",
category: "theme",
description: "Displays the title of a post, page, or any other content-type.",
textdomain: "default",
usesContext: ["postId", "postType", "queryId"],
attributes: {
textAlign: {
type: "string"
},
level: {
type: "number",
"default": 2
},
levelOptions: {
type: "array"
},
isLink: {
type: "boolean",
"default": false
},
rel: {
type: "string",
attribute: "rel",
"default": ""
},
linkTarget: {
type: "string",
"default": "_self"
}
},
example: {
viewportWidth: 350
},
supports: {
align: ["wide", "full"],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: 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
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
style: "wp-block-post-title"
};
const {
name: post_title_name
} = post_title_metadata;
const post_title_settings = {
icon: library_title,
edit: PostTitleEdit,
deprecated: post_title_deprecated
};
const post_title_init = () => initBlock({
name: post_title_name,
metadata: post_title_metadata,
settings: post_title_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/preformatted.js
/**
* WordPress dependencies
*/
const preformatted = /*#__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: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12zM7 16.5h6V15H7v1.5zm4-4h6V11h-6v1.5zM9 11H7v1.5h2V11zm6 5.5h2V15h-2v1.5z"
})
});
/* harmony default export */ const library_preformatted = (preformatted);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/edit.js
/**
* WordPress dependencies
*/
function PreformattedEdit({
attributes,
mergeBlocks,
setAttributes,
onRemove,
insertBlocksAfter,
style
}) {
const {
content
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "pre",
identifier: "content",
preserveWhiteSpace: true,
value: content,
onChange: nextContent => {
setAttributes({
content: nextContent
});
},
onRemove: onRemove,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Preformatted text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write preformatted text…'),
onMerge: mergeBlocks,
...blockProps,
__unstablePastePlainText: true,
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/save.js
/**
* WordPress dependencies
*/
function preformatted_save_save({
attributes
}) {
const {
content
} = attributes;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("pre", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save(),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/transforms.js
/**
* WordPress dependencies
*/
const preformatted_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/code', 'core/paragraph'],
transform: ({
content,
anchor
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/preformatted', {
content,
anchor
})
}, {
type: 'raw',
isMatch: node => node.nodeName === 'PRE' && !(node.children.length === 1 && node.firstChild.nodeName === 'CODE'),
schema: ({
phrasingContentSchema
}) => ({
pre: {
children: phrasingContentSchema
}
})
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', attributes)
}, {
type: 'block',
blocks: ['core/code'],
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/code', attributes)
}]
};
/* harmony default export */ const preformatted_transforms = (preformatted_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const preformatted_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/preformatted",
title: "Preformatted",
category: "text",
description: "Add text that respects your spacing and tabs, and also allows styling.",
textdomain: "default",
attributes: {
content: {
type: "rich-text",
source: "rich-text",
selector: "pre",
__unstablePreserveWhiteSpace: true,
role: "content"
}
},
supports: {
anchor: true,
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
padding: true,
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: true,
color: true,
width: true,
style: true
}
}
},
style: "wp-block-preformatted"
};
const {
name: preformatted_name
} = preformatted_metadata;
const preformatted_settings = {
icon: library_preformatted,
example: {
attributes: {
/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */
// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.
content: (0,external_wp_i18n_namespaceObject.__)('EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\nWindow, very small in the distance, illuminated.\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;')
/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */
}
},
transforms: preformatted_transforms,
edit: PreformattedEdit,
save: preformatted_save_save,
merge(attributes, attributesToMerge) {
return {
content: attributes.content + '\n\n' + attributesToMerge.content
};
}
};
const preformatted_init = () => initBlock({
name: preformatted_name,
metadata: preformatted_metadata,
settings: preformatted_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pullquote.js
/**
* WordPress dependencies
*/
const pullquote = /*#__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: "M18 8H6c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zm.5 6c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-4c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v4zM4 4v1.5h16V4H4zm0 16h16v-1.5H4V20z"
})
});
/* harmony default export */ const library_pullquote = (pullquote);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/shared.js
const SOLID_COLOR_CLASS = `is-style-solid-color`;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const pullquote_deprecated_blockAttributes = {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p'
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: ''
},
mainColor: {
type: 'string'
},
customMainColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
}
};
function parseBorderColor(styleString) {
if (!styleString) {
return;
}
const matches = styleString.match(/border-color:([^;]+)[;]?/);
if (matches && matches[1]) {
return matches[1];
}
}
function multilineToInline(value) {
value = value || ``;
const padded = `${value}`;
const values = padded.split(`
`);
values.shift();
values.pop();
return values.join('
');
}
const pullquote_deprecated_v5 = {
attributes: {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p',
role: 'content'
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: '',
role: 'content'
},
textAlign: {
type: 'string'
}
},
save({
attributes
}) {
const {
textAlign,
citation,
value
} = attributes;
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), shouldShowCitation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})]
})
});
},
migrate({
value,
...attributes
}) {
return {
value: multilineToInline(value),
...attributes
};
}
};
// TODO: this is ripe for a bit of a clean up according to the example in https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/#example
const pullquote_deprecated_v4 = {
attributes: {
...pullquote_deprecated_blockAttributes
},
save({
attributes
}) {
const {
mainColor,
customMainColor,
customTextColor,
textColor,
value,
citation,
className
} = attributes;
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let figureClasses, figureStyles;
// Is solid color style
if (isSolidColorStyle) {
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', mainColor);
figureClasses = dist_clsx({
'has-background': backgroundClass || customMainColor,
[backgroundClass]: backgroundClass
});
figureStyles = {
backgroundColor: backgroundClass ? undefined : customMainColor
};
// Is normal style and a custom color is being used ( we can set a style directly with its value)
} else if (customMainColor) {
figureStyles = {
borderColor: customMainColor
};
}
const blockquoteTextColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const blockquoteClasses = dist_clsx({
'has-text-color': textColor || customTextColor,
[blockquoteTextColorClass]: blockquoteTextColorClass
});
const blockquoteStyles = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: figureClasses,
style: figureStyles
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyles,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})]
})
});
},
migrate({
value,
className,
mainColor,
customMainColor,
customTextColor,
...attributes
}) {
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let style;
if (customMainColor) {
if (!isSolidColorStyle) {
// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
style = {
border: {
color: customMainColor
}
};
} else {
// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
style = {
color: {
background: customMainColor
}
};
}
}
// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
if (customTextColor && style) {
style.color = {
...style.color,
text: customTextColor
};
}
return {
value: multilineToInline(value),
className,
backgroundColor: isSolidColorStyle ? mainColor : undefined,
borderColor: isSolidColorStyle ? undefined : mainColor,
textAlign: isSolidColorStyle ? 'left' : undefined,
style,
...attributes
};
}
};
const pullquote_deprecated_v3 = {
attributes: {
...pullquote_deprecated_blockAttributes,
// figureStyle is an attribute that never existed.
// We are using it as a way to access the styles previously applied to the figure.
figureStyle: {
source: 'attribute',
selector: 'figure',
attribute: 'style'
}
},
save({
attributes
}) {
const {
mainColor,
customMainColor,
textColor,
customTextColor,
value,
citation,
className,
figureStyle
} = attributes;
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let figureClasses, figureStyles;
// Is solid color style
if (isSolidColorStyle) {
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', mainColor);
figureClasses = dist_clsx({
'has-background': backgroundClass || customMainColor,
[backgroundClass]: backgroundClass
});
figureStyles = {
backgroundColor: backgroundClass ? undefined : customMainColor
};
// Is normal style and a custom color is being used ( we can set a style directly with its value)
} else if (customMainColor) {
figureStyles = {
borderColor: customMainColor
};
// If normal style and a named color are being used, we need to retrieve the color value to set the style,
// as there is no expectation that themes create classes that set border colors.
} else if (mainColor) {
// Previously here we queried the color settings to know the color value
// of a named color. This made the save function impure and the block was refactored,
// because meanwhile a change in the editor made it impossible to query color settings in the save function.
// Here instead of querying the color settings to know the color value, we retrieve the value
// directly from the style previously serialized.
const borderColor = parseBorderColor(figureStyle);
figureStyles = {
borderColor
};
}
const blockquoteTextColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const blockquoteClasses = (textColor || customTextColor) && dist_clsx('has-text-color', {
[blockquoteTextColorClass]: blockquoteTextColorClass
});
const blockquoteStyles = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", {
className: figureClasses,
style: figureStyles,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyles,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})]
})
});
},
migrate({
value,
className,
figureStyle,
mainColor,
customMainColor,
customTextColor,
...attributes
}) {
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let style;
if (customMainColor) {
if (!isSolidColorStyle) {
// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
style = {
border: {
color: customMainColor
}
};
} else {
// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
style = {
color: {
background: customMainColor
}
};
}
}
// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
if (customTextColor && style) {
style.color = {
...style.color,
text: customTextColor
};
}
// If is the default style, and a main color is set,
// migrate the main color value into a custom border color.
// The custom border color value is retrieved by parsing the figure styles.
if (!isSolidColorStyle && mainColor && figureStyle) {
const borderColor = parseBorderColor(figureStyle);
if (borderColor) {
return {
value: multilineToInline(value),
...attributes,
className,
// Block supports: Set style.border.color if a deprecated block has `mainColor`, inline border CSS and is not a solid color style.
style: {
border: {
color: borderColor
}
}
};
}
}
return {
value: multilineToInline(value),
className,
backgroundColor: isSolidColorStyle ? mainColor : undefined,
borderColor: isSolidColorStyle ? undefined : mainColor,
textAlign: isSolidColorStyle ? 'left' : undefined,
style,
...attributes
};
}
};
const pullquote_deprecated_v2 = {
attributes: pullquote_deprecated_blockAttributes,
save({
attributes
}) {
const {
mainColor,
customMainColor,
textColor,
customTextColor,
value,
citation,
className
} = attributes;
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let figureClass, figureStyles;
// Is solid color style
if (isSolidColorStyle) {
figureClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', mainColor);
if (!figureClass) {
figureStyles = {
backgroundColor: customMainColor
};
}
// Is normal style and a custom color is being used ( we can set a style directly with its value)
} else if (customMainColor) {
figureStyles = {
borderColor: customMainColor
};
// Is normal style and a named color is being used, we need to retrieve the color value to set the style,
// as there is no expectation that themes create classes that set border colors.
} else if (mainColor) {
var _select$getSettings$c;
const colors = (_select$getSettings$c = (0,external_wp_data_namespaceObject.select)(external_wp_blockEditor_namespaceObject.store).getSettings().colors) !== null && _select$getSettings$c !== void 0 ? _select$getSettings$c : [];
const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues)(colors, mainColor);
figureStyles = {
borderColor: colorObject.color
};
}
const blockquoteTextColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const blockquoteClasses = textColor || customTextColor ? dist_clsx('has-text-color', {
[blockquoteTextColorClass]: blockquoteTextColorClass
}) : undefined;
const blockquoteStyle = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", {
className: figureClass,
style: figureStyles,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyle,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})]
})
});
},
migrate({
value,
className,
mainColor,
customMainColor,
customTextColor,
...attributes
}) {
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let style = {};
if (customMainColor) {
if (!isSolidColorStyle) {
// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
style = {
border: {
color: customMainColor
}
};
} else {
// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
style = {
color: {
background: customMainColor
}
};
}
}
// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
if (customTextColor && style) {
style.color = {
...style.color,
text: customTextColor
};
}
return {
value: multilineToInline(value),
className,
backgroundColor: isSolidColorStyle ? mainColor : undefined,
borderColor: isSolidColorStyle ? undefined : mainColor,
textAlign: isSolidColorStyle ? 'left' : undefined,
style,
...attributes
};
}
};
const pullquote_deprecated_v1 = {
attributes: {
...pullquote_deprecated_blockAttributes
},
save({
attributes
}) {
const {
value,
citation
} = attributes;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})]
});
},
migrate({
value,
...attributes
}) {
return {
value: multilineToInline(value),
...attributes
};
}
};
const deprecated_v0 = {
attributes: {
...pullquote_deprecated_blockAttributes,
citation: {
type: 'string',
source: 'html',
selector: 'footer'
},
align: {
type: 'string',
default: 'none'
}
},
save({
attributes
}) {
const {
value,
citation,
align
} = attributes;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
className: `align${align}`,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "footer",
value: citation
})]
});
},
migrate({
value,
...attributes
}) {
return {
value: multilineToInline(value),
...attributes
};
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const pullquote_deprecated = ([pullquote_deprecated_v5, pullquote_deprecated_v4, pullquote_deprecated_v3, pullquote_deprecated_v2, pullquote_deprecated_v1, deprecated_v0]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/figure.js
const Figure = 'figure';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/blockquote.js
const BlockQuote = 'blockquote';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const isWebPlatform = external_wp_element_namespaceObject.Platform.OS === 'web';
function PullQuoteEdit({
attributes,
setAttributes,
isSelected,
insertBlocksAfter
}) {
const {
textAlign,
citation,
value
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) || isSelected;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Figure, {
...blockProps,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockQuote, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "value",
tagName: "p",
value: value,
onChange: nextValue => setAttributes({
value: nextValue
}),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Pullquote text'),
placeholder:
// translators: placeholder text used for the quote
(0,external_wp_i18n_namespaceObject.__)('Add quote'),
textAlign: "center"
}), shouldShowCitation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "citation",
tagName: isWebPlatform ? 'cite' : undefined,
style: {
display: 'block'
},
value: citation,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Pullquote citation text'),
placeholder:
// translators: placeholder text used for the citation
(0,external_wp_i18n_namespaceObject.__)('Add citation'),
onChange: nextCitation => setAttributes({
citation: nextCitation
}),
className: "wp-block-pullquote__citation",
__unstableMobileNoFocusOnMount: true,
textAlign: "center",
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
})]
})
})]
});
}
/* harmony default export */ const pullquote_edit = (PullQuoteEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function pullquote_save_save({
attributes
}) {
const {
textAlign,
citation,
value
} = attributes;
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: dist_clsx({
[`has-text-align-${textAlign}`]: textAlign
})
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("blockquote", {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
value: value
}), shouldShowCitation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})]
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/transforms.js
/**
* WordPress dependencies
*/
const pullquote_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/paragraph'],
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/pullquote', {
value: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: (0,external_wp_richText_namespaceObject.join)(attributes.map(({
content
}) => (0,external_wp_richText_namespaceObject.create)({
html: content
})), '\n')
}),
anchor: attributes.anchor
});
}
}, {
type: 'block',
blocks: ['core/heading'],
transform: ({
content,
anchor
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/pullquote', {
value: content,
anchor
});
}
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: ({
value,
citation
}) => {
const paragraphs = [];
if (value) {
paragraphs.push((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: value
}));
}
if (citation) {
paragraphs.push((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: citation
}));
}
if (paragraphs.length === 0) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: ''
});
}
return paragraphs;
}
}, {
type: 'block',
blocks: ['core/heading'],
transform: ({
value,
citation
}) => {
// If there is no pullquote content, use the citation as the
// content of the resulting heading. A nonexistent citation
// will result in an empty heading.
if (!value) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content: citation
});
}
const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content: value
});
if (!citation) {
return headingBlock;
}
return [headingBlock, (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content: citation
})];
}
}]
};
/* harmony default export */ const pullquote_transforms = (pullquote_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const pullquote_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/pullquote",
title: "Pullquote",
category: "text",
description: "Give special visual emphasis to a quote from your text.",
textdomain: "default",
attributes: {
value: {
type: "rich-text",
source: "rich-text",
selector: "p",
role: "content"
},
citation: {
type: "rich-text",
source: "rich-text",
selector: "cite",
role: "content"
},
textAlign: {
type: "string"
}
},
supports: {
anchor: true,
align: ["left", "right", "wide", "full"],
background: {
backgroundImage: true,
backgroundSize: true,
__experimentalDefaultControls: {
backgroundImage: true
}
},
color: {
gradients: true,
background: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
dimensions: {
minHeight: true,
__experimentalDefaultControls: {
minHeight: false
}
},
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
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
__experimentalStyle: {
typography: {
fontSize: "1.5em",
lineHeight: "1.6"
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-pullquote-editor",
style: "wp-block-pullquote"
};
const {
name: pullquote_name
} = pullquote_metadata;
const pullquote_settings = {
icon: library_pullquote,
example: {
attributes: {
value:
// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.
(0,external_wp_i18n_namespaceObject.__)('One of the hardest things to do in technology is disrupt yourself.'),
citation: (0,external_wp_i18n_namespaceObject.__)('Matt Mullenweg')
}
},
transforms: pullquote_transforms,
edit: pullquote_edit,
save: pullquote_save_save,
deprecated: pullquote_deprecated
};
const pullquote_init = () => initBlock({
name: pullquote_name,
metadata: pullquote_metadata,
settings: pullquote_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/loop.js
/**
* WordPress dependencies
*/
const loop = /*#__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: "M18.1823 11.6392C18.1823 13.0804 17.0139 14.2487 15.5727 14.2487C14.3579 14.2487 13.335 13.4179 13.0453 12.2922L13.0377 12.2625L13.0278 12.2335L12.3985 10.377L12.3942 10.3785C11.8571 8.64997 10.246 7.39405 8.33961 7.39405C5.99509 7.39405 4.09448 9.29465 4.09448 11.6392C4.09448 13.9837 5.99509 15.8843 8.33961 15.8843C8.88499 15.8843 9.40822 15.781 9.88943 15.5923L9.29212 14.0697C8.99812 14.185 8.67729 14.2487 8.33961 14.2487C6.89838 14.2487 5.73003 13.0804 5.73003 11.6392C5.73003 10.1979 6.89838 9.02959 8.33961 9.02959C9.55444 9.02959 10.5773 9.86046 10.867 10.9862L10.8772 10.9836L11.4695 12.7311C11.9515 14.546 13.6048 15.8843 15.5727 15.8843C17.9172 15.8843 19.8178 13.9837 19.8178 11.6392C19.8178 9.29465 17.9172 7.39404 15.5727 7.39404C15.0287 7.39404 14.5066 7.4968 14.0264 7.6847L14.6223 9.20781C14.9158 9.093 15.2358 9.02959 15.5727 9.02959C17.0139 9.02959 18.1823 10.1979 18.1823 11.6392Z"
})
});
/* harmony default export */ const library_loop = (loop);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/utils.js
/**
* WordPress dependencies
*/
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
/**
* @typedef IHasNameAndId
* @property {string|number} id The entity's id.
* @property {string} name The entity's name.
*/
/**
* The object used in Query block that contains info and helper mappings
* from an array of IHasNameAndId objects.
*
* @typedef {Object} QueryEntitiesInfo
* @property {IHasNameAndId[]} entities The array of entities.
* @property {Object} mapById Object mapping with the id as key and the entity as value.
* @property {Object} mapByName Object mapping with the name as key and the entity as value.
* @property {string[]} names Array with the entities' names.
*/
/**
* Returns a helper object with mapping from Objects that implement
* the `IHasNameAndId` interface. The returned object is used for
* integration with `FormTokenField` component.
*
* @param {IHasNameAndId[]} entities The entities to extract of helper object.
* @return {QueryEntitiesInfo} The object with the entities information.
*/
const getEntitiesInfo = entities => {
const mapping = entities?.reduce((accumulator, entity) => {
const {
mapById,
mapByName,
names
} = accumulator;
mapById[entity.id] = entity;
mapByName[entity.name] = entity;
names.push(entity.name);
return accumulator;
}, {
mapById: {},
mapByName: {},
names: []
});
return {
entities,
...mapping
};
};
/**
* Helper util to return a value from a certain path of the object.
* Path is specified as a string of properties, separated by dots,
* for example: "parent.child".
*
* @param {Object} object Input object.
* @param {string} path Path to the object property.
* @return {*} Value of the object property at the specified path.
*/
const getValueFromObjectPath = (object, path) => {
const normalizedPath = path.split('.');
let value = object;
normalizedPath.forEach(fieldName => {
value = value?.[fieldName];
});
return value;
};
/**
* Helper util to map records to add a `name` prop from a
* provided path, in order to handle all entities in the same
* fashion(implementing`IHasNameAndId` interface).
*
* @param {Object[]} entities The array of entities.
* @param {string} path The path to map a `name` property from the entity.
* @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.
*/
const mapToIHasNameAndId = (entities, path) => {
return (entities || []).map(entity => ({
...entity,
name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getValueFromObjectPath(entity, path))
}));
};
/**
* Returns a helper object that contains:
* 1. An `options` object from the available post types, to be passed to a `SelectControl`.
* 2. A helper map with available taxonomies per post type.
* 3. A helper map with post format support per post type.
*
* @return {Object} The helper object related to post types.
*/
const usePostTypes = () => {
const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getPostTypes
} = select(external_wp_coreData_namespaceObject.store);
const excludedPostTypes = ['attachment'];
const filteredPostTypes = getPostTypes({
per_page: -1
})?.filter(({
viewable,
slug
}) => viewable && !excludedPostTypes.includes(slug));
return filteredPostTypes;
}, []);
const postTypesTaxonomiesMap = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!postTypes?.length) {
return;
}
return postTypes.reduce((accumulator, type) => {
accumulator[type.slug] = type.taxonomies;
return accumulator;
}, {});
}, [postTypes]);
const postTypesSelectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => (postTypes || []).map(({
labels,
slug
}) => ({
label: labels.singular_name,
value: slug
})), [postTypes]);
const postTypeFormatSupportMap = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!postTypes?.length) {
return {};
}
return postTypes.reduce((accumulator, type) => {
accumulator[type.slug] = type.supports?.['post-formats'] || false;
return accumulator;
}, {});
}, [postTypes]);
return {
postTypesTaxonomiesMap,
postTypesSelectOptions,
postTypeFormatSupportMap
};
};
/**
* Hook that returns the taxonomies associated with a specific post type.
*
* @param {string} postType The post type from which to retrieve the associated taxonomies.
* @return {Object[]} An array of the associated taxonomies.
*/
const useTaxonomies = postType => {
const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getTaxonomies,
getPostType
} = select(external_wp_coreData_namespaceObject.store);
// Does the post type have taxonomies?
if (getPostType(postType)?.taxonomies?.length > 0) {
return getTaxonomies({
type: postType,
per_page: -1
});
}
return [];
}, [postType]);
return (0,external_wp_element_namespaceObject.useMemo)(() => {
return taxonomies?.filter(({
visibility
}) => !!visibility?.publicly_queryable);
}, [taxonomies]);
};
/**
* Hook that returns whether a specific post type is hierarchical.
*
* @param {string} postType The post type to check.
* @return {boolean} Whether a specific post type is hierarchical.
*/
function useIsPostTypeHierarchical(postType) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const type = select(external_wp_coreData_namespaceObject.store).getPostType(postType);
return type?.viewable && type?.hierarchical;
}, [postType]);
}
/**
* Hook that returns the query properties' names defined by the active
* block variation, to determine which block's filters to show.
*
* @param {Object} attributes Block attributes.
* @return {string[]} An array of the query attributes.
*/
function useAllowedControls(attributes) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getActiveBlockVariation('core/query', attributes)?.allowedControls, [attributes]);
}
function isControlAllowed(allowedControls, key) {
// Every controls is allowed if the list is not defined.
if (!allowedControls) {
return true;
}
return allowedControls.includes(key);
}
/**
* Clones a pattern's blocks and then recurses over that list of blocks,
* transforming them to retain some `query` attribute properties.
* For now we retain the `postType` and `inherit` properties as they are
* fundamental for the expected functionality of the block and don't affect
* its design and presentation.
*
* Returns the cloned/transformed blocks and array of existing Query Loop
* client ids for further manipulation, in order to avoid multiple recursions.
*
* @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).
* @param {Record} queryBlockAttributes The existing Query Loop's attributes.
* @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.
*/
const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) => {
const {
query: {
postType,
inherit
},
namespace
} = queryBlockAttributes;
const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
const queryClientIds = [];
const blocksQueue = [...clonedBlocks];
while (blocksQueue.length > 0) {
const block = blocksQueue.shift();
if (block.name === 'core/query') {
block.attributes.query = {
...block.attributes.query,
postType,
inherit
};
if (namespace) {
block.attributes.namespace = namespace;
}
queryClientIds.push(block.clientId);
}
block.innerBlocks?.forEach(innerBlock => {
blocksQueue.push(innerBlock);
});
}
return {
newBlocks: clonedBlocks,
queryClientIds
};
};
/**
* Helper hook that determines if there is an active variation of the block
* and if there are available specific patterns for this variation.
* If there are, these patterns are going to be the only ones suggested to
* the user in setup and replace flow, without including the default ones
* for Query Loop.
*
* If there are no such patterns, the default ones for Query Loop are going
* to be suggested.
*
* @param {string} clientId The block's client ID.
* @param {Object} attributes The block's attributes.
* @return {string} The block name to be used in the patterns suggestions.
*/
function useBlockNameForPatterns(clientId, attributes) {
const activeVariationName = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getActiveBlockVariation('core/query', attributes)?.name, [attributes]);
const blockName = `core/query/${activeVariationName}`;
const hasActiveVariationPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!activeVariationName) {
return false;
}
const {
getBlockRootClientId,
getPatternsByBlockTypes
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
const activePatterns = getPatternsByBlockTypes(blockName, rootClientId);
return activePatterns.length > 0;
}, [clientId, activeVariationName, blockName]);
return hasActiveVariationPatterns ? blockName : 'core/query';
}
/**
* Helper hook that determines if there is an active variation of the block
* and if there are available specific scoped `block` variations connected with
* this variation.
*
* If there are, these variations are going to be the only ones suggested
* to the user in setup flow when clicking to `start blank`, without including
* the default ones for Query Loop.
*
* If there are no such scoped `block` variations, the default ones for Query
* Loop are going to be suggested.
*
* The way we determine such variations is with the convention that they have the `namespace`
* attribute defined as an array. This array should contain the names(`name` property) of any
* variations they want to be connected to.
* For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,
* we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.
* If the user selects this variation, the `namespace` attribute will be overridden by the
* main `inserter` variation.
*
* @param {Object} attributes The block's attributes.
* @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.
*/
function useScopedBlockVariations(attributes) {
const {
activeVariationName,
blockVariations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getActiveBlockVariation,
getBlockVariations
} = select(external_wp_blocks_namespaceObject.store);
return {
activeVariationName: getActiveBlockVariation('core/query', attributes)?.name,
blockVariations: getBlockVariations('core/query', 'block')
};
}, [attributes]);
const variations = (0,external_wp_element_namespaceObject.useMemo)(() => {
// Filter out the variations that have defined a `namespace` attribute,
// which means they are 'connected' to specific variations of the block.
const isNotConnected = variation => !variation.attributes?.namespace;
if (!activeVariationName) {
return blockVariations.filter(isNotConnected);
}
const connectedVariations = blockVariations.filter(variation => variation.attributes?.namespace?.includes(activeVariationName));
if (!!connectedVariations.length) {
return connectedVariations;
}
return blockVariations.filter(isNotConnected);
}, [activeVariationName, blockVariations]);
return variations;
}
/**
* Hook that returns the block patterns for a specific block type.
*
* @param {string} clientId The block's client ID.
* @param {string} name The block type name.
* @return {Object[]} An array of valid block patterns.
*/
const usePatterns = (clientId, name) => {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getPatternsByBlockTypes
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
return getPatternsByBlockTypes(name, rootClientId);
}, [name, clientId]);
};
/**
* The object returned by useUnsupportedBlocks with info about the type of
* unsupported blocks present inside the Query block.
*
* @typedef {Object} UnsupportedBlocksInfo
* @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.
* @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.
* @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.
*/
/**
* Hook that returns an object with information about the unsupported blocks
* present inside a Query Loop with the given `clientId`. The returned object
* contains props that are true when a certain type of unsupported block is
* present.
*
* @param {string} clientId The block's client ID.
* @return {UnsupportedBlocksInfo} The object containing the information.
*/
const useUnsupportedBlocks = clientId => {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getClientIdsOfDescendants,
getBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
const blocks = {};
getClientIdsOfDescendants(clientId).forEach(descendantClientId => {
const blockName = getBlockName(descendantClientId);
/*
* Client side navigation can be true in two states:
* - supports.interactivity = true;
* - supports.interactivity.clientNavigation = true;
*/
const blockSupportsInteractivity = Object.is((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'interactivity'), true);
const blockSupportsInteractivityClientNavigation = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'interactivity.clientNavigation');
const blockInteractivity = blockSupportsInteractivity || blockSupportsInteractivityClientNavigation;
if (!blockInteractivity) {
blocks.hasBlocksFromPlugins = true;
} else if (blockName === 'core/post-content') {
blocks.hasPostContentBlock = true;
}
});
blocks.hasUnsupportedBlocks = blocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;
return blocks;
}, [clientId]);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/enhanced-pagination-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function EnhancedPaginationControl({
enhancedPagination,
setAttributes,
clientId
}) {
const {
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
const fullPageClientSideNavigation = window.__experimentalFullPageClientSideNavigation;
let help = (0,external_wp_i18n_namespaceObject.__)('Browsing between pages requires a full page reload.');
if (fullPageClientSideNavigation) {
help = (0,external_wp_i18n_namespaceObject.__)('Experimental full-page client-side navigation setting enabled.');
} else if (enhancedPagination) {
help = (0,external_wp_i18n_namespaceObject.__)('Reload the full page—instead of just the posts list—when visitors navigate between pages.');
} else if (hasUnsupportedBlocks) {
help = (0,external_wp_i18n_namespaceObject.__)('Enhancement disabled because there are non-compatible blocks inside the Query block.');
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Reload full page'),
help: help,
checked: !enhancedPagination && !fullPageClientSideNavigation,
disabled: hasUnsupportedBlocks || fullPageClientSideNavigation,
onChange: value => {
setAttributes({
enhancedPagination: !value
});
}
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/query-toolbar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function QueryToolbar({
openPatternSelectionModal,
name,
clientId
}) {
const hasPatterns = !!usePatterns(clientId, name).length;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: hasPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
className: "wp-block-template-part__block-control-group",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: openPatternSelectionModal,
children: (0,external_wp_i18n_namespaceObject.__)('Replace')
})
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/order-control.js
/**
* WordPress dependencies
*/
const orderOptions = [{
label: (0,external_wp_i18n_namespaceObject.__)('Newest to oldest'),
value: 'date/desc'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Oldest to newest'),
value: 'date/asc'
}, {
/* translators: Label for ordering posts by title in ascending order. */
label: (0,external_wp_i18n_namespaceObject.__)('A → Z'),
value: 'title/asc'
}, {
/* translators: Label for ordering posts by title in descending order. */
label: (0,external_wp_i18n_namespaceObject.__)('Z → A'),
value: 'title/desc'
}];
function OrderControl({
order,
orderBy,
onChange
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Order by'),
value: `${orderBy}/${order}`,
options: orderOptions,
onChange: value => {
const [newOrderBy, newOrder] = value.split('/');
onChange({
order: newOrder,
orderBy: newOrderBy
});
}
});
}
/* harmony default export */ const order_control = (OrderControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/author-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const author_control_AUTHORS_QUERY = {
who: 'authors',
per_page: -1,
_fields: 'id,name',
context: 'view'
};
function AuthorControl({
value,
onChange
}) {
const authorsList = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getUsers
} = select(external_wp_coreData_namespaceObject.store);
return getUsers(author_control_AUTHORS_QUERY);
}, []);
if (!authorsList) {
return null;
}
const authorsInfo = getEntitiesInfo(authorsList);
/**
* We need to normalize the value because the block operates on a
* comma(`,`) separated string value and `FormTokenFiels` needs an
* array.
*/
const normalizedValue = !value ? [] : value.toString().split(',');
// Returns only the existing authors ids. This prevents the component
// from crashing in the editor, when non existing ids are provided.
const sanitizedValue = normalizedValue.reduce((accumulator, authorId) => {
const author = authorsInfo.mapById[authorId];
if (author) {
accumulator.push({
id: authorId,
value: author.name
});
}
return accumulator;
}, []);
const getIdByValue = (entitiesMappedByName, authorValue) => {
const id = authorValue?.id || entitiesMappedByName[authorValue]?.id;
if (id) {
return id;
}
};
const onAuthorChange = newValue => {
const ids = Array.from(newValue.reduce((accumulator, author) => {
// Verify that new values point to existing entities.
const id = getIdByValue(authorsInfo.mapByName, author);
if (id) {
accumulator.add(id);
}
return accumulator;
}, new Set()));
onChange({
author: ids.join(',')
});
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, {
label: (0,external_wp_i18n_namespaceObject.__)('Authors'),
value: sanitizedValue,
suggestions: authorsInfo.names,
onChange: onAuthorChange,
__experimentalShowHowTo: false,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true
});
}
/* harmony default export */ const author_control = (AuthorControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/parent-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const parent_control_EMPTY_ARRAY = [];
const BASE_QUERY = {
order: 'asc',
_fields: 'id,title',
context: 'view'
};
function ParentControl({
parents,
postType,
onChange
}) {
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(parent_control_EMPTY_ARRAY);
const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(parent_control_EMPTY_ARRAY);
const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 250);
const {
searchResults,
searchHasResolved
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!search) {
return {
searchResults: parent_control_EMPTY_ARRAY,
searchHasResolved: true
};
}
const {
getEntityRecords,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const selectorArgs = ['postType', postType, {
...BASE_QUERY,
search,
orderby: 'relevance',
exclude: parents,
per_page: 20
}];
return {
searchResults: getEntityRecords(...selectorArgs),
searchHasResolved: hasFinishedResolution('getEntityRecords', selectorArgs)
};
}, [search, parents]);
const currentParents = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!parents?.length) {
return parent_control_EMPTY_ARRAY;
}
const {
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
return getEntityRecords('postType', postType, {
...BASE_QUERY,
include: parents,
per_page: parents.length
});
}, [parents]);
// Update the `value` state only after the selectors are resolved
// to avoid emptying the input when we're changing parents.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!parents?.length) {
setValue(parent_control_EMPTY_ARRAY);
}
if (!currentParents?.length) {
return;
}
const currentParentsInfo = getEntitiesInfo(mapToIHasNameAndId(currentParents, 'title.rendered'));
// Returns only the existing entity ids. This prevents the component
// from crashing in the editor, when non existing ids are provided.
const sanitizedValue = parents.reduce((accumulator, id) => {
const entity = currentParentsInfo.mapById[id];
if (entity) {
accumulator.push({
id,
value: entity.name
});
}
return accumulator;
}, []);
setValue(sanitizedValue);
}, [parents, currentParents]);
const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!searchResults?.length) {
return parent_control_EMPTY_ARRAY;
}
return getEntitiesInfo(mapToIHasNameAndId(searchResults, 'title.rendered'));
}, [searchResults]);
// Update suggestions only when the query has resolved.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!searchHasResolved) {
return;
}
setSuggestions(entitiesInfo.names);
}, [entitiesInfo.names, searchHasResolved]);
const getIdByValue = (entitiesMappedByName, entity) => {
const id = entity?.id || entitiesMappedByName?.[entity]?.id;
if (id) {
return id;
}
};
const onParentChange = newValue => {
const ids = Array.from(newValue.reduce((accumulator, entity) => {
// Verify that new values point to existing entities.
const id = getIdByValue(entitiesInfo.mapByName, entity);
if (id) {
accumulator.add(id);
}
return accumulator;
}, new Set()));
setSuggestions(parent_control_EMPTY_ARRAY);
onChange({
parents: ids
});
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Parents'),
value: value,
onInputChange: debouncedSearch,
suggestions: suggestions,
onChange: onParentChange,
__experimentalShowHowTo: false,
__nextHasNoMarginBottom: true
});
}
/* harmony default export */ const parent_control = (ParentControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/taxonomy-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const taxonomy_controls_EMPTY_ARRAY = [];
const taxonomy_controls_BASE_QUERY = {
order: 'asc',
_fields: 'id,name',
context: 'view'
};
// Helper function to get the term id based on user input in terms `FormTokenField`.
const getTermIdByTermValue = (terms, termValue) => {
// First we check for exact match by `term.id` or case sensitive `term.name` match.
const termId = termValue?.id || terms?.find(term => term.name === termValue)?.id;
if (termId) {
return termId;
}
/**
* Here we make an extra check for entered terms in a non case sensitive way,
* to match user expectations, due to `FormTokenField` behaviour that shows
* suggestions which are case insensitive.
*
* Although WP tries to discourage users to add terms with the same name (case insensitive),
* it's still possible if you manually change the name, as long as the terms have different slugs.
* In this edge case we always apply the first match from the terms list.
*/
const termValueLower = termValue.toLocaleLowerCase();
return terms?.find(term => term.name.toLocaleLowerCase() === termValueLower)?.id;
};
function TaxonomyControls({
onChange,
query
}) {
const {
postType,
taxQuery
} = query;
const taxonomies = useTaxonomies(postType);
if (!taxonomies || taxonomies.length === 0) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4,
children: taxonomies.map(taxonomy => {
const termIds = taxQuery?.[taxonomy.slug] || [];
const handleChange = newTermIds => onChange({
taxQuery: {
...taxQuery,
[taxonomy.slug]: newTermIds
}
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyItem, {
taxonomy: taxonomy,
termIds: termIds,
onChange: handleChange
}, taxonomy.slug);
})
});
}
/**
* Renders a `FormTokenField` for a given taxonomy.
*
* @param {Object} props The props for the component.
* @param {Object} props.taxonomy The taxonomy object.
* @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.
* @param {Function} props.onChange Callback `onChange` function.
* @return {JSX.Element} The rendered component.
*/
function TaxonomyItem({
taxonomy,
termIds,
onChange
}) {
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(taxonomy_controls_EMPTY_ARRAY);
const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(taxonomy_controls_EMPTY_ARRAY);
const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 250);
const {
searchResults,
searchHasResolved
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!search) {
return {
searchResults: taxonomy_controls_EMPTY_ARRAY,
searchHasResolved: true
};
}
const {
getEntityRecords,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const selectorArgs = ['taxonomy', taxonomy.slug, {
...taxonomy_controls_BASE_QUERY,
search,
orderby: 'name',
exclude: termIds,
per_page: 20
}];
return {
searchResults: getEntityRecords(...selectorArgs),
searchHasResolved: hasFinishedResolution('getEntityRecords', selectorArgs)
};
}, [search, termIds]);
// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.
// They are used to extract the terms' names to populate the `FormTokenField` properly
// and to sanitize the provided `termIds`, by setting only the ones that exist.
const existingTerms = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!termIds?.length) {
return taxonomy_controls_EMPTY_ARRAY;
}
const {
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
return getEntityRecords('taxonomy', taxonomy.slug, {
...taxonomy_controls_BASE_QUERY,
include: termIds,
per_page: termIds.length
});
}, [termIds]);
// Update the `value` state only after the selectors are resolved
// to avoid emptying the input when we're changing terms.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!termIds?.length) {
setValue(taxonomy_controls_EMPTY_ARRAY);
}
if (!existingTerms?.length) {
return;
}
// Returns only the existing entity ids. This prevents the component
// from crashing in the editor, when non existing ids are provided.
const sanitizedValue = termIds.reduce((accumulator, id) => {
const entity = existingTerms.find(term => term.id === id);
if (entity) {
accumulator.push({
id,
value: entity.name
});
}
return accumulator;
}, []);
setValue(sanitizedValue);
}, [termIds, existingTerms]);
// Update suggestions only when the query has resolved.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!searchHasResolved) {
return;
}
setSuggestions(searchResults.map(result => result.name));
}, [searchResults, searchHasResolved]);
const onTermsChange = newTermValues => {
const newTermIds = new Set();
for (const termValue of newTermValues) {
const termId = getTermIdByTermValue(searchResults, termValue);
if (termId) {
newTermIds.add(termId);
}
}
setSuggestions(taxonomy_controls_EMPTY_ARRAY);
onChange(Array.from(newTermIds));
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "block-library-query-inspector__taxonomy-control",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, {
label: taxonomy.name,
value: value,
onInputChange: debouncedSearch,
suggestions: suggestions,
displayTransform: external_wp_htmlEntities_namespaceObject.decodeEntities,
onChange: onTermsChange,
__experimentalShowHowTo: false,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/format-controls.js
/**
* WordPress dependencies
*/
// All WP post formats, sorted alphabetically by translated name.
// Value is the post format slug. Label is the name.
const POST_FORMATS = [{
value: 'aside',
label: (0,external_wp_i18n_namespaceObject.__)('Aside')
}, {
value: 'audio',
label: (0,external_wp_i18n_namespaceObject.__)('Audio')
}, {
value: 'chat',
label: (0,external_wp_i18n_namespaceObject.__)('Chat')
}, {
value: 'gallery',
label: (0,external_wp_i18n_namespaceObject.__)('Gallery')
}, {
value: 'image',
label: (0,external_wp_i18n_namespaceObject.__)('Image')
}, {
value: 'link',
label: (0,external_wp_i18n_namespaceObject.__)('Link')
}, {
value: 'quote',
label: (0,external_wp_i18n_namespaceObject.__)('Quote')
}, {
value: 'standard',
label: (0,external_wp_i18n_namespaceObject.__)('Standard')
}, {
value: 'status',
label: (0,external_wp_i18n_namespaceObject.__)('Status')
}, {
value: 'video',
label: (0,external_wp_i18n_namespaceObject.__)('Video')
}].sort((a, b) => {
const normalizedA = a.label.toUpperCase();
const normalizedB = b.label.toUpperCase();
if (normalizedA < normalizedB) {
return -1;
}
if (normalizedA > normalizedB) {
return 1;
}
return 0;
});
// A helper function to convert translatable post format names into their static values.
function formatNamesToValues(names, formats) {
return names.map(name => {
return formats.find(item => item.label.toLocaleLowerCase() === name.toLocaleLowerCase())?.value;
}).filter(Boolean);
}
function FormatControls({
onChange,
query: {
format
}
}) {
// 'format' is expected to be an array. If it is not an array, for example
// if a user has manually entered an invalid value in the block markup,
// convert it to an array to prevent JavaScript errors.
const normalizedFormats = Array.isArray(format) ? format : [format];
const {
supportedFormats
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports();
return {
supportedFormats: themeSupports.formats
};
}, []);
const formats = POST_FORMATS.filter(item => supportedFormats.includes(item.value));
const values = normalizedFormats.map(name => formats.find(item => item.value === name)?.label).filter(Boolean);
const suggestions = formats.filter(item => !normalizedFormats.includes(item.value)).map(item => item.label);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, {
label: (0,external_wp_i18n_namespaceObject.__)('Formats'),
value: values,
suggestions: suggestions,
onChange: newValues => {
onChange({
format: formatNamesToValues(newValues, formats)
});
},
__experimentalShowHowTo: false,
__experimentalExpandOnFocus: true,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/sticky-control.js
/**
* WordPress dependencies
*/
const stickyOptions = [{
label: (0,external_wp_i18n_namespaceObject.__)('Include'),
value: ''
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Exclude'),
value: 'exclude'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Only'),
value: 'only'
}];
function StickyControl({
value,
onChange
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Sticky posts'),
options: stickyOptions,
value: value,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('Sticky posts always appear first, regardless of their publish date.')
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/create-new-post-link.js
/**
* WordPress dependencies
*/
const CreateNewPostLink = ({
postType
}) => {
const newPostUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
post_type: postType
});
const addNewItemLabel = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
return getPostType(postType)?.labels?.add_new_item;
}, [postType]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "wp-block-query__create-new-link",
children: (0,external_wp_element_namespaceObject.createInterpolateElement)('' + addNewItemLabel + '',
// eslint-disable-next-line jsx-a11y/anchor-has-content
{
a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", {
href: newPostUrl
})
})
});
};
/* harmony default export */ const create_new_post_link = (CreateNewPostLink);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/per-page-control.js
/**
* WordPress dependencies
*/
const MIN_POSTS_PER_PAGE = 1;
const MAX_POSTS_PER_PAGE = 100;
const PerPageControl = ({
perPage,
offset = 0,
onChange
}) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'),
min: MIN_POSTS_PER_PAGE,
max: MAX_POSTS_PER_PAGE,
onChange: newPerPage => {
if (isNaN(newPerPage) || newPerPage < MIN_POSTS_PER_PAGE || newPerPage > MAX_POSTS_PER_PAGE) {
return;
}
onChange({
perPage: newPerPage,
offset
});
},
value: parseInt(perPage, 10)
});
};
/* harmony default export */ const per_page_control = (PerPageControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/offset-controls.js
/**
* WordPress dependencies
*/
const MIN_OFFSET = 0;
const MAX_OFFSET = 100;
const OffsetControl = ({
offset = 0,
onChange
}) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Offset'),
value: offset,
min: MIN_OFFSET,
onChange: newOffset => {
if (isNaN(newOffset) || newOffset < MIN_OFFSET || newOffset > MAX_OFFSET) {
return;
}
onChange({
offset: newOffset
});
}
});
};
/* harmony default export */ const offset_controls = (OffsetControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/pages-control.js
/**
* WordPress dependencies
*/
const PagesControl = ({
pages,
onChange
}) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Max pages'),
value: pages,
min: 0,
onChange: newPages => {
if (isNaN(newPages) || newPages < 0) {
return;
}
onChange({
pages: newPages
});
},
help: (0,external_wp_i18n_namespaceObject.__)('Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).')
});
};
/* harmony default export */ const pages_control = (PagesControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
BlockInfo
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function QueryInspectorControls(props) {
const {
attributes,
setQuery,
setDisplayLayout,
isTemplate
} = props;
const {
query,
displayLayout
} = attributes;
const {
order,
orderBy,
author: authorIds,
pages,
postType,
perPage,
offset,
sticky,
inherit,
taxQuery,
parents,
format
} = query;
const allowedControls = useAllowedControls(attributes);
const [showSticky, setShowSticky] = (0,external_wp_element_namespaceObject.useState)(postType === 'post');
const {
postTypesTaxonomiesMap,
postTypesSelectOptions,
postTypeFormatSupportMap
} = usePostTypes();
const taxonomies = useTaxonomies(postType);
const isPostTypeHierarchical = useIsPostTypeHierarchical(postType);
(0,external_wp_element_namespaceObject.useEffect)(() => {
setShowSticky(postType === 'post');
}, [postType]);
const onPostTypeChange = newValue => {
const updateQuery = {
postType: newValue
};
// We need to dynamically update the `taxQuery` property,
// by removing any not supported taxonomy from the query.
const supportedTaxonomies = postTypesTaxonomiesMap[newValue];
const updatedTaxQuery = Object.entries(taxQuery || {}).reduce((accumulator, [taxonomySlug, terms]) => {
if (supportedTaxonomies.includes(taxonomySlug)) {
accumulator[taxonomySlug] = terms;
}
return accumulator;
}, {});
updateQuery.taxQuery = !!Object.keys(updatedTaxQuery).length ? updatedTaxQuery : undefined;
if (newValue !== 'post') {
updateQuery.sticky = '';
}
// We need to reset `parents` because they are tied to each post type.
updateQuery.parents = [];
// Post types can register post format support with `add_post_type_support`.
// But we need to reset the `format` property when switching to post types
// that do not support post formats.
const hasFormatSupport = postTypeFormatSupportMap[newValue];
if (!hasFormatSupport) {
updateQuery.format = [];
}
setQuery(updateQuery);
};
const [querySearch, setQuerySearch] = (0,external_wp_element_namespaceObject.useState)(query.search);
const onChangeDebounced = (0,external_wp_element_namespaceObject.useCallback)((0,external_wp_compose_namespaceObject.debounce)(() => {
if (query.search !== querySearch) {
setQuery({
search: querySearch
});
}
}, 250), [querySearch, query.search]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
onChangeDebounced();
return onChangeDebounced.cancel;
}, [querySearch, onChangeDebounced]);
const showInheritControl = isTemplate && isControlAllowed(allowedControls, 'inherit');
const showPostTypeControl = !inherit && isControlAllowed(allowedControls, 'postType');
const postTypeControlLabel = (0,external_wp_i18n_namespaceObject.__)('Post type');
const postTypeControlHelp = (0,external_wp_i18n_namespaceObject.__)('Select the type of content to display: posts, pages, or custom post types.');
const showColumnsControl = false;
const showOrderControl = !inherit && isControlAllowed(allowedControls, 'order');
const showStickyControl = !inherit && showSticky && isControlAllowed(allowedControls, 'sticky');
const showSettingsPanel = showInheritControl || showPostTypeControl || showColumnsControl || showOrderControl || showStickyControl;
const showTaxControl = !!taxonomies?.length && isControlAllowed(allowedControls, 'taxQuery');
const showAuthorControl = isControlAllowed(allowedControls, 'author');
const showSearchControl = isControlAllowed(allowedControls, 'search');
const showParentControl = isControlAllowed(allowedControls, 'parents') && isPostTypeHierarchical;
const postTypeHasFormatSupport = postTypeFormatSupportMap[postType];
const showFormatControl = (0,external_wp_data_namespaceObject.useSelect)(select => {
// Check if the post type supports post formats and if the control is allowed.
if (!postTypeHasFormatSupport || !isControlAllowed(allowedControls, 'format')) {
return false;
}
const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports();
// If there are no supported formats, getThemeSupports still includes the default 'standard' format,
// and in this case the control should not be shown since the user has no other formats to choose from.
return themeSupports.formats && themeSupports.formats.length > 0 && themeSupports.formats.some(type => type !== 'standard');
}, [allowedControls, postTypeHasFormatSupport]);
const showFiltersPanel = showTaxControl || showAuthorControl || showSearchControl || showParentControl || showFormatControl;
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
const showPostCountControl = isControlAllowed(allowedControls, 'postCount');
const showOffSetControl = isControlAllowed(allowedControls, 'offset');
const showPagesControl = isControlAllowed(allowedControls, 'pages');
const showDisplayPanel = showPostCountControl || showOffSetControl || showPagesControl;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [!!postType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInfo, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(create_new_post_link, {
postType: postType
})
}), showSettingsPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
children: [showInheritControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Query type'),
isBlock: true,
onChange: value => {
setQuery({
inherit: !!value
});
},
help: inherit ? (0,external_wp_i18n_namespaceObject.__)('Display a list of posts or custom post types based on the current template.') : (0,external_wp_i18n_namespaceObject.__)('Display a list of posts or custom post types based on specific criteria.'),
value: !!inherit,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: true,
label: (0,external_wp_i18n_namespaceObject.__)('Default')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: false,
label: (0,external_wp_i18n_namespaceObject.__)('Custom')
})]
}), showPostTypeControl && (postTypesSelectOptions.length > 2 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
options: postTypesSelectOptions,
value: postType,
label: postTypeControlLabel,
onChange: onPostTypeChange,
help: postTypeControlHelp
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
isBlock: true,
value: postType,
label: postTypeControlLabel,
onChange: onPostTypeChange,
help: postTypeControlHelp,
children: postTypesSelectOptions.map(option => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: option.value,
label: option.label
}, option.value))
})), showColumnsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: displayLayout.columns,
onChange: value => setDisplayLayout({
columns: value
}),
min: 2,
max: Math.max(6, displayLayout.columns)
}), displayLayout.columns > 6 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
status: "warning",
isDismissible: false,
children: (0,external_wp_i18n_namespaceObject.__)('This column count exceeds the recommended amount and may cause visual breakage.')
})]
}), showOrderControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(order_control, {
order,
orderBy,
onChange: setQuery
}), showStickyControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StickyControl, {
value: sticky,
onChange: value => setQuery({
sticky: value
})
})]
}), !inherit && showDisplayPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
className: "block-library-query-toolspanel__display",
label: (0,external_wp_i18n_namespaceObject.__)('Display'),
resetAll: () => {
setQuery({
offset: 0,
pages: 0
});
},
dropdownMenuProps: dropdownMenuProps,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Items'),
hasValue: () => perPage > 0,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(per_page_control, {
perPage: perPage,
offset: offset,
onChange: setQuery
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Offset'),
hasValue: () => offset > 0,
onDeselect: () => setQuery({
offset: 0
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(offset_controls, {
offset: offset,
onChange: setQuery
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Max Pages to Show'),
hasValue: () => pages > 0,
onDeselect: () => setQuery({
pages: 0
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pages_control, {
pages: pages,
onChange: setQuery
})
})]
}), !inherit && showFiltersPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
className: "block-library-query-toolspanel__filters" // unused but kept for backward compatibility
,
label: (0,external_wp_i18n_namespaceObject.__)('Filters'),
resetAll: () => {
setQuery({
author: '',
parents: [],
search: '',
taxQuery: null,
format: []
});
setQuerySearch('');
},
dropdownMenuProps: dropdownMenuProps,
children: [showTaxControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Taxonomies'),
hasValue: () => Object.values(taxQuery || {}).some(terms => !!terms.length),
onDeselect: () => setQuery({
taxQuery: null
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyControls, {
onChange: setQuery,
query: query
})
}), showAuthorControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!authorIds,
label: (0,external_wp_i18n_namespaceObject.__)('Authors'),
onDeselect: () => setQuery({
author: ''
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(author_control, {
value: authorIds,
onChange: setQuery
})
}), showSearchControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!querySearch,
label: (0,external_wp_i18n_namespaceObject.__)('Keyword'),
onDeselect: () => setQuerySearch(''),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Keyword'),
value: querySearch,
onChange: setQuerySearch
})
}), showParentControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!parents?.length,
label: (0,external_wp_i18n_namespaceObject.__)('Parents'),
onDeselect: () => setQuery({
parents: []
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(parent_control, {
parents: parents,
postType: postType,
onChange: setQuery
})
}), showFormatControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!format?.length,
label: (0,external_wp_i18n_namespaceObject.__)('Formats'),
onDeselect: () => setQuery({
format: []
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormatControls, {
onChange: setQuery,
query: query
})
})]
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/enhanced-pagination-modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const modalDescriptionId = 'wp-block-query-enhanced-pagination-modal__description';
function EnhancedPaginationModal({
clientId,
attributes: {
enhancedPagination
},
setAttributes
}) {
const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const {
hasBlocksFromPlugins,
hasPostContentBlock,
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (enhancedPagination && hasUnsupportedBlocks && !window.__experimentalFullPageClientSideNavigation) {
setAttributes({
enhancedPagination: false
});
setOpen(true);
}
}, [enhancedPagination, hasUnsupportedBlocks, setAttributes]);
const closeModal = () => {
setOpen(false);
};
let notice = (0,external_wp_i18n_namespaceObject.__)('If you still want to prevent full page reloads, remove that block, then disable "Reload full page" again in the Query Block settings.');
if (hasBlocksFromPlugins) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when non-interactive or non-client Navigation compatible blocks from plugins are present inside the Query block.') + ' ' + notice;
} else if (hasPostContentBlock) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.') + ' ' + notice;
}
return isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Query block: Reload full page enabled'),
className: "wp-block-query__enhanced-pagination-modal",
aria: {
describedby: modalDescriptionId
},
role: "alertdialog",
focusOnMount: "firstElement",
isDismissible: false,
onRequestClose: closeModal,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
alignment: "right",
spacing: 5,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
id: modalDescriptionId,
children: notice
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
onClick: closeModal,
children: (0,external_wp_i18n_namespaceObject.__)('OK')
})]
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/query-content.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULTS_POSTS_PER_PAGE = 3;
const query_content_TEMPLATE = [['core/post-template']];
function QueryContent({
attributes,
setAttributes,
openPatternSelectionModal,
name,
clientId,
context
}) {
const {
queryId,
query,
displayLayout,
enhancedPagination,
tagName: TagName = 'div',
query: {
inherit
} = {}
} = attributes;
const {
postType
} = context;
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(QueryContent);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: query_content_TEMPLATE
});
const isTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => {
const currentTemplate = select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink()?.type;
const isInTemplate = 'wp_template' === currentTemplate;
const isInSingularContent = postType !== undefined;
return isInTemplate && !isInSingularContent;
}, [postType]);
const {
postsPerPage
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
getEntityRecord,
getEntityRecordEdits,
canUser
} = select(external_wp_coreData_namespaceObject.store);
const settingPerPage = canUser('read', {
kind: 'root',
name: 'site'
}) ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
// Gets changes made via the template area posts per page setting. These won't be saved
// until the page is saved, but we should reflect this setting within the query loops
// that inherit it.
const editedSettingPerPage = +getEntityRecordEdits('root', 'site')?.posts_per_page;
return {
postsPerPage: editedSettingPerPage || settingPerPage || DEFAULTS_POSTS_PER_PAGE
};
}, []);
// There are some effects running where some initialization logic is
// happening and setting some values to some attributes (ex. queryId).
// These updates can cause an `undo trap` where undoing will result in
// resetting again, so we need to mark these changes as not persistent
// with `__unstableMarkNextChangeAsNotPersistent`.
// Changes in query property (which is an object) need to be in the same callback,
// because updates are batched after the render and changes in different query properties
// would cause to override previous wanted changes.
const updateQuery = (0,external_wp_element_namespaceObject.useCallback)(newQuery => setAttributes({
query: {
...query,
...newQuery
}
}), [query, setAttributes]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const newQuery = {};
// When we inherit from global query always need to set the `perPage`
// based on the reading settings.
if (inherit && query.perPage !== postsPerPage) {
newQuery.perPage = postsPerPage;
} else if (!query.perPage && postsPerPage) {
newQuery.perPage = postsPerPage;
}
// We need to reset the `inherit` value if not in a template, as queries
// are not inherited when outside a template (e.g. when in singular content).
if (!isTemplate && query.inherit) {
newQuery.inherit = false;
}
if (!!Object.keys(newQuery).length) {
__unstableMarkNextChangeAsNotPersistent();
updateQuery(newQuery);
}
}, [query.perPage, postsPerPage, inherit, isTemplate, query.inherit, __unstableMarkNextChangeAsNotPersistent, updateQuery]);
// We need this for multi-query block pagination.
// Query parameters for each block are scoped to their ID.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!Number.isFinite(queryId)) {
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
queryId: instanceId
});
}
}, [queryId, instanceId, __unstableMarkNextChangeAsNotPersistent, setAttributes]);
const updateDisplayLayout = newDisplayLayout => setAttributes({
displayLayout: {
...displayLayout,
...newDisplayLayout
}
});
const htmlElementMessages = {
main: (0,external_wp_i18n_namespaceObject.__)('The element should be used for the primary content of your document only.'),
section: (0,external_wp_i18n_namespaceObject.__)("The element should represent a standalone portion of the document that can't be better represented by another element."),
aside: (0,external_wp_i18n_namespaceObject.__)("The