--- a/wp/wp-includes/js/dist/element.js Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/js/dist/element.js Tue Sep 27 16:37:53 2022 +0200
@@ -1,167 +1,83 @@
-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: {}
+/******/ (function() { // webpackBootstrap
+/******/ "use strict";
+/******/ // The require scope
+/******/ var __webpack_require__ = {};
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ !function() {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = function(exports, definition) {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
/******/ };
-/******/
-/******/ // 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");
-/******/ })
+/******/ }();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ !function() {
+/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ }();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ !function() {
+/******/ // 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 });
+/******/ };
+/******/ }();
+/******/
/************************************************************************/
-/******/ ({
-
-/***/ "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";
+var __webpack_exports__ = {};
// 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; });
+__webpack_require__.d(__webpack_exports__, {
+ "Children": function() { return /* reexport */ external_React_namespaceObject.Children; },
+ "Component": function() { return /* reexport */ external_React_namespaceObject.Component; },
+ "Fragment": function() { return /* reexport */ external_React_namespaceObject.Fragment; },
+ "Platform": function() { return /* reexport */ platform; },
+ "RawHTML": function() { return /* reexport */ RawHTML; },
+ "StrictMode": function() { return /* reexport */ external_React_namespaceObject.StrictMode; },
+ "Suspense": function() { return /* reexport */ external_React_namespaceObject.Suspense; },
+ "cloneElement": function() { return /* reexport */ external_React_namespaceObject.cloneElement; },
+ "concatChildren": function() { return /* reexport */ concatChildren; },
+ "createContext": function() { return /* reexport */ external_React_namespaceObject.createContext; },
+ "createElement": function() { return /* reexport */ external_React_namespaceObject.createElement; },
+ "createInterpolateElement": function() { return /* reexport */ create_interpolate_element; },
+ "createPortal": function() { return /* reexport */ external_ReactDOM_namespaceObject.createPortal; },
+ "createRef": function() { return /* reexport */ external_React_namespaceObject.createRef; },
+ "findDOMNode": function() { return /* reexport */ external_ReactDOM_namespaceObject.findDOMNode; },
+ "forwardRef": function() { return /* reexport */ external_React_namespaceObject.forwardRef; },
+ "isEmptyElement": function() { return /* reexport */ isEmptyElement; },
+ "isValidElement": function() { return /* reexport */ external_React_namespaceObject.isValidElement; },
+ "lazy": function() { return /* reexport */ external_React_namespaceObject.lazy; },
+ "memo": function() { return /* reexport */ external_React_namespaceObject.memo; },
+ "render": function() { return /* reexport */ external_ReactDOM_namespaceObject.render; },
+ "renderToString": function() { return /* reexport */ serialize; },
+ "switchChildrenNodeName": function() { return /* reexport */ switchChildrenNodeName; },
+ "unmountComponentAtNode": function() { return /* reexport */ external_ReactDOM_namespaceObject.unmountComponentAtNode; },
+ "useCallback": function() { return /* reexport */ external_React_namespaceObject.useCallback; },
+ "useContext": function() { return /* reexport */ external_React_namespaceObject.useContext; },
+ "useDebugValue": function() { return /* reexport */ external_React_namespaceObject.useDebugValue; },
+ "useEffect": function() { return /* reexport */ external_React_namespaceObject.useEffect; },
+ "useImperativeHandle": function() { return /* reexport */ external_React_namespaceObject.useImperativeHandle; },
+ "useLayoutEffect": function() { return /* reexport */ external_React_namespaceObject.useLayoutEffect; },
+ "useMemo": function() { return /* reexport */ external_React_namespaceObject.useMemo; },
+ "useReducer": function() { return /* reexport */ external_React_namespaceObject.useReducer; },
+ "useRef": function() { return /* reexport */ external_React_namespaceObject.useRef; },
+ "useState": function() { return /* reexport */ external_React_namespaceObject.useState; }
+});
-// EXTERNAL MODULE: external "React"
-var external_React_ = __webpack_require__("cDcd");
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js
+;// CONCATENATED MODULE: external "React"
+var external_React_namespaceObject = window["React"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js
/**
* Internal dependencies
*/
@@ -191,17 +107,17 @@
*
* @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.
+ * @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.
*/
/**
@@ -257,9 +173,9 @@
* }
* ```
*
- * @param {string} interpolatedString The interpolation string to be parsed.
- * @param {Object} conversionMap The map used to convert the string to
- * a react element.
+ * @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.
*/
@@ -279,7 +195,7 @@
do {// twiddle our thumbs
} while (proceed(conversionMap));
- return Object(external_React_["createElement"])(external_React_["Fragment"], null, ...output);
+ return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, ...output);
};
/**
* Validate conversion map.
@@ -289,7 +205,7 @@
*
* @private
*
- * @param {Object} conversionMap The map being validated.
+ * @param {Object} conversionMap The map being validated.
*
* @return {boolean} True means the map is valid.
*/
@@ -298,7 +214,7 @@
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));
+ return isObject && values.length && values.every(element => (0,external_React_namespaceObject.isValidElement)(element));
};
/**
* This is the iterator over the matches in the string.
@@ -344,7 +260,7 @@
output.push(conversionMap[name]);
offset = startOffset + tokenLength;
return true;
- } // otherwise we found an inner element
+ } // Otherwise we found an inner element.
addChild(createFrame(conversionMap[name], startOffset, tokenLength));
@@ -357,13 +273,13 @@
return true;
case 'closer':
- // if we're not nesting then this is easy - close the block
+ // 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
+ } // 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();
@@ -391,7 +307,7 @@
function nextToken() {
- const matches = tokenizer.exec(indoc); // we have no more tokens
+ const matches = tokenizer.exec(indoc); // We have no more tokens.
if (null === matches) {
return ['no-more-tokens'];
@@ -435,8 +351,8 @@
*
* @private
*
- * @param {Frame} frame The Frame containing the child element and it's
- * token information.
+ * @param {Frame} frame The Frame containing the child element and it's
+ * token information.
*/
@@ -455,7 +371,7 @@
parent.children.push(text);
}
- parent.children.push(Object(external_React_["cloneElement"])(element, null, ...children));
+ parent.children.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children));
parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;
}
/**
@@ -490,19 +406,18 @@
output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart));
}
- output.push(Object(external_React_["cloneElement"])(element, null, ...children));
+ output.push((0,external_React_namespaceObject.cloneElement)(element, null, ...children));
}
/* 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
+;// CONCATENATED MODULE: external "lodash"
+var external_lodash_namespaceObject = window["lodash"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js
/**
* External dependencies
*/
-// eslint-disable-next-line no-restricted-imports
+// eslint-disable-next-line @typescript-eslint/no-restricted-imports
/**
@@ -680,11 +595,15 @@
* @return {Array} The concatenated value.
*/
-function concatChildren(...childrenArguments) {
+function concatChildren() {
+ for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) {
+ childrenArguments[_key] = arguments[_key];
+ }
+
return childrenArguments.reduce((accumulator, children, i) => {
- external_React_["Children"].forEach(children, (child, j) => {
+ external_React_namespaceObject.Children.forEach(children, (child, j) => {
if (child && 'string' !== typeof child) {
- child = Object(external_React_["cloneElement"])(child, {
+ child = (0,external_React_namespaceObject.cloneElement)(child, {
key: [i, j].join()
});
}
@@ -704,9 +623,9 @@
*/
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, {
+ return children && external_React_namespaceObject.Children.map(children, (elt, index) => {
+ if ((0,external_lodash_namespaceObject.isString)(elt)) {
+ return (0,external_React_namespaceObject.createElement)(nodeName, {
key: index
}, elt);
}
@@ -715,17 +634,16 @@
children: childrenProp,
...props
} = elt.props;
- return Object(external_React_["createElement"])(nodeName, {
+ return (0,external_React_namespaceObject.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
+;// CONCATENATED MODULE: external "ReactDOM"
+var external_ReactDOM_namespaceObject = window["ReactDOM"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js
/**
* External dependencies
*/
@@ -735,9 +653,9 @@
*
* @see https://github.com/facebook/react/issues/10309#issuecomment-318433235
*
- * @param {import('./react').WPElement} child Any renderable child, such as an element,
- * string, or fragment.
- * @param {HTMLElement} container DOM node into which element should be rendered.
+ * @param {import('./react').WPElement} child Any renderable child, such as an element,
+ * string, or fragment.
+ * @param {HTMLElement} container DOM node into which element should be rendered.
*/
@@ -751,8 +669,8 @@
/**
* Renders a given element into the target DOM node.
*
- * @param {import('./react').WPElement} element Element to render.
- * @param {HTMLElement} target DOM node into which element should be rendered.
+ * @param {import('./react').WPElement} element Element to render.
+ * @param {HTMLElement} target DOM node into which element should be rendered.
*/
@@ -764,7 +682,7 @@
-// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js
/**
* External dependencies
*/
@@ -777,18 +695,18 @@
*/
const isEmptyElement = element => {
- if (Object(external_lodash_["isNumber"])(element)) {
+ if ((0,external_lodash_namespaceObject.isNumber)(element)) {
return false;
}
- if (Object(external_lodash_["isString"])(element) || Object(external_lodash_["isArray"])(element)) {
+ if ((0,external_lodash_namespaceObject.isString)(element) || (0,external_lodash_namespaceObject.isArray)(element)) {
return !element.length;
}
return !element;
};
-// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js
+;// 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.
@@ -799,7 +717,8 @@
*/
const Platform = {
OS: 'web',
- select: spec => 'web' in spec ? spec.web : spec.default
+ select: spec => 'web' in spec ? spec.web : spec.default,
+ isWeb: true
};
/**
* Component used to detect the current Platform being used.
@@ -823,10 +742,9 @@
/* 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
+;// CONCATENATED MODULE: external ["wp","escapeHtml"]
+var external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
+;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js
/**
* Internal dependencies
*/
@@ -840,27 +758,36 @@
* 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.
+ * @param {RawHTMLProps} props Children should be a string of HTML or an array
+ * of strings. Other props will be passed through
+ * to the 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', {
+function RawHTML(_ref) {
+ let {
+ children,
+ ...props
+ } = _ref;
+ let rawHtml = ''; // Cast children as an array, and concatenate each element if it is a string.
+
+ external_React_namespaceObject.Children.toArray(children).forEach(child => {
+ if (typeof child === 'string' && child.trim() !== '') {
+ rawHtml += child;
+ }
+ }); // The `div` wrapper will be stripped by the `renderElement` serializer in
+ // `./serialize.js` unless there are non-children props present.
+
+ return (0,external_React_namespaceObject.createElement)('div', {
dangerouslySetInnerHTML: {
- __html: children
+ __html: rawHtml
},
...props
});
}
-// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js
+;// 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.
@@ -908,8 +835,8 @@
const {
Provider,
Consumer
-} = Object(external_React_["createContext"])(undefined);
-const ForwardRef = Object(external_React_["forwardRef"])(() => {
+} = (0,external_React_namespaceObject.createContext)(undefined);
+const ForwardRef = (0,external_React_namespaceObject.forwardRef)(() => {
return null;
});
/**
@@ -1029,6 +956,40 @@
return value;
}
/**
+ * This is a map of all SVG attributes that have dashes. Map(lower case prop => dashed lower case attribute).
+ * We need this to render e.g strokeWidth as stroke-width.
+ *
+ * List from: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute.
+ */
+
+
+const SVG_ATTRIBUTE_WITH_DASHES_LIST = ['accentHeight', 'alignmentBaseline', 'arabicForm', 'baselineShift', 'capHeight', 'clipPath', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'dominantBaseline', 'enableBackground', 'fillOpacity', 'fillRule', 'floodColor', 'floodOpacity', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'horizAdvX', 'horizOriginX', 'imageRendering', 'letterSpacing', 'lightingColor', 'markerEnd', 'markerMid', 'markerStart', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pointerEvents', 'renderingIntent', 'shapeRendering', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'textAnchor', 'textDecoration', 'textRendering', 'underlinePosition', 'underlineThickness', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'vHanging', 'vIdeographic', 'vMathematical', 'vectorEffect', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'wordSpacing', 'writingMode', 'xmlnsXlink', 'xHeight'].reduce((map, attribute) => {
+ // The keys are lower-cased for more robust lookup.
+ map[attribute.toLowerCase()] = attribute;
+ return map;
+}, {});
+/**
+ * This is a map of all case-sensitive SVG attributes. Map(lowercase key => proper case attribute).
+ * The keys are lower-cased for more robust lookup.
+ * Note that this list only contains attributes that contain at least one capital letter.
+ * Lowercase attributes don't need mapping, since we lowercase all attributes by default.
+ */
+
+const CASE_SENSITIVE_SVG_ATTRIBUTES = ['allowReorder', 'attributeName', 'attributeType', 'autoReverse', 'baseFrequency', 'baseProfile', 'calcMode', 'clipPathUnits', 'contentScriptType', 'contentStyleType', 'diffuseConstant', 'edgeMode', 'externalResourcesRequired', 'filterRes', 'filterUnits', 'glyphRef', 'gradientTransform', 'gradientUnits', 'kernelMatrix', 'kernelUnitLength', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'limitingConeAngle', 'markerHeight', 'markerUnits', 'markerWidth', 'maskContentUnits', 'maskUnits', 'numOctaves', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'refX', 'refY', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'specularConstant', 'specularExponent', 'spreadMethod', 'startOffset', 'stdDeviation', 'stitchTiles', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textLength', 'viewBox', 'viewTarget', 'xChannelSelector', 'yChannelSelector'].reduce((map, attribute) => {
+ // The keys are lower-cased for more robust lookup.
+ map[attribute.toLowerCase()] = attribute;
+ return map;
+}, {});
+/**
+ * This is a map of all SVG attributes that have colons.
+ * Keys are lower-cased and stripped of their colons for more robust lookup.
+ */
+
+const SVG_ATTRIBUTES_WITH_COLONS = ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'xmlns:xlink'].reduce((map, attribute) => {
+ map[attribute.replace(':', '').toLowerCase()] = attribute;
+ return map;
+}, {});
+/**
* Returns the normal form of the element's attribute name for HTML.
*
* @param {string} attribute Non-normalized attribute name.
@@ -1036,7 +997,6 @@
* @return {string} Normalized attribute name.
*/
-
function getNormalAttributeName(attribute) {
switch (attribute) {
case 'htmlFor':
@@ -1046,7 +1006,17 @@
return 'class';
}
- return attribute.toLowerCase();
+ const attributeLowerCase = attribute.toLowerCase();
+
+ if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) {
+ return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase];
+ } else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) {
+ return (0,external_lodash_namespaceObject.kebabCase)(SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]);
+ } else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) {
+ return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase];
+ }
+
+ return attributeLowerCase;
}
/**
* Returns the normal form of the style property name for HTML.
@@ -1062,15 +1032,15 @@
function getNormalStylePropertyName(property) {
- if (Object(external_lodash_["startsWith"])(property, '--')) {
+ if ((0,external_lodash_namespaceObject.startsWith)(property, '--')) {
return property;
}
if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) {
- return '-' + Object(external_lodash_["kebabCase"])(property);
+ return '-' + (0,external_lodash_namespaceObject.kebabCase)(property);
}
- return Object(external_lodash_["kebabCase"])(property);
+ return (0,external_lodash_namespaceObject.kebabCase)(property);
}
/**
* Returns the normal form of the style property value for HTML. Appends a
@@ -1101,7 +1071,9 @@
*/
-function renderElement(element, context, legacyContext = {}) {
+function renderElement(element, context) {
+ let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+
if (null === element || undefined === element || false === element) {
return '';
}
@@ -1112,7 +1084,7 @@
switch (typeof element) {
case 'string':
- return Object(external_wp_escapeHtml_["escapeHTML"])(element);
+ return (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(element);
case 'number':
return element.toString();
@@ -1126,8 +1098,8 @@
element;
switch (type) {
- case external_React_["StrictMode"]:
- case external_React_["Fragment"]:
+ case external_React_namespaceObject.StrictMode:
+ case external_React_namespaceObject.Fragment:
return renderChildren(props.children, context, legacyContext);
case RawHTML:
@@ -1135,7 +1107,7 @@
children,
...wrapperProps
} = props;
- return renderNativeComponent(Object(external_lodash_["isEmpty"])(wrapperProps) ? null : 'div', { ...wrapperProps,
+ return renderNativeComponent((0,external_lodash_namespaceObject.isEmpty)(wrapperProps) ? null : 'div', { ...wrapperProps,
dangerouslySetInnerHTML: {
__html: children
}
@@ -1179,7 +1151,8 @@
* @return {string} Serialized element.
*/
-function renderNativeComponent(type, props, context, legacyContext = {}) {
+function renderNativeComponent(type, props, context) {
+ let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
let content = '';
if (type === 'textarea' && props.hasOwnProperty('value')) {
@@ -1187,7 +1160,7 @@
// 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');
+ props = (0,external_lodash_namespaceObject.omit)(props, 'value');
} else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') {
// Dangerous content is left unescaped.
content = props.dangerouslySetInnerHTML.__html;
@@ -1220,7 +1193,8 @@
* @return {string} Serialized element
*/
-function renderComponent(Component, props, context, legacyContext = {}) {
+function renderComponent(Component, props, context) {
+ let legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
const instance = new
/** @type {import('react').ComponentClass} */
Component(props, legacyContext);
@@ -1248,9 +1222,10 @@
* @return {string} Serialized children.
*/
-function renderChildren(children, context, legacyContext = {}) {
+function renderChildren(children, context) {
+ let legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let result = '';
- children = Object(external_lodash_["castArray"])(children);
+ children = (0,external_lodash_namespaceObject.castArray)(children);
for (let i = 0; i < children.length; i++) {
const child = children[i];
@@ -1274,7 +1249,7 @@
for (const key in props) {
const attribute = getNormalAttributeName(key);
- if (!Object(external_wp_escapeHtml_["isValidAttributeName"])(attribute)) {
+ if (!(0,external_wp_escapeHtml_namespaceObject.isValidAttributeName)(attribute)) {
continue;
}
@@ -1309,7 +1284,7 @@
}
if (typeof value === 'string') {
- value = Object(external_wp_escapeHtml_["escapeAttribute"])(value);
+ value = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(value);
}
result += '="' + value + '"';
@@ -1327,7 +1302,7 @@
function renderStyle(style) {
// Only generate from object, e.g. tolerate string value.
- if (!Object(external_lodash_["isPlainObject"])(style)) {
+ if (!(0,external_lodash_namespaceObject.isPlainObject)(style)) {
return style;
}
@@ -1355,7 +1330,7 @@
}
/* harmony default export */ var serialize = (renderElement);
-// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js
+;// CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js
@@ -1364,7 +1339,6 @@
-
-/***/ })
-
-/******/ });
\ No newline at end of file
+(window.wp = window.wp || {}).element = __webpack_exports__;
+/******/ })()
+;
\ No newline at end of file