} [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 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/edit-site/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)));
const rootEditingMode = getBlockEditingMode(rootClientId);
// 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 (0,external_React_namespaceObject.createElement)("div", {
...props
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (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 (0,external_React_namespaceObject.createElement)("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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"
}), (0,external_React_namespaceObject.createElement)(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"
}), (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
onRequestClose: onClose,
title: (0,external_wp_i18n_namespaceObject.__)('Edit Page List'),
className: 'wp-block-page-list-modal',
aria: {
describedby: 'wp-block-page-list-modal__description'
}
}, (0,external_React_namespaceObject.createElement)("p", {
id: 'wp-block-page-list-modal__description'
}, convertDescription), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-page-list-modal-buttons"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: onClose
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
disabled: disabled,
onClick: onClick
}, (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 (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-page-list__loading-indicator-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, {
className: "wp-block-page-list__loading-indicator"
})));
}
if (pages === null) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: 'warning',
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.')));
}
if (pages.length === 0) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: 'info',
isDismissible: false
}, (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 (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (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 (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: 'warning',
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.')));
}
if (pages.length > 0) {
return (0,external_React_namespaceObject.createElement)("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: classnames_default()('wp-block-page-list', {
'has-text-color': !!context.textColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', context.textColor)]: !!context.textColor,
'has-background': !!context.backgroundColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', context.backgroundColor)]: !!context.backgroundColor
}),
style: {
...context.style?.color
}
});
const pagesTree = (0,external_wp_element_namespaceObject.useMemo)(function makePagesTree(parentId = 0, level = 0) {
const childPages = pagesByParentId.get(parentId);
if (!childPages?.length) {
return [];
}
return childPages.reduce((tree, page) => {
const hasChildren = pagesByParentId.has(page.id);
const item = {
value: page.id,
label: '— '.repeat(level) + page.title.rendered,
rawName: page.title.rendered
};
tree.push(item);
if (hasChildren) {
tree.push(...makePagesTree(page.id, level + 1));
}
return tree;
}, []);
}, [pagesByParentId]);
const blockList = (0,external_wp_element_namespaceObject.useMemo)(function getBlockList(parentId = parentPageID) {
const childPages = pagesByParentId.get(parentId);
if (!childPages?.length) {
return [];
}
return childPages.reduce((template, page) => {
const hasChildren = pagesByParentId.has(page.id);
const pageProps = {
id: page.id,
label:
// translators: displayed when a page has an empty title.
page.title?.rendered?.trim() !== '' ? page.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'),
title: page.title?.rendered,
link: page.url,
hasChildren
};
let item = null;
const children = getBlockList(page.id);
item = (0,external_wp_blocks_namespaceObject.createBlock)('core/page-list-item', pageProps, children);
template.push(item);
return template;
}, []);
}, [pagesByParentId, parentPageID]);
const {
isNested,
hasSelectedChild,
parentClientId,
hasDraggedChild,
isChildOfNavigation
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockParentsByBlockName,
hasSelectedInnerBlock,
hasDraggedInnerBlock
} = select(external_wp_blockEditor_namespaceObject.store);
const blockParents = getBlockParentsByBlockName(clientId, 'core/navigation-submenu', true);
const navigationBlockParents = getBlockParentsByBlockName(clientId, 'core/navigation', true);
return {
isNested: blockParents.length > 0,
isChildOfNavigation: navigationBlockParents.length > 0,
hasSelectedChild: hasSelectedInnerBlock(clientId, true),
hasDraggedChild: hasDraggedInnerBlock(clientId, true),
parentClientId: navigationBlockParents[0]
};
}, [clientId]);
const convertToNavigationLinks = useConvertToNavigationLinks({
clientId,
pages,
parentClientId,
parentPageID
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
renderAppender: false,
__unstableDisableDropZone: true,
templateLock: isChildOfNavigation ? false : 'all',
onInput: NOOP,
onChange: NOOP,
value: blockList
});
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (hasSelectedChild || hasDraggedChild) {
openModal();
selectBlock(parentClientId);
}
}, [hasSelectedChild, hasDraggedChild, parentClientId, selectBlock, openModal]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
setAttributes({
isNested
});
}, [isNested, setAttributes]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, pagesTree.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
__next40pxDefaultSize: true,
className: "editor-page-attributes__parent",
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
value: parentPageID,
options: pagesTree,
onChange: value => setAttributes({
parentPageID: value !== null && value !== void 0 ? value : 0
}),
help: (0,external_wp_i18n_namespaceObject.__)('Choose a page to show only its subpages.')
})), allowConvertToLinks && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Edit this menu')
}, (0,external_React_namespaceObject.createElement)("p", null, convertDescription), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
disabled: !hasResolvedPages,
onClick: convertToNavigationLinks
}, (0,external_wp_i18n_namespaceObject.__)('Edit')))), allowConvertToLinks && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
title: (0,external_wp_i18n_namespaceObject.__)('Edit'),
onClick: openModal
}, (0,external_wp_i18n_namespaceObject.__)('Edit'))), isOpen && (0,external_React_namespaceObject.createElement)(ConvertToLinksModal, {
onClick: convertToNavigationLinks,
onClose: closeModal,
disabled: !hasResolvedPages
})), (0,external_React_namespaceObject.createElement)(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 = () => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "12",
height: "12",
viewBox: "0 0 12 12",
fill: "none"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M1.50002 4L6.00002 8L10.5 4",
strokeWidth: "1.5"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list-item/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useFrontPageId() {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const canReadSettings = select(external_wp_coreData_namespaceObject.store).canUser('read', 'settings');
if (!canReadSettings) {
return undefined;
}
const site = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site');
return site?.show_on_front === 'page' && site?.page_on_front;
}, []);
}
function PageListItemEdit({
context,
attributes
}) {
const {
id,
label,
link,
hasChildren,
title
} = attributes;
const isNavigationChild = ('showSubmenuIcon' in context);
const frontPageId = useFrontPageId();
const innerBlocksColors = getColors(context, true);
const navigationChildBlockProps = getNavigationChildBlockProps(innerBlocksColors);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(navigationChildBlockProps, {
className: 'wp-block-pages-list__item'
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps);
return (0,external_React_namespaceObject.createElement)("li", {
key: id,
className: classnames_default()('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
})
}, hasChildren && context.openSubmenusOnClick ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("button", {
type: "button",
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
"aria-expanded": "false"
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(label)), (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
}, (0,external_React_namespaceObject.createElement)(icons_ItemSubmenuIcon, null))) : (0,external_React_namespaceObject.createElement)("a", {
className: classnames_default()('wp-block-pages-list__item__link', {
'wp-block-navigation-item__content': isNavigationChild
}),
href: link
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), hasChildren && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !context.openSubmenusOnClick && context.showSubmenuIcon && (0,external_React_namespaceObject.createElement)("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"
}, (0,external_React_namespaceObject.createElement)(icons_ItemSubmenuIcon, null)), (0,external_React_namespaceObject.createElement)("ul", {
...innerBlocksProps
})));
}
;// 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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
'has-drop-cap': align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap,
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)("p", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
dir: direction
})
}, (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
'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 (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
'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 (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
[`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 (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
[`align${width}`]: width,
'has-background': backgroundColor,
'has-drop-cap': dropCap
});
const styles = {
backgroundColor,
color: textColor,
fontSize,
textAlign: align
};
return (0,external_React_namespaceObject.createElement)("p", {
style: styles,
className: className ? className : undefined
}, 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 (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, 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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(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
*/
const edit_name = 'core/paragraph';
function ParagraphRTLControl({
direction,
setDirection
}) {
return (0,external_wp_i18n_namespaceObject.isRTL)() && (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!dropCap,
label: (0,external_wp_i18n_namespaceObject.__)('Drop cap'),
onDeselect: () => setAttributes({
dropCap: undefined
}),
resetAllFilter: () => ({
dropCap: undefined
}),
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(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: classnames_default()({
'has-drop-cap': hasDropCapDisabled(align) ? false : dropCap,
[`has-text-align-${align}`]: align
}),
style: {
direction
}
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: align,
onChange: newAlign => setAttributes({
align: newAlign,
dropCap: hasDropCapDisabled(newAlign) ? false : dropCap
})
}), (0,external_React_namespaceObject.createElement)(ParagraphRTLControl, {
direction: direction,
setDirection: newDirection => setAttributes({
direction: newDirection
})
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "typography"
}, (0,external_React_namespaceObject.createElement)(DropCapControl, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "content",
tagName: "p",
...blockProps,
value: content,
onChange: newContent => setAttributes({
content: newContent
}),
onSplit: (value, isOriginal) => {
let newAttributes;
if (isOriginal || value) {
newAttributes = {
...attributes,
content: value
};
}
const block = (0,external_wp_blocks_namespaceObject.createBlock)(edit_name, newAttributes);
if (isOriginal) {
block.clientId = clientId;
}
return block;
},
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 = classnames_default()({
'has-drop-cap': align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap,
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)("p", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
dir: direction
})
}, (0,external_React_namespaceObject.createElement)(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",
usesContext: ["postId"],
attributes: {
align: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "p",
__experimentalRole: "content"
},
dropCap: {
type: "boolean",
"default": false
},
placeholder: {
type: "string"
},
direction: {
type: "string",
"enum": ["ltr", "rtl"]
}
},
supports: {
anchor: true,
className: false,
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",
usesContext: ["postId"],
attributes: {
align: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "p",
__experimentalRole: "content"
},
dropCap: {
type: "boolean",
"default": false
},
placeholder: {
type: "string"
},
direction: {
type: "string",
"enum": ["ltr", "rtl"]
}
},
supports: {
anchor: true,
className: false,
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(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: classnames_default()({
[`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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, showAuthorControl && (showCombobox && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
options: authorOptions,
value: authorId,
onChange: handleSelect,
allowReset: false
}) || (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
value: authorId,
options: authorOptions,
onChange: handleSelect
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show avatar'),
checked: showAvatar,
onChange: () => setAttributes({
showAvatar: !showAvatar
})
}), showAvatar && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Avatar size'),
value: attributes.avatarSize,
options: avatarSizes,
onChange: size => {
setAttributes({
avatarSize: Number(size)
});
}
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show bio'),
checked: showBio,
onChange: () => setAttributes({
showBio: !showBio
})
}), (0,external_React_namespaceObject.createElement)(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 && (0,external_React_namespaceObject.createElement)(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'
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, showAvatar && authorDetails?.avatar_urls && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-post-author__avatar"
}, (0,external_React_namespaceObject.createElement)("img", {
width: attributes.avatarSize,
src: authorDetails.avatar_urls[attributes.avatarSize],
alt: authorDetails.name
})), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-post-author__content"
}, (!external_wp_blockEditor_namespaceObject.RichText.isEmpty(byline) || isSelected) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
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
})
}), (0,external_React_namespaceObject.createElement)("p", {
className: "wp-block-post-author__name"
}, isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#post-author-pseudo-link",
onClick: event => event.preventDefault()
}, authorName) : authorName), showBio && (0,external_React_namespaceObject.createElement)("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
}
},
style: "wp-block-post-author"
};
const {
name: post_author_name
} = post_author_metadata;
const post_author_settings = {
icon: post_author,
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: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const displayName = authorName?.name || (0,external_wp_i18n_namespaceObject.__)('Author Name');
const displayAuthor = isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#author-pseudo-link",
onClick: event => event.preventDefault(),
className: "wp-block-post-author-name__link"
}, displayName) : displayName;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to author archive'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(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'
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, " ", 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"],
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
}
}
};
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: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const displayAuthorBiography = authorDetails?.description || (0,external_wp_i18n_namespaceObject.__)('Author Biography');
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("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"],
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
}
}
};
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(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.')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: commentId,
onChange: val => setCommentIdInput(parseInt(val))
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: () => {
setAttributes({
commentId: commentIdInput
});
}
}, (0,external_wp_i18n_namespaceObject.__)('Save'))));
}
return (0,external_React_namespaceObject.createElement)("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 (0,external_React_namespaceObject.createElement)("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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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: classnames_default()({
[`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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps,
style: blockStyles
}, hasPostAndComments ? commentsCount : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
}),
'aria-describedby': instanceIdDesc
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(post_comments_form_form, {
postId: postId,
postType: postType
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: instanceIdDesc
}, (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
}
}
},
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: classnames_default()({
[`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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, link && commentsText !== undefined ? (0,external_React_namespaceObject.createElement)("a", {
href: link + '#comments',
onClick: event => event.preventDefault()
}, commentsText) : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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/utils/hooks.js
/**
* WordPress dependencies
*/
/**
* Returns whether the current user can edit the given entity.
*
* @param {string} kind Entity kind.
* @param {string} name Entity name.
* @param {string} recordId Record's id.
*/
function useCanEditEntity(kind, name, recordId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUserEditEntityRecord(kind, name, recordId), [kind, name, recordId]);
}
/* harmony default export */ const hooks = ({
useCanEditEntity
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-content/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ReadOnlyContent({
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
});
return content?.protected && !userCanEdit ? (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('This content is password protected.'))) : (0,external_React_namespaceObject.createElement)("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 (0,external_React_namespaceObject.createElement)("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 ? (0,external_React_namespaceObject.createElement)(EditableContent, {
...props
}) : (0,external_React_namespaceObject.createElement)(ReadOnlyContent, {
layoutClassNames: layoutClassNames,
userCanEdit: userCanEdit,
postType: postType,
postId: postId
});
}
function edit_Placeholder({
layoutClassNames
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: layoutClassNames
});
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This is the Content block, it will display all the blocks in any single post or page.')), (0,external_React_namespaceObject.createElement)("p", null, (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.')), (0,external_React_namespaceObject.createElement)("p", null, (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 (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
function PostContentEdit({
context,
__unstableLayoutClassNames: layoutClassNames
}) {
const {
postId: contextPostId,
postType: contextPostType
} = context;
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(contextPostId);
if (contextPostId && contextPostType && hasAlreadyRendered) {
return (0,external_React_namespaceObject.createElement)(RecursionError, null);
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: contextPostId
}, contextPostId && contextPostType ? (0,external_React_namespaceObject.createElement)(Content, {
context: context,
layoutClassNames: layoutClassNames
}) : (0,external_React_namespaceObject.createElement)(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"],
supports: {
align: ["wide", "full"],
html: false,
layout: true,
dimensions: {
minHeight: true
},
spacing: {
blockGap: true
},
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
}
}
},
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: classnames_default()({
[`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 ? (0,external_React_namespaceObject.createElement)("time", {
dateTime: (0,external_wp_date_namespaceObject.dateI18n)('c', date),
ref: setPopoverAnchor
}, (0,external_wp_date_namespaceObject.dateI18n)(format || siteFormat, date)) : dateLabel;
if (isLink && date) {
postDate = (0,external_React_namespaceObject.createElement)("a", {
href: "#post-date-pseudo-link",
onClick: event => event.preventDefault()
}, postDate);
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
}), date && displayType === 'date' && !isDescendentOfQueryLoop && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
renderContent: ({
onClose
}) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPublishDateTimePicker, {
currentDate: date,
onChange: setDate,
is12Hour: is12HourFormat(siteTimeFormat),
onClose: onClose
}),
renderToggle: ({
isOpen,
onToggle
}) => {
const openOnArrowDown = event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
};
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
"aria-expanded": isOpen,
icon: library_edit,
title: (0,external_wp_i18n_namespaceObject.__)('Change Date'),
onClick: onToggle,
onKeyDown: openOnArrowDown
});
}
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalDateFormatPicker, {
format: format,
defaultFormat: siteFormat,
onChange: nextFormat => setAttributes({
format: nextFormat
})
}), (0,external_React_namespaceObject.createElement)(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
}), (0,external_React_namespaceObject.createElement)(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')
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, 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"],
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
}
}
};
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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: classnames_default()({
[`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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This block will display the excerpt.'))));
}
if (isProtected && !userCanEdit) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('The content is currently protected and does not have the available excerpt.')));
}
const readMoreLink = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
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 = classnames_default()('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 ? (0,external_React_namespaceObject.createElement)(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"
}) : (0,external_React_namespaceObject.createElement)("p", {
className: excerptClassName
}, !isTrimmed ? rawOrRenderedExcerpt || (0,external_wp_i18n_namespaceObject.__)('No excerpt found') : trimmedExcerpt + ELLIPSIS);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(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
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Max number of words'),
value: excerptLength,
onChange: value => {
setAttributes({
excerptLength: value
});
},
min: "10",
max: "100"
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, excerptContent, !showMoreOnNewLine && ' ', showMoreOnNewLine ? (0,external_React_namespaceObject.createElement)("p", {
className: "wp-block-post-excerpt__more-text"
}, 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"],
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
}
},
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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 = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "cover",
label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for Image dimension control')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "contain",
label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for Image dimension control')
}), (0,external_React_namespaceObject.createElement)(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,
imageSizeOptions = []
}) => {
const [availableUnits] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', '%', 'vw', 'em', 'rem']
});
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';
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "dimensions"
}, (0,external_React_namespaceObject.createElement)(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
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
value: aspectRatio,
options: [
// These should use the same values as AspectRatioDropdown in @wordpress/block-editor
{
label: (0,external_wp_i18n_namespaceObject.__)('Original'),
value: 'auto'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Square'),
value: '1'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('16:9'),
value: '16/9'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('4:3'),
value: '4/3'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('3:2'),
value: '3/2'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('9:16'),
value: '9/16'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('3:4'),
value: '3/4'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('2:3'),
value: '2/3'
}],
onChange: nextAspectRatio => setAttributes({
aspectRatio: nextAspectRatio
})
})), (0,external_React_namespaceObject.createElement)(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
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
labelPosition: "top",
value: height || '',
min: 0,
onChange: nextHeight => onDimensionChange('height', nextHeight),
units: units
})), (0,external_React_namespaceObject.createElement)(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
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
labelPosition: "top",
value: width || '',
min: 0,
onChange: nextWidth => onDimensionChange('width', nextWidth),
units: units
})), showScaleControl && (0,external_React_namespaceObject.createElement)(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
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: scaleLabel,
value: scale,
help: scaleHelp[scale],
onChange: value => setAttributes({
scale: value
}),
isBlock: true
}, SCALE_OPTIONS)), !!imageSizeOptions.length && (0,external_React_namespaceObject.createElement)(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
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__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/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 = ({
clientId,
attributes,
setAttributes,
overlayColor,
setOverlayColor
}) => {
const {
dimRatio
} = attributes;
const {
gradientClass,
gradientValue,
setGradient
} = (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) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !!dimRatio && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('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
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "color"
}, (0,external_React_namespaceObject.createElement)(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
}), (0,external_React_namespaceObject.createElement)(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
}, (0,external_React_namespaceObject.createElement)(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 = ((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/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 [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 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 blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style: {
width,
height,
aspectRatio
}
});
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const placeholder = content => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: classnames_default()('block-editor-media-placeholder', borderProps.className),
withIllustration: true,
style: {
height: !!aspectRatio && '100%',
width: !!aspectRatio && '100%',
...borderProps.style
}
}, content);
};
const onSelectImage = value => {
if (value?.id) {
setFeaturedImage(value.id);
}
};
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
};
const controls = blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(overlay, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId
}), (0,external_React_namespaceObject.createElement)(dimension_controls, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes,
imageSizeOptions: imageSizeOptions
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(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: "Page".
(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 && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(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'
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__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 consious 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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, controls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, !!isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: postPermalink,
target: linkTarget,
...disabledClickProps
}, placeholder()) : placeholder()));
}
const label = (0,external_wp_i18n_namespaceObject.__)('Add a featured image');
const imageStyles = {
...borderProps.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) {
image = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
onSelect: onSelectImage,
accept: "image/*",
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
onError: onUploadError,
placeholder: placeholder,
mediaLibraryButton: ({
open
}) => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
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 ? placeholder() : (0,external_React_namespaceObject.createElement)("img", {
className: borderProps.className,
src: mediaUrl,
alt: 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
});
}
/**
* 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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, controls, !!media && !isDescendentOfQueryLoop && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: featuredImage,
mediaURL: mediaUrl,
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
accept: "image/*",
onSelect: onSelectImage,
onError: onUploadError
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => setFeaturedImage(0)
}, (0,external_wp_i18n_namespaceObject.__)('Reset')))), (0,external_React_namespaceObject.createElement)("figure", {
...blockProps
}, !!isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: postPermalink,
target: linkTarget,
...disabledClickProps
}, image) : image));
}
;// 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"],
supports: {
align: ["left", "right", "center", "wide", "full"],
color: {
__experimentalDuotone: "img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before",
text: false,
background: false
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSelector: "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
},
html: false,
spacing: {
margin: true,
padding: true
},
interactivity: {
clientNavigation: true
}
},
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) {
/* translators: Label before for next and previous post. There is a space after the colon. */
placeholder = isNext ? (0,external_wp_i18n_namespaceObject.__)('Next: ') : (0,external_wp_i18n_namespaceObject.__)('Previous: ');
}
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: classnames_default()({
[`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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(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 && (0,external_React_namespaceObject.createElement)(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
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__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
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "none",
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Arrow option for Next/Previous link')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "arrow",
label: (0,external_wp_i18n_namespaceObject._x)('Arrow', 'Arrow option for Next/Previous link')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "chevron",
label: (0,external_wp_i18n_namespaceObject._x)('Chevron', 'Arrow option for Next/Previous link')
})))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
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.')
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, !isNext && displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-post-navigation-link__arrow-previous is-arrow-${arrow}`
}, displayArrow), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "a",
"aria-label": ariaLabel,
placeholder: placeholder,
value: label,
allowedFormats: ['core/bold', 'core/italic'],
onChange: newLabel => setAttributes({
label: newLabel
})
}), showTitle && (0,external_React_namespaceObject.createElement)("a", {
href: "#post-navigation-pseudo-link",
onClick: event => event.preventDefault()
}, (0,external_wp_i18n_namespaceObject.__)('An example title')), isNext && displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-post-navigation-link__arrow-next is-arrow-${arrow}`,
"aria-hidden": true
}, displayArrow)));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
/**
* WordPress dependencies
*/
const next = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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() {
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: 'wp-block-post'
}, {
template: post_template_edit_TEMPLATE,
__unstableDisableLayoutClassNames: true
});
return (0,external_React_namespaceObject.createElement)("li", {
...innerBlocksProps
});
}
function PostTemplateBlockPreview({
blocks,
blockContextId,
isHidden,
setActiveBlockContextId
}) {
const blockPreviewProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBlockPreview)({
blocks,
props: {
className: 'wp-block-post'
}
});
const handleOnClick = () => {
setActiveBlockContextId(blockContextId);
};
const style = {
display: isHidden ? 'none' : undefined
};
return (0,external_React_namespaceObject.createElement)("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,
// 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 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, restQueryArgs, previewPostType]);
const blockContexts = (0,external_wp_element_namespaceObject.useMemo)(() => posts?.map(post => ({
postType: post.type,
postId: post.id
})), [posts]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()(__unstableLayoutClassNames, {
[`columns-${columnCount}`]: layoutType === 'grid' && columnCount // Ensure column count is flagged via classname for backwards compatibility.
})
});
if (!posts) {
return (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
if (!posts.length) {
return (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, " ", (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.__)('List view'),
onClick: () => setDisplayLayout({
type: 'default'
}),
isActive: layoutType === 'default' || layoutType === 'constrained'
}, {
icon: library_grid,
title: (0,external_wp_i18n_namespaceObject.__)('Grid view'),
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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
controls: displayLayoutControls
})), (0,external_React_namespaceObject.createElement)("ul", {
...blockProps
}, blockContexts && blockContexts.map(blockContext => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
key: blockContext.postId,
value: blockContext
}, blockContext.postId === (activeBlockContextId || blockContexts[0]?.postId) ? (0,external_React_namespaceObject.createElement)(PostTemplateInnerBlocks, null) : null, (0,external_React_namespaceObject.createElement)(MemoizedPostTemplateBlockPreview, {
blocks: blocks,
blockContextId: blockContext.postId,
setActiveBlockContextId: setActiveBlockContextId,
isHidden: blockContext.postId === (activeBlockContextId || blockContexts[0]?.postId)
})))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/save.js
/**
* WordPress dependencies
*/
function PostTemplateSave() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// 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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(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: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign,
[`taxonomy-${term}`]: term
})
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__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.')
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, isLoading && hasPost && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !isLoading && (isSelected || prefix) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
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) && (0,external_React_namespaceObject.createElement)("span", null, blockInformation.title), hasPost && !isLoading && hasPostTerms && postTerms.map(postTerm => (0,external_React_namespaceObject.createElement)("a", {
key: postTerm.id,
href: postTerm.link,
onClick: event => event.preventDefault()
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTerm.name))).reduce((prev, curr) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, prev, (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-post-terms__separator"
}, separator || ' '), curr)), hasPost && !isLoading && !hasPostTerms && (selectedTerm?.labels?.no_terms || (0,external_wp_i18n_namespaceObject.__)('Term items not found.')), !isLoading && (isSelected || suffix) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(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"],
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
}
},
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: %d is the number of minutes the post will take to read. */
(0,external_wp_i18n_namespaceObject._n)('%d minute', '%d minutes', minutesToRead), minutesToRead);
}, [contentStructure, blocks]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, 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 = ((0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(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
}
}
};
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
*/
/**
* Internal dependencies
*/
function PostTitleEdit({
attributes: {
level,
textAlign,
isLink,
rel,
linkTarget
},
setAttributes,
context: {
postType,
postId,
queryId
},
insertBlocksAfter
}) {
const TagName = 'h' + level;
const isDescendentOfQueryLoop = Number.isFinite(queryId);
/**
* Hack: 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.
*/
const userCanEdit = useCanEditEntity('postType', !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: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
let titleElement = (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_wp_i18n_namespaceObject.__)('Title'));
if (postType && postId) {
titleElement = userCanEdit ? (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
tagName: TagName,
placeholder: (0,external_wp_i18n_namespaceObject.__)('No Title'),
value: rawTitle,
onChange: setTitle,
__experimentalVersion: 2,
__unstableOnSplitAtEnd: onSplitAtEnd,
...blockProps
}) : (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps,
dangerouslySetInnerHTML: {
__html: fullTitle?.rendered
}
});
}
if (isLink && postType && postId) {
titleElement = userCanEdit ? (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(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
})) : (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)("a", {
href: link,
target: linkTarget,
rel: rel,
onClick: event => event.preventDefault(),
dangerouslySetInnerHTML: {
__html: fullTitle?.rendered
}
}));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
value: level,
onChange: newLevel => setAttributes({
level: newLevel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Make title a link'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(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'
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__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
},
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,
__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
}
},
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)("pre", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)(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,
__experimentalRole: "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
}
},
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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(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',
__experimentalRole: 'content'
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: '',
__experimentalRole: 'content'
},
textAlign: {
type: 'string'
}
},
save({
attributes
}) {
const {
textAlign,
citation,
value
} = attributes;
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation);
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
})
}, (0,external_React_namespaceObject.createElement)("blockquote", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), shouldShowCitation && (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
'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 = classnames_default()({
'has-text-color': textColor || customTextColor,
[blockquoteTextColorClass]: blockquoteTextColorClass
});
const blockquoteStyles = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: figureClasses,
style: figureStyles
})
}, (0,external_React_namespaceObject.createElement)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyles
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(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 = classnames_default()({
'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) && classnames_default()('has-text-color', {
[blockquoteTextColorClass]: blockquoteTextColorClass
});
const blockquoteStyles = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return (0,external_React_namespaceObject.createElement)("figure", {
className: figureClasses,
style: figureStyles
}, (0,external_React_namespaceObject.createElement)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyles
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(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 ? classnames_default()('has-text-color', {
[blockquoteTextColorClass]: blockquoteTextColorClass
}) : undefined;
const blockquoteStyle = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return (0,external_React_namespaceObject.createElement)("figure", {
className: figureClass,
style: figureStyles
}, (0,external_React_namespaceObject.createElement)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyle
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)("blockquote", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)("blockquote", {
className: `align${align}`
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(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: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) || isSelected;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(Figure, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(BlockQuote, null, (0,external_React_namespaceObject.createElement)(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 && (0,external_React_namespaceObject.createElement)(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 (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
})
}, (0,external_React_namespaceObject.createElement)("blockquote", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
value: value
}), shouldShowCitation && (0,external_React_namespaceObject.createElement)(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",
__experimentalRole: "content"
},
citation: {
type: "rich-text",
source: "rich-text",
selector: "cite",
__experimentalRole: "content"
},
textAlign: {
type: "string"
}
},
supports: {
anchor: true,
align: ["left", "right", "wide", "full"],
color: {
gradients: true,
background: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__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 = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(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/icons/build-module/library/settings.js
/**
* WordPress dependencies
*/
const settings_settings = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
}));
/* harmony default export */ const library_settings = (settings_settings);
;// 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.
*
* @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]);
return {
postTypesTaxonomiesMap,
postTypesSelectOptions
};
};
/**
* 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
} = select(external_wp_coreData_namespaceObject.store);
const filteredTaxonomies = getTaxonomies({
type: postType,
per_page: -1,
context: 'view'
});
return filteredTaxonomies;
}, [postType]);
return 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
}
} = 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
};
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/query-toolbar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function QueryToolbar({
attributes: {
query
},
setQuery,
openPatternSelectionModal,
name,
clientId
}) {
const hasPatterns = !!usePatterns(clientId, name).length;
const maxPageInputId = (0,external_wp_compose_namespaceObject.useInstanceId)(QueryToolbar, 'blocks-query-pagination-max-page-input');
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !query.inherit && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
contentClassName: "block-library-query-toolbar__popover",
renderToggle: ({
onToggle
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_settings,
label: (0,external_wp_i18n_namespaceObject.__)('Display settings'),
onClick: onToggle
}),
renderContent: () => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__unstableInputWidth: "60px",
label: (0,external_wp_i18n_namespaceObject.__)('Items per Page'),
labelPosition: "edge",
min: 1,
max: 100,
onChange: value => {
if (isNaN(value) || value < 1 || value > 100) {
return;
}
setQuery({
perPage: value
});
},
step: "1",
value: query.perPage,
isDragEnabled: false
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__unstableInputWidth: "60px",
label: (0,external_wp_i18n_namespaceObject.__)('Offset'),
labelPosition: "edge",
min: 0,
max: 100,
onChange: value => {
if (isNaN(value) || value < 0 || value > 100) {
return;
}
setQuery({
offset: value
});
},
step: "1",
value: query.offset,
isDragEnabled: false
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
id: maxPageInputId,
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).')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
id: maxPageInputId,
__unstableInputWidth: "60px",
label: (0,external_wp_i18n_namespaceObject.__)('Max page to show'),
labelPosition: "edge",
min: 0,
onChange: value => {
if (isNaN(value) || value < 0) {
return;
}
setQuery({
pages: value
});
},
step: "1",
value: query.pages,
isDragEnabled: false
})))
})), hasPatterns && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
className: "wp-block-template-part__block-control-group"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: openPatternSelectionModal
}, (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 (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: 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 (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
label: (0,external_wp_i18n_namespaceObject.__)('Authors'),
value: sanitizedValue,
suggestions: authorsInfo.names,
onChange: onAuthorChange,
__experimentalShowHowTo: false
});
}
/* 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 (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
label: (0,external_wp_i18n_namespaceObject.__)('Parents'),
value: value,
onInputChange: debouncedSearch,
suggestions: suggestions,
onChange: onParentChange,
__experimentalShowHowTo: false
});
}
/* 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 (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, taxonomies.map(taxonomy => {
const termIds = taxQuery?.[taxonomy.slug] || [];
const handleChange = newTermIds => onChange({
taxQuery: {
...taxQuery,
[taxonomy.slug]: newTermIds
}
});
return (0,external_React_namespaceObject.createElement)(TaxonomyItem, {
key: taxonomy.slug,
taxonomy: taxonomy,
termIds: termIds,
onChange: handleChange
});
}));
}
/**
* 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 (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-query-inspector__taxonomy-control"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
label: taxonomy.name,
value: value,
onInputChange: debouncedSearch,
suggestions: suggestions,
displayTransform: external_wp_htmlEntities_namespaceObject.decodeEntities,
onChange: onTermsChange,
__experimentalShowHowTo: false
}));
}
;// 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 (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Sticky posts'),
options: stickyOptions,
value: value,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.')
});
}
;// 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);
let help = (0,external_wp_i18n_namespaceObject.__)('Browsing between pages requires a full page reload.');
if (enhancedPagination) {
help = (0,external_wp_i18n_namespaceObject.__)("Browsing between pages won't require a full page reload, unless non-compatible blocks are detected.");
} else if (hasUnsupportedBlocks) {
help = (0,external_wp_i18n_namespaceObject.__)("Force page reload can't be disabled because there are non-compatible blocks inside the Query block.");
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Force page reload'),
help: help,
checked: !enhancedPagination,
disabled: hasUnsupportedBlocks,
onChange: value => {
setAttributes({
enhancedPagination: !value
});
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/create-new-post-link.js
/**
* WordPress dependencies
*/
const CreateNewPostLink = ({
attributes: {
query: {
postType
} = {}
} = {}
}) => {
if (!postType) return null;
const newPostUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
post_type: postType
});
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-query__create-new-link"
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Add new post'),
// eslint-disable-next-line jsx-a11y/anchor-has-content
{
a: (0,external_React_namespaceObject.createElement)("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/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
BlockInfo
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function QueryInspectorControls(props) {
const {
attributes,
setQuery,
setDisplayLayout,
setAttributes,
clientId
} = props;
const {
query,
displayLayout,
enhancedPagination
} = attributes;
const {
order,
orderBy,
author: authorIds,
postType,
sticky,
inherit,
taxQuery,
parents
} = query;
const allowedControls = useAllowedControls(attributes);
const [showSticky, setShowSticky] = (0,external_wp_element_namespaceObject.useState)(postType === 'post');
const {
postTypesTaxonomiesMap,
postTypesSelectOptions
} = 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 = [];
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 = isControlAllowed(allowedControls, 'inherit');
const showPostTypeControl = !inherit && isControlAllowed(allowedControls, 'postType');
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 showFiltersPanel = showTaxControl || showAuthorControl || showSearchControl || showParentControl;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(BlockInfo, null, (0,external_React_namespaceObject.createElement)(create_new_post_link, {
...props
})), showSettingsPanel && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, showInheritControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Inherit query from template'),
help: (0,external_wp_i18n_namespaceObject.__)('Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'),
checked: !!inherit,
onChange: value => setQuery({
inherit: !!value
})
}), showPostTypeControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
options: postTypesSelectOptions,
value: postType,
label: (0,external_wp_i18n_namespaceObject.__)('Post type'),
onChange: onPostTypeChange,
help: (0,external_wp_i18n_namespaceObject.__)('WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.')
}), showColumnsControl && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: 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 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: "warning",
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('This column count exceeds the recommended amount and may cause visual breakage.'))), showOrderControl && (0,external_React_namespaceObject.createElement)(order_control, {
order,
orderBy,
onChange: setQuery
}), showStickyControl && (0,external_React_namespaceObject.createElement)(StickyControl, {
value: sticky,
onChange: value => setQuery({
sticky: value
})
}), (0,external_React_namespaceObject.createElement)(EnhancedPaginationControl, {
enhancedPagination: enhancedPagination,
setAttributes: setAttributes,
clientId: clientId
})), !inherit && showFiltersPanel && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
className: "block-library-query-toolspanel__filters",
label: (0,external_wp_i18n_namespaceObject.__)('Filters'),
resetAll: () => {
setQuery({
author: '',
parents: [],
search: '',
taxQuery: null
});
setQuerySearch('');
},
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, showTaxControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Taxonomies'),
hasValue: () => Object.values(taxQuery || {}).some(terms => !!terms.length),
onDeselect: () => setQuery({
taxQuery: null
})
}, (0,external_React_namespaceObject.createElement)(TaxonomyControls, {
onChange: setQuery,
query: query
})), showAuthorControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!authorIds,
label: (0,external_wp_i18n_namespaceObject.__)('Authors'),
onDeselect: () => setQuery({
author: ''
})
}, (0,external_React_namespaceObject.createElement)(author_control, {
value: authorIds,
onChange: setQuery
})), showSearchControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!querySearch,
label: (0,external_wp_i18n_namespaceObject.__)('Keyword'),
onDeselect: () => setQuerySearch('')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Keyword'),
value: querySearch,
onChange: setQuerySearch
})), showParentControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!parents?.length,
label: (0,external_wp_i18n_namespaceObject.__)('Parents'),
onDeselect: () => setQuery({
parents: []
})
}, (0,external_React_namespaceObject.createElement)(parent_control, {
parents: parents,
postType: postType,
onChange: setQuery
}))));
}
;// 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) {
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 "Force page reload" 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-clientNavigation 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 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Query block: Force page reload enabled'),
className: "wp-block-query__enhanced-pagination-modal",
aria: {
describedby: modalDescriptionId
},
role: "alertdialog",
focusOnMount: "firstElement",
isDismissible: false,
onRequestClose: closeModal
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
alignment: "right",
spacing: 5
}, (0,external_React_namespaceObject.createElement)("span", {
id: modalDescriptionId
}, notice), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: closeModal
}, (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
}) {
const {
queryId,
query,
displayLayout,
tagName: TagName = 'div',
query: {
inherit
} = {}
} = attributes;
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 {
postsPerPage
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
getEntityRecord,
canUser
} = select(external_wp_coreData_namespaceObject.store);
const settingPerPage = canUser('read', 'settings') ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
return {
postsPerPage: 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.
(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;
}
if (!!Object.keys(newQuery).length) {
__unstableMarkNextChangeAsNotPersistent();
updateQuery(newQuery);
}
}, [query.perPage, postsPerPage, inherit]);
// 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]);
const updateQuery = newQuery => setAttributes({
query: {
...query,
...newQuery
}
});
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