--- a/wp/wp-includes/js/dist/blocks.js Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/js/dist/blocks.js Tue Dec 15 13:49:49 2020 +0100
@@ -82,7 +82,7 @@
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 362);
+/******/ return __webpack_require__(__webpack_require__.s = 441);
/******/ })
/************************************************************************/
/******/ ({
@@ -101,7 +101,162 @@
/***/ }),
-/***/ 10:
+/***/ 103:
+/***/ (function(module, exports) {
+
+(function() { module.exports = this["wp"]["autop"]; }());
+
+/***/ }),
+
+/***/ 125:
+/***/ (function(module, exports) {
+
+(function() { module.exports = this["wp"]["shortcode"]; }());
+
+/***/ }),
+
+/***/ 14:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
+
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
+var arrayWithHoles = __webpack_require__(38);
+
+// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
+function _iterableToArrayLimit(arr, i) {
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _e = undefined;
+
+ try {
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+
+ if (i && _arr.length === i) break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"] != null) _i["return"]();
+ } finally {
+ if (_d) throw _e;
+ }
+ }
+
+ return _arr;
+}
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
+var unsupportedIterableToArray = __webpack_require__(29);
+
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
+var nonIterableRest = __webpack_require__(39);
+
+// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
+
+
+
+
+function _slicedToArray(arr, i) {
+ return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
+}
+
+/***/ }),
+
+/***/ 146:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toArray; });
+/* harmony import */ var _arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38);
+/* harmony import */ var _iterableToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(35);
+/* harmony import */ var _unsupportedIterableToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29);
+/* harmony import */ var _nonIterableRest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39);
+
+
+
+
+function _toArray(arr) {
+ return Object(_arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(arr) || Object(_iterableToArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(arr) || Object(_unsupportedIterableToArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(arr) || Object(_nonIterableRest__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])();
+}
+
+/***/ }),
+
+/***/ 18:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
+
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
+var arrayLikeToArray = __webpack_require__(26);
+
+// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
+
+function _arrayWithoutHoles(arr) {
+ if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
+}
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
+var iterableToArray = __webpack_require__(35);
+
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
+var unsupportedIterableToArray = __webpack_require__(29);
+
+// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
+function _nonIterableSpread() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
+
+
+
+
+function _toConsumableArray(arr) {
+ return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
+}
+
+/***/ }),
+
+/***/ 19:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+}
+
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) _defineProperties(Constructor, staticProps);
+ return Constructor;
+}
+
+/***/ }),
+
+/***/ 2:
+/***/ (function(module, exports) {
+
+(function() { module.exports = this["lodash"]; }());
+
+/***/ }),
+
+/***/ 20:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -114,111 +269,59 @@
/***/ }),
-/***/ 134:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["shortcode"]; }());
-
-/***/ }),
-
-/***/ 15:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
-function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
-}
-
-/***/ }),
-
-/***/ 17:
+/***/ 202:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
-function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
-
- return arr2;
- }
-}
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
-var iterableToArray = __webpack_require__(34);
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
-}
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
-
-
-
-function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
+/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
+/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
+/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
+/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
+
+
+/**
+ * WordPress dependencies
+ */
+
+var blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
+ xmlns: "http://www.w3.org/2000/svg",
+ viewBox: "0 0 24 24"
+}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
+ d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
+}));
+/* harmony default export */ __webpack_exports__["a"] = (blockDefault);
+
+
+/***/ }),
+
+/***/ 26:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
+function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
+ arr2[i] = arr[i];
+ }
+
+ return arr2;
}
/***/ }),
-/***/ 19:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
-function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
-
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
-
- return target;
- };
-
- return _extends.apply(this, arguments);
-}
-
-/***/ }),
-
-/***/ 2:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["lodash"]; }());
-
-/***/ }),
-
-/***/ 205:
+/***/ 268:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["blockSerializationDefaultParser"]; }());
/***/ }),
-/***/ 206:
+/***/ 269:
/***/ (function(module, exports, __webpack_require__) {
-var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.0 - 10-11-2018 */
+var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.1 - 02-11-2019 */
(function(){
/**
* Created by Tivie on 13-07-2015.
@@ -1190,7 +1293,7 @@
* POLYFILLS
*/
// use this instead of builtin is undefined for IE8 compatibility
-if (typeof(console) === 'undefined') {
+if (typeof console === 'undefined') {
console = {
warn: function (msg) {
'use strict';
@@ -2445,10 +2548,10 @@
*/
setConvFlavor = setFlavor,
- /**
- * Metadata of the document
- * @type {{parsed: {}, raw: string, format: string}}
- */
+ /**
+ * Metadata of the document
+ * @type {{parsed: {}, raw: string, format: string}}
+ */
metadata = {
parsed: {},
raw: '',
@@ -2507,7 +2610,7 @@
'Please inform the developer that the extension should be updated!');
legacyExtensionLoading(showdown.extensions[ext], ext);
return;
- // END LEGACY SUPPORT CODE
+ // END LEGACY SUPPORT CODE
} else if (!showdown.helper.isUndefined(extensions[ext])) {
ext = extensions[ext];
@@ -3051,7 +3154,7 @@
// to external links. Hash links (#) open in same page
if (options.openLinksInNewWindow && !/^#/.test(url)) {
// escaped _
- result += ' target="¨E95Eblank"';
+ result += ' rel="noopener noreferrer" target="¨E95Eblank"';
}
result += '>' + linkText + '</a>';
@@ -3069,7 +3172,7 @@
// normal cases
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
- writeAnchorTag);
+ writeAnchorTag);
// handle reference-style shortcuts: [link text]
// These must come last in case you've also got [link test][1]
@@ -3090,7 +3193,7 @@
var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
target = '';
if (options.openLinksInNewWindow) {
- target = ' target="¨E95Eblank"';
+ target = ' rel="noopener noreferrer" target="¨E95Eblank"';
}
return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
});
@@ -3124,7 +3227,7 @@
append = trailingPunctuation;
}
if (options.openLinksInNewWindow) {
- target = ' target="¨E95Eblank"';
+ target = ' rel="noopener noreferrer" target="¨E95Eblank"';
}
return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
};
@@ -3325,7 +3428,7 @@
text = globals.converter._dispatch('codeSpans.before', text, options, globals);
- if (typeof(text) === 'undefined') {
+ if (typeof text === 'undefined') {
text = '';
}
text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
@@ -3745,7 +3848,7 @@
//2. Split the text in that position
var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
- //3. Match recursively
+ //3. Match recursively
newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
// prevent an infinite loop
@@ -3864,13 +3967,13 @@
var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
- // Set text-style headers:
- // Header 1
- // ========
- //
- // Header 2
- // --------
- //
+ // Set text-style headers:
+ // Header 1
+ // ========
+ //
+ // Header 2
+ // --------
+ //
setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
@@ -4671,7 +4774,7 @@
}
var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
- //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
+ //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
function parseStyles (sLine) {
@@ -5359,69 +5462,79 @@
/***/ }),
-/***/ 24:
+/***/ 29:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
+/* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
+
+function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
+}
+
+/***/ }),
+
+/***/ 30:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["dom"]; }());
/***/ }),
-/***/ 26:
+/***/ 32:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["hooks"]; }());
/***/ }),
-/***/ 28:
+/***/ 35:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
+function _iterableToArray(iter) {
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
+}
+
+/***/ }),
+
+/***/ 38:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
-var arrayWithHoles = __webpack_require__(37);
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
-function _iterableToArrayLimit(arr, i) {
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
-
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
-
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
-
- return _arr;
-}
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
-var nonIterableRest = __webpack_require__(38);
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
-
-
-
-function _slicedToArray(arr, i) {
- return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])();
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
+function _arrayWithHoles(arr) {
+ if (Array.isArray(arr)) return arr;
}
/***/ }),
-/***/ 30:
+/***/ 39:
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
+function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+
+/***/ }),
+
+/***/ 4:
+/***/ (function(module, exports) {
+
+(function() { module.exports = this["wp"]["data"]; }());
+
+/***/ }),
+
+/***/ 42:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -5703,70 +5816,129 @@
/***/ }),
-/***/ 34:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
-function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
-}
-
-/***/ }),
-
-/***/ 35:
+/***/ 44:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["blob"]; }());
/***/ }),
-/***/ 362:
+/***/ 441:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
+// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, "createBlock", function() { return /* reexport */ createBlock; });
+__webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return /* reexport */ cloneBlock; });
+__webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return /* reexport */ getPossibleBlockTransformations; });
+__webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return /* reexport */ switchToBlockType; });
+__webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return /* reexport */ getBlockTransforms; });
+__webpack_require__.d(__webpack_exports__, "findTransform", function() { return /* reexport */ findTransform; });
+__webpack_require__.d(__webpack_exports__, "getBlockFromExample", function() { return /* reexport */ factory_getBlockFromExample; });
+__webpack_require__.d(__webpack_exports__, "parse", function() { return /* reexport */ parser; });
+__webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return /* reexport */ getBlockAttributes; });
+__webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return /* reexport */ parseWithAttributeSchema; });
+__webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return /* reexport */ pasteHandler; });
+__webpack_require__.d(__webpack_exports__, "rawHandler", function() { return /* reexport */ rawHandler; });
+__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return /* reexport */ getPhrasingContentSchema; });
+__webpack_require__.d(__webpack_exports__, "serialize", function() { return /* reexport */ serialize; });
+__webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return /* reexport */ getBlockContent; });
+__webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return /* reexport */ getBlockDefaultClassName; });
+__webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return /* reexport */ getBlockMenuDefaultClassName; });
+__webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return /* reexport */ getSaveElement; });
+__webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return /* reexport */ getSaveContent; });
+__webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return /* reexport */ isValidBlockContent; });
+__webpack_require__.d(__webpack_exports__, "getCategories", function() { return /* reexport */ categories_getCategories; });
+__webpack_require__.d(__webpack_exports__, "setCategories", function() { return /* reexport */ categories_setCategories; });
+__webpack_require__.d(__webpack_exports__, "updateCategory", function() { return /* reexport */ categories_updateCategory; });
+__webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return /* reexport */ registerBlockType; });
+__webpack_require__.d(__webpack_exports__, "registerBlockCollection", function() { return /* reexport */ registerBlockCollection; });
+__webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return /* reexport */ unregisterBlockType; });
+__webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return /* reexport */ setFreeformContentHandlerName; });
+__webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return /* reexport */ getFreeformContentHandlerName; });
+__webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return /* reexport */ setUnregisteredTypeHandlerName; });
+__webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return /* reexport */ getUnregisteredTypeHandlerName; });
+__webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return /* reexport */ registration_setDefaultBlockName; });
+__webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return /* reexport */ registration_getDefaultBlockName; });
+__webpack_require__.d(__webpack_exports__, "setGroupingBlockName", function() { return /* reexport */ registration_setGroupingBlockName; });
+__webpack_require__.d(__webpack_exports__, "getGroupingBlockName", function() { return /* reexport */ registration_getGroupingBlockName; });
+__webpack_require__.d(__webpack_exports__, "getBlockType", function() { return /* reexport */ registration_getBlockType; });
+__webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return /* reexport */ registration_getBlockTypes; });
+__webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return /* reexport */ registration_getBlockSupport; });
+__webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return /* reexport */ registration_hasBlockSupport; });
+__webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return /* reexport */ isReusableBlock; });
+__webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return /* reexport */ registration_getChildBlockNames; });
+__webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return /* reexport */ registration_hasChildBlocks; });
+__webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return /* reexport */ registration_hasChildBlocksWithInserterSupport; });
+__webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return /* reexport */ unstable__bootstrapServerSideBlockDefinitions; });
+__webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return /* reexport */ registration_registerBlockStyle; });
+__webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return /* reexport */ registration_unregisterBlockStyle; });
+__webpack_require__.d(__webpack_exports__, "registerBlockVariation", function() { return /* reexport */ registration_registerBlockVariation; });
+__webpack_require__.d(__webpack_exports__, "unregisterBlockVariation", function() { return /* reexport */ registration_unregisterBlockVariation; });
+__webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return /* reexport */ isUnmodifiedDefaultBlock; });
+__webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return /* reexport */ normalizeIconObject; });
+__webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return /* reexport */ isValidIcon; });
+__webpack_require__.d(__webpack_exports__, "__experimentalGetBlockLabel", function() { return /* reexport */ getBlockLabel; });
+__webpack_require__.d(__webpack_exports__, "__experimentalGetAccessibleBlockLabel", function() { return /* reexport */ getAccessibleBlockLabel; });
+__webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return /* reexport */ doBlocksMatchTemplate; });
+__webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return /* reexport */ synchronizeBlocksWithTemplate; });
+__webpack_require__.d(__webpack_exports__, "children", function() { return /* reexport */ api_children; });
+__webpack_require__.d(__webpack_exports__, "node", function() { return /* reexport */ api_node; });
+__webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return /* reexport */ withBlockContentContext; });
+
+// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, "getBlockTypes", function() { return getBlockTypes; });
__webpack_require__.d(selectors_namespaceObject, "getBlockType", function() { return getBlockType; });
__webpack_require__.d(selectors_namespaceObject, "getBlockStyles", function() { return getBlockStyles; });
+__webpack_require__.d(selectors_namespaceObject, "getBlockVariations", function() { return getBlockVariations; });
+__webpack_require__.d(selectors_namespaceObject, "getDefaultBlockVariation", function() { return getDefaultBlockVariation; });
__webpack_require__.d(selectors_namespaceObject, "getCategories", function() { return getCategories; });
+__webpack_require__.d(selectors_namespaceObject, "getCollections", function() { return getCollections; });
__webpack_require__.d(selectors_namespaceObject, "getDefaultBlockName", function() { return getDefaultBlockName; });
__webpack_require__.d(selectors_namespaceObject, "getFreeformFallbackBlockName", function() { return getFreeformFallbackBlockName; });
__webpack_require__.d(selectors_namespaceObject, "getUnregisteredFallbackBlockName", function() { return getUnregisteredFallbackBlockName; });
+__webpack_require__.d(selectors_namespaceObject, "getGroupingBlockName", function() { return getGroupingBlockName; });
__webpack_require__.d(selectors_namespaceObject, "getChildBlockNames", function() { return selectors_getChildBlockNames; });
__webpack_require__.d(selectors_namespaceObject, "getBlockSupport", function() { return selectors_getBlockSupport; });
__webpack_require__.d(selectors_namespaceObject, "hasBlockSupport", function() { return hasBlockSupport; });
__webpack_require__.d(selectors_namespaceObject, "isMatchingSearchTerm", function() { return isMatchingSearchTerm; });
__webpack_require__.d(selectors_namespaceObject, "hasChildBlocks", function() { return selectors_hasChildBlocks; });
__webpack_require__.d(selectors_namespaceObject, "hasChildBlocksWithInserterSupport", function() { return selectors_hasChildBlocksWithInserterSupport; });
+
+// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, "addBlockTypes", function() { return addBlockTypes; });
__webpack_require__.d(actions_namespaceObject, "removeBlockTypes", function() { return removeBlockTypes; });
__webpack_require__.d(actions_namespaceObject, "addBlockStyles", function() { return addBlockStyles; });
__webpack_require__.d(actions_namespaceObject, "removeBlockStyles", function() { return removeBlockStyles; });
+__webpack_require__.d(actions_namespaceObject, "addBlockVariations", function() { return addBlockVariations; });
+__webpack_require__.d(actions_namespaceObject, "removeBlockVariations", function() { return removeBlockVariations; });
__webpack_require__.d(actions_namespaceObject, "setDefaultBlockName", function() { return setDefaultBlockName; });
__webpack_require__.d(actions_namespaceObject, "setFreeformFallbackBlockName", function() { return setFreeformFallbackBlockName; });
__webpack_require__.d(actions_namespaceObject, "setUnregisteredFallbackBlockName", function() { return setUnregisteredFallbackBlockName; });
+__webpack_require__.d(actions_namespaceObject, "setGroupingBlockName", function() { return setGroupingBlockName; });
__webpack_require__.d(actions_namespaceObject, "setCategories", function() { return setCategories; });
__webpack_require__.d(actions_namespaceObject, "updateCategory", function() { return updateCategory; });
+__webpack_require__.d(actions_namespaceObject, "addBlockCollection", function() { return addBlockCollection; });
+__webpack_require__.d(actions_namespaceObject, "removeBlockCollection", function() { return removeBlockCollection; });
// EXTERNAL MODULE: external {"this":["wp","data"]}
-var external_this_wp_data_ = __webpack_require__(5);
+var external_this_wp_data_ = __webpack_require__(4);
+
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
+var toConsumableArray = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
-var defineProperty = __webpack_require__(15);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
-var toConsumableArray = __webpack_require__(17);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
-var objectSpread = __webpack_require__(7);
-
-// EXTERNAL MODULE: external "lodash"
-var external_lodash_ = __webpack_require__(2);
+var defineProperty = __webpack_require__(5);
+
+// EXTERNAL MODULE: external {"this":"lodash"}
+var external_this_lodash_ = __webpack_require__(2);
// EXTERNAL MODULE: external {"this":["wp","i18n"]}
var external_this_wp_i18n_ = __webpack_require__(1);
@@ -5775,6 +5947,9 @@
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**
* External dependencies
@@ -5787,18 +5962,27 @@
/**
- * Module Constants
+ * @typedef {Object} WPBlockCategory
+ *
+ * @property {string} slug Unique category slug.
+ * @property {string} title Category label, for display in user interface.
+ */
+
+/**
+ * Default set of categories.
+ *
+ * @type {WPBlockCategory[]}
*/
var DEFAULT_CATEGORIES = [{
- slug: 'common',
- title: Object(external_this_wp_i18n_["__"])('Common Blocks')
+ slug: 'text',
+ title: Object(external_this_wp_i18n_["__"])('Text')
}, {
- slug: 'formatting',
- title: Object(external_this_wp_i18n_["__"])('Formatting')
+ slug: 'media',
+ title: Object(external_this_wp_i18n_["__"])('Media')
}, {
- slug: 'layout',
- title: Object(external_this_wp_i18n_["__"])('Layout Elements')
+ slug: 'design',
+ title: Object(external_this_wp_i18n_["__"])('Design')
}, {
slug: 'widgets',
title: Object(external_this_wp_i18n_["__"])('Widgets')
@@ -5807,7 +5991,7 @@
title: Object(external_this_wp_i18n_["__"])('Embeds')
}, {
slug: 'reusable',
- title: Object(external_this_wp_i18n_["__"])('Reusable Blocks')
+ title: Object(external_this_wp_i18n_["__"])('Reusable blocks')
}];
/**
* Reducer managing the block types
@@ -5824,12 +6008,12 @@
switch (action.type) {
case 'ADD_BLOCK_TYPES':
- return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["keyBy"])(Object(external_lodash_["map"])(action.blockTypes, function (blockType) {
- return Object(external_lodash_["omit"])(blockType, 'styles ');
+ return _objectSpread({}, state, {}, Object(external_this_lodash_["keyBy"])(Object(external_this_lodash_["map"])(action.blockTypes, function (blockType) {
+ return Object(external_this_lodash_["omit"])(blockType, 'styles ');
}), 'name'));
case 'REMOVE_BLOCK_TYPES':
- return Object(external_lodash_["omit"])(state, action.names);
+ return Object(external_this_lodash_["omit"])(state, action.names);
}
return state;
@@ -5849,19 +6033,19 @@
switch (action.type) {
case 'ADD_BLOCK_TYPES':
- return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["mapValues"])(Object(external_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) {
- return Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(blockType, ['styles'], [])), Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [blockType.name], []))), function (style) {
+ return _objectSpread({}, state, {}, Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) {
+ return Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(blockType, ['styles'], [])), Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [blockType.name], []))), function (style) {
return style.name;
});
}));
case 'ADD_BLOCK_STYLES':
- return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.styles)), function (style) {
+ return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.styles)), function (style) {
return style.name;
})));
case 'REMOVE_BLOCK_STYLES':
- return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["filter"])(Object(external_lodash_["get"])(state, [action.blockName], []), function (style) {
+ return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["filter"])(Object(external_this_lodash_["get"])(state, [action.blockName], []), function (style) {
return action.styleNames.indexOf(style.name) === -1;
})));
}
@@ -5869,11 +6053,45 @@
return state;
}
/**
+ * Reducer managing the block variations.
+ *
+ * @param {Object} state Current state.
+ * @param {Object} action Dispatched action.
+ *
+ * @return {Object} Updated state.
+ */
+
+function blockVariations() {
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ var action = arguments.length > 1 ? arguments[1] : undefined;
+
+ switch (action.type) {
+ case 'ADD_BLOCK_TYPES':
+ return _objectSpread({}, state, {}, Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) {
+ return Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(blockType, ['variations'], [])), Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [blockType.name], []))), function (variation) {
+ return variation.name;
+ });
+ }));
+
+ case 'ADD_BLOCK_VARIATIONS':
+ return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.variations)), function (variation) {
+ return variation.name;
+ })));
+
+ case 'REMOVE_BLOCK_VARIATIONS':
+ return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["filter"])(Object(external_this_lodash_["get"])(state, [action.blockName], []), function (variation) {
+ return action.variationNames.indexOf(variation.name) === -1;
+ })));
+ }
+
+ return state;
+}
+/**
* Higher-order Reducer creating a reducer keeping track of given block name.
*
* @param {string} setActionType Action type.
*
- * @return {function} Reducer.
+ * @return {Function} Reducer.
*/
function createBlockNameSetterReducer(setActionType) {
@@ -5899,13 +6117,14 @@
var reducer_defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME');
var freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME');
var unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME');
+var groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME');
/**
* Reducer managing the categories
*
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
+ * @param {WPBlockCategory[]} state Current state.
+ * @param {Object} action Dispatched action.
+ *
+ * @return {WPBlockCategory[]} Updated state.
*/
function reducer_categories() {
@@ -5918,16 +6137,16 @@
case 'UPDATE_CATEGORY':
{
- if (!action.category || Object(external_lodash_["isEmpty"])(action.category)) {
+ if (!action.category || Object(external_this_lodash_["isEmpty"])(action.category)) {
return state;
}
- var categoryToChange = Object(external_lodash_["find"])(state, ['slug', action.slug]);
+ var categoryToChange = Object(external_this_lodash_["find"])(state, ['slug', action.slug]);
if (categoryToChange) {
- return Object(external_lodash_["map"])(state, function (category) {
+ return Object(external_this_lodash_["map"])(state, function (category) {
if (category.slug === action.slug) {
- return Object(objectSpread["a" /* default */])({}, category, action.category);
+ return _objectSpread({}, category, {}, action.category);
}
return category;
@@ -5938,24 +6157,57 @@
return state;
}
+function collections() {
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ var action = arguments.length > 1 ? arguments[1] : undefined;
+
+ switch (action.type) {
+ case 'ADD_BLOCK_COLLECTION':
+ return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.namespace, {
+ title: action.title,
+ icon: action.icon
+ }));
+
+ case 'REMOVE_BLOCK_COLLECTION':
+ return Object(external_this_lodash_["omit"])(state, action.namespace);
+ }
+
+ return state;
+}
/* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({
blockTypes: reducer_blockTypes,
blockStyles: blockStyles,
+ blockVariations: blockVariations,
defaultBlockName: reducer_defaultBlockName,
freeformFallbackBlockName: freeformFallbackBlockName,
unregisteredFallbackBlockName: unregisteredFallbackBlockName,
- categories: reducer_categories
+ groupingBlockName: groupingBlockName,
+ categories: reducer_categories,
+ collections: collections
}));
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
-var rememo = __webpack_require__(30);
+var rememo = __webpack_require__(42);
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
+
+
+
+function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
+/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
+
+/** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */
+
+/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
+
/**
* Given a block name or block type object, returns the corresponding
* normalized block type object.
@@ -5979,9 +6231,13 @@
var getBlockTypes = Object(rememo["a" /* default */])(function (state) {
- return Object.values(state.blockTypes);
+ return Object.values(state.blockTypes).map(function (blockType) {
+ return selectors_objectSpread({}, blockType, {
+ variations: getBlockVariations(state, blockType.name)
+ });
+ });
}, function (state) {
- return [state.blockTypes];
+ return [state.blockTypes, state.blockVariations];
});
/**
* Returns a block type by name.
@@ -6008,17 +6264,66 @@
return state.blockStyles[name];
}
/**
+ * Returns block variations by block name.
+ *
+ * @param {Object} state Data state.
+ * @param {string} blockName Block type name.
+ * @param {WPBlockVariationScope} [scope] Block variation scope name.
+ *
+ * @return {(WPBlockVariation[]|void)} Block variations.
+ */
+
+function getBlockVariations(state, blockName, scope) {
+ var variations = state.blockVariations[blockName];
+
+ if (!variations || !scope) {
+ return variations;
+ }
+
+ return variations.filter(function (variation) {
+ return !variation.scope || variation.scope.includes(scope);
+ });
+}
+/**
+ * Returns the default block variation for the given block type.
+ * When there are multiple variations annotated as the default one,
+ * the last added item is picked. This simplifies registering overrides.
+ * When there is no default variation set, it returns the first item.
+ *
+ * @param {Object} state Data state.
+ * @param {string} blockName Block type name.
+ * @param {WPBlockVariationScope} [scope] Block variation scope name.
+ *
+ * @return {?WPBlockVariation} The default block variation.
+ */
+
+function getDefaultBlockVariation(state, blockName, scope) {
+ var variations = getBlockVariations(state, blockName, scope);
+ return Object(external_this_lodash_["findLast"])(variations, 'isDefault') || Object(external_this_lodash_["first"])(variations);
+}
+/**
* Returns all the available categories.
*
* @param {Object} state Data state.
*
- * @return {Array} Categories list.
+ * @return {WPBlockCategory[]} Categories list.
*/
function getCategories(state) {
return state.categories;
}
/**
+ * Returns all the available collections.
+ *
+ * @param {Object} state Data state.
+ *
+ * @return {Object} Collections list.
+ */
+
+function getCollections(state) {
+ return state.collections;
+}
+/**
* Returns the name of the default block name.
*
* @param {Object} state Data state.
@@ -6052,6 +6357,17 @@
return state.unregisteredFallbackBlockName;
}
/**
+ * Returns the name of the block for handling unregistered blocks.
+ *
+ * @param {Object} state Data state.
+ *
+ * @return {string?} Name of the block for handling unregistered blocks.
+ */
+
+function getGroupingBlockName(state) {
+ return state.groupingBlockName;
+}
+/**
* Returns an array with the child blocks of a given block.
*
* @param {Object} state Data state.
@@ -6061,8 +6377,8 @@
*/
var selectors_getChildBlockNames = Object(rememo["a" /* default */])(function (state, blockName) {
- return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(state.blockTypes, function (blockType) {
- return Object(external_lodash_["includes"])(blockType.parent, blockName);
+ return Object(external_this_lodash_["map"])(Object(external_this_lodash_["filter"])(state.blockTypes, function (blockType) {
+ return Object(external_this_lodash_["includes"])(blockType.parent, blockName);
}), function (_ref) {
var name = _ref.name;
return name;
@@ -6084,7 +6400,7 @@
var selectors_getBlockSupport = function getBlockSupport(state, nameOrType, feature, defaultSupports) {
var blockType = getNormalizedBlockType(state, nameOrType);
- return Object(external_lodash_["get"])(blockType, ['supports', feature], defaultSupports);
+ return Object(external_this_lodash_["get"])(blockType, ['supports'].concat(Object(toConsumableArray["a" /* default */])(feature.split('.'))), defaultSupports);
};
/**
* Returns true if the block defines support for a feature, or false otherwise.
@@ -6109,14 +6425,14 @@
* @param {(string|Object)} nameOrType Block name or type object.
* @param {string} searchTerm Search term by which to filter.
*
- * @return {Object[]} Wheter block type matches search term.
+ * @return {Object[]} Whether block type matches search term.
*/
function isMatchingSearchTerm(state, nameOrType, searchTerm) {
var blockType = getNormalizedBlockType(state, nameOrType);
- var getNormalizedSearchTerm = Object(external_lodash_["flow"])([// Disregard diacritics.
+ var getNormalizedSearchTerm = Object(external_this_lodash_["flow"])([// Disregard diacritics.
// Input: "média"
- external_lodash_["deburr"], // Lowercase.
+ external_this_lodash_["deburr"], // Lowercase.
// Input: "MEDIA"
function (term) {
return term.toLowerCase();
@@ -6126,10 +6442,10 @@
return term.trim();
}]);
var normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
- var isSearchMatch = Object(external_lodash_["flow"])([getNormalizedSearchTerm, function (normalizedCandidate) {
- return Object(external_lodash_["includes"])(normalizedCandidate, normalizedSearchTerm);
+ var isSearchMatch = Object(external_this_lodash_["flow"])([getNormalizedSearchTerm, function (normalizedCandidate) {
+ return Object(external_this_lodash_["includes"])(normalizedCandidate, normalizedSearchTerm);
}]);
- return isSearchMatch(blockType.title) || Object(external_lodash_["some"])(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category);
+ return isSearchMatch(blockType.title) || Object(external_this_lodash_["some"])(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category);
}
/**
* Returns a boolean indicating if a block has child blocks or not.
@@ -6154,7 +6470,7 @@
*/
var selectors_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(state, blockName) {
- return Object(external_lodash_["some"])(selectors_getChildBlockNames(state, blockName), function (childBlockName) {
+ return Object(external_this_lodash_["some"])(selectors_getChildBlockNames(state, blockName), function (childBlockName) {
return hasBlockSupport(state, childBlockName, 'inserter', true);
});
};
@@ -6164,6 +6480,8 @@
* External dependencies
*/
+/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
+
/**
* Returns an action object used in signalling that block types have been added.
*
@@ -6175,7 +6493,7 @@
function addBlockTypes(blockTypes) {
return {
type: 'ADD_BLOCK_TYPES',
- blockTypes: Object(external_lodash_["castArray"])(blockTypes)
+ blockTypes: Object(external_this_lodash_["castArray"])(blockTypes)
};
}
/**
@@ -6189,7 +6507,7 @@
function removeBlockTypes(names) {
return {
type: 'REMOVE_BLOCK_TYPES',
- names: Object(external_lodash_["castArray"])(names)
+ names: Object(external_this_lodash_["castArray"])(names)
};
}
/**
@@ -6204,7 +6522,7 @@
function addBlockStyles(blockName, styles) {
return {
type: 'ADD_BLOCK_STYLES',
- styles: Object(external_lodash_["castArray"])(styles),
+ styles: Object(external_this_lodash_["castArray"])(styles),
blockName: blockName
};
}
@@ -6220,7 +6538,39 @@
function removeBlockStyles(blockName, styleNames) {
return {
type: 'REMOVE_BLOCK_STYLES',
- styleNames: Object(external_lodash_["castArray"])(styleNames),
+ styleNames: Object(external_this_lodash_["castArray"])(styleNames),
+ blockName: blockName
+ };
+}
+/**
+ * Returns an action object used in signalling that new block variations have been added.
+ *
+ * @param {string} blockName Block name.
+ * @param {WPBlockVariation|WPBlockVariation[]} variations Block variations.
+ *
+ * @return {Object} Action object.
+ */
+
+function addBlockVariations(blockName, variations) {
+ return {
+ type: 'ADD_BLOCK_VARIATIONS',
+ variations: Object(external_this_lodash_["castArray"])(variations),
+ blockName: blockName
+ };
+}
+/**
+ * Returns an action object used in signalling that block variations have been removed.
+ *
+ * @param {string} blockName Block name.
+ * @param {string|string[]} variationNames Block variation names.
+ *
+ * @return {Object} Action object.
+ */
+
+function removeBlockVariations(blockName, variationNames) {
+ return {
+ type: 'REMOVE_BLOCK_VARIATIONS',
+ variationNames: Object(external_this_lodash_["castArray"])(variationNames),
blockName: blockName
};
}
@@ -6269,6 +6619,22 @@
};
}
/**
+ * Returns an action object used to set the name of the block used
+ * when grouping other blocks
+ * eg: in "Group/Ungroup" interactions
+ *
+ * @param {string} name Block name.
+ *
+ * @return {Object} Action object.
+ */
+
+function setGroupingBlockName(name) {
+ return {
+ type: 'SET_GROUPING_BLOCK_NAME',
+ name: name
+ };
+}
+/**
* Returns an action object used to set block categories.
*
* @param {Object[]} categories Block categories.
@@ -6298,6 +6664,38 @@
category: category
};
}
+/**
+ * Returns an action object used to add block collections
+ *
+ * @param {string} namespace The namespace of the blocks to put in the collection
+ * @param {string} title The title to display in the block inserter
+ * @param {Object} icon (optional) The icon to display in the block inserter
+ *
+ * @return {Object} Action object.
+ */
+
+function addBlockCollection(namespace, title, icon) {
+ return {
+ type: 'ADD_BLOCK_COLLECTION',
+ namespace: namespace,
+ title: title,
+ icon: icon
+ };
+}
+/**
+ * Returns an action object used to remove block collections
+ *
+ * @param {string} namespace The namespace of the blocks to put in the collection
+ *
+ * @return {Object} Action object.
+ */
+
+function removeBlockCollection(namespace) {
+ return {
+ type: 'REMOVE_BLOCK_COLLECTION',
+ namespace: namespace
+ };
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js
/**
@@ -6317,23 +6715,92 @@
actions: actions_namespaceObject
});
-// EXTERNAL MODULE: ./node_modules/uuid/v4.js
-var v4 = __webpack_require__(65);
-var v4_default = /*#__PURE__*/__webpack_require__.n(v4);
-
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/rng.js
+// Unique ID creation requires a high quality random # generator. In the browser we therefore
+// require the crypto API and do not support built-in fallback to lower quality random number
+// generators (like Math.random()).
+// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
+// find the complete implementation of crypto (msCrypto) on IE11.
+var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
+var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
+
+function rng() {
+ if (!getRandomValues) {
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
+ }
+
+ return getRandomValues(rnds8);
+}
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/bytesToUuid.js
+/**
+ * Convert array of 16 byte values to UUID string format of the form:
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ */
+var byteToHex = [];
+
+for (var bytesToUuid_i = 0; bytesToUuid_i < 256; ++bytesToUuid_i) {
+ byteToHex[bytesToUuid_i] = (bytesToUuid_i + 0x100).toString(16).substr(1);
+}
+
+function bytesToUuid(buf, offset) {
+ var i = offset || 0;
+ var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
+
+ return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
+}
+
+/* harmony default export */ var esm_browser_bytesToUuid = (bytesToUuid);
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/v4.js
+
+
+
+function v4(options, buf, offset) {
+ var i = buf && offset || 0;
+
+ if (typeof options == 'string') {
+ buf = options === 'binary' ? new Array(16) : null;
+ options = null;
+ }
+
+ options = options || {};
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
+
+ rnds[6] = rnds[6] & 0x0f | 0x40;
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
+
+ if (buf) {
+ for (var ii = 0; ii < 16; ++ii) {
+ buf[i + ii] = rnds[ii];
+ }
+ }
+
+ return buf || esm_browser_bytesToUuid(rnds);
+}
+
+/* harmony default export */ var esm_browser_v4 = (v4);
// EXTERNAL MODULE: external {"this":["wp","hooks"]}
-var external_this_wp_hooks_ = __webpack_require__(26);
+var external_this_wp_hooks_ = __webpack_require__(32);
+
+// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
+var block_default = __webpack_require__(202);
// EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js
-var tinycolor = __webpack_require__(45);
+var tinycolor = __webpack_require__(66);
var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor);
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external_this_wp_element_ = __webpack_require__(0);
+// EXTERNAL MODULE: external {"this":["wp","dom"]}
+var external_this_wp_dom_ = __webpack_require__(30);
+
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js
+function utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { utils_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -6344,6 +6811,8 @@
*/
+
+
/**
* Internal dependencies
*/
@@ -6383,7 +6852,7 @@
var newDefaultBlock = isUnmodifiedDefaultBlock.block;
var blockType = registration_getBlockType(defaultBlockName);
- return Object(external_lodash_["every"])(blockType.attributes, function (value, key) {
+ return Object(external_this_lodash_["every"])(blockType.attributes, function (value, key) {
return newDefaultBlock.attributes[key] === block.attributes[key];
});
}
@@ -6396,34 +6865,30 @@
*/
function isValidIcon(icon) {
- return !!icon && (Object(external_lodash_["isString"])(icon) || Object(external_this_wp_element_["isValidElement"])(icon) || Object(external_lodash_["isFunction"])(icon) || icon instanceof external_this_wp_element_["Component"]);
+ return !!icon && (Object(external_this_lodash_["isString"])(icon) || Object(external_this_wp_element_["isValidElement"])(icon) || Object(external_this_lodash_["isFunction"])(icon) || icon instanceof external_this_wp_element_["Component"]);
}
/**
* Function that receives an icon as set by the blocks during the registration
* and returns a new icon object that is normalized so we can rely on just on possible icon structure
* in the codebase.
*
- * @param {(Object|string|WPElement)} icon Slug of the Dashicon to be shown
- * as the icon for the block in the
- * inserter, or element or an object describing the icon.
- *
- * @return {Object} Object describing the icon.
+ * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon;
+ * one of a Dashicon slug, an element, or a
+ * component.
+ *
+ * @return {WPBlockTypeIconDescriptor} Object describing the icon.
*/
function normalizeIconObject(icon) {
- if (!icon) {
- icon = 'block-default';
- }
-
if (isValidIcon(icon)) {
return {
src: icon
};
}
- if (Object(external_lodash_["has"])(icon, ['background'])) {
+ if (Object(external_this_lodash_["has"])(icon, ['background'])) {
var tinyBgColor = tinycolor_default()(icon.background);
- return Object(objectSpread["a" /* default */])({}, icon, {
+ return utils_objectSpread({}, icon, {
foreground: icon.foreground ? icon.foreground : Object(tinycolor["mostReadable"])(tinyBgColor, ICON_COLORS, {
includeFallbackColors: true,
level: 'AA',
@@ -6446,17 +6911,112 @@
*/
function normalizeBlockType(blockTypeOrName) {
- if (Object(external_lodash_["isString"])(blockTypeOrName)) {
+ if (Object(external_this_lodash_["isString"])(blockTypeOrName)) {
return registration_getBlockType(blockTypeOrName);
}
return blockTypeOrName;
}
+/**
+ * Get the label for the block, usually this is either the block title,
+ * or the value of the block's `label` function when that's specified.
+ *
+ * @param {Object} blockType The block type.
+ * @param {Object} attributes The values of the block's attributes.
+ * @param {Object} context The intended use for the label.
+ *
+ * @return {string} The block label.
+ */
+
+function getBlockLabel(blockType, attributes) {
+ var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'visual';
+ var getLabel = blockType.__experimentalLabel,
+ title = blockType.title;
+ var label = getLabel && getLabel(attributes, {
+ context: context
+ });
+
+ if (!label) {
+ return title;
+ } // Strip any HTML (i.e. RichText formatting) before returning.
+
+
+ return Object(external_this_wp_dom_["__unstableStripHTML"])(label);
+}
+/**
+ * Get a label for the block for use by screenreaders, this is more descriptive
+ * than the visual label and includes the block title and the value of the
+ * `getLabel` function if it's specified.
+ *
+ * @param {Object} blockType The block type.
+ * @param {Object} attributes The values of the block's attributes.
+ * @param {?number} position The position of the block in the block list.
+ * @param {string} [direction='vertical'] The direction of the block layout.
+ *
+ * @return {string} The block label.
+ */
+
+function getAccessibleBlockLabel(blockType, attributes, position) {
+ var direction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vertical';
+ // `title` is already localized, `label` is a user-supplied value.
+ var title = blockType.title;
+ var label = getBlockLabel(blockType, attributes, 'accessibility');
+ var hasPosition = position !== undefined; // getBlockLabel returns the block title as a fallback when there's no label,
+ // if it did return the title, this function needs to avoid adding the
+ // title twice within the accessible label. Use this `hasLabel` boolean to
+ // handle that.
+
+ var hasLabel = label && label !== title;
+
+ if (hasPosition && direction === 'vertical') {
+ if (hasLabel) {
+ return Object(external_this_wp_i18n_["sprintf"])(
+ /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
+ Object(external_this_wp_i18n_["__"])('%1$s Block. Row %2$d. %3$s'), title, position, label);
+ }
+
+ return Object(external_this_wp_i18n_["sprintf"])(
+ /* translators: accessibility text. 1: The block title. 2: The block row number. */
+ Object(external_this_wp_i18n_["__"])('%1$s Block. Row %2$d'), title, position);
+ } else if (hasPosition && direction === 'horizontal') {
+ if (hasLabel) {
+ return Object(external_this_wp_i18n_["sprintf"])(
+ /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
+ Object(external_this_wp_i18n_["__"])('%1$s Block. Column %2$d. %3$s'), title, position, label);
+ }
+
+ return Object(external_this_wp_i18n_["sprintf"])(
+ /* translators: accessibility text. 1: The block title. 2: The block column number. */
+ Object(external_this_wp_i18n_["__"])('%1$s Block. Column %2$d'), title, position);
+ }
+
+ if (hasLabel) {
+ return Object(external_this_wp_i18n_["sprintf"])(
+ /* translators: accessibility text. %1: The block title. %2: The block label. */
+ Object(external_this_wp_i18n_["__"])('%1$s Block. %2$s'), title, label);
+ }
+
+ return Object(external_this_wp_i18n_["sprintf"])(
+ /* translators: accessibility text. %s: The block title. */
+ Object(external_this_wp_i18n_["__"])('%s Block'), title);
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/constants.js
+/**
+ * Array of valid keys in a block type settings deprecation object.
+ *
+ * @type {string[]}
+ */
+var DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible'];
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js
-/* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */
+function registration_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function registration_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { registration_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { registration_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
+/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */
/**
* External dependencies
@@ -6468,46 +7028,130 @@
+
/**
* Internal dependencies
*/
+
+/**
+ * An icon type definition. One of a Dashicon slug, an element,
+ * or a component.
+ *
+ * @typedef {(string|WPElement|WPComponent)} WPIcon
+ *
+ * @see https://developer.wordpress.org/resource/dashicons/
+ */
+
+/**
+ * Render behavior of a block type icon; one of a Dashicon slug, an element,
+ * or a component.
+ *
+ * @typedef {WPIcon} WPBlockTypeIconRender
+ */
+
+/**
+ * An object describing a normalized block type icon.
+ *
+ * @typedef {Object} WPBlockTypeIconDescriptor
+ *
+ * @property {WPBlockTypeIconRender} src Render behavior of the icon,
+ * one of a Dashicon slug, an
+ * element, or a component.
+ * @property {string} background Optimal background hex string
+ * color when displaying icon.
+ * @property {string} foreground Optimal foreground hex string
+ * color when displaying icon.
+ * @property {string} shadowColor Optimal shadow hex string
+ * color when displaying icon.
+ */
+
+/**
+ * Value to use to render the icon for a block type in an editor interface,
+ * either a Dashicon slug, an element, a component, or an object describing
+ * the icon.
+ *
+ * @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon
+ */
+
+/**
+ * Named block variation scopes.
+ *
+ * @typedef {'block'|'inserter'} WPBlockVariationScope
+ */
+
+/**
+ * An object describing a variation defined for the block type.
+ *
+ * @typedef {Object} WPBlockVariation
+ *
+ * @property {string} name The unique and machine-readable name.
+ * @property {string} title A human-readable variation title.
+ * @property {string} [description] A detailed variation description.
+ * @property {WPIcon} [icon] An icon helping to visualize the variation.
+ * @property {boolean} [isDefault] Indicates whether the current variation is
+ * the default one. Defaults to `false`.
+ * @property {Object} [attributes] Values which override block attributes.
+ * @property {Array[]} [innerBlocks] Initial configuration of nested blocks.
+ * @property {Object} [example] Example provides structured data for
+ * the block preview. You can set to
+ * `undefined` to disable the preview shown
+ * for the block type.
+ * @property {WPBlockVariationScope[]} [scope] The list of scopes where the variation
+ * is applicable. When not provided, it
+ * assumes all available scopes.
+ */
+
/**
* Defined behavior of a block type.
*
- * @typedef {WPBlockType}
- *
- * @property {string} name Block's namespaced name.
- * @property {string} title Human-readable label for a block.
- * Shown in the block inserter.
- * @property {string} category Category classification of block,
- * impacting where block is shown in
- * inserter results.
- * @property {(Object|string|WPElement)} icon Slug of the Dashicon to be shown
- * as the icon for the block in the
- * inserter, or element or an object describing the icon.
- * @property {?string[]} keywords Additional keywords to produce
- * block as inserter search result.
- * @property {?Object} attributes Block attributes.
- * @property {Function} save Serialize behavior of a block,
- * returning an element describing
- * structure of the block's post
- * content markup.
- * @property {WPComponent} edit Component rendering element to be
- * interacted with in an editor.
- */
-
+ * @typedef {Object} WPBlock
+ *
+ * @property {string} name Block type's namespaced name.
+ * @property {string} title Human-readable block type label.
+ * @property {string} [description] A detailed block type description.
+ * @property {string} [category] Block type category classification,
+ * used in search interfaces to arrange
+ * block types by category.
+ * @property {WPBlockTypeIcon} [icon] Block type icon.
+ * @property {string[]} [keywords] Additional keywords to produce block
+ * type as result in search interfaces.
+ * @property {Object} [attributes] Block type attributes.
+ * @property {WPComponent} [save] Optional component describing
+ * serialized markup structure of a
+ * block type.
+ * @property {WPComponent} edit Component rendering an element to
+ * manipulate the attributes of a block
+ * in the context of an editor.
+ * @property {WPBlockVariation[]} [variations] The list of block variations.
+ * @property {Object} [example] Example provides structured data for
+ * the block preview. When not defined
+ * then no preview is shown.
+ */
+
+/**
+ * Mapping of legacy category slugs to their latest normal values, used to
+ * accommodate updates of the default set of block categories.
+ *
+ * @type {Record<string,string>}
+ */
+
+var LEGACY_CATEGORY_MAPPING = {
+ common: 'text',
+ formatting: 'text',
+ layout: 'design'
+};
var serverSideBlockDefinitions = {};
/**
- * Set the server side block definition of blocks.
+ * Sets the server side block definition of blocks.
*
* @param {Object} definitions Server-side block definitions
*/
+// eslint-disable-next-line camelcase
function unstable__bootstrapServerSideBlockDefinitions(definitions) {
- // eslint-disable-line camelcase
- serverSideBlockDefinitions = definitions;
+ serverSideBlockDefinitions = registration_objectSpread({}, serverSideBlockDefinitions, {}, definitions);
}
/**
* Registers a new block provided a unique name and an object defining its
@@ -6518,13 +7162,25 @@
* @param {Object} settings Block settings.
*
* @return {?WPBlock} The block, if it has been successfully registered;
- * otherwise `undefined`.
+ * otherwise `undefined`.
*/
function registerBlockType(name, settings) {
- settings = Object(objectSpread["a" /* default */])({
- name: name
- }, Object(external_lodash_["get"])(serverSideBlockDefinitions, name), settings);
+ settings = registration_objectSpread({
+ name: name,
+ icon: block_default["a" /* default */],
+ keywords: [],
+ attributes: {},
+ providesContext: {},
+ usesContext: [],
+ supports: {},
+ styles: [],
+ save: function save() {
+ return null;
+ }
+ }, Object(external_this_lodash_["pickBy"])(Object(external_this_lodash_["get"])(serverSideBlockDefinitions, name, {}), function (value) {
+ return !Object(external_this_lodash_["isNil"])(value);
+ }), {}, settings);
if (typeof name !== 'string') {
console.error('Block names must be strings.');
@@ -6541,28 +7197,45 @@
return;
}
+ var preFilterSettings = registration_objectSpread({}, settings);
+
settings = Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', settings, name);
- if (!settings || !Object(external_lodash_["isFunction"])(settings.save)) {
- console.error('The "save" property must be specified and must be a valid function.');
+ if (settings.deprecated) {
+ settings.deprecated = settings.deprecated.map(function (deprecation) {
+ return Object(external_this_lodash_["pick"])( // Only keep valid deprecation keys.
+ Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', // Merge deprecation keys with pre-filter settings
+ // so that filters that depend on specific keys being
+ // present don't fail.
+ registration_objectSpread({}, Object(external_this_lodash_["omit"])(preFilterSettings, DEPRECATED_ENTRY_KEYS), {}, deprecation), name), DEPRECATED_ENTRY_KEYS);
+ });
+ }
+
+ if (!Object(external_this_lodash_["isPlainObject"])(settings)) {
+ console.error('Block settings must be a valid object.');
return;
}
- if ('edit' in settings && !Object(external_lodash_["isFunction"])(settings.edit)) {
+ if (!Object(external_this_lodash_["isFunction"])(settings.save)) {
+ console.error('The "save" property must be a valid function.');
+ return;
+ }
+
+ if ('edit' in settings && !Object(external_this_lodash_["isFunction"])(settings.edit)) {
console.error('The "edit" property must be a valid function.');
return;
- }
-
- if (!('category' in settings)) {
- console.error('The block "' + name + '" must have a category.');
- return;
- }
-
- if ('category' in settings && !Object(external_lodash_["some"])(Object(external_this_wp_data_["select"])('core/blocks').getCategories(), {
+ } // Canonicalize legacy categories to equivalent fallback.
+
+
+ if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) {
+ settings.category = LEGACY_CATEGORY_MAPPING[settings.category];
+ }
+
+ if ('category' in settings && !Object(external_this_lodash_["some"])(Object(external_this_wp_data_["select"])('core/blocks').getCategories(), {
slug: settings.category
})) {
- console.error('The block "' + name + '" must have a registered category.');
- return;
+ console.warn('The block "' + name + '" is registered with an invalid category "' + settings.category + '".');
+ delete settings.category;
}
if (!('title' in settings) || settings.title === '') {
@@ -6578,7 +7251,7 @@
settings.icon = normalizeIconObject(settings.icon);
if (!isValidIcon(settings.icon.src)) {
- console.error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-registration/#icon-optional');
+ console.error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional');
return;
}
@@ -6586,12 +7259,36 @@
return settings;
}
/**
+ * Registers a new block collection to group blocks in the same namespace in the inserter.
+ *
+ * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace.
+ * @param {Object} settings The block collection settings.
+ * @param {string} settings.title The title to display in the block inserter.
+ * @param {Object} [settings.icon] The icon to display in the block inserter.
+ */
+
+function registerBlockCollection(namespace, _ref) {
+ var title = _ref.title,
+ icon = _ref.icon;
+ Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockCollection(namespace, title, icon);
+}
+/**
+ * Unregisters a block collection
+ *
+ * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace
+ *
+ */
+
+function unregisterBlockCollection(namespace) {
+ Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockCollection(namespace);
+}
+/**
* Unregisters a block.
*
* @param {string} name Block name.
*
* @return {?WPBlock} The previous block value, if it has been successfully
- * unregistered; otherwise `undefined`.
+ * unregistered; otherwise `undefined`.
*/
function unregisterBlockType(name) {
@@ -6618,13 +7315,22 @@
* Retrieves name of block handling non-block content, or undefined if no
* handler has been defined.
*
- * @return {?string} Blog name.
+ * @return {?string} Block name.
*/
function getFreeformContentHandlerName() {
return Object(external_this_wp_data_["select"])('core/blocks').getFreeformFallbackBlockName();
}
/**
+ * Retrieves name of block used for handling grouping interactions.
+ *
+ * @return {?string} Block name.
+ */
+
+function registration_getGroupingBlockName() {
+ return Object(external_this_wp_data_["select"])('core/blocks').getGroupingBlockName();
+}
+/**
* Assigns name of block handling unregistered block types.
*
* @param {string} blockName Block name.
@@ -6637,7 +7343,7 @@
* Retrieves name of block handling unregistered block types, or undefined if no
* handler has been defined.
*
- * @return {?string} Blog name.
+ * @return {?string} Block name.
*/
function getUnregisteredTypeHandlerName() {
@@ -6653,6 +7359,15 @@
Object(external_this_wp_data_["dispatch"])('core/blocks').setDefaultBlockName(name);
}
/**
+ * Assigns name of block for handling block grouping interactions.
+ *
+ * @param {string} name Block name.
+ */
+
+function registration_setGroupingBlockName(name) {
+ Object(external_this_wp_data_["dispatch"])('core/blocks').setGroupingBlockName(name);
+}
+/**
* Retrieves the default block name.
*
* @return {?string} Block name.
@@ -6776,11 +7491,35 @@
var registration_unregisterBlockStyle = function unregisterBlockStyle(blockName, styleVariationName) {
Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockStyles(blockName, styleVariationName);
};
+/**
+ * Registers a new block variation for the given block type.
+ *
+ * @param {string} blockName Name of the block (example: “core/columns”).
+ * @param {WPBlockVariation} variation Object describing a block variation.
+ */
+
+var registration_registerBlockVariation = function registerBlockVariation(blockName, variation) {
+ Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockVariations(blockName, variation);
+};
+/**
+ * Unregisters a block variation defined for the given block type.
+ *
+ * @param {string} blockName Name of the block (example: “core/columns”).
+ * @param {string} variationName Name of the variation defined for the block.
+ */
+
+var registration_unregisterBlockVariation = function unregisterBlockVariation(blockName, variationName) {
+ Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockVariations(blockName, variationName);
+};
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js
+function factory_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function factory_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { factory_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { factory_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -6814,28 +7553,28 @@
var blockType = registration_getBlockType(name); // Ensure attributes contains only values defined by block type, and merge
// default values for missing attributes.
- var sanitizedAttributes = Object(external_lodash_["reduce"])(blockType.attributes, function (result, schema, key) {
+ var sanitizedAttributes = Object(external_this_lodash_["reduce"])(blockType.attributes, function (accumulator, schema, key) {
var value = attributes[key];
if (undefined !== value) {
- result[key] = value;
+ accumulator[key] = value;
} else if (schema.hasOwnProperty('default')) {
- result[key] = schema.default;
+ accumulator[key] = schema.default;
}
if (['node', 'children'].indexOf(schema.source) !== -1) {
// Ensure value passed is always an array, which we're expecting in
// the RichText component to handle the deprecated value.
- if (typeof result[key] === 'string') {
- result[key] = [result[key]];
- } else if (!Array.isArray(result[key])) {
- result[key] = [];
- }
- }
-
- return result;
+ if (typeof accumulator[key] === 'string') {
+ accumulator[key] = [accumulator[key]];
+ } else if (!Array.isArray(accumulator[key])) {
+ accumulator[key] = [];
+ }
+ }
+
+ return accumulator;
}, {});
- var clientId = v4_default()(); // Blocks are stored with a unique ID, the assigned type name, the block
+ var clientId = esm_browser_v4(); // Blocks are stored with a unique ID, the assigned type name, the block
// attributes, and their inner blocks.
return {
@@ -6860,10 +7599,10 @@
function cloneBlock(block) {
var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined;
- var clientId = v4_default()();
- return Object(objectSpread["a" /* default */])({}, block, {
+ var clientId = esm_browser_v4();
+ return factory_objectSpread({}, block, {
clientId: clientId,
- attributes: Object(objectSpread["a" /* default */])({}, block.attributes, mergeAttributes),
+ attributes: factory_objectSpread({}, block.attributes, {}, mergeAttributes),
innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) {
return cloneBlock(innerBlock);
})
@@ -6881,16 +7620,26 @@
*/
var factory_isPossibleTransformForSource = function isPossibleTransformForSource(transform, direction, blocks) {
- if (Object(external_lodash_["isEmpty"])(blocks)) {
+ if (Object(external_this_lodash_["isEmpty"])(blocks)) {
return false;
- } // If multiple blocks are selected, only multi block transforms are allowed.
+ } // If multiple blocks are selected, only multi block transforms
+ // or wildcard transforms are allowed.
var isMultiBlock = blocks.length > 1;
- var isValidForMultiBlocks = !isMultiBlock || transform.isMultiBlock;
+ var firstBlockName = Object(external_this_lodash_["first"])(blocks).name;
+ var isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
if (!isValidForMultiBlocks) {
return false;
+ } // Check non-wildcard transforms to ensure that transform is valid
+ // for a block selection of multiple blocks of different types
+
+
+ if (!isWildcardBlockTransform(transform) && !Object(external_this_lodash_["every"])(blocks, {
+ name: firstBlockName
+ })) {
+ return false;
} // Only consider 'block' type transforms as valid.
@@ -6898,18 +7647,25 @@
if (!isBlockType) {
return false;
- } // Check if the transform's block name matches the source block only if this is a transform 'from'.
-
-
- var sourceBlock = Object(external_lodash_["first"])(blocks);
- var hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1;
+ } // Check if the transform's block name matches the source block (or is a wildcard)
+ // only if this is a transform 'from'.
+
+
+ var sourceBlock = Object(external_this_lodash_["first"])(blocks);
+ var hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
if (!hasMatchingName) {
return false;
+ } // Don't allow single Grouping blocks to be transformed into
+ // a Grouping block.
+
+
+ if (!isMultiBlock && factory_isContainerGroupBlock(sourceBlock.name) && factory_isContainerGroupBlock(transform.blockName)) {
+ return false;
} // If the transform has a `isMatch` function specified, check that it returns true.
- if (Object(external_lodash_["isFunction"])(transform.isMatch)) {
+ if (Object(external_this_lodash_["isFunction"])(transform.isMatch)) {
var attributes = transform.isMultiBlock ? blocks.map(function (block) {
return block.attributes;
}) : sourceBlock.attributes;
@@ -6932,13 +7688,13 @@
var factory_getBlockTypesForPossibleFromTransforms = function getBlockTypesForPossibleFromTransforms(blocks) {
- if (Object(external_lodash_["isEmpty"])(blocks)) {
+ if (Object(external_this_lodash_["isEmpty"])(blocks)) {
return [];
}
var allBlockTypes = registration_getBlockTypes(); // filter all blocks to find those with a 'from' transform.
- var blockTypesWithPossibleFromTransforms = Object(external_lodash_["filter"])(allBlockTypes, function (blockType) {
+ var blockTypesWithPossibleFromTransforms = Object(external_this_lodash_["filter"])(allBlockTypes, function (blockType) {
var fromTransforms = getBlockTransforms('from', blockType.name);
return !!findTransform(fromTransforms, function (transform) {
return factory_isPossibleTransformForSource(transform, 'from', blocks);
@@ -6957,19 +7713,19 @@
var factory_getBlockTypesForPossibleToTransforms = function getBlockTypesForPossibleToTransforms(blocks) {
- if (Object(external_lodash_["isEmpty"])(blocks)) {
+ if (Object(external_this_lodash_["isEmpty"])(blocks)) {
return [];
}
- var sourceBlock = Object(external_lodash_["first"])(blocks);
+ var sourceBlock = Object(external_this_lodash_["first"])(blocks);
var blockType = registration_getBlockType(sourceBlock.name);
var transformsTo = getBlockTransforms('to', blockType.name); // filter all 'to' transforms to find those that are possible.
- var possibleTransforms = Object(external_lodash_["filter"])(transformsTo, function (transform) {
- return factory_isPossibleTransformForSource(transform, 'to', blocks);
+ var possibleTransforms = Object(external_this_lodash_["filter"])(transformsTo, function (transform) {
+ return transform && factory_isPossibleTransformForSource(transform, 'to', blocks);
}); // Build a list of block names using the possible 'to' transforms.
- var blockNames = Object(external_lodash_["flatMap"])(possibleTransforms, function (transformation) {
+ var blockNames = Object(external_this_lodash_["flatMap"])(possibleTransforms, function (transformation) {
return transformation.blocks;
}); // Map block names to block types.
@@ -6978,6 +7734,33 @@
});
};
/**
+ * Determines whether transform is a "block" type
+ * and if so whether it is a "wildcard" transform
+ * ie: targets "any" block type
+ *
+ * @param {Object} t the Block transform object
+ *
+ * @return {boolean} whether transform is a wildcard transform
+ */
+
+
+var isWildcardBlockTransform = function isWildcardBlockTransform(t) {
+ return t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*');
+};
+/**
+ * Determines whether the given Block is the core Block which
+ * acts as a container Block for other Blocks as part of the
+ * Grouping mechanics
+ *
+ * @param {string} name the name of the Block to test against
+ *
+ * @return {boolean} whether or not the Block is the container Block type
+ */
+
+var factory_isContainerGroupBlock = function isContainerGroupBlock(name) {
+ return name === registration_getGroupingBlockName();
+};
+/**
* Returns an array of block types that the set of blocks received as argument
* can be transformed into.
*
@@ -6986,24 +7769,14 @@
* @return {Array} Block types that the blocks argument can be transformed to.
*/
-
function getPossibleBlockTransformations(blocks) {
- if (Object(external_lodash_["isEmpty"])(blocks)) {
- return [];
- }
-
- var sourceBlock = Object(external_lodash_["first"])(blocks);
- var isMultiBlock = blocks.length > 1;
-
- if (isMultiBlock && !Object(external_lodash_["every"])(blocks, {
- name: sourceBlock.name
- })) {
+ if (Object(external_this_lodash_["isEmpty"])(blocks)) {
return [];
}
var blockTypesForFromTransforms = factory_getBlockTypesForPossibleFromTransforms(blocks);
var blockTypesForToTransforms = factory_getBlockTypesForPossibleToTransforms(blocks);
- return Object(external_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(blockTypesForFromTransforms), Object(toConsumableArray["a" /* default */])(blockTypesForToTransforms)));
+ return Object(external_this_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(blockTypesForFromTransforms), Object(toConsumableArray["a" /* default */])(blockTypesForToTransforms)));
}
/**
* Given an array of transforms, returns the highest-priority transform where
@@ -7055,7 +7828,7 @@
function getBlockTransforms(direction, blockTypeOrName) {
// When retrieving transforms for all block types, recurse into self.
if (blockTypeOrName === undefined) {
- return Object(external_lodash_["flatMap"])(registration_getBlockTypes(), function (_ref) {
+ return Object(external_this_lodash_["flatMap"])(registration_getBlockTypes(), function (_ref) {
var name = _ref.name;
return getBlockTransforms(direction, name);
});
@@ -7074,7 +7847,7 @@
return transforms[direction].map(function (transform) {
- return Object(objectSpread["a" /* default */])({}, transform, {
+ return factory_objectSpread({}, transform, {
blockName: blockName
});
});
@@ -7085,29 +7858,22 @@
* @param {Array|Object} blocks Blocks array or block object.
* @param {string} name Block name.
*
- * @return {Array} Array of blocks.
+ * @return {?Array} Array of blocks or null.
*/
function switchToBlockType(blocks, name) {
- var blocksArray = Object(external_lodash_["castArray"])(blocks);
+ var blocksArray = Object(external_this_lodash_["castArray"])(blocks);
var isMultiBlock = blocksArray.length > 1;
var firstBlock = blocksArray[0];
- var sourceName = firstBlock.name;
-
- if (isMultiBlock && !Object(external_lodash_["every"])(blocksArray, function (block) {
- return block.name === sourceName;
- })) {
- return null;
- } // Find the right transformation by giving priority to the "to"
+ var sourceName = firstBlock.name; // Find the right transformation by giving priority to the "to"
// transformation.
-
var transformationsFrom = getBlockTransforms('from', name);
var transformationsTo = getBlockTransforms('to', sourceName);
var transformation = findTransform(transformationsTo, function (t) {
- return t.type === 'block' && t.blocks.indexOf(name) !== -1 && (!isMultiBlock || t.isMultiBlock);
+ return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock);
}) || findTransform(transformationsFrom, function (t) {
- return t.type === 'block' && t.blocks.indexOf(sourceName) !== -1 && (!isMultiBlock || t.isMultiBlock);
+ return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock);
}); // Stop if there is no valid transformation.
if (!transformation) {
@@ -7117,24 +7883,30 @@
var transformationResults;
if (transformation.isMultiBlock) {
- transformationResults = transformation.transform(blocksArray.map(function (currentBlock) {
- return currentBlock.attributes;
- }), blocksArray.map(function (currentBlock) {
- return currentBlock.innerBlocks;
- }));
+ if (Object(external_this_lodash_["has"])(transformation, '__experimentalConvert')) {
+ transformationResults = transformation.__experimentalConvert(blocksArray);
+ } else {
+ transformationResults = transformation.transform(blocksArray.map(function (currentBlock) {
+ return currentBlock.attributes;
+ }), blocksArray.map(function (currentBlock) {
+ return currentBlock.innerBlocks;
+ }));
+ }
+ } else if (Object(external_this_lodash_["has"])(transformation, '__experimentalConvert')) {
+ transformationResults = transformation.__experimentalConvert(firstBlock);
} else {
transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks);
} // Ensure that the transformation function returned an object or an array
// of objects.
- if (!Object(external_lodash_["isObjectLike"])(transformationResults)) {
+ if (!Object(external_this_lodash_["isObjectLike"])(transformationResults)) {
return null;
} // If the transformation function returned a single object, we want to work
// with an array instead.
- transformationResults = Object(external_lodash_["castArray"])(transformationResults); // Ensure that every block object returned by the transformation has a
+ transformationResults = Object(external_this_lodash_["castArray"])(transformationResults); // Ensure that every block object returned by the transformation has a
// valid block type.
if (transformationResults.some(function (result) {
@@ -7143,7 +7915,7 @@
return null;
}
- var firstSwitchedBlock = Object(external_lodash_["findIndex"])(transformationResults, function (result) {
+ var firstSwitchedBlock = Object(external_this_lodash_["findIndex"])(transformationResults, function (result) {
return result.name === name;
}); // Ensure that at least one block object returned by the transformation has
// the expected "destination" block type.
@@ -7153,7 +7925,7 @@
}
return transformationResults.map(function (result, index) {
- var transformedBlock = Object(objectSpread["a" /* default */])({}, result, {
+ var transformedBlock = factory_objectSpread({}, result, {
// The first transformed block whose type matches the "destination"
// type gets to keep the existing client ID of the first block.
clientId: index === firstSwitchedBlock ? firstBlock.clientId : result.clientId
@@ -7171,9 +7943,23 @@
return Object(external_this_wp_hooks_["applyFilters"])('blocks.switchToBlockType.transformedBlock', transformedBlock, blocks);
});
}
+/**
+ * Create a block object from the example API.
+ *
+ * @param {string} name
+ * @param {Object} example
+ *
+ * @return {Object} block.
+ */
+
+var factory_getBlockFromExample = function getBlockFromExample(name, example) {
+ return createBlock(name, example.attributes, Object(external_this_lodash_["map"])(example.innerBlocks, function (innerBlock) {
+ return getBlockFromExample(innerBlock.name, innerBlock);
+ }));
+};
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
-var slicedToArray = __webpack_require__(28);
+var slicedToArray = __webpack_require__(14);
// CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js
/**
@@ -7355,34 +8141,56 @@
};
}
// EXTERNAL MODULE: external {"this":["wp","autop"]}
-var external_this_wp_autop_ = __webpack_require__(66);
+var external_this_wp_autop_ = __webpack_require__(103);
// EXTERNAL MODULE: external {"this":["wp","blockSerializationDefaultParser"]}
-var external_this_wp_blockSerializationDefaultParser_ = __webpack_require__(205);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
-var arrayWithHoles = __webpack_require__(37);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
-var iterableToArray = __webpack_require__(34);
-
-// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
-var nonIterableRest = __webpack_require__(38);
-
-// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js
-
-
-
-function _toArray(arr) {
- return Object(arrayWithHoles["a" /* default */])(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(nonIterableRest["a" /* default */])();
-}
+var external_this_wp_blockSerializationDefaultParser_ = __webpack_require__(268);
+
+// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js
+var toArray = __webpack_require__(146);
+
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
-var classCallCheck = __webpack_require__(10);
+var classCallCheck = __webpack_require__(20);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
-var createClass = __webpack_require__(9);
-
-// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/utils.js
+var createClass = __webpack_require__(19);
+
+// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js
+/**
+ * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json
+ * do not edit
+ */
+var namedCharRefs = {
+ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "", NegativeThickSpace: "", NegativeThinSpace: "", NegativeVeryThinSpace: "", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: " ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c"
+};
+
+var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
+var CHARCODE = /^#([0-9]+)$/;
+var NAMED = /^([A-Za-z0-9]+)$/;
+var EntityParser = /** @class */ (function () {
+ function EntityParser(named) {
+ this.named = named;
+ }
+ EntityParser.prototype.parse = function (entity) {
+ if (!entity) {
+ return;
+ }
+ var matches = entity.match(HEXCHARCODE);
+ if (matches) {
+ return String.fromCharCode(parseInt(matches[1], 16));
+ }
+ matches = entity.match(CHARCODE);
+ if (matches) {
+ return String.fromCharCode(parseInt(matches[1], 10));
+ }
+ matches = entity.match(NAMED);
+ if (matches) {
+ return this.named[matches[1]];
+ }
+ };
+ return EntityParser;
+}());
+
var WSP = /[\t\n\f ]/;
var ALPHA = /[A-Za-z]/;
var CRLF = /\r\n?/g;
@@ -7393,54 +8201,50 @@
return ALPHA.test(char);
}
function preprocessInput(input) {
- return input.replace(CRLF, "\n");
-}
-function unwrap(maybe, msg) {
- if (!maybe)
- throw new Error((msg || 'value') + " was null");
- return maybe;
-}
-function or(maybe, otherwise) {
- return maybe || otherwise;
-}
-
-// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/evented-tokenizer.js
-
-var evented_tokenizer_EventedTokenizer = /** @class */ (function () {
+ return input.replace(CRLF, '\n');
+}
+
+var EventedTokenizer = /** @class */ (function () {
function EventedTokenizer(delegate, entityParser) {
this.delegate = delegate;
this.entityParser = entityParser;
- this.state = null;
- this.input = null;
- this.index = -1;
- this.tagLine = -1;
- this.tagColumn = -1;
+ this.state = "beforeData" /* beforeData */;
this.line = -1;
this.column = -1;
+ this.input = '';
+ this.index = -1;
+ this.tagNameBuffer = '';
this.states = {
beforeData: function () {
var char = this.peek();
- if (char === "<") {
- this.state = 'tagOpen';
+ if (char === '<' && !this.isIgnoredEndTag()) {
+ this.transitionTo("tagOpen" /* tagOpen */);
this.markTagStart();
this.consume();
}
else {
- this.state = 'data';
+ if (char === '\n') {
+ var tag = this.tagNameBuffer.toLowerCase();
+ if (tag === 'pre' || tag === 'textarea') {
+ this.consume();
+ }
+ }
+ this.transitionTo("data" /* data */);
this.delegate.beginData();
}
},
data: function () {
var char = this.peek();
- if (char === "<") {
+ var tag = this.tagNameBuffer;
+ if (char === '<' && !this.isIgnoredEndTag()) {
this.delegate.finishData();
- this.state = 'tagOpen';
+ this.transitionTo("tagOpen" /* tagOpen */);
this.markTagStart();
this.consume();
}
- else if (char === "&") {
+ else if (char === '&' && tag !== 'script' && tag !== 'style') {
this.consume();
- this.delegate.appendToData(this.consumeCharRef() || "&");
+ this.delegate.appendToData(this.consumeCharRef() || '&');
}
else {
this.consume();
@@ -7449,58 +8253,59 @@
},
tagOpen: function () {
var char = this.consume();
- if (char === "!") {
- this.state = 'markupDeclaration';
+ if (char === '!') {
+ this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */);
+ }
+ else if (char === '/') {
+ this.transitionTo("endTagOpen" /* endTagOpen */);
}
- else if (char === "/") {
- this.state = 'endTagOpen';
- }
- else if (isAlpha(char)) {
- this.state = 'tagName';
+ else if (char === '@' || char === ':' || isAlpha(char)) {
+ this.transitionTo("tagName" /* tagName */);
+ this.tagNameBuffer = '';
this.delegate.beginStartTag();
- this.delegate.appendToTagName(char.toLowerCase());
+ this.appendToTagName(char);
}
},
- markupDeclaration: function () {
+ markupDeclarationOpen: function () {
var char = this.consume();
- if (char === "-" && this.input.charAt(this.index) === "-") {
+ if (char === '-' && this.peek() === '-') {
this.consume();
- this.state = 'commentStart';
+ this.transitionTo("commentStart" /* commentStart */);
this.delegate.beginComment();
}
},
commentStart: function () {
var char = this.consume();
- if (char === "-") {
- this.state = 'commentStartDash';
+ if (char === '-') {
+ this.transitionTo("commentStartDash" /* commentStartDash */);
}
- else if (char === ">") {
+ else if (char === '>') {
this.delegate.finishComment();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
this.delegate.appendToCommentData(char);
- this.state = 'comment';
+ this.transitionTo("comment" /* comment */);
}
},
commentStartDash: function () {
var char = this.consume();
- if (char === "-") {
- this.state = 'commentEnd';
+ if (char === '-') {
+ this.transitionTo("commentEnd" /* commentEnd */);
}
- else if (char === ">") {
+ else if (char === '>') {
this.delegate.finishComment();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
- this.delegate.appendToCommentData("-");
- this.state = 'comment';
+ this.delegate.appendToCommentData('-');
+ this.transitionTo("comment" /* comment */);
}
},
comment: function () {
var char = this.consume();
- if (char === "-") {
- this.state = 'commentEndDash';
+ if (char === '-') {
+ this.transitionTo("commentEndDash" /* commentEndDash */);
}
else {
this.delegate.appendToCommentData(char);
@@ -7508,39 +8313,58 @@
},
commentEndDash: function () {
var char = this.consume();
- if (char === "-") {
- this.state = 'commentEnd';
+ if (char === '-') {
+ this.transitionTo("commentEnd" /* commentEnd */);
}
else {
- this.delegate.appendToCommentData("-" + char);
- this.state = 'comment';
+ this.delegate.appendToCommentData('-' + char);
+ this.transitionTo("comment" /* comment */);
}
},
commentEnd: function () {
var char = this.consume();
- if (char === ">") {
+ if (char === '>') {
this.delegate.finishComment();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
- this.delegate.appendToCommentData("--" + char);
- this.state = 'comment';
+ this.delegate.appendToCommentData('--' + char);
+ this.transitionTo("comment" /* comment */);
}
},
tagName: function () {
var char = this.consume();
if (isSpace(char)) {
- this.state = 'beforeAttributeName';
+ this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
- else if (char === "/") {
- this.state = 'selfClosingStartTag';
+ else if (char === '/') {
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
- else if (char === ">") {
+ else if (char === '>') {
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
- this.delegate.appendToTagName(char);
+ this.appendToTagName(char);
+ }
+ },
+ endTagName: function () {
+ var char = this.consume();
+ if (isSpace(char)) {
+ this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
+ this.tagNameBuffer = '';
+ }
+ else if (char === '/') {
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
+ this.tagNameBuffer = '';
+ }
+ else if (char === '>') {
+ this.delegate.finishTag();
+ this.transitionTo("beforeData" /* beforeData */);
+ this.tagNameBuffer = '';
+ }
+ else {
+ this.appendToTagName(char);
}
},
beforeAttributeName: function () {
@@ -7549,52 +8373,52 @@
this.consume();
return;
}
- else if (char === "/") {
- this.state = 'selfClosingStartTag';
+ else if (char === '/') {
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.consume();
}
- else if (char === ">") {
+ else if (char === '>') {
this.consume();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else if (char === '=') {
- this.delegate.reportSyntaxError("attribute name cannot start with equals sign");
- this.state = 'attributeName';
+ this.delegate.reportSyntaxError('attribute name cannot start with equals sign');
+ this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
this.consume();
this.delegate.appendToAttributeName(char);
}
else {
- this.state = 'attributeName';
+ this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
}
},
attributeName: function () {
var char = this.peek();
if (isSpace(char)) {
- this.state = 'afterAttributeName';
+ this.transitionTo("afterAttributeName" /* afterAttributeName */);
this.consume();
}
- else if (char === "/") {
+ else if (char === '/') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
- this.state = 'selfClosingStartTag';
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
- else if (char === "=") {
- this.state = 'beforeAttributeValue';
+ else if (char === '=') {
+ this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
this.consume();
}
- else if (char === ">") {
+ else if (char === '>') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else if (char === '"' || char === "'" || char === '<') {
- this.delegate.reportSyntaxError(char + " is not a valid character within attribute names");
+ this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names');
this.consume();
this.delegate.appendToAttributeName(char);
}
@@ -7609,29 +8433,29 @@
this.consume();
return;
}
- else if (char === "/") {
+ else if (char === '/') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
- this.state = 'selfClosingStartTag';
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
- else if (char === "=") {
+ else if (char === '=') {
this.consume();
- this.state = 'beforeAttributeValue';
+ this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
}
- else if (char === ">") {
+ else if (char === '>') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
+ this.transitionTo("attributeName" /* attributeName */);
+ this.delegate.beginAttribute();
this.consume();
- this.state = 'attributeName';
- this.delegate.beginAttribute();
this.delegate.appendToAttributeName(char);
}
},
@@ -7641,24 +8465,24 @@
this.consume();
}
else if (char === '"') {
- this.state = 'attributeValueDoubleQuoted';
+ this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */);
this.delegate.beginAttributeValue(true);
this.consume();
}
else if (char === "'") {
- this.state = 'attributeValueSingleQuoted';
+ this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */);
this.delegate.beginAttributeValue(true);
this.consume();
}
- else if (char === ">") {
+ else if (char === '>') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
- this.state = 'attributeValueUnquoted';
+ this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
this.delegate.beginAttributeValue(false);
this.consume();
this.delegate.appendToAttributeValue(char);
@@ -7668,10 +8492,10 @@
var char = this.consume();
if (char === '"') {
this.delegate.finishAttributeValue();
- this.state = 'afterAttributeValueQuoted';
+ this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
}
- else if (char === "&") {
- this.delegate.appendToAttributeValue(this.consumeCharRef('"') || "&");
+ else if (char === '&') {
+ this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
}
else {
this.delegate.appendToAttributeValue(char);
@@ -7681,10 +8505,10 @@
var char = this.consume();
if (char === "'") {
this.delegate.finishAttributeValue();
- this.state = 'afterAttributeValueQuoted';
+ this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
}
- else if (char === "&") {
- this.delegate.appendToAttributeValue(this.consumeCharRef("'") || "&");
+ else if (char === '&') {
+ this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
}
else {
this.delegate.appendToAttributeValue(char);
@@ -7695,17 +8519,22 @@
if (isSpace(char)) {
this.delegate.finishAttributeValue();
this.consume();
- this.state = 'beforeAttributeName';
+ this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
- else if (char === "&") {
+ else if (char === '/') {
+ this.delegate.finishAttributeValue();
this.consume();
- this.delegate.appendToAttributeValue(this.consumeCharRef(">") || "&");
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
- else if (char === ">") {
+ else if (char === '&') {
+ this.consume();
+ this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
+ }
+ else if (char === '>') {
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
this.consume();
@@ -7716,54 +8545,57 @@
var char = this.peek();
if (isSpace(char)) {
this.consume();
- this.state = 'beforeAttributeName';
+ this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
- else if (char === "/") {
+ else if (char === '/') {
this.consume();
- this.state = 'selfClosingStartTag';
+ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
- else if (char === ">") {
+ else if (char === '>') {
this.consume();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
- this.state = 'beforeAttributeName';
+ this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
},
selfClosingStartTag: function () {
var char = this.peek();
- if (char === ">") {
+ if (char === '>') {
this.consume();
this.delegate.markTagAsSelfClosing();
this.delegate.finishTag();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
else {
- this.state = 'beforeAttributeName';
+ this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
},
endTagOpen: function () {
var char = this.consume();
- if (isAlpha(char)) {
- this.state = 'tagName';
+ if (char === '@' || char === ':' || isAlpha(char)) {
+ this.transitionTo("endTagName" /* endTagName */);
+ this.tagNameBuffer = '';
this.delegate.beginEndTag();
- this.delegate.appendToTagName(char.toLowerCase());
+ this.appendToTagName(char);
}
}
};
this.reset();
}
EventedTokenizer.prototype.reset = function () {
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
this.input = '';
+ this.tagNameBuffer = '';
this.index = 0;
this.line = 1;
this.column = 0;
- this.tagLine = -1;
- this.tagColumn = -1;
this.delegate.reset();
};
+ EventedTokenizer.prototype.transitionTo = function (state) {
+ this.state = state;
+ };
EventedTokenizer.prototype.tokenize = function (input) {
this.reset();
this.tokenizePart(input);
@@ -7772,7 +8604,13 @@
EventedTokenizer.prototype.tokenizePart = function (input) {
this.input += preprocessInput(input);
while (this.index < this.input.length) {
- this.states[this.state].call(this);
+ var handler = this.states[this.state];
+ if (handler !== undefined) {
+ handler.call(this);
+ }
+ else {
+ throw new Error("unhandled state " + this.state);
+ }
}
};
EventedTokenizer.prototype.tokenizeEOF = function () {
@@ -7781,7 +8619,7 @@
EventedTokenizer.prototype.flushData = function () {
if (this.state === 'data') {
this.delegate.finishData();
- this.state = 'beforeData';
+ this.transitionTo("beforeData" /* beforeData */);
}
};
EventedTokenizer.prototype.peek = function () {
@@ -7790,7 +8628,7 @@
EventedTokenizer.prototype.consume = function () {
var char = this.peek();
this.index++;
- if (char === "\n") {
+ if (char === '\n') {
this.line++;
this.column = 0;
}
@@ -7819,42 +8657,32 @@
}
};
EventedTokenizer.prototype.markTagStart = function () {
- // these properties to be removed in next major bump
- this.tagLine = this.line;
- this.tagColumn = this.column;
- if (this.delegate.tagOpen) {
- this.delegate.tagOpen();
- }
+ this.delegate.tagOpen();
+ };
+ EventedTokenizer.prototype.appendToTagName = function (char) {
+ this.tagNameBuffer += char;
+ this.delegate.appendToTagName(char);
+ };
+ EventedTokenizer.prototype.isIgnoredEndTag = function () {
+ var tag = this.tagNameBuffer;
+ return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
+ (tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
+ (tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>');
};
return EventedTokenizer;
}());
-/* harmony default export */ var evented_tokenizer = (evented_tokenizer_EventedTokenizer);
-
-// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/tokenizer.js
-
-
-;
-var tokenizer_Tokenizer = /** @class */ (function () {
+
+var Tokenizer = /** @class */ (function () {
function Tokenizer(entityParser, options) {
if (options === void 0) { options = {}; }
this.options = options;
- this._token = null;
+ this.token = null;
this.startLine = 1;
this.startColumn = 0;
this.tokens = [];
- this.currentAttribute = null;
- this.tokenizer = new evented_tokenizer(this, entityParser);
- }
- Object.defineProperty(Tokenizer.prototype, "token", {
- get: function () {
- return unwrap(this._token);
- },
- set: function (value) {
- this._token = value;
- },
- enumerable: true,
- configurable: true
- });
+ this.tokenizer = new EventedTokenizer(this, entityParser);
+ this._currentAttribute = undefined;
+ }
Tokenizer.prototype.tokenize = function (input) {
this.tokens = [];
this.tokenizer.tokenize(input);
@@ -7871,13 +8699,35 @@
return this.tokens[0];
};
Tokenizer.prototype.reset = function () {
- this._token = null;
+ this.token = null;
this.startLine = 1;
this.startColumn = 0;
};
+ Tokenizer.prototype.current = function () {
+ var token = this.token;
+ if (token === null) {
+ throw new Error('token was unexpectedly null');
+ }
+ if (arguments.length === 0) {
+ return token;
+ }
+ for (var i = 0; i < arguments.length; i++) {
+ if (token.type === arguments[i]) {
+ return token;
+ }
+ }
+ throw new Error("token type was unexpectedly " + token.type);
+ };
+ Tokenizer.prototype.push = function (token) {
+ this.token = token;
+ this.tokens.push(token);
+ };
+ Tokenizer.prototype.currentAttribute = function () {
+ return this._currentAttribute;
+ };
Tokenizer.prototype.addLocInfo = function () {
if (this.options.loc) {
- this.token.loc = {
+ this.current().loc = {
start: {
line: this.startLine,
column: this.startColumn
@@ -7893,99 +8743,169 @@
};
// Data
Tokenizer.prototype.beginData = function () {
- this.token = {
- type: 'Chars',
+ this.push({
+ type: "Chars" /* Chars */,
chars: ''
- };
- this.tokens.push(this.token);
+ });
};
Tokenizer.prototype.appendToData = function (char) {
- this.token.chars += char;
+ this.current("Chars" /* Chars */).chars += char;
};
Tokenizer.prototype.finishData = function () {
this.addLocInfo();
};
// Comment
Tokenizer.prototype.beginComment = function () {
- this.token = {
- type: 'Comment',
+ this.push({
+ type: "Comment" /* Comment */,
chars: ''
- };
- this.tokens.push(this.token);
+ });
};
Tokenizer.prototype.appendToCommentData = function (char) {
- this.token.chars += char;
+ this.current("Comment" /* Comment */).chars += char;
};
Tokenizer.prototype.finishComment = function () {
this.addLocInfo();
};
// Tags - basic
+ Tokenizer.prototype.tagOpen = function () { };
Tokenizer.prototype.beginStartTag = function () {
- this.token = {
- type: 'StartTag',
+ this.push({
+ type: "StartTag" /* StartTag */,
tagName: '',
attributes: [],
selfClosing: false
- };
- this.tokens.push(this.token);
+ });
};
Tokenizer.prototype.beginEndTag = function () {
- this.token = {
- type: 'EndTag',
+ this.push({
+ type: "EndTag" /* EndTag */,
tagName: ''
- };
- this.tokens.push(this.token);
+ });
};
Tokenizer.prototype.finishTag = function () {
this.addLocInfo();
};
Tokenizer.prototype.markTagAsSelfClosing = function () {
- this.token.selfClosing = true;
+ this.current("StartTag" /* StartTag */).selfClosing = true;
};
// Tags - name
Tokenizer.prototype.appendToTagName = function (char) {
- this.token.tagName += char;
+ this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char;
};
// Tags - attributes
Tokenizer.prototype.beginAttribute = function () {
- var attributes = unwrap(this.token.attributes, "current token's attributs");
- this.currentAttribute = ["", "", false];
- attributes.push(this.currentAttribute);
+ this._currentAttribute = ['', '', false];
};
Tokenizer.prototype.appendToAttributeName = function (char) {
- var currentAttribute = unwrap(this.currentAttribute);
- currentAttribute[0] += char;
+ this.currentAttribute()[0] += char;
};
Tokenizer.prototype.beginAttributeValue = function (isQuoted) {
- var currentAttribute = unwrap(this.currentAttribute);
- currentAttribute[2] = isQuoted;
+ this.currentAttribute()[2] = isQuoted;
};
Tokenizer.prototype.appendToAttributeValue = function (char) {
- var currentAttribute = unwrap(this.currentAttribute);
- currentAttribute[1] = currentAttribute[1] || "";
- currentAttribute[1] += char;
+ this.currentAttribute()[1] += char;
};
Tokenizer.prototype.finishAttributeValue = function () {
+ this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
};
Tokenizer.prototype.reportSyntaxError = function (message) {
- this.token.syntaxError = message;
+ this.current().syntaxError = message;
};
return Tokenizer;
}());
-/* harmony default export */ var tokenizer = (tokenizer_Tokenizer);
+
+function tokenize(input, options) {
+ var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options);
+ return tokenizer.tokenize(input);
+}
+
+
// EXTERNAL MODULE: external {"this":["wp","htmlEntities"]}
-var external_this_wp_htmlEntities_ = __webpack_require__(57);
+var external_this_wp_htmlEntities_ = __webpack_require__(75);
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/logger.js
+function createLogger() {
+ /**
+ * Creates a log handler with block validation prefix.
+ *
+ * @param {Function} logger Original logger function.
+ *
+ * @return {Function} Augmented logger function.
+ */
+ function createLogHandler(logger) {
+ var log = function log(message) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ return logger.apply(void 0, ['Block validation: ' + message].concat(args));
+ }; // In test environments, pre-process the sprintf message to improve
+ // readability of error messages. We'd prefer to avoid pulling in this
+ // dependency in runtime environments, and it can be dropped by a combo
+ // of Webpack env substitution + UglifyJS dead code elimination.
+
+
+ if (false) {}
+
+ return log;
+ }
+
+ return {
+ // eslint-disable-next-line no-console
+ error: createLogHandler(console.error),
+ // eslint-disable-next-line no-console
+ warning: createLogHandler(console.warn),
+ getItems: function getItems() {
+ return [];
+ }
+ };
+}
+function createQueuedLogger() {
+ /**
+ * The list of enqueued log actions to print.
+ *
+ * @type {Array}
+ */
+ var queue = [];
+ var logger = createLogger();
+ return {
+ error: function error() {
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ args[_key2] = arguments[_key2];
+ }
+
+ queue.push({
+ log: logger.error,
+ args: args
+ });
+ },
+ warning: function warning() {
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
+ args[_key3] = arguments[_key3];
+ }
+
+ queue.push({
+ log: logger.warning,
+ args: args
+ });
+ },
+ getItems: function getItems() {
+ return queue;
+ }
+ };
+}
// EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
-var external_this_wp_isShallowEqual_ = __webpack_require__(42);
+var external_this_wp_isShallowEqual_ = __webpack_require__(64);
var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
-var esm_extends = __webpack_require__(19);
+var esm_extends = __webpack_require__(8);
// EXTERNAL MODULE: external {"this":["wp","compose"]}
-var external_this_wp_compose_ = __webpack_require__(6);
+var external_this_wp_compose_ = __webpack_require__(9);
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/block-content-provider/index.js
@@ -8020,7 +8940,11 @@
* </BlockContentProvider>
* ```
*
- * @return {WPElement} Element with BlockContent injected via context.
+ * @param {Object} props Component props.
+ * @param {WPElement} props.children Block save result.
+ * @param {Array} props.innerBlocks Block(s) to serialize.
+ *
+ * @return {WPComponent} Element with BlockContent injected via context.
*/
@@ -8030,7 +8954,9 @@
var BlockContent = function BlockContent() {
// Value is an array of blocks, so defer to block serializer
- var html = serialize(innerBlocks); // Use special-cased raw HTML tag to avoid default escaping
+ var html = serialize(innerBlocks, {
+ isInnerBlocks: true
+ }); // Use special-cased raw HTML tag to avoid default escaping
return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, html);
};
@@ -8043,7 +8969,7 @@
* A Higher Order Component used to inject BlockContent using context to the
* wrapped component.
*
- * @return {Component} Enhanced component with injected BlockContent as prop.
+ * @return {WPComponent} Enhanced component with injected BlockContent as prop.
*/
@@ -8062,6 +8988,10 @@
+function serializer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function serializer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { serializer_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { serializer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -8081,6 +9011,12 @@
/**
+ * @typedef {Object} WPBlockSerializationOptions Serialization Options.
+ *
+ * @property {boolean} isInnerBlocks Whether we are serializing inner blocks.
+ */
+
+/**
* Returns the block's default classname from its name.
*
* @param {string} blockName The block name.
@@ -8138,15 +9074,15 @@
innerBlocks: innerBlocks
});
- if (Object(external_lodash_["isObject"])(element) && Object(external_this_wp_hooks_["hasFilter"])('blocks.getSaveContent.extraProps')) {
+ if (Object(external_this_lodash_["isObject"])(element) && Object(external_this_wp_hooks_["hasFilter"])('blocks.getSaveContent.extraProps')) {
/**
* Filters the props applied to the block save result element.
*
- * @param {Object} props Props applied to save element.
- * @param {WPBlockType} blockType Block type definition.
- * @param {Object} attributes Block attributes.
+ * @param {Object} props Props applied to save element.
+ * @param {WPBlock} blockType Block type definition.
+ * @param {Object} attributes Block attributes.
*/
- var props = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', Object(objectSpread["a" /* default */])({}, element.props), blockType, attributes);
+ var props = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', serializer_objectSpread({}, element.props), blockType, attributes);
if (!external_this_wp_isShallowEqual_default()(props, element.props)) {
element = Object(external_this_wp_element_["cloneElement"])(element, props);
@@ -8155,9 +9091,9 @@
/**
* Filters the save result of a block during serialization.
*
- * @param {WPElement} element Block save result.
- * @param {WPBlockType} blockType Block type definition.
- * @param {Object} attributes Block attributes.
+ * @param {WPElement} element Block save result.
+ * @param {WPBlock} blockType Block type definition.
+ * @param {Object} attributes Block attributes.
*/
@@ -8199,27 +9135,27 @@
*/
function getCommentAttributes(blockType, attributes) {
- return Object(external_lodash_["reduce"])(blockType.attributes, function (result, attributeSchema, key) {
+ return Object(external_this_lodash_["reduce"])(blockType.attributes, function (accumulator, attributeSchema, key) {
var value = attributes[key]; // Ignore undefined values.
if (undefined === value) {
- return result;
+ return accumulator;
} // Ignore all attributes but the ones with an "undefined" source
// "undefined" source refers to attributes saved in the block comment.
if (attributeSchema.source !== undefined) {
- return result;
+ return accumulator;
} // Ignore default value.
if ('default' in attributeSchema && attributeSchema.default === value) {
- return result;
+ return accumulator;
} // Otherwise, include in comment set.
- result[key] = value;
- return result;
+ accumulator[key] = value;
+ return accumulator;
}, {});
}
/**
@@ -8276,9 +9212,9 @@
*/
function getCommentDelimitedContent(rawBlockName, attributes, content) {
- var serializedAttributes = !Object(external_lodash_["isEmpty"])(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix.
-
- var blockName = Object(external_lodash_["startsWith"])(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable.
+ var serializedAttributes = !Object(external_this_lodash_["isEmpty"])(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix.
+
+ var blockName = Object(external_this_lodash_["startsWith"])(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable.
if (!content) {
return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "/-->");
@@ -8290,47 +9226,54 @@
* Returns the content of a block, including comment delimiters, determining
* serialized attributes and content form from the current state of the block.
*
- * @param {Object} block Block instance.
+ * @param {Object} block Block instance.
+ * @param {WPBlockSerializationOptions} options Serialization options.
*
* @return {string} Serialized block.
*/
function serializeBlock(block) {
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ _ref$isInnerBlocks = _ref.isInnerBlocks,
+ isInnerBlocks = _ref$isInnerBlocks === void 0 ? false : _ref$isInnerBlocks;
+
var blockName = block.name;
var saveContent = getBlockContent(block);
- switch (blockName) {
- case getFreeformContentHandlerName():
- case getUnregisteredTypeHandlerName():
- return saveContent;
-
- default:
- {
- var blockType = registration_getBlockType(blockName);
- var saveAttributes = getCommentAttributes(blockType, block.attributes);
- return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
- }
- }
+ if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
+ return saveContent;
+ }
+
+ var blockType = registration_getBlockType(blockName);
+ var saveAttributes = getCommentAttributes(blockType, block.attributes);
+ return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
}
/**
* Takes a block or set of blocks and returns the serialized post content.
*
- * @param {Array} blocks Block(s) to serialize.
+ * @param {Array} blocks Block(s) to serialize.
+ * @param {WPBlockSerializationOptions} options Serialization options.
*
* @return {string} The post content.
*/
-function serialize(blocks) {
- return Object(external_lodash_["castArray"])(blocks).map(serializeBlock).join('\n\n');
-}
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation.js
-
-
-
-
-
-
+function serialize(blocks, options) {
+ return Object(external_this_lodash_["castArray"])(blocks).map(function (block) {
+ return serializeBlock(block, options);
+ }).join('\n\n');
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/index.js
+
+
+
+
+
+
+
+function validation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function validation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { validation_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { validation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**
* External dependencies
@@ -8348,6 +9291,7 @@
+
/**
* Globally matches any consecutive whitespace
*
@@ -8376,7 +9320,7 @@
* 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' ) ]
+ * Object.keys( Array.from( 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
@@ -8394,7 +9338,7 @@
* 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' ) ]
+ * Object.keys( Array.from( 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
@@ -8420,7 +9364,7 @@
* @type {Array}
*/
-var TEXT_NORMALIZATIONS = [external_lodash_["identity"], getTextWithCollapsedWhitespace];
+var TEXT_NORMALIZATIONS = [external_this_lodash_["identity"], getTextWithCollapsedWhitespace];
/**
* Regular expression matching a named character reference. In lieu of bundling
* a full set of references, the pattern covers the minimal necessary to test
@@ -8432,14 +9376,14 @@
* Tested aginst "12.5 Named character references":
*
* ```
- * const references = [ ...document.querySelectorAll(
+ * const references = Array.from( document.querySelectorAll(
* '#named-character-references-table tr[id^=entity-] td:first-child'
- * ) ].map( ( code ) => code.textContent )
+ * ) ).map( ( code ) => code.textContent )
* references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) )
* ```
*
- * @link https://html.spec.whatwg.org/multipage/syntax.html#character-references
- * @link https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
+ * @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
*
* @type {RegExp}
*/
@@ -8451,7 +9395,7 @@
* "The ampersand must be followed by a U+0023 NUMBER SIGN character (#),
* followed by one or more ASCII digits, representing a base-ten integer"
*
- * @link https://html.spec.whatwg.org/multipage/syntax.html#character-references
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
*
* @type {RegExp}
*/
@@ -8465,7 +9409,7 @@
* U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by
* one or more ASCII hex digits, representing a hexadecimal integer"
*
- * @link https://html.spec.whatwg.org/multipage/syntax.html#character-references
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
*
* @type {RegExp}
*/
@@ -8491,9 +9435,7 @@
* @see https://github.com/tildeio/simple-html-tokenizer/tree/master/src/entity-parser.ts
*/
-var validation_DecodeEntityParser =
-/*#__PURE__*/
-function () {
+var validation_DecodeEntityParser = /*#__PURE__*/function () {
function DecodeEntityParser() {
Object(classCallCheck["a" /* default */])(this, DecodeEntityParser);
}
@@ -8519,42 +9461,6 @@
return DecodeEntityParser;
}();
/**
- * Object of logger functions.
- */
-
-var log = function () {
- /**
- * Creates a logger with block validation prefix.
- *
- * @param {Function} logger Original logger function.
- *
- * @return {Function} Augmented logger function.
- */
- function createLogger(logger) {
- // In test environments, pre-process the sprintf message to improve
- // readability of error messages. We'd prefer to avoid pulling in this
- // dependency in runtime environments, and it can be dropped by a combo
- // of Webpack env substitution + UglifyJS dead code elimination.
- if (false) {}
-
- return function (message) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- return logger.apply(void 0, ['Block validation: ' + message].concat(args));
- };
- }
-
- return {
- /* eslint-disable no-console */
- error: createLogger(console.error),
- warning: createLogger(console.warn)
- /* eslint-enable no-console */
-
- };
-}();
-/**
* Given a specified string, returns an array of strings split by consecutive
* whitespace, ignoring leading or trailing whitespace.
*
@@ -8563,7 +9469,6 @@
* @return {string[]} Text pieces split on whitespace.
*/
-
function getTextPiecesSplitOnWhitespace(text) {
return text.trim().split(REGEXP_WHITESPACE);
}
@@ -8601,7 +9506,7 @@
key = _pair[0],
value = _pair[1];
- return value || key.indexOf('data-') === 0 || Object(external_lodash_["includes"])(MEANINGFUL_ATTRIBUTES, key);
+ return value || key.indexOf('data-') === 0 || Object(external_this_lodash_["includes"])(MEANINGFUL_ATTRIBUTES, key);
});
}
/**
@@ -8610,11 +9515,13 @@
*
* @param {Object} actual Actual token.
* @param {Object} expected Expected token.
+ * @param {Object} logger Validation logger object.
*
* @return {boolean} Whether two text tokens are equivalent.
*/
function isEquivalentTextTokens(actual, expected) {
+ var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
// This function is intentionally written as syntactically "ugly" as a hot
// path optimization. Text is progressively normalized in order from least-
// to-most operationally expensive, until the earliest point at which text
@@ -8632,7 +9539,7 @@
}
}
- log.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars);
+ logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars);
return false;
}
/**
@@ -8663,14 +9570,14 @@
.map(function (style) {
// ...split further into key-value pairs
var _style$split = style.split(':'),
- _style$split2 = _toArray(_style$split),
+ _style$split2 = Object(toArray["a" /* default */])(_style$split),
key = _style$split2[0],
valueParts = _style$split2.slice(1);
var value = valueParts.join(':');
return [key.trim(), getNormalizedStyleValue(value.trim())];
});
- return Object(external_lodash_["fromPairs"])(pairs);
+ return Object(external_this_lodash_["fromPairs"])(pairs);
}
/**
* Attribute-specific equality handlers
@@ -8678,17 +9585,17 @@
* @type {Object}
*/
-var isEqualAttributesOfName = Object(objectSpread["a" /* default */])({
+var isEqualAttributesOfName = validation_objectSpread({
class: function _class(actual, expected) {
// Class matches if members are the same, even if out of order or
// superfluous whitespace between.
- return !external_lodash_["xor"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getTextPiecesSplitOnWhitespace))).length;
+ return !external_this_lodash_["xor"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getTextPiecesSplitOnWhitespace))).length;
},
style: function style(actual, expected) {
- return external_lodash_["isEqual"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getStyleProperties)));
- }
-}, Object(external_lodash_["fromPairs"])(BOOLEAN_ATTRIBUTES.map(function (attribute) {
- return [attribute, external_lodash_["stubTrue"]];
+ return external_this_lodash_["isEqual"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getStyleProperties)));
+ }
+}, Object(external_this_lodash_["fromPairs"])(BOOLEAN_ATTRIBUTES.map(function (attribute) {
+ return [attribute, external_this_lodash_["stubTrue"]];
})));
/**
* Given two sets of attribute tuples, returns true if the attribute sets are
@@ -8696,45 +9603,55 @@
*
* @param {Array[]} actual Actual attributes tuples.
* @param {Array[]} expected Expected attributes tuples.
+ * @param {Object} logger Validation logger object.
*
* @return {boolean} Whether attributes are equivalent.
*/
function isEqualTagAttributePairs(actual, expected) {
+ var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
+
// Attributes is tokenized as tuples. Their lengths should match. This also
// avoids us needing to check both attributes sets, since if A has any keys
// which do not exist in B, we know the sets to be different.
if (actual.length !== expected.length) {
- log.warning('Expected attributes %o, instead saw %o.', expected, actual);
+ logger.warning('Expected attributes %o, instead saw %o.', expected, actual);
return false;
- } // Convert tuples to object for ease of lookup
-
-
- var _map = [actual, expected].map(external_lodash_["fromPairs"]),
- _map2 = Object(slicedToArray["a" /* default */])(_map, 2),
- actualAttributes = _map2[0],
- expectedAttributes = _map2[1];
-
- for (var name in actualAttributes) {
- // As noted above, if missing member in B, assume different
- if (!expectedAttributes.hasOwnProperty(name)) {
- log.warning('Encountered unexpected attribute `%s`.', name);
+ } // Attributes are not guaranteed to occur in the same order. For validating
+ // actual attributes, first convert the set of expected attribute values to
+ // an object, for lookup by key.
+
+
+ var expectedAttributes = {};
+
+ for (var i = 0; i < expected.length; i++) {
+ expectedAttributes[expected[i][0].toLowerCase()] = expected[i][1];
+ }
+
+ for (var _i = 0; _i < actual.length; _i++) {
+ var _actual$_i = Object(slicedToArray["a" /* default */])(actual[_i], 2),
+ name = _actual$_i[0],
+ actualValue = _actual$_i[1];
+
+ var nameLower = name.toLowerCase(); // As noted above, if missing member in B, assume different
+
+ if (!expectedAttributes.hasOwnProperty(nameLower)) {
+ logger.warning('Encountered unexpected attribute `%s`.', name);
return false;
}
- var actualValue = actualAttributes[name];
- var expectedValue = expectedAttributes[name];
- var isEqualAttributes = isEqualAttributesOfName[name];
+ var expectedValue = expectedAttributes[nameLower];
+ var isEqualAttributes = isEqualAttributesOfName[nameLower];
if (isEqualAttributes) {
// Defer custom attribute equality handling
if (!isEqualAttributes(actualValue, expectedValue)) {
- log.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
+ logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
return false;
}
} else if (actualValue !== expectedValue) {
// Otherwise strict inequality should bail
- log.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
+ logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
return false;
}
}
@@ -8749,12 +9666,17 @@
var isEqualTokensOfType = {
StartTag: function StartTag(actual, expected) {
- if (actual.tagName !== expected.tagName) {
- log.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName);
+ var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
+
+ if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case-
+ // insensitive check on the assumption that the majority case will
+ // have exactly equal tag names.
+ actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) {
+ logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName);
return false;
}
- return isEqualTagAttributePairs.apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getMeaningfulAttributePairs)));
+ return isEqualTagAttributePairs.apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getMeaningfulAttributePairs)).concat([logger]));
},
Chars: isEquivalentTextTokens,
Comment: isEquivalentTextTokens
@@ -8787,16 +9709,19 @@
* Tokenize an HTML string, gracefully handling any errors thrown during
* underlying tokenization.
*
- * @param {string} html HTML string to tokenize.
+ * @param {string} html HTML string to tokenize.
+ * @param {Object} logger Validation logger object.
*
* @return {Object[]|null} Array of valid tokenized HTML elements, or null on error
*/
function getHTMLTokens(html) {
+ var logger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createLogger();
+
try {
- return new tokenizer(new validation_DecodeEntityParser()).tokenize(html);
+ return new Tokenizer(new validation_DecodeEntityParser()).tokenize(html);
} catch (e) {
- log.warning('Malformed HTML detected: %s', html);
+ logger.warning('Malformed HTML detected: %s', html);
}
return null;
@@ -8829,18 +9754,28 @@
* false otherwise. Invalid HTML is not considered equivalent, even if the
* strings directly match.
*
- * @param {string} actual Actual HTML string.
+ * @param {string} actual Actual HTML string.
* @param {string} expected Expected HTML string.
+ * @param {Object} logger Validation logger object.
*
* @return {boolean} Whether HTML strings are equivalent.
*/
function isEquivalentHTML(actual, expected) {
- // Tokenize input content and reserialized save content
- var _map3 = [actual, expected].map(getHTMLTokens),
- _map4 = Object(slicedToArray["a" /* default */])(_map3, 2),
- actualTokens = _map4[0],
- expectedTokens = _map4[1]; // If either is malformed then stop comparing - the strings are not equivalent
+ var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger();
+
+ // Short-circuit if markup is identical.
+ if (actual === expected) {
+ return true;
+ } // Tokenize input content and reserialized save content
+
+
+ var _map = [actual, expected].map(function (html) {
+ return getHTMLTokens(html, logger);
+ }),
+ _map2 = Object(slicedToArray["a" /* default */])(_map, 2),
+ actualTokens = _map2[0],
+ expectedTokens = _map2[1]; // If either is malformed then stop comparing - the strings are not equivalent
if (!actualTokens || !expectedTokens) {
@@ -8853,13 +9788,13 @@
expectedToken = getNextNonWhitespaceToken(expectedTokens); // Inequal if exhausted all expected tokens
if (!expectedToken) {
- log.warning('Expected end of content, instead saw %o.', actualToken);
+ logger.warning('Expected end of content, instead saw %o.', actualToken);
return false;
} // Inequal if next non-whitespace token of each set are not same type
if (actualToken.type !== expectedToken.type) {
- log.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken);
+ logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken);
return false;
} // Defer custom token type equality handling, otherwise continue and
// assume as equal
@@ -8867,7 +9802,7 @@
var isEqualTokens = isEqualTokensOfType[actualToken.type];
- if (isEqualTokens && !isEqualTokens(actualToken, expectedToken)) {
+ if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) {
return false;
} // Peek at the next tokens (actual and expected) to see if they close
// a self-closing tag
@@ -8887,13 +9822,53 @@
if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) {
// If any non-whitespace tokens remain in expected token set, this
// indicates inequality
- log.warning('Expected %o, instead saw end of content.', expectedToken);
+ logger.warning('Expected %o, instead saw end of content.', expectedToken);
return false;
}
return true;
}
/**
+ * Returns an object with `isValid` property set to `true` if the parsed block
+ * is valid given the input content. A block is considered valid if, when serialized
+ * with assumed attributes, the content matches the original value. If block is
+ * invalid, this function returns all validations issues as well.
+ *
+ * @param {string|Object} blockTypeOrName Block type.
+ * @param {Object} attributes Parsed block attributes.
+ * @param {string} originalBlockContent Original block content.
+ * @param {Object} logger Validation logger object.
+ *
+ * @return {Object} Whether block is valid and contains validation messages.
+ */
+
+function getBlockContentValidationResult(blockTypeOrName, attributes, originalBlockContent) {
+ var logger = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : createQueuedLogger();
+ var blockType = normalizeBlockType(blockTypeOrName);
+ var generatedBlockContent;
+
+ try {
+ generatedBlockContent = getSaveContent(blockType, attributes);
+ } catch (error) {
+ logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString());
+ return {
+ isValid: false,
+ validationIssues: logger.getItems()
+ };
+ }
+
+ var isValid = isEquivalentHTML(originalBlockContent, generatedBlockContent, logger);
+
+ if (!isValid) {
+ logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, originalBlockContent);
+ }
+
+ return {
+ isValid: isValid,
+ validationIssues: logger.getItems()
+ };
+}
+/**
* Returns true if the parsed block is valid given the input content. A block
* is considered valid if, when serialized with assumed attributes, the content
* matches the original value.
@@ -8908,150 +9883,24 @@
*/
function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) {
- var blockType = normalizeBlockType(blockTypeOrName);
- var generatedBlockContent;
-
- try {
- generatedBlockContent = getSaveContent(blockType, attributes);
- } catch (error) {
- log.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString());
- return false;
- }
-
- var isValid = isEquivalentHTML(originalBlockContent, generatedBlockContent);
-
- if (!isValid) {
- log.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, originalBlockContent);
- }
+ var _getBlockContentValid = getBlockContentValidationResult(blockTypeOrName, attributes, originalBlockContent, createLogger()),
+ isValid = _getBlockContentValid.isValid;
return isValid;
}
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js
/**
* External dependencies
*/
/**
- * WordPress dependencies
- */
-
-
-/**
* Internal dependencies
*/
-/**
- * A representation of a block's rich text value.
- *
- * @typedef {WPBlockNode[]} WPBlockChildren
- */
-
-/**
- * Given block children, returns a serialize-capable WordPress element.
- *
- * @param {WPBlockChildren} children Block children object to convert.
- *
- * @return {WPElement} A serialize-capable element.
- */
-
-function getSerializeCapableElement(children) {
- // The fact that block children are compatible with the element serializer is
- // merely an implementation detail that currently serves to be true, but
- // should not be mistaken as being a guarantee on the external API. The
- // public API only offers guarantees to work with strings (toHTML) and DOM
- // elements (fromDOM), and should provide utilities to manipulate the value
- // rather than expect consumers to inspect or construct its shape (concat).
- return children;
-}
-/**
- * Given block children, returns an array of block nodes.
- *
- * @param {WPBlockChildren} children Block children object to convert.
- *
- * @return {Array<WPBlockNode>} An array of individual block nodes.
- */
-
-function getChildrenArray(children) {
- // The fact that block children are compatible with the element serializer
- // is merely an implementation detail that currently serves to be true, but
- // should not be mistaken as being a guarantee on the external API.
- return children;
-}
-/**
- * Given two or more block nodes, returns a new block node representing a
- * concatenation of its values.
- *
- * @param {...WPBlockChildren} blockNodes Block nodes to concatenate.
- *
- * @return {WPBlockChildren} Concatenated block node.
- */
-
-
-function concat() {
- var result = [];
-
- for (var i = 0; i < arguments.length; i++) {
- var blockNode = Object(external_lodash_["castArray"])(i < 0 || arguments.length <= i ? undefined : arguments[i]);
-
- for (var j = 0; j < blockNode.length; j++) {
- var child = blockNode[j];
- var canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string';
-
- if (canConcatToPreviousString) {
- result[result.length - 1] += child;
- } else {
- result.push(child);
- }
- }
- }
-
- return result;
-}
-/**
- * Given an iterable set of DOM nodes, returns equivalent block children.
- * Ignores any non-element/text nodes included in set.
- *
- * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert.
- *
- * @return {WPBlockChildren} Block children equivalent to DOM nodes.
- */
-
-function fromDOM(domNodes) {
- var result = [];
-
- for (var i = 0; i < domNodes.length; i++) {
- try {
- result.push(node_fromDOM(domNodes[i]));
- } catch (error) {// Simply ignore if DOM node could not be converted.
- }
- }
-
- return result;
-}
-/**
- * Given a block node, returns its HTML string representation.
- *
- * @param {WPBlockChildren} children Block node(s) to convert to string.
- *
- * @return {string} String HTML representation of block node.
- */
-
-function toHTML(children) {
- var element = getSerializeCapableElement(children);
- return Object(external_this_wp_element_["renderToString"])(element);
-}
-/**
- * Given a selector, returns an hpq matcher generating a WPBlockChildren value
- * matching the selector result.
- *
- * @param {string} selector DOM selector.
- *
- * @return {Function} hpq matcher.
- */
-
-function children_matcher(selector) {
+
+function matchers_html(selector, multilineTag) {
return function (domNode) {
var match = domNode;
@@ -9059,24 +9908,38 @@
match = domNode.querySelector(selector);
}
- if (match) {
- return fromDOM(match.childNodes);
- }
-
- return [];
+ if (!match) {
+ return '';
+ }
+
+ if (multilineTag) {
+ var value = '';
+ var length = match.children.length;
+
+ for (var index = 0; index < length; index++) {
+ var child = match.children[index];
+
+ if (child.nodeName.toLowerCase() !== multilineTag) {
+ continue;
+ }
+
+ value += child.outerHTML;
+ }
+
+ return value;
+ }
+
+ return match.innerHTML;
};
}
-/* harmony default export */ var api_children = ({
- concat: concat,
- getChildrenArray: getChildrenArray,
- fromDOM: fromDOM,
- toHTML: toHTML,
- matcher: children_matcher
-});
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js
+function node_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function node_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { node_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { node_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* Internal dependencies
*/
@@ -9147,7 +10010,7 @@
* @return {WPBlockNode} Block node equivalent to DOM node.
*/
-function node_fromDOM(domNode) {
+function fromDOM(domNode) {
if (domNode.nodeType === TEXT_NODE) {
return domNode.nodeValue;
}
@@ -9158,8 +10021,8 @@
return {
type: domNode.nodeName.toLowerCase(),
- props: Object(objectSpread["a" /* default */])({}, getNamedNodeMapAsObject(domNode.attributes), {
- children: fromDOM(domNode.childNodes)
+ props: node_objectSpread({}, getNamedNodeMapAsObject(domNode.attributes), {
+ children: children_fromDOM(domNode.childNodes)
})
};
}
@@ -9171,8 +10034,8 @@
* @return {string} String HTML representation of block node.
*/
-function node_toHTML(node) {
- return toHTML([node]);
+function toHTML(node) {
+ return children_toHTML([node]);
}
/**
* Given a selector, returns an hpq matcher generating a WPBlockNode value
@@ -9192,31 +10055,156 @@
}
try {
- return node_fromDOM(match);
+ return fromDOM(match);
} catch (error) {
return null;
}
};
}
+/**
+ * Object of utility functions used in managing block attribute values of
+ * source `node`.
+ *
+ * @see https://github.com/WordPress/gutenberg/pull/10439
+ *
+ * @deprecated since 4.0. The `node` source should not be used, and can be
+ * replaced by the `html` source.
+ *
+ * @private
+ */
+
/* harmony default export */ var api_node = ({
isNodeOfType: isNodeOfType,
- fromDOM: node_fromDOM,
- toHTML: node_toHTML,
+ fromDOM: fromDOM,
+ toHTML: toHTML,
matcher: node_matcher
});
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js
/**
* External dependencies
*/
/**
+ * WordPress dependencies
+ */
+
+
+/**
* Internal dependencies
*/
-
-function matchers_html(selector, multilineTag) {
+/**
+ * A representation of a block's rich text value.
+ *
+ * @typedef {WPBlockNode[]} WPBlockChildren
+ */
+
+/**
+ * Given block children, returns a serialize-capable WordPress element.
+ *
+ * @param {WPBlockChildren} children Block children object to convert.
+ *
+ * @return {WPElement} A serialize-capable element.
+ */
+
+function getSerializeCapableElement(children) {
+ // The fact that block children are compatible with the element serializer is
+ // merely an implementation detail that currently serves to be true, but
+ // should not be mistaken as being a guarantee on the external API. The
+ // public API only offers guarantees to work with strings (toHTML) and DOM
+ // elements (fromDOM), and should provide utilities to manipulate the value
+ // rather than expect consumers to inspect or construct its shape (concat).
+ return children;
+}
+/**
+ * Given block children, returns an array of block nodes.
+ *
+ * @param {WPBlockChildren} children Block children object to convert.
+ *
+ * @return {Array<WPBlockNode>} An array of individual block nodes.
+ */
+
+function getChildrenArray(children) {
+ // The fact that block children are compatible with the element serializer
+ // is merely an implementation detail that currently serves to be true, but
+ // should not be mistaken as being a guarantee on the external API.
+ return children;
+}
+/**
+ * Given two or more block nodes, returns a new block node representing a
+ * concatenation of its values.
+ *
+ * @param {...WPBlockChildren} blockNodes Block nodes to concatenate.
+ *
+ * @return {WPBlockChildren} Concatenated block node.
+ */
+
+
+function concat() {
+ var result = [];
+
+ for (var i = 0; i < arguments.length; i++) {
+ var blockNode = Object(external_this_lodash_["castArray"])(i < 0 || arguments.length <= i ? undefined : arguments[i]);
+
+ for (var j = 0; j < blockNode.length; j++) {
+ var child = blockNode[j];
+ var canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string';
+
+ if (canConcatToPreviousString) {
+ result[result.length - 1] += child;
+ } else {
+ result.push(child);
+ }
+ }
+ }
+
+ return result;
+}
+/**
+ * Given an iterable set of DOM nodes, returns equivalent block children.
+ * Ignores any non-element/text nodes included in set.
+ *
+ * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert.
+ *
+ * @return {WPBlockChildren} Block children equivalent to DOM nodes.
+ */
+
+function children_fromDOM(domNodes) {
+ var result = [];
+
+ for (var i = 0; i < domNodes.length; i++) {
+ try {
+ result.push(fromDOM(domNodes[i]));
+ } catch (error) {// Simply ignore if DOM node could not be converted.
+ }
+ }
+
+ return result;
+}
+/**
+ * Given a block node, returns its HTML string representation.
+ *
+ * @param {WPBlockChildren} children Block node(s) to convert to string.
+ *
+ * @return {string} String HTML representation of block node.
+ */
+
+function children_toHTML(children) {
+ var element = getSerializeCapableElement(children);
+ return Object(external_this_wp_element_["renderToString"])(element);
+}
+/**
+ * Given a selector, returns an hpq matcher generating a WPBlockChildren value
+ * matching the selector result.
+ *
+ * @param {string} selector DOM selector.
+ *
+ * @return {Function} hpq matcher.
+ */
+
+function children_matcher(selector) {
return function (domNode) {
var match = domNode;
@@ -9224,35 +10212,42 @@
match = domNode.querySelector(selector);
}
- if (!match) {
- return '';
- }
-
- if (multilineTag) {
- var value = '';
- var length = match.children.length;
-
- for (var index = 0; index < length; index++) {
- var child = match.children[index];
-
- if (child.nodeName.toLowerCase() !== multilineTag) {
- continue;
- }
-
- value += child.outerHTML;
- }
-
- return value;
- }
-
- return match.innerHTML;
+ if (match) {
+ return children_fromDOM(match.childNodes);
+ }
+
+ return [];
};
}
+/**
+ * Object of utility functions used in managing block attribute values of
+ * source `children`.
+ *
+ * @see https://github.com/WordPress/gutenberg/pull/10439
+ *
+ * @deprecated since 4.0. The `children` source should not be used, and can be
+ * replaced by the `html` source.
+ *
+ * @private
+ */
+
+/* harmony default export */ var api_children = ({
+ concat: concat,
+ getChildrenArray: getChildrenArray,
+ fromDOM: children_fromDOM,
+ toHTML: children_toHTML,
+ matcher: children_matcher
+});
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser.js
+
+function parser_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function parser_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { parser_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { parser_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -9275,6 +10270,7 @@
+
/**
* Sources which are guaranteed to return a string value.
*
@@ -9295,7 +10291,7 @@
*/
var parser_toBooleanAttributeMatcher = function toBooleanAttributeMatcher(matcher) {
- return Object(external_lodash_["flow"])([matcher, // Expected values from `attr( 'disabled' )`:
+ return Object(external_this_lodash_["flow"])([matcher, // Expected values from `attr( 'disabled' )`:
//
// <input>
// - Value: `undefined`
@@ -9365,6 +10361,36 @@
});
}
/**
+ * Returns true if value is valid per the given block attribute schema type
+ * definition, or false otherwise.
+ *
+ * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
+ *
+ * @param {*} value Value to test.
+ * @param {?(Array<string>|string)} type Block attribute schema type.
+ *
+ * @return {boolean} Whether value is valid.
+ */
+
+function isValidByType(value, type) {
+ return type === undefined || isOfTypes(value, Object(external_this_lodash_["castArray"])(type));
+}
+/**
+ * Returns true if value is valid per the given block attribute schema enum
+ * definition, or false otherwise.
+ *
+ * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2
+ *
+ * @param {*} value Value to test.
+ * @param {?Array} enumSet Block attribute schema enum.
+ *
+ * @return {boolean} Whether value is valid.
+ */
+
+function isValidByEnum(value, enumSet) {
+ return !Array.isArray(enumSet) || enumSet.includes(value);
+}
+/**
* Returns true if the given attribute schema describes a value which may be
* an ambiguous string.
*
@@ -9387,45 +10413,6 @@
return isStringSource && isSingleType;
}
/**
- * Returns value coerced to the specified JSON schema type string.
- *
- * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
- *
- * @param {*} value Original value.
- * @param {string} type Type to coerce.
- *
- * @return {*} Coerced value.
- */
-
-function asType(value, type) {
- switch (type) {
- case 'string':
- return String(value);
-
- case 'boolean':
- return Boolean(value);
-
- case 'object':
- return Object(value);
-
- case 'null':
- return null;
-
- case 'array':
- if (Array.isArray(value)) {
- return value;
- }
-
- return Array.from(value);
-
- case 'integer':
- case 'number':
- return Number(value);
- }
-
- return value;
-}
-/**
* Returns an hpq matcher given a source object.
*
* @param {Object} sourceConfig Attribute Source object.
@@ -9457,12 +10444,12 @@
return node_matcher(sourceConfig.selector);
case 'query':
- var subMatchers = Object(external_lodash_["mapValues"])(sourceConfig.query, matcherFromSource);
+ var subMatchers = Object(external_this_lodash_["mapValues"])(sourceConfig.query, matcherFromSource);
return query(sourceConfig.selector, subMatchers);
case 'tag':
- return Object(external_lodash_["flow"])([prop(sourceConfig.selector, 'nodeName'), function (value) {
- return value.toLowerCase();
+ return Object(external_this_lodash_["flow"])([prop(sourceConfig.selector, 'nodeName'), function (nodeName) {
+ return nodeName ? nodeName.toLowerCase() : undefined;
}]);
default:
@@ -9497,7 +10484,8 @@
*/
function getBlockAttribute(attributeKey, attributeSchema, innerHTML, commentAttributes) {
- var type = attributeSchema.type;
+ var type = attributeSchema.type,
+ enumSet = attributeSchema.enum;
var value;
switch (attributeSchema.source) {
@@ -9518,9 +10506,9 @@
break;
}
- if (type !== undefined && !isOfTypes(value, Object(external_lodash_["castArray"])(type))) {
- // Reject the value if it is not valid of type. Reverting to the
- // undefined value ensures the default is restored, if applicable.
+ if (!isValidByType(value, type) || !isValidByEnum(value, enumSet)) {
+ // Reject the value if it is not valid. Reverting to the undefined
+ // value ensures the default is respected, if applicable.
value = undefined;
}
@@ -9543,7 +10531,7 @@
function getBlockAttributes(blockTypeOrName, innerHTML) {
var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var blockType = normalizeBlockType(blockTypeOrName);
- var blockAttributes = Object(external_lodash_["mapValues"])(blockType.attributes, function (attributeSchema, attributeKey) {
+ var blockAttributes = Object(external_this_lodash_["mapValues"])(blockType.attributes, function (attributeSchema, attributeKey) {
return getBlockAttribute(attributeKey, attributeSchema, innerHTML, attributes);
});
return Object(external_this_wp_hooks_["applyFilters"])('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes);
@@ -9577,7 +10565,7 @@
// defining isEligible on its deprecation. If the block is both valid
// and does not opt to migrate, skip.
var _deprecatedDefinition = deprecatedDefinitions[i].isEligible,
- isEligible = _deprecatedDefinition === void 0 ? external_lodash_["stubFalse"] : _deprecatedDefinition;
+ isEligible = _deprecatedDefinition === void 0 ? external_this_lodash_["stubFalse"] : _deprecatedDefinition;
if (block.isValid && !isEligible(parsedAttributes, innerBlocks)) {
continue;
@@ -9586,25 +10574,27 @@
// and must be explicitly provided.
- var deprecatedBlockType = Object.assign(Object(external_lodash_["omit"])(blockType, ['attributes', 'save', 'supports']), deprecatedDefinitions[i]);
+ var deprecatedBlockType = Object.assign(Object(external_this_lodash_["omit"])(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]);
var migratedAttributes = getBlockAttributes(deprecatedBlockType, originalContent, parsedAttributes); // Ignore the deprecation if it produces a block which is not valid.
- var isValid = isValidBlockContent(deprecatedBlockType, migratedAttributes, originalContent);
+ var _getBlockContentValid = getBlockContentValidationResult(deprecatedBlockType, migratedAttributes, originalContent),
+ isValid = _getBlockContentValid.isValid,
+ validationIssues = _getBlockContentValid.validationIssues;
if (!isValid) {
+ block = parser_objectSpread({}, block, {
+ validationIssues: [].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(block, 'validationIssues', [])), Object(toConsumableArray["a" /* default */])(validationIssues))
+ });
continue;
}
- block = Object(objectSpread["a" /* default */])({}, block, {
- isValid: true
- });
var migratedInnerBlocks = innerBlocks; // A block may provide custom behavior to assign new attributes and/or
// inner blocks.
var migrate = deprecatedBlockType.migrate;
if (migrate) {
- var _castArray = Object(external_lodash_["castArray"])(migrate(migratedAttributes, innerBlocks));
+ var _castArray = Object(external_this_lodash_["castArray"])(migrate(migratedAttributes, innerBlocks));
var _castArray2 = Object(slicedToArray["a" /* default */])(_castArray, 2);
@@ -9614,8 +10604,11 @@
migratedInnerBlocks = _castArray2$2 === void 0 ? innerBlocks : _castArray2$2;
}
- block.attributes = migratedAttributes;
- block.innerBlocks = migratedInnerBlocks;
+ block = parser_objectSpread({}, block, {
+ attributes: migratedAttributes,
+ innerBlocks: migratedInnerBlocks,
+ isValid: true
+ });
}
return block;
@@ -9634,6 +10627,7 @@
_blockNode$innerBlock = blockNode.innerBlocks,
innerBlocks = _blockNode$innerBlock === void 0 ? [] : _blockNode$innerBlock,
innerHTML = blockNode.innerHTML;
+ var innerContent = blockNode.innerContent;
var freeformContentFallbackBlock = getFreeformContentHandlerName();
var unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || freeformContentFallbackBlock;
attributes = attributes || {}; // Trim content to avoid creation of intermediary freeform segments.
@@ -9650,6 +10644,14 @@
if ('core/text' === name || 'core/cover-text' === name) {
name = 'core/paragraph';
+ } // Convert derivative blocks such as 'core/social-link-wordpress' to the
+ // canonical form 'core/social-link'.
+
+
+ if (name && name.indexOf('core/social-link-') === 0) {
+ // Capture `social-link-wordpress` into `{"service":"wordpress"}`
+ attributes.service = name.substring(17);
+ name = 'core/social-link';
} // Fallback content may be upgraded from classic editor expecting implicit
// automatic paragraphs, so preserve them. Assumes wpautop is idempotent,
// meaning there are no negative consequences to repeated autop calls.
@@ -9663,24 +10665,50 @@
var blockType = registration_getBlockType(name);
if (!blockType) {
- // Preserve undelimited content for use by the unregistered type handler.
- var originalUndelimitedContent = innerHTML; // If detected as a block which is not registered, preserve comment
+ // Since the constituents of the block node are extracted at the start
+ // of the present function, construct a new object rather than reuse
+ // `blockNode`.
+ var reconstitutedBlockNode = {
+ attrs: attributes,
+ blockName: originalName,
+ innerBlocks: innerBlocks,
+ innerContent: innerContent
+ }; // Preserve undelimited content for use by the unregistered type
+ // handler. A block node's `innerHTML` isn't enough, as that field only
+ // carries the block's own HTML and not its nested blocks'.
+
+ var originalUndelimitedContent = serializeBlockNode(reconstitutedBlockNode, {
+ isCommentDelimited: false
+ }); // Preserve full block content for use by the unregistered type
+ // handler, block boundaries included.
+
+ var originalContent = serializeBlockNode(reconstitutedBlockNode, {
+ isCommentDelimited: true
+ }); // If detected as a block which is not registered, preserve comment
// delimiters in content of unregistered type handler.
if (name) {
- innerHTML = getCommentDelimitedContent(name, attributes, innerHTML);
+ innerHTML = originalContent;
}
name = unregisteredFallbackBlock;
attributes = {
originalName: originalName,
+ originalContent: originalContent,
originalUndelimitedContent: originalUndelimitedContent
};
blockType = registration_getBlockType(name);
} // Coerce inner blocks from parsed form to canonical form.
- innerBlocks = innerBlocks.map(createBlockWithFallback);
+ innerBlocks = innerBlocks.map(createBlockWithFallback); // Remove `undefined` innerBlocks.
+ //
+ // This is a temporary fix to prevent unrecoverable TypeErrors when handling unexpectedly
+ // empty freeform block nodes. See https://github.com/WordPress/gutenberg/pull/17164.
+
+ innerBlocks = innerBlocks.filter(function (innerBlock) {
+ return innerBlock;
+ });
var isFallbackBlock = name === freeformContentFallbackBlock || name === unregisteredFallbackBlock; // Include in set only if type was determined.
if (!blockType || !innerHTML && isFallbackBlock) {
@@ -9693,16 +10721,76 @@
// the block. When both match, the block is marked as valid.
if (!isFallbackBlock) {
- block.isValid = isValidBlockContent(blockType, block.attributes, innerHTML);
- } // Preserve original content for future use in case the block is parsed as
- // invalid, or future serialization attempt results in an error.
-
-
- block.originalContent = innerHTML;
+ var _getBlockContentValid2 = getBlockContentValidationResult(blockType, block.attributes, innerHTML),
+ isValid = _getBlockContentValid2.isValid,
+ validationIssues = _getBlockContentValid2.validationIssues;
+
+ block.isValid = isValid;
+ block.validationIssues = validationIssues;
+ } // Preserve original content for future use in case the block is parsed
+ // as invalid, or future serialization attempt results in an error.
+
+
+ block.originalContent = block.originalContent || innerHTML;
block = getMigratedBlock(block, attributes);
+
+ if (block.validationIssues && block.validationIssues.length > 0) {
+ if (block.isValid) {
+ // eslint-disable-next-line no-console
+ console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, block.attributes), block.originalContent);
+ } else {
+ block.validationIssues.forEach(function (_ref) {
+ var log = _ref.log,
+ args = _ref.args;
+ return log.apply(void 0, Object(toConsumableArray["a" /* default */])(args));
+ });
+ }
+ }
+
return block;
}
/**
+ * Serializes a block node into the native HTML-comment-powered block format.
+ * CAVEAT: This function is intended for reserializing blocks as parsed by
+ * valid parsers and skips any validation steps. This is NOT a generic
+ * serialization function for in-memory blocks. For most purposes, see the
+ * following functions available in the `@wordpress/blocks` package:
+ *
+ * @see serializeBlock
+ * @see serialize
+ *
+ * For more on the format of block nodes as returned by valid parsers:
+ *
+ * @see `@wordpress/block-serialization-default-parser` package
+ * @see `@wordpress/block-serialization-spec-parser` package
+ *
+ * @param {Object} blockNode A block node as returned by a valid parser.
+ * @param {?Object} options Serialization options.
+ * @param {?boolean} options.isCommentDelimited Whether to output HTML comments around blocks.
+ *
+ * @return {string} An HTML string representing a block.
+ */
+
+function serializeBlockNode(blockNode) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var _options$isCommentDel = options.isCommentDelimited,
+ isCommentDelimited = _options$isCommentDel === void 0 ? true : _options$isCommentDel;
+ var blockName = blockNode.blockName,
+ _blockNode$attrs = blockNode.attrs,
+ attrs = _blockNode$attrs === void 0 ? {} : _blockNode$attrs,
+ _blockNode$innerBlock2 = blockNode.innerBlocks,
+ innerBlocks = _blockNode$innerBlock2 === void 0 ? [] : _blockNode$innerBlock2,
+ _blockNode$innerConte = blockNode.innerContent,
+ innerContent = _blockNode$innerConte === void 0 ? [] : _blockNode$innerConte;
+ var childIndex = 0;
+ var content = innerContent.map(function (item) {
+ return (// `null` denotes a nested block, otherwise we have an HTML fragment
+ item !== null ? item : serializeBlockNode(innerBlocks[childIndex++], options)
+ );
+ }).join('\n').replace(/\n+/g, '\n').trim();
+ return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content;
+}
+/**
* Creates a parse implementation for the post content which returns a list of blocks.
*
* @param {Function} parseImplementation Parse implementation.
@@ -9712,14 +10800,14 @@
var createParse = function createParse(parseImplementation) {
return function (content) {
- return parseImplementation(content).reduce(function (memo, blockNode) {
+ return parseImplementation(content).reduce(function (accumulator, blockNode) {
var block = createBlockWithFallback(blockNode);
if (block) {
- memo.push(block);
- }
-
- return memo;
+ accumulator.push(block);
+ }
+
+ return accumulator;
}, []);
};
};
@@ -9735,15 +10823,30 @@
var parseWithGrammar = createParse(external_this_wp_blockSerializationDefaultParser_["parse"]);
/* harmony default export */ var parser = (parseWithGrammar);
-// EXTERNAL MODULE: external {"this":["wp","dom"]}
-var external_this_wp_dom_ = __webpack_require__(24);
-
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content.js
+
+
+function phrasing_content_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function phrasing_content_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { phrasing_content_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { phrasing_content_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
-var phrasing_content_phrasingContentSchema = {
+/**
+ * All phrasing content elements.
+ *
+ * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
+ */
+
+/**
+ * All text-level semantic elements.
+ *
+ * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html
+ */
+
+var textContentSchema = {
strong: {},
em: {},
s: {},
@@ -9759,24 +10862,113 @@
sub: {},
sup: {},
br: {},
+ small: {},
+ // To do: fix blockquote.
+ // cite: {},
+ q: {
+ attributes: ['cite']
+ },
+ dfn: {
+ attributes: ['title']
+ },
+ data: {
+ attributes: ['value']
+ },
+ time: {
+ attributes: ['datetime']
+ },
+ var: {},
+ samp: {},
+ kbd: {},
+ i: {},
+ b: {},
+ u: {},
+ mark: {},
+ ruby: {},
+ rt: {},
+ rp: {},
+ bdi: {
+ attributes: ['dir']
+ },
+ bdo: {
+ attributes: ['dir']
+ },
+ wbr: {},
'#text': {}
}; // Recursion is needed.
// Possible: strong > em > strong.
// Impossible: strong > strong.
-['strong', 'em', 's', 'del', 'ins', 'a', 'code', 'abbr', 'sub', 'sup'].forEach(function (tag) {
- phrasing_content_phrasingContentSchema[tag].children = Object(external_lodash_["omit"])(phrasing_content_phrasingContentSchema, tag);
+Object(external_this_lodash_["without"])(Object.keys(textContentSchema), '#text', 'br').forEach(function (tag) {
+ textContentSchema[tag].children = Object(external_this_lodash_["omit"])(textContentSchema, tag);
});
/**
+ * Embedded content elements.
+ *
+ * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0
+ */
+
+var embeddedContentSchema = {
+ audio: {
+ attributes: ['src', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted']
+ },
+ canvas: {
+ attributes: ['width', 'height']
+ },
+ embed: {
+ attributes: ['src', 'type', 'width', 'height']
+ },
+ img: {
+ attributes: ['alt', 'src', 'srcset', 'usemap', 'ismap', 'width', 'height']
+ },
+ object: {
+ attributes: ['data', 'type', 'name', 'usemap', 'form', 'width', 'height']
+ },
+ video: {
+ attributes: ['src', 'poster', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls', 'width', 'height']
+ }
+};
+/**
+ * Phrasing content elements.
+ *
+ * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
+ */
+
+var phrasing_content_phrasingContentSchema = phrasing_content_objectSpread({}, textContentSchema, {}, embeddedContentSchema);
+/**
* Get schema of possible paths for phrasing content.
*
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
*
+ * @param {string} context Set to "paste" to exclude invisible elements and
+ * sensitive data.
+ *
* @return {Object} Schema.
*/
-function getPhrasingContentSchema() {
- return phrasing_content_phrasingContentSchema;
+
+function getPhrasingContentSchema(context) {
+ if (context !== 'paste') {
+ return phrasing_content_phrasingContentSchema;
+ }
+
+ return Object(external_this_lodash_["omit"])(phrasing_content_objectSpread({}, phrasing_content_phrasingContentSchema, {
+ // We shouldn't paste potentially sensitive information which is not
+ // visible to the user when pasted, so strip the attributes.
+ ins: {
+ children: phrasing_content_phrasingContentSchema.ins.children
+ },
+ del: {
+ children: phrasing_content_phrasingContentSchema.del.children
+ }
+ }), ['u', // Used to mark misspelling. Shouldn't be pasted.
+ 'abbr', // Invisible.
+ 'data', // Invisible.
+ 'time', // Invisible.
+ 'wbr', // Invisible.
+ 'bdi', // Invisible.
+ 'bdo' // Invisible.
+ ]);
}
/**
* Find out whether or not the given node is phrasing content.
@@ -9792,11 +10984,19 @@
var tag = node.nodeName.toLowerCase();
return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span';
}
+function isTextContent(node) {
+ var tag = node.nodeName.toLowerCase();
+ return textContentSchema.hasOwnProperty(tag) || tag === 'span';
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js
+function raw_handling_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function raw_handling_utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { raw_handling_utils_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { raw_handling_utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -9822,37 +11022,43 @@
/**
* Given raw transforms from blocks, merges all schemas into one.
*
- * @param {Array} transforms Block transforms, of the `raw` type.
+ * @param {Array} transforms Block transforms, of the `raw` type.
+ * @param {Object} phrasingContentSchema The phrasing content schema.
+ * @param {Object} isPaste Whether the context is pasting or not.
*
* @return {Object} A complete block content schema.
*/
-function getBlockContentSchema(transforms) {
+function getBlockContentSchema(transforms, phrasingContentSchema, isPaste) {
var schemas = transforms.map(function (_ref) {
var isMatch = _ref.isMatch,
blockName = _ref.blockName,
schema = _ref.schema;
- var hasAnchorSupport = registration_hasBlockSupport(blockName, 'anchor'); // If the block does not has anchor support and the transform does not
+ var hasAnchorSupport = registration_hasBlockSupport(blockName, 'anchor');
+ schema = Object(external_this_lodash_["isFunction"])(schema) ? schema({
+ phrasingContentSchema: phrasingContentSchema,
+ isPaste: isPaste
+ }) : schema; // If the block does not has anchor support and the transform does not
// provides an isMatch we can return the schema right away.
if (!hasAnchorSupport && !isMatch) {
return schema;
}
- return Object(external_lodash_["mapValues"])(schema, function (value) {
+ return Object(external_this_lodash_["mapValues"])(schema, function (value) {
var attributes = value.attributes || []; // If the block supports the "anchor" functionality, it needs to keep its ID attribute.
if (hasAnchorSupport) {
attributes = [].concat(Object(toConsumableArray["a" /* default */])(attributes), ['id']);
}
- return Object(objectSpread["a" /* default */])({}, value, {
+ return raw_handling_utils_objectSpread({}, value, {
attributes: attributes,
isMatch: isMatch ? isMatch : undefined
});
});
});
- return external_lodash_["mergeWith"].apply(void 0, [{}].concat(Object(toConsumableArray["a" /* default */])(schemas), [function (objValue, srcValue, key) {
+ return external_this_lodash_["mergeWith"].apply(void 0, [{}].concat(Object(toConsumableArray["a" /* default */])(schemas), [function (objValue, srcValue, key) {
switch (key) {
case 'children':
{
@@ -9860,7 +11066,7 @@
return '*';
}
- return Object(objectSpread["a" /* default */])({}, objValue, srcValue);
+ return raw_handling_utils_objectSpread({}, objValue, {}, srcValue);
}
case 'attributes':
@@ -10010,7 +11216,7 @@
Array.from(node.attributes).forEach(function (_ref2) {
var name = _ref2.name;
- if (name !== 'class' && !Object(external_lodash_["includes"])(attributes, name)) {
+ if (name !== 'class' && !Object(external_this_lodash_["includes"])(attributes, name)) {
node.removeAttribute(name);
}
}); // Strip invalid classes.
@@ -10029,7 +11235,7 @@
};
}
- return external_lodash_["noop"];
+ return external_this_lodash_["noop"];
});
Array.from(node.classList).forEach(function (name) {
if (!mattchers.some(function (isMatch) {
@@ -10109,6 +11315,28 @@
cleanNodeList(doc.body.childNodes, doc, schema, inline);
return doc.body.innerHTML;
}
+/**
+ * Gets a sibling within text-level context.
+ *
+ * @param {Element} node The subject node.
+ * @param {string} which "next" or "previous".
+ */
+
+function getSibling(node, which) {
+ var sibling = node["".concat(which, "Sibling")];
+
+ if (sibling && isPhrasingContent(sibling)) {
+ return sibling;
+ }
+
+ var parentNode = node.parentNode;
+
+ if (!parentNode || !isPhrasingContent(parentNode)) {
+ return;
+ }
+
+ return getSibling(parentNode, which);
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js
/**
@@ -10123,7 +11351,7 @@
var normalise_blocks_window$Node = window.Node,
normalise_blocks_ELEMENT_NODE = normalise_blocks_window$Node.ELEMENT_NODE,
normalise_blocks_TEXT_NODE = normalise_blocks_window$Node.TEXT_NODE;
-/* harmony default export */ var normalise_blocks = (function (HTML) {
+function normaliseBlocks(HTML) {
var decuDoc = document.implementation.createHTMLDocument('');
var accuDoc = document.implementation.createHTMLDocument('');
var decu = decuDoc.body;
@@ -10180,7 +11408,7 @@
}
return accu.innerHTML;
-});
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js
/**
@@ -10209,7 +11437,7 @@
* @return {void}
*/
-/* harmony default export */ var special_comment_converter = (function (node, doc) {
+function specialCommentConverter(node, doc) {
if (node.nodeType !== COMMENT_NODE) {
return;
}
@@ -10241,7 +11469,7 @@
Object(external_this_wp_dom_["replace"])(node, createMore(customText, noTeaser, doc));
}
-});
+}
function createMore(customText, noTeaser, doc) {
var node = doc.createElement('wp-block');
@@ -10265,28 +11493,248 @@
return node;
}
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js
-
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js
+/**
+ * WordPress dependencies
+ */
+
+/**
+ * Browser dependencies
+ */
+
+var comment_remover_COMMENT_NODE = window.Node.COMMENT_NODE;
+/**
+ * Looks for comments, and removes them.
+ *
+ * @param {Node} node The node to be processed.
+ * @return {void}
+ */
+
+function commentRemover(node) {
+ if (node.nodeType === comment_remover_COMMENT_NODE) {
+ Object(external_this_wp_dom_["remove"])(node);
+ }
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js
+/**
+ * External dependencies
+ */
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Checks if the given node should be considered inline content, optionally
+ * depending on a context tag.
+ *
+ * @param {Node} node Node name.
+ * @param {string} contextTag Tag name.
+ *
+ * @return {boolean} True if the node is inline content, false if nohe.
+ */
+
+function isInline(node, contextTag) {
+ if (isTextContent(node)) {
+ return true;
+ }
+
+ if (!contextTag) {
+ return false;
+ }
+
+ var tag = node.nodeName.toLowerCase();
+ var inlineWhitelistTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']];
+ return inlineWhitelistTagGroups.some(function (tagGroup) {
+ return Object(external_this_lodash_["difference"])([tag, contextTag], tagGroup).length === 0;
+ });
+}
+
+function deepCheck(nodes, contextTag) {
+ return nodes.every(function (node) {
+ return isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag);
+ });
+}
+
+function isDoubleBR(node) {
+ return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR';
+}
+
+function isInlineContent(HTML, contextTag) {
+ var doc = document.implementation.createHTMLDocument('');
+ doc.body.innerHTML = HTML;
+ var nodes = Array.from(doc.body.children);
+ return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js
+/**
+ * External dependencies
+ */
/**
* WordPress dependencies
*/
+function phrasingContentReducer(node, doc) {
+ // In jsdom-jscore, 'node.style' can be null.
+ // TODO: Explore fixing this by patching jsdom-jscore.
+ if (node.nodeName === 'SPAN' && node.style) {
+ var _node$style = node.style,
+ fontWeight = _node$style.fontWeight,
+ fontStyle = _node$style.fontStyle,
+ textDecorationLine = _node$style.textDecorationLine,
+ textDecoration = _node$style.textDecoration,
+ verticalAlign = _node$style.verticalAlign;
+
+ if (fontWeight === 'bold' || fontWeight === '700') {
+ Object(external_this_wp_dom_["wrap"])(doc.createElement('strong'), node);
+ }
+
+ if (fontStyle === 'italic') {
+ Object(external_this_wp_dom_["wrap"])(doc.createElement('em'), node);
+ } // Some DOM implementations (Safari, JSDom) don't support
+ // style.textDecorationLine, so we check style.textDecoration as a
+ // fallback.
+
+
+ if (textDecorationLine === 'line-through' || Object(external_this_lodash_["includes"])(textDecoration, 'line-through')) {
+ Object(external_this_wp_dom_["wrap"])(doc.createElement('s'), node);
+ }
+
+ if (verticalAlign === 'super') {
+ Object(external_this_wp_dom_["wrap"])(doc.createElement('sup'), node);
+ } else if (verticalAlign === 'sub') {
+ Object(external_this_wp_dom_["wrap"])(doc.createElement('sub'), node);
+ }
+ } else if (node.nodeName === 'B') {
+ node = Object(external_this_wp_dom_["replaceTag"])(node, 'strong');
+ } else if (node.nodeName === 'I') {
+ node = Object(external_this_wp_dom_["replaceTag"])(node, 'em');
+ } else if (node.nodeName === 'A') {
+ // In jsdom-jscore, 'node.target' can be null.
+ // TODO: Explore fixing this by patching jsdom-jscore.
+ if (node.target && node.target.toLowerCase() === '_blank') {
+ node.rel = 'noreferrer noopener';
+ } else {
+ node.removeAttribute('target');
+ node.removeAttribute('rel');
+ }
+ }
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js
+function headRemover(node) {
+ if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') {
+ return;
+ }
+
+ node.parentNode.removeChild(node);
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js
+/**
+ * Browser dependencies
+ */
+var _window = window,
+ ms_list_converter_parseInt = _window.parseInt;
+
function isList(node) {
return node.nodeName === 'OL' || node.nodeName === 'UL';
}
+function msListConverter(node, doc) {
+ if (node.nodeName !== 'P') {
+ return;
+ }
+
+ var style = node.getAttribute('style');
+
+ if (!style) {
+ return;
+ } // Quick check.
+
+
+ if (style.indexOf('mso-list') === -1) {
+ return;
+ }
+
+ var matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
+
+ if (!matches) {
+ return;
+ }
+
+ var level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0;
+ var prevNode = node.previousElementSibling; // Add new list if no previous.
+
+ if (!prevNode || !isList(prevNode)) {
+ // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type.
+ var type = node.textContent.trim().slice(0, 1);
+ var isNumeric = /[1iIaA]/.test(type);
+ var newListNode = doc.createElement(isNumeric ? 'ol' : 'ul');
+
+ if (isNumeric) {
+ newListNode.setAttribute('type', type);
+ }
+
+ node.parentNode.insertBefore(newListNode, node);
+ }
+
+ var listNode = node.previousElementSibling;
+ var listType = listNode.nodeName;
+ var listItem = doc.createElement('li');
+ var receivingNode = listNode; // Remove the first span with list info.
+
+ node.removeChild(node.firstElementChild); // Add content.
+
+ while (node.firstChild) {
+ listItem.appendChild(node.firstChild);
+ } // Change pointer depending on indentation level.
+
+
+ while (level--) {
+ receivingNode = receivingNode.lastElementChild || receivingNode; // If it's a list, move pointer to the last item.
+
+ if (isList(receivingNode)) {
+ receivingNode = receivingNode.lastElementChild || receivingNode;
+ }
+ } // Make sure we append to a list.
+
+
+ if (!isList(receivingNode)) {
+ receivingNode = receivingNode.appendChild(doc.createElement(listType));
+ } // Append the list item to the list.
+
+
+ receivingNode.appendChild(listItem); // Remove the wrapper paragraph.
+
+ node.parentNode.removeChild(node);
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js
+/**
+ * WordPress dependencies
+ */
+
+
+function list_reducer_isList(node) {
+ return node.nodeName === 'OL' || node.nodeName === 'UL';
+}
+
function shallowTextContent(element) {
- return Object(toConsumableArray["a" /* default */])(element.childNodes).map(function (_ref) {
+ return Array.from(element.childNodes).map(function (_ref) {
var _ref$nodeValue = _ref.nodeValue,
nodeValue = _ref$nodeValue === void 0 ? '' : _ref$nodeValue;
return nodeValue;
}).join('');
}
-/* harmony default export */ var list_reducer = (function (node) {
- if (!isList(node)) {
+function listReducer(node) {
+ if (!list_reducer_isList(node)) {
return;
}
@@ -10321,7 +11769,7 @@
} // Invalid: OL/UL > OL/UL.
- if (parentElement && isList(parentElement)) {
+ if (parentElement && list_reducer_isList(parentElement)) {
var _prevListItem = node.previousElementSibling;
if (_prevListItem) {
@@ -10330,394 +11778,10 @@
Object(external_this_wp_dom_["unwrap"])(node);
}
}
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js
-/**
- * Internal dependencies
- */
-
-/* harmony default export */ var blockquote_normaliser = (function (node) {
- if (node.nodeName !== 'BLOCKQUOTE') {
- return;
- }
-
- node.innerHTML = normalise_blocks(node.innerHTML);
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js
-/**
- * External dependencies
- */
-
-/**
- * Internal dependencies
- */
-
-
-/**
- * Whether or not the given node is figure content.
- *
- * @param {Node} node The node to check.
- * @param {Object} schema The schema to use.
- *
- * @return {boolean} True if figure content, false if not.
- */
-
-function isFigureContent(node, schema) {
- var tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding
- // `figcaption` and any phrasing content.
-
- if (tag === 'figcaption' || isPhrasingContent(node)) {
- return false;
- }
-
- return Object(external_lodash_["has"])(schema, ['figure', 'children', tag]);
-}
-/**
- * Whether or not the given node can have an anchor.
- *
- * @param {Node} node The node to check.
- * @param {Object} schema The schema to use.
- *
- * @return {boolean} True if it can, false if not.
- */
-
-
-function canHaveAnchor(node, schema) {
- var tag = node.nodeName.toLowerCase();
- return Object(external_lodash_["has"])(schema, ['figure', 'children', 'a', 'children', tag]);
-}
-/**
- * This filter takes figure content out of paragraphs, wraps it in a figure
- * element, and moves any anchors with it if needed.
- *
- * @param {Node} node The node to filter.
- * @param {Document} doc The document of the node.
- * @param {Object} schema The schema to use.
- *
- * @return {void}
- */
-
-
-/* harmony default export */ var figure_content_reducer = (function (node, doc, schema) {
- if (!isFigureContent(node, schema)) {
- return;
- }
-
- var nodeToInsert = node;
- var parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with
- // only the figure content, take the anchor out instead of just the content.
-
- if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) {
- nodeToInsert = node.parentNode;
- }
-
- var wrapper = nodeToInsert;
-
- while (wrapper && wrapper.nodeName !== 'P') {
- wrapper = wrapper.parentElement;
- }
-
- var figure = doc.createElement('figure');
-
- if (wrapper) {
- wrapper.parentNode.insertBefore(figure, wrapper);
- } else {
- nodeToInsert.parentNode.insertBefore(figure, nodeToInsert);
- }
-
- figure.appendChild(nodeToInsert);
-});
-
-// EXTERNAL MODULE: external {"this":["wp","shortcode"]}
-var external_this_wp_shortcode_ = __webpack_require__(134);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js
-
-
-
-/**
- * External dependencies
- */
-
-/**
- * WordPress dependencies
- */
-
-
-/**
- * Internal dependencies
- */
-
-
-
-
-
-function segmentHTMLToShortcodeBlock(HTML) {
- var lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- // Get all matches.
- var transformsFrom = getBlockTransforms('from');
- var transformation = findTransform(transformsFrom, function (transform) {
- return transform.type === 'shortcode' && Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(transform.tag), function (tag) {
- return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML);
- });
- });
-
- if (!transformation) {
- return [HTML];
- }
-
- var transformTags = Object(external_lodash_["castArray"])(transformation.tag);
- var transformTag = Object(external_lodash_["first"])(transformTags);
- var match;
-
- if (match = Object(external_this_wp_shortcode_["next"])(transformTag, HTML, lastIndex)) {
- var beforeHTML = HTML.substr(0, match.index);
- lastIndex = match.index + match.content.length; // If the shortcode content does not contain HTML and the shortcode is
- // not on a new line (or in paragraph from Markdown converter),
- // consider the shortcode as inline text, and thus skip conversion for
- // this segment.
-
- if (!Object(external_lodash_["includes"])(match.shortcode.content || '', '<') && !/(\n|<p>)\s*$/.test(beforeHTML)) {
- return segmentHTMLToShortcodeBlock(HTML, lastIndex);
- }
-
- var attributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(transformation.attributes, function (schema) {
- return schema.shortcode;
- }), // Passing all of `match` as second argument is intentionally broad
- // but shouldn't be too relied upon.
- //
- // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
- function (schema) {
- return schema.shortcode(match.shortcode.attrs, match);
- });
- var block = createBlock(transformation.blockName, getBlockAttributes(Object(objectSpread["a" /* default */])({}, registration_getBlockType(transformation.blockName), {
- attributes: transformation.attributes
- }), match.shortcode.content, attributes));
- return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex))));
- }
-
- return [HTML];
-}
-
-/* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock);
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js
-/**
- * WordPress dependencies
- */
-
-/**
- * Browser dependencies
- */
-
-var comment_remover_COMMENT_NODE = window.Node.COMMENT_NODE;
-/**
- * Looks for comments, and removes them.
- *
- * @param {Node} node The node to be processed.
- * @return {void}
- */
-
-/* harmony default export */ var comment_remover = (function (node) {
- if (node.nodeType === comment_remover_COMMENT_NODE) {
- Object(external_this_wp_dom_["remove"])(node);
- }
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js
-/**
- * External dependencies
- */
-
-/**
- * Internal dependencies
- */
-
-
-/**
- * Checks if the given node should be considered inline content, optionally
- * depending on a context tag.
- *
- * @param {Node} node Node name.
- * @param {string} contextTag Tag name.
- *
- * @return {boolean} True if the node is inline content, false if nohe.
- */
-
-function isInline(node, contextTag) {
- if (isPhrasingContent(node)) {
- return true;
- }
-
- if (!contextTag) {
- return false;
- }
-
- var tag = node.nodeName.toLowerCase();
- var inlineWhitelistTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']];
- return inlineWhitelistTagGroups.some(function (tagGroup) {
- return Object(external_lodash_["difference"])([tag, contextTag], tagGroup).length === 0;
- });
-}
-
-function deepCheck(nodes, contextTag) {
- return nodes.every(function (node) {
- return isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag);
- });
-}
-
-function isDoubleBR(node) {
- return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR';
-}
-
-/* harmony default export */ var is_inline_content = (function (HTML, contextTag) {
- var doc = document.implementation.createHTMLDocument('');
- doc.body.innerHTML = HTML;
- var nodes = Array.from(doc.body.children);
- return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js
-/**
- * WordPress dependencies
- */
-
-/* harmony default export */ var phrasing_content_reducer = (function (node, doc) {
- // In jsdom-jscore, 'node.style' can be null.
- // TODO: Explore fixing this by patching jsdom-jscore.
- if (node.nodeName === 'SPAN' && node.style) {
- var _node$style = node.style,
- fontWeight = _node$style.fontWeight,
- fontStyle = _node$style.fontStyle,
- textDecorationLine = _node$style.textDecorationLine,
- verticalAlign = _node$style.verticalAlign;
-
- if (fontWeight === 'bold' || fontWeight === '700') {
- Object(external_this_wp_dom_["wrap"])(doc.createElement('strong'), node);
- }
-
- if (fontStyle === 'italic') {
- Object(external_this_wp_dom_["wrap"])(doc.createElement('em'), node);
- }
-
- if (textDecorationLine === 'line-through') {
- Object(external_this_wp_dom_["wrap"])(doc.createElement('s'), node);
- }
-
- if (verticalAlign === 'super') {
- Object(external_this_wp_dom_["wrap"])(doc.createElement('sup'), node);
- } else if (verticalAlign === 'sub') {
- Object(external_this_wp_dom_["wrap"])(doc.createElement('sub'), node);
- }
- } else if (node.nodeName === 'B') {
- node = Object(external_this_wp_dom_["replaceTag"])(node, 'strong');
- } else if (node.nodeName === 'I') {
- node = Object(external_this_wp_dom_["replaceTag"])(node, 'em');
- } else if (node.nodeName === 'A') {
- // In jsdom-jscore, 'node.target' can be null.
- // TODO: Explore fixing this by patching jsdom-jscore.
- if (node.target && node.target.toLowerCase() === '_blank') {
- node.rel = 'noreferrer noopener';
- } else {
- node.removeAttribute('target');
- node.removeAttribute('rel');
- }
- }
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js
-/* harmony default export */ var head_remover = (function (node) {
- if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') {
- return;
- }
-
- node.parentNode.removeChild(node);
-});
-
-// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js
-/**
- * Browser dependencies
- */
-var _window = window,
- ms_list_converter_parseInt = _window.parseInt;
-
-function ms_list_converter_isList(node) {
- return node.nodeName === 'OL' || node.nodeName === 'UL';
-}
-
-/* harmony default export */ var ms_list_converter = (function (node, doc) {
- if (node.nodeName !== 'P') {
- return;
- }
-
- var style = node.getAttribute('style');
-
- if (!style) {
- return;
- } // Quick check.
-
-
- if (style.indexOf('mso-list') === -1) {
- return;
- }
-
- var matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
-
- if (!matches) {
- return;
- }
-
- var level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0;
- var prevNode = node.previousElementSibling; // Add new list if no previous.
-
- if (!prevNode || !ms_list_converter_isList(prevNode)) {
- // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type.
- var type = node.textContent.trim().slice(0, 1);
- var isNumeric = /[1iIaA]/.test(type);
- var newListNode = doc.createElement(isNumeric ? 'ol' : 'ul');
-
- if (isNumeric) {
- newListNode.setAttribute('type', type);
- }
-
- node.parentNode.insertBefore(newListNode, node);
- }
-
- var listNode = node.previousElementSibling;
- var listType = listNode.nodeName;
- var listItem = doc.createElement('li');
- var receivingNode = listNode; // Remove the first span with list info.
-
- node.removeChild(node.firstElementChild); // Add content.
-
- while (node.firstChild) {
- listItem.appendChild(node.firstChild);
- } // Change pointer depending on indentation level.
-
-
- while (level--) {
- receivingNode = receivingNode.lastElementChild || receivingNode; // If it's a list, move pointer to the last item.
-
- if (ms_list_converter_isList(receivingNode)) {
- receivingNode = receivingNode.lastElementChild || receivingNode;
- }
- } // Make sure we append to a list.
-
-
- if (!ms_list_converter_isList(receivingNode)) {
- receivingNode = receivingNode.appendChild(doc.createElement(listType));
- } // Append the list item to the list.
-
-
- receivingNode.appendChild(listItem); // Remove the wrapper paragraph.
-
- node.parentNode.removeChild(node);
-});
+}
// EXTERNAL MODULE: external {"this":["wp","blob"]}
-var external_this_wp_blob_ = __webpack_require__(35);
+var external_this_wp_blob_ = __webpack_require__(44);
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js
@@ -10733,7 +11797,7 @@
var image_corrector_window = window,
atob = image_corrector_window.atob,
File = image_corrector_window.File;
-/* harmony default export */ var image_corrector = (function (node) {
+function imageCorrector(node) {
if (node.nodeName !== 'IMG') {
return;
}
@@ -10784,10 +11848,216 @@
if (node.height === 1 || node.width === 1) {
node.parentNode.removeChild(node);
}
-});
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js
+/**
+ * Internal dependencies
+ */
+
+function blockquoteNormaliser(node) {
+ if (node.nodeName !== 'BLOCKQUOTE') {
+ return;
+ }
+
+ node.innerHTML = normaliseBlocks(node.innerHTML);
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js
+/**
+ * External dependencies
+ */
+
+/**
+ * Internal dependencies
+ */
+
+
+/**
+ * Whether or not the given node is figure content.
+ *
+ * @param {Node} node The node to check.
+ * @param {Object} schema The schema to use.
+ *
+ * @return {boolean} True if figure content, false if not.
+ */
+
+function isFigureContent(node, schema) {
+ var tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding
+ // `figcaption` and any phrasing content.
+
+ if (tag === 'figcaption' || isTextContent(node)) {
+ return false;
+ }
+
+ return Object(external_this_lodash_["has"])(schema, ['figure', 'children', tag]);
+}
+/**
+ * Whether or not the given node can have an anchor.
+ *
+ * @param {Node} node The node to check.
+ * @param {Object} schema The schema to use.
+ *
+ * @return {boolean} True if it can, false if not.
+ */
+
+
+function canHaveAnchor(node, schema) {
+ var tag = node.nodeName.toLowerCase();
+ return Object(external_this_lodash_["has"])(schema, ['figure', 'children', 'a', 'children', tag]);
+}
+/**
+ * Wraps the given element in a figure element.
+ *
+ * @param {Element} element The element to wrap.
+ * @param {Element} beforeElement The element before which to place the figure.
+ */
+
+
+function wrapFigureContent(element) {
+ var beforeElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : element;
+ var figure = element.ownerDocument.createElement('figure');
+ beforeElement.parentNode.insertBefore(figure, beforeElement);
+ figure.appendChild(element);
+}
+/**
+ * This filter takes figure content out of paragraphs, wraps it in a figure
+ * element, and moves any anchors with it if needed.
+ *
+ * @param {Node} node The node to filter.
+ * @param {Document} doc The document of the node.
+ * @param {Object} schema The schema to use.
+ *
+ * @return {void}
+ */
+
+
+function figureContentReducer(node, doc, schema) {
+ if (!isFigureContent(node, schema)) {
+ return;
+ }
+
+ var nodeToInsert = node;
+ var parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with
+ // only the figure content, take the anchor out instead of just the content.
+
+ if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) {
+ nodeToInsert = node.parentNode;
+ }
+
+ var wrapper = nodeToInsert.closest('p,div'); // If wrapped in a paragraph or div, only extract if it's aligned or if
+ // there is no text content.
+ // Otherwise, if directly at the root, wrap in a figure element.
+
+ if (wrapper) {
+ // In jsdom-jscore, 'node.classList' can be undefined.
+ // In this case, default to extract as it offers a better UI experience on mobile.
+ if (!node.classList) {
+ wrapFigureContent(nodeToInsert, wrapper);
+ } else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) {
+ wrapFigureContent(nodeToInsert, wrapper);
+ }
+ } else if (nodeToInsert.parentNode.nodeName === 'BODY') {
+ wrapFigureContent(nodeToInsert);
+ }
+}
+
+// EXTERNAL MODULE: external {"this":["wp","shortcode"]}
+var external_this_wp_shortcode_ = __webpack_require__(125);
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js
+
+
+
+function shortcode_converter_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function shortcode_converter_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { shortcode_converter_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { shortcode_converter_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
+/**
+ * External dependencies
+ */
+
+/**
+ * WordPress dependencies
+ */
+
+
+/**
+ * Internal dependencies
+ */
+
+
+
+
+
+function segmentHTMLToShortcodeBlock(HTML) {
+ var lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ var excludedBlockNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
+ // Get all matches.
+ var transformsFrom = getBlockTransforms('from');
+ var transformation = findTransform(transformsFrom, function (transform) {
+ return excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(transform.tag), function (tag) {
+ return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML);
+ });
+ });
+
+ if (!transformation) {
+ return [HTML];
+ }
+
+ var transformTags = Object(external_this_lodash_["castArray"])(transformation.tag);
+ var transformTag = Object(external_this_lodash_["find"])(transformTags, function (tag) {
+ return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML);
+ });
+ var match;
+ var previousIndex = lastIndex;
+
+ if (match = Object(external_this_wp_shortcode_["next"])(transformTag, HTML, lastIndex)) {
+ lastIndex = match.index + match.content.length;
+ var beforeHTML = HTML.substr(0, match.index);
+ var afterHTML = HTML.substr(lastIndex); // If the shortcode content does not contain HTML and the shortcode is
+ // not on a new line (or in paragraph from Markdown converter),
+ // consider the shortcode as inline text, and thus skip conversion for
+ // this segment.
+
+ if (!Object(external_this_lodash_["includes"])(match.shortcode.content || '', '<') && !(/(\n|<p>)\s*$/.test(beforeHTML) && /^\s*(\n|<\/p>)/.test(afterHTML))) {
+ return segmentHTMLToShortcodeBlock(HTML, lastIndex);
+ } // If a transformation's `isMatch` predicate fails for the inbound
+ // shortcode, try again by excluding the current block type.
+ //
+ // This is the only call to `segmentHTMLToShortcodeBlock` that should
+ // ever carry over `excludedBlockNames`. Other calls in the module
+ // should skip that argument as a way to reset the exclusion state, so
+ // that one `isMatch` fail in an HTML fragment doesn't prevent any
+ // valid matches in subsequent fragments.
+
+
+ if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) {
+ return segmentHTMLToShortcodeBlock(HTML, previousIndex, [].concat(Object(toConsumableArray["a" /* default */])(excludedBlockNames), [transformation.blockName]));
+ }
+
+ var attributes = Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pickBy"])(transformation.attributes, function (schema) {
+ return schema.shortcode;
+ }), // Passing all of `match` as second argument is intentionally broad
+ // but shouldn't be too relied upon.
+ //
+ // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
+ function (schema) {
+ return schema.shortcode(match.shortcode.attrs, match);
+ });
+ var block = createBlock(transformation.blockName, getBlockAttributes(shortcode_converter_objectSpread({}, registration_getBlockType(transformation.blockName), {
+ attributes: transformation.attributes
+ }), match.shortcode.content, attributes));
+ return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex))));
+ }
+
+ return [HTML];
+}
+
+/* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock);
// EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js
-var showdown = __webpack_require__(206);
+var showdown = __webpack_require__(269);
var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown);
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js
@@ -10830,45 +12100,158 @@
*/
-/* harmony default export */ var markdown_converter = (function (text) {
+function markdownConverter(text) {
return converter.makeHtml(slackMarkdownVariantCorrector(text));
-});
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js
/**
- * WordPress dependencies
- */
-
-/**
* Removes iframes.
*
* @param {Node} node The node to check.
*
* @return {void}
*/
-
-/* harmony default export */ var iframe_remover = (function (node) {
+function iframeRemover(node) {
if (node.nodeName === 'IFRAME') {
- Object(external_this_wp_dom_["remove"])(node);
- }
-});
+ var text = node.ownerDocument.createTextNode(node.src);
+ node.parentNode.replaceChild(text, node);
+ }
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js
/**
* WordPress dependencies
*/
-/* harmony default export */ var google_docs_uid_remover = (function (node) {
+function googleDocsUIdRemover(node) {
if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) {
return;
}
Object(external_this_wp_dom_["unwrap"])(node);
-});
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-formatting-remover.js
+/**
+ * Internal dependencies
+ */
+
+
+function isFormattingSpace(character) {
+ return character === ' ' || character === '\r' || character === '\n' || character === '\t';
+}
+/**
+ * Removes spacing that formats HTML.
+ *
+ * @see https://www.w3.org/TR/css-text-3/#white-space-processing
+ *
+ * @param {Node} node The node to be processed.
+ * @return {void}
+ */
+
+
+function htmlFormattingRemover(node) {
+ if (node.nodeType !== node.TEXT_NODE) {
+ return;
+ } // Ignore pre content. Note that this does not use Element#closest due to
+ // a combination of (a) node may not be Element and (b) node.parentElement
+ // does not have full support in all browsers (Internet Exporer).
+ //
+ // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility
+
+ /** @type {Node?} */
+
+
+ var parent = node;
+
+ while (parent = parent.parentNode) {
+ if (parent.nodeType === window.Node.ELEMENT_NODE && parent.nodeName === 'PRE') {
+ return;
+ }
+ } // First, replace any sequence of HTML formatting space with a single space.
+
+
+ var newData = node.data.replace(/[ \r\n\t]+/g, ' '); // Remove the leading space if the text element is at the start of a block,
+ // is preceded by a line break element, or has a space in the previous
+ // node.
+
+ if (newData[0] === ' ') {
+ var previousSibling = getSibling(node, 'previous');
+
+ if (!previousSibling || previousSibling.nodeName === 'BR' || previousSibling.textContent.slice(-1) === ' ') {
+ newData = newData.slice(1);
+ }
+ } // Remove the trailing space if the text element is at the end of a block,
+ // is succeded by a line break element, or has a space in the next text
+ // node.
+
+
+ if (newData[newData.length - 1] === ' ') {
+ var nextSibling = getSibling(node, 'next');
+
+ if (!nextSibling || nextSibling.nodeName === 'BR' || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) {
+ newData = newData.slice(0, -1);
+ }
+ } // If there's no data left, remove the node, so `previousSibling` stays
+ // accurate. Otherwise, update the node data.
+
+
+ if (!newData) {
+ node.parentNode.removeChild(node);
+ } else {
+ node.data = newData;
+ }
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/br-remover.js
+/**
+ * Internal dependencies
+ */
+
+/**
+ * Removes trailing br elements from text-level content.
+ *
+ * @param {Element} node Node to check.
+ */
+
+function brRemover(node) {
+ if (node.nodeName !== 'BR') {
+ return;
+ }
+
+ if (getSibling(node, 'next')) {
+ return;
+ }
+
+ node.parentNode.removeChild(node);
+}
+
+// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/empty-paragraph-remover.js
+/**
+ * Removes empty paragraph elements.
+ *
+ * @param {Element} node Node to check.
+ */
+function emptyParagraphRemover(node) {
+ if (node.nodeName !== 'P') {
+ return;
+ }
+
+ if (node.hasChildNodes()) {
+ return;
+ }
+
+ node.parentNode.removeChild(node);
+}
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js
+function paste_handler_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function paste_handler_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { paste_handler_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { paste_handler_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -10897,6 +12280,10 @@
+
+
+
+
/**
* Browser dependencies
*/
@@ -10912,20 +12299,21 @@
*/
function filterInlineHTML(HTML) {
- HTML = deepFilterHTML(HTML, [google_docs_uid_remover, phrasing_content_reducer, comment_remover]);
- HTML = removeInvalidHTML(HTML, getPhrasingContentSchema(), {
+ HTML = deepFilterHTML(HTML, [googleDocsUIdRemover, phrasingContentReducer, commentRemover]);
+ HTML = removeInvalidHTML(HTML, getPhrasingContentSchema('paste'), {
inline: true
- }); // Allows us to ask for this information when we get a report.
+ });
+ HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); // Allows us to ask for this information when we get a report.
paste_handler_console.log('Processed inline HTML:\n\n', HTML);
return HTML;
}
function getRawTransformations() {
- return Object(external_lodash_["filter"])(getBlockTransforms('from'), {
+ return Object(external_this_lodash_["filter"])(getBlockTransforms('from'), {
type: 'raw'
}).map(function (transform) {
- return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, {
+ return transform.isMatch ? transform : paste_handler_objectSpread({}, transform, {
isMatch: function isMatch(node) {
return transform.selector && node.matches(transform.selector);
}
@@ -10974,14 +12362,14 @@
/**
* Converts an HTML string to known blocks. Strips everything else.
*
- * @param {string} [options.HTML] The HTML to convert.
- * @param {string} [options.plainText] Plain text version.
- * @param {string} [options.mode] Handle content as blocks or inline content.
- * * 'AUTO': Decide based on the content passed.
- * * 'INLINE': Always handle as inline content, and return string.
- * * 'BLOCKS': Always handle as blocks, and return array of blocks.
- * @param {Array} [options.tagName] The tag into which content will be inserted.
- * @param {boolean} [options.canUserUseUnfilteredHTML] Whether or not the user can use unfiltered HTML.
+ * @param {Object} options
+ * @param {string} [options.HTML] The HTML to convert.
+ * @param {string} [options.plainText] Plain text version.
+ * @param {string} [options.mode] Handle content as blocks or inline content.
+ * * 'AUTO': Decide based on the content passed.
+ * * 'INLINE': Always handle as inline content, and return string.
+ * * 'BLOCKS': Always handle as blocks, and return array of blocks.
+ * @param {Array} [options.tagName] The tag into which content will be inserted.
*
* @return {Array|string} A list of blocks or a string, depending on `handlerMode`.
*/
@@ -10994,11 +12382,12 @@
plainText = _ref3$plainText === void 0 ? '' : _ref3$plainText,
_ref3$mode = _ref3.mode,
mode = _ref3$mode === void 0 ? 'AUTO' : _ref3$mode,
- tagName = _ref3.tagName,
- _ref3$canUserUseUnfil = _ref3.canUserUseUnfilteredHTML,
- canUserUseUnfilteredHTML = _ref3$canUserUseUnfil === void 0 ? false : _ref3$canUserUseUnfil;
+ tagName = _ref3.tagName;
// First of all, strip any meta tags.
- HTML = HTML.replace(/<meta[^>]+>/, ''); // If we detect block delimiters in HTML, parse entirely as blocks.
+ HTML = HTML.replace(/<meta[^>]+>/g, ''); // Strip Windows markers.
+
+ HTML = HTML.replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, '');
+ HTML = HTML.replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, ''); // If we detect block delimiters in HTML, parse entirely as blocks.
if (mode !== 'INLINE') {
// Check plain text if there is no HTML.
@@ -11024,7 +12413,7 @@
if (plainText && (!HTML || isPlain(HTML))) {
- HTML = markdown_converter(plainText); // Switch to inline mode if:
+ HTML = markdownConverter(plainText); // Switch to inline mode if:
// * The current mode is AUTO.
// * The original plain text had no line breaks.
// * The original plain text was not an HTML paragraph.
@@ -11047,42 +12436,38 @@
var hasShortcodes = pieces.length > 1;
- if (mode === 'AUTO' && !hasShortcodes && is_inline_content(HTML, tagName)) {
+ if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) {
return filterInlineHTML(HTML);
}
var rawTransforms = getRawTransformations();
- var phrasingContentSchema = getPhrasingContentSchema();
- var blockContentSchema = getBlockContentSchema(rawTransforms);
- var blocks = Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) {
+ var phrasingContentSchema = getPhrasingContentSchema('paste');
+ var blockContentSchema = getBlockContentSchema(rawTransforms, phrasingContentSchema, true);
+ var blocks = Object(external_this_lodash_["compact"])(Object(external_this_lodash_["flatMap"])(pieces, function (piece) {
// Already a block from shortcode.
if (typeof piece !== 'string') {
return piece;
}
- var filters = [google_docs_uid_remover, ms_list_converter, head_remover, list_reducer, image_corrector, phrasing_content_reducer, special_comment_converter, comment_remover, figure_content_reducer, blockquote_normaliser];
-
- if (!canUserUseUnfilteredHTML) {
- // Should run before `figureContentReducer`.
- filters.unshift(iframe_remover);
- }
-
- var schema = Object(objectSpread["a" /* default */])({}, blockContentSchema, phrasingContentSchema);
+ var filters = [googleDocsUIdRemover, msListConverter, headRemover, listReducer, imageCorrector, phrasingContentReducer, specialCommentConverter, commentRemover, iframeRemover, figureContentReducer, blockquoteNormaliser];
+
+ var schema = paste_handler_objectSpread({}, blockContentSchema, {}, phrasingContentSchema);
piece = deepFilterHTML(piece, filters, blockContentSchema);
piece = removeInvalidHTML(piece, schema);
- piece = normalise_blocks(piece); // Allows us to ask for this information when we get a report.
+ piece = normaliseBlocks(piece);
+ piece = deepFilterHTML(piece, [htmlFormattingRemover, brRemover, emptyParagraphRemover], blockContentSchema); // Allows us to ask for this information when we get a report.
paste_handler_console.log('Processed HTML piece:\n\n', piece);
return htmlToBlocks({
html: piece,
rawTransforms: rawTransforms
});
- })); // If we're allowed to return inline content and there is only one block
+ })); // If we're allowed to return inline content, and there is only one inlineable block,
// and the original plain text content does not have any line breaks, then
// treat it as inline paste.
- if (mode === 'AUTO' && blocks.length === 1) {
+ if (mode === 'AUTO' && blocks.length === 1 && registration_hasBlockSupport(blocks[0].name, '__unstablePasteTextInline', false)) {
var trimmedPlainText = plainText.trim();
if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) {
@@ -11096,6 +12481,10 @@
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js
+function raw_handling_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function raw_handling_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { raw_handling_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { raw_handling_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -11116,11 +12505,12 @@
+
function raw_handling_getRawTransformations() {
- return Object(external_lodash_["filter"])(getBlockTransforms('from'), {
+ return Object(external_this_lodash_["filter"])(getBlockTransforms('from'), {
type: 'raw'
}).map(function (transform) {
- return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, {
+ return transform.isMatch ? transform : raw_handling_objectSpread({}, transform, {
isMatch: function isMatch(node) {
return transform.selector && node.matches(transform.selector);
}
@@ -11169,6 +12559,7 @@
/**
* Converts an HTML string to known blocks.
*
+ * @param {Object} $1
* @param {string} $1.HTML The HTML to convert.
*
* @return {Array} A list of blocks.
@@ -11188,8 +12579,9 @@
var pieces = shortcode_converter(HTML);
var rawTransforms = raw_handling_getRawTransformations();
- var blockContentSchema = getBlockContentSchema(rawTransforms);
- return Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) {
+ var phrasingContentSchema = getPhrasingContentSchema();
+ var blockContentSchema = getBlockContentSchema(rawTransforms, phrasingContentSchema);
+ return Object(external_this_lodash_["compact"])(Object(external_this_lodash_["flatMap"])(pieces, function (piece) {
// Already a block from shortcode.
if (typeof piece !== 'string') {
return piece;
@@ -11199,13 +12591,13 @@
var filters = [// Needed to adjust invalid lists.
- list_reducer, // Needed to create more and nextpage blocks.
- special_comment_converter, // Needed to create media blocks.
- figure_content_reducer, // Needed to create the quote block, which cannot handle text
+ listReducer, // Needed to create more and nextpage blocks.
+ specialCommentConverter, // Needed to create media blocks.
+ figureContentReducer, // Needed to create the quote block, which cannot handle text
// without wrapper paragraphs.
- blockquote_normaliser];
+ blockquoteNormaliser];
piece = deepFilterHTML(piece, filters, blockContentSchema);
- piece = normalise_blocks(piece);
+ piece = normaliseBlocks(piece);
return raw_handling_htmlToBlocks({
html: piece,
rawTransforms: rawTransforms
@@ -11218,10 +12610,12 @@
* WordPress dependencies
*/
+/** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */
+
/**
* Returns all the block categories.
*
- * @return {Object[]} Block categories.
+ * @return {WPBlockCategory[]} Block categories.
*/
function categories_getCategories() {
@@ -11230,7 +12624,7 @@
/**
* Sets the block categories.
*
- * @param {Object[]} categories Block categories.
+ * @param {WPBlockCategory[]} categories Block categories.
*/
function categories_setCategories(categories) {
@@ -11239,8 +12633,9 @@
/**
* Updates a category.
*
- * @param {string} slug Block category slug.
- * @param {Object} category Object containing the category properties that should be updated.
+ * @param {string} slug Block category slug.
+ * @param {WPBlockCategory} category Object containing the category properties
+ * that should be updated.
*/
function categories_updateCategory(slug, category) {
@@ -11251,6 +12646,10 @@
+function templates_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
+
+function templates_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { templates_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { templates_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
+
/**
* External dependencies
*/
@@ -11278,7 +12677,7 @@
function doBlocksMatchTemplate() {
var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- return blocks.length === template.length && Object(external_lodash_["every"])(template, function (_ref, index) {
+ return blocks.length === template.length && Object(external_this_lodash_["every"])(template, function (_ref, index) {
var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 3),
name = _ref2[0],
innerBlocksTemplate = _ref2[2];
@@ -11310,7 +12709,7 @@
return blocks;
}
- return Object(external_lodash_["map"])(template, function (_ref3, index) {
+ return Object(external_this_lodash_["map"])(template, function (_ref3, index) {
var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 3),
name = _ref4[0],
attributes = _ref4[1],
@@ -11320,7 +12719,7 @@
if (block && block.name === name) {
var innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate);
- return Object(objectSpread["a" /* default */])({}, block, {
+ return templates_objectSpread({}, block, {
innerBlocks: innerBlocks
});
} // To support old templates that were using the "children" format
@@ -11331,21 +12730,21 @@
var blockType = registration_getBlockType(name);
var isHTMLAttribute = function isHTMLAttribute(attributeDefinition) {
- return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'html';
+ return Object(external_this_lodash_["get"])(attributeDefinition, ['source']) === 'html';
};
var isQueryAttribute = function isQueryAttribute(attributeDefinition) {
- return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'query';
+ return Object(external_this_lodash_["get"])(attributeDefinition, ['source']) === 'query';
};
var normalizeAttributes = function normalizeAttributes(schema, values) {
- return Object(external_lodash_["mapValues"])(values, function (value, key) {
+ return Object(external_this_lodash_["mapValues"])(values, function (value, key) {
return normalizeAttribute(schema[key], value);
});
};
var normalizeAttribute = function normalizeAttribute(definition, value) {
- if (isHTMLAttribute(definition) && Object(external_lodash_["isArray"])(value)) {
+ if (isHTMLAttribute(definition) && Object(external_this_lodash_["isArray"])(value)) {
// Introduce a deprecated call at this point
// When we're confident that "children" format should be removed from the templates.
return Object(external_this_wp_element_["renderToString"])(value);
@@ -11360,7 +12759,7 @@
return value;
};
- var normalizedAttributes = normalizeAttributes(Object(external_lodash_["get"])(blockType, ['attributes'], {}), attributes);
+ var normalizedAttributes = normalizeAttributes(Object(external_this_lodash_["get"])(blockType, ['attributes'], {}), attributes);
return createBlock(name, normalizedAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate));
});
}
@@ -11379,55 +12778,6 @@
// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js
-/* concated harmony reexport createBlock */__webpack_require__.d(__webpack_exports__, "createBlock", function() { return createBlock; });
-/* concated harmony reexport cloneBlock */__webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return cloneBlock; });
-/* concated harmony reexport getPossibleBlockTransformations */__webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return getPossibleBlockTransformations; });
-/* concated harmony reexport switchToBlockType */__webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return switchToBlockType; });
-/* concated harmony reexport getBlockTransforms */__webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return getBlockTransforms; });
-/* concated harmony reexport findTransform */__webpack_require__.d(__webpack_exports__, "findTransform", function() { return findTransform; });
-/* concated harmony reexport parse */__webpack_require__.d(__webpack_exports__, "parse", function() { return parser; });
-/* concated harmony reexport getBlockAttributes */__webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return getBlockAttributes; });
-/* concated harmony reexport parseWithAttributeSchema */__webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return parseWithAttributeSchema; });
-/* concated harmony reexport pasteHandler */__webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return pasteHandler; });
-/* concated harmony reexport rawHandler */__webpack_require__.d(__webpack_exports__, "rawHandler", function() { return rawHandler; });
-/* concated harmony reexport getPhrasingContentSchema */__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return getPhrasingContentSchema; });
-/* concated harmony reexport serialize */__webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; });
-/* concated harmony reexport getBlockContent */__webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return getBlockContent; });
-/* concated harmony reexport getBlockDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return getBlockDefaultClassName; });
-/* concated harmony reexport getBlockMenuDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return getBlockMenuDefaultClassName; });
-/* concated harmony reexport getSaveElement */__webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return getSaveElement; });
-/* concated harmony reexport getSaveContent */__webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return getSaveContent; });
-/* concated harmony reexport isValidBlockContent */__webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return isValidBlockContent; });
-/* concated harmony reexport getCategories */__webpack_require__.d(__webpack_exports__, "getCategories", function() { return categories_getCategories; });
-/* concated harmony reexport setCategories */__webpack_require__.d(__webpack_exports__, "setCategories", function() { return categories_setCategories; });
-/* concated harmony reexport updateCategory */__webpack_require__.d(__webpack_exports__, "updateCategory", function() { return categories_updateCategory; });
-/* concated harmony reexport registerBlockType */__webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return registerBlockType; });
-/* concated harmony reexport unregisterBlockType */__webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return unregisterBlockType; });
-/* concated harmony reexport setFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return setFreeformContentHandlerName; });
-/* concated harmony reexport getFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return getFreeformContentHandlerName; });
-/* concated harmony reexport setUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return setUnregisteredTypeHandlerName; });
-/* concated harmony reexport getUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return getUnregisteredTypeHandlerName; });
-/* concated harmony reexport setDefaultBlockName */__webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return registration_setDefaultBlockName; });
-/* concated harmony reexport getDefaultBlockName */__webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return registration_getDefaultBlockName; });
-/* concated harmony reexport getBlockType */__webpack_require__.d(__webpack_exports__, "getBlockType", function() { return registration_getBlockType; });
-/* concated harmony reexport getBlockTypes */__webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return registration_getBlockTypes; });
-/* concated harmony reexport getBlockSupport */__webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return registration_getBlockSupport; });
-/* concated harmony reexport hasBlockSupport */__webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return registration_hasBlockSupport; });
-/* concated harmony reexport isReusableBlock */__webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return isReusableBlock; });
-/* concated harmony reexport getChildBlockNames */__webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return registration_getChildBlockNames; });
-/* concated harmony reexport hasChildBlocks */__webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return registration_hasChildBlocks; });
-/* concated harmony reexport hasChildBlocksWithInserterSupport */__webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return registration_hasChildBlocksWithInserterSupport; });
-/* concated harmony reexport unstable__bootstrapServerSideBlockDefinitions */__webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return unstable__bootstrapServerSideBlockDefinitions; });
-/* concated harmony reexport registerBlockStyle */__webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return registration_registerBlockStyle; });
-/* concated harmony reexport unregisterBlockStyle */__webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return registration_unregisterBlockStyle; });
-/* concated harmony reexport isUnmodifiedDefaultBlock */__webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return isUnmodifiedDefaultBlock; });
-/* concated harmony reexport normalizeIconObject */__webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return normalizeIconObject; });
-/* concated harmony reexport isValidIcon */__webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return isValidIcon; });
-/* concated harmony reexport doBlocksMatchTemplate */__webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return doBlocksMatchTemplate; });
-/* concated harmony reexport synchronizeBlocksWithTemplate */__webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return synchronizeBlocksWithTemplate; });
-/* concated harmony reexport children */__webpack_require__.d(__webpack_exports__, "children", function() { return api_children; });
-/* concated harmony reexport node */__webpack_require__.d(__webpack_exports__, "node", function() { return api_node; });
-/* concated harmony reexport withBlockContentContext */__webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return withBlockContentContext; });
// A "block" is the abstract term used to describe units of markup that,
// when composed together, form the content or layout of a page.
// The API for blocks is exposed via `wp.blocks`.
@@ -11448,36 +12798,43 @@
/***/ }),
-/***/ 37:
+/***/ 5:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
-function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+
+ return obj;
}
/***/ }),
-/***/ 38:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
-function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
-}
+/***/ 6:
+/***/ (function(module, exports) {
+
+(function() { module.exports = this["wp"]["primitives"]; }());
/***/ }),
-/***/ 42:
+/***/ 64:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["isShallowEqual"]; }());
/***/ }),
-/***/ 45:
+/***/ 66:
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.1
@@ -12678,190 +14035,42 @@
/***/ }),
-/***/ 5:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["data"]; }());
-
-/***/ }),
-
-/***/ 57:
+/***/ 75:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["htmlEntities"]; }());
/***/ }),
-/***/ 6:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["compose"]; }());
-
-/***/ }),
-
-/***/ 65:
-/***/ (function(module, exports, __webpack_require__) {
-
-var rng = __webpack_require__(87);
-var bytesToUuid = __webpack_require__(88);
-
-function v4(options, buf, offset) {
- var i = buf && offset || 0;
-
- if (typeof(options) == 'string') {
- buf = options === 'binary' ? new Array(16) : null;
- options = null;
- }
- options = options || {};
-
- var rnds = options.random || (options.rng || rng)();
-
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
-
- // Copy bytes to buffer, if provided
- if (buf) {
- for (var ii = 0; ii < 16; ++ii) {
- buf[i + ii] = rnds[ii];
- }
- }
-
- return buf || bytesToUuid(rnds);
-}
-
-module.exports = v4;
-
-
-/***/ }),
-
-/***/ 66:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["wp"]["autop"]; }());
-
-/***/ }),
-
-/***/ 7:
+/***/ 8:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
-/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
-
-function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
-
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
-
- ownKeys.forEach(function (key) {
- Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
- });
- }
-
- return target;
-}
-
-/***/ }),
-
-/***/ 87:
-/***/ (function(module, exports) {
-
-// Unique ID creation requires a high quality random # generator. In the
-// browser this is a little complicated due to unknown quality of Math.random()
-// and inconsistent support for the `crypto` API. We do the best we can via
-// feature-detection
-
-// getRandomValues needs to be invoked in a context where "this" is a Crypto
-// implementation. Also, find the complete implementation of crypto on IE11.
-var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
- (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
-
-if (getRandomValues) {
- // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
- var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
-
- module.exports = function whatwgRNG() {
- getRandomValues(rnds8);
- return rnds8;
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
+function _extends() {
+ _extends = Object.assign || function (target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+
+ for (var key in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
+ target[key] = source[key];
+ }
+ }
+ }
+
+ return target;
};
-} else {
- // Math.random()-based (RNG)
- //
- // If all else fails, use Math.random(). It's fast, but is of unspecified
- // quality.
- var rnds = new Array(16);
-
- module.exports = function mathRNG() {
- for (var i = 0, r; i < 16; i++) {
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
- rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
- }
-
- return rnds;
- };
-}
-
-
-/***/ }),
-
-/***/ 88:
-/***/ (function(module, exports) {
-
-/**
- * Convert array of 16 byte values to UUID string format of the form:
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
- */
-var byteToHex = [];
-for (var i = 0; i < 256; ++i) {
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
-}
-
-function bytesToUuid(buf, offset) {
- var i = offset || 0;
- var bth = byteToHex;
- // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
- return ([bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]]]).join('');
-}
-
-module.exports = bytesToUuid;
-
+
+ return _extends.apply(this, arguments);
+}
/***/ }),
/***/ 9:
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
-function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
-}
-
-function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
-}
+/***/ (function(module, exports) {
+
+(function() { module.exports = this["wp"]["compose"]; }());
/***/ })