WordPress/wp-includes/js/dist/element.js

1370 lines
42 KiB
JavaScript
Raw Normal View History

this["wp"] = this["wp"] || {}; this["wp"]["element"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "o/Ny");
/******/ })
/************************************************************************/
/******/ ({
/***/ "Vx3V":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["escapeHtml"]; }());
/***/ }),
/***/ "YLtl":
/***/ (function(module, exports) {
(function() { module.exports = window["lodash"]; }());
/***/ }),
/***/ "cDcd":
/***/ (function(module, exports) {
(function() { module.exports = window["React"]; }());
/***/ }),
/***/ "faye":
/***/ (function(module, exports) {
(function() { module.exports = window["ReactDOM"]; }());
/***/ }),
/***/ "o/Ny":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "createInterpolateElement", function() { return /* reexport */ create_interpolate_element; });
__webpack_require__.d(__webpack_exports__, "Children", function() { return /* reexport */ external_React_["Children"]; });
__webpack_require__.d(__webpack_exports__, "cloneElement", function() { return /* reexport */ external_React_["cloneElement"]; });
__webpack_require__.d(__webpack_exports__, "Component", function() { return /* reexport */ external_React_["Component"]; });
__webpack_require__.d(__webpack_exports__, "createContext", function() { return /* reexport */ external_React_["createContext"]; });
__webpack_require__.d(__webpack_exports__, "createElement", function() { return /* reexport */ external_React_["createElement"]; });
__webpack_require__.d(__webpack_exports__, "createRef", function() { return /* reexport */ external_React_["createRef"]; });
__webpack_require__.d(__webpack_exports__, "forwardRef", function() { return /* reexport */ external_React_["forwardRef"]; });
__webpack_require__.d(__webpack_exports__, "Fragment", function() { return /* reexport */ external_React_["Fragment"]; });
__webpack_require__.d(__webpack_exports__, "isValidElement", function() { return /* reexport */ external_React_["isValidElement"]; });
__webpack_require__.d(__webpack_exports__, "memo", function() { return /* reexport */ external_React_["memo"]; });
__webpack_require__.d(__webpack_exports__, "StrictMode", function() { return /* reexport */ external_React_["StrictMode"]; });
__webpack_require__.d(__webpack_exports__, "useCallback", function() { return /* reexport */ external_React_["useCallback"]; });
__webpack_require__.d(__webpack_exports__, "useContext", function() { return /* reexport */ external_React_["useContext"]; });
__webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return /* reexport */ external_React_["useDebugValue"]; });
__webpack_require__.d(__webpack_exports__, "useEffect", function() { return /* reexport */ external_React_["useEffect"]; });
__webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return /* reexport */ external_React_["useImperativeHandle"]; });
__webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return /* reexport */ external_React_["useLayoutEffect"]; });
__webpack_require__.d(__webpack_exports__, "useMemo", function() { return /* reexport */ external_React_["useMemo"]; });
__webpack_require__.d(__webpack_exports__, "useReducer", function() { return /* reexport */ external_React_["useReducer"]; });
__webpack_require__.d(__webpack_exports__, "useRef", function() { return /* reexport */ external_React_["useRef"]; });
__webpack_require__.d(__webpack_exports__, "useState", function() { return /* reexport */ external_React_["useState"]; });
__webpack_require__.d(__webpack_exports__, "lazy", function() { return /* reexport */ external_React_["lazy"]; });
__webpack_require__.d(__webpack_exports__, "Suspense", function() { return /* reexport */ external_React_["Suspense"]; });
__webpack_require__.d(__webpack_exports__, "concatChildren", function() { return /* reexport */ concatChildren; });
__webpack_require__.d(__webpack_exports__, "switchChildrenNodeName", function() { return /* reexport */ switchChildrenNodeName; });
__webpack_require__.d(__webpack_exports__, "createPortal", function() { return /* reexport */ external_ReactDOM_["createPortal"]; });
__webpack_require__.d(__webpack_exports__, "findDOMNode", function() { return /* reexport */ external_ReactDOM_["findDOMNode"]; });
__webpack_require__.d(__webpack_exports__, "render", function() { return /* reexport */ external_ReactDOM_["render"]; });
__webpack_require__.d(__webpack_exports__, "unmountComponentAtNode", function() { return /* reexport */ external_ReactDOM_["unmountComponentAtNode"]; });
__webpack_require__.d(__webpack_exports__, "isEmptyElement", function() { return /* reexport */ isEmptyElement; });
__webpack_require__.d(__webpack_exports__, "Platform", function() { return /* reexport */ platform; });
__webpack_require__.d(__webpack_exports__, "renderToString", function() { return /* reexport */ serialize; });
__webpack_require__.d(__webpack_exports__, "RawHTML", function() { return /* reexport */ RawHTML; });
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
2020-01-08 06:57:23 -05:00
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js
/**
* Internal dependencies
2020-01-08 06:57:23 -05:00
*/
/** @typedef {import('./react').WPElement} WPElement */
let indoc, offset, output, stack;
2020-01-08 06:57:23 -05:00
/**
* Matches tags in the localized string
*
* This is used for extracting the tag pattern groups for parsing the localized
* string and along with the map converting it to a react element.
*
* There are four references extracted using this tokenizer:
*
* match: Full match of the tag (i.e. <strong>, </strong>, <br/>)
* isClosing: The closing slash, it it exists.
* name: The name portion of the tag (strong, br) (if )
* isSelfClosed: The slash on a self closing tag, if it exists.
*
* @type {RegExp}
*/
const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
/**
* The stack frame tracking parse progress.
*
* @typedef Frame
*
* @property {WPElement} element A parent element which may still have
* @property {number} tokenStart Offset at which parent element first
* appears.
* @property {number} tokenLength Length of string marking start of parent
* element.
* @property {number} [prevOffset] Running offset at which parsing should
* continue.
* @property {number} [leadingTextStart] Offset at which last closing element
* finished, used for finding text between
* elements.
* @property {WPElement[]} children Children.
*/
2020-01-08 06:57:23 -05:00
/**
* Tracks recursive-descent parse state.
*
* This is a Stack frame holding parent elements until all children have been
* parsed.
*
* @private
* @param {WPElement} element A parent element which may still have
* nested children not yet parsed.
* @param {number} tokenStart Offset at which parent element first
* appears.
* @param {number} tokenLength Length of string marking start of parent
* element.
* @param {number} [prevOffset] Running offset at which parsing should
* continue.
* @param {number} [leadingTextStart] Offset at which last closing element
* finished, used for finding text between
* elements.
2020-01-08 06:57:23 -05:00
*
* @return {Frame} The stack frame tracking parse progress.
*/
function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) {
2020-01-08 06:57:23 -05:00
return {
element,
tokenStart,
tokenLength,
prevOffset,
leadingTextStart,
2020-01-08 06:57:23 -05:00
children: []
};
}
/**
* This function creates an interpolated element from a passed in string with
* specific tags matching how the string should be converted to an element via
* the conversion map value.
*
* @example
* For example, for the given string:
*
* "This is a <span>string</span> with <a>a link</a> and a self-closing
* <CustomComponentB/> tag"
*
* You would have something like this as the conversionMap value:
*
* ```js
* {
* span: <span />,
* a: <a href={ 'https://github.com' } />,
* CustomComponentB: <CustomComponent />,
* }
* ```
*
* @param {string} interpolatedString The interpolation string to be parsed.
* @param {Object} conversionMap The map used to convert the string to
* a react element.
* @throws {TypeError}
* @return {WPElement} A wp element.
*/
const createInterpolateElement = (interpolatedString, conversionMap) => {
2020-01-08 06:57:23 -05:00
indoc = interpolatedString;
offset = 0;
output = [];
stack = [];
tokenizer.lastIndex = 0;
if (!isValidConversionMap(conversionMap)) {
2020-01-08 06:57:23 -05:00
throw new TypeError('The conversionMap provided is not valid. It must be an object with values that are WPElements');
}
do {// twiddle our thumbs
} while (proceed(conversionMap));
return Object(external_React_["createElement"])(external_React_["Fragment"], null, ...output);
2020-01-08 06:57:23 -05:00
};
/**
* Validate conversion map.
*
* A map is considered valid if it's an object and every value in the object
* is a WPElement
*
* @private
*
* @param {Object} conversionMap The map being validated.
*
* @return {boolean} True means the map is valid.
*/
const isValidConversionMap = conversionMap => {
const isObject = typeof conversionMap === 'object';
const values = isObject && Object.values(conversionMap);
return isObject && values.length && values.every(element => Object(external_React_["isValidElement"])(element));
2020-01-08 06:57:23 -05:00
};
/**
* This is the iterator over the matches in the string.
*
* @private
*
* @param {Object} conversionMap The conversion map for the string.
*
* @return {boolean} true for continuing to iterate, false for finished.
*/
function proceed(conversionMap) {
const next = nextToken();
const [tokenType, name, startOffset, tokenLength] = next;
const stackDepth = stack.length;
const leadingTextStart = startOffset > offset ? offset : null;
2020-01-08 06:57:23 -05:00
if (!conversionMap[name]) {
addText();
return false;
}
switch (tokenType) {
case 'no-more-tokens':
if (stackDepth !== 0) {
const {
leadingTextStart: stackLeadingText,
tokenStart
} = stack.pop();
2020-01-08 06:57:23 -05:00
output.push(indoc.substr(stackLeadingText, tokenStart));
}
addText();
return false;
case 'self-closed':
if (0 === stackDepth) {
if (null !== leadingTextStart) {
output.push(indoc.substr(leadingTextStart, startOffset - leadingTextStart));
}
output.push(conversionMap[name]);
offset = startOffset + tokenLength;
return true;
} // otherwise we found an inner element
addChild(createFrame(conversionMap[name], startOffset, tokenLength));
2020-01-08 06:57:23 -05:00
offset = startOffset + tokenLength;
return true;
case 'opener':
stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart));
2020-01-08 06:57:23 -05:00
offset = startOffset + tokenLength;
return true;
case 'closer':
// if we're not nesting then this is easy - close the block
if (1 === stackDepth) {
closeOuterElement(startOffset);
offset = startOffset + tokenLength;
return true;
} // otherwise we're nested and we have to close out the current
// block and add it as a innerBlock to the parent
const stackTop = stack.pop();
const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset);
2020-01-08 06:57:23 -05:00
stackTop.children.push(text);
stackTop.prevOffset = startOffset + tokenLength;
const frame = createFrame(stackTop.element, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength);
2020-01-08 06:57:23 -05:00
frame.children = stackTop.children;
addChild(frame);
offset = startOffset + tokenLength;
return true;
default:
addText();
return false;
}
}
/**
* Grabs the next token match in the string and returns it's details.
*
* @private
*
* @return {Array} An array of details for the token matched.
*/
function nextToken() {
const matches = tokenizer.exec(indoc); // we have no more tokens
2020-01-08 06:57:23 -05:00
if (null === matches) {
return ['no-more-tokens'];
}
const startedAt = matches.index;
const [match, isClosing, name, isSelfClosed] = matches;
const length = match.length;
2020-01-08 06:57:23 -05:00
if (isSelfClosed) {
return ['self-closed', name, startedAt, length];
}
if (isClosing) {
return ['closer', name, startedAt, length];
}
return ['opener', name, startedAt, length];
}
/**
* Pushes text extracted from the indoc string to the output stack given the
* current rawLength value and offset (if rawLength is provided ) or the
* indoc.length and offset.
*
* @private
*/
function addText() {
const length = indoc.length - offset;
2020-01-08 06:57:23 -05:00
if (0 === length) {
return;
}
output.push(indoc.substr(offset, length));
}
/**
* Pushes a child element to the associated parent element's children for the
* parent currently active in the stack.
*
* @private
*
* @param {Frame} frame The Frame containing the child element and it's
* token information.
*/
function addChild(frame) {
const {
element,
tokenStart,
tokenLength,
prevOffset,
children
} = frame;
const parent = stack[stack.length - 1];
const text = indoc.substr(parent.prevOffset, tokenStart - parent.prevOffset);
2020-01-08 06:57:23 -05:00
if (text) {
parent.children.push(text);
}
parent.children.push(Object(external_React_["cloneElement"])(element, null, ...children));
2020-01-08 06:57:23 -05:00
parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;
}
/**
* This is called for closing tags. It creates the element currently active in
* the stack.
*
* @private
*
* @param {number} endOffset Offset at which the closing tag for the element
* begins in the string. If this is greater than the
* prevOffset attached to the element, then this
* helps capture any remaining nested text nodes in
* the element.
*/
function closeOuterElement(endOffset) {
const {
element,
leadingTextStart,
prevOffset,
tokenStart,
children
} = stack.pop();
const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset);
2020-01-08 06:57:23 -05:00
if (text) {
children.push(text);
}
if (null !== leadingTextStart) {
output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart));
}
output.push(Object(external_React_["cloneElement"])(element, null, ...children));
2020-01-08 06:57:23 -05:00
}
/* harmony default export */ var create_interpolate_element = (createInterpolateElement);
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
2020-01-08 06:57:23 -05:00
/**
* Object containing a React element.
*
* @typedef {import('react').ReactElement} WPElement
*/
/**
* Object containing a React component.
*
* @typedef {import('react').ComponentType} WPComponent
2020-01-08 06:57:23 -05:00
*/
/**
* Object containing a React synthetic event.
*
* @typedef {import('react').SyntheticEvent} WPSyntheticEvent
*/
Block Editor: Update the WordPress Packages from Gutenberg 5.3 - @wordpress/a11y@2.2.0 - @wordpress/annotations@1.2.0 - @wordpress/api-fetch@3.1.0 - @wordpress/autop@2.2.0 - @wordpress/babel-plugin-import-jsx-pragma@2.1.0 - @wordpress/babel-preset-default@4.1.0 - @wordpress/blob@2.3.0 - @wordpress/block-editor@1.1.0 - @wordpress/block-library@2.4.0 - @wordpress/block-serialization-default-parser@3.1.0 - @wordpress/blocks@6.2.0 - @wordpress/components@7.2.0 - @wordpress/compose@3.2.0 - @wordpress/core-data@2.2.0 - @wordpress/data@4.4.0 - @wordpress/date@3.2.0 - @wordpress/deprecated@2.2.0 - @wordpress/docgen@1.1.0 - @wordpress/dom-ready@2.2.0 - @wordpress/dom@2.2.0 - @wordpress/e2e-test-utils@1.1.0 - @wordpress/e2e-tests@1.1.0 - @wordpress/edit-post@3.3.0 - @wordpress/edit-widgets@0.2.0 - @wordpress/editor@9.2.0 - @wordpress/element@2.3.0 - @wordpress/escape-html@1.2.0 - @wordpress/eslint-plugin@2.1.0 - @wordpress/format-library@1.4.0 - @wordpress/hooks@2.2.0 - @wordpress/html-entities@2.2.0 - @wordpress/i18n@3.3.0 - @wordpress/keycodes@2.2.0 - @wordpress/list-reusable-blocks@1.3.0 - @wordpress/notices@1.3.0 - @wordpress/nux@3.2.0 - @wordpress/plugins@2.2.0 - @wordpress/priority-queue@1.1.0 - @wordpress/redux-routine@3.2.0 - @wordpress/rich-text@3.2.0 - @wordpress/scripts@3.1.0 - @wordpress/shortcode@2.2.0 - @wordpress/url@2.5.0 - @wordpress/viewport@2.3.0 - @wordpress/wordcount@2.2.0 Built from https://develop.svn.wordpress.org/trunk@44960 git-svn-id: http://core.svn.wordpress.org/trunk@44791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 08:48:00 -04:00
/**
* Object that provides utilities for dealing with React children.
*/
/**
* Creates a copy of an element with extended props.
*
* @param {WPElement} element Element
* @param {?Object} props Props to apply to cloned element
*
* @return {WPElement} Cloned element.
*/
/**
* A base class to create WordPress Components (Refs, state and lifecycle hooks)
*/
/**
* Creates a context object containing two components: a provider and consumer.
*
* @param {Object} defaultValue A default data stored in the context.
*
* @return {Object} Context object.
*/
/**
* Returns a new element of given type. Type can be either a string tag name or
* another function which itself returns an element.
*
* @param {?(string|Function)} type Tag name or element creator
* @param {Object} props Element properties, either attribute
2020-01-08 06:57:23 -05:00
* set to apply to DOM node or values to
* pass through to element creator
* @param {...WPElement} children Descendant elements
*
* @return {WPElement} Element.
*/
/**
* Returns an object tracking a reference to a rendered element via its
* `current` property as either a DOMElement or Element, dependent upon the
* type of element rendered with the ref attribute.
*
* @return {Object} Ref object.
*/
/**
* Component enhancer used to enable passing a ref to its wrapped component.
* Pass a function argument which receives `props` and `ref` as its arguments,
* returning an element using the forwarded ref. The return value is a new
* component which forwards its ref.
*
* @param {Function} forwarder Function passed `props` and `ref`, expected to
* return an element.
*
* @return {WPComponent} Enhanced component.
*/
/**
* A component which renders its children without any wrapping element.
*/
/**
2020-01-08 06:57:23 -05:00
* Checks if an object is a valid WPElement.
*
* @param {Object} objectToCheck The object to be checked.
*
* @return {boolean} true if objectToTest is a valid WPElement and false otherwise.
*/
Block Editor: Update the WordPress Packages to the ones used in the Gutenberg 6.5 release Updated Packages: In version 6.2: @wordpress/a11y@2.5.0 @wordpress/annotations@1.5.0 @wordpress/api-fetch@3.4.0 @wordpress/autop@2.4.0 @wordpress/babel-plugin-import-jsx-pragma@2.3.0 @wordpress/babel-plugin-makepot@3.2.0 @wordpress/babel-preset-default@4.4.0 @wordpress/blob@2.5.0 @wordpress/block-editor@3.0.0 @wordpress/block-library@2.7.0 @wordpress/block-serialization-default-parser@3.3.0 @wordpress/block-serialization-spec-parser@3.2.0 @wordpress/blocks@6.5.0 @wordpress/browserslist-config@2.6.0 @wordpress/components@8.1.0 @wordpress/compose@3.5.0 @wordpress/core-data@2.5.0 @wordpress/custom-templated-path-webpack-plugin@1.5.0 @wordpress/data-controls@1.1.0 @wordpress/data@4.7.0 @wordpress/date@3.4.0 @wordpress/dependency-extraction-webpack-plugin@1.1.0 @wordpress/deprecated@2.5.0 @wordpress/docgen@1.3.0 @wordpress/dom-ready@2.5.0 @wordpress/dom@2.4.0 @wordpress/e2e-test-utils@2.2.0 @wordpress/e2e-tests@1.4.0 @wordpress/edit-post@3.6.0 @wordpress/editor@9.5.0 @wordpress/element@2.6.0 @wordpress/escape-html@1.5.0 @wordpress/eslint-plugin@2.4.0 @wordpress/format-library@1.7.0 @wordpress/hooks@2.5.0 @wordpress/html-entities@2.5.0 @wordpress/i18n@3.6.0 @wordpress/is-shallow-equal@1.5.0 @wordpress/jest-console@3.2.0 @wordpress/jest-preset-default@4.3.0 @wordpress/jest-puppeteer-axe@1.2.0 @wordpress/keycodes@2.5.0 @wordpress/library-export-default-webpack-plugin@1.4.0 @wordpress/list-reusable-blocks@1.6.0 @wordpress/media-utils@1.0.0 @wordpress/notices@1.6.0 @wordpress/npm-package-json-lint-config@2.1.0 @wordpress/nux@3.5.0 @wordpress/plugins@2.5.0 @wordpress/postcss-themes@2.2.0 @wordpress/priority-queue@1.3.0 @wordpress/redux-routine@3.5.0 @wordpress/rich-text@3.5.0 @wordpress/scripts@3.4.0 @wordpress/server-side-render@1.1.0 @wordpress/shortcode@2.4.0 @wordpress/token-list@1.5.0 @wordpress/url@2.7.0 @wordpress/viewport@2.6.0 @wordpress/wordcount@2.5.0 In version 6.4: @wordpress/annotations@1.6.0 @wordpress/api-fetch@3.5.0 @wordpress/autop@2.5.0 @wordpress/babel-preset-default@4.5.0 @wordpress/block-editor@3.1.0 @wordpress/block-library@2.8.0 @wordpress/block-serialization-default-parser@3.4.0 @wordpress/block-serialization-spec-parser@3.3.0 @wordpress/blocks@6.6.0 @wordpress/components@8.2.0 @wordpress/compose@3.6.0 @wordpress/core-data@2.6.0 @wordpress/data-controls@1.2.0 @wordpress/data@4.8.0 @wordpress/date@3.5.0 @wordpress/dependency-extraction-webpack-plugin@1.2.0 @wordpress/deprecated@2.6.0 @wordpress/docgen@1.4.0 @wordpress/dom@2.5.0 @wordpress/e2e-test-utils@2.3.0 @wordpress/e2e-tests@1.5.0 @wordpress/edit-post@3.7.0 @wordpress/editor@9.6.0 @wordpress/element@2.7.0 @wordpress/eslint-plugin@3.0.0 @wordpress/format-library@1.8.0 @wordpress/hooks@2.6.0 @wordpress/is-shallow-equal@1.6.0 @wordpress/jest-console@3.3.0 @wordpress/jest-preset-default@5.0.0 @wordpress/jest-puppeteer-axe@1.3.0 @wordpress/keycodes@2.6.0 @wordpress/list-reusable-blocks@1.7.0 @wordpress/media-utils@1.1.0 @wordpress/notices@1.7.0 @wordpress/nux@3.6.0 @wordpress/plugins@2.6.0 @wordpress/project-management-automation@1.0.0 @wordpress/redux-routine@3.6.0 @wordpress/rich-text@3.6.0 @wordpress/scripts@4.0.0 @wordpress/server-side-render@1.2.0 @wordpress/token-list@1.6.0 @wordpress/viewport@2.7.0 @wordpress/wordcount@2.6.0 In version 6.5: @wordpress/annotations@1.7.0 @wordpress/api-fetch@3.6.0 @wordpress/babel-preset-default@4.6.0 @wordpress/block-directory@1.0.0 @wordpress/block-editor@3.2.0 @wordpress/block-library@2.9.0 @wordpress/blocks@6.7.0 @wordpress/components@8.3.0 @wordpress/compose@3.7.0 @wordpress/core-data@2.7.0 @wordpress/data-controls@1.3.0 @wordpress/data@4.9.0 @wordpress/dependency-extraction-webpack-plugin@2.0.0 @wordpress/e2e-test-utils@2.4.0 @wordpress/e2e-tests@1.7.0 @wordpress/edit-post@3.8.0 @wordpress/editor@9.7.0 @wordpress/element@2.8.0 @wordpress/eslint-plugin@3.1.0 @wordpress/format-library@1.9.0 @wordpress/list-reusable-blocks@1.8.0 @wordpress/media-utils@1.2.0 @wordpress/notices@1.8.0 @wordpress/nux@3.7.0 @wordpress/plugins@2.7.0 @wordpress/rich-text@3.7.0 @wordpress/scripts@5.0.0 @wordpress/server-side-render@1.3.0 @wordpress/url@2.8.0 @wordpress/viewport@2.8.0 Props youknowriad desrosj noisysocks pento jorgefilipecosta iseulde Fixes: #47843 Built from https://develop.svn.wordpress.org/trunk@46189 git-svn-id: http://core.svn.wordpress.org/trunk@46001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 11:19:18 -04:00
/**
* @see https://reactjs.org/docs/react-api.html#reactmemo
*/
Block Editor: Update the WordPress Packages from Gutenberg 5.3 - @wordpress/a11y@2.2.0 - @wordpress/annotations@1.2.0 - @wordpress/api-fetch@3.1.0 - @wordpress/autop@2.2.0 - @wordpress/babel-plugin-import-jsx-pragma@2.1.0 - @wordpress/babel-preset-default@4.1.0 - @wordpress/blob@2.3.0 - @wordpress/block-editor@1.1.0 - @wordpress/block-library@2.4.0 - @wordpress/block-serialization-default-parser@3.1.0 - @wordpress/blocks@6.2.0 - @wordpress/components@7.2.0 - @wordpress/compose@3.2.0 - @wordpress/core-data@2.2.0 - @wordpress/data@4.4.0 - @wordpress/date@3.2.0 - @wordpress/deprecated@2.2.0 - @wordpress/docgen@1.1.0 - @wordpress/dom-ready@2.2.0 - @wordpress/dom@2.2.0 - @wordpress/e2e-test-utils@1.1.0 - @wordpress/e2e-tests@1.1.0 - @wordpress/edit-post@3.3.0 - @wordpress/edit-widgets@0.2.0 - @wordpress/editor@9.2.0 - @wordpress/element@2.3.0 - @wordpress/escape-html@1.2.0 - @wordpress/eslint-plugin@2.1.0 - @wordpress/format-library@1.4.0 - @wordpress/hooks@2.2.0 - @wordpress/html-entities@2.2.0 - @wordpress/i18n@3.3.0 - @wordpress/keycodes@2.2.0 - @wordpress/list-reusable-blocks@1.3.0 - @wordpress/notices@1.3.0 - @wordpress/nux@3.2.0 - @wordpress/plugins@2.2.0 - @wordpress/priority-queue@1.1.0 - @wordpress/redux-routine@3.2.0 - @wordpress/rich-text@3.2.0 - @wordpress/scripts@3.1.0 - @wordpress/shortcode@2.2.0 - @wordpress/url@2.5.0 - @wordpress/viewport@2.3.0 - @wordpress/wordcount@2.2.0 Built from https://develop.svn.wordpress.org/trunk@44960 git-svn-id: http://core.svn.wordpress.org/trunk@44791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 08:48:00 -04:00
/**
* Component that activates additional checks and warnings for its descendants.
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#usecallback
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#usecontext
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#useeffect
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#usememo
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#usereducer
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#useref
*/
/**
* @see https://reactjs.org/docs/hooks-reference.html#usestate
*/
Block Editor: Update the WordPress Packages to the ones used in the Gutenberg 6.5 release Updated Packages: In version 6.2: @wordpress/a11y@2.5.0 @wordpress/annotations@1.5.0 @wordpress/api-fetch@3.4.0 @wordpress/autop@2.4.0 @wordpress/babel-plugin-import-jsx-pragma@2.3.0 @wordpress/babel-plugin-makepot@3.2.0 @wordpress/babel-preset-default@4.4.0 @wordpress/blob@2.5.0 @wordpress/block-editor@3.0.0 @wordpress/block-library@2.7.0 @wordpress/block-serialization-default-parser@3.3.0 @wordpress/block-serialization-spec-parser@3.2.0 @wordpress/blocks@6.5.0 @wordpress/browserslist-config@2.6.0 @wordpress/components@8.1.0 @wordpress/compose@3.5.0 @wordpress/core-data@2.5.0 @wordpress/custom-templated-path-webpack-plugin@1.5.0 @wordpress/data-controls@1.1.0 @wordpress/data@4.7.0 @wordpress/date@3.4.0 @wordpress/dependency-extraction-webpack-plugin@1.1.0 @wordpress/deprecated@2.5.0 @wordpress/docgen@1.3.0 @wordpress/dom-ready@2.5.0 @wordpress/dom@2.4.0 @wordpress/e2e-test-utils@2.2.0 @wordpress/e2e-tests@1.4.0 @wordpress/edit-post@3.6.0 @wordpress/editor@9.5.0 @wordpress/element@2.6.0 @wordpress/escape-html@1.5.0 @wordpress/eslint-plugin@2.4.0 @wordpress/format-library@1.7.0 @wordpress/hooks@2.5.0 @wordpress/html-entities@2.5.0 @wordpress/i18n@3.6.0 @wordpress/is-shallow-equal@1.5.0 @wordpress/jest-console@3.2.0 @wordpress/jest-preset-default@4.3.0 @wordpress/jest-puppeteer-axe@1.2.0 @wordpress/keycodes@2.5.0 @wordpress/library-export-default-webpack-plugin@1.4.0 @wordpress/list-reusable-blocks@1.6.0 @wordpress/media-utils@1.0.0 @wordpress/notices@1.6.0 @wordpress/npm-package-json-lint-config@2.1.0 @wordpress/nux@3.5.0 @wordpress/plugins@2.5.0 @wordpress/postcss-themes@2.2.0 @wordpress/priority-queue@1.3.0 @wordpress/redux-routine@3.5.0 @wordpress/rich-text@3.5.0 @wordpress/scripts@3.4.0 @wordpress/server-side-render@1.1.0 @wordpress/shortcode@2.4.0 @wordpress/token-list@1.5.0 @wordpress/url@2.7.0 @wordpress/viewport@2.6.0 @wordpress/wordcount@2.5.0 In version 6.4: @wordpress/annotations@1.6.0 @wordpress/api-fetch@3.5.0 @wordpress/autop@2.5.0 @wordpress/babel-preset-default@4.5.0 @wordpress/block-editor@3.1.0 @wordpress/block-library@2.8.0 @wordpress/block-serialization-default-parser@3.4.0 @wordpress/block-serialization-spec-parser@3.3.0 @wordpress/blocks@6.6.0 @wordpress/components@8.2.0 @wordpress/compose@3.6.0 @wordpress/core-data@2.6.0 @wordpress/data-controls@1.2.0 @wordpress/data@4.8.0 @wordpress/date@3.5.0 @wordpress/dependency-extraction-webpack-plugin@1.2.0 @wordpress/deprecated@2.6.0 @wordpress/docgen@1.4.0 @wordpress/dom@2.5.0 @wordpress/e2e-test-utils@2.3.0 @wordpress/e2e-tests@1.5.0 @wordpress/edit-post@3.7.0 @wordpress/editor@9.6.0 @wordpress/element@2.7.0 @wordpress/eslint-plugin@3.0.0 @wordpress/format-library@1.8.0 @wordpress/hooks@2.6.0 @wordpress/is-shallow-equal@1.6.0 @wordpress/jest-console@3.3.0 @wordpress/jest-preset-default@5.0.0 @wordpress/jest-puppeteer-axe@1.3.0 @wordpress/keycodes@2.6.0 @wordpress/list-reusable-blocks@1.7.0 @wordpress/media-utils@1.1.0 @wordpress/notices@1.7.0 @wordpress/nux@3.6.0 @wordpress/plugins@2.6.0 @wordpress/project-management-automation@1.0.0 @wordpress/redux-routine@3.6.0 @wordpress/rich-text@3.6.0 @wordpress/scripts@4.0.0 @wordpress/server-side-render@1.2.0 @wordpress/token-list@1.6.0 @wordpress/viewport@2.7.0 @wordpress/wordcount@2.6.0 In version 6.5: @wordpress/annotations@1.7.0 @wordpress/api-fetch@3.6.0 @wordpress/babel-preset-default@4.6.0 @wordpress/block-directory@1.0.0 @wordpress/block-editor@3.2.0 @wordpress/block-library@2.9.0 @wordpress/blocks@6.7.0 @wordpress/components@8.3.0 @wordpress/compose@3.7.0 @wordpress/core-data@2.7.0 @wordpress/data-controls@1.3.0 @wordpress/data@4.9.0 @wordpress/dependency-extraction-webpack-plugin@2.0.0 @wordpress/e2e-test-utils@2.4.0 @wordpress/e2e-tests@1.7.0 @wordpress/edit-post@3.8.0 @wordpress/editor@9.7.0 @wordpress/element@2.8.0 @wordpress/eslint-plugin@3.1.0 @wordpress/format-library@1.9.0 @wordpress/list-reusable-blocks@1.8.0 @wordpress/media-utils@1.2.0 @wordpress/notices@1.8.0 @wordpress/nux@3.7.0 @wordpress/plugins@2.7.0 @wordpress/rich-text@3.7.0 @wordpress/scripts@5.0.0 @wordpress/server-side-render@1.3.0 @wordpress/url@2.8.0 @wordpress/viewport@2.8.0 Props youknowriad desrosj noisysocks pento jorgefilipecosta iseulde Fixes: #47843 Built from https://develop.svn.wordpress.org/trunk@46189 git-svn-id: http://core.svn.wordpress.org/trunk@46001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 11:19:18 -04:00
/**
* @see https://reactjs.org/docs/react-api.html#reactlazy
*/
/**
* @see https://reactjs.org/docs/react-api.html#reactsuspense
*/
/**
* Concatenate two or more React children objects.
*
* @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate.
*
* @return {Array} The concatenated value.
*/
function concatChildren(...childrenArguments) {
return childrenArguments.reduce((accumulator, children, i) => {
external_React_["Children"].forEach(children, (child, j) => {
if (child && 'string' !== typeof child) {
child = Object(external_React_["cloneElement"])(child, {
key: [i, j].join()
});
}
2020-01-08 06:57:23 -05:00
accumulator.push(child);
});
2020-01-08 06:57:23 -05:00
return accumulator;
}, []);
}
/**
* Switches the nodeName of all the elements in the children object.
*
* @param {?Object} children Children object.
* @param {string} nodeName Node name.
*
* @return {?Object} The updated children object.
*/
function switchChildrenNodeName(children, nodeName) {
return children && external_React_["Children"].map(children, (elt, index) => {
if (Object(external_lodash_["isString"])(elt)) {
return Object(external_React_["createElement"])(nodeName, {
key: index
}, elt);
}
const {
children: childrenProp,
...props
} = elt.props;
return Object(external_React_["createElement"])(nodeName, {
key: index,
...props
}, childrenProp);
});
}
// EXTERNAL MODULE: external "ReactDOM"
var external_ReactDOM_ = __webpack_require__("faye");
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js
/**
* External dependencies
*/
/**
* Creates a portal into which a component can be rendered.
*
* @see https://github.com/facebook/react/issues/10309#issuecomment-318433235
*
* @param {import('./react').WPElement} child Any renderable child, such as an element,
2020-01-08 06:57:23 -05:00
* string, or fragment.
* @param {HTMLElement} container DOM node into which element should be rendered.
*/
/**
2020-01-08 06:57:23 -05:00
* Finds the dom node of a React component.
*
* @param {import('./react').WPComponent} component Component's instance.
*/
/**
* Renders a given element into the target DOM node.
*
* @param {import('./react').WPElement} element Element to render.
2020-01-08 06:57:23 -05:00
* @param {HTMLElement} target DOM node into which element should be rendered.
*/
/**
* Removes any mounted element from the target DOM node.
*
* @param {Element} target DOM node in which element is to be removed
*/
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js
/**
* External dependencies
*/
/**
* Checks if the provided WP element is empty.
*
* @param {*} element WP element to check.
* @return {boolean} True when an element is considered empty.
*/
const isEmptyElement = element => {
if (Object(external_lodash_["isNumber"])(element)) {
return false;
}
if (Object(external_lodash_["isString"])(element) || Object(external_lodash_["isArray"])(element)) {
return !element.length;
}
return !element;
};
2020-01-08 06:57:23 -05:00
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js
/**
* Parts of this source were derived and modified from react-native-web,
* released under the MIT license.
*
* Copyright (c) 2016-present, Nicolas Gallagher.
* Copyright (c) 2015-present, Facebook, Inc.
*
*/
const Platform = {
2020-01-08 06:57:23 -05:00
OS: 'web',
select: spec => 'web' in spec ? spec.web : spec.default
2020-01-08 06:57:23 -05:00
};
/**
* Component used to detect the current Platform being used.
* Use Platform.OS === 'web' to detect if running on web enviroment.
*
* This is the same concept as the React Native implementation.
*
* @see https://facebook.github.io/react-native/docs/platform-specific-code#platform-module
*
* Here is an example of how to use the select method:
* @example
* ```js
* import { Platform } from '@wordpress/element';
*
* const placeholderLabel = Platform.select( {
* native: __( 'Add media' ),
* web: __( 'Drag images, upload new ones or select files from your library.' ),
* } );
* ```
*/
/* harmony default export */ var platform = (Platform);
// EXTERNAL MODULE: external ["wp","escapeHtml"]
var external_wp_escapeHtml_ = __webpack_require__("Vx3V");
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js
/**
Block Editor: Update the WordPress Packages from Gutenberg 5.2. Updated Packages: - @wordpress/a11y@2.1.0 - @wordpress/annotations@1.1.0 - @wordpress/api-fetch@3.0.0 - @wordpress/autop@2.1.0 - @wordpress/babel-plugin-import-jsx-pragma@2.0.0 - @wordpress/babel-plugin-makepot@3.0.0 - @wordpress/babel-preset-default@4.0.0 - @wordpress/blob@2.2.0 - @wordpress/block-editor@1.0.0 - @wordpress/block-library@2.3.0 - @wordpress/block-serialization-default-parser@3.0.0 - @wordpress/block-serialization-spec-parser@3.0.0 - @wordpress/blocks@6.1.0 - @wordpress/browserslist-config@2.3.0 - @wordpress/components@7.1.0 - @wordpress/compose@3.1.0 - @wordpress/core-data@2.1.0 - @wordpress/custom-templated-path-webpack-plugin@1.2.0 - @wordpress/data@4.3.0 - @wordpress/date@3.1.0 - @wordpress/deprecated@2.1.0 - @wordpress/docgen@1.0.0 - @wordpress/dom-ready@2.1.0 - @wordpress/dom@2.1.0 - @wordpress/e2e-test-utils@1.0.0 - @wordpress/e2e-tests@1.0.0 - @wordpress/edit-post@3.2.0 - @wordpress/editor@9.1.0 - @wordpress/element@2.2.0 - @wordpress/escape-html@1.1.0 - @wordpress/eslint-plugin@2.0.0 - @wordpress/format-library@1.3.0 - @wordpress/hooks@2.1.0 - @wordpress/html-entities@2.1.0 - @wordpress/i18n@3.2.0 - @wordpress/is-shallow-equal@1.2.0 - @wordpress/jest-console@3.0.0 - @wordpress/jest-preset-default@4.0.0 - @wordpress/jest-puppeteer-axe@1.0.0 - @wordpress/keycodes@2.1.0 - @wordpress/library-export-default-webpack-plugin@1.1.0 - @wordpress/list-reusable-blocks@1.2.0 - @wordpress/notices@1.2.0 - @wordpress/npm-package-json-lint-config@1.2.0 - @wordpress/nux@3.1.0 - @wordpress/plugins@2.1.0 - @wordpress/postcss-themes@2.0.0 - @wordpress/priority-queue@1.0.0 - @wordpress/redux-routine@3.1.0 - @wordpress/rich-text@3.1.0 - @wordpress/scripts@3.0.0 - @wordpress/shortcode@2.1.0 - @wordpress/token-list@1.2.0 - @wordpress/url@2.4.0 - @wordpress/viewport@2.2.0 - @wordpress/wordcount@2.1.0 This also includes the update to the scripts dependencies and the new widgets php files. Props iseulde. Fixes #46429. Built from https://develop.svn.wordpress.org/trunk@44808 git-svn-id: http://core.svn.wordpress.org/trunk@44640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-07 04:09:59 -05:00
* Internal dependencies
*/
// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */
/**
* Component used as equivalent of Fragment with unescaped HTML, in cases where
* it is desirable to render dangerous HTML without needing a wrapper element.
* To preserve additional props, a `div` wrapper _will_ be created if any props
* aside from `children` are passed.
*
* @param {RawHTMLProps} props Children should be a string of HTML. Other props
* will be passed through to div wrapper.
*
* @return {JSX.Element} Dangerously-rendering component.
*/
function RawHTML({
children,
...props
}) {
// The DIV wrapper will be stripped by serializer, unless there are
// non-children props present.
return Object(external_React_["createElement"])('div', {
dangerouslySetInnerHTML: {
__html: children
},
...props
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js
/**
* Parts of this source were derived and modified from fast-react-render,
* released under the MIT license.
*
* https://github.com/alt-j/fast-react-render
*
* Copyright (c) 2016 Andrey Morozov
*
* 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.
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('./react').WPElement} WPElement */
const {
Provider,
Consumer
} = Object(external_React_["createContext"])(undefined);
const ForwardRef = Object(external_React_["forwardRef"])(() => {
Block Editor: Update the WordPress Packages to the ones used in the Gutenberg 6.5 release Updated Packages: In version 6.2: @wordpress/a11y@2.5.0 @wordpress/annotations@1.5.0 @wordpress/api-fetch@3.4.0 @wordpress/autop@2.4.0 @wordpress/babel-plugin-import-jsx-pragma@2.3.0 @wordpress/babel-plugin-makepot@3.2.0 @wordpress/babel-preset-default@4.4.0 @wordpress/blob@2.5.0 @wordpress/block-editor@3.0.0 @wordpress/block-library@2.7.0 @wordpress/block-serialization-default-parser@3.3.0 @wordpress/block-serialization-spec-parser@3.2.0 @wordpress/blocks@6.5.0 @wordpress/browserslist-config@2.6.0 @wordpress/components@8.1.0 @wordpress/compose@3.5.0 @wordpress/core-data@2.5.0 @wordpress/custom-templated-path-webpack-plugin@1.5.0 @wordpress/data-controls@1.1.0 @wordpress/data@4.7.0 @wordpress/date@3.4.0 @wordpress/dependency-extraction-webpack-plugin@1.1.0 @wordpress/deprecated@2.5.0 @wordpress/docgen@1.3.0 @wordpress/dom-ready@2.5.0 @wordpress/dom@2.4.0 @wordpress/e2e-test-utils@2.2.0 @wordpress/e2e-tests@1.4.0 @wordpress/edit-post@3.6.0 @wordpress/editor@9.5.0 @wordpress/element@2.6.0 @wordpress/escape-html@1.5.0 @wordpress/eslint-plugin@2.4.0 @wordpress/format-library@1.7.0 @wordpress/hooks@2.5.0 @wordpress/html-entities@2.5.0 @wordpress/i18n@3.6.0 @wordpress/is-shallow-equal@1.5.0 @wordpress/jest-console@3.2.0 @wordpress/jest-preset-default@4.3.0 @wordpress/jest-puppeteer-axe@1.2.0 @wordpress/keycodes@2.5.0 @wordpress/library-export-default-webpack-plugin@1.4.0 @wordpress/list-reusable-blocks@1.6.0 @wordpress/media-utils@1.0.0 @wordpress/notices@1.6.0 @wordpress/npm-package-json-lint-config@2.1.0 @wordpress/nux@3.5.0 @wordpress/plugins@2.5.0 @wordpress/postcss-themes@2.2.0 @wordpress/priority-queue@1.3.0 @wordpress/redux-routine@3.5.0 @wordpress/rich-text@3.5.0 @wordpress/scripts@3.4.0 @wordpress/server-side-render@1.1.0 @wordpress/shortcode@2.4.0 @wordpress/token-list@1.5.0 @wordpress/url@2.7.0 @wordpress/viewport@2.6.0 @wordpress/wordcount@2.5.0 In version 6.4: @wordpress/annotations@1.6.0 @wordpress/api-fetch@3.5.0 @wordpress/autop@2.5.0 @wordpress/babel-preset-default@4.5.0 @wordpress/block-editor@3.1.0 @wordpress/block-library@2.8.0 @wordpress/block-serialization-default-parser@3.4.0 @wordpress/block-serialization-spec-parser@3.3.0 @wordpress/blocks@6.6.0 @wordpress/components@8.2.0 @wordpress/compose@3.6.0 @wordpress/core-data@2.6.0 @wordpress/data-controls@1.2.0 @wordpress/data@4.8.0 @wordpress/date@3.5.0 @wordpress/dependency-extraction-webpack-plugin@1.2.0 @wordpress/deprecated@2.6.0 @wordpress/docgen@1.4.0 @wordpress/dom@2.5.0 @wordpress/e2e-test-utils@2.3.0 @wordpress/e2e-tests@1.5.0 @wordpress/edit-post@3.7.0 @wordpress/editor@9.6.0 @wordpress/element@2.7.0 @wordpress/eslint-plugin@3.0.0 @wordpress/format-library@1.8.0 @wordpress/hooks@2.6.0 @wordpress/is-shallow-equal@1.6.0 @wordpress/jest-console@3.3.0 @wordpress/jest-preset-default@5.0.0 @wordpress/jest-puppeteer-axe@1.3.0 @wordpress/keycodes@2.6.0 @wordpress/list-reusable-blocks@1.7.0 @wordpress/media-utils@1.1.0 @wordpress/notices@1.7.0 @wordpress/nux@3.6.0 @wordpress/plugins@2.6.0 @wordpress/project-management-automation@1.0.0 @wordpress/redux-routine@3.6.0 @wordpress/rich-text@3.6.0 @wordpress/scripts@4.0.0 @wordpress/server-side-render@1.2.0 @wordpress/token-list@1.6.0 @wordpress/viewport@2.7.0 @wordpress/wordcount@2.6.0 In version 6.5: @wordpress/annotations@1.7.0 @wordpress/api-fetch@3.6.0 @wordpress/babel-preset-default@4.6.0 @wordpress/block-directory@1.0.0 @wordpress/block-editor@3.2.0 @wordpress/block-library@2.9.0 @wordpress/blocks@6.7.0 @wordpress/components@8.3.0 @wordpress/compose@3.7.0 @wordpress/core-data@2.7.0 @wordpress/data-controls@1.3.0 @wordpress/data@4.9.0 @wordpress/dependency-extraction-webpack-plugin@2.0.0 @wordpress/e2e-test-utils@2.4.0 @wordpress/e2e-tests@1.7.0 @wordpress/edit-post@3.8.0 @wordpress/editor@9.7.0 @wordpress/element@2.8.0 @wordpress/eslint-plugin@3.1.0 @wordpress/format-library@1.9.0 @wordpress/list-reusable-blocks@1.8.0 @wordpress/media-utils@1.2.0 @wordpress/notices@1.8.0 @wordpress/nux@3.7.0 @wordpress/plugins@2.7.0 @wordpress/rich-text@3.7.0 @wordpress/scripts@5.0.0 @wordpress/server-side-render@1.3.0 @wordpress/url@2.8.0 @wordpress/viewport@2.8.0 Props youknowriad desrosj noisysocks pento jorgefilipecosta iseulde Fixes: #47843 Built from https://develop.svn.wordpress.org/trunk@46189 git-svn-id: http://core.svn.wordpress.org/trunk@46001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 11:19:18 -04:00
return null;
});
/**
* Valid attribute types.
*
* @type {Set<string>}
*/
const ATTRIBUTES_TYPES = new Set(['string', 'boolean', 'number']);
/**
* Element tags which can be self-closing.
*
* @type {Set<string>}
*/
const SELF_CLOSING_TAGS = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
/**
* Boolean attributes are attributes whose presence as being assigned is
* meaningful, even if only empty.
*
* See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
* Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
*
* Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]
* .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )
* .reduce( ( result, tr ) => Object.assign( result, {
* [ tr.firstChild.textContent.trim() ]: true
* } ), {} ) ).sort();
*
* @type {Set<string>}
*/
const BOOLEAN_ATTRIBUTES = new Set(['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']);
/**
* Enumerated attributes are attributes which must be of a specific value form.
* Like boolean attributes, these are meaningful if specified, even if not of a
* valid enumerated value.
*
* See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute
* Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
*
* Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ]
* .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) )
* .reduce( ( result, tr ) => Object.assign( result, {
* [ tr.firstChild.textContent.trim() ]: true
* } ), {} ) ).sort();
*
* Some notable omissions:
*
* - `alt`: https://blog.whatwg.org/omit-alt
*
* @type {Set<string>}
*/
const ENUMERATED_ATTRIBUTES = new Set(['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']);
/**
* Set of CSS style properties which support assignment of unitless numbers.
* Used in rendering of style properties, where `px` unit is assumed unless
* property is included in this set or value is zero.
*
* Generated via:
*
* Object.entries( document.createElement( 'div' ).style )
* .filter( ( [ key ] ) => (
* ! /^(webkit|ms|moz)/.test( key ) &&
* ( e.style[ key ] = 10 ) &&
* e.style[ key ] === '10'
* ) )
* .map( ( [ key ] ) => key )
* .sort();
*
* @type {Set<string>}
*/
const CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set(['animation', 'animationIterationCount', 'baselineShift', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'columnCount', 'cx', 'cy', 'fillOpacity', 'flexGrow', 'flexShrink', 'floodOpacity', 'fontWeight', 'gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'r', 'rx', 'ry', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'widows', 'x', 'y', 'zIndex', 'zoom']);
/**
* Returns true if the specified string is prefixed by one of an array of
* possible prefixes.
*
* @param {string} string String to check.
* @param {string[]} prefixes Possible prefixes.
*
* @return {boolean} Whether string has prefix.
*/
function hasPrefix(string, prefixes) {
return prefixes.some(prefix => string.indexOf(prefix) === 0);
}
/**
* Returns true if the given prop name should be ignored in attributes
* serialization, or false otherwise.
*
* @param {string} attribute Attribute to check.
*
* @return {boolean} Whether attribute should be ignored.
*/
function isInternalAttribute(attribute) {
return 'key' === attribute || 'children' === attribute;
}
/**
* Returns the normal form of the element's attribute value for HTML.
*
* @param {string} attribute Attribute name.
* @param {*} value Non-normalized attribute value.
*
* @return {*} Normalized attribute value.
*/
function getNormalAttributeValue(attribute, value) {
switch (attribute) {
case 'style':
return renderStyle(value);
}
return value;
}
/**
* Returns the normal form of the element's attribute name for HTML.
*
* @param {string} attribute Non-normalized attribute name.
*
* @return {string} Normalized attribute name.
*/
function getNormalAttributeName(attribute) {
switch (attribute) {
case 'htmlFor':
return 'for';
case 'className':
return 'class';
}
return attribute.toLowerCase();
}
/**
* Returns the normal form of the style property name for HTML.
*
* - Converts property names to kebab-case, e.g. 'backgroundColor' 'background-color'
* - Leaves custom attributes alone, e.g. '--myBackgroundColor' '--myBackgroundColor'
* - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' '-moz-transform'
*
* @param {string} property Property name.
*
* @return {string} Normalized property name.
*/
function getNormalStylePropertyName(property) {
if (Object(external_lodash_["startsWith"])(property, '--')) {
return property;
}
if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) {
return '-' + Object(external_lodash_["kebabCase"])(property);
}
return Object(external_lodash_["kebabCase"])(property);
}
/**
* Returns the normal form of the style property value for HTML. Appends a
* default pixel unit if numeric, not a unitless property, and not zero.
*
* @param {string} property Property name.
* @param {*} value Non-normalized property value.
*
* @return {*} Normalized property value.
*/
function getNormalStylePropertyValue(property, value) {
if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) {
return value + 'px';
}
return value;
}
/**
* Serializes a React element to string.
*
* @param {import('react').ReactNode} element Element to serialize.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
*
* @return {string} Serialized element.
*/
function renderElement(element, context, legacyContext = {}) {
if (null === element || undefined === element || false === element) {
return '';
}
if (Array.isArray(element)) {
return renderChildren(element, context, legacyContext);
}
switch (typeof element) {
case 'string':
return Object(external_wp_escapeHtml_["escapeHTML"])(element);
case 'number':
return element.toString();
}
const {
type,
props
} =
/** @type {{type?: any, props?: any}} */
element;
switch (type) {
case external_React_["StrictMode"]:
case external_React_["Fragment"]:
return renderChildren(props.children, context, legacyContext);
case RawHTML:
const {
children,
...wrapperProps
} = props;
return renderNativeComponent(Object(external_lodash_["isEmpty"])(wrapperProps) ? null : 'div', { ...wrapperProps,
dangerouslySetInnerHTML: {
__html: children
}
}, context, legacyContext);
}
switch (typeof type) {
case 'string':
return renderNativeComponent(type, props, context, legacyContext);
case 'function':
if (type.prototype && typeof type.prototype.render === 'function') {
return renderComponent(type, props, context, legacyContext);
}
return renderElement(type(props, legacyContext), context, legacyContext);
}
switch (type && type.$$typeof) {
case Provider.$$typeof:
return renderChildren(props.children, props.value, legacyContext);
case Consumer.$$typeof:
return renderElement(props.children(context || type._currentValue), context, legacyContext);
Block Editor: Update the WordPress Packages to the ones used in the Gutenberg 6.5 release Updated Packages: In version 6.2: @wordpress/a11y@2.5.0 @wordpress/annotations@1.5.0 @wordpress/api-fetch@3.4.0 @wordpress/autop@2.4.0 @wordpress/babel-plugin-import-jsx-pragma@2.3.0 @wordpress/babel-plugin-makepot@3.2.0 @wordpress/babel-preset-default@4.4.0 @wordpress/blob@2.5.0 @wordpress/block-editor@3.0.0 @wordpress/block-library@2.7.0 @wordpress/block-serialization-default-parser@3.3.0 @wordpress/block-serialization-spec-parser@3.2.0 @wordpress/blocks@6.5.0 @wordpress/browserslist-config@2.6.0 @wordpress/components@8.1.0 @wordpress/compose@3.5.0 @wordpress/core-data@2.5.0 @wordpress/custom-templated-path-webpack-plugin@1.5.0 @wordpress/data-controls@1.1.0 @wordpress/data@4.7.0 @wordpress/date@3.4.0 @wordpress/dependency-extraction-webpack-plugin@1.1.0 @wordpress/deprecated@2.5.0 @wordpress/docgen@1.3.0 @wordpress/dom-ready@2.5.0 @wordpress/dom@2.4.0 @wordpress/e2e-test-utils@2.2.0 @wordpress/e2e-tests@1.4.0 @wordpress/edit-post@3.6.0 @wordpress/editor@9.5.0 @wordpress/element@2.6.0 @wordpress/escape-html@1.5.0 @wordpress/eslint-plugin@2.4.0 @wordpress/format-library@1.7.0 @wordpress/hooks@2.5.0 @wordpress/html-entities@2.5.0 @wordpress/i18n@3.6.0 @wordpress/is-shallow-equal@1.5.0 @wordpress/jest-console@3.2.0 @wordpress/jest-preset-default@4.3.0 @wordpress/jest-puppeteer-axe@1.2.0 @wordpress/keycodes@2.5.0 @wordpress/library-export-default-webpack-plugin@1.4.0 @wordpress/list-reusable-blocks@1.6.0 @wordpress/media-utils@1.0.0 @wordpress/notices@1.6.0 @wordpress/npm-package-json-lint-config@2.1.0 @wordpress/nux@3.5.0 @wordpress/plugins@2.5.0 @wordpress/postcss-themes@2.2.0 @wordpress/priority-queue@1.3.0 @wordpress/redux-routine@3.5.0 @wordpress/rich-text@3.5.0 @wordpress/scripts@3.4.0 @wordpress/server-side-render@1.1.0 @wordpress/shortcode@2.4.0 @wordpress/token-list@1.5.0 @wordpress/url@2.7.0 @wordpress/viewport@2.6.0 @wordpress/wordcount@2.5.0 In version 6.4: @wordpress/annotations@1.6.0 @wordpress/api-fetch@3.5.0 @wordpress/autop@2.5.0 @wordpress/babel-preset-default@4.5.0 @wordpress/block-editor@3.1.0 @wordpress/block-library@2.8.0 @wordpress/block-serialization-default-parser@3.4.0 @wordpress/block-serialization-spec-parser@3.3.0 @wordpress/blocks@6.6.0 @wordpress/components@8.2.0 @wordpress/compose@3.6.0 @wordpress/core-data@2.6.0 @wordpress/data-controls@1.2.0 @wordpress/data@4.8.0 @wordpress/date@3.5.0 @wordpress/dependency-extraction-webpack-plugin@1.2.0 @wordpress/deprecated@2.6.0 @wordpress/docgen@1.4.0 @wordpress/dom@2.5.0 @wordpress/e2e-test-utils@2.3.0 @wordpress/e2e-tests@1.5.0 @wordpress/edit-post@3.7.0 @wordpress/editor@9.6.0 @wordpress/element@2.7.0 @wordpress/eslint-plugin@3.0.0 @wordpress/format-library@1.8.0 @wordpress/hooks@2.6.0 @wordpress/is-shallow-equal@1.6.0 @wordpress/jest-console@3.3.0 @wordpress/jest-preset-default@5.0.0 @wordpress/jest-puppeteer-axe@1.3.0 @wordpress/keycodes@2.6.0 @wordpress/list-reusable-blocks@1.7.0 @wordpress/media-utils@1.1.0 @wordpress/notices@1.7.0 @wordpress/nux@3.6.0 @wordpress/plugins@2.6.0 @wordpress/project-management-automation@1.0.0 @wordpress/redux-routine@3.6.0 @wordpress/rich-text@3.6.0 @wordpress/scripts@4.0.0 @wordpress/server-side-render@1.2.0 @wordpress/token-list@1.6.0 @wordpress/viewport@2.7.0 @wordpress/wordcount@2.6.0 In version 6.5: @wordpress/annotations@1.7.0 @wordpress/api-fetch@3.6.0 @wordpress/babel-preset-default@4.6.0 @wordpress/block-directory@1.0.0 @wordpress/block-editor@3.2.0 @wordpress/block-library@2.9.0 @wordpress/blocks@6.7.0 @wordpress/components@8.3.0 @wordpress/compose@3.7.0 @wordpress/core-data@2.7.0 @wordpress/data-controls@1.3.0 @wordpress/data@4.9.0 @wordpress/dependency-extraction-webpack-plugin@2.0.0 @wordpress/e2e-test-utils@2.4.0 @wordpress/e2e-tests@1.7.0 @wordpress/edit-post@3.8.0 @wordpress/editor@9.7.0 @wordpress/element@2.8.0 @wordpress/eslint-plugin@3.1.0 @wordpress/format-library@1.9.0 @wordpress/list-reusable-blocks@1.8.0 @wordpress/media-utils@1.2.0 @wordpress/notices@1.8.0 @wordpress/nux@3.7.0 @wordpress/plugins@2.7.0 @wordpress/rich-text@3.7.0 @wordpress/scripts@5.0.0 @wordpress/server-side-render@1.3.0 @wordpress/url@2.8.0 @wordpress/viewport@2.8.0 Props youknowriad desrosj noisysocks pento jorgefilipecosta iseulde Fixes: #47843 Built from https://develop.svn.wordpress.org/trunk@46189 git-svn-id: http://core.svn.wordpress.org/trunk@46001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 11:19:18 -04:00
case ForwardRef.$$typeof:
return renderElement(type.render(props), context, legacyContext);
}
return '';
}
/**
* Serializes a native component type to string.
*
* @param {?string} type Native component type to serialize, or null if
* rendering as fragment of children content.
* @param {Object} props Props object.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
*
* @return {string} Serialized element.
*/
function renderNativeComponent(type, props, context, legacyContext = {}) {
let content = '';
if (type === 'textarea' && props.hasOwnProperty('value')) {
// Textarea children can be assigned as value prop. If it is, render in
// place of children. Ensure to omit so it is not assigned as attribute
// as well.
content = renderChildren(props.value, context, legacyContext);
props = Object(external_lodash_["omit"])(props, 'value');
} else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') {
// Dangerous content is left unescaped.
content = props.dangerouslySetInnerHTML.__html;
} else if (typeof props.children !== 'undefined') {
content = renderChildren(props.children, context, legacyContext);
}
if (!type) {
return content;
}
const attributes = renderAttributes(props);
if (SELF_CLOSING_TAGS.has(type)) {
return '<' + type + attributes + '/>';
}
return '<' + type + attributes + '>' + content + '</' + type + '>';
}
/** @typedef {import('./react').WPComponent} WPComponent */
/**
* Serializes a non-native component type to string.
*
* @param {WPComponent} Component Component type to serialize.
* @param {Object} props Props object.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
*
* @return {string} Serialized element
*/
function renderComponent(Component, props, context, legacyContext = {}) {
const instance = new
/** @type {import('react').ComponentClass} */
Component(props, legacyContext);
if (typeof // Ignore reason: Current prettier reformats parens and mangles type assertion
// prettier-ignore
/** @type {{getChildContext?: () => unknown}} */
instance.getChildContext === 'function') {
Object.assign(legacyContext,
/** @type {{getChildContext?: () => unknown}} */
instance.getChildContext());
}
const html = renderElement(instance.render(), context, legacyContext);
return html;
}
/**
* Serializes an array of children to string.
*
* @param {import('react').ReactNodeArray} children Children to serialize.
* @param {Object} [context] Context object.
* @param {Object} [legacyContext] Legacy context object.
*
* @return {string} Serialized children.
*/
function renderChildren(children, context, legacyContext = {}) {
let result = '';
children = Object(external_lodash_["castArray"])(children);
for (let i = 0; i < children.length; i++) {
const child = children[i];
result += renderElement(child, context, legacyContext);
}
return result;
}
/**
* Renders a props object as a string of HTML attributes.
*
* @param {Object} props Props object.
*
* @return {string} Attributes string.
*/
function renderAttributes(props) {
let result = '';
for (const key in props) {
const attribute = getNormalAttributeName(key);
if (!Object(external_wp_escapeHtml_["isValidAttributeName"])(attribute)) {
continue;
}
let value = getNormalAttributeValue(key, props[key]); // If value is not of serializeable type, skip.
if (!ATTRIBUTES_TYPES.has(typeof value)) {
continue;
} // Don't render internal attribute names.
if (isInternalAttribute(key)) {
continue;
}
const isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute); // Boolean attribute should be omitted outright if its value is false.
if (isBooleanAttribute && value === false) {
continue;
}
const isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute); // Only write boolean value as attribute if meaningful.
if (typeof value === 'boolean' && !isMeaningfulAttribute) {
continue;
}
result += ' ' + attribute; // Boolean attributes should write attribute name, but without value.
// Mere presence of attribute name is effective truthiness.
if (isBooleanAttribute) {
continue;
}
if (typeof value === 'string') {
value = Object(external_wp_escapeHtml_["escapeAttribute"])(value);
}
result += '="' + value + '"';
}
return result;
}
/**
* Renders a style object as a string attribute value.
*
* @param {Object} style Style object.
*
* @return {string} Style attribute value.
*/
function renderStyle(style) {
// Only generate from object, e.g. tolerate string value.
if (!Object(external_lodash_["isPlainObject"])(style)) {
return style;
}
let result;
for (const property in style) {
const value = style[property];
if (null === value || undefined === value) {
continue;
}
if (result) {
result += ';';
} else {
result = '';
}
const normalName = getNormalStylePropertyName(property);
const normalValue = getNormalStylePropertyValue(property, value);
result += normalName + ':' + normalValue;
}
return result;
}
/* harmony default export */ var serialize = (renderElement);
// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js
2020-01-08 06:57:23 -05:00
/***/ })
/******/ });