Editor: Update packages for 6.1 Beta 2.

Package updates for bug and regression fixes:

* @wordpress/block-directory: 3.15.3
* @wordpress/block-editor: 10.0.3
* @wordpress/block-library: 7.14.3
* @wordpress/block-serialization-default-parser: 4.17.1
* @wordpress/blocks: 11.16.3
* @wordpress/components: 21.0.3
* @wordpress/compose: 5.15.2
* @wordpress/core-data: 5.0.3
* @wordpress/customize-widgets: 3.14.3
* @wordpress/edit-post: 6.14.3
* @wordpress/edit-site: 4.14.4
* @wordpress/edit-widgets: 4.14.3
* @wordpress/editor: 12.16.3
* @wordpress/format-library: 3.15.3
* @wordpress/interface: 4.16.3
* @wordpress/list-reusable-blocks: 3.15.3
* @wordpress/nux: 5.15.3
* @wordpress/preferences: 2.9.3
* @wordpress/reusable-blocks: 3.15.3
* @wordpress/server-side-render: 3.15.3
* @wordpress/style-engine: 1.0.2
* @wordpress/widgets: 2.15.3

References:
* [https://github.com/WordPress/gutenberg/pull/44233 Gutenberg PR 44233] – Blocks: Fix searching of blocks when description is non-string
* [https://github.com/WordPress/gutenberg/pull/44301 Gutenberg PR 44301] – Block Toolbar: update position when moving blocks
* [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR 44334] – Global Styles: Re-add styles that were removed, for classic themes
* [https://github.com/WordPress/gutenberg/pull/44351 Gutenberg PR 44351] – Comments block: Support nested comments settings in the comments blocks
* [https://github.com/WordPress/gutenberg/pull/44448 Gutenberg PR 44448] – Add a correct TS signature for useEntityRecords
* [https://github.com/WordPress/gutenberg/pull/44315 Gutenberg PR 44315] – Pullquote: fix transform to quote crash
* [https://github.com/WordPress/gutenberg/pull/44446 Gutenberg PR 44446] – Fix spacing property generation in flow layout type.
* [https://github.com/WordPress/gutenberg/pull/44408 Gutenberg PR 44408] – Upgrade react-easy-crop to bring in fix for site editor iframe
* [https://github.com/WordPress/gutenberg/pull/44406 Gutenberg PR 44406] – Style engine: kebab case preset slugs in the editor
* [https://github.com/WordPress/gutenberg/pull/44209 Gutenberg PR 44209] – Fixing padding on the post editor when RootPaddingAwareAlignments setting is enabled
* [https://github.com/WordPress/gutenberg/pull/42950 Gutenberg PR 42950] – Popover: fix limitShift logic by adding iframe offset correctly (and a custom shift limiter)
* [https://github.com/WordPress/gutenberg/pull/44337 Gutenberg PR 44337] – Submenu block href only if url is not empty
* [https://github.com/WordPress/gutenberg/pull/44291 Gutenberg PR 44291] – Add role=application to list view to prevent browse mode triggering in NVDA
* [https://github.com/WordPress/gutenberg/pull/44283 Gutenberg PR 44283] – Navigation block: Fix submenu colors for imported classic menus
* [https://github.com/WordPress/gutenberg/pull/44282 Gutenberg PR 44282] – Fix popover stacking in the customize widgets editor
* [https://github.com/WordPress/gutenberg/pull/44247 Gutenberg PR 44247] – Spacing presets: switch to using numbers instead of t-shirt sizes for labels
* [https://github.com/WordPress/gutenberg/pull/44299 Gutenberg PR 44299] – Backport template creation changes from core
* [https://github.com/WordPress/gutenberg/pull/44294 Gutenberg PR 44294] – [Block Library - Query Loop]: Fix broken preview in specific category template
* [https://github.com/WordPress/gutenberg/pull/44287 Gutenberg PR 44287] – [Block Library]: Rename Comments pagination inner blocks
* [https://github.com/WordPress/gutenberg/pull/44256 Gutenberg PR 44256] – Avoid showing the recursion warning in previews when replacing template parts
* [https://github.com/WordPress/gutenberg/pull/44265 Gutenberg PR 44265] – Blocks: officially deprecated the children and node matchers
* [https://github.com/WordPress/gutenberg/pull/44251 Gutenberg PR 44251] – Global styles: Remove the beta label from global styles header

Props bernhard-reiter, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54335


git-svn-id: http://core.svn.wordpress.org/trunk@53894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2022-09-27 17:32:52 +00:00
parent fe346c1464
commit cce69f5098
35 changed files with 842 additions and 279 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,8 @@
*/
function block_core_comment_template_render_comments( $comments, $block ) {
global $comment_depth;
$thread_comments = get_option( 'thread_comments' );
$thread_comments_depth = get_option( 'thread_comments_depth' );
if ( empty( $comment_depth ) ) {
$comment_depth = 1;
@ -46,14 +48,22 @@ function block_core_comment_template_render_comments( $comments, $block ) {
// If the comment has children, recurse to create the HTML for the nested
// comments.
if ( ! empty( $children ) ) {
$comment_depth += 1;
$inner_content = block_core_comment_template_render_comments(
$children,
$block
);
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
$comment_depth -= 1;
if ( ! empty( $children ) && ! empty( $thread_comments ) ) {
if ( $comment_depth < $thread_comments_depth ) {
$comment_depth += 1;
$inner_content = block_core_comment_template_render_comments(
$children,
$block
);
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
$comment_depth -= 1;
} else {
$inner_content = block_core_comment_template_render_comments(
$children,
$block
);
$block_content .= sprintf( $inner_content );
}
}
$content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );

View File

@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comments-pagination-next",
"title": "Next Page",
"title": "Comments Next Page",
"category": "theme",
"parent": [ "core/comments-pagination" ],
"description": "Displays the next comment's page link.",

View File

@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comments-pagination-numbers",
"title": "Page Numbers",
"title": "Comments Page Numbers",
"category": "theme",
"parent": [ "core/comments-pagination" ],
"description": "Displays a list of page numbers for comments pagination.",

View File

@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comments-pagination-previous",
"title": "Previous Page",
"title": "Comments Previous Page",
"category": "theme",
"parent": [ "core/comments-pagination" ],
"description": "Displays the previous comment's page link.",

View File

@ -183,7 +183,16 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
if ( ! $open_on_click ) {
$item_url = isset( $attributes['url'] ) ? $attributes['url'] : '';
// Start appending HTML attributes to anchor tag.
$html .= '<a class="wp-block-navigation-item__content" href="' . esc_url( $item_url ) . '"';
$html .= '<a class="wp-block-navigation-item__content"';
// The href attribute on a and area elements is not required;
// when those elements do not have href attributes they do not create hyperlinks.
// But also The href attribute must have a value that is a valid URL potentially
// surrounded by spaces.
// see: https://html.spec.whatwg.org/multipage/links.html#links-created-by-a-and-area-elements.
if ( ! empty( $item_url ) ) {
$html .= ' href="' . esc_url( $item_url ) . '"';
}
if ( $is_active ) {
$html .= ' aria-current="page"';

View File

@ -0,0 +1,85 @@
/**
* Colors
*/
/**
* Breakpoints & Media Queries
*/
/**
* SCSS Variables.
*
* Please use variables from this sheet to ensure consistency across the UI.
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
*/
/**
* Colors
*/
/**
* Fonts & basic variables.
*/
/**
* Grid System.
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
*/
/**
* Dimensions.
*/
/**
* Shadows.
*/
/**
* Editor widths.
*/
/**
* Block & Editor UI.
*/
/**
* Block paddings.
*/
/**
* React Native specific.
* These variables do not appear to be used anywhere else.
*/
/**
* Converts a hex value into the rgb equivalent.
*
* @param {string} hex - the hexadecimal value to convert
* @return {string} comma separated rgb values
*/
/**
* Breakpoint mixins
*/
/**
* Long content fade mixin
*
* Creates a fading overlay to signify that the content is longer
* than the space allows.
*/
/**
* Focus styles.
*/
/**
* Applies editor left position to the selector passed as argument
*/
/**
* Styles that are reused verbatim in a few places
*/
/**
* Allows users to opt-out of animations via OS-level preferences.
*/
/**
* Reset default styles for JavaScript UI based pages.
* This is a WP-admin agnostic reset
*/
/**
* Reset the WP Admin page styles for Gutenberg-like pages.
*/
.wp-block-button__link {
color: #fff;
background-color: #32373c;
border-radius: 9999px;
box-shadow: none;
text-decoration: none;
padding: calc(0.667em + 2px) calc(1.333em + 2px);
font-size: 1.125em;
}

View File

@ -0,0 +1 @@
.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}

View File

@ -0,0 +1,85 @@
/**
* Colors
*/
/**
* Breakpoints & Media Queries
*/
/**
* SCSS Variables.
*
* Please use variables from this sheet to ensure consistency across the UI.
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
*/
/**
* Colors
*/
/**
* Fonts & basic variables.
*/
/**
* Grid System.
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
*/
/**
* Dimensions.
*/
/**
* Shadows.
*/
/**
* Editor widths.
*/
/**
* Block & Editor UI.
*/
/**
* Block paddings.
*/
/**
* React Native specific.
* These variables do not appear to be used anywhere else.
*/
/**
* Converts a hex value into the rgb equivalent.
*
* @param {string} hex - the hexadecimal value to convert
* @return {string} comma separated rgb values
*/
/**
* Breakpoint mixins
*/
/**
* Long content fade mixin
*
* Creates a fading overlay to signify that the content is longer
* than the space allows.
*/
/**
* Focus styles.
*/
/**
* Applies editor left position to the selector passed as argument
*/
/**
* Styles that are reused verbatim in a few places
*/
/**
* Allows users to opt-out of animations via OS-level preferences.
*/
/**
* Reset default styles for JavaScript UI based pages.
* This is a WP-admin agnostic reset
*/
/**
* Reset the WP Admin page styles for Gutenberg-like pages.
*/
.wp-block-button__link {
color: #fff;
background-color: #32373c;
border-radius: 9999px;
box-shadow: none;
text-decoration: none;
padding: calc(0.667em + 2px) calc(1.333em + 2px);
font-size: 1.125em;
}

View File

@ -0,0 +1 @@
.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}

View File

@ -243,7 +243,8 @@
z-index: 7;
}
.customize-widgets-popover .components-popover {
.customize-widgets-popover .components-popover,
.customize-control-sidebar_block_editor .components-popover {
position: fixed !important;
}

File diff suppressed because one or more lines are too long

View File

@ -243,7 +243,8 @@
z-index: 7;
}
.customize-widgets-popover .components-popover {
.customize-widgets-popover .components-popover,
.customize-control-sidebar_block_editor .components-popover {
position: fixed !important;
}

File diff suppressed because one or more lines are too long

View File

@ -1694,8 +1694,7 @@ body.is-fullscreen-mode .edit-site-list-header {
padding: 16px;
}
.edit-site-navigation-sidebar__beta,
.edit-site-global-styles-sidebar__beta {
.edit-site-navigation-sidebar__beta {
display: inline-flex;
margin-right: 8px;
padding: 0 8px;

File diff suppressed because one or more lines are too long

View File

@ -1694,8 +1694,7 @@ body.is-fullscreen-mode .edit-site-list-header {
padding: 16px;
}
.edit-site-navigation-sidebar__beta,
.edit-site-global-styles-sidebar__beta {
.edit-site-navigation-sidebar__beta {
display: inline-flex;
margin-left: 8px;
padding: 0 8px;

File diff suppressed because one or more lines are too long

View File

@ -11853,6 +11853,7 @@ function usePopoverScroll(scrollableRef) {
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
function BlockPopover(_ref, ref) {
let {
@ -11879,8 +11880,33 @@ function BlockPopover(_ref, ref) {
height: selectedElement.offsetHeight
};
}, [selectedElement, lastSelectedElement, __unstableRefreshSize]);
const [popoverAnchorRecomputeCounter, forceRecomputePopoverAnchor] = (0,external_wp_element_namespaceObject.useReducer)( // Module is there to make sure that the counter doesn't overflow.
s => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 0); // When blocks are moved up/down, they are animated to their new position by
// updating the `transform` property manually (i.e. without using CSS
// transitions or animations). The animation, which can also scroll the block
// editor, can sometimes cause the position of the Popover to get out of sync.
// A MutationObserver is therefore used to make sure that changes to the
// selectedElement's attribute (i.e. `transform`) can be tracked and used to
// trigger the Popover to rerender.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!selectedElement) {
return;
}
const observer = new window.MutationObserver(forceRecomputePopoverAnchor);
observer.observe(selectedElement, {
attributes: true
});
return () => {
observer.disconnect();
};
}, [selectedElement]);
const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!selectedElement || bottomClientId && !lastSelectedElement) {
if ( // popoverAnchorRecomputeCounter is by definition always equal or greater
// than 0. This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverAnchorRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement) {
return undefined;
}
@ -11905,7 +11931,7 @@ function BlockPopover(_ref, ref) {
ownerDocument: selectedElement.ownerDocument
};
}, [bottomClientId, lastSelectedElement, selectedElement]);
}, [bottomClientId, lastSelectedElement, selectedElement, popoverAnchorRecomputeCounter]);
if (!selectedElement || bottomClientId && !lastSelectedElement) {
return null;
@ -27836,6 +27862,7 @@ function BlockListAppender(_ref) {
const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)();
function BlockPopoverInbetween(_ref) {
@ -27848,7 +27875,8 @@ function BlockPopoverInbetween(_ref) {
...props
} = _ref;
// This is a temporary hack to get the inbetween inserter to recompute properly.
const [positionRecompute, forceRecompute] = (0,external_wp_element_namespaceObject.useReducer)(s => s + 1, 0);
const [popoverRecomputeCounter, forcePopoverRecompute] = (0,external_wp_element_namespaceObject.useReducer)( // Module is there to make sure that the counter doesn't overflow.
s => (s + 1) % inbetween_MAX_POPOVER_RECOMPUTE_COUNTER, 0);
const {
orientation,
rootClientId,
@ -27874,7 +27902,10 @@ function BlockPopoverInbetween(_ref) {
const nextElement = useBlockElement(nextClientId);
const isVertical = orientation === 'vertical';
const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!previousElement && !nextElement || !isVisible) {
if ( // popoverRecomputeCounter is by definition always equal or greater than 0.
// This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible) {
return {};
}
@ -27898,9 +27929,12 @@ function BlockPopoverInbetween(_ref) {
width,
height: previousRect ? previousRect.height : nextRect.height
};
}, [previousElement, nextElement, isVertical, positionRecompute, isVisible]);
}, [previousElement, nextElement, isVertical, popoverRecomputeCounter, isVisible]);
const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!previousElement && !nextElement || !isVisible) {
if ( // popoverRecomputeCounter is by definition always equal or greater than 0.
// This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible) {
return undefined;
}
@ -27943,15 +27977,22 @@ function BlockPopoverInbetween(_ref) {
}
};
}, [previousElement, nextElement, positionRecompute, isVertical, isVisible]);
}, [previousElement, nextElement, popoverRecomputeCounter, isVertical, isVisible]);
const popoverScrollRef = use_popover_scroll(__unstableContentRef); // This is only needed for a smooth transition when moving blocks.
// When blocks are moved up/down, their position can be set by
// updating the `transform` property manually (i.e. without using CSS
// transitions or animations). The animation, which can also scroll the block
// editor, can sometimes cause the position of the Popover to get out of sync.
// A MutationObserver is therefore used to make sure that changes to the
// selectedElement's attribute (i.e. `transform`) can be tracked and used to
// trigger the Popover to rerender.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!previousElement) {
return;
}
const observer = new window.MutationObserver(forceRecompute);
const observer = new window.MutationObserver(forcePopoverRecompute);
observer.observe(previousElement, {
attributes: true
});
@ -27964,7 +28005,7 @@ function BlockPopoverInbetween(_ref) {
return;
}
const observer = new window.MutationObserver(forceRecompute);
const observer = new window.MutationObserver(forcePopoverRecompute);
observer.observe(nextElement, {
attributes: true
});
@ -27977,9 +28018,9 @@ function BlockPopoverInbetween(_ref) {
return;
}
previousElement.ownerDocument.defaultView.addEventListener('resize', forceRecompute);
previousElement.ownerDocument.defaultView.addEventListener('resize', forcePopoverRecompute);
return () => {
previousElement.ownerDocument.defaultView.removeEventListener('resize', forceRecompute);
previousElement.ownerDocument.defaultView.removeEventListener('resize', forcePopoverRecompute);
};
}, [previousElement]); // If there's either a previous or a next element, show the inbetween popover.
// Note that drag and drop uses the inbetween popover to show the drop indicator
@ -42701,7 +42742,8 @@ function ListView(_ref, ref) {
ref: treeGridRef,
onCollapseRow: collapseRow,
onExpandRow: expandRow,
onFocusRow: focusRow
onFocusRow: focusRow,
applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)('Block navigation structure')
}, (0,external_wp_element_namespaceObject.createElement)(ListViewContext.Provider, {
value: contextValue
}, (0,external_wp_element_namespaceObject.createElement)(branch, {
@ -44065,7 +44107,7 @@ function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, a
rotation = 0;
}
var _a = translateSize(mediaWidth, mediaHeight, rotation),
var _a = rotateSize(mediaWidth, mediaHeight, rotation),
width = _a.width,
height = _a.height;
@ -44084,6 +44126,15 @@ function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, a
height: fittingWidth / aspect
};
}
/**
* Compute media zoom.
* We fit the media into the container with "max-width: 100%; max-height: 100%;"
*/
function getMediaZoom(mediaSize) {
// Take the axis with more pixels to improve accuracy
return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight;
}
/**
* Ensure a new media position stays in the crop area.
*/
@ -44093,7 +44144,7 @@ function restrictPosition(position, mediaSize, cropSize, zoom, rotation) {
rotation = 0;
}
var _a = translateSize(mediaSize.width, mediaSize.height, rotation),
var _a = rotateSize(mediaSize.width, mediaSize.height, rotation),
width = _a.width,
height = _a.height;
@ -44105,7 +44156,7 @@ function restrictPosition(position, mediaSize, cropSize, zoom, rotation) {
function restrictPositionCoord(position, mediaSize, cropSize, zoom) {
var maxPosition = mediaSize * zoom / 2 - cropSize / 2;
return Math.min(maxPosition, Math.max(position, -maxPosition));
return clamp(position, -maxPosition, maxPosition);
}
function getDistanceBetweenPoints(pointA, pointB) {
@ -44130,18 +44181,22 @@ function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, r
// as it might need to be negative.
var limitAreaFn = restrictPosition && rotation === 0 ? limitArea : noOp;
var limitAreaFn = restrictPosition ? limitArea : noOp;
var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); // calculate the crop area in percentages
// in the rotated space
var croppedAreaPercentages = {
x: limitAreaFn(100, ((mediaSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaSize.width * 100),
y: limitAreaFn(100, ((mediaSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaSize.height * 100),
width: limitAreaFn(100, cropSize.width / mediaSize.width * 100 / zoom),
height: limitAreaFn(100, cropSize.height / mediaSize.height * 100 / zoom)
x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100),
y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100),
width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom),
height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom)
}; // we compute the pixels size naively
var widthInPixels = Math.round(limitAreaFn(mediaSize.naturalWidth, croppedAreaPercentages.width * mediaSize.naturalWidth / 100));
var heightInPixels = Math.round(limitAreaFn(mediaSize.naturalHeight, croppedAreaPercentages.height * mediaSize.naturalHeight / 100));
var isImgWiderThanHigh = mediaSize.naturalWidth >= mediaSize.naturalHeight * aspect; // then we ensure the width and height exactly match the aspect (to avoid rounding approximations)
// if the media is wider than high, when zoom is 0, the crop height will be equals to iamge height
var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100));
var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100));
var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * aspect; // then we ensure the width and height exactly match the aspect (to avoid rounding approximations)
// if the media is wider than high, when zoom is 0, the crop height will be equals to image height
// thus we want to compute the width from the height and aspect for accuracy.
// Otherwise, we compute the height from width and aspect.
@ -44154,8 +44209,8 @@ function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, r
};
var croppedAreaPixels = __assign(__assign({}, sizePixels), {
x: Math.round(limitAreaFn(mediaSize.naturalWidth - sizePixels.width, croppedAreaPercentages.x * mediaSize.naturalWidth / 100)),
y: Math.round(limitAreaFn(mediaSize.naturalHeight - sizePixels.height, croppedAreaPercentages.y * mediaSize.naturalHeight / 100))
x: Math.round(limitAreaFn(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)),
y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 100))
});
return {
@ -44175,34 +44230,47 @@ function noOp(_max, value) {
return value;
}
/**
* Compute the crop and zoom from the croppedAreaPixels
* Compute crop and zoom from the croppedAreaPercentages.
*/
function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) {
var mediaZoom = mediaSize.width / mediaSize.naturalWidth;
function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) {
var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); // This is the inverse process of computeCroppedArea
if (cropSize) {
var isHeightMaxSize_1 = cropSize.height > cropSize.width;
return isHeightMaxSize_1 ? cropSize.height / mediaZoom / croppedAreaPixels.height : cropSize.width / mediaZoom / croppedAreaPixels.width;
}
var aspect = croppedAreaPixels.width / croppedAreaPixels.height;
var isHeightMaxSize = mediaSize.naturalWidth >= mediaSize.naturalHeight * aspect;
return isHeightMaxSize ? mediaSize.naturalHeight / croppedAreaPixels.height : mediaSize.naturalWidth / croppedAreaPixels.width;
var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom);
var crop = {
x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100),
y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100)
};
return {
crop: crop,
zoom: zoom
};
}
/**
* Compute the crop and zoom from the croppedAreaPixels
* Compute zoom from the croppedAreaPixels
*/
function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) {
var mediaZoom = getMediaZoom(mediaSize);
return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom);
}
/**
* Compute crop and zoom from the croppedAreaPixels
*/
function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) {
var mediaZoom = mediaSize.width / mediaSize.naturalWidth;
var zoom = getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize);
var cropZoom = mediaZoom * zoom;
function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) {
if (rotation === void 0) {
rotation = 0;
}
var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom);
var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width;
var crop = {
x: ((mediaSize.naturalWidth - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom,
y: ((mediaSize.naturalHeight - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom
x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom,
y: ((mediaNaturalBBoxSize.height - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom
};
return {
crop: crop,
@ -44219,47 +44287,27 @@ function getCenter(a, b) {
y: (b.y + a.y) / 2
};
}
/**
*
* Returns an x,y point once rotated around xMid,yMid
*/
function rotateAroundMidPoint(x, y, xMid, yMid, degrees) {
var cos = Math.cos;
var sin = Math.sin;
var radian = degrees * Math.PI / 180; // Convert to radians
// Subtract midpoints, so that midpoint is translated to origin
// and add it in the end again
var xr = (x - xMid) * cos(radian) - (y - yMid) * sin(radian) + xMid;
var yr = (x - xMid) * sin(radian) + (y - yMid) * cos(radian) + yMid;
return [xr, yr];
function getRadianAngle(degreeValue) {
return degreeValue * Math.PI / 180;
}
/**
* Returns the new bounding area of a rotated rectangle.
*/
function translateSize(width, height, rotation) {
var centerX = width / 2;
var centerY = height / 2;
var outerBounds = [rotateAroundMidPoint(0, 0, centerX, centerY, rotation), rotateAroundMidPoint(width, 0, centerX, centerY, rotation), rotateAroundMidPoint(width, height, centerX, centerY, rotation), rotateAroundMidPoint(0, height, centerX, centerY, rotation)];
var minX = Math.min.apply(Math, outerBounds.map(function (p) {
return p[0];
}));
var maxX = Math.max.apply(Math, outerBounds.map(function (p) {
return p[0];
}));
var minY = Math.min.apply(Math, outerBounds.map(function (p) {
return p[1];
}));
var maxY = Math.max.apply(Math, outerBounds.map(function (p) {
return p[1];
}));
function rotateSize(width, height, rotation) {
var rotRad = getRadianAngle(rotation);
return {
width: maxX - minX,
height: maxY - minY
width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height),
height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height)
};
}
/**
* Clamp value between min and max
*/
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
/**
* Combine multiple class names into a single string.
*/
@ -44293,8 +44341,8 @@ function (_super) {
function Cropper() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.imageRef = null;
_this.videoRef = null;
_this.imageRef = /*#__PURE__*/external_React_default().createRef();
_this.videoRef = /*#__PURE__*/external_React_default().createRef();
_this.containerRef = null;
_this.styleRef = null;
_this.containerRect = null;
@ -44317,6 +44365,8 @@ function (_super) {
_this.rafDragTimeout = null;
_this.rafPinchTimeout = null;
_this.wheelTimer = null;
_this.currentDoc = document;
_this.currentWindow = window;
_this.state = {
cropSize: null,
hasWheelJustStarted: false
@ -44327,10 +44377,13 @@ function (_super) {
};
_this.cleanEvents = function () {
document.removeEventListener('mousemove', _this.onMouseMove);
document.removeEventListener('mouseup', _this.onDragStopped);
document.removeEventListener('touchmove', _this.onTouchMove);
document.removeEventListener('touchend', _this.onDragStopped);
_this.currentDoc.removeEventListener('mousemove', _this.onMouseMove);
_this.currentDoc.removeEventListener('mouseup', _this.onDragStopped);
_this.currentDoc.removeEventListener('touchmove', _this.onTouchMove);
_this.currentDoc.removeEventListener('touchend', _this.onDragStopped);
};
_this.clearScrollEvent = function () {
@ -44342,49 +44395,113 @@ function (_super) {
};
_this.onMediaLoad = function () {
_this.computeSizes();
var cropSize = _this.computeSizes();
_this.emitCropData();
if (cropSize) {
_this.emitCropData();
_this.setInitialCrop();
_this.setInitialCrop(cropSize);
}
if (_this.props.onMediaLoaded) {
_this.props.onMediaLoaded(_this.mediaSize);
}
};
_this.setInitialCrop = function () {
var _a = _this.props,
initialCroppedAreaPixels = _a.initialCroppedAreaPixels,
cropSize = _a.cropSize;
_this.setInitialCrop = function (cropSize) {
if (_this.props.initialCroppedAreaPercentages) {
var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom),
crop = _a.crop,
zoom = _a.zoom;
if (!initialCroppedAreaPixels) {
return;
_this.props.onCropChange(crop);
_this.props.onZoomChange && _this.props.onZoomChange(zoom);
} else if (_this.props.initialCroppedAreaPixels) {
var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom),
crop = _b.crop,
zoom = _b.zoom;
_this.props.onCropChange(crop);
_this.props.onZoomChange && _this.props.onZoomChange(zoom);
}
var _b = getInitialCropFromCroppedAreaPixels(initialCroppedAreaPixels, _this.mediaSize, cropSize),
crop = _b.crop,
zoom = _b.zoom;
_this.props.onCropChange(crop);
_this.props.onZoomChange && _this.props.onZoomChange(zoom);
};
_this.computeSizes = function () {
var _a, _b, _c, _d, _e, _f;
var mediaRef = _this.imageRef || _this.videoRef;
var mediaRef = _this.imageRef.current || _this.videoRef.current;
if (mediaRef && _this.containerRef) {
_this.containerRect = _this.containerRef.getBoundingClientRect();
_this.mediaSize = {
width: mediaRef.offsetWidth,
height: mediaRef.offsetHeight,
naturalWidth: ((_a = _this.imageRef) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0,
naturalHeight: ((_c = _this.imageRef) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0
};
var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(mediaRef.offsetWidth, mediaRef.offsetHeight, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation);
var containerAspect = _this.containerRect.width / _this.containerRect.height;
var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0;
var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0;
var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight;
var mediaAspect = naturalWidth / naturalHeight; // We do not rely on the offsetWidth/offsetHeight if the media is scaled down
// as the values they report are rounded. That will result in precision losses
// when calculating zoom. We use the fact that the media is positionned relative
// to the container. That allows us to use the container's dimensions
// and natural aspect ratio of the media to calculate accurate media size.
// However, for this to work, the container should not be rotated
var renderedMediaSize = void 0;
if (isMediaScaledDown) {
switch (_this.props.objectFit) {
default:
case 'contain':
renderedMediaSize = containerAspect > mediaAspect ? {
width: _this.containerRect.height * mediaAspect,
height: _this.containerRect.height
} : {
width: _this.containerRect.width,
height: _this.containerRect.width / mediaAspect
};
break;
case 'horizontal-cover':
renderedMediaSize = {
width: _this.containerRect.width,
height: _this.containerRect.width / mediaAspect
};
break;
case 'vertical-cover':
renderedMediaSize = {
width: _this.containerRect.height * mediaAspect,
height: _this.containerRect.height
};
break;
case 'auto-cover':
renderedMediaSize = naturalWidth > naturalHeight ? {
width: _this.containerRect.width,
height: _this.containerRect.width / mediaAspect
} : {
width: _this.containerRect.height * mediaAspect,
height: _this.containerRect.height
};
break;
}
} else {
renderedMediaSize = {
width: mediaRef.offsetWidth,
height: mediaRef.offsetHeight
};
}
_this.mediaSize = __assign(__assign({}, renderedMediaSize), {
naturalWidth: naturalWidth,
naturalHeight: naturalHeight
}); // set media size in the parent
if (_this.props.setMediaSize) {
_this.props.setMediaSize(_this.mediaSize);
}
var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(_this.mediaSize.width, _this.mediaSize.height, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation);
if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) {
_this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize);
@ -44392,14 +44509,23 @@ function (_super) {
_this.setState({
cropSize: cropSize
}, _this.recomputeCropPosition);
}, _this.recomputeCropPosition); // pass crop size to parent
if (_this.props.setCropSize) {
_this.props.setCropSize(cropSize);
}
return cropSize;
}
};
_this.onMouseDown = function (e) {
e.preventDefault();
document.addEventListener('mousemove', _this.onMouseMove);
document.addEventListener('mouseup', _this.onDragStopped);
_this.currentDoc.addEventListener('mousemove', _this.onMouseMove);
_this.currentDoc.addEventListener('mouseup', _this.onDragStopped);
_this.onDragStart(Cropper.getMousePoint(e));
};
@ -44409,11 +44535,16 @@ function (_super) {
};
_this.onTouchStart = function (e) {
document.addEventListener('touchmove', _this.onTouchMove, {
if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) {
return;
}
_this.currentDoc.addEventListener('touchmove', _this.onTouchMove, {
passive: false
}); // iOS 11 now defaults to passive: true
document.addEventListener('touchend', _this.onDragStopped);
_this.currentDoc.addEventListener('touchend', _this.onDragStopped);
if (e.touches.length === 2) {
_this.onPinchStart(e);
@ -44449,8 +44580,8 @@ function (_super) {
_this.onDrag = function (_a) {
var x = _a.x,
y = _a.y;
if (_this.rafDragTimeout) window.cancelAnimationFrame(_this.rafDragTimeout);
_this.rafDragTimeout = window.requestAnimationFrame(function () {
if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout);
_this.rafDragTimeout = _this.currentWindow.requestAnimationFrame(function () {
if (!_this.state.cropSize) return;
if (x === undefined || y === undefined) return;
var offsetX = x - _this.dragStartPosition.x;
@ -44476,12 +44607,18 @@ function (_super) {
};
_this.onWheel = function (e) {
if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) {
return;
}
e.preventDefault();
var point = Cropper.getMousePoint(e);
var pixelY = normalize_wheel_default()(e).pixelY;
var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200;
_this.setNewZoom(newZoom, point);
_this.setNewZoom(newZoom, point, {
shouldUpdatePosition: true
});
if (!_this.state.hasWheelJustStarted) {
_this.setState({
@ -44497,7 +44634,7 @@ function (_super) {
clearTimeout(_this.wheelTimer);
}
_this.wheelTimer = window.setTimeout(function () {
_this.wheelTimer = _this.currentWindow.setTimeout(function () {
return _this.setState({
hasWheelJustStarted: false
}, function () {
@ -44534,21 +44671,26 @@ function (_super) {
};
};
_this.setNewZoom = function (zoom, point) {
_this.setNewZoom = function (zoom, point, _a) {
var _b = (_a === void 0 ? {} : _a).shouldUpdatePosition,
shouldUpdatePosition = _b === void 0 ? true : _b;
if (!_this.state.cropSize || !_this.props.onZoomChange) return;
var zoomPoint = _this.getPointOnContainer(point);
var zoomTarget = _this.getPointOnMedia(zoomPoint);
var newZoom = Math.min(_this.props.maxZoom, Math.max(zoom, _this.props.minZoom));
var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom);
var requestedPosition = {
x: zoomTarget.x * newZoom - zoomPoint.x,
y: zoomTarget.y * newZoom - zoomPoint.y
};
var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition;
_this.props.onCropChange(newPosition);
if (shouldUpdatePosition) {
var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition;
_this.props.onCropChange(newPosition);
}
_this.props.onZoomChange(newZoom);
};
@ -44556,7 +44698,7 @@ function (_super) {
_this.getCropData = function () {
if (!_this.state.cropSize) {
return null;
} // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ricardo-ch/react-easy-crop/issues/6)
} // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ValentinH/react-easy-crop/issues/6)
var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop;
@ -44604,9 +44746,16 @@ function (_super) {
}
Cropper.prototype.componentDidMount = function () {
window.addEventListener('resize', this.computeSizes);
if (this.containerRef) {
if (this.containerRef.ownerDocument) {
this.currentDoc = this.containerRef.ownerDocument;
}
if (this.currentDoc.defaultView) {
this.currentWindow = this.currentDoc.defaultView;
}
this.currentWindow.addEventListener('resize', this.computeSizes);
this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, {
passive: false
});
@ -44615,22 +44764,36 @@ function (_super) {
}
if (!this.props.disableAutomaticStylesInjection) {
this.styleRef = document.createElement('style');
this.styleRef = this.currentDoc.createElement('style');
this.styleRef.setAttribute('type', 'text/css');
if (this.props.nonce) {
this.styleRef.setAttribute('nonce', this.props.nonce);
}
this.styleRef.innerHTML = css_248z;
document.head.appendChild(this.styleRef);
this.currentDoc.head.appendChild(this.styleRef);
} // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called
if (this.imageRef && this.imageRef.complete) {
if (this.imageRef.current && this.imageRef.current.complete) {
this.onMediaLoad();
} // set image and video refs in the parent if the callbacks exist
if (this.props.setImageRef) {
this.props.setImageRef(this.imageRef);
}
if (this.props.setVideoRef) {
this.props.setVideoRef(this.videoRef);
}
};
Cropper.prototype.componentWillUnmount = function () {
var _a;
window.removeEventListener('resize', this.computeSizes);
this.currentWindow.removeEventListener('resize', this.computeSizes);
if (this.containerRef) {
this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari);
@ -44668,7 +44831,7 @@ function (_super) {
}
if (prevProps.video !== this.props.video) {
(_j = this.videoRef) === null || _j === void 0 ? void 0 : _j.load();
(_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load();
}
};
@ -44699,12 +44862,14 @@ function (_super) {
var pointB = Cropper.getTouchPoint(e.touches[1]);
var center = getCenter(pointA, pointB);
this.onDrag(center);
if (this.rafPinchTimeout) window.cancelAnimationFrame(this.rafPinchTimeout);
this.rafPinchTimeout = window.requestAnimationFrame(function () {
if (this.rafPinchTimeout) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout);
this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function () {
var distance = getDistanceBetweenPoints(pointA, pointB);
var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance);
_this.setNewZoom(newZoom, center);
_this.setNewZoom(newZoom, center, {
shouldUpdatePosition: false
});
_this.lastPinchDistance = distance;
var rotation = getRotationBetweenPoints(pointA, pointB);
@ -44749,12 +44914,10 @@ function (_super) {
className: classNames('reactEasyCrop_Container', containerClassName)
}, image ? /*#__PURE__*/external_React_default().createElement("img", __assign({
alt: "",
className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName)
className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', objectFit === 'auto-cover' && (this.mediaSize.naturalWidth > this.mediaSize.naturalHeight ? 'reactEasyCrop_Cover_Horizontal' : 'reactEasyCrop_Cover_Vertical'), mediaClassName)
}, mediaProps, {
src: image,
ref: function ref(el) {
return _this.imageRef = el;
},
ref: this.imageRef,
style: __assign(__assign({}, mediaStyle), {
transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")"
}),
@ -44763,11 +44926,9 @@ function (_super) {
autoPlay: true,
loop: true,
muted: true,
className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName)
className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', objectFit === 'auto-cover' && (this.mediaSize.naturalWidth > this.mediaSize.naturalHeight ? 'reactEasyCrop_Cover_Horizontal' : 'reactEasyCrop_Cover_Vertical'), mediaClassName)
}, mediaProps, {
ref: function ref(el) {
return _this.videoRef = el;
},
ref: this.videoRef,
onLoadedMetadata: this.onMediaLoad,
style: __assign(__assign({}, mediaStyle), {
transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")"
@ -44825,6 +44986,7 @@ function (_super) {
/* harmony default export */ var index_module = (Cropper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js
const constants_MIN_ZOOM = 100;
const constants_MAX_ZOOM = 300;
@ -49985,6 +50147,12 @@ function RichTextWrapper(_ref, forwardedRef) {
let adjustedOnChange = originalOnChange; // Handle deprecated format.
if (Array.isArray(originalValue)) {
external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', {
since: '6.1',
version: '6.3',
alternative: 'value prop as string',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
adjustedValue = external_wp_blocks_namespaceObject.children.toHTML(originalValue);
adjustedOnChange = newValue => originalOnChange(external_wp_blocks_namespaceObject.children.fromDOM((0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes));
@ -50213,6 +50381,12 @@ ForwardedRichTextContainer.Content = _ref3 => {
// Handle deprecated `children` and `node` sources.
if (Array.isArray(value)) {
external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', {
since: '6.1',
version: '6.3',
alternative: 'value prop as string',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
value = external_wp_blocks_namespaceObject.children.toHTML(value);
}

File diff suppressed because one or more lines are too long

View File

@ -10564,7 +10564,7 @@ const comments_pagination_previous_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 2,
name: "core/comments-pagination-previous",
title: "Previous Page",
title: "Comments Previous Page",
category: "theme",
parent: ["core/comments-pagination"],
description: "Displays the previous comment's page link.",
@ -10910,7 +10910,7 @@ const comments_pagination_next_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 2,
name: "core/comments-pagination-next",
title: "Next Page",
title: "Comments Next Page",
category: "theme",
parent: ["core/comments-pagination"],
description: "Displays the next comment's page link.",
@ -11035,7 +11035,7 @@ const comments_pagination_numbers_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 2,
name: "core/comments-pagination-numbers",
title: "Page Numbers",
title: "Comments Page Numbers",
category: "theme",
parent: ["core/comments-pagination"],
description: "Displays a list of page numbers for comments pagination.",
@ -17230,8 +17230,8 @@ const deprecated_v3 = {
attribute: 'data-link'
},
caption: {
type: 'array',
source: 'children',
type: 'string',
source: 'html',
selector: 'figcaption'
}
}
@ -17340,8 +17340,8 @@ const gallery_deprecated_v2 = {
attribute: 'data-link'
},
caption: {
type: 'array',
source: 'children',
type: 'string',
source: 'html',
selector: 'figcaption'
}
}
@ -29948,10 +29948,12 @@ function menuItemsToBlocks(menuItems) {
* A recursive function that maps menu item nodes to blocks.
*
* @param {WPNavMenuItem[]} menuItems An array of WPNavMenuItem items.
* @param {number} level An integer representing the nesting level.
* @return {Object} Object containing innerBlocks and mapping.
*/
function mapMenuItemsToBlocks(menuItems) {
let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
let mapping = {}; // The menuItem should be in menu_order sort order.
const sortedItems = [...menuItems].sort((a, b) => a.menu_order - b.menu_order);
@ -29970,19 +29972,19 @@ function mapMenuItemsToBlocks(menuItems) {
return block;
}
const attributes = menuItemToBlockAttributes(menuItem); // If there are children recurse to build those nested blocks.
const blockType = (_menuItem$children = menuItem.children) !== null && _menuItem$children !== void 0 && _menuItem$children.length ? 'core/navigation-submenu' : 'core/navigation-link';
const attributes = menuItemToBlockAttributes(menuItem, blockType, level); // If there are children recurse to build those nested blocks.
const {
innerBlocks: nestedBlocks = [],
// alias to avoid shadowing
mapping: nestedMapping = {} // alias to avoid shadowing
} = (_menuItem$children = menuItem.children) !== null && _menuItem$children !== void 0 && _menuItem$children.length ? mapMenuItemsToBlocks(menuItem.children) : {}; // Update parent mapping with nested mapping.
} = (_menuItem$children2 = menuItem.children) !== null && _menuItem$children2 !== void 0 && _menuItem$children2.length ? mapMenuItemsToBlocks(menuItem.children, level + 1) : {}; // Update parent mapping with nested mapping.
mapping = { ...mapping,
...nestedMapping
};
const blockType = (_menuItem$children2 = menuItem.children) !== null && _menuItem$children2 !== void 0 && _menuItem$children2.length ? 'core/navigation-submenu' : 'core/navigation-link'; // Create block with nested "innerBlocks".
}; // Create block with nested "innerBlocks".
const block = (0,external_wp_blocks_namespaceObject.createBlock)(blockType, attributes, nestedBlocks); // Create mapping for menuItem -> block.
@ -30018,12 +30020,14 @@ function mapMenuItemsToBlocks(menuItems) {
/**
* Convert block attributes to menu item.
*
* @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes.
* @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes.
* @param {string} blockType The block type.
* @param {number} level An integer representing the nesting level.
* @return {Object} the block attributes converted from the WPNavMenuItem item.
*/
function menuItemToBlockAttributes(_ref) {
function menuItemToBlockAttributes(_ref, blockType, level) {
var _object;
let {
@ -30077,6 +30081,12 @@ function menuItemToBlockAttributes(_ref) {
}),
...(target === '_blank' && {
opensInNewTab: true
}),
...(blockType === 'core/navigation-submenu' && {
isTopLevelItem: level === 0
}),
...(blockType === 'core/navigation-link' && {
isTopLevelLink: level === 0
})
};
}
@ -38115,21 +38125,6 @@ function PostTemplateEdit(_ref2) {
page
}] = queryContext;
const [activeBlockContextId, setActiveBlockContextId] = (0,external_wp_element_namespaceObject.useState)();
let categorySlug = null;
if (templateSlug !== null && templateSlug !== void 0 && templateSlug.startsWith('category-')) {
categorySlug = templateSlug.replace('category-', '');
}
const {
records: categories,
hasResolved: hasResolvedCategories
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('taxonomy', 'category', {
context: 'view',
per_page: -1,
_fields: ['id'],
slug: categorySlug
});
const {
posts,
blocks
@ -38146,13 +38141,19 @@ function PostTemplateEdit(_ref2) {
per_page: -1,
context: 'view'
});
const templateCategory = inherit && (templateSlug === null || templateSlug === void 0 ? void 0 : templateSlug.startsWith('category-')) && getEntityRecords('taxonomy', 'category', {
context: 'view',
per_page: 1,
_fields: ['id'],
slug: templateSlug.replace('category-', '')
});
const query = {
offset: perPage ? perPage * (page - 1) + offset : 0,
order,
orderby: orderBy
};
}; // There is no need to build the taxQuery if we inherit.
if (taxQuery) {
if (taxQuery && !inherit) {
// 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, _ref3) => {
@ -38209,16 +38210,10 @@ function PostTemplateEdit(_ref2) {
if (templateSlug !== null && templateSlug !== void 0 && templateSlug.startsWith('archive-')) {
query.postType = templateSlug.replace('archive-', '');
postType = query.postType;
} else if (!!categorySlug && hasResolvedCategories) {
query.taxQuery = {
category: categories.map(_ref5 => {
let {
id
} = _ref5;
return id;
})
};
taxQuery = query.taxQuery;
} else if (templateCategory) {
var _templateCategory$;
query.categories = (_templateCategory$ = templateCategory[0]) === null || _templateCategory$ === void 0 ? void 0 : _templateCategory$.id;
}
} // When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
@ -38231,7 +38226,7 @@ function PostTemplateEdit(_ref2) {
}),
blocks: getBlocks(clientId)
};
}, [perPage, page, offset, order, orderBy, clientId, author, search, postType, exclude, sticky, inherit, templateSlug, taxQuery, parents, restQueryArgs, previewPostType, categories, categorySlug, hasResolvedCategories]);
}, [perPage, page, offset, order, orderBy, clientId, author, search, postType, exclude, sticky, inherit, templateSlug, taxQuery, parents, restQueryArgs, previewPostType]);
const blockContexts = (0,external_wp_element_namespaceObject.useMemo)(() => posts === null || posts === void 0 ? void 0 : posts.map(post => ({
postType: post.type,
postId: post.id
@ -43403,9 +43398,9 @@ const quote_transforms_transforms = {
anchor,
fontSize,
style
}, (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: value
}));
})]);
}
}, {
type: 'block',
@ -52208,7 +52203,7 @@ function TemplatePartEdit(_ref) {
return (0,external_wp_element_namespaceObject.createElement)(TagName, blockProps, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalRecursionProvider, {
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalRecursionProvider, {
uniqueId: templatePartId
}, (0,external_wp_element_namespaceObject.createElement)(TemplatePartAdvancedControls, {
tagName: tagName,
@ -52237,7 +52232,7 @@ function TemplatePartEdit(_ref) {
postId: templatePartId,
hasInnerBlocks: innerBlocks.length > 0,
layout: layout
}), !isPlaceholder && !isResolved && (0,external_wp_element_namespaceObject.createElement)(TagName, blockProps, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), isTemplatePartSelectionOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
}), !isPlaceholder && !isResolved && (0,external_wp_element_namespaceObject.createElement)(TagName, blockProps, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))), isTemplatePartSelectionOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
overlayClassName: "block-editor-template-part__selection-modal",
title: (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s as template part area title ("Header", "Footer", etc.).
(0,external_wp_i18n_namespaceObject.__)('Choose a %s'), areaObject.label.toLowerCase()),

File diff suppressed because one or more lines are too long

View File

@ -9448,7 +9448,7 @@ function isMatchingSearchTerm(state, nameOrType, searchTerm) {
term => term.trim()]);
const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
const isSearchMatch = (0,external_lodash_namespaceObject.flow)([getNormalizedSearchTerm, normalizedCandidate => (0,external_lodash_namespaceObject.includes)(normalizedCandidate, normalizedSearchTerm)]);
return isSearchMatch(blockType.title) || (0,external_lodash_namespaceObject.some)(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category) || isSearchMatch(blockType.description);
return isSearchMatch(blockType.title) || (0,external_lodash_namespaceObject.some)(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === 'string' && isSearchMatch(blockType.description);
}
/**
* Returns a boolean indicating if a block has child blocks or not.
@ -12417,10 +12417,15 @@ function matchers_html(selector, multilineTag) {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A representation of a single node within a block's rich text value. If
* representing a text node, the value is simply a string of the node value.
@ -12443,6 +12448,11 @@ function matchers_html(selector, multilineTag) {
*/
function isNodeOfType(node, type) {
external_wp_deprecated_default()('wp.blocks.node.isNodeOfType', {
since: '6.1',
version: '6.3',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return node && node.type === type;
}
/**
@ -12482,6 +12492,13 @@ function getNamedNodeMapAsObject(nodeMap) {
*/
function fromDOM(domNode) {
external_wp_deprecated_default()('wp.blocks.node.fromDOM', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.create',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
if (domNode.nodeType === domNode.TEXT_NODE) {
return domNode.nodeValue;
}
@ -12506,6 +12523,12 @@ function fromDOM(domNode) {
*/
function toHTML(node) {
external_wp_deprecated_default()('wp.blocks.node.toHTML', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.toHTMLString',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return children_toHTML([node]);
}
/**
@ -12518,6 +12541,12 @@ function toHTML(node) {
*/
function node_matcher(selector) {
external_wp_deprecated_default()('wp.blocks.node.matcher', {
since: '6.1',
version: '6.3',
alternative: 'html source',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return domNode => {
let match = domNode;
@ -12561,6 +12590,7 @@ function node_matcher(selector) {
*/
/**
* Internal dependencies
*/
@ -12598,9 +12628,14 @@ function getSerializeCapableElement(children) {
*/
function getChildrenArray(children) {
// The fact that block children are compatible with the element serializer
external_wp_deprecated_default()('wp.blocks.children.getChildrenArray', {
since: '6.1',
version: '6.3',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
}); // The fact that block children are compatible with the element serializer
// is merely an implementation detail that currently serves to be true, but
// should not be mistaken as being a guarantee on the external API.
return children;
}
/**
@ -12614,6 +12649,12 @@ function getChildrenArray(children) {
function concat() {
external_wp_deprecated_default()('wp.blocks.children.concat', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.concat',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
const result = [];
for (let i = 0; i < arguments.length; i++) {
@ -12643,6 +12684,12 @@ function concat() {
*/
function children_fromDOM(domNodes) {
external_wp_deprecated_default()('wp.blocks.children.fromDOM', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.create',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
const result = [];
for (let i = 0; i < domNodes.length; i++) {
@ -12663,6 +12710,12 @@ function children_fromDOM(domNodes) {
*/
function children_toHTML(children) {
external_wp_deprecated_default()('wp.blocks.children.toHTML', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.toHTMLString',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
const element = getSerializeCapableElement(children);
return (0,external_wp_element_namespaceObject.renderToString)(element);
}
@ -12676,6 +12729,12 @@ function children_toHTML(children) {
*/
function children_matcher(selector) {
external_wp_deprecated_default()('wp.blocks.children.matcher', {
since: '6.1',
version: '6.3',
alternative: 'html source',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return domNode => {
let match = domNode;

File diff suppressed because one or more lines are too long

View File

@ -19166,6 +19166,143 @@ const getReferenceElement = _ref2 => {
return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/limit-shift.js
/**
* External dependencies
*/
/**
* Parts of this source were derived and modified from `floating-ui`,
* released under the MIT license.
*
* https://github.com/floating-ui/floating-ui
*
* Copyright (c) 2021 Floating UI contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Custom limiter function for the `shift` middleware.
* This function is mostly identical default `limitShift` from ``@floating-ui`;
* the only difference is that, when computing the min/max shift limits, it
* also takes into account the iframe offset that is added by the
* custom "frameOffset" middleware.
*
* All unexported types and functions are also from the `@floating-ui` library,
* and have been copied to this file for convenience.
*/
function getSide(placement) {
return placement.split('-')[0];
}
function getMainAxisFromPlacement(placement) {
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
}
function getCrossAxis(axis) {
return axis === 'x' ? 'y' : 'x';
}
const limitShift = function () {
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return {
options,
fn(middlewareArguments) {
var _middlewareData$frame;
const {
x,
y,
placement,
rects,
middlewareData
} = middlewareArguments;
const {
offset = 0,
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true
} = options;
const coords = {
x,
y
};
const mainAxis = getMainAxisFromPlacement(placement);
const crossAxis = getCrossAxis(mainAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
const rawOffset = typeof offset === 'function' ? offset(middlewareArguments) : offset;
const computedOffset = typeof rawOffset === 'number' ? {
mainAxis: rawOffset,
crossAxis: 0
} : {
mainAxis: 0,
crossAxis: 0,
...rawOffset
}; // At the moment of writing, this is the only difference
// with the `limitShift` function from `@floating-ui`.
// This offset needs to be added to all min/max limits
// in order to make the shift-limiting work as expected.
const additionalFrameOffset = {
x: 0,
y: 0,
...((_middlewareData$frame = middlewareData.frameOffset) === null || _middlewareData$frame === void 0 ? void 0 : _middlewareData$frame.amount)
};
if (checkMainAxis) {
const len = mainAxis === 'y' ? 'height' : 'width';
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis + additionalFrameOffset[mainAxis];
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis + additionalFrameOffset[mainAxis];
if (mainAxisCoord < limitMin) {
mainAxisCoord = limitMin;
} else if (mainAxisCoord > limitMax) {
mainAxisCoord = limitMax;
}
}
if (checkCrossAxis) {
var _middlewareData$offse, _middlewareData$offse2, _middlewareData$offse3, _middlewareData$offse4;
const len = mainAxis === 'y' ? 'width' : 'height';
const isOriginSide = ['top', 'left'].includes(getSide(placement));
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? (_middlewareData$offse = (_middlewareData$offse2 = middlewareData.offset) === null || _middlewareData$offse2 === void 0 ? void 0 : _middlewareData$offse2[crossAxis]) !== null && _middlewareData$offse !== void 0 ? _middlewareData$offse : 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis) + additionalFrameOffset[crossAxis];
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : (_middlewareData$offse3 = (_middlewareData$offse4 = middlewareData.offset) === null || _middlewareData$offse4 === void 0 ? void 0 : _middlewareData$offse4[crossAxis]) !== null && _middlewareData$offse3 !== void 0 ? _middlewareData$offse3 : 0) - (isOriginSide ? computedOffset.crossAxis : 0) + additionalFrameOffset[crossAxis];
if (crossAxisCoord < limitMin) {
crossAxisCoord = limitMin;
} else if (crossAxisCoord > limitMax) {
crossAxisCoord = limitMax;
}
}
return {
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
};
}
};
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js
@ -19200,6 +19337,7 @@ const getReferenceElement = _ref2 => {
*
* @type {string}
*/
const SLOT_NAME = 'Popover'; // An SVG displaying a triangle facing down, filled with a solid
// color and bordered in such a way to create an arrow-like effect.
// Keeping the SVG's viewbox squared simplify the arrow positioning
@ -19362,36 +19500,35 @@ const UnforwardedPopover = (props, forwardedRef) => {
*/
const frameOffsetRef = (0,external_wp_element_namespaceObject.useRef)(getFrameOffset(referenceOwnerDocument));
/**
* Store the offset prop in a ref, due to constraints with floating-ui:
* https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.
*/
const middleware = [// Custom middleware which adjusts the popover's position by taking into
// account the offset of the anchor's iframe (if any) compared to the page.
{
name: 'frameOffset',
const offsetRef = (0,external_wp_element_namespaceObject.useRef)(offsetProp);
const middleware = [T(_ref2 => {
let {
placement: currentPlacement
} = _ref2;
fn(_ref2) {
let {
x,
y
} = _ref2;
if (!frameOffsetRef.current) {
return offsetRef.current;
if (!frameOffsetRef.current) {
return {
x,
y
};
}
return {
x: x + frameOffsetRef.current.x,
y: y + frameOffsetRef.current.y,
data: {
// This will be used in the customLimitShift() function.
amount: frameOffsetRef.current
}
};
}
const isTopBottomPlacement = currentPlacement.includes('top') || currentPlacement.includes('bottom'); // The main axis should represent the gap between the
// floating element and the reference element. The cross
// axis is always perpendicular to the main axis.
const mainAxis = isTopBottomPlacement ? 'y' : 'x';
const crossAxis = mainAxis === 'x' ? 'y' : 'x'; // When the popover is before the reference, subtract the offset,
// of the main axis else add it.
const hasBeforePlacement = currentPlacement.includes('top') || currentPlacement.includes('left');
const mainAxisModifier = hasBeforePlacement ? -1 : 1;
return {
mainAxis: offsetRef.current + frameOffsetRef.current[mainAxis] * mainAxisModifier,
crossAxis: frameOffsetRef.current[crossAxis]
};
}), computedFlipProp ? b() : undefined, computedResizeProp ? k({
}, T(offsetProp), computedFlipProp ? b() : undefined, computedResizeProp ? k({
apply(sizeProps) {
var _refs$floating$curren;
@ -19409,7 +19546,7 @@ const UnforwardedPopover = (props, forwardedRef) => {
}) : undefined, shouldShift ? L({
crossAxis: true,
limiter: D(),
limiter: limitShift(),
padding: 1 // Necessary to avoid flickering at the edge of the viewport.
}) : undefined, arrow({
@ -19463,10 +19600,6 @@ const UnforwardedPopover = (props, forwardedRef) => {
animationFrame: true
})
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
offsetRef.current = offsetProp;
update();
}, [offsetProp, update]);
const arrowCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => {
arrowRef.current = node;
update();
@ -31881,7 +32014,7 @@ function getVariation(placement) {
return placement.split('-')[1];
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
function getMainAxisFromPlacement(placement) {
function getMainAxisFromPlacement_getMainAxisFromPlacement(placement) {
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/computeOffsets.js
@ -31935,7 +32068,7 @@ function computeOffsets(_ref) {
};
}
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
var mainAxis = basePlacement ? getMainAxisFromPlacement_getMainAxisFromPlacement(basePlacement) : null;
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
@ -32815,7 +32948,7 @@ function preventOverflow(_ref) {
var basePlacement = getBasePlacement(state.placement);
var variation = getVariation(state.placement);
var isBasePlacement = !variation;
var mainAxis = getMainAxisFromPlacement(basePlacement);
var mainAxis = getMainAxisFromPlacement_getMainAxisFromPlacement(basePlacement);
var altAxis = getAltAxis(mainAxis);
var popperOffsets = state.modifiersData.popperOffsets;
var referenceRect = state.rects.reference;
@ -32948,7 +33081,7 @@ function arrow_arrow(_ref) {
var arrowElement = state.elements.arrow;
var popperOffsets = state.modifiersData.popperOffsets;
var basePlacement = getBasePlacement(state.placement);
var axis = getMainAxisFromPlacement(basePlacement);
var axis = getMainAxisFromPlacement_getMainAxisFromPlacement(basePlacement);
var isVertical = [left, right].indexOf(basePlacement) >= 0;
var len = isVertical ? 'height' : 'width';
@ -45914,6 +46047,7 @@ function useCombobox(userProps) {
refKey = 'ref',
ref,
onMouseMove,
onMouseDown,
onClick,
onPress,
disabled,
@ -45950,12 +46084,10 @@ function useCombobox(userProps) {
type: ItemClick,
index
});
if (inputRef.current) {
inputRef.current.focus();
}
};
const itemHandleMouseDown = e => e.preventDefault();
return {
[refKey]: handleRefs(ref, itemNode => {
if (itemNode) {
@ -45970,6 +46102,7 @@ function useCombobox(userProps) {
[onSelectKey]: callAllEventHandlers(customClickHandler, itemHandleClick)
}),
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown),
...rest
};
}, [dispatch, latest, shouldScrollRef, elementIds]);
@ -63362,12 +63495,13 @@ function getRowFocusables(rowElement) {
* Renders both a table and tbody element, used to create a tree hierarchy.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
* @param {Object} props Component props.
* @param {WPElement} props.children Children to be rendered.
* @param {Function} props.onExpandRow Callback to fire when row is expanded.
* @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
* @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
* @param {Object} ref A ref to the underlying DOM table element.
* @param {Object} props Component props.
* @param {WPElement} props.children Children to be rendered.
* @param {Function} props.onExpandRow Callback to fire when row is expanded.
* @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
* @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
* @param {string} props.applicationAriaLabel Label to use for the application role.
* @param {Object} ref A ref to the underlying DOM table element.
*/
@ -63377,6 +63511,7 @@ function TreeGrid(_ref, ref) {
onExpandRow = () => {},
onCollapseRow = () => {},
onFocusRow = () => {},
applicationAriaLabel,
...props
} = _ref;
const onKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => {
@ -63576,11 +63711,14 @@ function TreeGrid(_ref, ref) {
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
return (0,external_wp_element_namespaceObject.createElement)(RovingTabIndex, null, (0,external_wp_element_namespaceObject.createElement)("table", extends_extends({}, props, {
return (0,external_wp_element_namespaceObject.createElement)(RovingTabIndex, null, (0,external_wp_element_namespaceObject.createElement)("div", {
role: "application",
"aria-label": applicationAriaLabel
}, (0,external_wp_element_namespaceObject.createElement)("table", extends_extends({}, props, {
role: "treegrid",
onKeyDown: onKeyDown,
ref: ref
}), (0,external_wp_element_namespaceObject.createElement)("tbody", null, children)));
}), (0,external_wp_element_namespaceObject.createElement)("tbody", null, children))));
/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
}

File diff suppressed because one or more lines are too long

View File

@ -3809,14 +3809,18 @@ function VisualEditor(_ref2) {
const {
themeHasDisabledLayoutStyles,
themeSupportsLayout,
assets
assets,
useRootPaddingAwareAlignments
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _settings$__experimen;
const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
return {
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
themeSupportsLayout: _settings.supportsLayout,
assets: _settings.__unstableResolvedAssets
assets: _settings.__unstableResolvedAssets,
useRootPaddingAwareAlignments: (_settings$__experimen = _settings.__experimentalFeatures) === null || _settings$__experimen === void 0 ? void 0 : _settings$__experimen.useRootPaddingAwareAlignments
};
}, []);
const {
@ -3879,7 +3883,11 @@ function VisualEditor(_ref2) {
type: 'default'
};
}, [isTemplateMode, themeSupportsLayout, defaultLayout]);
const blockListLayoutClass = themeSupportsLayout ? 'is-layout-constrained' : 'is-layout-flow';
const blockListLayoutClass = classnames_default()({
'is-layout-constrained': themeSupportsLayout,
'is-layout-flow': !themeSupportsLayout,
'has-global-padding': useRootPaddingAwareAlignments
});
const titleRef = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
var _titleRef$current;

File diff suppressed because one or more lines are too long

View File

@ -11102,9 +11102,7 @@ function GlobalStylesSidebar() {
icon: library_styles,
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close global styles sidebar'),
panelClassName: "edit-site-global-styles-sidebar__panel",
header: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles')), (0,external_wp_element_namespaceObject.createElement)("span", {
className: "edit-site-global-styles-sidebar__beta"
}, (0,external_wp_i18n_namespaceObject.__)('Beta'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
header: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
icon: more_vertical,
label: (0,external_wp_i18n_namespaceObject.__)('More Global Styles Actions'),
controls: [{
@ -15262,7 +15260,7 @@ function NewTemplate(_ref) {
template_prefix: templatePrefix
})
});
templateContent = fallbackTemplate.content;
templateContent = fallbackTemplate.content.raw;
}
const newTemplate = await saveEntityRecord('postType', 'wp_template', {

File diff suppressed because one or more lines are too long

View File

@ -136,7 +136,7 @@ function generateBoxRules(style, options, path, ruleKeys) {
function getCSSVarFromStyleValue(styleValue) {
if (typeof styleValue === 'string' && styleValue.startsWith(VARIABLE_REFERENCE_PREFIX)) {
const variable = styleValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE);
const variable = styleValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).map(presetVariable => (0,external_lodash_namespaceObject.kebabCase)(presetVariable)).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE);
return `var(--wp--${variable})`;
}

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-beta1-54334';
$wp_version = '6.1-beta1-54335';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.