Update WordPress to 5.2

This commit is contained in:
Oliver Davies 2019-05-08 08:05:39 +01:00
parent 489b5a5914
commit e00f87f2f5
599 changed files with 119573 additions and 55990 deletions

View file

@ -82,12 +82,12 @@ this["wp"] = this["wp"] || {}; this["wp"]["dom"] =
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 324);
/******/ return __webpack_require__(__webpack_require__.s = 379);
/******/ })
/************************************************************************/
/******/ ({
/***/ 19:
/***/ 17:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -103,7 +103,7 @@ function _arrayWithoutHoles(arr) {
}
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
var iterableToArray = __webpack_require__(33);
var iterableToArray = __webpack_require__(34);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
@ -127,7 +127,18 @@ function _toConsumableArray(arr) {
/***/ }),
/***/ 324:
/***/ 34:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
/***/ }),
/***/ 379:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -141,7 +152,7 @@ __webpack_require__.d(tabbable_namespaceObject, "isTabbableIndex", function() {
__webpack_require__.d(tabbable_namespaceObject, "find", function() { return tabbable_find; });
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
var toConsumableArray = __webpack_require__(19);
var toConsumableArray = __webpack_require__(17);
// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/focusable.js
@ -224,11 +235,19 @@ function find(context) {
});
}
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/tabbable.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns the tab index of the given element. In contrast with the tabIndex
* property, this normalizes the default (0) to avoid browser inconsistencies,
@ -258,6 +277,47 @@ function getTabIndex(element) {
function isTabbableIndex(element) {
return getTabIndex(element) !== -1;
}
/**
* Returns a stateful reducer function which constructs a filtered array of
* tabbable elements, where at most one radio input is selected for a given
* name, giving priority to checked input, falling back to the first
* encountered.
*
* @return {Function} Radio group collapse reducer.
*/
function createStatefulCollapseRadioGroup() {
var CHOSEN_RADIO_BY_NAME = {};
return function collapseRadioGroup(result, element) {
var nodeName = element.nodeName,
type = element.type,
checked = element.checked,
name = element.name; // For all non-radio tabbables, construct to array by concatenating.
if (nodeName !== 'INPUT' || type !== 'radio' || !name) {
return result.concat(element);
}
var hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name); // Omit by skipping concatenation if the radio element is not chosen.
var isChosen = checked || !hasChosen;
if (!isChosen) {
return result;
} // At this point, if there had been a chosen element, the current
// element is checked and should take priority. Retroactively remove
// the element which had previously been considered the chosen one.
if (hasChosen) {
var hadChosenElement = CHOSEN_RADIO_BY_NAME[name];
result = Object(external_lodash_["without"])(result, hadChosenElement);
}
CHOSEN_RADIO_BY_NAME[name] = element;
return result.concat(element);
};
}
/**
* An array map callback, returning an object with the element value and its
* array index location as properties. This is used to emulate a proper stable
@ -270,6 +330,7 @@ function isTabbableIndex(element) {
* @return {Object} Mapped object with element, index.
*/
function mapElementToObjectTabbable(element, index) {
return {
element: element,
@ -313,12 +374,9 @@ function compareObjectTabbables(a, b) {
}
function tabbable_find(context) {
return find(context).filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement);
return find(context).filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []);
}
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom.js
/**
* External dependencies
@ -378,16 +436,19 @@ function isSelectionForward(selection) {
return true;
}
/**
* Check whether the selection is horizontally at the edge of the container.
* Check whether the selection is at the edge of the container. Checks for
* horizontal position by default. Set `onlyVertical` to true to check only
* vertically.
*
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check left, false for right.
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check left, false to check right.
* @param {boolean} onlyVertical Set to true to check only vertical position.
*
* @return {boolean} True if at the horizontal edge, false if not.
* @return {boolean} True if at the edge, false if not.
*/
function isHorizontalEdge(container, isReverse) {
function isEdge(container, isReverse, onlyVertical) {
if (Object(external_lodash_["includes"])(['INPUT', 'TEXTAREA'], container.tagName)) {
if (container.selectionStart !== container.selectionEnd) {
return false;
@ -404,110 +465,92 @@ function isHorizontalEdge(container, isReverse) {
return true;
}
var selection = window.getSelection(); // Create copy of range for setting selection to find effective offset.
var range = selection.getRangeAt(0).cloneRange(); // Collapse in direction of selection.
if (!selection.isCollapsed) {
range.collapse(!isSelectionForward(selection));
}
var node = range.startContainer;
var extentOffset;
if (isReverse) {
// When in reverse, range node should be first.
extentOffset = 0;
} else if (node.nodeValue) {
// Otherwise, vary by node type. A text node has no children. Its range
// offset reflects its position in nodeValue.
//
// "If the startContainer is a Node of type Text, Comment, or
// CDATASection, then the offset is the number of characters from the
// start of the startContainer to the boundary point of the Range."
//
// See: https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
// See: https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue
extentOffset = node.nodeValue.length;
} else {
// "For other Node types, the startOffset is the number of child nodes
// between the start of the startContainer and the boundary point of
// the Range."
//
// See: https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
extentOffset = node.childNodes.length;
} // Offset of range should be at expected extent.
var position = isReverse ? 'start' : 'end';
var offset = range["".concat(position, "Offset")];
if (offset !== extentOffset) {
return false;
} // If confirmed to be at extent, traverse up through DOM, verifying that
// the node is at first or last child for reverse or forward respectively.
// Continue until container is reached.
var order = isReverse ? 'first' : 'last';
while (node !== container) {
var parentNode = node.parentNode;
if (parentNode["".concat(order, "Child")] !== node) {
return false;
}
node = parentNode;
} // If reached, range is assumed to be at edge.
return true;
}
/**
* Check whether the selection is vertically at the edge of the container.
*
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check top, false for bottom.
*
* @return {boolean} True if at the edge, false if not.
*/
function isVerticalEdge(container, isReverse) {
if (Object(external_lodash_["includes"])(['INPUT', 'TEXTAREA'], container.tagName)) {
return isHorizontalEdge(container, isReverse);
}
if (!container.isContentEditable) {
return true;
}
var selection = window.getSelection();
var range = selection.rangeCount ? selection.getRangeAt(0) : null;
if (!range) {
if (!selection.rangeCount) {
return false;
}
var range = selection.getRangeAt(0).cloneRange();
var isForward = isSelectionForward(selection);
var isCollapsed = selection.isCollapsed; // Collapse in direction of selection.
if (!isCollapsed) {
range.collapse(!isForward);
}
var rangeRect = getRectangleFromRange(range);
if (!rangeRect) {
return false;
}
var buffer = rangeRect.height / 2;
var editableRect = container.getBoundingClientRect(); // Too low.
var computedStyle = window.getComputedStyle(container);
var lineHeight = parseInt(computedStyle.lineHeight, 10) || 0; // Only consider the multiline selection at the edge if the direction is
// towards the edge.
if (isReverse && rangeRect.top - buffer > editableRect.top) {
return false;
} // Too high.
if (!isReverse && rangeRect.bottom + buffer < editableRect.bottom) {
if (!isCollapsed && rangeRect.height > lineHeight && isForward === isReverse) {
return false;
}
return true;
var padding = parseInt(computedStyle["padding".concat(isReverse ? 'Top' : 'Bottom')], 10) || 0; // Calculate a buffer that is half the line height. In some browsers, the
// selection rectangle may not fill the entire height of the line, so we add
// 3/4 the line height to the selection rectangle to ensure that it is well
// over its line boundary.
var buffer = 3 * parseInt(lineHeight, 10) / 4;
var containerRect = container.getBoundingClientRect();
var verticalEdge = isReverse ? containerRect.top + padding > rangeRect.top - buffer : containerRect.bottom - padding < rangeRect.bottom + buffer;
if (!verticalEdge) {
return false;
}
if (onlyVertical) {
return true;
} // To calculate the horizontal position, we insert a test range and see if
// this test range has the same horizontal position. This method proves to
// be better than a DOM-based calculation, because it ignores empty text
// nodes and a trailing line break element. In other words, we need to check
// visual positioning, not DOM positioning.
var x = isReverse ? containerRect.left + 1 : containerRect.right - 1;
var y = isReverse ? containerRect.top + buffer : containerRect.bottom - buffer;
var testRange = hiddenCaretRangeFromPoint(document, x, y, container);
if (!testRange) {
return false;
}
var side = isReverse ? 'left' : 'right';
var testRect = getRectangleFromRange(testRange);
return Math.round(testRect[side]) === Math.round(rangeRect[side]);
}
/**
* Check whether the selection is horizontally at the edge of the container.
*
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check left, false for right.
*
* @return {boolean} True if at the horizontal edge, false if not.
*/
function isHorizontalEdge(container, isReverse) {
return isEdge(container, isReverse);
}
/**
* Check whether the selection is vertically at the edge of the container.
*
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check top, false for bottom.
*
* @return {boolean} True if at the vertical edge, false if not.
*/
function isVerticalEdge(container, isReverse) {
return isEdge(container, isReverse, true);
}
/**
* Get the rectangle of a given Range.
@ -525,6 +568,17 @@ function getRectangleFromRange(range) {
return range.getBoundingClientRect();
}
var _range = range,
startContainer = _range.startContainer; // Correct invalid "BR" ranges. The cannot contain any children.
if (startContainer.nodeName === 'BR') {
var parentNode = startContainer.parentNode;
var index = Array.from(parentNode.childNodes).indexOf(startContainer);
range = document.createRange();
range.setStart(parentNode, index);
range.setEnd(parentNode, index);
}
var rect = range.getClientRects()[0]; // If the collapsed range starts (and therefore ends) at an element node,
// `getClientRects` can be empty in some browsers. This can be resolved
// by adding a temporary text node with zero-width space to the range.
@ -532,7 +586,9 @@ function getRectangleFromRange(range) {
// See: https://stackoverflow.com/a/6847328/995445
if (!rect) {
var padNode = document.createTextNode("\u200B");
var padNode = document.createTextNode("\u200B"); // Do not modify the live range.
range = range.cloneRange();
range.insertNode(padNode);
rect = range.getClientRects()[0];
padNode.parentNode.removeChild(padNode);
@ -986,6 +1042,11 @@ function wrap(newNode, referenceNode) {
*/
/**
* Object grouping `focusable` and `tabbable` utils
* under the keys with the same name.
*/
var build_module_focus = {
focusable: focusable_namespaceObject,
tabbable: tabbable_namespaceObject
@ -993,17 +1054,6 @@ var build_module_focus = {
/***/ }),
/***/ 33:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
/***/ })
/******/ });