Editor: Update @wordpress npm packages

Update @wordpress npm packages to the latest published versions. This includes
block editor bug fixes for WordPress 5.7 RC 1.

Fixes #52588.

Built from https://develop.svn.wordpress.org/trunk@50400


git-svn-id: http://core.svn.wordpress.org/trunk@50011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2021-02-22 06:04:39 +00:00
parent 0b9c7b7cdf
commit c55ccb3ef0
10 changed files with 118 additions and 69 deletions

File diff suppressed because one or more lines are too long

View File

@ -17267,7 +17267,7 @@ function actions_duplicateBlocks(clientIds) {
case 16: case 16:
lastSelectedIndex = _context17.sent; lastSelectedIndex = _context17.sent;
clonedBlocks = blocks.map(function (block) { clonedBlocks = blocks.map(function (block) {
return Object(external_wp_blocks_["cloneBlock"])(block); return Object(external_wp_blocks_["__experimentalCloneSanitizedBlock"])(block);
}); });
_context17.next = 20; _context17.next = 20;
return actions_insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection); return actions_insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);

File diff suppressed because one or more lines are too long

View File

@ -5944,6 +5944,7 @@ __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexp
__webpack_require__.d(__webpack_exports__, "createBlock", function() { return /* reexport */ createBlock; }); __webpack_require__.d(__webpack_exports__, "createBlock", function() { return /* reexport */ createBlock; });
__webpack_require__.d(__webpack_exports__, "createBlocksFromInnerBlocksTemplate", function() { return /* reexport */ createBlocksFromInnerBlocksTemplate; }); __webpack_require__.d(__webpack_exports__, "createBlocksFromInnerBlocksTemplate", function() { return /* reexport */ createBlocksFromInnerBlocksTemplate; });
__webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return /* reexport */ cloneBlock; }); __webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return /* reexport */ cloneBlock; });
__webpack_require__.d(__webpack_exports__, "__experimentalCloneSanitizedBlock", function() { return /* reexport */ __experimentalCloneSanitizedBlock; });
__webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return /* reexport */ getPossibleBlockTransformations; }); __webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return /* reexport */ getPossibleBlockTransformations; });
__webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return /* reexport */ switchToBlockType; }); __webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return /* reexport */ switchToBlockType; });
__webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return /* reexport */ getBlockTransforms; }); __webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return /* reexport */ getBlockTransforms; });
@ -7795,8 +7796,32 @@ function createBlocksFromInnerBlocksTemplate() {
}); });
} }
/** /**
* Given a block object, returns a copy of the block object, optionally merging * Given a block object, returns a copy of the block object while sanitizing its attributes,
* new attributes and/or replacing its inner blocks. * optionally merging new attributes and/or replacing its inner blocks.
*
* @param {Object} block Block instance.
* @param {Object} mergeAttributes Block attributes.
* @param {?Array} newInnerBlocks Nested blocks.
*
* @return {Object} A cloned block.
*/
function __experimentalCloneSanitizedBlock(block) {
var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined;
var clientId = Object(v4["a" /* default */])();
var sanitizedAttributes = sanitizeBlockAttributes(block.name, factory_objectSpread(factory_objectSpread({}, block.attributes), mergeAttributes));
return factory_objectSpread(factory_objectSpread({}, block), {}, {
clientId: clientId,
attributes: sanitizedAttributes,
innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) {
return __experimentalCloneSanitizedBlock(innerBlock);
})
});
}
/**
* Given a block object, returns a copy of the block object,
* optionally merging new attributes and/or replacing its inner blocks.
* *
* @param {Object} block Block instance. * @param {Object} block Block instance.
* @param {Object} mergeAttributes Block attributes. * @param {Object} mergeAttributes Block attributes.
@ -7809,10 +7834,9 @@ function cloneBlock(block) {
var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined; var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined;
var clientId = Object(v4["a" /* default */])(); var clientId = Object(v4["a" /* default */])();
var sanitizedAttributes = sanitizeBlockAttributes(block.name, factory_objectSpread(factory_objectSpread({}, block.attributes), mergeAttributes));
return factory_objectSpread(factory_objectSpread({}, block), {}, { return factory_objectSpread(factory_objectSpread({}, block), {}, {
clientId: clientId, clientId: clientId,
attributes: sanitizedAttributes, attributes: factory_objectSpread(factory_objectSpread({}, block.attributes), mergeAttributes),
innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) { innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) {
return cloneBlock(innerBlock); return cloneBlock(innerBlock);
}) })

File diff suppressed because one or more lines are too long

View File

@ -22153,12 +22153,10 @@ function resolveWith(config, resolvers) {
return result; return result;
} }
var WEBKIT_DISTANCE_SCALE_FACTOR = 260;
/** /**
* Whether the browser supports GestureEvent (ie Safari) * Whether the browser supports GestureEvent (ie Safari)
* @returns true if the browser supports gesture event * @returns true if the browser supports gesture event
*/ */
function supportsGestureEvents() { function supportsGestureEvents() {
try { try {
// TODO [TS] possibly find GestureEvent definitions? // TODO [TS] possibly find GestureEvent definitions?
@ -22177,8 +22175,7 @@ function getEventTouches(event) {
return event.type === 'touchend' ? event.changedTouches : event.targetTouches; return event.type === 'touchend' ? event.changedTouches : event.targetTouches;
} }
function getPointerIds(event) { function getTouchIds(event) {
if ('pointerId' in event) return [event.pointerId];
return Array.from(getEventTouches(event)).map(function (t) { return Array.from(getEventTouches(event)).map(function (t) {
return t.identifier; return t.identifier;
}); });
@ -22239,6 +22236,7 @@ function getTwoTouchesEventValues(event, pointerIds, transform) {
A = _Array$from$filter[0], A = _Array$from$filter[0],
B = _Array$from$filter[1]; B = _Array$from$filter[1];
if (!A || !B) throw Error("The event doesn't have two pointers matching the pointerIds");
var dx = B.clientX - A.clientX; var dx = B.clientX - A.clientX;
var dy = B.clientY - A.clientY; var dy = B.clientY - A.clientY;
var cx = (B.clientX + A.clientX) / 2; var cx = (B.clientX + A.clientX) / 2;
@ -22314,7 +22312,7 @@ function getWebkitGestureEventValues(event, transform) {
transform = identity; transform = identity;
} }
return transform([event.scale * WEBKIT_DISTANCE_SCALE_FACTOR, event.rotation]); return transform([event.scale, event.rotation]);
} }
var DEFAULT_DRAG_DELAY = 180; var DEFAULT_DRAG_DELAY = 180;
@ -23111,24 +23109,11 @@ function getStartGestureState(_ref4, values, event) {
}); });
} }
function partial(func, state) {
return function (event) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// @ts-ignore
return func.call.apply(func, [this, _extends({}, state, {
event: event
})].concat(args));
};
}
/** /**
* The controller will keep track of the state for all gestures and also keep * The controller will keep track of the state for all gestures and also keep
* track of timeouts, and window listeners. * track of timeouts, and window listeners.
*/ */
var Controller = function Controller(classes) { var Controller = function Controller(classes) {
var _this = this; var _this = this;
@ -23141,25 +23126,29 @@ var Controller = function Controller(classes) {
this.supportsGestureEvents = supportsGestureEvents(); this.supportsGestureEvents = supportsGestureEvents();
this.bind = function () { this.bind = function () {
var bindings = {}; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
} }
var bindings = {};
for (var _iterator = _createForOfIteratorHelperLoose(_this.classes), _step; !(_step = _iterator()).done;) { for (var _iterator = _createForOfIteratorHelperLoose(_this.classes), _step; !(_step = _iterator()).done;) {
var RecognizerClass = _step.value; var RecognizerClass = _step.value;
new RecognizerClass(_this, args).addBindings(bindings); new RecognizerClass(_this, args).addBindings(bindings);
} // we also add event bindings for native handlers } // // we also add event bindings for native handlers
for (var _i = 0, _Object$entries = Object.entries(_this.nativeRefs); _i < _Object$entries.length; _i++) { var _loop = function _loop(eventKey) {
var _Object$entries$_i = _Object$entries[_i], addBindings(bindings, eventKey, function (event) {
event = _Object$entries$_i[0], return _this.nativeRefs[eventKey](_extends({}, _this.state.shared, {
handler = _Object$entries$_i[1]; event: event,
addBindings(bindings, event, partial(handler, _extends({}, _this.state.shared, {
args: args args: args
}))); }));
});
};
for (var eventKey in _this.nativeRefs) {
_loop(eventKey);
} }
if (_this.config.domTarget) { if (_this.config.domTarget) {
@ -23195,12 +23184,20 @@ var Controller = function Controller(classes) {
this.windowListeners = {}; this.windowListeners = {};
}; };
function addEventIds(controller, event) { function addEventIds(controller, event) {
var idList = 'pointerId' in event ? controller.pointerIds : controller.touchIds; if ('pointerId' in event) {
getPointerIds(event).forEach(idList.add, idList); controller.pointerIds.add(event.pointerId);
} else {
controller.touchIds = new Set(getTouchIds(event));
}
} }
function removeEventIds(controller, event) { function removeEventIds(controller, event) {
var idList = 'pointerId' in event ? controller.pointerIds : controller.touchIds; if ('pointerId' in event) {
getPointerIds(event).forEach(idList["delete"], idList); controller.pointerIds["delete"](event.pointerId);
} else {
getTouchIds(event).forEach(function (id) {
return controller.touchIds["delete"](id);
});
}
} }
function clearAllWindowListeners(controller) { function clearAllWindowListeners(controller) {
var _controller$config = controller.config, var _controller$config = controller.config,
@ -23253,10 +23250,10 @@ function updateDomListeners(_ref3, bindings) {
var eventOptions = config.eventOptions; var eventOptions = config.eventOptions;
removeListeners(domTarget, takeAll(domListeners), eventOptions); removeListeners(domTarget, takeAll(domListeners), eventOptions);
for (var _i2 = 0, _Object$entries2 = Object.entries(bindings); _i2 < _Object$entries2.length; _i2++) { for (var _i = 0, _Object$entries = Object.entries(bindings); _i < _Object$entries.length; _i++) {
var _Object$entries2$_i = _Object$entries2[_i2], var _Object$entries$_i = _Object$entries[_i],
key = _Object$entries2$_i[0], key = _Object$entries$_i[0],
fns = _Object$entries2$_i[1]; fns = _Object$entries$_i[1];
var name = key.slice(2).toLowerCase(); var name = key.slice(2).toLowerCase();
domListeners.push([name, chainFns.apply(void 0, fns)]); domListeners.push([name, chainFns.apply(void 0, fns)]);
} }
@ -23269,10 +23266,10 @@ function getPropsListener(_ref4, bindings) {
var props = {}; var props = {};
var captureString = config.eventOptions.capture ? 'Capture' : ''; var captureString = config.eventOptions.capture ? 'Capture' : '';
for (var _i3 = 0, _Object$entries3 = Object.entries(bindings); _i3 < _Object$entries3.length; _i3++) { for (var _i2 = 0, _Object$entries2 = Object.entries(bindings); _i2 < _Object$entries2.length; _i2++) {
var _Object$entries3$_i = _Object$entries3[_i3], var _Object$entries2$_i = _Object$entries2[_i2],
event = _Object$entries3$_i[0], event = _Object$entries2$_i[0],
fns = _Object$entries3$_i[1]; fns = _Object$entries2$_i[1];
var fnsArray = Array.isArray(fns) ? fns : [fns]; var fnsArray = Array.isArray(fns) ? fns : [fns];
var key = event + captureString; var key = event + captureString;
props[key] = chainFns.apply(void 0, fnsArray); props[key] = chainFns.apply(void 0, fnsArray);
@ -23889,6 +23886,7 @@ function isEqual(a, b) {
return equal(a, b); return equal(a, b);
} catch (error) { } catch (error) {
if ((error.message || '').match(/stack|recursion/i)) { if ((error.message || '').match(/stack|recursion/i)) {
// eslint-disable-next-line no-console
console.warn('react-fast-compare cannot handle circular refs'); console.warn('react-fast-compare cannot handle circular refs');
return false; return false;
} }
@ -23970,6 +23968,8 @@ var DistanceAngleRecognizer = /*#__PURE__*/function (_Recognizer) {
return DistanceAngleRecognizer; return DistanceAngleRecognizer;
}(Recognizer); }(Recognizer);
var ZOOM_CONSTANT = 7;
var WEBKIT_DISTANCE_SCALE_FACTOR = 260;
var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) { var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
_inheritsLoose(PinchRecognizer, _DistanceAngleRecogni); _inheritsLoose(PinchRecognizer, _DistanceAngleRecogni);
@ -23982,11 +23982,22 @@ var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
_this.onPinchStart = function (event) { _this.onPinchStart = function (event) {
addEventIds(_this.controller, event); addEventIds(_this.controller, event);
if (!_this.enabled || _this.state._active) return; // until we reach two fingers on the target don't react var touchIds = _this.controller.touchIds;
if (!_this.enabled) return;
if (_this.controller.touchIds.size < 2) return; if (_this.state._active) {
// check that the pointerIds that initiated the gesture
// are still enabled. This is useful for when the page
// loses track of the pointers (minifying gesture on iPad).
if (_this.state._pointerIds.every(function (id) {
return touchIds.has(id);
})) return; // something was wrong with the pointers but we let it go.
} // until we reach two fingers on the target don't react
var _pointerIds = Array.from(_this.controller.touchIds).slice(0, 2);
if (touchIds.size < 2) return;
var _pointerIds = Array.from(touchIds).slice(0, 2);
var _getTwoTouchesEventVa = getTwoTouchesEventValues(event, _pointerIds, _this.transform), var _getTwoTouchesEventVa = getTwoTouchesEventValues(event, _pointerIds, _this.transform),
values = _getTwoTouchesEventVa.values, values = _getTwoTouchesEventVa.values,
@ -24015,6 +24026,7 @@ var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
_this.updateSharedState(genericEventData); _this.updateSharedState(genericEventData);
try {
var _getTwoTouchesEventVa2 = getTwoTouchesEventValues(event, _this.state._pointerIds, _this.transform), var _getTwoTouchesEventVa2 = getTwoTouchesEventValues(event, _this.state._pointerIds, _this.transform),
values = _getTwoTouchesEventVa2.values, values = _getTwoTouchesEventVa2.values,
origin = _getTwoTouchesEventVa2.origin; origin = _getTwoTouchesEventVa2.origin;
@ -24026,11 +24038,14 @@ var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
})); }));
_this.fireGestureHandler(); _this.fireGestureHandler();
} catch (e) {
_this.onPinchEnd(event);
}
}; };
_this.onPinchEnd = function (event) { _this.onPinchEnd = function (event) {
removeEventIds(_this.controller, event); removeEventIds(_this.controller, event);
var pointerIds = getPointerIds(event); // if none of the lifted pointerIds is in the state pointerIds don't do anything var pointerIds = getTouchIds(event); // if none of the lifted pointerIds is in the state pointerIds don't do anything
if (_this.state._pointerIds.every(function (id) { if (_this.state._pointerIds.every(function (id) {
return !pointerIds.includes(id); return !pointerIds.includes(id);
@ -24090,9 +24105,12 @@ var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
event.preventDefault(); event.preventDefault();
var genericEventData = getGenericEventData(event); var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData); _this.updateSharedState(genericEventData); // this normalizes the values of the Safari's WebkitEvent by calculating
// the delta and then multiplying it by a constant.
var values = getWebkitGestureEventValues(event, _this.transform); var values = getWebkitGestureEventValues(event, _this.transform);
values[0] = (values[0] - _this.state.event.scale) * WEBKIT_DISTANCE_SCALE_FACTOR + _this.state.values[0];
var kinematics = _this.getKinematics(values, event); var kinematics = _this.getKinematics(values, event);
@ -24130,8 +24148,9 @@ var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
var _this$state$values = _this.state.values, var _this$state$values = _this.state.values,
prev_d = _this$state$values[0], prev_d = _this$state$values[0],
prev_a = _this$state$values[1]; prev_a = _this$state$values[1]; // ZOOM_CONSTANT is based on Safari trackpad natural zooming
var d = prev_d - delta_d;
var d = prev_d - delta_d * ZOOM_CONSTANT;
var a = prev_a !== void 0 ? prev_a : 0; var a = prev_a !== void 0 ? prev_a : 0;
return { return {
values: [d, a], values: [d, a],

File diff suppressed because one or more lines are too long

View File

@ -3552,10 +3552,16 @@ function useFocusReturn(onFocusReturn) {
focusedBeforeMount.current = node.ownerDocument.activeElement; focusedBeforeMount.current = node.ownerDocument.activeElement;
} else if (focusedBeforeMount.current) { } else if (focusedBeforeMount.current) {
// Defer to the component's own explicit focus return behavior, if var isFocused = ref.current.contains(ref.current.ownerDocument.activeElement);
if (ref.current.isConnected && !isFocused) {
return;
} // Defer to the component's own explicit focus return behavior, if
// specified. This allows for support that the `onFocusReturn` // specified. This allows for support that the `onFocusReturn`
// decides to allow the default behavior to occur under some // decides to allow the default behavior to occur under some
// conditions. // conditions.
if (onFocusReturnRef.current) { if (onFocusReturnRef.current) {
onFocusReturnRef.current(); onFocusReturnRef.current();
} else { } else {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.7-beta3-50399'; $wp_version = '5.7-beta3-50400';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.